Skip to content

Latest commit

 

History

124 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Command Code tooling

CI crates.io npm license

Everything Command Code (commandcode.ai) usage: a terminal dashboard with a built-in MCP server, and an opencode provider. One Cargo workspace shares the plan table and window math via cmduse-core; the opencode plugin is a separate TS package that registers the providers and delegates usage rendering to the cmduse CLI.

Components

Component Crate / dir Install Docs
cmduse CLI cli/ (crate cmd-usage, bin cmduse) crates.io · brew cli/README.md · man page
Shared core core/ (crate cmduse-core) crates.io docs.rs/cmduse-core · versioned on its own 1.x line, not as a pair with the CLI
opencode plugin opencode/ (@jeffreyjyz/opencode-command-code) npm opencode/src/index.ts

Install the CLI

brew install JeffreyJYZ/tap/cmduse     # macOS (Homebrew)
cargo install cmd-usage                # any platform with Rust

Then run cmduse for the live dashboard, or cmduse plans / cmduse models. Full usage, config, and statusline docs live in cli/README.md.

Build

cargo build                      # all Rust crates
cargo test                       # core + cli (host tests)
cargo fmt --all -- --check       # formatting (CI gate)
cargo clippy --all-targets -- -D warnings
cargo package -p cmduse-core --allow-dirty   # ships plans.json+gating.json
cd opencode && bun install && bun test       # conformance vectors too
bun run extract                              # regen core/gating.json (needs CLI)

Shared truth lives in core/: plans.json (plan table/caps), gating.json (model categories + per-plan access), conformance.json (behavior vectors). core/build.rs bakes plans/gating into Rust consts; the opencode plugin's model-gating layer imports gating.json and asserts the gating subset of the vectors (usage/window math is the Rust core's alone since plugin 0.2.0).

opencode plugin

Providers (command-code-anthropic, command-code-openai), a live gated model list, /usage (TUI slash command, alias /cmd-usage), and the cmd_usage tool — for both opencode v1 (≥1.18.29) and v2 (≥2.0.0) from one package.

Requires the cmduse CLI (usage windows/pace rendering live in the Rust core — the plugin spawns it):

brew install JeffreyJYZ/tap/cmduse

Install (opencode v2 uses plugins; v1's singular plugin is auto-normalized):

{
  "plugins": ["@jeffreyjyz/opencode-command-code"]
}

Auth, in host order: opencode's own connection — /connect and pick "Command Code" (or the CMD_API_KEY env method) — then our fallback ~/.commandcode/auth.json from cmd login. With no credential at all the providers stay activation: "auto", so a later /connect lights them up without a restart.

MCP server

cmduse mcp runs an MCP stdio server (hand-rolled JSON-RPC, no extra deps) exposing five tools: usage (dashboard), plans (comparison table), models (live gated list), daily, and hourly — the same output the CLI subcommands print, with auth and ~/.commandcode/auth.json shared.

Zed (~/.config/zed/settings.json):

{
  "context_servers": {
    "cmduse": { "source": "custom", "command": "cmduse", "args": ["mcp"] }
  }
}

Any other MCP host: run cmduse mcp as a stdio server. The opencode plugin doesn't need it — it registers its own providers and spawns cmduse directly.

Why the split

0.1.x duplicated pure logic across two Rust crates (e.g. the burn-rate pace gate was patched in two files for one bug). The workspace moves all shared math into core/; cli/ keeps only its presentation + I/O. The Zed extension (deprecated 0.6.9) was replaced by the built-in MCP server — one integration serves every MCP-capable host instead of one hand-maintained WASM product per editor.

License

MIT — see cli/LICENSE-MIT, core/LICENSE-MIT, and opencode/LICENSE.

About

Zed extension and cmduse CLI for live Command Code usage: plan, credits, 5-hour and weekly windows, per-window elapsed, billing period stats. Rust, no bloat.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages