@openturtle/cli 0.3.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 +674 -0
- package/dist/commands/collaboration.js +315 -0
- package/dist/commands/hook.js +162 -0
- package/dist/commands/resources.js +118 -0
- package/dist/core/api-client.js +221 -0
- package/dist/core/auth.js +35 -0
- package/dist/core/defaults.js +1 -0
- package/dist/core/input.js +37 -0
- package/dist/core/json.js +34 -0
- package/dist/core/managed-block.js +25 -0
- package/dist/core/mcp-config.js +129 -0
- package/dist/core/paths.js +32 -0
- package/dist/core/store.js +102 -0
- package/dist/core/types.js +1 -0
- package/dist/core/version.js +33 -0
- package/dist/core/web-auth.js +115 -0
- package/dist/index.js +469 -0
- package/dist/installers/agents.js +301 -0
- package/dist/installers/git.js +63 -0
- package/dist/installers/uninstall.js +107 -0
- package/dist/mcp/server.js +185 -0
- package/dist/watchers/importers.js +69 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,674 @@
|
|
|
1
|
+
# OpenTurtle CLI
|
|
2
|
+
|
|
3
|
+
OpenTurtle CLI 是一个本地命令行工具。它让你不安装 Desktop,也能使用团队协同、项目上下文、知识库、会议、目标、待办和工作日志,并把 Claude、Codex、Cursor、Qoder、Kiro 接入 OpenTurtle。
|
|
4
|
+
|
|
5
|
+
命令名是 `ot`。
|
|
6
|
+
|
|
7
|
+
## 给人看的快速开始
|
|
8
|
+
|
|
9
|
+
从 npm 全局安装:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install --global @openturtle/cli
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
临时使用、不全局安装时:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm dlx @openturtle/cli --help
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
进入你的项目后初始化:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ot init --update-gitignore
|
|
25
|
+
ot auth login --web
|
|
26
|
+
ot install --target all
|
|
27
|
+
ot --json doctor
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
日常使用:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
ot todos list --mine
|
|
34
|
+
ot goals list
|
|
35
|
+
ot projects list
|
|
36
|
+
ot roster list
|
|
37
|
+
ot context get --project <project-id>
|
|
38
|
+
ot knowledge search "部署"
|
|
39
|
+
ot meetings list --project <project-id>
|
|
40
|
+
ot worklogs record --summary "完成联调" --type progress
|
|
41
|
+
ot report draft --today
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
如果你希望 AI 工具自动帮你记录开发过程,再执行:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
ot install --target all --with-agent-hooks
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
hooks 只负责记录,不会阻止提交代码,也不会改变 AI 工具原本的行为。
|
|
51
|
+
|
|
52
|
+
## 常用场景
|
|
53
|
+
|
|
54
|
+
### 看我的待办
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
ot todos list --mine
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 更新待办进展
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
ot todos progress <todo-id> --message "完成接口联调,等待验收"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 记录一条工作日志
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
ot worklogs record --summary "完成 Qoder hook 接入验证" --type progress
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 搜索知识
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
ot knowledge search "日报"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 上传录音并处理会议
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
ot meetings upload ./meeting.m4a --project <project-id> --title "周会"
|
|
82
|
+
ot meetings processing <meeting-id>
|
|
83
|
+
ot meetings minutes <meeting-id>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 把会议结论同步到项目
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
ot meetings publish <meeting-id> --dry-run
|
|
90
|
+
ot meetings publish <meeting-id>
|
|
91
|
+
ot meetings updates list <meeting-id>
|
|
92
|
+
ot meetings updates confirm <meeting-id> <update-id> --knowledge <knowledge-id> --dry-run
|
|
93
|
+
ot meetings updates confirm <meeting-id> <update-id> --knowledge <knowledge-id>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
完整会议纪要先发布为 Knowledge。只有人工查看过项目更新草稿,并拿到已保存的 `knowledge_id` 后,CLI 才允许确认项目更新。
|
|
97
|
+
|
|
98
|
+
### 查看知识来源文件
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
ot knowledge sources --path docs
|
|
102
|
+
ot knowledge source docs/guide.md
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 生成今天的日报草稿
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
ot report draft --today
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 检查安装状态
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
ot doctor
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## 登录与退出
|
|
118
|
+
|
|
119
|
+
推荐通过 Web 登录,不需要复制 token:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
ot auth login --web
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
命令会打开 Web Admin,由当前登录账号明确确认授权。只打印链接、不自动打开浏览器:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
ot auth login --web --no-open
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
连接非默认服务时可以指定 API 和 Web 地址:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
ot auth login --web --server https://example.com --web-url https://example.com/cli-auth
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
也可以使用 token 登录:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
ot auth login --token <your-token>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
默认后端地址是 `https://lavertest.kingdee.com/openturtle`,可通过 `--server` 或
|
|
144
|
+
`OPENTURTLE_SERVER_URL` 覆盖。
|
|
145
|
+
|
|
146
|
+
查看登录状态:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
ot auth status
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
退出:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
ot auth logout
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## 给 AI Agent 的完整操作手册
|
|
159
|
+
|
|
160
|
+
本节是给 AI Agent、自动化脚本和后续维护者看的。人类用户通常只需要阅读上面的快速开始。
|
|
161
|
+
|
|
162
|
+
### 1. 基本身份
|
|
163
|
+
|
|
164
|
+
| 项目 | 值 |
|
|
165
|
+
| ----------------- | -------------------- |
|
|
166
|
+
| CLI command | `ot` |
|
|
167
|
+
| Package | `@openturtle/cli` |
|
|
168
|
+
| MCP server name | `ot-cli` |
|
|
169
|
+
| Project state dir | `.openturtle-cli/` |
|
|
170
|
+
| Global state dir | `~/.openturtle/cli/` |
|
|
171
|
+
|
|
172
|
+
重要边界:
|
|
173
|
+
|
|
174
|
+
- CLI 项目状态只写 `.openturtle-cli/`
|
|
175
|
+
- CLI 全局状态只写 `~/.openturtle/cli/`
|
|
176
|
+
- 不要创建或写入项目 `.openturtle/`
|
|
177
|
+
- 不要覆盖 Desktop 的 `openturtle-knowledge`
|
|
178
|
+
- 不要覆盖 Desktop 的 `openturtle-automations`
|
|
179
|
+
- 不要覆盖旧的 `openturtle-todo`
|
|
180
|
+
|
|
181
|
+
### 2. 安装 CLI
|
|
182
|
+
|
|
183
|
+
在仓库内开发安装:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
cd frontend
|
|
187
|
+
pnpm install
|
|
188
|
+
pnpm --filter @openturtle/cli build
|
|
189
|
+
pnpm --filter @openturtle/cli link --global
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
验证:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
command -v ot
|
|
196
|
+
ot --help
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
不全局安装时,可以在 `frontend` 目录运行:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
pnpm --filter @openturtle/cli dev -- --help
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
构建后可以直接运行:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
node apps/cli/dist/index.js --help
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### 3. 初始化工作区
|
|
212
|
+
|
|
213
|
+
在目标项目根目录执行:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
ot init --update-gitignore
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
期望创建:
|
|
220
|
+
|
|
221
|
+
```text
|
|
222
|
+
.openturtle-cli/
|
|
223
|
+
├── config.json
|
|
224
|
+
├── state.db
|
|
225
|
+
├── hooks/
|
|
226
|
+
├── drafts/
|
|
227
|
+
└── cache/
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
初始化后执行:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
ot doctor
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### 4. 配置认证
|
|
237
|
+
|
|
238
|
+
优先使用环境变量或 `ot auth login`。不要把 token 写入代码、README、commit message 或日志。
|
|
239
|
+
|
|
240
|
+
环境变量:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
export OPENTURTLE_SERVER_URL=https://lavertest.kingdee.com/openturtle
|
|
244
|
+
export OPENTURTLE_TOKEN=<your-token>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
CLI 登录:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
ot auth login --web
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Web 登录会把 access token 和 refresh token 保存到权限为 `0600` 的 `~/.openturtle/cli/auth.json`。CLI 不读取 Desktop 或浏览器的本地 token。
|
|
254
|
+
|
|
255
|
+
显式 token 登录:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
ot auth login --token <your-token>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
用户名密码登录:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
ot auth login --username <name> --password <password>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
检查:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
ot auth status
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### 5. 安装 Agent 接入
|
|
274
|
+
|
|
275
|
+
默认安装 MCP、rules/skills 和 Git hook,不安装 Agent hooks:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
ot install --target all
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
安装 Agent hooks:
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
ot install --target all --with-agent-hooks
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
只安装某个目标:
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
ot install --target git
|
|
291
|
+
ot install --target claude
|
|
292
|
+
ot install --target codex
|
|
293
|
+
ot install --target cursor
|
|
294
|
+
ot install --target qoder
|
|
295
|
+
ot install --target kiro
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
指定作用域:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
ot install --target all --scope project
|
|
302
|
+
ot install --target all --scope user
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
卸载单个 target:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
ot uninstall --target git
|
|
309
|
+
ot uninstall --target claude
|
|
310
|
+
ot uninstall --target codex
|
|
311
|
+
ot uninstall --target cursor
|
|
312
|
+
ot uninstall --target qoder
|
|
313
|
+
ot uninstall --target kiro
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
纯净卸载全部 OpenTurtle CLI 接入:
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
ot uninstall --target all
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
卸载只会删除 `ot-cli` MCP server、`OPENTURTLE-CLI` 托管 hook、CLI 写入的 rule/skill/steering/agent 文件,以及 `.openturtle-cli/` 本地状态目录。它会保留非 OpenTurtle 配置、用户自己的 hook、Desktop/旧版 MCP server,例如 `openturtle-knowledge`、`openturtle-automations`、`openturtle-todo`。
|
|
323
|
+
|
|
324
|
+
如果 Git 原来已有 `post-commit` hook,卸载会恢复原 hook,然后删除 OpenTurtle CLI 的备份文件。
|
|
325
|
+
|
|
326
|
+
### 6. Target 安装矩阵
|
|
327
|
+
|
|
328
|
+
| Target | 默认安装 | `--with-agent-hooks` |
|
|
329
|
+
| ------ | --------------------------------------------- | ----------------------------------------------------------------------------- |
|
|
330
|
+
| Git | `.git/hooks/post-commit` | 同默认 |
|
|
331
|
+
| Claude | `ot-cli` MCP、Skill | `UserPromptSubmit`、`PreToolUse`、`PostToolUse`、`Stop` |
|
|
332
|
+
| Codex | `ot-cli` MCP、Skill、`AGENTS.md` managed note | `PreToolUse`、`PostToolUse`、`Stop` |
|
|
333
|
+
| Cursor | project `.mcp.json`、Cursor Rule | `preToolUse`、`postToolUse` |
|
|
334
|
+
| Qoder | MCP、Skill | `UserPromptSubmit`、`PreToolUse`、`PostToolUse`、`PostToolUseFailure`、`Stop` |
|
|
335
|
+
| Kiro | MCP、Steering | `agentSpawn`、`userPromptSubmit`、`preToolUse`、`postToolUse`、`stop` |
|
|
336
|
+
|
|
337
|
+
Qoder 和 Kiro 支持 native hook。CLI 仍保留 `import-history` 和 `watch`,用于补齐旧会话或未启用 hook 的环境。
|
|
338
|
+
|
|
339
|
+
### 7. Hooks 的作用
|
|
340
|
+
|
|
341
|
+
hooks 是本地记录入口。它们把开发过程写入 `.openturtle-cli/state.db`,用于工作日志、待办进展证据和日报草稿。
|
|
342
|
+
|
|
343
|
+
会记录:
|
|
344
|
+
|
|
345
|
+
- Git commit
|
|
346
|
+
- 用户提交给 Agent 的 prompt
|
|
347
|
+
- Agent tool call 前后
|
|
348
|
+
- Agent tool call 失败
|
|
349
|
+
- Agent session stop
|
|
350
|
+
- history import 记录
|
|
351
|
+
|
|
352
|
+
不会做:
|
|
353
|
+
|
|
354
|
+
- 不阻止 Git commit
|
|
355
|
+
- 不阻止 Agent tool call
|
|
356
|
+
- 不替用户批准危险操作
|
|
357
|
+
- 不上传私有文件内容
|
|
358
|
+
- 不修改 Desktop MCP server
|
|
359
|
+
|
|
360
|
+
Git hook 会保留已有 hook。原 hook 的退出码会保留,OpenTurtle 采集失败不会改变 commit 结果。
|
|
361
|
+
|
|
362
|
+
### 8. MCP server
|
|
363
|
+
|
|
364
|
+
MCP server 名固定为:
|
|
365
|
+
|
|
366
|
+
```text
|
|
367
|
+
ot-cli
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
启动:
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
ot mcp serve
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
tools:
|
|
377
|
+
|
|
378
|
+
```text
|
|
379
|
+
list_my_todos
|
|
380
|
+
list_goals
|
|
381
|
+
list_workspace_knowledge
|
|
382
|
+
search_workspace_knowledge
|
|
383
|
+
list_knowledge_source_files
|
|
384
|
+
read_knowledge_source_file
|
|
385
|
+
record_worklog
|
|
386
|
+
list_worklogs
|
|
387
|
+
draft_daily_report
|
|
388
|
+
update_todo_progress
|
|
389
|
+
update_todo_status
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
`list_workspace_knowledge` / `search_workspace_knowledge` 查询可复用知识对象。`list_knowledge_source_files` / `read_knowledge_source_file` 只查看知识背后的来源文件或原文文件,不把来源文件当成第二套知识库。
|
|
393
|
+
|
|
394
|
+
MCP tools 优先访问 OpenTurtle API。云端不可用时,尽量返回本地缓存或本地草稿信息,并标记 `source: "local_cache"`。
|
|
395
|
+
|
|
396
|
+
MCP smoke test:
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
printf '%s\n' \
|
|
400
|
+
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \
|
|
401
|
+
'{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
|
|
402
|
+
| ot mcp serve
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
期望 `serverInfo.name` 是 `ot-cli`。
|
|
406
|
+
|
|
407
|
+
### 9. 资源命令
|
|
408
|
+
|
|
409
|
+
项目、团队成员和项目上下文:
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
ot projects list --keyword "OpenTurtle"
|
|
413
|
+
ot projects resolve "OpenTurtle"
|
|
414
|
+
ot projects show <project-id> --members
|
|
415
|
+
ot roster list
|
|
416
|
+
ot context get --project <project-id> --query "本周风险" --section risk
|
|
417
|
+
ot context item meeting <meeting-id> --project <project-id>
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
目标:
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
ot goals list --mine
|
|
424
|
+
ot goals list --status in_progress
|
|
425
|
+
ot goals show <goal-id>
|
|
426
|
+
ot goals create --body-file goal.json --dry-run
|
|
427
|
+
ot goals create --body-file goal.json
|
|
428
|
+
ot goals update <goal-id> --body-file goal-update.json --dry-run
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
待办:
|
|
432
|
+
|
|
433
|
+
```bash
|
|
434
|
+
ot todos list --mine
|
|
435
|
+
ot todos list --status pending
|
|
436
|
+
ot todos show <todo-id>
|
|
437
|
+
ot todos status <todo-id> in_progress
|
|
438
|
+
ot todos progress <todo-id> --message "完成接口联调,等待验收"
|
|
439
|
+
ot todos create --body-file todo.json --dry-run
|
|
440
|
+
ot todos submit-review <todo-id> --body-file review-submission.json --dry-run
|
|
441
|
+
ot todos review <todo-id> --body-file review-decision.json --dry-run
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
知识对象:
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
ot knowledge list
|
|
448
|
+
ot knowledge search "日报"
|
|
449
|
+
ot knowledge show <knowledge-id>
|
|
450
|
+
ot knowledge relations <knowledge-id>
|
|
451
|
+
ot knowledge save --body-file knowledge.json --dry-run
|
|
452
|
+
ot knowledge save --body-file knowledge.json
|
|
453
|
+
ot knowledge save <knowledge-id> --body-file knowledge-update.json --dry-run
|
|
454
|
+
ot knowledge attach <knowledge-id> ./design.pdf ./notes.md --dry-run
|
|
455
|
+
ot knowledge attachment-content <knowledge-id> <attachment-id>
|
|
456
|
+
ot knowledge attachment-download <knowledge-id> <attachment-id> --output ./design.pdf
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
来源文件:
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
ot knowledge sources --path docs
|
|
463
|
+
ot knowledge sources --q "WPS"
|
|
464
|
+
ot knowledge source docs/guide.md
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
知识对象是可复用的结论、规范、经验、决策沉淀和操作手册。来源文件是知识背后的原文、附件或仓库文档。
|
|
468
|
+
|
|
469
|
+
会议:
|
|
470
|
+
|
|
471
|
+
```bash
|
|
472
|
+
ot meetings list --project <project-id>
|
|
473
|
+
ot meetings upload ./meeting.m4a --project <project-id> --goal <goal-id> --dry-run
|
|
474
|
+
ot meetings upload ./meeting.m4a --project <project-id> --goal <goal-id>
|
|
475
|
+
ot meetings processing <meeting-id>
|
|
476
|
+
ot meetings transcript <meeting-id>
|
|
477
|
+
ot meetings minutes <meeting-id>
|
|
478
|
+
ot meetings participants <meeting-id>
|
|
479
|
+
ot meetings recording <meeting-id> --output ./meeting.m4a
|
|
480
|
+
ot meetings publish <meeting-id>
|
|
481
|
+
ot meetings updates list <meeting-id>
|
|
482
|
+
ot meetings updates edit <meeting-id> <update-id> --body-file update.json --dry-run
|
|
483
|
+
ot meetings updates confirm <meeting-id> <update-id> --knowledge <knowledge-id> --dry-run
|
|
484
|
+
ot meetings updates ignore <meeting-id> <update-id> --dry-run
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
批量确认全部剩余草稿必须显式传 `--all`。不能同时传更新 ID 和 `--all`。
|
|
488
|
+
录音和附件下载默认拒绝覆盖已有文件;确实要覆盖时显式传 `--force`。
|
|
489
|
+
|
|
490
|
+
工作日志:
|
|
491
|
+
|
|
492
|
+
```bash
|
|
493
|
+
ot worklogs list --today
|
|
494
|
+
ot worklogs record --summary "完成 Qoder hook 接入验证" --type progress
|
|
495
|
+
ot worklogs record --summary "Codex hook trust 需要用户确认" --type blocker
|
|
496
|
+
ot worklogs create --body-file worklog.json --dry-run
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
结构化写操作统一支持 `--body-file <json>`,也可用 `--body-file -` 从 stdin 读取。建议先执行同一条命令的 `--dry-run`,确认 `request.path` 和 `request.body` 后再去掉该参数。
|
|
500
|
+
|
|
501
|
+
只读 API 还提供受限逃生口,只允许 `/api/` 下的 GET:
|
|
502
|
+
|
|
503
|
+
```bash
|
|
504
|
+
ot request get /api/teams/me
|
|
505
|
+
ot request get /api/memory/search --query q=部署 --query limit=5
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
日报草稿:
|
|
509
|
+
|
|
510
|
+
```bash
|
|
511
|
+
ot report draft --today
|
|
512
|
+
ot report draft --today --output .openturtle-cli/drafts/today.md
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
### 10. 历史导入与监听
|
|
516
|
+
|
|
517
|
+
一次性导入:
|
|
518
|
+
|
|
519
|
+
```bash
|
|
520
|
+
ot import-history --target qoder
|
|
521
|
+
ot import-history --target kiro
|
|
522
|
+
ot import-history --target all
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
查看 watcher 路径:
|
|
526
|
+
|
|
527
|
+
```bash
|
|
528
|
+
ot watch --target qoder
|
|
529
|
+
ot watch --target kiro
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
v1 优先使用 native hook。`import-history` 和 `watch` 是兜底能力。
|
|
533
|
+
|
|
534
|
+
### 11. AI Agent 推荐流程
|
|
535
|
+
|
|
536
|
+
当你需要在一个新工作区启用 CLI:
|
|
537
|
+
|
|
538
|
+
```bash
|
|
539
|
+
command -v ot
|
|
540
|
+
ot init --update-gitignore
|
|
541
|
+
ot auth status
|
|
542
|
+
ot install --target all
|
|
543
|
+
ot --json doctor
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
只有用户明确要求自动记录 Agent 行为时,才执行:
|
|
547
|
+
|
|
548
|
+
```bash
|
|
549
|
+
ot install --target all --with-agent-hooks
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
然后优先使用高层命令:
|
|
553
|
+
|
|
554
|
+
```bash
|
|
555
|
+
ot todos list --mine
|
|
556
|
+
ot projects resolve "项目名"
|
|
557
|
+
ot context get --project <project-id>
|
|
558
|
+
ot meetings list --project <project-id>
|
|
559
|
+
ot todos progress <todo-id> --message "..."
|
|
560
|
+
ot worklogs record --summary "..." --type progress
|
|
561
|
+
ot report draft --today
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
不要直接改 `.openturtle-cli/state.db`,除非用户明确要求底层排查。
|
|
565
|
+
|
|
566
|
+
### 12. AI Agent 禁止事项
|
|
567
|
+
|
|
568
|
+
- 不要写项目 `.openturtle/`
|
|
569
|
+
- 不要覆盖 `openturtle-knowledge`
|
|
570
|
+
- 不要覆盖 `openturtle-automations`
|
|
571
|
+
- 不要覆盖旧 `openturtle-todo`
|
|
572
|
+
- 不要删除用户已有 Agent 配置
|
|
573
|
+
- 不要把 token 写入代码、README、commit 或日志
|
|
574
|
+
- 不要让 hook 阻塞 Git commit 或 Agent tool call
|
|
575
|
+
- 不要伪造 Codex hook trust state
|
|
576
|
+
- 不要在会议 Knowledge 尚未发布时确认项目更新
|
|
577
|
+
- 不要跳过 `meetings updates list` 直接批量确认会议草稿
|
|
578
|
+
- 不要修改 Qoder/Kiro 私有未知格式文件;只写本文列出的配置面
|
|
579
|
+
|
|
580
|
+
### 13. JSON 输出约定
|
|
581
|
+
|
|
582
|
+
CLI 默认输出 JSON,便于 AI Agent 读取。
|
|
583
|
+
|
|
584
|
+
成功示例:
|
|
585
|
+
|
|
586
|
+
```json
|
|
587
|
+
{
|
|
588
|
+
"initialized": true,
|
|
589
|
+
"project_dir": "/path/to/project/.openturtle-cli"
|
|
590
|
+
}
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
错误会输出到 stderr,并使用非 0 退出码。传全局 `--json` 时,错误也是稳定 JSON:
|
|
594
|
+
|
|
595
|
+
```json
|
|
596
|
+
{
|
|
597
|
+
"ok": false,
|
|
598
|
+
"error": {
|
|
599
|
+
"code": "api_error",
|
|
600
|
+
"message": "GET /api/teams/me failed: 401",
|
|
601
|
+
"method": "GET",
|
|
602
|
+
"path": "/api/teams/me",
|
|
603
|
+
"status": 401
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
token 不应该被完整打印,`auth status` 只显示脱敏 token。
|
|
609
|
+
|
|
610
|
+
### 14. 开发验证
|
|
611
|
+
|
|
612
|
+
在 `frontend` 目录执行:
|
|
613
|
+
|
|
614
|
+
```bash
|
|
615
|
+
pnpm --filter @openturtle/cli test
|
|
616
|
+
pnpm --filter @openturtle/cli build
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
打包前检查 tarball 内容:
|
|
620
|
+
|
|
621
|
+
```bash
|
|
622
|
+
cd apps/cli
|
|
623
|
+
npm pack --dry-run
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
期望包内只包含 `dist/`、`README.md` 和 `package.json` 等运行所需文件,不包含 `src/` 或 `test/`。
|
|
627
|
+
|
|
628
|
+
### 15. npm 自动发布
|
|
629
|
+
|
|
630
|
+
`.github/workflows/cli-npm-release.yml` 会在 `master` 的 CLI 文件发生变化时运行测试和构建,
|
|
631
|
+
然后以仓库版本为最低版本、基于 npm 已发布版本自动递增 patch,发布公开包 `@openturtle/cli`。
|
|
632
|
+
|
|
633
|
+
发布使用 npm Trusted Publisher(OIDC),不配置 `NPM_TOKEN`。在 npm 包的
|
|
634
|
+
`Settings -> Trusted Publisher` 中选择 GitHub Actions,并配置:
|
|
635
|
+
|
|
636
|
+
- Organization or user:`aka-danielZhang`
|
|
637
|
+
- Repository:`openturtle-os`
|
|
638
|
+
- Workflow filename:`cli-npm-release.yml`
|
|
639
|
+
- Allowed actions:`npm publish`
|
|
640
|
+
|
|
641
|
+
`@openturtle/cli` 首次发布前还没有包设置页面,因此需要维护者通过 npm 登录人工发布一次;
|
|
642
|
+
创建包并配置 Trusted Publisher 后,后续 `master` 发布只使用短期 OIDC 凭证。发布固定使用
|
|
643
|
+
`https://registry.npmjs.org/`,不受开发机 `npmmirror` 配置影响。
|
|
644
|
+
|
|
645
|
+
构建后 MCP smoke test:
|
|
646
|
+
|
|
647
|
+
```bash
|
|
648
|
+
printf '%s\n' \
|
|
649
|
+
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \
|
|
650
|
+
'{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
|
|
651
|
+
| node apps/cli/dist/index.js mcp serve
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
## 常见问题
|
|
655
|
+
|
|
656
|
+
### 我没有安装 Desktop,可以用吗?
|
|
657
|
+
|
|
658
|
+
可以。CLI 的目标就是让没有 Desktop 的用户也能使用 OpenTurtle。
|
|
659
|
+
|
|
660
|
+
### 安装 hook 会不会影响我提交代码?
|
|
661
|
+
|
|
662
|
+
不会。它只记录信息,记录失败也不会改变提交结果。
|
|
663
|
+
|
|
664
|
+
### Qoder 和 Kiro 支持 hook 吗?
|
|
665
|
+
|
|
666
|
+
支持。Qoder 使用 settings hook;Kiro 使用 hooks/agent 配置。
|
|
667
|
+
|
|
668
|
+
### 为什么不用 `.openturtle/`?
|
|
669
|
+
|
|
670
|
+
为了避免和 Desktop 等本地能力混在一起。CLI 项目状态只放 `.openturtle-cli/`。
|
|
671
|
+
|
|
672
|
+
### `node:sqlite` warning 是什么?
|
|
673
|
+
|
|
674
|
+
部分 Node 版本会提示内置 SQLite 仍是 experimental。这个 warning 不影响 CLI 测试和基本使用。
|