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), render_workstream_table (a
tmux-list-sessions-style table for tcode workstream list, #3296), 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::*.
Structs§
- Workstream
Row - One row of
workstream.list’s wire response, as needed to renderrender_workstream_table(#3296, DOC-48 §5.4).
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). - render_
workstream_ table - Render a tmux-
list-sessions-style table of workstreams fortcode workstream list(DOC-48 §5.4, AC-5.1, issue #3296).