Skip to content

Commit 9aafa40

Browse files
fricobenclaude
andauthored
feat(cli): simplify Cursor import via browser CSV download (#24)
Replace token-based authentication with a simpler browser download flow: - Remove `cursor login/logout/status` commands - Open browser to Cursor's CSV export URL instead - Auto-detect downloaded CSV in Downloads folder - Fall back to drag-and-drop if auto-detection fails This eliminates the need for users to manually extract session tokens from browser cookies, providing a much better UX. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 51bb7fc commit 9aafa40

5 files changed

Lines changed: 288 additions & 578 deletions

File tree

.claude/commands/test-cli.md

Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -59,48 +59,31 @@ cd packages/cli && bun run --conditions=browser src/cli.ts -i fricoben
5959

6060
## Step 3: Cursor Integration
6161

62-
### Login to Cursor
62+
If Cursor is installed, the CLI will automatically:
6363

64-
```bash
65-
cd packages/cli && bun run --conditions=browser src/cli.ts cursor login
66-
```
67-
68-
You'll need to:
69-
1. Open https://www.cursor.com/dashboard
70-
2. Open DevTools > Network tab
71-
3. Find any request to cursor.com/api
72-
4. Copy the `WorkosCursorSessionToken` cookie value
73-
74-
### Check Cursor Status
75-
76-
```bash
77-
cd packages/cli && bun run --conditions=browser src/cli.ts cursor status
78-
```
79-
80-
### Logout from Cursor
64+
1. Open your browser to `cursor.com/api/dashboard/export-usage-events-csv`
65+
2. Wait for the CSV to download
66+
3. Detect the download in your Downloads folder
67+
4. Import it alongside other AI tool data
8168

82-
```bash
83-
cd packages/cli && bun run --conditions=browser src/cli.ts cursor logout
84-
```
85-
86-
---
87-
88-
## Step 4: First-Run Cursor Prompt
89-
90-
If Cursor is installed but not logged in, the CLI will prompt:
69+
**If auto-detection fails:**
70+
- The CLI will prompt you to drag-and-drop the CSV file
71+
- Or press Enter to skip Cursor data
9172

73+
**Expected behavior:**
9274
```bash
9375
cd packages/cli && bun run --conditions=browser src/cli.ts
9476
```
9577

96-
**Expected behavior:**
97-
- Detects Cursor installation
98-
- Asks "Would you like to include your Cursor usage data? (y/n)"
99-
- If yes, opens browser and prompts for token
78+
- Shows "Cursor detected! Opening browser to download your usage data..."
79+
- Browser opens to Cursor export URL
80+
- Shows "Waiting for download..."
81+
- When detected: "Found: usage-events-YYYY-MM-DD.csv"
82+
- Shows "Imported X Cursor usage events."
10083

10184
---
10285

103-
## Step 5: Integration Test with Dev Server
86+
## Step 4: Integration Test with Dev Server
10487

10588
### Start the Dev Server
10689

@@ -133,10 +116,9 @@ VIBETRACKING_API_URL=http://localhost:3000 cd packages/cli && bun run --conditio
133116
|------|---------|----------|
134117
| Default (browser) | `src/cli.ts` | Shows stats, opens browser |
135118
| Inviter flag | `src/cli.ts -i username` | Adds inviter param to URL |
136-
| Cursor login | `src/cli.ts cursor login` | Prompts for token |
137-
| Cursor status | `src/cli.ts cursor status` | Shows auth status |
138-
| Cursor logout | `src/cli.ts cursor logout` | Clears credentials |
139-
| First-run prompt | (with Cursor installed) | Prompts for Cursor setup |
119+
| Cursor auto-detect | (with Cursor installed) | Opens browser, detects download |
120+
| Cursor drag-drop | (skip auto-detect) | Prompts for file, accepts drag-drop |
121+
| Skip Cursor | (press Enter at prompt) | Continues without Cursor data |
140122

141123
---
142124

@@ -150,7 +132,7 @@ The CLI scans these locations:
150132
| Codex | `~/.codex/` |
151133
| OpenCode | `~/.local/share/opencode/` |
152134
| Gemini | `~/.gemini/` |
153-
| Cursor | Via API (requires login) |
135+
| Cursor | Browser CSV download → `~/.vibetracking/cursor-cache/` |
154136
| Amp | `~/.ampcode/sessions/` |
155137
| Droid | `~/Library/.../googleAiStudio/history/` |
156138

@@ -160,8 +142,7 @@ The CLI scans these locations:
160142

161143
| File | Purpose |
162144
|------|---------|
163-
| `~/.vibetracking/cursor-credentials.json` | Cursor session token |
164-
| `~/.vibetracking/cursor-cache/usage.csv` | Cached Cursor data |
145+
| `~/.vibetracking/cursor-cache/usage.csv` | Cached Cursor data (from browser download) |
165146
| `~/.cache/vibetracking/pricing-litellm.json` | Cached LiteLLM pricing |
166147
| `~/.cache/vibetracking/pricing-openrouter.json` | Cached OpenRouter pricing |
167148

@@ -175,7 +156,7 @@ The CLI scans these locations:
175156

176157
### "No data found"
177158
- Check if you have data in `~/.claude/` or `~/.codex/`
178-
- For Cursor: run `vibetracking cursor login` first
159+
- For Cursor: make sure you're logged into cursor.com in your browser
179160

180161
### "Browser doesn't open"
181162
- URL is printed to console, open manually

CLAUDE.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -436,29 +436,29 @@ E2E tests use Playwright MCP tools. Credentials from Bitwarden when needed.
436436

437437
```bash
438438
vibetracking # Scan data and open browser to import
439-
vibetracking cursor login # Login to Cursor (paste session token)
440-
vibetracking cursor logout # Logout from Cursor
441-
vibetracking cursor status # Check Cursor authentication status
442439
```
443440

444441
### How It Works
445442

446443
1. Run `vibetracking` in your terminal
447-
2. CLI scans local AI tool data (Claude Code, Codex, Gemini, Amp, Droid)
448-
3. If Cursor credentials exist, fetches Cursor usage data
444+
2. If Cursor is installed, opens browser to download usage CSV from cursor.com
445+
3. CLI scans local AI tool data (Claude Code, Codex, Gemini, Amp, Droid)
449446
4. Opens browser to `/import#encoded_data`
450447
5. User logs in with GitHub (if needed) and confirms import
451448

452449
### Cursor Integration
453450

454-
Cursor usage data is synced via API (requires session token):
451+
Cursor usage data is imported via browser download:
455452

456-
```bash
457-
# Login to Cursor (opens browser, prompts for token)
458-
vibetracking cursor login
453+
1. CLI detects Cursor installation
454+
2. Opens browser to `cursor.com/api/dashboard/export-usage-events-csv`
455+
3. CSV downloads automatically (user must be logged into Cursor in browser)
456+
4. CLI detects the download and imports it
457+
5. If auto-detection fails, user can drag-drop the CSV file
459458

460-
# Credentials stored in ~/.vibetracking/cursor-credentials.json
461-
# Format: { "sessionToken": "eyJ...", "createdAt": "..." }
459+
```bash
460+
# Cache location for Cursor data
461+
~/.vibetracking/cursor-cache/usage.csv
462462
```
463463

464464
---

README.md

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ bun run dist/cli.js
168168
│ Claude: ~/.claude/projects/
169169
│ OpenCode: ~/.local/share/opencode/
170170
│ Codex: ~/.codex/
171-
│ Cursor: API (requires login)
171+
│ Cursor: Browser CSV download
172172
│ Gemini: ~/.gemini/
173173
│ Amp: ~/.amp/
174174
│ Droid: ~/.droid/
@@ -216,35 +216,13 @@ The CLI scans local AI coding tool data and opens your browser to import it via
216216

217217
### Cursor IDE Integration
218218

219-
Cursor requires authentication to fetch usage data:
219+
If Cursor is installed, the CLI will:
220220

221-
```bash
222-
# Login to Cursor
223-
bunx vibetracking cursor login
224-
225-
# Check authentication status
226-
bunx vibetracking cursor status
227-
228-
# Logout
229-
bunx vibetracking cursor logout
230-
```
231-
232-
### Background Sync
233-
234-
After authenticating via browser, you can sync in the background:
221+
1. Open your browser to download usage data from cursor.com
222+
2. Detect the downloaded CSV automatically
223+
3. Import it alongside your other AI tool data
235224

236-
```bash
237-
# Sync data silently (for cron jobs, hooks, etc.)
238-
bunx vibetracking sync --quiet
239-
```
240-
241-
### Model Pricing Lookup
242-
243-
```bash
244-
# Look up pricing for any model
245-
bunx vibetracking pricing claude-3-5-sonnet-20241022
246-
bunx vibetracking pricing gpt-4o --json
247-
```
225+
If auto-detection fails, you can drag-and-drop the CSV file into the terminal.
248226

249227
---
250228

@@ -296,8 +274,7 @@ bun run test:all # Run both
296274

297275
```bash
298276
cd packages/cli
299-
bun run src/cli.ts # Default command (opens browser)
300-
bun run src/cli.ts cursor login # Cursor authentication
277+
bun run src/cli.ts # Scan data and open browser
301278
```
302279

303280
### Web Application
@@ -360,7 +337,7 @@ npm publish
360337
- **Claude Code**: Check `~/.claude/projects/` exists
361338
- **OpenCode**: Check `~/.local/share/opencode/` exists
362339
- **Codex**: Check `~/.codex/` exists
363-
- **Cursor**: Run `vibetracking cursor login` first
340+
- **Cursor**: Make sure you're logged into cursor.com in your browser
364341

365342
### Native module build fails
366343

0 commit comments

Comments
 (0)