@cnbcool/cnb-api-generate 2.21.0 → 2.21.1

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
- prNumber: process.env.CNB_PULL_REQUEST_IID || undefined,
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
- prNumber: process.env.CNB_PULL_REQUEST_IID || undefined,
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 一律注册,但只有 issue 评论上传会消费:
206
+ // --number 一律注册以统一 Issue / PR 两侧参数形态,但只有 issue 评论上传会消费:
207
207
  // - post-issue-comment-*-asset-upload-url(issue 评论上传):path 为 repo + number
208
- // - post-asset-group(创建 issue 时上传):path 只有 repo,number 传了也会被忽略
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 维度查询,同样注册 --number 保持两侧参数形态一致
215
+ // CI 命令按 PR 维度查询,--number 会作为 prNumber 参与查询(见 execute-action)
217
216
  registerAutoInjectedPathOptions(shortcutCmd);
218
217
  } else {
219
218
  registerToolOptions(shortcutCmd, moduleName, shortcut.realTool, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnbcool/cnb-api-generate",
3
- "version": "2.21.0",
3
+ "version": "2.21.1",
4
4
  "main": "./built/index.js",
5
5
  "module": "./src/index.ts",
6
6
  "types": "./src/index.ts",