fix(cli): print help and require confirmation before destructive uninstall#1040
Open
metehanulusoy wants to merge 1 commit into
Open
fix(cli): print help and require confirmation before destructive uninstall#1040metehanulusoy wants to merge 1 commit into
metehanulusoy wants to merge 1 commit into
Conversation
…stall `uninstall --help` performed a real uninstall: unknown flags were silently ignored by the mutating subcommands, and the agent-config removal and binary deletion ran without any confirmation gate (the only prompt guarded index deletion). - install/uninstall/update now recognize --help/-h and print usage without touching anything - uninstall rejects unknown flags with an error + usage (a typo like `--dryrun` no longer triggers a real uninstall) - uninstall asks for confirmation before removing agent configs and the binary; -y auto-confirms (unchanged for scripts), -n and non-TTY stdin abort. --dry-run skips the prompt as it mutates nothing, keeping `uninstall --dry-run -y` (smoke-test phase 6b) working as before. Fixes DeusData#1038 Signed-off-by: metehanulusoy <ulusoy.metehan03@gmail.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1038
Problem
uninstall --helpperformed a real, destructive uninstall (removed all agent configs, skills, hooks, and deleted the binary, exit 0). Root causes, as detailed in the issue:handle_subcommandinmain.cmatchesuninstallpositionally before the global--helpcheck can see it.cbm_cmd_uninstallsilently ignored unknown flags —--help,-h, or a typo like--dryrunall fell through to a full uninstall.prompt_ynguarded index deletion, so evenuninstall -nremoved everything.Fix
cmd_wants_help()+ per-command usage printers:install,uninstall, andupdatenow print usage and exit 0 on--help/-hwithout touching anything.cbm_cmd_uninstallrejects unknown flags with an error + usage (exit 1).cbm_cmd_uninstallgates the destructive path behindprompt_yn:-yauto-confirms — unchanged behavior for scripts;-naborts (previously it still removed configs and the binary);-yfails closed via the existingprompt_ynerror;--dry-runskips the prompt (mutates nothing), so the existingscripts/smoke-test.shphase 6b invocationuninstall --dry-run -ybehaves exactly as before.No wrapper or script in the repo invokes bare
uninstallnon-interactively (checkedFormula/,pkg/,scripts/,install.sh,install.ps1), so the new prompt breaks no automated path.Behavior after the fix
Tests
Three regression tests in
tests/test_cli.c(run under a tempHOME, using the existingcbm_set_auto_answer_for_testseam):cli_uninstall_help_not_destructive—--helpexits 0 and leaves the fake install untouchedcli_uninstall_unknown_flag_rejected—--dryruntypo exits 1 and leaves files untouchedcli_uninstall_confirmation_gate— declined prompt aborts;-yproceeds and removes the binaryscripts/test.sh(ASan+UBSan) passes locally on macOS arm64.clang-format --dry-runreports zero warnings on both touched files; cppcheck is clean. clang-tidy was not available locally — relying on CI for that layer.🤖 Generated with Claude Code