meta-reviewing-cli-reviewing
CLI Review Patterns
Quick Guide: A CLI's contract is its exit code, its two output streams and what it does without a terminal — scripts and CI branch on those and never read the wording. Review every terminating path for the code it produces, every prompt for its cancel path and its non-interactive twin, and every write for the stream it lands on. Three Node facts decide verdicts:
process.exit()abandons writes still pending to a pipe, so piped output arrives truncated; installing aSIGINTlistener removes Node's default exit with 130; and while a prompt holds the terminal in raw mode, Ctrl+C is a keypress rather than a signal.
Detailed Resources:
- examples/core.md — before-and-after code for each pattern, a spawned contract test, and a worked review
- reference.md — review checklists by area, exit-code conventions, the shapes a prompt cancel takes
<critical_requirements>
Before reviewing CLI code
Trace every terminating path to the exit code it produces. Scripts and CI branch on the number, not the message, so a failure that exits 0 — a catch block that only logs, a cancelled prompt that returns — reports success to every && chained after it.
Find out what the prompt library does on Ctrl+C, then check that path at every prompt. A prompt holds the terminal in raw mode, where Ctrl+C is a keypress rather than SIGINT, so no signal handler sees it; the library returns a cancel value, rejects, or drops the field, and an unchecked call carries that into the next line as data.