feat(automation): headless JSON server (--serve) + Python client

Add an external automation API (issue #29 / #100 track 2): `OpenCADStudio
--serve` runs without a GUI and is driven over a line-based JSON protocol
on stdin/stdout — open / new / run / entities / save. State persists
across requests so a script or AI agent can act, observe, and act again.

`run` drives the app's existing command system rather than a separate
binding, so coverage grows with the app; synchronous commands apply now,
pick-based interactive ones come once coordinate feeding is wired. Ships
a ~100-line example ocs.py client over the same protocol — no FFI to
maintain. Headless works because the app already constructs and dispatches
GUI-less in tests.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-17 21:05:12 +03:00
1 parent 9cb11e77d2
commit 7f10b69e3c
6 files changed
+341

No files matched your search

+7
View File
@@ -39,6 +39,13 @@ fn main() -> iced::Result {
}
#[cfg(not(target_arch = "wasm32"))]
{
// Headless automation server — drive the app over JSON on stdin/stdout
// with no GUI (issue #29). `--serve` is the opt-in; everything else
// launches the editor.
if std::env::args().skip(1).any(|a| a == "--serve") {
app::serve();
return Ok(());
}
app::run()
}
}