@coderpp/yunxiao-cli 0.1.7 → 0.1.9
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 +258 -3
- package/dist/src/cli.js +531 -70
- package/dist/src/client.d.ts +109 -2
- package/dist/src/client.js +280 -0
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @coderpp/yunxiao-cli
|
|
2
2
|
|
|
3
|
-
用于评审和合并云效 Codeup
|
|
3
|
+
用于评审和合并云效 Codeup 合并请求、重试云效流水线任务、查询项目协作工作项并维护项目成员的命令行工具。
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
@@ -69,6 +69,38 @@ npm version 0.1.1
|
|
|
69
69
|
git push origin main v0.1.1
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
+
## 技能同步
|
|
73
|
+
|
|
74
|
+
当前仓库的技能位于 `.agents/skills`,可以同步到常用技能目录:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm run skills:sync
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
同步目标:
|
|
81
|
+
|
|
82
|
+
- `~/pp-note/.agents/skills`
|
|
83
|
+
- `~/pp-note/.claude/skills`
|
|
84
|
+
- `~/.hermes/skills`
|
|
85
|
+
|
|
86
|
+
如果希望技能文件修改后自动同步,启动 watcher:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm run skills:watch
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Watcher 会先同步一次,然后持续监听 `.agents/skills` 文件变化;同名技能会覆盖,目标目录里的其他技能不会被删除。
|
|
93
|
+
|
|
94
|
+
如果希望后台常驻自动同步:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npm run skills:watch:start
|
|
98
|
+
npm run skills:watch:status
|
|
99
|
+
npm run skills:watch:stop
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
后台 watcher 的 PID 和日志保存在 `.git/skill-sync-watch.*`,不会提交到仓库。
|
|
103
|
+
|
|
72
104
|
## 配置
|
|
73
105
|
|
|
74
106
|
不要把个人访问令牌写入代码或提交到仓库。建议通过环境变量提供:
|
|
@@ -78,6 +110,8 @@ export YUNXIAO_TOKEN="pt-..."
|
|
|
78
110
|
export YUNXIAO_DOMAIN="openapi-rdc.aliyuncs.com"
|
|
79
111
|
export YUNXIAO_ORGANIZATION_ID="your-organization-id"
|
|
80
112
|
export YUNXIAO_EDITION="center"
|
|
113
|
+
export YUNXIAO_PROJECT_IDS="project-id-1,project-id-2"
|
|
114
|
+
export YUNXIAO_WORKITEM_CATEGORIES="Req,Task,Bug"
|
|
81
115
|
```
|
|
82
116
|
|
|
83
117
|
说明:
|
|
@@ -85,8 +119,10 @@ export YUNXIAO_EDITION="center"
|
|
|
85
119
|
- 中心版默认使用 `openapi-rdc.aliyuncs.com`,并需要 `YUNXIAO_ORGANIZATION_ID`。
|
|
86
120
|
- Region 版设置 `YUNXIAO_EDITION=region`,通常不需要组织 ID。
|
|
87
121
|
- 也可以用命令参数覆盖配置:`--token`、`--domain`、`--organization-id`、`--edition`。
|
|
122
|
+
- 工作项查询不会默认扫描所有项目,需要通过 `--project-id`、`--project-ids` 或 `YUNXIAO_PROJECT_IDS` 指定项目范围。
|
|
123
|
+
- 工作项类型默认查询 `Req,Task,Bug`,可以通过 `--category` 或 `YUNXIAO_WORKITEM_CATEGORIES` 覆盖。
|
|
88
124
|
|
|
89
|
-
##
|
|
125
|
+
## 合并请求命令
|
|
90
126
|
|
|
91
127
|
查询合并请求列表:
|
|
92
128
|
|
|
@@ -124,10 +160,40 @@ node dist/src/index.js mr approve-and-merge 2813489 12 --yes --merge-type squash
|
|
|
124
160
|
node dist/src/index.js mr release yunxiao-cli release/1.2.3 master --yes
|
|
125
161
|
```
|
|
126
162
|
|
|
163
|
+
参数顺序是:
|
|
164
|
+
|
|
165
|
+
```text
|
|
166
|
+
mr release <repositoryName> <sourceBranch> <targetBranch>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
例如,把 `release` 合并到 `master`:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
node dist/src/index.js mr release syjc-web release master --yes
|
|
173
|
+
```
|
|
174
|
+
|
|
127
175
|
这个命令会先按仓库名称查询代码库 ID,再用当前 token 对应的用户作为评审人创建合并请求,随后评审通过并合并。合并时固定保留源分支,不会删除源分支。
|
|
128
176
|
|
|
177
|
+
如果只想创建合并请求,不自动评审和合并,使用 `--create-only`:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
node dist/src/index.js mr release syjc-web release master --yes --create-only
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
`--create-only` 仍会在云效创建合并请求,所以仍然需要 `--yes`。
|
|
184
|
+
|
|
129
185
|
创建合并请求时会使用云效 `createFrom=WEB`,以保证云效能正确解析源分支提交。
|
|
130
186
|
|
|
187
|
+
发布版本时,如果云效返回“源分支相对目标分支没有改动,不能新建代码评审”,可视为该仓库无改动并跳过。
|
|
188
|
+
|
|
189
|
+
发布所有版本时,推荐顺序为:
|
|
190
|
+
|
|
191
|
+
1. 商混版:`master` -> `gx-concrete/dev`
|
|
192
|
+
2. 蜀道版:`master` -> `sdjt/dev`
|
|
193
|
+
3. 标准版:`master` -> `release`
|
|
194
|
+
|
|
195
|
+
标准版应最后发布。
|
|
196
|
+
|
|
131
197
|
查询变更文件树:
|
|
132
198
|
|
|
133
199
|
```bash
|
|
@@ -150,8 +216,11 @@ node dist/src/index.js mr patches 2813489 12
|
|
|
150
216
|
node dist/src/index.js mr list --output table
|
|
151
217
|
node dist/src/index.js mr list --output json
|
|
152
218
|
node dist/src/index.js mr review 2813489 12 --output table
|
|
153
|
-
node dist/src/index.js mr release yunxiao-cli release/1.2.3 master --yes --output json
|
|
219
|
+
node dist/src/index.js mr release yunxiao-cli release/1.2.3 master --yes --create-only --output json
|
|
154
220
|
node dist/src/index.js mr patches 2813489 12 --output json
|
|
221
|
+
node dist/src/index.js pipeline failed-runs --hours 24 --output json
|
|
222
|
+
node dist/src/index.js pipeline runs 123 --status FAIL --output json
|
|
223
|
+
node dist/src/index.js pipeline retry-job 123 456 789 --yes --output table
|
|
155
224
|
```
|
|
156
225
|
|
|
157
226
|
支持的格式:
|
|
@@ -174,3 +243,189 @@ node dist/src/index.js mr patches 2813489 12 --output json
|
|
|
174
243
|
这是为了避免误合并。
|
|
175
244
|
|
|
176
245
|
未指定 `--merge-type` 时,默认使用 `no-fast-forward`。
|
|
246
|
+
|
|
247
|
+
## 项目与成员命令
|
|
248
|
+
|
|
249
|
+
查询项目列表:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
node dist/src/index.js project list --name 研发 --output table
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
获取项目信息:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
node dist/src/index.js project get <projectId> --output json
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
获取项目成员:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
node dist/src/index.js project members <projectId> --role-id project.admin
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
添加项目成员:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
node dist/src/index.js project member-add <projectId> \
|
|
271
|
+
--user-ids user-id-1,user-id-2 \
|
|
272
|
+
--role-id project.participant \
|
|
273
|
+
--yes
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
移除项目成员:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
node dist/src/index.js project member-remove <projectId> \
|
|
280
|
+
--user-ids user-id-1 \
|
|
281
|
+
--role-id project.participant \
|
|
282
|
+
--yes
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
查询组织成员:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
node dist/src/index.js member list --per-page 100
|
|
289
|
+
node dist/src/index.js member get <memberId> --output json
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## 流水线命令
|
|
293
|
+
|
|
294
|
+
查询最近失败流水线运行实例,并且同一个流水线只保留最新一次失败运行:
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
node dist/src/index.js pipeline failed-runs --hours 24 --output table
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
默认查询最近 24 小时,等价于:
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
node dist/src/index.js pipeline failed-runs --hours 24
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
也可以用毫秒时间戳指定范围:
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
node dist/src/index.js pipeline failed-runs \
|
|
310
|
+
--start-time 1777358348118 \
|
|
311
|
+
--end-time 1777444748118 \
|
|
312
|
+
--output json
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
查询流水线运行实例列表:
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
node dist/src/index.js pipeline runs <pipelineId> --status FAIL --per-page 30
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
可用过滤参数:
|
|
322
|
+
|
|
323
|
+
- `--page`、`--per-page`
|
|
324
|
+
- `--start-time`、`--end-time`:毫秒时间戳,例如 `1729178040000`
|
|
325
|
+
- `--status`:`FAIL`、`SUCCESS`、`RUNNING`
|
|
326
|
+
- `--trigger-mode`:触发方式,常见值为 `1` 人工触发、`2` 定时触发、`3` 代码提交触发、`5` 流水线触发、`6` Webhook 触发
|
|
327
|
+
|
|
328
|
+
获取单次流水线运行详情:
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
node dist/src/index.js pipeline run <pipelineId> <pipelineRunId> --output json
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
运行详情里包含阶段和任务信息,重试任务时需要从返回结果里的 `stages[].stageInfo.jobs[].id` 获取 `jobId`。
|
|
335
|
+
|
|
336
|
+
重试指定流水线任务:
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
node dist/src/index.js pipeline retry-job <pipelineId> <pipelineRunId> <jobId> --yes
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
`pipeline` 也可以简写为 `pl`,`retry-job` 也可以简写为 `retry`:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
node dist/src/index.js pl retry <pipelineId> <pipelineRunId> <jobId> --yes
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
## 工作项命令
|
|
349
|
+
|
|
350
|
+
查询当前用户待办工作项:
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
node dist/src/index.js workitem mine --project-ids project-id-1,project-id-2 --state todo
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
查询指定成员待办、进行中或已完成工作项:
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
node dist/src/index.js workitem list --project-ids project-id-1,project-id-2 --assigned-to user-id --state todo
|
|
360
|
+
node dist/src/index.js workitem list --project-ids project-id-1,project-id-2 --assigned-to user-id --state doing
|
|
361
|
+
node dist/src/index.js workitem list --project-ids project-id-1,project-id-2 --assigned-to user-id --state done
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
按时间范围查询工作项:
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
node dist/src/index.js workitem list \
|
|
368
|
+
--project-ids project-id-1,project-id-2 \
|
|
369
|
+
--from "2026-04-01 00:00:00" \
|
|
370
|
+
--to "2026-04-30 23:59:59"
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
默认时间字段为 `gmtCreate`。如需按更新时间等字段过滤,可加 `--date-field gmtModified` 或其他云效支持的字段标识。
|
|
374
|
+
|
|
375
|
+
如果已知云效状态 ID,可使用服务端状态过滤:
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
node dist/src/index.js workitem list --project-ids project-id-1 --status-ids 100005,100010
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
`--state todo|doing|done` 是便捷过滤,会根据返回结果中的状态英文名或中文名做本地过滤;不同项目模板状态差异较大时,优先使用 `--status-ids`。
|
|
382
|
+
|
|
383
|
+
默认只查询每个项目的一页结果。需要拉取所有分页时可以加 `--all-pages`:
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
node dist/src/index.js workitem list --project-ids project-id-1,project-id-2 --all-pages
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
获取工作项详情、动态、评论:
|
|
390
|
+
|
|
391
|
+
```bash
|
|
392
|
+
node dist/src/index.js workitem get <workitemId> --output json
|
|
393
|
+
node dist/src/index.js workitem activities <workitemId>
|
|
394
|
+
node dist/src/index.js workitem comments <workitemId>
|
|
395
|
+
node dist/src/index.js workitem timeline <workitemId> --output json
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
修改工作项负责人、参与人和计划完成时间:
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
node dist/src/index.js workitem update <workitemId> \
|
|
402
|
+
--assigned-to user-id \
|
|
403
|
+
--participants user-id-1,user-id-2 \
|
|
404
|
+
--due-date "2026-05-01 18:00:00" \
|
|
405
|
+
--yes
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
计划完成时间默认写入字段 `dueDate`。如果项目模板使用的是自定义字段,可以用 `--due-field <fieldId>` 覆盖:
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
node dist/src/index.js workitem update <workitemId> \
|
|
412
|
+
--due-field custom-plan-finish-field-id \
|
|
413
|
+
--due-date "2026-05-01 18:00:00" \
|
|
414
|
+
--yes
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
也可以用 `--field key=value` 或 `--fields '{"fieldId":"value"}'` 更新云效支持的其他字段。
|
|
418
|
+
|
|
419
|
+
创建工作项评论:
|
|
420
|
+
|
|
421
|
+
```bash
|
|
422
|
+
node dist/src/index.js workitem comment <workitemId> --content "处理完成,请确认。" --yes
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
会改变云效数据的命令需要 `--yes`:
|
|
426
|
+
|
|
427
|
+
- `project member-add`
|
|
428
|
+
- `project member-remove`
|
|
429
|
+
- `pipeline retry-job`
|
|
430
|
+
- `workitem update`
|
|
431
|
+
- `workitem comment`
|