@vibedrift/cli 0.4.0 → 0.4.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.
package/dist/index.js CHANGED
@@ -1321,9 +1321,29 @@ function buildDeviationPayloads(codeDnaResult, driftFindings) {
1321
1321
  const hasComment = dj.signals?.some((s) => s.type === "explanatory_comment" && s.present) ?? false;
1322
1322
  const sqlComplexity = dj.signals?.find((s) => s.type === "complex_sql")?.present ? 3 : 0;
1323
1323
  const funcComplexity = dj.signals?.reduce((sum, s) => sum + (s.present ? Math.abs(s.weight) : 0), 0) ?? 0;
1324
+ const patternToType = {
1325
+ repository: "data_access",
1326
+ raw_sql: "data_access",
1327
+ orm: "data_access",
1328
+ direct_db: "data_access",
1329
+ http_client: "data_access",
1330
+ wrap_with_context: "error_handling",
1331
+ raw_propagation: "error_handling",
1332
+ swallow: "error_handling",
1333
+ http_error_response: "error_handling",
1334
+ exception_throw: "error_handling",
1335
+ result_type: "error_handling",
1336
+ constructor_injection: "di",
1337
+ global_import: "di",
1338
+ service_locator: "di",
1339
+ no_di: "di",
1340
+ env_direct: "config",
1341
+ config_struct_di: "config"
1342
+ };
1343
+ const inferredType = patternToType[dj.deviatingPattern] ?? patternToType[dj.dominantPattern] ?? "data_access";
1324
1344
  deviations.push({
1325
1345
  file: dj.relativePath,
1326
- deviation_type: "architectural",
1346
+ deviation_type: inferredType,
1327
1347
  dominant_pattern: dj.dominantPattern,
1328
1348
  actual_pattern: dj.deviatingPattern,
1329
1349
  dominant_count: 0,
@@ -1344,7 +1364,7 @@ function buildDeviationPayloads(codeDnaResult, driftFindings) {
1344
1364
  seen.add(key);
1345
1365
  deviations.push({
1346
1366
  file: df.path,
1347
- deviation_type: d.subCategory ?? "architectural",
1367
+ deviation_type: d.subCategory ?? "data_access",
1348
1368
  dominant_pattern: d.dominantPattern,
1349
1369
  actual_pattern: df.detectedPattern,
1350
1370
  dominant_count: d.dominantCount,
@@ -1473,9 +1493,11 @@ function deduplicateFindingsAcrossLayers(findings) {
1473
1493
  return [...nonDuplicate, ...dedupedDuplicates];
1474
1494
  }
1475
1495
  function makeFilePairKey(f) {
1476
- const files = f.locations.map((l) => l.file).filter(Boolean).sort();
1496
+ const files = [...new Set(
1497
+ f.locations.map((l) => l.file).filter(Boolean)
1498
+ )].sort();
1477
1499
  if (files.length >= 2) {
1478
- return `dup::${files[0]}::${files[1]}`;
1500
+ return `dup::${files.join("::")}`;
1479
1501
  }
1480
1502
  return `dup::${files[0] ?? "unknown"}::${f.analyzerId}`;
1481
1503
  }
@@ -6017,9 +6039,9 @@ function computeDriftScores(findings) {
6017
6039
  ) / 10;
6018
6040
  let grade;
6019
6041
  if (composite >= 90) grade = "A";
6020
- else if (composite >= 80) grade = "B";
6021
- else if (composite >= 65) grade = "C";
6022
- else if (composite >= 50) grade = "D";
6042
+ else if (composite >= 75) grade = "B";
6043
+ else if (composite >= 50) grade = "C";
6044
+ else if (composite >= 25) grade = "D";
6023
6045
  else grade = "F";
6024
6046
  return {
6025
6047
  ...scores,