abse/smartwatch-flex-top-only
Three-panel flex smartwatch with two parallel R3.9 bends, all components flat-top, low-profile JST connector harnesses, split heartbeat optical windows and screw-retained PCB mounting. Modeled 39 × 50.5 × 14.5mm prototype; 100% routing, zero native DRC and shorts. Hardware qualification pending.
- Version
- 0.2.22
- License
- unset
- Stars
- 0
scripts/verify-purpose-notes.ts
import fs from 'node:fs'
import {schematicSheets,notesForSheet,schematicAt} from '../schematic-layout'
const input=process.argv[2]??'dist/index/circuit.json',output=process.argv[3]??'reports/schematic-notes/purpose-coverage.json'
const circuit=JSON.parse(fs.readFileSync(input,'utf8'))
const sources=new Map(circuit.filter((e:any)=>e.type==='source_component').map((e:any)=>[e.source_component_id,e.name]))
const refs=circuit.filter((e:any)=>e.type==='schematic_component').map((e:any)=>sources.get(e.source_component_id))
const sheets=new Map(circuit.filter((e:any)=>e.type==='schematic_sheet').map((e:any)=>[e.name,e.schematic_sheet_id]))
const used=new Set<string>(),rows=[]
for(const sheet of schematicSheets)for(const note of notesForSheet(sheet.name)){
if(!refs.includes(note.ref)||used.has(note.ref))throw Error('Missing or duplicate component note: '+note.ref)
const found=circuit.filter((e:any)=>e.type==='schematic_text'&&e.schematic_sheet_id===sheets.get(sheet.name)&&e.text===note.text&&Math.abs(e.position.x-note.schX)<1e-8&&Math.abs(e.position.y-note.schY)<1e-8)
if(found.length!==1)throw Error('Purpose text is missing, duplicated or on the wrong sheet: '+note.ref)
const position=schematicAt(note.ref)
if(Math.hypot(note.schX-position.schX,note.schY-position.schY)>5)throw Error('Purpose text too far from component: '+note.ref)
used.add(note.ref);rows.push({ref:note.ref,sheet:sheet.name,text:note.text,schX:note.schX,schY:note.schY})
}
if(used.size!==162||refs.length!==162||refs.some((ref:any)=>!used.has(ref)))throw Error('Incomplete purpose-note coverage')
const result={status:'PASS',components:162,purposeNotes:162,sheets:schematicSheets.length,entry:input,notes:rows}
fs.mkdirSync(output.slice(0,output.lastIndexOf('/')),{recursive:true});fs.writeFileSync(output,JSON.stringify(result,null,2)+'\n');console.log('PASS: 162 / 162 schematic components have one brief nearby purpose note on the correct sheet.')