Add git worktree management slash commands#120
Merged
Conversation
Add /worktree-new, /worktree-rm, and /worktree-ls commands for managing parallel development worktrees directly from Claude Code sessions. Each command resolves paths dynamically from the main worktree root, validates input, and handles edge cases (existing branches, uncommitted changes). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Overall assessment:
|
…d brittle parsing - Validate base-ref input (character allowlist + git rev-parse --verify) before shell use - Disallow leading-dash names in worktree-new and worktree-rm to prevent option injection - Add -- separators to git worktree add and git branch -d commands - Switch worktree-ls to --porcelain output for reliable parsing (handles spaces in paths) - Specify exact git command for "use existing branch" path in worktree-new Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Owner
Author
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall assessmentExecutive summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
…t checked-out branches - Step 4: Use `git worktree add -b` when base-ref is provided so the command creates a new branch instead of checking out the ref directly. This avoids detached HEAD for tags/remote refs and failures when the ref is already checked out elsewhere. - Step 3: Before offering to reuse an existing branch, check `git worktree list --porcelain` to detect if the branch is already checked out in another worktree and abort with a clear message. - Step 1: Update base-ref description to say "branch from" instead of "check out". Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Owner
Author
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall assessment: ✅ Looks good Executive summary:
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
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
/worktree-new <name> [base-branch]command to create isolated worktrees with full dev environment (venv, deps, Rust backend)/worktree-rm <name>command to safely remove worktrees with uncommitted-change checks and branch cleanup/worktree-lscommand to list all active worktrees with status infoAll commands resolve paths dynamically from the main worktree root, making them safe to run from any worktree. Input validation prevents shell metacharacters in names.
Methodology references (required if estimator / math changes)
Validation
.claude/commands/*.md), no Python code changesSecurity / privacy
Generated with Claude Code