gitlab-ai-review 4.2.0 → 4.2.1

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.
@@ -80,6 +80,12 @@ export function extractChangedSymbols(diff, fileName) {
80
80
  /(?:export\s+)?enum\s+(\w+)/, // 枚举
81
81
  ];
82
82
 
83
+ // 匹配接口/类型的字段定义
84
+ const fieldPatterns = [
85
+ /^\s*(\w+)\s*[?]?\s*:\s*/, // 接口字段:fieldName: type 或 fieldName?: type
86
+ /^\s*(\w+)\s*[=]/, // 对象属性:fieldName = value
87
+ ];
88
+
83
89
  lines.forEach((line, index) => {
84
90
  const isAddition = line.startsWith('+') && !line.startsWith('+++');
85
91
  const isDeletion = line.startsWith('-') && !line.startsWith('---');
@@ -130,6 +136,22 @@ export function extractChangedSymbols(diff, fileName) {
130
136
  }
131
137
  });
132
138
 
139
+ // 匹配接口/类型字段
140
+ fieldPatterns.forEach(pattern => {
141
+ const match = cleanLine.match(pattern);
142
+ if (match) {
143
+ const fieldName = match[1];
144
+ // 过滤掉常见关键字
145
+ if (!['if', 'else', 'for', 'while', 'return', 'const', 'let', 'var', 'function', 'class'].includes(fieldName)) {
146
+ addedSymbols.push({
147
+ name: fieldName,
148
+ type: 'field',
149
+ line: index + 1,
150
+ });
151
+ }
152
+ }
153
+ });
154
+
133
155
  // 匹配函数调用
134
156
  const callPattern = /(\w+)\s*\(/g;
135
157
  let callMatch;
@@ -153,6 +175,22 @@ export function extractChangedSymbols(diff, fileName) {
153
175
  });
154
176
  }
155
177
  });
178
+
179
+ // 匹配被删除的接口/类型字段
180
+ fieldPatterns.forEach(pattern => {
181
+ const match = cleanLine.match(pattern);
182
+ if (match) {
183
+ const fieldName = match[1];
184
+ // 过滤掉常见关键字
185
+ if (!['if', 'else', 'for', 'while', 'return', 'const', 'let', 'var', 'function', 'class'].includes(fieldName)) {
186
+ deletedSymbols.push({
187
+ name: fieldName,
188
+ type: 'field',
189
+ line: index + 1,
190
+ });
191
+ }
192
+ }
193
+ });
156
194
  }
157
195
  }
158
196
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitlab-ai-review",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "GitLab AI Review SDK with TypeScript Call Chain Analysis - 支持 TypeScript 增量调用链分析、影响分析、删除符号检测、注释代码识别、文件内部冲突检查、智能文件过滤的智能代码审查工具",
5
5
  "main": "index.js",
6
6
  "type": "module",