Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Refactor: Streamline command approval to handle batches
Maximilian Roos27b2c4d39151
diff --git a/src/commands/command_approval.rs b/src/commands/command_approval.rsindex a2a7f4eb3..5b97aceaa 100644--- a/src/commands/command_approval.rs+++ b/src/commands/command_approval.rs@@ -3,9 +3,11 @@//! This module provides shared functionality for approving and executing commands//! across different worktrunk operations (post-create, post-start, pre-merge).-use worktrunk::config::{CommandConfig, WorktrunkConfig};+use worktrunk::config::{ApprovedCommand, CommandConfig, WorktrunkConfig};use worktrunk::git::GitError;-use worktrunk::styling::{AnstyleStyle, HINT_EMOJI, WARNING, WARNING_EMOJI, format_with_gutter};+use worktrunk::styling::{+ AnstyleStyle, HINT_EMOJI, WARNING, WARNING_EMOJI, eprintln, format_with_gutter,+};/// Convert CommandConfig to a vector of (name, command) pairs///@@ -41,74 +43,82 @@ pub fn command_config_to_vec(}}-/// Check if command is approved and prompt if needed+/// Check if commands need approval and handle the approval flow///-/// Returns `Ok(true)` if the command is approved (either already approved or user approved it),-/// `Ok(false)` if the user declined, or `Err` if there was a system error.-pub fn check_and_approve_command(+/// Returns `Ok(true)` if all commands are approved (or force-approved),+/// `Ok(false)` if user declined approval.+/// Automatically saves approvals when granted.+pub fn approve_command_batch(+ commands: &[(String, String)],project_id: &str,- command: &str,config: &WorktrunkConfig,force: bool,+ context: &str,) -> Result<bool, GitError> {- // If already approved in user config, no need to prompt or save again- if config.is_command_approved(project_id, command) {+ // Find commands that need approval+ let needs_approval: Vec<(&str, &str)> = commands+ .iter()+ .filter(|(_, cmd)| !config.is_command_approved(project_id, cmd))+ .map(|(name, cmd)| (name.as_str(), cmd.as_str()))+ .collect();++ if needs_approval.is_empty() {return Ok(true);}- // Determine if we should approve (and save for future use)+ // Prompt or force-approvelet should_approve = if force {- // Force flag means auto-approve and savetrue} else {- // Otherwise, prompt the user- match prompt_for_approval(command, project_id) {- Ok(approved) => approved,- Err(e) => {- log_approval_warning("Failed to read user input", e);- return Ok(false);- }- }+ prompt_for_batch_approval(&needs_approval, project_id)+ .map_err(|e| GitError::CommandFailed(format!("Failed to read user input: {}", e)))?};- if should_approve {- // Reload config and save approval for future use- match WorktrunkConfig::load() {- Ok(mut fresh_config) => {- if let Err(e) =- fresh_config.approve_command(project_id.to_string(), command.to_string())- {- use worktrunk::styling::eprintln;- log_approval_warning("Failed to save command approval", e);- eprintln!("You will be prompted again next time.");- }- }- Err(e) => {- use worktrunk::styling::eprintln;- log_approval_warning("Failed to reload config for saving approval", e);- eprintln!("You will be prompted again next time.");- }+ if !should_approve {+ let dim = AnstyleStyle::new().dimmed();+ eprintln!("{dim}{context} declined{dim:#}");+ return Ok(false);+ }++ // Save all approvals to config+ let mut fresh_config = WorktrunkConfig::load()+ .map_err(|e| GitError::CommandFailed(format!("Failed to reload config: {}", e)))?;++ // Add each command to approved list+ for (_, command) in &needs_approval {+ if !fresh_config.is_command_approved(project_id, command) {+ fresh_config.approved_commands.push(ApprovedCommand {+ project: project_id.to_string(),+ command: command.to_string(),+ });}- Ok(true)- } else {- Ok(false)}-}-/// Log a warning message for command approval failures-fn log_approval_warning(message: &str, error: impl std::fmt::Display) {- use worktrunk::styling::eprintln;- eprintln!("{WARNING_EMOJI} {WARNING}{message}: {error}{WARNING:#}");+ // Save all approvals at once+ if let Err(e) = fresh_config.save() {+ eprintln!("{WARNING_EMOJI} {WARNING}Failed to save command approvals: {e}{WARNING:#}");+ eprintln!("You will be prompted again next time.");+ }++ Ok(true)}-/// Prompt the user to approve a command for execution+/// Prompt the user to approve multiple commands for execution///-/// Displays a formatted prompt asking the user to approve a command,-/// showing both the project and the command being requested.-fn prompt_for_approval(command: &str, project_id: &str) -> std::io::Result<bool> {+/// Displays a formatted prompt asking the user to approve a batch of commands,+/// showing both the project and all commands being requested.+pub fn prompt_for_batch_approval(+ commands: &[(&str, &str)],+ project_id: &str,+) -> std::io::Result<bool> {use std::io::{self, Write};use worktrunk::styling::eprintln;+ debug_assert!(+ !commands.is_empty(),+ "prompt_for_batch_approval called with empty commands list"+ );+// Extract just the project name for cleaner displaylet project_name = project_id.split('/').next_back().unwrap_or(project_id);@@ -119,8 +129,15 @@ fn prompt_for_approval(command: &str, project_id: &str) -> std::io::Result<bool>eprintln!("{WARNING_EMOJI} {WARNING}Permission required to execute in worktree{WARNING:#}");eprintln!();eprintln!("{bold}{project_name}{bold:#} ({dim}{project_id}{dim:#}) wants to execute:");- eprint!("{}", format_with_gutter(command));eprintln!();++ // Show each command with its name+ for (name, command) in commands {+ eprintln!("{bold}{name}:{bold:#}");+ eprint!("{}", format_with_gutter(command));+ eprintln!();+ }+eprint!("{HINT_EMOJI} Allow and remember? {bold}[y/N]{bold:#} ");io::stderr().flush()?;diff --git a/src/commands/merge.rs b/src/commands/merge.rsindex 919352543..80536b20f 100644--- a/src/commands/merge.rs+++ b/src/commands/merge.rs@@ -3,7 +3,7 @@ use worktrunk::config::{ProjectConfig, WorktrunkConfig, expand_command_template}use worktrunk::git::{GitError, Repository};use worktrunk::styling::{AnstyleStyle, ERROR, ERROR_EMOJI, HINT, HINT_EMOJI, eprintln, println};-use super::command_approval::{check_and_approve_command, command_config_to_vec};+use super::command_approval::{approve_command_batch, command_config_to_vec};use super::worktree::handle_push;use super::worktree::handle_remove;use crate::output::{execute_command_in_worktree, handle_remove_output};@@ -330,14 +330,13 @@ fn run_pre_merge_checks(.and_then(|n| n.to_str()).unwrap_or("unknown");+ // Approve commands (prompt if needed, save approvals)+ if !approve_command_batch(&commands, &project_id, config, force, "Pre-merge checks")? {+ return Err(GitError::CommandFailed(String::new()));+ }+// Execute each command sequentially, fail-fast on errorsfor (name, command) in commands {- if !check_and_approve_command(&project_id, &command, config, force)? {- let dim = AnstyleStyle::new().dimmed();- eprintln!("{dim}Skipping pre-merge check: {command}{dim:#}");- continue;- }-let expanded_command = expand_command_template(&command,repo_name,diff --git a/src/commands/worktree.rs b/src/commands/worktree.rsindex ef8d61b05..246b89116 100644--- a/src/commands/worktree.rs+++ b/src/commands/worktree.rs@@ -108,7 +108,7 @@ use worktrunk::styling::{format_with_gutter, println,};-use crate::commands::command_approval::{check_and_approve_command, command_config_to_vec};+use crate::commands::command_approval::{approve_command_batch, command_config_to_vec};use crate::commands::process::spawn_detached;use crate::output::execute_command_in_worktree;@@ -356,14 +356,19 @@ fn execute_post_create_commands(let project_id = repo.project_identifier()?;let repo_root = repo.main_worktree_root()?;+ // Approve commands (prompt if needed, save approvals)+ if !approve_command_batch(+ &commands,+ &project_id,+ config,+ force,+ "Post-create commands",+ )? {+ return Ok(());+ }+// Execute each command sequentiallyfor (name, command) in commands {- if !check_and_approve_command(&project_id, &command, config, force)? {- let dim = AnstyleStyle::new().dimmed();- eprintln!("{dim}Skipping command: {command}{dim:#}");- continue;- }-let expanded_command =expand_command_template(&command, repo_name, branch, worktree_path, &repo_root, None);@@ -419,14 +424,13 @@ fn spawn_post_start_commands(let project_id = repo.project_identifier()?;let repo_root = repo.main_worktree_root()?;+ // Approve commands (prompt if needed, save approvals)+ if !approve_command_batch(&commands, &project_id, config, force, "Post-start commands")? {+ return Ok(());+ }+// Spawn each command as a detached background processfor (name, command) in commands {- if !check_and_approve_command(&project_id, &command, config, force)? {- let dim = AnstyleStyle::new().dimmed();- eprintln!("{dim}Skipping command: {command}{dim:#}");- continue;- }-let expanded_command =expand_command_template(&command, repo_name, branch, worktree_path, &repo_root, None);diff --git a/src/config.rs b/src/config.rsindex a8174eb1f..f58f9fe6b 100644--- a/src/config.rs+++ b/src/config.rs@@ -343,7 +343,7 @@ impl WorktrunkConfig {}/// Save the current configuration to the default config file location- fn save(&self) -> Result<(), ConfigError> {+ pub fn save(&self) -> Result<(), ConfigError> {let config_path = get_config_path().ok_or_else(|| ConfigError::Message("Could not determine config path".to_string()))?;self.save_to(&config_path)diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap.new b/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap.newnew file mode 100644index 000000000..bc380fa8a--- /dev/null+++ b/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap.new@@ -0,0 +1,34 @@+---+source: tests/integration_tests/post_start_commands.rs+assertion_line: 30+info:+ program: wt+ args:+ - switch+ - "--create"+ - feature+ env:+ CLICOLOR_FORCE: "1"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: /dev/null+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpRLy6fk+ LANG: C+ LC_ALL: C+ SOURCE_DATE_EPOCH: "1704067200"+---+success: true+exit_code: 0+----- stdout -----+β [32mCreated new worktree for [1mfeature[0m+ [2mPath: [REPO]/../test-repo.feature[0m[0m++To enable automatic cd, run: wt configure-shell++----- stderr -----+π [36mExecuting (post-create):[0m+[40m [0m echo 'Setup done' > setup.txt+π [36mStarting (background): sleep 0.5 && echo 'Server running' > server.txt[0m+ [2mβ Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log[0mdiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap.new b/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap.newnew file mode 100644index 000000000..ea0dfe4d0--- /dev/null+++ b/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap.new@@ -0,0 +1,32 @@+---+source: tests/integration_tests/post_start_commands.rs+assertion_line: 30+info:+ program: wt+ args:+ - switch+ - "--create"+ - feature+ - "--execute"+ - "echo 'Execute flag' > execute.txt"+ env:+ CLICOLOR_FORCE: "1"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: /dev/null+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp9eIcJS+ LANG: C+ LC_ALL: C+ SOURCE_DATE_EPOCH: "1704067200"+---+success: true+exit_code: 0+----- stdout -----+β [32mCreated new worktree for [1mfeature[0m+ [2mPath: [REPO]/../test-repo.feature[0m[0m++----- stderr -----+π [36mStarting (background): echo 'Background task' > background.txt[0m+ [2mβ Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log[0mdiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap.new b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap.newnew file mode 100644index 000000000..692e46cc0--- /dev/null+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap.new@@ -0,0 +1,33 @@+---+source: tests/integration_tests/post_start_commands.rs+assertion_line: 30+info:+ program: wt+ args:+ - switch+ - "--create"+ - feature+ env:+ CLICOLOR_FORCE: "1"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: /dev/null+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpR8gOKN+ LANG: C+ LC_ALL: C+ SOURCE_DATE_EPOCH: "1704067200"+---+success: true+exit_code: 0+----- stdout -----+β [32mCreated new worktree for [1mfeature[0m+ [2mPath: [REPO]/../test-repo.feature[0m[0m++To enable automatic cd, run: wt configure-shell++----- stderr -----+π [36mExecuting (post-create):[0m+[40m [0m exit 1+π‘ [33mCommand [1m[33mcmd[0m failed: Command failed with exit code: exit status: 1[0mdiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap.new b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap.newnew file mode 100644index 000000000..f720e2a50--- /dev/null+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap.new@@ -0,0 +1,36 @@+---+source: tests/integration_tests/post_start_commands.rs+assertion_line: 30+info:+ program: wt+ args:+ - switch+ - "--create"+ - feature+ env:+ CLICOLOR_FORCE: "1"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: /dev/null+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpASFetv+ LANG: C+ LC_ALL: C+ SOURCE_DATE_EPOCH: "1704067200"+---+success: true+exit_code: 0+----- stdout -----+First+Second+β [32mCreated new worktree for [1mfeature[0m+ [2mPath: [REPO]/../test-repo.feature[0m[0m++To enable automatic cd, run: wt configure-shell++----- stderr -----+π [36mExecuting (post-create):[0m+[40m [0m echo 'First'+π [36mExecuting (post-create):[0m+[40m [0m echo 'Second'diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap.new b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap.newnew file mode 100644index 000000000..4faf95123--- /dev/null+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap.new@@ -0,0 +1,36 @@+---+source: tests/integration_tests/post_start_commands.rs+assertion_line: 30+info:+ program: wt+ args:+ - switch+ - "--create"+ - feature+ env:+ CLICOLOR_FORCE: "1"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: /dev/null+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpvnJ7sq+ LANG: C+ LC_ALL: C+ SOURCE_DATE_EPOCH: "1704067200"+---+success: true+exit_code: 0+----- stdout -----+Installing deps+Running setup+β [32mCreated new worktree for [1mfeature[0m+ [2mPath: [REPO]/../test-repo.feature[0m[0m++To enable automatic cd, run: wt configure-shell++----- stderr -----+π [36mExecuting (post-create):[0m+[40m [0m echo 'Installing deps'+π [36mExecuting (post-create):[0m+[40m [0m echo 'Running setup'diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap.new b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap.newnew file mode 100644index 000000000..f77746acf--- /dev/null+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap.new@@ -0,0 +1,33 @@+---+source: tests/integration_tests/post_start_commands.rs+assertion_line: 30+info:+ program: wt+ args:+ - switch+ - "--create"+ - feature+ env:+ CLICOLOR_FORCE: "1"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: /dev/null+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpfM9rik+ LANG: C+ LC_ALL: C+ SOURCE_DATE_EPOCH: "1704067200"+---+success: true+exit_code: 0+----- stdout -----+Setup complete+β [32mCreated new worktree for [1mfeature[0m+ [2mPath: [REPO]/../test-repo.feature[0m[0m++To enable automatic cd, run: wt configure-shell++----- stderr -----+π [36mExecuting (post-create):[0m+[40m [0m echo 'Setup complete'diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap.new b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap.newnew file mode 100644index 000000000..2f006b6c0--- /dev/null+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap.new@@ -0,0 +1,34 @@+---+source: tests/integration_tests/post_start_commands.rs+assertion_line: 30+info:+ program: wt+ args:+ - switch+ - "--create"+ - feature+ env:+ CLICOLOR_FORCE: "1"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: /dev/null+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpGAjZ5L+ LANG: C+ LC_ALL: C+ SOURCE_DATE_EPOCH: "1704067200"+---+success: true+exit_code: 0+----- stdout -----+β [32mCreated new worktree for [1mfeature[0m+ [2mPath: [REPO]/../test-repo.feature[0m[0m++To enable automatic cd, run: wt configure-shell++----- stderr -----+π [36mStarting (background): echo 'line1+line2+line3' | grep line2 > filtered.txt[0m+ [2mβ Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log[0mdiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap.new b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap.newnew file mode 100644index 000000000..6492944ec--- /dev/null+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap.new@@ -0,0 +1,32 @@+---+source: tests/integration_tests/post_start_commands.rs+assertion_line: 30+info:+ program: wt+ args:+ - switch+ - "--create"+ - feature+ env:+ CLICOLOR_FORCE: "1"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: /dev/null+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpd8ePiU+ LANG: C+ LC_ALL: C+ SOURCE_DATE_EPOCH: "1704067200"+---+success: true+exit_code: 0+----- stdout -----+β [32mCreated new worktree for [1mfeature[0m+ [2mPath: [REPO]/../test-repo.feature[0m[0m++To enable automatic cd, run: wt configure-shell++----- stderr -----+π [36mStarting (background): echo 'unclosed quote[0m+ [2mβ Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log[0mdiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap.new b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap.newnew file mode 100644index 000000000..5e66f3c18--- /dev/null+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap.new@@ -0,0 +1,32 @@+---+source: tests/integration_tests/post_start_commands.rs+assertion_line: 30+info:+ program: wt+ args:+ - switch+ - "--create"+ - feature+ env:+ CLICOLOR_FORCE: "1"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: /dev/null+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpMJJkmk+ LANG: C+ LC_ALL: C+ SOURCE_DATE_EPOCH: "1704067200"+---+success: true+exit_code: 0+----- stdout -----+β [32mCreated new worktree for [1mfeature[0m+ [2mPath: [REPO]/../test-repo.feature[0m[0m++To enable automatic cd, run: wt configure-shell++----- stderr -----+π [36mStarting (background): echo 'stdout output' && echo 'stderr output' >&2[0m+ [2mβ Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log[0mdiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap.new b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap.newnew file mode 100644index 000000000..23dfa6cd0--- /dev/null+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap.new@@ -0,0 +1,34 @@+---+source: tests/integration_tests/post_start_commands.rs+assertion_line: 30+info:+ program: wt+ args:+ - switch+ - "--create"+ - feature+ env:+ CLICOLOR_FORCE: "1"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: /dev/null+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpIDDG3d+ LANG: C+ LC_ALL: C+ SOURCE_DATE_EPOCH: "1704067200"+---+success: true+exit_code: 0+----- stdout -----+β [32mCreated new worktree for [1mfeature[0m+ [2mPath: [REPO]/../test-repo.feature[0m[0m++To enable automatic cd, run: wt configure-shell++----- stderr -----+π [36mStarting (background): echo 'Task 1 running' > task1.txt[0m+ [2mβ Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log[0m+π [36mStarting (background): echo 'Task 2 running' > task2.txt[0m+ [2mβ Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log[0mdiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap.new b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap.newnew file mode 100644index 000000000..fcca2cd92--- /dev/null+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap.new@@ -0,0 +1,36 @@+---+source: tests/integration_tests/post_start_commands.rs+assertion_line: 30+info:+ program: wt+ args:+ - switch+ - "--create"+ - feature+ env:+ CLICOLOR_FORCE: "1"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: /dev/null+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpLtMBOF+ LANG: C+ LC_ALL: C+ SOURCE_DATE_EPOCH: "1704067200"+---+success: true+exit_code: 0+----- stdout -----+β [32mCreated new worktree for [1mfeature[0m+ [2mPath: [REPO]/../test-repo.feature[0m[0m++To enable automatic cd, run: wt configure-shell++----- stderr -----+π [36mStarting (background): echo 'TASK1_OUTPUT'[0m+ [2mβ Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log[0m+π [36mStarting (background): echo 'TASK2_OUTPUT'[0m+ [2mβ Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log[0m+π [36mStarting (background): echo 'TASK3_OUTPUT'[0m+ [2mβ Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log[0mdiff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap.new b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap.newnew file mode 100644index 000000000..08b25851f--- /dev/null+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap.new@@ -0,0 +1,32 @@+---+source: tests/integration_tests/post_start_commands.rs+assertion_line: 30+info:+ program: wt+ args:+ - switch+ - "--create"+ - feature+ env:+ CLICOLOR_FORCE: "1"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: /dev/null+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp9UJIuZ+ LANG: C+ LC_ALL: C+ SOURCE_DATE_EPOCH: "1704067200"+---+success: true+exit_code: 0+----- stdout -----+β [32mCreated new worktree for [1mfeature[0m+ [2mPath: [REPO]/../test-repo.feature[0m[0m++To enable automatic cd, run: wt configure-shell++----- stderr -----+π [36mStarting (background): sleep 1 && echo 'Background task done' > background.txt[0m+ [2mβ Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log[0m