4 lines
1.4 KiB
JavaScript
4 lines
1.4 KiB
JavaScript
#!/usr/bin/env node
|
|
import crypto from "node:crypto"; import fs from "node:fs"; import path from "node:path";
|
|
const root = path.resolve(path.dirname(new URL(import.meta.url).pathname), ".."); const docs = path.join(root, "docs"); const boundary = JSON.parse(fs.readFileSync(path.join(docs, "p6/draft-source-boundary.json"), "utf8")); const artifacts = ["p6/draft-runtime.json", "p6/draft-kernel.json", "p6/draft-recovery.json", "p6/draft-facade.json"]; const contracts = Object.fromEntries(artifacts.map((file) => [file, { result: JSON.parse(fs.readFileSync(path.join(docs, file))).result, sha256: crypto.createHash("sha256").update(fs.readFileSync(path.join(docs, file))).digest("hex") }])); const report = { schema: "freecad-web-p6-draft-gate/v1", module: "Draft", result: Object.values(contracts).every((item) => item.result === "pass") ? "pass" : "fail", sourceRevision: boundary.sourceRevision, contracts, uncoveredActions: ["inspect/source-inventory", "python-api", "save/reopen"], moduleStatus: "pending_until_full_action_gate" }; fs.writeFileSync(path.join(docs, "p6/draft-gate.json"), `${JSON.stringify(report, null, 2)}\n`); fs.writeFileSync(path.join(docs, "p6/draft-gate.md"), `# Draft 首切片 Gate\n\n- 状态:\`${report.result}\`\n- 首切片:\`create/recompute\`\n- 未覆盖动作:\`inspect/source-inventory\`、\`python-api\`、\`save/reopen\`\n`); console.log(JSON.stringify({ result: report.result, uncoveredActions: report.uncoveredActions.length }));
|