mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-26 23:28:43 +00:00
Add packages/cli-rs, an OpenCode client written in Rust on OpenTUI's Rust crates. It is a client only.
2.1 KiB
2.1 KiB
cli-rs
The OpenCode native CLI (opencode-native), in Rust on OpenTUI. The root AGENTS.md applies too. User-facing names
say "native"; crates, this directory, and OPENCODE_RS_* variables say "rs".
Build
- Run cargo through the package script, for example
bun run --cwd packages/cli-rs cargo check -p opencode-api. It installs OpenTUI's native library, and cargo reads.cargo/config.tomlonly from the current directory. rust-toolchain.tomlpins the toolchain.- OpenTUI is the crates.io
opentuiat an exactversioninCargo.toml. To re-pin it, change these together: the release's rows in the sha256 table inscript/opentui-native.ts, theversion,Cargo.lock, and the directory in.cargo/config.toml. Send changes to OpenTUI's crates toanomalyco/opentui.
Checks
Before merging, the whole package must pass:
bun run cargo fmt --checkbun run cargo clippy --locked --workspace --all-targets -- -D warningsbun run cargo test --locked --workspace --no-fail-fastbun run check:driftbun run parity:machines
Each of opencode-tui and opencode-ui has one integration test binary, tests/all/main.rs, with one module per
area. Add tests as a module there, not as a new tests/*.rs. The package has no test script on purpose, because
CI would run the slow parity machines through turbo; run them with bun run parity:machines.
Rules
- Generated files are committed. Regenerate them with
bun run generateand the parity fixtures withbun run fixtures; never edit a fixture by hand.bun run check:driftfails if either is stale. - Record each deviation from the TypeScript client in
parity/deviations/. A difference without a file is a failure. - OpenTUI handles are not
Send. Run network work throughApp::spawn, and never block the UI thread. - Bound every queue between tasks and the UI.
- Where the TypeScript TUI uses
flexGrow, usegrow().basis(Length::Auto);grow()alone sets basis 0. - Declare third-party crates once in the root
[workspace.dependencies]. A change todeps-allow.txtneeds a maintainer's approval.