Skip to content

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

Indicate declined commands continuing operation

Maximilian Roos69fa637c42c0
diff --git a/src/commands/command_approval.rs b/src/commands/command_approval.rs
index 2a10b891b..652f0f434 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_BOLD,
- WARNING_EMOJI, eprint, eprintln, format_bash_with_gutter, println, stderr,
+ AnstyleStyle, HINT, HINT_EMOJI, PROGRESS_EMOJI, WARNING, WARNING_BOLD, WARNING_EMOJI, eprint,
+ eprintln, format_bash_with_gutter, println, stderr,
};
/// Batch approval helper used when multiple commands are queued for execution.
@@ -46,18 +46,6 @@ pub fn approve_command_batch(
};
if !approved {
- // Derive phase from commands - if all same phase, show it; otherwise show generic message
- let phase_str = if commands.len() == 1 {
- commands[0].phase.to_string()
- } else {
- let first_phase = commands[0].phase;
- if commands.iter().all(|cmd| cmd.phase == first_phase) {
- first_phase.to_string()
- } else {
- "commands".to_string()
- }
- };
- println!("{INFO_EMOJI} {phase_str} declined");
return Ok(false);
}
diff --git a/src/commands/merge.rs b/src/commands/merge.rs
index 02ac901b2..7778337b6 100644
--- a/src/commands/merge.rs
+++ b/src/commands/merge.rs
@@ -103,7 +103,12 @@ pub fn handle_merge(
// Approve all commands in a single batch
// Commands collected here are not yet expanded - expansion happens later in prepare_project_commands
- approve_command_batch(&all_commands, &project_id, config, force, false)?;
+ let approved = approve_command_batch(&all_commands, &project_id, config, force, false)?;
+
+ // If commands were declined, show message explaining that merge continues anyway
+ if !approved {
+ crate::output::info("Commands declined, continuing merge")?;
+ }
// Handle uncommitted changes (skip if --no-commit) - track whether commit occurred
let committed = if !no_commit && repo.is_dirty()? {
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rs
index 7ce475ea7..810c82273 100644
--- a/src/commands/worktree.rs
+++ b/src/commands/worktree.rs
@@ -326,7 +326,9 @@ pub fn handle_switch(
if let Err(e) = ctx.execute_post_create_commands() {
// Only treat CommandNotApproved as non-fatal (user declined)
// Other errors should still fail
- if !matches!(e, GitError::CommandNotApproved) {
+ if matches!(e, GitError::CommandNotApproved) {
+ crate::output::info("Commands declined, continuing worktree creation")?;
+ } else {
return Err(e);
}
}
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 d02a8ca7d..220110376 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,7 +4,7 @@ expression: combined
---
exit_code: 0
----- stdout -----
-⚪ post-create declined
+⚪ Commands declined, continuing worktree creation
✅ Created new worktree for test-mixed from main at [REPO].test-mixed
💡 To enable automatic cd, run: wt config shell
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 c49db2e60..b5dcb0d58 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,7 +4,7 @@ expression: combined
---
exit_code: 0
----- stdout -----
-⚪ post-create declined
+⚪ Commands declined, continuing worktree creation
✅ Created new worktree for test/nested-branch from main at [REPO].test-nested-branch
💡 To enable automatic cd, run: wt config shell
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 4d7fc0bb5..e050e2320 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,7 +4,7 @@ expression: combined
---
exit_code: 0
----- stdout -----
-⚪ post-create declined
+⚪ Commands declined, continuing worktree creation
✅ Created new worktree for test-named from main at [REPO].test-named
💡 To enable automatic cd, run: wt config shell
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 d9da6f7b5..386de982c 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,7 +4,7 @@ expression: combined
---
exit_code: 0
----- stdout -----
-⚪ post-create declined
+⚪ Commands declined, continuing worktree creation
✅ Created new worktree for feature/test-approval from main at [REPO].feature-test-approval
💡 To enable automatic cd, run: wt config shell
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 81018d718..d1b5e0484 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,7 +4,7 @@ expression: combined
---
exit_code: 0
----- stdout -----
-⚪ post-create declined
+⚪ Commands declined, continuing worktree creation
✅ Created new worktree for test-decline from main at [REPO].test-decline
💡 To enable automatic cd, run: wt config shell
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 046d236dc..6be8370c1 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,7 +4,7 @@ expression: combined
---
exit_code: 0
----- stdout -----
-⚪ post-create declined
+⚪ Commands declined, continuing worktree creation
✅ Created new worktree for test-force-2 from main at [REPO].test-force-2
💡 To enable automatic cd, run: wt config shell
diff --git a/tests/snapshots/integration__integration_tests__approvals__ask_approvals_all_none_approved.snap b/tests/snapshots/integration__integration_tests__approvals__ask_approvals_all_none_approved.snap
index 450340bc2..13f0d739a 100644
--- a/tests/snapshots/integration__integration_tests__approvals__ask_approvals_all_none_approved.snap
+++ b/tests/snapshots/integration__integration_tests__approvals__ask_approvals_all_none_approved.snap
@@ -1,6 +1,5 @@
---
source: tests/integration_tests/approvals.rs
-assertion_line: 13
info:
program: wt
args:
@@ -18,12 +17,11 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpRy2MnB/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpn5sywa/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-⚪ post-create declined
⚪ Commands declined
----- stderr -----