refactor(worktree): rename destroy to remove - #17
Conversation
…alias Aligns with git's `git worktree remove` verb. The semantics genuinely overlap (both tear down a worktree), so there's no reason for gratuitous divergence. `destroy` remains as a hidden alias for backward compat. Implements [[tasks/meta-63]] Co-authored-by: Claude <claude@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 WalkthroughRenames the worktree subcommand from "destroy" to "remove" while keeping "destroy" as a hidden alias. Updates CLI types, module routing, handler names, help text, ephemeral cleanup behavior, user-facing messages, and the plugin command list accordingly. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryRenames the
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| src/commands/worktree/cli_types.rs | Adds Remove variant to WorktreeCommands enum using existing DestroyArgs, hides Destroy for backward compat. One doc comment still references "destroy". |
| src/commands/worktree/mod.rs | Updates module declaration, dispatch match arm, and help text. One help string ("Atomic create+exec+destroy") was missed in the rename. |
| src/commands/worktree/remove.rs | File renamed from destroy.rs. Function renamed to handle_remove, user-facing message updated to "Removed". No issues found. |
| src/commands/worktree/exec.rs | Updates call from destroy::handle_destroy to remove::handle_remove and user-facing error messages. One verbose message still says "Destroying" instead of "Removing". |
| src/commands/worktree/add.rs | Error hint updated from meta worktree destroy to meta worktree remove. No issues found. |
| src/commands/worktree/create.rs | Error hint updated from meta worktree destroy to meta worktree remove. No issues found. |
| src/main.rs | Registers "git worktree remove" as a new command while retaining "git worktree destroy" for backward compat. No issues found. |
Flowchart
flowchart TD
A["User runs CLI command"] --> B{"Which command?"}
B -->|"meta git worktree remove"| C["WorktreeCommands::Remove(DestroyArgs)"]
B -->|"meta git worktree destroy"| D["WorktreeCommands::Destroy(DestroyArgs)\n(hidden alias)"]
C --> E["remove::handle_remove()"]
D --> E
E --> F["Validate & discover worktree"]
F --> G{"--force or clean?"}
G -->|"dirty without --force"| H["Bail with error"]
G -->|"clean or --force"| I["remove_worktree_repos()"]
I --> J["store_remove() + fire_post_destroy hook"]
J --> K["Print 'Removed worktree'"]
style C fill:#2d6,stroke:#1a4,color:#fff
style D fill:#888,stroke:#666,color:#fff
Last reviewed commit: fa925fa
Additional Comments (3)
This user-facing help string still references "destroy" instead of "remove". Since the rest of the help text was updated (e.g., line 162 and 191), this one appears to have been overlooked.
This doc comment (which clap surfaces in
This user-facing verbose message still says "Destroying" instead of "Removing", inconsistent with the updated messages on lines 67 and 72. Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
Addresses review feedback: three user-facing strings still referenced "destroy" instead of "remove" in ephemeral worktree help/messages. Co-authored-by: Claude <claude@anthropic.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/commands/worktree/exec.rs (1)
46-47: 🧹 Nitpick | 🔵 TrivialConsider updating the doc comment for consistency.
The struct doc comment still says "destroys an ephemeral worktree" while the implementation now uses "remove" terminology. Consider updating to "removes an ephemeral worktree on drop" for internal consistency.
📝 Suggested doc update
-/// RAII guard that destroys an ephemeral worktree on drop. +/// RAII guard that removes an ephemeral worktree on drop. /// Ensures cleanup even if the exec command panics.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/worktree/exec.rs` around lines 46 - 47, Update the struct doc comment for the RAII guard (EphemeralWorktreeGuard) to use "removes an ephemeral worktree on drop" instead of "destroys an ephemeral worktree on drop" so the comment matches the implementation's "remove" terminology; locate the doc comment above the EphemeralWorktreeGuard struct in exec.rs and replace the word "destroys" with "removes" and ensure the rest of the sentence remains consistent (e.g., "Ensures cleanup even if the exec command panics.").
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/commands/worktree/exec.rs`:
- Around line 46-47: Update the struct doc comment for the RAII guard
(EphemeralWorktreeGuard) to use "removes an ephemeral worktree on drop" instead
of "destroys an ephemeral worktree on drop" so the comment matches the
implementation's "remove" terminology; locate the doc comment above the
EphemeralWorktreeGuard struct in exec.rs and replace the word "destroys" with
"removes" and ensure the rest of the sentence remains consistent (e.g., "Ensures
cleanup even if the exec command panics.").
Co-authored-by: Claude <claude@anthropic.com>
Summary
meta git worktree destroytometa git worktree removeto align withgit worktree removedestroyas a hidden alias for backward compatibilityremoveContext
Part of [[tasks/meta-63]] — reviewing
meta git worktreecommand surface againstgit worktreefor naming alignment. The semantics of teardown genuinely overlap between git and meta, so there's no reason for gratuitous divergence.createwas intentionally kept (not renamed toadd) since it describes a richer operation.Test plan
cargo buildcleancargo testall passcargo clippycleanmeta git worktree removeworks end-to-endmeta git worktree destroystill works (hidden alias)🤖 Generated with Claude Code
Summary by CodeRabbit