Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Name the unconfigured source when a hook filter matches nothing (#3997)
Maximilian Roosce57d2d9972f
diff --git a/docs/src/content/docs/hook.md b/docs/src/content/docs/hook.mdindex 003fe77bb..e5ab5f2cd 100644--- a/docs/src/content/docs/hook.md+++ b/docs/src/content/docs/hook.md@@ -20,7 +20,7 @@ Hooks are shell commands that run at key points in the worktree lifecycle — au| **merge** | `pre-merge` | `post-merge` || **remove** | `pre-remove` | `post-remove` |-`pre-*` hooks block — failure aborts the operation. `post-*` hooks run in the background with output logged (use [`wt config state logs`](/config/#wt-config-state-logs) to find and manage log files). Use `-v` to see the template variables for background hooks; `wt hook <type> --dry-run` previews the commands.+`pre-*` hooks block — failure aborts the operation. `post-*` hooks run in the background with output logged (use [`wt config state logs`](/config/#wt-config-state-logs) to find and manage log files); `wt hook <type> --foreground` runs one inline instead, so its output arrives in the terminal. Use `-v` to see the template variables for background hooks; `wt hook <type> --dry-run` previews the commands.The most common creation hook is `post-start` — it runs background tasks (dev servers, file copying, builds) without blocking worktree creation. Prefer `post-start` over `pre-start` unless a later step needs the work completed first.@@ -30,7 +30,7 @@ The most common creation hook is `post-start` — it runs background tasks (dev| `post-switch` | Triggers on all switch results: creating, switching to existing, or staying on current || `pre-start` | Runs once when a new worktree is created, blocking `post-start`/`--execute` until complete: dependency install, env file generation || `post-start` | Runs once when a new worktree is created, in the background: dev servers, long builds, file watchers, copying caches |-| `pre-commit` | Formatters, linters, type checking — runs during `wt merge` before the squash commit |+| `pre-commit` | Formatters, linters, type checking — runs before any Worktrunk commit (`wt step commit`, `wt step squash`, and the commit `wt merge` makes) || `post-commit` | CI triggers, notifications, background linting || `pre-merge` | Tests, security scans, build verification — runs after rebase, before merge to target || `post-merge` | Deployment, notifications, installing updated binaries. Runs in the target branch worktree if it exists, otherwise the primary worktree |@@ -60,7 +60,7 @@ Project commands require approval on first run:- If a command changes, new approval is required- Declining skips every project command for that operation — including any already approved — and continues without them; saved approvals are unaffected- Use `--yes` to bypass prompts — useful for CI and automation-- Use `--no-hooks` to skip hooks+- Use `--no-hooks` to skip hooks — accepted by the commands that run them (`wt switch`, `wt merge`, `wt remove`, `wt step commit`, `wt step squash`), not by `wt hook`Manage approvals with `wt config approvals add` and `wt config approvals clear`.@@ -99,7 +99,7 @@ server = "npm run dev"Here `install` runs first, then `build` and `server` run together.-Templates are syntax-checked before the pipeline starts and rendered as each step runs, so a step can store [per-branch vars](/config/#wt-config-state-vars) that later steps read via `{{ vars.<key> }}`. Because an earlier step can still change those values, a preview leaves them alone: `wt hook <type> --dry-run` and `wt hook show --expanded` render `{{ vars.<key> }}` as itself while every other variable expands.+Templates are syntax-checked before the pipeline starts and rendered as each step runs, so a step can store [per-branch vars](/config/#wt-config-state-vars) that later steps read via `{{ vars.<key> }}`. Because an earlier step can still change those values, a preview stands the reference in for its value instead of resolving it: `wt hook <type> --dry-run` and `wt hook show --expanded` render `{{ vars.thing | default('none') }}` as `{{ vars.thing }}` — the reference is defined, so the `default` never fires — while every other variable expands. A filter that transforms its input still runs, against the placeholder text: `{{ vars.thing | upper }}` previews as `{{ VARS.THING }}`.Most hooks don't need `[[hook]]` blocks. Reach for them when there's a dependency chain — typically setup that must complete before later steps, like installing dependencies before running a build and dev server concurrently.@@ -112,7 +112,7 @@ Most hooks don't need `[[hook]]` blocks. Reach for them when there's a dependenc| Approval | Required | Not required || Execution order | After user hooks | First |-Skip all hooks with `--no-hooks`. To run a specific hook when user and project both define the same name, use `user:name` or `project:name` syntax.+To run a specific hook when user and project both define the same name, use `user:name` or `project:name` syntax.## Template variables@@ -197,18 +197,7 @@ Templates support Jinja2 filters for transforming values:| `basename` | `{{ repo_path \| basename }}` | Keep only the last path component (`/a/b/c` → `c`) || `codename(n)` | `{{ branch \| codename(2) }}` | Deterministic friendly words |-The `sanitize_db` filter produces database-safe identifiers — lowercase alphanumeric and underscores, no leading digits, with a 3-character hash suffix to avoid collisions and reserved words. The `sanitize_hash` filter produces a filesystem-safe name and appends a 3-character hash suffix when sanitization changed the input, so distinct originals never collide — already-safe names pass through unchanged. The `codename(n)` filter produces deterministic friendly names from an input string: `codename(1)` returns a noun, `codename(2)` returns `adjective-noun`, and higher counts add more adjectives. The pool is large (~1.26M combinations for `codename(2)`), so it usually stands alone as a worktree leaf:--```toml-# Friendly branch-derived worktree names, e.g. myproject.malleable-opah-worktree-path = "{{ repo_path }}/../{{ repo }}.{{ branch | codename(2) }}"-```--When you want both a friendly name and the original branch identity in the path, put the branch name in a parent directory:--```toml-worktree-path = "{{ repo_path }}/../worktrees/{{ branch | sanitize }}/{{ branch | codename(2) }}"-```+The `sanitize_db` filter produces database-safe identifiers — lowercase alphanumeric and underscores, no leading digits, with a 3-character hash suffix to avoid collisions and reserved words. The `sanitize_hash` filter produces a filesystem-safe name and appends a 3-character hash suffix when sanitization changed the input, so distinct originals never collide — already-safe names pass through unchanged. The `codename(n)` filter produces deterministic friendly names from an input string: `codename(1)` returns a noun, `codename(2)` returns `adjective-noun`, and higher counts add more adjectives. The pool is large (~1.26M combinations for `codename(2)`), so it usually stands alone as a worktree leaf — the [`worktree-path` recipes](/config/#worktree-path-template) show it both alone and under a branch-named parent directory.The `hash` filter is the bare 3-character base36 digest, useful for composing your own truncate-with-collision-avoidance recipes when an output budget is tight (e.g., Unix socket paths capped at 107 bytes):diff --git a/docs/src/content/docs/step.md b/docs/src/content/docs/step.mdindex 7429ddc81..f738f9778 100644--- a/docs/src/content/docs/step.md+++ b/docs/src/content/docs/step.md@@ -69,7 +69,7 @@ Commands:eval Evaluate a template expressionfor-each Run command in each worktreepromote [experimental] Swap a branch into the main worktree- prune Remove worktrees merged into the default branch+ prune Remove worktrees and branches merged into the default branchrelocate [experimental] Move worktrees to expected pathstether [experimental] Run a command; kill its whole process tree when its worktree isremoved@@ -103,7 +103,21 @@ Global Options:Stage and commit with LLM-generated message.-See [LLM-generated commit messages](/llm-commits/) for configuration and prompt customization.+See [LLM-generated commit messages](/llm-commits/) for configuration and prompt customization. Without a `[commit.generation]` command configured, the commit still happens — the message is built from the staged file names instead (`Changes to README.md`).++### Operating on another worktree++`--branch` commits in another worktree's branch without leaving the current one:++```console+$ wt step commit --branch feature+```++The branch must have a checked-out worktree. `--branch` re-roots the whole command: staging, hooks, and the commit all happen there. It has no effect on `--dry-run`, which always previews the current worktree.++### Hooks++`pre-commit` hooks run before the commit and abort it on failure; `post-commit` hooks run after it, in the background with their output logged. `--no-hooks` skips both. See [`wt hook`](/hook/).### Options@@ -198,7 +212,11 @@ Global Options:Squash commits since branching. Stages changes and generates message with LLM.-See [LLM-generated commit messages](/llm-commits/) for configuration and prompt customization.+See [LLM-generated commit messages](/llm-commits/) for configuration and prompt customization. Without a `[commit.generation]` command configured, the squash still happens — the message lists the squashed commits' subjects under `Squash commits from <branch>` instead.++### Hooks++`pre-commit` hooks run before the squash commit and abort it on failure; `post-commit` hooks run after it, in the background with their output logged. `--no-hooks` skips both. See [`wt hook`](/hook/).### Options@@ -545,6 +563,17 @@ Add to the project config:copy = "wt step copy-ignored"```+### Choosing source and destination++By default the copy runs from the primary worktree into the current one — what a `post-start` hook needs, since the new worktree is where the hook runs. `--from` and `--to` name either end by branch, so a copy can run between two worktrees from anywhere:++```console+$ wt step copy-ignored --from main --to feature # between two named worktrees+$ wt step copy-ignored --from feature # from feature into the current worktree+```++A branch named by `--from` or `--to` must have a worktree.+### What gets copiedAll gitignored files are copied by default, except for built-in excluded directories: VCS metadata (`.bzr/`, `.hg/`, `.jj/`, `.pijul/`, `.sl/`, `.svn/`), tool-state (`.conductor/`, `.entire/`, `.worktrees/`), and nested worktrees. Tracked files are never touched. Discovery handles nested `.gitignore` files, global excludes, and `.git/info/exclude`. Existing files in the destination are skipped, so re-running is safe; `--force` overwrites them.@@ -641,7 +670,7 @@ Options:--from <FROM>Source worktree branch- Defaults to main worktree.+ Defaults to primary worktree.--to <TO>Destination worktree branch@@ -723,19 +752,21 @@ $ wt step eval '{{ branch | sanitize_db }}'feature_auth_oauth2_a1b```-List the available template variables with `-v` (alongside the expansion, on stderr):+List the available template variables with `-v` (alongside the expansion, on stderr). The real block prints every variable in scope; this one is abridged:```console$ wt step eval -v '{{ branch }}'○ eval template variables:- branch = feature/auth-oauth2- worktree_path = /home/user/projects/myapp-feature-auth-oauth2+ branch = feature/auth+ worktree_path = /home/user/code/myproject.feature-auth+ …+ cwd = /home/user/code/myproject.feature-auth○ eval source{{ branch }}○ eval result- feature/auth-oauth2+ feature/auth-feature/auth-oauth2+feature/auth```### Command reference@@ -961,7 +992,7 @@ Global Options:## wt step prune-Remove worktrees merged into the default branch.+Remove worktrees and branches merged into the default branch.Bulk-removes worktrees and branches that are integrated into the default branch, using the same criteria as `wt remove`'s branch cleanup. Stale worktree entries are cleaned up too.@@ -971,7 +1002,7 @@ Locked worktrees and the main worktree are always skipped. The current worktree### Min-age guard-Worktrees younger than `--min-age` (default: 1 day) are skipped. This prevents removing a worktree just created from the default branch — it looks "merged" because its branch points at the same commit.+Worktrees and branches younger than `--min-age` (default: 1 day) are skipped. This prevents removing a worktree just created from the default branch — it looks "merged" because its branch points at the same commit.```console$ wt step prune --min-age=0s # no age guard@@ -999,7 +1030,7 @@ $ wt step prune### Command reference```text wt-command-reference-wt step prune - Remove worktrees merged into the default branch+wt step prune - Remove worktrees and branches merged into the default branchUsage: wt step prune [OPTIONS]@@ -1008,7 +1039,7 @@ Options:Show what would be removed--min-age <MIN_AGE>- Skip worktrees younger than this+ Skip worktrees and branches younger than this[default: 1d]diff --git a/plugins/worktrunk/skills/worktrunk/reference/hook.md b/plugins/worktrunk/skills/worktrunk/reference/hook.mdindex fab7be40c..b99039f97 100644--- a/plugins/worktrunk/skills/worktrunk/reference/hook.md+++ b/plugins/worktrunk/skills/worktrunk/reference/hook.md@@ -14,7 +14,7 @@ Hooks are shell commands that run at key points in the worktree lifecycle — au| **merge** | `pre-merge` | `post-merge` || **remove** | `pre-remove` | `post-remove` |-`pre-*` hooks block — failure aborts the operation. `post-*` hooks run in the background with output logged (use [`wt config state logs`](https://worktrunk.dev/config/#wt-config-state-logs) to find and manage log files). Use `-v` to see the template variables for background hooks; `wt hook <type> --dry-run` previews the commands.+`pre-*` hooks block — failure aborts the operation. `post-*` hooks run in the background with output logged (use [`wt config state logs`](https://worktrunk.dev/config/#wt-config-state-logs) to find and manage log files); `wt hook <type> --foreground` runs one inline instead, so its output arrives in the terminal. Use `-v` to see the template variables for background hooks; `wt hook <type> --dry-run` previews the commands.The most common creation hook is `post-start` — it runs background tasks (dev servers, file copying, builds) without blocking worktree creation. Prefer `post-start` over `pre-start` unless a later step needs the work completed first.@@ -24,7 +24,7 @@ The most common creation hook is `post-start` — it runs background tasks (dev| `post-switch` | Triggers on all switch results: creating, switching to existing, or staying on current || `pre-start` | Runs once when a new worktree is created, blocking `post-start`/`--execute` until complete: dependency install, env file generation || `post-start` | Runs once when a new worktree is created, in the background: dev servers, long builds, file watchers, copying caches |-| `pre-commit` | Formatters, linters, type checking — runs during `wt merge` before the squash commit |+| `pre-commit` | Formatters, linters, type checking — runs before any Worktrunk commit (`wt step commit`, `wt step squash`, and the commit `wt merge` makes) || `post-commit` | CI triggers, notifications, background linting || `pre-merge` | Tests, security scans, build verification — runs after rebase, before merge to target || `post-merge` | Deployment, notifications, installing updated binaries. Runs in the target branch worktree if it exists, otherwise the primary worktree |@@ -54,7 +54,7 @@ Project commands require approval on first run:- If a command changes, new approval is required- Declining skips every project command for that operation — including any already approved — and continues without them; saved approvals are unaffected- Use `--yes` to bypass prompts — useful for CI and automation-- Use `--no-hooks` to skip hooks+- Use `--no-hooks` to skip hooks — accepted by the commands that run them (`wt switch`, `wt merge`, `wt remove`, `wt step commit`, `wt step squash`), not by `wt hook`Manage approvals with `wt config approvals add` and `wt config approvals clear`.@@ -93,7 +93,7 @@ server = "npm run dev"Here `install` runs first, then `build` and `server` run together.-Templates are syntax-checked before the pipeline starts and rendered as each step runs, so a step can store [per-branch vars](https://worktrunk.dev/config/#wt-config-state-vars) that later steps read via `{{ vars.<key> }}`. Because an earlier step can still change those values, a preview leaves them alone: `wt hook <type> --dry-run` and `wt hook show --expanded` render `{{ vars.<key> }}` as itself while every other variable expands.+Templates are syntax-checked before the pipeline starts and rendered as each step runs, so a step can store [per-branch vars](https://worktrunk.dev/config/#wt-config-state-vars) that later steps read via `{{ vars.<key> }}`. Because an earlier step can still change those values, a preview stands the reference in for its value instead of resolving it: `wt hook <type> --dry-run` and `wt hook show --expanded` render `{{ vars.thing | default('none') }}` as `{{ vars.thing }}` — the reference is defined, so the `default` never fires — while every other variable expands. A filter that transforms its input still runs, against the placeholder text: `{{ vars.thing | upper }}` previews as `{{ VARS.THING }}`.Most hooks don't need `[[hook]]` blocks. Reach for them when there's a dependency chain — typically setup that must complete before later steps, like installing dependencies before running a build and dev server concurrently.@@ -106,7 +106,7 @@ Most hooks don't need `[[hook]]` blocks. Reach for them when there's a dependenc| Approval | Required | Not required || Execution order | After user hooks | First |-Skip all hooks with `--no-hooks`. To run a specific hook when user and project both define the same name, use `user:name` or `project:name` syntax.+To run a specific hook when user and project both define the same name, use `user:name` or `project:name` syntax.## Template variables@@ -191,18 +191,7 @@ Templates support Jinja2 filters for transforming values:| `basename` | `{{ repo_path \| basename }}` | Keep only the last path component (`/a/b/c` → `c`) || `codename(n)` | `{{ branch \| codename(2) }}` | Deterministic friendly words |-The `sanitize_db` filter produces database-safe identifiers — lowercase alphanumeric and underscores, no leading digits, with a 3-character hash suffix to avoid collisions and reserved words. The `sanitize_hash` filter produces a filesystem-safe name and appends a 3-character hash suffix when sanitization changed the input, so distinct originals never collide — already-safe names pass through unchanged. The `codename(n)` filter produces deterministic friendly names from an input string: `codename(1)` returns a noun, `codename(2)` returns `adjective-noun`, and higher counts add more adjectives. The pool is large (~1.26M combinations for `codename(2)`), so it usually stands alone as a worktree leaf:--```toml-# Friendly branch-derived worktree names, e.g. myproject.malleable-opah-worktree-path = "{{ repo_path }}/../{{ repo }}.{{ branch | codename(2) }}"-```--When you want both a friendly name and the original branch identity in the path, put the branch name in a parent directory:--```toml-worktree-path = "{{ repo_path }}/../worktrees/{{ branch | sanitize }}/{{ branch | codename(2) }}"-```+The `sanitize_db` filter produces database-safe identifiers — lowercase alphanumeric and underscores, no leading digits, with a 3-character hash suffix to avoid collisions and reserved words. The `sanitize_hash` filter produces a filesystem-safe name and appends a 3-character hash suffix when sanitization changed the input, so distinct originals never collide — already-safe names pass through unchanged. The `codename(n)` filter produces deterministic friendly names from an input string: `codename(1)` returns a noun, `codename(2)` returns `adjective-noun`, and higher counts add more adjectives. The pool is large (~1.26M combinations for `codename(2)`), so it usually stands alone as a worktree leaf — the [`worktree-path` recipes](https://worktrunk.dev/config/#worktree-path-template) show it both alone and under a branch-named parent directory.The `hash` filter is the bare 3-character base36 digest, useful for composing your own truncate-with-collision-avoidance recipes when an output budget is tight (e.g., Unix socket paths capped at 107 bytes):diff --git a/plugins/worktrunk/skills/worktrunk/reference/step.md b/plugins/worktrunk/skills/worktrunk/reference/step.mdindex b6b306cec..a88b23831 100644--- a/plugins/worktrunk/skills/worktrunk/reference/step.md+++ b/plugins/worktrunk/skills/worktrunk/reference/step.md@@ -57,7 +57,7 @@ Commands:eval Evaluate a template expressionfor-each Run command in each worktreepromote [experimental] Swap a branch into the main worktree- prune Remove worktrees merged into the default branch+ prune Remove worktrees and branches merged into the default branchrelocate [experimental] Move worktrees to expected pathstether [experimental] Run a command; kill its whole process tree when its worktree isremoved@@ -91,7 +91,21 @@ Global Options:Stage and commit with LLM-generated message.-See [LLM-generated commit messages](https://worktrunk.dev/llm-commits/) for configuration and prompt customization.+See [LLM-generated commit messages](https://worktrunk.dev/llm-commits/) for configuration and prompt customization. Without a `[commit.generation]` command configured, the commit still happens — the message is built from the staged file names instead (`Changes to README.md`).++### Operating on another worktree++`--branch` commits in another worktree's branch without leaving the current one:++```console+$ wt step commit --branch feature+```++The branch must have a checked-out worktree. `--branch` re-roots the whole command: staging, hooks, and the commit all happen there. It has no effect on `--dry-run`, which always previews the current worktree.++### Hooks++`pre-commit` hooks run before the commit and abort it on failure; `post-commit` hooks run after it, in the background with their output logged. `--no-hooks` skips both. See [`wt hook`](https://worktrunk.dev/hook/).### Options@@ -186,7 +200,11 @@ Global Options:Squash commits since branching. Stages changes and generates message with LLM.-See [LLM-generated commit messages](https://worktrunk.dev/llm-commits/) for configuration and prompt customization.+See [LLM-generated commit messages](https://worktrunk.dev/llm-commits/) for configuration and prompt customization. Without a `[commit.generation]` command configured, the squash still happens — the message lists the squashed commits' subjects under `Squash commits from <branch>` instead.++### Hooks++`pre-commit` hooks run before the squash commit and abort it on failure; `post-commit` hooks run after it, in the background with their output logged. `--no-hooks` skips both. See [`wt hook`](https://worktrunk.dev/hook/).### Options@@ -533,6 +551,17 @@ Add to the project config:copy = "wt step copy-ignored"```+### Choosing source and destination++By default the copy runs from the primary worktree into the current one — what a `post-start` hook needs, since the new worktree is where the hook runs. `--from` and `--to` name either end by branch, so a copy can run between two worktrees from anywhere:++```console+$ wt step copy-ignored --from main --to feature # between two named worktrees+$ wt step copy-ignored --from feature # from feature into the current worktree+```++A branch named by `--from` or `--to` must have a worktree.+### What gets copiedAll gitignored files are copied by default, except for built-in excluded directories: VCS metadata (`.bzr/`, `.hg/`, `.jj/`, `.pijul/`, `.sl/`, `.svn/`), tool-state (`.conductor/`, `.entire/`, `.worktrees/`), and nested worktrees. Tracked files are never touched. Discovery handles nested `.gitignore` files, global excludes, and `.git/info/exclude`. Existing files in the destination are skipped, so re-running is safe; `--force` overwrites them.@@ -629,7 +658,7 @@ Options:--from <FROM>Source worktree branch- Defaults to main worktree.+ Defaults to primary worktree.--to <TO>Destination worktree branch@@ -711,19 +740,21 @@ $ wt step eval '{{ branch | sanitize_db }}'feature_auth_oauth2_a1b```-List the available template variables with `-v` (alongside the expansion, on stderr):+List the available template variables with `-v` (alongside the expansion, on stderr). The real block prints every variable in scope; this one is abridged:```console$ wt step eval -v '{{ branch }}'○ eval template variables:- branch = feature/auth-oauth2- worktree_path = /home/user/projects/myapp-feature-auth-oauth2+ branch = feature/auth+ worktree_path = /home/user/code/myproject.feature-auth+ …+ cwd = /home/user/code/myproject.feature-auth○ eval source{{ branch }}○ eval result- feature/auth-oauth2+ feature/auth-feature/auth-oauth2+feature/auth```### Command reference@@ -949,7 +980,7 @@ Global Options:## wt step prune-Remove worktrees merged into the default branch.+Remove worktrees and branches merged into the default branch.Bulk-removes worktrees and branches that are integrated into the default branch, using the same criteria as `wt remove`'s branch cleanup. Stale worktree entries are cleaned up too.@@ -959,7 +990,7 @@ Locked worktrees and the main worktree are always skipped. The current worktree### Min-age guard-Worktrees younger than `--min-age` (default: 1 day) are skipped. This prevents removing a worktree just created from the default branch — it looks "merged" because its branch points at the same commit.+Worktrees and branches younger than `--min-age` (default: 1 day) are skipped. This prevents removing a worktree just created from the default branch — it looks "merged" because its branch points at the same commit.```console$ wt step prune --min-age=0s # no age guard@@ -987,7 +1018,7 @@ $ wt step prune### Command reference```-wt step prune - Remove worktrees merged into the default branch+wt step prune - Remove worktrees and branches merged into the default branchUsage: wt step prune [OPTIONS]@@ -996,7 +1027,7 @@ Options:Show what would be removed--min-age <MIN_AGE>- Skip worktrees younger than this+ Skip worktrees and branches younger than this[default: 1d]diff --git a/skills/worktrunk/reference/hook.md b/skills/worktrunk/reference/hook.mdindex fab7be40c..b99039f97 100644--- a/skills/worktrunk/reference/hook.md+++ b/skills/worktrunk/reference/hook.md@@ -14,7 +14,7 @@ Hooks are shell commands that run at key points in the worktree lifecycle — au| **merge** | `pre-merge` | `post-merge` || **remove** | `pre-remove` | `post-remove` |-`pre-*` hooks block — failure aborts the operation. `post-*` hooks run in the background with output logged (use [`wt config state logs`](https://worktrunk.dev/config/#wt-config-state-logs) to find and manage log files). Use `-v` to see the template variables for background hooks; `wt hook <type> --dry-run` previews the commands.+`pre-*` hooks block — failure aborts the operation. `post-*` hooks run in the background with output logged (use [`wt config state logs`](https://worktrunk.dev/config/#wt-config-state-logs) to find and manage log files); `wt hook <type> --foreground` runs one inline instead, so its output arrives in the terminal. Use `-v` to see the template variables for background hooks; `wt hook <type> --dry-run` previews the commands.The most common creation hook is `post-start` — it runs background tasks (dev servers, file copying, builds) without blocking worktree creation. Prefer `post-start` over `pre-start` unless a later step needs the work completed first.@@ -24,7 +24,7 @@ The most common creation hook is `post-start` — it runs background tasks (dev| `post-switch` | Triggers on all switch results: creating, switching to existing, or staying on current || `pre-start` | Runs once when a new worktree is created, blocking `post-start`/`--execute` until complete: dependency install, env file generation || `post-start` | Runs once when a new worktree is created, in the background: dev servers, long builds, file watchers, copying caches |-| `pre-commit` | Formatters, linters, type checking — runs during `wt merge` before the squash commit |+| `pre-commit` | Formatters, linters, type checking — runs before any Worktrunk commit (`wt step commit`, `wt step squash`, and the commit `wt merge` makes) || `post-commit` | CI triggers, notifications, background linting || `pre-merge` | Tests, security scans, build verification — runs after rebase, before merge to target || `post-merge` | Deployment, notifications, installing updated binaries. Runs in the target branch worktree if it exists, otherwise the primary worktree |@@ -54,7 +54,7 @@ Project commands require approval on first run:- If a command changes, new approval is required- Declining skips every project command for that operation — including any already approved — and continues without them; saved approvals are unaffected- Use `--yes` to bypass prompts — useful for CI and automation-- Use `--no-hooks` to skip hooks+- Use `--no-hooks` to skip hooks — accepted by the commands that run them (`wt switch`, `wt merge`, `wt remove`, `wt step commit`, `wt step squash`), not by `wt hook`Manage approvals with `wt config approvals add` and `wt config approvals clear`.@@ -93,7 +93,7 @@ server = "npm run dev"Here `install` runs first, then `build` and `server` run together.-Templates are syntax-checked before the pipeline starts and rendered as each step runs, so a step can store [per-branch vars](https://worktrunk.dev/config/#wt-config-state-vars) that later steps read via `{{ vars.<key> }}`. Because an earlier step can still change those values, a preview leaves them alone: `wt hook <type> --dry-run` and `wt hook show --expanded` render `{{ vars.<key> }}` as itself while every other variable expands.+Templates are syntax-checked before the pipeline starts and rendered as each step runs, so a step can store [per-branch vars](https://worktrunk.dev/config/#wt-config-state-vars) that later steps read via `{{ vars.<key> }}`. Because an earlier step can still change those values, a preview stands the reference in for its value instead of resolving it: `wt hook <type> --dry-run` and `wt hook show --expanded` render `{{ vars.thing | default('none') }}` as `{{ vars.thing }}` — the reference is defined, so the `default` never fires — while every other variable expands. A filter that transforms its input still runs, against the placeholder text: `{{ vars.thing | upper }}` previews as `{{ VARS.THING }}`.Most hooks don't need `[[hook]]` blocks. Reach for them when there's a dependency chain — typically setup that must complete before later steps, like installing dependencies before running a build and dev server concurrently.@@ -106,7 +106,7 @@ Most hooks don't need `[[hook]]` blocks. Reach for them when there's a dependenc| Approval | Required | Not required || Execution order | After user hooks | First |-Skip all hooks with `--no-hooks`. To run a specific hook when user and project both define the same name, use `user:name` or `project:name` syntax.+To run a specific hook when user and project both define the same name, use `user:name` or `project:name` syntax.## Template variables@@ -191,18 +191,7 @@ Templates support Jinja2 filters for transforming values:| `basename` | `{{ repo_path \| basename }}` | Keep only the last path component (`/a/b/c` → `c`) || `codename(n)` | `{{ branch \| codename(2) }}` | Deterministic friendly words |-The `sanitize_db` filter produces database-safe identifiers — lowercase alphanumeric and underscores, no leading digits, with a 3-character hash suffix to avoid collisions and reserved words. The `sanitize_hash` filter produces a filesystem-safe name and appends a 3-character hash suffix when sanitization changed the input, so distinct originals never collide — already-safe names pass through unchanged. The `codename(n)` filter produces deterministic friendly names from an input string: `codename(1)` returns a noun, `codename(2)` returns `adjective-noun`, and higher counts add more adjectives. The pool is large (~1.26M combinations for `codename(2)`), so it usually stands alone as a worktree leaf:--```toml-# Friendly branch-derived worktree names, e.g. myproject.malleable-opah-worktree-path = "{{ repo_path }}/../{{ repo }}.{{ branch | codename(2) }}"-```--When you want both a friendly name and the original branch identity in the path, put the branch name in a parent directory:--```toml-worktree-path = "{{ repo_path }}/../worktrees/{{ branch | sanitize }}/{{ branch | codename(2) }}"-```+The `sanitize_db` filter produces database-safe identifiers — lowercase alphanumeric and underscores, no leading digits, with a 3-character hash suffix to avoid collisions and reserved words. The `sanitize_hash` filter produces a filesystem-safe name and appends a 3-character hash suffix when sanitization changed the input, so distinct originals never collide — already-safe names pass through unchanged. The `codename(n)` filter produces deterministic friendly names from an input string: `codename(1)` returns a noun, `codename(2)` returns `adjective-noun`, and higher counts add more adjectives. The pool is large (~1.26M combinations for `codename(2)`), so it usually stands alone as a worktree leaf — the [`worktree-path` recipes](https://worktrunk.dev/config/#worktree-path-template) show it both alone and under a branch-named parent directory.The `hash` filter is the bare 3-character base36 digest, useful for composing your own truncate-with-collision-avoidance recipes when an output budget is tight (e.g., Unix socket paths capped at 107 bytes):diff --git a/skills/worktrunk/reference/step.md b/skills/worktrunk/reference/step.mdindex b6b306cec..a88b23831 100644--- a/skills/worktrunk/reference/step.md+++ b/skills/worktrunk/reference/step.md@@ -57,7 +57,7 @@ Commands:eval Evaluate a template expressionfor-each Run command in each worktreepromote [experimental] Swap a branch into the main worktree- prune Remove worktrees merged into the default branch+ prune Remove worktrees and branches merged into the default branchrelocate [experimental] Move worktrees to expected pathstether [experimental] Run a command; kill its whole process tree when its worktree isremoved@@ -91,7 +91,21 @@ Global Options:Stage and commit with LLM-generated message.-See [LLM-generated commit messages](https://worktrunk.dev/llm-commits/) for configuration and prompt customization.+See [LLM-generated commit messages](https://worktrunk.dev/llm-commits/) for configuration and prompt customization. Without a `[commit.generation]` command configured, the commit still happens — the message is built from the staged file names instead (`Changes to README.md`).++### Operating on another worktree++`--branch` commits in another worktree's branch without leaving the current one:++```console+$ wt step commit --branch feature+```++The branch must have a checked-out worktree. `--branch` re-roots the whole command: staging, hooks, and the commit all happen there. It has no effect on `--dry-run`, which always previews the current worktree.++### Hooks++`pre-commit` hooks run before the commit and abort it on failure; `post-commit` hooks run after it, in the background with their output logged. `--no-hooks` skips both. See [`wt hook`](https://worktrunk.dev/hook/).### Options@@ -186,7 +200,11 @@ Global Options:Squash commits since branching. Stages changes and generates message with LLM.-See [LLM-generated commit messages](https://worktrunk.dev/llm-commits/) for configuration and prompt customization.+See [LLM-generated commit messages](https://worktrunk.dev/llm-commits/) for configuration and prompt customization. Without a `[commit.generation]` command configured, the squash still happens — the message lists the squashed commits' subjects under `Squash commits from <branch>` instead.++### Hooks++`pre-commit` hooks run before the squash commit and abort it on failure; `post-commit` hooks run after it, in the background with their output logged. `--no-hooks` skips both. See [`wt hook`](https://worktrunk.dev/hook/).### Options@@ -533,6 +551,17 @@ Add to the project config:copy = "wt step copy-ignored"```+### Choosing source and destination++By default the copy runs from the primary worktree into the current one — what a `post-start` hook needs, since the new worktree is where the hook runs. `--from` and `--to` name either end by branch, so a copy can run between two worktrees from anywhere:++```console+$ wt step copy-ignored --from main --to feature # between two named worktrees+$ wt step copy-ignored --from feature # from feature into the current worktree+```++A branch named by `--from` or `--to` must have a worktree.+### What gets copiedAll gitignored files are copied by default, except for built-in excluded directories: VCS metadata (`.bzr/`, `.hg/`, `.jj/`, `.pijul/`, `.sl/`, `.svn/`), tool-state (`.conductor/`, `.entire/`, `.worktrees/`), and nested worktrees. Tracked files are never touched. Discovery handles nested `.gitignore` files, global excludes, and `.git/info/exclude`. Existing files in the destination are skipped, so re-running is safe; `--force` overwrites them.@@ -629,7 +658,7 @@ Options:--from <FROM>Source worktree branch- Defaults to main worktree.+ Defaults to primary worktree.--to <TO>Destination worktree branch@@ -711,19 +740,21 @@ $ wt step eval '{{ branch | sanitize_db }}'feature_auth_oauth2_a1b```-List the available template variables with `-v` (alongside the expansion, on stderr):+List the available template variables with `-v` (alongside the expansion, on stderr). The real block prints every variable in scope; this one is abridged:```console$ wt step eval -v '{{ branch }}'○ eval template variables:- branch = feature/auth-oauth2- worktree_path = /home/user/projects/myapp-feature-auth-oauth2+ branch = feature/auth+ worktree_path = /home/user/code/myproject.feature-auth+ …+ cwd = /home/user/code/myproject.feature-auth○ eval source{{ branch }}○ eval result- feature/auth-oauth2+ feature/auth-feature/auth-oauth2+feature/auth```### Command reference@@ -949,7 +980,7 @@ Global Options:## wt step prune-Remove worktrees merged into the default branch.+Remove worktrees and branches merged into the default branch.Bulk-removes worktrees and branches that are integrated into the default branch, using the same criteria as `wt remove`'s branch cleanup. Stale worktree entries are cleaned up too.@@ -959,7 +990,7 @@ Locked worktrees and the main worktree are always skipped. The current worktree### Min-age guard-Worktrees younger than `--min-age` (default: 1 day) are skipped. This prevents removing a worktree just created from the default branch — it looks "merged" because its branch points at the same commit.+Worktrees and branches younger than `--min-age` (default: 1 day) are skipped. This prevents removing a worktree just created from the default branch — it looks "merged" because its branch points at the same commit.```console$ wt step prune --min-age=0s # no age guard@@ -987,7 +1018,7 @@ $ wt step prune### Command reference```-wt step prune - Remove worktrees merged into the default branch+wt step prune - Remove worktrees and branches merged into the default branchUsage: wt step prune [OPTIONS]@@ -996,7 +1027,7 @@ Options:Show what would be removed--min-age <MIN_AGE>- Skip worktrees younger than this+ Skip worktrees and branches younger than this[default: 1d]diff --git a/src/cli/hook.rs b/src/cli/hook.rsindex d115bd393..2d0a7cf26 100644--- a/src/cli/hook.rs+++ b/src/cli/hook.rs@@ -89,7 +89,7 @@ fn hook_show_possible_values() -> Vec<clap::builder::PossibleValue> {pub enum HookCommand {/// Show configured hooks///- /// Lists user and project hooks. Project hooks show approval status (❓ = needs approval).+ /// Lists user and project hooks. Project hooks show approval status (`❯` = requires approval).Show {/// Hook type to show (default: all)#[arg(value_parser = PossibleValuesParser::new(hook_show_possible_values()))]diff --git a/src/cli/mod.rs b/src/cli/mod.rsindex 0e89c51fb..b579a1c9b 100644--- a/src/cli/mod.rs+++ b/src/cli/mod.rs@@ -1576,7 +1576,7 @@ $ wt step push| **merge** | `pre-merge` | `post-merge` || **remove** | `pre-remove` | `post-remove` |-`pre-*` hooks block — failure aborts the operation. `post-*` hooks run in the background with output logged (use [`wt config state logs`](/config/#wt-config-state-logs) to find and manage log files). Use `-v` to see the template variables for background hooks; `wt hook <type> --dry-run` previews the commands.+`pre-*` hooks block — failure aborts the operation. `post-*` hooks run in the background with output logged (use [`wt config state logs`](/config/#wt-config-state-logs) to find and manage log files); `wt hook <type> --foreground` runs one inline instead, so its output arrives in the terminal. Use `-v` to see the template variables for background hooks; `wt hook <type> --dry-run` previews the commands.The most common creation hook is `post-start` — it runs background tasks (dev servers, file copying, builds) without blocking worktree creation. Prefer `post-start` over `pre-start` unless a later step needs the work completed first.@@ -1586,7 +1586,7 @@ The most common creation hook is `post-start` — it runs background tasks (dev| `post-switch` | Triggers on all switch results: creating, switching to existing, or staying on current || `pre-start` | Runs once when a new worktree is created, blocking `post-start`/`--execute` until complete: dependency install, env file generation || `post-start` | Runs once when a new worktree is created, in the background: dev servers, long builds, file watchers, copying caches |-| `pre-commit` | Formatters, linters, type checking — runs during `wt merge` before the squash commit |+| `pre-commit` | Formatters, linters, type checking — runs before any Worktrunk commit (`wt step commit`, `wt step squash`, and the commit `wt merge` makes) || `post-commit` | CI triggers, notifications, background linting || `pre-merge` | Tests, security scans, build verification — runs after rebase, before merge to target || `post-merge` | Deployment, notifications, installing updated binaries. Runs in the target branch worktree if it exists, otherwise the primary worktree |@@ -1616,7 +1616,7 @@ Project commands require approval on first run:- If a command changes, new approval is required- Declining skips every project command for that operation — including any already approved — and continues without them; saved approvals are unaffected- Use `--yes` to bypass prompts — useful for CI and automation-- Use `--no-hooks` to skip hooks+- Use `--no-hooks` to skip hooks — accepted by the commands that run them (`wt switch`, `wt merge`, `wt remove`, `wt step commit`, `wt step squash`), not by `wt hook`Manage approvals with `wt config approvals add` and `wt config approvals clear`.@@ -1655,7 +1655,7 @@ server = "npm run dev"Here `install` runs first, then `build` and `server` run together.-Templates are syntax-checked before the pipeline starts and rendered as each step runs, so a step can store [per-branch vars](/config/#wt-config-state-vars) that later steps read via `{{ vars.<key> }}`. Because an earlier step can still change those values, a preview leaves them alone: `wt hook <type> --dry-run` and `wt hook show --expanded` render `{{ vars.<key> }}` as itself while every other variable expands.+Templates are syntax-checked before the pipeline starts and rendered as each step runs, so a step can store [per-branch vars](/config/#wt-config-state-vars) that later steps read via `{{ vars.<key> }}`. Because an earlier step can still change those values, a preview stands the reference in for its value instead of resolving it: `wt hook <type> --dry-run` and `wt hook show --expanded` render `{{ vars.thing | default('none') }}` as `{{ vars.thing }}` — the reference is defined, so the `default` never fires — while every other variable expands. A filter that transforms its input still runs, against the placeholder text: `{{ vars.thing | upper }}` previews as `{{ VARS.THING }}`.Most hooks don't need `[[hook]]` blocks. Reach for them when there's a dependency chain — typically setup that must complete before later steps, like installing dependencies before running a build and dev server concurrently.@@ -1668,7 +1668,7 @@ Most hooks don't need `[[hook]]` blocks. Reach for them when there's a dependenc| Approval | Required | Not required || Execution order | After user hooks | First |-Skip all hooks with `--no-hooks`. To run a specific hook when user and project both define the same name, use `user:name` or `project:name` syntax.+To run a specific hook when user and project both define the same name, use `user:name` or `project:name` syntax.## Template variables@@ -1753,18 +1753,7 @@ Templates support Jinja2 filters for transforming values:| `basename` | `{{ repo_path \| basename }}` | Keep only the last path component (`/a/b/c` → `c`) || `codename(n)` | `{{ branch \| codename(2) }}` | Deterministic friendly words |-The `sanitize_db` filter produces database-safe identifiers — lowercase alphanumeric and underscores, no leading digits, with a 3-character hash suffix to avoid collisions and reserved words. The `sanitize_hash` filter produces a filesystem-safe name and appends a 3-character hash suffix when sanitization changed the input, so distinct originals never collide — already-safe names pass through unchanged. The `codename(n)` filter produces deterministic friendly names from an input string: `codename(1)` returns a noun, `codename(2)` returns `adjective-noun`, and higher counts add more adjectives. The pool is large (~1.26M combinations for `codename(2)`), so it usually stands alone as a worktree leaf:--```toml-# Friendly branch-derived worktree names, e.g. myproject.malleable-opah-worktree-path = "{{ repo_path }}/../{{ repo }}.{{ branch | codename(2) }}"-```--When you want both a friendly name and the original branch identity in the path, put the branch name in a parent directory:--```toml-worktree-path = "{{ repo_path }}/../worktrees/{{ branch | sanitize }}/{{ branch | codename(2) }}"-```+The `sanitize_db` filter produces database-safe identifiers — lowercase alphanumeric and underscores, no leading digits, with a 3-character hash suffix to avoid collisions and reserved words. The `sanitize_hash` filter produces a filesystem-safe name and appends a 3-character hash suffix when sanitization changed the input, so distinct originals never collide — already-safe names pass through unchanged. The `codename(n)` filter produces deterministic friendly names from an input string: `codename(1)` returns a noun, `codename(2)` returns `adjective-noun`, and higher counts add more adjectives. The pool is large (~1.26M combinations for `codename(2)`), so it usually stands alone as a worktree leaf — the [`worktree-path` recipes](/config/#worktree-path-template) show it both alone and under a branch-named parent directory.The `hash` filter is the bare 3-character base36 digest, useful for composing your own truncate-with-collision-avoidance recipes when an output budget is tight (e.g., Unix socket paths capped at 107 bytes):diff --git a/src/cli/step.rs b/src/cli/step.rsindex b40e53a28..3af5bc952 100644--- a/src/cli/step.rs+++ b/src/cli/step.rs@@ -59,9 +59,9 @@ pub struct SquashArgs {}// Ordering: `wt merge` pipeline steps first (commit → squash → rebase → push),-// then standalone utilities (diff, copy-ignored), then experimentals-// (alphabetical: eval, for-each, promote, prune, relocate, tether). Keep this-// enum, the `## Operations` bullet list in `src/cli/mod.rs`, and the+// then standalone utilities (diff, copy-ignored), then the rest, alphabetical+// (eval, for-each, promote, prune, relocate, tether). Keep this enum, the+// `## Operations` bullet list in `src/cli/mod.rs`, and the// `<!-- subdoc: -->` markers in the same relative order./// Run individual operations#[derive(Subcommand)]@@ -69,7 +69,21 @@ pub struct SquashArgs {pub enum StepCommand {/// Stage and commit with LLM-generated message#[command(- after_long_help = r#"See [LLM-generated commit messages](/llm-commits/) for configuration and prompt customization.+ after_long_help = r#"See [LLM-generated commit messages](/llm-commits/) for configuration and prompt customization. Without a `[commit.generation]` command configured, the commit still happens — the message is built from the staged file names instead (`Changes to README.md`).++## Operating on another worktree++`--branch` commits in another worktree's branch without leaving the current one:++```console+$ wt step commit --branch feature+```++The branch must have a checked-out worktree. `--branch` re-roots the whole command: staging, hooks, and the commit all happen there. It has no effect on `--dry-run`, which always previews the current worktree.++## Hooks++`pre-commit` hooks run before the commit and abort it on failure; `post-commit` hooks run after it, in the background with their output logged. `--no-hooks` skips both. See [`wt hook`](/hook/).## Options@@ -111,7 +125,11 @@ Three sections are printed: the rendered prompt, the shell command that would in////// Stages changes and generates message with LLM.#[command(- after_long_help = r#"See [LLM-generated commit messages](/llm-commits/) for configuration and prompt customization.+ after_long_help = r#"See [LLM-generated commit messages](/llm-commits/) for configuration and prompt customization. Without a `[commit.generation]` command configured, the squash still happens — the message lists the squashed commits' subjects under `Squash commits from <branch>` instead.++## Hooks++`pre-commit` hooks run before the squash commit and abort it on failure; `post-commit` hooks run after it, in the background with their output logged. `--no-hooks` skips both. See [`wt hook`](/hook/).## Options@@ -313,6 +331,17 @@ Add to the project config:copy = "wt step copy-ignored"```+## Choosing source and destination++By default the copy runs from the primary worktree into the current one — what a `post-start` hook needs, since the new worktree is where the hook runs. `--from` and `--to` name either end by branch, so a copy can run between two worktrees from anywhere:++```console+$ wt step copy-ignored --from main --to feature # between two named worktrees+$ wt step copy-ignored --from feature # from feature into the current worktree+```++A branch named by `--from` or `--to` must have a worktree.+## What gets copiedAll gitignored files are copied by default, except for built-in excluded directories: VCS metadata (`.bzr/`, `.hg/`, `.jj/`, `.pijul/`, `.sl/`, `.svn/`), tool-state (`.conductor/`, `.entire/`, `.worktrees/`), and nested worktrees. Tracked files are never touched. Discovery handles nested `.gitignore` files, global excludes, and `.git/info/exclude`. Existing files in the destination are skipped, so re-running is safe; `--force` overwrites them.@@ -399,7 +428,7 @@ The `.worktreeinclude` pattern is shared with [Claude Code on desktop](https://cCopyIgnored {/// Source worktree branch///- /// Defaults to main worktree.+ /// Defaults to primary worktree.#[arg(long, add = crate::completion::worktree_only_completer(), value_parser = crate::cli::non_empty_branch)]from: Option<String>,@@ -463,19 +492,21 @@ $ wt step eval '{{ branch | sanitize_db }}'feature_auth_oauth2_a1b```-List the available template variables with `-v` (alongside the expansion, on stderr):+List the available template variables with `-v` (alongside the expansion, on stderr). The real block prints every variable in scope; this one is abridged:```console$ wt step eval -v '{{ branch }}'○ eval template variables:- branch = feature/auth-oauth2- worktree_path = /home/user/projects/myapp-feature-auth-oauth2+ branch = feature/auth+ worktree_path = /home/user/code/myproject.feature-auth+ …+ cwd = /home/user/code/myproject.feature-auth○ eval source{{ branch }}○ eval result- feature/auth-oauth2+ feature/auth-feature/auth-oauth2+feature/auth```"#)]@@ -601,7 +632,7 @@ The swap uses `rename()` for each entry — fast regardless of entry size, sinceformat: crate::cli::SwitchFormat,},- /// Remove worktrees merged into the default branch+ /// Remove worktrees and branches merged into the default branch#[command(after_long_help = r#"Bulk-removes worktrees and branches that are integrated into the default branch, using the same criteria as `wt remove`'s branch cleanup. Stale worktree entries are cleaned up too.@@ -611,7 +642,7 @@ Locked worktrees and the main worktree are always skipped. The current worktree## Min-age guard-Worktrees younger than `--min-age` (default: 1 day) are skipped. This prevents removing a worktree just created from the default branch — it looks "merged" because its branch points at the same commit.+Worktrees and branches younger than `--min-age` (default: 1 day) are skipped. This prevents removing a worktree just created from the default branch — it looks "merged" because its branch points at the same commit.```console$ wt step prune --min-age=0s # no age guard@@ -642,7 +673,7 @@ $ wt step prune#[arg(long)]dry_run: bool,- /// Skip worktrees younger than this+ /// Skip worktrees and branches younger than this#[arg(long, default_value = "1d")]min_age: String,diff --git a/src/commands/hooks.rs b/src/commands/hooks.rsindex 9a4f4bbe4..8d9e23dc2 100644--- a/src/commands/hooks.rs+++ b/src/commands/hooks.rs@@ -141,6 +141,7 @@ pub(crate) fn prepare_and_check(// under a non-empty filter means nothing matched.if !name_filters.is_empty() && result.is_empty() {return Err(no_matching_commands_error(+ hook_type,name_filters,user_config,project_config,@@ -180,9 +181,17 @@ fn filter_step_by_name(}}-/// Build the error for a name filter that matched no commands, listing the-/// available command names across the filters' source scopes.+/// Build the error for a filter that matched no commands.+///+/// A bare source filter (`user:` / `project:`) asks for every hook from one+/// source rather than naming a command, so a miss means that source+/// configures no hooks of this type — there is no name to have misspelled.+/// That gets [`worktrunk::git::GitError::HookSourceNotConfigured`], pointing+/// at the other source; a filter that did name a command gets+/// [`worktrunk::git::GitError::HookCommandNotFound`], listing the available+/// names across the filters' source scopes.fn no_matching_commands_error(+ hook_type: HookType,name_filters: &[String],user_config: Option<&CommandConfig>,project_config: Option<&CommandConfig>,@@ -194,6 +203,41 @@ fn no_matching_commands_error(.iter().map(|f| ParsedFilter::parse(f)).collect();++ let configured = |source: HookSource| {+ let config = match source {+ HookSource::User => user_config,+ HookSource::Project => project_config,+ };+ config.is_some_and(|c| c.commands().next().is_some())+ };+ // Only when every filter is a bare source. A list that also names a+ // command asked about that name, and answering about a source instead+ // would leave the name unmentioned and offer an invocation nobody typed —+ // so a mixed list falls through to `HookCommandNotFound`, which lists what+ // is available across the scopes the filters named.+ let all_bare = parsed_filters.iter().all(|f| f.name.is_empty());+ if let Some(source) = all_bare+ .then(|| {+ parsed_filters+ .iter()+ .filter_map(|f| f.source)+ .find(|source| !configured(*source))+ })+ .flatten()+ {+ let other = match source {+ HookSource::User => HookSource::Project,+ HookSource::Project => HookSource::User,+ };+ return worktrunk::git::GitError::HookSourceNotConfigured {+ source: source.to_string(),+ hook_type,+ other_source: configured(other).then(|| other.to_string()),+ }+ .into();+ }+let mut available = Vec::new();let sources = [diff --git a/src/git/error.rs b/src/git/error.rsindex 769f683c0..1475158c4 100644--- a/src/git/error.rs+++ b/src/git/error.rs@@ -570,6 +570,19 @@ pub enum GitError {name: String,available: Vec<String>,},+ /// A bare source filter (`wt hook pre-merge user:`) selected a source that+ /// configures no hooks of this type.+ ///+ /// Distinct from [`GitError::HookCommandNotFound`], which means a filter+ /// named a command: there the fix is to correct the name, here there is no+ /// name to correct. `other_source` names the source that does configure+ /// hooks of this type, when one does, so the hint can offer the working+ /// invocation.+ HookSourceNotConfigured {+ source: String,+ hook_type: HookType,+ other_source: Option<String>,+ },ParseError {message: String,},@@ -882,6 +895,10 @@ impl GitError {}}+ GitError::HookSourceNotConfigured {+ source, hook_type, ..+ } => format!("No {source} {hook_type} hooks configured"),+GitError::LlmCommandFailed { .. } => "Commit generation command failed".to_string(),GitError::ProjectConfigNotFound { .. } => "No project configuration found".to_string(),@@ -1405,6 +1422,28 @@ impl GitError {write!(f, "{}", error_message(&title))}+ GitError::HookSourceNotConfigured {+ hook_type,+ other_source,+ ..+ } => {+ let title = self.title();+ write!(f, "{}", error_message(&title))?;+ // The filter syntax is `<source>:`, so the working invocation+ // is the same command with the other prefix — when that source+ // has hooks of this type to run.+ match other_source {+ Some(other) => write!(+ f,+ "\n{}",+ hint_message(cformat!(+ "To run the {other} hooks, run <underline>wt hook {hook_type} {other}:</>"+ ))+ ),+ None => Ok(()),+ }+ }+GitError::LlmCommandFailed {command,error,diff --git a/tests/integration_tests/user_hooks.rs b/tests/integration_tests/user_hooks.rsindex e1931274e..deffdb977 100644--- a/tests/integration_tests/user_hooks.rs+++ b/tests/integration_tests/user_hooks.rs@@ -2373,6 +2373,116 @@ bar = "echo ran > project_bar.txt");}+/// A bare source filter (`user:` / `project:`) asks for every hook from one+/// source, so it runs them all without naming any.+#[rstest]+fn test_hook_bare_source_filter_runs_that_source(repo: TestRepo) {+ repo.write_test_config(+ r#"[pre-merge]+fmt = "echo ran > user_fmt.txt"+lint = "echo ran > user_lint.txt"+"#,+ );+ repo.write_project_config(r#"pre-merge = "echo ran > project.txt""#);+ repo.commit("Add pre-merge hooks");++ let output = repo+ .wt_command()+ .args(["hook", "pre-merge", "user:", "--yes"])+ .output()+ .expect("Failed to run wt hook pre-merge");++ assert!(+ output.status.success(),+ "wt hook pre-merge user: failed: {}",+ String::from_utf8_lossy(&output.stderr)+ );+ assert!(+ repo.root_path().join("user_fmt.txt").exists()+ && repo.root_path().join("user_lint.txt").exists(),+ "user: should run every user hook"+ );+ assert!(+ !repo.root_path().join("project.txt").exists(),+ "user: must not reach the project hook"+ );+}++/// A bare source filter that matches nothing means the source configures no+/// hooks of this type — there is no name to have misspelled, so the error says+/// so and points at the invocation that works.+#[rstest]+fn test_hook_bare_source_filter_reports_unconfigured_source(repo: TestRepo) {+ repo.write_project_config(+ r#"[pre-merge]+test = "echo TEST"+lint = "echo LINT"+"#,+ );+ repo.commit("Add pre-merge hooks");++ assert_cmd_snapshot!(+ "hook_bare_user_filter_without_user_hooks",+ make_snapshot_cmd(&repo, "hook", &["pre-merge", "user:", "--yes"], None)+ );+}++/// A filter list that also names a command is answered about that name, not+/// about a source. `user:` alone would report the unconfigured source, but+/// alongside `project:nope` that answer would leave `nope` unmentioned and+/// offer an invocation the user didn't ask for — so the mixed list falls+/// through to `HookCommandNotFound`, which lists what the named scopes hold.+#[rstest]+fn test_hook_mixed_source_and_name_filter_reports_the_name(repo: TestRepo) {+ repo.write_project_config(+ r#"[pre-merge]+test = "echo TEST"+"#,+ );+ repo.commit("Add pre-merge hooks");++ assert_cmd_snapshot!(+ "hook_mixed_filter_falls_through_to_name_error",+ make_snapshot_cmd(+ &repo,+ "hook",+ &["pre-merge", "user:", "project:nope", "--yes"],+ None+ )+ );+}++/// The mirror of the above: `project:` against a repo whose hooks are all in+/// user config.+#[rstest]+fn test_hook_bare_project_filter_reports_unconfigured_source(repo: TestRepo) {+ repo.write_test_config(+ r#"[pre-merge]+fmt = "echo FMT"+"#,+ );++ assert_cmd_snapshot!(+ "hook_bare_project_filter_without_project_hooks",+ make_snapshot_cmd(&repo, "hook", &["pre-merge", "project:", "--yes"], None)+ );+}++/// With neither source configuring the hook type, there is no working+/// invocation to suggest — an empty `[pre-merge]` table is a project config+/// that exists but contributes no commands, so this misses without the+/// "no hooks configured at all" early exit taking over.+#[rstest]+fn test_hook_bare_source_filter_omits_hint_when_neither_source_configured(repo: TestRepo) {+ repo.write_project_config("[pre-merge]\n");+ repo.commit("Add empty pre-merge table");++ assert_cmd_snapshot!(+ "hook_bare_project_filter_no_hooks_anywhere",+ make_snapshot_cmd(&repo, "hook", &["pre-merge", "project:", "--yes"], None)+ );+}+#[rstest]fn test_hook_multiple_name_filters_none_match(repo: TestRepo) {// Write project config with named hooksdiff --git a/tests/snapshots/integration__integration_tests__help__help_step_copy_ignored.snap b/tests/snapshots/integration__integration_tests__help__help_step_copy_ignored.snapindex 1d1ae038a..0ca154ca2 100644--- a/tests/snapshots/integration__integration_tests__help__help_step_copy_ignored.snap+++ b/tests/snapshots/integration__integration_tests__help__help_step_copy_ignored.snap@@ -53,7 +53,7 @@ Usage: [1m[36mwt step copy-ignored[0m [36m[OPTIONS][0m[1m[36m--from[0m[36m [0m[36m<FROM>[0mSource worktree branch[0m- Defaults to main worktree.[0m+ Defaults to primary worktree.[0m[1m[36m--to[0m[36m [0m[36m<TO>[0mDestination worktree branch[0m@@ -105,6 +105,15 @@ Add to the project config:[107m [0m [2m[36m[post-start][0m[107m [0m [2mcopy = [0m[2m[32m"wt step copy-ignored"[0m+[1m[32mChoosing source and destination[0m++By default the copy runs from the primary worktree into the current one — what a [2mpost-start[0m hook needs, since the new worktree is where the hook runs. [2m--from[0m and [2m--to[0m name either end by branch, so a copy can run between two worktrees from anywhere:++[107m [0m [2m[0m[2m[34mwt[0m[2m step copy-ignored [0m[2m[36m--from[0m[2m main [0m[2m[36m--to[0m[2m feature # between two named worktrees[0m+[107m [0m [2m[0m[2m[34mwt[0m[2m step copy-ignored [0m[2m[36m--from[0m[2m feature # from feature into the current worktree[0m++A branch named by [2m--from[0m or [2m--to[0m must have a worktree.+[1m[32mWhat gets copied[0mAll gitignored files are copied by default, except for built-in excluded directories: VCS metadata ([2m.bzr/[0m, [2m.hg/[0m, [2m.jj/[0m, [2m.pijul/[0m, [2m.sl/[0m, [2m.svn/[0m), tool-state ([2m.conductor/[0m, [2m.entire/[0m, [2m.worktrees/[0m), and nested worktrees. Tracked files are never touched. Discovery handles nested [2m.gitignore[0m files, global excludes, and [2m.git/info/exclude[0m. Existing files in the destination are skipped, so re-running is safe; [2m--force[0m overwrites them.diff --git a/tests/snapshots/integration__integration_tests__help__help_step_long.snap b/tests/snapshots/integration__integration_tests__help__help_step_long.snapindex c347baeb3..e21e1cae6 100644--- a/tests/snapshots/integration__integration_tests__help__help_step_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_step_long.snap@@ -58,7 +58,7 @@ Usage: [1m[36mwt step[0m [36m[OPTIONS][0m [36m<COMMAND>[0m[1m[36meval[0m Evaluate a template expression[1m[36mfor-each[0m Run command in each worktree[1m[36mpromote[0m [experimental] Swap a branch into the main worktree- [1m[36mprune[0m Remove worktrees merged into the default branch+ [1m[36mprune[0m Remove worktrees and branches merged into the default branch[1m[36mrelocate[0m [experimental] Move worktrees to expected paths[1m[36mtether[0m [experimental] Run a command; kill its whole process tree when its worktree is removeddiff --git a/tests/snapshots/integration__integration_tests__help__help_step_short.snap b/tests/snapshots/integration__integration_tests__help__help_step_short.snapindex 081a99aff..94901dab8 100644--- a/tests/snapshots/integration__integration_tests__help__help_step_short.snap+++ b/tests/snapshots/integration__integration_tests__help__help_step_short.snap@@ -56,7 +56,7 @@ Usage: [1m[36mwt step[0m [36m[OPTIONS][0m [36m<COMMAND>[0m[1m[36meval[0m Evaluate a template expression[1m[36mfor-each[0m Run command in each worktree[1m[36mpromote[0m [experimental] Swap a branch into the main worktree- [1m[36mprune[0m Remove worktrees merged into the default branch+ [1m[36mprune[0m Remove worktrees and branches merged into the default branch[1m[36mrelocate[0m [experimental] Move worktrees to expected paths[1m[36mtether[0m [experimental] Run a command; kill its whole process tree when its worktree is removeddiff --git a/tests/snapshots/integration__integration_tests__step_alias__step_help_includes_aliases.snap b/tests/snapshots/integration__integration_tests__step_alias__step_help_includes_aliases.snapindex 2991641b6..cbfe1d996 100644--- a/tests/snapshots/integration__integration_tests__step_alias__step_help_includes_aliases.snap+++ b/tests/snapshots/integration__integration_tests__step_alias__step_help_includes_aliases.snap@@ -71,7 +71,7 @@ Usage: [1m[36mwt step[0m [36m[OPTIONS][0m [36m<COMMAND>[0m[1m[36meval[0m Evaluate a template expression[1m[36mfor-each[0m Run command in each worktree[1m[36mpromote[0m [experimental] Swap a branch into the main worktree- [1m[36mprune[0m Remove worktrees merged into the default branch+ [1m[36mprune[0m Remove worktrees and branches merged into the default branch[1m[36mrelocate[0m [experimental] Move worktrees to expected paths[1m[36mtether[0m [experimental] Run a command; kill its whole process tree when its worktree is removeddiff --git a/tests/snapshots/integration__integration_tests__step_alias__step_list_no_aliases.snap b/tests/snapshots/integration__integration_tests__step_alias__step_list_no_aliases.snapindex e39002de8..7885a7f31 100644--- a/tests/snapshots/integration__integration_tests__step_alias__step_list_no_aliases.snap+++ b/tests/snapshots/integration__integration_tests__step_alias__step_list_no_aliases.snap@@ -70,7 +70,7 @@ Usage: [1m[36mwt step[0m [36m[OPTIONS][0m [36m<COMMAND>[0m[1m[36meval[0m Evaluate a template expression[1m[36mfor-each[0m Run command in each worktree[1m[36mpromote[0m [experimental] Swap a branch into the main worktree- [1m[36mprune[0m Remove worktrees merged into the default branch+ [1m[36mprune[0m Remove worktrees and branches merged into the default branch[1m[36mrelocate[0m [experimental] Move worktrees to expected paths[1m[36mtether[0m [experimental] Run a command; kill its whole process tree when its worktree is removeddiff --git a/tests/snapshots/integration__integration_tests__step_alias__step_list_with_aliases.snap b/tests/snapshots/integration__integration_tests__step_alias__step_list_with_aliases.snapindex d87f6a3b0..9150af0b6 100644--- a/tests/snapshots/integration__integration_tests__step_alias__step_list_with_aliases.snap+++ b/tests/snapshots/integration__integration_tests__step_alias__step_list_with_aliases.snap@@ -70,7 +70,7 @@ Usage: [1m[36mwt step[0m [36m[OPTIONS][0m [36m<COMMAND>[0m[1m[36meval[0m Evaluate a template expression[1m[36mfor-each[0m Run command in each worktree[1m[36mpromote[0m [experimental] Swap a branch into the main worktree- [1m[36mprune[0m Remove worktrees merged into the default branch+ [1m[36mprune[0m Remove worktrees and branches merged into the default branch[1m[36mrelocate[0m [experimental] Move worktrees to expected paths[1m[36mtether[0m [experimental] Run a command; kill its whole process tree when its worktree is removeddiff --git a/tests/snapshots/integration__integration_tests__user_hooks__hook_bare_project_filter_no_hooks_anywhere.snap b/tests/snapshots/integration__integration_tests__user_hooks__hook_bare_project_filter_no_hooks_anywhere.snapnew file mode 100644index 000000000..89d2a5b25--- /dev/null+++ b/tests/snapshots/integration__integration_tests__user_hooks__hook_bare_project_filter_no_hooks_anywhere.snap@@ -0,0 +1,64 @@+---+source: tests/integration_tests/user_hooks.rs+info:+ program: wt+ args:+ - hook+ - pre-merge+ - "project:"+ - "--yes"+ env:+ APPDATA: "[TEST_CONFIG_HOME]"+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"+ CLICOLOR_FORCE: "1"+ COLUMNS: "500"+ GIT_ALLOW_PROTOCOL: file+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_AUTHOR_EMAIL: [email protected]+ GIT_AUTHOR_NAME: Test User+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_EMAIL: [email protected]+ GIT_COMMITTER_NAME: Test User+ GIT_CONFIG_COUNT: "2"+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig+ GIT_CONFIG_KEY_0: user.useConfigOnly+ GIT_CONFIG_KEY_1: rerere.enabled+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig+ GIT_CONFIG_VALUE_0: "true"+ GIT_CONFIG_VALUE_1: "false"+ GIT_TERMINAL_PROMPT: "0"+ HOME: "[TEST_HOME]"+ LANG: C+ LC_ALL: C+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"+ PATH: "[PATH]"+ TERM: alacritty+ USERPROFILE: "[TEST_HOME]"+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"+ WORKTRUNK_TEST_BASH_INSTALLED: "0"+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"+ WORKTRUNK_TEST_EPOCH: "1735776000"+ WORKTRUNK_TEST_FISH_INSTALLED: "0"+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"+ WORKTRUNK_TEST_MOCK_CONFIG_DIR: "[TEST_MOCK_CONFIG]"+ WORKTRUNK_TEST_NUSHELL_ENV: "0"+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"+ WORKTRUNK_TEST_PARENT_SHELL: ""+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"+---+success: false+exit_code: 1+----- stdout -----++----- stderr -----+[31m✗[39m [31mNo project pre-merge hooks configured[39mdiff --git a/tests/snapshots/integration__integration_tests__user_hooks__hook_bare_project_filter_without_project_hooks.snap b/tests/snapshots/integration__integration_tests__user_hooks__hook_bare_project_filter_without_project_hooks.snapnew file mode 100644index 000000000..fc11da522--- /dev/null+++ b/tests/snapshots/integration__integration_tests__user_hooks__hook_bare_project_filter_without_project_hooks.snap@@ -0,0 +1,65 @@+---+source: tests/integration_tests/user_hooks.rs+info:+ program: wt+ args:+ - hook+ - pre-merge+ - "project:"+ - "--yes"+ env:+ APPDATA: "[TEST_CONFIG_HOME]"+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"+ CLICOLOR_FORCE: "1"+ COLUMNS: "500"+ GIT_ALLOW_PROTOCOL: file+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_AUTHOR_EMAIL: [email protected]+ GIT_AUTHOR_NAME: Test User+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_EMAIL: [email protected]+ GIT_COMMITTER_NAME: Test User+ GIT_CONFIG_COUNT: "2"+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig+ GIT_CONFIG_KEY_0: user.useConfigOnly+ GIT_CONFIG_KEY_1: rerere.enabled+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig+ GIT_CONFIG_VALUE_0: "true"+ GIT_CONFIG_VALUE_1: "false"+ GIT_TERMINAL_PROMPT: "0"+ HOME: "[TEST_HOME]"+ LANG: C+ LC_ALL: C+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"+ PATH: "[PATH]"+ TERM: alacritty+ USERPROFILE: "[TEST_HOME]"+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"+ WORKTRUNK_TEST_BASH_INSTALLED: "0"+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"+ WORKTRUNK_TEST_EPOCH: "1735776000"+ WORKTRUNK_TEST_FISH_INSTALLED: "0"+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"+ WORKTRUNK_TEST_MOCK_CONFIG_DIR: "[TEST_MOCK_CONFIG]"+ WORKTRUNK_TEST_NUSHELL_ENV: "0"+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"+ WORKTRUNK_TEST_PARENT_SHELL: ""+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"+---+success: false+exit_code: 1+----- stdout -----++----- stderr -----+[31m✗[39m [31mNo project pre-merge hooks configured[39m+[2m↳[22m [2mTo run the user hooks, run [4mwt hook pre-merge user:[24m[22mdiff --git a/tests/snapshots/integration__integration_tests__user_hooks__hook_bare_user_filter_without_user_hooks.snap b/tests/snapshots/integration__integration_tests__user_hooks__hook_bare_user_filter_without_user_hooks.snapnew file mode 100644index 000000000..69c26b7ab--- /dev/null+++ b/tests/snapshots/integration__integration_tests__user_hooks__hook_bare_user_filter_without_user_hooks.snap@@ -0,0 +1,65 @@+---+source: tests/integration_tests/user_hooks.rs+info:+ program: wt+ args:+ - hook+ - pre-merge+ - "user:"+ - "--yes"+ env:+ APPDATA: "[TEST_CONFIG_HOME]"+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"+ CLICOLOR_FORCE: "1"+ COLUMNS: "500"+ GIT_ALLOW_PROTOCOL: file+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_AUTHOR_EMAIL: [email protected]+ GIT_AUTHOR_NAME: Test User+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_EMAIL: [email protected]+ GIT_COMMITTER_NAME: Test User+ GIT_CONFIG_COUNT: "2"+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig+ GIT_CONFIG_KEY_0: user.useConfigOnly+ GIT_CONFIG_KEY_1: rerere.enabled+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig+ GIT_CONFIG_VALUE_0: "true"+ GIT_CONFIG_VALUE_1: "false"+ GIT_TERMINAL_PROMPT: "0"+ HOME: "[TEST_HOME]"+ LANG: C+ LC_ALL: C+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"+ PATH: "[PATH]"+ TERM: alacritty+ USERPROFILE: "[TEST_HOME]"+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"+ WORKTRUNK_TEST_BASH_INSTALLED: "0"+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"+ WORKTRUNK_TEST_EPOCH: "1735776000"+ WORKTRUNK_TEST_FISH_INSTALLED: "0"+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"+ WORKTRUNK_TEST_MOCK_CONFIG_DIR: "[TEST_MOCK_CONFIG]"+ WORKTRUNK_TEST_NUSHELL_ENV: "0"+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"+ WORKTRUNK_TEST_PARENT_SHELL: ""+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"+---+success: false+exit_code: 1+----- stdout -----++----- stderr -----+[31m✗[39m [31mNo user pre-merge hooks configured[39m+[2m↳[22m [2mTo run the project hooks, run [4mwt hook pre-merge project:[24m[22mdiff --git a/tests/snapshots/integration__integration_tests__user_hooks__hook_mixed_filter_falls_through_to_name_error.snap b/tests/snapshots/integration__integration_tests__user_hooks__hook_mixed_filter_falls_through_to_name_error.snapnew file mode 100644index 000000000..e28630361--- /dev/null+++ b/tests/snapshots/integration__integration_tests__user_hooks__hook_mixed_filter_falls_through_to_name_error.snap@@ -0,0 +1,65 @@+---+source: tests/integration_tests/user_hooks.rs+info:+ program: wt+ args:+ - hook+ - pre-merge+ - "user:"+ - "project:nope"+ - "--yes"+ env:+ APPDATA: "[TEST_CONFIG_HOME]"+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"+ CLICOLOR_FORCE: "1"+ COLUMNS: "500"+ GIT_ALLOW_PROTOCOL: file+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_AUTHOR_EMAIL: [email protected]+ GIT_AUTHOR_NAME: Test User+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_EMAIL: [email protected]+ GIT_COMMITTER_NAME: Test User+ GIT_CONFIG_COUNT: "2"+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig+ GIT_CONFIG_KEY_0: user.useConfigOnly+ GIT_CONFIG_KEY_1: rerere.enabled+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig+ GIT_CONFIG_VALUE_0: "true"+ GIT_CONFIG_VALUE_1: "false"+ GIT_TERMINAL_PROMPT: "0"+ HOME: "[TEST_HOME]"+ LANG: C+ LC_ALL: C+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"+ PATH: "[PATH]"+ TERM: alacritty+ USERPROFILE: "[TEST_HOME]"+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"+ WORKTRUNK_TEST_BASH_INSTALLED: "0"+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"+ WORKTRUNK_TEST_EPOCH: "1735776000"+ WORKTRUNK_TEST_FISH_INSTALLED: "0"+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"+ WORKTRUNK_TEST_MOCK_CONFIG_DIR: "[TEST_MOCK_CONFIG]"+ WORKTRUNK_TEST_NUSHELL_ENV: "0"+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"+ WORKTRUNK_TEST_PARENT_SHELL: ""+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"+---+success: false+exit_code: 1+----- stdout -----++----- stderr -----+[31m✗[39m [31mNo command named [1muser:, project:nope[22m (available: [1mproject:test[22m)[39m