@mai0313/vct 0.2.4

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/README.md ADDED
@@ -0,0 +1,704 @@
1
+ <center>
2
+
3
+ # Vibe Coding Tracker — AI Coding Assistant Usage Tracker
4
+
5
+ [![Crates.io](https://img.shields.io/crates/v/vibe_coding_tracker?logo=rust&style=flat-square&color=E05D44)](https://crates.io/crates/vibe_coding_tracker)
6
+ [![Crates.io Downloads](https://img.shields.io/crates/d/vibe_coding_tracker?logo=rust&style=flat-square)](https://crates.io/crates/vibe_coding_tracker)
7
+ [![npm version](https://img.shields.io/npm/v/vibe-coding-tracker?logo=npm&style=flat-square&color=CB3837)](https://www.npmjs.com/package/vibe-coding-tracker)
8
+ [![npm downloads](https://img.shields.io/npm/dt/vibe-coding-tracker?logo=npm&style=flat-square)](https://www.npmjs.com/package/vibe-coding-tracker)
9
+ [![rust](https://img.shields.io/badge/Rust-stable-orange?logo=rust&logoColor=white&style=flat-square)](https://www.rust-lang.org/)
10
+ [![tests](https://img.shields.io/github/actions/workflow/status/Mai0313/VibeCodingTracker/test.yml?label=tests&logo=github&style=flat-square)](https://github.com/Mai0313/VibeCodingTracker/actions/workflows/test.yml)
11
+ [![code-quality](https://img.shields.io/github/actions/workflow/status/Mai0313/VibeCodingTracker/code-quality-check.yml?label=code-quality&logo=github&style=flat-square)](https://github.com/Mai0313/VibeCodingTracker/actions/workflows/code-quality-check.yml)
12
+ [![license](https://img.shields.io/badge/License-MIT-green.svg?labelColor=gray&style=flat-square)](https://github.com/Mai0313/VibeCodingTracker/tree/master?tab=License-1-ov-file)
13
+ [![PRs](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/Mai0313/VibeCodingTracker/pulls)
14
+
15
+ </center>
16
+
17
+ **Track your AI coding costs in real-time.** Vibe Coding Tracker is a powerful CLI tool that helps you monitor and analyze your Claude Code, Codex, and Gemini usage, providing detailed cost breakdowns, token statistics, and code operation insights.
18
+
19
+ [English](README.md) | [繁體中文](README.zh-TW.md) | [简体中文](README.zh-CN.md)
20
+
21
+ > Note: CLI examples use the short alias `vct`. If you built from source, the compiled binary is named `vibe_coding_tracker`; create an alias or replace `vct` with the full name when running commands.
22
+
23
+ ---
24
+
25
+ ## 🎯 Why Vibe Coding Tracker?
26
+
27
+ ### 💰 Know Your Costs
28
+
29
+ Stop wondering how much your AI coding sessions cost. Get **real-time cost tracking** with automatic pricing updates from [LiteLLM](https://github.com/BerriAI/litellm).
30
+
31
+ ### 📊 Beautiful Visualizations
32
+
33
+ Choose your preferred view:
34
+
35
+ - **Interactive Dashboard**: Auto-refreshing terminal UI with live updates
36
+ - **Static Reports**: Professional tables for documentation
37
+ - **Script-Friendly**: Plain text and JSON for automation
38
+ - **Full Precision**: Export exact costs for accounting
39
+
40
+ ### 🚀 Zero Configuration
41
+
42
+ Automatically detects and processes logs from Claude Code, Codex, and Gemini. No setup required—just run and analyze.
43
+
44
+ ### 🎨 Rich Insights
45
+
46
+ - Token usage by model and date
47
+ - Cost breakdown by cache types
48
+ - File operations tracking
49
+ - Command execution history
50
+ - Git repository information
51
+
52
+ ---
53
+
54
+ ## ✨ Key Features
55
+
56
+ | Feature | Description |
57
+ | -------------------------- | ----------------------------------------------------------- |
58
+ | 🤖 **Auto-Detection** | Intelligently identifies Claude Code, Codex, or Gemini logs |
59
+ | 💵 **Smart Pricing** | Fuzzy model matching + daily cache for speed |
60
+ | 🎨 **4 Display Modes** | Interactive, Table, Text, and JSON outputs |
61
+ | 📈 **Comprehensive Stats** | Tokens, costs, file ops, and tool calls |
62
+ | ⚡ **High Performance** | Built with Rust for speed and reliability |
63
+ | 🔄 **Live Updates** | Real-time dashboard refreshes every second |
64
+ | 💾 **Efficient Caching** | Smart daily cache reduces API calls |
65
+
66
+ ---
67
+
68
+ ## 🚀 Quick Start
69
+
70
+ ### Installation
71
+
72
+ **Prerequisites**:
73
+
74
+ - [Rust toolchain](https://rustup.rs/) (1.70+) for building from source
75
+ - [Node.js](https://nodejs.org/) (v18+) for `npm` installation
76
+
77
+ #### From `npm` (Recommended)
78
+
79
+ Choose any of the following package names (all are identical):
80
+
81
+ ```bash
82
+ # Main package
83
+ npm install -g vibe-coding-tracker
84
+
85
+ # Short alias with scope
86
+ npm install -g @mai0313/vct
87
+
88
+ # Full name with scope
89
+ npm install -g @mai0313/vibe-coding-tracker
90
+ ```
91
+
92
+ All packages include pre-compiled binaries for your platform - no build step required!
93
+
94
+ #### From Source
95
+
96
+ ```bash
97
+ # Clone and build
98
+ git clone https://github.com/Mai0313/VibeCodingTracker.git
99
+ cd VibeCodingTracker
100
+ cargo build --release
101
+
102
+ # Binary location
103
+ ./target/release/vibe_coding_tracker
104
+
105
+ # Optional: create a short alias (adjust the paths as needed)
106
+ ln -sf "$(pwd)/target/release/vibe_coding_tracker" ~/.local/bin/vct
107
+ ```
108
+
109
+ ### First Run
110
+
111
+ ```bash
112
+ # View your usage with the short alias (if available)
113
+ vct usage
114
+
115
+ # Or run the binary built by Cargo
116
+ ./target/release/vibe_coding_tracker usage
117
+
118
+ # Analyze a specific conversation
119
+ ./target/release/vibe_coding_tracker analysis --path ~/.claude/projects/session.jsonl
120
+ ```
121
+
122
+ > 💡 **Tip**: Use `vct` as a short alias for `vibe_coding_tracker` to save typing—create it manually with `ln -sf ./target/release/vibe_coding_tracker ~/.local/bin/vct` (or any path you prefer).
123
+
124
+ ---
125
+
126
+ ## 📖 Command Guide
127
+
128
+ ### 🔍 Quick Reference
129
+
130
+ ```bash
131
+ vct <COMMAND> [OPTIONS]
132
+ # Replace with `vibe_coding_tracker` if you are using the full binary name
133
+
134
+ Commands:
135
+ usage Show token usage and costs (default: interactive)
136
+ analysis Analyze conversation files and export data
137
+ version Display version information
138
+ update Update to the latest version from GitHub releases
139
+ help Show help information
140
+ ```
141
+
142
+ ---
143
+
144
+ ## 💰 Usage Command
145
+
146
+ **Track your spending across all AI coding sessions.**
147
+
148
+ ### Basic Usage
149
+
150
+ ```bash
151
+ # Interactive dashboard (recommended)
152
+ vct usage
153
+
154
+ # Static table for reports
155
+ vct usage --table
156
+
157
+ # Plain text for scripts
158
+ vct usage --text
159
+
160
+ # JSON for data processing
161
+ vct usage --json
162
+ ```
163
+
164
+ ### What You Get
165
+
166
+ The tool scans these directories automatically:
167
+
168
+ - `~/.claude/projects/*.jsonl` (Claude Code)
169
+ - `~/.codex/sessions/*.jsonl` (Codex)
170
+ - `~/.gemini/tmp/<project_hash>/chats/*.json` (Gemini)
171
+
172
+ ### 🎨 Interactive Mode (Default)
173
+
174
+ **Live dashboard that updates every second**
175
+
176
+ ```
177
+ ┌──────────────────────────────────────────────────────────────────┐
178
+ │ 📊 Token Usage Statistics │
179
+ └──────────────────────────────────────────────────────────────────┘
180
+ ┌────────────┬──────────────────────┬────────────┬────────────┬────────────┬──────────────┬────────────┬────────────┐
181
+ │ Date │ Model │ Input │ Output │ Cache Read │ Cache Create │ Total │ Cost (USD) │
182
+ ├────────────┼──────────────────────┼────────────┼────────────┼────────────┼──────────────┼────────────┼────────────┤
183
+ │ 2025-10-01 │ claude-sonnet-4-20… │ 45,230 │ 12,450 │ 230,500 │ 50,000 │ 338,180 │ $2.15 │
184
+ │ 2025-10-02 │ claude-sonnet-4-20… │ 32,100 │ 8,920 │ 180,000 │ 30,000 │ 251,020 │ $1.58 │
185
+ │ 2025-10-03 │ claude-sonnet-4-20… │ 28,500 │ 7,200 │ 150,000 │ 25,000 │ 210,700 │ $1.32 │
186
+ │ 2025-10-03 │ gpt-4-turbo │ 15,000 │ 5,000 │ 0 │ 0 │ 20,000 │ $0.25 │
187
+ │ │ TOTAL │ 120,830 │ 33,570 │ 560,500 │ 105,000 │ 819,900 │ $5.30 │
188
+ └────────────┴──────────────────────┴────────────┴────────────┴────────────┴──────────────┴────────────┴────────────┘
189
+ ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
190
+ │ 💰 Total Cost: $5.30 | 🔢 Total Tokens: 819,900 | 📅 Entries: 4 | 🧠 Memory: 12.5 MB │
191
+ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
192
+ ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
193
+ │ 📈 Daily Averages │
194
+ │ │
195
+ │ Claude Code: 266,667 tokens/day | $1.68/day │
196
+ │ Codex: 20,000 tokens/day | $0.25/day │
197
+ │ Overall: 204,975 tokens/day | $1.33/day │
198
+ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
199
+
200
+ Press 'q', 'Esc', or 'Ctrl+C' to quit
201
+ ```
202
+
203
+ **Features**:
204
+
205
+ - ✨ Auto-refreshes every second
206
+ - 🎯 Highlights today's entries
207
+ - 🔄 Shows recently updated rows
208
+ - 💾 Displays memory usage
209
+ - 📊 Summary statistics
210
+ - 📈 Daily averages by provider (Claude Code, Codex, Gemini)
211
+
212
+ **Controls**: Press `q`, `Esc`, or `Ctrl+C` to exit
213
+
214
+ ### 📋 Static Table Mode
215
+
216
+ **Perfect for documentation and reports**
217
+
218
+ ```bash
219
+ vct usage --table
220
+ ```
221
+
222
+ ```
223
+ 📊 Token Usage Statistics
224
+
225
+ ╔════════════╦══════════════════════╦════════════╦════════════╦════════════╦══════════════╦══════════════╦════════════╗
226
+ ║ Date ║ Model ║ Input ║ Output ║ Cache Read ║ Cache Create ║ Total Tokens ║ Cost (USD) ║
227
+ ╠════════════╬══════════════════════╬════════════╬════════════╬════════════╬══════════════╬══════════════╬════════════╣
228
+ ║ 2025-10-01 ║ claude-sonnet-4-20… ║ 45,230 ║ 12,450 ║ 230,500 ║ 50,000 ║ 338,180 ║ $2.15 ║
229
+ ║ 2025-10-02 ║ claude-sonnet-4-20… ║ 32,100 ║ 8,920 ║ 180,000 ║ 30,000 ║ 251,020 ║ $1.58 ║
230
+ ║ 2025-10-03 ║ claude-sonnet-4-20… ║ 28,500 ║ 7,200 ║ 150,000 ║ 25,000 ║ 210,700 ║ $1.32 ║
231
+ ║ 2025-10-03 ║ gpt-4-turbo ║ 15,000 ║ 5,000 ║ 0 ║ 0 ║ 20,000 ║ $0.25 ║
232
+ ║ ║ TOTAL ║ 120,830 ║ 33,570 ║ 560,500 ║ 105,000 ║ 819,900 ║ $5.30 ║
233
+ ╚════════════╩══════════════════════╩════════════╩════════════╩════════════╩══════════════╩══════════════╩════════════╝
234
+
235
+ 📈 Daily Averages (by Provider)
236
+
237
+ ╔═════════════╦════════════════╦══════════════╦══════╗
238
+ ║ Provider ║ Avg Tokens/Day ║ Avg Cost/Day ║ Days ║
239
+ ╠═════════════╬════════════════╬══════════════╬══════╣
240
+ ║ Claude Code ║ 266,667 ║ $1.68 ║ 3 ║
241
+ ╠═════════════╬════════════════╬══════════════╬══════╣
242
+ ║ Codex ║ 20,000 ║ $0.25 ║ 1 ║
243
+ ╠═════════════╬════════════════╬══════════════╬══════╣
244
+ ║ OVERALL ║ 204,975 ║ $1.33 ║ 4 ║
245
+ ╚═════════════╩════════════════╩══════════════╩══════╝
246
+ ```
247
+
248
+ ### 📝 Text Mode
249
+
250
+ **Ideal for scripting and parsing**
251
+
252
+ ```bash
253
+ vct usage --text
254
+ ```
255
+
256
+ ```
257
+ 2025-10-01 > claude-sonnet-4-20250514: $2.154230
258
+ 2025-10-02 > claude-sonnet-4-20250514: $1.583450
259
+ 2025-10-03 > claude-sonnet-4-20250514: $1.321200
260
+ 2025-10-03 > gpt-4-turbo: $0.250000
261
+ ```
262
+
263
+ ### 🗂️ JSON Mode
264
+
265
+ **Full precision for accounting and integration**
266
+
267
+ ```bash
268
+ vct usage --json
269
+ ```
270
+
271
+ ```json
272
+ {
273
+ "2025-10-01": [
274
+ {
275
+ "model": "claude-sonnet-4-20250514",
276
+ "usage": {
277
+ "input_tokens": 45230,
278
+ "output_tokens": 12450,
279
+ "cache_read_input_tokens": 230500,
280
+ "cache_creation_input_tokens": 50000,
281
+ "cache_creation": {
282
+ "ephemeral_5m_input_tokens": 50000
283
+ },
284
+ "service_tier": "standard"
285
+ },
286
+ "cost_usd": 2.1542304567890125
287
+ }
288
+ ]
289
+ }
290
+ ```
291
+
292
+ ### 🔍 Output Comparison
293
+
294
+ | Feature | Interactive | Table | Text | JSON |
295
+ | --------------- | ----------- | ------- | --------- | ------------------ |
296
+ | **Best For** | Monitoring | Reports | Scripts | Integration |
297
+ | **Cost Format** | $2.15 | $2.15 | $2.154230 | 2.1542304567890123 |
298
+ | **Updates** | Real-time | Static | Static | Static |
299
+ | **Colors** | ✅ | ✅ | ❌ | ❌ |
300
+ | **Parseable** | ❌ | ❌ | ✅ | ✅ |
301
+
302
+ ### 💡 Use Cases
303
+
304
+ - **Budget Tracking**: Monitor your daily AI spending
305
+ - **Cost Optimization**: Identify expensive sessions
306
+ - **Team Reporting**: Generate usage reports for management
307
+ - **Billing**: Export precise costs for invoicing
308
+ - **Monitoring**: Real-time dashboard for active development
309
+
310
+ ---
311
+
312
+ ## 📊 Analysis Command
313
+
314
+ **Deep dive into conversation files - single file or batch analysis.**
315
+
316
+ ### Basic Usage
317
+
318
+ ```bash
319
+ # Single file: Analyze and display
320
+ vct analysis --path ~/.claude/projects/session.jsonl
321
+
322
+ # Single file: Save to file
323
+ vct analysis --path ~/.claude/projects/session.jsonl --output report.json
324
+
325
+ # Batch: Analyze all sessions with interactive table (default)
326
+ vct analysis
327
+
328
+ # Batch: Save aggregated results to JSON
329
+ vct analysis --output batch_report.json
330
+
331
+ # Batch with provider grouping: Output complete records grouped by provider (JSON format)
332
+ vct analysis --all
333
+
334
+ # Save the grouped results to a file
335
+ vct analysis --all --output grouped_report.json
336
+ ```
337
+
338
+ ### What You Get
339
+
340
+ **Single File Analysis**:
341
+
342
+ - **Token Usage**: Input, output, and cache statistics by model
343
+ - **File Operations**: Every read, write, and edit with full details
344
+ - **Command History**: All shell commands executed
345
+ - **Tool Usage**: Counts of each tool type used
346
+ - **Metadata**: User, machine ID, Git repo, timestamps
347
+
348
+ **Batch Analysis**:
349
+
350
+ - **Aggregated Metrics**: Grouped by date and model
351
+ - **Line Counts**: Edit, read, and write operations
352
+ - **Tool Statistics**: Bash, Edit, Read, TodoWrite, Write counts
353
+ - **Interactive Display**: Real-time TUI table (default)
354
+ - **JSON Export**: Structured data for further processing
355
+
356
+ ### Sample Output - Single File
357
+
358
+ ```json
359
+ {
360
+ "extensionName": "Claude-Code",
361
+ "insightsVersion": "0.1.0",
362
+ "user": "wei",
363
+ "machineId": "5b0dfa41ada84d5180a514698f67bd80",
364
+ "records": [
365
+ {
366
+ "conversationUsage": {
367
+ "claude-sonnet-4-20250514": {
368
+ "input_tokens": 252,
369
+ "output_tokens": 3921,
370
+ "cache_read_input_tokens": 1298818,
371
+ "cache_creation_input_tokens": 124169
372
+ }
373
+ },
374
+ "toolCallCounts": {
375
+ "Read": 15,
376
+ "Write": 4,
377
+ "Edit": 2,
378
+ "Bash": 5,
379
+ "TodoWrite": 3
380
+ },
381
+ "totalUniqueFiles": 8,
382
+ "totalWriteLines": 80,
383
+ "totalReadLines": 120,
384
+ "folderPath": "/home/wei/repo/project",
385
+ "gitRemoteUrl": "https://github.com/user/project.git"
386
+ }
387
+ ]
388
+ }
389
+ ```
390
+
391
+ ### Sample Output - Batch Analysis
392
+
393
+ **Interactive Table** (default when running `vct analysis`):
394
+
395
+ ```
396
+ ┌──────────────────────────────────────────────────────────────────┐
397
+ │ 🔍 Analysis Statistics │
398
+ └──────────────────────────────────────────────────────────────────┘
399
+ ┌────────────┬────────────────────┬────────────┬────────────┬────────────┬──────┬──────┬──────┬───────────┬───────┐
400
+ │ Date │ Model │ Edit Lines │ Read Lines │ Write Lines│ Bash │ Edit │ Read │ TodoWrite │ Write │
401
+ ├────────────┼────────────────────┼────────────┼────────────┼────────────┼──────┼──────┼──────┼───────────┼───────┤
402
+ │ 2025-10-02 │ claude-sonnet-4-5…│ 901 │ 11,525 │ 53 │ 13 │ 26 │ 27 │ 10 │ 1 │
403
+ │ 2025-10-03 │ claude-sonnet-4-5…│ 574 │ 10,057 │ 1,415 │ 53 │ 87 │ 78 │ 30 │ 8 │
404
+ │ 2025-10-03 │ gpt-5-codex │ 0 │ 1,323 │ 0 │ 75 │ 0 │ 20 │ 0 │ 0 │
405
+ │ │ TOTAL │ 1,475 │ 22,905 │ 1,468 │ 141 │ 113 │ 125 │ 40 │ 9 │
406
+ └────────────┴────────────────────┴────────────┴────────────┴────────────┴──────┴──────┴──────┴───────────┴───────┘
407
+ ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
408
+ │ 📝 Total Lines: 25,848 | 🔧 Total Tools: 428 | 📅 Entries: 3 | 🧠 Memory: 8.2 MB │
409
+ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
410
+
411
+ Press 'q', 'Esc', or 'Ctrl+C' to quit
412
+ ```
413
+
414
+ **JSON Export** (with `--output`):
415
+
416
+ ```json
417
+ [
418
+ {
419
+ "date": "2025-10-02",
420
+ "model": "claude-sonnet-4-5-20250929",
421
+ "editLines": 901,
422
+ "readLines": 11525,
423
+ "writeLines": 53,
424
+ "bashCount": 13,
425
+ "editCount": 26,
426
+ "readCount": 27,
427
+ "todoWriteCount": 10,
428
+ "writeCount": 1
429
+ },
430
+ {
431
+ "date": "2025-10-03",
432
+ "model": "claude-sonnet-4-5-20250929",
433
+ "editLines": 574,
434
+ "readLines": 10057,
435
+ "writeLines": 1415,
436
+ "bashCount": 53,
437
+ "editCount": 87,
438
+ "readCount": 78,
439
+ "todoWriteCount": 30,
440
+ "writeCount": 8
441
+ }
442
+ ]
443
+ ```
444
+
445
+ ### 💡 Use Cases
446
+
447
+ **Single File Analysis**:
448
+
449
+ - **Usage Auditing**: Track what the AI did in each session
450
+ - **Cost Attribution**: Calculate costs per project or feature
451
+ - **Compliance**: Export detailed activity logs
452
+ - **Analysis**: Understand coding patterns and tool usage
453
+
454
+ **Batch Analysis**:
455
+
456
+ - **Productivity Tracking**: Monitor coding activity over time
457
+ - **Tool Usage Patterns**: Identify most-used tools across sessions
458
+ - **Model Comparison**: Compare efficiency between different AI models
459
+ - **Historical Analysis**: Track trends in code operations by date
460
+
461
+ ---
462
+
463
+ ## 🔧 Version Command
464
+
465
+ **Check your installation.**
466
+
467
+ ```bash
468
+ # Formatted output
469
+ vct version
470
+
471
+ # JSON format
472
+ vct version --json
473
+
474
+ # Plain text
475
+ vct version --text
476
+ ```
477
+
478
+ ### Output
479
+
480
+ ```
481
+ 🚀 Vibe Coding Tracker
482
+
483
+ ╔════════════════╦═════════╗
484
+ ║ Version ║ 0.1.0 ║
485
+ ╠════════════════╬═════════╣
486
+ ║ Rust Version ║ 1.89.0 ║
487
+ ╠════════════════╬═════════╣
488
+ ║ Cargo Version ║ 1.89.0 ║
489
+ ╚════════════════╩═════════╝
490
+ ```
491
+
492
+ ---
493
+
494
+ ## 🔄 Update Command
495
+
496
+ **Keep your installation up-to-date automatically.**
497
+
498
+ The update command checks GitHub releases and downloads the latest version for your platform.
499
+
500
+ ### Basic Usage
501
+
502
+ ```bash
503
+ # Interactive update with confirmation
504
+ vct update
505
+
506
+ # Check for updates without installing
507
+ vct update --check
508
+
509
+ # Force update without confirmation prompt
510
+ vct update --force
511
+ ```
512
+
513
+ ### How It Works
514
+
515
+ 1. **Check Latest Version**: Fetches the latest release from GitHub API
516
+ 2. **Compare Versions**: Compares current version with the latest available
517
+ 3. **Download Binary**: Downloads the appropriate binary for your platform (Linux/macOS/Windows)
518
+ 4. **Smart Replacement**:
519
+ - **Linux/macOS**: Automatically replaces the binary (backs up old version to `.old`)
520
+ - **Windows**: Downloads as `.new` and creates a batch script for safe replacement
521
+
522
+ ### Platform Support
523
+
524
+ The update command automatically detects your platform and downloads the correct archive:
525
+
526
+ - **Linux**: `vibe_coding_tracker-v{version}-linux-x64-gnu.tar.gz`, `vibe_coding_tracker-v{version}-linux-arm64-gnu.tar.gz`
527
+ - **macOS**: `vibe_coding_tracker-v{version}-macos-x64.tar.gz`, `vibe_coding_tracker-v{version}-macos-arm64.tar.gz`
528
+ - **Windows**: `vibe_coding_tracker-v{version}-windows-x64.zip`, `vibe_coding_tracker-v{version}-windows-arm64.zip`
529
+
530
+ ### Windows Update Process
531
+
532
+ On Windows, the binary cannot be replaced while running. The update command:
533
+
534
+ 1. Downloads the new version as `vct.new`
535
+ 2. Creates an update script (`update_vct.bat`)
536
+ 3. Displays instructions to complete the update
537
+
538
+ Run the batch script after closing the application to finish the update.
539
+
540
+ ---
541
+
542
+ ## 💡 Smart Pricing System
543
+
544
+ ### How It Works
545
+
546
+ 1. **Automatic Updates**: Fetches pricing from [LiteLLM](https://github.com/BerriAI/litellm) daily
547
+ 2. **Smart Caching**: Stores pricing in `~/.vibe-coding-tracker/` for 24 hours
548
+ 3. **Fuzzy Matching**: Finds best match even for custom model names
549
+ 4. **Always Accurate**: Ensures you get the latest pricing
550
+
551
+ ### Model Matching
552
+
553
+ **Priority Order**:
554
+
555
+ 1. ✅ **Exact Match**: `claude-sonnet-4` → `claude-sonnet-4`
556
+ 2. 🔄 **Normalized**: `claude-sonnet-4-20250514` → `claude-sonnet-4`
557
+ 3. 🔍 **Substring**: `custom-gpt-4` → `gpt-4`
558
+ 4. 🎯 **Fuzzy (AI-powered)**: Uses Jaro-Winkler similarity (70% threshold)
559
+ 5. 💵 **Fallback**: Shows $0.00 if no match found
560
+
561
+ ### Cost Calculation
562
+
563
+ ```
564
+ Total Cost = (Input Tokens × Input Cost) +
565
+ (Output Tokens × Output Cost) +
566
+ (Cache Read × Cache Read Cost) +
567
+ (Cache Creation × Cache Creation Cost)
568
+ ```
569
+
570
+ ---
571
+
572
+ ## 🐳 Docker Support
573
+
574
+ ```bash
575
+ # Build image
576
+ docker build -f docker/Dockerfile --target prod -t vibe_coding_tracker:latest .
577
+
578
+ # Run with your sessions
579
+ docker run --rm \
580
+ -v ~/.claude:/root/.claude \
581
+ -v ~/.codex:/root/.codex \
582
+ -v ~/.gemini:/root/.gemini \
583
+ vibe_coding_tracker:latest usage
584
+ ```
585
+
586
+ ---
587
+
588
+ ## 🔍 Troubleshooting
589
+
590
+ ### Pricing Data Not Loading
591
+
592
+ ```bash
593
+ # Check cache
594
+ ls -la ~/.vibe-coding-tracker/
595
+
596
+ # Force refresh
597
+ rm -rf ~/.vibe-coding-tracker/
598
+ vct usage
599
+
600
+ # Debug mode
601
+ RUST_LOG=debug vct usage
602
+ ```
603
+
604
+ ### No Usage Data Shown
605
+
606
+ ```bash
607
+ # Verify session directories
608
+ ls -la ~/.claude/projects/
609
+ ls -la ~/.codex/sessions/
610
+ ls -la ~/.gemini/tmp/
611
+
612
+ # Count session files
613
+ find ~/.claude/projects -name "*.jsonl" | wc -l
614
+ find ~/.codex/sessions -name "*.jsonl" | wc -l
615
+ find ~/.gemini/tmp -name "*.json" | wc -l
616
+ ```
617
+
618
+ ### Analysis Command Fails
619
+
620
+ ```bash
621
+ # Validate JSONL format
622
+ jq empty < your-file.jsonl
623
+
624
+ # Check file permissions
625
+ ls -la your-file.jsonl
626
+
627
+ # Run with debug output
628
+ RUST_LOG=debug vct analysis --path your-file.jsonl
629
+ ```
630
+
631
+ ### Interactive Mode Issues
632
+
633
+ ```bash
634
+ # Reset terminal if broken
635
+ reset
636
+
637
+ # Check terminal type
638
+ echo $TERM # Should be xterm-256color or compatible
639
+
640
+ # Use static table as fallback
641
+ vct usage --table
642
+ ```
643
+
644
+ ---
645
+
646
+ ## ⚡ Performance
647
+
648
+ Built with Rust for **speed** and **reliability**:
649
+
650
+ | Operation | Time |
651
+ | ------------------- | ------ |
652
+ | Parse 10MB JSONL | ~320ms |
653
+ | Analyze 1000 events | ~45ms |
654
+ | Load cached pricing | ~2ms |
655
+ | Interactive refresh | ~30ms |
656
+
657
+ **Binary Size**: ~3-5 MB (stripped)
658
+
659
+ ---
660
+
661
+ ## 📚 Learn More
662
+
663
+ - **Developer Docs**: See [.github/copilot-instructions.md](.github/copilot-instructions.md)
664
+ - **Report Issues**: [GitHub Issues](https://github.com/Mai0313/VibeCodingTracker/issues)
665
+ - **Source Code**: [GitHub Repository](https://github.com/Mai0313/VibeCodingTracker)
666
+
667
+ ---
668
+
669
+ ## 🤝 Contributing
670
+
671
+ Contributions welcome! Here's how:
672
+
673
+ 1. Fork the repository
674
+ 2. Create your feature branch
675
+ 3. Make your changes
676
+ 4. Submit a pull request
677
+
678
+ For development setup and guidelines, see [.github/copilot-instructions.md](.github/copilot-instructions.md).
679
+
680
+ ---
681
+
682
+ ## 📄 License
683
+
684
+ MIT License - see [LICENSE](LICENSE) for details.
685
+
686
+ ---
687
+
688
+ ## 🙏 Credits
689
+
690
+ - [LiteLLM](https://github.com/BerriAI/litellm) for model pricing data
691
+ - Claude Code, Codex, and Gemini teams for creating amazing AI coding assistants
692
+ - The Rust community for excellent tooling
693
+
694
+ ---
695
+
696
+ <center>
697
+
698
+ **Save money. Track usage. Code smarter.**
699
+
700
+ [⭐ Star this project](https://github.com/Mai0313/VibeCodingTracker) if you find it useful!
701
+
702
+ Made with 🦀 Rust
703
+
704
+ </center>
package/bin/vct.js ADDED
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('child_process');
4
+ const path = require('path');
5
+ const fs = require('fs');
6
+ const os = require('os');
7
+
8
+ // Determine platform-specific binary name and archive format
9
+ function getPlatformInfo() {
10
+ const platform = process.platform;
11
+ const arch = process.arch;
12
+
13
+ const platformMap = {
14
+ darwin: {
15
+ x64: { friendlyId: 'macos-x64', ext: 'tar.gz' },
16
+ arm64: { friendlyId: 'macos-arm64', ext: 'tar.gz' },
17
+ },
18
+ linux: {
19
+ x64: { friendlyId: 'linux-x64-gnu', ext: 'tar.gz' },
20
+ arm64: { friendlyId: 'linux-arm64-gnu', ext: 'tar.gz' },
21
+ },
22
+ win32: {
23
+ x64: { friendlyId: 'windows-x64', ext: 'zip' },
24
+ arm64: { friendlyId: 'windows-arm64', ext: 'zip' },
25
+ },
26
+ };
27
+
28
+ if (!platformMap[platform] || !platformMap[platform][arch]) {
29
+ console.error(`Unsupported platform: ${platform}-${arch}`);
30
+ process.exit(1);
31
+ }
32
+
33
+ const info = platformMap[platform][arch];
34
+ return {
35
+ binaryName: platform === 'win32' ? 'vibe_coding_tracker.exe' : 'vibe_coding_tracker',
36
+ ...info
37
+ };
38
+ }
39
+
40
+ // Extract binary from archive on first run
41
+ function extractBinary() {
42
+ const info = getPlatformInfo();
43
+ const binDir = path.join(__dirname);
44
+ const binaryPath = path.join(binDir, info.binaryName);
45
+
46
+ // If binary already exists, return its path
47
+ if (fs.existsSync(binaryPath)) {
48
+ return binaryPath;
49
+ }
50
+
51
+ // Find the archive in binaries directory
52
+ const packageRoot = path.join(__dirname, '..');
53
+ const binariesDir = path.join(packageRoot, 'binaries');
54
+
55
+ if (!fs.existsSync(binariesDir)) {
56
+ console.error('Error: Binaries directory not found.');
57
+ console.error('Please reinstall the package.');
58
+ process.exit(1);
59
+ }
60
+
61
+ // Find matching archive
62
+ const files = fs.readdirSync(binariesDir);
63
+ const archivePattern = `${info.friendlyId}.${info.ext}`;
64
+ const archiveFile = files.find(f => f.includes(info.friendlyId) && f.endsWith(info.ext));
65
+
66
+ if (!archiveFile) {
67
+ console.error(`Error: Binary archive not found for ${archivePattern}`);
68
+ console.error('Please reinstall the package.');
69
+ process.exit(1);
70
+ }
71
+
72
+ const archivePath = path.join(binariesDir, archiveFile);
73
+
74
+ // Extract binary
75
+ try {
76
+ if (info.ext === 'tar.gz') {
77
+ const tar = require('tar');
78
+ tar.extract({
79
+ file: archivePath,
80
+ cwd: binDir,
81
+ sync: true,
82
+ });
83
+ } else if (info.ext === 'zip') {
84
+ const AdmZip = require('adm-zip');
85
+ const zip = new AdmZip(archivePath);
86
+ zip.extractEntryTo(info.binaryName, binDir, false, true);
87
+ }
88
+
89
+ // Make binary executable on Unix-like systems
90
+ if (process.platform !== 'win32') {
91
+ fs.chmodSync(binaryPath, 0o755);
92
+ }
93
+ } catch (err) {
94
+ console.error('Failed to extract binary:', err);
95
+ process.exit(1);
96
+ }
97
+
98
+ return binaryPath;
99
+ }
100
+
101
+ // Get or extract binary
102
+ const binaryPath = extractBinary();
103
+
104
+ // Forward all arguments to the binary
105
+ const args = process.argv.slice(2);
106
+ const child = spawn(binaryPath, args, {
107
+ stdio: 'inherit',
108
+ windowsHide: true,
109
+ });
110
+
111
+ child.on('exit', (code, signal) => {
112
+ if (signal) {
113
+ process.kill(process.pid, signal);
114
+ } else {
115
+ process.exit(code);
116
+ }
117
+ });
118
+
119
+ child.on('error', (err) => {
120
+ console.error('Failed to start binary:', err);
121
+ process.exit(1);
122
+ });
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@mai0313/vct",
3
+ "version": "0.2.4",
4
+ "description": "Vibe Coding Tracker - AI coding assistant telemetry/usage parser, aggregate JSONL events into CodeAnalysis results",
5
+ "author": "Wei Lee <mai@mai0313.com>",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/Mai0313/VibeCodingTracker",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Mai0313/VibeCodingTracker.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/Mai0313/VibeCodingTracker/issues"
14
+ },
15
+ "keywords": [
16
+ "cli",
17
+ "ai",
18
+ "coding-assistant",
19
+ "telemetry",
20
+ "claude",
21
+ "codex",
22
+ "gemini",
23
+ "usage-tracker",
24
+ "analytics"
25
+ ],
26
+ "bin": {
27
+ "vct": "bin/vct.js",
28
+ "vibe-coding-tracker": "bin/vct.js"
29
+ },
30
+ "engines": {
31
+ "node": ">=18.0.0"
32
+ },
33
+ "os": [
34
+ "darwin",
35
+ "linux",
36
+ "win32"
37
+ ],
38
+ "cpu": [
39
+ "x64",
40
+ "arm64"
41
+ ],
42
+ "files": [
43
+ "bin/",
44
+ "binaries/",
45
+ "README.md"
46
+ ],
47
+ "dependencies": {
48
+ "adm-zip": "^0.5.10",
49
+ "tar": "^7.4.3"
50
+ }
51
+ }