gokul/acoustic-guitar-tuner

This code defines the physical pin configuration and footprint layouts for the ATtiny1616 microcontroller and a matching tactile switch component, including their key hardware connection points, dimensions, and 3D models.

Version
1.0.10
License
unset
Stars
1

scripts/check-release.mjs

import { readFileSync } from "node:fs"
import assert from "node:assert/strict"

// This is an additional release gate, not a substitute for Gerber DRC or bench tests.
const file = process.argv[2] ?? "dist/index/circuit.json"
const circuit = JSON.parse(readFileSync(file, "utf8"))
assert(Array.isArray(circuit) && circuit.length > 0, "Missing circuit data")
const errors = circuit.filter(item =>
  item.type?.endsWith("_error") ||
  (typeof item.error_type === "string" && !item.error_type.endsWith("_warning")),
)
for (const error of errors) console.error(error.message ?? JSON.stringify(error))
assert.equal(errors.length, 0, `${errors.length} unresolved CAD errors; do not export`)
const traces = circuit.filter(item => item.type === "pcb_trace")
assert(traces.length > 0, "Board is not routed")
const board = circuit.find(item => item.type === "pcb_board")
assert(board?.outline?.length > 10, "Custom board outline is missing")
const components = circuit.filter(item => item.type === "source_component")
assert(!components.some(item => item.name?.startsWith("TP_")), "Old test points remain")
const header = components.find(item => item.name === "J1")
assert(header, "Female programming connector J1 is missing")
const pcbHeader = circuit.find(item => item.type === "pcb_component" && item.source_component_id === header.source_component_id)
const holes = circuit.filter(item => item.type === "pcb_plated_hole" && item.pcb_component_id === pcbHeader?.pcb_component_id)
assert.equal(holes.length, 3, "J1 must have three plated through-holes")
assert(holes.every(hole => hole.pcb_plated_hole_id && hole.pcb_port_id), "Header hole identifier/connection missing")
const warnings = circuit.filter(item => item.type?.endsWith("_warning"))
console.log(`PASS: no CAD errors; ${traces.length} routed traces; J1 has three connected plated holes; no TP_* components.`)
console.log(`${warnings.length} warnings remain for review. This check does not establish physical tuning accuracy or production approval.`)