tokenleak 1.3.0 → 2.0.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 +58 -34
- package/package.json +3 -2
- package/tokenleak +6615 -2459
package/README.md
CHANGED
|
@@ -39,18 +39,18 @@ npx tokenleak --help
|
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
After installing, run `tokenleak` in your terminal. It auto-detects supported providers from their local logs.
|
|
42
|
-
In an interactive TTY, plain `tokenleak`
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
In an interactive TTY, plain `tokenleak` launches a full-screen TUI dashboard with 8 views:
|
|
43
|
+
|
|
44
|
+
- **Overview** — heatmap, stats, providers, and top models
|
|
45
|
+
- **Matrix** — 4-page deep-dive with activity patterns, cache economics, sessions, model efficiency, attribution, and cache ROI by model
|
|
46
|
+
- **Advisor** — model efficiency recommendations with projected savings
|
|
47
|
+
- **Focus** — deep-work session rankings scored by duration, density, and streaks
|
|
48
|
+
- **Explain** — narrative day-by-day usage breakdown
|
|
49
|
+
- **Compare** — side-by-side period comparison with deltas
|
|
50
|
+
- **Export** — save PNG, Wrapped PNG, or launch a live server
|
|
51
|
+
- **Wrapped** — Spotify-Wrapped-style stats card with achievements and usage breakdown
|
|
52
|
+
|
|
53
|
+
Use `tokenleak --legacy` to open the classic interactive launcher instead.
|
|
54
54
|
|
|
55
55
|
### From source
|
|
56
56
|
|
|
@@ -68,10 +68,13 @@ bun dist/tokenleak.js
|
|
|
68
68
|
## Usage
|
|
69
69
|
|
|
70
70
|
```bash
|
|
71
|
-
# Open the
|
|
71
|
+
# Open the TUI dashboard (TTY only)
|
|
72
72
|
tokenleak
|
|
73
73
|
|
|
74
|
-
#
|
|
74
|
+
# Open the classic interactive launcher
|
|
75
|
+
tokenleak --legacy
|
|
76
|
+
|
|
77
|
+
# Skip the TUI and render directly with flags
|
|
75
78
|
tokenleak --format terminal
|
|
76
79
|
|
|
77
80
|
# Start the local live dashboard server
|
|
@@ -150,18 +153,19 @@ tokenleak cursor accounts --json
|
|
|
150
153
|
tokenleak cursor switch work
|
|
151
154
|
tokenleak cursor logout --name work
|
|
152
155
|
tokenleak cursor logout --all --purge-cache
|
|
156
|
+
tokenleak cursor reset
|
|
153
157
|
```
|
|
154
158
|
|
|
155
159
|
- Getting a Cursor session token:
|
|
156
160
|
|
|
157
|
-
The exact
|
|
161
|
+
The exact browser wording may vary, but the reliable source of truth is the `WorkosCursorSessionToken` cookie:
|
|
158
162
|
|
|
159
163
|
1. Open Cursor and sign in.
|
|
160
164
|
2. Open `https://www.cursor.com/settings`.
|
|
161
|
-
3. Open your browser developer tools
|
|
162
|
-
4.
|
|
163
|
-
5.
|
|
164
|
-
6. Paste that token into `tokenleak cursor login --name <label>` when prompted
|
|
165
|
+
3. Open your browser developer tools.
|
|
166
|
+
4. Go to `Application` (or `Storage`) -> `Cookies` -> `https://www.cursor.com`.
|
|
167
|
+
5. Copy the value of the `WorkosCursorSessionToken` cookie.
|
|
168
|
+
6. Paste that token into `tokenleak cursor login --name <label>` when prompted, or into the TUI setup modal after pressing `c`.
|
|
165
169
|
|
|
166
170
|
- Local checkout flow:
|
|
167
171
|
|
|
@@ -183,6 +187,7 @@ bun packages/cli/dist/cli.js --provider cursor --format json
|
|
|
183
187
|
- Normal dashboard/report runs auto-refresh Cursor cache when you are logged in and Cursor is requested or available.
|
|
184
188
|
- If refresh fails but cached CSVs exist, Tokenleak falls back to the cached data.
|
|
185
189
|
- `tokenleak cursor status` only validates the saved session token. It does not mark Cursor as available by itself.
|
|
190
|
+
- `tokenleak cursor reset` clears saved Cursor credentials and the local Cursor cache so you can re-test the in-TUI setup flow from a clean state.
|
|
186
191
|
- `tokenleak --list-providers` reports whether local provider data exists. For Cursor, that means `cursor-cache/usage*.csv` must already be present.
|
|
187
192
|
- If `cursor status` is valid but `--list-providers` still shows Cursor as unavailable, run `tokenleak --provider cursor` once to sync the cache, then rerun `--list-providers`.
|
|
188
193
|
- Cursor session tokens are stored in plaintext at `~/.config/tokenleak/cursor-credentials.json` (or under `TOKENLEAK_CURSOR_DIR`) with local-only file permissions.
|
|
@@ -280,7 +285,7 @@ The wrapped card includes 12 sections: title, big numbers, streak story, top mod
|
|
|
280
285
|
|
|
281
286
|
Achievements are computed from your actual data — earn badges like Streak Master (30+ day streak), Cache Master (>50% hit rate), Night Owl (>40% usage 10pm-6am), Power User (>10k avg daily tokens), and more.
|
|
282
287
|
|
|
283
|
-
The
|
|
288
|
+
The TUI dashboard includes a Wrapped view (press `8` or arrow to it). The classic launcher (`tokenleak --legacy`) also offers a guided Wrapped setup flow.
|
|
284
289
|
|
|
285
290
|
### Wrapped Live
|
|
286
291
|
|
|
@@ -299,7 +304,7 @@ tokenleak --wrapped-live --provider claude-code,codex
|
|
|
299
304
|
|
|
300
305
|
The presentation uses the same 12 sections as the static wrapped card but rendered as navigable slides with an obsidian-and-gold design. Use arrow keys, click the nav buttons, or swipe on touch devices to move between slides.
|
|
301
306
|
|
|
302
|
-
The
|
|
307
|
+
The classic launcher (`tokenleak --legacy`) includes Wrapped Live as a menu option.
|
|
303
308
|
|
|
304
309
|
### Model Efficiency Advisor
|
|
305
310
|
|
|
@@ -372,19 +377,36 @@ tokenleak --format json --upload gist
|
|
|
372
377
|
|
|
373
378
|
## Interactive modes
|
|
374
379
|
|
|
375
|
-
###
|
|
376
|
-
|
|
377
|
-
In a real TTY, `tokenleak` opens a launcher instead of rendering immediately. You can move with arrow keys, use number shortcuts, inspect the exact command preview before running it, and stay inside the same session after each command finishes.
|
|
380
|
+
### TUI dashboard (default)
|
|
378
381
|
|
|
379
|
-
|
|
382
|
+
In a real TTY, `tokenleak` launches a full-screen terminal dashboard built with [@opentui/core](https://www.npmjs.com/package/@opentui/core). The TUI provides 8 views with keyboard and mouse navigation:
|
|
380
383
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
384
|
+
| Key | Action |
|
|
385
|
+
| --- | --- |
|
|
386
|
+
| `←` / `→` | Switch between views |
|
|
387
|
+
| `Tab` / `>` | Next time period (1D → 7D → 30D → 90D → ALL) |
|
|
388
|
+
| `Shift+Tab` / `<` | Previous time period |
|
|
389
|
+
| `1`–`8` | Jump directly to a view |
|
|
390
|
+
| `j` / `k` | Scroll up/down in scrollable views |
|
|
391
|
+
| `[` / `]` | Matrix page navigation (in Matrix view) |
|
|
392
|
+
| `h` / `l` | Previous/next day (in Explain view) |
|
|
393
|
+
| `s` | Toggle sort mode (in Overview) |
|
|
394
|
+
| `r` | Refresh data |
|
|
395
|
+
| `c` | Open Cursor setup when the dashboard shows a Cursor auth/sync banner |
|
|
396
|
+
| `?` | Help overlay |
|
|
397
|
+
| `q` | Quit |
|
|
398
|
+
|
|
399
|
+
When Cursor needs setup, re-authentication, or a cache retry, the TUI shows a contextual banner. Press `c` to open the built-in Cursor setup flow, paste a session token, validate it, and sync usage CSVs without leaving the dashboard.
|
|
400
|
+
|
|
401
|
+
The Matrix view spans 4 pages:
|
|
402
|
+
1. Overview + time windows + providers + top models
|
|
403
|
+
2. Hour-of-day, day-of-week, I/O breakdown, monthly burn
|
|
404
|
+
3. Cache economics, cache ROI, session metrics, top projects
|
|
405
|
+
4. Model efficiency, attribution clusters, top sessions, cache ROI by model
|
|
406
|
+
|
|
407
|
+
### Classic launcher
|
|
408
|
+
|
|
409
|
+
`tokenleak --legacy` opens the previous interactive launcher with a numbered menu, command preview, and guided setup flows for exports, wrapped cards, and the live dashboard.
|
|
388
410
|
|
|
389
411
|
### Live dashboard
|
|
390
412
|
|
|
@@ -392,7 +414,7 @@ This mode uses event-level data when available, so session, token, project, attr
|
|
|
392
414
|
|
|
393
415
|
## All flags
|
|
394
416
|
|
|
395
|
-
When you run bare `tokenleak` in a real terminal, the
|
|
417
|
+
When you run bare `tokenleak` in a real terminal, the TUI dashboard launches. Pass flags to skip the TUI and render directly.
|
|
396
418
|
|
|
397
419
|
Subcommands:
|
|
398
420
|
|
|
@@ -426,6 +448,7 @@ Subcommands:
|
|
|
426
448
|
| `--live-server` | `-L` | `false` | Start the local browser dashboard |
|
|
427
449
|
| `--wrapped-live` | | `false` | Start the interactive AI Wrapped presentation in a browser |
|
|
428
450
|
| `--advisor` | | `false` | Run the model efficiency advisor |
|
|
451
|
+
| `--legacy` | | `false` | Open the classic interactive launcher instead of the TUI |
|
|
429
452
|
| `--no-color` | | `false` | Strip ANSI escape codes from terminal output |
|
|
430
453
|
| `--no-insights` | | `false` | Hide terminal insights |
|
|
431
454
|
| `--version` | | | Print version information |
|
|
@@ -743,12 +766,13 @@ tokenleak/
|
|
|
743
766
|
core/ Shared types, constants, aggregation engine
|
|
744
767
|
registry/ Provider parsers and model pricing
|
|
745
768
|
renderers/ JSON, SVG, PNG, and terminal output
|
|
769
|
+
tui/ Full-screen TUI dashboard (default interactive mode)
|
|
746
770
|
cli/ CLI entrypoint and config handling
|
|
747
771
|
mcp/ MCP server for AI assistant integration
|
|
748
772
|
scripts/
|
|
749
773
|
build-npm.ts Bundles CLI for npm publishing
|
|
750
774
|
dist/
|
|
751
|
-
tokenleak
|
|
775
|
+
tokenleak Bundled CLI (generated)
|
|
752
776
|
```
|
|
753
777
|
|
|
754
778
|
## Contributing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tokenleak",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Visualise your AI coding-assistant token usage across providers — heatmaps, dashboards, and shareable cards.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"tokenleak"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"sharp": "^0.34.0"
|
|
13
|
+
"sharp": "^0.34.0",
|
|
14
|
+
"@opentui/core": "^0.1.88"
|
|
14
15
|
},
|
|
15
16
|
"engines": {
|
|
16
17
|
"bun": ">=1.0.0"
|