Skip to content

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

feat: Redirect interactive prompts to stderr for shell parsing

Maximilian Roos7ff43e793d7b
diff --git a/CLAUDE.md b/CLAUDE.md
index cd597ec99..4291951dc 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -121,15 +121,16 @@ println!("Config: {bold}{}{bold:#}", path); // Should have INFO_EMOJI
- **stdout**: All worktrunk output (messages, directives, errors, warnings, progress)
- **stderr**: All child process output (git, npm, user commands)
+- **Exception**: Interactive prompts use stderr to bypass shell wrapper's NUL-delimited parsing
**Why:** Simple reasoning (one decision point), better for piping (`wt list | jq`), child output never interferes with directives. Trade-off: violates Unix convention of errors→stderr, but our "errors" are structured program output, not crashes.
```rust
-// ALL our output goes to stdout (including errors and interactive prompts)
+// ALL our output goes to stdout (including errors)
println!("{ERROR_EMOJI} {ERROR}Branch already exists{ERROR:#}");
-// Interactive prompts are worktrunk output → stdout
-print!("{HINT_EMOJI} Allow and remember? [y/N] ");
+// Interactive prompts go to stderr to bypass shell wrapper buffering
+eprint!("{HINT_EMOJI} Allow and remember? [y/N] ");
// Redirect child processes to stderr
let wrapped = format!("{{ {}; }} 1>&2", command);
@@ -137,16 +138,17 @@ Command::new("sh").arg("-c").arg(&wrapped).status()?;
```
**Interactive prompts and stdin:**
-- Prompts are worktrunk output → always use stdout
-- **CRITICAL**: Flush stdout before blocking on stdin to prevent interleaving:
+- Prompts use stderr to bypass shell wrapper's NUL-delimited stdout parsing
+- **CRITICAL**: Flush stderr before blocking on stdin to prevent interleaving:
```rust
- print!("💡 Allow and remember? [y/N] ");
- stdout().flush()?; // Ensures prompt is visible before blocking
+ eprint!("💡 Allow and remember? [y/N] ");
+ stderr().flush()?; // Ensures prompt is visible before blocking
let mut response = String::new();
io::stdin().read_line(&mut response)?;
```
-- Without flushing, buffered stdout can appear after the prompt is shown
+- Without flushing, buffered stderr can appear after the prompt is shown
+- **Why stderr?** The shell wrapper (`templates/bash.sh`) uses `read -d ''` to parse NUL-delimited directives from stdout. Non-NUL-terminated output (like prompts) would get buffered in the shell's read buffer. Stderr bypasses this parsing and appears immediately.
### Temporal Locality: Output Should Be Close to Operations
diff --git a/src/commands/command_approval.rs b/src/commands/command_approval.rs
index 1459e460d..26645c2cf 100644
--- a/src/commands/command_approval.rs
+++ b/src/commands/command_approval.rs
@@ -5,8 +5,8 @@
use worktrunk::config::{Command, WorktrunkConfig};
use worktrunk::git::{GitError, GitResultExt};
use worktrunk::styling::{
- AnstyleStyle, HINT, HINT_EMOJI, INFO_EMOJI, PROGRESS_EMOJI, WARNING, WARNING_EMOJI,
- format_bash_with_gutter, print, println, stdout,
+ AnstyleStyle, HINT, HINT_EMOJI, INFO_EMOJI, PROGRESS_EMOJI, WARNING, WARNING_EMOJI, eprint,
+ eprintln, format_bash_with_gutter, println, stderr,
};
/// Batch approval helper used when multiple commands are queued for execution.
@@ -86,15 +86,15 @@ fn prompt_for_batch_approval(
let count = commands.len();
let plural = if count == 1 { "" } else { "s" };
- println!();
- println!(
+ eprintln!();
+ eprintln!(
"{WARNING_EMOJI} {WARNING}Permission required to execute {warning_bold}{count}{warning_bold:#} command{plural}{WARNING:#}",
);
- println!();
- println!(
+ eprintln!();
+ eprintln!(
"{INFO_EMOJI} {bold}{project_name}{bold:#} ({dim}{project_id}{dim:#}) wants to execute:"
);
- println!();
+ eprintln!();
for cmd in commands {
// Format as: {context} {bold}{name}{bold:#}:
@@ -103,21 +103,21 @@ fn prompt_for_batch_approval(
Some(name) => format!("{PROGRESS_EMOJI} {context} {bold}{name}{bold:#}:"),
None => format!("{PROGRESS_EMOJI} {context}:"),
};
- println!("{label}");
- print!("{}", format_bash_with_gutter(&cmd.expanded, ""));
- println!();
+ eprintln!("{label}");
+ eprint!("{}", format_bash_with_gutter(&cmd.expanded, ""));
+ eprintln!();
}
- // Flush stdout before showing prompt to ensure all output is visible
- stdout().flush()?;
+ // Flush stderr before showing prompt to ensure all output is visible
+ stderr().flush()?;
- print!("{HINT_EMOJI} Allow and remember? {bold}[y/N]{bold:#} ");
- stdout().flush()?;
+ eprint!("{HINT_EMOJI} Allow and remember? {bold}[y/N]{bold:#} ");
+ stderr().flush()?;
let mut response = String::new();
io::stdin().read_line(&mut response)?;
- println!();
+ eprintln!();
Ok(response.trim().eq_ignore_ascii_case("y"))
}
diff --git a/src/commands/dev.rs b/src/commands/dev.rs
index f97aa7753..3ab796969 100644
--- a/src/commands/dev.rs
+++ b/src/commands/dev.rs
@@ -380,3 +380,49 @@ pub fn handle_dev_rebase(target: Option<&str>) -> Result<bool, GitError> {
Ok(true)
}
+
+/// Handle `wt dev ask-approval` command - test the approval prompt UI
+pub fn handle_dev_ask_approval(force: bool) -> Result<(), GitError> {
+ use super::command_approval::approve_command_batch;
+ use worktrunk::config::{Command, WorktrunkConfig};
+
+ // Create some test commands to show in the approval prompt
+ let test_commands = vec![
+ Command::with_expansion(
+ Some("insta".to_string()),
+ "NEXTEST_STATUS_LEVEL=fail cargo insta test".to_string(),
+ "NEXTEST_STATUS_LEVEL=fail cargo insta test --test-runner nextest".to_string(),
+ ),
+ Command::with_expansion(
+ Some("doc".to_string()),
+ "RUSTDOCFLAGS='-Dwarnings' cargo doc --no-deps".to_string(),
+ "RUSTDOCFLAGS='-Dwarnings' cargo doc --no-deps".to_string(),
+ ),
+ Command::with_expansion(
+ None,
+ "cargo install --path .".to_string(),
+ "cargo install --path .".to_string(),
+ ),
+ ];
+
+ let repo = Repository::current();
+ let project_id = repo.project_identifier()?;
+ let config = WorktrunkConfig::load().git_context("Failed to load config")?;
+
+ // Call the approval prompt
+ let approved = approve_command_batch(&test_commands, &project_id, &config, force, "test")?;
+
+ // Show result
+ if approved {
+ use worktrunk::styling::{GREEN, SUCCESS_EMOJI};
+ crate::output::success(format!(
+ "{SUCCESS_EMOJI} {GREEN}Commands approved!{GREEN:#}"
+ ))?;
+ } else {
+ use worktrunk::styling::INFO_EMOJI;
+ let dim = worktrunk::styling::AnstyleStyle::new().dimmed();
+ crate::output::success(format!("{INFO_EMOJI} {dim}Commands declined{dim:#}"))?;
+ }
+
+ Ok(())
+}
diff --git a/src/commands/mod.rs b/src/commands/mod.rs
index ce76a495f..44521a9ca 100644
--- a/src/commands/mod.rs
+++ b/src/commands/mod.rs
@@ -16,7 +16,8 @@ pub use config::{
};
pub use configure_shell::{ConfigAction, handle_configure_shell};
pub use dev::{
- handle_dev_commit, handle_dev_push, handle_dev_rebase, handle_dev_run_hook, handle_dev_squash,
+ handle_dev_ask_approval, handle_dev_commit, handle_dev_push, handle_dev_rebase,
+ handle_dev_run_hook, handle_dev_squash,
};
pub use init::handle_init;
pub use list::handle_list;
diff --git a/src/main.rs b/src/main.rs
index 4184d8f24..6ffc5359b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -32,8 +32,9 @@ use commands::worktree::SwitchResult;
use commands::{
ConfigAction, Shell, handle_complete, handle_completion, handle_config_help,
handle_config_init, handle_config_list, handle_config_refresh_cache, handle_configure_shell,
- handle_dev_commit, handle_dev_push, handle_dev_rebase, handle_dev_run_hook, handle_dev_squash,
- handle_init, handle_list, handle_merge, handle_remove, handle_switch,
+ handle_dev_ask_approval, handle_dev_commit, handle_dev_push, handle_dev_rebase,
+ handle_dev_run_hook, handle_dev_squash, handle_init, handle_list, handle_merge, handle_remove,
+ handle_switch,
};
use output::{execute_user_command, handle_remove_output, handle_switch_output};
@@ -137,6 +138,13 @@ enum DevCommand {
/// Target branch to rebase onto (defaults to default branch)
target: Option<String>,
},
+
+ /// Test approval prompt UI (for development/debugging)
+ AskApproval {
+ /// Skip command approval prompts
+ #[arg(short, long)]
+ force: bool,
+ },
}
#[derive(Subcommand)]
@@ -589,6 +597,7 @@ fn main() {
allow_merge_commits,
} => handle_dev_push(target.as_deref(), allow_merge_commits),
DevCommand::Rebase { target } => handle_dev_rebase(target.as_deref()).map(|_| ()),
+ DevCommand::AskApproval { force } => handle_dev_ask_approval(force),
},
Commands::List {
format,
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap
index 31d0849c4..757976f8f 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap
@@ -4,6 +4,12 @@ expression: combined
---
exit_code: 0
----- stdout -----
+⚪ post-create declined
+✅ Created new worktree for test-mixed from main at [REPO].test-mixed
+
+💡 To enable automatic cd, run: wt config shell
+
+----- stderr -----
🟡 Permission required to execute 2 commands
@@ -15,10 +21,4 @@ exit_code: 0
🔄 post-create:
  echo 'Third command'
-💡 Allow and remember? [y/N]
-⚪ post-create declined
-✅ Created new worktree for test-mixed from main at [REPO].test-mixed
-
-💡 To enable automatic cd, run: wt config shell
-
------ stderr -----
+💡 Allow and remember? [y/N]
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap
index 40841d768..27392b344 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap
@@ -4,6 +4,12 @@ expression: combined
---
exit_code: 0
----- stdout -----
+⚪ post-create declined
+✅ Created new worktree for test/nested-branch from main at [REPO].test-nested-branch
+
+💡 To enable automatic cd, run: wt config shell
+
+----- stderr -----
🟡 Permission required to execute 4 commands
@@ -21,10 +27,4 @@ exit_code: 0
🔄 post-create:
  cd [REPO].test-nested-branch && pwd
-💡 Allow and remember? [y/N]
-⚪ post-create declined
-✅ Created new worktree for test/nested-branch from main at [REPO].test-nested-branch
-
-💡 To enable automatic cd, run: wt config shell
-
------ stderr -----
+💡 Allow and remember? [y/N]
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap
index ae94208a1..e20ae7e63 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap
@@ -4,6 +4,12 @@ expression: combined
---
exit_code: 0
----- stdout -----
+⚪ post-create declined
+✅ Created new worktree for test-named from main at [REPO].test-named
+
+💡 To enable automatic cd, run: wt config shell
+
+----- stderr -----
🟡 Permission required to execute 3 commands
@@ -18,10 +24,4 @@ exit_code: 0
🔄 post-create test:
  echo 'Running tests...'
-💡 Allow and remember? [y/N]
-⚪ post-create declined
-✅ Created new worktree for test-named from main at [REPO].test-named
-
-💡 To enable automatic cd, run: wt config shell
-
------ stderr -----
+💡 Allow and remember? [y/N]
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap
index 273da9e47..27197247c 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap
@@ -4,6 +4,12 @@ expression: combined
---
exit_code: 0
----- stdout -----
+⚪ post-create declined
+✅ Created new worktree for feature/test-approval from main at [REPO].feature-test-approval
+
+💡 To enable automatic cd, run: wt config shell
+
+----- stderr -----
🟡 Permission required to execute 1 command
@@ -12,10 +18,4 @@ exit_code: 0
🔄 post-create:
  echo 'Worktree path: [REPO].feature-test-approval'
-💡 Allow and remember? [y/N]
-⚪ post-create declined
-✅ Created new worktree for feature/test-approval from main at [REPO].feature-test-approval
-
-💡 To enable automatic cd, run: wt config shell
-
------ stderr -----
+💡 Allow and remember? [y/N]
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap b/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap
index e9d7b2703..a88b2eec2 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap
@@ -4,6 +4,12 @@ expression: combined
---
exit_code: 0
----- stdout -----
+⚪ post-create declined
+✅ Created new worktree for test-decline from main at [REPO].test-decline
+
+💡 To enable automatic cd, run: wt config shell
+
+----- stderr -----
🟡 Permission required to execute 2 commands
@@ -15,10 +21,4 @@ exit_code: 0
🔄 post-create:
  echo 'Third command'
-💡 Allow and remember? [y/N]
-⚪ post-create declined
-✅ Created new worktree for test-decline from main at [REPO].test-decline
-
-💡 To enable automatic cd, run: wt config shell
-
------ stderr -----
+💡 Allow and remember? [y/N]
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap b/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap
index 5285fa543..11fdd2b7b 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap
@@ -4,6 +4,12 @@ expression: combined
---
exit_code: 0
----- stdout -----
+⚪ post-create declined
+✅ Created new worktree for test-force-2 from main at [REPO].test-force-2
+
+💡 To enable automatic cd, run: wt config shell
+
+----- stderr -----
🟡 Permission required to execute 1 command
@@ -12,10 +18,4 @@ exit_code: 0
🔄 post-create:
  echo 'test command' > output.txt
-💡 Allow and remember? [y/N]
-⚪ post-create declined
-✅ Created new worktree for test-force-2 from main at [REPO].test-force-2
-
-💡 To enable automatic cd, run: wt config shell
-
------ stderr -----
+💡 Allow and remember? [y/N]
diff --git a/tests/snapshots/integration__integration_tests__init__init_bash.snap b/tests/snapshots/integration__integration_tests__init__init_bash.snap
index 65f9be467..f037ba110 100644
--- a/tests/snapshots/integration__integration_tests__init__init_bash.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_bash.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpIA7lzg/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpBXcTuz/test-config.toml
---
success: true
exit_code: 0
@@ -199,6 +199,9 @@ _wt() {
wt__config,shell)
cmd="wt__config__shell"
;;
+ wt__dev,ask-approval)
+ cmd="wt__dev__ask__approval"
+ ;;
wt__dev,commit)
cmd="wt__dev__commit"
;;
@@ -351,7 +354,7 @@ _wt() {
return 0
;;
wt__dev)
- opts="-v -h --verbose --help run-hook commit squash push rebase"
+ opts="-v -h --verbose --help run-hook commit squash push rebase ask-approval"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -364,6 +367,20 @@ _wt() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
+ wt__dev__ask__approval)
+ opts="-f -v -h --force --verbose --help"
+ if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ fi
+ case "${prev}" in
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ ;;
wt__dev__commit)
opts="-f -v -h --force --no-verify --verbose --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
diff --git a/tests/snapshots/integration__integration_tests__init__init_fish.snap b/tests/snapshots/integration__integration_tests__init__init_fish.snap
index 692625e2d..4108672f2 100644
--- a/tests/snapshots/integration__integration_tests__init__init_fish.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_fish.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpwoMAjs/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpPGWZC8/test-config.toml
---
success: true
exit_code: 0
@@ -244,13 +244,14 @@ zsh\t''"
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -s f -l force -d 'Skip confirmation prompt'
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -s h -l help -d 'Print help'
-complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
-complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase" -s h -l help -d 'Print help'
-complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase" -f -a "run-hook" -d 'Run a project hook for testing'
-complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase" -f -a "commit" -d 'Commit changes with LLM-generated message'
-complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase" -f -a "squash" -d 'Squash commits with LLM-generated message'
-complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase" -f -a "push" -d 'Push changes to target branch'
-complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase" -f -a "rebase" -d 'Rebase current branch onto target branch'
+complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase ask-approval" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
+complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase ask-approval" -s h -l help -d 'Print help'
+complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase ask-approval" -f -a "run-hook" -d 'Run a project hook for testing'
+complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase ask-approval" -f -a "commit" -d 'Commit changes with LLM-generated message'
+complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase ask-approval" -f -a "squash" -d 'Squash commits with LLM-generated message'
+complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase ask-approval" -f -a "push" -d 'Push changes to target branch'
+complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase ask-approval" -f -a "rebase" -d 'Rebase current branch onto target branch'
+complete -c wt -n "__fish_wt_using_subcommand dev; and not __fish_seen_subcommand_from run-hook commit squash push rebase ask-approval" -f -a "ask-approval" -d 'Test approval prompt UI (for development/debugging)'
complete -c wt -n "__fish_wt_using_subcommand dev; and __fish_seen_subcommand_from run-hook" -s f -l force -d 'Skip command approval prompts'
complete -c wt -n "__fish_wt_using_subcommand dev; and __fish_seen_subcommand_from run-hook" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand dev; and __fish_seen_subcommand_from run-hook" -s h -l help -d 'Print help'
@@ -267,6 +268,9 @@ complete -c wt -n "__fish_wt_using_subcommand dev; and __fish_seen_subcommand_fr
complete -c wt -n "__fish_wt_using_subcommand dev; and __fish_seen_subcommand_from push" -s h -l help -d 'Print help'
complete -c wt -n "__fish_wt_using_subcommand dev; and __fish_seen_subcommand_from rebase" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand dev; and __fish_seen_subcommand_from rebase" -s h -l help -d 'Print help'
+complete -c wt -n "__fish_wt_using_subcommand dev; and __fish_seen_subcommand_from ask-approval" -s f -l force -d 'Skip command approval prompts'
+complete -c wt -n "__fish_wt_using_subcommand dev; and __fish_seen_subcommand_from ask-approval" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
+complete -c wt -n "__fish_wt_using_subcommand dev; and __fish_seen_subcommand_from ask-approval" -s h -l help -d 'Print help'
complete -c wt -n "__fish_wt_using_subcommand list" -l format -d 'Output format' -r -f -a "table\t'Human-readable table format'
json\t'Machine-readable JSON with display fields (includes styled unicode for rendering)'"
complete -c wt -n "__fish_wt_using_subcommand list" -l branches -d 'Include branches without worktrees'
diff --git a/tests/snapshots/integration__integration_tests__init__init_zsh.snap b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
index bccae9aa1..1192d65a4 100644
--- a/tests/snapshots/integration__integration_tests__init__init_zsh.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpO74VSQ/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpT0vvwA/test-config.toml
---
success: true
exit_code: 0
@@ -292,6 +292,16 @@ _arguments "${_arguments_options[@]}" : \
'--help[Print help]' \
'::target -- Target branch to rebase onto (defaults to default branch):_default' \
&& ret=0
+;;
+(ask-approval)
+_arguments "${_arguments_options[@]}" : \
+'-f[Skip command approval prompts]' \
+'--force[Skip command approval prompts]' \
+'-v[Enable verbose output (show git commands and debug info)]' \
+'--verbose[Enable verbose output (show git commands and debug info)]' \
+'-h[Print help]' \
+'--help[Print help]' \
+&& ret=0
;;
esac
;;
@@ -445,9 +455,15 @@ _wt__dev_commands() {
'squash:Squash commits with LLM-generated message' \
'push:Push changes to target branch' \
'rebase:Rebase current branch onto target branch' \
+'ask-approval:Test approval prompt UI (for development/debugging)' \
)
_describe -t commands 'wt dev commands' commands "$@"
}
+(( $+functions[_wt__dev__ask-approval_commands] )) ||
+_wt__dev__ask-approval_commands() {
+ local commands; commands=()
+ _describe -t commands 'wt dev ask-approval commands' commands "$@"
+}
(( $+functions[_wt__dev__commit_commands] )) ||
_wt__dev__commit_commands() {
local commands; commands=()