Skip to content

Commit 9a9957f

Browse files
committed
Release v1.2.1
Patch release. VS Code extension is now self-contained for marketplace users: Python sources bundled inside the .vsix, only dependency is Python 3.8+ on PATH. Adds auto-start, workspace folder discovery, platform-aware error messages, dedicated extension README, real icon, two screenshots. Triage and verification: Claude Code & Codex collab.
2 parents 3d375a9 + ad05701 commit 9a9957f

17 files changed

Lines changed: 433 additions & 37 deletions

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## v1.2.1 — 2026-05-29
4+
5+
### Extension
6+
7+
- Bundle the Python sources (`cli.py`, `scanner.py`, `dashboard.py`) inside the `.vsix` so the extension works standalone — the only end-user dependency is Python 3.8+ on `PATH`. The `vscode:prepublish` script copies the files from the repo root at package time, so each extension version embeds the matching Python snapshot.
8+
- Auto-start the dashboard when the user clicks the sidebar icon (no Command Palette step needed). `DashboardSidebar` accepts an `onShow` callback wired to `openDashboard()`; in-flight startup coalescing on the host side keeps clicks idempotent.
9+
- Discover `cli.py` in any open VS Code workspace folder — covers the "cloned the repo into c:\github\claude-usage and opened it in VS Code" case that the original monorepo-sibling fallback couldn't reach for installed extensions.
10+
- Platform-aware error messages: missing-Python guidance now leads with the right install command (python.org installer on Windows with the "Add to PATH" reminder; `brew install python` on macOS; distro package manager on Linux). The Homebrew suggestion is hidden on Windows.
11+
- Add a dedicated [vscode-extension/README.md](vscode-extension/README.md) for the marketplace listing.
12+
- Real gauge icon shipped (was a placeholder).
13+
- 4 new install-mode tests for bundled discovery + ordering; 4 sidebar tests for the auto-start callback. Total extension test count: 74.
14+
315
## v1.2.0 — 2026-05-29
416

517
### Distribution

README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,6 @@ cd claude-usage
6060
python cli.py dashboard
6161
```
6262

63-
### VS Code extension
64-
65-
The dashboard also runs as a VS Code extension that lives in the activity-bar sidebar — no separate browser tab needed.
66-
67-
```
68-
git clone https://github.com/phuryn/claude-usage
69-
cd claude-usage/vscode-extension
70-
./scripts/install.sh # macOS / Linux / WSL
71-
.\scripts\install.ps1 # Windows
72-
```
73-
74-
The extension auto-discovers `claude-usage` on `PATH` (Homebrew users get it for free) or the repo's `cli.py` (clone users). Open via Command Palette → **Claude Usage: Open Dashboard**. See [vscode-extension/](vscode-extension/) for details.
7563

7664
---
7765

@@ -140,6 +128,21 @@ Costs are calculated using **Anthropic API pricing as of April 2026** ([claude.c
140128
141129
---
142130

131+
## VS Code extension
132+
133+
If you'd rather see the dashboard inside your editor, the same UI is available as a VS Code extension. Same data, same charts, embedded as an activity-bar sidebar.
134+
135+
[**Install from the VS Code Marketplace →**](https://marketplace.visualstudio.com/items?itemName=PawelHuryn.claude-usage-phuryn)
136+
137+
![VS Code extension — daily usage](docs/usage1.png)
138+
![VS Code extension — hourly + projects](docs/usage2.png)
139+
140+
The Python sources are bundled inside the `.vsix`, so the only end-user requirement is **Python 3.8+ on your `PATH`**. After install, click the gauge icon in the activity bar — the server spawns automatically and the dashboard renders in the sidebar.
141+
142+
See [vscode-extension/README.md](vscode-extension/README.md) for settings, commands, discovery order, and local-install instructions.
143+
144+
---
145+
143146
## Files
144147

145148
| File | Purpose |

docs/usage1.png

405 KB
Loading

docs/usage2.png

555 KB
Loading

vscode-extension/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ node_modules/
22
out/
33
*.vsix
44
.vscode-test/
5+
# Generated at package time by scripts/copy-python.js — the .py snapshot
6+
# that ships in the .vsix. One source of truth (repo root) → reproducible.
7+
python/

vscode-extension/.vscodeignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ out/**/*.map
99
*.vsix
1010
tsconfig.json
1111
vitest.config.ts
12+
# Bigger source-of-truth icon kept in-repo for marketplace listing / refs;
13+
# the runtime extension only needs resources/icon.png.
14+
resources/icon_large.png

vscode-extension/README.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Claude Code Usage — VS Code extension
2+
3+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](LICENSE.txt)
4+
5+
**See your Claude Code usage — tokens, costs, sessions, projects — right inside VS Code.**
6+
7+
![Daily usage view](https://raw.githubusercontent.com/phuryn/claude-usage/main/docs/usage1.png)
8+
9+
The extension reads your local Claude Code JSONL transcripts (the ones Claude Code already writes regardless of plan) and renders the same dashboard the Python tool ships, embedded as a VS Code sidebar. No API calls, no telemetry — all data stays on your machine.
10+
11+
Works on **API, Pro, and Max plans**. Captures usage from the Claude Code CLI, the official VS Code extension, and dispatched Code sessions.
12+
13+
---
14+
15+
## Install
16+
17+
### From the VS Code Marketplace
18+
19+
Search the Extensions sidebar for **"Claude Code Usage"** (publisher: `PawelHuryn`), or open the marketplace link from the Open VSX page.
20+
21+
### From a `.vsix` file (local install)
22+
23+
```
24+
git clone https://github.com/phuryn/claude-usage
25+
cd claude-usage/vscode-extension
26+
./scripts/install.sh # macOS / Linux / WSL
27+
.\scripts\install.ps1 # Windows PowerShell
28+
```
29+
30+
The scripts run `vsce package` then `code --install-extension` against your local VS Code install.
31+
32+
---
33+
34+
## Requirements
35+
36+
- **Python 3.8 or newer on your `PATH`.** Almost everyone running Claude Code already has Python installed; if not, see [python.org/downloads](https://www.python.org/downloads/). On Windows make sure to check **"Add Python to PATH"** during the installer.
37+
38+
That's the only dependency. The Python sources (`cli.py`, `scanner.py`, `dashboard.py`) are bundled inside the extension — no separate clone or Homebrew install needed.
39+
40+
---
41+
42+
## Usage
43+
44+
1. Click the **gauge icon** in the activity bar (left sidebar of VS Code).
45+
2. The extension starts the dashboard server on a free local port and embeds it in a sidebar webview.
46+
3. Filter by model, range, or project — same UI as the standalone web dashboard.
47+
48+
![Hourly + project breakdown](https://raw.githubusercontent.com/phuryn/claude-usage/main/docs/usage2.png)
49+
50+
### Commands
51+
52+
Open the Command Palette (`Ctrl+Shift+P` / `Cmd+Shift+P`):
53+
54+
| Command | What it does |
55+
|---|---|
56+
| **Claude Usage: Open Dashboard** | Reveal the sidebar and start the server (also fires automatically when you click the activity-bar icon) |
57+
| **Claude Usage: Rescan Transcripts** | Refresh the iframe; the dashboard's own Rescan button triggers a full DB rebuild |
58+
| **Claude Usage: Restart Server** | Kill and respawn the Python process (use after changing settings) |
59+
| **Claude Usage: Show Logs** | Open the extension's output channel — useful when something doesn't work |
60+
61+
### Settings
62+
63+
| Setting | Default | Description |
64+
|---|---|---|
65+
| `claudeUsage.pythonPath` | _(auto-discover)_ | Path to a Python 3.8+ interpreter. Leave empty to auto-detect (`claude-usage` on PATH first, then `python3`, then `python`). |
66+
| `claudeUsage.cliPath` | _(bundled)_ | Path to a custom `cli.py` (or its parent directory). Empty = use the bundled copy that ships with the extension. |
67+
| `claudeUsage.port` | `0` | Port for the local dashboard server. `0` = OS picks a free one. |
68+
69+
---
70+
71+
## How discovery works
72+
73+
When you click the icon, the extension resolves how to run the dashboard in this order:
74+
75+
1. **`claudeUsage.cliPath` setting** if you've set one
76+
2. **The bundled `python/cli.py`** that ships inside this `.vsix` (most installs hit this)
77+
3. The `claude-usage` shim on `PATH` (if you installed via Homebrew)
78+
4. A `cli.py` in any open VS Code workspace folder (the legacy "open the cloned repo" path)
79+
5. A sibling `cli.py` from the extension dir (dev mode, when running from source via F5)
80+
81+
If none of those find anything, you'll get a friendly message in the sidebar — most often "Python 3.8+ is required" with a platform-specific install hint.
82+
83+
---
84+
85+
## Privacy
86+
87+
The extension only:
88+
- Reads local JSONL transcripts from `~/.claude/projects/` (and the Xcode coding-assistant directory on macOS, if present)
89+
- Runs a small HTTP server bound to `127.0.0.1` (localhost-only — never `0.0.0.0`) on a port the OS picks for you
90+
- Embeds that server's dashboard in a VS Code webview
91+
92+
No data leaves your machine. No API calls. No telemetry.
93+
94+
---
95+
96+
## Troubleshooting
97+
98+
- **"Python 3.8 or newer required"** — install from [python.org](https://www.python.org/downloads/) and reload VS Code (`Ctrl+Shift+P``Developer: Reload Window`). On Windows make sure "Add Python to PATH" is checked in the installer.
99+
- **Sidebar stays blank or shows "starting…"** — run `Claude Usage: Show Logs`. The extension logs the resolved Python path, the install mode, the spawn command, and any stdout/stderr from the server.
100+
- **Dashboard renders but shows "No usage recorded"** — Claude Code hasn't written transcripts to `~/.claude/projects/` yet. Run a Claude Code session first.
101+
102+
---
103+
104+
## Source
105+
106+
The Python tool, this extension, and a Homebrew formula all live at [github.com/phuryn/claude-usage](https://github.com/phuryn/claude-usage). Bug reports and feature discussions: [Issues](https://github.com/phuryn/claude-usage/issues), [Discussions](https://github.com/phuryn/claude-usage/discussions).
107+
108+
**Made by** [The Product Compass Newsletter](https://www.productcompass.pm).

vscode-extension/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "claude-usage-phuryn",
33
"displayName": "Claude Code Usage",
44
"description": "Embed your Claude Code usage dashboard (token counts, costs, sessions, projects) directly inside VS Code. Reads local JSONL transcripts, no API calls.",
5-
"version": "1.2.0",
5+
"version": "1.2.1",
66
"publisher": "PawelHuryn",
77
"author": {
88
"name": "Paweł Huryn",
@@ -92,7 +92,8 @@
9292
}
9393
},
9494
"scripts": {
95-
"vscode:prepublish": "tsc -p .",
95+
"copy-python": "node scripts/copy-python.js",
96+
"vscode:prepublish": "npm run copy-python && tsc -p .",
9697
"compile": "tsc -p .",
9798
"watch": "tsc -p . -w",
9899
"test": "vitest run",
55.3 KB
Loading

0 commit comments

Comments
 (0)