Commit graph

14 commits

Author SHA1 Message Date
Simon Klee
ff7fa63d0d
feat(cli-rs): add the run command
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.
2026-11-04 23:46:40 +01:00
Simon Klee
f1123c4e61
refactor(cli-rs): load themes as the TUI does under new designs
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.
2026-11-04 21:55:46 +01:00
Simon Klee
d9b56c37a6
feat(cli-rs): generate the TUI's highlight queries
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.
2026-11-04 20:28:38 +01:00
Simon Klee
26cfacbbf9
fix(cli-rs): fix the API types carbon found wrong in F.2
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.
2026-11-04 19:51:14 +01:00
Simon Klee
a15b60f360
fix(cli-rs): expect 204 from no-content endpoints
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.
2026-11-04 19:17:11 +01:00
Simon Klee
d8918d4a80
test(cli-rs): prove local config files against the TypeScript client
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.
2026-11-04 18:52:53 +01:00
Simon Klee
147a0c6040
feat(cli-rs): port jsonc-parser path edits and config keybind names
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.
2026-11-04 18:52:53 +01:00
Simon Klee
7baefa3f36
fix(cli-rs): keep JSON key order in generated records
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.
2026-11-04 18:34:12 +01:00
Simon Klee
5bfa4b6c7f
feat(cli-rs): generate the 244 TUI keybind definitions
script/gen/keybinds.ts writes each name, its default as JSON text, and its description from TuiKeybind.Definitions.
2026-11-04 18:25:27 +01:00
Simon Klee
98141f92f7
feat(cli-rs): generate the built-in theme table
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.
2026-11-04 18:22:46 +01:00
Simon Klee
0f63e545d7
chore(cli-rs): format the API generator and type the oracle's fetch
Prettier over script/gen/api.ts and script/rust; the oracle's fake fetch no
longer casts to typeof fetch, so bun check passes. Output is unchanged.
2026-11-04 18:20:48 +01:00
Simon Klee
cc409d1fcf
feat(cli-rs): generate the Rust API client from ClientApi
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.
2026-11-04 18:20:48 +01:00
Simon Klee
01ab034b56
feat(cli-rs): add the command tree
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.
2026-11-04 18:19:21 +01:00
Simon Klee
ad5c8910e0
feat(cli-rs): dump the TypeScript command tree
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.
2026-11-04 18:19:21 +01:00