repospend 0.0.6 → 0.0.8

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,28 @@
2
2
 
3
3
  All notable changes to RepoSpend will be documented in this file.
4
4
 
5
+ ## 0.0.8
6
+
7
+ - Make `repospend serve` and `npx repospend` recover when the default localhost port is already in use by trying nearby ports instead of exiting with `EADDRINUSE`.
8
+ - Print a clear message when RepoSpend falls back from the requested port to the actual dashboard port.
9
+ - Add a Models view with per-model token shape, API-equivalent cost, cache reuse, top repo, latest activity, and one-click filter into Sessions.
10
+ - Reorder the Overview so the Top repositories and Waste signals panels appear higher on the page.
11
+ - Refresh the dashboard accent color from purple to teal across nav, KPI cards, and the metric timeline.
12
+ - Replace the Sessions page mini-stats with filter-aware totals (tokens, API-equivalent cost, sessions needing review, edits, commands).
13
+ - Make the filters bar scroll with the page instead of sticking to the top.
14
+ - Collapse the "How Agent Friction is classified" explainer into a disclosure to reduce vertical noise on the Agent Friction page.
15
+
16
+ ## 0.0.7
17
+
18
+ - 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.
19
+ - Include Cursor in source filters, dashboard source health, README data-source documentation, and CLI help.
20
+ - Track known vs. unknown-cost sessions in grouped breakdowns so mixed Cursor or Claude data does not hide partial cost coverage.
21
+ - 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.
22
+ - Improve Codex token aggregation by skipping duplicate or stale `last_token_usage` snapshots while preserving post-compaction token deltas.
23
+ - Refresh the dashboard IA and UI copy around "AI providers", "apps / surfaces", repo-or-folder grouping, quick actions, filter summaries, and Cursor usage links.
24
+ - Improve the local scan loading state with elapsed timing, staged scan context, source-level hints, and previous-scan context while refreshes are running.
25
+ - Ignore local `.codex/` files.
26
+
5
27
  ## 0.0.6
6
28
 
7
29
  - 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
41
66
 
42
- ## Good For
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 |
43
73
 
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
74
+ RepoSpend started as a Codex-first release. Claude Code and Cursor support are
75
+ newer and depend on what those tools persist locally.
49
76
 
50
- ## Screenshots
77
+ ## Requirements
51
78
 
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.
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
55
82
 
56
- ### Overview
83
+ RepoSpend uses `better-sqlite3`, so npm may install a native SQLite package for
84
+ your platform.
57
85
 
58
- ![RepoSpend overview dashboard with fictional Middle-earth usage data](docs/screenshots/dashboard-overview.png)
86
+ ## What It Shows
87
+
88
+ RepoSpend helps you break down local AI coding usage by:
89
+
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
+ ```
104
+
105
+ RepoSpend walks up to the Git root and shows them together as one
106
+ `RivendellRecords` project.
59
107
 
60
- The main dashboard summarizes AI coding tokens, API-equivalent cost, top repos,
61
- cache reuse, file edits, and command issue rate.
108
+ ## Screenshots
62
109
 
63
110
  ### Repositories
64
111
 
@@ -74,6 +121,13 @@ token intensity across projects.
74
121
  Repo detail explains why a project stands out, including cost concentration,
75
122
  warnings, token shape, sessions, and command signals.
76
123
 
124
+ ### Models
125
+
126
+ ![RepoSpend models view with fictional model usage and token shape](docs/screenshots/models-view.png)
127
+
128
+ The models view compares token shape, API-equivalent cost, cache reuse, sessions,
129
+ and repo concentration across the models used in the current scan.
130
+
77
131
  ### Sessions
78
132
 
79
133
  ![RepoSpend sessions table with fictional session titles](docs/screenshots/sessions-view.png)
@@ -95,49 +149,17 @@ commands, highlights, and issues to inspect.
95
149
  Agent Friction separates blocking command failures from harmless shell exits so
96
150
  high-token troubleshooting is easier to review.
97
151
 
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
152
  ## Privacy
132
153
 
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
154
+ RepoSpend is local-first. Everything the dashboard shows comes from files already
155
+ on your machine.
139
156
 
140
- Everything the dashboard shows comes from files already on your machine.
157
+ - No login or account required.
158
+ - No telemetry.
159
+ - No prompt or transcript uploads.
160
+ - It does not modify Codex, Claude Code, Cursor, or RTK files.
161
+ - It does not claim to match your subscription bill exactly.
162
+ - It does not read Codex Desktop server-side sessions that are not stored locally.
141
163
 
142
164
  ## Cost Estimates, Not Invoices
143
165
 
@@ -152,39 +174,29 @@ usage, account-level terms, provider changes, or other billing details. If you u
152
174
  Codex or Claude Code through a subscription, read the number as "what this token
153
175
  usage would roughly cost at API-style rates."
154
176
 
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.
177
+ Codex support is the most complete today. Claude Code and Cursor support depend
178
+ on what those tools store locally, so some sessions may show unknown tokens or
179
+ cost.
158
180
 
159
- ### Why RepoSpend's token totals can look lower than `ccusage`
181
+ ### Token Accounting
160
182
 
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.
183
+ RepoSpend uses normalized model-work totals:
164
184
 
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.
185
+ ```text
186
+ totalTokens = inputTokens + outputTokens + reasoningTokens
187
+ ```
174
188
 
175
- ### Codex Desktop on Windows
189
+ Cache reads and cache writes are kept as input sub-buckets and priced once. This
190
+ means RepoSpend token totals may look lower than tools that display cache
191
+ reads/writes as separate addable token columns.
176
192
 
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.
193
+ For the detailed accounting model and comparison with `ccusage` and Tokscale,
194
+ see [docs/token-accounting.md](docs/token-accounting.md).
183
195
 
184
196
  ## What It Reads
185
197
 
186
- RepoSpend only reads local files. It does not edit Codex, Claude Code, or RTK
187
- data.
198
+ RepoSpend only reads local files. It does not edit Codex, Claude Code, Cursor, or
199
+ RTK data.
188
200
 
189
201
  Codex data:
190
202
 
@@ -209,6 +221,26 @@ reliable token/model data.
209
221
  Claude Code transcript files can contain prompt text, tool output, and file
210
222
  contents. RepoSpend keeps all scanning local.
211
223
 
224
+ Cursor data (experimental):
225
+
226
+ ```text
227
+ ~/.cursor/
228
+ ~/.cursor/chats/
229
+ ~/.cursor/projects/
230
+ ~/.cursor/projects/*/agent-transcripts/
231
+ ~/Library/Application Support/Cursor/User/globalStorage/state.vscdb
232
+ ~/Library/Application Support/Cursor/User/workspaceStorage/
233
+ ~/.config/Cursor/User/globalStorage/state.vscdb
234
+ ~/.config/Cursor/User/workspaceStorage/
235
+ %APPDATA%\Cursor\User\globalStorage\state.vscdb
236
+ %APPDATA%\Cursor\User\workspaceStorage\
237
+ ```
238
+
239
+ RepoSpend prioritizes Cursor JSONL transcripts, then searches local SQLite,
240
+ `.db`, and `.vscdb` files for chat/composer/agent-like JSON blobs. Unknown or
241
+ locked Cursor databases are skipped with warnings. Prompt and response text is
242
+ never uploaded.
243
+
212
244
  RepoSpend-owned settings:
213
245
 
214
246
  ```text
@@ -246,6 +278,7 @@ Most commands also accept a simple source filter:
246
278
  ```bash
247
279
  repospend by-repo --source codex
248
280
  repospend by-repo --source claude
281
+ repospend by-repo --source cursor
249
282
  repospend by-repo --source all
250
283
  ```
251
284
 
@@ -260,11 +293,34 @@ browser.
260
293
  token usage are shown when present in local JSONL files.
261
294
  - Claude Code sessions without local token details are shown with unknown
262
295
  tokens/cost.
296
+ - Cursor support is experimental: local transcript/session discovery is
297
+ best-effort, and Cursor may omit token/cost details or change local schemas.
263
298
  - Cost estimates do not represent subscription billing, credits, regional
264
299
  pricing, or account-specific terms.
265
- - Budget alerts are not active yet.
300
+ - Budget alerts are not available yet.
266
301
  - Some older sessions may not include full token, command, or prompt details.
267
302
  - RTK analytics appear only when local `rtk` data is available.
303
+ - On Windows, RepoSpend captures Codex **CLI** usage from `~/.codex/`. The Codex
304
+ **Desktop app** does not persist session transcripts or per-turn token usage to
305
+ disk; real session data lives server-side.
306
+
307
+ ## Troubleshooting Cursor Import
308
+
309
+ Cursor local files vary by version and surface. To inspect what exists locally:
310
+
311
+ ```bash
312
+ find ~/.cursor -type f | grep -E "jsonl|sqlite|db|vscdb|chat|transcript"
313
+ ls -la "$HOME/Library/Application Support/Cursor/User/globalStorage"
314
+ ls -la "$HOME/Library/Application Support/Cursor/User/workspaceStorage"
315
+ ```
316
+
317
+ On Linux, replace the `Library/Application Support` paths with
318
+ `$HOME/.config/Cursor/User/...`. On Windows, check
319
+ `%APPDATA%\Cursor\User\globalStorage` and `%APPDATA%\Cursor\User\workspaceStorage`.
320
+
321
+ If Cursor sessions import with unknown tokens or cost, that usually means the
322
+ local files did not include exact usage data. RepoSpend keeps the session visible
323
+ and avoids guessing.
268
324
 
269
325
  ## Develop
270
326