1.7 KiB
| title | status | type | priority | created_at | updated_at | parent |
|---|---|---|---|---|---|---|
| Color-coded transcript output in CLI | completed | task | normal | 2026-03-31T00:32:52Z | 2026-03-31T04:28:11Z | claudbg-qpfe |
Apply ANSI colors to transcript output in sessions transcribe and agents transcribe:
[assistant]→ orange[user]→ grey[tool: Foo]→ blue[tool_result]→ green[tool_result (error)]→ red
Colors are enabled by default in interactive terminals (isatty check). Controlled by the --[no-]color flag and NO_COLOR env var.
Summary of Changes
Added ANSI color support to transcript output in both sessions transcribe and agents transcribe.
New file: src/output/color.rs
A small color helper module with five functions — orange, grey, blue, green, red — each taking a &str and a color_enabled: bool flag. When disabled the string is returned unchanged; when enabled the string is wrapped with the appropriate ANSI 256-color (or standard) escape code followed by \x1b[0m reset. Includes 3 unit tests.
Modified: src/output/mod.rs
Declared and exported the new color sub-module.
Modified: src/commands/sessions.rs and src/commands/agents.rs
Updated render_entry_text in both files (they are independent copies) to:
- Call
opts.color_enabled()once and pass the flag to color helpers. - Color
[assistant]labels orange (\x1b[38;5;208m). - Color
[user]labels grey (\x1b[38;5;245m). - Color
[tool: X]labels blue (\x1b[38;5;33m). - Color
[tool_result]labels green (\x1b[32m). - Color
[tool_result (error)]labels red (\x1b[31m).
Only the label prefix is colored; the message body is left plain. No new crate dependencies were added.