Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
fix(plugin): /wt-switch-create guesses whether a bare name is the repo or the branch (#4159)
Maximilian Roosa2f1497010c9
diff --git a/plugins/worktrunk/skills/wt-switch-create/SKILL.md b/plugins/worktrunk/skills/wt-switch-create/SKILL.mdindex 8ad7c532a..e48703d21 100644--- a/plugins/worktrunk/skills/wt-switch-create/SKILL.md+++ b/plugins/worktrunk/skills/wt-switch-create/SKILL.md@@ -10,17 +10,23 @@ Arguments: `$ARGUMENTS`. Grammar: `[<branch>] [<repo>] [-- <task>]`.- **branch** — optional; the branch name for the new worktree. When omitted,pick one (step 1 below).-- **repo** — optional path; create the worktree in this repo instead of the- session's current one.+- **repo** — optional path or name; create the worktree in this repo instead+ of the session's current one.- **task** — optional; what to do inside the new worktree. No task means enterthe worktree and wait.-Tokens before the `--` are the branch and/or repo: a path-shaped token-(starting with `/`, `~`, `./`, or `../`) is the repo; any other token is the-branch (`docs` is a branch name, never the `docs/` directory). More than one-branch-shaped token before a `--` doesn't fit the grammar — ask. Without a-`--`, judge where the task starts: leading tokens that read as a branch name-(`fix-auth`) or a repo path are consumed as such, and the rest is the task;+Tokens before the `--` are the branch and/or repo. A path-shaped token+(starting with `/`, `~`, `./`, or `../`) is the repo. A bare name can be+either, so make an informed guess. It is the branch when the current repo+already has a branch by that name, as it is for `wt switch` itself. Otherwise+it is the repo when a git repository by that name exists where the user keeps+repos (beside the current repo, or in a workspace directory like+`~/workspace`), and the branch when none does (`docs` is a branch, not the+current repo's `docs/` directory). A name read as the repo carries its absolute+path forward: that path, not the bare token, is the `<repo>` in step 3. Two+tokens that both read as branches don't fit the grammar — ask. Without a `--`,+judge where the task starts: leading tokens that read as a branch name+(`fix-auth`) or a repo are consumed as such, and the rest is the task;otherwise the whole input is the task (`fix the parser bug` has nobranch-shaped lead — all task).diff --git a/skills/wt-switch-create/SKILL.md b/skills/wt-switch-create/SKILL.mdindex 8ad7c532a..e48703d21 100644--- a/skills/wt-switch-create/SKILL.md+++ b/skills/wt-switch-create/SKILL.md@@ -10,17 +10,23 @@ Arguments: `$ARGUMENTS`. Grammar: `[<branch>] [<repo>] [-- <task>]`.- **branch** — optional; the branch name for the new worktree. When omitted,pick one (step 1 below).-- **repo** — optional path; create the worktree in this repo instead of the- session's current one.+- **repo** — optional path or name; create the worktree in this repo instead+ of the session's current one.- **task** — optional; what to do inside the new worktree. No task means enterthe worktree and wait.-Tokens before the `--` are the branch and/or repo: a path-shaped token-(starting with `/`, `~`, `./`, or `../`) is the repo; any other token is the-branch (`docs` is a branch name, never the `docs/` directory). More than one-branch-shaped token before a `--` doesn't fit the grammar — ask. Without a-`--`, judge where the task starts: leading tokens that read as a branch name-(`fix-auth`) or a repo path are consumed as such, and the rest is the task;+Tokens before the `--` are the branch and/or repo. A path-shaped token+(starting with `/`, `~`, `./`, or `../`) is the repo. A bare name can be+either, so make an informed guess. It is the branch when the current repo+already has a branch by that name, as it is for `wt switch` itself. Otherwise+it is the repo when a git repository by that name exists where the user keeps+repos (beside the current repo, or in a workspace directory like+`~/workspace`), and the branch when none does (`docs` is a branch, not the+current repo's `docs/` directory). A name read as the repo carries its absolute+path forward: that path, not the bare token, is the `<repo>` in step 3. Two+tokens that both read as branches don't fit the grammar — ask. Without a `--`,+judge where the task starts: leading tokens that read as a branch name+(`fix-auth`) or a repo are consumed as such, and the rest is the task;otherwise the whole input is the task (`fix the parser bug` has nobranch-shaped lead — all task).