# KiCad Library Manager

**Organize your personal KiCad libraries fast.** Probe your machine, then work across three
priority views with inline editing, live previews, and one-click sync back to disk.

![KiCad Library Manager](docs/shot.png)

## What it is

A Hydrogen webview app that reads your **own** KiCad libraries (via the adom-desktop bridge),
lets you reorganize and edit them, and writes the changes back — with reversible backups the
whole way. It doesn't scrape vendors or invent CAD; it manages what you already have (plus
optional one-click adds from the Adom wiki).

## Three views

- **Symbol priority** — grouped by symbol library. Every field is inline-editable: symbol name,
  reference letter, the linked footprint (with **autocomplete** ranked by package/ref family),
  datasheet (a small icon — green when it's a real link), the **LCSC / JLC part number**
  (hover it for **live JLCPCB stock + price breaks**), and a description (expandable editor).
- **Footprint priority** — grouped by `.pretty`. Shows each footprint's 3D model and the number
  of symbols using it (click to expand the list).
- **3D-model priority** — grouped by folder, with the footprints that reference each model.

## Highlights

- **Probe** finds your `sym-lib-table` / `fp-lib-table` and personal libraries automatically.
- **Previews** — click 🔍 to see the symbol + its linked footprint rendered by KiCad's own
  `kicad-cli` (themed for a dark canvas, pad numbers on top), or a footprint with its **3D model**
  in an interactive viewer; standalone 3D-model previews too.
- **Add / duplicate** — pull a part (symbol + footprint + 3D) from the Adom wiki, add a blank
  symbol/footprint, or duplicate a symbol.
- **Flags + undo** — delete flags a row **red**, new items show **green**; nothing touches disk
  until you **Sync**. Full undo/redo tree (Ctrl+Z / Ctrl+Shift+Z) and revert-to-backup.
- **Flags** for libraries not registered in your lib-table and footprints that come from a KiCad
  default (stock) library.
- **Sync** — write edits/adds/deletes to disk with `.klm.bak` backups and a reversible
  `.klm-trash/`, per-library or all at once; a chip shows `N new · N deleted · N changed`.

## Running

```bash
kicad-library-manager serve     # start the server on :7823
kicad-library-manager app       # open it as a Hydrogen webview tab  (alias: klm)
```

## Requirements

- **adom-desktop** bridge (to reach your filesystem + shell).
- **kicad-cli** (KiCad 9) on the desktop for symbol/footprint previews.
- **step2glb** + the JLCPCB search service for 3D model conversion and live stock/price
  (the app degrades gracefully if they're unavailable).

Pure-Node HTTP server, zero native deps, single-file vanilla-JS SPA.
