feat: add compact output format - #84
Conversation
The default text output prints every passing check, the token tables, and the analysis sections for each skill. Validating a directory of skills produces hundreds of lines in which the few findings that need attention are buried. Add -o compact, which renders each skill as a single line naming it and its outcome, with any warnings and errors listed beneath it. Passing and informational findings, token counts, and the content and contamination analysis sections are omitted. Only the rendering changes: finding counts, the overall summary, and exit codes are still computed from the full report, and the other output formats are untouched.
0404e01 to
25d15a3
Compare
|
Thank you @choplin — three for three. This one's design notes were a pleasure to read: making compact a value of Verified locally: full suite under Seriously, thank you for this run of contributions. Repeat contributors with this level of care are rare here, and you're very welcome back anytime — if you have more ideas for the validator, I'd be glad to see them as issues or PRs. |
What this PR does
Adds
-o compact, a text output format that reduces each skill to a single line and lists only its warnings and errors.The default text output prints every passing check, the token tables, and the content and contamination analysis sections for each skill. That is the right default when you are working on one skill, but when running
checkover a directory of skills — the common pre-commit and CI case — it produces hundreds of lines in which the few findings that need attention are buried. Today the only way to get a terse view is-o jsonplus ajqfilter.Compact output looks like this:
Passing and informational findings, token counts, and the analysis sections are omitted. Separators are not drawn, so the per-skill lines read as a list.
Only the rendering changes. Finding counts, the overall summary, and exit codes are still computed from the full report, so
-o compactand-o textalways agree on pass/fail and on--strictbehaviour.Design notes
An output format rather than a
--compactflag. A boolean flag would raise the question of what--compact -o jsonmeans, and would need either an error or a documented precedence rule. Making compact a value of the existing--outputenum makes it mutually exclusive with the other renderers by construction, and matches how it is used in practice: it is a way to render a report, likemarkdown.--emit-annotationsstill composes with it, as with every other format.A separate renderer rather than a mode inside
Print.report/compact.gobuilds its own output fromtypes.Reportinstead of adding suppression branches to the existing renderer, which keeps the full text output exactly as it was.Level threshold is fixed at warning. An earlier draft exposed a
--min-levelflag so the threshold was configurable. It was dropped: the only threshold with a real use case is "show me what needs attention", anderror-only would hide warnings that still affect the exit code, which is a confusing thing to offer. If a use case for error-only output appears later, it can be added without changing this format.How to test
Covered by tests:
report/compact_test.go— a passing skill renders as exactly one line; warnings and errors are listed indented beneath the summary; pass and info findings, token counts and analysis sections are omitted; the icon reflects the worst level present; multi-skill output has no separators and keeps the overall summary.cmd/compact_integration_test.go— drives the built binary end to end, asserting the rendering above and that exit codes (0/1/2) are unaffected, plus a guard that the default text output is unchanged.Checklist
go test -race ./... -count=1)golangci-lint run)-o compactis additive and the existing formats are untouchedNote: CONTRIBUTING.md asks that new output formats be discussed in an issue first. I had already built this for my own use, so I am opening it as a concrete proposal rather than a request to write it — happy to move the discussion to an issue, or to close this if the direction does not fit the project.