opencode-dashboard-client 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,43 +4,41 @@ Front end for [opencode-dashboard](https://github.com/GCS-ZHN/opencode-dashboard
4
4
  view of opencode token usage (server → project → session → model), with input / output / reasoning /
5
5
  cache tokens and cost at every level.
6
6
 
7
- The npm package ships the **built SPA** plus the **front-end server**, which is the single entry point
8
- for browsers: it serves the SPA and proxies `/api/s/{i}/*` to the configured aggregation backends.
9
- Real backends stay hidden from the client's network.
7
+ Installs as a CLI (`opencode-dashboard`): its `serve` command runs the **front-end server**, the single
8
+ entry point for browsers it serves the built SPA and proxies `/api/s/{i}/*` to the configured
9
+ aggregation backends. Real backends stay hidden from the client's network.
10
10
 
11
11
  ## Install (npm)
12
12
 
13
13
  ```bash
14
- npm install opencode-dashboard-client
14
+ npm install -g opencode-dashboard-client
15
15
  ```
16
16
 
17
- Requires Node ≥ 22 and [bun](https://bun.sh) (the front-end server runs on bun).
17
+ Requires Node ≥ 22. Works anywhere with `npx opencode-dashboard ...` too.
18
18
 
19
- ## Quick start
19
+ ## Configure
20
+
21
+ Write the config interactively to the standard XDG path
22
+ (`$XDG_CONFIG_HOME/opencode-dashboard/config.yaml`, `~/.config/...` by default):
20
23
 
21
24
  ```bash
22
- cd node_modules/opencode-dashboard-client # or wherever npm installed the package
25
+ opencode-dashboard configure
23
26
  ```
24
27
 
25
- 1. **Point it at your backends** edit `dashboard.yaml`:
26
- ```yaml
27
- servers:
28
- - name: main
29
- url: http://127.0.0.1:8791
30
- - name: backup
31
- url: http://127.0.0.1:8792
32
- ui:
33
- sessionPage: 30 # sessions loaded per page when a project is expanded
34
- ```
35
- `dashboard.yaml` is the single file you edit — the SPA fetches the server list + UI options from
36
- `GET /api/config` at startup, so there is nothing to rebuild after a change.
37
-
38
- 2. **Run the front-end server** (serves the built SPA + proxies `/api/s/{i}/*`):
39
- ```bash
40
- bun server.ts
41
- ```
42
- Env overrides: `PORT` (default 5173), `HOST` (default 0.0.0.0), `DASHBOARD_CONFIG` (config file
43
- path). Open http://localhost:5173/.
28
+ Add one backend per prompt (`name` + `url`, e.g. `main` / `http://127.0.0.1:8791`), then set the
29
+ front-end port, host, and `ui.sessionPage`. Re-run it any time to preview and extend the existing
30
+ config. You can also hand-edit the file — the SPA fetches the server list + UI options from
31
+ `GET /api/config` at startup, so there is nothing to rebuild after a change.
32
+
33
+ ## Run
34
+
35
+ ```bash
36
+ opencode-dashboard serve [--port N] [--host H]
37
+ ```
38
+
39
+ Serves the SPA on the configured host/port (default `0.0.0.0:5173`) and proxies `/api/s/{i}/*` to the
40
+ configured backends. CLI flags beat env vars (`PORT`, `HOST`), which beat the config file. Open
41
+ http://localhost:5173/.
44
42
 
45
43
  Each configured backend is one tab (with an **Overall** tab showing all of them in a grid). Sessions
46
44
  render as parent/child trees — subagents are collapsed by default and a parent's totals include all
@@ -52,10 +50,14 @@ descendants. Live updates come over SSE, so the page refreshes itself as opencod
52
50
  git clone https://github.com/GCS-ZHN/opencode-dashboard
53
51
  cd opencode-dashboard/client
54
52
  bun install # install dev deps (typescript, vite, yaml)
55
- bun run dev # Vite dev server (same /api/s/{i} proxy + /api/config from dashboard.yaml) → :5173
56
- bun run build # typecheck (tsc) + bundle (vite)
53
+ bun run dev # Vite dev server (reads repo dashboard.yaml) → :5173
54
+ bun run build # typecheck (tsc) + bundle (vite + CLI)
55
+ bun run serve # run the built CLI: node dist-cli/cli.mjs serve
57
56
  bun mock-server.ts # serve canned API data for frontend-only work (PORT env, default 8791)
58
57
  ```
59
58
 
59
+ During dev the repo `dashboard.yaml` is used; the published package never ships it — runtime
60
+ configuration lives in the XDG file written by `opencode-dashboard configure`.
61
+
60
62
  Full project docs (architecture, API contract, publishing) live in the repo
61
63
  [README](https://github.com/GCS-ZHN/opencode-dashboard).