gitlab-ai-review 4.2.2 → 4.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.
@@ -64,7 +64,7 @@ export function extractImportsExports(content, fileName) {
64
64
  * @returns {Object} 变更的符号列表 { added: [], deleted: [], modified: [], commented: [] }
65
65
  */
66
66
  export function extractChangedSymbols(diff, fileName) {
67
- if (!diff) return { added: [], deleted: [], modified: [], commented: [] };
67
+ if (!diff) return { added: [], deleted: [], modified: [], commented: [], all: [] };
68
68
 
69
69
  const addedSymbols = [];
70
70
  const deletedSymbols = [];
@@ -519,7 +519,7 @@ export async function analyzeImpact(options) {
519
519
  if (totalSymbols === 0) {
520
520
  return {
521
521
  fileName,
522
- changedSymbols,
522
+ changedSymbols: { added: [], deleted: [], modified: [], commented: [], all: [] },
523
523
  fileContent: null,
524
524
  internalUsage: [],
525
525
  affectedFiles: [],
@@ -277,6 +277,17 @@ export class IncrementalCallChainAnalyzer {
277
277
 
278
278
  console.log(`✅ 构建了 ${callChains.length} 个调用链`);
279
279
 
280
+ // 输出调用链摘要
281
+ if (callChains.length > 0) {
282
+ console.log(`\n📊 调用链摘要:`);
283
+ callChains.forEach((chain, idx) => {
284
+ const totalRefs = (chain.usages?.length || 0) + (chain.typeUsages?.length || 0);
285
+ const issueCount = chain.issues?.length || 0;
286
+ const issueInfo = issueCount > 0 ? ` ⚠️ ${issueCount} 个问题` : '';
287
+ console.log(` ${idx + 1}. ${chain.symbol} (${chain.type}): ${totalRefs} 处引用${issueInfo}`);
288
+ });
289
+ }
290
+
280
291
  // 5. 提取代码上下文
281
292
  const codeContext = this.extractCodeContext(callChains, changedFiles);
282
293
 
@@ -329,6 +340,17 @@ export class IncrementalCallChainAnalyzer {
329
340
 
330
341
  console.log(` ✅ 找到 ${references.length} 处直接引用, ${typeUsages.length} 处类型使用`);
331
342
 
343
+ // 输出类型使用的详细位置
344
+ if (typeUsages.length > 0) {
345
+ console.log(` 📦 类型使用位置:`);
346
+ typeUsages.slice(0, 3).forEach((typeUsage, idx) => {
347
+ console.log(` ${idx + 1}. ${typeUsage.file}:${typeUsage.line} - ${typeUsage.parentType}`);
348
+ });
349
+ if (typeUsages.length > 3) {
350
+ console.log(` ... 还有 ${typeUsages.length - 3} 处`);
351
+ }
352
+ }
353
+
332
354
  // 3. 分析每个引用点
333
355
  const usages = references.map(ref => {
334
356
  const usage = {
@@ -353,12 +375,37 @@ export class IncrementalCallChainAnalyzer {
353
375
  return usage;
354
376
  });
355
377
 
378
+ const issues = usages.filter(u => u.issue).map(u => u.issue);
379
+
380
+ // 输出直接引用的详细信息
381
+ if (references.length > 0) {
382
+ console.log(` 🔍 直接引用位置:`);
383
+ usages.slice(0, 3).forEach((usage, idx) => {
384
+ const issueInfo = usage.issue ? ` ⚠️ ${usage.issue.type}` : '';
385
+ const dataFlowInfo = usage.dataFlow && usage.dataFlow.length > 0
386
+ ? ` → ${usage.dataFlow[usage.dataFlow.length - 1]}`
387
+ : '';
388
+ console.log(` ${idx + 1}. ${usage.file}:${usage.line}${issueInfo}${dataFlowInfo}`);
389
+ });
390
+ if (usages.length > 3) {
391
+ console.log(` ... 还有 ${usages.length - 3} 处`);
392
+ }
393
+ }
394
+
395
+ // 输出检测到的问题
396
+ if (issues.length > 0) {
397
+ console.log(` 🚨 检测到 ${issues.length} 个问题:`);
398
+ issues.forEach((issue, idx) => {
399
+ console.log(` ${idx + 1}. [${issue.severity}] ${issue.message}`);
400
+ });
401
+ }
402
+
356
403
  return {
357
404
  symbol: symbolName,
358
405
  type: symbolType,
359
406
  usages,
360
407
  typeUsages, // 新增:类型使用(如 mockData: Courseware[])
361
- issues: usages.filter(u => u.issue).map(u => u.issue),
408
+ issues,
362
409
  };
363
410
 
364
411
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitlab-ai-review",
3
- "version": "4.2.2",
3
+ "version": "4.2.4",
4
4
  "description": "GitLab AI Review SDK with TypeScript Call Chain Analysis - 支持 TypeScript 增量调用链分析、影响分析、删除符号检测、注释代码识别、文件内部冲突检查、智能文件过滤的智能代码审查工具",
5
5
  "main": "index.js",
6
6
  "type": "module",