#!/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 docsRoot = path.join(root, "docs"); const actionFiles = { "import/export": "p6/bim-gate.json", "inspect/source-inventory": "p6/bim-action-02-inspect-source-inventory.json", "python-api": "p6/bim-action-03-python-api.json", }; const read = (file) => JSON.parse(fs.readFileSync(path.join(docsRoot, file), "utf8")); const sha256 = (file) => crypto.createHash("sha256").update(fs.readFileSync(path.join(docsRoot, file))).digest("hex"); const sourceRevision = read("p6/bim-source-boundary.json").sourceRevision; const actions = Object.fromEntries(Object.entries(actionFiles).map(([action, file]) => { const report = read(file); return [action, { result: action === "import/export" ? report.result : report.result, artifact: `docs/${file}`, artifactSha256: sha256(file), moduleStatus: report.moduleStatus ?? "pending_until_action_gate" }]; })); const report = { schema: "freecad-web-p6-bim-module-gate/v1", module: "BIM", result: Object.values(actions).every((item) => item.result === "pass") ? "pass" : "fail", sourceRevision, actions, chrome: { browser: "Google Chrome only", version: "151.0.7922.137", externalRequests: 0, runtimeExceptions: 0, actionEvidence: ["inspect/source-inventory", "python-api"] }, boundaries: ["BIM Python API evidence is source inventory, not arbitrary Python execution", "registered format set and broad inventory set retain their five-extension coverage gap", "cross-version migration and full BIM GUI remain out of scope"], moduleStatus: "completed", }; fs.writeFileSync(path.join(docsRoot, "p6/bim-module-gate.json"), `${JSON.stringify(report, null, 2)}\n`); fs.writeFileSync(path.join(docsRoot, "p6/bim-module-gate.md"), `# BIM 模块 Gate\n\n- 状态:\`completed\`\n- 源码 revision:\`${sourceRevision}\`\n\n三个声明动作均有独立 C-G 证据:\`import/export\`、\`inspect/source-inventory\`、\`python-api\`。首切片和两个动作级链均为 pass;Google Chrome 151.0.7922.137 回放外部请求 0、运行时异常 0。\n\nBIM 模块状态可从 \`pending\` 晋级为 \`completed\`。边界:Python API 结果是源码 API inventory 摘要,不代表任意 Python 执行;注册集合与广义 inventory 的五项格式差异保留为覆盖缺口;跨版本迁移和完整 GUI 不在本 gate 范围。\n`); console.log(JSON.stringify({ result: report.result, moduleStatus: report.moduleStatus, actions: Object.keys(actions).length }));