← Commit history

Publish 1.1.1

John Lauer ·2b0a278a43 · ·parent 63c1c64
4 files changed +23−23
README.md+9−9
@@ -1,6 +1,6 @@ # adom-ds2sf -**Datasheet → symbol + footprint + provenance JSON.**+**Datasheet to symbol + footprint + provenance JSON.**  A small Rust CLI that runs downstream of `chip-fetcher`: it reads a chip's datasheet PDF and produces the JSON inputs needed by Adom's `sym_create` MCP plus a footprint metadata file plus a field-level provenance audit trail. Built for both human use and **agent-to-agent calling** by an upstream automation (`chip-fetcher`, batch pipelines). @@ -46,10 +46,10 @@ The provenance JSON is the audit trail. Pick any pin or any dimension, follow th  Two focused `claude -p` calls per datasheet: -1. **Symbol pass** — pinout tables, pin types, Adom logical groups (POWER / I2C / GPIO / etc.), per-pin page provenance.-2. **Footprint pass** — package outline, recommended land pattern, body + lead dimensions, per-dimension page provenance.+1. **Symbol pass**: pinout tables, pin types, Adom logical groups (POWER / I2C / GPIO / etc.), per-pin page provenance.+2. **Footprint pass**: package outline, recommended land pattern, body + lead dimensions, per-dimension page provenance. -Each pass has its own JSON schema and its own validator. Failures retry once with the validation error fed back to the model. Symbol-pass receives the canonical pin-name → pin-number map for the footprint pass so the two outputs cannot disagree with themselves.+Each pass has its own JSON schema and its own validator. Failures retry once with the validation error fed back to the model. Symbol-pass receives the canonical pin-name to pin-number map for the footprint pass so the two outputs cannot disagree with themselves.  After Claude finishes, ds2sf normalizes the package name against the **service-kicad standard library** (`Package_SO`, `Package_QFP`, `Package_DFN_QFN`, `Package_LQFP`, `Package_TO_SOT_SMD`, `Package_DIP`, …). When the package matches, downstream tools just pull the `.kicad_mod` from there. When it doesn't (custom OLGA packages, modules, optical sensors), `bodyDimensions` + `leadDimensions` carry the datasheet-extracted values and `kicad_baseline` is `null`. @@ -121,10 +121,10 @@ Every invocation writes `<MPN>-extraction.result.json` and exits with one of thr  `hints[]` is a tagged-union list: -- `try_alternate_pdf` — `{reason, candidates: PathBuf[]}`. ds2sf already ranked the chip-dir's other PDFs; pick the first one not yet tried.-- `update_upstream_metadata` — `{file, key, current, extracted}`. e.g. `info.json`'s `package` disagrees with the datasheet; patch it and re-run.-- `use_datasheet_extracted_footprint` — `{package}`. Custom package; downstream footprint authoring should use the captured dimensions.-- `human_review` — `{reason, notes}`. Engineering nuance the schematic designer should see.+- `try_alternate_pdf`: `{reason, candidates: PathBuf[]}`. ds2sf already ranked the chip-dir's other PDFs; pick the first one not yet tried.+- `update_upstream_metadata`: `{file, key, current, extracted}`. e.g. `info.json`'s `package` disagrees with the datasheet; patch it and re-run.+- `use_datasheet_extracted_footprint`: `{package}`. Custom package; downstream footprint authoring should use the captured dimensions.+- `human_review`: `{reason, notes}`. Engineering nuance the schematic designer should see.  This means an upstream agent like `chip-fetcher` can call ds2sf, walk `hints[].candidates` until it gets `status: ok`, and accept the extraction without human input. @@ -189,4 +189,4 @@ Or just `./build.sh`.  - ~$0.20–0.30 per chip end-to-end - ~2–3 min wall time per chip-- Anthropic prompt cache keeps the PDF warm across the symbol→footprint calls+- Anthropic prompt cache keeps the PDF warm across the symboltofootprint calls
SKILL.md+12−12
@@ -5,7 +5,7 @@ description: Datasheet to symbol + footprint + provenance JSON, plus a live AI-d  # adom-ds2sf: datasheet to symbol + footprint + provenance -Pipeline: read a chip-fetcher chip directory, send the datasheet PDF to Claude in two focused passes (symbol → footprint), normalize the package against the service-kicad standard library, and emit four JSON files alongside the existing chip-fetcher artifacts.+Pipeline: read a chip-fetcher chip directory, send the datasheet PDF to Claude in two focused passes (symbol to footprint), normalize the package against the service-kicad standard library, and emit four JSON files alongside the existing chip-fetcher artifacts.  ## ⚠ Always Opus, never Haiku @@ -14,7 +14,7 @@ Production runs MUST use the default `--model claude-opus-4-7`. EEs rely on this ## When to use  - After `chip-fetcher` lands a chip into `~/project/chip-fetcher/library/<MPN>/`.-- When you want an Adom-grouped symbol (POWER / I2C / GPIO / etc.) — the UL bundle's `.kicad_sym` is flat and ungrouped.+- When you want an Adom-grouped symbol (POWER / I2C / GPIO / etc.): the UL bundle's `.kicad_sym` is flat and ungrouped. - When you need a downstream-ready `sym_create` input JSON. - When you need page-level provenance to deeplink the Adom user back to the datasheet PDF page each fact came from. @@ -32,7 +32,7 @@ Every verb that talks to the dashboard takes the global `--ai-thread "<name>"` f  ## Module products: pass `--pdf` explicitly -For **module products** (ESP32-WROOM, NORA, ATWINC, SARA-R5, etc.), chip-fetcher's auto-named `<MPN>.pdf` may be the internal SoC datasheet — which has the SoC's pinout, not the module's external castellated-pad pinout. The extractor will refuse to hallucinate (writes a result.json with `status: "needs_better_pdf"` and a list of candidate PDFs already on disk).+For **module products** (ESP32-WROOM, NORA, ATWINC, SARA-R5, etc.), chip-fetcher's auto-named `<MPN>.pdf` may be the internal SoC datasheet: which has the SoC's pinout, not the module's external castellated-pad pinout. The extractor will refuse to hallucinate (writes a result.json with `status: "needs_better_pdf"` and a list of candidate PDFs already on disk).  Look for the module-specific PDF in the chip-dir (`<MPN>-original.pdf`, `<MPN>-datasheethardware-guideline.pdf`, etc.) and pass it via `--pdf`: @@ -55,7 +55,7 @@ Run the full pipeline against a chip directory. | `--datasheet-url <url>` | Override the datasheet URL. | | `--source-tier <mfr\|snapmagic\|mouser\|digikey\|arrow\|cse\|lcsc\|unknown>` | Override the upstream provenance tier. | | `--out-dir <path>` | Output directory (default: chip-dir). |-| `--model <id>` | Claude model (default `claude-opus-4-7`). **Always use Opus for production EE work.** Haiku produces frequent misreads on chip data — pin-order swaps (DMG2305 GDS↔GSD), pad undercounts (ICE40UP5K saw 24 of 48), package-variant confusion (WSL2010 → WSL2512), and JTAG-letter typos (MTDO → MTD0). Concur catches these via cross-source consensus, but the right answer is to never let them happen: use Opus. Only override to a cheaper model for development testing where a follow-up Opus run is acceptable. |+| `--model <id>` | Claude model (default `claude-opus-4-7`). **Always use Opus for production EE work.** Haiku produces frequent misreads on chip data: pin-order swaps (DMG2305 GDS↔GSD), pad undercounts (ICE40UP5K saw 24 of 48), package-variant confusion (WSL2010 to WSL2512), and JTAG-letter typos (MTDO to MTD0). Concur catches these via cross-source consensus, but the right answer is to never let them happen: use Opus. Only override to a cheaper model for development testing where a follow-up Opus run is acceptable. | | `--force` | Bypass cache, re-run Claude. | | `--symbol-only` | Skip footprint pass. | | `--footprint-only` | Re-run only footprint pass against cached symbol. |@@ -72,7 +72,7 @@ Resolve a package string against service-kicad's standard library (debug aid).  ```bash ds2sf normalize "VSSOP-10"-# OK: VSSOP-10 → Package_SO:MSOP-10_3x3mm_P0.5mm (service-kicad stdlib)+# OK: VSSOP-10 to Package_SO:MSOP-10_3x3mm_P0.5mm (service-kicad stdlib) ```  ### `ds2sf inspect <CHIP-DIR>`@@ -139,7 +139,7 @@ When a chip has **no datasheet PDF** the dashboard says so and `POST /extract` r   .ds2sf-cache/                      # raw Claude responses for re-emit / debug ``` -The provenance JSON is the audit trail. Open the file, pick a pin, follow `pin_provenance[i].page` → open that page in the datasheet PDF → confirm the pin name + description are visibly there. Same for footprint dimensions via `dimension_provenance[i].page` + `figure_label`.+The provenance JSON is the audit trail. Open the file, pick a pin, follow `pin_provenance[i].page` to open that page in the datasheet PDF to confirm the pin name + description are visibly there. Same for footprint dimensions via `dimension_provenance[i].page` + `figure_label`.  --- @@ -151,7 +151,7 @@ ds2sf is built so an upstream agent (chip-fetcher, automation) can call it progr  | Exit | `status` | Meaning | Caller action | |---|---|---|---|-| 0 | `ok` | Extraction completed. `review_required[]` may still have entries — they're informational, not blocking. | Accept the outputs. |+| 0 | `ok` | Extraction completed. `review_required[]` may still have entries: they're informational, not blocking. | Accept the outputs. | | 2 | `needs_better_pdf` | Extractor refused because the supplied PDF doesn't have the right data (typically: SoC datasheet was passed for a module, or wrong package variant). | Try one of `hints[].candidates` and re-call with `--pdf <new>`. | | 3 | `unrecoverable` | Hard failure (Claude returned malformed output twice; pre-flight failure; emit error). | Surface to a human; inspect `.ds2sf-cache/`. | @@ -168,7 +168,7 @@ Always written. Stable schema (`schema_version: "1"`):   "manufacturer": "TI",   "datasheet_used": "/home/.../ADS1115IDGSR.pdf",   "datasheet_sha256": "65231e81…",-  "summary": "ADS1115IDGSR — 10 pins, package VSSOP-10 …",+  "summary": "ADS1115IDGSR: 10 pins, package VSSOP-10 …",   "review_required": [ … merged from symbol + footprint passes … ],   "hints": [     { "action": "try_alternate_pdf",@@ -199,9 +199,9 @@ Always written. Stable schema (`schema_version: "1"`):  | Reason | When | Caller action | |---|---|---|-| `module_external_pinout_missing` | Empty pins[] returned because the supplied PDF was a SoC datasheet for a module product. | `hints[].try_alternate_pdf` → re-call with one of the candidate PDFs. |-| `package_mismatch_in_hint` | info.json's `package` disagrees with the datasheet's actual package. | `hints[].update_upstream_metadata` → patch info.json's `package` to match `extracted`, then accept. |-| `non_standard_package_no_kicad_baseline` | The package isn't in service-kicad's stdlib (custom OLGA, modules, optical). | `hints[].use_datasheet_extracted_footprint` → use `<MPN>-footprint.extracted.json`'s `bodyDimensions` + `leadDimensions` directly. |+| `module_external_pinout_missing` | Empty pins[] returned because the supplied PDF was a SoC datasheet for a module product. | `hints[].try_alternate_pdf` to re-call with one of the candidate PDFs. |+| `package_mismatch_in_hint` | info.json's `package` disagrees with the datasheet's actual package. | `hints[].update_upstream_metadata` to patch info.json's `package` to match `extracted`, then accept. |+| `non_standard_package_no_kicad_baseline` | The package isn't in service-kicad's stdlib (custom OLGA, modules, optical). | `hints[].use_datasheet_extracted_footprint` to use `<MPN>-footprint.extracted.json`'s `bodyDimensions` + `leadDimensions` directly. | | `muxed_pin_protocol_select` | Some pins (e.g. SDA/MOSI) are protocol-multiplexed. | Informational. Pin descriptions in provenance explain how. | | `pad_dimensions_from_example_layout` | Footprint dims came from an "Example Board Layout" rather than a formal recommended land pattern. | Informational; recommend cross-check vs IPC-7351. | | `boot_strapping_pins`, `vdd_spi_voltage_dependency`, `psram_variant_conflict`, `non_uniform_pad_pitch`, `power_supply_configuration`, `thermal_management`, `i2c_address_multidevice` | Engineering nuances Claude flagged for human review. | Surface to schematic designer. |@@ -232,7 +232,7 @@ while r.status == "needs_better_pdf" {         .flatten()         .find(|c| !tried.contains(*c));     let Some(next) = next else {-        // Out of candidates — escalate to human.+        // Out of candidates: escalate to human.         log_for_review(&r); break;     };     tried.insert(next.clone());
package.json+1−1
@@ -1,6 +1,6 @@ {   "slug": "adom-ds2sf",-  "version": "1.1.0",+  "version": "1.1.1",   "type": "app",   "description": "Datasheet to symbol + footprint + provenance JSON, with a live dashboard: pins, groups, land pattern, and the datasheet page every fact came from.",   "dependencies": {},
page.json+1−1
@@ -1,6 +1,6 @@ {   "slug": "adom-ds2sf",-  "version": "1.1.0",+  "version": "1.1.1",   "type": "app",   "description": "Datasheet to symbol + footprint + provenance JSON, with a live dashboard: pins, groups, land pattern, and the datasheet page every fact came from.",   "dependencies": {},