Files
OmniRoute/scripts/check/check-api-docs-refs.mjs
backryun d1d75fdbf4 ci(quality): cut PR gate wall time without dropping protection (#6716)
Collapse duplicate CI spend while keeping each gate's existence reason:

- quality.yml: TIA __RUN_ALL__ defers full unit to fast-unit 4-shard (#6781);
  path filters via classify-pr-changes; docs-gates split; draft skip
- ci.yml: wire docs/i18n/code path filters; ESLint JSON artifact for quality-gate;
  drop advisory typecheck:noimplicit; float actions/cache@v6
- TIA parity: memory/usage/combo/serial; **/*.test.mjs any depth; electron/bin
  no longer force unit __RUN_ALL__
- check:complexity-ratchets: one ESLint walk, ruleId-isolated baselines + cache
- check:api-docs-refs + lib/apiRoutes: shared API route inventory
- husky pre-push: intentionally light (gates live in pre-commit); CLAUDE.md +
  QUALITY_GATES.md docs synced
- collect-metrics / lint:json: path.resolve cache path; Windows-safe eslint bin
- env-doc allowlist for ESLINT_RESULTS_JSON / COMPLEXITY_ESLINT_REPORT
- release-green --full-ci expects check:api-docs-refs (not docs-symbols alone)

Tests: select-impacted, classify-pr-changes, api-routes lib, complexity-rule-count,
validate-release-green.

Reconciled after #6781 (fast-unit 2→4 shards) per maintainer request on #6716.

Co-authored-by: Diego Rodrigues de Sa e Souza <8016841+diegosouzapw@users.noreply.github.com>
2026-07-11 08:03:11 -03:00

33 lines
1.2 KiB
JavaScript

#!/usr/bin/env node
/**
* Combined anti-hallucination gate: OpenAPI paths + docs prose /api refs.
*
* Existence reasons (both still enforced):
* - openapi-routes: invented/obsolete paths in docs/openapi.yaml
* - docs-symbols: invented/obsolete /api paths in docs markdown *
* Shared walk of src/app/api (lib/apiRoutes.mjs) — one filesystem inventory,
* two independent failure messages. Prefer this on docs-gates CI; individual
* scripts remain for targeted local runs.
*/
import { pathToFileURL } from "node:url";
import { collectApiRouteFiles, collectApiRouteUrlPaths } from "./lib/apiRoutes.mjs";
import { runOpenapiRoutesCheck } from "./check-openapi-routes.mjs";
import { runDocsSymbolsCheck } from "./check-docs-symbols.mjs";
function main() {
const implPaths = collectApiRouteUrlPaths();
const routeFiles = collectApiRouteFiles();
const openapi = runOpenapiRoutesCheck({ implPaths });
const docs = runDocsSymbolsCheck({ routeFiles });
if (openapi.ok) console.log(openapi.message);
else console.error(openapi.message);
if (docs.ok) console.log(docs.message);
else console.error(docs.message);
process.exit(openapi.ok && docs.ok ? 0 : 1);
}
if (import.meta.url === pathToFileURL(process.argv[1] || "").href) main();