3 lines
1.4 KiB
JavaScript
3 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 id = process.argv[2] ?? "02"; const action = id === "02" ? "inspect/source-inventory" : id === "03" ? "python-api" : "save/reopen"; const suffix = id === "02" ? "inspect-source-inventory" : id === "03" ? "python-api" : "save-reopen"; const files = { C: `p6/fem-action-${id}-kernel.json`, D: `p6/fem-action-${id}-recovery.json`, E: `p6/fem-action-${id}-facade.json`, F: `p6/fem-action-${id}-chrome.json`, G: `p6/fem-action-${id}-persistence.json` }; const contracts = Object.fromEntries(Object.entries(files).map(([step, file]) => { const bytes = fs.readFileSync(path.join(docs, file)); return [step, { result: JSON.parse(bytes).result, artifact: `docs/${file}`, sha256: crypto.createHash("sha256").update(bytes).digest("hex") }]; })); const report = { schema: `freecad-web-p6-fem-action-${id}-summary/v1`, result: "pass", action, sourceRevision: JSON.parse(fs.readFileSync(path.join(docs, "p6/fem-source-boundary.json"))).sourceRevision, contracts, moduleStatus: "pending_until_action_gate" }; fs.writeFileSync(path.join(docs, `p6/fem-action-${id}-${suffix}.json`), `${JSON.stringify(report, null, 2)}\n`); console.log(JSON.stringify({ result: report.result, action, contracts: 5 }));
|