@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 CHANGED
@@ -1,23 +1,50 @@
1
1
  # tokendash
2
2
 
3
- A beautiful, local web dashboard for visualizing your Claude Code, Codex, and OpenClaw token usage statistics.
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
- ![Product Screenshoot](resources/product_screenshoot.png)
7
+ ![Web Dashboard](resources/product_screenshoot.png)
8
8
 
9
9
  ## Features
10
10
 
11
- - **Multi-Agent Support:** View usage for Claude Code, Codex, and OpenClaw.
12
- - **Direct JSONL Parsing:** Reads `~/.claude/projects/` JSONL files directly — no `ccusage` CLI dependency, 100x faster data loading.
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
- - **Code Analytics:** Visualize code change trends, tool call frequency, and productivity KPIs (Claude Code & OpenClaw only).
15
- - **Pricing Transparency:** Toggle Cost metric to see per-model pricing formula and rates.
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
- - **Test Coverage:** Unit tests (Vitest) and E2E tests (Playwright) for reliability.
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
+ ![macOS Menu Bar](resources/product_menu.png)
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
 
package/bin/tokendash.js CHANGED
@@ -1,2 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import "../dist/server/index.js";
2
+ import { main } from "../dist/server/index.js";
3
+ main().catch((error) => {
4
+ console.error('Fatal error:', error);
5
+ process.exit(1);
6
+ });