Files
openclaw/scripts/generate-config-doc-baseline.ts
T
Peter SteinbergerandGitHub 58452de711 refactor(config): config-surface reduction tranche 1 — retire dead keys, dedupe channel schemas, add growth ratchet (#111142)
* refactor(config): retire dead and aliased config keys via doctor migrations

* refactor(config): dedupe bundled channel config schemas into shared builders

* feat(config): add config-surface count ratchet to doc-baseline check

* test(config): drop stale fixtures for retired config keys

* fix(doctor): migrate only positive finite MCP timeout aliases

* fix(migrate-hermes): emit canonical MCP timeouts only

* fix(config): satisfy lint and contract gates
2026-07-19 00:52:37 -07:00

59 lines
2.1 KiB
JavaScript

#!/usr/bin/env node
// Generate Config Doc Baseline script supports OpenClaw repository automation.
import path from "node:path";
import { fileURLToPath } from "node:url";
import { writeConfigDocBaselineArtifacts } 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 writeConfigDocBaselineArtifacts({
repoRoot,
check: checkOnly,
});
if (checkOnly) {
if (!result.changed) {
console.log(
`OK ${path.relative(repoRoot, result.hashPath)} and ${path.relative(repoRoot, result.countsPath)}`,
);
process.exit(0);
}
if (result.countBudgetError) {
console.error(
`Config baseline count budget invalid: ${result.countBudgetError}. Run \`pnpm config:docs:gen\` to recreate ${path.relative(repoRoot, result.countsPath)}.`,
);
}
for (const violation of result.countViolations) {
console.error(violation.message);
}
if (result.hashChanged) {
console.error(
[
"Config baseline drift detected.",
`Hash mismatch: ${path.relative(repoRoot, result.hashPath)}`,
"If this config-surface change is intentional, run `pnpm config:docs:gen` and commit the updated hash file.",
"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.hashPath)}`,
`Wrote ${path.relative(repoRoot, result.countsPath)}`,
`Wrote ${path.relative(repoRoot, result.jsonPaths.combined)} (gitignored, local only)`,
`Wrote ${path.relative(repoRoot, result.jsonPaths.core)} (gitignored, local only)`,
`Wrote ${path.relative(repoRoot, result.jsonPaths.channel)} (gitignored, local only)`,
`Wrote ${path.relative(repoRoot, result.jsonPaths.plugin)} (gitignored, local only)`,
].join("\n"),
);