Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Remove array format for hook commands, standardize on named table
Maximilian Rooscdf0bc94a508
diff --git a/.claude-plugin/skills/worktrunk/SKILL.md b/.claude-plugin/skills/worktrunk/SKILL.mdindex 6ac1c3982..a5abd071d 100644--- a/.claude-plugin/skills/worktrunk/SKILL.md+++ b/.claude-plugin/skills/worktrunk/SKILL.md@@ -125,7 +125,9 @@ Common request for workflow automation. Follow discovery process:post-create = "npm install"# Validate code quality before committing- pre-commit = ["npm run lint", "npm run typecheck"]+ [pre-commit]+ lint = "npm run lint"+ typecheck = "npm run typecheck"# Run tests before mergingpre-merge = "npm test"diff --git a/.claude-plugin/skills/worktrunk/reference/hook-types-reference.md b/.claude-plugin/skills/worktrunk/reference/hook-types-reference.mdindex 5fc5d0c75..a9f543bd6 100644--- a/.claude-plugin/skills/worktrunk/reference/hook-types-reference.md+++ b/.claude-plugin/skills/worktrunk/reference/hook-types-reference.md@@ -25,7 +25,7 @@ Detailed behavior and use cases for all five Worktrunk hook types.- Blocks until all commands complete- User cannot use worktree until complete- Failure shows error but doesn't abort (worktree still created)-- Commands run sequentially (even if using array format)+- Commands run sequentially**Use cases**:- Installing dependencies (npm install, cargo build, poetry install)@@ -35,11 +35,10 @@ Detailed behavior and use cases for all five Worktrunk hook types.**Example**:```toml-post-create = [- "npm install",- "npm run db:migrate",- "cp .env.example .env"-]+[post-create]+install = "npm install"+migrate = "npm run db:migrate"+env = "cp .env.example .env"```**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.@@ -62,11 +61,10 @@ post-create = [**Example**:```toml-post-start = [- "npm run build",- "docker-compose up -d",- "git pull origin main"-]+[post-start]+build = "npm run build"+services = "docker-compose up -d"+sync = "git pull origin main"```**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 `.git/wt-logs/` for output.@@ -89,11 +87,10 @@ post-start = [**Example**:```toml-pre-commit = [- "npm run lint",- "npm run typecheck",- "npm run format:check"-]+[pre-commit]+lint = "npm run lint"+typecheck = "npm run typecheck"+format = "npm run format:check"```**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.@@ -117,10 +114,9 @@ pre-commit = [**Example**:```toml-pre-merge = [- "npm test",- "npm run build"-]+[pre-merge]+test = "npm test"+build = "npm run build"```**What happens**: User runs `wt merge`. After commit succeeds, before merging, both commands run. If any fails, merge is aborted but commit remains.@@ -144,10 +140,9 @@ pre-merge = [**Example**:```toml-post-merge = [- "npm run deploy",- "./scripts/notify-slack.sh"-]+[post-merge]+deploy = "npm run deploy"+notify = "./scripts/notify-slack.sh"```**What happens**: User runs `wt merge`. After merge succeeds and push completes, commands run in main worktree. Then cleanup happens (branch deletion, worktree removal).@@ -169,19 +164,19 @@ Full sequence when running `wt merge`:## Format Variants-All hooks support three formats:+All hooks support two formats:### Single Command (String)```tomlpost-create = "npm install"```-### Multiple Commands (Array)+### Multiple Commands (Named Table)```toml-post-create = [- "npm install",- "npm run build"-]+[post-create]+dependencies = "npm install"+database = "npm run db:migrate"+services = "docker-compose up -d"```Behavior:@@ -191,15 +186,7 @@ Behavior:- `pre-merge`: Sequential execution- `post-merge`: Sequential execution-### Named Commands (Table)-```toml-[post-create]-dependencies = "npm install"-database = "npm run db:migrate"-services = "docker-compose up -d"-```--Behavior same as array format, but with descriptive names.+Named commands appear in output with their labels, making it easier to identify which command succeeded or failed.## Template Variables@@ -256,10 +243,14 @@ post-start = "npm run build"### Progressive Validation```toml# Quick checks before commit-pre-commit = ["npm run lint", "npm run typecheck"]+[pre-commit]+lint = "npm run lint"+typecheck = "npm run typecheck"# Thorough validation before merge-pre-merge = ["npm test", "npm run build"]+[pre-merge]+test = "npm test"+build = "npm run build"```### Target-Specific Behaviordiff --git a/.claude-plugin/skills/worktrunk/reference/project-config.md b/.claude-plugin/skills/worktrunk/reference/project-config.mdindex 91bc9e3de..a153af27c 100644--- a/.claude-plugin/skills/worktrunk/reference/project-config.md+++ b/.claude-plugin/skills/worktrunk/reference/project-config.md@@ -72,10 +72,9 @@ Typical npm project:post-create = "npm install"# Validate code quality before committing (blocking, fail-fast)-pre-commit = [- "npm run lint",- "npm run typecheck"-]+[pre-commit]+lint = "npm run lint"+typecheck = "npm run typecheck"# Run tests before merging (blocking, fail-fast)pre-merge = "npm test"@@ -91,10 +90,9 @@ Typical Rust project:post-start = "cargo build"# Format and lint before committing (blocking, fail-fast)-pre-commit = [- "cargo fmt --check",- "cargo clippy -- -D warnings"-]+[pre-commit]+format = "cargo fmt --check"+lint = "cargo clippy -- -D warnings"# Run tests before merging (blocking, fail-fast)pre-merge = "cargo test"@@ -110,7 +108,9 @@ Document why each hook exists:post-create = "npm install"# Enforce code quality standards (matches CI checks)-pre-commit = ["npm run lint", "npm run typecheck"]+[pre-commit]+lint = "npm run lint"+typecheck = "npm run typecheck"```### Step 7: Suggest Testing@@ -143,34 +143,33 @@ Ask: When should this run?<example type="adding-to-single-command">-Current:+Current (single command):```tomlpost-create = "npm install"```-Adding "npm run db:migrate":+Adding "npm run db:migrate" — convert to named table:```toml-post-create = [- "npm install",- "npm run db:migrate"-]+[post-create]+install = "npm install"+migrate = "npm run db:migrate"```</example>-<example type="adding-to-array">+<example type="adding-to-table">-Current:+Current (named table):```toml-pre-commit = ["npm run lint"]+[pre-commit]+lint = "npm run lint"```-Adding typecheck:+Adding typecheck — just add another entry:```toml-pre-commit = [- "npm run lint",- "npm run typecheck"-]+[pre-commit]+lint = "npm run lint"+typecheck = "npm run typecheck"```</example>@@ -223,7 +222,7 @@ fi## Formats-All hooks support three command formats.+All hooks support two command formats.### Single Command (String)@@ -231,13 +230,13 @@ All hooks support three command formats.post-create = "npm install"```-### Multiple Commands (Array)+### Multiple Commands (Named Table)```toml-post-create = [- "npm install",- "npm run build"-]+[post-create]+dependencies = "npm install"+database = "npm run db:migrate"+services = "docker-compose up -d"```Behavior:@@ -247,16 +246,7 @@ Behavior:- `pre-merge`: Sequential- `post-merge`: Sequential-### Named Commands (Table)--```toml-[post-create]-dependencies = "npm install"-database = "npm run db:migrate"-services = "docker-compose up -d"-```--Behavior same as array format, but with descriptive names.+Named commands appear in output with their labels, which helps identify which command succeeded or failed.## Hook Types@@ -277,10 +267,9 @@ Five hook types with different timing and behavior:<example type="post-create">```toml-post-create = [- "npm install",- "npm run db:migrate"-]+[post-create]+install = "npm install"+migrate = "npm run db:migrate"```</example>@@ -300,10 +289,9 @@ post-create = [<example type="post-start">```toml-post-start = [- "npm run build",- "docker-compose up -d"-]+[post-start]+build = "npm run build"+services = "docker-compose up -d"```</example>@@ -323,10 +311,9 @@ post-start = [<example type="pre-commit">```toml-pre-commit = [- "npm run lint",- "npm run typecheck"-]+[pre-commit]+lint = "npm run lint"+typecheck = "npm run typecheck"```</example>diff --git a/dev/wt.example.toml b/dev/wt.example.tomlindex 92d06d184..fb9fee869 100644--- a/dev/wt.example.toml+++ b/dev/wt.example.toml@@ -23,10 +23,7 @@# 1. Single string:# post-create = "npm install"#-# 2. Array (runs sequentially):-# post-create = ["npm install", "npm run build"]-#-# 3. Named table (runs sequentially in declaration order):+# 2. Named table (runs sequentially in declaration order):# [post-create]# install = "npm install --frozen-lockfile"# build = "npm run build"@@ -42,10 +39,7 @@# 1. Single string:# post-start = "npm run dev"#-# 2. Array (runs in parallel):-# post-start = ["npm run dev", "npm run watch"]-#-# 3. Named table (runs in parallel):+# 2. Named table (runs in parallel):# [post-start]# server = "npm run dev"# watch = "npm run watch"@@ -56,10 +50,10 @@# Runs for both squash and no-squash merge modes# Use for: formatters, linters, quick validation#-# Format options same as post-create+# Single command:# pre-commit = "cargo fmt -- --check"#-# Or multiple:+# Multiple commands:# [pre-commit]# format = "cargo fmt -- --check"# lint = "cargo clippy -- -D warnings"@@ -69,10 +63,10 @@# 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-# pre-merge = ["cargo test", "cargo build"]+# Single command:+# pre-merge = "cargo test"#-# Or named:+# Multiple commands:# [pre-merge]# test = "cargo test"# build = "cargo build --release"@@ -82,8 +76,13 @@# Runs after push succeeds but before cleanup# Use for: updating production builds, notifications, cleanup#-# Format options same as post-create+# Single command:# post-merge = "cargo install --path ."+#+# Multiple commands:+# [post-merge]+# install = "cargo install --path ."+# notify = "echo 'Merged!'"# Example: Node.js Project# [post-create]diff --git a/docs/content/hooks.md b/docs/content/hooks.mdindex 9c6c100b3..280f36e8a 100644--- a/docs/content/hooks.md+++ b/docs/content/hooks.md@@ -23,7 +23,7 @@ Hooks automate setup and validation at worktree lifecycle events. They're define## Configuration formats-All hooks support three formats in `.config/wt.toml`:+All hooks support two formats in `.config/wt.toml`:### Single command (string)@@ -31,13 +31,7 @@ All hooks support three formats in `.config/wt.toml`:post-create = "npm install"```-### Multiple commands (array)--```toml-post-create = ["npm install", "npm run build"]-```--### Named commands (table)+### Multiple commands (table)```toml[post-create]diff --git a/src/config/commands.rs b/src/config/commands.rsindex 23cf3ddc0..94feb79e7 100644--- a/src/config/commands.rs+++ b/src/config/commands.rs@@ -53,9 +53,8 @@ impl Command {/// Configuration for commands - canonical representation////// Internally stores commands as `Vec<Command>` for uniform processing.-/// Deserializes from three TOML formats:+/// Deserializes from two TOML formats:/// - 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@@ -86,7 +85,7 @@ impl CommandConfig {}}-// Custom deserialization to handle 3 TOML formats+// Custom deserialization to handle 2 TOML formatsimpl<'de> Deserialize<'de> for CommandConfig {fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where@@ -96,7 +95,6 @@ impl<'de> Deserialize<'de> for CommandConfig {#[serde(untagged)]enum CommandConfigToml {Single(String),- Multiple(Vec<String>),Named(IndexMap<String, String>),}@@ -106,10 +104,6 @@ impl<'de> Deserialize<'de> for CommandConfig {// Phase will be set later when commands are collectedvec![Command::new(None, cmd, CommandPhase::PostCreate)]}- CommandConfigToml::Multiple(cmds) => cmds- .into_iter()- .map(|template| Command::new(None, template, CommandPhase::PostCreate))- .collect(),CommandConfigToml::Named(map) => {// IndexMap preserves insertion order from TOMLmap.into_iter()@@ -136,20 +130,7 @@ impl Serialize for CommandConfig {return self.commands[0].template.serialize(serializer);}- // If all commands are unnamed or numbered 1,2,3..., serialize as array- let all_numbered = self- .commands- .iter()- .enumerate()- .all(|(i, cmd)| cmd.name.as_ref().is_none_or(|n| n == &(i + 1).to_string()));-- if all_numbered {- let templates: Vec<_> = self.commands.iter().map(|cmd| &cmd.template).collect();- return templates.serialize(serializer);- }-- // Otherwise serialize as named map- // At this point, all commands must have names (from Named TOML format)+ // Serialize as named map (all commands from Named format have names)let mut map = serializer.serialize_map(Some(self.commands.len()))?;for cmd in &self.commands {let key = cmd.name.as_ref().unwrap();diff --git a/src/config/mod.rs b/src/config/mod.rsindex bd7dc0307..e4a02d424 100644--- a/src/config/mod.rs+++ b/src/config/mod.rs@@ -169,23 +169,6 @@ mod tests {);}- #[test]- fn test_command_config_multiple() {- let toml = r#"post-create = ["npm install", "npm test"]"#;- let config: ProjectConfig = toml::from_str(toml).unwrap();- let cmd_config = config.post_create.unwrap();- let commands = cmd_config.commands();- assert_eq!(commands.len(), 2);- assert_eq!(- commands[0],- Command::new(None, "npm install".to_string(), CommandPhase::PostCreate)- );- assert_eq!(- commands[1],- Command::new(None, "npm test".to_string(), CommandPhase::PostCreate)- );- }-#[test]fn test_command_config_named() {let toml = r#"@@ -276,7 +259,7 @@ task2 = "echo 'Task 2 running' > task2.txt"#[test]fn test_project_config_both_commands() {let toml = r#"- post-create = ["npm install"]+ post-create = "npm install"[post-start]server = "npm run dev"@@ -299,27 +282,6 @@ task2 = "echo 'Task 2 running' > task2.txt");}- #[test]- fn test_pre_merge_command_multiple() {- let toml = r#"pre-merge = ["cargo fmt -- --check", "cargo test"]"#;- let config: ProjectConfig = toml::from_str(toml).unwrap();- let cmd_config = config.pre_merge.unwrap();- let commands = cmd_config.commands();- assert_eq!(commands.len(), 2);- assert_eq!(- commands[0],- Command::new(- None,- "cargo fmt -- --check".to_string(),- CommandPhase::PostCreate- )- );- assert_eq!(- commands[1],- Command::new(None, "cargo test".to_string(), CommandPhase::PostCreate)- );- }-#[test]fn test_pre_merge_command_named() {let toml = r#"@@ -366,21 +328,10 @@ task2 = "echo 'Task 2 running' > task2.txt"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+ // Verify it serialized back as a stringassert!(serialized.contains(r#"post-create = "npm install""#));}- #[test]- fn test_command_config_roundtrip_multiple() {- 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 = ["npm install", "npm test"]"#));- }-#[test]fn test_command_config_roundtrip_named() {let original = r#"diff --git a/src/config/project.rs b/src/config/project.rsindex 66d9f7422..c3434664a 100644--- a/src/config/project.rs+++ b/src/config/project.rs@@ -32,21 +32,21 @@ use super::commands::CommandConfig;#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq)]pub struct ProjectConfig {/// Commands to execute sequentially before worktree is ready (blocking)- /// Supports string (single command), array (sequential), or table (named, sequential)+ /// Supports string (single command) or table (named, sequential)////// Available template variables: `{{ repo }}`, `{{ branch }}`, `{{ worktree }}`, `{{ worktree_name }}`, `{{ repo_root }}`, `{{ default_branch }}`, `{{ commit }}`, `{{ short_commit }}`, `{{ remote }}`, `{{ upstream }}`#[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)+ /// Supports string (single command) or table (named, parallel)////// Available template variables: `{{ repo }}`, `{{ branch }}`, `{{ worktree }}`, `{{ worktree_name }}`, `{{ repo_root }}`, `{{ default_branch }}`, `{{ commit }}`, `{{ short_commit }}`, `{{ remote }}`, `{{ upstream }}`#[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)+ /// Supports string (single command) or table (named, sequential)/// All commands must exit with code 0 for commit to proceed/// Runs before any commit operation during `wt merge` (both squash and no-squash modes)///@@ -55,7 +55,7 @@ pub struct ProjectConfig {pub pre_commit: Option<CommandConfig>,/// Commands to execute before merging (blocking, fail-fast validation)- /// Supports string (single command), array (sequential), or table (named, sequential)+ /// Supports string (single command) or table (named, sequential)/// All commands must exit with code 0 for merge to proceed////// Available template variables: `{{ repo }}`, `{{ branch }}`, `{{ worktree }}`, `{{ worktree_name }}`, `{{ repo_root }}`, `{{ default_branch }}`, `{{ commit }}`, `{{ short_commit }}`, `{{ remote }}`, `{{ upstream }}`, `{{ target }}`@@ -63,7 +63,7 @@ pub struct ProjectConfig {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)+ /// Supports string (single command) or table (named, sequential)/// Runs after push succeeds but before cleanup////// Available template variables: `{{ repo }}`, `{{ branch }}`, `{{ worktree }}`, `{{ worktree_name }}`, `{{ repo_root }}`, `{{ default_branch }}`, `{{ commit }}`, `{{ short_commit }}`, `{{ remote }}`, `{{ upstream }}`, `{{ target }}`diff --git a/tests/integration_tests/approval_pty.rs b/tests/integration_tests/approval_pty.rsindex 5eabdbc18..282299334 100644--- a/tests/integration_tests/approval_pty.rs+++ b/tests/integration_tests/approval_pty.rs@@ -185,11 +185,11 @@ fn test_approval_prompt_multiple_commands() {let repo = TestRepo::new();repo.commit("Initial commit");repo.write_project_config(- r#"post-create = [- "echo 'First command'",- "echo 'Second command'",- "echo 'Third command'"-]"#,+ r#"[post-create]+first = "echo 'First command'"+second = "echo 'Second command'"+third = "echo 'Third command'"+"#,);repo.commit("Add config");@@ -315,11 +315,11 @@ fn test_approval_prompt_mixed_approved_unapproved_accept() {let repo = TestRepo::new();repo.commit("Initial commit");repo.write_project_config(- r#"post-create = [- "echo 'First command'",- "echo 'Second command'",- "echo 'Third command'"-]"#,+ r#"[post-create]+first = "echo 'First command'"+second = "echo 'Second command'"+third = "echo 'Third command'"+"#,);repo.commit("Add config");@@ -374,11 +374,11 @@ fn test_approval_prompt_mixed_approved_unapproved_decline() {let repo = TestRepo::new();repo.commit("Initial commit");repo.write_project_config(- r#"post-create = [- "echo 'First command'",- "echo 'Second command'",- "echo 'Third command'"-]"#,+ r#"[post-create]+first = "echo 'First command'"+second = "echo 'Second command'"+third = "echo 'Third command'"+"#,);repo.commit("Add config");diff --git a/tests/integration_tests/approval_ui.rs b/tests/integration_tests/approval_ui.rsindex aa000f52b..576fee433 100644--- a/tests/integration_tests/approval_ui.rs+++ b/tests/integration_tests/approval_ui.rs@@ -63,12 +63,12 @@ fn test_approval_multiple_commands() {repo.commit("Initial commit");repo.write_project_config(- r#"post-create = [- "echo 'Branch: {{ branch }}'",- "echo 'Worktree: {{ worktree }}'",- "echo 'Repo: {{ main_worktree }}'",- "cd {{ worktree }} && pwd"-]"#,+ r#"[post-create]+branch = "echo 'Branch: {{ branch }}'"+worktree = "echo 'Worktree: {{ worktree }}'"+repo = "echo 'Repo: {{ main_worktree }}'"+pwd = "cd {{ worktree }} && pwd"+"#,);repo.commit("Add config");@@ -87,11 +87,11 @@ fn test_approval_mixed_approved_unapproved() {repo.commit("Initial commit");repo.write_project_config(- r#"post-create = [- "echo 'First command'",- "echo 'Second command'",- "echo 'Third command'"-]"#,+ r#"[post-create]+first = "echo 'First command'"+second = "echo 'Second command'"+third = "echo 'Third command'"+"#,);repo.commit("Add config");@@ -184,11 +184,11 @@ fn test_decline_approval_skips_only_unapproved() {repo.commit("Initial commit");repo.write_project_config(- r#"post-create = [- "echo 'First command'",- "echo 'Second command'",- "echo 'Third command'"-]"#,+ r#"[post-create]+first = "echo 'First command'"+second = "echo 'Second command'"+third = "echo 'Third command'"+"#,);repo.commit("Add config");diff --git a/tests/integration_tests/post_start_commands.rs b/tests/integration_tests/post_start_commands.rsindex 41cd40b4b..ca7dcb29a 100644--- a/tests/integration_tests/post_start_commands.rs+++ b/tests/integration_tests/post_start_commands.rs@@ -70,36 +70,6 @@ approved-commands = ["echo 'Setup complete'"]);}-#[test]-fn test_post_create_multiple_commands_array() {- let repo = TestRepo::new();- repo.commit("Initial commit");-- // Create project config with multiple commands (array format)- repo.write_project_config(r#"post-create = ["echo 'First'", "echo 'Second'"]"#);-- repo.commit("Add config with multiple commands");-- // Pre-approve both commands in temp HOME- repo.write_test_config(- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"--[projects."repo"]-approved-commands = [- "echo 'First'",- "echo 'Second'",-]-"#,- );-- // Both commands should execute sequentially- snapshot_switch(- "post_create_multiple_commands_array",- &repo,- &["--create", "feature"],- );-}-#[test]fn test_post_create_named_commands() {let repo = TestRepo::new();@@ -169,12 +139,12 @@ fn test_post_create_template_expansion() {// Create project config with template variablesrepo.write_project_config(- r#"post-create = [- "echo 'Repo: {{ main_worktree }}' > info.txt",- "echo 'Branch: {{ branch }}' >> info.txt",- "echo 'Worktree: {{ worktree }}' >> info.txt",- "echo 'Root: {{ repo_root }}' >> info.txt"-]"#,+ r#"[post-create]+repo = "echo 'Repo: {{ main_worktree }}' > info.txt"+branch = "echo 'Branch: {{ branch }}' >> info.txt"+worktree = "echo 'Worktree: {{ worktree }}' >> info.txt"+root = "echo 'Root: {{ repo_root }}' >> info.txt"+"#,);repo.commit("Add config with templates");@@ -288,12 +258,12 @@ fn test_post_create_git_variables_template() {// Create project config with git-related template variablesrepo.write_project_config(- r#"post-create = [- "echo 'Commit: {{ commit }}' > git_vars.txt",- "echo 'Short: {{ short_commit }}' >> git_vars.txt",- "echo 'Remote: {{ remote }}' >> git_vars.txt",- "echo 'Worktree Name: {{ worktree_name }}' >> git_vars.txt"-]"#,+ r#"[post-create]+commit = "echo 'Commit: {{ commit }}' > git_vars.txt"+short = "echo 'Short: {{ short_commit }}' >> git_vars.txt"+remote = "echo 'Remote: {{ remote }}' >> git_vars.txt"+worktree_name = "echo 'Worktree Name: {{ worktree_name }}' >> git_vars.txt"+"#,);repo.commit("Add config with git template variables");diff --git a/tests/integration_tests/shell_wrapper.rs b/tests/integration_tests/shell_wrapper.rsindex f428e89a2..db9136e0f 100644--- a/tests/integration_tests/shell_wrapper.rs+++ b/tests/integration_tests/shell_wrapper.rs@@ -887,13 +887,12 @@ mod tests {fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),- r#"# Blocking command that runs before worktree is ready-post-create = [- "echo 'Installing dependencies...'",- "echo 'Building project...'"-]+ r#"# Blocking commands that run before worktree is ready+[post-create]+install = "echo 'Installing dependencies...'"+build = "echo 'Building project...'"-# Background command that runs in parallel+# Background commands that run in parallel[post-start]server = "echo 'Starting dev server on port 3000'"watch = "echo 'Watching for file changes'"diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snapindex caf20ed72..915e36e51 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap@@ -6,20 +6,20 @@ y🟡 [33m[1mrepo[22m needs approval to execute [1m2[22m commands:[39m-⚪ post-create:+⚪ post-create [1mfirst[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'First command'[0m[2m[0m-⚪ post-create:+⚪ post-create [1mthird[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Third command'[0m[2m[0m❓ Allow and remember? [1m[y/N][22m-🔄 [36mRunning post-create:[39m+🔄 [36mRunning post-create [1mfirst[22m:[39m[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'First command'[0m[2m[0m[0mFirst command-🔄 [36mRunning post-create:[39m+🔄 [36mRunning post-create [1msecond[22m:[39m[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Second command'[0m[2m[0m[0mSecond command-🔄 [36mRunning post-create:[39m+🔄 [36mRunning post-create [1mthird[22m:[39m[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Third command'[0m[2m[0m[0mThird command✅ [32m[32mCreated new worktree for [1mtest-mixed-accept[22m from [1mmain[22m at [1m[REPO]/repo.test-mixed-accept[39m[22m[39mdiff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snapindex 1c75a873a..354ae6453 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap@@ -6,10 +6,10 @@ n🟡 [33m[1mrepo[22m needs approval to execute [1m2[22m commands:[39m-⚪ post-create:+⚪ post-create [1mfirst[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'First command'[0m[2m[0m-⚪ post-create:+⚪ post-create [1mthird[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Third command'[0m[2m[0m❓ Allow and remember? [1m[y/N][22mdiff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snapindex 3b07e97bb..d148b0063 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap@@ -6,23 +6,23 @@ y🟡 [33m[1mrepo[22m needs approval to execute [1m3[22m commands:[39m-⚪ post-create:+⚪ post-create [1mfirst[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'First command'[0m[2m[0m-⚪ post-create:+⚪ post-create [1msecond[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Second command'[0m[2m[0m-⚪ post-create:+⚪ post-create [1mthird[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Third command'[0m[2m[0m❓ Allow and remember? [1m[y/N][22m-🔄 [36mRunning post-create:[39m+🔄 [36mRunning post-create [1mfirst[22m:[39m[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'First command'[0m[2m[0m[0mFirst command-🔄 [36mRunning post-create:[39m+🔄 [36mRunning post-create [1msecond[22m:[39m[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Second command'[0m[2m[0m[0mSecond command-🔄 [36mRunning post-create:[39m+🔄 [36mRunning post-create [1mthird[22m:[39m[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Third command'[0m[2m[0m[0mThird command✅ [32m[32mCreated new worktree for [1mtest-multi[22m from [1mmain[22m at [1m[REPO]/repo.test-multi[39m[22m[39mdiff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snapindex e942c09bf..875fd37c6 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap@@ -2,10 +2,10 @@source: tests/integration_tests/shell_wrapper.rsexpression: output.normalized()----🔄 [36mRunning post-create:[39m+🔄 [36mRunning post-create [1minstall[22m:[39m[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Installing dependencies...'[0m[2m[0mInstalling dependencies...-🔄 [36mRunning post-create:[39m+🔄 [36mRunning post-create [1mbuild[22m:[39m[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Building project...'[0m[2m[0mBuilding project...✅ [32m[32mCreated new worktree for [1mfeature-hooks[22m from [1mmain[22m at [1m[TMPDIR]/repo.feature-hooks[39m[22m[39mdiff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snapindex a3564f234..076711c68 100644--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap@@ -8,10 +8,10 @@ exit_code: 1----- stderr -----🟡 [33m[1mrepo[22m needs approval to execute [1m2[22m commands:[39m-⚪ post-create:+⚪ post-create [1mfirst[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'First command'[0m[2m[0m-⚪ post-create:+⚪ post-create [1mthird[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Third command'[0m[2m[0m❌ [31mCannot prompt for approval in non-interactive environment[39mdiff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snapindex 7de69d0c1..c9d034f1e 100644--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap@@ -8,16 +8,16 @@ exit_code: 1----- stderr -----🟡 [33m[1mrepo[22m needs approval to execute [1m4[22m commands:[39m-⚪ post-create:+⚪ post-create [1mbranch[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Branch: test-nested-branch'[0m[2m[0m-⚪ post-create:+⚪ post-create [1mworktree[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Worktree: [REPO].test-nested-branch'[0m[2m[0m-⚪ post-create:+⚪ post-create [1mrepo[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Repo: repo'[0m[2m[0m-⚪ post-create:+⚪ post-create [1mpwd[22m:[107m [0m [2m[0m[2m[34mcd[0m[2m [REPO].test-nested-branch [0m[2m[36m&&[0m[2m [0m[2m[34mpwd[0m[2m[0m❌ [31mCannot prompt for approval in non-interactive environment[39mdiff --git a/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap b/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snapindex a3564f234..076711c68 100644--- a/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap+++ b/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap@@ -8,10 +8,10 @@ exit_code: 1----- stderr -----🟡 [33m[1mrepo[22m needs approval to execute [1m2[22m commands:[39m-⚪ post-create:+⚪ post-create [1mfirst[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'First command'[0m[2m[0m-⚪ post-create:+⚪ post-create [1mthird[22m:[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Third command'[0m[2m[0m❌ [31mCannot prompt for approval in non-interactive environment[39mdiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_git_variables_template.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_git_variables_template.snapindex e713e30f1..b5ed13760 100644--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_git_variables_template.snap+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_git_variables_template.snap@@ -26,13 +26,13 @@ exit_code: 0----- stdout ---------- stderr ------🔄 [36mRunning post-create:[39m-[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Commit: ca423bfe8d8bb22a62e11874452caa0e667c626e'[0m[2m [0m[2m[36m>[0m[2m git_vars.txt[0m-[0m🔄 [36mRunning post-create:[39m-[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Short: ca423bf'[0m[2m [0m[2m[36m>>[0m[2m git_vars.txt[0m-[0m🔄 [36mRunning post-create:[39m+🔄 [36mRunning post-create [1mcommit[22m:[39m+[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Commit: d5f94f04f2d59bd7282f575b929b659aefa65f2e'[0m[2m [0m[2m[36m>[0m[2m git_vars.txt[0m+[0m🔄 [36mRunning post-create [1mshort[22m:[39m+[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Short: d5f94f0'[0m[2m [0m[2m[36m>>[0m[2m git_vars.txt[0m+[0m🔄 [36mRunning post-create [1mremote[22m:[39m[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Remote: origin'[0m[2m [0m[2m[36m>>[0m[2m git_vars.txt[0m-[0m🔄 [36mRunning post-create:[39m+[0m🔄 [36mRunning post-create [1mworktree_name[22m:[39m[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Worktree Name: repo.feature'[0m[2m [0m[2m[36m>>[0m[2m git_vars.txt[0m[0m✅ [32m[32mCreated new worktree for [1mfeature[22m from [1mmain[22m at [1m[REPO].feature[39m[22m[39m💡 [2mRun [90mwt config shell install[39m to enable automatic cd[22mdiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snapindex 43fdbe9f0..0481e53dd 100644--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap@@ -25,13 +25,13 @@ exit_code: 0----- stdout ---------- stderr ------🔄 [36mRunning post-create:[39m+🔄 [36mRunning post-create [1mrepo[22m:[39m[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Repo: repo'[0m[2m [0m[2m[36m>[0m[2m info.txt[0m-[0m🔄 [36mRunning post-create:[39m+[0m🔄 [36mRunning post-create [1mbranch[22m:[39m[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Branch: feature-test'[0m[2m [0m[2m[36m>>[0m[2m info.txt[0m-[0m🔄 [36mRunning post-create:[39m+[0m🔄 [36mRunning post-create [1mworktree[22m:[39m[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Worktree: [REPO].feature-test'[0m[2m [0m[2m[36m>>[0m[2m info.txt[0m-[0m🔄 [36mRunning post-create:[39m+[0m🔄 [36mRunning post-create [1mroot[22m:[39m[107m [0m [2m[0m[2m[34mecho[0m[2m [0m[2m[32m'Root: [REPO]'[0m[2m [0m[2m[36m>>[0m[2m info.txt[0m[0m✅ [32m[32mCreated new worktree for [1mfeature/test[22m from [1mmain[22m at [1m[REPO].feature-test[39m[22m[39m💡 [2mRun [90mwt config shell install[39m to enable automatic cd[22m