Public command

daemon

Runs the local KiCad Cruncher plugin daemon and no-build browser tool center.

Usage

kicad-cruncher daemon
kicad-cruncher daemon --host 127.0.0.1 --port 8765
kicad-cruncher daemon --host 0.0.0.0 --allow-remote-host
kicad-cruncher daemon --health

Arguments

--host defaults to 127.0.0.1. Non-loopback hosts are rejected unless --allow-remote-host is supplied. --port defaults to 8765. --reload enables uvicorn reload for local development. --health prints the shared health payload and exits without starting a server.

Output

The running daemon exposes /health, /version, /api/v1/commands, /api/v1/kicad/session, /api/v1/pcb/layer-cleanup, and the initial browser tool center at /. On startup it writes a local kicad_cruncher.daemon.state.a0 JSON file containing the loopback URL that installed plugins can discover; KICAD_CRUNCHER_DAEMON_STATE overrides the state-file path for tests and custom installs. The tool center uses a Lib Cruncher-style compact tabbed shell with PCB Clean as the first active tab.

Adapters

/api/v1/pcb/layer-cleanup delegates to the shared PCB clean logic. mode=file may perform explicit direct-file apply for automation. mode=kicad-ipc returns a mutation request for the KiCad plugin to apply through KiCad IPC under the editor commit/undo model; the daemon does not mutate live KiCad editor state itself.

Roadmap

The daemon roadmap is tracked in active requirements under docs/plugin/requirements/. Production-ready live KiCad workflow status still requires manual validation of daemon web-UI direct-file apply on copied boards, live editor apply through the installed plugin and daemon mutation request path, packaged daemon auto-start on a normal workstation install, and future footprint-local HLR preview/apply flows with fixture-backed daemon request tests. These are deferred obligations; the current release-facing contract is the implemented PCB Clean planner, file apply path, plugin mutation request shape, and mocked KiCad IPC adapter coverage.

Tests

L0 verifies command registration, help, and host policy. L3 exercises startup state writing with an injected server runner, command inventory, plugin daemon-state discovery, plugin-mode PCB clean mutation planning, mocked KiCad IPC apply-adapter behavior, and daemon file-mode apply against public fixtures. L99 verifies package-wide Ruff and Pyright.