Skip to content

feat(mk): drop a leading "worktree-" from the worktree folder name - #12

Merged
stilliard merged 1 commit into
mainfrom
feat/worktree-prefix-strip
Aug 27, 2026
Merged

feat(mk): drop a leading "worktree-" from the worktree folder name#12
stilliard merged 1 commit into
mainfrom
feat/worktree-prefix-strip

Conversation

@stilliard

Copy link
Copy Markdown
Owner

Claude Code creates worktrees as .claude/worktrees/<name> on a branch named worktree-<name>. wt mk now names the folder the same way, so wt mk worktree-my-feature creates .claude/worktrees/my-feature.

Both spellings still resolve — _wt_resolve matches branch name or folder basename, and completion already does substring matching.

🤖 Generated with Claude Code

Claude Code creates worktrees as .claude/worktrees/<name> on a branch named
worktree-<name>. wt now derives the folder the same way, so `wt mk
worktree-my-feature` lands in .claude/worktrees/my-feature instead of
.claude/worktrees/worktree-my-feature.

Both spellings still resolve: _wt_resolve matches the branch name or the
folder basename, and completion already does substring matching.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Copilot AI 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.

🟢 Approval recommended

The behavior change is implemented in a single shared helper, is exercised by targeted tests (including the worktree- edge case), and documentation has been updated accordingly.

Pull request overview

This PR aligns wt mk’s default worktree folder naming with Claude Code by stripping a leading worktree- prefix from the folder name (while leaving the branch name unchanged), so both tools share the same .claude/worktrees/<name> layout.

Changes:

  • Add _wt_safe_name and use it for default worktree folder naming (and {name} expansion) to drop a leading worktree- after slash-to-dash normalization.
  • Update wt mk behavior and documentation to reflect the new naming rule.
  • Add/extend Bats tests to ensure both wt mk and _wt_resolve support the new mapping and the edge case worktree-.
File summaries
File Description
lib/core.sh Introduces _wt_safe_name and uses it as the canonical “safe folder name” input to default path expansion.
lib/commands/mk.sh Switches wt mk to compute the destination folder name via _wt_safe_name.
test/helpers.bash Updates test helper wt_dest() to match the new folder-naming logic.
test/mk.bats Adds tests for stripping worktree- and preserving the exact worktree- branch name case.
test/resolve.bats Adds coverage confirming _wt_resolve can find the same worktree via both branch name and folder basename.
README.md Documents the updated default folder naming behavior.
lib/commands/help.sh Updates wt.path help text to describe the new {name} semantics.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@stilliard stilliard left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

👍

@stilliard
stilliard merged commit 88816bb into main Aug 27, 2026
1 check 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.

2 participants