Skip to content

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.rs
index 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::io
eprintln!();
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.rs
index 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 result
if 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.snap
index 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 -----
-🟑 test-repo (test-repo) wants to execute 2 commands:
+🟑 test-repo wants to execute 2 commands:
πŸ”„ post-create:
  echo 'First command'
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 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 -----
-🟑 test-repo (test-repo) wants to execute 4 commands:
+🟑 test-repo wants to execute 4 commands:
πŸ”„ post-create:
  echo 'Branch: test-nested-branch'
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 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 -----
-🟑 test-repo (test-repo) wants to execute 3 commands:
+🟑 test-repo wants to execute 3 commands:
πŸ”„ post-create install:
  echo 'Installing dependencies...'
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 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 -----
-🟑 test-repo (test-repo) wants to execute 1 command:
+🟑 test-repo wants to execute 1 command:
πŸ”„ post-create:
  echo 'Worktree path: [REPO].feature-test-approval'
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 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 -----
-🟑 test-repo (test-repo) wants to execute 2 commands:
+🟑 test-repo wants to execute 2 commands:
πŸ”„ post-create:
  echo 'First command'
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 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 -----
-🟑 test-repo (test-repo) wants to execute 1 command:
+🟑 test-repo wants to execute 1 command:
πŸ”„ post-create:
  echo 'test command' > output.txt