vibeusage 0.2.21 โ 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.
- package/README.md +306 -173
- package/README.old.md +324 -0
- package/README.zh-CN.md +304 -188
- package/package.json +32 -32
- package/src/cli.js +41 -37
- package/src/commands/activate-if-needed.js +41 -0
- package/src/commands/diagnostics.js +8 -9
- package/src/commands/doctor.js +31 -26
- package/src/commands/init.js +285 -218
- package/src/commands/status.js +86 -83
- package/src/commands/sync.js +182 -130
- package/src/commands/uninstall.js +66 -62
- package/src/lib/activation-check.js +290 -0
- package/src/lib/browser-auth.js +52 -54
- package/src/lib/claude-config.js +25 -25
- package/src/lib/cli-ui.js +35 -35
- package/src/lib/codex-config.js +40 -36
- package/src/lib/debug-flags.js +2 -2
- package/src/lib/diagnostics.js +70 -57
- package/src/lib/doctor.js +139 -132
- package/src/lib/fs.js +17 -17
- package/src/lib/gemini-config.js +44 -40
- package/src/lib/init-flow.js +16 -22
- package/src/lib/insforge-client.js +10 -10
- package/src/lib/insforge.js +9 -3
- package/src/lib/openclaw-hook.js +89 -66
- package/src/lib/openclaw-session-plugin.js +116 -92
- package/src/lib/opencode-config.js +31 -32
- package/src/lib/opencode-usage-audit.js +34 -31
- package/src/lib/progress.js +12 -13
- package/src/lib/project-usage-purge.js +23 -17
- package/src/lib/prompt.js +8 -4
- package/src/lib/rollout.js +342 -241
- package/src/lib/runtime-config.js +34 -22
- package/src/lib/subscriptions.js +94 -92
- package/src/lib/tracker-paths.js +6 -6
- package/src/lib/upload-throttle.js +35 -16
- package/src/lib/uploader.js +33 -29
- package/src/lib/vibeusage-api.js +72 -56
- 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
|
-
|
|
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
|
[](https://opensource.org/licenses/MIT)
|
|
13
|
-
[](https://www.npmjs.com/package/vibeusage)
|
|
14
|
+
[](https://nodejs.org/)
|
|
14
15
|
[](https://www.apple.com/macos/)
|
|
15
16
|
|
|
16
17
|
[**English**](README.md) โข [**ไธญๆ่ฏดๆ**](README.zh-CN.md)
|
|
17
18
|
|
|
18
|
-
[**Documentation**](docs/) โข [**Dashboard**](
|
|
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
|
|
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]
|
|
68
|
+
> [!TIP]
|
|
69
|
+
> **Core Index**: Our signature metric that reflects your flow state by analyzing token consumption rates and patterns.
|
|
33
70
|
|
|
34
|
-
##
|
|
71
|
+
## ๐ Dashboard Features
|
|
35
72
|
|
|
36
|
-
|
|
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
|
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
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
|
-
##
|
|
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
|
-
###
|
|
106
|
+
### Standard Setup
|
|
71
107
|
|
|
72
|
-
Initialize your environment once
|
|
108
|
+
Initialize your environment once - VibeUsage handles all synchronization automatically in the background:
|
|
73
109
|
|
|
74
110
|
```bash
|
|
75
|
-
npx
|
|
111
|
+
npx vibeusage init
|
|
76
112
|
```
|
|
77
113
|
|
|
78
|
-
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
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
|
-
|
|
149
|
+
## ๐ก Usage
|
|
102
150
|
|
|
103
|
-
### Sync
|
|
151
|
+
### Manual Sync
|
|
104
152
|
|
|
105
|
-
While sync happens automatically, you can manually trigger
|
|
153
|
+
While sync happens automatically, you can manually trigger synchronization anytime:
|
|
106
154
|
|
|
107
155
|
```bash
|
|
108
|
-
# Manually sync latest local session data
|
|
109
|
-
npx
|
|
156
|
+
# Manually sync latest local session data
|
|
157
|
+
npx vibeusage sync
|
|
110
158
|
|
|
111
159
|
# Check current link status
|
|
112
|
-
npx
|
|
160
|
+
npx vibeusage status
|
|
113
161
|
```
|
|
114
162
|
|
|
115
|
-
###
|
|
163
|
+
### Health Check
|
|
164
|
+
|
|
165
|
+
Run comprehensive diagnostics to identify issues:
|
|
116
166
|
|
|
117
167
|
```bash
|
|
118
|
-
#
|
|
119
|
-
npx
|
|
168
|
+
# Basic health check
|
|
169
|
+
npx vibeusage doctor
|
|
120
170
|
|
|
121
|
-
#
|
|
122
|
-
npx
|
|
171
|
+
# JSON output for debugging
|
|
172
|
+
npx vibeusage doctor --json --out doctor.json
|
|
123
173
|
|
|
124
|
-
#
|
|
125
|
-
npx
|
|
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
|
|
192
|
+
npx vibeusage uninstall
|
|
133
193
|
|
|
134
194
|
# Full purge - removes all data including config and cached sessions
|
|
135
|
-
npx
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
276
|
+
## ๐ง Troubleshooting
|
|
186
277
|
|
|
187
|
-
|
|
278
|
+
<details>
|
|
279
|
+
<summary><b>Data not appearing in Dashboard</b></summary>
|
|
188
280
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
-
|
|
194
|
-
npx --yes vibeusage doctor --json --out doctor.json
|
|
286
|
+
</details>
|
|
195
287
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
```
|
|
288
|
+
<details>
|
|
289
|
+
<summary><b>Streak shows 0 days while totals look correct</b></summary>
|
|
199
290
|
|
|
200
|
-
|
|
291
|
+
Streak is defined as consecutive days ending today. If today's total is 0, streak will be 0.
|
|
201
292
|
|
|
202
|
-
|
|
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
|
-
```
|
|
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
|
-
|
|
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
|
-
|
|
305
|
+
Note: `insforge-auth-token` is not used by the dashboard; use `vibeusage.dashboard.auth.v1`.
|
|
219
306
|
|
|
220
|
-
|
|
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
|
-
|
|
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
|
|
315
|
+
VIBEUSAGE_HTTP_TIMEOUT_MS=60000 npx vibeusage sync
|
|
231
316
|
```
|
|
232
317
|
|
|
233
|
-
|
|
318
|
+
</details>
|
|
234
319
|
|
|
235
|
-
|
|
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
|
-
###
|
|
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
|
-
###
|
|
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
|
-
#
|
|
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
|
-
###
|
|
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
|
-
#
|
|
309
|
-
|
|
380
|
+
# Validate Copy Registry
|
|
381
|
+
npm run validate:copy
|
|
382
|
+
|
|
383
|
+
# Generate architecture canvas
|
|
384
|
+
npm run architecture:canvas
|
|
310
385
|
|
|
311
|
-
#
|
|
312
|
-
|
|
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
|
|
323
|
-
<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
|