ci: add canonical architecture policy validator
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { readFile, access } from "node:fs/promises";
|
||||
|
||||
const requiredFiles = [
|
||||
"docs/MASTERPLAN.md",
|
||||
"docs/STANDARDS.md",
|
||||
"docs/AUTOMATIONS.md",
|
||||
"docs/UPSTREAM-CAPABILITY-MATRIX.md",
|
||||
"docs/spec/DIGITAL-TWIN-SPEC.md",
|
||||
"packages/types/src/index.ts",
|
||||
];
|
||||
|
||||
for (const path of requiredFiles) {
|
||||
await access(path).catch(() => {
|
||||
throw new Error(`Missing canonical C0PY artifact: ${path}`);
|
||||
});
|
||||
}
|
||||
|
||||
const types = await readFile("packages/types/src/index.ts", "utf8");
|
||||
const requiredContracts = [
|
||||
"CapabilityDisposition",
|
||||
"EvidenceConfidence",
|
||||
"EvidenceRecord",
|
||||
"CaptureProfile",
|
||||
"ProductWorkflow",
|
||||
"FidelityVector",
|
||||
"ReconstructionSpec",
|
||||
];
|
||||
|
||||
for (const contract of requiredContracts) {
|
||||
if (!types.includes(` ${contract}`)) {
|
||||
throw new Error(`Missing canonical contract: ${contract}`);
|
||||
}
|
||||
}
|
||||
|
||||
const masterplan = await readFile("docs/MASTERPLAN.md", "utf8");
|
||||
for (const disposition of [
|
||||
"CORE",
|
||||
"DEPENDENCY",
|
||||
"CHERRY_PICK",
|
||||
"ADAPTER",
|
||||
"REIMPLEMENT",
|
||||
"REFERENCE_ONLY",
|
||||
"DROP",
|
||||
]) {
|
||||
if (!masterplan.includes(`\`${disposition}\``)) {
|
||||
throw new Error(`Masterplan is missing capability disposition: ${disposition}`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log("C0PY canonical architecture policy: OK");
|
||||
Reference in New Issue
Block a user