@mai0313/vct 0.17.0 → 1.1.0

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 CHANGED
@@ -143,7 +143,6 @@ vct <COMMAND> [OPTIONS]
143
143
  Commands:
144
144
  analysis Analyze JSONL conversation files (single file or all sessions)
145
145
  usage Display token usage statistics
146
- statusline Cache Claude Code rate limits from a statusLine hook (stdin JSON)
147
146
  version Display version information
148
147
  update Update to the latest version from GitHub releases
149
148
  help Print this message or the help of the given subcommand(s)
@@ -236,21 +235,27 @@ The tool automatically scans these directories:
236
235
 
237
236
  ### Live Quota Panels
238
237
 
239
- At the bottom of the interactive dashboard, the per-provider stats sit on the left and two live quota panels sit on the right:
238
+ `vct usage` shows **live remaining quota for Claude Code and Codex right in the dashboard — with zero setup.** No status-line hook, no config file: vct reads each provider's own OAuth credentials, calls its usage API on a background thread, and keeps the panels current while you work.
240
239
 
241
240
  ```
242
- ┌ Provider/Tokens/Cost/Days ┬ Claude ────────┬ Codex ──────────┐
243
- │ Claude 1.2M $3.00 4d │ 5h ▰▰▱▱▱ 16% │ Plan: plus │
244
- │ Codex 800K $0.00 6d │ ↻ 4h13m │ 5h ▰▰▱▱▱ 27% │
245
- │ ... │ 7d ▰▰▰▱▱ 28% │ 7d ▱▱▱▱▱ 4% │
246
- │ │ updated 2m ago │ Credits: 0 +2 │
247
- └───────────────────────────┴────────────────┴─────────────────┘
241
+ ┌ Provider/Tokens/Cost/Days ┬ Claude ───────────────────┬ Codex ────────────────────┐
242
+ │ Claude 1.2M $3.00 4d │ Plan: max 20x │ Plan: plus │
243
+ │ Codex 800K $0.00 6d │ 5h ▰▱▱▱▱ 16% ↻ 2h0m │ 5h ▰▰▱▱▱ 37% ↻ 2h33m │
244
+ │ ... │ 7d ▰▰▱▱▱ 41% ↻ 5d │ 7d ▰▰▱▱▱ 24% ↻ 3d16h │
245
+ │ │ Opus ▰▰▰▱▱ 61% ↻ 5d │ Credits: 0 +3 reset │
246
+ │ │ Balance: - $0.00 used │ updated just now │
247
+ │ │ updated just now │ │
248
+ └───────────────────────────┴────────────────────────────┴────────────────────────────┘
248
249
  ```
249
250
 
250
- - **Claude** — 5-hour and weekly rate-limit usage. Claude Code only exposes these limits through its `statusLine` hook, so wire `vct statusline ingest` into your statusLine (see [Statusline Command](#statusline-command)) for this panel to populate.
251
- - **Codex** — plan tier, 5-hour and weekly usage, and credit balance. Pulled live from the ChatGPT backend (`wham/usage`) using the token in `~/.codex/auth.json` on a background thread; when unavailable it falls back to the newest `rate_limits` in your Codex session logs (the title shows `(API)` vs `(session)`).
251
+ - **Claude** — plan tier, 5-hour, weekly, and per-model weekly usage from the official OAuth usage API (`GET /api/oauth/usage`), read from `~/.claude/.credentials.json`, plus your credit balance. Polled about once a minute to stay under the endpoint's rate limit; a red `LIMIT` flag appears in the title when a cap is hit. The per-model weekly row is best-effort and simply hides when that scope is not returned.
252
+ - **Codex** — plan tier, 5-hour and weekly usage, and credit balance from the ChatGPT backend (`wham/usage`) using `~/.codex/auth.json` (with approximate remaining messages / spend cap when applicable); falls back to the newest `rate_limits` in your Codex session logs when the API is unavailable (the title shows `Codex` vs `Codex (session)`).
252
253
 
253
- Quota panels appear only in the interactive TUI; `--table`, `--text`, and `--json` are unchanged.
254
+ **Automatic token refresh.** For both providers, when a token is near expiry or rejected, vct refreshes it and writes the new token back to the provider's own credential file (in that CLI's exact format), so a token is reused across checks rather than refreshed every time. If a refresh cannot proceed, the panel shows a `run: <provider> auth login` hint instead of breaking.
255
+
256
+ A panel appears only for a provider whose credentials are present. Quota panels appear only in the interactive TUI; `--table`, `--text`, and `--json` are unchanged.
257
+
258
+ > **Platform note:** on macOS, Claude Code stores its OAuth credentials in the system Keychain rather than `~/.claude/.credentials.json`, so the Claude panel is not shown on macOS.
254
259
 
255
260
  ---
256
261
 
@@ -324,35 +329,6 @@ vct analysis --output today.json --daily
324
329
 
325
330
  ---
326
331
 
327
- ## Statusline Command
328
-
329
- **Feed Claude Code rate limits into the `usage` dashboard.**
330
-
331
- Claude Code only exposes its 5-hour / weekly rate limits through the `statusLine` hook's stdin JSON, so `vct` captures them from there and caches them to `~/.vibe_coding_tracker/claude_rate_limits.json` for the Claude quota panel.
332
-
333
- ### If you already have a statusLine
334
-
335
- Add one backgrounded line to your existing statusLine script. It has zero impact on your current display and is isolated, so a vct error can never disturb the statusLine:
336
-
337
- ```bash
338
- printf '%s' "$input" | vct statusline ingest >/dev/null 2>&1 &
339
- ```
340
-
341
- ### If you do not have a statusLine yet
342
-
343
- Point Claude Code's `~/.claude/settings.json` straight at vct, which caches the limits and prints a compact one-line status:
344
-
345
- ```json
346
- {
347
- "statusLine": {
348
- "type": "command",
349
- "command": "vct statusline"
350
- }
351
- }
352
- ```
353
-
354
- ---
355
-
356
332
  ## Update Command
357
333
 
358
334
  **Keep your installation up-to-date automatically.**
package/README.zh-CN.md CHANGED
@@ -143,7 +143,6 @@ vct <COMMAND> [OPTIONS]
143
143
  Commands:
144
144
  analysis Analyze JSONL conversation files (single file or all sessions)
145
145
  usage Display token usage statistics
146
- statusline Cache Claude Code rate limits from a statusLine hook (stdin JSON)
147
146
  version Display version information
148
147
  update Update to the latest version from GitHub releases
149
148
  help Print this message or the help of the given subcommand(s)
@@ -236,21 +235,27 @@ vct usage --json --daily
236
235
 
237
236
  ### 实时额度面板
238
237
 
239
- 在交互式仪表盘底部,左侧是各 provider 统计,右侧是两个实时额度面板:
238
+ `vct usage` 会**在仪表盘中直接显示 Claude Code 与 Codex 的实时剩余额度——完全零配置。** 不需要 status-line hook,也不需要配置文件:vct 会读取各 provider 自己的 OAuth 凭证,在后台线程调用其用量 API,并在你工作时保持面板持续更新。
240
239
 
241
240
  ```
242
- ┌ Provider/Tokens/Cost/Days ┬ Claude ────────┬ Codex ──────────┐
243
- │ Claude 1.2M $3.00 4d │ 5h ▰▰▱▱▱ 16% │ Plan: plus │
244
- │ Codex 800K $0.00 6d │ ↻ 4h13m │ 5h ▰▰▱▱▱ 27% │
245
- │ ... │ 7d ▰▰▰▱▱ 28% │ 7d ▱▱▱▱▱ 4% │
246
- │ │ updated 2m ago │ Credits: 0 +2 │
247
- └───────────────────────────┴────────────────┴─────────────────┘
241
+ ┌ Provider/Tokens/Cost/Days ┬ Claude ───────────────────┬ Codex ────────────────────┐
242
+ │ Claude 1.2M $3.00 4d │ Plan: max 20x │ Plan: plus │
243
+ │ Codex 800K $0.00 6d │ 5h ▰▱▱▱▱ 16% ↻ 2h0m │ 5h ▰▰▱▱▱ 37% ↻ 2h33m │
244
+ │ ... │ 7d ▰▰▱▱▱ 41% ↻ 5d │ 7d ▰▰▱▱▱ 24% ↻ 3d16h │
245
+ │ │ Opus ▰▰▰▱▱ 61% ↻ 5d │ Credits: 0 +3 reset │
246
+ │ │ Balance: - $0.00 used │ updated just now │
247
+ │ │ updated just now │ │
248
+ └───────────────────────────┴────────────────────────────┴────────────────────────────┘
248
249
  ```
249
250
 
250
- - **Claude** — 5 小时和每周的额度用量。Claude Code 仅通过 `statusLine` hook 暴露这些额度,需将 `vct statusline ingest` 接入你的 statusLine(见 [Statusline 命令](#statusline-%E5%91%BD%E4%BB%A4))此面板才会有数据。
251
- - **Codex** — 套餐类型、5 小时和每周用量、额度余额。后台线程使用 `~/.codex/auth.json` 中的 token 从 ChatGPT 后端(`wham/usage`)实时拉取;不可用时回退到 Codex 会话日志中最新的 `rate_limits`(标题显示 `(API)` 或 `(session)`)。
251
+ - **Claude** — 方案类型、5 小时、每周以及单模型每周用量,来自官方 OAuth 用量 API(`GET /api/oauth/usage`),从 `~/.claude/.credentials.json` 读取,并显示额度余额。约每分钟轮询一次以避开该端点的速率限制;触及上限时标题会出现红色 `LIMIT` 标记。单模型每周那一行属于尽力而为,未返回该范围时就自动隐藏。
252
+ - **Codex** — 套餐类型、5 小时和每周用量以及额度余额,使用 `~/.codex/auth.json` 从 ChatGPT 后端(`wham/usage`)获取(在适用时显示大致剩余讯息数 / 消费上限);API 不可用时回退到 Codex 会话日志中最新的 `rate_limits`(标题显示 `Codex` 或 `Codex (session)`)。
252
253
 
253
- 额度面板仅在交互式 TUI 中显示;`--table`、`--text`、`--json` 不受影响。
254
+ **自动刷新 token。** 对这两个 provider,当 token 接近过期或被拒绝时,vct 会刷新它并把新 token 写回该 provider 自己的凭证文件(采用该 CLI 的原始格式),因此 token 会在多次检查之间复用,而不是每次都重新刷新。如果刷新失败,面板会显示 `run: <provider> auth login` 提示,而不会直接中断。
255
+
256
+ 只有在某个 provider 的凭证存在时,才会显示对应的面板。额度面板仅在交互式 TUI 中显示;`--table`、`--text`、`--json` 不受影响。
257
+
258
+ > **平台说明:** 在 macOS 上,Claude Code 会把 OAuth 凭证保存在系统 Keychain 中,而不是 `~/.claude/.credentials.json`,因此在 macOS 上不会显示 Claude 面板。
254
259
 
255
260
  ---
256
261
 
@@ -324,35 +329,6 @@ vct analysis --output today.json --daily
324
329
 
325
330
  ---
326
331
 
327
- ## Statusline 命令
328
-
329
- **将 Claude Code 的额度信息接入 `usage` 仪表盘。**
330
-
331
- Claude Code 仅通过 `statusLine` hook 的 stdin JSON 暴露其 5 小时 / 每周额度,因此 `vct` 从那里捕获并缓存到 `~/.vibe_coding_tracker/claude_rate_limits.json`,供 Claude 额度面板读取。
332
-
333
- ### 如果你已有 statusLine
334
-
335
- 在现有 statusLine 脚本中加一行后台命令。它对当前显示零影响,且相互隔离,vct 出错也绝不会干扰 statusLine:
336
-
337
- ```bash
338
- printf '%s' "$input" | vct statusline ingest >/dev/null 2>&1 &
339
- ```
340
-
341
- ### 如果你还没有 statusLine
342
-
343
- 让 Claude Code 的 `~/.claude/settings.json` 直接指向 vct,它会缓存额度并打印一行简洁状态:
344
-
345
- ```json
346
- {
347
- "statusLine": {
348
- "type": "command",
349
- "command": "vct statusline"
350
- }
351
- }
352
- ```
353
-
354
- ---
355
-
356
332
  ## Update 命令
357
333
 
358
334
  **自动保持安装版本为最新。**
package/README.zh-TW.md CHANGED
@@ -143,7 +143,6 @@ vct <COMMAND> [OPTIONS]
143
143
  Commands:
144
144
  analysis Analyze JSONL conversation files (single file or all sessions)
145
145
  usage Display token usage statistics
146
- statusline Cache Claude Code rate limits from a statusLine hook (stdin JSON)
147
146
  version Display version information
148
147
  update Update to the latest version from GitHub releases
149
148
  help Print this message or the help of the given subcommand(s)
@@ -236,21 +235,27 @@ vct usage --json --daily
236
235
 
237
236
  ### 即時額度面板
238
237
 
239
- 在互動式儀表板底部,左側是各 provider 統計,右側是兩個即時額度面板:
238
+ `vct usage` 會**在儀表板中直接顯示 Claude Code 與 Codex 的即時剩餘額度——完全零設定。** 不需要 status-line hook,也不需要設定檔:vct 會讀取各 provider 自己的 OAuth 憑證,在背景執行緒呼叫其用量 API,並在你工作時讓面板保持最新。
240
239
 
241
240
  ```
242
- ┌ Provider/Tokens/Cost/Days ┬ Claude ────────┬ Codex ──────────┐
243
- │ Claude 1.2M $3.00 4d │ 5h ▰▰▱▱▱ 16% │ Plan: plus │
244
- │ Codex 800K $0.00 6d │ ↻ 4h13m │ 5h ▰▰▱▱▱ 27% │
245
- │ ... │ 7d ▰▰▰▱▱ 28% │ 7d ▱▱▱▱▱ 4% │
246
- │ │ updated 2m ago │ Credits: 0 +2 │
247
- └───────────────────────────┴────────────────┴─────────────────┘
241
+ ┌ Provider/Tokens/Cost/Days ┬ Claude ───────────────────┬ Codex ────────────────────┐
242
+ │ Claude 1.2M $3.00 4d │ Plan: max 20x │ Plan: plus │
243
+ │ Codex 800K $0.00 6d │ 5h ▰▱▱▱▱ 16% ↻ 2h0m │ 5h ▰▰▱▱▱ 37% ↻ 2h33m │
244
+ │ ... │ 7d ▰▰▱▱▱ 41% ↻ 5d │ 7d ▰▰▱▱▱ 24% ↻ 3d16h │
245
+ │ │ Opus ▰▰▰▱▱ 61% ↻ 5d │ Credits: 0 +3 reset │
246
+ │ │ Balance: - $0.00 used │ updated just now │
247
+ │ │ updated just now │ │
248
+ └───────────────────────────┴────────────────────────────┴────────────────────────────┘
248
249
  ```
249
250
 
250
- - **Claude** — 5 小時和每週的額度用量。Claude Code 僅透過 `statusLine` hook 暴露這些額度,需將 `vct statusline ingest` 接入你的 statusLine(見 [Statusline 指令](#statusline-%E6%8C%87%E4%BB%A4))此面板才會有資料。
251
- - **Codex** — 方案類型、5 小時和每週用量、額度餘額。背景執行緒使用 `~/.codex/auth.json` 中的 token 從 ChatGPT 後端(`wham/usage`)即時拉取;不可用時回退到 Codex 工作階段紀錄中最新的 `rate_limits`(標題顯示 `(API)` 或 `(session)`)。
251
+ - **Claude** — 方案類型、5 小時、每週以及單模型每週用量,來自官方 OAuth 用量 API(`GET /api/oauth/usage`),從 `~/.claude/.credentials.json` 讀取,並顯示額度餘額。約每分鐘輪詢一次以避開該端點的速率限制;觸及上限時標題會出現紅色 `LIMIT` 標記。單模型每週那一行屬於盡力而為,未回傳該範圍時就自動隱藏。
252
+ - **Codex** — 方案類型、5 小時和每週用量以及額度餘額,使用 `~/.codex/auth.json` 從 ChatGPT 後端(`wham/usage`)取得(在適用時顯示大致剩餘訊息數 / 消費上限);API 無法使用時回退到 Codex 工作階段紀錄中最新的 `rate_limits`(標題顯示 `Codex` 或 `Codex (session)`)。
252
253
 
253
- 額度面板僅在互動式 TUI 中顯示;`--table`、`--text`、`--json` 不受影響。
254
+ **自動刷新 token。** 對這兩個 provider,當 token 接近過期或被拒絕時,vct 會刷新它並把新的 token 寫回該 provider 自己的憑證檔案(採用該 CLI 的原始格式),因此 token 會在多次檢查之間重複使用,而不是每次都重新刷新。如果刷新失敗,面板會顯示 `run: <provider> auth login` 提示,而不會直接中斷。
255
+
256
+ 只有在某個 provider 的憑證存在時,才會顯示對應的面板。額度面板僅在互動式 TUI 中顯示;`--table`、`--text`、`--json` 不受影響。
257
+
258
+ > **平台說明:** 在 macOS 上,Claude Code 會把 OAuth 憑證儲存在系統 Keychain 中,而不是 `~/.claude/.credentials.json`,因此在 macOS 上不會顯示 Claude 面板。
254
259
 
255
260
  ---
256
261
 
@@ -324,35 +329,6 @@ vct analysis --output today.json --daily
324
329
 
325
330
  ---
326
331
 
327
- ## Statusline 指令
328
-
329
- **將 Claude Code 的額度資訊接入 `usage` 儀表板。**
330
-
331
- Claude Code 僅透過 `statusLine` hook 的 stdin JSON 暴露其 5 小時 / 每週額度,因此 `vct` 從那裡擷取並快取到 `~/.vibe_coding_tracker/claude_rate_limits.json`,供 Claude 額度面板讀取。
332
-
333
- ### 如果你已有 statusLine
334
-
335
- 在現有 statusLine 腳本中加一行背景指令。它對目前顯示零影響,且相互隔離,vct 出錯也絕不會干擾 statusLine:
336
-
337
- ```bash
338
- printf '%s' "$input" | vct statusline ingest >/dev/null 2>&1 &
339
- ```
340
-
341
- ### 如果你還沒有 statusLine
342
-
343
- 讓 Claude Code 的 `~/.claude/settings.json` 直接指向 vct,它會快取額度並印出一行精簡狀態:
344
-
345
- ```json
346
- {
347
- "statusLine": {
348
- "type": "command",
349
- "command": "vct statusline"
350
- }
351
- }
352
- ```
353
-
354
- ---
355
-
356
332
  ## Update 指令
357
333
 
358
334
  **自動保持安裝為最新版本。**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mai0313/vct",
3
- "version": "0.17.0",
3
+ "version": "1.1.0",
4
4
  "description": "Vibe Coding Tracker - AI coding assistant telemetry/usage parser, aggregate JSONL events into CodeAnalysis results",
5
5
  "author": "Wei Lee <mai@mai0313.com>",
6
6
  "license": "MIT",