fix(cli): print help and require confirmation before destructive uninstall#1040
fix(cli): print help and require confirmation before destructive uninstall#1040metehanulusoy 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>
|
Thanks for addressing the destructive uninstall behavior with help, validation, confirmation, and regression tests. This is a high-priority 0.9.1-rc safety fix. The current Ubuntu, macOS, and Windows smoke checks are failing, so those failures need to be resolved before the review can complete; install, update, noninteractive, and dry-run behavior must remain fail-closed. |
|
Good news — the fix itself is correct and complete: The CI red is purely branch staleness, not a bug in your change. I traced the smoke failure: Phase 9 (agent-config uninstall E2E) on your branch calls bare Could you rebase onto current main and push? Once it's green I'll re-diff and merge — this is a high-priority safety fix ( |
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