Skip to content

[ax] Add --output-format=json to validate-config - #8452

Merged
TomasVotruba merged 1 commit into
tv-validate-configfrom
tv-validate-config-json
Sep 3, 2026
Merged

[ax] Add --output-format=json to validate-config#8452
TomasVotruba merged 1 commit into
tv-validate-configfrom
tv-validate-config-json

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Stacked on #8450 (base branch tv-validate-config); will retarget to main once #8450 merges.

Why

validate-config (#8450) prints human warnings and sets an exit code. Agents and CI want a machine-readable result they can parse, not scrape from console text.

What

validate-config --output-format=json emits a compact machine gate to stdout and suppresses the human warnings:

{
    "valid": true,
    "issue_count": 0
}
  • exit 0 when valid is true, 1 otherwise - same gate as console mode.
  • default stays console.
  • warnings are silenced in json mode (verbosity QUIET), so stdout is clean JSON only, matching how process --output-format=json behaves.

Scope note

This v1 payload is the pass/fail gate (valid + issue_count). Per-finding detail (which rule/args are deprecated) would require the hygiene reporters to return structured findings instead of just counts - a larger change also touching ProcessCommand - so it is left as a follow-up.

Tests

  • testJsonOutputOnCleanConfig / testJsonOutputOnDeprecatedRegisteredRule assert both the payload and the exit code (output captured via ob_*).
  • composer check-cs, composer phpstan clean; verified on the CLI.

@TomasVotruba
TomasVotruba merged commit 27fb9b4 into tv-validate-config Sep 3, 2026
27 of 29 checks passed
@TomasVotruba
TomasVotruba deleted the tv-validate-config-json branch September 3, 2026 22:47
@TomasVotruba TomasVotruba changed the title [Console] Add --output-format=json to validate-config [ax] Add --output-format=json to validate-config Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant