job51-gitlab-cr-node-skill-prompt-optimize 1.5.9 → 1.6.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.
- package/index.js +4 -1
- package/log +758 -812
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -462,11 +462,12 @@ ${diffObject.diff}`;
|
|
|
462
462
|
}
|
|
463
463
|
|
|
464
464
|
// 如果 lineInfo 里的 firstLineFirstChar 为 +,则 targetLine 为 new_path 的 new_start 行;为 -,则 targetLine 为 old_path 的 old_start 行
|
|
465
|
+
// GitLab API 要求:diff 评论只能传递 new_line 或 old_line 中的一个,不能同时传递
|
|
465
466
|
let targetLine = lineInfo.firstLineFirstChar === '+'
|
|
466
467
|
? { new_line: lineInfo.new_start, new_path: diff_info.new_path }
|
|
467
468
|
: lineInfo.firstLineFirstChar === '-'
|
|
468
469
|
? { old_line: lineInfo.old_start, old_path: diff_info.old_path }
|
|
469
|
-
: { new_line: lineInfo.new_start, new_path: diff_info.new_path
|
|
470
|
+
: { new_line: lineInfo.new_start, new_path: diff_info.new_path };
|
|
470
471
|
|
|
471
472
|
// 尝试从审查结果中解析更精确的行号信息(从 LINE_INFO 标签)
|
|
472
473
|
const parsedLineInfo = lineInfoTag ? this.parseLineInfoFromReviewResult(lineInfoTag) : null;
|
|
@@ -505,6 +506,8 @@ ${diffObject.diff}`;
|
|
|
505
506
|
await this.createDiffDiscussion(projectId, mergeRequestIid, payload);
|
|
506
507
|
debugLog(`评论已发布到文件 ${file_path_with_line} 的相关变更区域`);
|
|
507
508
|
} catch (error) {
|
|
509
|
+
// 打印详细的错误响应信息
|
|
510
|
+
debugLog(`GitLab API 错误详情:${JSON.stringify(error.response?.data || error.message)}`);
|
|
508
511
|
console.error(`发布评论到文件 ${file_path_with_line} 的变更区域失败,改用一般讨论:`, error.message);
|
|
509
512
|
await this.createGeneralDiscussion(projectId, mergeRequestIid, file_path_with_line, reviewContent);
|
|
510
513
|
debugLog(`评论已发布到文件 ${file_path_with_line} (作为一般讨论)`);
|