gitlab-ai-review 2.5.2 → 2.5.3

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 (3) hide show
  1. package/cli.js +44 -0
  2. package/index.js +1 -1
  3. package/package.json +1 -1
package/cli.js CHANGED
@@ -28,6 +28,50 @@ async function main() {
28
28
  const changes = await sdk.getMergeRequestChanges();
29
29
  console.log(`✅ 共发现 ${changes.length} 个文件变更\n`);
30
30
 
31
+ // 3.1 输出详细的变更列表
32
+ if (changes.length > 0) {
33
+ console.log('📝 变更文件列表:');
34
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
35
+
36
+ changes.forEach((change, index) => {
37
+ const fileName = change.new_path || change.old_path;
38
+ let status = '';
39
+ let statusIcon = '';
40
+
41
+ // 判断文件状态
42
+ if (change.new_file) {
43
+ status = '新增';
44
+ statusIcon = '✨';
45
+ } else if (change.deleted_file) {
46
+ status = '删除';
47
+ statusIcon = '🗑️';
48
+ } else if (change.renamed_file) {
49
+ status = '重命名';
50
+ statusIcon = '📝';
51
+ } else {
52
+ status = '修改';
53
+ statusIcon = '✏️';
54
+ }
55
+
56
+ // 计算变更行数
57
+ const diff = change.diff || '';
58
+ const addedLines = (diff.match(/^\+[^+]/gm) || []).length;
59
+ const deletedLines = (diff.match(/^-[^-]/gm) || []).length;
60
+
61
+ console.log(`${index + 1}. ${statusIcon} ${status} - ${fileName}`);
62
+ if (addedLines > 0 || deletedLines > 0) {
63
+ console.log(` 📊 +${addedLines} -${deletedLines} 行`);
64
+ }
65
+
66
+ // 如果是重命名,显示旧路径
67
+ if (change.renamed_file && change.old_path !== change.new_path) {
68
+ console.log(` 📂 ${change.old_path} → ${change.new_path}`);
69
+ }
70
+ });
71
+
72
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
73
+ }
74
+
31
75
  // 4. 执行 AI 代码审查
32
76
  if (sdk.config.ai?.arkApiKey && changes.length > 0) {
33
77
  console.log('🤖 开始 AI 代码审查...\n');
package/index.js CHANGED
@@ -15,7 +15,7 @@ import * as DiffParser from './lib/diff-parser.js';
15
15
  export class GitLabAIReview {
16
16
  constructor(options = {}) {
17
17
  this.name = 'GitLab AI Review SDK';
18
- this.version = '2.5.2';
18
+ this.version = '2.5.3';
19
19
 
20
20
  // 如果传入了配置,使用手动配置;否则使用自动检测
21
21
  if (options.token || options.gitlab) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitlab-ai-review",
3
- "version": "2.5.2",
3
+ "version": "2.5.3",
4
4
  "description": "GitLab AI Review SDK - 支持 SDK 调用和 CLI 执行",
5
5
  "main": "index.js",
6
6
  "type": "module",