@cnbcool/cnb-api-generate 2.21.0 → 2.21.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.
|
@@ -114,7 +114,8 @@ export async function executeAction(
|
|
|
114
114
|
const result = await diagnoseBuild({
|
|
115
115
|
repo: (params.repo as string) || '',
|
|
116
116
|
sn: (opts.sn as string) || undefined,
|
|
117
|
-
|
|
117
|
+
// --number 显式传入时优先,未传时由 autoPath 用 CNB_PULL_REQUEST_IID 兜底
|
|
118
|
+
prNumber: (params.number as string) || undefined,
|
|
118
119
|
});
|
|
119
120
|
console.log(result);
|
|
120
121
|
return;
|
|
@@ -124,7 +125,8 @@ export async function executeAction(
|
|
|
124
125
|
const result = await analyzeBuildTiming({
|
|
125
126
|
repo: (params.repo as string) || '',
|
|
126
127
|
sn: (opts.sn as string) || undefined,
|
|
127
|
-
|
|
128
|
+
// --number 显式传入时优先,未传时由 autoPath 用 CNB_PULL_REQUEST_IID 兜底
|
|
129
|
+
prNumber: (params.number as string) || undefined,
|
|
128
130
|
});
|
|
129
131
|
console.log(result);
|
|
130
132
|
return;
|
|
@@ -203,17 +203,16 @@ export function registerModuleCommands(program: Command): void {
|
|
|
203
203
|
// 按命令类别注册选项:upload / ci 自定义 / 普通 swagger 命令
|
|
204
204
|
if (shortcut.upload) {
|
|
205
205
|
shortcutCmd.requiredOption('--file <string>', '本地文件路径。必填。');
|
|
206
|
-
// --number
|
|
206
|
+
// --number 一律注册以统一 Issue / PR 两侧参数形态,但只有 issue 评论上传会消费:
|
|
207
207
|
// - post-issue-comment-*-asset-upload-url(issue 评论上传):path 为 repo + number
|
|
208
|
-
// - post-asset-group
|
|
209
|
-
// - pull 侧 upload-files / upload-imgs:按仓库维度上传,同样不需要 number
|
|
208
|
+
// - post-asset-group / pull 侧 upload-*:path 只有 repo,number 传了也被忽略
|
|
210
209
|
registerAutoInjectedPathOptions(shortcutCmd);
|
|
211
210
|
} else if (
|
|
212
211
|
shortcut.realTool === '__get-ci-logs__' ||
|
|
213
212
|
shortcut.realTool === '__get-ci-timing__'
|
|
214
213
|
) {
|
|
215
214
|
shortcutCmd.option('--sn <string>', '构建号(可选,默认自动从环境变量或 PR 状态获取)');
|
|
216
|
-
// CI 命令按 PR
|
|
215
|
+
// CI 命令按 PR 维度查询,--number 会作为 prNumber 参与查询(见 execute-action)
|
|
217
216
|
registerAutoInjectedPathOptions(shortcutCmd);
|
|
218
217
|
} else {
|
|
219
218
|
registerToolOptions(shortcutCmd, moduleName, shortcut.realTool, true);
|
package/client/shortcuts.ts
CHANGED
|
@@ -16,7 +16,11 @@ export interface ShortcutDefinition {
|
|
|
16
16
|
shortName: string;
|
|
17
17
|
/** 实际对应的 tool 文件名 */
|
|
18
18
|
realTool: string;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* 为 true 时只注入 repo,不注入 number。
|
|
21
|
+
* CI 查询类命令(get-ci-logs / get-ci-timing)不得标记:其 number 会作为
|
|
22
|
+
* prNumber 参与查询,标记后会静默丢失 --number 的覆盖能力。
|
|
23
|
+
*/
|
|
20
24
|
repoOnly?: boolean;
|
|
21
25
|
/** 为 true 时表示是上传命令,走完整上传流程 */
|
|
22
26
|
upload?: boolean;
|
package/package.json
CHANGED
package/quick-commands.json
CHANGED
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
{ "shortName": "list-assignees", "realTool": "list-pull-assignees", "description": "查看处理人" },
|
|
32
32
|
{ "shortName": "upload-file", "realTool": "upload-files", "description": "上传文件", "repoOnly": true, "upload": true, "kind": "file", "hideInSkill": true, "dataTip": "--file 文件路径" },
|
|
33
33
|
{ "shortName": "upload-image", "realTool": "upload-imgs", "description": "上传图片", "repoOnly": true, "upload": true, "kind": "image", "hideInSkill": true, "dataTip": "--file 图片路径" },
|
|
34
|
-
{ "shortName": "get-ci-logs", "realTool": "__get-ci-logs__", "description": "获取 CI 失败日志", "
|
|
35
|
-
{ "shortName": "get-ci-timing", "realTool": "__get-ci-timing__", "description": "分析 CI 耗时瓶颈", "
|
|
34
|
+
{ "shortName": "get-ci-logs", "realTool": "__get-ci-logs__", "description": "获取 CI 失败日志", "custom": true, "dataTip": "--sn 构建号(可选)" },
|
|
35
|
+
{ "shortName": "get-ci-timing", "realTool": "__get-ci-timing__", "description": "分析 CI 耗时瓶颈", "custom": true, "dataTip": "--sn 构建号(可选)" },
|
|
36
36
|
{ "shortName": "get-imgs", "realTool": "get-pr-imgs", "description": "获取 PR 图片", "repoOnly": true, "dataTip": "--img-path 图片路径" },
|
|
37
37
|
{ "shortName": "get-files", "realTool": "get-pr-files", "description": "获取 PR 附件", "repoOnly": true, "dataTip": "--file-path 附件路径" }
|
|
38
38
|
],
|