@zhangferry-dev/tokendash 1.3.0 → 1.4.2
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 +40 -20
- package/bin/tokendash.js +5 -1
- package/dist/client/assets/{index-D-RErhSy.js → index-B4YgU_cb.js} +42 -42
- package/dist/client/assets/index-iYDpTV63.css +1 -0
- package/dist/client/index.html +2 -2
- package/dist/client/popover.html +1132 -0
- package/dist/electron-server.cjs +2175 -0
- package/dist/electron-server.cjs.map +7 -0
- package/dist/server/codexParser.d.ts +4 -5
- package/dist/server/codexParser.js +18 -6
- package/dist/server/index.d.ts +4 -1
- package/dist/server/index.js +59 -22
- package/electron/main.cjs +505 -0
- package/electron/main.js +291 -0
- package/electron/preload.cjs +25 -0
- package/electron/trayBadge.cjs +27 -0
- package/electron/trayBadge.js +30 -0
- package/electron/trayHelper +0 -0
- package/electron/trayHelper.swift +152 -0
- package/electron-builder.yml +20 -0
- package/package.json +13 -4
- package/resources/entitlements.mac.plist +10 -0
- package/resources/icon.icns +0 -0
- package/resources/icon.png +0 -0
- package/resources/product_menu.png +0 -0
- package/resources/product_screenshoot.png +0 -0
- package/dist/client/assets/index-x7K7fQX4.css +0 -1
package/README.md
CHANGED
|
@@ -1,23 +1,50 @@
|
|
|
1
1
|
# tokendash
|
|
2
2
|
|
|
3
|
-
A beautiful, local web dashboard for visualizing your Claude Code, Codex, and
|
|
3
|
+
A beautiful, local web dashboard for visualizing your Claude Code, Codex, OpenClaw, and OpenCode token usage statistics.
|
|
4
4
|
|
|
5
5
|
It runs locally and parses token usage data directly from local session files, presenting it in a clean, interactive React dashboard. No external CLI dependencies required.
|
|
6
6
|
|
|
7
|
-

|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
- **Multi-Agent Support:** View usage for Claude Code, Codex, and
|
|
12
|
-
- **Direct JSONL Parsing:** Reads
|
|
11
|
+
- **Multi-Agent Support:** View usage for Claude Code, Codex, OpenClaw, and OpenCode.
|
|
12
|
+
- **Direct JSONL Parsing:** Reads local session files directly — 100x faster data loading.
|
|
13
13
|
- **Detailed Metrics:** Track total tokens, cost (USD), active days, cache hit rates, and output/input ratio.
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
14
|
+
- **Today by Hour:** 24-hour token consumption panel showing hourly breakdown for the current day.
|
|
15
|
+
- **Code Analytics:** Visualize code change trends, tool call frequency, and productivity KPIs.
|
|
16
16
|
- **Interactive Charts:** Bar/line/area charts with tooltips, model breakdowns, and time range filtering.
|
|
17
17
|
- **24-Hour Heatmap:** Activity distribution by hour and day of week, with timezone awareness.
|
|
18
18
|
- **Model & Project Distribution:** See which models and projects drive your usage.
|
|
19
19
|
- **Persistent Filters:** Your selected time range, project, and metric mode are saved automatically.
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
## macOS Menu Bar App
|
|
22
|
+
|
|
23
|
+
TokenDash ships as a native macOS menu-bar-only application — no Dock icon, no window clutter. It lives quietly in your status bar and gives you instant access to your AI token usage at a glance.
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
**Status Bar Badge**
|
|
28
|
+
- Displays real-time token count (e.g. `1.2K`, `32.0M`) directly in the macOS status bar
|
|
29
|
+
- Updates every 5 seconds automatically
|
|
30
|
+
- Shows cost and cache hit rate in the tooltip on hover
|
|
31
|
+
- Resilient badge: transient network or data errors won't clear your existing badge value
|
|
32
|
+
|
|
33
|
+
**Popover Dashboard**
|
|
34
|
+
- Click the status bar icon to open a compact popover with today's full breakdown:
|
|
35
|
+
- Total tokens, input/output/cache metrics at a glance
|
|
36
|
+
- Hourly consumption bar chart with peak value highlight
|
|
37
|
+
- Agent filter dropdown (show only Claude Code, Codex, etc.)
|
|
38
|
+
- Settings: launch at login, check for updates, quit
|
|
39
|
+
- The popover syncs rendered totals back to the status bar badge for maximum accuracy
|
|
40
|
+
|
|
41
|
+
**Native Integration**
|
|
42
|
+
- Written in Swift (`trayHelper.swift`) for macOS 14+ compatibility
|
|
43
|
+
- Menu-bar-only (`LSUIElement: true`) — no Dock icon, runs silently in the background
|
|
44
|
+
- Dark mode support with automatic theme switching
|
|
45
|
+
- Custom app icon
|
|
46
|
+
- Distributed as a standard macOS DMG installer
|
|
47
|
+
- Port auto-detection with fallback — works even if port 3456 is already in use
|
|
21
48
|
|
|
22
49
|
## Requirements
|
|
23
50
|
|
|
@@ -43,6 +70,10 @@ By default, the backend server runs on port `3456`. When running the production
|
|
|
43
70
|
|
|
44
71
|
During development (`npm run dev`), Vite starts a separate development server on port `5173` with hot-module replacement. You should access the dashboard at `http://localhost:5173` while developing.
|
|
45
72
|
|
|
73
|
+
### macOS Menu Bar App
|
|
74
|
+
|
|
75
|
+
Download the latest `TokenDash-<version>-arm64.dmg` from [GitHub Releases](https://github.com/zhangferry/tokendash/releases). Open the DMG and drag TokenDash to your Applications folder. Launch it and the status bar icon appears immediately — no setup needed.
|
|
76
|
+
|
|
46
77
|
### Command Line Options
|
|
47
78
|
|
|
48
79
|
```bash
|
|
@@ -87,21 +118,10 @@ If you want to contribute or modify the dashboard locally:
|
|
|
87
118
|
|
|
88
119
|
- **Frontend:** React 19, Recharts, Tailwind CSS (via Vite plugin), built with Vite.
|
|
89
120
|
- **Backend:** Express, TypeScript.
|
|
90
|
-
- **Data Source:** All agent data is parsed directly from local session files (`~/.claude/projects/`, `~/.codex/sessions/`). No external CLI dependencies.
|
|
121
|
+
- **Data Source:** All agent data is parsed directly from local session files (`~/.claude/projects/`, `~/.codex/sessions/`) and OpenCode's SQLite database (`~/.local/share/opencode/opencode.db`). No external CLI dependencies.
|
|
91
122
|
- **Caching:** Persistent disk cache (`/tmp/tokendash-cache/`) with stale-while-revalidate pattern for snappy UI updates.
|
|
92
123
|
- **Testing:** Vitest (unit), Playwright (E2E). Run with `npm test` and `npm run test:e2e`.
|
|
93
|
-
|
|
94
|
-
## Changelog
|
|
95
|
-
|
|
96
|
-
### v1.2.0
|
|
97
|
-
- **Replaced `ccusage` CLI** with direct JSONL parser — data loads in 1-2ms instead of 12-30s
|
|
98
|
-
- **Added code analytics** — code change trend, tool call trend, daily KPIs
|
|
99
|
-
- **Added persistent disk cache** with stale-while-revalidate pattern
|
|
100
|
-
- **Fixed heatmap** — cost metric now shows real data (was always $0)
|
|
101
|
-
- **Fixed timezone handling** — correct date/hour grouping for non-UTC users
|
|
102
|
-
- **Added pricing info popup** — shows per-model pricing formula in Cost mode
|
|
103
|
-
- **Added test suite** — 49 unit tests + 6 E2E tests
|
|
104
|
-
- **Layout improvements** — model trend bar chart, side-by-side analytics panels
|
|
124
|
+
- **CI:** GitHub Actions pipeline for automated testing on every push and PR.
|
|
105
125
|
|
|
106
126
|
## License
|
|
107
127
|
|