main
John Lauer
Add JST GH libraries, native schematic parity and revised sensor harness study with reviewed clips
1ac01c3
"""Publish explicit sensor/library checkpoint against a freshly reviewed source head."""
from pathlib import Path
import json,subprocess,hashlib
R=Path(__file__).resolve().parents[1];O=R/'checkpoints/sensor-gh-review-v8';repo='adom/adom-custom-electronic-load';base=json.loads((O/'project-head.json').read_text())['data']['log'][0]['hash'];files=set()
def add(p):
if p.is_file():files.add(str(p.relative_to(R)))
for name in ['docs/completion-plan.md','videos/inventory.json','aiflow/run/run.json','aiflow/run/run.jsonl','aiflow/run/components.json','aiflow/run/timeline/presentation.json','aiflow/run/timeline/timeline.json','aiflow/run/timeline/sensor-gh-native.png','design/component-catalog-audit/testpad-review-board29.json']:add(R/name)
for pattern in ['tools/*sensor*.py','tools/*jst*.py','design/component-catalog-audit/jst-gh-*','aiflow/run/artifact-339f9a*.mp4','aiflow/run/artifact-83e39b*.mp4','checkpoints/jst-gh-*.log']:
for p in R.glob(pattern):add(p)
for name in ['checkpoints/sensor-gh-review-v8','mechanical/sensor-gh-study','videos/sensor-gh-candidate','videos/sensor-gh-detail']:
for p in (R/name).rglob('*'):
if p.suffix.lower() in ['.py','.json','.md','.glb','.step','.png','.mp4','.txt','.log','.kicad_pcb','.kicad_pro','.kicad_dru','.kicad_mod','.kicad_sch','.xml'] and not any(v in p.parts for v in ['__pycache__','3d','lib']):add(p)
# Supply complete portable candidate dependencies; these are previously published project models.
for name in ['3d','lib']:
for p in (O/name).rglob('*'):
if p.suffix.lower()in ['.step','.kicad_mod']:add(p)
add(O/'fp-lib-table')
for slug in ['bm03b-ghs-tbt','ghr-03v-s','sshl-002t-p0-2']:
for p in (R/'components'/slug).rglob('*'):
relative=p.relative_to(R/'components'/slug)
if 'review'in relative.parts:
if p.name in ['model-review.json','source-push.json','publish-first.json','page-readback.json']:add(p)
continue
if p.suffix.lower()in ['.json','.md','.step','.glb','.kicad_sym','.kicad_mod','.html','.png']or p.name=='LICENSE':add(p)
for name in ['project-push.json','publication-manifest.json']:files.discard(str((O/name).relative_to(R)))
manifest={'baseHead':base,'files':sorted(files),'sha256':{f:hashlib.sha256((R/f).read_bytes()).hexdigest()for f in sorted(files)},'scope':'Board29 remains adopted; GH and scaffold candidates unadopted, library/model evidence and two reviewed clips. Manufacturer PDFs/drawing crops excluded.'};(O/'publication-manifest.json').write_text(json.dumps(manifest,indent=2)+'\n')
x=json.loads(subprocess.check_output(['adom-wiki','repo','log',repo,'--limit','1','--json']));assert x['data']['log'][0]['hash']==base,'Concurrent source update; review before publication'
r=subprocess.run(['adom-wiki','repo','push',repo,'--files',*sorted(files),'-m','Add JST GH libraries, native schematic parity and revised sensor harness study with reviewed clips','--json'],cwd=R,capture_output=True,text=True);(O/'project-push.json').write_text(r.stdout);assert r.returncode==0,r.stderr;d=json.loads(r.stdout);assert d['status']=='ok',d;print(json.dumps({'files':len(files),'result':d['data']}))