# adom-kicad-library-importer

Rust CLI that takes zip files containing KiCad libraries (from SamacSys, SnapEDA, Ultra Librarian, etc.) and installs them into a local KiCad 9 installation via adom-desktop.

Runs inside the Adom Docker container, sends files and commands to the user's Windows desktop through the adom-desktop relay.

## What it does

- **Extracts** zip files and auto-detects KiCad files (`.kicad_sym`, `.kicad_mod`, `.step`, `.wrl`)
- **Converts** legacy KiCad 4/5 footprint format to KiCad 9 (module→footprint, stroke syntax, arc conversion, quoted layers)
- **Patches** symbol footprint references to include library prefix (`Name` → `Library:Name`)
- **Patches** 3D model paths in footprints to absolute quoted paths
- **Installs** symbols, footprints, and 3D models to a user-specified Windows directory
- **Registers** libraries in KiCad's `sym-lib-table` and `fp-lib-table`
- **Verifies** installation with 8 automated checks (lib-table entries, files on disk, linkages)

## Commands

```
install <ZIP_FILE>     Extract and install all KiCad libraries
  --library-name       Library name in KiCad (default: zip filename)
  --library-path       Windows path for footprints/3D models
  --kicad-version      Target KiCad version [default: 9.0]
  --dry-run            Show what would be installed
  --skip-lint          Skip pre-flight validation

uninstall <NAME>       Remove library files and lib-table entries
  --library-path       Windows path where library was installed

list <ZIP_FILE>        Show zip contents without installing

status                 Check adom-desktop connection and KiCad versions

verify <NAME>          Run 8-point verification on an installed library
  --library-path       Windows path where library was installed
```

## Example

```bash
adom-kicad-library-importer install LIB_LAN9370-I_KCX.zip \
  --library-name "LAN9370" \
  --library-path 'C:\Users\noah\KiCAD Libraries\hydrogen-library'
```

Installs:
- `hydrogen-library\LAN9370.kicad_sym` (symbol + sym-lib-table entry)
- `hydrogen-library\LAN9370.pretty\QFN40P800X800X90-65N.kicad_mod` (footprint + fp-lib-table entry)
- `hydrogen-library\LAN9370.3dshapes\LAN9370-I_KCX.stp` (3D model, referenced by footprint)

## Requirements

- `adom-desktop` CLI installed and relay running
- Adom Desktop app connected on Windows
- KiCad 9.0 installed on Windows

## Source

- GitHub: [adom-inc/adom-kicad-library-importer](https://github.com/adom-inc/adom-kicad-library-importer) (private)
