main
John Lauer Preserve board29, component assets and scaffold-fit correction candidate with reviewed footage c54169e
"""Validate project-only copper experiments with native desktop KiCad, never the editor."""
from pathlib import Path
import subprocess,json,shutil,sys
root=Path(__file__).resolve().parents[1];version=sys.argv[1];assert version.startswith('v') and version[1:].isdigit() and 4 <= int(version[1:]) <= 100
p=root/'checkpoints/unclipped-hotspots-v1';remote='C:/Users/john/adom-projects/adom-custom-electronic-load/review/unclipped-hotspots-v1';name='candidate-'+version
files=[str(root/'tools'/('hotspot_via_candidate_'+version+'.py')),str(root/'kicad/fp-lib-table')]
for ext in ['kicad_pro','kicad_dru']:
 q=p/(name+'.'+ext);shutil.copy2(p/('baseline.'+ext),q);files.append(str(q))
def ab(verb,args):
 r=subprocess.run(['adom-bridge',verb,json.dumps(args),'--target','AdomLapper','--ai-thread','adom-custom-load'],capture_output=True,text=True);j=json.loads(r.stdout);assert j.get('success'),j;return j
ab('send_files',{'filePaths':files,'dest':remote,'reason':'Isolated current-hotspot experiment; preserve live PCB and all original fabrication rules'})
for folder in sorted((root/'kicad/lib').glob('*.pretty')):
 ab('send_files',{'filePaths':[str(p) for p in sorted(folder.glob('*.kicad_mod'))],'dest':remote+'/lib/'+folder.name,'reason':'Validate against the actual project footprint libraries, without changing global desktop configuration'})
exe='C:/Users/john/AppData/Local/Programs/KiCad/10.0/bin/'
r=ab('shell_execute',{'command':f'"{exe}python.exe" "{remote}/hotspot_via_candidate_{version}.py" "{remote}/baseline.kicad_pcb" "{remote}/{name}.kicad_pcb"','timeoutSeconds':60,'reason':'Native refill of an isolated saved-board candidate'});(p/(version+'-native-command.json')).write_text(json.dumps(r,indent=2));assert r['exitCode']==0,r
r=ab('shell_execute',{'command':f'"{exe}kicad-cli.exe" pcb drc --format json --output "{remote}/drc-{version}.json" "{remote}/{name}.kicad_pcb"','timeoutSeconds':60,'reason':'Native DRC of isolated copper candidate, same project rules'});(p/(version+'-drc-command.json')).write_text(json.dumps(r,indent=2));assert r['exitCode']==0,r
r=ab('pull_file',{'filePaths':[remote+'/'+name+'.kicad_pcb',remote+'/'+name+'.changes.json',remote+'/drc-'+version+'.json'],'saveTo':str(p)});(p/(version+'-pull.json')).write_text(json.dumps(r,indent=2))
j=json.loads((p/('drc-'+version+'.json')).read_text());errors=[x for x in j['violations'] if x['severity']=='error'];print(json.dumps({'candidate':version,'errors':errors,'warnings':sum(x['severity']=='warning' for x in j['violations']),'opens':len(j['unconnected_items'])},indent=2))
if errors or j['unconnected_items']:raise SystemExit(2)