ocd/README.md

56 lines
1.5 KiB
Markdown
Raw Normal View History

# 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`.
```toml
[[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`.