Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
docs: improve hook command help text (#1785)
worktrunk-bot37192edf0432
diff --git a/docs/content/hook.md b/docs/content/hook.mdindex 165f46fbb..bfce919d1 100644--- a/docs/content/hook.md+++ b/docs/content/hook.md@@ -11,7 +11,7 @@ group = "Commands"Run configured hooks.-Hooks are shell commands that run at key points in the worktree lifecycle — automatically during `wt switch`, `wt merge`, & `wt remove`, or on demand via `wt hook <type>`. Both user (`~/.config/worktrunk/config.toml`) and project (`.config/wt.toml`) hooks are supported.+Hooks are shell commands that run at key points in the worktree lifecycle — automatically during `wt switch`, `wt merge`, & `wt remove`, or on demand via `wt hook <type>`. Both user and project hooks are supported.# Hook Types@@ -23,109 +23,22 @@ 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 to `.git/wt/logs/{branch}-{source}-{hook}-{name}.log`. Use `-v` to see expanded command details for background hooks.+`pre-*` hooks block — failure aborts the operation. `post-*` hooks run in the background with output logged (use [`wt config state logs`](@/config.md#wt-config-state-logs) to find and manage log files). Use `-v` to see expanded command details for background hooks.The most common starting point is `post-start` — it runs background tasks (dev servers, file copying, builds) when creating a worktree.-## pre-switch--Runs before every `wt switch` — before branch resolution or worktree creation. `{{ branch }}` is the destination branch argument as the user typed it (before resolution).--```toml-[pre-switch]-# Pull if last fetch was more than 6 hours ago-pull = """-FETCH_HEAD="$(git rev-parse --git-common-dir)/FETCH_HEAD"-if [ "$(find "$FETCH_HEAD" -mmin +360 2>/dev/null)" ] || [ ! -f "$FETCH_HEAD" ]; then- git pull-fi-"""-```--## post-switch--Triggers on all switch results: creating new worktrees, switching to existing ones, or staying on current.--```toml-[post-switch]-tmux = "[ -n \"$TMUX\" ] && tmux rename-window {{ branch | sanitize }}"-```--## pre-start--Tasks that must complete before `post-start` hooks or `--execute` run: dependency installation, environment file generation.--```toml-[pre-start]-install = "npm ci"-env = "echo 'PORT={{ branch | hash_port }}' > .env.local"-```--## post-start--Dev servers, long builds, file watchers, copying caches.--```toml-[post-start]-copy = "wt step copy-ignored"-server = "npm run dev -- --port {{ branch | hash_port }}"-```--## pre-commit--Formatters, linters, type checking — runs during `wt merge` before the squash commit.--```toml-[pre-commit]-format = "cargo fmt -- --check"-lint = "cargo clippy -- -D warnings"-```--## post-commit--CI triggers, notifications, background linting.--```toml-[post-commit]-notify = "curl -s https://ci.example.com/trigger?branch={{ branch }}"-```--## pre-merge--Tests, security scans, build verification — runs after rebase, before merge to target.--```toml-[pre-merge]-test = "cargo test"-build = "cargo build --release"-```--## post-merge--Deployment, notifications, installing updated binaries. Runs in the target branch worktree if it exists, otherwise the primary worktree.--```toml-post-merge = "cargo install --path ."-```--## pre-remove--Cleanup tasks before worktree is deleted, saving test artifacts, backing up state. Runs in the worktree being removed, with access to worktree files.--```toml-[pre-remove]-archive = "tar -czf ~/.wt-logs/{{ branch }}.tar.gz test-results/ logs/ 2>/dev/null || true"-```--## post-remove--Stopping dev servers, removing containers, notifying external systems. Template variables reference the removed worktree, so cleanup scripts can identify resources to tear down.--```toml-[post-remove]-kill-server = "lsof -ti :{{ branch | hash_port }} -sTCP:LISTEN | xargs kill 2>/dev/null || true"-remove-db = "docker stop {{ repo }}-{{ branch | sanitize }}-postgres 2>/dev/null || true"-```+| Hook | Purpose |+|------|---------|+| `pre-switch` | Runs before branch resolution or worktree creation. `{{ branch }}` is the destination as typed (before resolution) |+| `post-switch` | Triggers on all switch results: creating, switching to existing, or staying on current |+| `pre-start` | Tasks that must complete before `post-start`/`--execute`: dependency install, env file generation |+| `post-start` | Dev servers, long builds, file watchers, copying caches |+| `pre-commit` | Formatters, linters, type checking — runs during `wt merge` before the squash commit |+| `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 |+| `pre-remove` | Cleanup before worktree deletion: saving test artifacts, backing up state. Runs in the worktree being removed |+| `post-remove` | Stopping dev servers, removing containers, notifying external systems. Template variables reference the removed worktree |During `wt merge`, hooks run in this order: pre-commit → post-commit → pre-merge → pre-remove → post-remove + post-merge. As usual, post-* hooks run in the background. See [`wt merge`](@/merge.md#pipeline) for the complete pipeline.@@ -146,7 +59,7 @@ Project commands require approval on first run:<span class="c">❯</span> Allow and remember? <b>[y/N]</b>{% end %}-- Approvals are saved to user config (`~/.config/worktrunk/config.toml`)+- Approvals are saved to `~/.config/worktrunk/approvals.toml`- If a command changes, new approval is required- Use `--yes` to bypass prompts — useful for CI and automation- Use `--no-verify` to skip hooks@@ -483,6 +396,51 @@ install = "uv sync"For copying dependencies and caches between worktrees, see [`wt step copy-ignored`](@/step.md#language-specific-notes).+## Hook type examples++```toml+# Single command (string) — top-level, before any table headers+post-merge = "cargo install --path ."++[pre-switch]+# Pull if last fetch was more than 6 hours ago+pull = """+FETCH_HEAD="$(git rev-parse --git-common-dir)/FETCH_HEAD"+if [ "$(find "$FETCH_HEAD" -mmin +360 2>/dev/null)" ] || [ ! -f "$FETCH_HEAD" ]; then+ git pull+fi+"""++[post-switch]+tmux = "[ -n \"$TMUX\" ] && tmux rename-window {{ branch | sanitize }}"++[pre-start]+install = "npm ci"+env = "echo 'PORT={{ branch | hash_port }}' > .env.local"++[post-start]+copy = "wt step copy-ignored"+server = "npm run dev -- --port {{ branch | hash_port }}"++[pre-commit]+format = "cargo fmt -- --check"+lint = "cargo clippy -- -D warnings"++[post-commit]+notify = "curl -s https://ci.example.com/trigger?branch={{ branch }}"++[pre-merge]+test = "cargo test"+build = "cargo build --release"++[pre-remove]+archive = "tar -czf ~/.wt-logs/{{ branch }}.tar.gz test-results/ logs/ 2>/dev/null || true"++[post-remove]+kill-server = "lsof -ti :{{ branch | hash_port }} -sTCP:LISTEN | xargs kill 2>/dev/null || true"+remove-db = "docker stop {{ repo }}-{{ branch | sanitize }}-postgres 2>/dev/null || true"+```+## See also- [`wt merge`](@/merge.md) — Runs hooks automatically during mergediff --git a/docs/content/switch.md b/docs/content/switch.mdindex ae56a6951..1ffce623f 100644--- a/docs/content/switch.md+++ b/docs/content/switch.md@@ -32,11 +32,11 @@ The `--create` flag creates a new branch from `--base` — the default branch unIf the branch already has a worktree, `wt switch` changes directories to it. Otherwise, it creates one:-1. Runs [pre-switch hooks](@/hook.md#pre-switch), blocking until complete+1. Runs [pre-switch hooks](@/hook.md#hook-types), blocking until complete2. Creates worktree at configured path3. Switches to new directory-4. Runs [pre-start hooks](@/hook.md#pre-start), blocking until complete-5. Spawns [post-start](@/hook.md#post-start) and [post-switch hooks](@/hook.md#post-switch) in the background+4. Runs [pre-start hooks](@/hook.md#hook-types), blocking until complete+5. Spawns [post-start](@/hook.md#hook-types) and [post-switch hooks](@/hook.md#hook-types) in the background{{ terminal(cmd="wt switch feature # Existing branch → creates worktree|||wt switch --create feature # New branch and worktree|||wt switch --create fix --base release # New branch from release|||wt switch --create temp --no-verify # Skip hooks") }}diff --git a/skills/worktrunk/reference/hook.md b/skills/worktrunk/reference/hook.mdindex df1c7df18..3ba77b1ed 100644--- a/skills/worktrunk/reference/hook.md+++ b/skills/worktrunk/reference/hook.md@@ -2,7 +2,7 @@Run configured hooks.-Hooks are shell commands that run at key points in the worktree lifecycle — automatically during `wt switch`, `wt merge`, & `wt remove`, or on demand via `wt hook <type>`. Both user (`~/.config/worktrunk/config.toml`) and project (`.config/wt.toml`) hooks are supported.+Hooks are shell commands that run at key points in the worktree lifecycle — automatically during `wt switch`, `wt merge`, & `wt remove`, or on demand via `wt hook <type>`. Both user and project hooks are supported.# Hook Types@@ -14,109 +14,22 @@ 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 to `.git/wt/logs/{branch}-{source}-{hook}-{name}.log`. Use `-v` to see expanded command details for background hooks.+`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 expanded command details for background hooks.The most common starting point is `post-start` — it runs background tasks (dev servers, file copying, builds) when creating a worktree.-## pre-switch--Runs before every `wt switch` — before branch resolution or worktree creation. `{{ branch }}` is the destination branch argument as the user typed it (before resolution).--```toml-[pre-switch]-# Pull if last fetch was more than 6 hours ago-pull = """-FETCH_HEAD="$(git rev-parse --git-common-dir)/FETCH_HEAD"-if [ "$(find "$FETCH_HEAD" -mmin +360 2>/dev/null)" ] || [ ! -f "$FETCH_HEAD" ]; then- git pull-fi-"""-```--## post-switch--Triggers on all switch results: creating new worktrees, switching to existing ones, or staying on current.--```toml-[post-switch]-tmux = "[ -n \"$TMUX\" ] && tmux rename-window {{ branch | sanitize }}"-```--## pre-start--Tasks that must complete before `post-start` hooks or `--execute` run: dependency installation, environment file generation.--```toml-[pre-start]-install = "npm ci"-env = "echo 'PORT={{ branch | hash_port }}' > .env.local"-```--## post-start--Dev servers, long builds, file watchers, copying caches.--```toml-[post-start]-copy = "wt step copy-ignored"-server = "npm run dev -- --port {{ branch | hash_port }}"-```--## pre-commit--Formatters, linters, type checking — runs during `wt merge` before the squash commit.--```toml-[pre-commit]-format = "cargo fmt -- --check"-lint = "cargo clippy -- -D warnings"-```--## post-commit--CI triggers, notifications, background linting.--```toml-[post-commit]-notify = "curl -s https://ci.example.com/trigger?branch={{ branch }}"-```--## pre-merge--Tests, security scans, build verification — runs after rebase, before merge to target.--```toml-[pre-merge]-test = "cargo test"-build = "cargo build --release"-```--## post-merge--Deployment, notifications, installing updated binaries. Runs in the target branch worktree if it exists, otherwise the primary worktree.--```toml-post-merge = "cargo install --path ."-```--## pre-remove--Cleanup tasks before worktree is deleted, saving test artifacts, backing up state. Runs in the worktree being removed, with access to worktree files.--```toml-[pre-remove]-archive = "tar -czf ~/.wt-logs/{{ branch }}.tar.gz test-results/ logs/ 2>/dev/null || true"-```--## post-remove--Stopping dev servers, removing containers, notifying external systems. Template variables reference the removed worktree, so cleanup scripts can identify resources to tear down.--```toml-[post-remove]-kill-server = "lsof -ti :{{ branch | hash_port }} -sTCP:LISTEN | xargs kill 2>/dev/null || true"-remove-db = "docker stop {{ repo }}-{{ branch | sanitize }}-postgres 2>/dev/null || true"-```+| Hook | Purpose |+|------|---------|+| `pre-switch` | Runs before branch resolution or worktree creation. `{{ branch }}` is the destination as typed (before resolution) |+| `post-switch` | Triggers on all switch results: creating, switching to existing, or staying on current |+| `pre-start` | Tasks that must complete before `post-start`/`--execute`: dependency install, env file generation |+| `post-start` | Dev servers, long builds, file watchers, copying caches |+| `pre-commit` | Formatters, linters, type checking — runs during `wt merge` before the squash commit |+| `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 |+| `pre-remove` | Cleanup before worktree deletion: saving test artifacts, backing up state. Runs in the worktree being removed |+| `post-remove` | Stopping dev servers, removing containers, notifying external systems. Template variables reference the removed worktree |During `wt merge`, hooks run in this order: pre-commit → post-commit → pre-merge → pre-remove → post-remove + post-merge. As usual, post-* hooks run in the background. See [`wt merge`](https://worktrunk.dev/merge/#pipeline) for the complete pipeline.@@ -135,7 +48,7 @@ Project commands require approval on first run:<span class="c">❯</span> Allow and remember? <b>[y/N]</b>-- Approvals are saved to user config (`~/.config/worktrunk/config.toml`)+- Approvals are saved to `~/.config/worktrunk/approvals.toml`- If a command changes, new approval is required- Use `--yes` to bypass prompts — useful for CI and automation- Use `--no-verify` to skip hooks@@ -474,6 +387,51 @@ install = "uv sync"For copying dependencies and caches between worktrees, see [`wt step copy-ignored`](https://worktrunk.dev/step/#language-specific-notes).+## Hook type examples++```toml+# Single command (string) — top-level, before any table headers+post-merge = "cargo install --path ."++[pre-switch]+# Pull if last fetch was more than 6 hours ago+pull = """+FETCH_HEAD="$(git rev-parse --git-common-dir)/FETCH_HEAD"+if [ "$(find "$FETCH_HEAD" -mmin +360 2>/dev/null)" ] || [ ! -f "$FETCH_HEAD" ]; then+ git pull+fi+"""++[post-switch]+tmux = "[ -n \"$TMUX\" ] && tmux rename-window {{ branch | sanitize }}"++[pre-start]+install = "npm ci"+env = "echo 'PORT={{ branch | hash_port }}' > .env.local"++[post-start]+copy = "wt step copy-ignored"+server = "npm run dev -- --port {{ branch | hash_port }}"++[pre-commit]+format = "cargo fmt -- --check"+lint = "cargo clippy -- -D warnings"++[post-commit]+notify = "curl -s https://ci.example.com/trigger?branch={{ branch }}"++[pre-merge]+test = "cargo test"+build = "cargo build --release"++[pre-remove]+archive = "tar -czf ~/.wt-logs/{{ branch }}.tar.gz test-results/ logs/ 2>/dev/null || true"++[post-remove]+kill-server = "lsof -ti :{{ branch | hash_port }} -sTCP:LISTEN | xargs kill 2>/dev/null || true"+remove-db = "docker stop {{ repo }}-{{ branch | sanitize }}-postgres 2>/dev/null || true"+```+## Command referencewt hook - Run configured hooksdiff --git a/skills/worktrunk/reference/switch.md b/skills/worktrunk/reference/switch.mdindex 25d37f635..2a4ba0ff3 100644--- a/skills/worktrunk/reference/switch.md+++ b/skills/worktrunk/reference/switch.md@@ -18,11 +18,11 @@ The `--create` flag creates a new branch from `--base` — the default branch unIf the branch already has a worktree, `wt switch` changes directories to it. Otherwise, it creates one:-1. Runs [pre-switch hooks](https://worktrunk.dev/hook/#pre-switch), blocking until complete+1. Runs [pre-switch hooks](https://worktrunk.dev/hook/#hook-types), blocking until complete2. Creates worktree at configured path3. Switches to new directory-4. Runs [pre-start hooks](https://worktrunk.dev/hook/#pre-start), blocking until complete-5. Spawns [post-start](https://worktrunk.dev/hook/#post-start) and [post-switch hooks](https://worktrunk.dev/hook/#post-switch) in the background+4. Runs [pre-start hooks](https://worktrunk.dev/hook/#hook-types), blocking until complete+5. Spawns [post-start](https://worktrunk.dev/hook/#hook-types) and [post-switch hooks](https://worktrunk.dev/hook/#hook-types) in the background```bash$ wt switch feature # Existing branch → creates worktree|||wt switch --create feature # New branch and worktree|||wt switch --create fix --base release # New branch from release|||wt switch --create temp --no-verify # Skip hooksdiff --git a/src/cli/mod.rs b/src/cli/mod.rsindex 9bacf6d1f..ac4346415 100644--- a/src/cli/mod.rs+++ b/src/cli/mod.rs@@ -270,11 +270,11 @@ The `--create` flag creates a new branch from `--base` — the default branch unIf the branch already has a worktree, `wt switch` changes directories to it. Otherwise, it creates one:-1. Runs [pre-switch hooks](@/hook.md#pre-switch), blocking until complete+1. Runs [pre-switch hooks](@/hook.md#hook-types), blocking until complete2. Creates worktree at configured path3. Switches to new directory-4. Runs [pre-start hooks](@/hook.md#pre-start), blocking until complete-5. Spawns [post-start](@/hook.md#post-start) and [post-switch hooks](@/hook.md#post-switch) in the background+4. Runs [pre-start hooks](@/hook.md#hook-types), blocking until complete+5. Spawns [post-start](@/hook.md#hook-types) and [post-switch hooks](@/hook.md#hook-types) in the background```console$ wt switch feature # Existing branch → creates worktree@@ -1099,7 +1099,7 @@ Alias names that match a built-in step command (`commit`, `squash`, etc.) are sh/// Run configured hooks#[command(name = "hook",- after_long_help = r#"Hooks are shell commands that run at key points in the worktree lifecycle — automatically during `wt switch`, `wt merge`, & `wt remove`, or on demand via `wt hook <type>`. Both user (`~/.config/worktrunk/config.toml`) and project (`.config/wt.toml`) hooks are supported.+ after_long_help = r#"Hooks are shell commands that run at key points in the worktree lifecycle — automatically during `wt switch`, `wt merge`, & `wt remove`, or on demand via `wt hook <type>`. Both user and project hooks are supported.# Hook Types@@ -1111,109 +1111,22 @@ Alias names that match a built-in step command (`commit`, `squash`, etc.) are sh| **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 to `.git/wt/logs/{branch}-{source}-{hook}-{name}.log`. Use `-v` to see expanded command details for background hooks.+`pre-*` hooks block — failure aborts the operation. `post-*` hooks run in the background with output logged (use [`wt config state logs`](@/config.md#wt-config-state-logs) to find and manage log files). Use `-v` to see expanded command details for background hooks.The most common starting point is `post-start` — it runs background tasks (dev servers, file copying, builds) when creating a worktree.-## pre-switch--Runs before every `wt switch` — before branch resolution or worktree creation. `{{ branch }}` is the destination branch argument as the user typed it (before resolution).--```toml-[pre-switch]-# Pull if last fetch was more than 6 hours ago-pull = """-FETCH_HEAD="$(git rev-parse --git-common-dir)/FETCH_HEAD"-if [ "$(find "$FETCH_HEAD" -mmin +360 2>/dev/null)" ] || [ ! -f "$FETCH_HEAD" ]; then- git pull-fi-"""-```--## post-switch--Triggers on all switch results: creating new worktrees, switching to existing ones, or staying on current.--```toml-[post-switch]-tmux = "[ -n \"$TMUX\" ] && tmux rename-window {{ branch | sanitize }}"-```--## pre-start--Tasks that must complete before `post-start` hooks or `--execute` run: dependency installation, environment file generation.--```toml-[pre-start]-install = "npm ci"-env = "echo 'PORT={{ branch | hash_port }}' > .env.local"-```--## post-start--Dev servers, long builds, file watchers, copying caches.--```toml-[post-start]-copy = "wt step copy-ignored"-server = "npm run dev -- --port {{ branch | hash_port }}"-```--## pre-commit--Formatters, linters, type checking — runs during `wt merge` before the squash commit.--```toml-[pre-commit]-format = "cargo fmt -- --check"-lint = "cargo clippy -- -D warnings"-```--## post-commit--CI triggers, notifications, background linting.--```toml-[post-commit]-notify = "curl -s https://ci.example.com/trigger?branch={{ branch }}"-```--## pre-merge--Tests, security scans, build verification — runs after rebase, before merge to target.--```toml-[pre-merge]-test = "cargo test"-build = "cargo build --release"-```--## post-merge--Deployment, notifications, installing updated binaries. Runs in the target branch worktree if it exists, otherwise the primary worktree.--```toml-post-merge = "cargo install --path ."-```--## pre-remove--Cleanup tasks before worktree is deleted, saving test artifacts, backing up state. Runs in the worktree being removed, with access to worktree files.--```toml-[pre-remove]-archive = "tar -czf ~/.wt-logs/{{ branch }}.tar.gz test-results/ logs/ 2>/dev/null || true"-```--## post-remove--Stopping dev servers, removing containers, notifying external systems. Template variables reference the removed worktree, so cleanup scripts can identify resources to tear down.--```toml-[post-remove]-kill-server = "lsof -ti :{{ branch | hash_port }} -sTCP:LISTEN | xargs kill 2>/dev/null || true"-remove-db = "docker stop {{ repo }}-{{ branch | sanitize }}-postgres 2>/dev/null || true"-```+| Hook | Purpose |+|------|---------|+| `pre-switch` | Runs before branch resolution or worktree creation. `{{ branch }}` is the destination as typed (before resolution) |+| `post-switch` | Triggers on all switch results: creating, switching to existing, or staying on current |+| `pre-start` | Tasks that must complete before `post-start`/`--execute`: dependency install, env file generation |+| `post-start` | Dev servers, long builds, file watchers, copying caches |+| `pre-commit` | Formatters, linters, type checking — runs during `wt merge` before the squash commit |+| `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 |+| `pre-remove` | Cleanup before worktree deletion: saving test artifacts, backing up state. Runs in the worktree being removed |+| `post-remove` | Stopping dev servers, removing containers, notifying external systems. Template variables reference the removed worktree |During `wt merge`, hooks run in this order: pre-commit → post-commit → pre-merge → pre-remove → post-remove + post-merge. As usual, post-* hooks run in the background. See [`wt merge`](@/merge.md#pipeline) for the complete pipeline.@@ -1234,7 +1147,7 @@ Project commands require approval on first run:❯ Allow and remember? [y/N]```-- Approvals are saved to user config (`~/.config/worktrunk/config.toml`)+- Approvals are saved to `~/.config/worktrunk/approvals.toml`- If a command changes, new approval is required- Use `--yes` to bypass prompts — useful for CI and automation- Use `--no-verify` to skip hooks@@ -1578,6 +1491,51 @@ install = "uv sync"For copying dependencies and caches between worktrees, see [`wt step copy-ignored`](@/step.md#language-specific-notes).+## Hook type examples++```toml+# Single command (string) — top-level, before any table headers+post-merge = "cargo install --path ."++[pre-switch]+# Pull if last fetch was more than 6 hours ago+pull = """+FETCH_HEAD="$(git rev-parse --git-common-dir)/FETCH_HEAD"+if [ "$(find "$FETCH_HEAD" -mmin +360 2>/dev/null)" ] || [ ! -f "$FETCH_HEAD" ]; then+ git pull+fi+"""++[post-switch]+tmux = "[ -n \"$TMUX\" ] && tmux rename-window {{ branch | sanitize }}"++[pre-start]+install = "npm ci"+env = "echo 'PORT={{ branch | hash_port }}' > .env.local"++[post-start]+copy = "wt step copy-ignored"+server = "npm run dev -- --port {{ branch | hash_port }}"++[pre-commit]+format = "cargo fmt -- --check"+lint = "cargo clippy -- -D warnings"++[post-commit]+notify = "curl -s https://ci.example.com/trigger?branch={{ branch }}"++[pre-merge]+test = "cargo test"+build = "cargo build --release"++[pre-remove]+archive = "tar -czf ~/.wt-logs/{{ branch }}.tar.gz test-results/ logs/ 2>/dev/null || true"++[post-remove]+kill-server = "lsof -ti :{{ branch | hash_port }} -sTCP:LISTEN | xargs kill 2>/dev/null || true"+remove-db = "docker stop {{ repo }}-{{ branch | sanitize }}-postgres 2>/dev/null || true"+```+## See also- [`wt merge`](@/merge.md) — Runs hooks automatically during merge