Desktop: an unknown option or a bad --control port stops the launch (#997)

The desktop app imported any argument it didn't know as a file (writing it to Recent Footage)
and dropped a missing or non-numeric --control value, starting without a control server.
parse_args now returns an error for an unknown option, a --control value that isn't a port from
1 to 65535, or a bad EFFECTCRAFT_CONTROL_PORT (checked only when --control isn't given); main
prints it and exits with status 1 before anything starts. --control=<port> works, and -- ends
the options so a file named -x can still be opened.

Tests: parse_args unit tests, and tests/args.rs runs the binary with its own settings folder
and checks the exit, the message and that nothing was written.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
RealtaNuaandClaude Opus 5.5 committed 2026-10-12 17:40:15 +07:00
1 parent bfea3d1253
commit 649ba2e8cf
3 files changed
+185 -14

No files matched your search

+3
View File
@@ -6,6 +6,9 @@ The desktop app exposes a control channel for agents, tests and the MCP bridge:
effectcraft --control 9877 # or EFFECTCRAFT_CONTROL_PORT=9877
```
The port must be a number from 1 to 65535, and `--control` overrides the variable. A bad port or an
unknown option prints an error and the app exits with status 1 before it opens a window.
- **Transport:** TCP on `127.0.0.1` only, one JSON object per line in each direction. Connections are
persistent; requests on one connection are answered in order.
- **Request:** `{"id": 1, "method": "engine.execute", "params": {...}}` (`id` is echoed back, `params`