Skip to content

feat(plugin): /wt-switch-create — optional repo arg and -- task delimiter#2751

Merged
max-sixty merged 2 commits into
mainfrom
skill
May 13, 2026
Merged

feat(plugin): /wt-switch-create — optional repo arg and -- task delimiter#2751
max-sixty merged 2 commits into
mainfrom
skill

Conversation

@max-sixty
Copy link
Copy Markdown
Owner

@max-sixty max-sixty commented May 13, 2026

The /wt-switch-create skill now accepts <branch> [<repo>] [-- <task>]. The optional second token names a different repository to create the worktree in (instead of the session's current one); the skill cds into that repo with a Bash call before invoking EnterWorktree (which has no repo parameter), then verifies the new worktree landed under the requested repo as a safety check.

The -- cleanly separates the task from the rest. Without one, the parser treats a path-shaped second token (absolute, ~-relative, .//../-relative, or an existing directory) as the repo and the remaining tokens as the task — anything else after the branch is task text, so the old shorthand /wt-switch-create my-branch fix the bug keeps working.

Examples in the skill:

/wt-switch-create my-feature -- fix the parser bug
/wt-switch-create my-feature ~/workspace/other-repo -- fix the parser bug
/wt-switch-create my-feature

Also tidied existing prose: the nesting + different-repo case now stops rather than silently running the task in the wrong repo, and the scope note mentions the repo arg.

The follow-up commit updates the public docs page (docs/content/claude-code.md) so the /wt-switch-create signature shown at worktrunk.dev matches the new grammar; skills/worktrunk/reference/claude-code.md re-synced via test_docs_are_in_sync.

No code or test changes.

…` task delimiter

The skill now accepts `<branch> [<repo>] [-- <task>]`. The optional second
token names a different repository to create the worktree in; the skill `cd`s
there before calling `EnterWorktree` (which has no repo parameter), then
verifies the new worktree landed under the requested repo.

The `--` cleanly separates the task. Without one, the second token is the repo
when it's path-shaped (absolute, `~`-relative, `./`/`../`-relative, or an
existing directory), otherwise it starts the task — so the old shorthand
`<branch> <task...>` keeps working.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@worktrunk-bot worktrunk-bot left a comment

Choose a reason for hiding this comment

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

The skill grammar reads cleanly and the new safety check for the nested-different-repo case is a nice catch.

One out-of-diff observation: docs/content/claude-code.md still describes the command as `/wt-switch-create <branch> [task...]`, which won't reflect the new optional repo arg or -- delimiter after this lands. Since that file is the primary source for skills/worktrunk/reference/claude-code.md via test_docs_are_in_sync, the published docs page will lag the skill. Happy to push a follow-up commit updating the public docs page if useful.

…ammar

The public docs page still showed `/wt-switch-create <branch> [task...]`,
which would have lagged the skill spec from the previous commit. Update the
signature to `<branch> [<repo>] [-- <task>]` and add a sentence describing the
optional repo token and the `--` task delimiter. `skills/worktrunk/reference/claude-code.md`
re-synced via `test_docs_are_in_sync`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@max-sixty
Copy link
Copy Markdown
Owner Author

Thanks — pushed 1eec508 updating docs/content/claude-code.md (and the synced skills/worktrunk/reference/claude-code.md) to show the new <branch> [<repo>] [-- <task>] signature. PR description updated to mention the docs follow-up.

This was written by Claude Code on behalf of @max-sixty

@max-sixty max-sixty merged commit 5255598 into main May 13, 2026
34 checks passed
@max-sixty max-sixty deleted the skill branch May 13, 2026 05:49
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