cli: worktree add takes the branch positionally with create-vs-checkout magic - git's own signature is -b; align or pin the divergence #171
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea#171
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
madtea worktree add <path> [branch]takes the branch as a positional, andAddWorktree(internal/service/git/worktree.go) decides what it means: branch exists, check it out; branch missing, create it (git worktree add -b). Raw git's vocabulary is different - the positional after the path is a commit-ish to check out, and creating a new branch is the explicit-b <branch>. madtea's worktree add has no-b(only-f).No ADR guards this today: ADR 0005 (explicit canonical parameter names) is MCP-side, and ADR 0016 pins flag names to gh/tea, not flag-vs-positional shape - and for git-mirrored commands the vocabulary anchor is git itself. The anchor is real: the README shipped
worktree add -b feat/...as fiction until 2026-07-16 because-bis the muscle-memory signature. ADR 0005 makes exactly this training-data-anchor argument for the MCP surface.Decide one:
-b <branch>creates; the positional stays a plain commit-ish checkout with no silent create. Breaking change to the current positional-create behavior; #169's cobra-subcommand conversion is the natural vehicle.-b.Either way the MCP surface is unaffected:
madt_worktrees action=addalready takes an explicitbranch=parameter.Related: #169, #170.
We follow git for this, positional is not explicit. Probably need to record ADR.
Design pinned for implementation (decision above: follow git):
madtea worktree add <path> [<commit-ish>]- the positional after path is a plain checkout of an existing ref, exactly git's meaning; it never silently creates.-b <branch>is the explicit create form (git worktree add -b). Asking for a positional branch that does not exist is an error naming -b as the create path.