vibeusage 0.2.20 โ†’ 0.2.22

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.
Files changed (40) hide show
  1. package/README.md +306 -173
  2. package/README.old.md +324 -0
  3. package/README.zh-CN.md +304 -188
  4. package/package.json +32 -30
  5. package/src/cli.js +41 -37
  6. package/src/commands/activate-if-needed.js +41 -0
  7. package/src/commands/diagnostics.js +8 -9
  8. package/src/commands/doctor.js +31 -26
  9. package/src/commands/init.js +324 -208
  10. package/src/commands/status.js +86 -80
  11. package/src/commands/sync.js +182 -130
  12. package/src/commands/uninstall.js +69 -58
  13. package/src/lib/activation-check.js +290 -0
  14. package/src/lib/browser-auth.js +52 -54
  15. package/src/lib/claude-config.js +25 -25
  16. package/src/lib/cli-ui.js +35 -35
  17. package/src/lib/codex-config.js +40 -36
  18. package/src/lib/debug-flags.js +2 -2
  19. package/src/lib/diagnostics.js +73 -55
  20. package/src/lib/doctor.js +139 -132
  21. package/src/lib/fs.js +17 -17
  22. package/src/lib/gemini-config.js +44 -40
  23. package/src/lib/init-flow.js +16 -22
  24. package/src/lib/insforge-client.js +10 -10
  25. package/src/lib/insforge.js +9 -3
  26. package/src/lib/openclaw-hook.js +91 -67
  27. package/src/lib/openclaw-session-plugin.js +520 -0
  28. package/src/lib/opencode-config.js +31 -32
  29. package/src/lib/opencode-usage-audit.js +34 -31
  30. package/src/lib/progress.js +12 -13
  31. package/src/lib/project-usage-purge.js +23 -17
  32. package/src/lib/prompt.js +8 -4
  33. package/src/lib/rollout.js +342 -241
  34. package/src/lib/runtime-config.js +34 -22
  35. package/src/lib/subscriptions.js +94 -92
  36. package/src/lib/tracker-paths.js +6 -6
  37. package/src/lib/upload-throttle.js +35 -16
  38. package/src/lib/uploader.js +33 -29
  39. package/src/lib/vibeusage-api.js +72 -56
  40. package/src/lib/vibeusage-public-repo.js +41 -24
package/README.md CHANGED
@@ -4,18 +4,19 @@
4
4
 
5
5
  # ๐ŸŸข VIBEUSAGE
6
6
 
7
- **QUANTIFY YOUR AI OUTPUT**
8
- _Real-time AI Analytics for Codex CLI_
7
+ **QUANTIFY YOUR AI OUTPUT**
8
+ _Track AI Token Usage Across All Your CLI Tools_
9
9
 
10
10
  [**www.vibeusage.cc**](https://www.vibeusage.cc)
11
11
 
12
12
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
13
- [![Node.js Support](https://img.shields.io/badge/Node.js-%3E%3D18-brightgreen.svg)](https://nodejs.org/)
13
+ [![npm version](https://img.shields.io/npm/v/vibeusage.svg)](https://www.npmjs.com/package/vibeusage)
14
+ [![Node.js Support](https://img.shields.io/badge/Node.js-20.x-brightgreen.svg)](https://nodejs.org/)
14
15
  [![Platform](https://img.shields.io/badge/Platform-macOS-lightgrey.svg)](https://www.apple.com/macos/)
15
16
 
16
17
  [**English**](README.md) โ€ข [**ไธญๆ–‡่ฏดๆ˜Ž**](README.zh-CN.md)
17
18
 
18
- [**Documentation**](docs/) โ€ข [**Dashboard**](dashboard/) โ€ข [**Backend API**](BACKEND_API.md)
19
+ [**Documentation**](docs/) โ€ข [**Dashboard**](https://www.vibeusage.cc) โ€ข [**Backend API**](BACKEND_API.md)
19
20
 
20
21
  <br/>
21
22
 
@@ -25,127 +26,231 @@ _Real-time AI Analytics for Codex CLI_
25
26
 
26
27
  ---
27
28
 
29
+ ## ๐Ÿš€ Quick Start
30
+
31
+ Get started in 30 seconds:
32
+
33
+ ```bash
34
+ npx vibeusage init
35
+ ```
36
+
37
+ That's it! Your AI token usage will now automatically sync to the [Dashboard](https://www.vibeusage.cc) ๐ŸŽ‰
38
+
39
+ ## โœจ Why VibeUsage?
40
+
41
+ - ๐Ÿ“ก **Multi-Source Unified Tracking** - Support for Codex CLI, Every Code, Gemini CLI, Claude Code, Opencode, OpenClaw, and more
42
+ - ๐Ÿค– **Multi-Model Statistics** - Unified tracking for GPT-4, Claude, Gemini, o1, and all AI models
43
+ - ๐Ÿ“ **Project AI Footprint** - Track and publicly display token usage per repository, proving AI-assisted development
44
+ - ๐Ÿ† **Global Leaderboard** - Weekly/monthly/all-time rankings, grow with the global developer community
45
+ - ๐ŸŒ **Public Profiles** - Share your AI usage journey, optionally participate in leaderboards
46
+ - ๐Ÿ”’ **Privacy-First** - Only track numbers, never upload your code or conversations
47
+ - โšก **Zero-Config Auto-Sync** - Set up once, sync forever
48
+ - ๐ŸŽจ **Matrix-A Design** - Cyberpunk-style high-fidelity dashboard
49
+ - ๐Ÿ“ˆ **Deep Analytics** - Cost insights, trend forecasting, activity heatmaps
50
+
51
+ ## ๐Ÿงฐ Supported AI CLIs
52
+
53
+ | CLI Tool | Auto-Detection | Status |
54
+ |----------|----------------|--------|
55
+ | **Codex CLI** | โœ… | Full Support |
56
+ | **Every Code** | โœ… | Full Support |
57
+ | **Gemini CLI** | โœ… | Full Support |
58
+ | **Claude Code** | โœ… | Full Support |
59
+ | **Opencode** | โœ… | Full Support |
60
+ | **OpenClaw** | โœ… | Full Support |
61
+
62
+ Whether you're using GPT-4, Claude 3.5 Sonnet, o1, or Gemini - all token consumption is unified and tracked.
63
+
28
64
  ## ๐ŸŒŒ Overview
29
65
 
30
- **VibeUsage** is an intelligent token usage tracking system designed specifically for macOS developers. Through the all-new **Matrix-A Design System**, it provides a high-fidelity cyberpunk-style dashboard that transforms your **AI Output** into quantifiable metrics, supported by the **Neural Divergence Map** for real-time monitoring of multi-model compute distribution.
66
+ **VibeUsage** is an intelligent token usage tracking system designed for macOS developers. Through the all-new **Matrix-A Design System**, it provides a high-fidelity cyberpunk-style dashboard that transforms your **AI Output** into quantifiable metrics, supported by the **Neural Divergence Map** for real-time monitoring of multi-model compute distribution.
31
67
 
32
- > [!TIP] > **Core Index**: Our signature metric that reflects your flow state by analyzing token consumption rates and patterns.
68
+ > [!TIP]
69
+ > **Core Index**: Our signature metric that reflects your flow state by analyzing token consumption rates and patterns.
33
70
 
34
- ## ๐Ÿ”’ Privacy-First Architecture (Stealth Protocol)
71
+ ## ๐Ÿ“Š Dashboard Features
35
72
 
36
- We believe your code and thoughts are your own. VibeUsage is built with strict privacy pillars to ensure your data never leaves your control.
73
+ ### ๐ŸŽจ Matrix-A Design System
74
+ High-performance dashboard built with React + Vite, featuring our cyberpunk-inspired design language with:
75
+ - **Neural Divergence Map**: Visualize multi-engine load balancing and compute distribution
76
+ - **Cost Intelligence**: Real-time, multi-dimensional cost breakdown and forecasting
77
+ - **Activity Heatmap**: GitHub-style contribution graph with streak tracking
78
+ - **Smart Notifications**: Non-intrusive system-level alerts with Golden visual style
79
+
80
+ ### ๐Ÿ“ˆ Analytics & Insights
81
+ - **AI Analytics**: Deep analysis of Input/Output tokens with dedicated tracking for Cached and Reasoning components
82
+ - **Model Breakdown**: Per-model usage statistics and cost analysis
83
+ - **Project Stats**: Track token usage by GitHub repository
84
+ - **Trend Forecasting**: Predict future usage patterns
37
85
 
38
- - ๐Ÿ›ก๏ธ **No Content Upload**: We never upload prompts or responses. We only compute token counts locally and send counts plus minimal metadata (timestamps, model, device).
39
- - ๐Ÿ“ก **Local Aggregation**: All token consumption analysis happens on your machine. We only relay quantized 30-minute usage buckets to the cloud.
40
- - ๐Ÿ” **Hashed Identity**: Device tokens are hashed using SHA-256 server-side. Your raw credentials never exist in our database.
41
- - ๐Ÿ”ฆ **Full Transparency**: Audit the sync logic yourself in `src/lib/rollout.js`. We literally only capture numbers and timestamps.
42
-
43
- ## ๐Ÿš€ Key Features
44
-
45
- - ๐Ÿ“ก **Auto-Sync**: Real-time interception of AI CLI pipes with **automatic background synchronization**. Once initialized, your tokens are tracked and synced without any manual commands.
46
- - ๐Ÿงญ **Universal-Sync**: Native support for multiple AI CLI tools:
47
- - **Codex CLI** - OpenAI's official CLI
48
- - **Every Code** - Community Codex alternative
49
- - **Gemini CLI** - Google's AI CLI
50
- - **Opencode** - AI coding assistant
51
- - **Claude Code** - Anthropic's official CLI
52
- - Whether it's GPT-4, Claude 3.5 Sonnet, or o1/Gemini, token consumption from all models is unified and counted.
53
- - ๐Ÿ“Š **Matrix Dashboard**: High-performance dashboard built with React + Vite, featuring the new **Matrix-A** design language.
54
- - **Neural Divergence Map**: Visualize multi-engine load balancing and compute distribution.
55
- - **Cost Intelligence**: Real-time, multi-dimensional cost breakdown and forecasting.
56
- - **Activity Heatmap**: GitHub-style contribution graph with streak tracking.
57
- - **Smart Notifications**: Non-intrusive system-level alerts using a Golden (Gold/Amber) visual style for high-value information.
58
- - โšก **AI Analytics**: Deep analysis of Input/Output tokens, with dedicated tracking for Cached and Reasoning components.
59
- - ๐Ÿ“ˆ **Leaderboard**: Daily, weekly, monthly, and all-time rankings with privacy-safe display names.
60
- - ๐ŸŒ **Public View**: Share your AI usage journey with a privacy-safe public profile.
61
- - ๐Ÿ“ **Project Stats**: Track token usage by project/repository across all time.
62
- - ๐Ÿ”’ **Identity Core**: Robust authentication and permission management to secure your development data.
63
-
64
- ### ๐ŸŒŒ Visual Preview
86
+ ### ๐Ÿ† Community Features
87
+ - **Global Leaderboard**: Daily, weekly, monthly, and all-time rankings with privacy-safe display names
88
+ - **Public Profiles**: Share your AI usage journey with a privacy-safe public profile
89
+ - **Leaderboard Categories**: Compete in overall rankings or by specific models (GPT, Claude, etc.)
65
90
 
66
91
  <img src="docs/screenshots/landing.png" width="900" alt="VibeUsage Landing Preview"/>
67
92
 
68
- ## ๐Ÿ› ๏ธ Quick Start
93
+ ## ๐Ÿ”’ Privacy Guarantee
94
+
95
+ We believe your code and thoughts are your own. VibeUsage is built with strict privacy pillars to ensure your data never leaves your control.
96
+
97
+ | Protection | Description |
98
+ |------------|-------------|
99
+ | ๐Ÿ›ก๏ธ **No Content Upload** | Never upload prompts or responses - only compute token counts locally |
100
+ | ๐Ÿ“ก **Local Aggregation** | All analysis happens on your machine - only send 30-minute usage buckets |
101
+ | ๐Ÿ” **Hashed Identity** | Device tokens are SHA-256 hashed server-side - raw credentials never stored |
102
+ | ๐Ÿ”ฆ **Full Transparency** | Audit the sync logic yourself in `src/lib/rollout.js` - literally only numbers and timestamps |
103
+
104
+ ## ๐Ÿ“ฆ Installation
69
105
 
70
- ### Installation
106
+ ### Standard Setup
71
107
 
72
- Initialize your environment once and forget it. VibeUsage handles all synchronization in the background automatically.
108
+ Initialize your environment once - VibeUsage handles all synchronization automatically in the background:
73
109
 
74
110
  ```bash
75
- npx --yes vibeusage init
111
+ npx vibeusage init
76
112
  ```
77
113
 
78
- **Authentication Methods:**
114
+ ### Authentication Methods
79
115
 
80
116
  1. **Browser Auth** (default) - Opens browser for secure authentication
81
117
  2. **Link Code** - Use `--link-code` to authenticate via dashboard-generated code
82
118
  3. **Password** - Direct password authentication (fallback)
83
119
  4. **Access Token** - For CI/automated environments
84
120
 
85
- **CLI Options:**
86
- - `--yes` - Skip consent prompts in non-interactive environments
87
- - `--dry-run` - Preview changes without writing files
88
- - `--link-code <code>` - Authenticate using a link code from dashboard
89
- - `--base-url <url>` - Override the default API endpoint
121
+ ### CLI Options
122
+
123
+ ```bash
124
+ npx vibeusage init [options]
125
+
126
+ Options:
127
+ --yes Skip consent prompts (non-interactive environments)
128
+ --dry-run Preview changes without writing files
129
+ --link-code <code> Authenticate using a link code from dashboard
130
+ --base-url <url> Override the default API endpoint
131
+ --debug Enable debug output
132
+ ```
133
+
134
+ ### Auto-Configuration
90
135
 
91
- **Supported CLI Tools Auto-Configuration:**
136
+ Once `init` completes, all supported CLI tools are automatically configured for data sync:
92
137
 
93
138
  | Tool | Config Location | Method |
94
139
  |------|----------------|--------|
95
- | Codex CLI | `~/.codex/config.toml` | `notify` hook |
96
- | Every Code | `~/.code/config.toml` (or `CODE_HOME`) | `notify` hook |
97
- | Gemini CLI | `~/.gemini/settings.json` (or `GEMINI_HOME`) | `SessionEnd` hook |
98
- | Opencode | Global plugins | Message parser plugin |
99
- | Claude Code | `~/.claude/hooks/` | Hook configuration |
140
+ | **Codex CLI** | `~/.codex/config.toml` | `notify` hook |
141
+ | **Every Code** | `~/.code/config.toml` (or `CODE_HOME`) | `notify` hook |
142
+ | **Gemini CLI** | `~/.gemini/settings.json` (or `GEMINI_HOME`) | `SessionEnd` hook |
143
+ | **Opencode** | Global plugins | Message parser plugin |
144
+ | **Claude Code** | `~/.claude/hooks/` | Hook configuration |
145
+ | **OpenClaw** | Auto-links when installed | Gateway hook (requires restart) |
146
+
147
+ No further intervention required! ๐ŸŽ‰
100
148
 
101
- Once `init` completes, all supported CLI tools are automatically configured for data sync. No further intervention required.
149
+ ## ๐Ÿ’ก Usage
102
150
 
103
- ### Sync & Status
151
+ ### Manual Sync
104
152
 
105
- While sync happens automatically, you can manually trigger a synchronization or check status anytime:
153
+ While sync happens automatically, you can manually trigger synchronization anytime:
106
154
 
107
155
  ```bash
108
- # Manually sync latest local session data (Optional)
109
- npx --yes vibeusage sync
156
+ # Manually sync latest local session data
157
+ npx vibeusage sync
110
158
 
111
159
  # Check current link status
112
- npx --yes vibeusage status
160
+ npx vibeusage status
113
161
  ```
114
162
 
115
- ### Doctor
163
+ ### Health Check
164
+
165
+ Run comprehensive diagnostics to identify issues:
116
166
 
117
167
  ```bash
118
- # Run health checks
119
- npx --yes vibeusage doctor
168
+ # Basic health check
169
+ npx vibeusage doctor
120
170
 
121
- # Emit JSON report (and write to file)
122
- npx --yes vibeusage doctor --json --out doctor.json
171
+ # JSON output for debugging
172
+ npx vibeusage doctor --json --out doctor.json
123
173
 
124
- # Override base URL (diagnostics only)
125
- npx --yes vibeusage doctor --base-url https://example.invalid
174
+ # Test against a different endpoint
175
+ npx vibeusage doctor --base-url https://your-instance.insforge.app
176
+ ```
177
+
178
+ ### Debug Mode
179
+
180
+ Enable debug output to see detailed request/response information:
181
+
182
+ ```bash
183
+ VIBEUSAGE_DEBUG=1 npx vibeusage sync
184
+ # or
185
+ npx vibeusage sync --debug
126
186
  ```
127
187
 
128
188
  ### Uninstall
129
189
 
130
190
  ```bash
131
191
  # Standard uninstall (keeps data)
132
- npx --yes vibeusage uninstall
192
+ npx vibeusage uninstall
133
193
 
134
194
  # Full purge - removes all data including config and cached sessions
135
- npx --yes vibeusage uninstall --purge
195
+ npx vibeusage uninstall --purge
196
+ ```
197
+
198
+ ## ๐Ÿ—๏ธ Architecture
199
+
200
+ ```mermaid
201
+ graph LR
202
+ A[Codex CLI] -->|Rollout Logs| G(Tracker CLI)
203
+ B[Every Code] -->|Rollout Logs| G
204
+ C[Gemini CLI] -->|Session Logs| G
205
+ D[Opencode] -->|Message Logs| G
206
+ E[Claude Code] -->|Hook Output| G
207
+ F[OpenClaw] -->|Gateway Hook| G
208
+ G -->|AI Tokens| H{Core Relay}
209
+ H --> I[VibeUsage Dashboard]
210
+ H --> J[AI Analytics Engine]
211
+ H --> K[Leaderboard Service]
212
+ H --> L[Public View API]
136
213
  ```
137
214
 
215
+ ### Tech Stack
216
+
217
+ - **CLI**: Node.js 20.x, CommonJS
218
+ - **Dashboard**: React 18 + Vite + TailwindCSS + TypeScript
219
+ - **Backend**: InsForge Edge Functions (Deno)
220
+ - **Database**: InsForge Database (PostgreSQL)
221
+ - **Design**: Matrix-A Design System
222
+
223
+ ### Components
224
+
225
+ - **Tracker CLI** (`src/`): Node.js CLI that parses logs from multiple AI tools and syncs token data
226
+ - **Core Relay** (InsForge Edge Functions): Serverless backend handling ingestion, aggregation, and API
227
+ - **Dashboard** (`dashboard/`): React + Vite frontend for visualization
228
+ - **AI Analytics Engine**: Cost calculation, model breakdown, and usage forecasting
229
+
230
+ ### Data Flow
231
+
232
+ 1. AI CLI tools generate logs during usage
233
+ 2. Local `notify-handler` detects changes and triggers sync
234
+ 3. CLI incrementally parses logs, extracts token counts (whitelist fields only)
235
+ 4. Data aggregated into 30-minute UTC buckets locally
236
+ 5. Batch upload to InsForge with idempotent deduplication
237
+ 6. Dashboard queries aggregated results for visualization
238
+
138
239
  ### Log Sources
139
240
 
140
241
  | Tool | Log Location | Override Env |
141
242
  |------|-------------|--------------|
142
- | Codex CLI | `~/.codex/sessions/**/rollout-*.jsonl` | `CODEX_HOME` |
143
- | Every Code | `~/.code/sessions/**/rollout-*.jsonl` | `CODE_HOME` |
144
- | Gemini CLI | `~/.gemini/tmp/**/chats/session-*.json` | `GEMINI_HOME` |
145
- | Opencode | `~/.opencode/messages/*.json` | - |
146
- | Claude Code | Parsed from hook output | - |
243
+ | **Codex CLI** | `~/.codex/sessions/**/rollout-*.jsonl` | `CODEX_HOME` |
244
+ | **Every Code** | `~/.code/sessions/**/rollout-*.jsonl` | `CODE_HOME` |
245
+ | **Gemini CLI** | `~/.gemini/tmp/**/chats/session-*.json` | `GEMINI_HOME` |
246
+ | **Opencode** | `~/.opencode/messages/*.json` | - |
247
+ | **Claude Code** | Parsed from hook output | - |
248
+ | **OpenClaw** | Gateway hook integration | - |
249
+
250
+ ## โš™๏ธ Configuration
147
251
 
148
- ## ๐Ÿ”ง Environment Variables
252
+ <details>
253
+ <summary><b>Environment Variables</b></summary>
149
254
 
150
255
  ### Core Settings
151
256
 
@@ -166,43 +271,28 @@ npx --yes vibeusage uninstall --purge
166
271
  | `CODE_HOME` | Every Code directory override | `~/.code` |
167
272
  | `GEMINI_HOME` | Gemini CLI directory override | `~/.gemini` |
168
273
 
169
- ### Deprecated
170
-
171
- - `VIBEUSAGE_ROLLUP_ENABLED`: Currently ignored; rollup aggregation is disabled pending table deployment.
172
-
173
- ## ๐Ÿงฐ Troubleshooting
174
-
175
- ### Debug Mode
176
-
177
- Enable debug output to see detailed request/response information:
178
-
179
- ```bash
180
- VIBEUSAGE_DEBUG=1 npx --yes vibeusage sync
181
- # or
182
- npx --yes vibeusage sync --debug
183
- ```
274
+ </details>
184
275
 
185
- ### Health Check
276
+ ## ๐Ÿ”ง Troubleshooting
186
277
 
187
- Run the built-in doctor command to diagnose issues:
278
+ <details>
279
+ <summary><b>Data not appearing in Dashboard</b></summary>
188
280
 
189
- ```bash
190
- # Basic health check
191
- npx --yes vibeusage doctor
281
+ 1. Check status: `npx vibeusage status`
282
+ 2. Force manual sync: `npx vibeusage sync`
283
+ 3. Verify CLI tool hooks are configured (re-run `init` if needed)
284
+ 4. Check debug output: `VIBEUSAGE_DEBUG=1 npx vibeusage sync`
192
285
 
193
- # JSON output for debugging
194
- npx --yes vibeusage doctor --json --out doctor.json
286
+ </details>
195
287
 
196
- # Test against a different endpoint
197
- npx --yes vibeusage doctor --base-url https://your-instance.insforge.app
198
- ```
288
+ <details>
289
+ <summary><b>Streak shows 0 days while totals look correct</b></summary>
199
290
 
200
- ### Streak shows 0 days while totals look correct
291
+ Streak is defined as consecutive days ending today. If today's total is 0, streak will be 0.
201
292
 
202
- - Streak is defined as consecutive days ending today. If today's total is 0, streak will be 0.
203
- - If you expect a non-zero streak, clear cached auth/heatmap data and sign in again:
293
+ If you expect a non-zero streak, clear cached auth/heatmap data and sign in again:
204
294
 
205
- ```js
295
+ ```javascript
206
296
  localStorage.removeItem("vibeusage.dashboard.auth.v1");
207
297
  Object.keys(localStorage)
208
298
  .filter((k) => k.startsWith("vibeusage.heatmap."))
@@ -210,115 +300,158 @@ Object.keys(localStorage)
210
300
  location.reload();
211
301
  ```
212
302
 
213
- - Complete the landing page sign-in flow again after reload.
214
- - Note: `insforge-auth-token` is not used by the dashboard; use `vibeusage.dashboard.auth.v1`.
215
-
216
- ### Sync Issues
303
+ Complete the landing page sign-in flow again after reload.
217
304
 
218
- If data isn't appearing in the dashboard:
305
+ Note: `insforge-auth-token` is not used by the dashboard; use `vibeusage.dashboard.auth.v1`.
219
306
 
220
- 1. Check status: `npx --yes vibeusage status`
221
- 2. Force manual sync: `npx --yes vibeusage sync`
222
- 3. Verify CLI tool hooks are configured (re-run `init` if needed)
223
- 4. Check debug output: `VIBEUSAGE_DEBUG=1 npx vibeusage sync`
307
+ </details>
224
308
 
225
- ### Timeout Errors
309
+ <details>
310
+ <summary><b>Timeout errors on slow connections</b></summary>
226
311
 
227
312
  Increase HTTP timeout for slow connections:
228
313
 
229
314
  ```bash
230
- VIBEUSAGE_HTTP_TIMEOUT_MS=60000 npx --yes vibeusage sync
315
+ VIBEUSAGE_HTTP_TIMEOUT_MS=60000 npx vibeusage sync
231
316
  ```
232
317
 
233
- ## ๐Ÿ—๏ธ Architecture
318
+ </details>
234
319
 
235
- ```mermaid
236
- graph TD
237
- A[Codex CLI] -->|Rollout Logs| F(Tracker CLI)
238
- B[Every Code] -->|Rollout Logs| F
239
- C[Gemini CLI] -->|Session Logs| F
240
- D[Opencode] -->|Message Logs| F
241
- E[Claude Code] -->|Hook Output| F
242
- F -->|AI Tokens| G{Core Relay}
243
- G --> H[VibeUsage Dashboard]
244
- G --> I[AI Analytics Engine]
245
- G --> J[Leaderboard Service]
246
- G --> K[Public View API]
247
- ```
320
+ ## ๐Ÿ’ป Development
248
321
 
249
- ### Components
250
-
251
- - **Tracker CLI** (`src/`): Node.js CLI that parses logs from multiple AI tools and syncs token data
252
- - **Core Relay** (InsForge Edge Functions): Serverless backend handling ingestion, aggregation, and API
253
- - **Dashboard** (`dashboard/`): React + Vite frontend for visualization
254
- - **AI Analytics Engine**: Cost calculation, model breakdown, and usage forecasting
255
-
256
- ## ๐Ÿ’ป Developer Guide
257
-
258
- To run locally or contribute:
259
-
260
- ### Dashboard Development
322
+ ### Local Development
261
323
 
262
324
  ```bash
325
+ # Clone the repository
326
+ git clone https://github.com/your-username/vibeusage.git
327
+ cd vibeusage
328
+
263
329
  # Install dependencies
264
- cd dashboard
265
330
  npm install
266
331
 
267
- # Start dev server
332
+ # Start dashboard dev server
333
+ cd dashboard
334
+ npm install
268
335
  npm run dev
269
336
  ```
270
337
 
271
- ### Debug Payload (Usage Endpoints)
272
-
273
- When `debug=1` is included in a usage endpoint request, the response adds a `debug` object that helps the dashboard attribute slow queries without relying on response headers.
274
-
275
- ```ts
276
- const res = await fetch(
277
- `${baseUrl}/functions/vibeusage-usage-summary?from=2025-12-30&to=2025-12-30&debug=1`,
278
- {
279
- headers: { Authorization: `Bearer ${userJwt}` }
280
- }
281
- );
282
- const data = await res.json();
283
-
284
- if (data.debug) {
285
- console.debug('usage debug', {
286
- requestId: data.debug.request_id,
287
- status: data.debug.status,
288
- queryMs: data.debug.query_ms,
289
- slowThresholdMs: data.debug.slow_threshold_ms,
290
- slowQuery: data.debug.slow_query
291
- });
292
- }
293
- ```
294
-
295
- ### Architecture Validation
338
+ ### Development Commands
296
339
 
297
340
  ```bash
298
- # Validate Copy Registry
341
+ # Run tests
342
+ npm test
343
+
344
+ # Run local CI checks
345
+ npm run ci:local
346
+
347
+ # Validate copy registry
299
348
  npm run validate:copy
300
349
 
350
+ # Validate UI hardcoded text
351
+ npm run validate:ui-hardcode
352
+
353
+ # Validate architecture guardrails
354
+ npm run validate:guardrails
355
+
356
+ # Build backend functions
357
+ npm run build:insforge
358
+
359
+ # Check backend build (no write)
360
+ npm run build:insforge:check
361
+
301
362
  # Run smoke tests
302
363
  npm run smoke
303
364
  ```
304
365
 
305
- ### Architecture Canvas Focus
366
+ ### OpenSpec Workflow
367
+
368
+ This project uses **OpenSpec** for spec-driven development. Before making significant changes:
369
+
370
+ 1. Read [`openspec/project.md`](openspec/project.md) for project conventions
371
+ 2. Check [`openspec/AGENTS.md`](openspec/AGENTS.md) for the full OpenSpec workflow
372
+ 3. Run `openspec list` to see active changes
373
+ 4. Run `openspec list --specs` to see existing specifications
374
+
375
+ See [CLAUDE.md](CLAUDE.md) for detailed guidelines.
376
+
377
+ ### Architecture Validation
306
378
 
307
379
  ```bash
308
- # Generate a focused canvas for a top-level module
309
- node scripts/ops/architecture-canvas.cjs --focus src
380
+ # Validate Copy Registry
381
+ npm run validate:copy
382
+
383
+ # Generate architecture canvas
384
+ npm run architecture:canvas
310
385
 
311
- # Alias: --module
312
- node scripts/ops/architecture-canvas.cjs --module dashboard
386
+ # Generate focused canvas for a module
387
+ npm run architecture:canvas:focus -- src
313
388
  ```
314
389
 
390
+ ## ๐Ÿ—บ๏ธ Roadmap
391
+
392
+ - [ ] Windows support
393
+ - [ ] Linux support
394
+ - [ ] Enhanced project-level statistics
395
+ - [ ] Team collaboration features
396
+ - [ ] Custom report exports
397
+ - [ ] Additional AI CLI support
398
+
399
+ See [Issues](https://github.com/your-username/vibeusage/issues) for detailed plans.
400
+
401
+ ## ๐Ÿค Contributing
402
+
403
+ We welcome all forms of contributions!
404
+
405
+ 1. Fork the repository
406
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
407
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
408
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
409
+ 5. Create a Pull Request
410
+
411
+ ### Development Guidelines
412
+
413
+ - All user-facing text must be registered in `dashboard/src/content/copy.csv`
414
+ - Follow the OpenSpec proposal process for significant changes
415
+ - Code must pass all tests and validations
416
+ - See [CLAUDE.md](CLAUDE.md) for detailed conventions
417
+
315
418
  ## ๐Ÿ“œ License
316
419
 
317
420
  This project is licensed under the [MIT License](LICENSE).
318
421
 
422
+ ## ๐Ÿ™ Acknowledgments
423
+
424
+ - [InsForge](https://insforge.app) - Backend infrastructure
425
+ - [Matrix-A Design System](docs/dashboard/matrix-a.md) - UI framework
426
+ - All our amazing contributors
427
+
319
428
  ---
320
429
 
321
430
  <div align="center">
322
- <b>System_Ready // 2024 VibeUsage OS</b><br/>
323
- <i>"More Tokens. More Vibe."</i>
431
+ <b>System_Ready // 2024-2026 VibeUsage</b><br/>
432
+ <i>"Quantify Your AI Output. Own Your Data."</i><br/><br/>
433
+
434
+ Made with ๐Ÿ’š by developers, for developers
435
+
436
+ [Website](https://www.vibeusage.cc) โ€ข
437
+ [Dashboard](https://www.vibeusage.cc) โ€ข
438
+ [Docs](docs/) โ€ข
439
+ [API](BACKEND_API.md)
324
440
  </div>
441
+
442
+
443
+ ## AI Agent ๅฟซ้€Ÿๅฎ‰่ฃ…
444
+
445
+ ๅคๅˆถไปฅไธ‹ๅ†…ๅฎนๅ‘้€็ป™ไฝ ็š„ AI ๅŠฉๆ‰‹๏ผš
446
+
447
+ ```
448
+ ่ฏทๅธฎๆˆ‘ๅฎ‰่ฃ… VibeUsage ๆฅ่ฟฝ่ธช AI Token ็”จ้‡ใ€‚
449
+
450
+ ๆ‰ง่กŒไปฅไธ‹ๅ‘ฝไปค๏ผš
451
+ npx --yes vibeusage init
452
+
453
+ ๅฎ‰่ฃ…ๅฎŒๆˆๅŽ้ชŒ่ฏ๏ผš
454
+ vibeusage status
455
+ ```
456
+
457
+ ๆˆ–่€…ๆŸฅ็œ‹ๅฎŒๆ•ดๆŒ‡ๅ—: https://github.com/victorGPT/vibeusage/blob/main/docs/AI_AGENT_INSTALL.md