Skip to content

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

Refactor: Introduce global output context for consistent messaging

Maximilian Roosa16c6bb6cc09
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000..9196aff20
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+# Treat snapshot test files as text for proper diffs
+*.snap text diff
diff --git a/src/commands/merge.rs b/src/commands/merge.rs
index bf2ac4e6d..919352543 100644
--- a/src/commands/merge.rs
+++ b/src/commands/merge.rs
@@ -101,7 +101,7 @@ pub fn handle_merge(
let result = handle_remove()?;
// Display output based on mode
- handle_remove_output(&result, internal)?;
+ handle_remove_output(&result)?;
// Check if we need to switch to target branch
let primary_repo = Repository::at(&primary_worktree_dir);
@@ -126,23 +126,11 @@ pub fn handle_merge(
// Print comprehensive summary
println!();
- handle_merge_summary_output(
- &current_branch,
- &target_branch,
- squashed_count,
- true,
- internal,
- )?;
+ handle_merge_summary_output(&current_branch, &target_branch, squashed_count, true)?;
} else {
// Print comprehensive summary (worktree preserved)
println!();
- handle_merge_summary_output(
- &current_branch,
- &target_branch,
- squashed_count,
- false,
- internal,
- )?;
+ handle_merge_summary_output(&current_branch, &target_branch, squashed_count, false)?;
}
Ok(())
@@ -155,15 +143,14 @@ fn format_merge_summary(
squashed_count: Option<usize>,
cleaned_up: bool,
) -> String {
- let green = AnstyleStyle::new().fg_color(Some(Color::Ansi(AnsiColor::Green)));
- let green_bold = green.bold();
+ let bold = AnstyleStyle::new().bold();
let dim = AnstyleStyle::new().dimmed();
- let mut output = format!("✅ {green}Merge complete{green:#}\n\n");
+ let mut output = format!("Merge complete\n\n");
// Show what was merged
output.push_str(&format!(
- " {dim}Merged: {green_bold}{from_branch}{green_bold:#} → {green_bold}{to_branch}{green_bold:#}{dim:#}\n"
+ " {dim}Merged: {bold}{from_branch}{bold:#} → {bold}{to_branch}{bold:#}{dim:#}\n"
));
// Show squash info if applicable
@@ -183,33 +170,20 @@ fn format_merge_summary(
output
}
-/// Handle output for merge summary
-///
-/// In internal mode: outputs directives for shell wrapper
-/// In non-internal mode: prints message directly
+/// Handle output for merge summary using global output context
fn handle_merge_summary_output(
from_branch: &str,
to_branch: &str,
squashed_count: Option<usize>,
cleaned_up: bool,
- internal: bool,
) -> Result<(), GitError> {
- use crate::output::{Directive, DirectiveOutput};
-
let message = format_merge_summary(from_branch, to_branch, squashed_count, cleaned_up);
- if internal {
- // Internal mode: output directives for shell wrapper
- let mut output = DirectiveOutput::new();
- output.add(Directive::Message(message));
+ // Show success message (formatting added by OutputContext)
+ crate::output::success(message).map_err(|e| GitError::CommandFailed(e.to_string()))?;
- output
- .write_to_stdout()
- .map_err(|e| GitError::CommandFailed(e.to_string()))?;
- } else {
- // Non-internal mode: print directly
- println!("{}", message);
- }
+ // Flush output
+ crate::output::flush().map_err(|e| GitError::CommandFailed(e.to_string()))?;
Ok(())
}
diff --git a/src/main.rs b/src/main.rs
index d2749c0f8..6bb704797 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -311,23 +311,39 @@ fn main() {
force,
no_config_commands,
internal,
- } => WorktrunkConfig::load()
- .map_err(|e| GitError::CommandFailed(format!("Failed to load config: {}", e)))
- .and_then(|config| {
- handle_switch(
- &branch,
- create,
- base.as_deref(),
- force,
- no_config_commands,
- &config,
- )
- .and_then(|result| {
- handle_switch_output(&result, &branch, execute.as_deref(), internal)
+ } => {
+ // Initialize output context based on mode
+ let output_mode = if internal {
+ output::OutputMode::Directive
+ } else {
+ output::OutputMode::Interactive
+ };
+ output::initialize(output_mode);
+
+ WorktrunkConfig::load()
+ .map_err(|e| GitError::CommandFailed(format!("Failed to load config: {}", e)))
+ .and_then(|config| {
+ handle_switch(
+ &branch,
+ create,
+ base.as_deref(),
+ force,
+ no_config_commands,
+ &config,
+ )
+ .and_then(|result| handle_switch_output(&result, &branch, execute.as_deref()))
})
- }),
+ }
Commands::Remove { internal } => {
- handle_remove().and_then(|result| handle_remove_output(&result, internal))
+ // Initialize output context based on mode
+ let output_mode = if internal {
+ output::OutputMode::Directive
+ } else {
+ output::OutputMode::Interactive
+ };
+ output::initialize(output_mode);
+
+ handle_remove().and_then(|result| handle_remove_output(&result))
}
Commands::Push {
target,
@@ -341,15 +357,25 @@ fn main() {
no_verify,
force,
internal,
- } => handle_merge(
- target.as_deref(),
- squash,
- keep,
- message.as_deref(),
- no_verify,
- force,
- internal,
- ),
+ } => {
+ // Initialize output context based on mode
+ let output_mode = if internal {
+ output::OutputMode::Directive
+ } else {
+ output::OutputMode::Interactive
+ };
+ output::initialize(output_mode);
+
+ handle_merge(
+ target.as_deref(),
+ squash,
+ keep,
+ message.as_deref(),
+ no_verify,
+ force,
+ internal,
+ )
+ }
Commands::Completion { shell } => {
let mut cli_cmd = Cli::command();
handle_completion(shell, &mut cli_cmd);
diff --git a/src/output.rs b/src/output.rs
deleted file mode 100644
index b63db5cef..000000000
--- a/src/output.rs
+++ /dev/null
@@ -1,242 +0,0 @@
-//! Output and presentation layer for worktree commands.
-//!
-//! This module handles all presentation logic, keeping it separate from business logic.
-//! It provides:
-//! - Directive protocol types for shell integration
-//! - Message formatting for results
-//! - Output rendering for both internal and non-internal modes
-
-use std::io::{self, Write};
-use std::path::{Path, PathBuf};
-use worktrunk::git::GitError;
-use worktrunk::shell::Shell;
-use worktrunk::styling::{AnstyleStyle, println};
-
-use crate::commands::worktree::{RemoveResult, SwitchResult};
-
-/// A directive for the shell wrapper to execute
-#[derive(Debug, Clone)]
-pub enum Directive {
- /// Change directory to the given path
- ChangeDirectory(PathBuf),
- /// Execute a command in the current directory
- Execute(String),
- /// Print a message to the user
- Message(String),
-}
-
-/// Output containing multiple directives for shell integration
-#[derive(Default)]
-pub struct DirectiveOutput {
- directives: Vec<Directive>,
-}
-
-impl DirectiveOutput {
- /// Create a new directive output
- pub fn new() -> Self {
- Self::default()
- }
-
- /// Add a directive
- pub fn add(&mut self, directive: Directive) -> &mut Self {
- self.directives.push(directive);
- self
- }
-
- /// Write directives to stdout with NUL termination
- ///
- /// Format: `<directive_content>\0<directive_content>\0...`
- /// Each directive is NUL-terminated to support multi-line commands.
- pub fn write_to_stdout(&self) -> io::Result<()> {
- let mut stdout = io::stdout();
-
- for directive in &self.directives {
- match directive {
- Directive::ChangeDirectory(path) => {
- write!(stdout, "__WORKTRUNK_CD__{}\0", path.display())?;
- }
- Directive::Execute(cmd) => {
- write!(stdout, "__WORKTRUNK_EXEC__{}\0", cmd)?;
- }
- Directive::Message(msg) => {
- write!(stdout, "{}\0", msg)?;
- }
- }
- }
-
- // Final newline for readability in logs
- stdout.write_all(b"\n")?;
- Ok(())
- }
-}
-
-/// Format a message for a switch operation
-pub fn format_switch_message(result: &SwitchResult, branch: &str) -> String {
- use anstyle::{AnsiColor, Color};
- let green = AnstyleStyle::new().fg_color(Some(Color::Ansi(AnsiColor::Green)));
- let green_bold = green.bold();
-
- match result {
- SwitchResult::ExistingWorktree(_) => {
- format!(
- "✅ {green}Switched to worktree for {green_bold}{branch}{green_bold:#}{green:#}"
- )
- }
- SwitchResult::CreatedWorktree {
- path,
- created_branch,
- } => {
- let dim = AnstyleStyle::new().dimmed();
- if *created_branch {
- format!(
- "✅ {green}Created new worktree for {green_bold}{branch}{green_bold:#}{green:#}\n {dim}Path: {}{dim:#}",
- path.display()
- )
- } else {
- format!(
- "✅ {green}Added worktree for {green_bold}{branch}{green_bold:#}{green:#}\n {dim}Path: {}{dim:#}",
- path.display()
- )
- }
- }
- }
-}
-
-/// Handle output for a switch operation
-///
-/// In internal mode: outputs directives for shell wrapper
-/// In non-internal mode: prints message and executes command
-pub fn handle_switch_output(
- result: &SwitchResult,
- branch: &str,
- execute: Option<&str>,
- internal: bool,
-) -> Result<(), GitError> {
- if internal {
- // Internal mode: output directives for shell wrapper
- let mut output = DirectiveOutput::new();
- output.add(Directive::ChangeDirectory(result.path().clone()));
- output.add(Directive::Message(format_switch_message(result, branch)));
-
- if let Some(cmd) = execute {
- output.add(Directive::Execute(cmd.to_string()));
- }
-
- output
- .write_to_stdout()
- .map_err(|e| GitError::CommandFailed(e.to_string()))?;
- } else {
- // Non-internal mode: print message and execute command
- println!("{}", format_switch_message(result, branch));
-
- if let Some(cmd) = execute {
- // Execute command after showing message
- println!();
- execute_command_in_worktree(result.path(), cmd)?;
- } else {
- // Show shell integration hint if no command to execute
- println!();
- println!("{}", shell_integration_hint());
- }
- }
-
- Ok(())
-}
-
-/// Format a message for a remove operation
-pub fn format_remove_message(result: &RemoveResult) -> String {
- use anstyle::{AnsiColor, Color};
- let green = AnstyleStyle::new().fg_color(Some(Color::Ansi(AnsiColor::Green)));
- let green_bold = green.bold();
-
- match result {
- RemoveResult::AlreadyOnDefault(branch) => {
- format!(
- "✅ {green}Already on default branch {green_bold}{branch}{green_bold:#}{green:#}"
- )
- }
- RemoveResult::RemovedWorktree { primary_path } => {
- let dim = AnstyleStyle::new().dimmed();
- format!(
- "✅ {green}Removed worktree and returned to primary{green:#}\n {dim}Path: {}{dim:#}",
- primary_path.display()
- )
- }
- RemoveResult::SwitchedToDefault(branch) => {
- format!(
- "✅ {green}Switched to default branch {green_bold}{branch}{green_bold:#}{green:#}"
- )
- }
- }
-}
-
-/// Handle output for a remove operation
-///
-/// In internal mode: outputs directives for shell wrapper (only for RemovedWorktree)
-/// In non-internal mode: prints message
-pub fn handle_remove_output(result: &RemoveResult, internal: bool) -> Result<(), GitError> {
- if internal {
- // Internal mode: only RemovedWorktree needs a CD directive
- if let RemoveResult::RemovedWorktree { primary_path } = result {
- let mut output = DirectiveOutput::new();
- output.add(Directive::ChangeDirectory(primary_path.clone()));
- output.add(Directive::Message(format_remove_message(result)));
-
- output
- .write_to_stdout()
- .map_err(|e| GitError::CommandFailed(e.to_string()))?;
- }
- // Other cases don't need directives in internal mode
- } else {
- // Non-internal mode: print message and hint
- println!("{}", format_remove_message(result));
-
- // Show shell integration hint for RemovedWorktree
- if matches!(result, RemoveResult::RemovedWorktree { .. }) {
- println!();
- println!("{}", shell_integration_hint());
- }
- }
-
- Ok(())
-}
-
-/// Generate hint message for shell integration setup
-pub fn shell_integration_hint() -> String {
- if let Some(config_path) = Shell::is_integration_configured() {
- format!(
- "Shell integration configured. Restart your shell or run: source {}",
- config_path.display()
- )
- } else {
- "To enable automatic cd, run: wt configure-shell".to_string()
- }
-}
-
-/// Execute a command in the given worktree directory
-pub fn execute_command_in_worktree(worktree_path: &Path, command: &str) -> Result<(), GitError> {
- #[cfg(target_os = "windows")]
- let (shell, shell_arg) = ("cmd", "/C");
- #[cfg(not(target_os = "windows"))]
- let (shell, shell_arg) = ("sh", "-c");
-
- let status = std::process::Command::new(shell)
- .arg(shell_arg)
- .arg(command)
- .current_dir(worktree_path)
- .stdin(std::process::Stdio::inherit())
- .stdout(std::process::Stdio::inherit())
- .stderr(std::process::Stdio::inherit())
- .status()
- .map_err(|e| GitError::CommandFailed(format!("Failed to execute command: {}", e)))?;
-
- if !status.success() {
- return Err(GitError::CommandFailed(format!(
- "Command '{}' failed with exit code {}",
- command,
- status.code().unwrap_or(-1)
- )));
- }
-
- Ok(())
-}
diff --git a/src/output/directive.rs b/src/output/directive.rs
new file mode 100644
index 000000000..1ff4e8ed6
--- /dev/null
+++ b/src/output/directive.rs
@@ -0,0 +1,44 @@
+//! Directive output mode for shell integration
+
+use anstream::adapter::strip_str;
+use std::io::{self, Write};
+use std::path::Path;
+
+/// Directive output mode for shell integration
+///
+/// Outputs NUL-terminated directives for shell wrapper to parse and execute.
+pub struct DirectiveOutput;
+
+impl DirectiveOutput {
+ pub fn new() -> Self {
+ Self
+ }
+
+ pub fn success(&mut self, message: String) -> io::Result<()> {
+ let plain = strip_str(&message).to_string();
+ write!(io::stdout(), "{}\0", plain)
+ }
+
+ pub fn change_directory(&mut self, path: &Path) -> io::Result<()> {
+ write!(io::stdout(), "__WORKTRUNK_CD__{}\0", path.display())
+ }
+
+ pub fn execute(&mut self, command: String) -> io::Result<()> {
+ write!(io::stdout(), "__WORKTRUNK_EXEC__{}\0", command)
+ }
+
+ pub fn flush(&mut self) -> io::Result<()> {
+ writeln!(io::stdout())?;
+ io::stdout().flush()
+ }
+
+ pub fn is_interactive(&self) -> bool {
+ false
+ }
+}
+
+impl Default for DirectiveOutput {
+ fn default() -> Self {
+ Self::new()
+ }
+}
diff --git a/src/output/global.rs b/src/output/global.rs
new file mode 100644
index 000000000..9ec74522a
--- /dev/null
+++ b/src/output/global.rs
@@ -0,0 +1,123 @@
+//! Global output context using thread-local storage
+//!
+//! This provides a logging-like API where you configure output mode once
+//! at program start, then use it anywhere without passing parameters.
+//!
+//! # Implementation
+//!
+//! Uses `thread_local!` to store per-thread output state:
+//! - Each thread gets its own `OUTPUT_CONTEXT`
+//! - `RefCell<T>` enables interior mutability (runtime borrow checking)
+//! - Enum dispatch avoids trait object overhead (static dispatch)
+//!
+//! # Trade-offs
+//!
+//! - ✅ Zero parameter threading - call from anywhere
+//! - ✅ Single initialization point - set once in main()
+//! - ✅ Fast access - thread-local is just a pointer lookup
+//! - ⚠️ Per-thread state - not an issue for single-threaded CLI
+//! - ⚠️ Runtime borrow checks - acceptable for this access pattern
+
+use super::directive::DirectiveOutput;
+use super::interactive::InteractiveOutput;
+use std::cell::RefCell;
+use std::io;
+use std::path::Path;
+
+/// Output mode selection
+#[derive(Debug, Clone, Copy)]
+pub enum OutputMode {
+ Interactive,
+ Directive,
+}
+
+/// Output handler - enum dispatch instead of trait object
+enum OutputHandler {
+ Interactive(InteractiveOutput),
+ Directive(DirectiveOutput),
+}
+
+thread_local! {
+ static OUTPUT_CONTEXT: RefCell<OutputHandler> = RefCell::new(
+ OutputHandler::Interactive(InteractiveOutput::new())
+ );
+}
+
+/// Initialize the global output context
+///
+/// Call this once at program startup to set the output mode.
+pub fn initialize(mode: OutputMode) {
+ let handler = match mode {
+ OutputMode::Interactive => OutputHandler::Interactive(InteractiveOutput::new()),
+ OutputMode::Directive => OutputHandler::Directive(DirectiveOutput::new()),
+ };
+
+ OUTPUT_CONTEXT.with(|ctx| {
+ *ctx.borrow_mut() = handler;
+ });
+}
+
+/// Emit a success message
+pub fn success(message: impl Into<String>) -> io::Result<()> {
+ OUTPUT_CONTEXT.with(|ctx| {
+ let msg = message.into();
+ match &mut *ctx.borrow_mut() {
+ OutputHandler::Interactive(i) => i.success(msg),
+ OutputHandler::Directive(d) => d.success(msg),
+ }
+ })
+}
+
+/// Request directory change (for shell integration)
+pub fn change_directory(path: impl AsRef<Path>) -> io::Result<()> {
+ OUTPUT_CONTEXT.with(|ctx| {
+ let p = path.as_ref();
+ match &mut *ctx.borrow_mut() {
+ OutputHandler::Interactive(i) => i.change_directory(p),
+ OutputHandler::Directive(d) => d.change_directory(p),
+ }
+ })
+}
+
+/// Request command execution
+pub fn execute(command: impl Into<String>) -> io::Result<()> {
+ OUTPUT_CONTEXT.with(|ctx| {
+ let cmd = command.into();
+ match &mut *ctx.borrow_mut() {
+ OutputHandler::Interactive(i) => i.execute(cmd),
+ OutputHandler::Directive(d) => d.execute(cmd),
+ }
+ })
+}
+
+/// Flush any buffered output
+pub fn flush() -> io::Result<()> {
+ OUTPUT_CONTEXT.with(|ctx| match &mut *ctx.borrow_mut() {
+ OutputHandler::Interactive(i) => i.flush(),
+ OutputHandler::Directive(d) => d.flush(),
+ })
+}
+
+/// Check if interactive mode
+pub fn is_interactive() -> bool {
+ OUTPUT_CONTEXT.with(|ctx| match &*ctx.borrow() {
+ OutputHandler::Interactive(i) => i.is_interactive(),
+ OutputHandler::Directive(d) => d.is_interactive(),
+ })
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_mode_switching() {
+ // Default is interactive
+ initialize(OutputMode::Interactive);
+ assert!(is_interactive());
+
+ // Switch to directive
+ initialize(OutputMode::Directive);
+ assert!(!is_interactive());
+ }
+}
diff --git a/src/output/handlers.rs b/src/output/handlers.rs
new file mode 100644
index 000000000..e9db98c37
--- /dev/null
+++ b/src/output/handlers.rs
@@ -0,0 +1,140 @@
+//! Output handlers for worktree operations using the global output context
+
+use crate::commands::worktree::{RemoveResult, SwitchResult};
+use worktrunk::git::GitError;
+use worktrunk::styling::AnstyleStyle;
+
+/// Format plain message for switch operation (no emoji - added by OutputContext)
+fn format_switch_message_plain(result: &SwitchResult, branch: &str) -> String {
+ let bold = AnstyleStyle::new().bold();
+
+ match result {
+ SwitchResult::ExistingWorktree(_) => {
+ format!("Switched to worktree for {bold}{branch}{bold:#}")
+ }
+ SwitchResult::CreatedWorktree {
+ path,
+ created_branch,
+ } => {
+ let dim = AnstyleStyle::new().dimmed();
+ if *created_branch {
+ format!(
+ "Created new worktree for {bold}{branch}{bold:#}\n {dim}Path: {}{dim:#}",
+ path.display()
+ )
+ } else {
+ format!(
+ "Added worktree for {bold}{branch}{bold:#}\n {dim}Path: {}{dim:#}",
+ path.display()
+ )
+ }
+ }
+ }
+}
+
+/// Format plain message for remove operation (no emoji - added by OutputContext)
+fn format_remove_message_plain(result: &RemoveResult) -> String {
+ let bold = AnstyleStyle::new().bold();
+ let dim = AnstyleStyle::new().dimmed();
+
+ match result {
+ RemoveResult::AlreadyOnDefault(branch) => {
+ format!("Already on default branch {bold}{branch}{bold:#}")
+ }
+ RemoveResult::RemovedWorktree { primary_path } => {
+ format!(
+ "Removed worktree, returned to primary\n {dim}Path: {}{dim:#}",
+ primary_path.display()
+ )
+ }
+ RemoveResult::SwitchedToDefault(branch) => {
+ format!("Switched to default branch {bold}{branch}{bold:#}")
+ }
+ }
+}
+
+/// Shell integration hint message
+fn shell_integration_hint() -> &'static str {
+ "To enable automatic cd, run: wt configure-shell"
+}
+
+/// Handle output for a switch operation
+pub fn handle_switch_output(
+ result: &SwitchResult,
+ branch: &str,
+ execute: Option<&str>,
+) -> Result<(), GitError> {
+ // Set target directory for command execution
+ super::change_directory(result.path()).map_err(|e| GitError::CommandFailed(e.to_string()))?;
+
+ // Show success message (plain text - formatting added by OutputContext)
+ super::success(format_switch_message_plain(result, branch))
+ .map_err(|e| GitError::CommandFailed(e.to_string()))?;
+
+ // Execute command if provided
+ if let Some(cmd) = execute {
+ super::execute(cmd).map_err(|e| GitError::CommandFailed(e.to_string()))?;
+ } else if super::is_interactive() {
+ // No execute command in interactive mode: show shell integration hint
+ use worktrunk::styling::println;
+ println!();
+ println!("{}", shell_integration_hint());
+ }
+
+ // Flush output (important for directive mode)
+ super::flush().map_err(|e| GitError::CommandFailed(e.to_string()))?;
+
+ Ok(())
+}
+
+/// Handle output for a remove operation
+pub fn handle_remove_output(result: &RemoveResult) -> Result<(), GitError> {
+ // For removed worktree, set target directory for shell to cd to
+ if let RemoveResult::RemovedWorktree { primary_path } = result {
+ super::change_directory(primary_path)
+ .map_err(|e| GitError::CommandFailed(e.to_string()))?;
+ }
+
+ // Show success message
+ super::success(format_remove_message_plain(result))
+ .map_err(|e| GitError::CommandFailed(e.to_string()))?;
+
+ // Flush output
+ super::flush().map_err(|e| GitError::CommandFailed(e.to_string()))?;
+
+ Ok(())
+}
+
+/// Execute a command in a worktree directory
+pub fn execute_command_in_worktree(
+ worktree_path: &std::path::Path,
+ command: &str,
+) -> Result<(), GitError> {
+ use std::process::Command;
+
+ let output = Command::new("sh")
+ .arg("-c")
+ .arg(command)
+ .current_dir(worktree_path)
+ .output()
+ .map_err(|e| GitError::CommandFailed(format!("Failed to execute command: {}", e)))?;
+
+ if !output.status.success() {
+ return Err(GitError::CommandFailed(format!(
+ "Command failed with exit code: {}",
+ output.status
+ )));
+ }
+
+ // Print command output
+ if !output.stdout.is_empty() {
+ use worktrunk::styling::println;
+ println!("{}", String::from_utf8_lossy(&output.stdout).trim_end());
+ }
+ if !output.stderr.is_empty() {
+ use worktrunk::styling::eprintln;
+ eprintln!("{}", String::from_utf8_lossy(&output.stderr).trim_end());
+ }
+
+ Ok(())
+}
diff --git a/src/output/interactive.rs b/src/output/interactive.rs
new file mode 100644
index 000000000..1c52a644e
--- /dev/null
+++ b/src/output/interactive.rs
@@ -0,0 +1,62 @@
+//! Interactive output mode for human users
+
+use anstyle::{AnsiColor, Color};
+use std::io::{self, Write};
+use std::path::Path;
+use worktrunk::styling::{AnstyleStyle, println};
+
+/// Interactive output mode for human users
+///
+/// Formats messages with colors, emojis, and formatting.
+/// Executes commands directly instead of emitting directives.
+pub struct InteractiveOutput {
+ /// Target directory for command execution (set by change_directory)
+ target_dir: Option<std::path::PathBuf>,
+}
+
+impl InteractiveOutput {
+ pub fn new() -> Self {
+ Self { target_dir: None }
+ }
+
+ pub fn success(&mut self, message: String) -> io::Result<()> {
+ let green = AnstyleStyle::new().fg_color(Some(Color::Ansi(AnsiColor::Green)));
+ println!("✅ {green}{message}{green:#}");
+ Ok(())
+ }
+
+ pub fn change_directory(&mut self, path: &Path) -> io::Result<()> {
+ // In interactive mode, we can't actually change directory
+ // Just store the target for execute commands
+ self.target_dir = Some(path.to_path_buf());
+ Ok(())
+ }
+
+ pub fn execute(&mut self, command: String) -> io::Result<()> {
+ // Execute command in the target directory
+ let exec_dir = self
+ .target_dir
+ .as_ref()
+ .map(|p| p.as_path())
+ .unwrap_or_else(|| Path::new("."));
+
+ crate::output::execute_command_in_worktree(exec_dir, &command)
+ .map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))
+ }
+
+ pub fn flush(&mut self) -> io::Result<()> {
+ io::stdout().flush()?;
+ io::stderr().flush()?;
+ Ok(())
+ }
+
+ pub fn is_interactive(&self) -> bool {
+ true
+ }
+}
+
+impl Default for InteractiveOutput {
+ fn default() -> Self {
+ Self::new()
+ }
+}
diff --git a/src/output/mod.rs b/src/output/mod.rs
new file mode 100644
index 000000000..61bdb18dd
--- /dev/null
+++ b/src/output/mod.rs
@@ -0,0 +1,70 @@
+//! Output and presentation layer for worktree commands.
+//!
+//! # Architecture
+//!
+//! Global context-based output system similar to logging frameworks (`log`, `tracing`).
+//! Initialize once at program start with `initialize(OutputMode)`, then use
+//! output functions anywhere: `success()`, `change_directory()`, `execute()`, etc.
+//!
+//! ## Design
+//!
+//! **Thread-local storage** stores the output handler globally:
+//!
+//! ```rust,ignore
+//! thread_local! {
+//! static OUTPUT_CONTEXT: RefCell<OutputHandler> = ...;
+//! }
+//! ```
+//!
+//! Each thread gets its own output context. `RefCell` provides interior mutability
+//! for mutation through shared references (runtime borrow checking).
+//!
+//! **Enum dispatch** routes calls to the appropriate handler:
+//!
+//! ```rust,ignore
+//! enum OutputHandler {
+//! Interactive(InteractiveOutput), // Human-friendly with colors
+//! Directive(DirectiveOutput), // Machine-readable for shell integration
+//! }
+//! ```
+//!
+//! This enables static dispatch and compiler optimizations.
+//!
+//! ## Usage Pattern
+//!
+//! ```rust,ignore
+//! // 1. Initialize once in main()
+//! let mode = if internal {
+//! OutputMode::Directive
+//! } else {
+//! OutputMode::Interactive
+//! };
+//! output::initialize(mode);
+//!
+//! // 2. Use anywhere in the codebase
+//! output::success("Operation complete");
+//! output::change_directory(&path);
+//! output::execute("git pull");
+//! output::flush();
+//! ```
+//!
+//! ## Output Modes
+//!
+//! - **Interactive**: Colors, emojis, shell hints, direct command execution
+//! - **Directive**: Plain text with NUL-terminated directives for shell integration
+//! - `__WORKTRUNK_CD__<path>\0` - Change directory
+//! - `__WORKTRUNK_EXEC__<cmd>\0` - Execute command
+//! - `<message>\0` - Success message
+
+pub mod directive;
+pub mod global;
+pub mod handlers;
+pub mod interactive;
+
+// Re-export the public API
+pub use global::{
+ OutputMode, change_directory, execute, flush, initialize, is_interactive, success,
+};
+
+// Re-export output handlers
+pub use handlers::{execute_command_in_worktree, handle_remove_output, handle_switch_output};
diff --git a/tests/snapshots/integration__integration_tests__directives__merge_internal_keep.snap b/tests/snapshots/integration__integration_tests__directives__merge_internal_keep.snap
index 1810e0d24..a1f59d37f 100644
Binary files a/tests/snapshots/integration__integration_tests__directives__merge_internal_keep.snap and b/tests/snapshots/integration__integration_tests__directives__merge_internal_keep.snap differ
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap
index 64f55fd33..80d1a4cb1 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap
@@ -16,8 +16,8 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
- WORKTRUNK_LLM__ARGS: "fix: update file 1 content"
- WORKTRUNK_LLM__COMMAND: echo
+ WORKTRUNK_COMMIT_GENERATION__ARGS: "fix: update file 1 content"
+ WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
---
success: true
exit_code: 0
@@ -37,15 +37,13 @@ exit_code: 0
✅ Pushed to main (1 commit, 2 files, +2) 
🔄 Cleaning up worktree...
-✅ Removed worktree and returned to primary
- Path: [REPO]
+✅ Removed worktree, returned to primary
+ Path: [REPO]
-To enable automatic cd, run: wt configure-shell
+✅ Merge complete
-✅ Merge complete
-
- Merged: feature → main
+ Merged: feature → main
Squashed: 3 commits into 1
- Worktree: Removed
+ Worktree: Removed
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap
index 65f87582b..7f09cccb9 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap
@@ -32,14 +32,12 @@ exit_code: 0
✅ Pushed to main (2 commits, 1 file, +1) 
🔄 Cleaning up worktree...
-✅ Removed worktree and returned to primary
- Path: [REPO]
+✅ Removed worktree, returned to primary
+ Path: [REPO]
-To enable automatic cd, run: wt configure-shell
+✅ Merge complete
-✅ Merge complete
-
- Merged: feature → main
- Worktree: Removed
+ Merged: feature → main
+ Worktree: Removed
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap
index e7637b1b7..7c9d9a25b 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap
@@ -15,8 +15,8 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
- WORKTRUNK_LLM__ARGS: "fix: improve auth validation logic"
- WORKTRUNK_LLM__COMMAND: echo
+ WORKTRUNK_COMMIT_GENERATION__ARGS: "fix: improve auth validation logic"
+ WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
---
success: true
exit_code: 0
@@ -34,14 +34,12 @@ exit_code: 0
✅ Pushed to main (2 commits, 1 file, +1) 
🔄 Cleaning up worktree...
-✅ Removed worktree and returned to primary
- Path: [REPO]
+✅ Removed worktree, returned to primary
+ Path: [REPO]
-To enable automatic cd, run: wt configure-shell
+✅ Merge complete
-✅ Merge complete
-
- Merged: feature → main
- Worktree: Removed
+ Merged: feature → main
+ Worktree: Removed
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_message.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_message.snap
index 4111c28cf..37cf76f81 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_message.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_message.snap
@@ -17,8 +17,8 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
- WORKTRUNK_LLM__ARGS: "feat: complete user dashboard"
- WORKTRUNK_LLM__COMMAND: echo
+ WORKTRUNK_COMMIT_GENERATION__ARGS: "feat: complete user dashboard"
+ WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
---
success: true
exit_code: 0
@@ -36,14 +36,12 @@ exit_code: 0
✅ Pushed to main (2 commits, 1 file, +1) 
🔄 Cleaning up worktree...
-✅ Removed worktree and returned to primary
- Path: [REPO]
+✅ Removed worktree, returned to primary
+ Path: [REPO]
-To enable automatic cd, run: wt configure-shell
+✅ Merge complete
-✅ Merge complete
-
- Merged: feature → main
- Worktree: Removed
+ Merged: feature → main
+ Worktree: Removed
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
index 6badecad1..103920ad8 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
@@ -29,14 +29,12 @@ exit_code: 0
✅ Pushed to main (1 commit, 1 file, +1) 
🔄 Cleaning up worktree...
-✅ Removed worktree and returned to primary
- Path: [REPO]
+✅ Removed worktree, returned to primary
+ Path: [REPO]
-To enable automatic cd, run: wt configure-shell
+✅ Merge complete
-✅ Merge complete
-
- Merged: feature → main
- Worktree: Removed
+ Merged: feature → main
+ Worktree: Removed
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap
index 4b19e90d7..474a79e01 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap
@@ -29,14 +29,12 @@ exit_code: 0
✅ Pushed to main (1 commit, 1 file, +1) 
🔄 Cleaning up worktree...
-✅ Removed worktree and returned to primary
- Path: [REPO]
+✅ Removed worktree, returned to primary
+ Path: [REPO]
-To enable automatic cd, run: wt configure-shell
+✅ Merge complete
-✅ Merge complete
-
- Merged: feature → main
- Worktree: Removed
+ Merged: feature → main
+ Worktree: Removed
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_failure.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_failure.snap
index a8def8be7..c240a1332 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_failure.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_failure.snap
@@ -26,6 +26,6 @@ exit_code: 1
❌ Pre-merge check failed: cmd
- Command 'exit 1' failed with exit code 1
+ Command failed with exit code: exit status: 1
💡 Use --no-verify to skip pre-merge checks
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_named.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_named.snap
index 6bda1fd6a..ceba19506 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_named.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_named.snap
@@ -33,14 +33,12 @@ exit_code: 0
✅ Pushed to main (1 commit, 1 file, +1) 
🔄 Cleaning up worktree...
-✅ Removed worktree and returned to primary
- Path: [REPO]
+✅ Removed worktree, returned to primary
+ Path: [REPO]
-To enable automatic cd, run: wt configure-shell
+✅ Merge complete
-✅ Merge complete
-
- Merged: feature → main
- Worktree: Removed
+ Merged: feature → main
+ Worktree: Removed
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_no_verify.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_no_verify.snap
index bd0cbea25..cf0118447 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_no_verify.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_no_verify.snap
@@ -30,14 +30,12 @@ exit_code: 0
✅ Pushed to main (1 commit, 1 file, +1) 
🔄 Cleaning up worktree...
-✅ Removed worktree and returned to primary
- Path: [REPO]
+✅ Removed worktree, returned to primary
+ Path: [REPO]
-To enable automatic cd, run: wt configure-shell
+✅ Merge complete
-✅ Merge complete
-
- Merged: feature → main
- Worktree: Removed
+ Merged: feature → main
+ Worktree: Removed
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_success.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_success.snap
index 2577c824f..62cb216c3 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_success.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_success.snap
@@ -31,14 +31,12 @@ exit_code: 0
✅ Pushed to main (1 commit, 1 file, +1) 
🔄 Cleaning up worktree...
-✅ Removed worktree and returned to primary
- Path: [REPO]
+✅ Removed worktree, returned to primary
+ Path: [REPO]
-To enable automatic cd, run: wt configure-shell
+✅ Merge complete
-✅ Merge complete
-
- Merged: feature → main
- Worktree: Removed
+ Merged: feature → main
+ Worktree: Removed
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
index 882737c71..e3eb89577 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
@@ -34,15 +34,13 @@ exit_code: 0
✅ Pushed to main (1 commit, 3 files, +3) 
🔄 Cleaning up worktree...
-✅ Removed worktree and returned to primary
- Path: [REPO]
+✅ Removed worktree, returned to primary
+ Path: [REPO]
-To enable automatic cd, run: wt configure-shell
+✅ Merge complete
-✅ Merge complete
-
- Merged: feature → main
+ Merged: feature → main
Squashed: 3 commits into 1
- Worktree: Removed
+ Worktree: Removed
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap
index 79775bffb..4de1a2b3b 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
- WORKTRUNK_LLM__COMMAND: nonexistent-llm-command
+ WORKTRUNK_COMMIT_GENERATION__COMMAND: nonexistent-llm-command
---
success: true
exit_code: 0
@@ -34,15 +34,13 @@ exit_code: 0
✅ Pushed to main (1 commit, 2 files, +2) 
🔄 Cleaning up worktree...
-✅ Removed worktree and returned to primary
- Path: [REPO]
+✅ Removed worktree, returned to primary
+ Path: [REPO]
-To enable automatic cd, run: wt configure-shell
+✅ Merge complete
-✅ Merge complete
-
- Merged: feature → main
+ Merged: feature → main
Squashed: 2 commits into 1
- Worktree: Removed
+ Worktree: Removed
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap
index b981e014b..287ae3d07 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap
@@ -31,14 +31,12 @@ exit_code: 0
✅ Pushed to main (1 commit, 1 file, +1) 
🔄 Cleaning up worktree...
-✅ Removed worktree and returned to primary
- Path: [REPO]
+✅ Removed worktree, returned to primary
+ Path: [REPO]
-To enable automatic cd, run: wt configure-shell
+✅ Merge complete
-✅ Merge complete
-
- Merged: feature → main
- Worktree: Removed
+ Merged: feature → main
+ Worktree: Removed
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap
index ff888fcef..dd9bbe158 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap
@@ -16,9 +16,9 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
- WORKTRUNK_LLM__ARGS__0: "-c"
- WORKTRUNK_LLM__ARGS__1: "cat >/dev/null && echo 'feat: implement user authentication system'"
- WORKTRUNK_LLM__COMMAND: sh
+ WORKTRUNK_COMMIT_GENERATION__ARGS__0: "-c"
+ WORKTRUNK_COMMIT_GENERATION__ARGS__1: "cat >/dev/null && echo 'feat: implement user authentication system'"
+ WORKTRUNK_COMMIT_GENERATION__COMMAND: sh
---
success: true
exit_code: 0
@@ -35,15 +35,13 @@ exit_code: 0
✅ Pushed to main (1 commit, 1 file, +1) 
🔄 Cleaning up worktree...
-✅ Removed worktree and returned to primary
- Path: [REPO]
+✅ Removed worktree, returned to primary
+ Path: [REPO]
-To enable automatic cd, run: wt configure-shell
+✅ Merge complete
-✅ Merge complete
-
- Merged: feature → main
+ Merged: feature → main
Squashed: 2 commits into 1
- Worktree: Removed
+ Worktree: Removed
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap b/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
index 890450ef8..12666fdcc 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
@@ -28,14 +28,12 @@ exit_code: 0
✅ Pushed to main (1 commit, 1 file, +1) 
🔄 Cleaning up worktree...
-✅ Removed worktree and returned to primary
- Path: [REPO]
+✅ Removed worktree, returned to primary
+ Path: [REPO]
-To enable automatic cd, run: wt configure-shell
+✅ Merge complete
-✅ Merge complete
-
- Merged: feature → main
- Worktree: Removed
+ Merged: feature → main
+ Worktree: Removed
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_keep.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_keep.snap
index 4037f58a1..170b8f8ac 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_with_keep.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_keep.snap
@@ -30,9 +30,9 @@ exit_code: 0
✅ Pushed to main (1 commit, 1 file, +1) 
-✅ Merge complete
+✅ Merge complete
- Merged: feature → main
- Worktree: Kept (use 'wt remove' to clean up)
+ Merged: feature → main
+ Worktree: Kept (use 'wt remove' to clean up)
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap b/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
index c15b61d36..4468b203c 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
@@ -13,7 +13,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpKHkSRe
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpUuZGl5
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -21,13 +21,23 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for feature
- Path: [REPO]/../test-repo.feature
+✅ Created new worktree for feature
+ Path: [REPO]/../test-repo.feature
To enable automatic cd, run: wt configure-shell
----- stderr -----
-🔄 Executing (post-create):
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
  echo 'Setup done' > setup.txt
-🔄 Starting (background): sleep 0.5 && echo 'Server running' > server.txt
- → Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log
+
+💡 Allow and remember? [y/N] Skipping command: echo 'Setup done' > setup.txt
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
+  sleep 0.5 && echo 'Server running' > server.txt
+
+💡 Allow and remember? [y/N] Skipping command: sleep 0.5 && echo 'Server running' > server.txt
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap b/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap
index 0a5069243..5c1c55545 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap
@@ -15,7 +15,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpyp4YON
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmptZb4Ps
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -23,10 +23,14 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for feature
- Path: [REPO]/../test-repo.feature
-
+✅ Created new worktree for feature
+ Path: [REPO]/../test-repo.feature
----- stderr -----
-🔄 Starting (background): echo 'Background task' > background.txt
- → Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
+  echo 'Background task' > background.txt
+
+💡 Allow and remember? [y/N] Skipping command: echo 'Background task' > background.txt
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap
index e9c2e8adc..2d56c21e9 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap
@@ -13,7 +13,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpnLywt9
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpF1umrW
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -21,12 +21,16 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for feature
- Path: [REPO]/../test-repo.feature
+✅ Created new worktree for feature
+ Path: [REPO]/../test-repo.feature
To enable automatic cd, run: wt configure-shell
----- stderr -----
-🔄 Executing (post-create):
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
  exit 1
-🟡 Command cmd failed: Command 'exit 1' failed with exit code 1
+
+💡 Allow and remember? [y/N] Skipping command: exit 1
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap
index 4fda35dac..42ca631e8 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap
@@ -13,7 +13,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp0uygJv
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpU051MH
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -21,15 +21,23 @@ info:
success: true
exit_code: 0
----- stdout -----
-First
-Second
-✅ Created new worktree for feature
- Path: [REPO]/../test-repo.feature
+✅ Created new worktree for feature
+ Path: [REPO]/../test-repo.feature
To enable automatic cd, run: wt configure-shell
----- stderr -----
-🔄 Executing (post-create):
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
  echo 'First'
-🔄 Executing (post-create):
+
+💡 Allow and remember? [y/N] Skipping command: echo 'First'
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
  echo 'Second'
+
+💡 Allow and remember? [y/N] Skipping command: echo 'Second'
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap
index 53da6c1ed..f8a1983ca 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap
@@ -13,7 +13,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpfRJrjF
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpYddzNM
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -21,15 +21,23 @@ info:
success: true
exit_code: 0
----- stdout -----
-Installing deps
-Running setup
-✅ Created new worktree for feature
- Path: [REPO]/../test-repo.feature
+✅ Created new worktree for feature
+ Path: [REPO]/../test-repo.feature
To enable automatic cd, run: wt configure-shell
----- stderr -----
-🔄 Executing (post-create):
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
  echo 'Installing deps'
-🔄 Executing (post-create):
+
+💡 Allow and remember? [y/N] Skipping command: echo 'Installing deps'
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
  echo 'Running setup'
+
+💡 Allow and remember? [y/N] Skipping command: echo 'Running setup'
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_no_config.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_no_config.snap
index 17ed5284f..ac8530bca 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_no_config.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_no_config.snap
@@ -20,8 +20,8 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for feature
- Path: [REPO]/../test-repo.feature
+✅ Created new worktree for feature
+ Path: [REPO]/../test-repo.feature
To enable automatic cd, run: wt configure-shell
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap
index 4f3f61a66..80bbd1517 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap
@@ -13,7 +13,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpCIH1Ds
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpYozSFb
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -21,12 +21,16 @@ info:
success: true
exit_code: 0
----- stdout -----
-Setup complete
-✅ Created new worktree for feature
- Path: [REPO]/../test-repo.feature
+✅ Created new worktree for feature
+ Path: [REPO]/../test-repo.feature
To enable automatic cd, run: wt configure-shell
----- stderr -----
-🔄 Executing (post-create):
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
  echo 'Setup complete'
+
+💡 Allow and remember? [y/N] Skipping command: echo 'Setup complete'
diff --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.snap
index 637065996..ba6ccc13a 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
@@ -13,7 +13,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpWzrP13
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpM4oDJl
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -21,8 +21,8 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for feature/test
- Path: [REPO]/../test-repo.feature-test
+✅ Created new worktree for feature/test
+ Path: [REPO]/../test-repo.feature-test
To enable automatic cd, run: wt configure-shell
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap
index ca8491f42..a98593c99 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap
@@ -13,7 +13,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpAjLGDp
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpJdNF1s
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -21,13 +21,20 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for feature
- Path: [REPO]/../test-repo.feature
+✅ Created new worktree for feature
+ Path: [REPO]/../test-repo.feature
To enable automatic cd, run: wt configure-shell
----- stderr -----
-🔄 Starting (background): echo 'line1
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
+  echo 'line1
+  line2
+  line3' | grep line2 > filtered.txt
+
+💡 Allow and remember? [y/N] Skipping command: echo 'line1
line2
line3' | grep line2 > filtered.txt
- → Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap
index 0797e1aa2..de2ec6530 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap
@@ -13,7 +13,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpsrsqrn
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpuSHM2t
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -21,11 +21,16 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for feature
- Path: [REPO]/../test-repo.feature
+✅ Created new worktree for feature
+ Path: [REPO]/../test-repo.feature
To enable automatic cd, run: wt configure-shell
----- stderr -----
-🔄 Starting (background): echo 'unclosed quote
- → Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
+  echo 'unclosed quote
+
+💡 Allow and remember? [y/N] Skipping command: echo 'unclosed quote
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap
index 5a73a461a..829c5738d 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap
@@ -13,7 +13,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpmm81Ut
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpU4gfUf
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -21,11 +21,16 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for feature
- Path: [REPO]/../test-repo.feature
+✅ Created new worktree for feature
+ Path: [REPO]/../test-repo.feature
To enable automatic cd, run: wt configure-shell
----- stderr -----
-🔄 Starting (background): echo 'stdout output' && echo 'stderr output' >&2
- → Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
+  echo 'stdout output' && echo 'stderr output' >&2
+
+💡 Allow and remember? [y/N] Skipping command: echo 'stdout output' && echo 'stderr output' >&2
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
index 348140588..22b3311a1 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
@@ -13,7 +13,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpsJq5hm
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpqq16nl
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -21,13 +21,23 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for feature
- Path: [REPO]/../test-repo.feature
+✅ Created new worktree for feature
+ Path: [REPO]/../test-repo.feature
To enable automatic cd, run: wt configure-shell
----- stderr -----
-🔄 Starting (background): echo 'Task 1 running' > task1.txt
- → Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log
-🔄 Starting (background): echo 'Task 2 running' > task2.txt
- → Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
+  echo 'Task 1 running' > task1.txt
+
+💡 Allow and remember? [y/N] Skipping command: echo 'Task 1 running' > task1.txt
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
+  echo 'Task 2 running' > task2.txt
+
+💡 Allow and remember? [y/N] Skipping command: echo 'Task 2 running' > task2.txt
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
index 72133a89c..a8b8f46ea 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
@@ -13,7 +13,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpsJ7hwP
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpYgkgiZ
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -21,15 +21,30 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for feature
- Path: [REPO]/../test-repo.feature
+✅ Created new worktree for feature
+ Path: [REPO]/../test-repo.feature
To enable automatic cd, run: wt configure-shell
----- stderr -----
-🔄 Starting (background): echo 'TASK1_OUTPUT'
- → Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log
-🔄 Starting (background): echo 'TASK2_OUTPUT'
- → Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log
-🔄 Starting (background): echo 'TASK3_OUTPUT'
- → Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
+  echo 'TASK1_OUTPUT'
+
+💡 Allow and remember? [y/N] Skipping command: echo 'TASK1_OUTPUT'
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
+  echo 'TASK2_OUTPUT'
+
+💡 Allow and remember? [y/N] Skipping command: echo 'TASK2_OUTPUT'
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
+  echo 'TASK3_OUTPUT'
+
+💡 Allow and remember? [y/N] Skipping command: echo 'TASK3_OUTPUT'
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap
index 85b9c71d4..a919ee568 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap
@@ -13,7 +13,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpeoYZa6
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp04jzX0
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -21,11 +21,16 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for feature
- Path: [REPO]/../test-repo.feature
+✅ Created new worktree for feature
+ Path: [REPO]/../test-repo.feature
To enable automatic cd, run: wt configure-shell
----- stderr -----
-🔄 Starting (background): sleep 1 && echo 'Background task done' > background.txt
- → Logs: .git/wt-logs/post-start-[NAME]-[TIMESTAMP].log
+
+🟡 Permission required to execute in worktree
+
+test-repo (test-repo) wants to execute:
+  sleep 1 && echo 'Background task done' > background.txt
+
+💡 Allow and remember? [y/N] Skipping command: sleep 1 && echo 'Background task done' > background.txt
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_already_on_default.snap b/tests/snapshots/integration__integration_tests__remove__remove_already_on_default.snap
index dac8e8361..cacbe3789 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_already_on_default.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_already_on_default.snap
@@ -18,6 +18,6 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Already on default branch main
+✅ Already on default branch main
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_from_worktree.snap b/tests/snapshots/integration__integration_tests__remove__remove_from_worktree.snap
index 19e72d14a..3033e34d3 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_from_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_from_worktree.snap
@@ -18,9 +18,7 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Removed worktree and returned to primary
- Path: [REPO]
-
-To enable automatic cd, run: wt configure-shell
+✅ Removed worktree, returned to primary
+ Path: [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap b/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap
index 3d43ecf74..f384a42c7 100644
Binary files a/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap and b/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap differ
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_switch_to_default.snap b/tests/snapshots/integration__integration_tests__remove__remove_switch_to_default.snap
index 09cfca0a5..2ef55887d 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_switch_to_default.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_switch_to_default.snap
@@ -18,6 +18,6 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Switched to default branch main
+✅ Switched to default branch main
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_base_without_create.snap b/tests/snapshots/integration__integration_tests__switch__switch_base_without_create.snap
index 2f7565116..8c3dbd906 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_base_without_create.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_base_without_create.snap
@@ -21,7 +21,7 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Switched to worktree for main
+✅ Switched to worktree for main
To enable automatic cd, run: wt configure-shell
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap b/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap
index 9d2df18be..3fc455777 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap
@@ -20,8 +20,8 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for feature-x
- Path: [REPO]/../test-repo.feature-x
+✅ Created new worktree for feature-x
+ Path: [REPO]/../test-repo.feature-x
To enable automatic cd, run: wt configure-shell
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap
index 9674fdc59..ac995c2cf 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap
@@ -22,8 +22,7 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for file-test
- Path: [REPO]/../test-repo.file-test
-
+✅ Created new worktree for file-test
+ Path: [REPO]/../test-repo.file-test
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_existing.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_existing.snap
index cd0a72c3f..27f0c5cbc 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_existing.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_existing.snap
@@ -21,7 +21,6 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Switched to worktree for existing-exec
-
+✅ Switched to worktree for existing-exec
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap
index 1b4998f34..25ad57e6d 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap
@@ -22,9 +22,8 @@ info:
success: false
exit_code: 1
----- stdout -----
-✅ Created new worktree for fail-test
- Path: [REPO]/../test-repo.fail-test
-
+✅ Created new worktree for fail-test
+ Path: [REPO]/../test-repo.fail-test
----- stderr -----
-Command 'exit 1' failed with exit code 1
+Command failed with exit code: exit status: 1
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap
index adb5ba753..cf3113752 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap
@@ -22,9 +22,8 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for multiline-test
- Path: [REPO]/../test-repo.multiline-test
-
+✅ Created new worktree for multiline-test
+ Path: [REPO]/../test-repo.multiline-test
line1
line2
line3
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap
index 58c8e94ee..52a9e382b 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap
@@ -22,9 +22,8 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for exec-test
- Path: [REPO]/../test-repo.exec-test
-
+✅ Created new worktree for exec-test
+ Path: [REPO]/../test-repo.exec-test
test output
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_existing_branch.snap b/tests/snapshots/integration__integration_tests__switch__switch_existing_branch.snap
index 2fa510ac1..51dcc187c 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_existing_branch.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_existing_branch.snap
@@ -19,7 +19,7 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Switched to worktree for feature-z
+✅ Switched to worktree for feature-z
To enable automatic cd, run: wt configure-shell
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap b/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap
index c18b6f2e8..dab60f80b 100644
Binary files a/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap and b/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap differ
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap
index 0f0265750..916a0fec7 100644
Binary files a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap and b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap differ
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap
index 6fff1ab96..247803cd3 100644
Binary files a/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap and b/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap differ
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_execute_still_runs.snap b/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_execute_still_runs.snap
index c43b23987..07e79da3b 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_execute_still_runs.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_execute_still_runs.snap
@@ -23,9 +23,8 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for no-config-commands-test
- Path: [REPO]/../test-repo.no-config-commands-test
-
+✅ Created new worktree for no-config-commands-test
+ Path: [REPO]/../test-repo.no-config-commands-test
execute command runs
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_existing.snap b/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_existing.snap
index 2433d9f82..3f1bb34fe 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_existing.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_existing.snap
@@ -22,8 +22,7 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Switched to worktree for existing-no-config-commands
-
+✅ Switched to worktree for existing-no-config-commands
execute still runs
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_skips_post_start.snap b/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_skips_post_start.snap
index 110238d4b..42b2e1858 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_skips_post_start.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_skips_post_start.snap
@@ -14,7 +14,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpqatjYg
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpNFSOzv
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -22,8 +22,8 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for no-post-start
- Path: [REPO]/../test-repo.no-post-start
+✅ Created new worktree for no-post-start
+ Path: [REPO]/../test-repo.no-post-start
To enable automatic cd, run: wt configure-shell
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_with_force.snap b/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_with_force.snap
index 5e9410378..c789364ce 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_with_force.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_no_config_commands_with_force.snap
@@ -15,7 +15,7 @@ info:
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
- HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpD3ng3v
+ HOME: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpAByZ8M
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1704067200"
@@ -23,8 +23,8 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for force-no-config-commands
- Path: [REPO]/../test-repo.force-no-config-commands
+✅ Created new worktree for force-no-config-commands
+ Path: [REPO]/../test-repo.force-no-config-commands
To enable automatic cd, run: wt configure-shell
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_with_base.snap b/tests/snapshots/integration__integration_tests__switch__switch_with_base.snap
index d46e5d63e..bd17825c0 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_with_base.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_with_base.snap
@@ -22,8 +22,8 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Created new worktree for feature-with-base
- Path: [REPO]/../test-repo.feature-with-base
+✅ Created new worktree for feature-with-base
+ Path: [REPO]/../test-repo.feature-with-base
To enable automatic cd, run: wt configure-shell