feat: npx claude-mem — unified CLI with 13 IDE integrations#1258
feat: npx claude-mem — unified CLI with 13 IDE integrations#1258thedotmack wants to merge 5 commits intomainfrom
Conversation
…n commands Replaces the old git-clone installer with a direct npm package copy workflow. Supports 13 IDE auto-detection targets, runtime delegation to Bun worker, and pure Node.js install path (no Bun required for installation). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds esbuild steps for npx-cli (57KB, Node.js ESM) and openclaw plugin (12KB). Creates .npmignore to exclude node_modules and Bun binary from npm package, reducing pack size from 146MB to 2MB. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Gemini CLI: platform adapter mapping 6 of 11 hooks, settings.json deep-merge installer, GEMINI.md context injection. OpenCode: plugin with tool.execute.after interceptor, bus events for session lifecycle, claude_mem_search custom tool, AGENTS.md context. Windsurf: platform adapter for tool_info envelope format, hooks.json installer for 5 post-action hooks, .windsurf/rules context injection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codex CLI: transcript-based integration watching ~/.codex/sessions/, schema bumped to v0.3 with exec_command support, AGENTS.md context. OpenClaw: installer wires pre-built plugin to ~/.openclaw/extensions/, registers in openclaw.json with memory slot and sync config. MCP integrations (6 IDEs): Copilot CLI, Antigravity, Goose, Crush, Roo Code, and Warp — config writing + context injection. Goose uses string-based YAML manipulation (no parser dependency). All 13 IDE targets now supported in npx claude-mem install. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Removes installer/ directory (16 files) — fully replaced by src/npx-cli/. Updates install.sh and installer.js to redirect to npx claude-mem. Adds npx claude-mem as primary install method in docs and README. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR successfully replaces the old git-clone installer with a modern NPX CLI and adds support for 13 AI coding tools. The implementation is comprehensive and well-structured. Key Improvements:
Architecture:
Documentation:
The code quality is high with proper error handling, cross-platform support, and well-organized modular structure. All test plan items appear achievable. Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
Start([npx claude-mem install]) --> DetectIDEs[Detect Installed IDEs]
DetectIDEs --> Prompt{Interactive?}
Prompt -->|Yes| MultiSelect[Multi-select IDE Prompt]
Prompt -->|No| DefaultIDE[Default: claude-code]
MultiSelect --> CopyPlugin[Copy Plugin Files to Marketplace]
DefaultIDE --> CopyPlugin
CopyPlugin --> Cache[Cache Plugin Version]
Cache --> RegisterMarket[Register in known-marketplaces.json]
RegisterMarket --> RegisterPlugin[Register in installed-plugins.json]
RegisterPlugin --> EnablePlugin[Enable in Claude Settings]
EnablePlugin --> NpmInstall[Run npm install in Marketplace]
NpmInstall --> SmartInstall[Run smart-install for Bun/uv]
SmartInstall --> IDESetup{IDE Type?}
IDESetup -->|Claude Code| CC[Already Registered]
IDESetup -->|Hook-Based| Hooks[Gemini CLI / Windsurf]
IDESetup -->|Plugin-Based| Plugins[OpenCode / OpenClaw]
IDESetup -->|MCP-Based| MCP[6 MCP Tools]
IDESetup -->|Transcript| Transcript[Codex CLI]
Hooks --> HookInstall[Install Hooks in settings.json + Context MD]
Plugins --> PluginInstall[Copy Pre-built Plugin + Register Config]
MCP --> MCPInstall[Write MCP Config + Context MD]
Transcript --> TranscriptInstall[Configure Transcript Watching]
CC --> Complete[Installation Complete]
HookInstall --> Complete
PluginInstall --> Complete
MCPInstall --> Complete
TranscriptInstall --> Complete
Complete --> Runtime[Runtime Commands Available]
Runtime --> Start[npx claude-mem start/stop/restart/status]
Runtime --> Search[npx claude-mem search query]
Runtime --> Update[npx claude-mem update/uninstall]
Last reviewed commit: cc17786 |
PR Review: feat: npx claude-mem - unified CLI with 13 IDE integrationsThis is a substantial, well-structured refactor. The DX improvement (146MB to 2MB package, single install command) is significant, and the architecture cleanly separates the pure-Node install path from the Bun-dependent runtime path. A few issues worth addressing before merge: Bugs / Correctness1. writeJsonFileAtomic is not atomic (src/npx-cli/utils/paths.ts) The function calls writeFileSync directly, which is not atomic. A crash or power loss mid-write can corrupt ~/.claude/settings.json, installed_plugins.json, or known_marketplaces.json -- files that Claude Code itself reads at startup. The name creates a false sense of safety. Fix: write to a temp file first, then renameSync to the target (rename is atomic on the same filesystem). 2. update command does not actually update (src/npx-cli/index.ts L99-103) update/upgrade just calls runInstallCommand() -- identical to install. A user running npx claude-mem update on an old cached npx installation will silently re-install the same version. Consider checking npm view claude-mem version first, or at minimum printing: run npx claude-mem@latest install to upgrade. 3. Missing await on runtime commands (src/npx-cli/index.ts L123-138) runStartCommand(), runStopCommand(), runRestartCommand(), and runStatusCommand() are called without await inside an async function. They are currently void, so no runtime error today, but this will silently swallow any future async errors. Architecture / Code Quality4. Shared utilities imported from CursorHooksInstaller.ts GeminiCliHooksInstaller.ts, WindsurfHooksInstaller.ts, and McpIntegrations.ts all import helpers (findBunPath, findWorkerServicePath, findMcpServerPath) directly from CursorHooksInstaller.ts. Why does the Gemini installer depend on a Cursor file? These should live in a shared module such as src/services/integrations/shared.ts. 5. Cursor shows in IDE selection but installation is unimplemented (src/npx-cli/commands/install.ts L79-83) A user who selects Cursor only sees a vague coming soon log after completing the install flow. Either mark Cursor as disabled in the clack multi-select (clack supports disabled on options), or remove it from the list until implemented. 6. readJsonFileSafe / writeJsonFileAtomic use untyped any (src/npx-cli/utils/paths.ts) McpIntegrations.ts already has the better pattern with readJsonSafe generic. Apply the same generic approach to the shared path utilities. 7. copyPluginToMarketplace copies the entire package root (src/npx-cli/commands/install.ts) The filter only skips .git and .tgz. The .npmignore rules do not apply to cpSync -- it copies everything on disk. Consider an allowlist filter (plugin/, dist/, package.json, openclaw/) to avoid copying dev artifacts. Security8. Shell injection pattern in isCommandInPath (src/npx-cli/commands/ide-detection.ts L36-41) All callers use hardcoded strings, so no immediate risk. But using a template literal with execSync is unsafe for any future caller that might pass user-controlled input. Prefer spawnSync with an args array instead of a shell string. Minor9. npmPackageRootDirectory() path assumption (src/npx-cli/utils/paths.ts L83-90) Assumes the bundled entry point lives at dist/npx-cli/index.js (2 levels up from import.meta.url). If the output path changes, the install silently copies the wrong directory. An assertion that plugin/ exists at the resolved root would make failures obvious. 10. No install rollback -- if a step fails after the file copy but before registration completes, the user is left in a partially-installed state. A try/finally that cleans up the marketplace dir on error would be safer. What Is Working Well
Overall a solid feature. Priority items before merge: (1) non-atomic writes to Claude config files, (2) update command behavior, (4) CursorHooksInstaller coupling. Generated with Claude Code |
Chriscross475
left a comment
There was a problem hiding this comment.
This PR is too large to review effectively (4902 additions, 5437 deletions, 40+ files changed). It mixes multiple architectural concerns that should be reviewed separately:
Concerns:
- Cannot thoroughly verify correctness across 13 new IDE integrations
- Build pipeline changes (6 esbuild targets) mixed with installer removal
- npm packaging strategy completely overhauled in same PR
- High risk of introducing bugs that would be hard to bisect
- Difficult to revert if issues arise in production
Recommendation:
Break this into smaller PRs:
- PR 1: npm packaging changes (.npmignore, package.json files array, bin entry)
- PR 2: Remove old installer/, add npx-cli/ foundation
- PR 3: Add IDE integrations in groups (hooks-based, plugin-based, MCP-based)
- PR 4: Build pipeline updates
- PR 5: Documentation updates
Each can be reviewed thoroughly, tested independently, and reverted if needed.
If you need to ship urgently:
At minimum, provide:
- Test results for all 13 IDE integrations
- npm pack dry-run output showing 2MB package size
- Verification that old git-clone install path still works during transition period
- Rollback plan if npx install fails for users
|
I don't have to ship immediately, we can test systematically, and do a pre release channel |
OpenCode Integration FindingsHey @thedotmack — I've been testing the OpenCode integration from this branch ( 1. Plugin Hook API MismatchThe plugin at hooks: {
tool: {
execute: {
after: (input, output) => { ... }
}
}
}The current hooks: {
"tool.execute.after": (input, output) => { ... },
"chat.message": (input, output) => { ... }
}The nested form silently fails — hooks never fire, no data is captured. 2. Event Handler Signature ChangeThe plugin uses: event(eventName: string, payload: any)The current SDK uses: event({ event }: { event: Event })Where 3.
|
|
@runzexia please do submit the code! Thank you so much for working that out! :) |
|
@runzexia let me know if you have issues but i think if you fork the repo and work out of this PR you should be able to submit a PR to THIS PR? or the branch? IDK how this would work here 😭 |
Summary
npx claude-membecomes the single install command, replacing the old git-clone installerinstaller/directory removed (16 files, -5431 lines) — fully replaced bysrc/npx-cli/What's New
NPX CLI (
src/npx-cli/)npx claude-mem install— interactive IDE multi-select with auto-detectionnpx claude-mem install --ide <name>— direct IDE setupnpx claude-mem start/stop/restart/status— worker management (delegates to Bun)npx claude-mem search <query>— search memory from terminalnpx claude-mem update/uninstall/version— lifecycle managementIDE Integrations
Build Pipeline
.npmignoreexcludes Bun binary (60MB) and plugin/node_modules (379MB)Test plan
npm run buildproduces all 6 targetsnode dist/npx-cli/index.js --versionprints 10.5.2node dist/npx-cli/index.js --helpshows all commandsnpm pack --dry-runshows ~2MB package sizebun:sqlitein dist/npx-cli/index.js--helpoutput🤖 Generated with Claude Code