← Commit history

Sub-readme: KiCad wishlist, automation without the foreground

John Lauer ·0d703a4bf2 ·3d ago ·parent 22ffdca
2 files changed +137
README.md+1
@@ -56,6 +56,7 @@ How the dock card, the dashboard and this demo fit together: [docs/dashboard.md] | [Native silkscreen text](docs/native-silk-text.md), [graphics](docs/native-silk-graphics.md) and [fields](docs/native-silk-fields.md) | The stable-ID silk batch verbs, what each refuses, and what KiCad 10.0.5 will not do over IPC. | | [Linked view refresh](docs/linked-view-refresh.md) | `kicad_refresh_board_views`: refreshing one PCB editor and its bound 3D viewer in the background. | | [Astra's working notes](docs/CODEX-ASTRA.md) | How the AI Flow thread contributes to this bridge: preflight, branch PRs, acceptance. The three `*-astra-prompt.md` files beside it are the prompts used for the ESC demo runs. |+| [KiCad wishlist: automation without the foreground](docs/kicad-wishlist.md) | Every place the bridge needs UI automation, real input or the foreground because KiCad has no API for it, ranked worst first, with the feature request that would fix each. | | [Your wiki page as a KiCad PCM repository](docs/pcm.md) | The page serves `repository.json`, `packages.json` and the zips anonymously, so it is a Plugin and Content Manager repository as-is: the sample library package, the packer, adding the repository in KiCad or with `kicad_pcm_add_repository`, and updates through PCM's Update button or `kicad_pcm_install {update:true}`. |  ## Live routing (from 0.9.340)
docs/kicad-wishlist.mdadded+136
@@ -0,0 +1,136 @@+# KiCad wishlist: automation without the foreground++The KiCad Bridge drives KiCad on the user's own Windows desktop while they keep working. KiCad offers no first-class way to do some of that in the background, so the bridge falls back to UI automation, posted keystrokes, real mouse input or the foreground. This page lists every such place, ranked worst first, with the KiCad feature that would remove each workaround. It is written to be posted to the KiCad forum as feature requests.++Measured on KiCad 10.0.5, Windows 11, October 2026.++We drive KiCad 10.0.5 on Windows from an AI agent: opening boards and editors, editing through the IPC API, taking screenshots and recording demos. The agent runs while the user keeps working, so every time KiCad needs the foreground or real input, the user loses their screen. Below is every place we have to fall back to UI automation, posted keystrokes, real mouse input or the foreground, ranked worst first, with the feature that would remove each workaround.++Severity: **real input** (the foreground and the user's mouse are taken), **KiCad takes the foreground** (we can only push it back afterwards), **UI automation** (posted window messages or UI Automation because no API exists), **API gap** (no foreground needed, but we must edit files or restart).++### 1. Clicking anything that has no command behind it (real input)+- **Want:** Press a canvas control or a toolbar button that is not in a menu, for example a toggle in the 3D viewer's toolbar.+- **KiCad today:** Nothing. Posted `WM_LBUTTONDOWN`/`UP` messages to the window are often ignored by the wx canvas.+- **Workaround:** Real mouse input with `SendInput`: KiCad must be the foreground window and the user's cursor moves. The user loses their screen for a few seconds.+- **Ask:** Every `TOOL_ACTION` invocable by name through the IPC API, aimed at a specific frame, so no action ever needs a click.++### 2. Opening the Footprint Editor when no PCB Editor is open (real input)+- **Want:** Open the Footprint Editor, optionally at `Library:Footprint`.+- **KiCad today:** No CLI argument and no API. The editor is launched from a host frame's menu (the PCB Editor or the Project Manager).+- **Workaround:** Fire the host frame's menu item, then UI Automation on the launcher. When neither works, the last resort is a real click on the launcher button, which needs the foreground.+- **Ask:** A command line argument and an IPC call that open the Symbol or Footprint Editor at a given library item.++### 3. Every new window activates itself (KiCad takes the foreground)+- **Want:** Open a board, a schematic, an editor or the 3D viewer without disturbing what the user is doing.+- **KiCad today:** Starting `pcbnew.exe` / `eeschema.exe` with `SW_SHOWNOACTIVATE` is ignored. The frame comes to the front when its document finishes loading, and again when a second frame of the same process opens.+- **Workaround:** Watch for the activation and push the window back afterwards. The user still sees it flash forward, keyboard focus moves into KiCad for a moment, and a fullscreen video in front is interrupted. In one full test run we counted about 40 of these grabs.+- **Ask:** A way to start KiCad and open documents without activating (a command line flag, an environment variable, or an IPC open-document call that never raises).++### 4. Progress dialogs are top-level and steal focus (KiCad takes the foreground)+- **Want:** Load a board or a library, or refill zones, in the background.+- **KiCad today:** `Load PCB`, `Load Schematic`, `Loading Symbol Libraries` and `Fill All Zones` are separate top-level windows that activate.+- **Workaround:** Same after-the-fact push as above, once per dialog.+- **Ask:** Progress reported through the API (or at least non-activating progress windows), and an IPC event when a load or a fill completes.++### 5. Startup dialogs that block automation (KiCad takes the foreground)+- **Want:** Start an editor on a fresh or headless machine and get straight to work.+- **KiCad today:** KiCad 10's *Welcome to KiCad* setup wizard appears in every editor start until `kicad.json` has `system.first_run_shown: true`, and cancelling it does not set that flag. On a machine without a usable GPU, *Could not use OpenGL, falling back to software rendering* appears at every start.+- **Workaround:** Find each dialog and press its button (`BM_CLICK`), or edit `kicad.json` before launch while no KiCad is running.+- **Ask:** Cancelling the wizard should count as answered, and a documented headless or automation flag that suppresses first-run and informational dialogs.++### 6. Save, lock and recovery prompts block closing (KiCad takes the foreground)+- **Want:** Close an editor the automation opened, or reopen a file.+- **KiCad today:** *Save changes?*, file-locked and auto-save-recovery prompts are modal and are the only way to answer.+- **Workaround:** `WM_CLOSE`, then find the modal dialog and press a button. A force kill loses unsaved work and leaves stale `.lck` files behind.+- **Ask:** An IPC call to close a document or frame with an explicit choice (save, discard, cancel), and to report which documents have unsaved changes.++### 7. Opening the Symbol or Footprint Editor at one part (UI automation)+- **Want:** Show `Device:R` in the Symbol Editor.+- **KiCad today:** No way to pass a library item to a running editor.+- **Workaround:** Type the name into the library tree's search box with UI Automation (or `WM_SETTEXT`), post `VK_DOWN` and `VK_RETURN`, then poll the window title until it shows the part. If the tree pane is hidden, toggle it from the View menu first. On a slow machine the editor does not answer while it loads its libraries, and the attempt fails.+- **Ask:** An IPC call to load a given `Library:Item` into the Symbol or Footprint Editor.++### 8. Driving the 3D viewer (UI automation)+- **Want:** Rotate, zoom, pan, and frame one part (for example a connector) for a screenshot.+- **KiCad today:** No 3D viewer API at all.+- **Workaround:** Read the viewer's menu bar and post `WM_COMMAND` with the discovered ids (they differ between versions): Zoom, Rotate, Move Board, view presets. There is no way to set a camera pose or frame a reference designator.+- **Ask:** A 3D viewer API: set and read the camera, frame an item or a bounding box, and render a view to an image off-screen.++### 9. Any menu command (UI automation)+- **Want:** Zoom to Selection, View > Refresh, open the Plugin and Content Manager, and similar.+- **KiCad today:** These exist as actions but are not reachable through IPC.+- **Workaround:** Enumerate the native menu with `GetMenu`, match the label (labels vary by version and language), post `WM_COMMAND` to the right frame.+- **Ask:** Run any action by name through IPC (the same ask as the first entry).++### 10. Libraries added while KiCad runs (UI automation)+- **Want:** Install a library, then open one of its parts.+- **KiCad today:** A running KiCad never re-reads `sym-lib-table` or `fp-lib-table`. The only refresh is the user pressing OK in Manage Libraries, or a restart.+- **Workaround:** Fire the library tree's refresh through the menu, or close and restart KiCad, which loses the user's window state unless it is saved and restored by hand.+- **Ask:** An IPC call to reload the library tables (and the library tree) in a running KiCad.++### 11. Plugin and Content Manager (UI automation)+- **Want:** Add a repository and install or update a package.+- **KiCad today:** No CLI and no API. Repositories are read from `kicad.json` only at start.+- **Workaround:** Write `pcm.repositories` into `kicad.json`, extract packages into the third-party folder and edit `installed_packages.json` by hand, then ask the user to restart. The PCM dialog itself can only be opened through the menu.+- **Ask:** PCM commands in `kicad-cli` and the IPC API: list, add repository, install, update, remove, with an event when the library tables change.++### 12. Settings that KiCad overwrites on exit (UI automation)+- **Want:** Turn on the IPC API server, or change 3D viewer model visibility.+- **KiCad today:** Only through the preferences dialogs, or by editing the JSON files.+- **Workaround:** Edit `kicad_common.json` or `3d_viewer.json` while no KiCad is running, because a running KiCad writes its in-memory settings back on exit.+- **Ask:** Read and write settings through the API, applied live.++### 13. Footprint reference and value fields (API gap)+- **Want:** Move or resize a footprint's reference text.+- **KiCad today:** `UpdateItems` on a `PCB_FIELD_T` answers `ISC_INVALID_TYPE` on 10.0.5.+- **Workaround:** Close the editor, edit the saved board file, reopen it.+- **Ask:** Field updates through `UpdateItems`.++### 14. 3D model binding per footprint (API gap)+- **Want:** Change a footprint's model path, offset, rotation or scale.+- **KiCad today:** The footprint messages do not expose the model list.+- **Workaround:** File edits only.+- **Ask:** Read and write a footprint's 3D models through the API.++### 15. Zone refill (API gap)+- **Want:** Refill specific zones and know when it is done.+- **KiCad today:** `RefillZones` with a list of zone ids answers `AS_UNIMPLEMENTED`; an empty list (all zones) works but runs asynchronously with no completion signal.+- **Workaround:** Poll the board until its serialized form stops changing.+- **Ask:** Refill by id, and a completion event or a revision that changes only when the fill lands.++### 16. DRC on the live board (API gap)+- **Want:** Check a proposed edit before committing it.+- **KiCad today:** No DRC over IPC.+- **Workaround:** Serialize the board, run `kicad-cli pcb drc` on a copy. The report stops at about 199 markers per violation type (499 for clearance), so large boards come back incomplete.+- **Ask:** DRC through the API on the live board, with complete results.++### 17. One API server for several editors (API gap)+- **Want:** Work with two boards open at once.+- **KiCad today:** One IPC server per machine; with two PCB Editors open, calls reach only one of them.+- **Workaround:** Detect the mismatch and refuse, or close the other editor.+- **Ask:** Address a specific document or frame in every IPC call.++### 18. Schematics (API gap)+- **Want:** Edit a schematic live.+- **KiCad today:** The IPC API covers the board editor; the schematic editor has none.+- **Workaround:** Edit the `.kicad_sch` file, run ERC with `kicad-cli`, and reload.+- **Ask:** Schematic coverage in the IPC API.++### Recording in the background+Recording KiCad in the background mostly works today. Windows Graphics Capture records a KiCad window that is covered by other windows, including the PCB canvas and the 3D viewer, so demo videos do not need KiCad in front. Three things break it:+- A minimized window does not paint, so it records nothing.+- On a machine with no GPU, the 3D viewer shows "Your OpenGL version is not supported" over a black canvas unless a software OpenGL is installed.+- Every entry above that needs the foreground or real input interrupts the recording and the user at the same moment.++So the problem is less about capture than about KiCad taking the foreground and needing real input. The first three asks below would let an automated KiCad session run, and be recorded, without the user ever seeing it.++### The short version+1. Start KiCad and open documents without activating any window, and make progress dialogs non-activating.+2. Run any action by name through the IPC API, aimed at a specific frame.+3. A 3D viewer API: camera pose, frame an item, render off-screen.+4. Open the Symbol or Footprint Editor at a Library:Item from the command line and the API.+5. Reload library tables, and drive the Plugin and Content Manager, from the CLI and the API.+6. Close documents with an explicit save, discard or cancel choice; report unsaved changes; suppress first-run and informational dialogs in automation.+7. Fill the gaps in the board API: field updates, 3D model binding, refill by zone id with a completion event, live DRC with complete results, per-document addressing.+8. Schematic coverage in the IPC API.+