repospend 0.0.5 → 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,28 @@
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
+
17
+ ## 0.0.6
18
+
19
+ - Improve Codex session metadata recovery from rollout logs, including standalone Codex Desktop sessions and imported Claude model metadata.
20
+ - Add an optional source-scoped app display mode so shared surfaces can be shown as source-specific entries such as "Codex on VS Code".
21
+ - Improve sparse timeline charts and RTK unavailable-state guidance in the dashboard.
22
+ - Document why RepoSpend token totals can differ from `ccusage` while API-equivalent costs still match.
23
+ - Show a git-branch icon next to repos with a confirmed git root and a folder icon for path-inferred repos, giving a quick visual signal of data confidence.
24
+ - Fix Windows extended-length path prefix (\\?\) handling in git root detection, which caused repos on Windows to incorrectly appear as unverified.
25
+
26
+
5
27
  ## 0.0.5
6
28
 
7
29
  - Fix Codex token under-count on long sessions by summing per-turn `last_token_usage` instead of taking the max of `total_token_usage`, which Codex resets on each context compaction.
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:
59
99
 
60
- The main dashboard summarizes AI coding tokens, API-equivalent cost, top repos,
61
- cache reuse, file edits, and command issue rate.
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.
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,14 +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.
173
+
174
+ ### Token Accounting
175
+
176
+ RepoSpend uses normalized model-work totals:
177
+
178
+ ```text
179
+ totalTokens = inputTokens + outputTokens + reasoningTokens
180
+ ```
181
+
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.
185
+
186
+ For the detailed accounting model and comparison with `ccusage` and Tokscale,
187
+ see [docs/token-accounting.md](docs/token-accounting.md).
158
188
 
159
189
  ## What It Reads
160
190
 
161
- RepoSpend only reads local files. It does not edit Codex, Claude Code, or RTK
162
- data.
191
+ RepoSpend only reads local files. It does not edit Codex, Claude Code, Cursor, or
192
+ RTK data.
163
193
 
164
194
  Codex data:
165
195
 
@@ -184,6 +214,26 @@ reliable token/model data.
184
214
  Claude Code transcript files can contain prompt text, tool output, and file
185
215
  contents. RepoSpend keeps all scanning local.
186
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
+
187
237
  RepoSpend-owned settings:
188
238
 
189
239
  ```text
@@ -221,6 +271,7 @@ Most commands also accept a simple source filter:
221
271
  ```bash
222
272
  repospend by-repo --source codex
223
273
  repospend by-repo --source claude
274
+ repospend by-repo --source cursor
224
275
  repospend by-repo --source all
225
276
  ```
226
277
 
@@ -235,11 +286,34 @@ browser.
235
286
  token usage are shown when present in local JSONL files.
236
287
  - Claude Code sessions without local token details are shown with unknown
237
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.
238
291
  - Cost estimates do not represent subscription billing, credits, regional
239
292
  pricing, or account-specific terms.
240
- - Budget alerts are not active yet.
293
+ - Budget alerts are not available yet.
241
294
  - Some older sessions may not include full token, command, or prompt details.
242
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.
243
317
 
244
318
  ## Develop
245
319