@cnbcool/cnb-api-generate 2.16.3 → 2.16.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.
|
@@ -27,7 +27,7 @@ _requestMap, quickCommandsByModule) {
|
|
|
27
27
|
const config = (0, get_config_1.getConfig)();
|
|
28
28
|
const cliCmd = config.skillsDev ? skills_1.CNB_CLI_DEV_CMD : skills_1.CNB_CLI_PROD_CMD;
|
|
29
29
|
// 仅替换两类占位符:
|
|
30
|
-
// - <$QUICK_COMMANDS
|
|
30
|
+
// - <$QUICK_COMMANDS$>:配置驱动的快捷命令清单(标题/使用约定写在模板里即可)
|
|
31
31
|
// - <$CNB_CLI_CMD$> :CLI 命令前缀
|
|
32
32
|
const quickCommandsMd = (0, render_quick_commands_md_1.renderQuickCommandsMarkdown)(quickCommandsByModule, cliCmd);
|
|
33
33
|
const total = Object.values(quickCommandsByModule).reduce((n, arr) => n + arr.length, 0);
|
|
@@ -4,7 +4,7 @@ exports.renderQuickCommandsMarkdown = renderQuickCommandsMarkdown;
|
|
|
4
4
|
/**
|
|
5
5
|
* 把解析后的快捷命令渲染为 markdown 文本,对应模板里的 <$QUICK_COMMANDS$> 占位符。
|
|
6
6
|
*
|
|
7
|
-
* 仅渲染命令列表本身——"## 快捷命令" 标题、"##
|
|
7
|
+
* 仅渲染命令列表本身——"## 快捷命令" 标题、"## 使用约定" 等静态文案直接
|
|
8
8
|
* 写在 skills-template/SKILL.md 模板里,没必要再加占位符。
|
|
9
9
|
*
|
|
10
10
|
* 渲染规则:
|
package/package.json
CHANGED
package/skills-template/SKILL.md
CHANGED
|
@@ -9,13 +9,25 @@ description: CNB 平台交互命令,支持代码仓库、Issue、PR、CI、制
|
|
|
9
9
|
|
|
10
10
|
<$QUICK_COMMANDS$>
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## 使用约定
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
14
|
+
- **编号自识别**:Issue/PR 编号自动从环境变量识别,无需额外传递。
|
|
15
|
+
- **默认摘要省流**:默认精简输出,加 `--verbose` 输出完整数据。
|
|
16
|
+
- **多行用单引号**:bash 参数为多行文本时用单引号,降低命令注入风险。
|
|
17
|
+
- **范围限本仓**:快捷命令仅限当前仓库的当前 Issue/PR,跨仓库或跨编号请参考「更多 API」。
|
|
18
|
+
- **提及不召唤**:评论中直接 @npc 会召唤 npc;仅提及不召唤时,用反引号包裹 `@npc`。
|
|
19
|
+
|
|
20
|
+
## 取正文里的图片与附件
|
|
21
|
+
|
|
22
|
+
评论正文里的图片、附件 URL,一律用 `get-imgs` / `get-files` 取回。
|
|
23
|
+
|
|
24
|
+
- **不要裸 `curl`**:CLI 内置鉴权;
|
|
25
|
+
手写 `Authorization: Bearer` 或 `token` 都不被识别,只会拿到 400。
|
|
26
|
+
- **参数取 URL 的尾段**:
|
|
27
|
+
- 图片取 `/imgs/<issues|pulls>/` 之后的部分
|
|
28
|
+
- 附件取 `/files/<issues|pulls>/` 之后的部分
|
|
29
|
+
- **URL 从 `list-comments` 原文取**:
|
|
30
|
+
不要去 `find` 本地文件,也不要猜域名。
|
|
19
31
|
|
|
20
32
|
## 常用链接
|
|
21
33
|
|