Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
fix(plugin): fail worktree hooks before side effects; document path args (#3060)
Maximilian Roos11129d381142
diff --git a/docs/content/remove.md b/docs/content/remove.mdindex 0c0fb48f7..2d7e4a30e 100644--- a/docs/content/remove.md+++ b/docs/content/remove.md@@ -97,7 +97,7 @@ Usage: <b><span class=c>wt remove</span></b> <span class=c>[OPTIONS]</span> <spa<b><span class=g>Arguments:</span></b><span class=c>[BRANCHES]...</span>- Branch name [default: current]+ Branch name or worktree path [default: current]<b><span class=g>Options:</span></b><b><span class=c>--no-delete-branch</span></b>diff --git a/plugins/worktrunk/README.md b/plugins/worktrunk/README.mdindex 246c45e4a..10750f012 100644--- a/plugins/worktrunk/README.md+++ b/plugins/worktrunk/README.md@@ -2,6 +2,9 @@Git worktree management CLI integration with activity tracking.+Requires the `wt` CLI ([worktrunk.dev](https://worktrunk.dev)) and `jq` (used+by the worktree-lifecycle hooks).+## Features1. **Configuration skill** — Guides LLM-powered commit message setup, project hooks (pre-start, pre-merge), and worktree path customizationdiff --git a/plugins/worktrunk/hooks/hooks.json b/plugins/worktrunk/hooks/hooks.jsonindex d0fbf5acf..80fd5fe29 100644--- a/plugins/worktrunk/hooks/hooks.json+++ b/plugins/worktrunk/hooks/hooks.json@@ -69,7 +69,7 @@"hooks": [{"type": "command",- "command": "bash -c 'set -o pipefail; jq -r .name | xargs -I{} bash \"$CLAUDE_PLUGIN_ROOT/hooks/wt.sh\" switch --create {} --no-cd --format=json | jq -r .path'"+ "command": "bash -c 'name=$(jq -er .name) || exit 1; bash \"$CLAUDE_PLUGIN_ROOT/hooks/wt.sh\" switch --create \"$name\" --no-cd --format=json | jq -er .path'"}]}@@ -79,7 +79,7 @@"hooks": [{"type": "command",- "command": "bash -c 'set -o pipefail; jq -r .worktree_path | xargs -I{} bash \"$CLAUDE_PLUGIN_ROOT/hooks/wt.sh\" remove --foreground {}'"+ "command": "bash -c 'p=$(jq -er .worktree_path) || exit 1; bash \"$CLAUDE_PLUGIN_ROOT/hooks/wt.sh\" remove --foreground \"$p\"'"}]}diff --git a/skills/worktrunk/reference/remove.md b/skills/worktrunk/reference/remove.mdindex 6aad86e8a..82d5200e4 100644--- a/skills/worktrunk/reference/remove.md+++ b/skills/worktrunk/reference/remove.md@@ -95,7 +95,7 @@ Usage: wt remove [OPTIONS] [BRANCHES]...Arguments:[BRANCHES]...- Branch name [default: current]+ Branch name or worktree path [default: current]Options:--no-delete-branchdiff --git a/skills/wt-switch-create/SKILL.md b/skills/wt-switch-create/SKILL.mdindex 881c7024f..43212138d 100644--- a/skills/wt-switch-create/SKILL.md+++ b/skills/wt-switch-create/SKILL.md@@ -38,9 +38,10 @@ Steps 1–3 come before any other work.<!-- Maintainers: the design choices here are backed by tested evidence inrationale.md (same directory) — read it before re-adding guards or routes. -->-1. **Pick the branch name** if none was given: short kebab-case from the task- ("fix the parser bug" → `fix-parser-bug`) or, mid-session, from the work- being moved; with nothing to derive from, ask.+1. **Pick the branch name** if none was given: short, from the task ("fix the+ parser bug" → `fix-parser-bug`) and consistent with existing worktree+ names, or, mid-session, from the work being moved; with nothing to derive+ from, ask.2. **Create the worktree** with a `Bash` call (omit `-C <repo>` when no repowas given):diff --git a/src/cli/mod.rs b/src/cli/mod.rsindex 579136799..0abf68371 100644--- a/src/cli/mod.rs+++ b/src/cli/mod.rs@@ -425,7 +425,7 @@ pub(crate) struct ListArgs {#[derive(Args)]pub(crate) struct RemoveArgs {- /// Branch name [default: current]+ /// Branch name or worktree path [default: current]#[arg(add = crate::completion::local_branches_completer())]pub(crate) branches: Vec<String>,diff --git a/tests/snapshots/integration__integration_tests__help__help_remove_long.snap b/tests/snapshots/integration__integration_tests__help__help_remove_long.snapindex 5e45c5835..70070b8eb 100644--- a/tests/snapshots/integration__integration_tests__help__help_remove_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_remove_long.snap@@ -44,7 +44,7 @@ Usage: [1m[36mwt remove[0m [36m[OPTIONS][0m [36m[BRANCHES]...[0m[1m[32mArguments:[0m[36m[BRANCHES]...[0m- Branch name [default: current]+ Branch name or worktree path [default: current][1m[32mOptions:[0m[1m[36m--no-delete-branch[0mdiff --git a/tests/snapshots/integration__integration_tests__help__help_remove_short.snap b/tests/snapshots/integration__integration_tests__help__help_remove_short.snapindex b5dc70866..5d488a9f8 100644--- a/tests/snapshots/integration__integration_tests__help__help_remove_short.snap+++ b/tests/snapshots/integration__integration_tests__help__help_remove_short.snap@@ -41,7 +41,7 @@ wt remove - Remove worktree; delete branch if mergedUsage: [1m[36mwt remove[0m [36m[OPTIONS][0m [36m[BRANCHES]...[0m[1m[32mArguments:[0m- [36m[BRANCHES]...[0m Branch name [default: current]+ [36m[BRANCHES]...[0m Branch name or worktree path [default: current][1m[32mOptions:[0m[1m[36m--no-delete-branch[0m Keep branch after removal