feat(cli): make tool output responsive to terminal width

- Add terminal_width module with get_terminal_width(), clip_line(),
  compress_path(), and compress_command() utilities
- Update ConsoleUiWriter to use dynamic terminal width for all tool output
- Tool output lines are clipped to fit without wrapping
- Tool headers use semantic compression (paths preserve filename,
  commands clip from right)
- 4-character right margin for visual clarity
- Minimum 40 columns, default 80 when terminal size unavailable
- All truncation is UTF-8 safe (char counting, not byte slicing)
- Add 13 unit tests for terminal width utilities
This commit is contained in:
Dhanji R. Prasanna
2026-02-05 20:18:30 +11:00
parent b2fbcf33d0
commit 30627bce97
4 changed files with 272 additions and 40 deletions

View File

@@ -24,6 +24,7 @@ mod template;
mod completion;
mod project;
mod input_formatter;
mod terminal_width;
use anyhow::Result;
use std::path::PathBuf;