Skip to content

refactor(worktree): rename destroy to remove - #17

Merged
mateodelnorte merged 4 commits into
mainfrom
worktree-rename-destroy-to-remove
Feb 17, 2026
Merged

mateodelnorte merged 4 commits into
mainfrom
worktree-rename-destroy-to-remove

Conversation

@mateodelnorte

@mateodelnorte mateodelnorte commented Feb 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Renames meta git worktree destroy to meta git worktree remove to align with git worktree remove
  • Keeps destroy as a hidden alias for backward compatibility
  • Updates all user-facing messages (help text, error hints) to reference remove

Context

Part of [[tasks/meta-63]] — reviewing meta git worktree command surface against git worktree for naming alignment. The semantics of teardown genuinely overlap between git and meta, so there's no reason for gratuitous divergence. create was intentionally kept (not renamed to add) since it describes a richer operation.

Test plan

  • cargo build clean
  • cargo test all pass
  • cargo clippy clean
  • meta git worktree remove works end-to-end
  • meta git worktree destroy still works (hidden alias)
  • BATS integration tests (companion PR in meta repo)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Renamed worktree removal wording from "destroy" to "remove" across help text, logs, hints, and error messages; "destroy" kept as a hidden alias for compatibility.
    • Updated ephemeral exec wording from "create+exec+destroy" to "create+exec+remove".
    • Ephemeral cleanup and user guidance now reference removal instead of destruction.
    • Public command list now advertises the new "git worktree remove" subcommand.

…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>
@coderabbitai

coderabbitai Bot commented Feb 17, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉


Walkthrough

Renames 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

Cohort / File(s) Summary
CLI Type Definitions
src/commands/worktree/cli_types.rs
Added Remove(DestroyArgs) variant to WorktreeCommands; kept Destroy as a hidden alias; updated ExecArgs.ephemeral doc comment to reference "remove".
Command Module & Routing
src/commands/worktree/mod.rs
Replaced mod destroy with mod remove; dispatcher now routes WorktreeCommands::Remove(...) and ::Destroy(...) to remove::handle_remove; help text/usage updated from "destroy" → "remove".
Handler Implementation
src/commands/worktree/remove.rs, src/commands/worktree/exec.rs
Renamed handler handle_destroy → handle_remove (crate-visible); exec RAII now calls handle_remove on drop; log and success messages changed from "Destroyed" → "Removed".
User-Facing Messages
src/commands/worktree/add.rs, src/commands/worktree/create.rs
Updated error/guidance strings to recommend meta worktree remove instead of meta worktree destroy.
Plugin Integration
src/main.rs
Added "git worktree remove" to the plugin info.commands list.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through branches, gentle and spry,

swapped "destroy" for "remove" with a wink in my eye.
Old alias tucked in, new label in bloom,
I munched on the prompts and cleared out the room. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and accurately summarizes the main change: renaming the destroy worktree command to remove to align with Git conventions.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch worktree-rename-destroy-to-remove

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Feb 17, 2026

Copy link
Copy Markdown

Greptile Summary

Renames the meta git worktree destroy command to meta git worktree remove to align with git worktree remove, while keeping destroy as a hidden alias for backward compatibility. The rename is implemented cleanly via a new Remove enum variant that shares the existing DestroyArgs type, and the file destroy.rs is renamed to remove.rs.

  • Remove variant added to WorktreeCommands enum; Destroy hidden with #[command(hide = true)]
  • destroy.rs renamed to remove.rs, function renamed handle_destroy → handle_remove
  • User-facing error hints in add.rs and create.rs updated to reference remove
  • "git worktree remove" registered as a new plugin command in main.rs alongside the retained "git worktree destroy"
  • A few user-facing strings were missed in the rename: the --ephemeral help text in mod.rs, the --ephemeral doc comment in cli_types.rs, and a verbose log message in exec.rs still reference "destroy"

Confidence Score: 4/5

  • This PR is safe to merge — it's a straightforward rename with no behavioral changes, and the missed strings are non-blocking style issues.
  • The rename is correctly implemented at the dispatch level (both variants route to the same handler) and backward compatibility is preserved. The only findings are three leftover "destroy" references in user-facing strings, which are cosmetic inconsistencies rather than functional bugs.
  • src/commands/worktree/mod.rs, src/commands/worktree/cli_types.rs, and src/commands/worktree/exec.rs each have one remaining "destroy" reference that should be updated for consistency.

Important Files Changed

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
Loading

Last reviewed commit: fa925fa

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps

greptile-apps Bot commented Feb 17, 2026

Copy link
Copy Markdown
Additional Comments (3)

src/commands/worktree/mod.rs
Missed "destroy" in help text

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.

    let _ = writeln!(w, "  --ephemeral              Atomic create+exec+remove");

src/commands/worktree/cli_types.rs
Missed "destroy" in doc comment

This doc comment (which clap surfaces in --help output) still says "destroy" instead of "remove". For consistency with the rename:

    /// Atomic create+exec+remove (requires --all or --repo, and -- <cmd>)

src/commands/worktree/exec.rs
Missed "Destroying" in verbose message

This user-facing verbose message still says "Destroying" instead of "Removing", inconsistent with the updated messages on lines 67 and 72.

            eprintln!("Removing ephemeral worktree '{}'...", self.name);

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>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🔵 Trivial

Consider 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>
@mateodelnorte
mateodelnorte merged commit c933368 into main Feb 17, 2026
7 checks passed
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.

1 participant