feat(scripts): add emit-all orchestrator + initial compliance artifacts
Adds scripts/compliance/emit-all.mjs which runs all three compliance emitters in --check mode and exits non-zero if any artifact is stale. Adds compliance:emit-all root package script. Generates initial compliance/retention-policy.yml and compliance/sub-processors.yml from the template collections. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
49
scripts/compliance/emit-all.mjs
Normal file
49
scripts/compliance/emit-all.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* emit-all.mjs — Compliance artifact orchestrator.
|
||||
*
|
||||
* Runs all three compliance emitters in --check mode and exits non-zero
|
||||
* if any generator reports a mismatch or validation failure.
|
||||
*
|
||||
* Usage:
|
||||
* node scripts/compliance/emit-all.mjs
|
||||
* pnpm compliance:emit-all
|
||||
*/
|
||||
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import path from "node:path";
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
const SCRIPTS = [
|
||||
"emit-data-map.mjs",
|
||||
"emit-retention-policy.mjs",
|
||||
"emit-sub-processors.mjs",
|
||||
];
|
||||
|
||||
let anyFailed = false;
|
||||
|
||||
for (const script of SCRIPTS) {
|
||||
const scriptPath = path.join(__dirname, script);
|
||||
const result = spawnSync(process.execPath, [scriptPath, "--check"], {
|
||||
stdio: "inherit",
|
||||
});
|
||||
|
||||
if (result.status !== 0) {
|
||||
anyFailed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (anyFailed) {
|
||||
process.stderr.write(
|
||||
"\n✗ compliance:emit-all — one or more artifacts are out of date.\n" +
|
||||
" Run each generator to regenerate:\n" +
|
||||
" pnpm compliance:data-map\n" +
|
||||
" pnpm compliance:retention-policy\n" +
|
||||
" pnpm compliance:sub-processors\n",
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log("✓ compliance:emit-all — all artifacts are up to date");
|
||||
Reference in New Issue
Block a user