gitlab-ai-review 4.1.3 → 4.1.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.
Files changed (2) hide show
  1. package/index.js +5 -69
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -16,7 +16,7 @@ import * as ImpactAnalyzer from './lib/impact-analyzer.js';
16
16
  export class GitLabAIReview {
17
17
  constructor(options = {}) {
18
18
  this.name = 'GitLab AI Review SDK';
19
- this.version = '4.1.3';
19
+ this.version = '4.1.4';
20
20
 
21
21
  // 如果传入了配置,使用手动配置;否则使用自动检测
22
22
  if (options.token || options.gitlab) {
@@ -257,40 +257,8 @@ export class GitLabAIReview {
257
257
  }
258
258
  }
259
259
 
260
- // 构建评论内容,包含完整的修改块上下文
261
- let commentBody = '🤖 **AI 代码审查**\n\n';
262
-
263
- // 如果是修改块(同时有 oldLine 和 newLine),显示完整的删除和新增
264
- if (review.oldLine && review.newLine) {
265
- // 添加修改块的上下文
266
- const oldChange = meaningfulChanges.find(c => c.lineNumber === review.oldLine && c.type === 'deletion');
267
- const newChange = meaningfulChanges.find(c => c.lineNumber === review.newLine && c.type === 'addition');
268
-
269
- if (oldChange || newChange) {
270
- commentBody += '**📝 修改内容:**\n```diff\n';
271
- if (oldChange) {
272
- commentBody += `- ${oldChange.content}\n`;
273
- }
274
- if (newChange) {
275
- commentBody += `+ ${newChange.content}\n`;
276
- }
277
- commentBody += '```\n\n';
278
- }
279
- } else if (review.lineNumber) {
280
- // 单独的删除或新增
281
- const relatedChange = meaningfulChanges.find(c => c.lineNumber === review.lineNumber);
282
- const isDeletion = relatedChange && relatedChange.type === 'deletion';
283
-
284
- // 添加单个变更的上下文
285
- if (relatedChange) {
286
- commentBody += `**📝 ${isDeletion ? '删除' : '新增'}内容:**\n\`\`\`${isDeletion ? 'diff' : 'javascript'}\n`;
287
- commentBody += `${isDeletion ? '-' : '+'} ${relatedChange.content}\n`;
288
- commentBody += '```\n\n';
289
- }
290
- }
291
-
292
- // 添加 AI 审查意见
293
- commentBody += review.comment;
260
+ // 直接使用 AI 审查意见作为评论内容
261
+ const commentBody = `🤖 **AI 代码审查**\n\n${review.comment}`;
294
262
 
295
263
  const commentResult = await this.gitlabClient.createLineComment(
296
264
  this.config.project.projectId,
@@ -576,40 +544,8 @@ export class GitLabAIReview {
576
544
  }
577
545
  }
578
546
 
579
- // 构建评论内容,包含完整的修改块上下文
580
- let commentBody = '🤖 **AI 代码审查**\n\n';
581
-
582
- // 如果是修改块(同时有 oldLine 和 newLine),显示完整的删除和新增
583
- if (review.oldLine && review.newLine) {
584
- // 添加修改块的上下文
585
- const oldChange = meaningfulChanges.find(c => c.lineNumber === review.oldLine && c.type === 'deletion');
586
- const newChange = meaningfulChanges.find(c => c.lineNumber === review.newLine && c.type === 'addition');
587
-
588
- if (oldChange || newChange) {
589
- commentBody += '**📝 修改内容:**\n```diff\n';
590
- if (oldChange) {
591
- commentBody += `- ${oldChange.content}\n`;
592
- }
593
- if (newChange) {
594
- commentBody += `+ ${newChange.content}\n`;
595
- }
596
- commentBody += '```\n\n';
597
- }
598
- } else if (review.lineNumber) {
599
- // 单独的删除或新增
600
- const relatedChange = meaningfulChanges.find(c => c.lineNumber === review.lineNumber);
601
- const isDeletion = relatedChange && relatedChange.type === 'deletion';
602
-
603
- // 添加单个变更的上下文
604
- if (relatedChange) {
605
- commentBody += `**📝 ${isDeletion ? '删除' : '新增'}内容:**\n\`\`\`${isDeletion ? 'diff' : 'javascript'}\n`;
606
- commentBody += `${isDeletion ? '-' : '+'} ${relatedChange.content}\n`;
607
- commentBody += '```\n\n';
608
- }
609
- }
610
-
611
- // 添加 AI 审查意见
612
- commentBody += review.comment;
547
+ // 直接使用 AI 审查意见作为评论内容
548
+ const commentBody = `🤖 **AI 代码审查**\n\n${review.comment}`;
613
549
 
614
550
  const commentResult = await this.gitlabClient.createLineComment(
615
551
  this.config.project.projectId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitlab-ai-review",
3
- "version": "4.1.3",
3
+ "version": "4.1.4",
4
4
  "description": "GitLab AI Review SDK with Impact Analysis - 支持影响分析、删除符号检测、注释代码识别、文件内部冲突检查、智能文件过滤的智能代码审查工具",
5
5
  "main": "index.js",
6
6
  "type": "module",