job51-gitlab-cr-node-jt-1 2.6.3 → 2.6.4
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/.claude/skills/simple-code-review/SKILL.md +16 -5
- package/docs/GITLAB_CR_NODE_TECHNICAL_DOCS.md +39 -1
- package/index.js +7 -3
- package/log.txt +1797 -1697
- package/package.json +1 -1
|
@@ -71,17 +71,28 @@ description: 代码审查技能,审查变更代码并输出 REPORT 和 LINE_IN
|
|
|
71
71
|
|
|
72
72
|
## 输出模板
|
|
73
73
|
|
|
74
|
-
**⚠️
|
|
74
|
+
**⚠️ 强制格式要求(违反会导致解析失败)**:
|
|
75
75
|
|
|
76
|
-
1.
|
|
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
|
-
|
|
85
|
+
3. **每个问题块只能有一个 `**文件及行号**:` 行**:
|
|
86
|
+
- **正确**:每个问题块中 `**文件及行号**:` 只出现一次
|
|
87
|
+
- **错误**:同一个问题块中出现两次 `**文件及行号**:` 行
|
|
88
|
+
|
|
89
|
+
4. **行号标注**:**禁止**在问题描述中写"(行 X)",行号只能通过 `<LINE_INFO>` 标签提供
|
|
90
|
+
|
|
91
|
+
5. **LINE_INFO**:必须与问题一一对应,第 N 个元素对应问题 N 的行号
|
|
81
92
|
|
|
82
|
-
|
|
93
|
+
6. **禁止输出错误代码示例**:已经有行号定位了,不需要重复输出错误代码
|
|
83
94
|
|
|
84
|
-
|
|
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.
|
|
4
|
+
**当前版本**: 2.6.4
|
|
5
5
|
**作者**: tao.jing
|
|
6
6
|
**最后更新**: 2026-04-16
|
|
7
7
|
**项目地址**: https://gitdev.51job.com/51jobweb/ai-agent
|
|
@@ -25,6 +25,44 @@
|
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
28
|
+
## 版本历史
|
|
29
|
+
|
|
30
|
+
### v2.6.4 (2026-04-16)
|
|
31
|
+
|
|
32
|
+
**Bug 修复**:
|
|
33
|
+
- **修复 GitLab API line_code 错误**:在构建 diff 评论 payload 时,添加 `position_type` 字段(`new` 或 `old`),确保 GitLab API 能够正确识别行号类型
|
|
34
|
+
- 问题现象:`400 Bad request - Note {:line_code=>["不能为空字符", "must be a valid line code"]}`
|
|
35
|
+
- 修复方案:`targetLine` 对象中显式指定 `position_type: 'new'`(新增行)或 `position_type: 'old'`(删除行)
|
|
36
|
+
- 修复文件:`index.js:590-629`
|
|
37
|
+
|
|
38
|
+
### v2.6.3 (2026-04-16)
|
|
39
|
+
|
|
40
|
+
**输出格式修复**:
|
|
41
|
+
- **修复 AI 输出格式不标准问题**:在 SKILL.md 中增加强制格式要求,确保 AI 输出符合解析期望
|
|
42
|
+
- 增加 `## 🤖 AI 代码审查结果` 主标题的强制要求
|
|
43
|
+
- 禁止同一个问题块中出现多次 `**文件及行号**:` 行
|
|
44
|
+
- 修复文件:`.claude/skills/simple-code-review/SKILL.md`
|
|
45
|
+
|
|
46
|
+
### v2.6.2 (2026-04-16)
|
|
47
|
+
|
|
48
|
+
**行号计算修复**:
|
|
49
|
+
- **修复临时文件元数据行计数问题**:明确临时文件中 7 行元数据 + 1 行 `@@` 头都必须忽略,从 `@@` 之后的第一行才开始编号
|
|
50
|
+
- 修复文件:`.claude/skills/simple-code-review/SKILL.md`、`.claude/rules/code-review-rules.md`
|
|
51
|
+
|
|
52
|
+
### v2.6.1 (2026-04-16)
|
|
53
|
+
|
|
54
|
+
**行号验证增强**:
|
|
55
|
+
- **增加行号范围验证**:在 AI 输出前强制验证行号是否在 `[new_start, new_start + new_count - 1]` 范围内
|
|
56
|
+
- 修复文件:`.claude/skills/simple-code-review/SKILL.md`、`.claude/rules/code-review-rules.md`
|
|
57
|
+
|
|
58
|
+
### v2.6.0 (2026-04-16)
|
|
59
|
+
|
|
60
|
+
**初始版本**:
|
|
61
|
+
- 新增行号计算规范,要求基于 diff 块内容逐行计数计算绝对行号
|
|
62
|
+
- 新增跨 diff 块上下文分析,避免误报已删除代码的问题
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
28
66
|
## 1. 项目概述
|
|
29
67
|
|
|
30
68
|
### 1.1 项目定位
|
package/index.js
CHANGED
|
@@ -600,7 +600,8 @@ ${diffObject.diff}`;
|
|
|
600
600
|
} else {
|
|
601
601
|
targetLine = {
|
|
602
602
|
old_path: problemInfo.old_path || diff_info.old_path,
|
|
603
|
-
old_line: problemInfo.old_line
|
|
603
|
+
old_line: problemInfo.old_line,
|
|
604
|
+
position_type: 'old'
|
|
604
605
|
};
|
|
605
606
|
}
|
|
606
607
|
} else if (problemInfo.new_line) {
|
|
@@ -613,7 +614,8 @@ ${diffObject.diff}`;
|
|
|
613
614
|
} else {
|
|
614
615
|
targetLine = {
|
|
615
616
|
old_path: problemInfo.new_path || diff_info.old_path,
|
|
616
|
-
old_line: problemInfo.new_line
|
|
617
|
+
old_line: problemInfo.new_line,
|
|
618
|
+
position_type: 'old'
|
|
617
619
|
};
|
|
618
620
|
}
|
|
619
621
|
} else if (newCount === 0) {
|
|
@@ -621,9 +623,11 @@ ${diffObject.diff}`;
|
|
|
621
623
|
} else if (problemInfo.new_line < newStart || problemInfo.new_line > newEnd) {
|
|
622
624
|
skipReason = `new_line=${problemInfo.new_line} 超出 diff 块范围 [${newStart}, ${newEnd}]`;
|
|
623
625
|
} else {
|
|
626
|
+
// 新增文件/新增行:使用 position_type: 'new',GitLab API 需要这个字段
|
|
624
627
|
targetLine = {
|
|
625
628
|
new_path: problemInfo.new_path || diff_info.new_path,
|
|
626
|
-
new_line: problemInfo.new_line
|
|
629
|
+
new_line: problemInfo.new_line,
|
|
630
|
+
position_type: 'new'
|
|
627
631
|
};
|
|
628
632
|
}
|
|
629
633
|
}
|