ronds_ai 0.1.33 → 0.13.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/LICENSE +21 -0
- package/PRIVACY.md +56 -0
- package/README.md +54 -462
- package/bin/ronds_ai.js +641 -383
- package/contracts/component-protocol.json +74 -0
- package/lib/archive.js +88 -0
- package/lib/auto-bootstrap.js +544 -0
- package/lib/component-store.js +245 -0
- package/lib/consent.js +221 -0
- package/lib/default-org.js +27 -0
- package/lib/doctor.js +240 -213
- package/lib/gateway.js +185 -0
- package/lib/legacy.js +760 -0
- package/lib/manager-store.js +703 -0
- package/lib/migration.js +1640 -0
- package/lib/org-config.js +464 -0
- package/lib/paths.js +24 -0
- package/lib/release.js +193 -0
- package/lib/route.js +86 -0
- package/lib/uninstall.js +239 -0
- package/lib/update-manager.js +247 -0
- package/package.json +20 -23
- package/lib/ai_usage_events.js +0 -831
- package/lib/analyze_claude.js +0 -160
- package/lib/analyze_config.js +0 -119
- package/lib/analyze_diagnostics.js +0 -606
- package/lib/analyze_session.js +0 -167
- package/lib/check_record.js +0 -237
- package/lib/code_record.js +0 -875
- package/lib/git.js +0 -27
- package/lib/hooks_auto_sync.js +0 -422
- package/lib/hooks_deploy.js +0 -892
- package/lib/skills_install.js +0 -226
- package/lib/skills_prompt.js +0 -130
- package/lib/skills_targets.js +0 -81
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ronds
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/PRIVACY.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# PRIVACY
|
|
2
|
+
|
|
3
|
+
_Last updated: 2026-10-17. This notice describes the `ronds_ai` **manager**
|
|
4
|
+
npm package and, at a summary level, the separately distributed component it
|
|
5
|
+
installs._
|
|
6
|
+
|
|
7
|
+
## The manager itself collects nothing
|
|
8
|
+
|
|
9
|
+
This package does not read, store, or transmit your code, prompts, AI session
|
|
10
|
+
files, editor activity, or identity. It only:
|
|
11
|
+
|
|
12
|
+
- downloads and verifies a signed component archive from the organization's
|
|
13
|
+
release channel,
|
|
14
|
+
- records which permissions you granted (booleans + timestamp, no content),
|
|
15
|
+
- forwards fixed commands to the locally installed component.
|
|
16
|
+
|
|
17
|
+
## What the installed component can collect — only with your grant
|
|
18
|
+
|
|
19
|
+
Collection happens solely in the privately distributed component and each
|
|
20
|
+
category is off by default:
|
|
21
|
+
|
|
22
|
+
| Permission | What it would collect if granted |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| `codeMetrics` | statistics of your AI-assisted code edits (counts, file names) |
|
|
25
|
+
| `codeContent` | the changed code text itself |
|
|
26
|
+
| `promptContent` | prompts you send to supported AI tools and invoked skills |
|
|
27
|
+
| `identity` | your employee/work ID and git author identity attached to events |
|
|
28
|
+
| `historyScan` | explicit backfill scan of past session files |
|
|
29
|
+
|
|
30
|
+
Until a permission is granted, hooks run in a fail-open no-op mode: your tools
|
|
31
|
+
work normally and nothing is queued. Queued data leaves the machine **only**
|
|
32
|
+
via `flush`/scheduled maintenance, **only** to the receiver URL in the
|
|
33
|
+
organization configuration (never a hardcoded endpoint), and only event types
|
|
34
|
+
whose permission is currently granted.
|
|
35
|
+
|
|
36
|
+
## Background processes
|
|
37
|
+
|
|
38
|
+
- One per-user scheduled task (`ronds_ai_sync`) runs a maintenance cycle every
|
|
39
|
+
4 hours: update checks + authorized scan/flush. Installed only after the
|
|
40
|
+
`schedule` permission is granted; removable via
|
|
41
|
+
`ronds_ai schedule uninstall` or `ronds_ai uninstall`.
|
|
42
|
+
- Tool hooks point to a local gateway file; if the component is missing or
|
|
43
|
+
unauthorized they exit immediately without collecting.
|
|
44
|
+
|
|
45
|
+
## Stopping and removing
|
|
46
|
+
|
|
47
|
+
`ronds_ai disable` (stop everything), `ronds_ai uninstall --confirm`
|
|
48
|
+
(full removal — local unsent queues are kept on disk for your inspection and
|
|
49
|
+
are never uploaded after uninstall). `ronds_ai consent show` lists every
|
|
50
|
+
granted permission at any time.
|
|
51
|
+
|
|
52
|
+
## Review
|
|
53
|
+
|
|
54
|
+
The component's full source is available to authorized reviewers via the
|
|
55
|
+
organization's internal GitLab. The manager archive intentionally contains no
|
|
56
|
+
business collection code, no secrets, and no install scripts.
|
package/README.md
CHANGED
|
@@ -1,467 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
`ronds_ai` 是一个命令行工具,主要用于两类事情:
|
|
4
|
-
|
|
5
|
-
- 接收 Claude / Cursor / Hermes / Codex 的 hook 事件,整理成统一的代码变更事件并上报
|
|
6
|
-
- 帮助项目写入对应的 hook 配置,以及安装 Skills 到 Claude / Codex / Cursor
|
|
7
|
-
|
|
8
|
-
## Requirements
|
|
9
|
-
|
|
10
|
-
- Node.js `>=16`
|
|
11
|
-
- `git`
|
|
12
|
-
- `unzip`
|
|
13
|
-
|
|
14
|
-
`git` 主要用于读取仓库信息和用户邮箱;`unzip` 用于 `skills install` 解压技能包。
|
|
15
|
-
可选的 `analyze` 命令单独要求 Node.js `>=20`,不会改变 `record` 等现有命令的 Node 版本要求。
|
|
16
|
-
|
|
17
|
-
## Install
|
|
18
|
-
|
|
19
|
-
按一次性执行使用:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npx ronds_ai@latest <command>
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
或全局安装:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm install -g ronds_ai
|
|
29
|
-
ronds_ai <command>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Commands
|
|
33
|
-
|
|
34
|
-
### `check record`
|
|
35
|
-
|
|
36
|
-
检查 `record` 命令运行所需的基础环境。
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
ronds_ai check record
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
示例:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
npx ronds_ai@latest check record
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
当前会检查并输出:
|
|
49
|
-
|
|
50
|
-
- 当前 Node 版本
|
|
51
|
-
- Node 是否满足 `>=16`
|
|
52
|
-
- 当前目录下读取到的 `git user.email`
|
|
53
|
-
- 当前 `MCP_TRACKER_WORKER_ID` 的来源和取值
|
|
54
|
-
- `~/.profile` 路径
|
|
55
|
-
|
|
56
|
-
输出 JSON 后,命令还会继续在终端里显示当前 `MCP_TRACKER_WORKER_ID`,并询问是否要修改。
|
|
57
|
-
如果选择修改:
|
|
58
|
-
|
|
59
|
-
- Windows:写入用户级持久环境变量,新的终端可直接读取
|
|
60
|
-
- Linux:写入 `~/.profile`,新的 shell 可读取
|
|
61
|
-
|
|
62
|
-
如果不想进入交互流程,可加上:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
ronds_ai check record --no-prompt
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
或:
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
npx ronds_ai@latest check record --no-prompt
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
交互式修改后,命令会再次显示更新后的 `MCP_TRACKER_WORKER_ID`。
|
|
75
|
-
|
|
76
|
-
输出是一个 JSON,例如:
|
|
77
|
-
|
|
78
|
-
```json
|
|
79
|
-
{
|
|
80
|
-
"ok": true,
|
|
81
|
-
"targetDir": "/path/to/project",
|
|
82
|
-
"node": {
|
|
83
|
-
"version": "v20.19.0",
|
|
84
|
-
"requirement": ">=16",
|
|
85
|
-
"satisfied": true
|
|
86
|
-
},
|
|
87
|
-
"gitUserEmail": "name@example.com",
|
|
88
|
-
"workerId": {
|
|
89
|
-
"name": "MCP_TRACKER_WORKER_ID",
|
|
90
|
-
"value": "worker-123",
|
|
91
|
-
"source": "env"
|
|
92
|
-
},
|
|
93
|
-
"profileFile": "/Users/you/.profile"
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
如果 Node 版本不满足要求,命令会返回非 0 退出码。
|
|
98
|
-
|
|
99
|
-
### `record`
|
|
100
|
-
|
|
101
|
-
从标准输入读取 Claude、Codex、Cursor 或 Hermes 的 hook payload,转换为统一事件后发送到服务端。
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
ronds_ai record <tool>
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
支持的 `tool`:
|
|
108
|
-
|
|
109
|
-
- `claude`
|
|
110
|
-
- `codex`
|
|
111
|
-
- `cursor`
|
|
112
|
-
- `hermes`
|
|
113
|
-
|
|
114
|
-
示例:
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
npx ronds_ai@latest record claude
|
|
118
|
-
npx ronds_ai@latest record codex
|
|
119
|
-
npx ronds_ai@latest record cursor
|
|
120
|
-
npx ronds_ai@latest record hermes
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
这个命令通常不是手工执行,而是被 Claude / Codex / Cursor 或 Hermes 的 hook 配置调用。
|
|
124
|
-
|
|
125
|
-
行为说明:
|
|
126
|
-
|
|
127
|
-
- 从 `stdin` 读取一段 JSON
|
|
128
|
-
- 根据来源提取文件路径、变更内容、增删行数、仓库信息、worker_id
|
|
129
|
-
- 组装事件后通过 HTTP POST 上报
|
|
130
|
-
- Claude / Cursor 成功时输出一行 JSON
|
|
131
|
-
- Claude / Cursor 失败时会把事件写入本地失败日志,并输出保存位置
|
|
132
|
-
- Codex 作为 `PostToolUse` hook 调用时,标准输出固定为 Codex hook command output schema,避免触发 `invalid post-tool-use JSON output`
|
|
133
|
-
|
|
134
|
-
成功输出示例:
|
|
135
|
-
|
|
136
|
-
```json
|
|
137
|
-
{"status":"sent","event_id":"...","response_status":200}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
`dry-run` 输出示例:
|
|
141
|
-
|
|
142
|
-
```json
|
|
143
|
-
{"status":"dry-run","event_id":"...","response_status":0}
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
失败保存输出示例:
|
|
147
|
-
|
|
148
|
-
```json
|
|
149
|
-
{"status":"saved","event_id":"...","saved_path":"/Users/you/.ronds_ai/failed-events/20260409-claude-error.jsonl"}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
目前支持的 hook 事件:
|
|
153
|
-
|
|
154
|
-
- Claude: `PostToolUse`
|
|
155
|
-
- Codex: `PostToolUse`(`apply_patch` 编辑后采集)
|
|
156
|
-
- Cursor: `afterFileEdit`
|
|
157
|
-
- **Hermes**: `post_tool_call`
|
|
158
|
-
|
|
159
|
-
其中 Claude 仅处理这些工具产生的事件:
|
|
160
|
-
|
|
161
|
-
- `Write`
|
|
162
|
-
- `Edit`
|
|
163
|
-
- `MultiEdit`
|
|
164
|
-
|
|
165
|
-
Codex 使用 `PostToolUse` hook,在 `apply_patch` 执行后直接解析本次补丁内容并生成变更事件;失败事件同样写入 `~/.ronds_ai/failed-events`。
|
|
166
|
-
|
|
167
|
-
Codex 输出示例:
|
|
168
|
-
|
|
169
|
-
```json
|
|
170
|
-
{"continue":true,"hookSpecificOutput":{"hookEventName":"PostToolUse"}}
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
**Hermes** 使用 [Shell hooks](https://hermes-agent.nousresearch.com/docs/user-guide/features/hooks#shell-hooks),通过 `~/.hermes/config.yaml` 中的 `hooks.post_tool_call` 配置监听 `write_file` 和 `patch` 工具的调用。Hermes Shell hook 不要求特定 stdout 格式,成功/失败信息直接输出 JSON 结果行。
|
|
174
|
-
|
|
175
|
-
### `analyze`
|
|
176
|
-
|
|
177
|
-
接收 Claude Code 的逐轮 Hook 事件,并异步上报用户 Prompt 与 Skill 调用:
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
ronds_ai analyze claude
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
该命令由 `hooks deploy` 自动安装到 `UserPromptSubmit` 和 `PostToolUse:Skill`(project 或 user scope,未用 `--tool` 排除 claude 时)。它上报:
|
|
1
|
+
# ronds_ai (manager)
|
|
184
2
|
|
|
185
|
-
-
|
|
186
|
-
-
|
|
187
|
-
|
|
188
|
-
|
|
3
|
+
`ronds_ai` is the **manager** half of a two-part client tool for Ronds
|
|
4
|
+
enterprise AI-usage analytics. It is a thin, public npm package: it does **not**
|
|
5
|
+
collect any code, prompts, or telemetry itself. All collection logic ships in a
|
|
6
|
+
separate, privately distributed **component** that this manager downloads,
|
|
7
|
+
signature-verifies, installs and invokes on the user's machine.
|
|
189
8
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
事件入口地址默认为本机 API,也可按部署环境覆盖:
|
|
9
|
+
## What this package does
|
|
193
10
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
`
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
{
|
|
203
|
-
"hooks": [
|
|
204
|
-
{
|
|
205
|
-
"type": "command",
|
|
206
|
-
"command": "npx ronds_ai@latest analyze claude",
|
|
207
|
-
"async": true
|
|
208
|
-
}
|
|
209
|
-
]
|
|
210
|
-
}
|
|
211
|
-
],
|
|
212
|
-
"PostToolUse": [
|
|
213
|
-
{
|
|
214
|
-
"matcher": "Skill",
|
|
215
|
-
"hooks": [
|
|
216
|
-
{
|
|
217
|
-
"type": "command",
|
|
218
|
-
"command": "npx ronds_ai@latest analyze claude",
|
|
219
|
-
"async": true
|
|
220
|
-
}
|
|
221
|
-
]
|
|
222
|
-
}
|
|
223
|
-
]
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
升级到 schema v6 时会清理本工具管理的旧 `Stop` / `SessionEnd` analyze Hook,同时保留用户自定义 Hook。Hook payload 或本地入队失败时,`analyze` 保持 fail-open。
|
|
229
|
-
|
|
230
|
-
### `doctor`
|
|
231
|
-
|
|
232
|
-
检查当前目录下的 hook 配置和最近错误日志,方便排查接入问题。
|
|
233
|
-
|
|
234
|
-
```bash
|
|
235
|
-
ronds_ai doctor <tool>
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
支持的 `tool`:
|
|
11
|
+
| Area | Behavior |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| Component install / update | Downloads a versioned component archive from the **organization-configured source** (or a built-in default org source), verifies an **Ed25519 signature** over the release manifest, checks size + SHA-512, extracts with a hardened no-symlink/no-traversal extractor, and runs the component's `capabilities` / `health` self-checks in isolation before activating it atomically. |
|
|
14
|
+
| Command routing | Fixed business commands (`record`, `analyze`, `scan`, `flush`, `maintenance run`, `skills install`, `schedule …`, `hooks …`) are checked against the user's recorded consent and then forwarded to the locally installed component. stdin/stdout/exit codes pass through; the manager never parses business payloads. |
|
|
15
|
+
| Two update chains | The manager updates itself from npm and the component from the signed manifest channel, each with independent 4h→24h backoff, anti-replay sequence watermarks, and no-downgrade rules. |
|
|
16
|
+
| Self-versioning | Manager versions install under `~/.ronds_ai/manager/versions/` with a minimal stable bootstrap (`launch.cjs`) that can roll back to the last known good version offline (`ronds_ai manager rollback --previous`). |
|
|
17
|
+
| Stable entrypoints | Hooks and scheduled tasks point at stable entry files (`manager/dispatch.cjs`, `manager/launch.cjs`) that never move between versions — upgrading never rewrites your hooks or tasks. |
|
|
18
|
+
| Legacy migration | Read-only inventory (`legacy inspect`), transactional data migration (`legacy apply`) and a gated takeover transaction (`migration apply`) migrate existing single-package installs safely. |
|
|
239
19
|
|
|
240
|
-
|
|
241
|
-
- `claude`
|
|
242
|
-
- `codex`
|
|
243
|
-
- `cursor`
|
|
244
|
-
- `hermes`
|
|
245
|
-
|
|
246
|
-
示例:
|
|
247
|
-
|
|
248
|
-
```bash
|
|
249
|
-
npx ronds_ai@latest doctor analyze
|
|
250
|
-
npx ronds_ai@latest doctor claude
|
|
251
|
-
npx ronds_ai@latest doctor codex
|
|
252
|
-
npx ronds_ai@latest doctor cursor
|
|
253
|
-
npx ronds_ai@latest doctor hermes
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
输出内容包括:
|
|
257
|
-
|
|
258
|
-
- 当前检查的工具类型
|
|
259
|
-
- 当前目标目录
|
|
260
|
-
- 当前目录下的 `git user.email`
|
|
261
|
-
- 关键配置文件是否存在
|
|
262
|
-
- 今天的最近错误日志内容
|
|
20
|
+
## What this package explicitly does NOT do
|
|
263
21
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
- 写入或更新 `.cursor/hooks.json`
|
|
303
|
-
- 写入或更新 `.claude/settings.json`(代码采集 Hook,以及异步的 `UserPromptSubmit` / `PostToolUse:Skill` analyze Hook)
|
|
304
|
-
- 清理项目内旧版 Cursor、Claude、Codex hook 脚本
|
|
305
|
-
- 跳过 Codex 项目级配置部署,并在输出中说明原因
|
|
306
|
-
|
|
307
|
-
`--scope user`(用户级部署),行为:
|
|
308
|
-
|
|
309
|
-
- 写入或更新用户级 Cursor hook 配置
|
|
310
|
-
- 写入或更新用户级 Claude hook 配置(同上,并清理本工具管理的旧 Stop / SessionEnd analyze Hook)
|
|
311
|
-
- 写入或更新系统级 `requirements.toml`(Windows: `C:\ProgramData\OpenAI\Codex\requirements.toml`,Linux / macOS: `/etc/codex/requirements.toml`),包含 `[features] hooks = true`、`[hooks]` 托管目录配置以及 `PostToolUse` 的 `apply_patch` hook
|
|
312
|
-
- 清理用户目录中的旧版 hook 脚本文件
|
|
313
|
-
|
|
314
|
-
Codex 推荐使用 `--scope user`,因为项目级 `.codex` 配置在未被用户显式信任的项目中会被 Codex 忽略。
|
|
315
|
-
|
|
316
|
-
#### Hermes Shell Hook 部署
|
|
317
|
-
|
|
318
|
-
```bash
|
|
319
|
-
ronds_ai hooks deploy hermes
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
生成或更新 `~/.hermes/config.yaml`,添加 `hooks.post_tool_call` 条目(监听 `write_file` 和 `patch` 工具的调用)并设置 `hooks_auto_accept: true`。
|
|
323
|
-
|
|
324
|
-
因为 Hermes 的 Shell hook 配置独立于 Claude / Codex / Cursor(YAML 格式、用户级目录),所以走单独的子命令路径,不与其他工具混用。
|
|
325
|
-
|
|
326
|
-
执行后 `~/.hermes/config.yaml` 的效果:
|
|
327
|
-
|
|
328
|
-
```yaml
|
|
329
|
-
hooks:
|
|
330
|
-
post_tool_call:
|
|
331
|
-
- matcher: write_file|patch
|
|
332
|
-
command: npx ronds_ai@latest record hermes
|
|
333
|
-
timeout: 30
|
|
334
|
-
hooks_auto_accept: true
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
也可手动复制以上内容到 `~/.hermes/config.yaml`。
|
|
338
|
-
|
|
339
|
-
输出是一个 JSON,包含:
|
|
340
|
-
|
|
341
|
-
- `scope`: 本次部署的 scope
|
|
342
|
-
- `targetDir`: 命令执行时的项目目录
|
|
343
|
-
- `configRoot`: 实际写入配置的根目录
|
|
344
|
-
- `createdFiles`
|
|
345
|
-
- `updatedFiles`
|
|
346
|
-
- `removedFiles`
|
|
347
|
-
- `skipped`: 被跳过的工具及原因(仅在 project scope 下出现)
|
|
348
|
-
- `analyze`: Claude 会话摘要 hook 的安装状态(`installed`、`events`、`command`)
|
|
349
|
-
|
|
350
|
-
### Hooks Auto Sync(自动后台同步)
|
|
351
|
-
|
|
352
|
-
CLI 会**自动在后台检查并更新用户级 hooks 配置**,无需用户每次手动执行 `hooks deploy --scope user`。
|
|
353
|
-
|
|
354
|
-
工作方式:
|
|
355
|
-
|
|
356
|
-
1. 运行任意 CLI 命令时,进行轻量检查(多数情况下只读取一次 sentinel 文件的修改时间)
|
|
357
|
-
2. 如果距离上次检查超过 24 小时,判断 hooks schema 版本是否落后
|
|
358
|
-
3. 版本落后时,后台启动子进程自动执行 `hooks deploy --scope user` 和 `deploy hermes`
|
|
359
|
-
4. 当前命令不等待后台同步完成,也不受后台同步失败的影响
|
|
360
|
-
5. `record` 高频路径使用 sentinel fast path,额外成本约等于一次文件 stat
|
|
361
|
-
|
|
362
|
-
可通过环境变量禁用:
|
|
363
|
-
|
|
364
|
-
```bash
|
|
365
|
-
RONDS_AI_DISABLE_HOOKS_AUTO_SYNC=1
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
注意:
|
|
369
|
-
|
|
370
|
-
- auto-sync 只维护**用户级** hooks,不影响项目级配置
|
|
371
|
-
- auto-sync 会同步维护用户级 Claude 的 schema v6 逐轮事件 Hook
|
|
372
|
-
- 后台同步失败时,错误记录到 `~/.ronds_ai/hooks_auto_sync_error.log`,不污染当前命令输出
|
|
373
|
-
- 首次安装 hooks 仍建议执行 `ronds_ai hooks deploy --scope user`
|
|
374
|
-
|
|
375
|
-
### `skills install`
|
|
376
|
-
|
|
377
|
-
下载一个技能包并安装到 Claude / Codex / Cursor 对应的技能目录。
|
|
378
|
-
|
|
379
|
-
```bash
|
|
380
|
-
ronds_ai skills install <name> [--tool claude,codex,cursor] [--scope project|global] [--project-dir <path>] [--force]
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
示例:
|
|
384
|
-
|
|
385
|
-
```bash
|
|
386
|
-
npx ronds_ai@latest skills install demo-skill
|
|
387
|
-
npx ronds_ai@latest skills install demo-skill --tool claude --scope global
|
|
388
|
-
npx ronds_ai@latest skills install demo-skill --tool codex,cursor --scope project
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
参数说明:
|
|
392
|
-
|
|
393
|
-
- `name`: 要安装的 skill 名称
|
|
394
|
-
- `--tool`: 目标工具,可传 `claude`、`codex`、`cursor`,多个值用逗号分隔
|
|
395
|
-
- `--scope`: 安装范围,可选 `project` 或 `global`
|
|
396
|
-
- `--project-dir`: 当 `scope=project` 时指定项目目录;默认是当前目录
|
|
397
|
-
- `--force`: 目标目录已存在时覆盖
|
|
398
|
-
|
|
399
|
-
如果没有传 `--tool` 或 `--scope`,CLI 会进入交互式提示。
|
|
400
|
-
|
|
401
|
-
安装目录规则:
|
|
402
|
-
|
|
403
|
-
- `claude` + `project`: `<project>/.claude/skills/<name>`
|
|
404
|
-
- `claude` + `global`: `~/.claude/skills/<name>`
|
|
405
|
-
- `codex` + `project`: `<project>/.agents/skills/<name>`
|
|
406
|
-
- `codex` + `global`: `~/.agents/skills/<name>`
|
|
407
|
-
- `cursor` + `project`: `<project>/.agents/skills/<name>`
|
|
408
|
-
- `cursor` + `global`: `~/.agents/skills/<name>`
|
|
409
|
-
|
|
410
|
-
输出是一个 JSON,包含:
|
|
411
|
-
|
|
412
|
-
- 安装的 skill 名称
|
|
413
|
-
- 安装范围
|
|
414
|
-
- 项目目录
|
|
415
|
-
- 下载地址
|
|
416
|
-
- 实际安装到的目标路径列表
|
|
417
|
-
|
|
418
|
-
## Environment Variables
|
|
419
|
-
|
|
420
|
-
### `record` 相关
|
|
421
|
-
|
|
422
|
-
- `HOOK_REPORT_URL`: 上报地址
|
|
423
|
-
- `CHANGE_REPORT_URL`: 上报地址,作为 `HOOK_REPORT_URL` 的备用读取项
|
|
424
|
-
- `HOOK_REPORT_TIMEOUT_MS`: 请求超时时间,默认 `10000`
|
|
425
|
-
- `HOOK_REPORT_TOKEN`: 如果设置,会以 `Authorization: Bearer <token>` 发送
|
|
426
|
-
- `HOOK_REPORT_HEADERS`: 额外请求头,要求是 JSON 字符串
|
|
427
|
-
- `HOOK_REQUEST_DRY_RUN=1`: 不发请求。Claude / Cursor 会把事件打印到标准输出;Codex 仍输出合法的 PostToolUse hook command output schema
|
|
428
|
-
|
|
429
|
-
默认上报地址:
|
|
430
|
-
|
|
431
|
-
```text
|
|
432
|
-
https://aihub.ronds.com/api/api/v1/ai-code-events
|
|
433
|
-
```
|
|
434
|
-
|
|
435
|
-
### `worker_id` 解析顺序
|
|
436
|
-
|
|
437
|
-
`record` 在构建事件时,会按下面顺序寻找 `worker_id`:
|
|
438
|
-
|
|
439
|
-
1. `process.cwd()/.ai_config/config.json` 中的 `worker_id`
|
|
440
|
-
2. Git 仓库根目录下 `.ai_config/config.json` 中的 `worker_id`
|
|
441
|
-
3. 环境变量 `MCP_TRACKER_WORKER_ID`
|
|
442
|
-
4. 环境变量 `WORKER_ID`
|
|
443
|
-
5. 当前系统用户名
|
|
444
|
-
|
|
445
|
-
## Error Logs
|
|
446
|
-
|
|
447
|
-
命令运行失败或上报失败时,会把信息保存到:
|
|
448
|
-
|
|
449
|
-
```text
|
|
450
|
-
~/.ronds_ai/failed-events
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
常见文件名格式:
|
|
454
|
-
|
|
455
|
-
- `YYYYMMDD-claude-error.jsonl`
|
|
456
|
-
- `YYYYMMDD-codex-error.jsonl`
|
|
457
|
-
- `YYYYMMDD-cursor-error.jsonl`
|
|
458
|
-
- `YYYYMMDD-hermes-error.jsonl`
|
|
459
|
-
- `YYYYMMDD-cli-error.jsonl`
|
|
460
|
-
|
|
461
|
-
## Notes
|
|
462
|
-
|
|
463
|
-
- `record` 和 `doctor` 目前支持 `claude`、`codex`、`cursor`、`hermes`
|
|
464
|
-
- `hooks deploy` 支持 `claude`、`codex`、`cursor`、`hermes`(hermes 为独立子命令)
|
|
465
|
-
- `skills install` 支持 `claude`、`codex`、`cursor`
|
|
466
|
-
- 不支持的命令或参数会直接报错,并把错误写入 CLI 错误日志
|
|
467
|
-
|
|
22
|
+
- It does **not** read or store code contents, prompts, session files, git
|
|
23
|
+
identity, or any other user content.
|
|
24
|
+
- It does **not** modify host tool configuration files (hook deployment is
|
|
25
|
+
executed by the privately distributed component and always targets the
|
|
26
|
+
manager's stable gateway entry).
|
|
27
|
+
- It contains **no** secrets: no private keys, no tokens, no business API
|
|
28
|
+
endpoints. The only embedded metadata is a default organization channel URL
|
|
29
|
+
and its public verification key (see `lib/default-org.js`), which an
|
|
30
|
+
explicit `setup --config <file>` can override.
|
|
31
|
+
- It runs no install scripts (no `preinstall`/`postinstall`).
|
|
32
|
+
|
|
33
|
+
## Where the sensitive parts live
|
|
34
|
+
|
|
35
|
+
The component that performs collection (code-edit metrics, prompt/skill
|
|
36
|
+
events, session scanning) is distributed privately through the organization's
|
|
37
|
+
signed release channel, is activated only after the user (or an auditable
|
|
38
|
+
organization policy) grants specific permissions, and its source is available
|
|
39
|
+
for review to authorized reviewers via the organization's internal GitLab.
|
|
40
|
+
|
|
41
|
+
## Data & permissions summary
|
|
42
|
+
|
|
43
|
+
Nine independent permissions (`codeMetrics`, `codeContent`, `promptContent`,
|
|
44
|
+
`identity`, `historyScan`, `hookRepair`, `schedule`, `managerAutoUpdate`,
|
|
45
|
+
`componentAutoUpdate`) default to **false**. Nothing is queued or uploaded
|
|
46
|
+
until the corresponding permission is explicitly granted
|
|
47
|
+
(`ronds_ai consent grant …`, inspectable via `ronds_ai consent show`). Uploads
|
|
48
|
+
go only to the receiver configured in the organization file, never to a
|
|
49
|
+
hardcoded endpoint.
|
|
50
|
+
|
|
51
|
+
## How to stop it
|
|
52
|
+
|
|
53
|
+
- `ronds_ai disable` — persistent stop; blocks installs, updates, maintenance.
|
|
54
|
+
- `ronds_ai uninstall --confirm` — stops the scheduled task, removes managed
|
|
55
|
+
hooks, removes the installed component and entrypoints; keeps your consent
|
|
56
|
+
records and any not-yet-uploaded local queues for inspection.
|
|
57
|
+
- `ronds_ai doctor` — read-only health report of everything above.
|
|
58
|
+
|
|
59
|
+
Full design: [`docs/design/manager-component-handoff.md`](http://172.16.0.9:30000/raoyu/ronds_ai_cli/-/blob/codex/manager-component-split/docs/design/manager-component-handoff.md) (internal GitLab).
|