Expand description
Pure, unit-tested formatting for the tcode CLI’s human-readable output
(#2060).
Why: every subcommand handler in the binary needs to turn a wire-shaped
Session/SessionEventEnvelope/TranscriptRecord into something a
terminal user can read. Keeping the formatting logic here (rather than
inline println!s scattered across the binary’s subcommand handlers)
makes it independently unit-testable without spawning a subprocess, and
keeps each handler a thin “call the client, print the result” wrapper.
What: render_session_table (a fixed-width table for session list),
render_event_line (one line per streamed SessionEventEnvelope,
used by attach/run-task), render_transcript_human (a readable
turn-by-turn view for transcript), and exit_code_for_status (maps a
terminal SessionStatus onto the SAME run_task::ExitCode values the
legacy in-process run-task path already used, so scripts checking $?
see a consistent contract regardless of which path produced the run).
Test: render::tests::*.
Functions§
- exit_
code_ for_ status - Map a terminal
SessionStatusonto the CLI process exit code. - render_
event_ line - Render one line for a single streamed event, for
attach/run-task. - render_
session_ table - Render a fixed-width table of sessions for
tcode session list. - render_
transcript_ human - Render a
TranscriptRecordas a readable turn-by-turn view fortcode transcript(human mode;--jsonbypasses this entirely and pretty-prints the raw result).