Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Replace --internal flag with WORKTRUNK_DIRECTIVE_FILE environment variable (#269)
Maximilian Roos87321281d466
diff --git a/.claude/rules/cli-output-formatting.md b/.claude/rules/cli-output-formatting.mdindex 589e9f32b..40205f3f6 100644--- a/.claude/rules/cli-output-formatting.md+++ b/.claude/rules/cli-output-formatting.md@@ -255,21 +255,21 @@ messages. Currently being trialed — expand to other commands if it works well.## stdout vs stderr-**Both modes write all messages to stderr.** stdout is reserved for structured-data:+stdout is for the primary output of commands — the data you asked for. stderr+is for status messages about the operation. This separation allows piping+(`wt list | grep foo`) without progress or warnings interfering.-- **stdout**: JSON output (`--format=json`), shell scripts (directive mode)-- **stderr**: All user-facing messages (progress, success, errors, hints,- gutter, etc.)+- **stdout**: Primary output (table data, JSON, statusline)+- **stderr**: Status messages (progress, success, errors, hints, warnings)-**Directive mode** additionally emits a shell script to stdout at the end.+Shell integration writes directives (cd, exec) to `WORKTRUNK_DIRECTIVE_FILE`, keeping+stdout completely free for data.-Use the output system (`output::print()` with message formatting functions) to-handle both modes automatically. Never write directly to stdout/stderr in-command code.+Use the output system (`output::print()` with message formatting functions).+Never write directly to stdout/stderr in command code.```rust-// GOOD - use output system (handles both modes)+// GOOD - use output systemoutput::print(success_message("Branch created"))?;// BAD - direct writes bypass output systemdiff --git a/.claude/rules/output-system-architecture.md b/.claude/rules/output-system-architecture.mdindex d96388d1f..82b6af4aa 100644--- a/.claude/rules/output-system-architecture.md+++ b/.claude/rules/output-system-architecture.md@@ -1,44 +1,37 @@# Output System Architecture-## Two Output Modes+## Shell Integration-Worktrunk supports two output modes, selected once at program startup:+Worktrunk uses file-based directive passing for shell integration:-1. **Interactive Mode** — Human-friendly output with colors, symbols, and hints-2. **Directive Mode** — Shell script on stdout (at end), user messages on stderr+1. Shell wrapper creates a temp file via `mktemp`+2. Shell wrapper sets `WORKTRUNK_DIRECTIVE_FILE` env var to the file path+3. wt writes shell commands (like `cd '/path'`) to that file+4. Shell wrapper sources the file after wt exits-Both modes write all messages to stderr. stdout is reserved for structured data-(JSON, shell scripts).--The mode is determined at initialization in `main()` and never changes during-execution.+When `WORKTRUNK_DIRECTIVE_FILE` is not set (direct binary call), commands execute+directly and shell integration hints are shown.## The Cardinal Rule: Never Check Mode in Command Code-Command code must never check which output mode is active. The output system-uses enum dispatch — commands call output functions without knowing the mode.+Command code must never check whether shell integration is active. The output+system handles this automatically — commands call output functions without+knowing the mode.```rust// NEVER DO THIS-if mode == OutputMode::Interactive {- println!("✓ Success!");+if is_shell_integration_active() {+ // different behavior}// ALWAYS DO THISoutput::print(success_message("Success!"))?;+output::change_directory(&path)?;```-Decide once at the edge (`main()`), initialize globally, trust internally:+State is lazily initialized on first use — just call output functions anywhere:```rust-// In main.rs - the only place that knows about modes-let output_mode = match cli.internal {- Some(shell) => output::OutputMode::Directive(shell),- None => output::OutputMode::Interactive,-};-output::initialize(output_mode);--// Everywhere else - just use the output functionsoutput::print(success_message("Created worktree"))?;output::change_directory(&path)?;```@@ -47,19 +40,20 @@ output::change_directory(&path)?;The output module (`src/output/global.rs`) provides:-- `print(message)` — Write message as-is (use with message formatting functions)-- `shell_integration_hint(message)` — Shell integration hints (↳, suppressed in- directive)-- `gutter(content)` — Gutter-formatted content (use with `format_with_gutter()`)-- `blank()` — Blank line for visual separation-- `data(content)` — Structured data output without symbol (JSON, for piping)-- `table(content)` — Table/UI output to stderr-- `change_directory(path)` — Request directory change-- `execute(command)` — Execute command or buffer for shell script+- `print(message)` — Status message to stderr (use with message formatting functions)+- `shell_integration_hint(message)` — Shell integration hints (↳, suppressed when+ shell integration is active)+- `gutter(content)` — Gutter-formatted content to stderr+- `blank()` — Blank line to stderr+- `data(content)` — Structured data to stdout (JSON)+- `table(content)` — Primary output to stdout (table data, pipeable)+- `change_directory(path)` — Request directory change (writes to directive file+ if set)+- `execute(command)` — Execute command directly or write to directive file- `flush()` — Flush output buffers- `flush_for_stderr_prompt()` — Flush before interactive prompts-- `terminate_output()` — Emit shell script in directive mode (no-op in- interactive)+- `terminate_output()` — Reset ANSI state on stderr+- `is_shell_integration_active()` — Check if directive file is set (rarely needed)**Message formatting functions** (from `worktrunk::styling`):@@ -72,14 +66,22 @@ The output module (`src/output/global.rs`) provides:For the complete API, see `src/output/global.rs` and `src/styling/constants.rs`.-## Adding New Output Functions+## Security: Protecting the Directive File-Add the function to both handlers, add dispatch in `global.rs`, never add mode-parameters. This maintains one canonical path: commands have ONE code path that-works for both modes.+The `WORKTRUNK_DIRECTIVE_FILE` environment variable is automatically removed from all+spawned subprocesses. This prevents hooks from discovering and writing to the+directive file.++The `shell_exec::run()` function (the canonical way to run external commands)+handles this automatically. Other spawn sites must explicitly call+`.env_remove(DIRECTIVE_FILE_ENV_VAR)`.++## Adding New Output Functions-## Architectural Constraint: --internal Commands Must Use Output System+Add the function to `global.rs`. The pattern:+- **Primary output** (data the command produces) → stdout via `table()` or `data()`+- **Status messages** (progress, success, errors) → stderr via `print()`+- **Directives** (cd, exec) → directive file via `change_directory()`, `execute()`-Commands supporting `--internal` must never use direct print macros — use output-system functions to prevent directive leaks. Enforced by-`tests/output_system_guard.rs`.+This separation makes commands pipeable: `wt list | grep feature` works because+the table goes to stdout while progress/warnings go to stderr.diff --git a/docs/content/config.md b/docs/content/config.mdindex 30dcb5397..4f11c6209 100644--- a/docs/content/config.md+++ b/docs/content/config.md@@ -226,7 +226,10 @@ WORKTRUNK_COMMIT_GENERATION__ARGS="test: automated commit" \| Variable | Purpose ||----------|---------|+| `WORKTRUNK_BIN` | Override binary path for shell wrappers (useful for testing dev builds) || `WORKTRUNK_CONFIG_PATH` | Override user config file location |+| `WORKTRUNK_DIRECTIVE_FILE` | Internal: set by shell wrappers to enable directory changes |+| `WORKTRUNK_SHELL` | Internal: set by shell wrappers to indicate shell type (e.g., `powershell`) || `WORKTRUNK_MAX_CONCURRENT_COMMANDS` | Max parallel git commands (default: 32). Lower if hitting resource limits. || `NO_COLOR` | Disable colored output ([standard](https://no-color.org/)) || `CLICOLOR_FORCE` | Force colored output even when not a TTY |diff --git a/src/cli.rs b/src/cli.rsindex 7fe7699ab..f1c3ba180 100644--- a/src/cli.rs+++ b/src/cli.rs@@ -4,16 +4,6 @@ use std::sync::OnceLock;use crate::commands::Shell;-/// Shell type for directive output in --internal mode-#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, ValueEnum)]-pub enum DirectiveShell {- /// POSIX shells (bash, zsh, fish) - outputs `cd '/path'`- #[default]- Posix,- /// PowerShell - outputs `Set-Location '/path'`- Powershell,-}-/// Custom styles for help output - matches worktrunk's color schemefn help_styles() -> Styles {Styles::styled()@@ -182,11 +172,6 @@ pub struct Cli {)]pub verbose: bool,- /// Shell wrapper mode (optionally specify shell type for directive output)- /// Usage: --internal (defaults to posix) or --internal=powershell- #[arg(long, global = true, hide = true, default_missing_value = "posix", num_args = 0..=1, require_equals = true)]- pub internal: Option<DirectiveShell>,-#[command(subcommand)]pub command: Option<Commands>,}@@ -1377,7 +1362,10 @@ WORKTRUNK_COMMIT_GENERATION__ARGS="test: automated commit" \| Variable | Purpose ||----------|---------|+| `WORKTRUNK_BIN` | Override binary path for shell wrappers (useful for testing dev builds) || `WORKTRUNK_CONFIG_PATH` | Override user config file location |+| `WORKTRUNK_DIRECTIVE_FILE` | Internal: set by shell wrappers to enable directory changes |+| `WORKTRUNK_SHELL` | Internal: set by shell wrappers to indicate shell type (e.g., `powershell`) || `WORKTRUNK_MAX_CONCURRENT_COMMANDS` | Max parallel git commands (default: 32). Lower if hitting resource limits. || `NO_COLOR` | Disable colored output ([standard](https://no-color.org/)) || `CLICOLOR_FORCE` | Force colored output even when not a TTY |diff --git a/src/commands/command_approval.rs b/src/commands/command_approval.rsindex 6de694a6e..f5aea406b 100644--- a/src/commands/command_approval.rs+++ b/src/commands/command_approval.rs@@ -102,8 +102,7 @@ fn prompt_for_batch_approval(commands: &[&Command], project_id: &str) -> anyhow:let plural = if count == 1 { "" } else { "s" };// CRITICAL: Flush stdout before writing to stderr to prevent stream interleaving- // In directive mode, flushes both stdout (directives) and stderr (messages)- // In interactive mode, flushes both stdout and stderr+ // Flushes both stdout (for data output) and stderr (for messages)crate::output::flush_for_stderr_prompt()?;eprintln!(diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rsindex 0d4cdc35c..6d004bff6 100644--- a/src/commands/configure_shell.rs+++ b/src/commands/configure_shell.rs@@ -506,8 +506,7 @@ fn prompt_for_confirmation(use worktrunk::styling::{eprint, eprintln};// CRITICAL: Flush stdout before writing to stderr to prevent stream interleaving- // In directive mode, flushes both stdout (directives) and stderr (messages)- // In interactive mode, flushes both stdout and stderr+ // Flushes both stdout (for data output) and stderr (for messages)crate::output::flush_for_stderr_prompt().map_err(|e| e.to_string())?;let bold = Style::new().bold();diff --git a/src/commands/for_each.rs b/src/commands/for_each.rsindex a1503633f..00b90c502 100644--- a/src/commands/for_each.rs+++ b/src/commands/for_each.rs@@ -178,11 +178,13 @@ fn run_command_streaming(.command(command).current_dir(working_dir).stdin(stdin_mode)- // Redirect stdout to stderr to keep stdout clean for directive scripts+ // Redirect stdout to stderr to keep stdout reserved for data output// Note: Stdio::from(Stderr) works since Rust 1.74 (impl From<Stderr> for Stdio).stdout(Stdio::from(std::io::stderr()))// Stream stderr to terminal in real-time.stderr(Stdio::inherit())+ // Prevent subprocesses from writing to the directive file+ .env_remove(worktrunk::shell_exec::DIRECTIVE_FILE_ENV_VAR).spawn().map_err(|e| CommandError::SpawnFailed(e.to_string()))?;diff --git a/src/commands/list/collect.rs b/src/commands/list/collect.rsindex a29d8391a..890f72af0 100644--- a/src/commands/list/collect.rs+++ b/src/commands/list/collect.rs@@ -967,15 +967,16 @@ pub fn collect(}table.finalize_tty(final_msg)?;} else {- // Non-TTY: print final static table- let mut final_lines = Vec::new();- final_lines.push(layout.format_header_line());+ // Non-TTY: output to stdout (same as buffered mode)+ // Progressive skeleton was suppressed; now output the final table+ crate::output::table(layout.format_header_line())?;for item in &all_items {- final_lines.push(layout.format_list_item_line(item, previous_branch.as_deref()));+ crate::output::table(+ layout.format_list_item_line(item, previous_branch.as_deref()),+ )?;}- final_lines.push(String::new()); // Spacer- final_lines.push(final_msg);- table.finalize_non_tty(final_lines)?;+ crate::output::table("")?;+ crate::output::table(final_msg)?;}} else if render_table {// Buffered mode: render final tablediff --git a/src/commands/list/progressive.rs b/src/commands/list/progressive.rsindex 5ee674cfd..962f5059d 100644--- a/src/commands/list/progressive.rs+++ b/src/commands/list/progressive.rs@@ -14,7 +14,8 @@ impl RenderMode {////// * `progressive` - Rendering mode (Some(true) = --progressive, Some(false) = --no-progressive, None = auto)///- /// Table output always goes to stderr (via output::table()), so we check stderr's TTY status.+ /// Table output goes to stdout, so we check stdout's TTY status. When piped+ /// (`wt list | grep`), we buffer; when interactive, we render progressively.pub fn detect(progressive: Option<bool>) -> Self {// Priority 1: Explicit CLI flagmatch progressive {@@ -23,9 +24,9 @@ impl RenderMode {None => {} // Fall through to auto-detection}- // Priority 2: Auto-detect based on stderr TTY (table output always goes to stderr)+ // Priority 2: Auto-detect based on stdout TTYuse std::io::IsTerminal;- if std::io::stderr().is_terminal() {+ if std::io::stdout().is_terminal() {// TODO: Check for pager in environmentRenderMode::Progressive} else {diff --git a/src/commands/list/progressive_table.rs b/src/commands/list/progressive_table.rsindex 2ce9e381c..9e36dd053 100644--- a/src/commands/list/progressive_table.rs+++ b/src/commands/list/progressive_table.rs@@ -188,22 +188,6 @@ impl ProgressiveTable {Ok(())}- /// Finalize for non-TTY: clear all and print final static table.- ///- /// # Arguments- /// * `final_lines` - Final rendered lines (header + rows + spacer + footer)- pub fn finalize_non_tty(&self, final_lines: Vec<String>) -> std::io::Result<()> {- let mut stderr = stderr();-- // For non-TTY, we just print the final table- // (initial output was suppressed)- for line in final_lines {- writeln!(stderr, "{}", line)?;- }-- stderr.flush()- }-/// Check if output is going to a TTY.pub fn is_tty(&self) -> bool {self.is_tty@@ -343,26 +327,6 @@ mod tests {// This tests that the method doesn't panic}- #[test]- fn test_finalize_non_tty() {- let table = ProgressiveTable::new(- "header".to_string(),- vec!["row".to_string()],- "loading".to_string(),- 80,- );-- let final_lines = vec![- "Final Header".to_string(),- "Final Row".to_string(),- "".to_string(),- "Complete".to_string(),- ];-- // Should not panic (writes to stderr which may fail in some test envs)- let _ = table.finalize_non_tty(final_lines);- }-#[test]fn test_render_initial_non_tty() {let table = ProgressiveTable::new(diff --git a/src/commands/process.rs b/src/commands/process.rsindex 5d1ed58a7..ec9580717 100644--- a/src/commands/process.rs+++ b/src/commands/process.rs@@ -156,6 +156,8 @@ fn spawn_detached_unix(.context("Failed to clone log file handle")?,)).stderr(Stdio::from(log_file))+ // Prevent hooks from writing to the directive file+ .env_remove(worktrunk::shell_exec::DIRECTIVE_FILE_ENV_VAR).process_group(0) // New process group, not in PTY's foreground group.spawn().context("Failed to spawn detached process")?;@@ -232,6 +234,8 @@ fn spawn_detached_windows(.context("Failed to clone log file handle")?,)).stderr(Stdio::from(log_file))+ // Prevent hooks from writing to the directive file+ .env_remove(worktrunk::shell_exec::DIRECTIVE_FILE_ENV_VAR).creation_flags(CREATE_NEW_PROCESS_GROUP | DETACHED_PROCESS).spawn().context("Failed to spawn detached process")?;diff --git a/src/commands/select.rs b/src/commands/select.rsindex edaab3b9b..6141c2419 100644--- a/src/commands/select.rs+++ b/src/commands/select.rs@@ -121,6 +121,8 @@ fn run_git_diff_with_pager(git_args: &[&str], pager_cmd: &str) -> Option<String>.arg(&pipeline).stdout(Stdio::piped()).stderr(Stdio::null())+ // Prevent subprocesses from writing to the directive file+ .env_remove(worktrunk::shell_exec::DIRECTIVE_FILE_ENV_VAR).spawn(){Ok(child) => child,@@ -806,7 +808,7 @@ where}}-pub fn handle_select(is_directive_mode: bool) -> anyhow::Result<()> {+pub fn handle_select() -> anyhow::Result<()> {let repo = Repository::current();// Initialize preview mode state file (auto-cleanup on drop)@@ -985,15 +987,14 @@ pub fn handle_select(is_directive_mode: bool) -> anyhow::Result<()> {handle_switch(&identifier, false, None, false, false, false, &config)?;// Clear the terminal screen after skim exits to prevent artifacts- // Use stderr for terminal control sequences - in directive mode, stdout goes to a FIFO- // for directive parsing, so terminal control must go through stderr to reach the TTY+ // Use stderr for terminal control - stdout is reserved for data outputuse crossterm::{execute, terminal};use std::io::stderr;execute!(stderr(), terminal::Clear(terminal::ClearType::All))?;execute!(stderr(), crossterm::cursor::MoveTo(0, 0))?;- // Show success message; emit cd directive if in directive mode- handle_switch_output(&result, &branch_info, false, is_directive_mode)?;+ // Show success message; emit cd directive if shell integration is active+ handle_switch_output(&result, &branch_info, false)?;}Ok(())diff --git a/src/commands/statusline.rs b/src/commands/statusline.rsindex d1c3a6be4..262252456 100644--- a/src/commands/statusline.rs+++ b/src/commands/statusline.rs@@ -123,9 +123,8 @@ fn format_directory_fish_style(path: &Path) -> String {/// Run the statusline command.///-/// Output uses `output::data()` which routes based on mode:-/// - Interactive: stdout (for shell prompts)-/// - Directive: stderr (stdout reserved for shell script)+/// Output uses `output::data()` for raw stdout (bypasses anstream color detection).+/// Shell prompts (PS1) and Claude Code always expect ANSI codes.pub fn run(claude_code: bool) -> Result<()> {// Get context - either from stdin (claude-code mode) or current directorylet (cwd, model_name) = if claude_code {@@ -196,7 +195,7 @@ pub fn run(claude_code: bool) -> Result<()> {output.push_str(&model);}- // Output via output system (routes based on mode: interactive→stdout, directive→stderr)+ // Output via data() - shell prompts and Claude Code always expect ANSI codesif !output.is_empty() {use worktrunk::styling::fix_dim_after_color_reset;let reset = anstyle::Reset;diff --git a/src/commands/worktree.rs b/src/commands/worktree.rsindex 1c99391bb..46920b238 100644--- a/src/commands/worktree.rs+++ b/src/commands/worktree.rs@@ -1,6 +1,4 @@-//! Worktree operations with dual-mode output for shell integration.-//!-//! Note: This module uses message functions from worktrunk::styling.+//! Worktree operations with file-based shell integration.//!//! # The Directory Change Problem//!@@ -12,11 +10,16 @@//! The binary can change *its own* working directory, but when it exits, the parent shell remains//! in the original directory.//!-//! # Solution: Dual-Mode Output+//! # Solution: File-Based Directive Passing+//!+//! Shell wrappers create a temp file and set `WORKTRUNK_DIRECTIVE_FILE` to its path://!-//! We solve this with two output modes:+//! 1. Shell wrapper creates temp file via `mktemp`+//! 2. Shell wrapper sets `WORKTRUNK_DIRECTIVE_FILE=/path/to/temp`+//! 3. wt binary writes commands like `cd '/path'` to that file+//! 4. Shell wrapper sources the file after wt exits//!-//! ## Without `--internal` (Direct Binary Call)+//! ## Without Shell Integration (Direct Binary Call)//!//! ```bash//! $ wt switch my-feature@@ -31,7 +34,7 @@//! The binary performs git operations and prints user-friendly messages, but **cannot** change//! the parent shell's directory. User must manually `cd` to the worktree.//!-//! ## With `--internal` (Via Shell Wrapper)+//! ## With Shell Integration//!//! ```bash//! $ wt switch my-feature@@ -41,16 +44,11 @@//! /path/to/worktree # ← Automatically changed!//! ```//!-//! When shell integration is enabled (`eval "$(wt config shell init bash)"`), the shell function-//! intercepts commands and adds `--internal`:+//! When shell integration is enabled (`eval "$(wt config shell init bash)"`), the shell wrapper://!-//! 1. Shell wrapper calls: `wt switch --internal my-feature`-//! 2. Binary streams user-facing messages to **stderr** (real-time feedback)-//! 3. At exit, binary outputs a shell script to **stdout** (e.g., `cd '/path/to/worktree'`)-//! 4. Shell wrapper captures stdout via `$()` and evals it in the parent shell-//!-//! The binary **never changes directories itself** - it just outputs a shell script that the-//! wrapper evals to perform the cd.+//! 1. Creates a temp file and sets `WORKTRUNK_DIRECTIVE_FILE` to its path+//! 2. Runs the wt binary (which writes `cd '/path'` to the temp file)+//! 3. Sources the temp file after wt exits//!//! # Implementation Details//!@@ -60,38 +58,8 @@//! - `output::handle_switch_output()`: Formats and outputs switch operation results//! - `output::handle_remove_output()`: Formats and outputs remove operation results//!-//! These handlers automatically select the appropriate mode (user-friendly or directive protocol)-//! based on the `internal` flag.-//!-//! ## Shell Script Protocol-//!-//! In directive mode (`--internal`), the binary:-//! - Streams all user messages to **stderr** (real-time, with colors)-//! - Buffers cd/exec directives internally-//! - At exit, emits a shell script to **stdout**:-//!-//! ```bash-//! cd '/path/to/worktree'-//! echo 'optional follow-up command'-//! ```-//!-//! The shell wrapper captures this via command substitution and evals it:-//!-//! ```bash-//! wt() {-//! local script exit_code=0-//! script="$(command "$WORKTRUNK_BIN" --internal "$@" 2>&2)" || exit_code=$?-//! if [[ -n "$script" ]]; then-//! eval "$script"-//! fi-//! return "$exit_code"-//! }-//! ```-//!-//! This pattern (stderr for logs, stdout for script) is proven by direnv. Benefits:-//! - No FIFOs, no background processes, no job control suppression-//! - Full streaming: stderr goes directly to terminal while wt runs-//! - Simple shell wrapper: just command substitution + eval+//! The output handlers check `is_shell_integration_active()` to determine if hints should+//! be suppressed (when shell integration is already configured).//!//! ## Exit Code Semantics//!diff --git a/src/completion.rs b/src/completion.rsindex 30da906de..76288c2ba 100644--- a/src/completion.rs+++ b/src/completion.rs@@ -11,9 +11,6 @@ use crate::display::format_relative_time_short;use worktrunk::config::{ProjectConfig, WorktrunkConfig};use worktrunk::git::{BranchCategory, Repository};-/// Args that should never appear in completions, even when all options are shown.-const COMPLETION_DENYLIST: &[&str] = &["--internal"];-/// Handle shell-initiated completion requests via `COMPLETE=$SHELL wt`pub fn maybe_handle_env_completion() -> bool {let Some(shell_name) = std::env::var_os("COMPLETE") else {@@ -107,15 +104,6 @@ pub fn maybe_handle_env_completion() -> bool {completions};- // Filter out denylisted completions- let filtered: Vec<_> = completions- .into_iter()- .filter(|c| {- let value = c.get_value().to_string_lossy();- !COMPLETION_DENYLIST.contains(&value.as_ref())- })- .collect();-// Write completions in the appropriate format for the shelllet shell_name = shell_name.to_string_lossy();let ifs = std::env::var("_CLAP_IFS").ok();@@ -130,7 +118,7 @@ pub fn maybe_handle_env_completion() -> bool {};let mut stdout = std::io::stdout();- for (i, candidate) in filtered.iter().enumerate() {+ for (i, candidate) in completions.iter().enumerate() {if i != 0 {let _ = write!(stdout, "{}", separator);}@@ -406,7 +394,7 @@ fn hide_non_positional_options_for_completion(cmd: Command) -> Command {};// Hide non-positional args that aren't already hidden.- // Args originally marked hide=true (like --internal) stay hidden always.+ // Args originally marked hide=true stay hidden always.// Args we hide here will appear when completing `--` (all-hidden = all shown).let cmd = cmd.mut_args(|arg| {if arg.is_positional() || arg.is_hide_set() {diff --git a/src/help_pager.rs b/src/help_pager.rsindex d3b3c0000..03b65377d 100644--- a/src/help_pager.rs+++ b/src/help_pager.rs@@ -81,8 +81,8 @@ fn detect_help_pager() -> Option<String> {/// - Pager spawn fails (prints to stderr)////// Note: All fallbacks output to stderr for consistency with pager behavior-/// (which sends output to stderr via `>&2`). This ensures `config show --internal`-/// works correctly in directive mode where stdout is reserved for shell directives.+/// (which sends output to stderr via `>&2`). This ensures `config show`+/// works correctly since stdout is reserved for data output.pub fn show_help_in_pager(help_text: &str) -> std::io::Result<()> {let Some(pager_cmd) = detect_help_pager() else {log::debug!("No pager configured, printing help directly to stderr");@@ -116,6 +116,8 @@ pub fn show_help_in_pager(help_text: &str) -> std::io::Result<()> {// Falls back to direct output if pager unavailable (e.g., less not installed)let shell = ShellConfig::get();let mut cmd = shell.command(&final_cmd);+ // Prevent subprocesses from writing to the directive file+ cmd.env_remove(worktrunk::shell_exec::DIRECTIVE_FILE_ENV_VAR);let mut child = match cmd.stdin(Stdio::piped()).env("LESS", &less_flags).spawn() {Ok(child) => child,Err(e) => {diff --git a/src/llm.rs b/src/llm.rsindex 2fa709406..e36d31027 100644--- a/src/llm.rs+++ b/src/llm.rs@@ -282,7 +282,9 @@ fn execute_llm_command(command: &str, args: &[String], prompt: &str) -> anyhow::cmd.stdin(Stdio::piped()).stdout(Stdio::piped())- .stderr(Stdio::piped());+ .stderr(Stdio::piped())+ // Prevent subprocesses from writing to the directive file+ .env_remove(worktrunk::shell_exec::DIRECTIVE_FILE_ENV_VAR);// Log executionlog::debug!("$ {} {}", command, args.join(" "));diff --git a/src/main.rs b/src/main.rsindex 5f8bee750..550bb140b 100644--- a/src/main.rs+++ b/src/main.rs@@ -556,7 +556,7 @@ fn enhance_and_exit_error(err: clap::Error) -> ! {use color_print::ceprintln;// Enhance `wt switch` missing argument error with shortcut hints.- // Safe in directive mode: hints go to stderr, only stdout is eval'd.+ // Hints go to stderr, which is safe since stdout is reserved for data output.// Check for both "wt switch" and "wt.exe switch" (Windows)let err_str = format!("{err}");let is_switch_missing_arg = err.kind() == ErrorKind::MissingRequiredArgument@@ -608,13 +608,6 @@ fn main() {set_config_path(path);}- // Initialize output context based on --internal flag- let output_mode = match cli.internal {- Some(shell) => output::OutputMode::Directive(shell),- None => output::OutputMode::Interactive,- };- output::initialize(output_mode);-// Configure logging based on --verbose flag or RUST_LOG env varenv_logger::Builder::from_env(env_logger::Env::default().default_filter_or(if cli.verbose { "debug" } else { "off" }),@@ -1130,7 +1123,7 @@ fn main() {},},#[cfg(unix)]- Commands::Select => handle_select(cli.internal.is_some()),+ Commands::Select => handle_select(),Commands::List {subcommand,format,@@ -1240,13 +1233,7 @@ fn main() {)?;// Show success message (temporal locality: immediately after worktree creation)- // Pass cli.internal to indicate whether shell integration is active- handle_switch_output(- &result,- &branch_info,- execute.is_some(),- cli.internal.is_some(),- )?;+ handle_switch_output(&result, &branch_info, execute.is_some())?;// Now spawn post-start hooks (background processes, after success message)// Only run post-start commands when creating a NEW worktree, not when switching to existing@@ -1504,11 +1491,6 @@ fn main() {}),};- // Emit shell script (directive mode) or no-op (interactive mode)- // Must be called before error handling so cd happens even on failure- // (matches shell wrapper behavior which evals script regardless of exit code)- let _ = output::terminate_output();-if let Err(e) = result {// GitError, WorktrunkError, and HookErrorWithHint produce styled output via Displayif let Some(err) = e.downcast_ref::<worktrunk::git::GitError>() {@@ -1549,6 +1531,12 @@ fn main() {// Preserve exit code from child processes (especially for signals like SIGINT)let code = exit_code(&e).unwrap_or(1);++ // Reset ANSI state before exiting+ let _ = output::terminate_output();process::exit(code);}++ // Reset ANSI state before returning to shell (success case)+ let _ = output::terminate_output();}diff --git a/src/output/global.rs b/src/output/global.rsindex dcd9421e3..ee9fc27b9 100644--- a/src/output/global.rs+++ b/src/output/global.rs@@ -1,56 +1,47 @@-//! Global output context with thread-safe mode propagation+//! Global output context with file-based directive passing//!-//! This provides a logging-like API where you configure output mode once-//! at program start, then use it anywhere without passing parameters.+//! This provides a logging-like API where you configure output once+//! at program start, then use output functions anywhere without passing parameters.//!//! # Implementation//!//! Uses a simple global approach:-//! - `OnceLock<OutputMode>` stores the mode globally (set once at startup)-//! - `OnceLock<Mutex<OutputState>>` stores stateful data (target_dir, exec_command)-//! - All output functions check the mode and behave accordingly+//! - `OnceLock<Mutex<OutputState>>` stores the directive file path and accumulated state+//! - If `WORKTRUNK_DIRECTIVE_FILE` env var is set, directives are written to that file+//! - Otherwise, commands execute directly//!-//! # Output Modes+//! # Shell Integration//!-//! - **Interactive**: User messages to stderr, data (JSON) to stdout for piping-//! - **Directive**: All output to stderr, stdout reserved for shell script at end+//! When `WORKTRUNK_DIRECTIVE_FILE` is set (by the shell wrapper), wt writes shell commands+//! (like `cd '/path'`) to that file. The shell wrapper sources the file after wt exits.+//! This allows the parent shell to change directory.//!//! # Trade-offs//!//! - Zero parameter threading - call from anywhere-//! - Single initialization point - set once in main()-//! - Spawned threads automatically use correct mode+//! - Lazy initialization - state initialized on first use+//! - Spawned threads automatically use correct context//! - Simple implementation - no traits, no handler structs+//! - stdout always available for data output (JSON, etc.)#[cfg(not(unix))]use super::handlers::execute_streaming;-use crate::cli::DirectiveShell;+use std::fs::OpenOptions;use std::io::{self, Write};use std::path::Path;use std::path::PathBuf;#[cfg(unix)]use std::process::Stdio;use std::sync::{Mutex, OnceLock};+use worktrunk::shell_exec::DIRECTIVE_FILE_ENV_VAR;#[cfg(unix)]use worktrunk::shell_exec::ShellConfig;use worktrunk::styling::{eprintln, hint_message, stderr};-/// Output mode selection-#[derive(Debug, Clone, Copy)]-pub enum OutputMode {- Interactive,- /// Directive mode with shell type for output formatting- Directive(DirectiveShell),-}--/// Global output mode, set once at initialization.-static GLOBAL_MODE: OnceLock<OutputMode> = OnceLock::new();--/// Accumulated state for change_directory/execute/terminate_output.-/// Only used by main thread - these operations are never called from spawned threads.+/// Global output state, lazily initialized on first access.////// Uses `OnceLock<Mutex<T>>` pattern:-/// - `OnceLock` provides one-time initialization (set in `initialize()`)+/// - `OnceLock` provides one-time lazy initialization (via `get_or_init()`)/// - `Mutex` allows mutation after initialization/// - No unsafe code required///@@ -60,34 +51,47 @@ static OUTPUT_STATE: OnceLock<Mutex<OutputState>> = OnceLock::new();#[derive(Default)]struct OutputState {+ /// Path to the directive file (from WORKTRUNK_DIRECTIVE_FILE env var)+ /// If None, we're in interactive mode (no shell wrapper)+ directive_file: Option<PathBuf>,+ /// Buffered target directory for execute() in interactive modetarget_dir: Option<PathBuf>,- exec_command: Option<String>,}-/// Get the current output mode, defaulting to Interactive if not initialized.-fn get_mode() -> OutputMode {- GLOBAL_MODE- .get()- .copied()- .unwrap_or(OutputMode::Interactive)+/// Get or lazily initialize the global output state.+///+/// Reads `WORKTRUNK_DIRECTIVE_FILE` from environment on first access.+/// Empty or whitespace-only strings are treated as "not set" to handle edge cases.+fn get_state() -> &'static Mutex<OutputState> {+ OUTPUT_STATE.get_or_init(|| {+ let directive_file = std::env::var(DIRECTIVE_FILE_ENV_VAR)+ .ok()+ .filter(|s| !s.trim().is_empty())+ .map(PathBuf::from);++ Mutex::new(OutputState {+ directive_file,+ target_dir: None,+ })+ })}-/// Initialize the global output context-///-/// Call this once at program startup to set the output mode.-/// All threads will automatically use the same mode.-pub fn initialize(mode: OutputMode) {- let _ = GLOBAL_MODE.set(mode);- let _ = OUTPUT_STATE.set(Mutex::new(OutputState::default()));+/// Check if shell integration is active (directive file is set)+fn has_directive_file() -> bool {+ get_state()+ .lock()+ .expect("OUTPUT_STATE lock poisoned")+ .directive_file+ .is_some()}/// Display a shell integration hint////// Shell integration hints like "Run `wt config shell install` to enable automatic cd" are only-/// shown in interactive mode. In directive mode, users already have shell integration.+/// shown when shell integration is NOT active. When it is active, users already have it./// This is the canonical check - call sites don't need to guard.pub fn shell_integration_hint(message: impl Into<String>) -> io::Result<()> {- if matches!(get_mode(), OutputMode::Directive(_)) {+ if has_directive_file() {return Ok(());}eprintln!("{}", hint_message(message.into()));@@ -127,34 +131,24 @@ pub fn blank() -> io::Result<()> {/// Emit structured data output without emoji decoration///-/// Used for JSON, prompts, statuslines, and other pipeable data. Writes directly-/// to stdout/stderr without anstream processing, preserving any ANSI codes.-///-/// - **Interactive**: writes to stdout (for piping to `jq`, `llm`, etc.)-/// - **Directive**: writes to stderr (stdout reserved for shell script)+/// Used for JSON, prompts, statuslines, and other pipeable data. Always writes to stdout.+/// With WORKTRUNK_DIRECTIVE_FILE, stdout is never used for directives, so it's always+/// available for data output.////// Example:/// ```rust,ignore/// output::data(json_string)?;/// ```pub fn data(content: impl Into<String>) -> io::Result<()> {- let content = content.into();- match get_mode() {- OutputMode::Interactive => {- writeln!(io::stdout(), "{content}")?;- io::stdout().flush()- }- OutputMode::Directive(_) => {- writeln!(io::stderr(), "{content}")?;- io::stderr().flush()- }- }+ println!("{}", content.into());+ io::stdout().flush()}-/// Emit table/UI output to stderr+/// Emit primary output to stdout///-/// Used for table rows and progress indicators that should appear on the same-/// stream as progress bars. Both modes write to stderr.+/// Used for the main data a command produces (table rows, formatted output).+/// This is pipeable — `wt list | grep feature` works because table data+/// goes to stdout while progress/warnings go to stderr.////// Example:/// ```rust,ignore@@ -164,50 +158,80 @@ pub fn data(content: impl Into<String>) -> io::Result<()> {/// }/// ```pub fn table(content: impl Into<String>) -> io::Result<()> {- eprintln!("{}", content.into());- stderr().flush()+ println!("{}", content.into());+ io::stdout().flush()+}++/// Write a directive to the directive file (if set)+fn write_directive(directive: &str) -> io::Result<()> {+ // Copy path out of lock to avoid holding mutex during I/O+ let path = {+ let guard = get_state().lock().expect("OUTPUT_STATE lock poisoned");+ guard.directive_file.clone()+ };++ let Some(path) = path else {+ return Ok(());+ };++ let mut file = OpenOptions::new().append(true).open(&path)?;+ writeln!(file, "{}", directive)?;+ file.flush()}/// Request directory change (for shell integration)///-/// In directive mode, buffers the path for the final shell script.-/// In interactive mode, stores path for execute() to use as working directory.-///-/// No-op if called before initialize() - this is safe since main thread-/// operations only happen after initialization.+/// If shell integration is active (WORKTRUNK_DIRECTIVE_FILE set), writes `cd` command to the file.+/// Also stores path for execute() to use as working directory.pub fn change_directory(path: impl AsRef<Path>) -> io::Result<()> {- if let Some(state) = OUTPUT_STATE.get() {- state.lock().expect("OUTPUT_STATE lock poisoned").target_dir =- Some(path.as_ref().to_path_buf());+ let path = path.as_ref();+ let mut guard = get_state().lock().expect("OUTPUT_STATE lock poisoned");++ // Store for execute() to use+ guard.target_dir = Some(path.to_path_buf());++ // Write to directive file if set+ if guard.directive_file.is_some() {+ drop(guard); // Release lock before I/O++ let path_str = path.to_string_lossy();+ // Escape based on shell type. Both shell families use single-quoted strings+ // where contents are literal, but they escape embedded quotes differently:+ // - PowerShell: double the quote ('it''s')+ // - POSIX (bash/zsh/fish): end quote, escaped quote, start quote ('it'\''s')+ let is_powershell = std::env::var("WORKTRUNK_SHELL")+ .map(|v| v.eq_ignore_ascii_case("powershell"))+ .unwrap_or(false);+ let escaped = if is_powershell {+ path_str.replace('\'', "''")+ } else {+ path_str.replace('\'', "'\\''")+ };+ write_directive(&format!("cd '{}'", escaped))?;}+Ok(())}/// Request command execution///-/// In interactive mode, executes the command directly (replacing process on Unix).-/// In directive mode, buffers the command for the final shell script.+/// In interactive mode (no directive file), executes the command directly (replacing process on Unix).+/// In shell integration mode, writes the command to the directive file.pub fn execute(command: impl Into<String>) -> anyhow::Result<()> {let command = command.into();- match get_mode() {- OutputMode::Interactive => {- // Get target directory (lock released before execute to avoid holding across I/O)- let target_dir = OUTPUT_STATE.get().and_then(|s| {- let guard = s.lock().expect("OUTPUT_STATE lock poisoned");- guard.target_dir.clone()- });-- execute_command(command, target_dir.as_deref())- }- OutputMode::Directive(_) => {- if let Some(state) = OUTPUT_STATE.get() {- state- .lock()- .expect("OUTPUT_STATE lock poisoned")- .exec_command = Some(command);- }- Ok(())- }++ let (has_directive, target_dir) = {+ let guard = get_state().lock().expect("OUTPUT_STATE lock poisoned");+ (guard.directive_file.is_some(), guard.target_dir.clone())+ };++ if has_directive {+ // Write to directive file+ write_directive(&command)?;+ Ok(())+ } else {+ // Execute directly+ execute_command(command, target_dir.as_deref())}}@@ -278,51 +302,26 @@ pub fn flush_for_stderr_prompt() -> io::Result<()> {/// Terminate command output///-/// In directive mode, emits the buffered shell script (cd and exec commands) to stdout.-/// In interactive mode, this is a no-op.+/// Resets ANSI state on stderr when shell integration is active.+/// In interactive mode (no shell wrapper), message formatting functions+/// already reset their own styles, so no global reset is needed.pub fn terminate_output() -> io::Result<()> {- match get_mode() {- OutputMode::Interactive => Ok(()),- OutputMode::Directive(shell) => {- let mut stderr = io::stderr();-- // Reset ANSI state before returning to shell- write!(stderr, "{}", anstyle::Reset)?;- stderr.flush()?;-- // Emit shell script to stdout with buffered directives- let mut stdout = io::stdout();-- if let Some(state) = OUTPUT_STATE.get() {- let guard = state.lock().expect("OUTPUT_STATE lock poisoned");-- // cd command- if let Some(ref path) = guard.target_dir {- let path_str = path.to_string_lossy();- match shell {- DirectiveShell::Posix => {- // Always single-quote for consistent cross-platform behavior- // (shell_escape behaves differently on Windows vs Unix)- let escaped = path_str.replace('\'', "'\\''");- writeln!(stdout, "cd '{}'", escaped)?;- }- DirectiveShell::Powershell => {- // PowerShell: double single quotes for escaping- let escaped = path_str.replace('\'', "''");- writeln!(stdout, "Set-Location '{}'", escaped)?;- }- }- }-- // exec command- if let Some(ref cmd) = guard.exec_command {- writeln!(stdout, "{}", cmd)?;- }- }-- stdout.flush()- }+ if !has_directive_file() {+ return Ok(());}++ let mut stderr = io::stderr();++ // Reset ANSI state before returning to shell+ write!(stderr, "{}", anstyle::Reset)?;+ stderr.flush()+}++/// Check if we're in shell integration mode (directive file is set)+///+/// This is useful for handlers that need to know whether shell integration is active.+pub fn is_shell_integration_active() -> bool {+ has_directive_file()}#[cfg(test)]@@ -331,27 +330,18 @@ mod tests {use std::path::PathBuf;#[test]- fn test_initialize_does_not_panic() {- use crate::cli::DirectiveShell;-- // Verify initialize() doesn't panic when called (possibly multiple times in tests).- // Note: GLOBAL_MODE can only be set once per process.- // In production, initialize() is called exactly once.- initialize(OutputMode::Interactive);- initialize(OutputMode::Directive(DirectiveShell::Posix));- initialize(OutputMode::Directive(DirectiveShell::Powershell));+ fn test_lazy_init_does_not_panic() {+ // Verify lazy initialization doesn't panic.+ // State is lazily initialized on first access.+ let _ = has_directive_file();}#[test]- fn test_spawned_thread_uses_correct_mode() {- use crate::cli::DirectiveShell;+ fn test_spawned_thread_uses_correct_state() {use std::sync::mpsc;- // Initialize mode (may already be set by another test, which is fine)- initialize(OutputMode::Directive(DirectiveShell::Posix));-// Spawn a thread and verify it can access output without panicking.- // The thread reads the same GLOBAL_MODE.+ // State is lazily initialized and shared across threads.let (tx, rx) = mpsc::channel();std::thread::spawn(move || {// Access output system in spawned thread@@ -364,7 +354,7 @@ mod tests {rx.recv().unwrap();}- // Shell escaping tests (moved from directive.rs)+ // Shell escaping tests#[test]fn test_shell_script_format() {@@ -396,26 +386,6 @@ mod tests {assert_eq!(cd_cmd, "cd '/test/my path/here'");}- #[test]- fn test_powershell_path_format() {- // PowerShell uses Set-Location and doubles single quotes for escaping- let path = PathBuf::from("C:\\Users\\test\\path");- let path_str = path.to_string_lossy();- let escaped = path_str.replace('\'', "''");- let ps_cmd = format!("Set-Location '{}'", escaped);- assert_eq!(ps_cmd, "Set-Location 'C:\\Users\\test\\path'");- }-- #[test]- fn test_powershell_path_with_single_quotes() {- // PowerShell escapes single quotes by doubling them- let path = PathBuf::from("C:\\Users\\it's a test\\path");- let path_str = path.to_string_lossy();- let escaped = path_str.replace('\'', "''");- let ps_cmd = format!("Set-Location '{}'", escaped);- assert_eq!(ps_cmd, "Set-Location 'C:\\Users\\it''s a test\\path'");- }-/// Test that anstyle formatting is preserved#[test]fn test_success_preserves_anstyle() {diff --git a/src/output/handlers.rs b/src/output/handlers.rsindex 040eb977a..765d67aad 100644--- a/src/output/handlers.rs+++ b/src/output/handlers.rs@@ -21,7 +21,7 @@ use worktrunk::styling::{/// Format a switch message with a consistent location phrase///-/// Both interactive and directive modes now use the human-friendly+/// Both modes (with and without shell integration) use the human-friendly/// `"Created new worktree for {branch} from {base} @ {path}"` wording so/// users see the same message regardless of how worktrunk is invoked.///@@ -353,13 +353,12 @@ fn shell_integration_hint() -> String {/// Handle output for a switch operation///-/// `is_directive_mode` indicates whether shell integration is active (via --internal flag).-/// When false, we show warnings for operations that can't complete without shell integration.+/// When shell integration is not active and no execute command is provided,+/// we show warnings for operations that can't complete without shell integration.pub fn handle_switch_output(result: &SwitchResult,branch_info: &SwitchBranchInfo,has_execute_command: bool,- is_directive_mode: bool,) -> anyhow::Result<()> {// Set target directory for command executionsuper::change_directory(result.path())?;@@ -368,6 +367,9 @@ pub fn handle_switch_output(let path_display = format_path_for_display(path);let branch = branch_info.branch();+ // Check if shell integration is active (directive file set)+ let is_shell_integration_active = super::is_shell_integration_active();+// Show path mismatch warning after the main messagelet path_mismatch_warning = branch_info.expected_path.as_ref().map(|expected| {let expected_display = format_path_for_display(expected);@@ -386,7 +388,7 @@ pub fn handle_switch_output(}}SwitchResult::Existing(_) => {- if is_directive_mode || has_execute_command {+ if is_shell_integration_active || has_execute_command {super::print(info_message(format_switch_message(branch, path, false, None, None,)))?;@@ -428,7 +430,7 @@ pub fn handle_switch_output(base_branch.as_deref(),from_remote.as_deref(),)))?;- // Show setup hint if no execute command (hint suppressed in directive mode)+ // Show setup hint if no execute command (hint suppressed when shell integration is active)if !has_execute_command {super::shell_integration_hint(shell_integration_hint())?;}@@ -827,7 +829,7 @@ pub(crate) fn execute_streaming(// Determine stdout handling based on redirect flag// When redirecting, use Stdio::from(stderr) to redirect child stdout to our stderr at OS level.- // This keeps stdout clean for directive scripts while hook output goes to stderr.+ // This keeps stdout reserved for data output while hook output goes to stderr.// Previously used shell-level `{ cmd } 1>&2` wrapping, but OS-level redirect is simpler// and may improve signal handling by removing an extra shell process layer.let stdout_mode = if redirect_stdout_to_stderr {@@ -853,6 +855,8 @@ pub(crate) fn execute_streaming(// Prevent vergen "overridden" warning in nested cargo builds when run via `cargo run`.// Add more VERGEN_* variables here if we expand build.rs and hit similar issues..env_remove("VERGEN_GIT_DESCRIBE")+ // Prevent hooks from writing to the directive file+ .env_remove(worktrunk::shell_exec::DIRECTIVE_FILE_ENV_VAR).spawn().map_err(|e| {anyhow::Error::from(worktrunk::git::GitError::Other {diff --git a/src/output/mod.rs b/src/output/mod.rsindex 83fea126b..ff146c48b 100644--- a/src/output/mod.rs+++ b/src/output/mod.rs@@ -3,59 +3,36 @@//! # 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: `print()`, `change_directory()`, `execute()`, etc.+//! State is lazily initialized on first use — no explicit initialization required.//!-//! ## Design-//!-//! **Global state** with `OnceLock`:-//!-//! ```rust,ignore-//! static GLOBAL_MODE: OnceLock<OutputMode> = OnceLock::new();-//! static OUTPUT_STATE: OnceLock<Mutex<OutputState>> = OnceLock::new();-//! ```-//!-//! The mode is set once at initialization and readable by all threads.-//! State (target_dir, exec_command) is stored globally for main thread operations.-//!-//! All output functions check the mode directly - no handler structs or traits.-//!-//! ## Usage Pattern+//! ## Usage//!//! ```rust,ignore//! use worktrunk::styling::{success_message, error_message, hint_message};//!-//! // 1. Initialize once in main()-//! let mode = if internal {-//! OutputMode::Directive(shell)-//! } else {-//! OutputMode::Interactive-//! };-//! output::initialize(mode);-//!-//! // 2. Use anywhere in the codebase//! output::print(success_message("Operation complete"));//! output::change_directory(&path);//! output::execute("git pull");-//! output::flush();//! ```//!-//! ## Output Modes+//! ## Shell Integration+//!+//! When `WORKTRUNK_DIRECTIVE_FILE` env var is set (by shell wrapper):+//! - Shell commands (cd, exec) are written to that file+//! - Shell wrapper sources the file after wt exits+//! - This allows the parent shell to change directory//!-//! - **Interactive**: Colors, emojis, shell hints, direct command execution-//! - Messages to stderr, data (JSON) to stdout for piping-//! - **Directive**: Shell script protocol for shell integration-//! - All messages to stderr, stdout reserved for shell script at end-//! - stdout: Shell script emitted at end (e.g., `cd '/path'`)-//! - stderr: Success messages, progress updates, warnings (streams in real-time)+//! When not set (direct binary call):+//! - Commands execute directly+//! - Shell hints are shown for missing integrationmod global;pub mod handlers;// Re-export the public APIpub use global::{- OutputMode, blank, change_directory, data, execute, flush, flush_for_stderr_prompt, gutter,- initialize, print, shell_integration_hint, table, terminate_output,+ blank, change_directory, data, execute, flush, flush_for_stderr_prompt, gutter,+ is_shell_integration_active, print, shell_integration_hint, table, terminate_output,};// Re-export output handlerspub use handlers::{diff --git a/src/shell.rs b/src/shell.rsindex 856df0cde..cb0e0bb3b 100644--- a/src/shell.rs+++ b/src/shell.rs@@ -425,6 +425,8 @@ pub fn detect_zsh_compinit() -> Option<bool> {.arg(probe_cmd).stdout(Stdio::piped()).stderr(Stdio::null()) // Suppress user's zsh startup messages+ // Prevent subprocesses from writing to the directive file+ .env_remove(crate::shell_exec::DIRECTIVE_FILE_ENV_VAR).spawn().ok()?;diff --git a/src/shell_exec.rs b/src/shell_exec.rsindex 2d497b367..ae3f05e71 100644--- a/src/shell_exec.rs+++ b/src/shell_exec.rs@@ -199,11 +199,18 @@ fn find_git_bash() -> Option<PathBuf> {None}+/// Environment variable removed from spawned subprocesses for security.+/// Hooks and other child processes should not be able to write to the directive file.+pub const DIRECTIVE_FILE_ENV_VAR: &str = "WORKTRUNK_DIRECTIVE_FILE";+/// Execute a command with timing and debug logging.////// This is the **only** way to run external commands in worktrunk. All command execution/// must go through this function to ensure consistent logging and tracing.///+/// The `WORKTRUNK_DIRECTIVE_FILE` environment variable is automatically removed from spawned+/// processes to prevent hooks from discovering and writing to the directive file.+////// ```text/// $ git status [worktree-name] # with context/// $ gh pr list # without context@@ -215,6 +222,9 @@ fn find_git_bash() -> Option<PathBuf> {pub fn run(cmd: &mut Command, context: Option<&str>) -> std::io::Result<std::process::Output> {use std::time::Instant;+ // Remove WORKTRUNK_DIRECTIVE_FILE to prevent hooks from writing to it+ cmd.env_remove(DIRECTIVE_FILE_ENV_VAR);+// Build command string for logginglet program = cmd.get_program().to_string_lossy();let args: Vec<_> = cmd.get_args().map(|a| a.to_string_lossy()).collect();diff --git a/src/styling/mod.rs b/src/styling/mod.rsindex 42ee00239..aa38a65d4 100644--- a/src/styling/mod.rs+++ b/src/styling/mod.rs@@ -7,11 +7,11 @@//!//! ## stdout vs stderr principle//!-//! - **stdout**: ALL worktrunk output (messages, errors, warnings, directives, data)-//! - **stderr**: ALL child process output (git, npm, user commands)-//! - **Exception**: Interactive prompts use stderr so they appear even when stdout is redirected+//! - **stdout**: Primary data output (table data, JSON, statusline)+//! - **stderr**: Status messages (progress, success, errors, hints, warnings)//!-//! Use `println!` for all worktrunk messages. Use `eprintln!` only for interactive prompts.+//! This separation allows piping (`wt list | grep foo`) without status messages interfering.+//! Use `output::table()` for primary output, `output::print()` for status messages.mod constants;mod format;@@ -42,10 +42,10 @@ const DEFAULT_TERMINAL_WIDTH: usize = 80;/// Prefers direct terminal size detection over COLUMNS environment variable,/// because tools like cargo may set COLUMNS incorrectly.///-/// Checks stderr first since that's where table output goes, then stdout.+/// Checks stderr first (for status messages), then stdout (for table output).pub fn get_terminal_width() -> usize {// Prefer direct terminal detection (more accurate than COLUMNS which may be stale/wrong)- // Check stderr first (where table output goes), then stdout+ // Check stderr first (status messages), then stdout (table output)if let Some((terminal_size::Width(w), _)) =terminal_size::terminal_size_of(std::io::stderr()).or_else(terminal_size::terminal_size){diff --git a/templates/bash.sh b/templates/bash.shindex 91540a2b3..d1f802952 100644--- a/templates/bash.sh+++ b/templates/bash.sh@@ -5,7 +5,7 @@ if command -v {{ cmd }} >/dev/null 2>&1 || [[ -n "${WORKTRUNK_BIN:-}" ]]; then{{ posix_shim }}- # Override {{ cmd }} command to add --internal flag+ # Override {{ cmd }} command{{ cmd }}() {local use_source=falselocal args=()@@ -14,10 +14,10 @@ if command -v {{ cmd }} >/dev/null 2>&1 || [[ -n "${WORKTRUNK_BIN:-}" ]]; thenif [[ "$arg" == "--source" ]]; then use_source=true; else args+=("$arg"); fidone- # Completion mode: call binary directly, bypassing --internal and wt_exec.+ # Completion mode: call binary directly, bypassing wt_exec.# This check MUST be here (not in the binary) because clap's completion- # handler runs before argument parsing - we can't detect --internal there.- # The binary outputs completion candidates, not shell script to eval.+ # handler runs before argument parsing.+ # The binary outputs completion candidates, not directives to source.if [[ -n "${COMPLETE:-}" ]]; thencommand "${WORKTRUNK_BIN:-{{ cmd }}}" "${args[@]}"return@@ -25,18 +25,22 @@ if command -v {{ cmd }} >/dev/null 2>&1 || [[ -n "${WORKTRUNK_BIN:-}" ]]; then# --source: use cargo run (builds from source)if [[ "$use_source" == true ]]; then+ # If stdout is not a terminal (piped/redirected), run directly.+ # This allows `wt list --format=json | jq` to work.if [[ ! -t 1 ]]; thencargo run --bin {{ cmd }} --quiet -- "${args[@]}"returnfi- local script exit_code=0- script="$(cargo run --bin {{ cmd }} --quiet -- --internal "${args[@]}")" || exit_code=$?- if [[ -n "$script" ]]; then- eval "$script"+ local directive_file exit_code=0+ directive_file="$(mktemp)"+ WORKTRUNK_DIRECTIVE_FILE="$directive_file" cargo run --bin {{ cmd }} --quiet -- "${args[@]}" || exit_code=$?+ if [[ -s "$directive_file" ]]; then+ source "$directive_file"if [[ $exit_code -eq 0 ]]; thenexit_code=$?fifi+ rm -f "$directive_file"return "$exit_code"fi@@ -47,7 +51,7 @@ if command -v {{ cmd }} >/dev/null 2>&1 || [[ -n "${WORKTRUNK_BIN:-}" ]]; thenreturnfi- wt_exec --internal "${args[@]}"+ wt_exec "${args[@]}"}# Lazy completions - generate on first TAB, then delegate to clap's completerdiff --git a/templates/fish.fish b/templates/fish.fishindex 047de251a..1ad8f0d99 100644--- a/templates/fish.fish+++ b/templates/fish.fish@@ -2,32 +2,33 @@# Only initialize if {{ cmd }} is available (in PATH or via WORKTRUNK_BIN)if type -q {{ cmd }}; or test -n "$WORKTRUNK_BIN"- # Capture stdout (shell script), eval in parent shell. stderr streams to terminal.+ # Execute wt command with file-based directive passing.+ # Creates a temp file, passes path via WORKTRUNK_DIRECTIVE_FILE, evals it after.# WORKTRUNK_BIN can override the binary path (for testing dev builds).#- # We use pipeline capture (`| read`) instead of command substitution (`(...)`)- # because fish's command substitution runs in its own pipeline where stderr- # doesn't inherit caller redirects. With pipeline capture, stderr flows through- # normally and respects redirects like `wt --help &>file`.+ # Note: We use `eval (cat ... | string collect)` instead of `source` because:+ # 1. fish's `source` doesn't propagate `exit` to the parent function+ # 2. `eval (cat ...)` without `string collect` splits on newlines, breaking multiline directives+ # With `string collect`, `exit 42` properly exits the function with code 42.function wt_exectest -n "$WORKTRUNK_BIN"; or set -l WORKTRUNK_BIN (type -P {{ cmd }})- # Pipeline capture: stderr streams through, stdout captured via read- # -z (null delimiter) ensures we capture all lines, not just the first- command $WORKTRUNK_BIN $argv | string collect --allow-empty | read --local -z script- set -l exit_code $pipestatus[1]+ set -l directive_file (mktemp)+ WORKTRUNK_DIRECTIVE_FILE=$directive_file command $WORKTRUNK_BIN $argv+ set -l exit_code $status- if test -n "$script"- eval $script+ if test -s "$directive_file"+ eval (cat "$directive_file" | string collect)if test $exit_code -eq 0set exit_code $statusendend+ rm -f "$directive_file"return $exit_codeend- # Override {{ cmd }} command to add --internal flag+ # Override {{ cmd }} commandfunction {{ cmd }}set -l use_source falseset -l args@@ -38,18 +39,22 @@ if type -q {{ cmd }}; or test -n "$WORKTRUNK_BIN"# --source: use cargo run (builds from source)if test $use_source = true+ # If stdout is not a terminal (piped/redirected), run directly.+ # This allows `wt list --format=json | jq` to work.if not isatty stdoutcargo run --bin {{ cmd }} --quiet -- $argsreturn $statusend- cargo run --bin {{ cmd }} --quiet -- --internal $args | string collect --allow-empty | read --local -z script- set -l exit_code $pipestatus[1]- if test -n "$script"- eval $script+ set -l directive_file (mktemp)+ WORKTRUNK_DIRECTIVE_FILE=$directive_file cargo run --bin {{ cmd }} --quiet -- $args+ set -l exit_code $status+ if test -s "$directive_file"+ eval (cat "$directive_file" | string collect)if test $exit_code -eq 0set exit_code $statusendend+ rm -f "$directive_file"return $exit_codeend@@ -61,7 +66,7 @@ if type -q {{ cmd }}; or test -n "$WORKTRUNK_BIN"return $statusend- wt_exec --internal $args+ wt_exec $argsend# Completions are in ~/.config/fish/completions/wt.fish (installed by `wt config shell install`)diff --git a/templates/posix_directives.sh b/templates/posix_directives.shindex 0e9579087..190cb4ba6 100644--- a/templates/posix_directives.sh+++ b/templates/posix_directives.sh@@ -1,15 +1,19 @@-# Capture stdout (shell script), eval in parent shell. stderr streams to terminal.+# Execute wt command with file-based directive passing.+# Creates a temp file, passes path via WORKTRUNK_DIRECTIVE_FILE, sources it after.# WORKTRUNK_BIN can override the binary path (for testing dev builds).wt_exec() {- local script exit_code=0- script="$(command "${WORKTRUNK_BIN:-{{ cmd }}}" "$@")" || exit_code=$?+ local directive_file exit_code=0+ directive_file="$(mktemp)"- if [[ -n "$script" ]]; then- eval "$script"+ WORKTRUNK_DIRECTIVE_FILE="$directive_file" command "${WORKTRUNK_BIN:-{{ cmd }}}" "$@" || exit_code=$?++ if [[ -s "$directive_file" ]]; then+ source "$directive_file"if [[ $exit_code -eq 0 ]]; thenexit_code=$?fifi+ rm -f "$directive_file"return "$exit_code"}diff --git a/templates/powershell.ps1 b/templates/powershell.ps1index b385e6b6e..a3e60ff64 100644--- a/templates/powershell.ps1+++ b/templates/powershell.ps1@@ -8,7 +8,7 @@# Only initialize if wt is availableif (Get-Command {{ cmd }} -ErrorAction SilentlyContinue) {- # wt wrapper function - captures stdout and executes as PowerShell+ # wt wrapper function - uses temp file for directivesfunction {{ cmd }} {param([Parameter(ValueFromRemainingArguments = $true)]@@ -25,16 +25,38 @@ if (Get-Command {{ cmd }} -ErrorAction SilentlyContinue) {return $LASTEXITCODE}- # Run wt with --internal=powershell- # stdout is captured for Invoke-Expression (contains Set-Location directives)- # stderr passes through to console in real-time (user messages, progress, errors)- # Note: We do NOT use 2>&1 as that would merge stderr into the script variable- $script = & $wtBin --internal=powershell @Arguments | Out-String- $exitCode = $LASTEXITCODE+ $directiveFile = [System.IO.Path]::GetTempFileName()- # Execute the directive script (e.g., Set-Location) if command succeeded- if ($exitCode -eq 0 -and $script.Trim()) {- Invoke-Expression $script+ try {+ # Run wt with WORKTRUNK_DIRECTIVE_FILE env var+ # WORKTRUNK_SHELL tells the binary to use PowerShell-compatible escaping+ # stdout and stderr both go to console normally+ $env:WORKTRUNK_DIRECTIVE_FILE = $directiveFile+ $env:WORKTRUNK_SHELL = "powershell"+ & $wtBin @Arguments+ $exitCode = $LASTEXITCODE+ }+ finally {+ Remove-Item Env:\WORKTRUNK_DIRECTIVE_FILE -ErrorAction SilentlyContinue+ Remove-Item Env:\WORKTRUNK_SHELL -ErrorAction SilentlyContinue+ }++ # Execute the directive script if it has content+ try {+ if ((Test-Path $directiveFile) -and (Get-Item $directiveFile).Length -gt 0) {+ $script = Get-Content -Path $directiveFile -Raw+ if ($script.Trim()) {+ Invoke-Expression $script+ # If wt succeeded, use the directive script's exit code+ if ($exitCode -eq 0) {+ $exitCode = $LASTEXITCODE+ }+ }+ }+ }+ finally {+ # Cleanup even if Invoke-Expression throws+ Remove-Item $directiveFile -ErrorAction SilentlyContinue}# Propagate exit code so $? and $LASTEXITCODE are consistent for scripts/CIdiff --git a/templates/zsh.zsh b/templates/zsh.zshindex bcaa7b139..807a50bdd 100644--- a/templates/zsh.zsh+++ b/templates/zsh.zsh@@ -8,7 +8,7 @@ if command -v {{ cmd }} >/dev/null 2>&1 || [[ -n "${WORKTRUNK_BIN:-}" ]]; then{{ posix_shim }}- # Override {{ cmd }} command to add --internal flag+ # Override {{ cmd }} command{{ cmd }}() {local use_source=falselocal -a args@@ -17,10 +17,10 @@ if command -v {{ cmd }} >/dev/null 2>&1 || [[ -n "${WORKTRUNK_BIN:-}" ]]; thenif [[ "$arg" == "--source" ]]; then use_source=true; else args+=("$arg"); fidone- # Completion mode: call binary directly, bypassing --internal and wt_exec.+ # Completion mode: call binary directly, bypassing wt_exec.# This check MUST be here (not in the binary) because clap's completion- # handler runs before argument parsing - we can't detect --internal there.- # The binary outputs completion candidates, not shell script to eval.+ # handler runs before argument parsing.+ # The binary outputs completion candidates, not directives to source.if [[ -n "${COMPLETE:-}" ]]; thencommand "${WORKTRUNK_BIN:-{{ cmd }}}" "${args[@]}"return@@ -28,18 +28,22 @@ if command -v {{ cmd }} >/dev/null 2>&1 || [[ -n "${WORKTRUNK_BIN:-}" ]]; then# --source: use cargo run (builds from source)if [[ "$use_source" == true ]]; then+ # If stdout is not a terminal (piped/redirected), run directly.+ # This allows `wt list --format=json | jq` to work.if [[ ! -t 1 ]]; thencargo run --bin {{ cmd }} --quiet -- "${args[@]}"returnfi- local script exit_code=0- script="$(cargo run --bin {{ cmd }} --quiet -- --internal "${args[@]}")" || exit_code=$?- if [[ -n "$script" ]]; then- eval "$script"+ local directive_file exit_code=0+ directive_file="$(mktemp)"+ WORKTRUNK_DIRECTIVE_FILE="$directive_file" cargo run --bin {{ cmd }} --quiet -- "${args[@]}" || exit_code=$?+ if [[ -s "$directive_file" ]]; then+ source "$directive_file"if [[ $exit_code -eq 0 ]]; thenexit_code=$?fifi+ rm -f "$directive_file"return "$exit_code"fi@@ -50,7 +54,7 @@ if command -v {{ cmd }} >/dev/null 2>&1 || [[ -n "${WORKTRUNK_BIN:-}" ]]; thenreturnfi- wt_exec --internal "${args[@]}"+ wt_exec "${args[@]}"}# Lazy completions - generate on first TAB, then delegate to clap's completerdiff --git a/tests/common/mod.rs b/tests/common/mod.rsindex a9b7f4e9e..7b7cfc38f 100644--- a/tests/common/mod.rs+++ b/tests/common/mod.rs@@ -617,6 +617,35 @@ pub fn configure_cli_command(cmd: &mut Command) {}}+/// Create a temporary file for directive output.+///+/// The shell wrapper sets WORKTRUNK_DIRECTIVE_FILE to a temp file before running wt.+/// Use `configure_directive_file()` to set this on a Command for testing.+///+/// Returns a tuple of (path, guard). The guard must be kept alive for the duration+/// of the test - when dropped, the temp file is cleaned up.+pub fn directive_file() -> (PathBuf, tempfile::TempPath) {+ // Create temp file that persists until guard is dropped+ let file = tempfile::NamedTempFile::new().expect("failed to create temp file");++ // Get the path before we persist+ let path = file.path().to_path_buf();++ // Convert to TempPath - file persists until TempPath is dropped+ let guard = file.into_temp_path();++ (path, guard)+}++/// Configure a Command to use directive file mode.+///+/// Sets the WORKTRUNK_DIRECTIVE_FILE environment variable to the given path.+/// The wt binary will write shell directives (like cd) to this file instead of+/// executing them directly.+pub fn configure_directive_file(cmd: &mut Command, path: &Path) {+ cmd.env("WORKTRUNK_DIRECTIVE_FILE", path);+}+/// Configure a PTY CommandBuilder with isolated environment for testing.////// This is the PTY equivalent of `configure_cli_command()`. It:@@ -1743,6 +1772,7 @@ exit 1pub fn add_standard_env_redactions(settings: &mut insta::Settings) {settings.add_redaction(".env.GIT_CONFIG_GLOBAL", "[TEST_GIT_CONFIG]");settings.add_redaction(".env.WORKTRUNK_CONFIG_PATH", "[TEST_CONFIG]");+ settings.add_redaction(".env.WORKTRUNK_DIRECTIVE_FILE", "[DIRECTIVE_FILE]");settings.add_redaction(".env.HOME", "[TEST_HOME]");// Windows: the `home` crate uses USERPROFILE for home_dir()settings.add_redaction(".env.USERPROFILE", "[TEST_HOME]");@@ -2012,7 +2042,7 @@ pub fn setup_temp_snapshot_settings(temp_path: &std::path::Path) -> insta::Setti/// * `subcommand` - The subcommand to run (e.g., "switch", "remove")/// * `args` - Arguments to pass after the subcommand/// * `cwd` - Optional working directory (defaults to repo root)-/// * `global_flags` - Optional global flags to pass before the subcommand (e.g., &["--internal"])+/// * `global_flags` - Optional global flags to pass before the subcommand (e.g., &["--verbose"])pub fn make_snapshot_cmd_with_global_flags(repo: &TestRepo,subcommand: &str,diff --git a/tests/integration_tests/bare_repository.rs b/tests/integration_tests/bare_repository.rsindex 1e321d9d8..e6947995d 100644--- a/tests/integration_tests/bare_repository.rs+++ b/tests/integration_tests/bare_repository.rs@@ -1,5 +1,6 @@use crate::common::{- TestRepo, canonicalize, repo, setup_temp_snapshot_settings, wait_for_file, wt_command,+ TestRepo, canonicalize, configure_directive_file, directive_file, repo,+ setup_temp_snapshot_settings, wait_for_file, wt_command,};use insta_cmd::assert_cmd_snapshot;use rstest::rstest;@@ -201,12 +202,12 @@ fn test_bare_repo_list_shows_no_bare_entry() {cmd.arg("list").current_dir(&main_worktree);let output = cmd.output().unwrap();- let stderr = String::from_utf8_lossy(&output.stderr);+ let stdout = String::from_utf8_lossy(&output.stdout);- // Should only show the main worktree, not the bare repo (table output is on stderr)- assert!(stderr.contains("main"));- assert!(!stderr.contains(".git"));- assert!(!stderr.contains("bare"));+ // Should only show the main worktree, not the bare repo (table output is on stdout)+ assert!(stdout.contains("main"));+ assert!(!stdout.contains(".git"));+ assert!(!stdout.contains("bare"));}#[test]@@ -219,9 +220,11 @@ fn test_bare_repo_switch_creates_worktree() {// Run wt switch --create to create a new worktree// Config uses {{ branch }} template, so worktrees are created inside bare repo+ let (directive_path, _guard) = directive_file();let mut cmd = wt_command();test.configure_wt_cmd(&mut cmd);- cmd.args(["switch", "--create", "feature", "--internal"])+ configure_directive_file(&mut cmd, &directive_path);+ cmd.args(["switch", "--create", "feature"]).current_dir(&main_worktree);let output = cmd.output().unwrap();@@ -270,9 +273,11 @@ fn test_bare_repo_switch_with_configured_naming() {test.commit_in_worktree(&main_worktree, "Initial commit");// Config uses "{{ branch }}" template, so worktrees are created inside bare repo+ let (directive_path, _guard) = directive_file();let mut cmd = wt_command();test.configure_wt_cmd(&mut cmd);- cmd.args(["switch", "--create", "feature", "--internal"])+ configure_directive_file(&mut cmd, &directive_path);+ cmd.args(["switch", "--create", "feature"]).current_dir(&main_worktree);let output = cmd.output().unwrap();@@ -306,9 +311,11 @@ fn test_bare_repo_remove_worktree() {test.commit_in_worktree(&feature_worktree, "Feature work");// Remove feature worktree from main worktree+ let (directive_path, _guard) = directive_file();let mut cmd = wt_command();test.configure_wt_cmd(&mut cmd);- cmd.args(["remove", "feature", "--no-background", "--internal"])+ configure_directive_file(&mut cmd, &directive_path);+ cmd.args(["remove", "feature", "--no-background"]).current_dir(&main_worktree);let output = cmd.output().unwrap();@@ -348,11 +355,11 @@ fn test_bare_repo_identifies_primary_correctly() {cmd.arg("list").current_dir(&main_worktree);let output = cmd.output().unwrap();- let stderr = String::from_utf8_lossy(&output.stderr);+ let stdout = String::from_utf8_lossy(&output.stdout);- // First non-bare worktree (main) should be primary (table output is on stderr)+ // First non-bare worktree (main) should be primary (table output is on stdout)// The exact formatting may vary, but main should be listed- assert!(stderr.contains("main"));+ assert!(stdout.contains("main"));}#[test]@@ -365,9 +372,11 @@ fn test_bare_repo_worktree_base_used_for_paths() {// Create new worktree - config uses {{ branch }} template// Worktrees are created inside the bare repo directory+ let (directive_path, _guard) = directive_file();let mut cmd = wt_command();test.configure_wt_cmd(&mut cmd);- cmd.args(["switch", "--create", "dev", "--internal"])+ configure_directive_file(&mut cmd, &directive_path);+ cmd.args(["switch", "--create", "dev"]).current_dir(&main_worktree);cmd.output().unwrap();@@ -421,13 +430,13 @@ worktree-path = "{{ branch }}"let bare_output = bare_list.output().unwrap();let normal_output = normal_list.output().unwrap();- // Both should show 1 worktree (main/main) - table output is on stderr- let bare_stderr = String::from_utf8_lossy(&bare_output.stderr);- let normal_stderr = String::from_utf8_lossy(&normal_output.stderr);+ // Both should show 1 worktree (main/main) - table output is on stdout+ let bare_stdout = String::from_utf8_lossy(&bare_output.stdout);+ let normal_stdout = String::from_utf8_lossy(&normal_output.stdout);- assert!(bare_stderr.contains("main"));- assert!(normal_stderr.contains("main"));- assert_eq!(bare_stderr.lines().count(), normal_stderr.lines().count());+ assert!(bare_stdout.contains("main"));+ assert!(normal_stdout.contains("main"));+ assert_eq!(bare_stdout.lines().count(), normal_stdout.lines().count());}#[test]@@ -453,11 +462,11 @@ fn test_bare_repo_commands_from_bare_directory() {);}- let stderr = String::from_utf8_lossy(&output.stderr);+ let stdout = String::from_utf8_lossy(&output.stdout);- // Should list the worktree even when run from bare repo (table output is on stderr)- assert!(stderr.contains("main"), "Should show main worktree");- assert!(!stderr.contains("bare"), "Should not show bare repo itself");+ // Should list the worktree even when run from bare repo (table output is on stdout)+ assert!(stdout.contains("main"), "Should show main worktree");+ assert!(!stdout.contains("bare"), "Should not show bare repo itself");}/// Test that merge workflow works correctly with bare repositories.@@ -475,9 +484,11 @@ fn test_bare_repo_merge_workflow() {// Create feature branch worktree using wt switch// Config uses {{ branch }} template, so worktrees are inside bare repo+ let (directive_path, _guard) = directive_file();let mut cmd = wt_command();test.configure_wt_cmd(&mut cmd);- cmd.args(["switch", "--create", "feature", "--internal"])+ configure_directive_file(&mut cmd, &directive_path);+ cmd.args(["switch", "--create", "feature"]).current_dir(&main_worktree);cmd.output().unwrap();@@ -489,14 +500,15 @@ fn test_bare_repo_merge_workflow() {test.commit_in_worktree(&feature_worktree, "Feature work");// Merge feature into main (explicitly specify target)+ let (directive_path, _guard) = directive_file();let mut cmd = wt_command();test.configure_wt_cmd(&mut cmd);+ configure_directive_file(&mut cmd, &directive_path);cmd.args(["merge","main", // Explicitly specify target branch"--no-squash", // Skip squash to avoid LLM dependency"--no-verify", // Skip pre-merge hooks- "--internal",]).current_dir(&feature_worktree);@@ -554,10 +566,11 @@ fn test_bare_repo_background_logs_location() {test.commit_in_worktree(&feature_worktree, "Feature work");// Run remove in background to test log file location+ let (directive_path, _guard) = directive_file();let mut cmd = wt_command();test.configure_wt_cmd(&mut cmd);- cmd.args(["remove", "feature", "--internal"])- .current_dir(&main_worktree);+ configure_directive_file(&mut cmd, &directive_path);+ cmd.args(["remove", "feature"]).current_dir(&main_worktree);let output = cmd.output().unwrap();diff --git a/tests/integration_tests/column_alignment_verification.rs b/tests/integration_tests/column_alignment_verification.rsindex d9792dfb8..762ce89a7 100644--- a/tests/integration_tests/column_alignment_verification.rs+++ b/tests/integration_tests/column_alignment_verification.rs@@ -331,7 +331,7 @@ fn test_alignment_verification_with_varying_content(mut repo: TestRepo) {cmd.arg("list").current_dir(repo.root_path());let output = cmd.output().unwrap();- let stdout = String::from_utf8_lossy(&output.stderr);+ let stdout = String::from_utf8_lossy(&output.stdout);println!("=== RAW OUTPUT ===");println!("{}", stdout);@@ -359,7 +359,7 @@ fn test_alignment_with_unicode_content(mut repo: TestRepo) {cmd.arg("list").current_dir(repo.root_path());let output = cmd.output().unwrap();- let stdout = String::from_utf8_lossy(&output.stderr);+ let stdout = String::from_utf8_lossy(&output.stdout);println!("=== RAW OUTPUT WITH UNICODE ===");println!("{}", stdout);@@ -395,7 +395,7 @@ fn test_alignment_with_sparse_columns(mut repo: TestRepo) {cmd.arg("list").current_dir(repo.root_path());let output = cmd.output().unwrap();- let stdout = String::from_utf8_lossy(&output.stderr);+ let stdout = String::from_utf8_lossy(&output.stdout);println!("=== RAW OUTPUT WITH SPARSE COLUMNS ===");println!("{}", stdout);@@ -443,7 +443,7 @@ fn test_alignment_real_world_scenario(mut repo: TestRepo) {cmd.arg("list").current_dir(repo.root_path());let output = cmd.output().unwrap();- let stdout = String::from_utf8_lossy(&output.stderr);+ let stdout = String::from_utf8_lossy(&output.stdout);println!("=== RAW OUTPUT: Real World Scenario ===");println!("{}", stdout);@@ -475,7 +475,7 @@ fn test_alignment_at_different_terminal_widths(mut repo: TestRepo) {.env("COLUMNS", width.to_string());let output = cmd.output().unwrap();- let stdout = String::from_utf8_lossy(&output.stderr);+ let stdout = String::from_utf8_lossy(&output.stdout);println!("{}", stdout);diff --git a/tests/integration_tests/completion.rs b/tests/integration_tests/completion.rsindex 324c8586a..5df8b77f4 100644--- a/tests/integration_tests/completion.rs+++ b/tests/integration_tests/completion.rs@@ -1235,54 +1235,6 @@ fn test_complete_version_flag_all_shells(repo: TestRepo) {}}-/// Verify --internal never appears in completions across all supported shells.-///-/// The --internal flag is used by shell wrappers and should never be exposed to users.-/// This is a regression test for a bug where global hidden args would appear in completions-/// due to clap's "all hidden = all shown" behavior when completing `--`.-#[rstest]-fn test_complete_internal_flag_never_shown(repo: TestRepo) {- repo.commit("initial");-- for shell in ["bash", "zsh", "fish"] {- // Test: wt --<cursor> - should NOT show --internal- let output = repo- .completion_cmd_for_shell(&["wt", "--"], shell)- .output()- .unwrap();- assert!(output.status.success(), "{shell}: completion failed");- let stdout = String::from_utf8_lossy(&output.stdout);- assert!(- !stdout.contains("--internal"),- "{shell}: --internal should NEVER appear in completions, got:\n{stdout}"- );-- // Test: wt config --<cursor> - should NOT show --internal on subcommands either- let output = repo- .completion_cmd_for_shell(&["wt", "config", "--"], shell)- .output()- .unwrap();- assert!(output.status.success(), "{shell}: completion failed");- let stdout = String::from_utf8_lossy(&output.stdout);- assert!(- !stdout.contains("--internal"),- "{shell}: --internal should NEVER appear in subcommand completions, got:\n{stdout}"- );-- // Test: wt -<cursor> - should NOT show --internal even with single dash- let output = repo- .completion_cmd_for_shell(&["wt", "-"], shell)- .output()- .unwrap();- assert!(output.status.success(), "{shell}: completion failed");- let stdout = String::from_utf8_lossy(&output.stdout);- assert!(- !stdout.contains("--internal"),- "{shell}: --internal should NEVER appear in single-dash completions, got:\n{stdout}"- );- }-}-/// Verify single dash '-' shows both short AND long flags.////// When completing `wt -`, users should see both short flags like `-h` and long flagsdiff --git a/tests/integration_tests/completion_validation.rs b/tests/integration_tests/completion_validation.rsindex d5445e602..3debf0c29 100644--- a/tests/integration_tests/completion_validation.rs+++ b/tests/integration_tests/completion_validation.rs@@ -44,59 +44,21 @@ impl Issue {}/// Validate fish shell completions-fn validate_fish(content: &str) -> Vec<Issue> {- let mut issues = Vec::new();-- // Check for hidden flags- for line in content.lines() {- if line.contains("complete -c wt") && line.contains("-l internal") {- issues.push(Issue::error(- "fish",- Category::HiddenFlag,- "Hidden flag --internal appears in completions",- ));- }- }-- issues+fn validate_fish(_content: &str) -> Vec<Issue> {+ // No hidden flags to check after removing --internal+ Vec::new()}/// Validate bash shell completions-fn validate_bash(content: &str) -> Vec<Issue> {- let mut issues = Vec::new();-- // Check for hidden flags in opts strings- // Note: We don't validate bash syntax here. If you need that, use shellcheck.- // We only check that our filtering logic removed hidden flags.- for line in content.lines() {- if line.contains("opts=") && line.contains("--internal") {- issues.push(Issue::error(- "bash",- Category::HiddenFlag,- "Hidden flag --internal appears in opts",- ));- }- }-- issues+fn validate_bash(_content: &str) -> Vec<Issue> {+ // No hidden flags to check after removing --internal+ Vec::new()}/// Validate zsh shell completions-fn validate_zsh(content: &str) -> Vec<Issue> {- let mut issues = Vec::new();-- // Check for hidden flags in argument specs- for line in content.lines() {- if line.contains("'--internal[") {- issues.push(Issue::error(- "zsh",- Category::HiddenFlag,- "Hidden flag --internal appears in completions",- ));- }- }-- issues+fn validate_zsh(_content: &str) -> Vec<Issue> {+ // No hidden flags to check after removing --internal+ Vec::new()}/// Extract flags from shell completion contentdiff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rsindex d842f0efc..823b4c90d 100644--- a/tests/integration_tests/configure_shell.rs+++ b/tests/integration_tests/configure_shell.rs@@ -27,7 +27,7 @@ fn test_configure_shell_with_yes(repo: TestRepo, temp_home: TempDir) {.arg("--force").current_dir(repo.root_path());- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -71,7 +71,7 @@ fn test_configure_shell_specific_shell(repo: TestRepo, temp_home: TempDir) {.arg("--force").current_dir(repo.root_path());- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -115,7 +115,7 @@ fn test_configure_shell_already_exists(repo: TestRepo, temp_home: TempDir) {.arg("--force").current_dir(repo.root_path());- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -148,7 +148,7 @@ fn test_configure_shell_fish(repo: TestRepo, temp_home: TempDir) {.arg("--force").current_dir(repo.root_path());- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -203,7 +203,7 @@ fn test_configure_shell_fish_extension_exists(repo: TestRepo, temp_home: TempDir// Fish completions are inline in the init script, so when extension exists,// it should say "All shells already configured"- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -244,7 +244,7 @@ fn test_configure_shell_no_files(repo: TestRepo, temp_home: TempDir) {.arg("--force").current_dir(repo.root_path());- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: falseexit_code: 1----- stdout -----@@ -281,7 +281,7 @@ fn test_configure_shell_multiple_configs(repo: TestRepo, temp_home: TempDir) {.arg("--force").current_dir(repo.root_path());- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -341,7 +341,7 @@ fn test_configure_shell_mixed_states(repo: TestRepo, temp_home: TempDir) {.arg("--force").current_dir(repo.root_path());- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -397,7 +397,7 @@ fn test_uninstall_shell(repo: TestRepo, temp_home: TempDir) {.arg("--force").current_dir(repo.root_path());- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -454,7 +454,7 @@ fn test_uninstall_shell_multiple(repo: TestRepo, temp_home: TempDir) {.arg("--force").current_dir(repo.root_path());- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -504,7 +504,7 @@ fn test_uninstall_shell_not_found(repo: TestRepo, temp_home: TempDir) {.arg("--force").current_dir(repo.root_path());- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -541,7 +541,7 @@ fn test_uninstall_shell_fish(repo: TestRepo, temp_home: TempDir) {.arg("--force").current_dir(repo.root_path());- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -649,7 +649,7 @@ fn test_configure_shell_no_warning_when_compinit_enabled(repo: TestRepo, temp_ho.arg("--force").current_dir(repo.root_path());- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -686,7 +686,7 @@ fn test_configure_shell_no_warning_for_bash_user(repo: TestRepo, temp_home: Temp.current_dir(repo.root_path());// Should NOT show compinit warning - user is a bash user, not zsh- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -724,7 +724,7 @@ fn test_configure_shell_no_warning_for_fish_install(repo: TestRepo, temp_home: T.current_dir(repo.root_path());// Should NOT show compinit warning - we're installing fish, not zsh- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -763,7 +763,7 @@ fn test_configure_shell_no_warning_when_already_configured(repo: TestRepo, temp_.current_dir(repo.root_path());// Should NOT show compinit warning - zsh is AlreadyExists, not newly added- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----@@ -797,7 +797,7 @@ fn test_configure_shell_no_warning_when_shell_unset(repo: TestRepo, temp_home: T.current_dir(repo.root_path());// Should NOT show compinit warning - can't determine user's shell- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: trueexit_code: 0----- stdout -----diff --git a/tests/integration_tests/directives.rs b/tests/integration_tests/directives.rsindex 64d3312b3..46d828107 100644--- a/tests/integration_tests/directives.rs+++ b/tests/integration_tests/directives.rs@@ -1,123 +1,109 @@use crate::common::{- TestRepo, repo, repo_with_feature_worktree, repo_with_remote, repo_with_remote_and_feature,- setup_snapshot_settings, wt_command,+ TestRepo, configure_directive_file, directive_file, repo, repo_with_feature_worktree,+ repo_with_remote, repo_with_remote_and_feature, setup_snapshot_settings, wt_command,};-use insta::Settings;use insta_cmd::assert_cmd_snapshot;use rstest::rstest;// ============================================================================-// PowerShell Directive Tests+// Directive File Tests// ============================================================================-// These tests verify that --internal=powershell produces correct PowerShell syntax.-// The PowerShell directive mode outputs:-// - `Set-Location 'path'` instead of `cd 'path'`-// - Proper single-quote escaping ('' instead of '\'' for embedded quotes)+// These tests verify that WORKTRUNK_DIRECTIVE_FILE env var causes directives to be+// written to the file. The shell wrapper sources this file after wt exits.-/// Test that switch with --internal=powershell outputs PowerShell Set-Location syntax+/// Test that switch with directive file writes cd command to file#[rstest]-fn test_switch_internal_powershell_directive(#[from(repo_with_remote)] mut repo: TestRepo) {+fn test_switch_directive_file(#[from(repo_with_remote)] mut repo: TestRepo) {let _feature_wt = repo.add_worktree("feature");+ let (directive_path, _guard) = directive_file();let mut settings = setup_snapshot_settings(&repo);- // Normalize the PowerShell Set-Location path- settings.add_filter(r"Set-Location '[^']+'", "Set-Location '[PATH]'");+ // Normalize the directive file cd path+ settings.add_filter(r"cd '[^']+'", "cd '[PATH]'");settings.bind(|| {let mut cmd = wt_command();repo.clean_cli_env(&mut cmd);- cmd.arg("--internal=powershell")- .arg("switch")+ configure_directive_file(&mut cmd, &directive_path);+ cmd.arg("switch").arg("feature").current_dir(repo.root_path());- // Use file-based snapshot since inline snapshots don't handle- // path normalization and ANSI codes wellassert_cmd_snapshot!(cmd);++ // Verify directive file contains cd command+ let directives = std::fs::read_to_string(&directive_path).unwrap_or_default();+ assert!(+ directives.contains("cd '"),+ "Directive file should contain cd command, got: {}",+ directives+ );});}-/// Test merge with --internal=powershell (switch back to main after merge)+/// Test merge with directive file (switch back to main after merge)#[rstest]-fn test_merge_internal_powershell_directive(mut repo_with_remote_and_feature: TestRepo) {+fn test_merge_directive_file(mut repo_with_remote_and_feature: TestRepo) {let repo = &mut repo_with_remote_and_feature;let feature_wt = &repo.worktrees["feature"];+ let (directive_path, _guard) = directive_file();let mut settings = setup_snapshot_settings(repo);- // Normalize the PowerShell Set-Location path- settings.add_filter(r"Set-Location '[^']+'", "Set-Location '[PATH]'");+ settings.add_filter(r"cd '[^']+'", "cd '[PATH]'");settings.bind(|| {let mut cmd = wt_command();repo.clean_cli_env(&mut cmd);- cmd.arg("--internal=powershell")- .arg("merge")- .arg("main")- .current_dir(feature_wt);+ configure_directive_file(&mut cmd, &directive_path);+ cmd.arg("merge").arg("main").current_dir(feature_wt);assert_cmd_snapshot!(cmd);++ // Verify directive file contains cd command (back to main)+ let directives = std::fs::read_to_string(&directive_path).unwrap_or_default();+ assert!(+ directives.contains("cd '"),+ "Directive file should contain cd command, got: {}",+ directives+ );});}-/// Test that remove with --internal=powershell outputs PowerShell Set-Location syntax+/// Test that remove with directive file writes cd command to file#[rstest]-fn test_remove_internal_powershell_directive(#[from(repo_with_remote)] mut repo: TestRepo) {+fn test_remove_directive_file(#[from(repo_with_remote)] mut repo: TestRepo) {let feature_wt = repo.add_worktree("feature");+ let (directive_path, _guard) = directive_file();let mut settings = setup_snapshot_settings(&repo);- // Normalize the PowerShell Set-Location path- settings.add_filter(r"Set-Location '[^']+'", "Set-Location '[PATH]'");+ settings.add_filter(r"cd '[^']+'", "cd '[PATH]'");settings.bind(|| {let mut cmd = wt_command();repo.clean_cli_env(&mut cmd);- cmd.arg("--internal=powershell")- .arg("remove")- .current_dir(&feature_wt);+ configure_directive_file(&mut cmd, &directive_path);+ cmd.arg("remove").current_dir(&feature_wt);assert_cmd_snapshot!(cmd);++ // Verify directive file contains cd command (back to main)+ let directives = std::fs::read_to_string(&directive_path).unwrap_or_default();+ assert!(+ directives.contains("cd '"),+ "Directive file should contain cd command, got: {}",+ directives+ );});}// ============================================================================-// POSIX Directive Tests (existing tests)+// Non-Directive Mode Tests (no WORKTRUNK_DIRECTIVE_FILE)// ============================================================================-/// Test the directive protocol for switch command+/// Test switch without directive file (error case - branch not found)#[rstest]-fn test_switch_internal_directive(repo: TestRepo) {- let mut settings = Settings::clone_current();- settings.set_snapshot_path("../snapshots");-- // Normalize the shell script cd path output- settings.add_filter(r"cd '[^']+'", "cd '[PATH]'");-- settings.bind(|| {- let mut cmd = wt_command();- repo.clean_cli_env(&mut cmd);- cmd.arg("--internal")- .arg("switch")- .arg("my-feature")- .current_dir(repo.root_path());-- assert_cmd_snapshot!(cmd, @r"- success: false- exit_code: 1- ----- stdout ------- ----- stderr ------ [0m[31m✗[39m [31mBranch [1mmy-feature[22m not found[39m-- [2m↳[22m [2mTo create a new branch, run [90mwt switch my-feature --create[39m; to list branches, run [90mwt list --branches --remotes[39m[22m- ");- });-}--/// Test switch without internal flag (should show help message)-#[rstest]-fn test_switch_without_internal(repo: TestRepo) {- let mut settings = Settings::clone_current();- settings.set_snapshot_path("../snapshots");+fn test_switch_without_directive_file(repo: TestRepo) {+ let settings = setup_snapshot_settings(&repo);settings.bind(|| {let mut cmd = wt_command();@@ -126,97 +112,52 @@ fn test_switch_without_internal(repo: TestRepo) {.arg("my-feature").current_dir(repo.root_path());- assert_cmd_snapshot!(cmd, @r"- success: false- exit_code: 1- ----- stdout ------- ----- stderr ------ [31m✗[39m [31mBranch [1mmy-feature[22m not found[39m-- [2m↳[22m [2mTo create a new branch, run [90mwt switch my-feature --create[39m; to list branches, run [90mwt list --branches --remotes[39m[22m- ");- });-}--/// Test remove command with internal flag-#[rstest]-fn test_remove_internal_directive(repo: TestRepo) {- let mut settings = Settings::clone_current();- settings.set_snapshot_path("../snapshots");-- // Normalize the shell script cd path output- settings.add_filter(r"cd '[^']+'", "cd '[PATH]'");-- settings.bind(|| {- let mut cmd = wt_command();- repo.clean_cli_env(&mut cmd);- cmd.arg("--internal")- .arg("remove")- .current_dir(repo.root_path());-- assert_cmd_snapshot!(cmd, @r"- success: false- exit_code: 1- ----- stdout ------- ----- stderr ------ [0m[31m✗[39m [31mThe main worktree cannot be removed[39m- ");+ assert_cmd_snapshot!(cmd);});}-/// Test remove without internal flag+/// Test remove without directive file (error case - main worktree)#[rstest]-fn test_remove_without_internal(repo: TestRepo) {- let mut settings = Settings::clone_current();- settings.set_snapshot_path("../snapshots");+fn test_remove_without_directive_file(repo: TestRepo) {+ let settings = setup_snapshot_settings(&repo);settings.bind(|| {let mut cmd = wt_command();repo.clean_cli_env(&mut cmd);cmd.arg("remove").current_dir(repo.root_path());- assert_cmd_snapshot!(cmd, @r"- success: false- exit_code: 1- ----- stdout ------- ----- stderr ------ [31m✗[39m [31mThe main worktree cannot be removed[39m- ");+ assert_cmd_snapshot!(cmd);});}-/// Test merge command with internal flag and --no-remove+/// Test merge with directive file and --no-remove#[rstest]-fn test_merge_internal_no_remove(mut repo_with_feature_worktree: TestRepo) {+fn test_merge_directive_no_remove(mut repo_with_feature_worktree: TestRepo) {let repo = &mut repo_with_feature_worktree;let feature_wt = &repo.worktrees["feature"];+ let (directive_path, _guard) = directive_file();let settings = setup_snapshot_settings(repo);settings.bind(|| {let mut cmd = wt_command();repo.clean_cli_env(&mut cmd);- cmd.arg("--internal")- .arg("merge")+ configure_directive_file(&mut cmd, &directive_path);+ cmd.arg("merge").arg("main").arg("--no-remove").current_dir(feature_wt);- // Note: Using file snapshot instead of inline because multiline inline snapshots- // don't work well with NUL bytes (\0) in the outputassert_cmd_snapshot!(cmd);});}-/// Test merge command with internal flag (removes worktree, emits cd shell script)-/// This test verifies that the shell script output is correctly formatted+/// Test merge with directive file (removes worktree, writes cd to file)#[rstest]-fn test_merge_internal_remove(mut repo_with_feature_worktree: TestRepo) {+fn test_merge_directive_remove(mut repo_with_feature_worktree: TestRepo) {let repo = &mut repo_with_feature_worktree;let feature_wt = &repo.worktrees["feature"];+ let (directive_path, _guard) = directive_file();let mut settings = setup_snapshot_settings(repo);settings.add_filter(r"cd '[^']+'", "cd '[PATH]'");@@ -224,11 +165,17 @@ fn test_merge_internal_remove(mut repo_with_feature_worktree: TestRepo) {settings.bind(|| {let mut cmd = wt_command();repo.clean_cli_env(&mut cmd);- cmd.arg("--internal")- .arg("merge")- .arg("main")- .current_dir(feature_wt);+ configure_directive_file(&mut cmd, &directive_path);+ cmd.arg("merge").arg("main").current_dir(feature_wt);assert_cmd_snapshot!(cmd);++ // Verify directive file contains cd command+ let directives = std::fs::read_to_string(&directive_path).unwrap_or_default();+ assert!(+ directives.contains("cd '"),+ "Directive file should contain cd command, got: {}",+ directives+ );});}diff --git a/tests/integration_tests/internal_flag.rs b/tests/integration_tests/internal_flag.rsdeleted file mode 100644index 00b3991f3..000000000--- a/tests/integration_tests/internal_flag.rs+++ /dev/null@@ -1,72 +0,0 @@-//! Tests for --internal flag behavior-//!-//! Verifies that:-//! 1. Commands that emit directives work correctly with --internal (already tested in directives.rs)-//! 2. Commands that DON'T emit directives work correctly with --internal-//! 3. The --internal flag can be safely passed to all commands--use crate::common::{- TestRepo, repo, set_temp_home_env, setup_snapshot_settings, setup_snapshot_settings_with_home,- temp_home, wt_command,-};-use insta_cmd::assert_cmd_snapshot;-use rstest::rstest;-use std::fs;-use tempfile::TempDir;--/// Test that `list` command works with --internal flag-///-/// The list command outputs tables through stderr in directive mode for progressive-/// streaming. This bypasses the shell wrapper's NUL-delimited parsing on stdout,-/// allowing real-time display without buffering.-///-/// Expected behavior:-/// - stdout: empty (no directives emitted by list command)-/// - stderr: complete table output with ANSI formatting-#[rstest]-fn test_list_with_internal_flag(repo: TestRepo) {- let settings = setup_snapshot_settings(&repo);-- settings.bind(|| {- let mut cmd = wt_command();- repo.clean_cli_env(&mut cmd);- cmd.arg("--internal")- .arg("list")- .current_dir(repo.root_path());-- assert_cmd_snapshot!(cmd);- });-}--/// Test that `config show` command works with --internal flag-///-/// Config show doesn't emit directives, but should work fine with --internal.-#[rstest]-fn test_config_show_with_internal_flag(mut repo: TestRepo, temp_home: TempDir) {- // Setup mock gh/glab for deterministic BINARIES output- repo.setup_mock_ci_tools_unauthenticated();-- // Create fake global config at XDG path- let global_config_dir = temp_home.path().join(".config").join("worktrunk");- fs::create_dir_all(&global_config_dir).unwrap();- fs::write(- global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"-"#,- )- .unwrap();-- let settings = setup_snapshot_settings_with_home(&repo, &temp_home);- settings.bind(|| {- let mut cmd = wt_command();- repo.clean_cli_env(&mut cmd);- repo.configure_mock_commands(&mut cmd);- set_temp_home_env(&mut cmd, temp_home.path());- cmd.arg("--internal")- .arg("config")- .arg("show")- .current_dir(repo.root_path());-- assert_cmd_snapshot!(cmd);- });-}diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rsindex 906c09546..c74065db3 100644--- a/tests/integration_tests/merge.rs+++ b/tests/integration_tests/merge.rs@@ -1676,7 +1676,7 @@ fn test_merge_no_commit_with_dirty_tree(mut repo: TestRepo) {settings.bind(|| {let mut cmd =make_snapshot_cmd(&repo, "merge", &["main", "--no-commit"], Some(&feature_wt));- assert_cmd_snapshot!(cmd, @r"+ assert_cmd_snapshot!(cmd, @"success: falseexit_code: 1----- stdout -----diff --git a/tests/integration_tests/mod.rs b/tests/integration_tests/mod.rsindex 15f7d2056..a42af3530 100644--- a/tests/integration_tests/mod.rs+++ b/tests/integration_tests/mod.rs@@ -29,7 +29,6 @@ pub mod git_error_display;pub mod help;pub mod hook_show;pub mod init;-pub mod internal_flag;pub mod list;pub mod list_column_alignment;pub mod list_config;diff --git a/tests/integration_tests/output_system_guard.rs b/tests/integration_tests/output_system_guard.rsindex d6fd282c9..193244730 100644--- a/tests/integration_tests/output_system_guard.rs+++ b/tests/integration_tests/output_system_guard.rs@@ -1,17 +1,18 @@//! Guard test to prevent stdout leaks in command code//!-//! In directive mode (`--internal`), stdout is reserved for shell script output.-//! Any `println!` or `print!` in command code would leak into the script and-//! potentially be eval'd by the shell wrapper.+//! stdout is reserved for data output (e.g., JSON). User-visible messages go to stderr.+//! When shell integration is active (`WORKTRUNK_DIRECTIVE_FILE` is set), directives are written+//! to the file, not stdout.//!//! This test enforces: **No stdout writes in command code except via output system**//!//! Allowed:-//! - `output::*` functions (route to correct stream based on mode)+//! - `output::*` functions (route to correct stream)//! - `eprintln!` / `eprint!` (stderr is safe)//!//! Exceptions:-//! - `init.rs` - intentionally outputs shell code to stdout for `eval`+//! - `init.rs` - outputs shell integration code to stdout for `eval`+//! - `statusline.rs` - outputs status line text to stdout for shell promptsuse std::fs;use std::path::Path;@@ -44,8 +45,8 @@ fn check_no_stdout_in_commands() {if !violations.is_empty() {panic!("stdout writes found in command code (use output::* instead):\n\n{}\n\n\- In directive mode, stdout is reserved for shell script output.\n\- Use output::info(), output::hint(), output::data(), etc. instead.",+ stdout is reserved for data output (JSON, tables).\n\+ Use output::print(), output::table(), output::data(), etc. instead.",violations.join("\n"));}diff --git a/tests/integration_tests/remove.rs b/tests/integration_tests/remove.rsindex 4f93adc1a..7739a4927 100644--- a/tests/integration_tests/remove.rs+++ b/tests/integration_tests/remove.rs@@ -1,6 +1,6 @@use crate::common::{- TestRepo, canonicalize, make_snapshot_cmd_with_global_flags, repo, repo_with_remote,- setup_snapshot_settings, setup_temp_snapshot_settings, wt_command,+ TestRepo, canonicalize, configure_directive_file, directive_file, make_snapshot_cmd, repo,+ repo_with_remote, setup_snapshot_settings, setup_temp_snapshot_settings, wt_command,};use insta_cmd::assert_cmd_snapshot;use rstest::rstest;@@ -11,20 +11,39 @@ use tempfile::TempDir;/// Helper to create snapshot with normalized pathsfn snapshot_remove(test_name: &str, repo: &TestRepo, args: &[&str], cwd: Option<&std::path::Path>) {- snapshot_remove_with_global_flags(test_name, repo, args, cwd, &[]);+ snapshot_remove_impl(test_name, repo, args, cwd, false);}-/// Helper to create snapshot with global flags (e.g., --internal)-fn snapshot_remove_with_global_flags(+/// Helper to create snapshot with directive file (simulates shell wrapper)+fn snapshot_remove_with_directive_file(test_name: &str,repo: &TestRepo,args: &[&str],cwd: Option<&std::path::Path>,- global_flags: &[&str],+) {+ snapshot_remove_impl(test_name, repo, args, cwd, true);+}++fn snapshot_remove_impl(+ test_name: &str,+ repo: &TestRepo,+ args: &[&str],+ cwd: Option<&std::path::Path>,+ with_directive_file: bool,) {let settings = setup_snapshot_settings(repo);settings.bind(|| {- let mut cmd = make_snapshot_cmd_with_global_flags(repo, "remove", args, cwd, global_flags);+ // Directive file guard - declared at closure scope to live through command execution+ let maybe_directive = if with_directive_file {+ Some(directive_file())+ } else {+ None+ };++ let mut cmd = make_snapshot_cmd(repo, "remove", args, cwd);+ if let Some((ref directive_path, ref _guard)) = maybe_directive {+ configure_directive_file(&mut cmd, directive_path);+ }assert_cmd_snapshot!(test_name, cmd);});}@@ -60,13 +79,7 @@ fn test_remove_from_worktree(mut repo: TestRepo) {fn test_remove_internal_mode(mut repo: TestRepo) {let worktree_path = repo.add_worktree("feature-internal");- snapshot_remove_with_global_flags(- "remove_internal_mode",- &repo,- &[],- Some(&worktree_path),- &["--internal"],- );+ snapshot_remove_with_directive_file("remove_internal_mode", &repo, &[], Some(&worktree_path));}#[rstest]diff --git a/tests/integration_tests/security.rs b/tests/integration_tests/security.rsindex 359268c2e..0d6eb3106 100644--- a/tests/integration_tests/security.rs+++ b/tests/integration_tests/security.rs@@ -2,19 +2,22 @@//!//! # Attack Surface Analysis//!-//! Worktrunk uses a shell script protocol for shell integration. Commands with `--internal`:-//! - Stream all user-visible output (progress, errors, hints) to stderr in real-time-//! - Emit a shell script to stdout at the end (cd commands, exec commands)+//! Worktrunk uses a file-based directive protocol for shell integration. When `WORKTRUNK_DIRECTIVE_FILE`+//! env var is set (pointing to a temp file), the wt binary:+//! - Streams all user-visible output (progress, errors, hints) to stderr in real-time+//! - Writes shell directives (cd commands, exec commands) to the directive file//!-//! The shell wrapper captures stdout via command substitution and evals it:+//! The shell wrapper sources the directive file after wt exits://! ```bash-//! script="$(wt --internal ... 2>&2)" && eval "$script"+//! directive_file="$(mktemp)"+//! WORKTRUNK_DIRECTIVE_FILE="$directive_file" wt ... || exit_code=$?+//! source "$directive_file"//! ```//!//! ## Vulnerability: Shell Injection//!//! If external content (branch names, file paths, git output) can inject malicious shell-//! code into stdout, the shell wrapper will execute it. This is analogous to SQL injection+//! code into the directive file, the shell wrapper will execute it. This is analogous to SQL injection//! or command injection vulnerabilities.//!//! ## Attack Vectors@@ -29,7 +32,7 @@//! ```bash//! # Create directory with malicious name//! mkdir "test'; rm -rf /; echo '"-//! wt switch --internal branch # If cd emits: cd 'test'; rm -rf /; echo ''+//! WORKTRUNK_DIRECTIVE_FILE=/tmp/d wt switch branch # If cd emits: cd 'test'; rm -rf /; echo ''//! ```//!//! **Protection:** All paths are escaped using `replace('\'', "'\\''")` pattern,@@ -49,8 +52,8 @@//!//! **Shell script protocol with proper escaping:**//!-//! 1. **Channel separation**: User messages go to stderr, shell script goes to stdout-//! - Shell wrapper only evals stdout: `script="$(... 2>&2)" && eval "$script"`+//! 1. **Channel separation**: User messages go to stderr, shell directives go to a temp file+//! - Shell wrapper only sources the directive file//! - Malicious content in stderr cannot be executed//!//! 2. **Path escaping**: All paths use single quotes with `'\''` escape pattern@@ -75,13 +78,12 @@//!//! ## Security Model//!-//! The new shell script protocol is simpler and more secure than the previous NUL-delimited-//! directive protocol:+//! The file-based directive protocol is secure://!-//! 1. **Simpler parsing**: No NUL byte parsing in shell, just command substitution + eval-//! 2. **Channel separation**: Messages on stderr, script on stdout (not interleaved)+//! 1. **Simpler parsing**: Just source a file, no command substitution needed+//! 2. **Channel separation**: Messages on stderr, directives in temp file//! 3. **Standard escaping**: Uses well-understood POSIX single-quote escaping-//! 4. **Smaller attack surface**: Only cd and exec commands in stdout, nothing else+//! 4. **Smaller attack surface**: Only cd and exec commands in directive file//!//! ### Testing Limitations//!@@ -96,7 +98,9 @@//! For comprehensive security testing, see `tests/integration_tests/shell_wrapper.rs` which//! tests the full shell integration pipeline.-use crate::common::{TestRepo, repo, setup_snapshot_settings, wt_command};+use crate::common::{+ TestRepo, configure_directive_file, directive_file, repo, setup_snapshot_settings, wt_command,+};use insta::Settings;use insta_cmd::assert_cmd_snapshot;use rstest::rstest;@@ -215,10 +219,11 @@ fn test_branch_name_is_directive_not_executed(repo: TestRepo) {settings.set_snapshot_path("../snapshots");settings.bind(|| {+ let (directive_path, _guard) = directive_file();let mut cmd = wt_command();repo.clean_cli_env(&mut cmd);- cmd.arg("--internal")- .arg("switch")+ configure_directive_file(&mut cmd, &directive_path);+ cmd.arg("switch").arg("--create").arg(malicious_branch).current_dir(repo.root_path());@@ -253,10 +258,11 @@ fn test_branch_name_with_newline_directive_not_executed(repo: TestRepo) {settings.set_snapshot_path("../snapshots");settings.bind(|| {+ let (directive_path, _guard) = directive_file();let mut cmd = wt_command();repo.clean_cli_env(&mut cmd);- cmd.arg("--internal")- .arg("switch")+ configure_directive_file(&mut cmd, &directive_path);+ cmd.arg("switch").arg("--create").arg(malicious_branch).current_dir(repo.root_path());@@ -355,10 +361,11 @@ fn test_branch_name_with_cd_directive_not_executed(repo: TestRepo) {let settings = setup_snapshot_settings(&repo);settings.bind(|| {+ let (directive_path, _guard) = directive_file();let mut cmd = wt_command();repo.clean_cli_env(&mut cmd);- cmd.arg("--internal")- .arg("switch")+ configure_directive_file(&mut cmd, &directive_path);+ cmd.arg("switch").arg("--create").arg(malicious_branch).current_dir(repo.root_path());@@ -379,10 +386,11 @@ fn test_error_message_with_directive_not_executed(repo: TestRepo) {let settings = setup_snapshot_settings(&repo);settings.bind(|| {+ let (directive_path, _guard) = directive_file();let mut cmd = wt_command();repo.clean_cli_env(&mut cmd);- cmd.arg("--internal")- .arg("switch")+ configure_directive_file(&mut cmd, &directive_path);+ cmd.arg("switch").arg(malicious_branch).current_dir(repo.root_path());@@ -399,7 +407,7 @@ fn test_error_message_with_directive_not_executed(repo: TestRepo) {/// Test that execute flag (-x) input is properly handled////// The -x flag is SUPPOSED to execute commands, so this tests that:-/// 1. Commands from -x are emitted as shell script to stdout+/// 1. Commands from -x are written to the directive file/// 2. User content in branch names that looks like old directives doesn't cause injection#[rstest]fn test_execute_flag_with_directive_like_branch_name(repo: TestRepo) {@@ -422,17 +430,18 @@ fn test_execute_flag_with_directive_like_branch_name(repo: TestRepo) {settings.set_snapshot_path("../snapshots");settings.bind(|| {+ let (directive_path, _guard) = directive_file();let mut cmd = wt_command();repo.clean_cli_env(&mut cmd);- cmd.arg("--internal")- .arg("switch")+ configure_directive_file(&mut cmd, &directive_path);+ cmd.arg("switch").arg("--create").arg(malicious_branch).arg("-x").arg("echo legitimate command").current_dir(repo.root_path());- // The -x command should appear in stdout as shell script+ // The -x command should be written to directive file// The branch name should NOT inject additional commandsassert_cmd_snapshot!(cmd);});diff --git a/tests/integration_tests/shell_wrapper.rs b/tests/integration_tests/shell_wrapper.rsindex 84ed40f5a..af4f9a108 100644--- a/tests/integration_tests/shell_wrapper.rs+++ b/tests/integration_tests/shell_wrapper.rs@@ -539,9 +539,9 @@ fn exec_bash_truly_interactive(////// This simulates what actually happens when users run `wt switch`, etc. in their shell:/// 1. The `wt` function is defined (from shell integration)-/// 2. It calls `wt_exec --internal switch ...`-/// 3. The wrapper captures stdout (shell script) via command substitution and evals it-/// 4. Users see stderr output (progress, success, hints) in real-time+/// 2. It calls `wt_exec` which sets WORKTRUNK_DIRECTIVE_FILE and runs the binary+/// 3. The wrapper sources the directive file after wt exits (for cd, exec commands)+/// 4. Users see stdout/stderr output in real-time////// Now uses PTY interactive mode for consistent behavior and potential input echoing.///@@ -1259,7 +1259,7 @@ approved-commands = ["echo 'test command executed'"]// should NOT appear because the user already has shell integrationlet output = exec_through_wrapper("bash", &repo, "switch", &["--create", "bash-test"]);- // Critical: shell integration hint must be suppressed in directive mode+ // Critical: shell integration hint must be suppressed when shell integration is activeassert!(!output.combined.contains("To enable automatic cd"),"Shell integration hint should not appear when running through wrapper. Output:\n{}",@@ -1358,7 +1358,7 @@ approved-commands = ["echo 'background task'"]assert_eq!(output.exit_code, 0, "Command should succeed");// Critical assertion: progress messages should appear to users- // This is the test that catches the bug where progress() is suppressed in directive mode+ // This is the test that catches the bug where progress() was incorrectly suppressedassert!(output.combined.contains("Running project post-start"),"Progress message 'Running project post-start' missing from output. \diff --git a/tests/integration_tests/statusline.rs b/tests/integration_tests/statusline.rsindex 93dd42141..5f39f7b78 100644--- a/tests/integration_tests/statusline.rs+++ b/tests/integration_tests/statusline.rs@@ -44,12 +44,11 @@ fn run_statusline_from_dir(let output = child.wait_with_output().expect("failed to wait for output");- // Statusline outputs to stdout in interactive mode, stderr in directive mode- // For tests without --internal, we capture stdout+ // Statusline outputs to stdout in interactive modelet stdout = String::from_utf8_lossy(&output.stdout);let stderr = String::from_utf8_lossy(&output.stderr);- // Return whichever has content (stdout for interactive, stderr for --internal)+ // Return whichever has content (stdout for interactive)if !stdout.is_empty() {stdout.to_string()} else {@@ -196,33 +195,10 @@ fn test_statusline_claude_code_with_model(repo: TestRepo) {}// --- Directive Mode Tests -----#[rstest]-fn test_statusline_directive_mode(repo: TestRepo) {- // When called with --internal, output goes to stderr (stdout empty for shell eval)- add_uncommitted_changes(&repo);-- let mut cmd = wt_command();- cmd.current_dir(repo.root_path());- cmd.args(["--internal", "list", "statusline"]);- repo.clean_cli_env(&mut cmd);-- let output = cmd.output().expect("failed to run command");-- // stdout should be empty in directive mode- assert!(- output.stdout.is_empty(),- "stdout should be empty in directive mode, got: {:?}",- String::from_utf8_lossy(&output.stdout)- );-- // stderr should have the statusline- let stderr = String::from_utf8_lossy(&output.stderr);- assert!(- !stderr.is_empty(),- "stderr should have statusline output in directive mode"- );-}+// Note: With the new WORKTRUNK_DIRECTIVE_FILE architecture, data output (like statusline)+// still goes to stdout. The directive file is only used for shell directives like+// `cd '/path'`. So this test is no longer needed - statusline behavior is the same+// regardless of whether WORKTRUNK_DIRECTIVE_FILE is set.// --- Branch Display Tests ---diff --git a/tests/integration_tests/switch.rs b/tests/integration_tests/switch.rsindex d1c2f0368..b5c7f942e 100644--- a/tests/integration_tests/switch.rs+++ b/tests/integration_tests/switch.rs@@ -1,6 +1,7 @@use crate::common::{- TestRepo, make_snapshot_cmd_with_global_flags, repo, repo_with_remote, set_temp_home_env,- setup_home_snapshot_settings, setup_snapshot_settings, temp_home, wt_command,+ TestRepo, configure_directive_file, directive_file, make_snapshot_cmd, repo, repo_with_remote,+ set_temp_home_env, setup_home_snapshot_settings, setup_snapshot_settings, temp_home,+ wt_command,};use insta_cmd::assert_cmd_snapshot;use rstest::rstest;@@ -10,32 +11,37 @@ use tempfile::TempDir;// Snapshot helpersfn snapshot_switch(test_name: &str, repo: &TestRepo, args: &[&str]) {- snapshot_switch_impl(test_name, repo, args, &[], None);+ snapshot_switch_impl(test_name, repo, args, false, None);}-fn snapshot_switch_with_global_flags(- test_name: &str,- repo: &TestRepo,- args: &[&str],- global_flags: &[&str],-) {- snapshot_switch_impl(test_name, repo, args, global_flags, None);+fn snapshot_switch_with_directive_file(test_name: &str, repo: &TestRepo, args: &[&str]) {+ snapshot_switch_impl(test_name, repo, args, true, None);}fn snapshot_switch_from_dir(test_name: &str, repo: &TestRepo, args: &[&str], cwd: &Path) {- snapshot_switch_impl(test_name, repo, args, &[], Some(cwd));+ snapshot_switch_impl(test_name, repo, args, false, Some(cwd));}fn snapshot_switch_impl(test_name: &str,repo: &TestRepo,args: &[&str],- global_flags: &[&str],+ with_directive_file: bool,cwd: Option<&Path>,) {let settings = setup_snapshot_settings(repo);settings.bind(|| {- let mut cmd = make_snapshot_cmd_with_global_flags(repo, "switch", args, cwd, global_flags);+ // Directive file guard - declared at closure scope to live through command execution+ let maybe_directive = if with_directive_file {+ Some(directive_file())+ } else {+ None+ };++ let mut cmd = make_snapshot_cmd(repo, "switch", args, cwd);+ if let Some((ref directive_path, ref _guard)) = maybe_directive {+ configure_directive_file(&mut cmd, directive_path);+ }assert_cmd_snapshot!(test_name, cmd);});}@@ -155,11 +161,10 @@ fn test_switch_base_without_create_warning(repo: TestRepo) {// Internal mode tests#[rstest]fn test_switch_internal_mode(repo: TestRepo) {- snapshot_switch_with_global_flags(+ snapshot_switch_with_directive_file("switch_internal_mode",&repo,&["--create", "internal-test"],- &["--internal"],);}@@ -167,23 +172,17 @@ fn test_switch_internal_mode(repo: TestRepo) {fn test_switch_existing_worktree_internal(mut repo: TestRepo) {repo.add_worktree("existing-wt");- snapshot_switch_with_global_flags(- "switch_existing_internal",- &repo,- &["existing-wt"],- &["--internal"],- );+ snapshot_switch_with_directive_file("switch_existing_internal", &repo, &["existing-wt"]);}#[rstest]fn test_switch_internal_with_execute(repo: TestRepo) {let execute_cmd = "echo 'line1'\necho 'line2'";- snapshot_switch_with_global_flags(+ snapshot_switch_with_directive_file("switch_internal_with_execute",&repo,&["--create", "exec-internal", "--execute", execute_cmd],- &["--internal"],);}// Error tests@@ -448,11 +447,10 @@ fn test_switch_no_warning_when_branch_matches(mut repo: TestRepo) {repo.add_worktree("feature");// Switch to feature with shell integration - should NOT show any warning- snapshot_switch_with_global_flags(+ snapshot_switch_with_directive_file("switch_no_warning_when_branch_matches",&repo,&["feature"],- &["--internal"],);}@@ -477,12 +475,7 @@ fn test_switch_path_mismatch_shows_hint(repo: TestRepo) {.unwrap();// Switch to feature - should show hint about path mismatch- snapshot_switch_with_global_flags(- "switch_path_mismatch_shows_hint",- &repo,- &["feature"],- &["--internal"],- );+ snapshot_switch_with_directive_file("switch_path_mismatch_shows_hint", &repo, &["feature"]);}/// Test that switching to a branch errors when path is occupied by worktree on different branch@@ -519,11 +512,10 @@ fn test_switch_error_path_occupied_different_branch(repo: TestRepo) {.unwrap();// Switch to feature - should error since path is occupied by bugfix worktree- snapshot_switch_with_global_flags(+ snapshot_switch_with_directive_file("switch_error_path_occupied_different_branch",&repo,&["feature"],- &["--internal"],);}@@ -565,12 +557,7 @@ fn test_switch_error_path_occupied_detached(repo: TestRepo) {.unwrap();// Switch to feature - should error since path is occupied by detached worktree- snapshot_switch_with_global_flags(- "switch_error_path_occupied_detached",- &repo,- &["feature"],- &["--internal"],- );+ snapshot_switch_with_directive_file("switch_error_path_occupied_detached", &repo, &["feature"]);}/// Test switching to default branch when main worktree is on a different branch@@ -591,30 +578,28 @@ fn test_switch_error_main_worktree_on_different_branch(repo: TestRepo) {.unwrap();// Now try to switch to main - should error because main worktree is on feature- snapshot_switch_with_global_flags(+ snapshot_switch_with_directive_file("switch_error_main_worktree_on_different_branch",&repo,&["main"],- &["--internal"],);}-// Internal mode with execute tests-/// Test that --execute with exit code is emitted in directive mode shell script.-/// The shell wrapper will eval this script and propagate the exit code.+// Execute tests with directive file+/// Test that --execute with exit code is written to directive file.+/// The shell wrapper sources this file and propagates the exit code.#[rstest]fn test_switch_internal_execute_exit_code(repo: TestRepo) {// wt succeeds (exit 0), but shell script contains "exit 42"// Shell wrapper will eval and return 42- snapshot_switch_with_global_flags(+ snapshot_switch_with_directive_file("switch_internal_execute_exit_code",&repo,&["--create", "exit-code-test", "--execute", "exit 42"],- &["--internal"],);}-/// Test execute command failure propagation in directive mode.+/// Test execute command failure propagation with shell integration./// When wt succeeds but the execute script would fail, wt still exits 0./// The shell wrapper handles the execute command's exit code.#[rstest]@@ -622,11 +607,10 @@ fn test_switch_internal_execute_with_output_before_exit(repo: TestRepo) {// Execute command outputs then exits with codelet cmd = "echo 'doing work'\nexit 7";- snapshot_switch_with_global_flags(+ snapshot_switch_with_directive_file("switch_internal_execute_output_then_exit",&repo,&["--create", "output-exit-test", "--execute", cmd],- &["--internal"],);}// History and ping-pong testsdiff --git a/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_worktrees.snap b/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_worktrees.snapindex 808feca23..c78035413 100644--- a/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_worktrees.snap+++ b/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_worktrees.snap@@ -20,10 +20,10 @@ info:success: trueexit_code: 0----- stdout -----+ [1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage[0m+@ main [2m^[22m . [2m6c3da842[0m [2m1d[0m [2mInitial commit on main[0m++ feature [2m↑[22m [32m↑1[0m ../feature [2m72413a3b[0m [2m1d[0m [2mWork on feature[0m------ stderr ------ Branch Status HEAD± main↕ Path Remote⇅ Commit Age Message-@ main ^ . 6c3da842 1d Initial commit on main-+ feature ↑ ↑1 ../feature 72413a3b 1d Work on feature+[2m○[22m [2mShowing 2 worktrees, 1 ahead[0m-○ Showing 2 worktrees, 1 ahead+----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_filters_by_repo_owner.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_filters_by_repo_owner.snapindex 064e9ddcb..ae33d6900 100644--- a/tests/snapshots/integration__integration_tests__ci_status__list_full_filters_by_repo_owner.snap+++ b/tests/snapshots/integration__integration_tests__ci_status__list_full_filters_by_repo_owner.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [4m[32m]8;;https://github.com/my-org/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature[0m [2m_[22m [2m../repo.feature[0m [4m[32m]8;;https://github.com/my-org/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_conflicts.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_conflicts.snapindex 803a73b1b..50b29af85 100644--- a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_conflicts.snap+++ b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_conflicts.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [4m[33m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature[0m [2m_[22m [2m../repo.feature[0m [4m[33m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_failed.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_failed.snapindex e6d4f1f70..88e1cfe4c 100644--- a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_failed.snap+++ b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_failed.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [4m[31m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature[0m [2m_[22m [2m../repo.feature[0m [4m[31m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_passed.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_passed.snapindex a6f1bf9f2..d7ce9590e 100644--- a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_passed.snap+++ b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_passed.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [4m[32m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature[0m [2m_[22m [2m../repo.feature[0m [4m[32m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_running.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_running.snapindex 1e0714119..7b70f75c1 100644--- a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_running.snap+++ b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_pr_running.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [4m[34m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature[0m [2m_[22m [2m../repo.feature[0m [4m[34m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_workflow_run.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_workflow_run.snapindex 14f06925e..5dd3e763d 100644--- a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_workflow_run.snap+++ b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_workflow_run.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature[0m [2m_[22m [2m../repo.feature[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_workflow_running.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_workflow_running.snapindex 14f06925e..5dd3e763d 100644--- a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_workflow_running.snap+++ b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_github_workflow_running.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature[0m [2m_[22m [2m../repo.feature[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_mixed_check_types.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_mixed_check_types.snapindex 1e0714119..7b70f75c1 100644--- a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_mixed_check_types.snap+++ b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_mixed_check_types.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [4m[34m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature[0m [2m_[22m [2m../repo.feature[0m [4m[34m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_no_ci_checks.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_no_ci_checks.snapindex 1c389f13d..f097be655 100644--- a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_no_ci_checks.snap+++ b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_no_ci_checks.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [4m[90m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature[0m [2m_[22m [2m../repo.feature[0m [4m[90m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_stale_pr.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_stale_pr.snapindex a12faa365..f9014ae74 100644--- a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_stale_pr.snap+++ b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_stale_pr.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2m[4m[32m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ feature [2m↑[22m [32m↑1[0m [32m+1[0m ../repo.feature [2m[4m[32m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2m1b2eaadd[0m [2m1d[0m [2mLocal commit[2m○[22m [2mShowing 2 worktrees, 1 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_status_context_failure.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_status_context_failure.snapindex e6d4f1f70..88e1cfe4c 100644--- a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_status_context_failure.snap+++ b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_status_context_failure.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [4m[31m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature[0m [2m_[22m [2m../repo.feature[0m [4m[31m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_status_context_pending.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_status_context_pending.snapindex 1e0714119..7b70f75c1 100644--- a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_status_context_pending.snap+++ b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_status_context_pending.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [4m[34m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature[0m [2m_[22m [2m../repo.feature[0m [4m[34m]8;;https://github.com/test-owner/test-repo/pull/1/●]8;;/[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__directives__merge_internal_powershell_directive.snap b/tests/snapshots/integration__integration_tests__directives__merge_directive_file.snapsimilarity index 92%rename from tests/snapshots/integration__integration_tests__directives__merge_internal_powershell_directive.snaprename to tests/snapshots/integration__integration_tests__directives__merge_directive_file.snapindex 88d641b01..e8abea8a3 100644--- a/tests/snapshots/integration__integration_tests__directives__merge_internal_powershell_directive.snap+++ b/tests/snapshots/integration__integration_tests__directives__merge_directive_file.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/directives.rsinfo:program: wtargs:- - "--internal=powershell"- merge- mainenv:@@ -24,12 +23,12 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpCUDDF7XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: trueexit_code: 0----- stdout ------Set-Location _REPO_----- stderr -----[36m◎[39m [36mMerging 1 commit to [1mmain[22m @ [2mfc12499[22m (no commit/squash/rebase needed)[39mdiff --git a/tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snap b/tests/snapshots/integration__integration_tests__directives__merge_directive_no_remove.snapsimilarity index 92%rename from tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snaprename to tests/snapshots/integration__integration_tests__directives__merge_directive_no_remove.snapindex 7edb5299b..04a5c3fde 100644--- a/tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snap+++ b/tests/snapshots/integration__integration_tests__directives__merge_directive_no_remove.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/directives.rsinfo:program: wtargs:- - "--internal"- merge- main- "--no-remove"@@ -25,6 +24,7 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpG9gkyLXDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: truediff --git a/tests/snapshots/integration__integration_tests__directives__merge_internal_remove.snap b/tests/snapshots/integration__integration_tests__directives__merge_directive_remove.snapsimilarity index 92%rename from tests/snapshots/integration__integration_tests__directives__merge_internal_remove.snaprename to tests/snapshots/integration__integration_tests__directives__merge_directive_remove.snapindex a18d89459..176785fea 100644--- a/tests/snapshots/integration__integration_tests__directives__merge_internal_remove.snap+++ b/tests/snapshots/integration__integration_tests__directives__merge_directive_remove.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/directives.rsinfo:program: wtargs:- - "--internal"- merge- mainenv:@@ -24,12 +23,12 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpk1oHzoXDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: trueexit_code: 0----- stdout ------cd _REPO_----- stderr -----[36m◎[39m [36mMerging 1 commit to [1mmain[22m @ [2mfc12499[22m (no commit/squash/rebase needed)[39mdiff --git a/tests/snapshots/integration__integration_tests__directives__remove_internal_powershell_directive.snap b/tests/snapshots/integration__integration_tests__directives__remove_directive_file.snapsimilarity index 90%rename from tests/snapshots/integration__integration_tests__directives__remove_internal_powershell_directive.snaprename to tests/snapshots/integration__integration_tests__directives__remove_directive_file.snapindex bec7bd0c6..674302952 100644--- a/tests/snapshots/integration__integration_tests__directives__remove_internal_powershell_directive.snap+++ b/tests/snapshots/integration__integration_tests__directives__remove_directive_file.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/directives.rsinfo:program: wtargs:- - "--internal=powershell"- removeenv:APPDATA: "[TEST_CONFIG_HOME]"@@ -23,12 +22,12 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp6oa0RGXDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: trueexit_code: 0----- stdout ------Set-Location _REPO_----- stderr -----[36m◎ Removing [1mfeature[22m worktree & branch in background (same commit as [1mmain[22m,[39m [2m_[22m[36m)[39mdiff --git a/tests/snapshots/integration__integration_tests__directives__remove_without_directive_file.snap b/tests/snapshots/integration__integration_tests__directives__remove_without_directive_file.snapnew file mode 100644index 000000000..4d13feff7--- /dev/null+++ b/tests/snapshots/integration__integration_tests__directives__remove_without_directive_file.snap@@ -0,0 +1,32 @@+---+source: tests/integration_tests/directives.rs+info:+ program: wt+ args:+ - remove+ env:+ APPDATA: "[TEST_CONFIG_HOME]"+ CLICOLOR_FORCE: "1"+ COLUMNS: "150"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ GIT_TERMINAL_PROMPT: "0"+ HOME: "[TEST_HOME]"+ LANG: C+ LC_ALL: C+ PATH: "[PATH]"+ RUST_LOG: warn+ SOURCE_DATE_EPOCH: "1735776000"+ USERPROFILE: "[TEST_HOME]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"+---+success: false+exit_code: 1+----- stdout -----++----- stderr -----+[31m✗[39m [31mThe main worktree cannot be removed[39mdiff --git a/tests/snapshots/integration__integration_tests__directives__switch_internal_powershell_directive.snap b/tests/snapshots/integration__integration_tests__directives__switch_directive_file.snapsimilarity index 89%rename from tests/snapshots/integration__integration_tests__directives__switch_internal_powershell_directive.snaprename to tests/snapshots/integration__integration_tests__directives__switch_directive_file.snapindex dbfb1cc3e..8764c7470 100644--- a/tests/snapshots/integration__integration_tests__directives__switch_internal_powershell_directive.snap+++ b/tests/snapshots/integration__integration_tests__directives__switch_directive_file.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/directives.rsinfo:program: wtargs:- - "--internal=powershell"- switch- featureenv:@@ -24,12 +23,12 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpNSbcF7XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: trueexit_code: 0----- stdout ------Set-Location _REPO_.feature----- stderr -----[2m○[22m Switched to worktree for [1mfeature[22m @ [1m_REPO_.feature[22mdiff --git a/tests/snapshots/integration__integration_tests__internal_flag__list_with_internal_flag.snap b/tests/snapshots/integration__integration_tests__directives__switch_without_directive_file.snapsimilarity index 60%rename from tests/snapshots/integration__integration_tests__internal_flag__list_with_internal_flag.snaprename to tests/snapshots/integration__integration_tests__directives__switch_without_directive_file.snapindex e32ab44a1..dc1216601 100644--- a/tests/snapshots/integration__integration_tests__internal_flag__list_with_internal_flag.snap+++ b/tests/snapshots/integration__integration_tests__directives__switch_without_directive_file.snap@@ -1,10 +1,10 @@----source: tests/integration_tests/internal_flag.rs+source: tests/integration_tests/directives.rsinfo:program: wtargs:- - "--internal"- - list+ - switch+ - my-featureenv:APPDATA: "[TEST_CONFIG_HOME]"CLICOLOR_FORCE: "1"@@ -25,12 +25,11 @@ info:WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"----success: true-exit_code: 0+success: false+exit_code: 1----- stdout ---------- stderr ------ [1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage-@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+[31m✗[39m [31mBranch [1mmy-feature[22m not found[39m-[2m○[22m [2mShowing 1 worktree+[2m↳[22m [2mTo create a new branch, run [90mwt switch my-feature --create[39m; to list branches, run [90mwt list --branches --remotes[39m[22mdiff --git a/tests/snapshots/integration__integration_tests__help__help_config_long.snap b/tests/snapshots/integration__integration_tests__help__help_config_long.snapindex e36caa581..bfdfaf80c 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_long.snap@@ -231,7 +231,10 @@ Override the LLM command in CI to use a mock:Variable Purpose───────────────────────────────── ──────────────────────────────────────────────────────────────────────────+ WORKTRUNK_BIN Override binary path for shell wrappers (useful for testing dev builds)WORKTRUNK_CONFIG_PATH Override user config file location+ WORKTRUNK_DIRECTIVE_FILE Internal: set by shell wrappers to enable directory changes+ WORKTRUNK_SHELL Internal: set by shell wrappers to indicate shell type (e.g., powershell)WORKTRUNK_MAX_CONCURRENT_COMMANDS Max parallel git commands (default: 32). Lower if hitting resource limits.NO_COLOR Disable colored output (standard)CLICOLOR_FORCE Force colored output even when not a TTYdiff --git a/tests/snapshots/integration__integration_tests__init__init_bash.snap b/tests/snapshots/integration__integration_tests__init__init_bash.snapindex 0c47a2ac9..6bbed2c25 100644--- a/tests/snapshots/integration__integration_tests__init__init_bash.snap+++ b/tests/snapshots/integration__integration_tests__init__init_bash.snap@@ -35,23 +35,27 @@ exit_code: 0# Only initialize if wt is available (in PATH or via WORKTRUNK_BIN)if command -v wt >/dev/null 2>&1 || [[ -n "${WORKTRUNK_BIN:-}" ]]; then-# Capture stdout (shell script), eval in parent shell. stderr streams to terminal.+# Execute wt command with file-based directive passing.+# Creates a temp file, passes path via WORKTRUNK_DIRECTIVE_FILE, sources it after.# WORKTRUNK_BIN can override the binary path (for testing dev builds).wt_exec() {- local script exit_code=0- script="$(command "${WORKTRUNK_BIN:-wt}" "$@")" || exit_code=$?+ local directive_file exit_code=0+ directive_file="$(mktemp)"- if [[ -n "$script" ]]; then- eval "$script"+ WORKTRUNK_DIRECTIVE_FILE="$directive_file" command "${WORKTRUNK_BIN:-wt}" "$@" || exit_code=$?++ if [[ -s "$directive_file" ]]; then+ source "$directive_file"if [[ $exit_code -eq 0 ]]; thenexit_code=$?fifi+ rm -f "$directive_file"return "$exit_code"}- # Override wt command to add --internal flag+ # Override wt commandwt() {local use_source=falselocal args=()@@ -60,10 +64,10 @@ wt_exec() {if [[ "$arg" == "--source" ]]; then use_source=true; else args+=("$arg"); fidone- # Completion mode: call binary directly, bypassing --internal and wt_exec.+ # Completion mode: call binary directly, bypassing wt_exec.# This check MUST be here (not in the binary) because clap's completion- # handler runs before argument parsing - we can't detect --internal there.- # The binary outputs completion candidates, not shell script to eval.+ # handler runs before argument parsing.+ # The binary outputs completion candidates, not directives to source.if [[ -n "${COMPLETE:-}" ]]; thencommand "${WORKTRUNK_BIN:-wt}" "${args[@]}"return@@ -71,18 +75,22 @@ wt_exec() {# --source: use cargo run (builds from source)if [[ "$use_source" == true ]]; then+ # If stdout is not a terminal (piped/redirected), run directly.+ # This allows `wt list --format=json | jq` to work.if [[ ! -t 1 ]]; thencargo run --bin wt --quiet -- "${args[@]}"returnfi- local script exit_code=0- script="$(cargo run --bin wt --quiet -- --internal "${args[@]}")" || exit_code=$?- if [[ -n "$script" ]]; then- eval "$script"+ local directive_file exit_code=0+ directive_file="$(mktemp)"+ WORKTRUNK_DIRECTIVE_FILE="$directive_file" cargo run --bin wt --quiet -- "${args[@]}" || exit_code=$?+ if [[ -s "$directive_file" ]]; then+ source "$directive_file"if [[ $exit_code -eq 0 ]]; thenexit_code=$?fifi+ rm -f "$directive_file"return "$exit_code"fi@@ -93,7 +101,7 @@ wt_exec() {returnfi- wt_exec --internal "${args[@]}"+ wt_exec "${args[@]}"}# Lazy completions - generate on first TAB, then delegate to clap's completerdiff --git a/tests/snapshots/integration__integration_tests__init__init_fish.snap b/tests/snapshots/integration__integration_tests__init__init_fish.snapindex ba185dde0..0fefb0086 100644--- a/tests/snapshots/integration__integration_tests__init__init_fish.snap+++ b/tests/snapshots/integration__integration_tests__init__init_fish.snap@@ -34,32 +34,33 @@ exit_code: 0# Only initialize if wt is available (in PATH or via WORKTRUNK_BIN)if type -q wt; or test -n "$WORKTRUNK_BIN"- # Capture stdout (shell script), eval in parent shell. stderr streams to terminal.+ # Execute wt command with file-based directive passing.+ # Creates a temp file, passes path via WORKTRUNK_DIRECTIVE_FILE, evals it after.# WORKTRUNK_BIN can override the binary path (for testing dev builds).#- # We use pipeline capture (`| read`) instead of command substitution (`(...)`)- # because fish's command substitution runs in its own pipeline where stderr- # doesn't inherit caller redirects. With pipeline capture, stderr flows through- # normally and respects redirects like `wt --help &>file`.+ # Note: We use `eval (cat ... | string collect)` instead of `source` because:+ # 1. fish's `source` doesn't propagate `exit` to the parent function+ # 2. `eval (cat ...)` without `string collect` splits on newlines, breaking multiline directives+ # With `string collect`, `exit 42` properly exits the function with code 42.function wt_exectest -n "$WORKTRUNK_BIN"; or set -l WORKTRUNK_BIN (type -P wt)- # Pipeline capture: stderr streams through, stdout captured via read- # -z (null delimiter) ensures we capture all lines, not just the first- command $WORKTRUNK_BIN $argv | string collect --allow-empty | read --local -z script- set -l exit_code $pipestatus[1]+ set -l directive_file (mktemp)+ WORKTRUNK_DIRECTIVE_FILE=$directive_file command $WORKTRUNK_BIN $argv+ set -l exit_code $status- if test -n "$script"- eval $script+ if test -s "$directive_file"+ eval (cat "$directive_file" | string collect)if test $exit_code -eq 0set exit_code $statusendend+ rm -f "$directive_file"return $exit_codeend- # Override wt command to add --internal flag+ # Override wt commandfunction wtset -l use_source falseset -l args@@ -70,18 +71,22 @@ if type -q wt; or test -n "$WORKTRUNK_BIN"# --source: use cargo run (builds from source)if test $use_source = true+ # If stdout is not a terminal (piped/redirected), run directly.+ # This allows `wt list --format=json | jq` to work.if not isatty stdoutcargo run --bin wt --quiet -- $argsreturn $statusend- cargo run --bin wt --quiet -- --internal $args | string collect --allow-empty | read --local -z script- set -l exit_code $pipestatus[1]- if test -n "$script"- eval $script+ set -l directive_file (mktemp)+ WORKTRUNK_DIRECTIVE_FILE=$directive_file cargo run --bin wt --quiet -- $args+ set -l exit_code $status+ if test -s "$directive_file"+ eval (cat "$directive_file" | string collect)if test $exit_code -eq 0set exit_code $statusendend+ rm -f "$directive_file"return $exit_codeend@@ -93,7 +98,7 @@ if type -q wt; or test -n "$WORKTRUNK_BIN"return $statusend- wt_exec --internal $args+ wt_exec $argsend# Completions are in ~/.config/fish/completions/wt.fish (installed by `wt config shell install`)diff --git a/tests/snapshots/integration__integration_tests__init__init_zsh.snap b/tests/snapshots/integration__integration_tests__init__init_zsh.snapindex 292e72bbb..b0519935d 100644--- a/tests/snapshots/integration__integration_tests__init__init_zsh.snap+++ b/tests/snapshots/integration__integration_tests__init__init_zsh.snap@@ -38,23 +38,27 @@ exit_code: 0# Only initialize if wt is available (in PATH or via WORKTRUNK_BIN)if command -v wt >/dev/null 2>&1 || [[ -n "${WORKTRUNK_BIN:-}" ]]; then-# Capture stdout (shell script), eval in parent shell. stderr streams to terminal.+# Execute wt command with file-based directive passing.+# Creates a temp file, passes path via WORKTRUNK_DIRECTIVE_FILE, sources it after.# WORKTRUNK_BIN can override the binary path (for testing dev builds).wt_exec() {- local script exit_code=0- script="$(command "${WORKTRUNK_BIN:-wt}" "$@")" || exit_code=$?+ local directive_file exit_code=0+ directive_file="$(mktemp)"- if [[ -n "$script" ]]; then- eval "$script"+ WORKTRUNK_DIRECTIVE_FILE="$directive_file" command "${WORKTRUNK_BIN:-wt}" "$@" || exit_code=$?++ if [[ -s "$directive_file" ]]; then+ source "$directive_file"if [[ $exit_code -eq 0 ]]; thenexit_code=$?fifi+ rm -f "$directive_file"return "$exit_code"}- # Override wt command to add --internal flag+ # Override wt commandwt() {local use_source=falselocal -a args@@ -63,10 +67,10 @@ wt_exec() {if [[ "$arg" == "--source" ]]; then use_source=true; else args+=("$arg"); fidone- # Completion mode: call binary directly, bypassing --internal and wt_exec.+ # Completion mode: call binary directly, bypassing wt_exec.# This check MUST be here (not in the binary) because clap's completion- # handler runs before argument parsing - we can't detect --internal there.- # The binary outputs completion candidates, not shell script to eval.+ # handler runs before argument parsing.+ # The binary outputs completion candidates, not directives to source.if [[ -n "${COMPLETE:-}" ]]; thencommand "${WORKTRUNK_BIN:-wt}" "${args[@]}"return@@ -74,18 +78,22 @@ wt_exec() {# --source: use cargo run (builds from source)if [[ "$use_source" == true ]]; then+ # If stdout is not a terminal (piped/redirected), run directly.+ # This allows `wt list --format=json | jq` to work.if [[ ! -t 1 ]]; thencargo run --bin wt --quiet -- "${args[@]}"returnfi- local script exit_code=0- script="$(cargo run --bin wt --quiet -- --internal "${args[@]}")" || exit_code=$?- if [[ -n "$script" ]]; then- eval "$script"+ local directive_file exit_code=0+ directive_file="$(mktemp)"+ WORKTRUNK_DIRECTIVE_FILE="$directive_file" cargo run --bin wt --quiet -- "${args[@]}" || exit_code=$?+ if [[ -s "$directive_file" ]]; then+ source "$directive_file"if [[ $exit_code -eq 0 ]]; thenexit_code=$?fifi+ rm -f "$directive_file"return "$exit_code"fi@@ -96,7 +104,7 @@ wt_exec() {returnfi- wt_exec --internal "${args[@]}"+ wt_exec "${args[@]}"}# Lazy completions - generate on first TAB, then delegate to clap's completerdiff --git a/tests/snapshots/integration__integration_tests__internal_flag__config_show_with_internal_flag.snap b/tests/snapshots/integration__integration_tests__internal_flag__config_show_with_internal_flag.snapdeleted file mode 100644index 983ed01c6..000000000--- a/tests/snapshots/integration__integration_tests__internal_flag__config_show_with_internal_flag.snap+++ /dev/null@@ -1,43 +0,0 @@-----source: tests/integration_tests/internal_flag.rs-info:- program: wt- args:- - "--internal"- - config- - show- env:- APPDATA: "[TEST_CONFIG_HOME]"- CLICOLOR_FORCE: "1"- COLUMNS: "150"- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"- GIT_CONFIG_SYSTEM: /dev/null- GIT_EDITOR: ""- GIT_TERMINAL_PROMPT: "0"- HOME: "[TEST_HOME]"- LANG: C- LC_ALL: C- PATH: "[PATH]"- RUST_LOG: warn- SOURCE_DATE_EPOCH: "1735776000"- USERPROFILE: "[TEST_HOME]"- WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"-----success: true-exit_code: 0------ stdout ------------ stderr ------[36mUSER CONFIG[39m ~/.config/worktrunk/config.toml-[107m [0m worktree-path = [32m"../{{ main_worktree }}.{{ branch }}"--[36mPROJECT CONFIG[39m _REPO_/.config/wt.toml-[2m↳[22m [2mNot found[22m--[36mSHELL INTEGRATION[39m-[2m○[22m [2mSkipped bash; ~/.bashrc not found[22m-[2m○[22m [2mSkipped zsh; ~/.zshrc not found[22m-[2m○[22m [2mSkipped fish; ~/.config/fish/conf.d not found[22mdiff --git a/tests/snapshots/integration__integration_tests__list__branch_only_with_status.snap b/tests/snapshots/integration__integration_tests__list__branch_only_with_status.snapindex 17ba23c2d..b776d34a0 100644--- a/tests/snapshots/integration__integration_tests__list__branch_only_with_status.snap+++ b/tests/snapshots/integration__integration_tests__list__branch_only_with_status.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2mbranch-only[0m [2m/[22m[2m_[22m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktrees, 1 branches++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__default_branch_missing_worktree.snap b/tests/snapshots/integration__integration_tests__list__default_branch_missing_worktree.snapindex 7de2a8746..d5839875a 100644--- a/tests/snapshots/integration__integration_tests__list__default_branch_missing_worktree.snap+++ b/tests/snapshots/integration__integration_tests__list__default_branch_missing_worktree.snap@@ -27,9 +27,9 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ develop [31m⚑[39m[2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktree++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__detached_head.snap b/tests/snapshots/integration__integration_tests__list__detached_head.snapindex a7e1c7704..81dc0fc9f 100644--- a/tests/snapshots/integration__integration_tests__list__detached_head.snap+++ b/tests/snapshots/integration__integration_tests__list__detached_head.snap@@ -27,9 +27,9 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ - [31m⚑[39m[2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktree++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__detached_head_in_worktree.snap b/tests/snapshots/integration__integration_tests__list__detached_head_in_worktree.snapindex f49d18693..b9059bcd8 100644--- a/tests/snapshots/integration__integration_tests__list__detached_head_in_worktree.snap+++ b/tests/snapshots/integration__integration_tests__list__detached_head_in_worktree.snap@@ -27,10 +27,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2m-[0m [31m⚑[39m[2m_[22m [2m../repo.feature[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__git_error_warning.snap b/tests/snapshots/integration__integration_tests__list__git_error_warning.snapindex 0a7fd0e96..6b37d6a00 100644--- a/tests/snapshots/integration__integration_tests__list__git_error_warning.snap+++ b/tests/snapshots/integration__integration_tests__list__git_error_warning.snap@@ -27,13 +27,13 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ feature [33m✗[39m ../repo.feature [2m00000000[0m [2m55y[0m [2m[2m○[22m [2mShowing 2 worktrees++----- stderr -----[33m▲[39m [33mSome git operations failed:[107m [0m [1mfeature[22m: commit-details (fatal: bad object 0000000000000000000000000000000000000000)[107m [0m [1mfeature[22m: ahead-behind (fatal: Invalid symmetric difference expression main...0000000000000000000000000000000000000000)diff --git a/tests/snapshots/integration__integration_tests__list__large_diffs_alignment.snap b/tests/snapshots/integration__integration_tests__list__large_diffs_alignment.snapindex 81ad87825..693de6210 100644--- a/tests/snapshots/integration__integration_tests__list__large_diffs_alignment.snap+++ b/tests/snapshots/integration__integration_tests__list__large_diffs_alignment.snap@@ -27,8 +27,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ diverged [36m![39m [2m↑[22m 💬 [32m+40[0m [31m-60[0m [32m↑1[0m ../repo.diverged [2ma86ce3fb[0m [2m1d[0m [2mDiverged commit@@ -36,3 +34,5 @@ exit_code: 0+ fix [36m?[39m [2m–[22m 💬 ../repo.fix [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 4 worktrees, 3 with changes, 2 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__list_ordering_rules.snap b/tests/snapshots/integration__integration_tests__list__list_ordering_rules.snapindex 037dc80f7..968319c58 100644--- a/tests/snapshots/integration__integration_tests__list__list_ordering_rules.snap+++ b/tests/snapshots/integration__integration_tests__list__list_ordering_rules.snap@@ -27,8 +27,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ feature-current [2m↑[22m [32m↑1[0m ../repo.feature-current [2m431987e2[0m [2m23h[0m [2mCommit at 01:00^ main [2m^[22m . [2mb8b9f445[0m [2m1d[0m [2mInitial commit on main@@ -37,3 +35,5 @@ exit_code: 0+ feature-oldest [2m↑[22m [32m↑1[0m ../repo.feature-oldest [2m9777b5e4[0m [2m23h[0m [2mCommit at 00:30[2m○[22m [2mShowing 5 worktrees, 4 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__list_primary_on_different_branch.snap b/tests/snapshots/integration__integration_tests__list__list_primary_on_different_branch.snapindex b1d3492c4..1ed47edbd 100644--- a/tests/snapshots/integration__integration_tests__list__list_primary_on_different_branch.snap+++ b/tests/snapshots/integration__integration_tests__list__list_primary_on_different_branch.snap@@ -27,11 +27,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ develop [31m⚑[39m[2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-a[0m [2m_[22m [2m../repo.feature-a[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-b[0m [2m_[22m [2m../repo.feature-b[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 3 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__list_with_c_flag.snap b/tests/snapshots/integration__integration_tests__list__list_with_c_flag.snapindex 25e7407fd..880ca28b5 100644--- a/tests/snapshots/integration__integration_tests__list__list_with_c_flag.snap+++ b/tests/snapshots/integration__integration_tests__list__list_with_c_flag.snap@@ -17,11 +17,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-a[0m [2m_[22m [2m../repo.feature-a[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-b[0m [2m_[22m [2m../repo.feature-b[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 3 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__locked_no_reason.snap b/tests/snapshots/integration__integration_tests__list__locked_no_reason.snapindex d043b7164..88ddbb5fb 100644--- a/tests/snapshots/integration__integration_tests__list__locked_no_reason.snap+++ b/tests/snapshots/integration__integration_tests__list__locked_no_reason.snap@@ -27,10 +27,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mlocked-no-reason[0m [33m⊞[39m[2m_[22m [2m../repo.locked-no-reason[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__locked_worktree.snap b/tests/snapshots/integration__integration_tests__list__locked_worktree.snapindex b721c8afe..cdb27fa68 100644--- a/tests/snapshots/integration__integration_tests__list__locked_worktree.snap+++ b/tests/snapshots/integration__integration_tests__list__locked_worktree.snap@@ -27,10 +27,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mlocked-feature[0m [33m⊞[39m[2m_[22m [2m../repo.locked-feature[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__long_commit_message.snap b/tests/snapshots/integration__integration_tests__list__long_commit_message.snapindex a5e93f2be..419187cf9 100644--- a/tests/snapshots/integration__integration_tests__list__long_commit_message.snap+++ b/tests/snapshots/integration__integration_tests__list__long_commit_message.snap@@ -27,10 +27,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2mc80da958[0m [2m1d[0m [2mShort message+ [2mfeature-a[0m [2m⊂[22m [2m[31m↓1[0m [2m../repo.feature-a[0m [2m0fcd1a46[0m [2m1d[0m [2mThis is a very long commit message that should test how the me…[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__many_worktrees_varied.snap b/tests/snapshots/integration__integration_tests__list__many_worktrees_varied.snapindex d74226f7a..06ac1a66f 100644--- a/tests/snapshots/integration__integration_tests__list__many_worktrees_varied.snap+++ b/tests/snapshots/integration__integration_tests__list__many_worktrees_varied.snap@@ -27,8 +27,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mmedium-name[0m [2m_[22m [2m../repo.medium-name[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit@@ -37,3 +35,5 @@ exit_code: 0+ [2mwith-changes[0m [2m_[22m [2m../repo.with-changes[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 5 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__maximum_status_symbols.snap b/tests/snapshots/integration__integration_tests__list__maximum_status_symbols.snapindex ad6a6da67..bacbc1790 100644--- a/tests/snapshots/integration__integration_tests__list__maximum_status_symbols.snap+++ b/tests/snapshots/integration__integration_tests__list__maximum_status_symbols.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m[2m⇡[22m . [32m⇡1[0m [2m9dd6c628[0m [2m1d[0m [2mMain advances+ feature [36m+[39m[36m![39m[36m?[39m[33m⊞[39m[33m✗[39m[2m⇅[22m🤖 [32m+2[0m [31m-2[0m [32m↑2[0m [2m[31m↓1[0m [32m+3[0m [31m-1[0m ../repo.feature [32m⇡1[0m [2m[31m⇣1[0m [2m88205002[0m [2m1d[0m [2mLocal commit[2m○[22m [2mShowing 2 worktrees, 1 with changes, 1 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__maximum_status_with_git_operation.snap b/tests/snapshots/integration__integration_tests__list__maximum_status_with_git_operation.snapindex 88ab15e8a..bed376819 100644--- a/tests/snapshots/integration__integration_tests__list__maximum_status_with_git_operation.snap+++ b/tests/snapshots/integration__integration_tests__list__maximum_status_with_git_operation.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2m1c3b3fec[0m [2m1d[0m [2mMain conflicting changes+ feature [36m+[39m[36m![39m[36m?[39m[31m✘[39m[2m–[22m 🤖 [32m+7[0m ../repo.feature [2m1c3b3fec[0m [2m1d[0m [2mMain conflicting changes[2m○[22m [2mShowing 2 worktrees, 1 with changes++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__maximum_working_tree_symbols.snap b/tests/snapshots/integration__integration_tests__list__maximum_working_tree_symbols.snapindex 0570da7ae..38e4c79bb 100644--- a/tests/snapshots/integration__integration_tests__list__maximum_working_tree_symbols.snap+++ b/tests/snapshots/integration__integration_tests__list__maximum_working_tree_symbols.snap@@ -27,10 +27,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ feature [36m+[39m[36m![39m[36m?[39m [2m↑[22m [32m+2[0m [31m-3[0m [32m↑1[0m ../repo.feature [2m095602ce[0m [2m1d[0m [2mAdd files[2m○[22m [2mShowing 2 worktrees, 1 with changes, 1 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__multiple_worktrees.snap b/tests/snapshots/integration__integration_tests__list__multiple_worktrees.snapindex 28572c2ce..40b75d8a0 100644--- a/tests/snapshots/integration__integration_tests__list__multiple_worktrees.snap+++ b/tests/snapshots/integration__integration_tests__list__multiple_worktrees.snap@@ -27,11 +27,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-a[0m [2m_[22m [2m../repo.feature-a[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-b[0m [2m_[22m [2m../repo.feature-b[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 3 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__no_progressive_flag.snap b/tests/snapshots/integration__integration_tests__list__no_progressive_flag.snapindex ba4ad4014..0ac29630f 100644--- a/tests/snapshots/integration__integration_tests__list__no_progressive_flag.snap+++ b/tests/snapshots/integration__integration_tests__list__no_progressive_flag.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature[0m [2m_[22m [2m../repo.feature[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__previous_worktree_gutter.snap b/tests/snapshots/integration__integration_tests__list__previous_worktree_gutter.snapindex 1205ff460..5ee218872 100644--- a/tests/snapshots/integration__integration_tests__list__previous_worktree_gutter.snap+++ b/tests/snapshots/integration__integration_tests__list__previous_worktree_gutter.snap@@ -27,10 +27,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit- [2mfeature[0m [2m_[22m [2m../repo.feature[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__progressive_flag.snap b/tests/snapshots/integration__integration_tests__list__progressive_flag.snapindex bdc221894..e18ec5b64 100644--- a/tests/snapshots/integration__integration_tests__list__progressive_flag.snap+++ b/tests/snapshots/integration__integration_tests__list__progressive_flag.snap@@ -28,11 +28,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-a[0m [2m_[22m [2m../repo.feature-a[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-b[0m [2m_[22m [2m../repo.feature-b[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 3 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__progressive_with_branches.snap b/tests/snapshots/integration__integration_tests__list__progressive_with_branches.snapindex e6847bd0f..ef1cfda46 100644--- a/tests/snapshots/integration__integration_tests__list__progressive_with_branches.snap+++ b/tests/snapshots/integration__integration_tests__list__progressive_with_branches.snap@@ -29,8 +29,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-a[0m [2m_[22m [2m../repo.feature-a[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit@@ -38,3 +36,5 @@ exit_code: 0[2morphan-2[0m [2m/[22m[2m_[22m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees, 2 branches++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__readme_example_list.snap b/tests/snapshots/integration__integration_tests__list__readme_example_list.snapindex 1a86011f7..5ca5ce237 100644--- a/tests/snapshots/integration__integration_tests__list__readme_example_list.snap+++ b/tests/snapshots/integration__integration_tests__list__readme_example_list.snap@@ -27,11 +27,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ feature-api [36m+[39m [2m↕[22m[2m⇡[22m [32m+54[0m [31m-5[0m [32m↑4[0m [2m[31m↓1[0m [32m⇡3[0m [2mec97decc[0m [2m30m[0m [2mAdd API tests^ main [2m^[22m[2m⇅[22m [32m⇡1[0m [2m[31m⇣1[0m [2m6088adb3[0m [2m4d[0m [2mMerge fix-auth: hardened to…+ fix-auth [2m↕[22m[2m|[22m [32m↑2[0m [2m[31m↓1[0m [2m|[0m [2m127407de[0m [2m5h[0m [2mAdd secure token storage[2m○[22m [2mShowing 3 worktrees, 1 with changes, 2 ahead, 1 column hidden++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__readme_example_list_branches.snap b/tests/snapshots/integration__integration_tests__list__readme_example_list_branches.snapindex 790d5fe70..64ed33a8b 100644--- a/tests/snapshots/integration__integration_tests__list__readme_example_list_branches.snap+++ b/tests/snapshots/integration__integration_tests__list__readme_example_list_branches.snap@@ -29,8 +29,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ feature-api [36m+[39m [2m↕[22m[2m⇡[22m [32m+54[0m [31m-5[0m [32m↑4[0m [2m[31m↓1[0m [32m+234[0m [31m-24[0m [32m⇡3[0m [2m[34m●[0m [2mec97decc[0m [2m30m[0m [2mAdd API tests^ main [2m^[22m[2m⇅[22m [32m⇡1[0m [2m[31m⇣1[0m [32m●[0m [2m6088adb3[0m [2m4d[0m [2mMerge fix-au…@@ -39,3 +37,5 @@ exit_code: 0wip [2m/[22m[2m↕[22m [32m↑1[0m [2m[31m↓1[0m [32m+33[0m [2md62fd0e8[0m [2m3d[0m [2mStart API do…[2m○[22m [2mShowing 3 worktrees, 2 branches, 1 with changes, 4 ahead, 1 column hidden++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__readme_example_list_full.snap b/tests/snapshots/integration__integration_tests__list__readme_example_list_full.snapindex 331b2fad2..c17889cc3 100644--- a/tests/snapshots/integration__integration_tests__list__readme_example_list_full.snap+++ b/tests/snapshots/integration__integration_tests__list__readme_example_list_full.snap@@ -28,11 +28,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ feature-api [36m+[39m [2m↕[22m[2m⇡[22m [32m+54[0m [31m-5[0m [32m↑4[0m [2m[31m↓1[0m [32m+234[0m [31m-24[0m [32m⇡3[0m [2m[34m●[0m [2mec97decc[0m [2m30m[0m [2mAdd API tests^ main [2m^[22m[2m⇅[22m [32m⇡1[0m [2m[31m⇣1[0m [32m●[0m [2m6088adb3[0m [2m4d[0m [2mMerge fix-au…+ fix-auth [2m↕[22m[2m|[22m [32m↑2[0m [2m[31m↓1[0m [32m+25[0m [31m-11[0m [2m|[0m [32m●[0m [2m127407de[0m [2m5h[0m [2mAdd secure t…[2m○[22m [2mShowing 3 worktrees, 1 with changes, 2 ahead, 1 column hidden++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__single_worktree.snap b/tests/snapshots/integration__integration_tests__list__single_worktree.snapindex d62679c60..9361b8608 100644--- a/tests/snapshots/integration__integration_tests__list__single_worktree.snap+++ b/tests/snapshots/integration__integration_tests__list__single_worktree.snap@@ -27,9 +27,9 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktree++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__status_column_padding_emoji.snap b/tests/snapshots/integration__integration_tests__list__status_column_padding_emoji.snapindex cd97124d4..8026cc59c 100644--- a/tests/snapshots/integration__integration_tests__list__status_column_padding_emoji.snap+++ b/tests/snapshots/integration__integration_tests__list__status_column_padding_emoji.snap@@ -27,8 +27,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ main-symbol [2m↑[22m 💬 [32m↑1[0m ../repo.main-symbol [2mb69fe20d[0m [2m1d[0m [2mSymbol commit@@ -36,3 +34,5 @@ exit_code: 0+ wli-sequence [36m![39m[36m?[39m [2m↑[22m 🤖 [32m+1[0m [31m-112[0m [32m↑1[0m ../repo.wli-sequence [2mc73070d4[0m [2m1d[0m [2mInitial content[2m○[22m [2mShowing 4 worktrees, 1 with changes, 3 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_detached_head.snap b/tests/snapshots/integration__integration_tests__list__task_dag_detached_head.snapindex f1023831d..8ab3c797c 100644--- a/tests/snapshots/integration__integration_tests__list__task_dag_detached_head.snap+++ b/tests/snapshots/integration__integration_tests__list__task_dag_detached_head.snap@@ -28,9 +28,9 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ - [31m⚑[39m[2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktree++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_full_with_diffs.snap b/tests/snapshots/integration__integration_tests__list__task_dag_full_with_diffs.snapindex 66149637e..3b662927b 100644--- a/tests/snapshots/integration__integration_tests__list__task_dag_full_with_diffs.snap+++ b/tests/snapshots/integration__integration_tests__list__task_dag_full_with_diffs.snap@@ -29,11 +29,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ feature-a [36m?[39m [2m–[22m ../repo.feature-a [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ feature-b [2m↑[22m [32m↑1[0m [32m+1[0m [31m-1[0m ../repo.feature-b [2m86bdffd3[0m [2m1d[0m [2mTest commit[2m○[22m [2mShowing 3 worktrees, 1 with changes, 1 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_many_worktrees.snap b/tests/snapshots/integration__integration_tests__list__task_dag_many_worktrees.snapindex 90cbbfade..17055678c 100644--- a/tests/snapshots/integration__integration_tests__list__task_dag_many_worktrees.snap+++ b/tests/snapshots/integration__integration_tests__list__task_dag_many_worktrees.snap@@ -28,8 +28,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-1[0m [2m_[22m [2m../repo.feature-1[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit@@ -44,3 +42,5 @@ exit_code: 0+ [2mfeature-9[0m [2m_[22m [2m../repo.feature-9[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 11 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_multiple_worktrees.snap b/tests/snapshots/integration__integration_tests__list__task_dag_multiple_worktrees.snapindex 489ab1a61..34b58e6eb 100644--- a/tests/snapshots/integration__integration_tests__list__task_dag_multiple_worktrees.snap+++ b/tests/snapshots/integration__integration_tests__list__task_dag_multiple_worktrees.snap@@ -28,8 +28,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-a[0m [2m_[22m [2m../repo.feature-a[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit@@ -37,3 +35,5 @@ exit_code: 0+ [2mfeature-c[0m [2m_[22m [2m../repo.feature-c[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 4 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_ordering_stability.snap b/tests/snapshots/integration__integration_tests__list__task_dag_ordering_stability.snapindex 141dd6934..e269c0b34 100644--- a/tests/snapshots/integration__integration_tests__list__task_dag_ordering_stability.snap+++ b/tests/snapshots/integration__integration_tests__list__task_dag_ordering_stability.snap@@ -28,8 +28,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ feature-current [2m↑[22m [32m↑1[0m ../repo.feature-current [2m431987e2[0m [2m23h[0m [2mCommit at 01:00^ main [2m^[22m . [2mb8b9f445[0m [2m1d[0m [2mInitial commit on main@@ -38,3 +36,5 @@ exit_code: 0+ feature-oldest [2m↑[22m [32m↑1[0m ../repo.feature-oldest [2m9777b5e4[0m [2m23h[0m [2mCommit at 00:30[2m○[22m [2mShowing 5 worktrees, 4 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_single_worktree.snap b/tests/snapshots/integration__integration_tests__list__task_dag_single_worktree.snapindex ab0ae7630..3529fd402 100644--- a/tests/snapshots/integration__integration_tests__list__task_dag_single_worktree.snap+++ b/tests/snapshots/integration__integration_tests__list__task_dag_single_worktree.snap@@ -28,9 +28,9 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktree++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_with_locked.snap b/tests/snapshots/integration__integration_tests__list__task_dag_with_locked.snapindex 3133197f6..34938ba23 100644--- a/tests/snapshots/integration__integration_tests__list__task_dag_with_locked.snap+++ b/tests/snapshots/integration__integration_tests__list__task_dag_with_locked.snap@@ -28,11 +28,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mlocked[0m [33m⊞[39m[2m_[22m [2m../repo.locked[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mnormal[0m [2m_[22m [2m../repo.normal[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 3 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_with_upstream.snap b/tests/snapshots/integration__integration_tests__list__task_dag_with_upstream.snapindex 7aed55027..f71356827 100644--- a/tests/snapshots/integration__integration_tests__list__task_dag_with_upstream.snap+++ b/tests/snapshots/integration__integration_tests__list__task_dag_with_upstream.snap@@ -29,11 +29,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m[2m|[22m . [2m|[0m [2mb8b9f445[0m [2m1d[0m [2mInitial commit on main+ ahead [2m↑[22m[2m⇡[22m [32m↑1[0m [32m+1[0m ../repo.ahead [32m⇡1[0m [2ma66d3071[0m [2m1d[0m [2mAhead commit+ [2min-sync[0m [2m_[22m[2m|[22m [2m../repo.in-sync[0m [2m|[0m [2mb8b9f445[0m [2m1d[0m [2mInitial commit on main[2m○[22m [2mShowing 3 worktrees, 1 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__unicode_commit_message.snap b/tests/snapshots/integration__integration_tests__list__unicode_commit_message.snapindex ca3b8fa58..6533e7bbd 100644--- a/tests/snapshots/integration__integration_tests__list__unicode_commit_message.snap+++ b/tests/snapshots/integration__integration_tests__list__unicode_commit_message.snap@@ -27,10 +27,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2md167d3cc[0m [2m1d[0m [2mFix bug with café ☕ handling+ [2mfeature-test[0m [2m⊂[22m [2m[31m↓1[0m [2m../repo.feature-test[0m [2m96b95eab[0m [2m1d[0m [2mAdd support for 日本語 and émoji 🎉[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__user_marker_special_chars.snap b/tests/snapshots/integration__integration_tests__list__user_marker_special_chars.snapindex ee3abe95a..bc147d404 100644--- a/tests/snapshots/integration__integration_tests__list__user_marker_special_chars.snap+++ b/tests/snapshots/integration__integration_tests__list__user_marker_special_chars.snap@@ -27,11 +27,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2memoji[0m [2m_[22m 🔄 [2m../repo.emoji[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mmulti[0m [2m_[22m 👨💻 [2m../repo.multi[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 3 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__with_branches_flag.snap b/tests/snapshots/integration__integration_tests__list__with_branches_flag.snapindex 42f440a82..f7cd37dd2 100644--- a/tests/snapshots/integration__integration_tests__list__with_branches_flag.snap+++ b/tests/snapshots/integration__integration_tests__list__with_branches_flag.snap@@ -28,8 +28,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-with-worktree[0m [2m_[22m [2m../repo.feature-with-worktree[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit@@ -38,3 +36,5 @@ exit_code: 0[2mfix-bug[0m [2m/[22m[2m_[22m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees, 3 branches++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__with_branches_flag_none_available.snap b/tests/snapshots/integration__integration_tests__list__with_branches_flag_none_available.snapindex 7c571fc56..cc9516c48 100644--- a/tests/snapshots/integration__integration_tests__list__with_branches_flag_none_available.snap+++ b/tests/snapshots/integration__integration_tests__list__with_branches_flag_none_available.snap@@ -28,11 +28,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-a[0m [2m_[22m [2m../repo.feature-a[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-b[0m [2m_[22m [2m../repo.feature-b[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 3 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snap b/tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snapindex 02a221287..bcd65ab8c 100644--- a/tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snap+++ b/tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snap@@ -28,8 +28,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2mbranch-alpha[0m [2m/[22m[2m_[22m [2ma1e809f5[0m [2m1d[0m [2mInitial commit@@ -37,3 +35,5 @@ exit_code: 0[2mbranch-gamma[0m [2m/[22m[2m_[22m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktrees, 3 branches++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__with_remotes_and_branches.snap b/tests/snapshots/integration__integration_tests__list__with_remotes_and_branches.snapindex a6139ef39..1903afbcd 100644--- a/tests/snapshots/integration__integration_tests__list__with_remotes_and_branches.snap+++ b/tests/snapshots/integration__integration_tests__list__with_remotes_and_branches.snap@@ -29,8 +29,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m[2m|[22m . [2m|[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2mlocal-only-1[0m [2m/[22m[2m_[22m [2ma1e809f5[0m [2m1d[0m [2mInitial commit@@ -39,3 +37,5 @@ exit_code: 0[2morigin/remote-only-2[0m [2m/[22m[2m_[22m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktrees, 2 branches, 2 remote branches++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__with_remotes_filters_worktrees.snap b/tests/snapshots/integration__integration_tests__list__with_remotes_filters_worktrees.snapindex f63753802..e1185f229 100644--- a/tests/snapshots/integration__integration_tests__list__with_remotes_filters_worktrees.snap+++ b/tests/snapshots/integration__integration_tests__list__with_remotes_filters_worktrees.snap@@ -28,11 +28,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m[2m|[22m . [2m|[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mfeature-with-worktree[0m [2m_[22m [2m../repo.feature-with-worktree[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2morigin/remote-only[0m [2m/[22m[2m_[22m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 2 worktrees, 1 remote branches++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__with_remotes_flag.snap b/tests/snapshots/integration__integration_tests__list__with_remotes_flag.snapindex 14149963a..a952e1121 100644--- a/tests/snapshots/integration__integration_tests__list__with_remotes_flag.snap+++ b/tests/snapshots/integration__integration_tests__list__with_remotes_flag.snap@@ -28,11 +28,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m[2m|[22m . [2m|[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2morigin/remote-feature-1[0m [2m/[22m[2m_[22m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2morigin/remote-feature-2[0m [2m/[22m[2m_[22m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktrees, 2 remote branches++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__with_upstream_tracking.snap b/tests/snapshots/integration__integration_tests__list__with_upstream_tracking.snapindex c6d6e38c3..d39abf968 100644--- a/tests/snapshots/integration__integration_tests__list__with_upstream_tracking.snap+++ b/tests/snapshots/integration__integration_tests__list__with_upstream_tracking.snap@@ -29,8 +29,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mPath[0m [1mRemote⇅[0m [1mCI[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m[2m|[22m . [2m|[0m [2mb8b9f445[0m [2m1d[0m [2mInitial commit on main+ ahead [2m↑[22m[2m⇡[22m [32m↑2[0m [32m+2[0m ../repo.ahead [32m⇡2[0m [2m9c8b56b3[0m [2m1d[0m [2mAhead commit 2@@ -40,3 +38,5 @@ exit_code: 0+ [2mno-upstream[0m [2m_[22m [2m../repo.no-upstream[0m [2mb8b9f445[0m [2m1d[0m [2mInitial commit on main[2m○[22m [2mShowing 6 worktrees, 2 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list__with_user_marker.snap b/tests/snapshots/integration__integration_tests__list__with_user_marker.snapindex 909913042..1c15162c0 100644--- a/tests/snapshots/integration__integration_tests__list__with_user_marker.snap+++ b/tests/snapshots/integration__integration_tests__list__with_user_marker.snap@@ -27,8 +27,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma058e792[0m [2m1d[0m [2mInitial commit+ feature-api [2m↑[22m 🤖 [32m↑1[0m ../repo.feature-api [2m95e48b49[0m [2m1d[0m [2mAdd REST API endpoints@@ -36,3 +34,5 @@ exit_code: 0+ wip-docs [36m?[39m [2m–[22m ../repo.wip-docs [2ma058e792[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 4 worktrees, 2 with changes, 2 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_alignment_check.snap b/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_alignment_check.snapindex 230dcedad..96ae21c57 100644--- a/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_alignment_check.snap+++ b/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_alignment_check.snap@@ -27,10 +27,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ test [36m![39m[36m?[39m [2m↑[22m [32m+1[0m [31m-1[0m [32m↑1[0m ../repo.test [2m689d5d16[0m [2m1d[0m [2mTest[2m○[22m [2mShowing 2 worktrees, 1 with changes, 1 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_width_consistency.snap b/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_width_consistency.snapindex 317419da2..6edfaf086 100644--- a/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_width_consistency.snap+++ b/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_width_consistency.snap@@ -27,11 +27,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ complex [36m+[39m [36m?[39m [2m↑[22m [32m+1[0m [31m-1[0m [32m↑1[0m ../repo.complex [2m42162296[0m [2m1d[0m [2mComplex+ simple [36m?[39m [2m↑[22m [32m↑1[0m ../repo.simple [2m63ee5cb5[0m [2m1d[0m [2mSimple[2m○[22m [2mShowing 3 worktrees, 2 with changes, 2 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list_config__list_config_branches_enabled.snap b/tests/snapshots/integration__integration_tests__list_config__list_config_branches_enabled.snapindex f31d8ff4d..a6f091af8 100644--- a/tests/snapshots/integration__integration_tests__list_config__list_config_branches_enabled.snap+++ b/tests/snapshots/integration__integration_tests__list_config__list_config_branches_enabled.snap@@ -27,9 +27,9 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktree++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list_config__list_config_cli_override.snap b/tests/snapshots/integration__integration_tests__list_config__list_config_cli_override.snapindex d7bc4de41..e150cda35 100644--- a/tests/snapshots/integration__integration_tests__list_config__list_config_cli_override.snap+++ b/tests/snapshots/integration__integration_tests__list_config__list_config_cli_override.snap@@ -28,10 +28,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2mfeature[0m [2m/[22m[2m_[22m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktrees, 1 branches++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list_config__list_config_full_and_branches.snap b/tests/snapshots/integration__integration_tests__list_config__list_config_full_and_branches.snapindex f31d8ff4d..a6f091af8 100644--- a/tests/snapshots/integration__integration_tests__list_config__list_config_full_and_branches.snap+++ b/tests/snapshots/integration__integration_tests__list_config__list_config_full_and_branches.snap@@ -27,9 +27,9 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktree++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list_config__list_config_full_enabled.snap b/tests/snapshots/integration__integration_tests__list_config__list_config_full_enabled.snapindex f31d8ff4d..a6f091af8 100644--- a/tests/snapshots/integration__integration_tests__list_config__list_config_full_enabled.snap+++ b/tests/snapshots/integration__integration_tests__list_config__list_config_full_enabled.snap@@ -27,9 +27,9 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktree++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__list_config__list_no_config.snap b/tests/snapshots/integration__integration_tests__list_config__list_no_config.snapindex f31d8ff4d..a6f091af8 100644--- a/tests/snapshots/integration__integration_tests__list_config__list_no_config.snap+++ b/tests/snapshots/integration__integration_tests__list_config__list_no_config.snap@@ -27,9 +27,9 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktree++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap b/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snapindex 22707b1e8..af053c6fd 100644--- a/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap+++ b/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/remove.rsinfo:program: wtargs:- - "--internal"- removeenv:APPDATA: "[TEST_CONFIG_HOME]"@@ -23,12 +22,12 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpjdyPXGXDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: trueexit_code: 0----- stdout ------cd _REPO_----- stderr -----[36m◎ Removing [1mfeature-internal[22m worktree & branch in background (same commit as [1mmain[22m,[39m [2m_[22m[36m)[39mdiff --git a/tests/snapshots/integration__integration_tests__security__branch_name_with_cd_directive_not_executed.snap b/tests/snapshots/integration__integration_tests__security__branch_name_with_cd_directive_not_executed.snapindex aa7aa2272..1b65415e0 100644--- a/tests/snapshots/integration__integration_tests__security__branch_name_with_cd_directive_not_executed.snap+++ b/tests/snapshots/integration__integration_tests__security__branch_name_with_cd_directive_not_executed.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/security.rsinfo:program: wtargs:- - "--internal"- switch- "--create"- __WORKTRUNK_CD__/tmp@@ -25,6 +24,7 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpkyUIH2XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: false@@ -32,6 +32,6 @@ exit_code: 1----- stdout ---------- stderr ------[0m[31m✗[39m [31mBranch [1m__WORKTRUNK_CD__/tmp[22m already exists[39m+[31m✗[39m [31mBranch [1m__WORKTRUNK_CD__/tmp[22m already exists[39m[2m↳[22m [2mTo switch to the existing branch, remove [90m--create[39m; run [90mwt switch __WORKTRUNK_CD__/tmp[39m[22mdiff --git a/tests/snapshots/integration__integration_tests__security__commit_message_with_directive_not_executed.snap b/tests/snapshots/integration__integration_tests__security__commit_message_with_directive_not_executed.snapindex d11e9e718..433a8c8e6 100644--- a/tests/snapshots/integration__integration_tests__security__commit_message_with_directive_not_executed.snap+++ b/tests/snapshots/integration__integration_tests__security__commit_message_with_directive_not_executed.snap@@ -27,10 +27,10 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2m85d55864[0m [2m1d[0m [2mFix bug __WORKTRUNK_EXEC__echo PWNED > /tmp/hacked4+ [2mfeature[0m [2m_[22m [2m../repo.feature[0m [2m85d55864[0m [2m1d[0m [2mFix bug __WORKTRUNK_EXEC__echo PWNED > /tmp/hacked4[2m○[22m [2mShowing 2 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__security__error_message_with_directive_not_executed.snap b/tests/snapshots/integration__integration_tests__security__error_message_with_directive_not_executed.snapindex 9d74ae57a..acc23049e 100644--- a/tests/snapshots/integration__integration_tests__security__error_message_with_directive_not_executed.snap+++ b/tests/snapshots/integration__integration_tests__security__error_message_with_directive_not_executed.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/security.rsinfo:program: wtargs:- - "--internal"- switch- __WORKTRUNK_EXEC__echo PWNED > /tmp/hacked6env:@@ -24,6 +23,7 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpMhB5XqXDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: false@@ -31,6 +31,6 @@ exit_code: 1----- stdout ---------- stderr ------[0m[31m✗[39m [31mBranch [1m__WORKTRUNK_EXEC__echo PWNED > /tmp/hacked6[22m not found[39m+[31m✗[39m [31mBranch [1m__WORKTRUNK_EXEC__echo PWNED > /tmp/hacked6[22m not found[39m[2m↳[22m [2mTo create a new branch, run [90mwt switch '__WORKTRUNK_EXEC__echo PWNED > /tmp/hacked6' --create[39m; to list branches, run [90mwt list --branches --remotes[39m[22mdiff --git a/tests/snapshots/integration__integration_tests__security__path_with_directive_not_executed.snap b/tests/snapshots/integration__integration_tests__security__path_with_directive_not_executed.snapindex 7abd64ca4..94cbed1f1 100644--- a/tests/snapshots/integration__integration_tests__security__path_with_directive_not_executed.snap+++ b/tests/snapshots/integration__integration_tests__security__path_with_directive_not_executed.snap@@ -27,9 +27,9 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 1 worktree++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_empty_diffs.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_empty_diffs.snapindex 09be55850..cdc30d58c 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_empty_diffs.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_empty_diffs.snap@@ -27,8 +27,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2malso-no-changes[0m [2m_[22m [2m../repo.also-no-changes[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit@@ -36,3 +34,5 @@ exit_code: 0+ with-changes [36m![39m [2m–[22m [32m+1[0m [31m-1[0m ../repo.with-changes [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 4 worktrees, 1 with changes++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_extreme_diffs.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_extreme_diffs.snapindex 8f74779dc..e3d1d06c1 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_extreme_diffs.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_extreme_diffs.snap@@ -27,11 +27,11 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ huge [36m?[39m [2m–[22m ../repo.huge [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ tiny [36m![39m [2m–[22m [32m+1[0m [31m-1[0m ../repo.tiny [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 3 worktrees, 2 with changes++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_varying_diffs.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_varying_diffs.snapindex 4bfac9b63..6509dc364 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_varying_diffs.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_varying_diffs.snap@@ -27,8 +27,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ feature-large [36m?[39m [2m–[22m ../repo.feature-large [2ma1e809f5[0m [2m1d[0m [2mInitial commit@@ -36,3 +34,5 @@ exit_code: 0+ feature-small [36m?[39m [2m–[22m ../repo.feature-small [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 4 worktrees, 3 with changes++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__long_branch_names.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__long_branch_names.snapindex 4c171556a..d4c425fe2 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__long_branch_names.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__long_branch_names.snap@@ -27,8 +27,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2manother-extremely-long-name-here[0m [2m_[22m [2m../repo.another-extremely-long-name-here[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit@@ -36,3 +34,5 @@ exit_code: 0+ [2mvery-long-feature-branch-name[0m [2m_[22m [2m../repo.very-long-feature-branch-name[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 4 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__mixed_length_branch_names.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__mixed_length_branch_names.snapindex f02e367c6..c6c343787 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__mixed_length_branch_names.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__mixed_length_branch_names.snap@@ -27,8 +27,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mextremely-long-branch-name-that-might-cause-layout-issues[0m [2m_[22m [2ma1e809f5[0m [2m1d[0m [2mInitial commit@@ -36,3 +34,5 @@ exit_code: 0+ [2mx[0m [2m_[22m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 4 worktrees, 1 column hidden++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__short_branch_names.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__short_branch_names.snapindex 3a6da02fe..c2d865301 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__short_branch_names.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__short_branch_names.snap@@ -27,8 +27,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2ma[0m [2m_[22m [2m../repo.a[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit@@ -36,3 +34,5 @@ exit_code: 0+ [2mccc[0m [2m_[22m [2m../repo.ccc[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 4 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__unicode_branch_names.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__unicode_branch_names.snapindex 75c84b0e7..7cf51614d 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__unicode_branch_names.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__unicode_branch_names.snap@@ -27,8 +27,6 @@ info:success: trueexit_code: 0----- stdout ------------ stderr -----[1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mPath[0m [1mRemote⇅[0m [1mCommit[0m [1mAge[0m [1mMessage@ main [2m^[22m . [2ma1e809f5[0m [2m1d[0m [2mInitial commit+ [2mcafe[0m [2m_[22m [2m../repo.cafe[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit@@ -36,3 +34,5 @@ exit_code: 0+ [2mresume[0m [2m_[22m [2m../repo.resume[0m [2ma1e809f5[0m [2m1d[0m [2mInitial commit[2m○[22m [2mShowing 4 worktrees++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__switch__switch_error_main_worktree_on_different_branch.snap b/tests/snapshots/integration__integration_tests__switch__switch_error_main_worktree_on_different_branch.snapindex 443f029cf..a277a7c46 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_error_main_worktree_on_different_branch.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_error_main_worktree_on_different_branch.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/switch.rsinfo:program: wtargs:- - "--internal"- switch- mainenv:@@ -24,6 +23,7 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp2rkJvkXDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: false@@ -31,7 +31,7 @@ exit_code: 1----- stdout ---------- stderr ------[0m[31m✗[39m [31mCannot create worktree for [1mmain[22m: existing worktree at [1m_REPO_[22m on [1mfeature[22m[39m+[31m✗[39m [31mCannot create worktree for [1mmain[22m: existing worktree at [1m_REPO_[22m on [1mfeature[22m[39m[2m↳[22m [2mTo switch the worktree to this branch:[22m[107m [0m [2m[0m[2m[34mcd[0m[2m _REPO_ [0m[2m[36m&&[0m[2m [0m[2m[34mgit[0m[2m switch maindiff --git a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_detached.snap b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_detached.snapindex 1a24f5ca5..c5805befd 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_detached.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_detached.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/switch.rsinfo:program: wtargs:- - "--internal"- switch- featureenv:@@ -24,6 +23,7 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpGK1tDzXDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: false@@ -31,7 +31,7 @@ exit_code: 1----- stdout ---------- stderr ------[0m[31m✗[39m [31mCannot create worktree for [1mfeature[22m: existing worktree at [1m_REPO_.feature[22m, detached[39m+[31m✗[39m [31mCannot create worktree for [1mfeature[22m: existing worktree at [1m_REPO_.feature[22m, detached[39m[2m↳[22m [2mTo switch the worktree to this branch:[22m[107m [0m [2m[0m[2m[34mcd[0m[2m _REPO_.feature [0m[2m[36m&&[0m[2m [0m[2m[34mgit[0m[2m switch featurediff --git a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_different_branch.snap b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_different_branch.snapindex ae314a8ac..be6f89195 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_different_branch.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_different_branch.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/switch.rsinfo:program: wtargs:- - "--internal"- switch- featureenv:@@ -24,6 +23,7 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpLxHMDwXDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: false@@ -31,7 +31,7 @@ exit_code: 1----- stdout ---------- stderr ------[0m[31m✗[39m [31mCannot create worktree for [1mfeature[22m: existing worktree at [1m_REPO_.feature[22m on [1mbugfix[22m[39m+[31m✗[39m [31mCannot create worktree for [1mfeature[22m: existing worktree at [1m_REPO_.feature[22m on [1mbugfix[22m[39m[2m↳[22m [2mTo switch the worktree to this branch:[22m[107m [0m [2m[0m[2m[34mcd[0m[2m _REPO_.feature [0m[2m[36m&&[0m[2m [0m[2m[34mgit[0m[2m switch featurediff --git a/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap b/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snapindex ad51c726a..4c59e2acd 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/switch.rsinfo:program: wtargs:- - "--internal"- switch- existing-wtenv:@@ -24,12 +23,12 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpEiloG9XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: trueexit_code: 0----- stdout ------cd _REPO_.existing-wt----- stderr -----[2m○[22m Switched to worktree for [1mexisting-wt[22m @ [1m_REPO_.existing-wt[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_exit_code.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_exit_code.snapindex 33f1b96a3..1e75b4b6d 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_exit_code.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_exit_code.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/switch.rsinfo:program: wtargs:- - "--internal"- switch- "--create"- exit-code-test@@ -27,13 +26,12 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpeUwbkqXDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: trueexit_code: 0----- stdout ------cd _REPO_.exit-code-test-exit 42----- stderr -----[32m✓[39m [32mCreated new worktree for [1mexit-code-test[22m from [1mmain[22m @ [1m_REPO_.exit-code-test[22m[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_output_then_exit.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_output_then_exit.snapindex c57701442..1ebe8157d 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_output_then_exit.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_output_then_exit.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/switch.rsinfo:program: wtargs:- - "--internal"- switch- "--create"- output-exit-test@@ -27,14 +26,12 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpWE3ij4XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: trueexit_code: 0----- stdout ------cd _REPO_.output-exit-test-echo 'doing work'-exit 7----- stderr -----[32m✓[39m [32mCreated new worktree for [1moutput-exit-test[22m from [1mmain[22m @ [1m_REPO_.output-exit-test[22m[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snapindex df32f5170..bdd47507b 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/switch.rsinfo:program: wtargs:- - "--internal"- switch- "--create"- internal-test@@ -25,12 +24,12 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpmD2P3KXDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: trueexit_code: 0----- stdout ------cd _REPO_.internal-test----- stderr -----[32m✓[39m [32mCreated new worktree for [1minternal-test[22m from [1mmain[22m @ [1m_REPO_.internal-test[22m[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snapindex 9d55d1289..36ab3cfa2 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/switch.rsinfo:program: wtargs:- - "--internal"- switch- "--create"- exec-internal@@ -27,14 +26,12 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpGhxbf4XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: trueexit_code: 0----- stdout ------cd _REPO_.exec-internal-echo 'line1'-echo 'line2'----- stderr -----[32m✓[39m [32mCreated new worktree for [1mexec-internal[22m from [1mmain[22m @ [1m_REPO_.exec-internal[22m[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_no_warning_when_branch_matches.snap b/tests/snapshots/integration__integration_tests__switch__switch_no_warning_when_branch_matches.snapindex 81ddf4ee4..0820705c1 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_no_warning_when_branch_matches.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_no_warning_when_branch_matches.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/switch.rsinfo:program: wtargs:- - "--internal"- switch- featureenv:@@ -24,12 +23,12 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpthQdH1XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: trueexit_code: 0----- stdout ------cd _REPO_.feature----- stderr -----[2m○[22m Switched to worktree for [1mfeature[22m @ [1m_REPO_.feature[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_path_mismatch_shows_hint.snap b/tests/snapshots/integration__integration_tests__switch__switch_path_mismatch_shows_hint.snapindex 713a70e46..c3f53ef9c 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_path_mismatch_shows_hint.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_path_mismatch_shows_hint.snap@@ -3,7 +3,6 @@ source: tests/integration_tests/switch.rsinfo:program: wtargs:- - "--internal"- switch- featureenv:@@ -24,12 +23,12 @@ info:SOURCE_DATE_EPOCH: "1735776000"USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpxYhow8XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: trueexit_code: 0----- stdout ------cd '[PROJECT_ID]'----- stderr -----[2m○[22m Switched to worktree for [1mfeature[22m @ [1m[PROJECT_ID][22m