job51-gitlab-cr-node-jt-1 1.2.1 → 1.2.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 +1 -1
- package/index.js +7 -10
- package/log.txt +519 -507
- package/package.json +1 -1
- package/temp-diff-block-1772527822359-0.diff +10 -0
- package/temp-diff-block-1772527823803-2.diff +9 -0
- package/temp-diff-block-1772527949844-0.diff +10 -0
- package/temp-diff-block-1772527949860-2.diff +9 -0
- package/temp-diff-block-1772528045156-0.diff +10 -0
- package/temp-diff-block-1772528045169-1.diff +8 -0
- package/temp-diff-block-1772528045180-2.diff +9 -0
- package/temp-diff-block-1772528185915-0.diff +10 -0
- package/temp-diff-block-1772528185952-2.diff +9 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: simple-code-review
|
|
3
|
-
description: 你的角色是"资深软件开发工程师"
|
|
3
|
+
description: 你的角色是"资深软件开发工程师",你会接收到从执行giff命令得到的每一个变更内容代码块的文件,你要对文件中的代码变动内容进行代码评审,按照下文"检查项"标题后的几个方面(分析代码变更、执行深度代码审查、上下文影响分析)依次对本次代码变更的质量进行评估,按照下文中"报告模板"标题后的模版生成中文代码审查报告文本内容,等待结果生成好后,将文本内容直接返回,生成报告内容时注意文件问题位置建议四个部分的换行排版。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## 检查项
|
package/index.js
CHANGED
|
@@ -116,16 +116,16 @@ class GitLabCodeReviewer {
|
|
|
116
116
|
|
|
117
117
|
// 创建处理单个块的函数
|
|
118
118
|
const processBlock = async (diffObject, blockIndex) => {
|
|
119
|
-
// 创建临时文件存储diff
|
|
120
|
-
const
|
|
119
|
+
// 创建临时文件存储diff内容,文件地址选择当前文件夹下,避免权限问题
|
|
120
|
+
const fileName = `temp-diff-block-${Date.now()}-${blockIndex}.diff`;
|
|
121
|
+
const tmpFileName = path.join(__dirname, fileName);
|
|
121
122
|
|
|
122
123
|
try {
|
|
123
124
|
// 将diff内容写入临时文件
|
|
124
125
|
fs.writeFileSync(tmpFileName, diffObject.diff);
|
|
125
126
|
|
|
126
|
-
//
|
|
127
|
-
const review_result = await this.reviewDiffWithClaudeUsingFile(
|
|
128
|
-
|
|
127
|
+
// 审核当前块(传入临时的文件而不是直接的diff内容)
|
|
128
|
+
const review_result = await this.reviewDiffWithClaudeUsingFile(fileName);
|
|
129
129
|
const blockObj = { ...diffObject, review_result, temp_file_path: tmpFileName };
|
|
130
130
|
|
|
131
131
|
// 立即发布评论
|
|
@@ -197,11 +197,8 @@ class GitLabCodeReviewer {
|
|
|
197
197
|
debugLog(`开始审核文件: ${filePath}`);
|
|
198
198
|
|
|
199
199
|
const prompt = '/simple-code-review' + ' ' + filePath;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
//输出文件内容
|
|
203
|
-
debugLog(`文件内容: ${fs.readFileSync(filePath, 'utf8')}`);
|
|
204
|
-
// 最多重试3次,直到结果包含"🤖 AI代码审查报告"或达到最大重试次数
|
|
200
|
+
|
|
201
|
+
// 最多重试5次,直到结果包含"🤖 AI代码审查报告"或达到最大重试次数
|
|
205
202
|
let attempts = 0;
|
|
206
203
|
const maxAttempts = 5;
|
|
207
204
|
|