4 lines
2.0 KiB
JavaScript
4 lines
2.0 KiB
JavaScript
#!/usr/bin/env node
|
|
import crypto from "node:crypto";import fs from "node:fs";import path from "node:path";import{fileURLToPath}from"node:url";
|
|
const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),"..");const docs=path.join(root,"docs/p6");const files={A:"points-source-boundary.json",B:"points-runtime.json",C:"points-kernel.json",D:"points-recovery.json",E:"points-facade.json",F:"points-chrome.json",G:"points-persistence.json"};const read=f=>JSON.parse(fs.readFileSync(path.join(docs,f),"utf8"));const hash=f=>crypto.createHash("sha256").update(fs.readFileSync(path.join(docs,f))).digest("hex");const contracts=Object.fromEntries(Object.entries(files).map(([step,file])=>{const v=read(file);const status=v.status||v.result||(step==="E"&&v.schemaChecks&&Object.values(v.schemaChecks).every(Boolean)?"pass":undefined);return[step,{artifact:`docs/p6/${file}`,status,sha256:hash(file)}]}));const result=Object.values(contracts).every(x=>x.status==="pass"||x.status==="completed")?"pass":"fail";const report={schema:"freecad-web-points-gate/v1",task_id:"FW-P6-PTS-X",module:"Points",status:result,source_revision:read(files.A).source_revision,contracts,module_status_after_gate:"in_progress",coverage:{createRecompute:"pass",inspectSourceInventory:"pending",pythonApi:"pending",saveReopen:"pending"},boundaries:["A-G close only the Points create/recompute first slice.","Later action cards remain pending."]};fs.writeFileSync(path.join(docs,"points-gate.json"),`${JSON.stringify(report,null,2)}\n`);fs.writeFileSync(path.join(docs,"points-gate.md"),`# Points first-slice gate\n\n- Result: \`${result}\`\n- Closed action: create/recompute\n- Points status after gate: \`${report.module_status_after_gate}\`\n`);fs.writeFileSync(path.join(root,"docs/freecad-p6-points-x-gate.log"),`${JSON.stringify({result,closedAction:"create/recompute",moduleStatus:report.module_status_after_gate})}\n`);console.log(JSON.stringify({result,closedAction:"create/recompute",moduleStatus:report.module_status_after_gate}));if(result!=="pass")process.exitCode=1;
|