Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Refactor: Rename hook command keys

Maximilian Roos2c201a792ec4
diff --git a/.claude-plugin/skills/worktrunk/SKILL.md b/.claude-plugin/skills/worktrunk/SKILL.md
index 7c903a2a7..695ac3e63 100644
--- a/.claude-plugin/skills/worktrunk/SKILL.md
+++ b/.claude-plugin/skills/worktrunk/SKILL.md
@@ -109,9 +109,9 @@ Common request for workflow automation. Follow discovery process:
- For Python: Check pyproject.toml
3. **Design appropriate hooks**
- - Dependencies (fast, must complete) → `post-create-command`
- - Tests/linting (must pass) → `pre-commit-command` or `pre-merge-command`
- - Long builds → `post-start-command`
+ - Dependencies (fast, must complete) → `post-create`
+ - Tests/linting (must pass) → `pre-commit` or `pre-merge`
+ - Long builds → `post-start`
4. **Validate commands work**
```console
@@ -122,13 +122,13 @@ Common request for workflow automation. Follow discovery process:
5. **Create `.config/wt.toml`**
```toml
# Install dependencies when creating worktrees
- post-create-command = "npm install"
+ post-create = "npm install"
# Validate code quality before committing
- pre-commit-command = ["npm run lint", "npm run typecheck"]
+ pre-commit = ["npm run lint", "npm run typecheck"]
# Run tests before merging
- pre-merge-command = "npm test"
+ pre-merge = "npm test"
```
6. **Add comments explaining choices**
@@ -192,5 +192,5 @@ Find specific sections with grep:
```console
grep -A 20 "## Installation" reference/README.md
grep -A 20 "## LLM Setup" reference/user-config.md
-grep -A 30 "### post-create-command" reference/project-config.md
+grep -A 30 "### post-create" reference/project-config.md
```
diff --git a/.claude-plugin/skills/worktrunk/reference/hook-types-reference.md b/.claude-plugin/skills/worktrunk/reference/hook-types-reference.md
index 0802d6fa7..4eb06d781 100644
--- a/.claude-plugin/skills/worktrunk/reference/hook-types-reference.md
+++ b/.claude-plugin/skills/worktrunk/reference/hook-types-reference.md
@@ -6,18 +6,18 @@ Detailed behavior and use cases for all five Worktrunk hook types.
| Hook | When | Blocking? | Fail-Fast? | Variables | Execution |
|------|------|-----------|------------|-----------|-----------|
-| `post-create-command` | After creating worktree | Yes | No | Basic | Sequential |
-| `post-start-command` | When switching to worktree | No | No | Basic | Parallel |
-| `pre-commit-command` | Before committing during merge | Yes | Yes | Basic + Merge | Sequential |
-| `pre-merge-command` | Before merging to target | Yes | Yes | Basic + Merge | Sequential |
-| `post-merge-command` | After successful merge | Yes | No | Basic + Merge | Sequential |
+| `post-create` | After creating worktree | Yes | No | Basic | Sequential |
+| `post-start` | When switching to worktree | No | No | Basic | Parallel |
+| `pre-commit` | Before committing during merge | Yes | Yes | Basic + Merge | Sequential |
+| `pre-merge` | Before merging to target | Yes | Yes | Basic + Merge | Sequential |
+| `post-merge` | After successful merge | Yes | No | Basic + Merge | Sequential |
**Basic variables**: `{{ repo }}`, `{{ branch }}`, `{{ worktree }}`, `{{ repo_root }}`
**Merge variables**: Basic + `{{ target }}`
## Detailed Behavior
-### post-create-command
+### post-create
**When it runs**: After creating a new worktree, before switching to it.
@@ -35,7 +35,7 @@ Detailed behavior and use cases for all five Worktrunk hook types.
**Example**:
```toml
-post-create-command = [
+post-create = [
"npm install",
"npm run db:migrate",
"cp .env.example .env"
@@ -44,7 +44,7 @@ post-create-command = [
**What happens**: User runs `wt switch --create feature-x`. Commands execute sequentially. User sees progress. After all complete, they're switched to the new worktree.
-### post-start-command
+### post-start
**When it runs**: After creating a new worktree (not when switching to existing).
@@ -62,7 +62,7 @@ post-create-command = [
**Example**:
```toml
-post-start-command = [
+post-start = [
"npm run build",
"docker-compose up -d",
"git pull origin main"
@@ -71,7 +71,7 @@ post-start-command = [
**What happens**: User runs `wt switch --create feature-x`. After creation completes, all three commands start immediately in parallel in background. User can work while they run. Check `.wt-logs/` for output.
-### pre-commit-command
+### pre-commit
**When it runs**: Before committing changes during `wt merge`.
@@ -89,7 +89,7 @@ post-start-command = [
**Example**:
```toml
-pre-commit-command = [
+pre-commit = [
"npm run lint",
"npm run typecheck",
"npm run format:check"
@@ -98,7 +98,7 @@ pre-commit-command = [
**What happens**: User runs `wt merge`. Before creating commit, all three commands run. If any fails, commit is aborted. User fixes issues and tries again.
-### pre-merge-command
+### pre-merge
**When it runs**: Before merging to target branch during `wt merge`.
@@ -117,7 +117,7 @@ pre-commit-command = [
**Example**:
```toml
-pre-merge-command = [
+pre-merge = [
"npm test",
"npm run build"
]
@@ -125,7 +125,7 @@ pre-merge-command = [
**What happens**: User runs `wt merge`. After commit succeeds, before merging, both commands run. If any fails, merge is aborted but commit remains.
-### post-merge-command
+### post-merge
**When it runs**: After successful merge to target branch, before cleanup.
@@ -144,7 +144,7 @@ pre-merge-command = [
**Example**:
```toml
-post-merge-command = [
+post-merge = [
"npm run deploy",
"./scripts/notify-slack.sh"
]
@@ -157,14 +157,14 @@ post-merge-command = [
Full sequence when running `wt merge`:
1. Validate working tree is clean
-2. **Run `pre-commit-command`** (fail-fast)
+2. **Run `pre-commit`** (fail-fast)
3. Create commit
4. Switch to main worktree
5. Pull latest changes
-6. **Run `pre-merge-command`** (fail-fast)
+6. **Run `pre-merge`** (fail-fast)
7. Merge branch into target
8. Push to remote
-9. **Run `post-merge-command`** (best-effort)
+9. **Run `post-merge`** (best-effort)
10. Clean up (delete branch, remove worktree)
## Format Variants
@@ -173,27 +173,27 @@ All hooks support three formats:
### Single Command (String)
```toml
-post-create-command = "npm install"
+post-create = "npm install"
```
### Multiple Commands (Array)
```toml
-post-create-command = [
+post-create = [
"npm install",
"npm run build"
]
```
Behavior:
-- `post-create-command`: Sequential execution
-- `post-start-command`: Parallel execution
-- `pre-commit-command`: Sequential execution
-- `pre-merge-command`: Sequential execution
-- `post-merge-command`: Sequential execution
+- `post-create`: Sequential execution
+- `post-start`: Parallel execution
+- `pre-commit`: Sequential execution
+- `pre-merge`: Sequential execution
+- `post-merge`: Sequential execution
### Named Commands (Table)
```toml
-[post-create-command]
+[post-create]
dependencies = "npm install"
database = "npm run db:migrate"
services = "docker-compose up -d"
@@ -206,7 +206,7 @@ Behavior same as array format, but with descriptive names.
### Basic Variables (All Hooks)
```toml
-post-create-command = "echo 'Working on {{ branch }} in {{ repo }}'"
+post-create = "echo 'Working on {{ branch }} in {{ repo }}'"
```
Available:
@@ -218,10 +218,10 @@ Available:
### Merge Variables (Merge Hooks Only)
```toml
-pre-merge-command = "echo 'Merging {{ branch }} into {{ target }}'"
+pre-merge = "echo 'Merging {{ branch }} into {{ target }}'"
```
-Available in: `pre-commit-command`, `pre-merge-command`, `post-merge-command`
+Available in: `pre-commit`, `pre-merge`, `post-merge`
Additional variable:
- `{{ target }}` - Target branch for merge (e.g., "main")
@@ -231,7 +231,7 @@ Additional variable:
Use shell conditionals with variables:
```toml
-pre-merge-command = """
+pre-merge = """
if [ "{{ target }}" = "main" ]; then
npm run test:full
elif [ "{{ target }}" = "staging" ]; then
@@ -247,24 +247,24 @@ fi
### Fast Dependencies + Slow Build
```toml
# Blocking: must complete before work starts
-post-create-command = "npm install"
+post-create = "npm install"
# Background: builds while user works
-post-start-command = "npm run build"
+post-start = "npm run build"
```
### Progressive Validation
```toml
# Quick checks before commit
-pre-commit-command = ["npm run lint", "npm run typecheck"]
+pre-commit = ["npm run lint", "npm run typecheck"]
# Thorough validation before merge
-pre-merge-command = ["npm test", "npm run build"]
+pre-merge = ["npm test", "npm run build"]
```
### Target-Specific Behavior
```toml
-post-merge-command = """
+post-merge = """
if [ "{{ target }}" = "main" ]; then
npm run deploy:production
elif [ "{{ target }}" = "staging" ]; then
@@ -275,12 +275,12 @@ fi
### Monorepo with Multiple Tools
```toml
-[post-create-command]
+[post-create]
frontend = "cd frontend && npm install"
backend = "cd backend && cargo build"
database = "docker-compose up -d postgres"
-[pre-merge-command]
+[pre-merge]
frontend-tests = "cd frontend && npm test"
backend-tests = "cd backend && cargo test"
```
diff --git a/.claude-plugin/skills/worktrunk/reference/project-config.md b/.claude-plugin/skills/worktrunk/reference/project-config.md
index b8f7a1a92..0d81aa839 100644
--- a/.claude-plugin/skills/worktrunk/reference/project-config.md
+++ b/.claude-plugin/skills/worktrunk/reference/project-config.md
@@ -49,10 +49,10 @@ For Rust projects, common commands:
Match hooks to project needs using this decision tree:
-- **Dependency installation** (fast, must complete) → `post-create-command`
-- **Tests/linting** (fast, must pass) → `pre-commit-command` or `pre-merge-command`
-- **Long builds** (slow, optional) → `post-start-command`
-- **Deployment** (after merge) → `post-merge-command`
+- **Dependency installation** (fast, must complete) → `post-create`
+- **Tests/linting** (fast, must pass) → `pre-commit` or `pre-merge`
+- **Long builds** (slow, optional) → `post-start`
+- **Deployment** (after merge) → `post-merge`
### Step 4: Validate Commands Work
@@ -69,16 +69,16 @@ which cargo # Check tool exists
Typical npm project:
```toml
# Install dependencies when creating new worktrees (blocking)
-post-create-command = "npm install"
+post-create = "npm install"
# Validate code quality before committing (blocking, fail-fast)
-pre-commit-command = [
+pre-commit = [
"npm run lint",
"npm run typecheck"
]
# Run tests before merging (blocking, fail-fast)
-pre-merge-command = "npm test"
+pre-merge = "npm test"
```
</example>
@@ -88,16 +88,16 @@ pre-merge-command = "npm test"
Typical Rust project:
```toml
# Build runs in background (slow)
-post-start-command = "cargo build"
+post-start = "cargo build"
# Format and lint before committing (blocking, fail-fast)
-pre-commit-command = [
+pre-commit = [
"cargo fmt --check",
"cargo clippy -- -D warnings"
]
# Run tests before merging (blocking, fail-fast)
-pre-merge-command = "cargo test"
+pre-merge = "cargo test"
```
</example>
@@ -107,10 +107,10 @@ pre-merge-command = "cargo test"
Document why each hook exists:
```toml
# Dependencies must be installed before worktree is usable
-post-create-command = "npm install"
+post-create = "npm install"
# Enforce code quality standards (matches CI checks)
-pre-commit-command = ["npm run lint", "npm run typecheck"]
+pre-commit = ["npm run lint", "npm run typecheck"]
```
### Step 7: Suggest Testing
@@ -133,11 +133,11 @@ cat .config/wt.toml
### Step 2: Determine Appropriate Hook Type
Ask: When should this run?
-- Creating worktree → `post-create-command`
-- Switching to worktree → `post-start-command`
-- Before committing → `pre-commit-command`
-- Before merging → `pre-merge-command`
-- After merging → `post-merge-command`
+- Creating worktree → `post-create`
+- Switching to worktree → `post-start`
+- Before committing → `pre-commit`
+- Before merging → `pre-merge`
+- After merging → `post-merge`
### Step 3: Handle Format Conversion if Needed
@@ -145,12 +145,12 @@ Ask: When should this run?
Current:
```toml
-post-create-command = "npm install"
+post-create = "npm install"
```
Adding "npm run db:migrate":
```toml
-post-create-command = [
+post-create = [
"npm install",
"npm run db:migrate"
]
@@ -162,12 +162,12 @@ post-create-command = [
Current:
```toml
-pre-commit-command = ["npm run lint"]
+pre-commit = ["npm run lint"]
```
Adding typecheck:
```toml
-pre-commit-command = [
+pre-commit = [
"npm run lint",
"npm run typecheck"
]
@@ -194,14 +194,14 @@ Available in all hook types:
<example type="basic-variables">
```toml
-post-create-command = "echo 'Working on {{ branch }} in {{ repo }}'"
+post-create = "echo 'Working on {{ branch }} in {{ repo }}'"
```
</example>
### Merge Variables (Merge Hooks Only)
-Available in: `pre-commit-command`, `pre-merge-command`, `post-merge-command`
+Available in: `pre-commit`, `pre-merge`, `post-merge`
Additional variable:
- `{{ target }}` - Target branch for merge (e.g., "main")
@@ -210,7 +210,7 @@ Additional variable:
Run different tests based on target branch:
```toml
-pre-merge-command = """
+pre-merge = """
if [ "{{ target }}" = "main" ]; then
npm run test:full
else
@@ -228,29 +228,29 @@ All hooks support three command formats.
### Single Command (String)
```toml
-post-create-command = "npm install"
+post-create = "npm install"
```
### Multiple Commands (Array)
```toml
-post-create-command = [
+post-create = [
"npm install",
"npm run build"
]
```
Behavior:
-- `post-create-command`: Sequential
-- `post-start-command`: Parallel
-- `pre-commit-command`: Sequential
-- `pre-merge-command`: Sequential
-- `post-merge-command`: Sequential
+- `post-create`: Sequential
+- `post-start`: Parallel
+- `pre-commit`: Sequential
+- `pre-merge`: Sequential
+- `post-merge`: Sequential
### Named Commands (Table)
```toml
-[post-create-command]
+[post-create]
dependencies = "npm install"
database = "npm run db:migrate"
services = "docker-compose up -d"
@@ -262,7 +262,7 @@ Behavior same as array format, but with descriptive names.
Five hook types with different timing and behavior:
-### post-create-command
+### post-create
**When**: After creating new worktree, before switching to it
**Blocking**: Yes (user waits)
@@ -277,7 +277,7 @@ Five hook types with different timing and behavior:
<example type="post-create">
```toml
-post-create-command = [
+post-create = [
"npm install",
"npm run db:migrate"
]
@@ -285,7 +285,7 @@ post-create-command = [
</example>
-### post-start-command
+### post-start
**When**: After switching to existing worktree
**Blocking**: No (runs in background)
@@ -300,7 +300,7 @@ post-create-command = [
<example type="post-start">
```toml
-post-start-command = [
+post-start = [
"npm run build",
"docker-compose up -d"
]
@@ -308,7 +308,7 @@ post-start-command = [
</example>
-### pre-commit-command
+### pre-commit
**When**: Before committing during merge
**Blocking**: Yes
@@ -323,7 +323,7 @@ post-start-command = [
<example type="pre-commit">
```toml
-pre-commit-command = [
+pre-commit = [
"npm run lint",
"npm run typecheck"
]
@@ -331,7 +331,7 @@ pre-commit-command = [
</example>
-### pre-merge-command
+### pre-merge
**When**: Before merging to target branch
**Blocking**: Yes
@@ -346,12 +346,12 @@ pre-commit-command = [
<example type="pre-merge">
```toml
-pre-merge-command = "npm test"
+pre-merge = "npm test"
```
</example>
-### post-merge-command
+### post-merge
**When**: After successful merge, before cleanup
**Blocking**: Yes
@@ -366,7 +366,7 @@ pre-merge-command = "npm test"
<example type="post-merge">
```toml
-post-merge-command = "npm run deploy"
+post-merge = "npm run deploy"
```
</example>
@@ -433,13 +433,13 @@ Move long-running commands to background:
Before (blocks for minutes):
```toml
-post-create-command = "npm run build"
+post-create = "npm run build"
```
After (runs in background):
```toml
-post-create-command = "npm install" # Fast, blocking
-post-start-command = "npm run build" # Slow, background
+post-create = "npm install" # Fast, blocking
+post-start = "npm run build" # Slow, background
```
</example>
diff --git a/.config/wt.example.toml b/.config/wt.example.toml
index cd1105775..acb9f57a3 100644
--- a/.config/wt.example.toml
+++ b/.config/wt.example.toml
@@ -1,37 +1,37 @@
# Worktrunk Project Configuration
# Location: <repo>/.config/wt.toml
#
-# This file defines project-specific commands that run automatically during
+# This file defines project-specific hooks that run automatically during
# worktree operations. It should be checked into git and shared across all
# developers working on the project.
-# Available template variables (all commands):
+# Available template variables (all hooks):
# {{ repo }} - Repository name (e.g., "my-project")
# {{ branch }} - Branch name (slashes replaced with dashes)
# {{ worktree }} - Absolute path to the worktree
# {{ repo_root }} - Absolute path to the repository root
#
-# Merge-related commands also support:
+# Merge-related hooks also support:
# {{ target }} - Target branch for the merge (e.g., "main")
-# Post-Create Commands
+# Post-Create Hook
# Runs SEQUENTIALLY and BLOCKS until complete
# The worktree switch won't complete until these finish
# Commands run one after another in the worktree directory
#
# Format options:
# 1. Single string:
-# post-create-command = "npm install"
+# post-create = "npm install"
#
# 2. Array (runs sequentially):
-# post-create-command = ["npm install", "npm run build"]
+# post-create = ["npm install", "npm run build"]
#
# 3. Named table (runs sequentially in declaration order):
-# [post-create-command]
+# [post-create]
# install = "npm install --frozen-lockfile"
# build = "npm run build"
-# Post-Start Commands
+# Post-Start Hook
# Runs in BACKGROUND as detached processes (parallel)
# Use for: uv sync, npm install, bundle install, build, dev servers, file watchers,
# long-running tasks
@@ -40,79 +40,79 @@
#
# Format options:
# 1. Single string:
-# post-start-command = "npm run dev"
+# post-start = "npm run dev"
#
# 2. Array (runs in parallel):
-# post-start-command = ["npm run dev", "npm run watch"]
+# post-start = ["npm run dev", "npm run watch"]
#
# 3. Named table (runs in parallel):
-# [post-start-command]
+# [post-start]
# server = "npm run dev"
# watch = "npm run watch"
-# Pre-Commit Commands
+# Pre-Commit Hook
# Runs SEQUENTIALLY before committing changes during merge (blocking, fail-fast)
# All commands must exit with code 0 for commit to proceed
# Runs for both squash and no-squash merge modes
# Use for: formatters, linters, quick validation
#
-# Format options same as post-create-command
-# pre-commit-command = "cargo fmt -- --check"
+# Format options same as post-create
+# pre-commit = "cargo fmt -- --check"
#
# Or multiple:
-# [pre-commit-command]
+# [pre-commit]
# format = "cargo fmt -- --check"
# lint = "cargo clippy -- -D warnings"
-# Pre-Merge Commands
+# Pre-Merge Hook
# Runs SEQUENTIALLY before merging to target branch (blocking, fail-fast)
# All commands must exit with code 0 for merge to proceed
# Use for: tests, linters, build verification before merging
#
-# Format options same as post-create-command
-# pre-merge-command = ["cargo test", "cargo build"]
+# Format options same as post-create
+# pre-merge = ["cargo test", "cargo build"]
#
# Or named:
-# [pre-merge-command]
+# [pre-merge]
# test = "cargo test"
# build = "cargo build --release"
-# Post-Merge Commands
+# Post-Merge Hook
# Runs SEQUENTIALLY in the main worktree after successful merge (blocking)
# Runs after push succeeds but before cleanup
# Use for: updating production builds, notifications, cleanup
#
-# Format options same as post-create-command
-# post-merge-command = "cargo install --path ."
+# Format options same as post-create
+# post-merge = "cargo install --path ."
# Example: Node.js Project
-# [post-create-command]
+# [post-create]
# install = "npm ci"
#
-# [post-start-command]
+# [post-start]
# server = "npm run dev"
#
-# [pre-merge-command]
+# [pre-merge]
# lint = "npm run lint"
# test = "npm test"
# Example: Rust Project
-# [post-create-command]
+# [post-create]
# build = "cargo build"
#
-# [pre-merge-command]
+# [pre-merge]
# format = "cargo fmt -- --check"
# clippy = "cargo clippy -- -D warnings"
# test = "cargo test"
#
-# post-merge-command = "cargo install --path ."
+# post-merge = "cargo install --path ."
# Example: Python Project
-# [post-create-command]
+# [post-create]
# venv = "python -m venv .venv"
# install = ".venv/bin/pip install -r requirements.txt"
#
-# [pre-merge-command]
+# [pre-merge]
# format = ".venv/bin/black --check ."
# lint = ".venv/bin/ruff check ."
# test = ".venv/bin/pytest"
diff --git a/.config/wt.toml b/.config/wt.toml
index f8bfafdc1..3062f46db 100644
--- a/.config/wt.toml
+++ b/.config/wt.toml
@@ -1,4 +1,4 @@
-# Post-start commands for worktree setup
+# Post-start hooks for worktree setup
# These run after creating a new worktree
#
# Available template variables:
@@ -11,30 +11,30 @@
# but seeded from base to warm-start builds (low disk usage)
# macOS: uses cp -c (clonefile on APFS)
# Linux: would need cp --reflink=auto (GNU coreutils) or rsync 3.2.3+ with --reflink
-post-start-command = """
+post-start = """
[ -d {{ repo_root }}/target ] &&
[ ! -e {{ worktree }}/target ] &&
cp -cR {{ repo_root }}/target/. {{ worktree }}/target/
"""
-# Post-merge commands
+# Post-merge hooks
# These run in the main worktree after successful merge and push
# Available template variables: {{ repo }}, {{ branch }}, {{ worktree }}, {{ repo_root }}, {{ target }}
-[post-merge-command]
+[post-merge]
build = "cargo build --all-targets"
install = "cargo install --path ."
-# Pre-commit commands
+# Pre-commit hooks
# These run sequentially before committing changes during merge (both squash and no-squash)
# All commands must exit with code 0 for commit to proceed
-[pre-commit-command]
+[pre-commit]
pre-commit = "pre-commit run --all-files"
-# Pre-merge commands
+# Pre-merge hooks
# These run sequentially before merging to main
# All commands must exit with code 0 for merge to proceed
-# Note: This must come AFTER post-merge-command because [pre-merge-command] starts
+# Note: This must come AFTER post-merge because [pre-merge] starts
# a TOML table section, and everything after it would be inside that section
-[pre-merge-command]
+[pre-merge]
insta = "NEXTEST_STATUS_LEVEL=fail NEXTEST_SUCCESS_OUTPUT=never cargo insta test --check --test-runner nextest --test-runner-fallback true --features shell-integration-tests"
doc = "RUSTDOCFLAGS='-Dwarnings' cargo doc --no-deps"
diff --git a/README.md b/README.md
index 33350636a..06eea294e 100644
--- a/README.md
+++ b/README.md
@@ -166,25 +166,25 @@ For more details, including custom prompt templates: `wt config --help`
Automate tasks at different points in the worktree lifecycle. Configure hooks in `.config/wt.toml`.
-| Hook | When | On Failure |
-| ----------------------- | ---------------------------------- | -------------- |
-| **post-create-command** | After worktree created | Warn, continue |
-| **post-start-command** | After worktree created (background) | Warn, continue |
-| **pre-commit-command** | Before squash commit created | Stop merge |
-| **pre-merge-command** | After squash, before push | Stop merge |
-| **post-merge-command** | After successful merge | Warn, continue |
+| Hook | When | On Failure |
+| ---------------- | ---------------------------------- | -------------- |
+| **post-create** | After worktree created | Warn, continue |
+| **post-start** | After worktree created (background) | Warn, continue |
+| **pre-commit** | Before squash commit created | Stop merge |
+| **pre-merge** | After squash, before push | Stop merge |
+| **post-merge** | After successful merge | Warn, continue |
```toml
# Install dependencies, build setup
-[post-create-command]
+[post-create]
"install" = "uv sync"
# Dev servers, file watchers (runs in background)
-[post-start-command]
+[post-start]
"dev" = "uv run dev"
# Tests and lints before merging (blocks on failure)
-[pre-merge-command]
+[pre-merge]
"test" = "uv run pytest"
"lint" = "uv run ruff check"
```
@@ -285,13 +285,13 @@ launches Claude Code in that directory.
**Auto-generate commit messages** — Configure an LLM to generate commit
messages during merge. See [LLM Commit Messages](#llm-commit-messages).
-**Automate startup with hooks** — Use `post-create-command` for environment
-setup, `post-start-command` for non-blocking tasks. For example, worktrunk uses
-`post-start-command` to bootstrap build caches from main via copy-on-write,
+**Automate startup with hooks** — Use `post-create` for environment
+setup, `post-start` for non-blocking tasks. For example, worktrunk uses
+`post-start` to bootstrap build caches from main via copy-on-write,
eliminating cold compiles (see [worktrunk's config](.config/wt.toml)). See
[Project Hooks](#project-hooks) for details.
-**Use `pre-merge-command` as a "local CI"** — Running `wt merge` with pre-merge
+**Use `pre-merge` as a "local CI"** — Running `wt merge` with pre-merge
hooks is like having a local CI pipeline. Tests run after squashing but before
pushing to main, and failures abort the merge. This protects `main` from one
agent forgetting to run tests, without having to babysit it.
@@ -310,10 +310,10 @@ terminal that supports hyperlinks.
instead of duplicating logic:
```toml
-[post-create-command]
+[post-create]
"setup" = "task install"
-[pre-merge-command]
+[pre-merge]
"validate" = "just test lint"
```
diff --git a/dev/config.example.toml b/dev/config.example.toml
index a89ce56d5..c6f1d15d7 100644
--- a/dev/config.example.toml
+++ b/dev/config.example.toml
@@ -56,7 +56,7 @@ verify = true # Run project hooks
project = "github.com/user/repo"
command = "npm install"
-# NOTE: For project-specific commands (post-create, post-start, pre-merge, etc.),
+# NOTE: For project-specific hooks (post-create, post-start, pre-merge, etc.),
# use a separate PROJECT config file at <repo>/.config/wt.toml
# See: .config/wt.example.toml for project configuration examples
diff --git a/dev/wt-demo-build.py b/dev/wt-demo-build.py
index ea80b4b22..ad17f9009 100755
--- a/dev/wt-demo-build.py
+++ b/dev/wt-demo-build.py
@@ -107,7 +107,7 @@ def prepare_repo():
# Project hooks
(DEMO_REPO / ".config").mkdir()
(DEMO_REPO / ".config" / "wt.toml").write_text(
- '[pre-merge-command]\ntest = "cargo nextest run"\n'
+ '[pre-merge]\ntest = "cargo nextest run"\n'
)
git(["-C", str(DEMO_REPO), "add", ".config/wt.toml"])
commit_dated(DEMO_REPO, "Add project hooks", "5d")
diff --git a/src/commands/commit.rs b/src/commands/commit.rs
index 22a7ca36a..e9deb0175 100644
--- a/src/commands/commit.rs
+++ b/src/commands/commit.rs
@@ -139,7 +139,7 @@ impl CommitOptions<'_> {
let project_config = self.ctx.repo.load_project_config()?;
let has_pre_commit = project_config
.as_ref()
- .map(|c| c.pre_commit_command.is_some())
+ .map(|c| c.pre_commit.is_some())
.unwrap_or(false);
if self.no_verify && has_pre_commit {
diff --git a/src/commands/hooks.rs b/src/commands/hooks.rs
index dec35c21d..bd9eec177 100644
--- a/src/commands/hooks.rs
+++ b/src/commands/hooks.rs
@@ -174,7 +174,7 @@ impl<'a> HookPipeline<'a> {
target_branch: Option<&str>,
auto_trust: bool,
) -> anyhow::Result<()> {
- let Some(pre_commit_config) = &project_config.pre_commit_command else {
+ let Some(pre_commit_config) = &project_config.pre_commit else {
return Ok(());
};
diff --git a/src/commands/merge.rs b/src/commands/merge.rs
index d54aab76a..3b33d0d1f 100644
--- a/src/commands/merge.rs
+++ b/src/commands/merge.rs
@@ -258,7 +258,7 @@ pub fn run_pre_merge_commands(
target_branch: &str,
auto_trust: bool,
) -> anyhow::Result<()> {
- let Some(pre_merge_config) = &project_config.pre_merge_command else {
+ let Some(pre_merge_config) = &project_config.pre_merge else {
return Ok(());
};
@@ -291,7 +291,7 @@ pub fn execute_post_merge_commands(
None => return Ok(()),
};
- let Some(post_merge_config) = &project_config.post_merge_command else {
+ let Some(post_merge_config) = &project_config.post_merge else {
return Ok(());
};
diff --git a/src/commands/project_config.rs b/src/commands/project_config.rs
index 1004fe81c..97bf2993c 100644
--- a/src/commands/project_config.rs
+++ b/src/commands/project_config.rs
@@ -9,11 +9,11 @@ pub fn collect_commands_for_hooks(
let mut commands = Vec::new();
for hook in hooks {
let cfg = match hook {
- HookType::PostCreate => &project_config.post_create_command,
- HookType::PostStart => &project_config.post_start_command,
- HookType::PreCommit => &project_config.pre_commit_command,
- HookType::PreMerge => &project_config.pre_merge_command,
- HookType::PostMerge => &project_config.post_merge_command,
+ HookType::PostCreate => &project_config.post_create,
+ HookType::PostStart => &project_config.post_start,
+ HookType::PreCommit => &project_config.pre_commit,
+ HookType::PreMerge => &project_config.pre_merge,
+ HookType::PostMerge => &project_config.post_merge,
};
if let Some(config) = cfg {
commands.extend(config.commands_with_phase(*hook));
diff --git a/src/commands/standalone.rs b/src/commands/standalone.rs
index 496c68aa6..c276d37f6 100644
--- a/src/commands/standalone.rs
+++ b/src/commands/standalone.rs
@@ -26,26 +26,26 @@ pub fn handle_standalone_run_hook(hook_type: HookType, force: bool) -> anyhow::R
// Execute the hook based on type
match hook_type {
HookType::PostCreate => {
- check_hook_configured(&project_config.post_create_command, hook_type)?;
+ check_hook_configured(&project_config.post_create, hook_type)?;
ctx.execute_post_create_commands()
}
HookType::PostStart => {
- check_hook_configured(&project_config.post_start_command, hook_type)?;
+ check_hook_configured(&project_config.post_start, hook_type)?;
ctx.execute_post_start_commands_sequential()
}
HookType::PreCommit => {
- check_hook_configured(&project_config.pre_commit_command, hook_type)?;
+ check_hook_configured(&project_config.pre_commit, hook_type)?;
// Pre-commit hook can optionally use target branch context
let target_branch = repo.default_branch().ok();
HookPipeline::new(ctx).run_pre_commit(&project_config, target_branch.as_deref(), false)
}
HookType::PreMerge => {
- check_hook_configured(&project_config.pre_merge_command, hook_type)?;
+ check_hook_configured(&project_config.pre_merge, hook_type)?;
let target_branch = repo.default_branch().unwrap_or_else(|_| "main".to_string());
run_pre_merge_commands(&project_config, &ctx, &target_branch, false)
}
HookType::PostMerge => {
- check_hook_configured(&project_config.post_merge_command, hook_type)?;
+ check_hook_configured(&project_config.post_merge, hook_type)?;
let target_branch = repo.default_branch().unwrap_or_else(|_| "main".to_string());
execute_post_merge_commands(&ctx, &target_branch, false)
}
@@ -123,7 +123,7 @@ pub fn handle_squash(
let project_config = repo.load_project_config()?;
let has_pre_commit = project_config
.as_ref()
- .map(|c| c.pre_commit_command.is_some())
+ .map(|c| c.pre_commit.is_some())
.unwrap_or(false);
if skip_pre_commit && has_pre_commit {
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rs
index 220f36e84..c4700d600 100644
--- a/src/commands/worktree.rs
+++ b/src/commands/worktree.rs
@@ -400,7 +400,7 @@ impl<'a> CommandContext<'a> {
None => return Ok(()),
};
- let Some(post_create_config) = &project_config.post_create_command else {
+ let Some(post_create_config) = &project_config.post_create else {
return Ok(());
};
@@ -423,7 +423,7 @@ impl<'a> CommandContext<'a> {
None => return Ok(()),
};
- let Some(post_start_config) = &project_config.post_start_command else {
+ let Some(post_start_config) = &project_config.post_start else {
return Ok(());
};
@@ -444,7 +444,7 @@ impl<'a> CommandContext<'a> {
None => return Ok(()),
};
- let Some(post_start_config) = &project_config.post_start_command else {
+ let Some(post_start_config) = &project_config.post_start else {
return Ok(());
};
diff --git a/src/config/commands.rs b/src/config/commands.rs
index 40f394e3e..23cf3ddc0 100644
--- a/src/config/commands.rs
+++ b/src/config/commands.rs
@@ -54,9 +54,9 @@ impl Command {
///
/// Internally stores commands as `Vec<Command>` for uniform processing.
/// Deserializes from three TOML formats:
-/// - Single string: `post-create-command = "npm install"`
-/// - Array: `post-create-command = ["npm install", "npm test"]`
-/// - Named table: `[post-create-command]` followed by `install = "npm install"`
+/// - Single string: `post-create = "npm install"`
+/// - Array: `post-create = ["npm install", "npm test"]`
+/// - Named table: `[post-create]` followed by `install = "npm install"`
///
/// **Order preservation:** Named commands preserve TOML insertion order (requires
/// `preserve_order` feature on toml crate and IndexMap for deserialization). This
diff --git a/src/config/mod.rs b/src/config/mod.rs
index a2e7de58e..6ccadb91b 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -18,11 +18,11 @@
//! **Purpose**: Project-specific hooks and commands, checked into git
//!
//! **Settings**:
-//! - `post-create-command` - Sequential blocking commands when creating worktree
-//! - `post-start-command` - Parallel background commands after worktree created
-//! - `pre-commit-command` - Validation before committing changes during merge
-//! - `pre-merge-command` - Validation before merging to target branch
-//! - `post-merge-command` - Cleanup after successful merge
+//! - `post-create` - Sequential blocking commands when creating worktree
+//! - `post-start` - Parallel background commands after worktree created
+//! - `pre-commit` - Validation before committing changes during merge
+//! - `pre-merge` - Validation before merging to target branch
+//! - `post-merge` - Cleanup after successful merge
//!
//! **Managed by**: Checked into the repository, shared across all developers
//!
@@ -174,17 +174,17 @@ mod tests {
#[test]
fn test_project_config_default() {
let config = ProjectConfig::default();
- assert!(config.post_create_command.is_none());
- assert!(config.post_start_command.is_none());
- assert!(config.pre_merge_command.is_none());
- assert!(config.post_merge_command.is_none());
+ assert!(config.post_create.is_none());
+ assert!(config.post_start.is_none());
+ assert!(config.pre_merge.is_none());
+ assert!(config.post_merge.is_none());
}
#[test]
fn test_command_config_single() {
- let toml = r#"post-create-command = "npm install""#;
+ let toml = r#"post-create = "npm install""#;
let config: ProjectConfig = toml::from_str(toml).unwrap();
- let cmd_config = config.post_create_command.unwrap();
+ let cmd_config = config.post_create.unwrap();
let commands = cmd_config.commands();
assert_eq!(commands.len(), 1);
assert_eq!(
@@ -195,9 +195,9 @@ mod tests {
#[test]
fn test_command_config_multiple() {
- let toml = r#"post-create-command = ["npm install", "npm test"]"#;
+ let toml = r#"post-create = ["npm install", "npm test"]"#;
let config: ProjectConfig = toml::from_str(toml).unwrap();
- let cmd_config = config.post_create_command.unwrap();
+ let cmd_config = config.post_create.unwrap();
let commands = cmd_config.commands();
assert_eq!(commands.len(), 2);
assert_eq!(
@@ -213,12 +213,12 @@ mod tests {
#[test]
fn test_command_config_named() {
let toml = r#"
- [post-start-command]
+ [post-start]
server = "npm run dev"
watch = "npm run watch"
"#;
let config: ProjectConfig = toml::from_str(toml).unwrap();
- let cmd_config = config.post_start_command.unwrap();
+ let cmd_config = config.post_start.unwrap();
let commands = cmd_config.commands();
assert_eq!(commands.len(), 2);
// Preserves TOML insertion order
@@ -244,13 +244,13 @@ mod tests {
fn test_command_config_named_preserves_toml_order() {
// Test that named commands preserve TOML order (not alphabetical)
let toml = r#"
- [pre-merge-command]
+ [pre-merge]
insta = "cargo insta test"
doc = "cargo doc"
clippy = "cargo clippy"
"#;
let config: ProjectConfig = toml::from_str(toml).unwrap();
- let cmd_config = config.pre_merge_command.unwrap();
+ let cmd_config = config.pre_merge.unwrap();
let commands = cmd_config.commands();
// Extract just the names for easier verification
@@ -275,12 +275,12 @@ mod tests {
fn test_command_config_task_order() {
// Test exact ordering as used in post_start tests
let toml = r#"
-[post-start-command]
+[post-start]
task1 = "echo 'Task 1 running' > task1.txt"
task2 = "echo 'Task 2 running' > task2.txt"
"#;
let config: ProjectConfig = toml::from_str(toml).unwrap();
- let cmd_config = config.post_start_command.unwrap();
+ let cmd_config = config.post_start.unwrap();
let commands = cmd_config.commands();
assert_eq!(commands.len(), 2);
@@ -300,21 +300,21 @@ task2 = "echo 'Task 2 running' > task2.txt"
#[test]
fn test_project_config_both_commands() {
let toml = r#"
- post-create-command = ["npm install"]
+ post-create = ["npm install"]
- [post-start-command]
+ [post-start]
server = "npm run dev"
"#;
let config: ProjectConfig = toml::from_str(toml).unwrap();
- assert!(config.post_create_command.is_some());
- assert!(config.post_start_command.is_some());
+ assert!(config.post_create.is_some());
+ assert!(config.post_start.is_some());
}
#[test]
fn test_pre_merge_command_single() {
- let toml = r#"pre-merge-command = "cargo test""#;
+ let toml = r#"pre-merge = "cargo test""#;
let config: ProjectConfig = toml::from_str(toml).unwrap();
- let cmd_config = config.pre_merge_command.unwrap();
+ let cmd_config = config.pre_merge.unwrap();
let commands = cmd_config.commands();
assert_eq!(commands.len(), 1);
assert_eq!(
@@ -325,9 +325,9 @@ task2 = "echo 'Task 2 running' > task2.txt"
#[test]
fn test_pre_merge_command_multiple() {
- let toml = r#"pre-merge-command = ["cargo fmt -- --check", "cargo test"]"#;
+ let toml = r#"pre-merge = ["cargo fmt -- --check", "cargo test"]"#;
let config: ProjectConfig = toml::from_str(toml).unwrap();
- let cmd_config = config.pre_merge_command.unwrap();
+ let cmd_config = config.pre_merge.unwrap();
let commands = cmd_config.commands();
assert_eq!(commands.len(), 2);
assert_eq!(
@@ -347,13 +347,13 @@ task2 = "echo 'Task 2 running' > task2.txt"
#[test]
fn test_pre_merge_command_named() {
let toml = r#"
- [pre-merge-command]
+ [pre-merge]
format = "cargo fmt -- --check"
lint = "cargo clippy"
test = "cargo test"
"#;
let config: ProjectConfig = toml::from_str(toml).unwrap();
- let cmd_config = config.pre_merge_command.unwrap();
+ let cmd_config = config.pre_merge.unwrap();
let commands = cmd_config.commands();
assert_eq!(commands.len(), 3);
// Preserves TOML insertion order
@@ -385,30 +385,30 @@ task2 = "echo 'Task 2 running' > task2.txt"
#[test]
fn test_command_config_roundtrip_single() {
- let original = r#"post-create-command = "npm install""#;
+ let original = r#"post-create = "npm install""#;
let config: ProjectConfig = toml::from_str(original).unwrap();
let serialized = toml::to_string(&config).unwrap();
let config2: ProjectConfig = toml::from_str(&serialized).unwrap();
assert_eq!(config, config2);
// Verify it serialized back as a string, not array
- assert!(serialized.contains(r#"post-create-command = "npm install""#));
+ assert!(serialized.contains(r#"post-create = "npm install""#));
}
#[test]
fn test_command_config_roundtrip_multiple() {
- let original = r#"post-create-command = ["npm install", "npm test"]"#;
+ let original = r#"post-create = ["npm install", "npm test"]"#;
let config: ProjectConfig = toml::from_str(original).unwrap();
let serialized = toml::to_string(&config).unwrap();
let config2: ProjectConfig = toml::from_str(&serialized).unwrap();
assert_eq!(config, config2);
// Verify it serialized back as an array
- assert!(serialized.contains(r#"post-create-command = ["npm install", "npm test"]"#));
+ assert!(serialized.contains(r#"post-create = ["npm install", "npm test"]"#));
}
#[test]
fn test_command_config_roundtrip_named() {
let original = r#"
- [post-start-command]
+ [post-start]
server = "npm run dev"
watch = "npm run watch"
"#;
@@ -417,7 +417,7 @@ task2 = "echo 'Task 2 running' > task2.txt"
let config2: ProjectConfig = toml::from_str(&serialized).unwrap();
assert_eq!(config, config2);
// Verify it serialized back as a named table
- assert!(serialized.contains("[post-start-command]"));
+ assert!(serialized.contains("[post-start]"));
assert!(serialized.contains(r#"server = "npm run dev""#));
assert!(serialized.contains(r#"watch = "npm run watch""#));
}
diff --git a/src/config/project.rs b/src/config/project.rs
index 2435a359c..876167eb2 100644
--- a/src/config/project.rs
+++ b/src/config/project.rs
@@ -7,21 +7,21 @@ use serde::{Deserialize, Serialize};
use super::commands::CommandConfig;
-/// Project-specific configuration with hooks and commands.
+/// Project-specific configuration with hooks.
///
/// This config is stored at `<repo>/.config/wt.toml` within the repository and
-/// IS checked into git. It defines project-specific commands that run automatically
+/// IS checked into git. It defines project-specific hooks that run automatically
/// during worktree operations. All developers working on the project share this config.
///
/// # Template Variables
///
-/// All commands support these template variables:
+/// All hooks support these template variables:
/// - `{{ repo }}` - Repository name (e.g., "my-project")
/// - `{{ branch }}` - Branch name (e.g., "feature-foo")
/// - `{{ worktree }}` - Absolute path to the worktree
/// - `{{ repo_root }}` - Absolute path to the repository root
///
-/// Merge-related commands (`pre-commit-command`, `pre-merge-command`, `post-merge-command`) also support:
+/// Merge-related hooks (`pre-commit`, `pre-merge`, `post-merge`) also support:
/// - `{{ target }}` - Target branch for the merge (e.g., "main")
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq)]
pub struct ProjectConfig {
@@ -29,15 +29,15 @@ pub struct ProjectConfig {
/// Supports string (single command), array (sequential), or table (named, sequential)
///
/// Available template variables: `{{ repo }}`, `{{ branch }}`, `{{ worktree }}`, `{{ repo_root }}`
- #[serde(default, rename = "post-create-command")]
- pub post_create_command: Option<CommandConfig>,
+ #[serde(default, rename = "post-create")]
+ pub post_create: Option<CommandConfig>,
/// Commands to execute in parallel as background processes (non-blocking)
/// Supports string (single), array (parallel), or table (named, parallel)
///
/// Available template variables: `{{ repo }}`, `{{ branch }}`, `{{ worktree }}`, `{{ repo_root }}`
- #[serde(default, rename = "post-start-command")]
- pub post_start_command: Option<CommandConfig>,
+ #[serde(default, rename = "post-start")]
+ pub post_start: Option<CommandConfig>,
/// Commands to execute before committing changes during merge (blocking, fail-fast validation)
/// Supports string (single command), array (sequential), or table (named, sequential)
@@ -45,24 +45,24 @@ pub struct ProjectConfig {
/// Runs before any commit operation during `wt merge` (both squash and no-squash modes)
///
/// Available template variables: `{{ repo }}`, `{{ branch }}`, `{{ worktree }}`, `{{ repo_root }}`, `{{ target }}`
- #[serde(default, rename = "pre-commit-command")]
- pub pre_commit_command: Option<CommandConfig>,
+ #[serde(default, rename = "pre-commit")]
+ pub pre_commit: Option<CommandConfig>,
/// Commands to execute before merging (blocking, fail-fast validation)
/// Supports string (single command), array (sequential), or table (named, sequential)
/// All commands must exit with code 0 for merge to proceed
///
/// Available template variables: `{{ repo }}`, `{{ branch }}`, `{{ worktree }}`, `{{ repo_root }}`, `{{ target }}`
- #[serde(default, rename = "pre-merge-command")]
- pub pre_merge_command: Option<CommandConfig>,
+ #[serde(default, rename = "pre-merge")]
+ pub pre_merge: Option<CommandConfig>,
/// Commands to execute after successful merge in the main worktree (blocking)
/// Supports string (single command), array (sequential), or table (named, sequential)
/// Runs after push succeeds but before cleanup
///
/// Available template variables: `{{ repo }}`, `{{ branch }}`, `{{ worktree }}`, `{{ repo_root }}`, `{{ target }}`
- #[serde(default, rename = "post-merge-command")]
- pub post_merge_command: Option<CommandConfig>,
+ #[serde(default, rename = "post-merge")]
+ pub post_merge: Option<CommandConfig>,
}
impl ProjectConfig {
diff --git a/tests/integration_tests/.post_start_commands.rs.pending-snap b/tests/integration_tests/.post_start_commands.rs.pending-snap
new file mode 100644
index 000000000..8cf591ada
--- /dev/null
+++ b/tests/integration_tests/.post_start_commands.rs.pending-snap
@@ -0,0 +1,15 @@
+{"run_id":"1764014800-127677000","line":625,"new":{"module_name":"integration__integration_tests__post_start_commands","snapshot_name":"post_start_complex_shell_commands","metadata":{"source":"tests/integration_tests/post_start_commands.rs","assertion_line":625,"expression":"contents"},"snapshot":""},"old":{"module_name":"integration__integration_tests__post_start_commands","metadata":{},"snapshot":"line2"}}
+{"run_id":"1764014800-127677000","line":672,"new":null,"old":null}
+{"run_id":"1764014940-883397000","line":730,"new":null,"old":null}
+{"run_id":"1764014940-883397000","line":625,"new":{"module_name":"integration__integration_tests__post_start_commands","snapshot_name":"post_start_complex_shell_commands","metadata":{"source":"tests/integration_tests/post_start_commands.rs","assertion_line":625,"expression":"contents"},"snapshot":""},"old":{"module_name":"integration__integration_tests__post_start_commands","metadata":{},"snapshot":"line2"}}
+{"run_id":"1764014940-883397000","line":672,"new":null,"old":null}
+{"run_id":"1764014940-883397000","line":431,"new":null,"old":null}
+{"run_id":"1764014963-908385000","line":625,"new":null,"old":null}
+{"run_id":"1764014980-254290000","line":730,"new":null,"old":null}
+{"run_id":"1764014980-254290000","line":625,"new":{"module_name":"integration__integration_tests__post_start_commands","snapshot_name":"post_start_complex_shell_commands","metadata":{"source":"tests/integration_tests/post_start_commands.rs","assertion_line":625,"expression":"contents"},"snapshot":""},"old":{"module_name":"integration__integration_tests__post_start_commands","metadata":{},"snapshot":"line2"}}
+{"run_id":"1764014980-254290000","line":672,"new":null,"old":null}
+{"run_id":"1764014980-254290000","line":431,"new":{"module_name":"integration__integration_tests__post_start_commands","snapshot_name":"post_start_log_file_captures_output","metadata":{"source":"tests/integration_tests/post_start_commands.rs","assertion_line":431,"expression":"log_contents"},"snapshot":"stdout output"},"old":{"module_name":"integration__integration_tests__post_start_commands","metadata":{},"snapshot":"stdout output\nstderr output"}}
+{"run_id":"1764015452-863643000","line":730,"new":null,"old":null}
+{"run_id":"1764015452-863643000","line":625,"new":null,"old":null}
+{"run_id":"1764015452-863643000","line":431,"new":null,"old":null}
+{"run_id":"1764015452-863643000","line":672,"new":null,"old":null}
diff --git a/tests/integration_tests/approval_pty.rs b/tests/integration_tests/approval_pty.rs
index ea5962c15..6ac89daf5 100644
--- a/tests/integration_tests/approval_pty.rs
+++ b/tests/integration_tests/approval_pty.rs
@@ -134,7 +134,7 @@ fn normalize_output(output: &str) -> String {
fn test_approval_prompt_accept() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- repo.write_project_config(r#"post-create-command = "echo 'test command'""#);
+ repo.write_project_config(r#"post-create = "echo 'test command'""#);
repo.commit("Add config");
let env_vars = repo.test_env_vars();
@@ -155,7 +155,7 @@ fn test_approval_prompt_accept() {
fn test_approval_prompt_decline() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- repo.write_project_config(r#"post-create-command = "echo 'test command'""#);
+ repo.write_project_config(r#"post-create = "echo 'test command'""#);
repo.commit("Add config");
let env_vars = repo.test_env_vars();
@@ -177,7 +177,7 @@ fn test_approval_prompt_multiple_commands() {
let repo = TestRepo::new();
repo.commit("Initial commit");
repo.write_project_config(
- r#"post-create-command = [
+ r#"post-create = [
"echo 'First command'",
"echo 'Second command'",
"echo 'Third command'"
@@ -205,7 +205,7 @@ fn test_approval_prompt_multiple_commands() {
fn test_approval_prompt_permission_error() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- repo.write_project_config(r#"post-create-command = "echo 'test command'""#);
+ repo.write_project_config(r#"post-create = "echo 'test command'""#);
repo.commit("Add config");
// Create config file and make it read-only to trigger permission error when saving approval
@@ -268,7 +268,7 @@ fn test_approval_prompt_named_commands() {
let repo = TestRepo::new();
repo.commit("Initial commit");
repo.write_project_config(
- r#"[post-create-command]
+ r#"[post-create]
install = "echo 'Installing dependencies...'"
build = "echo 'Building project...'"
test = "echo 'Running tests...'"
@@ -307,7 +307,7 @@ fn test_approval_prompt_mixed_approved_unapproved_accept() {
let repo = TestRepo::new();
repo.commit("Initial commit");
repo.write_project_config(
- r#"post-create-command = [
+ r#"post-create = [
"echo 'First command'",
"echo 'Second command'",
"echo 'Third command'"
@@ -366,7 +366,7 @@ fn test_approval_prompt_mixed_approved_unapproved_decline() {
let repo = TestRepo::new();
repo.commit("Initial commit");
repo.write_project_config(
- r#"post-create-command = [
+ r#"post-create = [
"echo 'First command'",
"echo 'Second command'",
"echo 'Third command'"
diff --git a/tests/integration_tests/approval_ui.rs b/tests/integration_tests/approval_ui.rs
index 6a8043dc2..aa000f52b 100644
--- a/tests/integration_tests/approval_ui.rs
+++ b/tests/integration_tests/approval_ui.rs
@@ -45,7 +45,7 @@ fn test_approval_single_command() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- repo.write_project_config(r#"post-create-command = "echo 'Worktree path: {{ worktree }}'""#);
+ repo.write_project_config(r#"post-create = "echo 'Worktree path: {{ worktree }}'""#);
repo.commit("Add config");
@@ -63,7 +63,7 @@ fn test_approval_multiple_commands() {
repo.commit("Initial commit");
repo.write_project_config(
- r#"post-create-command = [
+ r#"post-create = [
"echo 'Branch: {{ branch }}'",
"echo 'Worktree: {{ worktree }}'",
"echo 'Repo: {{ main_worktree }}'",
@@ -87,7 +87,7 @@ fn test_approval_mixed_approved_unapproved() {
repo.commit("Initial commit");
repo.write_project_config(
- r#"post-create-command = [
+ r#"post-create = [
"echo 'First command'",
"echo 'Second command'",
"echo 'Third command'"
@@ -118,7 +118,7 @@ fn test_force_flag_does_not_save_approvals() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- repo.write_project_config(r#"post-create-command = "echo 'test command' > output.txt""#);
+ repo.write_project_config(r#"post-create = "echo 'test command' > output.txt""#);
repo.commit("Add config");
@@ -157,7 +157,7 @@ fn test_already_approved_commands_skip_prompt() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- repo.write_project_config(r#"post-create-command = "echo 'approved' > output.txt""#);
+ repo.write_project_config(r#"post-create = "echo 'approved' > output.txt""#);
repo.commit("Add config");
@@ -184,7 +184,7 @@ fn test_decline_approval_skips_only_unapproved() {
repo.commit("Initial commit");
repo.write_project_config(
- r#"post-create-command = [
+ r#"post-create = [
"echo 'First command'",
"echo 'Second command'",
"echo 'Third command'"
@@ -220,7 +220,7 @@ fn test_approval_named_commands() {
repo.commit("Initial commit");
repo.write_project_config(
- r#"[post-create-command]
+ r#"[post-create]
install = "echo 'Installing dependencies...'"
build = "echo 'Building project...'"
test = "echo 'Running tests...'"
@@ -280,9 +280,7 @@ fn test_run_hook_pre_merge_requires_approval() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- repo.write_project_config(
- r#"pre-merge-command = "echo 'Running pre-merge checks on {{ branch }}'""#,
- );
+ repo.write_project_config(r#"pre-merge = "echo 'Running pre-merge checks on {{ branch }}'""#);
repo.commit("Add pre-merge hook");
@@ -304,9 +302,7 @@ fn test_run_hook_post_merge_requires_approval() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- repo.write_project_config(
- r#"post-merge-command = "echo 'Post-merge cleanup for {{ branch }}'""#,
- );
+ repo.write_project_config(r#"post-merge = "echo 'Post-merge cleanup for {{ branch }}'""#);
repo.commit("Add post-merge hook");
@@ -328,7 +324,7 @@ fn test_approval_fails_in_non_tty() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- repo.write_project_config(r#"post-create-command = "echo 'test command'""#);
+ repo.write_project_config(r#"post-create = "echo 'test command'""#);
repo.commit("Add config");
// Run WITHOUT piping stdin - this simulates non-TTY environment
@@ -348,7 +344,7 @@ fn test_force_bypasses_tty_check() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- repo.write_project_config(r#"post-create-command = "echo 'test command'""#);
+ repo.write_project_config(r#"post-create = "echo 'test command'""#);
repo.commit("Add config");
// Run with --force to bypass approval entirely
diff --git a/tests/integration_tests/approvals.rs b/tests/integration_tests/approvals.rs
index b149f660e..d4cc6fcdd 100644
--- a/tests/integration_tests/approvals.rs
+++ b/tests/integration_tests/approvals.rs
@@ -40,7 +40,7 @@ fn test_ask_approvals_no_config() {
fn test_ask_approvals_force() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- repo.write_project_config(r#"post-create-command = "echo 'test'""#);
+ repo.write_project_config(r#"post-create = "echo 'test'""#);
repo.commit("Add config");
snapshot_ask_approvals("ask_approvals_force", &repo, &["--force"]);
@@ -50,7 +50,7 @@ fn test_ask_approvals_force() {
fn test_ask_approvals_all_with_none_approved() {
let repo = TestRepo::new();
repo.commit("Initial commit");
- repo.write_project_config(r#"post-create-command = "echo 'test'""#);
+ repo.write_project_config(r#"post-create = "echo 'test'""#);
repo.commit("Add config");
snapshot_ask_approvals("ask_approvals_all_none_approved", &repo, &["--all"]);
@@ -83,7 +83,7 @@ fn test_clear_approvals_with_approvals() {
let repo = TestRepo::new();
let project_id = format!("{}/origin", repo.root_path().display());
repo.commit("Initial commit");
- repo.write_project_config(r#"post-create-command = "echo 'test'""#);
+ repo.write_project_config(r#"post-create = "echo 'test'""#);
repo.commit("Add config");
// Manually approve the command by writing to test config
@@ -113,7 +113,7 @@ fn test_clear_approvals_global_with_approvals() {
let repo = TestRepo::new();
let project_id = format!("{}/origin", repo.root_path().display());
repo.commit("Initial commit");
- repo.write_project_config(r#"post-create-command = "echo 'test'""#);
+ repo.write_project_config(r#"post-create = "echo 'test'""#);
repo.commit("Add config");
// Manually approve the command
@@ -139,7 +139,7 @@ fn test_clear_approvals_after_clear() {
let repo = TestRepo::new();
let project_id = format!("{}/origin", repo.root_path().display());
repo.commit("Initial commit");
- repo.write_project_config(r#"post-create-command = "echo 'test'""#);
+ repo.write_project_config(r#"post-create = "echo 'test'""#);
repo.commit("Add config");
// Manually approve the command
@@ -167,9 +167,9 @@ fn test_clear_approvals_multiple_approvals() {
repo.commit("Initial commit");
repo.write_project_config(
r#"
-post-create-command = "echo 'first'"
-post-start-command = "echo 'second'"
-[pre-commit-command]
+post-create = "echo 'first'"
+post-start = "echo 'second'"
+[pre-commit]
lint = "echo 'third'"
"#,
);
diff --git a/tests/integration_tests/config_list.rs b/tests/integration_tests/config_list.rs
index 647a815ad..a0d02823f 100644
--- a/tests/integration_tests/config_list.rs
+++ b/tests/integration_tests/config_list.rs
@@ -31,9 +31,9 @@ command = "npm install"
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"post-create-command = "npm install"
+ r#"post-create = "npm install"
-[post-start-command]
+[post-start]
server = "npm run dev"
"#,
)
@@ -58,9 +58,9 @@ server = "npm run dev"
  command = "npm install"
⚪ Project Config: [REPO]/.config/wt.toml
-   post-create-command = "npm install"
+   post-create = "npm install"
 
-   [post-start-command]
+   [post-start]
  server = "npm run dev"
----- stderr -----
diff --git a/tests/integration_tests/e2e_shell_post_start.rs b/tests/integration_tests/e2e_shell_post_start.rs
index 4a5071c22..bba3e863c 100644
--- a/tests/integration_tests/e2e_shell_post_start.rs
+++ b/tests/integration_tests/e2e_shell_post_start.rs
@@ -36,7 +36,7 @@ fn test_shell_integration_post_start_background(#[case] shell: &str) {
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"post-start-command = "sleep 0.05 && echo 'Background task done' > bg_marker.txt""#,
+ r#"post-start = "sleep 0.05 && echo 'Background task done' > bg_marker.txt""#,
)
.unwrap();
@@ -136,7 +136,7 @@ fn test_bash_shell_integration_post_start_parallel() {
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"[post-start-command]
+ r#"[post-start]
task1 = "sleep 0.05 && echo 'Task 1' > task1.txt"
task2 = "sleep 0.05 && echo 'Task 2' > task2.txt"
"#,
@@ -209,7 +209,7 @@ fn test_bash_shell_integration_post_create_blocks() {
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"post-create-command = "echo 'Setup done' > setup.txt""#,
+ r#"post-create = "echo 'Setup done' > setup.txt""#,
)
.unwrap();
@@ -281,7 +281,7 @@ fn test_fish_shell_integration_post_start_background() {
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"[post-start-command]
+ r#"[post-start]
fish_bg = "sleep 0.05 && echo 'Fish background done' > fish_bg.txt"
"#,
)
diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rs
index f8141747f..6a4c015ae 100644
--- a/tests/integration_tests/merge.rs
+++ b/tests/integration_tests/merge.rs
@@ -889,11 +889,7 @@ fn test_merge_pre_merge_command_success() {
// Create project config with pre-merge command
let config_dir = repo.root_path().join(".config");
fs::create_dir_all(&config_dir).unwrap();
- fs::write(
- config_dir.join("wt.toml"),
- r#"pre-merge-command = "exit 0""#,
- )
- .unwrap();
+ fs::write(config_dir.join("wt.toml"), r#"pre-merge = "exit 0""#).unwrap();
repo.commit("Add config");
@@ -942,11 +938,7 @@ fn test_merge_pre_merge_command_failure() {
// Create project config with failing pre-merge command
let config_dir = repo.root_path().join(".config");
fs::create_dir_all(&config_dir).unwrap();
- fs::write(
- config_dir.join("wt.toml"),
- r#"pre-merge-command = "exit 1""#,
- )
- .unwrap();
+ fs::write(config_dir.join("wt.toml"), r#"pre-merge = "exit 1""#).unwrap();
repo.commit("Add config");
@@ -995,11 +987,7 @@ fn test_merge_pre_merge_command_no_hooks() {
// Create project config with failing pre-merge command
let config_dir = repo.root_path().join(".config");
fs::create_dir_all(&config_dir).unwrap();
- fs::write(
- config_dir.join("wt.toml"),
- r#"pre-merge-command = "exit 1""#,
- )
- .unwrap();
+ fs::write(config_dir.join("wt.toml"), r#"pre-merge = "exit 1""#).unwrap();
repo.commit("Add config");
@@ -1051,7 +1039,7 @@ fn test_merge_pre_merge_command_named() {
fs::write(
config_dir.join("wt.toml"),
r#"
-[pre-merge-command]
+[pre-merge]
format = "exit 0"
lint = "exit 0"
test = "exit 0"
@@ -1108,7 +1096,7 @@ fn test_merge_post_merge_command_success() {
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"post-merge-command = "echo 'merged {{ branch }} to {{ target }}' > post-merge-ran.txt""#,
+ r#"post-merge = "echo 'merged {{ branch }} to {{ target }}' > post-merge-ran.txt""#,
)
.unwrap();
@@ -1174,7 +1162,7 @@ fn test_merge_post_merge_command_skipped_with_no_verify() {
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"post-merge-command = "echo 'merged {{ branch }} to {{ target }}' > post-merge-ran.txt""#,
+ r#"post-merge = "echo 'merged {{ branch }} to {{ target }}' > post-merge-ran.txt""#,
)
.unwrap();
@@ -1232,11 +1220,7 @@ fn test_merge_post_merge_command_failure() {
// Create project config with failing post-merge command
let config_dir = repo.root_path().join(".config");
fs::create_dir_all(&config_dir).unwrap();
- fs::write(
- config_dir.join("wt.toml"),
- r#"post-merge-command = "exit 1""#,
- )
- .unwrap();
+ fs::write(config_dir.join("wt.toml"), r#"post-merge = "exit 1""#).unwrap();
repo.commit("Add config");
@@ -1288,7 +1272,7 @@ fn test_merge_post_merge_command_named() {
fs::write(
config_dir.join("wt.toml"),
r#"
-[post-merge-command]
+[post-merge]
notify = "echo 'Merge to {{ target }} complete' > notify.txt"
deploy = "echo 'Deploying branch {{ branch }}' > deploy.txt"
"#,
@@ -1356,7 +1340,7 @@ fn test_merge_pre_commit_command_success() {
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"pre-commit-command = "echo 'Pre-commit check passed'""#,
+ r#"pre-commit = "echo 'Pre-commit check passed'""#,
)
.unwrap();
@@ -1393,11 +1377,7 @@ fn test_merge_pre_commit_command_failure() {
// Create project config with failing pre-commit command
let config_dir = repo.root_path().join(".config");
fs::create_dir_all(&config_dir).unwrap();
- fs::write(
- config_dir.join("wt.toml"),
- r#"pre-commit-command = "exit 1""#,
- )
- .unwrap();
+ fs::write(config_dir.join("wt.toml"), r#"pre-commit = "exit 1""#).unwrap();
repo.commit("Add config");
@@ -1434,7 +1414,7 @@ fn test_merge_pre_squash_command_success() {
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- "pre-commit-command = \"echo 'Pre-commit check passed'\"",
+ "pre-commit = \"echo 'Pre-commit check passed'\"",
)
.unwrap();
@@ -1485,11 +1465,7 @@ fn test_merge_pre_squash_command_failure() {
// Create project config with failing pre-commit command (used for both squash and no-squash)
let config_dir = repo.root_path().join(".config");
fs::create_dir_all(&config_dir).unwrap();
- fs::write(
- config_dir.join("wt.toml"),
- r#"pre-commit-command = "exit 1""#,
- )
- .unwrap();
+ fs::write(config_dir.join("wt.toml"), r#"pre-commit = "exit 1""#).unwrap();
repo.commit("Add config");
@@ -1708,11 +1684,11 @@ EOF
}
let config_content = r#"
-[pre-merge-command]
+[pre-merge]
"test" = "cargo test"
"lint" = "cargo clippy"
-[post-merge-command]
+[post-merge]
"install" = "cargo install --path ."
"#;
@@ -1907,10 +1883,10 @@ fi
}
let config_content = r#"
-[post-create-command]
+[post-create]
"install" = "uv sync"
-[post-start-command]
+[post-start]
"dev" = "uv run dev"
"#;
@@ -2035,7 +2011,7 @@ fi
}
let config_content = r#"
-[pre-merge-command]
+[pre-merge]
"test" = "uv run pytest"
"lint" = "uv run ruff check"
"#;
@@ -3013,7 +2989,7 @@ fn test_step_squash_with_no_verify_flag() {
fs::create_dir_all(feature_wt.join(".config")).expect("Failed to create .config");
fs::write(
feature_wt.join(".config/wt.toml"),
- "pre-commit-command = \"echo pre-commit check\"",
+ "pre-commit = \"echo pre-commit check\"",
)
.expect("Failed to write wt.toml");
@@ -3128,7 +3104,7 @@ fn test_step_squash_with_both_flags() {
fs::create_dir_all(feature_wt.join(".config")).expect("Failed to create .config");
fs::write(
feature_wt.join(".config/wt.toml"),
- "pre-commit-command = \"echo pre-commit check\"",
+ "pre-commit = \"echo pre-commit check\"",
)
.expect("Failed to write wt.toml");
@@ -3187,7 +3163,7 @@ fn test_step_commit_with_no_verify_flag() {
fs::create_dir_all(repo.root_path().join(".config")).expect("Failed to create .config");
fs::write(
repo.root_path().join(".config/wt.toml"),
- "pre-commit-command = \"echo pre-commit check\"",
+ "pre-commit = \"echo pre-commit check\"",
)
.expect("Failed to write wt.toml");
@@ -3244,7 +3220,7 @@ fn test_step_commit_with_both_flags() {
fs::create_dir_all(repo.root_path().join(".config")).expect("Failed to create .config");
fs::write(
repo.root_path().join(".config/wt.toml"),
- "pre-commit-command = \"echo pre-commit check\"",
+ "pre-commit = \"echo pre-commit check\"",
)
.expect("Failed to write wt.toml");
diff --git a/tests/integration_tests/post_start_commands.rs b/tests/integration_tests/post_start_commands.rs
index cdb69d65f..2911e0e8e 100644
--- a/tests/integration_tests/post_start_commands.rs
+++ b/tests/integration_tests/post_start_commands.rs
@@ -43,7 +43,7 @@ fn test_post_create_single_command() {
repo.commit("Initial commit");
// Create project config with a single command (string format)
- repo.write_project_config(r#"post-create-command = "echo 'Setup complete'""#);
+ repo.write_project_config(r#"post-create = "echo 'Setup complete'""#);
repo.commit("Add config");
@@ -70,7 +70,7 @@ fn test_post_create_multiple_commands_array() {
repo.commit("Initial commit");
// Create project config with multiple commands (array format)
- repo.write_project_config(r#"post-create-command = ["echo 'First'", "echo 'Second'"]"#);
+ repo.write_project_config(r#"post-create = ["echo 'First'", "echo 'Second'"]"#);
repo.commit("Add config with multiple commands");
@@ -101,7 +101,7 @@ fn test_post_create_named_commands() {
// Create project config with named commands (table format)
repo.write_project_config(
- r#"[post-create-command]
+ r#"[post-create]
install = "echo 'Installing deps'"
setup = "echo 'Running setup'"
"#,
@@ -135,7 +135,7 @@ fn test_post_create_failing_command() {
repo.commit("Initial commit");
// Create project config with a command that will fail
- repo.write_project_config(r#"post-create-command = "exit 1""#);
+ repo.write_project_config(r#"post-create = "exit 1""#);
repo.commit("Add config with failing command");
@@ -163,7 +163,7 @@ fn test_post_create_template_expansion() {
// Create project config with template variables
repo.write_project_config(
- r#"post-create-command = [
+ r#"post-create = [
"echo 'Repo: {{ main_worktree }}' > info.txt",
"echo 'Branch: {{ branch }}' >> info.txt",
"echo 'Worktree: {{ worktree }}' >> info.txt",
@@ -234,7 +234,7 @@ fn test_post_start_single_background_command() {
// Create project config with a background command
repo.write_project_config(
- r#"post-start-command = "sleep 0.1 && echo 'Background task done' > background.txt""#,
+ r#"post-start = "sleep 0.1 && echo 'Background task done' > background.txt""#,
);
repo.commit("Add background command");
@@ -273,7 +273,7 @@ fn test_post_start_multiple_background_commands() {
// Create project config with multiple background commands (table format)
repo.write_project_config(
- r#"[post-start-command]
+ r#"[post-start]
task1 = "echo 'Task 1 running' > task1.txt"
task2 = "echo 'Task 2 running' > task2.txt"
"#,
@@ -319,9 +319,9 @@ fn test_both_post_create_and_post_start() {
// Create project config with both command types
repo.write_project_config(
- r#"post-create-command = "echo 'Setup done' > setup.txt"
+ r#"post-create = "echo 'Setup done' > setup.txt"
-[post-start-command]
+[post-start]
server = "sleep 0.05 && echo 'Server running' > server.txt"
"#,
);
@@ -363,7 +363,7 @@ fn test_invalid_toml() {
repo.commit("Initial commit");
// Create invalid TOML
- repo.write_project_config("post-create-command = [invalid syntax\n");
+ repo.write_project_config("post-create = [invalid syntax\n");
repo.commit("Add invalid config");
@@ -381,9 +381,7 @@ fn test_post_start_log_file_captures_output() {
repo.commit("Initial commit");
// Create command that writes to both stdout and stderr
- repo.write_project_config(
- r#"post-start-command = "echo 'stdout output' && echo 'stderr output' >&2""#,
- );
+ repo.write_project_config(r#"post-start = "echo 'stdout output' && echo 'stderr output' >&2""#);
repo.commit("Add command with stdout/stderr");
@@ -442,7 +440,7 @@ fn test_post_start_invalid_command_handling() {
repo.commit("Initial commit");
// Create command with syntax error (missing quote)
- repo.write_project_config(r#"post-start-command = "echo 'unclosed quote""#);
+ repo.write_project_config(r#"post-start = "echo 'unclosed quote""#);
repo.commit("Add invalid command");
@@ -477,7 +475,7 @@ fn test_post_start_multiple_commands_separate_logs() {
// Create multiple background commands with distinct output
repo.write_project_config(
- r#"[post-start-command]
+ r#"[post-start]
task1 = "echo 'TASK1_OUTPUT'"
task2 = "echo 'TASK2_OUTPUT'"
task3 = "echo 'TASK3_OUTPUT'"
@@ -555,7 +553,7 @@ fn test_execute_flag_with_post_start_commands() {
repo.commit("Initial commit");
// Create post-start command
- repo.write_project_config(r#"post-start-command = "echo 'Background task' > background.txt""#);
+ repo.write_project_config(r#"post-start = "echo 'Background task' > background.txt""#);
repo.commit("Add background command");
@@ -602,7 +600,7 @@ fn test_post_start_complex_shell_commands() {
// Create command with pipes and redirects
repo.write_project_config(
- r#"post-start-command = "echo 'line1\nline2\nline3' | grep line2 > filtered.txt""#,
+ r#"post-start = "echo 'line1\nline2\nline3' | grep line2 > filtered.txt""#,
);
repo.commit("Add complex shell command");
@@ -634,7 +632,7 @@ fn test_post_start_multiline_commands_with_newlines() {
// Create command with actual newlines (using TOML triple-quoted string)
repo.write_project_config(
- r#"post-start-command = """
+ r#"post-start = """
echo 'first line' > multiline.txt
echo 'second line' >> multiline.txt
echo 'third line' >> multiline.txt
@@ -685,7 +683,7 @@ fn test_post_create_multiline_with_control_structures() {
// Test multiline command with if-else control structure
repo.write_project_config(
- r#"post-create-command = """
+ r#"post-create = """
if [ ! -f test.txt ]; then
echo 'File does not exist' > result.txt
else
@@ -746,9 +744,7 @@ fn test_post_start_skipped_on_existing_worktree() {
repo.commit("Initial commit");
// Create project config with post-start command
- repo.write_project_config(
- r#"post-start-command = "echo 'POST-START-RAN' > post_start_marker.txt""#,
- );
+ repo.write_project_config(r#"post-start = "echo 'POST-START-RAN' > post_start_marker.txt""#);
repo.commit("Add post-start config");
diff --git a/tests/integration_tests/shell_wrapper.rs b/tests/integration_tests/shell_wrapper.rs
index 62cff7353..5f090052b 100644
--- a/tests/integration_tests/shell_wrapper.rs
+++ b/tests/integration_tests/shell_wrapper.rs
@@ -753,7 +753,7 @@ mod tests {
);
}
- /// Test switch --create with post-create-command (blocking) and post-start-command (background)
+ /// Test switch --create with post-create (blocking) and post-start (background)
/// Note: bash and fish disabled due to flaky PTY buffering race conditions
///
/// TODO: Fix timing/race condition in bash where "Building project..." output appears
@@ -773,13 +773,13 @@ mod tests {
fs::write(
config_dir.join("wt.toml"),
r#"# Blocking command that runs before worktree is ready
-post-create-command = [
+post-create = [
"echo 'Installing dependencies...'",
"echo 'Building project...'"
]
# Background command that runs in parallel
-[post-start-command]
+[post-start]
server = "echo 'Starting dev server on port 3000'"
watch = "echo 'Watching for file changes'"
"#,
@@ -813,7 +813,7 @@ approved-commands = [
assert_snapshot!(format!("switch_with_hooks_{}", shell), output.normalized());
}
- /// Test merge with successful pre-merge-command validation
+ /// Test merge with successful pre-merge validation
/// Note: fish disabled due to flaky PTY buffering race conditions
/// TODO: bash variant occasionally fails on Ubuntu CI with snapshot mismatches due to PTY timing
#[rstest]
@@ -830,7 +830,7 @@ approved-commands = [
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"[pre-merge-command]
+ r#"[pre-merge]
format = "echo '✓ Code formatting check passed'"
lint = "echo '✓ Linting passed - no warnings'"
test = "echo '✓ All 47 tests passed in 2.3s'"
@@ -896,7 +896,7 @@ approved-commands = [
);
}
- /// Test merge with failing pre-merge-command that aborts the merge
+ /// Test merge with failing pre-merge that aborts the merge
/// Note: fish disabled due to flaky PTY buffering race conditions
#[rstest]
#[case("bash")]
@@ -912,7 +912,7 @@ approved-commands = [
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"[pre-merge-command]
+ r#"[pre-merge]
format = "echo '✓ Code formatting check passed'"
test = "echo '✗ Test suite failed: 3 tests failing' && exit 1"
"#,
@@ -997,7 +997,7 @@ approved-commands = [
fs::write(
config_dir.join("wt.toml"),
format!(
- r#"[pre-merge-command]
+ r#"[pre-merge]
check1 = "{} check1 3"
check2 = "{} check2 3"
"#,
@@ -1086,7 +1086,7 @@ approved-commands = [
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"post-start-command = "echo 'test command executed'""#,
+ r#"post-start = "echo 'test command executed'""#,
)
.unwrap();
@@ -1206,7 +1206,7 @@ approved-commands = ["echo 'test command executed'"]
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"post-start-command = "echo 'background task'""#,
+ r#"post-start = "echo 'background task'""#,
)
.unwrap();
@@ -1275,7 +1275,7 @@ approved-commands = ["echo 'background task'"]
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"post-start-command = "echo 'fish background task'""#,
+ r#"post-start = "echo 'fish background task'""#,
)
.unwrap();
@@ -1520,7 +1520,7 @@ approved-commands = ["echo 'fish background task'"]
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"post-start-command = "echo 'background job'""#,
+ r#"post-start = "echo 'background job'""#,
)
.unwrap();
@@ -1569,7 +1569,7 @@ approved-commands = ["echo 'background job'"]
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"post-start-command = "echo 'bash background'""#,
+ r#"post-start = "echo 'bash background'""#,
)
.unwrap();
@@ -1921,7 +1921,7 @@ approved-commands = ["echo 'bash background'"]
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"post-start-command = "echo 'cleanup test'""#,
+ r#"post-start = "echo 'cleanup test'""#,
)
.unwrap();
@@ -2058,7 +2058,7 @@ fi
}
let config_content = r#"
-[pre-merge-command]
+[pre-merge]
"test" = "uv run pytest"
"lint" = "uv run ruff check"
"#;
@@ -2288,10 +2288,10 @@ fi
}
let config_content = r#"
-[post-create-command]
+[post-create]
"install" = "uv sync"
-[post-start-command]
+[post-start]
"dev" = "uv run dev"
"#;
@@ -2348,7 +2348,7 @@ fi
// Create project config with named post-create commands
repo.write_project_config(
- r#"[post-create-command]
+ r#"[post-create]
install = "echo 'Installing dependencies...'"
build = "echo 'Building project...'"
test = "echo 'Running tests...'"
diff --git a/tests/integration_tests/switch.rs b/tests/integration_tests/switch.rs
index 10d8f564d..5bb371c44 100644
--- a/tests/integration_tests/switch.rs
+++ b/tests/integration_tests/switch.rs
@@ -290,7 +290,7 @@ fn test_switch_no_config_commands_skips_post_start_commands() {
fs::write(
config_dir.join("wt.toml"),
- format!(r#"post-start-commands = ["{}"]"#, create_file_cmd),
+ format!(r#"post-starts = ["{}"]"#, create_file_cmd),
)
.unwrap();
@@ -355,7 +355,7 @@ fn test_switch_no_config_commands_with_force() {
fs::create_dir_all(&config_dir).unwrap();
fs::write(
config_dir.join("wt.toml"),
- r#"post-start-commands = ["echo 'test'"]"#,
+ r#"post-starts = ["echo 'test'"]"#,
)
.unwrap();
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_create.snap b/tests/snapshots/integration__integration_tests__help__help_config_create.snap
index 76427d5ec..23e461a62 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_create.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_create.snap
@@ -92,7 +92,7 @@ Creates ~/.config/worktrunk/config.toml with the following content:
project = "github.com/user/repo"
command = "npm install"

- # NOTE: For project-specific commands (post-create, post-start, pre-merge, etc.),
+ # NOTE: For project-specific hooks (post-create, post-start, pre-merge, etc.),
# use a separate PROJECT config file at <repo>/.config/wt.toml
# See: .config/wt.example.toml for project configuration examples