Repository navigation
Description
Discord Username / User ID
uisupersaiyan3
What does this improvement do?
The only machine-readable output today is --output json, which for the paginated list surfaces emits a single buffered, pretty-printed array (out.print({ runs, nextCursor }, ...) in runResultHistory at src/commands/test.ts:3735, test runList at :419, project runList at src/commands/project.ts:47). That shape is awkward for the two most common scripting consumers: spreadsheets and awk (must hand-parse JSON), and line-oriented pipelines (jq or while read must buffer and slice the whole array). This adds two modes to the existing --output enum. --output csv emits an RFC 4180 table: a header row, then one row per item, with columns derived from the response type so they cannot drift. --output ndjson emits one compact JSON object per line with no wrapping array, streamed as each page arrives, so ... --output ndjson | jq -c 'select(.status=="failed")' works without buffering. Both apply to the list commands only (test result --history, project list, test list); a single-object command given --output csv or --output ndjson exits 5 with a clear message. It drops straight into shell CI and data pipelines.
Details / implementation notes
Extend OutputMode (src/lib/output.ts:1) to 'json' | 'text' | 'csv' | 'ndjson' and widen isOutputMode (:12); because --output is validated at one choke point (src/index.ts:128, :140) the new modes stay uniform across command groups. Reuse (do not re-implement) the existing render call sites: runResultHistory (src/commands/test.ts:3735, table via renderRunHistoryTable :3860), test runList (:419, renderTestListText :473), project runList (src/commands/project.ts:47), by adding csv and ndjson branches alongside the current json/text branch in each. Row columns come from the source-of-truth types (RunHistoryItem, CliTest, CliProject), never hand-listed. csv quoting follows RFC 4180 (fields containing , " or a newline are wrapped, " is doubled; null/absent renders as an empty field). ndjson writes one line per row incrementally across the existing cursor loop and routes pagination metadata (nextCursor, short-page hints) to stderr so stdout stays pure ndjson. --output json and --output text remain byte-identical; exit codes are unchanged except exit 5 when csv or ndjson is used on a non-list command. No new dependency. Tests: csv quoting edge cases, multi-page accumulation, ndjson line shape, stdout/stderr separation, non-list rejection exit 5, json/text unchanged. PR to follow once assigned.
Confirmations
- I have searched existing issues and this is not a duplicate.
- I have provided my Discord identity above for reward coordination.
Activity
ISTHA1607 commentedon Jul 23, 2026
/assign
testsprite-hob commentedon Jul 23, 2026
Assigned to @ISTHA1607. Thanks for taking this on. (2 more slots available.)
Your open assigned issues (1/3):
(none)
crypticsaiyan commentedon Oct 21, 2026
/assign
testsprite-hob commentedon Oct 21, 2026
Assigned to @crypticsaiyan. Thanks for taking this on. (1 more slot available.)
Your open assigned issues (2/3):
zeshi-du commentedon Nov 9, 2026
We've decided not to add new output formats in this cycle;
--outputstaysjsonandtext(see #632). Thanks for the proposal and the work on it.