AnasSarkiz/pedometer

A four-layer Bluetooth pedometer PCB built around a bare TI CC2340R5 MCU, 48 MHz/32.768 kHz clocks, 2.4 GHz antenna matching network, battery charger/fuel gauge, accelerometer, regulator, USB‑C, OLED/SWD connectors, and supporting passives/protection.

Version
1.1.3
License
unset
Stars
0

scripts/check-fabrication.ts

import fs from "node:fs";
import crypto from "node:crypto";

const report = JSON.parse(fs.readFileSync("review/fabrication-review.json", "utf8"));
const circuitHash = crypto.createHash("sha256").update(fs.readFileSync("dist/index/circuit.json")).digest("hex");
if (report.circuitSha256 !== circuitHash) {
  console.error("FABRICATION HOLD: the review does not cover this Circuit JSON; rerun the fabrication review.");
  process.exit(1);
}
const manufacturingHash = crypto.createHash("sha256").update(fs.readFileSync("review/manufacturing/circuit.json")).digest("hex");
if (report.manufacturingCircuitSha256 !== manufacturingHash) {
  console.error("FABRICATION HOLD: manufacturing layers have changed since the review.");
  process.exit(1);
}
const open = report.findings.filter((f: { status: string }) => f.status !== "resolved");
if (report.status !== "ready" || open.length) {
  console.error(`FABRICATION HOLD: ${open.length} open findings. See docs/fabrication-review.md.`);
  for (const f of open) console.error(`${f.id}: ${f.title}`);
  process.exit(1);
}
console.log("Fabrication review clear for the recorded Circuit JSON.");