feat(check): emit the check result as a machine-readable document - #21
Merged
Conversation
Add `--json` to `check`, emitting one JSON document on stdout instead of the human lines. `compile` already had `--report`; `check` had nothing, so a consuming repository parsed the diagnostic stream back apart with a regex over merged stdout and stderr, and re-derived paths by string-matching the `<root>` token the formatter emits. A gate whose consumer is one formatting change away from silently finding zero issues fails open, which is the wrong direction. The document carries `schemaVersion`, since ndr:r51yhr binds any machine- targeted format. `status` is hoisted to the top level so a consumer branches on it rather than on an empty `issues` array — reading "no issues parsed" as "passed" is the failure the text format invited, and a test pins it. It deliberately does not group by disposition, though ndr:71jgk2 binds every report format. Check codes are already dispositional — missing-output, changed-output, unsafe-output-content each name what became of the thing — and there is no severity axis to reorganise, so the grouping would classify nothing. Also exports ./report from package.json; it had no entry, so tests could not import the builder. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LxNdWk6ZUzq6uWFtd94yWD
|
🎉 This PR is included in version 0.4.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
--jsontocheck, emitting one JSON document on stdout instead of the human lines.Why
compilealready had--reportwith a JSON format;checkhad nothing. A consuming repository parses the diagnostic stream back apart — a regex over merged stdout and stderr, then re-deriving paths by string-matching the literal<root>token the formatter emits for root-anchored manifests.That makes the consumer one formatting change away from silently finding zero issues. A gate that fails open is the wrong direction for a gate to fail, and this removes the parsing layer rather than asking every consumer to maintain one.
Design calls, each against a standing decision
schemaVersion: 1—ndr:r51yhrbinds "the JSON compilation report, and any later machine-targeted format." This is one.ndr:71jgk2binds "every report format." Check codes are already dispositional —missing-output,changed-output,unsafe-output-contenteach name what became of the thing — and check issues carry no severity, so there is no axis to reorganise. Imposing the grouping would add a layer that classifies nothing. The reasoning is in a code comment so it is not re-litigated later.statushoisted to the top level, so a consumer branches on it rather than onissues.length. Reading "no issues parsed" as "passed" is precisely the failure mode the text format invited; a test pins it.--jsonowns stdout entirely — one stray human line makes the document unparseable.--claude-nativeoutput still writes through, since suppressing another tool's output would hide why a run failed.Testing
jdh-agentscorpus: valid JSON, 67,895 bytes, andfilesChecked(213 / 207) matches the text path exactly, so the two views cannot disagree.Also adds
"./report"to the packageexportsmap — it had no entry, so tests could not import the builder.Risk surface
Low and additive. The default (no
--json) path is byte-identical; exit codes are unchanged in both modes. The one shared-code change isbuildCheckReportreadingMarketplaceCheckResult, which it does not mutate.Note this is a
feat:, so merging cuts 0.4.0 — and it is the first release since the npm job landed, so it will be the first real exercise ofpublish-npm. That job has never run; if it fails, the release assets are already attached by then and only the npm half is affected.Rollback
Revert the commit.
--jsondisappears; the text path and every exit code are untouched.🤖 Generated with Claude Code
https://claude.ai/code/session_01LxNdWk6ZUzq6uWFtd94yWD