repospend 0.0.6 → 0.0.7

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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to RepoSpend will be documented in this file.
4
4
 
5
+ ## 0.0.7
6
+
7
+ - Bump RepoSpend package versions to 0.0.7.
8
+ - Add experimental Cursor support with read-only discovery for local JSONL transcripts and SQLite/vscdb storage, keeping sessions visible when token or cost data is unavailable.
9
+ - Include Cursor in source filters, dashboard source health, README data-source documentation, and CLI help.
10
+ - Track known vs. unknown-cost sessions in grouped breakdowns so mixed Cursor or Claude data does not hide partial cost coverage.
11
+ - Improve Claude Code aggregation by merging duplicate streaming usage rows with per-field maxima, deduplicating resumed usage after that merge, and splitting multi-day/model sessions into activity-day segments.
12
+ - Improve Codex token aggregation by skipping duplicate or stale `last_token_usage` snapshots while preserving post-compaction token deltas.
13
+ - Refresh the dashboard IA and UI copy around "AI providers", "apps / surfaces", repo-or-folder grouping, quick actions, filter summaries, and Cursor usage links.
14
+ - Improve the local scan loading state with elapsed timing, staged scan context, source-level hints, and previous-scan context while refreshes are running.
15
+ - Ignore local `.codex/` files.
16
+
5
17
  ## 0.0.6
6
18
 
7
19
  - Improve Codex session metadata recovery from rollout logs, including standalone Codex Desktop sessions and imported Claude model metadata.
package/README.md CHANGED
@@ -6,25 +6,51 @@
6
6
  [![node](https://img.shields.io/node/v/repospend)](https://www.npmjs.com/package/repospend)
7
7
  [![CI](https://github.com/mehmetdemircs/RepoSpend/actions/workflows/ci.yml/badge.svg)](https://github.com/mehmetdemircs/RepoSpend/actions/workflows/ci.yml)
8
8
 
9
- RepoSpend is a local-first dashboard for seeing which repositories are using the
10
- most AI coding tokens.
9
+ RepoSpend shows where your AI coding tool usage is going across Codex, Claude Code,
10
+ Cursor, and RTK. It is local, private, and repo-first.
11
11
 
12
- It reads supported local Codex and Claude Code files in read-only mode, groups
13
- sessions by Git repo, and shows token usage, cost estimates, models, sessions,
14
- and agent friction.
12
+ It reads supported local usage files in read-only mode and groups sessions by Git
13
+ repo.
15
14
 
16
15
  No login. No telemetry. No prompt uploads.
17
16
 
17
+ ```bash
18
+ npx repospend
19
+ ```
20
+
21
+ RepoSpend opens a local dashboard, usually at
22
+ [http://localhost:2005](http://localhost:2005).
23
+
24
+ ## Preview
25
+
26
+ ![RepoSpend overview dashboard with fictional Middle-earth usage data](docs/screenshots/dashboard-overview.png)
27
+
28
+ Screenshots use fictional Middle-earth demo data. The Lord of the Rings themed
29
+ repo names, sessions, prompts, token counts, and costs are intentional; no private
30
+ repository data is shown.
31
+
32
+ ## Why RepoSpend?
33
+
34
+ AI coding tools are powerful, but it is hard to see where the usage goes.
35
+
36
+ RepoSpend helps answer:
37
+
38
+ - Which repo is using the most tokens?
39
+ - Which sessions were unusually expensive?
40
+ - Which model or tool generated the spend?
41
+ - Where did the agent get stuck retrying commands?
42
+ - How much would this usage roughly cost at API-style rates?
43
+
44
+ Everything stays local.
45
+
18
46
  ## Quick Start
19
47
 
20
- You can run RepoSpend without installing it globally:
48
+ Run without installing globally:
21
49
 
22
50
  ```bash
23
51
  npx repospend
24
52
  ```
25
53
 
26
- Then open the local dashboard URL printed in your terminal.
27
-
28
54
  Or install it once:
29
55
 
30
56
  ```bash
@@ -36,29 +62,50 @@ RepoSpend starts a local dashboard, binds to localhost, opens your browser, and
36
62
  prints the dashboard URL. By default it runs at
37
63
  [http://localhost:2005](http://localhost:2005).
38
64
 
39
- RepoSpend requires Node.js `20` or newer. It uses `better-sqlite3`, so npm may
40
- install a native SQLite package for your platform.
65
+ ## Supported Tools
66
+
67
+ | Tool | Status | Notes |
68
+ |---|---|---|
69
+ | Codex | Most complete support | Tokens, models, sessions, repo grouping, command friction |
70
+ | Claude Code | Initial support | Sessions, projects, models, timestamps, tokens when available |
71
+ | Cursor | Experimental | Local JSONL and SQLite/vscdb discovery; tokens/cost only when local data includes them |
72
+ | RTK | Optional/local | Shown only when local RTK data exists |
73
+
74
+ RepoSpend started as a Codex-first release. Claude Code and Cursor support are
75
+ newer and depend on what those tools persist locally.
41
76
 
42
- ## Good For
77
+ ## Requirements
43
78
 
44
- - finding which repo is burning the most AI coding tokens
45
- - reviewing expensive or unusual coding-agent sessions
46
- - comparing Codex and Claude Code usage locally
47
- - spotting repeated command failures and agent friction
48
- - exporting usage data for your own analysis
79
+ - Node.js `20` or newer
80
+ - macOS, Linux, or Windows
81
+ - Local Codex, Claude Code, Cursor, or RTK data, depending on what you want to inspect
49
82
 
50
- ## Screenshots
83
+ RepoSpend uses `better-sqlite3`, so npm may install a native SQLite package for
84
+ your platform.
51
85
 
52
- Screenshots use fictional Middle-earth demo data. The Lord of the Rings themed
53
- repo names, sessions, prompts, token counts, and costs are intentional; no private
54
- repository data is shown.
86
+ ## What It Shows
55
87
 
56
- ### Overview
88
+ RepoSpend helps you break down local AI coding usage by:
57
89
 
58
- ![RepoSpend overview dashboard with fictional Middle-earth usage data](docs/screenshots/dashboard-overview.png)
90
+ - repo
91
+ - session
92
+ - day and hour
93
+ - model
94
+ - source/tool and app/surface, where detectable
95
+ - token type
96
+ - estimated API-equivalent cost
97
+
98
+ If Codex records work from both of these paths:
99
+
100
+ ```text
101
+ /Users/elrond/dev/RivendellRecords
102
+ /Users/elrond/dev/RivendellRecords/apps/web
103
+ ```
59
104
 
60
- The main dashboard summarizes AI coding tokens, API-equivalent cost, top repos,
61
- cache reuse, file edits, and command issue rate.
105
+ RepoSpend walks up to the Git root and shows them together as one
106
+ `RivendellRecords` project.
107
+
108
+ ## Screenshots
62
109
 
63
110
  ### Repositories
64
111
 
@@ -95,49 +142,17 @@ commands, highlights, and issues to inspect.
95
142
  Agent Friction separates blocking command failures from harmless shell exits so
96
143
  high-token troubleshooting is easier to review.
97
144
 
98
- ## What It Shows
99
-
100
- RepoSpend helps you break down local AI coding usage by:
101
-
102
- - repo
103
- - session
104
- - day and hour
105
- - model
106
- - source/tool and app/surface, where detectable
107
- - token type
108
- - estimated API-equivalent cost
109
-
110
- If Codex records work from both of these paths:
111
-
112
- ```text
113
- /Users/elrond/dev/RivendellRecords
114
- /Users/elrond/dev/RivendellRecords/apps/web
115
- ```
116
-
117
- RepoSpend walks up to the Git root and shows them together as one
118
- `RivendellRecords` project.
119
-
120
- ## Supported Tools
121
-
122
- | Tool | Status | Notes |
123
- |---|---|---|
124
- | Codex | Most complete support | Tokens, models, sessions, repo grouping, command friction |
125
- | Claude Code | Initial support | Sessions, projects, models, timestamps, tokens when available |
126
- | RTK | Optional/local | Shown only when local RTK data exists |
127
-
128
- RepoSpend started as a Codex-first release. Claude Code support is newer and
129
- depends on what your local Claude Code files include.
130
-
131
145
  ## Privacy
132
146
 
133
- RepoSpend is local-first:
134
-
135
- - no login
136
- - no telemetry
137
- - no prompt uploads
138
- - no changes to Codex or Claude Code files
147
+ RepoSpend is local-first. Everything the dashboard shows comes from files already
148
+ on your machine.
139
149
 
140
- Everything the dashboard shows comes from files already on your machine.
150
+ - No login or account required.
151
+ - No telemetry.
152
+ - No prompt or transcript uploads.
153
+ - It does not modify Codex, Claude Code, Cursor, or RTK files.
154
+ - It does not claim to match your subscription bill exactly.
155
+ - It does not read Codex Desktop server-side sessions that are not stored locally.
141
156
 
142
157
  ## Cost Estimates, Not Invoices
143
158
 
@@ -152,39 +167,29 @@ usage, account-level terms, provider changes, or other billing details. If you u
152
167
  Codex or Claude Code through a subscription, read the number as "what this token
153
168
  usage would roughly cost at API-style rates."
154
169
 
155
- Claude Code cost may show as unknown when local files do not include token counts
156
- or a model name. RepoSpend shows those sessions with unknown tokens/cost rather
157
- than guessing.
170
+ Codex support is the most complete today. Claude Code and Cursor support depend
171
+ on what those tools store locally, so some sessions may show unknown tokens or
172
+ cost.
158
173
 
159
- ### Why RepoSpend's token totals can look lower than `ccusage`
174
+ ### Token Accounting
160
175
 
161
- If you compare RepoSpend to `ccusage` you may see matching costs but different
162
- "total tokens", especially for Codex where cache reads dominate. This is
163
- expected.
176
+ RepoSpend uses normalized model-work totals:
164
177
 
165
- RepoSpend treats `cached_input_tokens` as a **subset of** `input_tokens`, which
166
- is how the OpenAI and Anthropic APIs document the field. The "total tokens"
167
- number reflects the tokens the model actually processed. `ccusage` adds cached
168
- tokens as a separate line item in its "Total Tokens" column, which inflates the
169
- total but does not change billing.
170
-
171
- The dollar cost is the source of truth and should agree between the two tools
172
- within rounding. If costs diverge, that is a real discrepancy worth
173
- investigating; token-count divergence on its own usually is not.
178
+ ```text
179
+ totalTokens = inputTokens + outputTokens + reasoningTokens
180
+ ```
174
181
 
175
- ### Codex Desktop on Windows
182
+ Cache reads and cache writes are kept as input sub-buckets and priced once. This
183
+ means RepoSpend token totals may look lower than tools that display cache
184
+ reads/writes as separate addable token columns.
176
185
 
177
- RepoSpend captures Codex **CLI** usage on Windows from `~/.codex/`. The Codex
178
- **Desktop app** (installed as the MSIX package
179
- `OpenAI.Codex_<id>` under `%LOCALAPPDATA%\Packages\`) does not persist session
180
- transcripts or per-turn token usage to disk. Only Electron caches and debug
181
- logs are stored locally. Real session data lives server-side. Neither RepoSpend
182
- nor `ccusage` can report on Codex Desktop usage from local files alone.
186
+ For the detailed accounting model and comparison with `ccusage` and Tokscale,
187
+ see [docs/token-accounting.md](docs/token-accounting.md).
183
188
 
184
189
  ## What It Reads
185
190
 
186
- RepoSpend only reads local files. It does not edit Codex, Claude Code, or RTK
187
- data.
191
+ RepoSpend only reads local files. It does not edit Codex, Claude Code, Cursor, or
192
+ RTK data.
188
193
 
189
194
  Codex data:
190
195
 
@@ -209,6 +214,26 @@ reliable token/model data.
209
214
  Claude Code transcript files can contain prompt text, tool output, and file
210
215
  contents. RepoSpend keeps all scanning local.
211
216
 
217
+ Cursor data (experimental):
218
+
219
+ ```text
220
+ ~/.cursor/
221
+ ~/.cursor/chats/
222
+ ~/.cursor/projects/
223
+ ~/.cursor/projects/*/agent-transcripts/
224
+ ~/Library/Application Support/Cursor/User/globalStorage/state.vscdb
225
+ ~/Library/Application Support/Cursor/User/workspaceStorage/
226
+ ~/.config/Cursor/User/globalStorage/state.vscdb
227
+ ~/.config/Cursor/User/workspaceStorage/
228
+ %APPDATA%\Cursor\User\globalStorage\state.vscdb
229
+ %APPDATA%\Cursor\User\workspaceStorage\
230
+ ```
231
+
232
+ RepoSpend prioritizes Cursor JSONL transcripts, then searches local SQLite,
233
+ `.db`, and `.vscdb` files for chat/composer/agent-like JSON blobs. Unknown or
234
+ locked Cursor databases are skipped with warnings. Prompt and response text is
235
+ never uploaded.
236
+
212
237
  RepoSpend-owned settings:
213
238
 
214
239
  ```text
@@ -246,6 +271,7 @@ Most commands also accept a simple source filter:
246
271
  ```bash
247
272
  repospend by-repo --source codex
248
273
  repospend by-repo --source claude
274
+ repospend by-repo --source cursor
249
275
  repospend by-repo --source all
250
276
  ```
251
277
 
@@ -260,11 +286,34 @@ browser.
260
286
  token usage are shown when present in local JSONL files.
261
287
  - Claude Code sessions without local token details are shown with unknown
262
288
  tokens/cost.
289
+ - Cursor support is experimental: local transcript/session discovery is
290
+ best-effort, and Cursor may omit token/cost details or change local schemas.
263
291
  - Cost estimates do not represent subscription billing, credits, regional
264
292
  pricing, or account-specific terms.
265
- - Budget alerts are not active yet.
293
+ - Budget alerts are not available yet.
266
294
  - Some older sessions may not include full token, command, or prompt details.
267
295
  - RTK analytics appear only when local `rtk` data is available.
296
+ - On Windows, RepoSpend captures Codex **CLI** usage from `~/.codex/`. The Codex
297
+ **Desktop app** does not persist session transcripts or per-turn token usage to
298
+ disk; real session data lives server-side.
299
+
300
+ ## Troubleshooting Cursor Import
301
+
302
+ Cursor local files vary by version and surface. To inspect what exists locally:
303
+
304
+ ```bash
305
+ find ~/.cursor -type f | grep -E "jsonl|sqlite|db|vscdb|chat|transcript"
306
+ ls -la "$HOME/Library/Application Support/Cursor/User/globalStorage"
307
+ ls -la "$HOME/Library/Application Support/Cursor/User/workspaceStorage"
308
+ ```
309
+
310
+ On Linux, replace the `Library/Application Support` paths with
311
+ `$HOME/.config/Cursor/User/...`. On Windows, check
312
+ `%APPDATA%\Cursor\User\globalStorage` and `%APPDATA%\Cursor\User\workspaceStorage`.
313
+
314
+ If Cursor sessions import with unknown tokens or cost, that usually means the
315
+ local files did not include exact usage data. RepoSpend keeps the session visible
316
+ and avoids guessing.
268
317
 
269
318
  ## Develop
270
319