Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Refactor: Improve approval messages and details
Maximilian Roos9e71579dce2b
diff --git a/src/commands/command_approval.rs b/src/commands/command_approval.rsindex 6336ce0fa..88f8b0168 100644--- a/src/commands/command_approval.rs+++ b/src/commands/command_approval.rs@@ -93,7 +93,7 @@ fn prompt_for_batch_approval(commands: &[&Command], project_id: &str) -> std::ioeprintln!();eprintln!(- "{WARNING_EMOJI} {WARNING}{warning_bold}{project_name}{warning_bold:#}{WARNING:#} ({project_id}) {WARNING}wants to execute {warning_bold}{count}{warning_bold:#} command{plural}:{WARNING:#}"+ "{WARNING_EMOJI} {WARNING}{warning_bold}{project_name}{warning_bold:#} wants to execute {warning_bold}{count}{warning_bold:#} command{plural}:{WARNING:#}");eprintln!();diff --git a/src/commands/dev.rs b/src/commands/dev.rsindex adda95bf7..73801d0be 100644--- a/src/commands/dev.rs+++ b/src/commands/dev.rs@@ -427,8 +427,26 @@ pub fn handle_dev_ask_approval(force: bool) -> Result<(), GitError> {// Show resultif approved {- use worktrunk::styling::GREEN;- crate::output::success(format!("{GREEN}Commands approved!{GREEN:#}"))?;+ use worktrunk::styling::{AnstyleStyle, GREEN};++ if force {+ // When using --force, commands aren't saved to config+ crate::output::success(format!(+ "{GREEN}Commands approved (not saved with --force){GREEN:#}"+ ))?;+ } else {+ // Interactive approval - commands were saved to config+ crate::output::success(format!(+ "{GREEN}Commands approved and saved to config{GREEN:#}"+ ))?;++ // Show config path as supplementary metadata+ if let Some(config_path) = worktrunk::config::get_config_path() {+ use worktrunk::styling::println;+ let dim = AnstyleStyle::new().dimmed();+ println!("{dim}Config: {}{dim:#}", config_path.display());+ }+ }} else {let dim = worktrunk::styling::AnstyleStyle::new().dimmed();crate::output::info(format!("{dim}Commands declined{dim:#}"))?;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 7ef52fc9c..dd36e73c4 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@@ -11,7 +11,7 @@ exit_code: 0----- stderr ------π‘ [33m[1m[33mtest-repo[0m[0m (test-repo) [33mwants to execute [1m[33m2[0m commands:[0m+π‘ [33m[1m[33mtest-repo[0m wants to execute [1m[33m2[0m commands:[0mπ post-create:[40m [0m [1m[34mecho[0m [32m'First command'[0m[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 a5ebc20f5..6228c1775 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@@ -11,7 +11,7 @@ exit_code: 0----- stderr ------π‘ [33m[1m[33mtest-repo[0m[0m (test-repo) [33mwants to execute [1m[33m4[0m commands:[0m+π‘ [33m[1m[33mtest-repo[0m wants to execute [1m[33m4[0m commands:[0mπ post-create:[40m [0m [1m[34mecho[0m [32m'Branch: test-nested-branch'[0m[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 90e8b9645..33ac64ac7 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@@ -11,7 +11,7 @@ exit_code: 0----- stderr ------π‘ [33m[1m[33mtest-repo[0m[0m (test-repo) [33mwants to execute [1m[33m3[0m commands:[0m+π‘ [33m[1m[33mtest-repo[0m wants to execute [1m[33m3[0m commands:[0mπ post-create [1minstall[0m:[40m [0m [1m[34mecho[0m [32m'Installing dependencies...'[0m[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 e0a1ef5e1..cde72dd17 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,7 +11,7 @@ exit_code: 0----- stderr ------π‘ [33m[1m[33mtest-repo[0m[0m (test-repo) [33mwants to execute [1m[33m1[0m command:[0m+π‘ [33m[1m[33mtest-repo[0m wants to execute [1m[33m1[0m command:[0mπ post-create:[40m [0m [1m[34mecho[0m [32m'Worktree path: [REPO].feature-test-approval'[0m[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 1bc9eb0b6..1129f07f9 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@@ -11,7 +11,7 @@ exit_code: 0----- stderr ------π‘ [33m[1m[33mtest-repo[0m[0m (test-repo) [33mwants to execute [1m[33m2[0m commands:[0m+π‘ [33m[1m[33mtest-repo[0m wants to execute [1m[33m2[0m commands:[0mπ post-create:[40m [0m [1m[34mecho[0m [32m'First command'[0m[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 124dbc1af..880c417a7 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,7 +11,7 @@ exit_code: 0----- stderr ------π‘ [33m[1m[33mtest-repo[0m[0m (test-repo) [33mwants to execute [1m[33m1[0m command:[0m+π‘ [33m[1m[33mtest-repo[0m wants to execute [1m[33m1[0m command:[0mπ post-create:[40m [0m [1m[34mecho[0m [32m'test command'[0m [36m>[0m output.txt[0m