feat(peer-cli): add JSONL peer test harness

Agents need a way to exercise multiple peers without launching the Tauri GUI.
Add `lanspread-peer-cli` as a workspace crate that starts the core peer runtime,
reads JSON commands from stdin, and writes result, event, and error records as
JSONL on stdout.

The harness supports status, peer listing, game listing, direct connect,
set-game-dir, download, install, uninstall, wait-peers, and shutdown commands.
It can seed tiny fixture archives that use a fixture unpacker, or delegate real
archives to an external `unrar` program when one is supplied.

Add a Dockerfile, `.dockerignore`, and `just` recipes for building the binary,
building the image, and running named harness containers with state and games
mounted under `target/peer-cli/`. The documentation now lists the crate and the
new test harness commands in the project map, with a crate-local README for the
JSONL protocol.

This commit depends on the non-GUI peer hooks introduced in the previous commit:
startup options, local-ready events, direct connects, snapshots, and explicit
post-download install policy. It does not add old-peer compatibility paths.

Test Plan:
- `git diff --check`
- `just fmt`
- `just clippy`
- `just test`
- `just peer-cli-build`
- Not run: `just peer-cli-image` requires a Docker daemon and base image access.

Depends-on: e711cf3454
Refs: crates/lanspread-peer-cli/README.md
This commit is contained in:
2026-05-16 18:33:18 +02:00
parent e711cf3454
commit dc9e13e6a1
11 changed files with 1032 additions and 0 deletions
+5
View File
@@ -12,6 +12,7 @@ Cargo workspace under `crates/`:
- `lanspread-db` — database/schema types (sqlx + sqlite).
- `lanspread-compat` — compatibility/migration glue between db and other crates.
- `lanspread-utils` — small shared helpers.
- `lanspread-peer-cli` — JSONL peer harness for scripted and containerized tests.
- `lanspread-tauri-deno-ts/` — frontend (Vite + Deno + TS in `src/`) and Tauri shell (`src-tauri/`). This is the GUI client.
Top-level `Cargo.toml` pins workspace dependency versions; per-crate `Cargo.toml`s set lints (pedantic clippy, `unsafe_code = forbid` on most).
@@ -24,8 +25,12 @@ Never use normal cargo ... commands, use the just ... commands instead.
- `just build` — build the GUI without bundling (also dev mode).
- `just fmt` — format the workspace.
- `just clippy` — lint the workspace.
- `just test` — run the workspace unit tests.
- `just fix` — auto-apply cargo/clippy fixes, then format.
- `just clean` — wipe the build cache.
- `just peer-cli-build` — build the scripted peer harness.
- `just peer-cli-image` — build the peer harness Docker image.
- `just peer-cli-run NAME` — run one named harness container with persistent state under `target/peer-cli/NAME/`.
## Protocol policy