---
name: adom-schematic
description: "Use when the user asks to view, open, preview, or inspect a schematic or .kicad_sch sheet; to find out what a symbol/reference designator on a schematic is; to get stock, price, MPN, LCSC part, datasheet or wiki page for parts on a schematic; or to embed an interactive schematic view inside another app or web page. Also trigger for 'show me the schematic', 'what is U1', 'how much does this BOM cost', or 'make the schematic preview clickable'."
---

# adom-schematic

Interactive schematic viewer for `.kicad_sch`. The drawing is the EDA's OWN
render (authentic symbols, fonts, wire routing); an overlay parsed from the sheet
adds per-component highlighting and live part data.

## Architecture

```
adom-schematic (single Rust binary, no Node, no local KiCad)
  |
  +-- visual base      whole-sheet SVG from service-kicad
  |                    POST /kicad/sch/export/svg       (KICAD_SERVICE_API)
  |
  +-- interaction      .kicad_sch parsed in Rust -> per-component REGIONS
  |   overlay          (symbol body + one box per visible property text), used to
  |                    (a) place invisible hotspots and (b) tag every drawing
  |                    element with data-cref by bbox containment, so the
  |                    highlight acts on the symbol's real strokes
  |
  +-- enrichment       GET /enrich?mpn=&lcsc=   (async, cached)
                         adom-jlcpcb search <Cnnn>    -> stock, price, tier,
                                                         popularity, mfr, real MPN
                         adom-wiki discover search    -> wiki page, vouch count
```

## Quick start

```bash
# self-contained interactive HTML for embedding in another app
adom-schematic embed --file sheet.kicad_sch --out sheet.html

# composed interactive SVG (+ sheet.meta.json)
adom-schematic render --file sheet.kicad_sch --out sheet.svg --meta

# live app
adom-schematic serve --file sheet.kicad_sch --port 8793

# one part's data as JSON (host apps use this to serve /enrich for an embed)
adom-schematic enrich --mpn 100nF --lcsc C1525
```

## Commands

| Command | Description |
|---|---|
| `embed --file F [--out O]` | One self-contained interactive HTML file |
| `render --file F --out O [--meta]` | Composed interactive SVG, optional `<out>.meta.json` |
| `serve [--file F] [--port P]` | Live app server (default :8785) |
| `enrich [--mpn M] [--lcsc C]` | Stock / price / MPN / wiki as JSON on stdout |

## Interactions

- **Hover** a symbol -> KiCad-style selection: its own strokes (including the
  reference and value text) gain a bright halo. Colours are unchanged and the
  rest of the sheet is untouched.
- **Hover card** -> reference, value, description, footprint, LCSC, plus live
  MPN, stock, price, tier, popularity, JLCPCB link, wiki link, datasheet. It
  follows the cursor and flips at viewport edges.
- **Click** -> pins the card where it is and makes it clickable, so the links can
  be followed. On small/embedded screens (<=620px) the hover card is abridged to
  reference · MPN · stock; pinning always expands it to full detail.
- **Component list** -> every part on the sheet, hover-linked to the drawing.

## Embedding in another app

```html
<iframe src="/board-view/<slug>/sch" style="border:0;width:100%;height:100%"></iframe>
```

The embed's `fetch("enrich")` is RELATIVE, so it resolves against whoever serves
the page. Point that route at `adom-schematic enrich` and the embedded
card gets live stock and price (adom-project-manager does this); answer nothing
and it degrades to identity only.

## Environment

| Variable | Purpose |
|---|---|
| `KICAD_SERVICE_API` | service-kicad base URL |
| `JLCPCB_API` | adom-jlcpcb API endpoint |

## Notes

- KiCad today; Altium and Fusion exports are the planned next step.
- Sibling app: **adom-2dboard** (`.kicad_pcb`, with net/trace highlighting).
