ocd/README.md
ocd 3b1d2a4389 Scaffold ocd: config, HTTP fetch, cache, paced pipeline, render
Rust CLI with clap subcommands (pretty/raw json/raw plain/fetch/cache/config).
Per-workspace dual HTTP (Zen balance + Go limits) run with tokio::join,
500 ms workspace pacing, TTL-180s file cache, retry/backoff for transient
failures. scrape.rs holds the only OpenCode-coupled HTML selectors (placeholders
until the real Zen/Go pages are captured). Unicode blitter-block bars in
pretty mode; stable JSON/plain raw output for widgets and agent plugins.
2026-07-30 01:07:30 +03:00

1.5 KiB

ocd

Console dashboard for opencode account limits and balance.

ocd reads a config of opencode accounts and auth cookies. It scrapes the opencode Zen page for balance and the Go page for limits. It prints usage for the 5-hour, week, and month time frames, each reset time, the next update time, and remaining balance.

Install

cargo install --path .

Configure

ocd config init
$EDITOR ocd.toml
ocd config check   # lists accounts and workspaces, no network

Each account section carries default_workspace and optional extra_workspaces.

[[account]]
name              = "work"
cookie            = "${OCD_COOKIE_WORK}"
default_workspace = "ws_123"
extra_workspaces  = ["ws_456"]

${VAR} expands from the environment so cookies stay out of the file.

Run

ocd pretty            # default terminal output
ocd raw json          # one JSON object for widgets and agent plugins
ocd raw plain         # TSV-ish lines for shell and awk
ocd fetch             # update cache, print nothing; for cron
ocd cache ls | clear
ocd -a work -w ws_456 pretty   # one account, one workspace

Politeness

Per workspace two requests run at once (Zen, Go). The walk paces 500 ms between workspaces. Cache TTL defaults to 180 s. Use --force-refresh to bypass.

Status

This is a scaffold. The HTTP, cache, pacing, and render pipeline work. The opencode HTML selectors in src/scrape.rs are placeholders until the real Zen and Go pages are captured. See DESIGN.md.