Port of handlers/run.ts, run/run.ts and run/noninteractive.ts: text and
--format json output, permissions and forms auto-rejected (or approved
with --auto), -f attachments typed by the mime-types table, stdin and
words after --, -w worktrees, titles and archived sessions. Events and
messages stay JSON so JSON lines pass server fields through unchanged.
P-CLI scenarios in parity/scenarios/C.10 compare it with the TS run.
The Rust client implements the TUI with experimental new-designs on, and only that. Built-in themes are generated with the new-designs parse, opencode2 is a built-in listed first, custom V1 themes take migrateV1NewDesigns, and agent accents use categorical step 400. ThemeState::set_new_designs and the legacy V1 migration are gone; the U.1 oracle records the new-designs views only.
script/gen/grammars.ts writes assets/queries from parsers-config.ts and @opentui/core's bundled queries. It reads Core's query cache first, as Core does, and applies Core's #lua-match? rewrite, so the files hold what Core compiles.
carbon-1: a union member that is itself a union with several tags joins the
outer tag, so SessionLogItem routes log.synced to LogSynced and its tag()
delegates to the inner enum.
carbon-2: Schema.NonEmptyArray(T) is Vec<T>, so form fields and tool
content are typed (FormField, ToolContent).
carbon-3: Ref_1 twins that Rust decodes the same as Ref share its type
(FormInfo, ShellInfo, FormAnswer, the inbox payloads, message parts).
carbon-4: untagged unions get a generated Deserialize that skips a member
whose required literal field holds another value, so an LSP server entry
with disabled: false keeps its command.
carbon-5: generated errors implement TaggedError, and DeclaredError::decode
checks the tag.
Call sites in crates/store and crates/ui follow the renamed types.
The generator read httpApiStatus only through resolveAt, so the 50 endpoints whose
no-content success keeps 204 on its context annotations expected 200, as
resolveHttpApiStatus in httpapi-codegen does not. Every such call (reload, session
remove, permission reply, model switch) failed against a real server with
UnexpectedStatus 204. Tests that answered those calls with 200 now answer 204.
parity/oracle/F.5-config.ts drives the real jsonc-parser, Effect
decoder, Config layer, migration, model.json repository, storage, and
JSONL parsers. config_interop.rs compares 293 JSONC cases, 46 decode
and 20 resolve cases, the V1 migration, and byte-equal files over
seven cli.json scenarios with TS-only, Rust-only, and alternating
clients; TS also waits on the Rust locks. Fixes the array removal edge
the corpus found and records the remaining edge cases as deviations.
A byte-exact port of the jsonc-parser 3.3.1 scanner, tree, modify, and
formatter that cli.json edits and the V1 migration use, plus the JS
number format of JSON.stringify. script/gen/config.ts generates the
keybind names and the V1 command map.
Records decoded into BTreeMap, which sorts keys. The TUI prints tool inputs in wire order (primitiveInputSummary, the fallback JSON title), so records are now IndexMap; serde_json already preserves order.
script/gen/themes.ts writes every built-in theme as the V2 document the TypeScript TUI resolves: V1 themes migrated by both migrations (current and new-designs), plus opencode and opencode2. The Rust resolver starts from the same documents.
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.