feat(cli): add dailybot uninstall command with install-method detection#14
Merged
xergioalex merged 1 commit intomainfrom May 3, 2026
Merged
feat(cli): add dailybot uninstall command with install-method detection#14xergioalex merged 1 commit intomainfrom
dailybot uninstall command with install-method detection#14xergioalex merged 1 commit intomainfrom
Conversation
…tion ## Summary Mirrors the UX of `dailybot upgrade`: one command, auto-detects how the CLI was installed, runs the matching uninstall (pipx / uv tool / pip) or prints the right command for installs we don't own (Homebrew / PyInstaller binary / editable). Conservative-by-default: prompts for confirmation, keeps `~/.config/dailybot/` unless `--purge` is passed, supports `--dry-run` and `--yes` for scripts/CI. ## Change Log - Extracted `_detect_install_method`, `_resolve_install_path`, and the method-label table from `commands/upgrade.py` into a new shared module `dailybot_cli/install_method.py` so both upgrade and uninstall stay in lock-step. Pure refactor of upgrade — its 12 existing tests keep passing without changes. - Added `dailybot_cli/commands/uninstall.py`. Follows the five-step CLI pattern from `docs/CLI_COMMAND_BEST_PRACTICES.md`: print plan, honor `--dry-run`, confirm (default no), execute or print manual command, optionally purge config. Editable installs bail out early — same safety stance `upgrade` takes. - Wired `uninstall` into `main.py` so it shows up under `dailybot --help`. - Added 20 tests in `tests/uninstall_test.py` covering: confirmation flow (decline / `--yes` / `-y` / safe default), every install method dispatch (pipx / uv-tool / pip / homebrew / binary / editable), `--dry-run`, `--purge` with and without an existing config dir, `--purge` for the homebrew path (still wipes config even when delegating package-manager work), subprocess failure exit-code propagation, missing executable fallback, and top-level CLI help integration. - README gets an "Uninstall" section right next to the existing upgrade docs, with the four most common invocations and the default-keeps-config note. - AGENTS.md project structure updated to mention `install_method.py` and `commands/uninstall.py`. ## Risks - Strictly additive: no public API change; `upgrade` behavior is unchanged (its functions are now thin re-exports of the shared module). - `--purge` is opt-in. Default behavior preserves user state, so a reinstall doesn't force re-login. - Subprocess invocations use `argv` lists, never `shell=True`. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
dailybot upgrade. Auto-detects how the CLI was installed and runs the matching uninstall (pipx/uv tool/pip) or prints the right command for installs we don't own (brew uninstall,rm <binary>, editable dev install).-y/--yesto skip), supports--dry-runto preview, and keeps~/.config/dailybot/unless--purgeis passed — so reinstalling later doesn't force a re-login.Why this shape
Best-practice notes that drove the design (see
docs/CLI_COMMAND_BEST_PRACTICES.md):--purgeis opt-in — losing credentials and agent profiles silently is the kind of thing users only notice an hour later. Opt-in beats opt-out.upgradealready takes; we don't want topip uninstallsomeone's working clone out from under them.homebrew/binary— invokingbrew uninstallorrm-ing our own running binary from inside the CLI is a recipe for sudo prompts, file locks, and "the binary disappeared while it was executing" weirdness on macOS/Windows.shell=True— same pattern asupgrade.Change log
dailybot_cli/install_method.py(new) — extracts_detect_install_method,_resolve_install_path, and the method-label table fromcommands/upgrade.py. Bothupgradeanduninstallimport from here so they can never disagree on what they call each install method or where it lives. Pure refactor ofupgrade— its 12 existing tests pass unchanged.dailybot_cli/commands/uninstall.py(new) — follows the five-step CLI pattern: print plan, honor--dry-run, confirm (default no), execute or print manual command, optionally purge config.dailybot_cli/main.py— registers the new top-level command.tests/uninstall_test.py(new) — 20 tests covering: confirmation flow (decline /--yes/-y/ safe default), every install-method dispatch,--dry-run(shouldn't even prompt),--purge(with and without an existing config dir, including the homebrew case where we delegate the package-manager work but still wipe config), subprocess failure exit-code propagation, missing-executable fallback, and top-level help integration.Test plan
ruff check dailybot_cli testscleanruff format --check dailybot_cli testscleanmypy dailybot_clicleanpytest -x— 192 passed (172 existing + 20 new)dailybot uninstall --help— example block renders cleanlydailybot uninstall --dry-runin this editable install — correctly bails out with the editable-refusal message🤖 Generated with Claude Code