opencode-rs mini runs in a split footer and writes the session's transcript to the scrollback above it: the flags, piped stdin, session resolution behind the first frame, replay on resume and resize with --replay-limit, the theme quantized to the palette and mono output, SIGUSR2 theme reload, OPENCODE_SHOW_TTFD and OPENCODE_DIRECT_TRACE. The prompt, request footers, and tool output are stubs for M.2 to M.4. P-PTY scenarios in parity/scenarios/M.1 match the TS mini.
The TUI /stats poster had its own activityCalendar port and time zone
lookup. Move C.3's activity_calendar and time_zone, with the TS oracle
test, to opencode-ui and use them in both. Number formatting stays
apart: TS uses formatNumber in the CLI and statsNumber in the TUI.
Every CLI step is merged, so drop the kit-wide dead_code allowance and
the builder options nothing calls: output on confirm, text, select,
multiselect, password and spinner; the spinner timer and messages;
password mask; multiselect max_items and cursor_at; autocomplete
placeholder and initial values. Options only the prompt demo uses keep
an item-level allowance. signals::on_shutdown had no allowance left.
The TUI /pair dialog drew its code with the qrcode crate, which picks
other masks than packages/util/src/qr.ts. Move the C.9 port to
opencode-ui so both use it, and drop the qrcode dependency.
Tool calls carry locations, read display text, and images. Permission asks get
the TS titles, previews, and locations, and completed edits get full-file diffs
(ports of the patch format and jsdiff's apply). Question forms go out as
elicitations, session/load replays history, and compactions report standard
updates or markers. acp --login runs auth login in-process.
Port Effect CLI's wizard: it asks for the selected command's flags and arguments,
or for a subcommand, with Effect's select, confirm, toggle, integer, and text prompts,
prints the command line, and runs it after a confirmation by running the binary
again with it. Required arguments are not checked next to --wizard, so it can ask
for them. The prompts share the Clack kit's raw mode and key decoding.
Ports packages/cli/src/acp: JSON-RPC over stdio, sessions, catalog, prompt turns, content translation, and the private standalone server. Config options and directories are filled; tools, permission, elicitation, replay, compaction, and login are signatures with simple bodies for C.12.
main.rs now registers the prompt kit's restore step, so pair drops its
own. Also apply clippy and rustfmt to the C.8 and C.9 files, and name the
command when the service test cannot spawn opencode-rs.
Run opencode-rs against a fake TS binary and service for stop, restart,
set and pair --remote, and against the TS CLI from source in an isolated
sandbox for start, stop, restart and set in both directions.
Port the seven service subcommands and pair: stop and restart shut the
persistent terminals down first, set remote true and pair --remote turn
remote access on through the TS command, and pair prints its QR code with a
port of the TS encoder. P-CLI and P-PTY scenarios compare both clients; the
runners gain a setup hook that writes files into the sandbox.
auth and mcp use the remaining prompts, so the kit drops its
unused_imports allowance and the builder type re-exports nobody names.
dead_code stays for the options C.8, C.9 and C.15 may need; the demo
binary allows its own unused imports.
Ports the six auth subcommands with their forms, OAuth, command and
key logins, and the integration picker, and the four mcp subcommands.
mcp add edits opencode.json[c] with the F.5 JSONC path edits, so
comments and formatting stay. A signal during an OAuth or command wait
cancels the attempt from the C.14 teardown.
A SIGTERM during a prompt exited through the C.14 teardown without the
prompt's raw-mode guard running, so the shell stayed in raw mode. The
prompt kit now tracks the modes each live raw guard saved, and the CLI
registers a teardown step that puts the first one back and shows the
cursor.
TS aborts each stats call after 30 seconds and reports it as an unreachable server. A unit test covers the transport mapping that packages/cli/test/stats.test.ts checks.
Ports handlers/api.ts: an OpenAPI operation ID with --param path and query values, or a raw method and path, with -d and -H. Error replies print their body and HTTP status with exit 1. P-CLI compares ten cases with TS on the fake server.
Ports handlers/stats.ts and util activity-calendar.ts: the range flags, --project ., the summary card, the detail sections, NO_COLOR, and the COLORFGBG palette. A P-ORACLE fixture compares activityCalendar and renderStats byte for byte; P-CLI and P-PTY compare the command on the fake server. P-CLI cases gain masks for values that move with the clock.
run registers a teardown step with C.14's signals module instead of
listening for Ctrl+C itself: the session is interrupted, then the process
exits with 130 as the TS run does. P-CLI cases can now send a signal once a
request reaches the fake server; sigint.cli.ts compares both clients.
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.
These commands need the server, the installer, npm and Host.resolve,
which exist only in TypeScript (Q4). opencode-rs now execs
OPENCODE_TS_BIN, else opencode on PATH, with its own arguments, so the
TS binary keeps the pid, stdio, signals and exit status. Remote access
gets enable_remote (TS service set remote true) and tunnel_hostname,
which reads the OpenTunnel XDG storage, for C.8 and C.9.
Port C.14: merge NO_PROXY with the loopback hosts, run as the SSH askpass
helper when OPENCODE_SSH_ASKPASS_PORT is set, install a log facade logger
that writes the TS key=value format to <data>/log (with trim, --log-level,
--print-logs, and OTLP log export), and bound signal-initiated shutdown to
10 s with SIGHUP as SIGTERM under a terminal.
Panics and the service connection notes now go through the same logger.
Ports packages/cli/src/commands/handlers/session/*.ts: the list with its less pager on a terminal, the export picker on stderr through the prompt kit, and the import that replaces the file's location in place. P-CLI compares 14 cases with TS on the fake server.
connect::resolve ignored why discovery missed and started a service when the
registration of another channel was starting, slow, failed or incompatible,
which put a second service next to the user's (O-21). Discovery now reports
the first pending registration, and resolve waits on it with the ensure loop,
or reports a failed or incompatible service, and starts one only when no live
service is registered.
The TUI client kept its startup URL and password, so it never reconnected
when the service restarted on a new port or password. The managed client's
transport now routes its requests to the current service and, after a
transport error or 401, finds the service again as TS's reconnect does.
Found by review carbon-4.
models, reload, debug agents and debug config bound the connection to _, which
dropped it at once and stopped a --standalone or service.disabled server
before the request ran. connect now returns the client together with a
private connection, so a caller cannot drop one without the other.
Found by review carbon-1.
Text, password, confirm, select, multiselect, autocomplete, spinner,
intro, outro, note, cancel and log, ported from @clack/prompts
1.0.0-alpha.1 with its frame diffing, wrap-ansi trimming, readline
line editing and Node key decoding, so screens match the TS commands.
A prompt whose input ends is cancelled instead of waiting forever.
The root command now hands the TUI --auto and the terminal environment (local
servers only), keeps --continue next to --session as TS does, and logs the
service start. The TUI sends --prompt to the first home or to the session
startup opens and submits it once the catalogs load, gives the first new
session the --session ID, uploads the environment before a new session's
first send, and shows 'auto' in the prompt's metadata row.
The default hook wrote panics into the alternate screen, which scrolled it out of step with the renderer and left stale cells. Write every panic to the log directory instead. A worker panic leaves the TUI running; a UI-thread panic prints a short note after opentui's hook restores the terminal and exits with 101.
The TS home with the logo, prompt slot and version footer; the reconnecting and migration overlays in place of the status row; the terminal title; server-driven tui.* events, deletion of the open session and MCP toasts; --continue, --fork, OPENCODE_ROUTE, a new session ID from --session and --model warnings; the location context with the environment upload; the location-missing and missing plugin route screens; and the exit epilogue.
Port PermissionPrompt and SessionQuestion: the inline prompt above the
session prompt, the Ctrl+F full-screen view, the rejection message for
subagent requests, and autoaccept mode from session.permissions or --auto.
models, reload, debug agents, debug config (redacted), debug heap-dump, and debug
paths, ported from the TS handlers. Reads print the server's JSON as it came, as
the Promise client returns it, so Client::json is public. Sorting follows
localeCompare. P-CLI scenarios in parity/scenarios/C.1 pass against TS; H.3's
models case now runs for Rust too.
The root command enters the directory, connects with F.6 discovery and F.9 autostart (printing "Starting background server..."), reads cli.json, and runs the TUI with -s and -c. The connection lives until the TUI ends.
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.
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.