opencode/packages/cli-rs/Cargo.toml

192 lines
8.5 KiB
TOML

[workspace]
members = ["crates/*"]
resolver = "3"
[workspace.package]
version = "0.1.0"
edition = "2024"
license = "MIT"
publish = false
[workspace.lints.rust]
unsafe_code = "deny"
# From Anomaly's shared Rust lint set, the ones the client already has no findings for, so it keeps none.
unsafe_op_in_unsafe_fn = "deny"
unused_must_use = "deny"
[workspace.lints.clippy]
await_holding_lock = "deny"
await_holding_refcell_ref = "deny"
dbg_macro = "deny"
todo = "warn"
# Every `unsafe` block states the invariant that makes it sound in a `// SAFETY:` comment.
undocumented_unsafe_blocks = "deny"
[workspace.dependencies]
opencode-acp = { path = "crates/acp" }
opencode-api = { path = "crates/api" }
opencode-api-types = { path = "crates/api-types" }
opencode-drive = { path = "crates/drive" }
opencode-latex = { path = "crates/latex" }
opencode-local = { path = "crates/local" }
opencode-mermaid = { path = "crates/mermaid" }
opencode-mini = { path = "crates/mini" }
opencode-parity = { path = "crates/parity" }
# Without their default features: `ts` (TypeScript TUI plugins on the JS host) is chosen by opencode-cli, so a build
# without it has no JS host anywhere (ts-feature).
opencode-plugin = { path = "crates/plugin", default-features = false }
opencode-plugin-abi = { path = "crates/plugin-abi", features = ["host"] }
opencode-service = { path = "crates/service" }
opencode-store = { path = "crates/store" }
opencode-tui = { path = "crates/tui", default-features = false }
opencode-ui = { path = "crates/ui" }
opencode-util = { path = "crates/util" }
# OpenTUI's Rust crates (`packages/rust` of anomalyco/opentui), pinned exactly to a release on crates.io. The crate
# has no native library: script/opentui-native.ts installs the release's, checked against its table; see README.md.
opentui = { version = "=0.9.9", features = ["static", "tokio", "tree-sitter"] }
# Expected third-party crates, declared once so steps rarely edit manifests. A crate takes one with
# `name.workspace = true` and adds features with `features = [...]`.
base64 = "0.23"
bytes = "1"
futures-util = { version = "0.3", default-features = false, features = ["std", "sink"] }
# The IDNA stub: `url` rejects non-ASCII hosts instead of pulling ICU4X (deviation A10-ascii-hosts). Pinned so a
# `cargo update` cannot bring 1.2 back.
idna_adapter = "=1.0.0"
indexmap = { version = "2", features = ["serde"] }
libc = "0.2"
log = { version = "0.4", features = ["std"] }
memchr = "2"
# Luau plugins, behind opencode-plugin's default feature `luau`: Luau's VM and compiler. Values cross as
# JSON (`crates/plugin/src/luau/json.rs`), so mlua's own serde is off.
mlua = { version = "0.12", features = ["luau"] }
notify = "8"
percent-encoding = "2"
rand = "0.10"
regex = "1"
ring = "0.17"
# TLS is rustls on ring with the platform's roots, configured once in `opencode_api::transport`, for HTTP/1.1 only, as
# Bun's fetch speaks.
reqwest = { version = "0.13", default-features = false, features = ["rustls-no-provider", "json", "stream"] }
rustix = { version = "1", features = ["fs", "process"] }
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"] }
rustls-platform-verifier = "0.7"
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["preserve_order", "raw_value"] }
sha1 = "0.11"
thiserror = "2"
tokio = { version = "1.53", features = ["rt-multi-thread", "macros", "sync", "time", "io-util", "process", "fs", "net", "signal"] }
tokio-tungstenite = { version = "0.30", features = ["rustls-tls-native-roots"] }
tokio-util = "0.7"
unicode-width = "0.2"
url = "2"
# Win32 calls, for opencode-util's `win` module only (DW1); each use adds its features there.
windows-sys = "0.61"
# Tree-sitter grammars for opencode-ui's `grammars` feature (crates/ui/src/grammars), pinned to
# the WASM releases packages/tui/src/parsers-config.ts loads where crates.io has them. The five opentui bundles take
# its versions.
tree-sitter-javascript = "0.25"
tree-sitter-md = "0.5"
tree-sitter-rust = "0.24"
tree-sitter-typescript = "0.23"
tree-sitter-zig = "1.1"
tree-sitter-bash = "=0.25.0"
tree-sitter-css = "=0.25.0"
tree-sitter-diff = "=0.1.0"
tree-sitter-go = "=0.25.0"
tree-sitter-html = "=0.23.2"
tree-sitter-json = "=0.24.8"
tree-sitter-python = "=0.23.6"
tree-sitter-yaml = "=0.7.2"
tree-sitter-agda = "=1.3.3"
tree-sitter-c = "=0.24.1"
tree-sitter-c-sharp = "=0.23.1"
tree-sitter-clojure-orchard = "0.2.9"
tree-sitter-cpp = "=0.23.4"
tree-sitter-elixir = "=0.3.5"
tree-sitter-haskell = "=0.23.1"
tree-sitter-hcl = { git = "https://github.com/tree-sitter-grammars/tree-sitter-hcl", tag = "v1.2.0" }
tree-sitter-java = "=0.23.5"
tree-sitter-julia = "=0.23.1"
tree-sitter-lua = "=0.5.0"
tree-sitter-make = "=1.1.1"
tree-sitter-nix = "0.3.0"
tree-sitter-php = "=0.24.2"
tree-sitter-r = "=1.2.0"
tree-sitter-ruby = "=0.23.1"
tree-sitter-scala = "=0.24.0"
tree-sitter-toml-ng = "=0.7.0"
tree-sitter-vim = "0.4.0"
tree-sitter-vue-next = "0.1.0"
tree-sitter-xml = "=0.7.0"
# Luau 747: mlua `main`'s "Bump Luau to 0.747", whose mlua-sys takes `luau0-src` 0.24.0+luau747 from
# crates.io. mlua 0.12.2's mlua-sys pins 740's type numbers, so `luau0-src` cannot move alone. The patch goes once
# mlua 0.12.3 is on crates.io (its deprecation notes say "since 0.12.3"), which `mlua = "0.12"` takes.
[patch.crates-io]
mlua = { git = "https://github.com/mlua-rs/mlua", rev = "01b48a402fffa83c1429b4a49cfd55c6caaa5939" }
mlua-sys = { git = "https://github.com/mlua-rs/mlua", rev = "01b48a402fffa83c1429b4a49cfd55c6caaa5939" }
# A Luau 747 fork with fixes not yet upstream, their flags on by default: linear-time plain `string.find`,
# `string.split` and literal `gsub`; table built-ins and pattern matching bounded between interrupts; a collector goal
# by heap size, for the carrier to set; small allocator pages while a heap is small; single-class patterns matched
# against a byte table; `string.format` and `bit32` edge cases defined; and a build without the codegen-only libraries,
# in one parallel pass, whose release builds define `NDEBUG` (no `LUAU_ASSERT`); and hashes keyed per VM from the OS
# (SipHash-1-3 for strings of 32 bytes or more, a salted interning table, every table key's main position) with a
# linear table resize, so a plugin can't flood a hash chain. `pairs` order over a table's hash part differs between
# VMs. Each fix moves back to stock once upstream takes it; the patch goes when the fork's diff is empty. mlua-sys 0.14
# takes 0.24.1 unchanged.
luau0-src = { git = "https://github.com/simonklee/luau-src-rs", rev = "553892c79eac79091232f87218d6a94d97779f7b" }
# File and line tables only, for the workspace and its dependencies: backtraces still show file and line, and a test
# binary's debug info is small enough to pass through the linker. Full debug info with `split-debuginfo = "unpacked"`
# left 30,700 `.dwo` files (4.8 GB) in a fresh target/ and about 600 MB more per edit in `tui`, which incremental
# builds never delete. `CARGO_PROFILE_DEV_DEBUG=true` brings full debug info back for a debugger. `test` inherits this.
[profile.dev]
debug = "line-tables-only"
# Dependencies optimised a little, which the workspace's tests run on: a workspace test run took 166 s instead of 185 s,
# for 8 to 14 s more in a cold build and 3% more in target/. The workspace's own crates stay at 0, so an edit rebuilds
# as fast as before (opt-level 1 for them took an edit in tui from 5 s to 9-25 s). Full optimisation for the ones that
# do the most work in the tests: OpenTUI's Rust side, JSON, tree-sitter's runtime, and Luau's C++ (mlua-sys's build
# script compiles it, with mlua-sys's level).
[profile.dev.package."*"]
opt-level = 1
[profile.dev.package.opentui]
opt-level = 3
[profile.dev.package.serde_json]
opt-level = 3
[profile.dev.package.tree-sitter]
opt-level = 3
[profile.dev.package.mlua-sys]
opt-level = 3
# The idna_adapter stub debug-asserts that an ASCII host character is lowercase, and `idna` instantiates it.
# tower-http resolves a redirect's `Location` with `Url::join` before reqwest consults its redirect policy, so
# with `Policy::none()` a `Location` such as `https://B%C3%BCcher.example` still reaches the stub
# (A10-ascii-hosts). Every other parse goes through `js::parse_url`/`join_url` first.
[profile.dev.package.idna]
debug-assertions = false
[profile.dev.package.idna_adapter]
debug-assertions = false
[profile.release]
debug = "line-tables-only"
# The performance scenarios (`bun run perf`): release code generation, without the line tables and in more units, so
# compiling the TUI's test binary fits in 4 GB.
[profile.perf]
inherits = "release"
debug = false
codegen-units = 64
[profile.dist]
inherits = "release"
lto = "fat"
codegen-units = 1