@cnbcool/cnb-api-generate 2.18.16 → 2.18.17
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.
- package/client/shortcuts.ts +11 -1
- package/package.json +1 -1
package/client/shortcuts.ts
CHANGED
|
@@ -262,6 +262,16 @@ export function resolveShortcut(
|
|
|
262
262
|
|
|
263
263
|
// Hack: 当调用 `pulls comment` 且环境变量中存在 CNB_REVIEW_ID 时,
|
|
264
264
|
// 自动改写为"回复一个 review 评审"接口,使 AI 无需改变调用方式。
|
|
265
|
+
//
|
|
266
|
+
// 两类 ID 语义不同,不能混用:
|
|
267
|
+
// - path 的 review_id:被回复评论所属的评审 ID,取 CNB_REVIEW_ID;
|
|
268
|
+
// - body 的 reply_to_comment_id:被回复的「父评论」ID,取 CNB_COMMENT_ID。
|
|
269
|
+
// 早前把两者都写成 CNB_REVIEW_ID,导致回复挂到了该 review 的根评论上(错位)。
|
|
270
|
+
//
|
|
271
|
+
// reply_to_comment_id 只能取 CNB_COMMENT_ID,不做任何兜底:
|
|
272
|
+
// CNB_REVIEW_ID 是评审 ID 而非评论 ID,拿它兜底等于把错位静默重演一遍
|
|
273
|
+
// (即使两者数值偶尔相同,语义上仍是错的),因此 CNB_COMMENT_ID 缺失时
|
|
274
|
+
// 宁可让请求显式失败,也不能挂到错误的父评论下。
|
|
265
275
|
if (
|
|
266
276
|
moduleName === 'pulls'
|
|
267
277
|
&& matched.realTool === 'post-pull-comment'
|
|
@@ -271,7 +281,7 @@ export function resolveShortcut(
|
|
|
271
281
|
autoPath.review_id = process.env.CNB_REVIEW_ID;
|
|
272
282
|
autoData = {
|
|
273
283
|
...(autoData || {}),
|
|
274
|
-
reply_to_comment_id: process.env.
|
|
284
|
+
reply_to_comment_id: process.env.CNB_COMMENT_ID,
|
|
275
285
|
};
|
|
276
286
|
}
|
|
277
287
|
|