Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Output: Show detailed stats only in progress messages
Maximilian Roosf1f9f1680bb9
diff --git a/CLAUDE.md b/CLAUDE.mdindex 3ebd3c49f..5792531c9 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -98,6 +98,39 @@ Removed worktree for bugfix**Why this matters:** Immediate feedback builds confidence, failed operations are obvious, Ctrl+C interrupts don't leave uncertainty, matches how users think about sequential operations.+### Information Display: Show Once, Not Twice++**Core Principle: Display detailed information in progress messages, not in success messages.**++When operations have both progress and success messages:+- **Progress message**: Include detailed stats/context (what's about to happen)+- **Success message**: Minimal confirmation with reference info (hash, path)++This prevents redundant noise while giving users information when they need it most (before the operation runs).++**Good pattern:**+```rust+// Progress: detailed stats upfront+output::progress("π Committing changes... (3 files, +45, -12)")?;+perform_commit()?;+// Success: minimal confirmation with reference+output::success("β Committed changes @ a1b2c3d")?;+```++**Bad pattern:**+```rust+// Redundant - same stats shown twice+output::progress("π Committing changes... (3 files, +45, -12)")?;+perform_commit()?;+output::success("β Committed changes (3 files, +45, -12) @ a1b2c3d")?; // β Too noisy+```++**Rationale:**+- Users read progress messages to understand what's happening+- Success messages just confirm completion - stats already seen+- Commit hashes/paths in success messages enable easy reference+- Reduces visual noise and line count in output+### Semantic Style Constants**Style constants defined in `src/styling.rs`:**diff --git a/src/commands/merge.rs b/src/commands/merge.rsindex b481ad923..5f19c6bd8 100644--- a/src/commands/merge.rs+++ b/src/commands/merge.rs@@ -244,14 +244,9 @@ fn commit_with_generated_message(.to_string();use worktrunk::styling::{GREEN, SUCCESS_EMOJI};- let success_msg = match stats_parts.is_empty() {- true => format!("{SUCCESS_EMOJI} {GREEN}Committed changes @ {commit_hash}{GREEN:#}"),- false => format!(- "{SUCCESS_EMOJI} {GREEN}Committed changes ({}) @ {commit_hash}{GREEN:#}",- stats_parts.join(", ")- ),- };- crate::output::success(success_msg)?;+ crate::output::success(format!(+ "{SUCCESS_EMOJI} {GREEN}Committed changes @ {commit_hash}{GREEN:#}"+ ))?;Ok(())}@@ -266,10 +261,7 @@ fn handle_commit_changes(repo.run_command(&["add", "-A"]).git_context("Failed to stage changes")?;- commit_with_generated_message(- "Committing uncommitted changes...",- commit_generation_config,- )+ commit_with_generated_message("Committing changes...", commit_generation_config)}fn handle_squash(@@ -299,7 +291,7 @@ fn handle_squash(if commit_count == 0 && has_staged {// Just staged changes, no commits - commit them directly (no squashing needed)- commit_with_generated_message("Committing staged changes...", commit_generation_config)?;+ commit_with_generated_message("Committing changes...", commit_generation_config)?;return Ok(None);}@@ -315,7 +307,7 @@ fn handle_squash(// Get diff stats early for display in progress messagelet range = format!("{}..HEAD", merge_base);let diff_shortstat = repo- .run_command(&["diff", "--shortstat", &format!("{}..HEAD", merge_base)])+ .run_command(&["diff", "--shortstat", &range]).unwrap_or_default();let stats = parse_diff_shortstat(&diff_shortstat);let stats_parts = stats.format_summary();@@ -374,16 +366,9 @@ fn handle_squash(// Show success immediately after completing the squashuse worktrunk::styling::{GREEN, SUCCESS_EMOJI};- let success_msg = match stats_parts.is_empty() {- true => format!(- "{SUCCESS_EMOJI} {GREEN}Squashed {commit_count} commits into 1 @ {commit_hash}{GREEN:#}"- ),- false => format!(- "{SUCCESS_EMOJI} {GREEN}Squashed {commit_count} commits into 1 ({}) @ {commit_hash}{GREEN:#}",- stats_parts.join(", ")- ),- };- crate::output::success(success_msg)?;+ crate::output::success(format!(+ "{SUCCESS_EMOJI} {GREEN}Squashed {commit_count} commits into 1 @ {commit_hash}{GREEN:#}"+ ))?;Ok(Some(commit_count))}diff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snapindex 57dd647fa..1c6094623 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap@@ -19,7 +19,7 @@ info:SOURCE_DATE_EPOCH: "1761609600"WORKTRUNK_COMMIT_GENERATION__ARGS: "fix: update file 1 content"WORKTRUNK_COMMIT_GENERATION__COMMAND: echo- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpo6rpX4/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpisDYxs/test-config.toml---success: trueexit_code: 0@@ -32,7 +32,7 @@ exit_code: 0[40m [0m - feat: add file 1[40m [0m - feat: add file 2-β [32mSquashed 2 commits into 1 (2 files, [32m+2[0m) @ [SHA][0m+β [32mSquashed 2 commits into 1 @ [SHA][0mπ [36mRebasing onto [1m[36mmain[0m...[0mπ [36mMerging 1 commit to [1m[36mmain[0m @ [SHA][0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snapindex 795b64b22..011a76076 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap@@ -16,16 +16,16 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpJYa7yM/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpLuX5t1/test-config.toml---success: trueexit_code: 0----- stdout ------π [36mCommitting uncommitted changes... (1 file, [32m+1[0m, [31m-1[0m)[0m+π [36mCommitting changes... (1 file, [32m+1[0m, [31m-1[0m)[0mπ [36mGenerating commit message...[0m[40m [0m [1mWIP: Auto-commit before merge[0m-β [32mCommitted changes (1 file, [32m+1[0m, [31m-1[0m) @ [SHA][0m+β [32mCommitted changes @ [SHA][0mπ [36mRebasing onto [1m[36mmain[0m...[0mπ [36mMerging 2 commits to [1m[36mmain[0m @ [SHA][0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snapindex 8a26a36c1..7b952dac9 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap@@ -18,16 +18,16 @@ info:SOURCE_DATE_EPOCH: "1761609600"WORKTRUNK_COMMIT_GENERATION__ARGS: "fix: improve auth validation logic"WORKTRUNK_COMMIT_GENERATION__COMMAND: echo- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpwSE8M5/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp2sHvTX/test-config.toml---success: trueexit_code: 0----- stdout ------π [36mCommitting uncommitted changes... (1 file, [32m+1[0m, [31m-1[0m)[0m+π [36mCommitting changes... (1 file, [32m+1[0m, [31m-1[0m)[0mπ [36mGenerating commit message...[0m[40m [0m [1mWIP: Auto-commit before merge[0m-β [32mCommitted changes (1 file, [32m+1[0m, [31m-1[0m) @ [SHA][0m+β [32mCommitted changes @ [SHA][0mπ [36mRebasing onto [1m[36mmain[0m...[0mπ [36mMerging 2 commits to [1m[36mmain[0m @ [SHA][0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snap b/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snapindex 9fc6906f6..c903acfda 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snap@@ -16,16 +16,16 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpulyUF2/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpKeOZyO/test-config.toml---success: trueexit_code: 0----- stdout ------π [36mCommitting uncommitted changes... (1 file, [32m+1[0m)[0m+π [36mCommitting changes... (1 file, [32m+1[0m)[0mπ [36mGenerating commit message...[0m[40m [0m [1mWIP: Auto-commit before merge[0m-β [32mCommitted changes (1 file, [32m+1[0m) @ [SHA][0m+β [32mCommitted changes @ [SHA][0mπ [36mRebasing onto [1m[36mmain[0m...[0mπ [36mMerging 1 commit to [1m[36mmain[0m @ [SHA][0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snapindex 2f3e31235..60626ed11 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap@@ -17,7 +17,7 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpkxZNqZ/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpBQQvyf/test-config.toml---success: trueexit_code: 0@@ -31,7 +31,7 @@ exit_code: 0[40m [0m - fix: update logic[40m [0m - docs: update readme-β [32mSquashed 3 commits into 1 (3 files, [32m+3[0m) @ [SHA][0m+β [32mSquashed 3 commits into 1 @ [SHA][0mπ [36mRebasing onto [1m[36mmain[0m...[0mπ [36mMerging 1 commit to [1m[36mmain[0m @ [SHA][0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snapindex 721282430..d26a5ba7c 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap@@ -18,7 +18,7 @@ info:LC_ALL: CSOURCE_DATE_EPOCH: "1761609600"WORKTRUNK_COMMIT_GENERATION__COMMAND: nonexistent-llm-command- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpDTLZlD/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpk6VxVV/test-config.toml---success: trueexit_code: 0@@ -31,7 +31,7 @@ exit_code: 0[40m [0m - feat: new feature[40m [0m - fix: bug fix-β [32mSquashed 2 commits into 1 (2 files, [32m+2[0m) @ [SHA][0m+β [32mSquashed 2 commits into 1 @ [SHA][0mπ [36mRebasing onto [1m[36mmain[0m...[0mπ [36mMerging 1 commit to [1m[36mmain[0m @ [SHA][0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snapindex 518b878dc..e399e5b20 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap@@ -20,7 +20,7 @@ info:WORKTRUNK_COMMIT_GENERATION__ARGS__0: "-c"WORKTRUNK_COMMIT_GENERATION__ARGS__1: "cat >/dev/null && echo 'feat: implement user authentication system'"WORKTRUNK_COMMIT_GENERATION__COMMAND: sh- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpT3OwtL/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpr4HNo8/test-config.toml---success: trueexit_code: 0@@ -33,7 +33,7 @@ exit_code: 0[40m [0m - feat: add authentication[40m [0m - fix: handle edge case-β [32mSquashed 2 commits into 1 (1 file, [32m+1[0m) @ [SHA][0m+β [32mSquashed 2 commits into 1 @ [SHA][0mπ [36mRebasing onto [1m[36mmain[0m...[0mπ [36mMerging 1 commit to [1m[36mmain[0m @ [SHA][0m