Skip to content

fix(cli): show help for install, update, uninstall and other action verbs instead of running them - #4767

Merged
thedotmack merged 3 commits into
thedotmack:mainfrom
drakeo338:claude/4764-fix
Oct 15, 2026
Merged

thedotmack merged 3 commits into
thedotmack:mainfrom
drakeo338:claude/4764-fix

Conversation

@drakeo338

Copy link
Copy Markdown
Contributor

Fixes #4764.

npx claude-mem <verb> --help ran the verb. main() dispatched install, update/upgrade and uninstall/remove without looking at the arguments that follow them. repair, prune, start, stop and restart did the same, and prune --help deletes old cache versions, which is the breakage the issue describes.

For those verbs, a trailing -h or --help now prints the usage text and exits 0 before anything runs. Commands that parse their own arguments (server, telemetry, search, pi, kimi, …) are unchanged.

Tests: tests/npx-cli/subcommand-help.test.ts runs each verb with --help and -h against a bundled CLI in an isolated HOME. It checks for exit 0, the help text, no command output and an untouched HOME. All 20 cases fail on main and pass here. bun test tests/npx-cli (199 tests) and tsc --noEmit pass.

Prepared with an AI coding assistant; I reviewed and ran the checks above.

…erbs instead of running them (thedotmack#4764)

npx claude-mem uninstall --help ran the uninstall. The main() switch sent
install, update, upgrade, uninstall and remove straight to their commands
and ignored a trailing -h/--help, and so did repair, prune, start, stop and
restart (prune --help deleted old cache versions). Print the usage text and
exit 0 for those verbs when either flag follows them.

The test bundles the CLI into a package-shaped temp dir because printHelp()
resolves the package version relative to dist/npx-cli/, which fails when
the TypeScript source is run directly.
@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes are safe to merge: help requests return before action commands load or run, and the regression tests isolate installation paths from the developer's environment.

Summary

Action commands now print help and return before running when a trailing argument is -h or --help.

  • Action verbs show help before running when either help flag follows.

No blocking issues remain in the reviewed changes.

Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

Comment thread tests/npx-cli/subcommand-help.test.ts Resolved
Point CLAUDE_CONFIG_DIR at the temp home, drop inherited
CLAUDE_MEM_WORKER_SCRIPT_PATH and CLAUDE_PLUGIN_ROOT so a regression can
never reach a developer's real install, and disable Bun's transpiler cache
so it does not write ~/Library/Caches/bun into the checked home on macOS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019t4K26AgEm5awWRyDmNN6m
@thedotmack

Copy link
Copy Markdown
Owner

Thanks @drakeo338, this is a clean fix and the 20 cases that fail on main are great. I pushed one test-only commit to your branch:

  • runCli now points CLAUDE_CONFIG_DIR at the temp home and drops inherited CLAUDE_MEM_WORKER_SCRIPT_PATH / CLAUDE_PLUGIN_ROOT, so if the guard ever regresses, uninstall --help can only touch the temp home, never a developer's real install (Greptile's note).
  • It also sets BUN_RUNTIME_TRANSPILER_CACHE_PATH=0: on macOS, current Bun writes its transpiler cache to ~/Library/Caches/bun, which made the empty-home check fail locally.

I'll land it once main's build fix is in.

@thedotmack
thedotmack merged commit 1df1511 into thedotmack:main Oct 15, 2026
8 checks passed
@thedotmack

Copy link
Copy Markdown
Owner

Merged, thank you @drakeo338! npx claude-mem install --help, uninstall --help and the other action verbs now print help instead of reinstalling, pruning the cache or uninstalling. Your 20 red-on-main cases made this easy to trust. I merged main and added the test-isolation commit described above. It's on main and ships in the next release.

thedotmack pushed a commit that referenced this pull request Nov 2, 2026
)

Follow-up to #4764 (#4767). `npx claude-mem cleanup --help` and
`npx claude-mem adopt --help` ignored the flag and ran the command:
cleanup applied the one-time v12.4.3 purge and wrote its marker, and adopt
stamped merged-worktree observations into the parent project.

Both take only flags, so the worker-service handler read --help as "no
--dry-run" and went ahead. Add them to HELP_AWARE_COMMANDS and to the
subcommand --help test.
thedotmack pushed a commit that referenced this pull request Nov 5, 2026
…5394)

Follow-up to #4767 and #5288. `npx claude-mem kimi uninstall --help`
removed claude-mem's hooks from Kimi's config.toml instead of printing
help, and `telemetry disable --help` turned telemetry off. The same
happened for the install/uninstall verbs of devin, antigravity-cli and
pi, for `memory ingest --help` (the worker ran the real ingest), and for
`project merge`, `backup run`, `restore <file>`, `server`, `worker` and
`transcript watch`.

main() only checks for -h/--help on the commands in HELP_AWARE_COMMANDS,
and the handlers for these commands read their verb and ignore the rest
of the arguments. Add them to the set, and add the missing
`memory ingest` line to the help they now print.

The subcommand --help test covers one verb per command. Its temp home
now also covers %APPDATA% (Devin's config on Windows), KIMI_CODE_HOME,
PI_CODING_AGENT_DIR and the worker port, so a regression cannot reach a
real host config or a running worker.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'install --help' (and update/uninstall --help) runs the command instead of printing help

2 participants