@aiusage/cli 1.7.4 → 1.7.5
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 +16 -2
- package/README.zh-CN.md +21 -1
- package/dist/cli.js +783 -133
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
`@aiusage/cli` is the AIUsage command-line tool for:
|
|
4
4
|
|
|
5
5
|
- discovering and managing projects across AI tools
|
|
6
|
-
- scanning local Claude Code, Codex, Cursor, Copilot CLI, Copilot for VS Code, Gemini CLI, Antigravity, Amp, Kimi Code, Qwen Code, Droid, OpenCode, and
|
|
6
|
+
- scanning local Claude Code, Codex, Cursor, Copilot CLI, Copilot for VS Code, Gemini CLI, Antigravity, Amp, Kimi Code, Qwen Code, Droid, OpenCode, Pi, and Trae usage
|
|
7
7
|
- importing historical usage from Anthropic Admin API
|
|
8
8
|
- printing local usage summaries for the last 7 days, 30 days, 90 days, or all history
|
|
9
9
|
- scheduling automatic sync to an AIUsage Worker
|
|
@@ -31,6 +31,7 @@ differ, rather than treating every local record as billable token usage.
|
|
|
31
31
|
| Droid | `~/.factory/sessions/*.settings.json`; uses persisted token totals first and the transcript only as a model fallback. |
|
|
32
32
|
| OpenCode | OpenCode 1.2+ `opencode.db` through read-only `sqlite3`, plus legacy `storage/message/*.json`. |
|
|
33
33
|
| Pi / Oh My Pi | `~/.pi/agent/sessions/` and `~/.omp/agent/sessions/` JSONL, including provider, cache-write, and session metadata. |
|
|
34
|
+
| Trae / Trae CN | `aiusage trae sync` reads Trae CN history through Trae's official local `ai-agent` RPC and writes a privacy-minimized cache under `~/.aiusage/trae-cache/sessions/`. The scanner also accepts international Trae caches produced by `tokscale trae sync` under `~/.config/tokscale/trae-cache/sessions/`. The encrypted SQLCipher database is never opened directly. |
|
|
34
35
|
|
|
35
36
|
Only token counters and session metadata are aggregated or uploaded. Conversation
|
|
36
37
|
content and local credentials are never uploaded.
|
|
@@ -67,7 +68,7 @@ aiusage project alias # list all configured aliases
|
|
|
67
68
|
aiusage project alias --remove myapp # remove alias
|
|
68
69
|
```
|
|
69
70
|
|
|
70
|
-
Scans data directories for all supported tools, including Kimi Code session metadata, listing discovered projects with their aliases and sources.
|
|
71
|
+
Scans data directories for all supported tools, including Kimi Code session metadata and the Trae CN sync cache, listing discovered projects with their aliases and sources.
|
|
71
72
|
|
|
72
73
|
Project aliases are applied locally before upload. If two devices set the same alias for their respective project directories, the server merges them into one project.
|
|
73
74
|
|
|
@@ -90,6 +91,19 @@ Reads data from local tool data directories including `~/.claude/projects` (Clau
|
|
|
90
91
|
|
|
91
92
|
**Compact mode** (default) shows Sources and Daily tables with merged Cache column and 2-decimal cost. **Detail mode** (`--detail`) expands all columns (CacheRead, CacheWrite, Reasoning), adds Top Models and Pricing Notes sections, and shows 4-decimal cost.
|
|
92
93
|
|
|
94
|
+
### trae sync
|
|
95
|
+
|
|
96
|
+
Sync Trae CN's local historical token counters before running a regular report or dashboard upload:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
aiusage trae sync
|
|
100
|
+
aiusage report --range all
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
If Trae CN is closed, AIUsage temporarily launches it with a local-only debugging port, reads the official `ai-agent` session API, then closes the temporary instance. If Trae is already running without that port, quit Trae and rerun the command. Use `--port 9230 --no-launch` to connect to an instance you started yourself.
|
|
104
|
+
|
|
105
|
+
Only session identifiers, workspace paths, timestamps, model labels, and numeric token counters are cached. Conversation content and login credentials are neither cached nor uploaded. International Trae users can run `tokscale trae sync`; AIUsage reads that compatible cache automatically.
|
|
106
|
+
|
|
93
107
|
### Shared date options
|
|
94
108
|
|
|
95
109
|
`scan`, `report`, and `sync` use the same date options:
|
package/README.zh-CN.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
`@aiusage/cli` 是 AIUsage 命令行工具,用于:
|
|
4
4
|
|
|
5
5
|
- 发现和管理本机 AI 工具项目
|
|
6
|
-
- 扫描本地 AI 编程工具的 Token 用量(Claude Code、Codex、Cursor、Copilot CLI、Copilot VS Code、Gemini CLI、Antigravity、Amp、Kimi Code、Qwen Code、Droid、OpenCode、Pi)
|
|
6
|
+
- 扫描本地 AI 编程工具的 Token 用量(Claude Code、Codex、Cursor、Copilot CLI、Copilot VS Code、Gemini CLI、Antigravity、Amp、Kimi Code、Qwen Code、Droid、OpenCode、Pi、Trae)
|
|
7
7
|
- 通过 Anthropic Admin API 导入历史用量
|
|
8
8
|
- 生成本地用量报告(最近 7 天、30 天、90 天或全部历史)
|
|
9
9
|
- 定时自动同步数据到 AIUsage Worker
|
|
@@ -14,6 +14,10 @@ Kimi 同时支持旧版 Kimi CLI 的 `~/.kimi/sessions/` 与新版 Kimi Code 的
|
|
|
14
14
|
`wire.jsonl` 中的 Token 计数与会话元数据,不上传对话正文;新版格式参考了
|
|
15
15
|
[tokscale](https://github.com/junhoyeo/tokscale) 的 MIT 开源实现。
|
|
16
16
|
|
|
17
|
+
Trae CN 通过 `aiusage trae sync` 调用 Trae 自己的本地 `ai-agent` 接口读取历史
|
|
18
|
+
Token 计数,缓存到 `~/.aiusage/trae-cache/sessions/`;不会直接破解加密数据库。
|
|
19
|
+
国际版 Trae 也兼容 `tokscale trae sync` 生成的缓存。
|
|
20
|
+
|
|
17
21
|
## 安装
|
|
18
22
|
|
|
19
23
|
```bash
|
|
@@ -67,6 +71,22 @@ aiusage report --json # JSON 输出
|
|
|
67
71
|
|
|
68
72
|
**紧凑模式**(默认)显示来源和每日汇总表,合并缓存列,保留 2 位小数成本。**详细模式**(`--detail`)展开所有列(CacheRead、CacheWrite、Reasoning),增加热门模型和定价说明,显示 4 位小数成本。
|
|
69
73
|
|
|
74
|
+
### trae sync
|
|
75
|
+
|
|
76
|
+
先同步 Trae CN 的本地历史用量,再运行常规报告或看板上传:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
aiusage trae sync
|
|
80
|
+
aiusage report --range all
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
如果 Trae CN 未运行,AIUsage 会用仅限本机的调试端口临时启动它,读取官方
|
|
84
|
+
`ai-agent` 会话接口,完成后自动退出。如果 Trae 已经在运行但没有开启该端口,
|
|
85
|
+
请先退出 Trae 再重试。也可以通过 `--port 9230 --no-launch` 连接自行启动的实例。
|
|
86
|
+
|
|
87
|
+
缓存只包含会话标识、项目路径、时间、模型名和 Token 数字,不包含对话正文或登录凭据。
|
|
88
|
+
国际版用户可先执行 `tokscale trae sync`,AIUsage 会自动读取兼容缓存。
|
|
89
|
+
|
|
70
90
|
### 统一日期参数
|
|
71
91
|
|
|
72
92
|
`scan`、`report`、`sync` 使用同一套日期参数:
|