Skip to content

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.md
index 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.rs
index 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 message
let 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.snap
index 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: true
exit_code: 0
----- stdout -----
-πŸ”„ Squashing 2 commits with working tree changes into 1 (2 files, +2)...
+πŸ”„ Squashing 2 commits & working tree changes into a single commit (2 files, +2)...
πŸ’‘ Backup created @ [SHA]
πŸ”„ Generating squash commit message...
πŸ’‘ Using fallback commit message. Run 'wt config --help' for LLM setup guide
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap
index 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: true
exit_code: 0
----- stdout -----
-πŸ”„ Squashing 1 commit with working tree changes into 1 (1 file, +1)...
+πŸ”„ Squashing 1 commit & working tree changes into a single commit (1 file, +1)...
πŸ’‘ Backup created @ [SHA]
πŸ”„ Generating squash commit message...
πŸ’‘ Using fallback commit message. Run 'wt config --help' for LLM setup guide
diff --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.snap
index 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: true
exit_code: 0
----- stdout -----
-πŸ”„ Squashing 1 commit with working tree changes into 1 (1 file, +1)...
+πŸ”„ Squashing 1 commit & working tree changes into a single commit (1 file, +1)...
πŸ’‘ Backup created @ [SHA]
πŸ”„ Generating squash commit message...
πŸ’‘ Using fallback commit message. Run 'wt config --help' for LLM setup guide
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
index 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: true
exit_code: 0
----- stdout -----
-πŸ”„ Squashing 3 commits into 1 (3 files, +3)...
+πŸ”„ Squashing 3 commits into a single commit (3 files, +3)...
πŸ”„ Generating squash commit message...
πŸ’‘ Using fallback commit message. Run 'wt config --help' for LLM setup guide
  Squash commits from main
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.snap
index 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: true
exit_code: 0
----- stdout -----
-πŸ”„ Squashing 3 commits into 1...
+πŸ”„ Squashing 3 commits into a single commit...
πŸ”„ Generating squash commit message...
πŸ’‘ Using fallback commit message. Run 'wt config --help' for LLM setup guide
  Squash commits from main
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap
index 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: true
exit_code: 0
----- stdout -----
-πŸ”„ Squashing 2 commits into 1 (2 files, +2)...
+πŸ”„ Squashing 2 commits into a single commit (2 files, +2)...
πŸ”„ Generating squash commit message...
πŸ’‘ Using fallback commit message. Run 'wt config --help' for LLM setup guide
  Squash commits from main
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap
index 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: true
exit_code: 0
----- stdout -----
-πŸ”„ Squashing 2 commits into 1 (1 file, +1)...
+πŸ”„ Squashing 2 commits into a single commit (1 file, +1)...
πŸ”„ Generating squash commit message...
πŸ’‘ Using fallback commit message. Run 'wt config --help' for LLM setup guide
  Squash commits from main
diff --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.snap
index 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: true
exit_code: 0
----- stdout -----
-πŸ”„ Squashing 2 commits with working tree changes into 1 (2 files, +2)...
+πŸ”„ Squashing 2 commits & working tree changes into a single commit (2 files, +2)...
πŸ’‘ Backup created @ [SHA]
πŸ”„ Generating squash commit message...
πŸ’‘ Using fallback commit message. Run 'wt config --help' for LLM setup guide
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_untracked_files.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_untracked_files.snap
index 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
🟑 Auto-staging 2 untracked files:
  untracked1.txt
  untracked2.txt
-πŸ”„ Squashing 1 commit with working tree changes into 1 (1 file, +1)...
+πŸ”„ Squashing 1 commit & working tree changes into a single commit (3 files, +3)...
πŸ’‘ Backup created @ [SHA]
πŸ”„ Generating squash commit message...
πŸ’‘ Using fallback commit message. Run 'wt config --help' for LLM setup guide
diff --git a/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap b/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
index 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: true
exit_code: 0
----- stdout -----
-πŸ”„ Squashing 3 commits into 1 (3 files, +33)...
+πŸ”„ Squashing 3 commits into a single commit (3 files, +33)...
πŸ”„ Generating squash commit message...
  feat(auth): Implement JWT authentication system
 
diff --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.snap
index 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: true
exit_code: 0
----- stdout -----
-πŸ”„ Squashing 3 commits into 1 (2 files, +45)...
+πŸ”„ Squashing 3 commits into a single commit (2 files, +45)...
πŸ”„ Generating squash commit message...
  feat(api): Add user authentication endpoints