3 lines
2.4 KiB
JavaScript
3 lines
2.4 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 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 actions={"create/recompute":["points-gate.json"],"inspect/source-inventory":["points-action-02-kernel.json","points-action-02-recovery.json","points-action-02-facade.json","points-action-02-chrome.json","points-action-02-persistence.json"],"python-api":["points-action-03-kernel.json","points-action-03-recovery.json","points-action-03-facade.json","points-action-03-chrome.json","points-action-03-persistence.json"],"save/reopen":["points-persistence.json"]};const entries=Object.fromEntries(Object.entries(actions).map(([action,files])=>{const statuses=files.map(f=>{const v=read(f);return v.status||v.result||(v.schema?.includes("facade")?"pass":undefined)});return[action,{result:statuses.every(s=>s==="pass"||s==="pass_boundary"||s==="completed"),evidence:files.map(f=>({path:`docs/p6/${f}`,sha256:hash(f)}))}]}));const result=Object.values(entries).every(x=>x.result);const report={schema:"freecad-web-points-module-gate/v1",task_id:"FW-P6-PTS-Y",module:"Points",status:result?"pass":"fail",source_revision:read("points-runtime.json").source_revision,module_status_before_gate:"pending",module_status_after_gate:result?"completed":"pending",eligible_for_completion:result,actions:entries,boundaries:["All four declared Points actions have independent conclusions.","GUI import dialogs and non-Chrome compatibility remain outside scope."]};fs.writeFileSync(path.join(docs,"points-module-gate.json"),`${JSON.stringify(report,null,2)}\n`);fs.writeFileSync(path.join(docs,"points-module-gate.md"),`# Points module gate\n\n- Result: \`${report.status}\`\n- Points status after gate: \`${report.module_status_after_gate}\`\n`);fs.writeFileSync(path.join(root,"docs/freecad-p6-points-y-gate.log"),`${JSON.stringify({result:report.status,actions:Object.fromEntries(Object.entries(entries).map(([k,v])=>[k,v.result])),moduleStatus:report.module_status_after_gate})}\n`);console.log(JSON.stringify({result:report.status,actions:4,moduleStatus:report.module_status_after_gate}));if(!result)process.exitCode=1;
|