Reporting
Structured terminal output for diagnostic commands. The report middleware decorates ctx.report with methods for writing checks, findings, and summaries.
Setup
Register the report() middleware in your CLI bootstrap:
The middleware accepts optional configuration:
Report API
Once registered, ctx.report provides three methods:
ctx.report.check(input)
Write a single pass/fail/warn/skip/fix check row. Useful for test results, linter checks, or diagnostic steps.
See the report() reference for all input fields.
ctx.report.finding(input)
Write a finding with optional code frame. Models a lint error, warning, or hint with source location.
See the report() reference for all input fields.
ctx.report.summary(input)
Write a summary block or inline stats. Two styles are available:
Block style ('tally') -- aligned multi-row summary:
Inline style -- pipe-separated one-liner:
See the report() reference for all input fields.
Standalone usage
Use createReport() outside the middleware pipeline for scripts or standalone tools:
Full example
A diagnostic command that checks project files and reports results:
Module augmentation
When using the report middleware, augment the CommandContext interface to get type-safe access: