@vibgrate/cli 2026.711.2 → 2026.715.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.
@@ -1,5 +1,5 @@
1
1
  import { redactUrlCredentials } from './chunk-RXP66R2E.js';
2
- import { pathExists, readJsonFile, Semaphore, FileCache, quickTreeCount, ensureDir, writeJsonFile, writeTextFile, readTextFile, findPackageJsonFiles, findFiles, findSolutionFiles } from './chunk-GI6W53LM.js';
2
+ import { pathExists, readTextFile, readJsonFile, Semaphore, FileCache, quickTreeCount, ensureDir, writeJsonFile, writeTextFile, findPackageJsonFiles, findFiles, findSolutionFiles } from './chunk-GI6W53LM.js';
3
3
  import * as path29 from 'path';
4
4
  import { basename, dirname } from 'path';
5
5
  import chalk3 from 'chalk';
@@ -19,7 +19,7 @@ import * as zlib from 'zlib';
19
19
  import { promisify } from 'util';
20
20
 
21
21
  // src/version.ts
22
- var VERSION = "2026.711.2";
22
+ var VERSION = "2026.715.1";
23
23
  var TOP_LEVEL_NODE_MODULES = /^node_modules\/((?:@[^/]+\/)?[^/]+)$/;
24
24
  function parsePackageLock(json) {
25
25
  const out = /* @__PURE__ */ new Map();
@@ -977,14 +977,6 @@ function aggregateLibyears(values) {
977
977
  if (measured === 0) return null;
978
978
  return { total, max, measured };
979
979
  }
980
- function freshnessScoreFromLibyears(agg) {
981
- if (!agg || agg.measured === 0) return null;
982
- const avg = agg.total / agg.measured;
983
- const avgPenalty = Math.min(avg * 20, 100);
984
- const maxPenalty = Math.min(agg.max * 10, 100);
985
- const score = 100 - (avgPenalty * 0.7 + maxPenalty * 0.3);
986
- return Math.max(0, Math.min(100, Math.round(score)));
987
- }
988
980
 
989
981
  // src/core-open/runtimes/catalog.ts
990
982
  function productForType(type) {
@@ -1741,10 +1733,10 @@ function parseTfmMajor(tfm) {
1741
1733
  return null;
1742
1734
  }
1743
1735
  function isDotnetProjectFile(name) {
1744
- return name.endsWith(".csproj") || name.endsWith(".vbproj");
1736
+ return name.endsWith(".csproj") || name.endsWith(".vbproj") || name.endsWith(".sqlproj");
1745
1737
  }
1746
1738
  function stripDotnetProjectExtension(filePath) {
1747
- return path29.basename(filePath).replace(/\.(cs|vb)proj$/i, "");
1739
+ return path29.basename(filePath).replace(/\.(cs|vb|sql)proj$/i, "");
1748
1740
  }
1749
1741
  function parseDotnetProjectFile(xml, filePath) {
1750
1742
  const parsed = parser.parse(xml);
@@ -1813,7 +1805,7 @@ async function scanDotnetProjects(rootDir, nugetCache, cache, projectScanTimeout
1813
1805
  try {
1814
1806
  const slnContent = cache ? await cache.readTextFile(slnPath) : await readTextFile(slnPath);
1815
1807
  const slnDir = path29.dirname(slnPath);
1816
- const projectRegex = /Project\("[^"]*"\)\s*=\s*"[^"]*",\s*"([^"]+\.(?:cs|vb)proj)"/g;
1808
+ const projectRegex = /Project\("[^"]*"\)\s*=\s*"[^"]*",\s*"([^"]+\.(?:cs|vb|sql)proj)"/g;
1817
1809
  let match;
1818
1810
  while ((match = projectRegex.exec(slnContent)) !== null) {
1819
1811
  if (match[1]) {
@@ -6604,7 +6596,166 @@ var PubCache = class {
6604
6596
  return p;
6605
6597
  }
6606
6598
  };
6607
- var DRIFT_SCORE_METHODOLOGY_VERSION = "driftscore-2.0";
6599
+
6600
+ // src/core-open/scoring/dependency-drift-v3.ts
6601
+ var POINTS_PER_LIBYEAR = 25;
6602
+ var TIME_WEIGHT = 0.55;
6603
+ var VERSION_WEIGHT = 0.45;
6604
+ var UNSUPPORTED_FLOOR = 70;
6605
+ var ABANDONED_FLOOR = 50;
6606
+ var AGG_MEAN_WEIGHT = 0.5;
6607
+ var AGG_P95_WEIGHT = 0.3;
6608
+ var AGG_UNSUPPORTED_SHARE_WEIGHT = 0.2;
6609
+ var WEIGHT_DIRECT_PROD = 1;
6610
+ var WEIGHT_DIRECT_DEV = 0.5;
6611
+ var WEIGHT_TRANSITIVE = 0.4;
6612
+ var CANARY_MAJOR_THRESHOLD = 900;
6613
+ var SCHEME_JUMP_MAX_MAJORS = 20;
6614
+ var HIGH_CADENCE_TIME_CAP = 50;
6615
+ var PLACEHOLDER_STUBS = /* @__PURE__ */ new Set([
6616
+ "fs",
6617
+ "crypto",
6618
+ "path",
6619
+ "util",
6620
+ "os",
6621
+ "events",
6622
+ "stream",
6623
+ "http",
6624
+ "https",
6625
+ "assert",
6626
+ "buffer",
6627
+ "punycode",
6628
+ "querystring",
6629
+ "url",
6630
+ "zlib",
6631
+ "domain"
6632
+ ]);
6633
+ var HIGH_CADENCE_PREFIXES = [
6634
+ "@aws-sdk/",
6635
+ "aws-sdk",
6636
+ "@google-cloud/",
6637
+ "@azure/"
6638
+ ];
6639
+ function clamp(v, min, max) {
6640
+ return Math.min(max, Math.max(min, v));
6641
+ }
6642
+ function majorOf(version) {
6643
+ if (!version) return null;
6644
+ const m = /^\D*(\d+)/.exec(version);
6645
+ return m ? Number(m[1]) : null;
6646
+ }
6647
+ function isHighCadence(pkg) {
6648
+ return HIGH_CADENCE_PREFIXES.some((p) => pkg === p || pkg.startsWith(p));
6649
+ }
6650
+ function versionDriftPoints(dep) {
6651
+ const mb = dep.majorsBehind;
6652
+ if (mb === null || mb === void 0) return 0;
6653
+ if (mb <= 0) {
6654
+ return dep.drift === "current" ? 0 : 15;
6655
+ }
6656
+ if (mb === 1) return 45;
6657
+ if (mb === 2) return 70;
6658
+ if (mb === 3) return 85;
6659
+ return 100;
6660
+ }
6661
+ function timeDriftPoints(libyears) {
6662
+ if (libyears === null || libyears === void 0 || Number.isNaN(libyears)) return null;
6663
+ return clamp(libyears * POINTS_PER_LIBYEAR, 0, 100);
6664
+ }
6665
+ function perDependencyDrift(dep, ctx = {}) {
6666
+ const flags = [];
6667
+ if (PLACEHOLDER_STUBS.has(dep.package)) {
6668
+ return {
6669
+ package: dep.package,
6670
+ drift: 0,
6671
+ mode: "estimated",
6672
+ unsupported: false,
6673
+ weight: 0,
6674
+ flags: ["placeholder-stub"],
6675
+ excluded: true
6676
+ };
6677
+ }
6678
+ const latestMajor = majorOf(dep.latestStable);
6679
+ let versionReliable = true;
6680
+ if (latestMajor !== null && latestMajor >= CANARY_MAJOR_THRESHOLD) {
6681
+ versionReliable = false;
6682
+ flags.push("canary-latest");
6683
+ }
6684
+ if (dep.majorsBehind !== null && dep.majorsBehind !== void 0 && dep.majorsBehind > SCHEME_JUMP_MAX_MAJORS) {
6685
+ versionReliable = false;
6686
+ flags.push("scheme-jump");
6687
+ }
6688
+ const highCadence = isHighCadence(dep.package);
6689
+ if (highCadence) flags.push("high-cadence-damped");
6690
+ const V = versionReliable ? versionDriftPoints(dep) : 0;
6691
+ let T = timeDriftPoints(dep.libyears);
6692
+ if (T !== null && highCadence) T = Math.min(T, HIGH_CADENCE_TIME_CAP);
6693
+ let base;
6694
+ let mode;
6695
+ if (T !== null) {
6696
+ mode = "verified";
6697
+ base = versionReliable ? TIME_WEIGHT * T + VERSION_WEIGHT * V : T;
6698
+ } else {
6699
+ mode = "estimated";
6700
+ base = V;
6701
+ }
6702
+ const unsupported = ctx.unsupported === true;
6703
+ if (unsupported) {
6704
+ base = Math.max(base, UNSUPPORTED_FLOOR);
6705
+ flags.push("unsupported-floor");
6706
+ }
6707
+ if (ctx.abandoned === true) {
6708
+ base = Math.max(base, ABANDONED_FLOOR);
6709
+ flags.push("abandoned-floor");
6710
+ }
6711
+ const weight = ctx.transitive === true ? WEIGHT_TRANSITIVE : dep.section === "devDependencies" ? WEIGHT_DIRECT_DEV : WEIGHT_DIRECT_PROD;
6712
+ return {
6713
+ package: dep.package,
6714
+ drift: clamp(Math.round(base), 0, 100),
6715
+ mode,
6716
+ unsupported,
6717
+ weight,
6718
+ flags,
6719
+ excluded: false
6720
+ };
6721
+ }
6722
+ function percentile(values, p) {
6723
+ if (values.length === 0) return 0;
6724
+ const sorted = [...values].sort((a, b) => a - b);
6725
+ const rank2 = Math.ceil(p * sorted.length);
6726
+ return sorted[clamp(rank2 - 1, 0, sorted.length - 1)];
6727
+ }
6728
+ function aggregateDependencyDrift(deps, ctxOf) {
6729
+ const results = deps.map((d) => perDependencyDrift(d, ctxOf?.(d))).filter((r) => !r.excluded);
6730
+ const excluded = deps.length - results.length;
6731
+ if (results.length === 0) return null;
6732
+ const weightSum = results.reduce((s, r) => s + r.weight, 0) || 1;
6733
+ const weightedMean = results.reduce((s, r) => s + r.drift * r.weight, 0) / weightSum;
6734
+ const p95 = percentile(results.map((r) => r.drift), 0.95);
6735
+ const unsupportedShare = results.filter((r) => r.unsupported).length / results.length;
6736
+ const verified = results.filter((r) => r.mode === "verified").length;
6737
+ const drift = clamp(
6738
+ Math.round(
6739
+ AGG_MEAN_WEIGHT * weightedMean + AGG_P95_WEIGHT * p95 + AGG_UNSUPPORTED_SHARE_WEIGHT * (unsupportedShare * 100)
6740
+ ),
6741
+ 0,
6742
+ 100
6743
+ );
6744
+ return {
6745
+ drift,
6746
+ mean: Math.round(weightedMean),
6747
+ p95,
6748
+ unsupportedShare,
6749
+ mode: verified > 0 ? "verified" : "estimated",
6750
+ scored: results.length,
6751
+ excluded,
6752
+ coverage: Math.round(verified / results.length * 100) / 100,
6753
+ top: [...results].sort((a, b) => b.drift - a.drift).slice(0, 10)
6754
+ };
6755
+ }
6756
+
6757
+ // src/core-open/scoring/drift-score.ts
6758
+ var DRIFT_SCORE_METHODOLOGY_VERSION = "driftscore-3.0";
6608
6759
  var DEFAULT_THRESHOLDS = {
6609
6760
  failOnError: {
6610
6761
  eolDays: 180,
@@ -6616,7 +6767,7 @@ var DEFAULT_THRESHOLDS = {
6616
6767
  dependencyTwoPlusPercent: 30
6617
6768
  }
6618
6769
  };
6619
- function clamp(val, min, max) {
6770
+ function clamp2(val, min, max) {
6620
6771
  return Math.min(max, Math.max(min, val));
6621
6772
  }
6622
6773
  function runtimeScore(projects) {
@@ -6639,23 +6790,12 @@ function frameworkScore(projects) {
6639
6790
  const avgLag = lags.reduce((a, b) => a + b, 0) / lags.length;
6640
6791
  const maxPenalty = Math.min(maxLag * 20, 100);
6641
6792
  const avgPenalty = Math.min(avgLag * 15, 100);
6642
- return clamp(100 - (maxPenalty * 0.6 + avgPenalty * 0.4), 0, 100);
6793
+ return clamp2(100 - (maxPenalty * 0.6 + avgPenalty * 0.4), 0, 100);
6643
6794
  }
6644
6795
  function dependencyScore(projects) {
6645
- let totalCurrent = 0;
6646
- let totalOne = 0;
6647
- let totalTwo = 0;
6648
- for (const p of projects) {
6649
- totalCurrent += p.dependencyAgeBuckets.current;
6650
- totalOne += p.dependencyAgeBuckets.oneBehind;
6651
- totalTwo += p.dependencyAgeBuckets.twoPlusBehind;
6652
- }
6653
- const total = totalCurrent + totalOne + totalTwo;
6654
- if (total === 0) return null;
6655
- const currentPct = totalCurrent / total;
6656
- const onePct = totalOne / total;
6657
- const twoPct = totalTwo / total;
6658
- return clamp(Math.round(currentPct * 100 - onePct * 10 - twoPct * 40), 0, 100);
6796
+ const deps = projects.flatMap((p) => p.dependencies);
6797
+ const agg = aggregateDependencyDrift(deps);
6798
+ return agg ? 100 - agg.drift : null;
6659
6799
  }
6660
6800
  var MONTH_MS = 1e3 * 60 * 60 * 24 * 30;
6661
6801
  function eolScore(projects) {
@@ -6703,15 +6843,6 @@ function eolScore(projects) {
6703
6843
  }
6704
6844
  return score;
6705
6845
  }
6706
- function freshnessScore(projects) {
6707
- const aggs = projects.map((p) => p.libyears).filter((a) => !!a);
6708
- if (aggs.length === 0) return null;
6709
- const total = aggs.reduce((s, a) => s + a.total, 0);
6710
- const measured = aggs.reduce((s, a) => s + a.measured, 0);
6711
- const max = aggs.reduce((m, a) => Math.max(m, a.max), 0);
6712
- if (measured === 0) return null;
6713
- return freshnessScoreFromLibyears({ total, max, measured });
6714
- }
6715
6846
  function coverageConfidence(projects) {
6716
6847
  let known = 0;
6717
6848
  let unknown = 0;
@@ -6728,13 +6859,11 @@ function computeDriftScore(projects) {
6728
6859
  const fs9 = frameworkScore(projects);
6729
6860
  const ds = dependencyScore(projects);
6730
6861
  const es = eolScore(projects);
6731
- const frs = freshnessScore(projects);
6732
6862
  const components = [
6733
6863
  { score: rs, weight: 0.25 },
6734
6864
  { score: fs9, weight: 0.25 },
6735
6865
  { score: ds, weight: 0.3 },
6736
- { score: es, weight: 0.2 },
6737
- { score: frs, weight: 0.15 }
6866
+ { score: es, weight: 0.2 }
6738
6867
  ];
6739
6868
  const confidence = coverageConfidence(projects) ?? void 0;
6740
6869
  const toDrift = (health2) => 100 - health2;
@@ -6745,7 +6874,6 @@ function computeDriftScore(projects) {
6745
6874
  dependencyScore: toDrift(Math.round(ds ?? 100)),
6746
6875
  eolScore: toDrift(Math.round(es ?? 100))
6747
6876
  };
6748
- if (frs !== null) c.freshnessScore = toDrift(Math.round(frs));
6749
6877
  return c;
6750
6878
  };
6751
6879
  const active = components.filter((c) => c.score !== null);
@@ -6773,7 +6901,6 @@ function computeDriftScore(projects) {
6773
6901
  if (fs9 !== null) measured.push("framework");
6774
6902
  if (ds !== null) measured.push("dependency");
6775
6903
  if (es !== null) measured.push("eol");
6776
- if (frs !== null) measured.push("freshness");
6777
6904
  return {
6778
6905
  score,
6779
6906
  riskLevel,
@@ -7345,6 +7472,26 @@ function formatExtended(ext) {
7345
7472
  }
7346
7473
  lines.push("");
7347
7474
  }
7475
+ if (ext.databaseSchema) {
7476
+ const ds = ext.databaseSchema;
7477
+ lines.push(chalk3.bold.underline(" Database Schema"));
7478
+ const dsHead = [];
7479
+ if (ds.providers.length > 0) dsHead.push(ds.providers.join(", "));
7480
+ dsHead.push(`${ds.models.length} model${ds.models.length !== 1 ? "s" : ""}`);
7481
+ dsHead.push(`${ds.enums.length} enum${ds.enums.length !== 1 ? "s" : ""}`);
7482
+ lines.push(` ${dsHead.join(" \xB7 ")}`);
7483
+ const bySource = /* @__PURE__ */ new Map();
7484
+ for (const m of ds.models) bySource.set(m.source, (bySource.get(m.source) ?? 0) + 1);
7485
+ if (bySource.size > 1) {
7486
+ const sourceSummary = [...bySource.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([s, n]) => `${s}: ${n}`).join(", ");
7487
+ lines.push(` Sources: ${sourceSummary}`);
7488
+ }
7489
+ if (ds.models.length > 0) {
7490
+ const preview = ds.models.slice(0, 5).map((m) => m.name).join(", ");
7491
+ lines.push(` Models: ${chalk3.white(preview)}${ds.models.length > 5 ? chalk3.dim(` (+${ds.models.length - 5} more)`) : ""}`);
7492
+ }
7493
+ lines.push("");
7494
+ }
7348
7495
  if (ext.dependencyGraph) {
7349
7496
  const dg = ext.dependencyGraph;
7350
7497
  if (dg.lockfileType) {
@@ -11143,6 +11290,20 @@ function dedupeRoutes(routes) {
11143
11290
  }
11144
11291
  var gzip2 = promisify(zlib.gzip);
11145
11292
  var MAX_ITEMS = 50;
11293
+ var MAX_DB_MODELS = 300;
11294
+ var MAX_DB_FIELDS_PER_MODEL = 100;
11295
+ var MAX_DB_MODEL_FILES = 5;
11296
+ var MAX_DB_FILES_SCANNED = 500;
11297
+ var DB_UPLOAD_HARD_CEILING = {
11298
+ maxModels: 2e3,
11299
+ maxFieldsPerModel: 500,
11300
+ maxFilesPerModel: 20,
11301
+ maxFilesScanned: 5e3
11302
+ };
11303
+ function clampCap(configured, fallback, ceiling) {
11304
+ if (typeof configured !== "number" || !Number.isFinite(configured) || configured <= 0) return fallback;
11305
+ return Math.min(Math.floor(configured), ceiling);
11306
+ }
11146
11307
  function extractName(entry) {
11147
11308
  const match = entry.match(/^(.+?)\s*\(/);
11148
11309
  return match ? match[1].trim() : entry.trim();
@@ -11208,7 +11369,29 @@ function compactAssetBranding(result) {
11208
11369
  // Don't include logos
11209
11370
  };
11210
11371
  }
11211
- function prepareArtifactForUpload(artifact) {
11372
+ function compactDatabaseSchema(result, caps) {
11373
+ const maxModels = clampCap(caps?.maxModels, MAX_DB_MODELS, DB_UPLOAD_HARD_CEILING.maxModels);
11374
+ const maxFieldsPerModel = clampCap(caps?.maxFieldsPerModel, MAX_DB_FIELDS_PER_MODEL, DB_UPLOAD_HARD_CEILING.maxFieldsPerModel);
11375
+ const maxFilesPerModel = clampCap(caps?.maxFilesPerModel, MAX_DB_MODEL_FILES, DB_UPLOAD_HARD_CEILING.maxFilesPerModel);
11376
+ const maxFilesScanned = clampCap(caps?.maxFilesScanned, MAX_DB_FILES_SCANNED, DB_UPLOAD_HARD_CEILING.maxFilesScanned);
11377
+ return {
11378
+ providers: result.providers.slice(0, MAX_ITEMS),
11379
+ models: result.models.slice(0, maxModels).map((model) => ({
11380
+ ...model,
11381
+ fields: model.fields.slice(0, maxFieldsPerModel),
11382
+ files: model.files.slice(0, maxFilesPerModel)
11383
+ })),
11384
+ enums: result.enums.slice(0, MAX_ITEMS),
11385
+ filesScanned: result.filesScanned.slice(0, maxFilesScanned),
11386
+ projects: result.projects.slice(0, MAX_ITEMS).map((project) => ({
11387
+ project: project.project,
11388
+ filesScanned: project.filesScanned.slice(0, MAX_ITEMS),
11389
+ models: project.models.slice(0, MAX_ITEMS),
11390
+ enums: project.enums.slice(0, MAX_ITEMS)
11391
+ }))
11392
+ };
11393
+ }
11394
+ function prepareArtifactForUpload(artifact, opts) {
11212
11395
  const compacted = { ...artifact };
11213
11396
  if (compacted.extended) {
11214
11397
  const ext = { ...compacted.extended };
@@ -11284,6 +11467,9 @@ function prepareArtifactForUpload(artifact) {
11284
11467
  duplicatedPackages: ext.dependencyGraph.duplicatedPackages.slice(0, MAX_ITEMS)
11285
11468
  };
11286
11469
  }
11470
+ if (ext.databaseSchema) {
11471
+ ext.databaseSchema = compactDatabaseSchema(ext.databaseSchema, opts?.databaseSchemaCaps);
11472
+ }
11287
11473
  compacted.extended = ext;
11288
11474
  }
11289
11475
  return compacted;
@@ -11292,8 +11478,8 @@ async function compressArtifact(artifact) {
11292
11478
  const json = JSON.stringify(artifact);
11293
11479
  return gzip2(json, { level: 9 });
11294
11480
  }
11295
- async function prepareCompressedUpload(artifact) {
11296
- const compacted = prepareArtifactForUpload(artifact);
11481
+ async function prepareCompressedUpload(artifact, opts) {
11482
+ const compacted = prepareArtifactForUpload(artifact, opts);
11297
11483
  const compressed = await compressArtifact(compacted);
11298
11484
  return { body: compressed, contentEncoding: "gzip" };
11299
11485
  }
@@ -11467,6 +11653,6 @@ async function writeTextFile2(filePath, content) {
11467
11653
  await fs2.writeFile(filePath, content, "utf8");
11468
11654
  }
11469
11655
 
11470
- export { PROJECT_TYPE_TO_OSV_ECOSYSTEM, VERSION, brandProgressBar, buildVersionTimelines, compactUiPurpose, computeDriftScore, computeRepoFingerprint, computeUpgradeImpact, detectVcs, driftBar, ensureDir2 as ensureDir, fetchRiskySymbols, fetchScanPreflight, findPackageAnyEcosystem, findPackageTimeline, findVersionCrossings, getChangelogSignals, gitHistoryAvailable, normalizeConstraint, parseDsn, pathExists2 as pathExists, prepareCompressedUpload, projectTypeToVulnEcosystem, readJsonFile2 as readJsonFile, resolveHead, resolveRepositoryName, runCoreScan, severityRank, titleBox, versionSatisfies, workingTreeDirty, writeDefaultConfig, writeJsonFile2 as writeJsonFile, writeTextFile2 as writeTextFile };
11471
- //# sourceMappingURL=chunk-NNU2PW2H.js.map
11472
- //# sourceMappingURL=chunk-NNU2PW2H.js.map
11656
+ export { PROJECT_TYPE_TO_OSV_ECOSYSTEM, VERSION, brandProgressBar, buildVersionTimelines, compactUiPurpose, computeDriftScore, computeRepoFingerprint, computeUpgradeImpact, detectVcs, driftBar, ensureDir2 as ensureDir, fetchRiskySymbols, fetchScanPreflight, findPackageAnyEcosystem, findPackageTimeline, findVersionCrossings, getChangelogSignals, gitHistoryAvailable, loadConfig, normalizeConstraint, parseDsn, pathExists2 as pathExists, prepareCompressedUpload, projectTypeToVulnEcosystem, readJsonFile2 as readJsonFile, resolveHead, resolveRepositoryName, runCoreScan, severityRank, titleBox, versionSatisfies, workingTreeDirty, writeDefaultConfig, writeJsonFile2 as writeJsonFile, writeTextFile2 as writeTextFile };
11657
+ //# sourceMappingURL=chunk-C5AVF7PT.js.map
11658
+ //# sourceMappingURL=chunk-C5AVF7PT.js.map