@cnbcool/cnb-api-generate 2.18.0 → 2.18.2
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/client/lib/exit-code.ts +7 -2
- package/package.json +1 -1
- package/skills-template/SKILL.md +8 -17
package/client/lib/exit-code.ts
CHANGED
|
@@ -12,8 +12,13 @@
|
|
|
12
12
|
* 输出内容不被截断,进程在事件循环结束后以非零码退出。
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* 退出码:HTTP 非 2xx。
|
|
17
|
+
*
|
|
18
|
+
* 不复用 1(命令拼错 / 未登录 / 工具函数不存在)与 2(git-credential),
|
|
19
|
+
* 免得脚本只凭退出码区分不出「调用成功但接口报错」和其它失败;3 当前空闲。
|
|
20
|
+
*/
|
|
21
|
+
export const EXIT_CODE_HTTP_ERROR = 3;
|
|
17
22
|
|
|
18
23
|
/**
|
|
19
24
|
* 从响应对象中解析 HTTP 状态码。
|
package/package.json
CHANGED
package/skills-template/SKILL.md
CHANGED
|
@@ -19,29 +19,20 @@ description: CNB 平台交互命令,支持代码仓库、Issue、PR、CI、制
|
|
|
19
19
|
编号同 `--repo` 一样默认从环境变量识别,无需传递;用 `--repo <组织/仓库>`、`--number <编号>`
|
|
20
20
|
可覆盖,例:`cnb issues get --number 68`。
|
|
21
21
|
|
|
22
|
-
- `cnb issues get-imgs --img-path 图片路径` — 取正文里的图片
|
|
23
|
-
- `cnb issues get-files --file-path 附件路径` — 取正文里的附件
|
|
24
|
-
|
|
25
|
-
`--img-path` / `--file-path` 取 URL 的**完整尾段**,首位数字 ID 段不能省,漏掉返回 `404`:
|
|
26
|
-
|
|
27
|
-
- 原文 `.../-/imgs/issues/2101868753481326592/Lma2nfHjnchalMtHZcq4OA/6d7ab033-xxxx.png`
|
|
28
|
-
- 正确 `2101868753481326592/Lma2nfHjnchalMtHZcq4OA/6d7ab033-xxxx.png` ✅
|
|
29
|
-
- 漏 ID `Lma2nfHjnchalMtHZcq4OA/6d7ab033-xxxx.png` ❌ `404`
|
|
30
|
-
|
|
31
|
-
鉴权由 `@cnbcool/cnb-cli`(命令 `cnb`)内置,执行命令即带登录态,
|
|
32
|
-
`get-imgs` / `get-files` 无需自己传鉴权头。
|
|
33
|
-
|
|
34
22
|
## pull 访问
|
|
35
23
|
|
|
36
24
|
编号同 `--repo` 一样默认从环境变量识别,无需传递;用 `--repo <组织/仓库>`、`--number <编号>`
|
|
37
25
|
可覆盖,例:`cnb pulls get --repo x/y --number 97`。
|
|
38
26
|
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
## 图片与附件解析
|
|
28
|
+
|
|
29
|
+
正文里图片、附件的下载地址形如:
|
|
30
|
+
|
|
31
|
+
- 图片 `.../-/imgs/<issues|pulls>/<数字 ID>/<key>/<文件名>`
|
|
32
|
+
- 附件 `.../-/files/<issues|pulls>/<数字 ID>/<key>/<文件名>`
|
|
41
33
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
鉴权同样由 `cnb` 命令内置的登录态提供,无需自己传鉴权头。
|
|
34
|
+
参数取 `/imgs/<issues|pulls>/`、`/files/<issues|pulls>/` 之后的**完整尾段**,
|
|
35
|
+
首位的数字 ID 段不能省,漏掉返回 `404`。
|
|
45
36
|
|
|
46
37
|
## 常用链接
|
|
47
38
|
|