@cnbcool/cnb-api-generate 2.4.5 → 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.
|
@@ -41,6 +41,10 @@ function registerToolOptions(toolCmd: Command, moduleName: string, toolName: str
|
|
|
41
41
|
option.makeOptionMandatory();
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
if (opt.required && opt.source === 'query') {
|
|
45
|
+
option.makeOptionMandatory();
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
if (opt.choices) {
|
|
45
49
|
option.choices(opt.choices);
|
|
46
50
|
}
|
package/client/shortcuts.ts
CHANGED
|
@@ -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:
|
|
248
|
-
autoPath
|
|
249
|
-
autoData
|
|
266
|
+
tool: realTool,
|
|
267
|
+
autoPath,
|
|
268
|
+
autoData,
|
|
250
269
|
upload: !!matched.upload,
|
|
251
270
|
};
|
|
252
271
|
}
|