repospend 0.0.8 → 0.1.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/CHANGELOG.md CHANGED
@@ -2,6 +2,37 @@
2
2
 
3
3
  All notable changes to RepoSpend will be documented in this file.
4
4
 
5
+ ## 0.1.0
6
+
7
+ - Add GitHub Copilot support for local OTEL exports, Copilot session-state files, and VS Code Copilot Chat transcript/debug files, leaving cost unknown when local data lacks full token splits.
8
+ - Add Copilot source status, labels, settings metrics, quick links, tests, API-equivalent model pricing aliases, and VS Code model metadata recovery.
9
+ - Add Claude service-tier metadata and Codex current-config service-tier visibility in the dashboard cost summary and settings.
10
+ - Add a Data Doctor confidence report in the dashboard, Settings, and `repospend doctor`, covering token coverage, pricing coverage, repo verification, parser issues, source warnings, and empty-data states.
11
+ - Add pricing-gap triage in Settings and Usage Health, with one-click review of unpriced token-bearing sessions and clearer separation between missing model rates and missing token detail.
12
+ - Add bundled Claude Opus 4.8 pricing and inherited pricing labels for nearby newer Claude and GPT model IDs when an exact local rate is not present.
13
+ - Improve dashboard scanability by simplifying the Overview, promoting "Start here" actions, normalizing compact number/model labels, cleaning noisy markdown session titles, and adding a Sessions cost-outlier legend.
14
+ - Improve Agent Friction by treating command failures as triage evidence, routing review actions directly to command evidence, and avoiding false positives from source text or HTTP-style status codes.
15
+ - Add dashboard-style filters to CLI summaries and exports, and apply API export filters consistently across JSON and CSV.
16
+ - Harden localhost settings/cache mutations with Host and Origin checks for local API writes.
17
+ - Remove unused budget configuration and UI/documentation copy so old budget fields are intentionally dropped on the next config save.
18
+ - Improve README, package metadata, AI-readable docs, and dashboard screenshots for repo-level AI coding usage discovery while keeping Cursor experimental and RTK framed as token-reduction workflow context.
19
+ - Move detailed source paths and Cursor troubleshooting into `docs/data-sources.md`, and publish the linked docs with the npm package.
20
+ - Raise the Vite chunk warning threshold to match the current local dashboard bundle size.
21
+
22
+ ## 0.0.9
23
+
24
+ - Cache parsed Codex session summaries under `~/.repospend/cache` so unchanged large transcripts reload much faster.
25
+ - Limit local source scanning to the active dashboard date window when possible, reducing default last-7-days scan work.
26
+ - Warm a bounded last-30-days cache in the background after the default last-7-days dashboard loads, without auto-scanning all-time history.
27
+ - Make refresh/rescan/retry actions clear RepoSpend's parse cache before reloading local logs.
28
+ - Add an Advanced settings action to clear only the parse cache and reload without deleting pricing or source settings.
29
+ - Keep demo mode from reading, warming, or clearing the real local parse cache.
30
+ - Make experimental Cursor support opt-in so default scans and dashboard surfaces stay focused on Codex and Claude Code unless Cursor is explicitly enabled in Settings.
31
+ - Add a local Data Sources setting for enabling Cursor, with copy explaining that reliable Cursor tokens, model names, and costs are often unavailable from local transcript files alone.
32
+ - Hide Cursor quick links, loading-state rows, and status copy while the experimental Cursor source is disabled.
33
+ - Improve Cursor CLI metadata recovery by inferring transcript dates and repo paths from Cursor's local project/transcript paths when records omit timestamp or cwd fields.
34
+ - Avoid an unnecessary standalone Codex session pass for sessions already imported from the Codex SQLite thread index.
35
+
5
36
  ## 0.0.8
6
37
 
7
38
  - 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`.
package/README.md CHANGED
@@ -1,18 +1,23 @@
1
1
  # RepoSpend
2
2
 
3
+ RepoSpend is a local-first dashboard for tracking AI coding token usage and API-equivalent spend by repository, session, model, and tool. It supports local Codex, Claude Code, and GitHub Copilot usage data, runs with `npx repospend`, and does not upload prompts, code, transcripts, or usage data.
4
+
3
5
  [![npm version](https://img.shields.io/npm/v/repospend)](https://www.npmjs.com/package/repospend)
4
6
  [![npm downloads](https://img.shields.io/npm/dm/repospend)](https://www.npmjs.com/package/repospend)
5
7
  [![license](https://img.shields.io/npm/l/repospend)](./LICENSE)
6
8
  [![node](https://img.shields.io/node/v/repospend)](https://www.npmjs.com/package/repospend)
7
9
  [![CI](https://github.com/mehmetdemircs/RepoSpend/actions/workflows/ci.yml/badge.svg)](https://github.com/mehmetdemircs/RepoSpend/actions/workflows/ci.yml)
8
10
 
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
+ RepoSpend turns local AI coding usage data into a repo-level cost dashboard, so
12
+ developers can see which projects, sessions, models, and tools are driving token
13
+ usage and estimated API-equivalent cost.
11
14
 
12
- It reads supported local usage files in read-only mode and groups sessions by Git
13
- repo.
15
+ Project links:
14
16
 
15
- No login. No telemetry. No prompt uploads.
17
+ - Website: [https://repospend.com](https://repospend.com)
18
+ - GitHub: [https://github.com/mehmetdemircs/RepoSpend](https://github.com/mehmetdemircs/RepoSpend)
19
+ - npm package: [`repospend`](https://www.npmjs.com/package/repospend)
20
+ - AI-readable summary: [docs/llms.txt](docs/llms.txt)
16
21
 
17
22
  ```bash
18
23
  npx repospend
@@ -21,6 +26,13 @@ npx repospend
21
26
  RepoSpend opens a local dashboard, usually at
22
27
  [http://localhost:2005](http://localhost:2005).
23
28
 
29
+ Best for developers who want to:
30
+
31
+ - see which repositories are driving AI coding usage
32
+ - compare Codex, Claude Code, and GitHub Copilot usage locally
33
+ - inspect expensive sessions without uploading prompts or code
34
+ - understand token shape, cache reuse, model mix, and agent friction
35
+
24
36
  ## Preview
25
37
 
26
38
  ![RepoSpend overview dashboard with fictional Middle-earth usage data](docs/screenshots/dashboard-overview.png)
@@ -29,16 +41,32 @@ Screenshots use fictional Middle-earth demo data. The Lord of the Rings themed
29
41
  repo names, sessions, prompts, token counts, and costs are intentional; no private
30
42
  repository data is shown.
31
43
 
44
+ ## What is RepoSpend?
45
+
46
+ RepoSpend is a local-first AI coding spend dashboard for developers and teams
47
+ who want to understand usage by repository instead of only by account, day, or
48
+ tool. It reads supported local files in read-only mode, normalizes them into
49
+ sessions, and groups them by Git repository.
50
+
51
+ Use it to inspect Codex token usage, Claude Code token usage by repo, GitHub
52
+ Copilot local usage data, model mix, cache reuse, and the sessions behind high
53
+ estimated API-equivalent spend.
54
+
32
55
  ## Why RepoSpend?
33
56
 
34
- AI coding tools are powerful, but it is hard to see where the usage goes.
57
+ AI coding tools are powerful, but it is hard to see which repo, session, model,
58
+ or workflow is responsible for the usage.
35
59
 
36
- RepoSpend helps answer:
60
+ RepoSpend helps answer practical questions:
37
61
 
38
62
  - Which repo is using the most tokens?
39
63
  - Which sessions were unusually expensive?
40
64
  - Which model or tool generated the spend?
65
+ - What token shape drove the cost: input, cached input, output, or reasoning?
66
+ - Are cache reads reducing repeated input work?
67
+ - Is spend concentrated in one model, one repo, or one day?
41
68
  - Where did the agent get stuck retrying commands?
69
+ - Which sessions should be exported or reviewed later?
42
70
  - How much would this usage roughly cost at API-style rates?
43
71
 
44
72
  Everything stays local.
@@ -68,17 +96,22 @@ prints the dashboard URL. By default it runs at
68
96
  |---|---|---|
69
97
  | Codex | Most complete support | Tokens, models, sessions, repo grouping, command friction |
70
98
  | 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 |
99
+ | GitHub Copilot | Initial support | Copilot CLI OTEL exports, Copilot CLI session state, and VS Code Copilot Chat transcripts; costs only when local data includes full token splits |
100
+ | Cursor | Experimental opt-in | Local JSONL and SQLite/vscdb discovery; tokens/cost only when local data includes them |
101
+ | RTK | Token reduction workflow | Not an AI model or coding assistant; shown by default as workflow context for reducing token waste |
73
102
 
74
- RepoSpend started as a Codex-first release. Claude Code and Cursor support are
75
- newer and depend on what those tools persist locally.
103
+ RepoSpend started as a Codex-first release. Claude Code support is newer, and
104
+ GitHub Copilot support is newest. Cursor is off by default because accurate
105
+ Cursor token usage often requires account-backed usage data rather than local
106
+ files alone.
76
107
 
77
108
  ## Requirements
78
109
 
79
110
  - Node.js `20` or newer
80
111
  - macOS, Linux, or Windows
81
- - Local Codex, Claude Code, Cursor, or RTK data, depending on what you want to inspect
112
+ - Local Codex, Claude Code, or GitHub Copilot data for usage analytics
113
+ - Optional RTK data if you want token-reduction workflow context
114
+ - Cursor data only if you enable experimental Cursor import
82
115
 
83
116
  RepoSpend uses `better-sqlite3`, so npm may install a native SQLite package for
84
117
  your platform.
@@ -87,23 +120,12 @@ your platform.
87
120
 
88
121
  RepoSpend helps you break down local AI coding usage by:
89
122
 
90
- - repo
91
- - session
92
- - day and hour
93
- - model
94
- - source/tool and app/surface, where detectable
95
- - token type
123
+ - repo, session, day, and hour
124
+ - model, source/tool, and app/surface where detectable
125
+ - input, cached input, output, and reasoning token shape
96
126
  - estimated API-equivalent cost
97
127
 
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.
128
+ Nested paths are grouped by Git root so usage rolls up to the repository.
107
129
 
108
130
  ## Screenshots
109
131
 
@@ -111,43 +133,37 @@ RepoSpend walks up to the Git root and shows them together as one
111
133
 
112
134
  ![RepoSpend repositories table with fictional repo usage](docs/screenshots/repos-view.png)
113
135
 
114
- The repos view compares spend, tokens, sessions, cache hit rate, file edits, and
115
- token intensity across projects.
136
+ Compare spend, tokens, sessions, cache hit rate, file edits, and token intensity.
116
137
 
117
138
  ### Repository Detail
118
139
 
119
140
  ![RepoSpend repository detail for one-ring-infra](docs/screenshots/repo-detail.png)
120
141
 
121
- Repo detail explains why a project stands out, including cost concentration,
122
- warnings, token shape, sessions, and command signals.
142
+ Inspect cost concentration, warnings, token shape, sessions, and command signals.
123
143
 
124
144
  ### Models
125
145
 
126
146
  ![RepoSpend models view with fictional model usage and token shape](docs/screenshots/models-view.png)
127
147
 
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.
148
+ Compare token shape, API-equivalent cost, cache reuse, and repo concentration.
130
149
 
131
150
  ### Sessions
132
151
 
133
152
  ![RepoSpend sessions table with fictional session titles](docs/screenshots/sessions-view.png)
134
153
 
135
- The sessions view makes individual AI coding runs searchable and sortable by
136
- repo, tool, model, outcome, cost, tokens, and activity.
154
+ Search and sort individual AI coding runs by repo, tool, model, cost, and tokens.
137
155
 
138
156
  ### Session Detail
139
157
 
140
158
  ![RepoSpend session detail for a fictional palantir event stream fix](docs/screenshots/session-detail.png)
141
159
 
142
- Session detail shows the shape of one run: cost, tokens, model, file edits,
143
- commands, highlights, and issues to inspect.
160
+ Review one run's cost, tokens, model, file edits, commands, and issues.
144
161
 
145
162
  ### Agent Friction
146
163
 
147
164
  ![RepoSpend agent friction screen with fictional command issue signals](docs/screenshots/agent-friction.png)
148
165
 
149
- Agent Friction separates blocking command failures from harmless shell exits so
150
- high-token troubleshooting is easier to review.
166
+ Separate blocking command failures from harmless shell exits.
151
167
 
152
168
  ## Privacy
153
169
 
@@ -157,7 +173,7 @@ on your machine.
157
173
  - No login or account required.
158
174
  - No telemetry.
159
175
  - No prompt or transcript uploads.
160
- - It does not modify Codex, Claude Code, Cursor, or RTK files.
176
+ - It does not modify Codex, Claude Code, GitHub Copilot, Cursor, or RTK files.
161
177
  - It does not claim to match your subscription bill exactly.
162
178
  - It does not read Codex Desktop server-side sessions that are not stored locally.
163
179
 
@@ -165,18 +181,12 @@ on your machine.
165
181
 
166
182
  RepoSpend shows **API-equivalent cost**.
167
183
 
168
- That means it estimates cost from local token counts and the pricing assumptions
169
- stored in RepoSpend. It is useful for comparing repos and sessions, but it is not
170
- an invoice.
184
+ RepoSpend estimates cost from local token counts and local pricing assumptions.
185
+ It is useful for comparing repos and sessions, but it is not an invoice. Actual
186
+ cost can differ because of subscriptions, credits, included usage, account terms,
187
+ provider changes, or missing local token data.
171
188
 
172
- Your actual cost may be different because of subscriptions, credits, included
173
- usage, account-level terms, provider changes, or other billing details. If you use
174
- Codex or Claude Code through a subscription, read the number as "what this token
175
- usage would roughly cost at API-style rates."
176
-
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.
189
+ For pricing details, see [docs/pricing.md](docs/pricing.md).
180
190
 
181
191
  ### Token Accounting
182
192
 
@@ -193,64 +203,84 @@ reads/writes as separate addable token columns.
193
203
  For the detailed accounting model and comparison with `ccusage` and Tokscale,
194
204
  see [docs/token-accounting.md](docs/token-accounting.md).
195
205
 
196
- ## What It Reads
206
+ ## Data Sources
197
207
 
198
- RepoSpend only reads local files. It does not edit Codex, Claude Code, Cursor, or
199
- RTK data.
208
+ RepoSpend only reads local files. It does not edit Codex, Claude Code, GitHub
209
+ Copilot, Cursor, or RTK data.
200
210
 
201
- Codex data:
211
+ | Source | What RepoSpend reads | Notes |
212
+ |---|---|---|
213
+ | Codex | Local CLI state and session files | Most complete token, model, repo, session, and command-friction support |
214
+ | Claude Code | Local project and session JSONL files | Tokens and models are shown when present in local transcripts |
215
+ | GitHub Copilot | Local OTEL exports, session-state, and VS Code Copilot Chat files | Full cost requires local input/cache/output token splits |
216
+ | Cursor | Experimental local transcript/database discovery | Off by default; local files vary and often omit exact token/cost data |
217
+ | RTK | Local workflow context | Not an AI token source; helps explain token-reduction practices |
202
218
 
203
- ```text
204
- ~/.codex/state_5.sqlite
205
- ~/.codex/sessions
206
- ```
219
+ Detailed paths, source-specific behavior, and Cursor troubleshooting live in
220
+ [docs/data-sources.md](docs/data-sources.md).
207
221
 
208
- Claude Code data:
222
+ RepoSpend-owned settings live under `~/.repospend/`, including pricing overrides,
223
+ local app settings, and the parse cache.
209
224
 
210
- ```text
211
- ~/.claude/projects
212
- ~/.config/claude/projects
213
- ~/Library/Application Support/Claude/local-agent-mode-sessions
214
- ~/.config/Claude/local-agent-mode-sessions
215
- ```
225
+ ## FAQ
216
226
 
217
- RepoSpend also checks `~/.claude/history.jsonl` for source status, but does not
218
- import history-only entries into usage analytics because they do not contain
219
- reliable token/model data.
227
+ ### What is RepoSpend?
220
228
 
221
- Claude Code transcript files can contain prompt text, tool output, and file
222
- contents. RepoSpend keeps all scanning local.
229
+ RepoSpend is a local-first dashboard for tracking AI coding token usage and
230
+ API-equivalent spend by repository, session, model, and tool.
223
231
 
224
- Cursor data (experimental):
232
+ ### Does RepoSpend upload prompts or code?
225
233
 
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
- ```
234
+ No. RepoSpend runs locally, reads supported client files in read-only mode, and
235
+ does not upload prompts, code, transcripts, or usage data.
238
236
 
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.
237
+ ### Which tools does RepoSpend support?
243
238
 
244
- RepoSpend-owned settings:
239
+ RepoSpend tracks local usage from Codex, Claude Code, and GitHub Copilot. Cursor
240
+ import is experimental and opt-in. RTK can appear as workflow context for
241
+ token-reduction signals, but it is not an AI model or coding assistant. Support
242
+ depth depends on what each tool stores locally; Codex is currently the most
243
+ complete path.
245
244
 
246
- ```text
247
- ~/.repospend/pricing.json
248
- ~/.repospend/config.json
245
+ ### How do I run RepoSpend?
246
+
247
+ Run it with:
248
+
249
+ ```bash
250
+ npx repospend
249
251
  ```
250
252
 
251
- The Settings page includes a reset action for RepoSpend-owned files under
252
- `~/.repospend/`. It does not delete or edit anything under `~/.codex` or
253
- `~/.claude`.
253
+ RepoSpend starts a localhost dashboard, usually at
254
+ [http://localhost:2005](http://localhost:2005).
255
+
256
+ ### How is RepoSpend different from ccusage?
257
+
258
+ `ccusage` is excellent for Claude Code usage totals and terminal reporting.
259
+ RepoSpend is a visual, repo-first dashboard across multiple AI coding tools. It
260
+ focuses on repository grouping, session inspection, model mix, token shape,
261
+ cache reuse, exports, and command/agent friction signals.
262
+
263
+ ### Is RepoSpend open source?
264
+
265
+ Yes. RepoSpend is open source under the Apache-2.0 license. The GitHub repository
266
+ is [mehmetdemircs/RepoSpend](https://github.com/mehmetdemircs/RepoSpend).
267
+
268
+ ## Compared With Other Usage Tools
269
+
270
+ RepoSpend is complementary to command-line usage tools such as `ccusage` and
271
+ generic Claude Code usage monitors.
272
+
273
+ Use `ccusage` when you want fast Claude Code totals, daily breakdowns, or a CLI
274
+ view that is close to Claude Code's local usage files. Use RepoSpend when you
275
+ want a local dashboard that compares AI coding usage across repos, sessions,
276
+ models, and tools.
277
+
278
+ Generic Claude Code monitors usually focus on one source. RepoSpend is designed
279
+ as a repo-level AI coding cost tracker: it brings together local Codex, Claude
280
+ Code, and GitHub Copilot data, includes experimental Cursor imports when enabled,
281
+ and can show optional RTK workflow context for token-reduction signals. The
282
+ dashboard then explains the token shape and sessions behind the estimated
283
+ API-equivalent spend.
254
284
 
255
285
  ## Commands
256
286
 
@@ -264,6 +294,7 @@ There are also a few terminal-friendly commands:
264
294
 
265
295
  ```bash
266
296
  repospend scan
297
+ repospend doctor
267
298
  repospend by-repo
268
299
  repospend by-day
269
300
  repospend by-hour
@@ -273,13 +304,12 @@ repospend export --format json
273
304
  repospend export --format csv
274
305
  ```
275
306
 
276
- Most commands also accept a simple source filter:
307
+ Most commands also accept dashboard-style filters:
277
308
 
278
309
  ```bash
279
- repospend by-repo --source codex
280
- repospend by-repo --source claude
281
- repospend by-repo --source cursor
282
- repospend by-repo --source all
310
+ repospend by-repo --source codex # codex, claude, copilot, cursor, all
311
+ repospend export --format csv --repo my-app --from 2026-05-01 --to 2026-05-29
312
+ repospend doctor --model gpt-5-codex --sourceApp "VS Code"
283
313
  ```
284
314
 
285
315
  Use `REPOSPEND_NO_OPEN=1 repospend` if you want the URL printed without opening a
@@ -293,35 +323,18 @@ browser.
293
323
  token usage are shown when present in local JSONL files.
294
324
  - Claude Code sessions without local token details are shown with unknown
295
325
  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.
326
+ - Cursor support is experimental and off by default: local transcript/session
327
+ discovery is best-effort, and Cursor may omit token/cost details or change
328
+ local schemas.
298
329
  - Cost estimates do not represent subscription billing, credits, regional
299
330
  pricing, or account-specific terms.
300
- - Budget alerts are not available yet.
301
331
  - Some older sessions may not include full token, command, or prompt details.
302
- - RTK analytics appear only when local `rtk` data is available.
332
+ - RTK is workflow context, not an AI token source; it helps explain token-reduction
333
+ practices alongside AI usage.
303
334
  - On Windows, RepoSpend captures Codex **CLI** usage from `~/.codex/`. The Codex
304
335
  **Desktop app** does not persist session transcripts or per-turn token usage to
305
336
  disk; real session data lives server-side.
306
337
 
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.
324
-
325
338
  ## Develop
326
339
 
327
340
  From source: