From dbffc151fbea89159542f59396886aabe5387622 Mon Sep 17 00:00:00 2001 From: Elijah Voigt Date: Sun, 29 Mar 2026 22:10:13 -0700 Subject: [PATCH] fix(transcribe): format tool_calls as readable list in header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace {:?} debug format with entries sorted by count descending, formatted as "Name×N" joined by ", " instead of raw HashMap output. Closes claudbg-f4ot Co-Authored-By: Claude Sonnet 4.6 --- ...-transcription-header-shows-tools-as-debug-hashmap.md | 9 +++++++-- src/commands/sessions.rs | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.beans/claudbg-f4ot--transcription-header-shows-tools-as-debug-hashmap.md b/.beans/claudbg-f4ot--transcription-header-shows-tools-as-debug-hashmap.md index e5ff5e7..e934a23 100644 --- a/.beans/claudbg-f4ot--transcription-header-shows-tools-as-debug-hashmap.md +++ b/.beans/claudbg-f4ot--transcription-header-shows-tools-as-debug-hashmap.md @@ -1,10 +1,11 @@ --- # claudbg-f4ot title: Transcription header shows tools as debug HashMap, not readable list -status: todo +status: completed type: bug +priority: normal created_at: 2026-03-30T04:43:50Z -updated_at: 2026-03-30T04:43:50Z +updated_at: 2026-03-30T05:10:08Z parent: claudbg-8vpb --- @@ -46,3 +47,7 @@ Format `stats.tool_calls` by iterating entries, sorting by count descending, and - `src/commands/sessions.rs` — transcribe function, `Tools:` println - `src/commands/agents.rs` — transcribe function (same issue) - `src/models/stats.rs` — `tool_calls: HashMap` + +## Summary of Changes + +In sessions.rs transcribe function, replaced {:?} debug format with a sorted, human-readable format: entries sorted by count descending, formatted as 'Name×N', joined by ', '. diff --git a/src/commands/sessions.rs b/src/commands/sessions.rs index 5422383..5711d4e 100644 --- a/src/commands/sessions.rs +++ b/src/commands/sessions.rs @@ -513,7 +513,13 @@ pub async fn transcribe(id: &str, follow: bool, opts: &crate::cli::GlobalOpts) - stats.cache_read_tokens, stats.cache_creation_tokens ); - println!("Tools: {:?}", stats.tool_calls); + let mut tool_entries: Vec<(&String, &u64)> = stats.tool_calls.iter().collect(); + tool_entries.sort_by(|a, b| b.1.cmp(a.1).then(a.0.cmp(b.0))); + let tools_str: Vec = tool_entries + .iter() + .map(|(name, count)| format!("{}×{}", name, count)) + .collect(); + println!("Tools: {}", tools_str.join(", ")); println!("Duration: {}ms", stats.duration_ms); println!("{}", "─".repeat(80));