Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
refactor(success-messages): Clarify no-action messages and update snapshot
Maximilian Rooscc9a7ad18222
diff --git a/src/commands/merge.rs b/src/commands/merge.rsindex 3b33d0d1f..53e193e74 100644--- a/src/commands/merge.rs+++ b/src/commands/merge.rs@@ -220,29 +220,21 @@ pub fn handle_merge(Ok(())}-/// Format the merge summary message (no emoji - output system adds it)-fn format_merge_summary(main_path: Option<&std::path::Path>) -> String {+/// Handle output for merge summary using global output context+fn handle_merge_summary_output(main_path: Option<&std::path::Path>) -> anyhow::Result<()> {use worktrunk::styling::GREEN;- // Show where we ended upif let Some(path) = main_path {- format!(+ // Action completed: moved to main worktree+ crate::output::success(format!("{GREEN}Returned to main at {GREEN_BOLD}{}{GREEN_BOLD:#}{GREEN:#}",format_path_for_display(path)- )+ ))?;} else {- format!("{GREEN}Worktree preserved (--no-remove){GREEN:#}")+ // No action: worktree stayed as-is (acknowledging --no-remove flag)+ crate::output::info("Worktree preserved (--no-remove)")?;}-}--/// Handle output for merge summary using global output context-fn handle_merge_summary_output(main_path: Option<&std::path::Path>) -> anyhow::Result<()> {- let message = format_merge_summary(main_path);-- // Show success message (formatting added by OutputContext)- crate::output::success(message)?;- // Flush outputcrate::output::flush()?;Ok(())diff --git a/src/commands/worktree.rs b/src/commands/worktree.rsindex c4700d600..4a07cef8b 100644--- a/src/commands/worktree.rs+++ b/src/commands/worktree.rs@@ -107,7 +107,9 @@ use worktrunk::git::{not_fast_forward, push_failed, worktree_creation_failed, worktree_missing,worktree_path_exists, worktree_path_occupied,};-use worktrunk::styling::{CYAN, CYAN_BOLD, GREEN, GREEN_BOLD, WARNING, format_with_gutter};+use worktrunk::styling::{+ AnstyleStyle, CYAN, CYAN_BOLD, GREEN, GREEN_BOLD, WARNING, format_with_gutter,+};use super::command_executor::CommandContext;use super::hooks::{HookFailureStrategy, HookPipeline};@@ -626,15 +628,11 @@ pub fn handle_push(summary_parts.join(", ")))?;} else {- // No commits to push - show current HEAD commit info- let head_sha = repo- .run_command(&["rev-parse", "--short", "HEAD"])?- .trim()- .to_string();- let green_dim = GREEN.dimmed();+ // No commits to push - state description without action verb+ let bold = AnstyleStyle::new().bold();- // For merge workflow context, acknowledge operations that didn't happen- let note = if let Some(ops) = operations {+ // For merge workflow context, explain why nothing was pushed+ let context = if let Some(ops) = operations {let mut notes = Vec::new();if !ops.committed && !ops.squashed {notes.push("no new commits");@@ -643,17 +641,17 @@ pub fn handle_push(notes.push("no rebase needed");}if notes.is_empty() {- "already up to date".to_string()+ String::new()} else {- notes.join(", ")+ format!(" ({})", notes.join(", "))}} else {- // Standalone push - no merge workflow context- "already up to date".to_string()+ String::new()};- crate::output::success(format!(- "{GREEN}{verb} {GREEN_BOLD}{target_branch}{GREEN_BOLD:#}{GREEN} @ {green_dim}{head_sha}{green_dim:#} ({note}){GREEN:#}"+ // No action: nothing was pushed, just acknowledging state+ crate::output::info(format!(+ "Already up to date with {bold}{target_branch}{bold:#}{context}"))?;}diff --git a/src/main.rs b/src/main.rsindex 1f2fd00ba..c2f093324 100644--- a/src/main.rs+++ b/src/main.rs@@ -306,7 +306,8 @@ fn main() {"Configured {changes_count} shell{plural}"))?;} else {- crate::output::success("All shells already configured")?;+ // No action: all shells were already configured+ crate::output::info("All shells already configured")?;}// Restart hint for current shell (only if config files changed, not just completions)diff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rsindex a8467dabf..a8be8c58a 100644--- a/tests/integration_tests/configure_shell.rs+++ b/tests/integration_tests/configure_shell.rs@@ -118,7 +118,7 @@ fn test_configure_shell_already_exists() {exit_code: 0----- stdout -----⚪ Already configured shell extension & completions for [1mzsh[0m @ [1m~/.zshrc[0m- ✅ All shells already configured+ ⚪ All shells already configured----- stderr -----");diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rsindex 6a4c015ae..8581e468d 100644--- a/tests/integration_tests/merge.rs+++ b/tests/integration_tests/merge.rs@@ -2234,7 +2234,7 @@ fn test_merge_no_commit_with_clean_tree() {[107m [0m feature.txt | 1 [32m+[m[107m [0m 1 file changed, 1 insertion(+)✅ [32mMerged to [1m[32mmain[0m[0m (1 commit, 1 file, [32m+1[0m)- ✅ [32mWorktree preserved (--no-remove)[0m+ ⚪ Worktree preserved (--no-remove)----- stderr -----");@@ -2337,7 +2337,7 @@ fn test_merge_no_commit_no_squash_no_remove_redundant() {[107m [0m feature.txt | 1 [32m+[m[107m [0m 1 file changed, 1 insertion(+)✅ [32mMerged to [1m[32mmain[0m[0m (1 commit, 1 file, [32m+1[0m)- ✅ [32mWorktree preserved (--no-remove)[0m+ ⚪ Worktree preserved (--no-remove)----- stderr -----");diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge.snapindex 3f0426afd..12264c6a7 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge.snap@@ -2,5 +2,5 @@source: tests/integration_tests/shell_wrapper.rsexpression: output.normalized()----✅ [32mMerged to [1m[32mmain[0m[32m @ [2m[32m[HASH][0m (no new commits, no rebase needed)[0m-✅ [32mWorktree preserved (--no-remove)[0m+⚪ Already up to date with [1mmain[0m (no new commits, no rebase needed)+⚪ Worktree preserved (--no-remove)diff --git a/tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snap b/tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snapindex dbd21de2a..7629fcc89 100644--- a/tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snap+++ b/tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snap@@ -30,4 +30,4 @@ exit_code: 0[107m [0m feature.txt | 1 [32m+[m[107m [0m 1 file changed, 1 insertion(+)✅ [32mMerged to [1m[32mmain[0m[0m (1 commit, 1 file, [32m+1[0m)-✅ [32mWorktree preserved (--no-remove)[0m+⚪ Worktree preserved (--no-remove)diff --git a/tests/snapshots/integration__integration_tests__merge__merge_already_on_target.snap b/tests/snapshots/integration__integration_tests__merge__merge_already_on_target.snapindex 0247706d5..4a1487ec4 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_already_on_target.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_already_on_target.snap@@ -20,7 +20,7 @@ info:success: trueexit_code: 0----- stdout ------✅ [32mMerged to [1m[32mmain[0m[32m @ [2m[SHA] (no new commits, no rebase needed)[0m-✅ [32mWorktree preserved (--no-remove)[0m+⚪ Already up to date with [1mmain[0m (no new commits, no rebase needed)+⚪ Worktree preserved (--no-remove)----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__merge__merge_default_branch_missing_worktree.snap b/tests/snapshots/integration__integration_tests__merge__merge_default_branch_missing_worktree.snapindex 0247706d5..4a1487ec4 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_default_branch_missing_worktree.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_default_branch_missing_worktree.snap@@ -20,7 +20,7 @@ info:success: trueexit_code: 0----- stdout ------✅ [32mMerged to [1m[32mmain[0m[32m @ [2m[SHA] (no new commits, no rebase needed)[0m-✅ [32mWorktree preserved (--no-remove)[0m+⚪ Already up to date with [1mmain[0m (no new commits, no rebase needed)+⚪ Worktree preserved (--no-remove)----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snapindex 0ce6ebb5e..a97a5d1e3 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap@@ -21,7 +21,7 @@ info:success: trueexit_code: 0----- stdout ------✅ [32mMerged to [1m[32mmain[0m[32m @ [2m[SHA] (no new commits, no rebase needed)[0m+⚪ Already up to date with [1mmain[0m (no new commits, no rebase needed)🔄 [36mRemoving [1m[36mno-commits[0m[36m worktree & branch in background[0m----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snap b/tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snapindex 9bfee154c..a8f28a124 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snap@@ -27,6 +27,6 @@ exit_code: 0[107m [0m feature.txt | 1 [32m+[m[107m [0m 1 file changed, 1 insertion(+)✅ [32mMerged to [1m[32mmain[0m[0m (1 commit, 1 file, [32m+1[0m)-✅ [32mWorktree preserved (--no-remove)[0m+⚪ Worktree preserved (--no-remove)----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__merge__merge_rebase_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_rebase_fast_forward.snapindex eeb030b9b..549d3981a 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_rebase_fast_forward.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_rebase_fast_forward.snap@@ -22,7 +22,7 @@ success: trueexit_code: 0----- stdout -----✅ [32mFast-forwarded to [1m[32mmain[0m[0m-✅ [32mMerged to [1m[32mmain[0m[32m @ [2m[SHA] (no new commits)[0m+⚪ Already up to date with [1mmain[0m (no new commits)🔄 [36mRemoving [1m[36mfast-forward-test[0m[36m worktree & branch in background[0m----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snapindex 4b372ab01..3a3dab504 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap@@ -31,7 +31,7 @@ exit_code: 0[107m [0m - Change 2[107m [0m - Revert to initial⚪ [2mNo changes after squashing 3 commits[0m-✅ [32mMerged to [1m[32mmain[0m[32m @ [2m[SHA] (no new commits, no rebase needed)[0m+⚪ Already up to date with [1mmain[0m (no new commits, no rebase needed)🔄 [36mRemoving [1m[36mfeature[0m[36m worktree & branch in background[0m----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snapindex 9bfee154c..a8f28a124 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap@@ -27,6 +27,6 @@ exit_code: 0[107m [0m feature.txt | 1 [32m+[m[107m [0m 1 file changed, 1 insertion(+)✅ [32mMerged to [1m[32mmain[0m[0m (1 commit, 1 file, [32m+1[0m)-✅ [32mWorktree preserved (--no-remove)[0m+⚪ Worktree preserved (--no-remove)----- stderr -----