@juliantanx/aiusage 1.3.0 → 1.3.1

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.
Files changed (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +115 -27
  3. package/dist/index.js +1015 -123
  4. package/dist/web/_app/immutable/assets/10.DpWloLoX.css +1 -0
  5. package/dist/web/_app/immutable/assets/11.BfaLSE4e.css +1 -0
  6. package/dist/web/_app/immutable/assets/14.CxRLR3o7.css +1 -0
  7. package/dist/web/_app/immutable/assets/2.BLunjqo3.css +1 -0
  8. package/dist/web/_app/immutable/assets/6.8Efnpu8u.css +1 -0
  9. package/dist/web/_app/immutable/assets/8.BeGOLIpG.css +1 -0
  10. package/dist/web/_app/immutable/assets/9.DMukHCtv.css +1 -0
  11. package/dist/web/_app/immutable/assets/_page.8Efnpu8u.css +1 -0
  12. package/dist/web/_app/immutable/assets/_page.BeGOLIpG.css +1 -0
  13. package/dist/web/_app/immutable/assets/_page.BfaLSE4e.css +1 -0
  14. package/dist/web/_app/immutable/assets/_page.CYETnzhl.css +1 -0
  15. package/dist/web/_app/immutable/assets/_page.CxRLR3o7.css +1 -0
  16. package/dist/web/_app/immutable/assets/_page.DDYvQrAf.css +1 -0
  17. package/dist/web/_app/immutable/assets/_page.DpWloLoX.css +1 -0
  18. package/dist/web/_app/immutable/chunks/{ToolSelector.CnQ-eszE.js → ToolSelector.Dhbay8qR.js} +2 -2
  19. package/dist/web/_app/immutable/chunks/api.Wak6H2JS.js +1 -0
  20. package/dist/web/_app/immutable/chunks/entry.CS-NDdiQ.js +3 -0
  21. package/dist/web/_app/immutable/chunks/i18n.BCaZpNqk.js +1 -0
  22. package/dist/web/_app/immutable/chunks/{index.wix8pgil.js → index.BmCbw0jM.js} +1 -1
  23. package/dist/web/_app/immutable/chunks/{stores.C3ZtRBEM.js → stores.BjyZzXAW.js} +1 -1
  24. package/dist/web/_app/immutable/entry/app.27f4j9Xy.js +2 -0
  25. package/dist/web/_app/immutable/entry/start.bzCZowcz.js +1 -0
  26. package/dist/web/_app/immutable/nodes/0.CFOrMeCV.js +1 -0
  27. package/dist/web/_app/immutable/nodes/{1.CNbcoUIj.js → 1.DZIXtjp3.js} +1 -1
  28. package/dist/web/_app/immutable/nodes/10.DxJi0s_F.js +1 -0
  29. package/dist/web/_app/immutable/nodes/11.q1SVEyD9.js +1 -0
  30. package/dist/web/_app/immutable/nodes/12.CamXVWac.js +1 -0
  31. package/dist/web/_app/immutable/nodes/{11.TrX-RGQX.js → 13.Bbzem3lL.js} +1 -1
  32. package/dist/web/_app/immutable/nodes/14.BbcTrrp0.js +1 -0
  33. package/dist/web/_app/immutable/nodes/2.DcYQmIYj.js +3 -0
  34. package/dist/web/_app/immutable/nodes/{3.CcnPu3DZ.js → 3.DqJoSOZA.js} +1 -1
  35. package/dist/web/_app/immutable/nodes/4.CoqRShfZ.js +41 -0
  36. package/dist/web/_app/immutable/nodes/{5.Bxx7TNGK.js → 5.BcRc8qNP.js} +1 -1
  37. package/dist/web/_app/immutable/nodes/6.DU7MEeuP.js +1 -0
  38. package/dist/web/_app/immutable/nodes/{7.bOnMUP4_.js → 7.CE7kQC3R.js} +1 -1
  39. package/dist/web/_app/immutable/nodes/8.DzIcKP7s.js +1 -0
  40. package/dist/web/_app/immutable/nodes/9.4mP0VDWh.js +1 -0
  41. package/dist/web/_app/version.json +1 -1
  42. package/dist/web/index.html +7 -7
  43. package/package.json +8 -3
  44. package/dist/web/_app/immutable/assets/12.DAmfvZ5J.css +0 -1
  45. package/dist/web/_app/immutable/assets/2.G6nSchsK.css +0 -1
  46. package/dist/web/_app/immutable/assets/6.CrsKlz6Y.css +0 -1
  47. package/dist/web/_app/immutable/assets/8.DDodt1Wn.css +0 -1
  48. package/dist/web/_app/immutable/assets/9.ApFevNUr.css +0 -1
  49. package/dist/web/_app/immutable/assets/_page.ApFevNUr.css +0 -1
  50. package/dist/web/_app/immutable/assets/_page.CrsKlz6Y.css +0 -1
  51. package/dist/web/_app/immutable/assets/_page.DAmfvZ5J.css +0 -1
  52. package/dist/web/_app/immutable/assets/_page.DDodt1Wn.css +0 -1
  53. package/dist/web/_app/immutable/assets/_page.DewAUGiJ.css +0 -1
  54. package/dist/web/_app/immutable/chunks/api.OwJBmtEN.js +0 -1
  55. package/dist/web/_app/immutable/chunks/entry.DWbp2XzC.js +0 -3
  56. package/dist/web/_app/immutable/chunks/i18n.BOq44pYI.js +0 -1
  57. package/dist/web/_app/immutable/entry/app.7Tmcb_qs.js +0 -2
  58. package/dist/web/_app/immutable/entry/start.CuMG7ijt.js +0 -1
  59. package/dist/web/_app/immutable/nodes/0.GiWuXD22.js +0 -1
  60. package/dist/web/_app/immutable/nodes/10.DgPr3L-S.js +0 -1
  61. package/dist/web/_app/immutable/nodes/12.ZW7n1TLF.js +0 -1
  62. package/dist/web/_app/immutable/nodes/2.D0gEY9nh.js +0 -3
  63. package/dist/web/_app/immutable/nodes/4.CCaCZRNi.js +0 -13
  64. package/dist/web/_app/immutable/nodes/6.8zY9a_YX.js +0 -1
  65. package/dist/web/_app/immutable/nodes/8.01X9rJRT.js +0 -1
  66. package/dist/web/_app/immutable/nodes/9.DabFUxt3.js +0 -1
  67. /package/dist/web/_app/immutable/assets/{10.D4XIqeEN.css → 12.D4XIqeEN.css} +0 -0
  68. /package/dist/web/_app/immutable/assets/{11.CR85TxeS.css → 13.CR85TxeS.css} +0 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 juliantanx
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,42 +1,58 @@
1
- # aiusage
1
+ # aiusage — AI Coding Assistant Usage Tracker
2
2
 
3
- Track AI coding assistant usage, token consumption, cost, and tool calls in one place across Claude Code, Codex, OpenClaw, OpenCode, Hermes, and Qoder.
3
+ **Open-source CLI and dashboard to track token usage, cost, and sessions across Claude Code, Codex, OpenCode, Hermes, Qoder, and more.** Local-first, privacy-respecting, with an optional web dashboard and multi-machine sync.
4
4
 
5
- English | [中文](https://github.com/juliantanx/aiusage/blob/main/README_zh.md)
5
+ [![npm version](https://img.shields.io/npm/v/@juliantanx/aiusage)](https://www.npmjs.com/package/@juliantanx/aiusage)
6
+ [![CI](https://github.com/juliantanx/aiusage/actions/workflows/test.yml/badge.svg)](https://github.com/juliantanx/aiusage/actions/workflows/test.yml)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
8
+ [![Node.js](https://img.shields.io/badge/Node.js-18%2B-green.svg)](https://nodejs.org/)
6
9
 
7
- ## Why aiusage
10
+ **aiusage** gives you one local-first place to understand how your AI coding tools are being used: tokens, cost, model mix, tool activity, projects, sessions, and multi-machine sync when you need it. Supports Claude Code, Codex, OpenClaw, OpenCode, Hermes, and Qoder.
8
11
 
9
- - Aggregate local session logs from multiple AI coding assistants into one view.
10
- - Analyze token usage, cost, model mix, and tool call activity.
11
- - Explore the data through a local dashboard with overview ranges from Today to All Time.
12
- - Sync usage data across multiple machines with GitHub, S3, or R2.
13
- - Keep everything local-first, with optional cloud sync when you need shared visibility.
12
+ English | [中文](https://github.com/juliantanx/aiusage/blob/main/README_zh.md)
14
13
 
15
14
  ## Quick Start
16
15
 
17
16
  **Prerequisites:** Node.js 18 or later
18
17
 
19
18
  ```bash
20
- # Install
21
19
  npm install -g @juliantanx/aiusage
22
-
23
- # Parse local session logs
24
20
  aiusage parse
25
-
26
- # Start the dashboard
27
21
  aiusage serve
28
- # Open http://localhost:3847
29
22
  ```
30
23
 
31
- Day-to-day usage is usually just:
24
+ Open `http://localhost:3847` to explore the dashboard.
32
25
 
33
- ```bash
34
- aiusage parse
35
- aiusage serve
36
- ```
26
+ If aiusage is useful, consider starring the repo to help more developers discover it.
37
27
 
38
28
  `aiusage` does not run a built-in background parser. If you want automatic imports, schedule `aiusage parse` with cron or Task Scheduler.
39
29
 
30
+ ### Running in Background (PM2)
31
+
32
+ `aiusage serve` runs in the foreground and stops when you close the terminal. To keep it running in the background on **Windows, macOS, and Linux**, use [PM2](https://pm2.keymetrics.io/):
33
+
34
+ ```bash
35
+ # Install PM2 (one-time)
36
+ npm install -g pm2 pm2-startup
37
+
38
+ # Start aiusage serve as a background service
39
+ pm2 start aiusage -- serve
40
+
41
+ # Start the system tray widget as a background service (optional)
42
+ pm2 start aiusage-widget -- --foreground
43
+
44
+ # Set auto-start on boot (Windows / macOS / Linux)
45
+ pm2 save
46
+ pm2-startup install
47
+
48
+ # Common commands
49
+ pm2 list # View running status
50
+ pm2 logs # View logs
51
+ pm2 stop all # Stop all services
52
+ pm2 restart all # Restart all services
53
+ pm2 delete all # Remove all services
54
+ ```
55
+
40
56
  <details>
41
57
  <summary>Build from source</summary>
42
58
 
@@ -65,6 +81,39 @@ pnpm rebuild:sqlite
65
81
 
66
82
  </details>
67
83
 
84
+ ## Why aiusage
85
+
86
+ AI coding assistant usage is scattered by default: different tools, different local logs, different machines, and no shared view of tokens or cost.
87
+
88
+ aiusage brings that data into one local-first dashboard so you can:
89
+
90
+ - Track token usage, cost, model mix, and tool-call activity in one place.
91
+ - Aggregate usage across Claude Code, Codex, OpenClaw, OpenCode, Hermes, and Qoder.
92
+ - Understand usage over time through overview, token, cost, model, session, and project views.
93
+ - Sync across multiple machines with GitHub, S3, or R2 when shared visibility matters.
94
+ - Keep your data local by default, with optional sync only when you choose it.
95
+
96
+ ## Who is this for?
97
+
98
+ aiusage is built for:
99
+
100
+ - Developers using Claude Code, Codex, or other AI coding assistants every day.
101
+ - People who want visibility into token usage and spend over time.
102
+ - Multi-tool users who want one dashboard instead of multiple disconnected logs.
103
+ - Multi-machine workflows that need optional aggregation and sync.
104
+
105
+ ## Supported tools
106
+
107
+ aiusage currently supports:
108
+
109
+ - Claude Code
110
+ - Codex
111
+ - OpenClaw
112
+ - OpenCode
113
+ - Hermes
114
+ - Qoder
115
+ - Cursor
116
+
68
117
  ## Screenshots
69
118
 
70
119
  ![Homepage dashboard](https://cdn.jsdelivr.net/gh/juliantanx/aiusage@0ae8299/docs/assets/readme/home.png)
@@ -73,6 +122,16 @@ pnpm rebuild:sqlite
73
122
 
74
123
  ![Token usage page](https://cdn.jsdelivr.net/gh/juliantanx/aiusage@0ae8299/docs/assets/readme/token.png)
75
124
 
125
+ ## Common use cases
126
+
127
+ Use aiusage to:
128
+
129
+ - Track token and cost trends across AI coding assistants.
130
+ - Compare model usage and activity over time.
131
+ - Inspect tool-call volume and session-level behavior.
132
+ - Aggregate usage across multiple machines into one view.
133
+ - Run a local or Docker-hosted dashboard for ongoing visibility.
134
+
76
135
  ## CLI Reference
77
136
 
78
137
  ### `aiusage` (default)
@@ -85,7 +144,7 @@ Import newly appended local session data from discovered source paths.
85
144
 
86
145
  | Option | Description |
87
146
  |--------|-------------|
88
- | `--tool <tool>` | Only parse a specific tool: `claude-code`, `codex`, `openclaw`, `opencode`, `hermes`, `qoder` |
147
+ | `--tool <tool>` | Only parse a specific tool: `claude-code`, `codex`, `openclaw`, `opencode`, `hermes`, `qoder`, `cursor` |
89
148
  | `--progress` | Show real-time progress bar on stderr (TTY only, silent in pipes/CI) |
90
149
 
91
150
  ```bash
@@ -114,7 +173,7 @@ Print a usage summary in the terminal.
114
173
  | Option | Description |
115
174
  |--------|-------------|
116
175
  | `--device <id>` | Filter by device instance ID |
117
- | `--tool <tool>` | Filter by tool type |
176
+ | `--tool <tool>` | Filter by tool type (`claude-code`, `codex`, `openclaw`, `opencode`, `hermes`, `qoder`, `cursor`) |
118
177
 
119
178
  ```bash
120
179
  aiusage summary # All-time summary
@@ -452,6 +511,7 @@ docker build -t aiusage .
452
511
  | Hermes | `~/.hermes/state.db` | `~/.hermes/state.db` | `%USERPROFILE%\.hermes\state.db` |
453
512
  | Qoder (sessions) | `~/.qoder/logs/sessions/` | `~/.qoder/logs/sessions/` plus WSL-mounted Windows user homes | `%USERPROFILE%\.qoder\logs\sessions\` |
454
513
  | Qoder (SQLite) | `~/Library/Application Support/Qoder/SharedClientCache/cache/db/local.db` | `~/.local/share/Qoder/SharedClientCache/cache/db/local.db` | `%LOCALAPPDATA%\Qoder\SharedClientCache\cache\db\local.db` |
514
+ | Cursor | `~/Library/Application Support/Cursor/User/globalStorage/state.vscdb` | `~/.config/Cursor/User/globalStorage/state.vscdb` | `%APPDATA%\Cursor\User\globalStorage\state.vscdb` |
455
515
 
456
516
  Discovery behavior:
457
517
 
@@ -462,6 +522,7 @@ Discovery behavior:
462
522
  - **Hermes** — reads the SQLite database file (`state.db`) directly. Sessions without a recorded end time are still imported if they have token data (e.g. sessions from a force-quit).
463
523
  - **Qoder (sessions)** — recursively scans structured session segment logs (`logs/sessions/**/segments/*.jsonl`) and imports `model.response.completed` token events. On WSL, aiusage also checks mounted Windows user homes such as `/mnt/c/Users/<user>`, `/mnt/d/Users/<user>`, and `/mnt/e/Users/<user>` for the same Qoder session-log layout.
464
524
  - **Qoder (SQLite)** — reads the `local.db` SQLite database directly (`SharedClientCache/cache/db/local.db`) and imports assistant messages from the `chat_message` table, joined with `chat_record` for model information. This is the primary source on macOS and is tried alongside the sessions directory.
525
+ - **Cursor** — reads Cursor's `state.vscdb` SQLite database directly and imports composer conversations with token usage data.
465
526
 
466
527
  > On Linux, OpenCode respects `$XDG_DATA_HOME` if set.
467
528
 
@@ -480,7 +541,8 @@ If you installed a tool to a non-default location, override the paths in the **S
480
541
  "opencode": "/custom/path/opencode.db",
481
542
  "hermes": "/custom/path/.hermes/state.db",
482
543
  "qoder": "/custom/path/.qoder/logs/sessions",
483
- "qoder-db": "/custom/path/local.db"
544
+ "qoder-db": "/custom/path/local.db",
545
+ "cursor": "/custom/path/state.vscdb"
484
546
  }
485
547
  }
486
548
  ```
@@ -527,6 +589,28 @@ packages/
527
589
  web/ - SvelteKit web dashboard (SPA)
528
590
  ```
529
591
 
592
+ ## FAQ
593
+
594
+ ### Does aiusage upload my data?
595
+
596
+ No. aiusage is local-first. Your usage data stays on your machine unless you explicitly configure a sync backend.
597
+
598
+ ### Can I use aiusage across multiple machines?
599
+
600
+ Yes. You can sync usage data through GitHub, S3, or R2 and then view the combined result from any configured machine or Docker deployment.
601
+
602
+ ### Does aiusage run a background parser automatically?
603
+
604
+ No. By default, you run `aiusage parse` manually. You can automate parsing and syncing with cron, Task Scheduler, or your own scheduler.
605
+
606
+ ### Which assistants are supported?
607
+
608
+ aiusage currently supports Claude Code, Codex, OpenClaw, OpenCode, Hermes, and Qoder.
609
+
610
+ ### Can I inspect the raw database myself?
611
+
612
+ Yes. aiusage stores data in a local SQLite database, and the README already documents how to open it in tools like DBeaver, TablePlus, DataGrip, or DB Browser for SQLite.
613
+
530
614
  ## Friends
531
615
 
532
616
  [**linux.do**](https://linux.do/) — Thanks to the linux.do community for their support and inspiration during the development of this project.
@@ -535,12 +619,16 @@ packages/
535
619
 
536
620
  <a href="https://www.star-history.com/?repos=juliantanx%2Faiusage&type=date&logscale=&legend=top-left">
537
621
  <picture>
538
- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=juliantanx/aiusage&type=date&theme=dark&legend=top-left&t=20260524" />
539
- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=juliantanx/aiusage&type=date&legend=top-left&t=20260524" />
540
- <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=juliantanx/aiusage&type=date&legend=top-left&t=20260524" />
622
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=juliantanx/aiusage&type=date&theme=dark&legend=top-left&t=20260526" />
623
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=juliantanx/aiusage&type=date&legend=top-left&t=20260526" />
624
+ <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=juliantanx/aiusage&type=date&legend=top-left&t=20260526" />
541
625
  </picture>
542
626
  </a>
543
627
 
628
+ ## Contributing
629
+
630
+ Contributions are welcome! See [CONTRIBUTING.md](./CONTRIBUTING.md) for how to get started.
631
+
544
632
  ## License
545
633
 
546
- MIT
634
+ [MIT](./LICENSE)