Cargo
$ cargo Official Low RiskThe standard build system, dependency resolver, test runner, and publisher for Rust crates. Exposes rich JSON workspace graphs via cargo metadata --format-version 1, machine-readable compiler diagnostics via --message-format=json, and --dry-run on publish.
brew install rust Invokes rustc, workspace manifests, and local unit tests directly; MCP cannot replace local compilation.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
First-class cargo metadata --format-version 1, --message-format=json, --color=never, --locked, and --offline flags.
cargo check --message-format=jsonemits line-by-line JSON diagnosticscargo metadatareturns canonical workspace JSON
--locked prevents unintended lockfile changes, --dry-run guards publish, and build artifacts stay isolated in target/.
cargo publish --dry-runandcargo test --lockedprotect against accidental mutations
Installed cleanly via rustup or system packages across macOS, Linux, and Windows, though full toolchain download is moderately large.
- Universal
rustuptoolchain installer across major OSes
Unifies dependency resolution, compilation, testing, benchmarking, and publishing in one deterministic CLI.
cargo checkvalidates code far faster than full release linking
Official Rust Project CLI maintained under MIT/Apache-2.0.
- First-party
rust-lang/cargorepository
Comprehensive Cargo Book at doc.rust-lang.org/cargo/ and detailed --help.
- Official Cargo Book documentation
Security, Auth & Guardrails
Builds and tests need no auth; cargo publish uses ~/.cargo/credentials.toml or CARGO_REGISTRY_TOKEN.
Dual MIT / Apache-2.0 open-source toolchain; completely free.
# Cargo (cargo) Agent Rules - Use `cargo check --message-format=json` for fast structured error feedback before full builds. - Pass `--locked` (or `--offline` in sandboxed environments) when running `cargo test`. - Never run `cargo publish` without explicit user confirmation (preview with `cargo publish --dry-run` first).
Agent-Ready Command Recipes
Safe Read-Only Queries
cargo metadata --format-version 1 --no-deps
Outputs complete workspace package manifests, targets, and paths in JSON.
cargo check --message-format=json --color=never
Streams structured JSON compiler errors, spans, and fix suggestions without linking binaries.
Controlled Writes & Previews
cargo test --locked --color=never
Runs the test suite while refusing to mutate Cargo.lock.
Strengths for Agents
- +
cargo check --message-format=jsongives agents exact file/line/span diagnostics and suggested fixes. - +
cargo metadata --format-version 1exposes full workspace structure cleanly. - +
--locked,--offline, andcargo publish --dry-runenforce strict reproducibility.
Caveats & Pitfalls
- ! Compile times and
target/disk usage can be heavy on large workspaces. - ! Crate
build.rsscripts execute arbitrary Rust code at compile time.