job51-gitlab-cr-node-jt-1 2.4.5 → 2.4.6

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.
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: simple-code-review
3
3
  description: 代码审查技能,审查变更代码并输出 REPORT 和 LINE_INFO
4
4
  ---
@@ -21,6 +21,7 @@ description: 代码审查技能,审查变更代码并输出 REPORT 和 LINE_IN
21
21
  - 第 2 行 `+` 或空格:行号 = `New Start + 1`
22
22
  - 以此类推,`-` 开头的删除行不计入行号
23
23
  - **重要**:行号是变更后文件中的绝对行号,必须使用 `New Start` 作为基准计算
24
+ - **只报告当前 diff 块内的问题**:问题的行号必须在 `[New Start, New Start + New Count - 1]` 范围内
24
25
 
25
26
  4. **读取上下文**:基于 New Path 读取变更后文件,涉及方法调用时追踪读取实现代码
26
27
 
@@ -29,7 +30,7 @@ description: 代码审查技能,审查变更代码并输出 REPORT 和 LINE_IN
29
30
  6. **输出结果**:
30
31
  - 审查结果放入 `<REPORT>` 标签
31
32
  - 行号信息放入 `<LINE_INFO>` 标签(必须输出)
32
- - LINE_INFO 格式参考 @.claude/rules/code-review-rules.md 第 19
33
+ - LINE_INFO 格式参考 @.claude/rules/code-review-rules.md 第 18
33
34
  - **问题和行号对应**:`<LINE_INFO>` 中的第 N 个元素对应第 N 个问题的行号
34
35
 
35
36
  ## 输出模板
@@ -39,16 +40,13 @@ description: 代码审查技能,审查变更代码并输出 REPORT 和 LINE_IN
39
40
 
40
41
  ### 🔴 严重问题
41
42
 
42
- ---
43
43
  **问题 1**:[问题描述]<br/>
44
44
  **文件及行号**:[文件路径:行号]<br/>
45
45
  **修改建议**:[正确示例代码或说明]
46
- ---
47
46
 
48
47
  **问题 2**:[问题描述]<br/>
49
48
  **文件及行号**:[文件路径:行号]<br/>
50
49
  **修改建议**:[正确示例代码或说明]
51
- ---
52
50
 
53
51
  </REPORT>
54
52
 
@@ -57,7 +55,8 @@ description: 代码审查技能,审查变更代码并输出 REPORT 和 LINE_IN
57
55
  </LINE_INFO>
58
56
 
59
57
  **说明**:
60
- - 无问题时省略对应标题,但 `<LINE_INFO>` 必须输出(空数组:`[]`)
61
- - 每个问题用 `---` 分割线分隔,方便切分
58
+ - 无问题时省略 `### 🔴 严重问题` 标题,但 `<LINE_INFO>` 必须输出(空数组:`[]`)
59
+ - 每个问题以 `**问题 N**:` 开头,方便切分
62
60
  - **`<LINE_INFO>` 数组中的元素顺序必须与问题顺序一致**:第 1 个元素对应问题 1 的行号,第 2 个元素对应问题 2 的行号,以此类推
63
61
  - 行号计算:使用 `New Start` 作为基准,第 1 行 `+` 或空格的行号 = `New Start`,第 2 行 = `New Start + 1`,依此类推
62
+ - **无严重问题时,LINE_INFO 必须输出空数组 `[]`**
package/index.js CHANGED
@@ -102,7 +102,7 @@ class GitLabCodeReviewer {
102
102
  // 无严重问题 → 直接返回标准空格式
103
103
  if (!hasSeriousProblem) {
104
104
  debugLog(`【决策】报告无严重问题,返回标准空格式`);
105
- return { reportContent: claudeResult, lineInfo: lineInfoContent };
105
+ return { reportContent: '<REPORT>\n## 🤖 AI 代码审查结果\n\n</REPORT>', lineInfo: '[]' };
106
106
  }
107
107
 
108
108
  // 有严重问题 → 检查标题是否符合要求
@@ -297,7 +297,7 @@ ${diffObject.diff}`;
297
297
  // 无严重问题 → 直接返回标准空格式
298
298
  if (!hasSeriousProblem) {
299
299
  debugLog(`【决策】报告无严重问题,返回标准空格式`);
300
- return { reportContent: claudeResult, lineInfo: lineInfoContent };
300
+ return { reportContent: '<REPORT>\n## 🤖 AI 代码审查结果\n\n</REPORT>', lineInfo: '[]' };
301
301
  }
302
302
 
303
303
  // 有严重问题 → 检查标题是否符合要求
@@ -514,29 +514,32 @@ ${diffObject.diff}`;
514
514
  */
515
515
  extractSingleProblemReport(fullReport, problemIndex) {
516
516
  const lines = fullReport.split('\n');
517
- // 使用 --- 分割线来切分问题
517
+ // 使用 **问题 N**: 模式来切分问题
518
518
  const problemBlocks = [];
519
519
  let currentBlock = [];
520
- let inBlock = false;
520
+ let currentBlockIndex = 0;
521
521
 
522
522
  for (const line of lines) {
523
- if (line.trim() === '---') {
524
- if (inBlock) {
525
- // 块结束
526
- if (currentBlock.length > 0) {
527
- problemBlocks.push(currentBlock.join('\n'));
528
- currentBlock = [];
529
- }
530
- inBlock = false;
531
- } else {
532
- // 块开始
533
- inBlock = true;
523
+ // 检查是否是新的问题开始(如 **问题 1**:, **问题 2**:等)
524
+ const problemMatch = line.match(/\*\*问题\s*(\d+)\*\*/);
525
+ if (problemMatch) {
526
+ // 保存上一个问题块
527
+ if (currentBlock.length > 0 && currentBlockIndex > 0) {
528
+ problemBlocks.push(currentBlock.join('\n'));
529
+ currentBlock = [];
534
530
  }
535
- } else if (inBlock) {
531
+ currentBlockIndex = parseInt(problemMatch[1]);
532
+ currentBlock.push(line);
533
+ } else {
536
534
  currentBlock.push(line);
537
535
  }
538
536
  }
539
537
 
538
+ // 保存最后一个问题块
539
+ if (currentBlock.length > 0 && currentBlockIndex > 0) {
540
+ problemBlocks.push(currentBlock.join('\n'));
541
+ }
542
+
540
543
  // 返回第 problemIndex 个问题(索引从 1 开始)
541
544
  if (problemIndex >= 1 && problemIndex <= problemBlocks.length) {
542
545
  return problemBlocks[problemIndex - 1];