job51-gitlab-cr-node-jt-1 2.6.3 → 2.6.5

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.
@@ -71,17 +71,28 @@ description: 代码审查技能,审查变更代码并输出 REPORT 和 LINE_IN
71
71
 
72
72
  ## 输出模板
73
73
 
74
- **⚠️ 强制格式要求**:
74
+ **⚠️ 强制格式要求(违反会导致解析失败)**:
75
75
 
76
- 1. **问题格式**:每个问题必须以 `**问题 N**:` 开头(N 为阿拉伯数字 1,2,3...)
76
+ 1. **报告开头必须包含 `## 🤖 AI 代码审查结果`**:
77
+ - **正确**:`<REPORT>\n## 🤖 AI 代码审查结果\n\n### 🔴 严重问题`
78
+ - **错误**:`<REPORT>\n### 🔴 严重问题`(缺少主标题)
79
+ - **错误**:`<REPORT>\n## 代码审查结果`(缺少 emoji)
80
+
81
+ 2. **问题格式**:每个问题必须以 `**问题 N**:` 开头(N 为阿拉伯数字 1,2,3...)
77
82
  - **正确**:`**问题 1**:`、`**问题 2**:`
78
83
  - **错误**:`1. **xxx**`、`### 问题 1`、`**问题一**:`、`**问题 1**: xxx(行 43)`
79
84
 
80
- 2. **行号标注**:**禁止**在问题描述中写"(行 X)",行号只能通过 `<LINE_INFO>` 标签提供
85
+ 3. **每个问题块只能有一个 `**文件及行号**:` 行**:
86
+ - **正确**:每个问题块中 `**文件及行号**:` 只出现一次
87
+ - **错误**:同一个问题块中出现两次 `**文件及行号**:` 行
88
+
89
+ 4. **行号标注**:**禁止**在问题描述中写"(行 X)",行号只能通过 `<LINE_INFO>` 标签提供
90
+
91
+ 5. **LINE_INFO**:必须与问题一一对应,第 N 个元素对应问题 N 的行号
81
92
 
82
- 3. **LINE_INFO**:必须与问题一一对应,第 N 个元素对应问题 N 的行号
93
+ 6. **禁止输出错误代码示例**:已经有行号定位了,不需要重复输出错误代码
83
94
 
84
- 4. **禁止输出错误代码示例**:已经有行号定位了,不需要重复输出错误代码
95
+ 7. **必须输出 `<LINE_INFO>` 标签**:即使无问题也要输出空数组 `<LINE_INFO>[]</LINE_INFO>`
85
96
 
86
97
  <REPORT>
87
98
  ## 🤖 AI 代码审查结果
@@ -1,7 +1,7 @@
1
1
  # GitLab Code Review AI Tool 技术文档
2
2
 
3
3
  **项目名称**: job51-gitlab-cr-node
4
- **当前版本**: 2.5.8
4
+ **当前版本**: 2.6.5
5
5
  **作者**: tao.jing
6
6
  **最后更新**: 2026-04-16
7
7
  **项目地址**: https://gitdev.51job.com/51jobweb/ai-agent
@@ -25,6 +25,52 @@
25
25
 
26
26
  ---
27
27
 
28
+ ## 版本历史
29
+
30
+ ### v2.6.5 (2026-04-16)
31
+
32
+ **Bug 修复**:
33
+ - **移除无效的 position_type 字段**:GitLab API 不接受 `position_type: 'new'` 或 `position_type: 'old'` 参数
34
+ - 问题现象:`400 Bad request - {"error":"position[position_type] does not have a valid value"}`,所有评论降级为一般讨论
35
+ - 修复方案:移除 `targetLine` 对象中的 `position_type` 字段,GitLab API 自动根据 `new_path/new_line` 或 `old_path/old_line` 判断评论类型
36
+ - 修复文件:`index.js:601-631`
37
+
38
+ ### v2.6.4 (2026-04-16)
39
+
40
+ **Bug 修复**:
41
+ - **修复 GitLab API line_code 错误**:在构建 diff 评论 payload 时,添加 `position_type` 字段(`new` 或 `old`),确保 GitLab API 能够正确识别行号类型
42
+ - 问题现象:`400 Bad request - Note {:line_code=>["不能为空字符", "must be a valid line code"]}`
43
+ - 修复方案:`targetLine` 对象中显式指定 `position_type: 'new'`(新增行)或 `position_type: 'old'`(删除行)
44
+ - 修复文件:`index.js:590-629`
45
+
46
+ ### v2.6.3 (2026-04-16)
47
+
48
+ **输出格式修复**:
49
+ - **修复 AI 输出格式不标准问题**:在 SKILL.md 中增加强制格式要求,确保 AI 输出符合解析期望
50
+ - 增加 `## 🤖 AI 代码审查结果` 主标题的强制要求
51
+ - 禁止同一个问题块中出现多次 `**文件及行号**:` 行
52
+ - 修复文件:`.claude/skills/simple-code-review/SKILL.md`
53
+
54
+ ### v2.6.2 (2026-04-16)
55
+
56
+ **行号计算修复**:
57
+ - **修复临时文件元数据行计数问题**:明确临时文件中 7 行元数据 + 1 行 `@@` 头都必须忽略,从 `@@` 之后的第一行才开始编号
58
+ - 修复文件:`.claude/skills/simple-code-review/SKILL.md`、`.claude/rules/code-review-rules.md`
59
+
60
+ ### v2.6.1 (2026-04-16)
61
+
62
+ **行号验证增强**:
63
+ - **增加行号范围验证**:在 AI 输出前强制验证行号是否在 `[new_start, new_start + new_count - 1]` 范围内
64
+ - 修复文件:`.claude/skills/simple-code-review/SKILL.md`、`.claude/rules/code-review-rules.md`
65
+
66
+ ### v2.6.0 (2026-04-16)
67
+
68
+ **初始版本**:
69
+ - 新增行号计算规范,要求基于 diff 块内容逐行计数计算绝对行号
70
+ - 新增跨 diff 块上下文分析,避免误报已删除代码的问题
71
+
72
+ ---
73
+
28
74
  ## 1. 项目概述
29
75
 
30
76
  ### 1.1 项目定位
package/index.js CHANGED
@@ -621,6 +621,7 @@ ${diffObject.diff}`;
621
621
  } else if (problemInfo.new_line < newStart || problemInfo.new_line > newEnd) {
622
622
  skipReason = `new_line=${problemInfo.new_line} 超出 diff 块范围 [${newStart}, ${newEnd}]`;
623
623
  } else {
624
+ // 新增文件/新增行:使用 new_path + new_line
624
625
  targetLine = {
625
626
  new_path: problemInfo.new_path || diff_info.new_path,
626
627
  new_line: problemInfo.new_line