feat(selfhost): add a --json output mode to loopover-config-lint (#5931) - #5979
Conversation
…Nbored#5931) scripts/loopover-config-lint.ts was the only config-validation entrypoint in the repo without a machine-readable output mode, even though the SelfHostConfigLintResult it already computes (ok/warnings/recognizedFields/summary) is trivially JSON-serializable — and every sibling CLI (loopover-mcp validate-config/doctor/status) already supports --json. Add a --json flag: main() prints `{ path, ...result }` as pretty JSON instead of the text report, keeping the same exit code (1 when the manifest fails). The serialization is a pure formatLintJson export (directly unit-tested alongside formatLintReport), and a real subprocess CLI test invokes the script with --json for a clean and an unknown-field manifest so the main() wiring can't silently regress. Default text output and the file-read error paths are unchanged.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #5979 +/- ##
==========================================
- Coverage 95.16% 85.67% -9.50%
==========================================
Files 589 589
Lines 46790 46790
Branches 14943 14943
==========================================
- Hits 44528 40087 -4441
- Misses 1511 5292 +3781
- Partials 751 1411 +660
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-15 05:39:10 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 4 non-blocking
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
Adds a
--jsonoutput mode toscripts/loopover-config-lint.ts(npm run selfhost:config-lint -- [path] [--json]) — closing #5931. It's the one config-validation entrypoint in the repo without a machine-readable output mode, even though theSelfHostConfigLintResultit already computes (ok/warnings/recognizedFields/summary) is trivially JSON-serializable. Every sibling CLI (loopover-mcp validate-config --json,doctor --json,status --json) already supports it, so a self-hoster wiring config-lint into a CI/pre-deploy check had to regex-parse the human-readable report.With
--json, the command prints{ path, ...result }pretty-printed to stdout instead of the text report, and keeps the same exit-code behavior (1when the manifest fails validation). The default text output and the file-read error paths are unchanged.What changed
scripts/loopover-config-lint.ts: a pureformatLintJson(path, result)export (alongside the existingformatLintReport, so the serialization is directly unit-tested rather than only reached through CLI glue);main()parses--jsonand picks the first non-flag arg as the path (so--jsonmay appear before or after it);usage()documents the flag.test/unit/loopover-config-lint-script.test.ts: directformatLintJsonunit tests (clean + unknown-field, incl. the same secret-redaction contract the text report has), plus a real subprocess CLI test invokingtsx scripts/loopover-config-lint.ts <manifest> --json— asserting valid JSON withok/warnings/recognizedFields/summaryand the correct exit code (0 clean, 1 on warnings), so a future edit can't silently break the--jsonwiring inmain()'s I/O block.Scope
--jsonconvention.CONTRIBUTING.md; nosite//CNAME/lovable.Closes #5931.Validation
git diff --checknpm run typecheck(0 errors)npx vitest run test/unit/loopover-config-lint-script.test.ts— 12 pass (incl. the 4 new tests)vitest runsuite greennpm run docs:drift-checkgreenscripts/**is excluded fromvitest.config.tscoverage.include and listed incodecov.yml's ignore, so this isn't numerically gated bycodecov/patch; the required regression coverage is provided via the real subprocess/CLI test above, and the newformatLintJsonlogic (a pure export outsidemain()'s/* v8 ignore */block) is directly unit-tested.Safety
apps/loopover-uichange).Closes #5931