An opt-in live test (OPENCODE_LIVE=1) reads through the generated client from
the service script/live.sh uses: info, sessions, messages, inbox, forms,
permissions, location collections, and the event stream. It skips
experimental.session.stats, which took the shared service down unbounded.
A P-ORACLE fixture records the requests the TypeScript Promise client builds;
the generated Rust client must build the same ones, and query::append must
match appendQuery. Unit tests cover tagged unions (known, rpc.*, unknown),
literal enums, double options, declared errors, binary bodies, auth, and
the event stream through F.3's SSE reader.
Every endpoint's location query decoded into its own struct; equal anonymous
objects and unions now share one, and the location query is LocationQueryInput.
script/gen/api.ts compiles ClientApi with the Promise client's options and emits
types and one method per endpoint (166) into crates/api/src/generated. The
request core, errors, query encoding, and the reqwest transport are written
by hand. Tagged unions decode through a generated Deserialize that keeps
unknown members and routes rpc.* events.
All 48 commands of the TypeScript CLI with clap derive, proven against the dumped Spec tree. A pre-pass and a post-parse check keep the Effect CLI behaviors scripts see: --no-<flag>, boolean literals, repeated flags, k=v values, -w without a following value, the scope of --standalone and --server, and root flags before a subcommand. Help, version, completions for six shells, exit code 1 on usage errors, and stdout that ignores EPIPE. Handlers are stubs that name their step; the root command reports that the TUI is not built yet.
script/gen/commands.ts writes the Spec tree of packages/cli/src/commands/commands.ts to crates/cli/tests/fixtures/commands.json: names, aliases, descriptions, arguments, and flags with types, bounds, and defaults. The Rust tree test compares against it.
opencode-parity loads P-COMP fixtures, compares a capture cell by cell, and reports each differing row with markers plus the fields of each differing cell. Tests cover byte-exact reformatting, an injected one-cell change, and an opentui-rust box matching the TypeScript render.
renderComponent renders a TUI component in createTestRenderer at a fixed size and theme, inside the TUI providers or bare, and writes its cells through the same native resolved-chars call opentui-rust's Capture uses. bun run fixtures now also runs parity/component scripts.
Build socket URLs as the PTY and client MCP clients do (path prefix and base query kept, URLSearchParams.set order, ws or wss), with an optional ticket parameter, and open them with handshake headers.
SharedEvents ports shared-events.ts: one upstream per subscriber set, a types filter, the latest server.connected for late subscribers, and a 4,096-event cap per subscriber. connect() ports createClientConnection: server.connected first, the 2 s connect and 45 s idle limits, resync, 1 s reconnect, and 10 ms batches with adjacent deltas merged on a bounded queue. Both are generic over an Event trait. An opt-in live test (OPENCODE_LIVE=1) reads the running service.
Port Identifier.create with session, message, and part prefixes. A P-ORACLE script records the time prefixes TypeScript mints for a call sequence, counter restarts and overflow included, and the Rust test replays it.
Port the generated TypeScript client's SSE reader: blank-line blocks, joined data lines, CRLF and CR normalization across chunks, streaming UTF-8 decoding, and the 16 MiB limit counted in UTF-16 units. Every chunk reports activity, keepalive comments included.
Add packages/cli-rs: a Cargo workspace with the 14 crates of the plan,
module stubs for api, local, service, store, and ui, and the expected
third-party crates in [workspace.dependencies]. opentui is a path
dependency on the local opentui-rust checkout, linked statically.
script/opentui-lib.sh copies native artifacts whose header matches the
bindings into ~/.cache/opencode-rs/opentui, where .cargo/config.toml
points OPENTUI_LIB_DIR. opencode-rs --version runs; script/live.sh
runs it against the elected background service.