mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-26 07:57:40 +00:00
Docs: add config drift baseline statefile (#45891)
* Docs: add config drift statefile generator * Docs: generate config drift baseline * CI: move config docs drift runner into workflow sanity * Docs: emit config drift baseline json * Docs: commit config drift baseline json * Docs: wire config baseline into release checks * Config: fix baseline drift walker coverage * Docs: regenerate config drift baselines
This commit is contained in:
44
scripts/generate-config-doc-baseline.ts
Normal file
44
scripts/generate-config-doc-baseline.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env node
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { writeConfigDocBaselineStatefile } from "../src/config/doc-baseline.js";
|
||||
|
||||
const args = new Set(process.argv.slice(2));
|
||||
const checkOnly = args.has("--check");
|
||||
|
||||
if (checkOnly && args.has("--write")) {
|
||||
console.error("Use either --check or --write, not both.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const result = await writeConfigDocBaselineStatefile({
|
||||
repoRoot,
|
||||
check: checkOnly,
|
||||
});
|
||||
|
||||
if (checkOnly) {
|
||||
if (!result.changed) {
|
||||
console.log(
|
||||
`OK ${path.relative(repoRoot, result.jsonPath)} ${path.relative(repoRoot, result.statefilePath)}`,
|
||||
);
|
||||
process.exit(0);
|
||||
}
|
||||
console.error(
|
||||
[
|
||||
"Config baseline drift detected.",
|
||||
`Expected current: ${path.relative(repoRoot, result.jsonPath)}`,
|
||||
`Expected current: ${path.relative(repoRoot, result.statefilePath)}`,
|
||||
"If this config-surface change is intentional, run `pnpm config:docs:gen` and commit the updated baseline files.",
|
||||
"If not intentional, treat this as docs drift or a possible breaking config change and fix the schema/help changes first.",
|
||||
].join("\n"),
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(
|
||||
[
|
||||
`Wrote ${path.relative(repoRoot, result.jsonPath)}`,
|
||||
`Wrote ${path.relative(repoRoot, result.statefilePath)}`,
|
||||
].join("\n"),
|
||||
);
|
||||
Reference in New Issue
Block a user