Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
feat: enhance squash command progress messages for clarity and detail
Maximilian Roosb16c26f97eae
diff --git a/CLAUDE.md b/CLAUDE.mdindex d169019af..967b605f4 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -227,7 +227,7 @@ Progress messages should include all relevant details (what's being done, counts```rust// β GOOD - detailed progress, minimal success-output::progress("π Squashing 3 commits with working tree changes into 1 (5 files, +120, -45)...")?;+output::progress("π Squashing 3 commits & working tree changes into a single commit (5 files, +60)...")?;perform_squash()?;output::success("β Squashed @ a1b2c3d")?;```diff --git a/src/commands/standalone.rs b/src/commands/standalone.rsindex 2d44ea59f..e479ebce0 100644--- a/src/commands/standalone.rs+++ b/src/commands/standalone.rs@@ -143,26 +143,35 @@ pub fn handle_squash(// Either multiple commits OR single commit with staged changes - squash them// Get diff stats early for display in progress messagelet range = format!("{}..HEAD", merge_base);- let stats_parts = repo.diff_stats_summary(&["diff", "--shortstat", &range]);let commit_text = if commit_count == 1 {"commit"} else {"commits"};++ // Get total stats (commits + any working tree changes)+ let total_stats = if has_staged {+ repo.diff_stats_summary(&["diff", "--shortstat", &merge_base, "--cached"])+ } else {+ repo.diff_stats_summary(&["diff", "--shortstat", &range])+ };+let with_changes = if has_staged {- " with working tree changes"+ " & working tree changes"} else {""};- let squash_progress = match stats_parts.is_empty() {- true => {- format!("{CYAN}Squashing {commit_count} {commit_text}{with_changes} into 1...{CYAN:#}")- }- false => format!(- "{CYAN}Squashing {commit_count} {commit_text}{with_changes} into 1{CYAN:#} ({})...",- stats_parts.join(", ")- ),++ let squash_progress = if total_stats.is_empty() {+ format!(+ "{CYAN}Squashing {commit_count} {commit_text}{with_changes} into a single commit...{CYAN:#}"+ )+ } else {+ format!(+ "{CYAN}Squashing {commit_count} {commit_text}{with_changes} into a single commit{CYAN:#} ({})...",+ total_stats.join(", ")+ )};crate::output::progress(squash_progress)?;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 ec1c6c080..80a3024ea 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@@ -23,7 +23,7 @@ info:success: trueexit_code: 0----- stdout ------π [36mSquashing 2 commits with working tree changes into 1[0m (2 files, [32m+2[0m)...+π [36mSquashing 2 commits & working tree changes into a single commit[0m (2 files, [32m+2[0m)...π‘ Backup created @ [SHA]π [36mGenerating squash commit message...[0mπ‘ [2mUsing fallback commit message. Run 'wt config --help' for LLM setup guide[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 6d4e75b96..078e2bf36 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@@ -21,7 +21,7 @@ info:success: trueexit_code: 0----- stdout ------π [36mSquashing 1 commit with working tree changes into 1[0m (1 file, [32m+1[0m)...+π [36mSquashing 1 commit & working tree changes into a single commit[0m (1 file, [32m+1[0m)...π‘ Backup created @ [SHA]π [36mGenerating squash commit message...[0mπ‘ [2mUsing fallback commit message. Run 'wt config --help' for LLM setup guide[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 000544ab2..d483ba4ac 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@@ -23,7 +23,7 @@ info:success: trueexit_code: 0----- stdout ------π [36mSquashing 1 commit with working tree changes into 1[0m (1 file, [32m+1[0m)...+π [36mSquashing 1 commit & working tree changes into a single commit[0m (1 file, [32m+1[0m)...π‘ Backup created @ [SHA]π [36mGenerating squash commit message...[0mπ‘ [2mUsing fallback commit message. Run 'wt config --help' for LLM setup guide[0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snapindex bcef9ddda..7dd8dea86 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap@@ -21,7 +21,7 @@ info:success: trueexit_code: 0----- stdout ------π [36mSquashing 3 commits into 1[0m (3 files, [32m+3[0m)...+π [36mSquashing 3 commits into a single commit[0m (3 files, [32m+3[0m)...π [36mGenerating squash commit message...[0mπ‘ [2mUsing fallback commit message. Run 'wt config --help' for LLM setup guide[0m[107m [0m [1mSquash commits from main[0mdiff --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 646419bfd..38e5429a9 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@@ -21,7 +21,7 @@ info:success: trueexit_code: 0----- stdout ------π [36mSquashing 3 commits into 1...[0m+π [36mSquashing 3 commits into a single commit...[0mπ [36mGenerating squash commit message...[0mπ‘ [2mUsing fallback commit message. Run 'wt config --help' for LLM setup guide[0m[107m [0m [1mSquash commits from main[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 5c386d21d..510f4622f 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@@ -22,7 +22,7 @@ info:success: trueexit_code: 0----- stdout ------π [36mSquashing 2 commits into 1[0m (2 files, [32m+2[0m)...+π [36mSquashing 2 commits into a single commit[0m (2 files, [32m+2[0m)...π [36mGenerating squash commit message...[0mπ‘ [2mUsing fallback commit message. Run 'wt config --help' for LLM setup guide[0m[107m [0m [1mSquash commits from main[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 d97ad50d4..7c1a3a6c2 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@@ -24,7 +24,7 @@ info:success: trueexit_code: 0----- stdout ------π [36mSquashing 2 commits into 1[0m (1 file, [32m+1[0m)...+π [36mSquashing 2 commits into a single commit[0m (1 file, [32m+1[0m)...π [36mGenerating squash commit message...[0mπ‘ [2mUsing fallback commit message. Run 'wt config --help' for LLM setup guide[0m[107m [0m [1mSquash commits from main[0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_working_tree_creates_backup.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_working_tree_creates_backup.snapindex dea55e3d8..b0ffdd7e4 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_working_tree_creates_backup.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_working_tree_creates_backup.snap@@ -23,7 +23,7 @@ info:success: trueexit_code: 0----- stdout ------π [36mSquashing 2 commits with working tree changes into 1[0m (2 files, [32m+2[0m)...+π [36mSquashing 2 commits & working tree changes into a single commit[0m (2 files, [32m+2[0m)...π‘ Backup created @ [SHA]π [36mGenerating squash commit message...[0mπ‘ [2mUsing fallback commit message. Run 'wt config --help' for LLM setup guide[0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_untracked_files.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_untracked_files.snapindex b3c039644..aef2f1cb6 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_with_untracked_files.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_untracked_files.snap@@ -26,7 +26,7 @@ exit_code: 0π‘ [33mAuto-staging 2 untracked files:[0m[107m [0m untracked1.txt[107m [0m untracked2.txt-π [36mSquashing 1 commit with working tree changes into 1[0m (1 file, [32m+1[0m)...+π [36mSquashing 1 commit & working tree changes into a single commit[0m (3 files, [32m+3[0m)...π‘ Backup created @ [SHA]π [36mGenerating squash commit message...[0mπ‘ [2mUsing fallback commit message. Run 'wt config --help' for LLM setup guide[0mdiff --git a/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap b/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snapindex b0997a39c..32f6c77e4 100644--- a/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap@@ -23,7 +23,7 @@ info:success: trueexit_code: 0----- stdout ------π [36mSquashing 3 commits into 1[0m (3 files, [32m+33[0m)...+π [36mSquashing 3 commits into a single commit[0m (3 files, [32m+33[0m)...π [36mGenerating squash commit message...[0m[107m [0m [1mfeat(auth): Implement JWT authentication system[0m[107m [0mdiff --git a/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_pre_merge.snap b/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_pre_merge.snapindex ebfec292b..ba0b7de04 100644--- a/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_pre_merge.snap+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_pre_merge.snap@@ -23,7 +23,7 @@ info:success: trueexit_code: 0----- stdout ------π [36mSquashing 3 commits into 1[0m (2 files, [32m+45[0m)...+π [36mSquashing 3 commits into a single commit[0m (2 files, [32m+45[0m)...π [36mGenerating squash commit message...[0m[107m [0m [1mfeat(api): Add user authentication endpoints[0m[107m [0m