Skip to content

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

feat: Direct interactive prompts to stderr for clarity

Maximilian Roosf2407a505a83
diff --git a/src/commands/command_approval.rs b/src/commands/command_approval.rs
index 1f5ae6c79..044b68652 100644
--- a/src/commands/command_approval.rs
+++ b/src/commands/command_approval.rs
@@ -5,7 +5,8 @@
use worktrunk::config::{Command, WorktrunkConfig};
use worktrunk::git::{GitError, GitResultExt};
use worktrunk::styling::{
- AnstyleStyle, HINT_EMOJI, WARNING, WARNING_EMOJI, format_bash_with_gutter, print, println,
+ AnstyleStyle, HINT_EMOJI, WARNING, WARNING_EMOJI, eprint, format_bash_with_gutter, print,
+ println, stderr,
};
/// Batch approval helper used when multiple commands are queued for execution.
@@ -94,8 +95,8 @@ fn prompt_for_batch_approval(commands: &[&Command], project_id: &str) -> std::io
println!();
}
- print!("{HINT_EMOJI} Allow and remember? {bold}[y/N]{bold:#} ");
- io::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)?;
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 fa10e1243..260bb3868 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
@@ -15,10 +15,11 @@ exit_code: 0
  echo 'Third command'
-πŸ’‘ Allow and remember? [y/N]
+
Post-create commands 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 7bf0a01d7..1f1bdbe7a 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
@@ -23,10 +23,11 @@ exit_code: 0
  cd [REPO].test-nested-branch && pwd
-πŸ’‘ Allow and remember? [y/N]
+
Post-create commands 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_single_command.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap
index 3964c1007..87f3be190 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
@@ -11,10 +11,11 @@ exit_code: 0
  echo 'Worktree path: [REPO].feature-test-approval'
-πŸ’‘ Allow and remember? [y/N]
+
Post-create commands 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 5010e040f..06eaa11fe 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
@@ -15,10 +15,11 @@ exit_code: 0
  echo 'Third command'
-πŸ’‘ Allow and remember? [y/N]
+
Post-create commands 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 8348a0e49..90b08af90 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
@@ -11,10 +11,11 @@ exit_code: 0
  echo 'test command' > output.txt
-πŸ’‘ Allow and remember? [y/N]
+
Post-create commands 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]