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.rsindex 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.rsindex 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 occurredlet committed = if !no_commit && repo.is_dirty()? {diff --git a/src/commands/worktree.rs b/src/commands/worktree.rsindex 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.snapindex 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✅ [32mCreated new worktree for [1m[32mtest-mixed[0m[32m from [1m[32mmain[0m[32m at [1m[32m[REPO].test-mixed[0m[0m💡 [2mTo enable automatic cd, run: wt config shell[0mdiff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snapindex 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✅ [32mCreated new worktree for [1m[32mtest/nested-branch[0m[32m from [1m[32mmain[0m[32m at [1m[32m[REPO].test-nested-branch[0m[0m💡 [2mTo enable automatic cd, run: wt config shell[0mdiff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snapindex 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✅ [32mCreated new worktree for [1m[32mtest-named[0m[32m from [1m[32mmain[0m[32m at [1m[32m[REPO].test-named[0m[0m💡 [2mTo enable automatic cd, run: wt config shell[0mdiff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snapindex 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✅ [32mCreated new worktree for [1m[32mfeature/test-approval[0m[32m from [1m[32mmain[0m[32m at [1m[32m[REPO].feature-test-approval[0m[0m💡 [2mTo enable automatic cd, run: wt config shell[0mdiff --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.snapindex 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✅ [32mCreated new worktree for [1m[32mtest-decline[0m[32m from [1m[32mmain[0m[32m at [1m[32m[REPO].test-decline[0m[0m💡 [2mTo enable automatic cd, run: wt config shell[0mdiff --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.snapindex 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✅ [32mCreated new worktree for [1m[32mtest-force-2[0m[32m from [1m[32mmain[0m[32m at [1m[32m[REPO].test-force-2[0m[0m💡 [2mTo enable automatic cd, run: wt config shell[0mdiff --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.snapindex 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: 13info:program: wtargs:@@ -18,12 +17,11 @@ info:LANG: CLC_ALL: CSOURCE_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: trueexit_code: 0----- stdout ------⚪ post-create declined⚪ Commands declined----- stderr -----