@mai0313/vct 2.3.1 → 2.5.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
@@ -216,15 +216,16 @@ vct usage --table --merge-providers
216
216
  ### Preview: Interactive Dashboard (`vct usage`)
217
217
 
218
218
  ```
219
- ┌ Models · $79.33 · 49.1M tokens · 3 models ────────────────────────── −2 cols ┐┌ Providers ───────────────────────────┐
220
- │Model Input Output Total Cost (USD) █│Provider Tokens Cost │
221
- │ █│ │
222
- │gemini-3.1-pro-preview 129K 10.3K 207K $0.40█│Claude 48.9M $78.93 │
223
- │claude-haiku-4-5-20251001 5.57K 19.8K 5.28M $1.34█│Gemini 207K $0.40 │
224
- │claude-opus-4-8 25.7K 179K 43.6M $77.59█│ │
225
- │ █│ │
226
- │ █│ │
227
- └──────────────────────────────────────────────────────────────────────────────┘└──────────────────────────────────────┘
219
+ ┌ Models · $79.33 · 49.1M tokens · 3 models ───────────────────────────────────────────────────────────────────────────┐
220
+ │Model Input Output Cache Read Cache Write Total Cost (USD) Share █
221
+ │ █
222
+ │gemini-3.1-pro-preview 129K 10.3K 66.0K 1.70K 207K $0.40 0.4%█
223
+ │claude-haiku-4-5-20251001 5.57K 19.8K 5.20M 55.0K 5.28M $1.34 █ 10.8%█
224
+ │claude-opus-4-8 25.7K 179K 42.9M 496K 43.6M $77.59 █████████ 88.8%█
225
+ │ █
226
+ │ █
227
+ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
228
+ Claude $78.93 · Gemini $0.40
228
229
  ┌ Claude ──────────────┐┌ Codex ───────────────┐┌ Copilot ─────────────┐┌ Cursor ────────LIMIT ┐┌ Grok ────────────────┐
229
230
  │max 20x just now││plus just now││individual just now││free just now││SuperGrok just now│
230
231
  │5h ▰▱▱▱▱ 13% 1h42m││5h ▰▰▱▱▱ 33% 12m ││prem ▰▱▱▱▱ 3% 24d0h││total ▰▰▰▰▰ 94% 16d0h││week ▰▰▱▱▱ 38% 3d4h │
@@ -233,7 +234,7 @@ vct usage --table --merge-providers
233
234
  │bal - · $0.00 used ││reset expires 17d0h ││ ││ ││ │
234
235
  └──────────────────────┘└──────────────────────┘└──────────────────────┘└──────────────────────┘└──────────────────────┘
235
236
  Total Cost: $79.33 | Total Tokens: 49.1M | Models: 3 | Memory: 4.7 MB | CPU: 0.0%
236
- ↑/↓ scroll m merge p hide Q quota r refresh q quit | Star on GitHub
237
+ ↑/↓ scroll m merge p providers Q quota r refresh q quit | Star on GitHub
237
238
  ```
238
239
 
239
240
  Both interactive dashboards draw a centered `Loading sessions...` spinner as soon as terminal setup finishes. Loading stays responsive to `q`, Ctrl+C, and resize events. Later scans run in one background worker, keep the last successful data visible with a `Refreshing...` footer, and coalesce repeated refresh requests into at most one pending scan. A failed refresh keeps the last-known-good view and retries on the next scheduled or manual refresh.
@@ -305,7 +306,7 @@ For noninteractive `usage` and `analysis` scans, vct exits with an error when ev
305
306
 
306
307
  ### Live Quota Panels
307
308
 
308
- `vct usage` shows **live quota usage for Claude Code, Codex, GitHub Copilot, Cursor, and Grok right in the dashboard — with zero setup.** No status-line hook, no credentials to enter: vct reads each provider's own credentials, calls its usage API on a background thread, and keeps the panels current while you work. Every gauge is percent **used**, so a full bar means the window is spent, not untouched. (Prefer a quieter dashboard? Trim `panels` under `[usage.quota]` in [`config.toml`](#configuration), or set it to `[]` to hide the quota cards entirely. The Provider Usage pane is local scan data, not a quota panel, so it keeps its own `p` toggle.)
309
+ `vct usage` shows **live quota usage for Claude Code, Codex, GitHub Copilot, Cursor, and Grok right in the dashboard — with zero setup.** No status-line hook, no credentials to enter: vct reads each provider's own credentials, calls its usage API on a background thread, and keeps the panels current while you work. Every gauge is percent **used**, so a full bar means the window is spent, not untouched. (Prefer a quieter dashboard? Trim `panels` under `[usage.quota]` in [`config.toml`](#configuration), or set it to `[]` to hide the quota cards entirely. The per-provider cost line under the table is local scan data, not a quota panel, so it stays whatever you set here.)
309
310
 
310
311
  ```
311
312
  ┌ Claude ──────────────┐┌ Codex ───────────────┐┌ Copilot ─────────────┐┌ Cursor ────────LIMIT ┐┌ Grok ────────────────┐
@@ -318,14 +319,14 @@ For noninteractive `usage` and `analysis` scans, vct exits with an error when ev
318
319
  ```
319
320
 
320
321
  - **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.
321
- - **Codex** — plan tier, 5-hour and weekly usage, credit balance, and the earliest fetched available earned-reset expiry from the ChatGPT backend (`wham/usage` + `wham/rate-limit-reset-credits`) 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)`).
322
+ - **Codex** — plan tier, available 5-hour and weekly usage windows, credit balance, and the earliest fetched available earned-reset expiry from the ChatGPT backend (`wham/usage` + `wham/rate-limit-reset-credits`) 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)`).
322
323
  - **Copilot** — plan tier plus your premium-request quota, shown as two gauges: percent used and the used / total request count (e.g. `45/1500`), from GitHub's Copilot API (`GET /copilot_internal/user`), read from `~/.copilot/config.json`. The request impersonates the Copilot CLI. The token is long-lived, so there is no refresh; a `401` / `403` shows a `run: copilot login` hint.
323
324
  - **Cursor** — plan tier, total / auto / API percent **used**, and on-demand spend from cursor.com (`GET /api/usage-summary`), using the session token in `~/.config/cursor/auth.json`. Refresh is reactive: vct re-reads the file each poll and uses the token while it is valid, since the official Cursor client keeps it fresh.
324
325
  - **Grok** — plan tier plus your included-allowance usage for the current weekly or monthly period, from the Grok CLI's own billing endpoint (`GET /v1/billing?format=credits`), read from `~/.grok/auth.json`. A prepaid balance is shown only once it is non-zero, and pay-as-you-go spend once you have either spent something or set a cap. The request impersonates the Grok CLI; a `401` / `403` shows a `run: grok login` hint.
325
326
 
326
327
  **Automatic token refresh.** For Claude, Codex, and Grok, 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. Grok's token endpoint is resolved from its login issuer rather than hardcoded, the way its own CLI does it, and every other login in the file is preserved on write. If a refresh cannot proceed, the panel shows a `run: <provider> auth login` hint instead of breaking. Copilot (long-lived token) and Cursor (kept fresh by its own client) are read-only — vct never writes their credential files.
327
328
 
328
- A panel appears only for a provider whose credentials are present. Panels are placed on a uniform grid that fits as many cards per row as the terminal allows and wraps the rest onto the next row, so a new provider costs a card and never a new layout rule. On a terminal too short to spend rows on the grid, it folds into a one-line digest showing the gauges that still fit and counting the rest; press `Q` for the full-detail overlay, where every card has room for every line whatever the terminal size, and `p` to toggle the Provider Usage side pane. Quota panels appear only in the interactive TUI; `--table`, `--text`, and `--json` are unchanged.
329
+ A panel appears only for a provider whose credentials are present. Panels are placed on a uniform grid that fits as many cards per row as the terminal allows and wraps the rest onto the next row, so a new provider costs a card and never a new layout rule. On a terminal too short to spend rows on the grid, it folds into a one-line digest showing the gauges that still fit and counting the rest; press `Q` for the full-detail overlay, where every card has room for every line whatever the terminal size, and `p` for the Provider Usage panel with per-provider tokens and share. Quota panels appear only in the interactive TUI; `--table`, `--text`, and `--json` are unchanged.
329
330
 
330
331
  > **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. Cursor's `~/.config/cursor` credential path is Linux-oriented.
331
332
 
@@ -460,9 +461,13 @@ Codex code-mode sessions expose a completed JavaScript `exec` cell but no struct
460
461
 
461
462
  ## Update Command
462
463
 
463
- **Keep your installation up-to-date automatically.**
464
+ **Keep supported direct installations up to date automatically.**
465
+
466
+ At startup, vct silently checks for a newer release at most once per UTC day. A newer release is downloaded and applied only when the current binary was installed by the official `scripts/install.sh` or `scripts/install.ps1` installer and carries its `.vct-managed` marker. The check, download, and replacement never print to stdout or stderr. A network failure, rate limit, read-only directory, or another running vct process only leaves the current command running; the reason is recorded in the diagnostic log. `VCT_OFFLINE=1` skips the check completely.
467
+
468
+ After a Unix update, vct re-executes the current command with the new binary. On Windows, the current command finishes and a helper applies the replacement afterwards. The automatic path never modifies installs from cargo, npm, PyPI, a distro package, or an unmarked manual or development build. Update those through their package manager instead. To add automatic updates to an existing direct install, run the current official installer once more so it creates the marker.
464
469
 
465
- The update command works for **all installation methods** (npm/pip/cargo/manual) by directly downloading and replacing the binary from GitHub releases.
470
+ Set `general.auto_update = false` in `~/.vct/config.toml` to disable startup checks and automatic updates. The explicit `vct update` command retains its existing manual behavior.
466
471
 
467
472
  ### Basic Usage
468
473
 
@@ -559,9 +564,12 @@ vct keeps its user settings in `~/.vct/config.toml`. The file is **created with
559
564
  # Default time range when no --daily/--weekly/--monthly/--all flag is given.
560
565
  # One of: "daily" | "weekly" | "monthly" | "all".
561
566
  default_time_range = "all"
567
+ # Check for a newer release at startup and automatically update supported direct installs.
568
+ # Set to false to disable this behavior.
569
+ auto_update = true
562
570
  # Layout version of this file, stamped by vct. Only the upgrade pass reads it;
563
571
  # leave it alone unless you want a past upgrade to run again.
564
- version = 2
572
+ version = 3
565
573
 
566
574
  [usage]
567
575
  # Start the usage dashboard with models merged across provider prefixes.
@@ -609,6 +617,7 @@ retention_days = 7
609
617
  | Setting | Effect |
610
618
  | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
611
619
  | `general.default_time_range` | Period used when you pass no `--daily/--weekly/--monthly/--all`. An explicit flag always wins. |
620
+ | `general.auto_update` | Check once per UTC day at startup and automatically update only official-installer direct installs. Set to `false` to disable. |
612
621
  | `general.version` | Layout version vct stamps on the file, so a panel added by a later release is offered to you exactly once. |
613
622
  | `usage.merge_models` | Seeds the dashboard merged; the `m` toggle saves your last choice back here. `--merge-providers` forces on. |
614
623
  | `usage.refresh_interval` | Redraw cadence of the `usage` dashboard (seconds). |
package/README.zh-CN.md CHANGED
@@ -216,15 +216,16 @@ vct usage --table --merge-providers
216
216
  ### 预览:交互式面板(`vct usage`)
217
217
 
218
218
  ```
219
- ┌ Models · $79.33 · 49.1M tokens · 3 models ────────────────────────── −2 cols ┐┌ Providers ───────────────────────────┐
220
- │Model Input Output Total Cost (USD) █│Provider Tokens Cost │
221
- │ █│ │
222
- │gemini-3.1-pro-preview 129K 10.3K 207K $0.40█│Claude 48.9M $78.93 │
223
- │claude-haiku-4-5-20251001 5.57K 19.8K 5.28M $1.34█│Gemini 207K $0.40 │
224
- │claude-opus-4-8 25.7K 179K 43.6M $77.59█│ │
225
- │ █│ │
226
- │ █│ │
227
- └──────────────────────────────────────────────────────────────────────────────┘└──────────────────────────────────────┘
219
+ ┌ Models · $79.33 · 49.1M tokens · 3 models ───────────────────────────────────────────────────────────────────────────┐
220
+ │Model Input Output Cache Read Cache Write Total Cost (USD) Share █
221
+ │ █
222
+ │gemini-3.1-pro-preview 129K 10.3K 66.0K 1.70K 207K $0.40 0.4%█
223
+ │claude-haiku-4-5-20251001 5.57K 19.8K 5.20M 55.0K 5.28M $1.34 █ 10.8%█
224
+ │claude-opus-4-8 25.7K 179K 42.9M 496K 43.6M $77.59 █████████ 88.8%█
225
+ │ █
226
+ │ █
227
+ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
228
+ Claude $78.93 · Gemini $0.40
228
229
  ┌ Claude ──────────────┐┌ Codex ───────────────┐┌ Copilot ─────────────┐┌ Cursor ────────LIMIT ┐┌ Grok ────────────────┐
229
230
  │max 20x just now││plus just now││individual just now││free just now││SuperGrok just now│
230
231
  │5h ▰▱▱▱▱ 13% 1h42m││5h ▰▰▱▱▱ 33% 12m ││prem ▰▱▱▱▱ 3% 24d0h││total ▰▰▰▰▰ 94% 16d0h││week ▰▰▱▱▱ 38% 3d4h │
@@ -233,7 +234,7 @@ vct usage --table --merge-providers
233
234
  │bal - · $0.00 used ││reset expires 17d0h ││ ││ ││ │
234
235
  └──────────────────────┘└──────────────────────┘└──────────────────────┘└──────────────────────┘└──────────────────────┘
235
236
  Total Cost: $79.33 | Total Tokens: 49.1M | Models: 3 | Memory: 4.7 MB | CPU: 0.0%
236
- ↑/↓ scroll m merge p hide Q quota r refresh q quit | Star on GitHub
237
+ ↑/↓ scroll m merge p providers Q quota r refresh q quit | Star on GitHub
237
238
  ```
238
239
 
239
240
  两个交互式面板都会在 terminal setup 完成后立即绘制居中的 `Loading sessions...` spinner. Loading 期间仍可响应 `q`, Ctrl+C 与 resize event. 后续扫描由单一 background worker 执行, 并在 `Refreshing...` footer 下保留上一次成功的数据. 重复的 refresh 请求最多只会合并为一个 pending scan. 如果 refresh 失败, 面板会保留 last-known-good view, 并在下次排程或手动刷新时重试.
@@ -305,7 +306,7 @@ Grok 的 `usage` 是单一时点的本地 context 估算:vct 会把 `signals.j
305
306
 
306
307
  ### 实时额度面板
307
308
 
308
- `vct usage` 会**在仪表盘中直接显示 Claude Code、Codex、GitHub Copilot、Cursor 与 Grok 的实时额度用量——完全零配置。** 不需要 status-line hook,也无需手动输入任何凭证:vct 会读取各 provider 自己的 OAuth 凭证,在后台线程调用其用量 API,并在你工作时保持面板持续更新。每个进度条都是**已用**百分比,所以进度条满格代表该额度周期已耗尽,而不是还没开始用。(想要更清爽的面板?在 [`config.toml`](#%E9%85%8D%E7%BD%AE) 中精简 `[usage.quota]` 下的 `panels`,或设为 `[]` 隐藏所有额度卡片。Provider Usage 侧栏是本机扫描数据而不是额度面板,所以它有自己的 `p` 开关。)
309
+ `vct usage` 会**在仪表盘中直接显示 Claude Code、Codex、GitHub Copilot、Cursor 与 Grok 的实时额度用量——完全零配置。** 不需要 status-line hook,也无需手动输入任何凭证:vct 会读取各 provider 自己的 OAuth 凭证,在后台线程调用其用量 API,并在你工作时保持面板持续更新。每个进度条都是**已用**百分比,所以进度条满格代表该额度周期已耗尽,而不是还没开始用。(想要更清爽的面板?在 [`config.toml`](#%E9%85%8D%E7%BD%AE) 中精简 `[usage.quota]` 下的 `panels`,或设为 `[]` 隐藏所有额度卡片。表格下方那行各 provider 成本是本机扫描数据而不是额度面板,所以不受这里的设置影响。)
309
310
 
310
311
  ```
311
312
  ┌ Claude ──────────────┐┌ Codex ───────────────┐┌ Copilot ─────────────┐┌ Cursor ────────LIMIT ┐┌ Grok ────────────────┐
@@ -318,14 +319,14 @@ Grok 的 `usage` 是单一时点的本地 context 估算:vct 会把 `signals.j
318
319
  ```
319
320
 
320
321
  - **Claude** — 方案类型、5 小时、每周以及单模型每周用量,来自官方 OAuth 用量 API(`GET /api/oauth/usage`),从 `~/.claude/.credentials.json` 读取,并显示额度余额。约每分钟轮询一次以避开该端点的速率限制;触及上限时标题会出现红色 `LIMIT` 标记。单模型每周那一行属于尽力而为,未返回该范围时就自动隐藏。
321
- - **Codex** — 套餐类型、5 小时和每周用量、额度余额以及已获取的可用 reset credit 中最早的到期时间,使用 `~/.codex/auth.json` 从 ChatGPT 后端(`wham/usage` + `wham/rate-limit-reset-credits`)获取(在适用时显示大致剩余讯息数 / 消费上限);API 不可用时回退到 Codex 会话日志中最新的 `rate_limits`(标题显示 `Codex` 或 `Codex (session)`)。
322
+ - **Codex** — 套餐类型、可用的 5 小时和每周用量周期、额度余额以及已获取的可用 reset credit 中最早的到期时间,使用 `~/.codex/auth.json` 从 ChatGPT 后端(`wham/usage` + `wham/rate-limit-reset-credits`)获取(在适用时显示大致剩余讯息数 / 消费上限);API 不可用时回退到 Codex 会话日志中最新的 `rate_limits`(标题显示 `Codex` 或 `Codex (session)`)。
322
323
  - **Copilot** — 方案类型,以及你的 premium 请求额度,以两个进度条呈现:已用百分比,以及已用 / 总量的请求数(例如 `45/1500`),来自 GitHub 的 Copilot API(`GET /copilot_internal/user`),从 `~/.copilot/config.json` 读取。该请求会模拟 Copilot CLI。token 为长期有效,因此不需要刷新;遇到 `401` / `403` 时会显示 `run: copilot login` 提示。
323
324
  - **Cursor** — 方案类型、total / auto / API **已用**百分比,以及按需消费,来自 cursor.com(`GET /api/usage-summary`),使用 `~/.config/cursor/auth.json` 中的 session token。刷新是被动式的:vct 每次轮询都会重新读取该文件,并在 token 有效期内使用它,因为官方 Cursor 客户端会让它保持最新。
324
325
  - **Grok** — 方案类型,以及当前每周或每月周期内的方案内含额度用量,来自 Grok CLI 自己的计费端点(`GET /v1/billing?format=credits`),从 `~/.grok/auth.json` 读取。预付余额只有在非零时才会显示;按量付费的消费则在你有过消费、或设置了上限之后才会显示。该请求会模拟 Grok CLI;遇到 `401` / `403` 时会显示 `run: grok login` 提示。
325
326
 
326
327
  **自动刷新 token。** 对 Claude、Codex 和 Grok,当 token 接近过期或被拒绝时,vct 会刷新它并把新 token 写回该 provider 自己的凭证文件(采用该 CLI 的原始格式),因此 token 会在多次检查之间复用,而不是每次都重新刷新。Grok 的 token 端点会像它自己的 CLI 那样,从登录时的 issuer 解析得出,而不是写死在代码里;写入时也会保留文件中其他所有的登录信息。如果刷新失败,面板会显示 `run: <provider> auth login` 提示,而不会直接中断。Copilot(长期有效的 token)和 Cursor(由其自身客户端保持最新)为只读——vct 从不写入它们的凭证文件。
327
328
 
328
- 只有在某个 provider 的凭证存在时,才会显示对应的面板。面板排在一个统一网格上:一行放得下几张就放几张,放不下的自动折到下一行,因此新增一个 provider 只是多一张卡片,不会多一条排版规则。当终端高度不足以留给网格时,它会收成一行摘要,显示放得下的 gauge,并把其余的记成数量;按 `Q` 打开完整的额度浮层,无论终端多大,每张卡片都放得下全部内容,按 `p` 可切换 Provider Usage 侧栏。额度面板仅在交互式 TUI 中显示;`--table`、`--text`、`--json` 不受影响。
329
+ 只有在某个 provider 的凭证存在时,才会显示对应的面板。面板排在一个统一网格上:一行放得下几张就放几张,放不下的自动折到下一行,因此新增一个 provider 只是多一张卡片,不会多一条排版规则。当终端高度不足以留给网格时,它会收成一行摘要,显示放得下的 gauge,并把其余的记成数量;按 `Q` 打开完整的额度浮层,无论终端多大,每张卡片都放得下全部内容,按 `p` 打开 Provider Usage 面板,里面有各 provider 的 token 数与占比。额度面板仅在交互式 TUI 中显示;`--table`、`--text`、`--json` 不受影响。
329
330
 
330
331
  > **平台说明:** 在 macOS 上,Claude Code 会把 OAuth 凭证保存在系统 Keychain 中,而不是 `~/.claude/.credentials.json`,因此在 macOS 上不会显示 Claude 面板。Cursor 的 `~/.config/cursor` 凭证路径偏向 Linux。
331
332
 
@@ -460,9 +461,13 @@ Codex code mode session 会提供已完成的 JavaScript `exec` cell, 但没有
460
461
 
461
462
  ## Update 命令
462
463
 
463
- **自动保持安装版本为最新。**
464
+ **自动让受支持的直接安装保持最新版本.**
465
+
466
+ vct 启动时每天 UTC 日期最多检查一次新版. 只有通过官方 `scripts/install.sh` 或 `scripts/install.ps1` 安装, 并且带有 `.vct-managed` marker 的二进制文件, 才会下载并应用新版. 检查, 下载和替换都不会输出到 stdout 或 stderr. 网络失败, rate limit, 只读目录或另一个 vct process 正在运行时, 当前命令仍会照常继续, 原因只会写入 diagnostic log. `VCT_OFFLINE=1` 会完全跳过检查.
467
+
468
+ Unix 应用更新后, vct 会用新版 binary 重新执行当前命令. Windows 会先让当前命令结束, 再由 helper 应用替换. 自动流程绝不会修改通过 cargo, npm, PyPI, distro package 安装的版本, 也不会修改没有 marker 的手动安装或 development build. 请通过相应的 package manager 更新. 现有直接安装只要再运行一次当前官方 installer, 就会创建 marker 并启用自动更新.
464
469
 
465
- update 命令适用于**所有安装方式**(npm/pip/cargo/手动安装),它会直接从 GitHub releases 下载并替换二进制文件。
470
+ 在 `~/.vct/config.toml` 中设置 `general.auto_update = false` 可以关闭启动检查和自动更新. 显式执行的 `vct update` 会保留原有手动行为.
466
471
 
467
472
  ### 基本用法
468
473
 
@@ -559,9 +564,12 @@ vct 会把用户设置保存在 `~/.vct/config.toml` 中。该文件会在**首
559
564
  # 未指定 --daily/--weekly/--monthly/--all flag 时使用的默认时间范围
560
565
  # 取值之一: "daily" | "weekly" | "monthly" | "all"
561
566
  default_time_range = "all"
567
+ # 启动时检查新版, 并自动更新由官方 installer 创建的受支持直接安装.
568
+ # 设为 false 可关闭此行为.
569
+ auto_update = true
562
570
  # 该文件的布局版本, 由 vct 标记. 只有升级流程会读取它;
563
571
  # 除非你想让某次过去的升级再跑一遍, 否则不要动它.
564
- version = 2
572
+ version = 3
565
573
 
566
574
  [usage]
567
575
  # 启动 usage 面板时就把跨 provider 前缀的 model 合并显示
@@ -608,6 +616,7 @@ retention_days = 7
608
616
  | 设置项 | 作用 |
609
617
  | ------------------------------ | --------------------------------------------------------------------------------------------------------------- |
610
618
  | `general.default_time_range` | 当你没有传入 `--daily/--weekly/--monthly/--all` 时使用的时间范围。显式传入的 flag 始终优先。 |
619
+ | `general.auto_update` | 启动时每天 UTC 日期最多检查一次, 并且只更新官方 installer 的直接安装. 设为 `false` 可关闭. |
611
620
  | `general.version` | vct 标记在文件上的布局版本,让后续版本新增的面板只会向你提供一次。 |
612
621
  | `usage.merge_models` | 让面板启动时就处于合并状态;`m` 切换会把你上次的选择保存回这里。`--merge-providers` 会强制开启。 |
613
622
  | `usage.refresh_interval` | `usage` 面板的自动刷新间隔(秒)。 |
package/README.zh-TW.md CHANGED
@@ -216,15 +216,16 @@ vct usage --table --merge-providers
216
216
  ### 預覽:互動式儀表板(`vct usage`)
217
217
 
218
218
  ```
219
- ┌ Models · $79.33 · 49.1M tokens · 3 models ────────────────────────── −2 cols ┐┌ Providers ───────────────────────────┐
220
- │Model Input Output Total Cost (USD) █│Provider Tokens Cost │
221
- │ █│ │
222
- │gemini-3.1-pro-preview 129K 10.3K 207K $0.40█│Claude 48.9M $78.93 │
223
- │claude-haiku-4-5-20251001 5.57K 19.8K 5.28M $1.34█│Gemini 207K $0.40 │
224
- │claude-opus-4-8 25.7K 179K 43.6M $77.59█│ │
225
- │ █│ │
226
- │ █│ │
227
- └──────────────────────────────────────────────────────────────────────────────┘└──────────────────────────────────────┘
219
+ ┌ Models · $79.33 · 49.1M tokens · 3 models ───────────────────────────────────────────────────────────────────────────┐
220
+ │Model Input Output Cache Read Cache Write Total Cost (USD) Share █
221
+ │ █
222
+ │gemini-3.1-pro-preview 129K 10.3K 66.0K 1.70K 207K $0.40 0.4%█
223
+ │claude-haiku-4-5-20251001 5.57K 19.8K 5.20M 55.0K 5.28M $1.34 █ 10.8%█
224
+ │claude-opus-4-8 25.7K 179K 42.9M 496K 43.6M $77.59 █████████ 88.8%█
225
+ │ █
226
+ │ █
227
+ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
228
+ Claude $78.93 · Gemini $0.40
228
229
  ┌ Claude ──────────────┐┌ Codex ───────────────┐┌ Copilot ─────────────┐┌ Cursor ────────LIMIT ┐┌ Grok ────────────────┐
229
230
  │max 20x just now││plus just now││individual just now││free just now││SuperGrok just now│
230
231
  │5h ▰▱▱▱▱ 13% 1h42m││5h ▰▰▱▱▱ 33% 12m ││prem ▰▱▱▱▱ 3% 24d0h││total ▰▰▰▰▰ 94% 16d0h││week ▰▰▱▱▱ 38% 3d4h │
@@ -233,7 +234,7 @@ vct usage --table --merge-providers
233
234
  │bal - · $0.00 used ││reset expires 17d0h ││ ││ ││ │
234
235
  └──────────────────────┘└──────────────────────┘└──────────────────────┘└──────────────────────┘└──────────────────────┘
235
236
  Total Cost: $79.33 | Total Tokens: 49.1M | Models: 3 | Memory: 4.7 MB | CPU: 0.0%
236
- ↑/↓ scroll m merge p hide Q quota r refresh q quit | Star on GitHub
237
+ ↑/↓ scroll m merge p providers Q quota r refresh q quit | Star on GitHub
237
238
  ```
238
239
 
239
240
  兩個互動式儀表板都會在 terminal setup 完成後立即繪製置中的 `Loading sessions...` spinner. Loading 期間仍可處理 `q`, Ctrl+C 與 resize event. 後續掃描由單一 background worker 執行, 並在 `Refreshing...` footer 下保留上一次成功的資料. 重複的 refresh 要求最多只會合併為一個 pending scan. 如果 refresh 失敗, 儀表板會保留 last-known-good view, 並在下次排程或手動刷新時重試.
@@ -305,7 +306,7 @@ Grok 的 `usage` 是單一當下的本地 context 估算:vct 會把 `signals.j
305
306
 
306
307
  ### 即時額度面板
307
308
 
308
- `vct usage` 會**在儀表板中直接顯示 Claude Code、Codex、GitHub Copilot、Cursor 與 Grok 的即時額度用量——完全零設定。** 不需要 status-line hook,也不需要手動輸入憑證:vct 會讀取各 provider 自己的 OAuth 憑證,在背景執行緒呼叫其用量 API,並在你工作時讓面板保持最新。每個進度條都是**已用**百分比,所以進度條滿格代表該額度週期已用盡,而不是還沒開始用。(想要更清爽的儀表板嗎?在 [`config.toml`](#%E8%A8%AD%E5%AE%9A) 中精簡 `[usage.quota]` 下的 `panels`,或設為 `[]` 隱藏所有額度卡片。Provider Usage 側欄是本機掃描資料而不是額度面板,所以它有自己的 `p` 開關。)
309
+ `vct usage` 會**在儀表板中直接顯示 Claude Code、Codex、GitHub Copilot、Cursor 與 Grok 的即時額度用量——完全零設定。** 不需要 status-line hook,也不需要手動輸入憑證:vct 會讀取各 provider 自己的 OAuth 憑證,在背景執行緒呼叫其用量 API,並在你工作時讓面板保持最新。每個進度條都是**已用**百分比,所以進度條滿格代表該額度週期已用盡,而不是還沒開始用。(想要更清爽的儀表板嗎?在 [`config.toml`](#%E8%A8%AD%E5%AE%9A) 中精簡 `[usage.quota]` 下的 `panels`,或設為 `[]` 隱藏所有額度卡片。表格下方那行各 provider 成本是本機掃描資料而不是額度面板,所以不受這裡的設定影響。)
309
310
 
310
311
  ```
311
312
  ┌ Claude ──────────────┐┌ Codex ───────────────┐┌ Copilot ─────────────┐┌ Cursor ────────LIMIT ┐┌ Grok ────────────────┐
@@ -318,14 +319,14 @@ Grok 的 `usage` 是單一當下的本地 context 估算:vct 會把 `signals.j
318
319
  ```
319
320
 
320
321
  - **Claude** — 方案類型、5 小時、每週以及單模型每週用量,來自官方 OAuth 用量 API(`GET /api/oauth/usage`),從 `~/.claude/.credentials.json` 讀取,並顯示額度餘額。約每分鐘輪詢一次以避開該端點的速率限制;觸及上限時標題會出現紅色 `LIMIT` 標記。單模型每週那一行屬於盡力而為,未回傳該範圍時就自動隱藏。
321
- - **Codex** — 方案類型、5 小時和每週用量、額度餘額以及已取得的可用 reset credit 中最早的到期時間,使用 `~/.codex/auth.json` 從 ChatGPT 後端(`wham/usage` + `wham/rate-limit-reset-credits`)取得(在適用時顯示大致剩餘訊息數 / 消費上限);API 無法使用時回退到 Codex 工作階段紀錄中最新的 `rate_limits`(標題顯示 `Codex` 或 `Codex (session)`)。
322
+ - **Codex** — 方案類型、可用的 5 小時和每週用量週期、額度餘額以及已取得的可用 reset credit 中最早的到期時間,使用 `~/.codex/auth.json` 從 ChatGPT 後端(`wham/usage` + `wham/rate-limit-reset-credits`)取得(在適用時顯示大致剩餘訊息數 / 消費上限);API 無法使用時回退到 Codex 工作階段紀錄中最新的 `rate_limits`(標題顯示 `Codex` 或 `Codex (session)`)。
322
323
  - **Copilot** — 方案類型以及你的 premium 請求額度,以兩個進度條呈現:已用百分比,以及已用 / 總量請求數(例如 `45/1500`),來自 GitHub 的 Copilot API(`GET /copilot_internal/user`),從 `~/.copilot/config.json` 讀取。該請求會模擬 Copilot CLI。token 為長期有效,因此不需要刷新;遇到 `401` / `403` 時會顯示 `run: copilot login` 提示。
323
324
  - **Cursor** — 方案類型、total / auto / API **已用**百分比,以及按需消費,來自 cursor.com(`GET /api/usage-summary`),使用 `~/.config/cursor/auth.json` 中的 session token。刷新是被動式的:vct 每次輪詢都會重新讀取該檔案,並在 token 有效期內使用它,因為官方 Cursor 用戶端會讓它保持最新。
324
325
  - **Grok** — 方案類型以及目前每週或每月週期的內含額度用量,來自 Grok CLI 自己的計費端點(`GET /v1/billing?format=credits`),從 `~/.grok/auth.json` 讀取。預付餘額只有在不為零時才會顯示;按量計費的消費則在你有過消費、或設定了上限之後才會顯示。該請求會模擬 Grok CLI;遇到 `401` / `403` 時會顯示 `run: grok login` 提示。
325
326
 
326
327
  **自動刷新 token。** 對 Claude、Codex 和 Grok,當 token 接近過期或被拒絕時,vct 會刷新它並把新的 token 寫回該 provider 自己的憑證檔案(採用該 CLI 的原始格式),因此 token 會在多次檢查之間重複使用,而不是每次都重新刷新。Grok 的 token 端點會如同它自己的 CLI 一樣,從登入的 issuer 解析出來,而不是寫死在程式裡;寫入時也會保留該檔案中其他所有的登入資訊。如果刷新失敗,面板會顯示 `run: <provider> auth login` 提示,而不會直接中斷。Copilot(長期有效的 token)和 Cursor(由其自身用戶端保持最新)為唯讀——vct 從不寫入它們的憑證檔案。
327
328
 
328
- 只有在某個 provider 的憑證存在時,才會顯示對應的面板。面板排在一個統一網格上:一列放得下幾張就放幾張,放不下的自動折到下一列,因此新增一個 provider 只是多一張卡片,不會多一條排版規則。當終端高度不足以留給網格時,它會收成一行摘要,顯示放得下的 gauge,並把其餘的記成數量;按 `Q` 開啟完整的額度浮層,無論終端多大,每張卡片都放得下全部內容,按 `p` 可切換 Provider Usage 側欄。額度面板僅在互動式 TUI 中顯示;`--table`、`--text`、`--json` 不受影響。
329
+ 只有在某個 provider 的憑證存在時,才會顯示對應的面板。面板排在一個統一網格上:一列放得下幾張就放幾張,放不下的自動折到下一列,因此新增一個 provider 只是多一張卡片,不會多一條排版規則。當終端高度不足以留給網格時,它會收成一行摘要,顯示放得下的 gauge,並把其餘的記成數量;按 `Q` 開啟完整的額度浮層,無論終端多大,每張卡片都放得下全部內容,按 `p` 開啟 Provider Usage 面板,裡面有各 provider 的 token 數與佔比。額度面板僅在互動式 TUI 中顯示;`--table`、`--text`、`--json` 不受影響。
329
330
 
330
331
  > **平台說明:** 在 macOS 上,Claude Code 會把 OAuth 憑證儲存在系統 Keychain 中,而不是 `~/.claude/.credentials.json`,因此在 macOS 上不會顯示 Claude 面板。Cursor 的 `~/.config/cursor` 憑證路徑偏向 Linux。
331
332
 
@@ -460,9 +461,13 @@ Codex code mode session 會提供已完成的 JavaScript `exec` cell, 但沒有
460
461
 
461
462
  ## Update 指令
462
463
 
463
- **自動保持安裝為最新版本。**
464
+ **自動讓受支援的直接安裝維持最新版本.**
465
+
466
+ vct 啟動時最多每天 UTC 日期檢查一次新版. 只有透過官方 `scripts/install.sh` 或 `scripts/install.ps1` 安裝, 且帶有 `.vct-managed` marker 的執行檔, 才會下載並套用新版. 檢查, 下載與替換都不會印到 stdout 或 stderr. 網路失敗, rate limit, 唯讀目錄或另一個 vct process 正在執行時, 目前指令仍會照常繼續, 原因只會寫入 diagnostic log. `VCT_OFFLINE=1` 會完全略過檢查.
467
+
468
+ Unix 套用更新後, vct 會用新版 binary 重新執行目前指令. Windows 則會讓目前指令結束, 再由 helper 套用替換. 自動流程絕不會修改透過 cargo, npm, PyPI, distro package 安裝的版本, 或沒有 marker 的手動與 development build. 請透過對應 package manager 更新. 既有的直接安裝只要再執行一次目前的官方 installer, 就會建立 marker 並啟用自動更新.
464
469
 
465
- Update 指令適用於**所有安裝方式**(npm/pip/cargo/手動安裝),透過直接從 GitHub releases 下載並替換執行檔來完成更新。
470
+ 在 `~/.vct/config.toml` 設定 `general.auto_update = false` 可關閉啟動檢查與自動更新. 明確執行的 `vct update` 會保留原有的手動行為.
466
471
 
467
472
  ### 基本用法
468
473
 
@@ -559,9 +564,12 @@ vct 會把使用者設定存放在 `~/.vct/config.toml`。這個檔案會在**
559
564
  # 未指定 --daily/--weekly/--monthly/--all flag 時使用的預設時間範圍。
560
565
  # 可選值:"daily" | "weekly" | "monthly" | "all"
561
566
  default_time_range = "all"
567
+ # 啟動時檢查新版, 並自動更新由官方 installer 建立的受支援直接安裝.
568
+ # 設為 false 可關閉此行為.
569
+ auto_update = true
562
570
  # 這個檔案的版面版本,由 vct 標記。只有升級流程會讀取它;
563
571
  # 除非你想讓過去的升級再跑一次,否則別去動它。
564
- version = 2
572
+ version = 3
565
573
 
566
574
  [usage]
567
575
  # 啟動 usage 儀表板時,是否先把不同 provider 前綴的 model 合併。
@@ -608,6 +616,7 @@ retention_days = 7
608
616
  | 設定項 | 效果 |
609
617
  | ------------------------------ | ------------------------------------------------------------------------------------------------------------- |
610
618
  | `general.default_time_range` | 未指定 `--daily/--weekly/--monthly/--all` 時使用的時間範圍。明確指定的 flag 一律優先。 |
619
+ | `general.auto_update` | 啟動時每天 UTC 日期最多檢查一次, 並只更新官方 installer 的直接安裝. 設為 `false` 可關閉. |
611
620
  | `general.version` | vct 標記在檔案上的版面版本,讓後續版本新增的面板只會向你提議一次。 |
612
621
  | `usage.merge_models` | 讓儀表板一開始就是合併狀態;`m` 切換會把你最後的選擇存回這裡。`--merge-providers` 會強制開啟。 |
613
622
  | `usage.refresh_interval` | `usage` 儀表板自動刷新的間隔(秒)。 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mai0313/vct",
3
- "version": "2.3.1",
3
+ "version": "2.5.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",