The TUI and UI integration tests moved under tests/all; comments and step docs name the new paths, and docs/H.2.md and AGENTS.md give the --test all commands.
2.9 KiB
cli-rs
The Rust client, opencode-rs, on opentui-rust. The plan and decisions live outside this repository, in
/home/simon/src/opendocs/oc-rust/plan.md and decisions.md. The root AGENTS.md applies too.
Running cargo
- Cargo reads
.cargo/config.tomlfrom the current directory, not from--manifest-path, andcargo -Cis unstable. Without that configopentui-sysfails with "set OPENTUI_LIB_DIR". Run cargo through the package script, which runs in this directory:bun run --cwd packages/cli-rs cargo check -p opencode-api. script/opentui-lib.sh(orbun run --cwd packages/cli-rs opentui-lib) fills~/.cache/opencode-rs/opentui/<platform>with native artifacts whoseopentui.hmatches opentui-rust's bindings. Rerun it when the build fails with the header hash message. A shellOPENTUI_LIB_DIRwins over the config.- opentui is a path dependency on the local opentui-rust checkout, linked statically. A change on
opentui-rust
mainshows up in the next build, with no lock change.
Checks
Fast checks only, scoped with -p to the crates a step touches: cargo fmt --check, cargo check,
cargo clippy --all-targets -- -D warnings, and cargo test. Add one targeted parity scenario and single
TypeScript test files. No root bun run check, no full Bun suites, no opentui-rust test.sh, no
OpenTUI suites, no benchmarks. Put timeout on anything that could hang.
The integration tests of opencode-tui and opencode-ui link the static OpenTUI set, so each crate
has one test binary, tests/all/main.rs, with one module per area and the shared helpers under
tests/all/support. Add a new test file there as a module, not as a new tests/*.rs. Run one area
with cargo test -p opencode-tui --test all <module>::, the unit tests with --lib.
Ownership
- Each step owns the files plan 8.4 lists.
lib.rsofapi,local,service,store, anduialready declares every module, each a stub file naming its step; fill your stubs and leave other steps' files alone. - Third-party crates are declared once in the root
[workspace.dependencies]. A crate takes one withname.workspace = true.Cargo.lock, crate[dependencies], andbun.lockare shared and resolved by rebase.
Rules
- Deviations from the TypeScript client go in
parity/deviations/<row>-<slug>.md: the TypeScript behavior, the Rust behavior, and the reason. A difference without a file is a failure. - opentui-rust handles are not
Send. Network work runs on tokio throughApp::spawn; never block the UI thread. - Every queue between tasks and the UI is bounded.
- Where the TypeScript TUI uses
flexGrow, usegrow().basis(Length::Auto): opentui-rust'sgrow()alone sets basis 0, which lays out differently. - Generated files are committed; regenerate with
bun run --cwd packages/cli-rs generate, which runs everyscript/gen/*.ts. Parity fixtures regenerate withbun run --cwd packages/cli-rs fixtures.