mirror of
https://github.com/morluto/rea.git
synced 2026-10-19 04:19:54 -05:00
Derive package, tool-family, provider, setup-client, schema-version, and CLI facts from the runtime contract sources into a deterministic checked-in catalog. Add non-mutating generated-file checks, exact TypeDoc regenerate-and-compare validation, caller-visible documentation fact checks, and CI enforcement through docs:check. Cover command-router parity, source-derived catalog values, deliberate documentation drift, and stale generated artifacts while preserving runtime behavior.
22 lines
770 B
JavaScript
22 lines
770 B
JavaScript
import { dirname, join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
import { analysisErrorJsonSchema } from "../dist/contracts/errorSchemas.js";
|
|
import { format } from "prettier";
|
|
import { ensureGeneratedFile } from "./lib/generated-file.mjs";
|
|
|
|
const arguments_ = new Set(process.argv.slice(2));
|
|
for (const argument of arguments_)
|
|
if (argument !== "--check")
|
|
throw new Error(`Unknown error schema option: ${argument}`);
|
|
|
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
await ensureGeneratedFile({
|
|
path: join(root, "docs/error-contract.schema.json"),
|
|
source: await format(JSON.stringify(analysisErrorJsonSchema), {
|
|
parser: "json",
|
|
}),
|
|
check: arguments_.has("--check"),
|
|
generateCommand: "npm run docs:generate",
|
|
});
|