# adom-component-fit

CLI shim that returns the rotation + offset transform needed to fit a given LCSC 3D model onto a given KiCad footprint. Distributed to the InstaPCB consumer's render pipeline so each component lands with pin-1 in the right corner regardless of EasyEDA-vs-KiCad pin-1 convention drift.

## Usage

```
adom-component-fit <Library>/<Footprint> <LCSC-code>
```

Two positional args. Same `<Library>/<Footprint>` shape consumers already pass to `step2glb from-library` / `adom-pin1-truth`.

**Output (stdout, single JSON line):**

```json
{"rot_deg":180.0,"offset_mm":[0.0,0.0,0.0]}
```

- `rot_deg` — rotation around the GLB's local Y axis (world up once placed on the PCB plane). Positive = CCW looking down at the board.
- `offset_mm` — `[x, y, z]` translation in the footprint's local frame, applied **after** the rotation.

**Unknown entry:** exit non-zero, one-line stderr message, no stdout. Caller falls back to identity (no transform).

## Exit codes

| Code | Meaning |
|------|---------|
| 0 | Real answer printed |
| 1 | (Library/Footprint, LCSC) not in the dataset |
| 2 | Bad CLI input |

## Backed by

- One CSV per library at `data/component-fit/<Library>.csv`, baked into the binary at compile time.
- New rows arrive via task files in `component-fit-tasks/`; the listener (`scripts/fit-listener.sh`, run from cron) processes them and republishes this binary.
- Source: github.com/adom-inc/adom-pin1-truth
