main
John Lauer Add JST GH libraries, native schematic parity and revised sensor harness study with reviewed clips 1ac01c3
"""Document exact reusable GH parts, preserving per-file library rights and provisional fit."""
from pathlib import Path
import json,shutil,hashlib
R=Path(__file__).resolve().parents[1];source='https://www.jst-mfg.com/product/pdf/eng/eGH.pdf'
items=[('bm03b-ghs-tbt','BM03B-GHS-TBT',3,'top-entry SMT header','455-BM03B-GHS-TBTTR-ND','306-BM03BGHSTBTLFSNN'),('ghr-03v-s','GHR-03V-S',3,'keyed cable housing','455-1593-ND','306-GHR-03V-S'),('sshl-002t-p0-2','SSHL-002T-P0.2',1,'loose crimp contact','455-1606TR-ND','306-SSHL-002T-P0.2')]
for slug,mpn,n,role,dk,mo in items:
 P=R/'components'/slug;header=slug=='bm03b-ghs-tbt';model=json.loads((P/'review/model-review.json').read_text());parts={'symbol':slug+'.kicad_sym','footprint':slug+'.kicad_mod','step':slug+'.step','model_3d':slug+'.glb','model_3d_plain':slug+'.glb','model_3d_step':slug+'.step'}
 page={'slug':slug,'type':'hardware','kind':'component','version':'0.1.0','title':f'JST {mpn} {role}','description':f'JST GH 1.25 mm {role}, with portable native KiCad documentation and explicitly provisional nominal geometry.','brief':f'GH {role}; exact identity, native assets and provenance, with physical fit unqualified.','license':'MIT AND CC-BY-SA-4.0' if header else 'MIT','tags':['JST','GH','connector','1.25mm'],'hero':{'type':'image','path':'hero.png'},'source':{'name':'JST','url':source},'component':{'mpn':mpn,'manufacturer':'JST','package':role,'pin_count':n,'category':'Connectors','datasheet':source,'wiki_url':'https://wiki.adom.inc/adom/'+slug,'parts':parts,'distributor_links':{'digikey':dk,'mouser':mo},'pins':[{'number':str(i+1),'name':str(i+1),'type':'passive','description':'Connector contact position; verify mating-face orientation'}for i in range(n)],'assetRoles':{'symbol':'Native PCB connector symbol'if header else 'Off-board harness documentation, on_board=no','footprint':'SMT signal pads1-3 plus two unnetted MP retention tabs'if header else 'Zero-pad mechanical envelope; not a PCB solder footprint'},'qualification':{'status':'provisional','model':model['classification'],'matingAndCrimp':'Not qualified'}}}
 (P/'page.json').write_text(json.dumps(page,indent=2)+'\n');pkg=dict(page,name='@adom/'+slug,files=['README.md','LICENSE','THIRD_PARTY.md','LICENSE-KICAD.md','KICAD-LIBRARY-LICENSE.md','page.json','package.json','provenance.json',slug+'*','hero.png','symbol.html','footprint.html','skills/**','review/model-review.json'],dependencies={});(P/'package.json').write_text(json.dumps(pkg,indent=2)+'\n');shutil.copy2(R/'components/m20-9990346/LICENSE',P/'LICENSE')
 rights='Original documentation, harness symbols and original off-board geometry are MIT licensed. Manufacturer documents are linked, not included or relicensed. Manufacturer names and marks remain their owners property. '
 if header:
  (P/'LICENSE-KICAD.md').write_text('KiCad library assets, attributed to the KiCad library contributors: CC-BY-SA-4.0 with the KiCad electronic-design exception. Redistribution as library assets remains under this license. Official license and exception: https://www.kicad.org/libraries/license/ ; legal code: https://creativecommons.org/licenses/by-sa/4.0/legalcode . Source footprint: https://gitlab.com/kicad/libraries/kicad-footprints/-/blob/master/Connector_JST.pretty/JST_GH_BM03B-GHS-TBT_1x03-1MP_P1.25mm_Vertical.kicad_mod ; source STEP: https://gitlab.com/kicad/libraries/kicad-packages3D/-/blob/master/Connector_JST.3dshapes/JST_GH_BM03B-GHS-TBT_1x03-1MP_P1.25mm_Vertical.step . Local snapshot hashes and modifications are in provenance.json. Original symbol and documentation are MIT under LICENSE; this does not relicense the footprint or STEP.\n');rights+='Header footprint and STEP are KiCad-library-derived assets under the KiCad library CC-BY-SA4.0 license with its board-design exception. See LICENSE-KICAD.md; do not describe this model as original Adom or manufacturer CAD.'
 else:pkg['files'].remove('LICENSE-KICAD.md');pkg['files'].remove('KICAD-LIBRARY-LICENSE.md');(P/'package.json').write_text(json.dumps(pkg,indent=2)+'\n')
 (P/'THIRD_PARTY.md').write_text(rights+'\n');prov={'mpn':mpn,'retrievedAt':'2026-10-11','manufacturerSource':source,'datasheetPages':[2,3],'authoring':model['classification'],'generator':'tools/build_jst_gh_catalog.py in adom/adom-custom-electronic-load','generatorSha256':hashlib.sha256((R/'tools/build_jst_gh_catalog.py').read_bytes()).hexdigest(),'scope':model,'redistribution':rights,'assets':{},'wikiVisualReview':'pending; task browser closed by user'}
 for ext in ['step','kicad_mod','kicad_sym']:
  p=P/(slug+'.'+ext);prov['assets'][p.name]={'sha256':hashlib.sha256(p.read_bytes()).hexdigest(),'classification':('KiCad-derived' if header and ext!='kicad_sym' else 'original Adom'),'units':'mm'if ext!='kicad_sym'else 'native KiCad','source':source,'limits':model['limits']}
 if header:
  for ext,repo,folder in [('step','kicad-packages3D','Connector_JST.3dshapes'),('kicad_mod','kicad-footprints','Connector_JST.pretty')]:
   prov['assets'][slug+'.'+ext]['source']=f'https://gitlab.com/kicad/libraries/{repo}/-/blob/master/{folder}/JST_GH_BM03B-GHS-TBT_1x03-1MP_P1.25mm_Vertical.{ext}'
 for name in [slug+'.glb','hero.png']:
  asset=P/name
  if asset.exists():prov['assets'][name]={'sha256':hashlib.sha256(asset.read_bytes()).hexdigest(),'classification':'KiCad-derived rendering' if header else 'Original Adom rendering','derivedFrom':slug+'.step','license':'CC-BY-SA-4.0 with KiCad exception' if header else 'MIT','modification':'step2glb conversion or thumbnail rendering; no claim of manufacturer approval'}
 (P/'provenance.json').write_text(json.dumps(prov,indent=2)+'\n')
 skill=P/'skills'/slug;skill.mkdir(parents=True,exist_ok=True);(skill/'SKILL.md').write_text(f'''---
name: {slug}
description: Use when selecting, wiring or importing JST {mpn}; verify the GH mating family, wire range and native asset roles.
---
Parent skill: component-widgets

# JST {mpn}

Read README.md, provenance.json and review/model-review.json. The native symbol {'maps PCB pins1-3; MP pads are mechanical retention tabs with no electrical pin mapping'if header else 'is off-board harness documentation; the footprint has zero copper pads and is not a PCB connector land pattern'}. Preserve these roles.

GH uses SSHL-002T-P0.2 contacts; SSHL-003 variants are incompatible. Check AWG30-26 and insulation OD0.76-1.00mm against the actual wire, not gauge alone. Use manufacturer-approved tooling and per-wire crimp setup; nominal gauge matching does not prove crimp quality. Verify pin numbering from the mating face, continuity, latch engagement and cable strain relief. Do not copy a board-specific sensor assignment into this reusable part page.

These models are nominal; the off-board contact is a loose-contact illustration and does not prove crimped or mated fit. Keep rendered/source validation separate from physical qualification. Do not invent an animation state for this passive connector. Do not infer support in another EDA without a native import/render check.
''')
 text=f'''# {page['title']}

{page['description']}

[Manufacturer GH drawing]({source}) · [JST handling precautions](https://www.jst-mfg.com/product/pdf/eng/handling_e.pdf)

The keyed GH family uses **SSHL-002T-P0.2** contacts. SSHL-003 variants are not compatible. Applicable wire range is AWG30–26 with insulation diameter0.76–1.00mm. Series rating is1A with AWG26,50V; −40 to105°C including current-related heating. These ratings are not a guarantee for every harness wire or application.

'''
 if header:text+='''This top-entry3-position header has1.25mm contact pitch and7.00mm overall width. The nominal KiCad STEP is7.00×4.9504×4.20mm including terminals. Manufacturer mounting pattern gives0.60mm-wide signal pads on1.25mm pitch,1.70mm signal-pad length and two1.00×2.80mm retention pads. The two MP pads are mechanical solder tabs, not additional signal contacts. Pin1 is the negative-X signal pad in the supplied footprint; the manufacturer drawing is the same mounting-face pattern rotated180°. Verify orientation before connecting.

The footprint and STEP come from KiCad libraries under their own license, not manufacturer CAD. The original symbol has three passive electrical pins. No Altium/Fusion native parity is claimed.
'''
 elif n==3:text+='''Empty three-position housing:5.00mm width,4.15mm overall depth,5.70mm height,1.25mm contact pitch. Order one SSHL-002T-P0.2 per populated circuit. The STEP is an original simplified exterior with illustrative latch and passages; it does not prove engagement or contact retention. The symbol documents a harness (`on_board=no`); the zero-pad footprint is only a mechanical envelope.
'''
 else:text+='''Tin-plated copper-alloy contact. Manufacturer drawing gives4.8mm overall length and0.8×0.55mm socket section. The supplied original loose-contact illustration omits working spring and retention details and approximates the open crimp wings. It is not an installed/crimped model. There are no PCB solder pads; use its off-board symbol and mechanical envelope only.
'''
 text+='''
Use JST's specified tooling and establish the contact-specific conductor/insulation crimp settings with the actual wire. General handling guidance calls for stranded tin-plated annealed copper wire; solder-dipped end preparation requires separate review. Physical retention, pull test, mating orientation, installed cable bend and service-life qualification remain open. Native asset validation and live wiki review are recorded separately; publication is not hardware approval.
''';(P/'README.md').write_text(text);print(slug,'documented')