@cnbcool/cnb-api-generate 2.4.6 → 2.4.7

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.
@@ -242,11 +242,30 @@ export function resolveShortcut(
242
242
  const matched = shortcuts.find((s) => s.shortName === toolName);
243
243
  if (!matched) return null;
244
244
 
245
+ let realTool = matched.realTool;
246
+ const autoPath = buildAutoPath(moduleName, !!matched.repoOnly);
247
+ let autoData = matched.autoData || null;
248
+
249
+ // Hack: 当调用 `pulls comment` 且环境变量中存在 CNB_REVIEW_ID 时,
250
+ // 自动改写为"回复一个 review 评审"接口,使 AI 无需改变调用方式。
251
+ if (
252
+ moduleName === 'pulls'
253
+ && matched.realTool === 'post-pull-comment'
254
+ && process.env.CNB_REVIEW_ID
255
+ ) {
256
+ realTool = 'post-pull-request-review-reply';
257
+ autoPath.review_id = process.env.CNB_REVIEW_ID;
258
+ autoData = {
259
+ ...(autoData || {}),
260
+ reply_to_comment_id: process.env.CNB_REVIEW_ID,
261
+ };
262
+ }
263
+
245
264
  return {
246
265
  module: moduleName,
247
- tool: matched.realTool,
248
- autoPath: buildAutoPath(moduleName, !!matched.repoOnly),
249
- autoData: matched.autoData || null,
266
+ tool: realTool,
267
+ autoPath,
268
+ autoData,
250
269
  upload: !!matched.upload,
251
270
  };
252
271
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnbcool/cnb-api-generate",
3
- "version": "2.4.6",
3
+ "version": "2.4.7",
4
4
  "main": "./built/index.js",
5
5
  "module": "./src/index.ts",
6
6
  "types": "./src/index.ts",