@vibgrate/cli 2026.711.1 → 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';
@@ -13,14 +13,13 @@ import { readFile, mkdir, writeFile, mkdtemp, rm } from 'fs/promises';
13
13
  import { XMLParser } from 'fast-xml-parser';
14
14
  import { parse as parse$1 } from 'smol-toml';
15
15
  import * as crypto from 'crypto';
16
- import ts from 'typescript';
17
16
  import * as fs5 from 'fs';
18
17
  import { mkdirSync, writeFileSync } from 'fs';
19
18
  import * as zlib from 'zlib';
20
19
  import { promisify } from 'util';
21
20
 
22
21
  // src/version.ts
23
- var VERSION = "2026.711.1";
22
+ var VERSION = "2026.715.1";
24
23
  var TOP_LEVEL_NODE_MODULES = /^node_modules\/((?:@[^/]+\/)?[^/]+)$/;
25
24
  function parsePackageLock(json) {
26
25
  const out = /* @__PURE__ */ new Map();
@@ -978,14 +977,6 @@ function aggregateLibyears(values) {
978
977
  if (measured === 0) return null;
979
978
  return { total, max, measured };
980
979
  }
981
- function freshnessScoreFromLibyears(agg) {
982
- if (!agg || agg.measured === 0) return null;
983
- const avg = agg.total / agg.measured;
984
- const avgPenalty = Math.min(avg * 20, 100);
985
- const maxPenalty = Math.min(agg.max * 10, 100);
986
- const score = 100 - (avgPenalty * 0.7 + maxPenalty * 0.3);
987
- return Math.max(0, Math.min(100, Math.round(score)));
988
- }
989
980
 
990
981
  // src/core-open/runtimes/catalog.ts
991
982
  function productForType(type) {
@@ -1055,14 +1046,14 @@ function rank(v) {
1055
1046
  }
1056
1047
  function isReleased(cycle, now) {
1057
1048
  if (typeof cycle.releaseDate !== "string") return true;
1058
- const ts2 = Date.parse(cycle.releaseDate);
1059
- return Number.isNaN(ts2) ? true : ts2 <= now;
1049
+ const ts = Date.parse(cycle.releaseDate);
1050
+ return Number.isNaN(ts) ? true : ts <= now;
1060
1051
  }
1061
1052
  function isLts(cycle, now) {
1062
1053
  if (cycle.lts === true) return true;
1063
1054
  if (typeof cycle.lts === "string") {
1064
- const ts2 = Date.parse(cycle.lts);
1065
- return !Number.isNaN(ts2) && ts2 <= now;
1055
+ const ts = Date.parse(cycle.lts);
1056
+ return !Number.isNaN(ts) && ts <= now;
1066
1057
  }
1067
1058
  return false;
1068
1059
  }
@@ -1742,10 +1733,10 @@ function parseTfmMajor(tfm) {
1742
1733
  return null;
1743
1734
  }
1744
1735
  function isDotnetProjectFile(name) {
1745
- return name.endsWith(".csproj") || name.endsWith(".vbproj");
1736
+ return name.endsWith(".csproj") || name.endsWith(".vbproj") || name.endsWith(".sqlproj");
1746
1737
  }
1747
1738
  function stripDotnetProjectExtension(filePath) {
1748
- return path29.basename(filePath).replace(/\.(cs|vb)proj$/i, "");
1739
+ return path29.basename(filePath).replace(/\.(cs|vb|sql)proj$/i, "");
1749
1740
  }
1750
1741
  function parseDotnetProjectFile(xml, filePath) {
1751
1742
  const parsed = parser.parse(xml);
@@ -1814,7 +1805,7 @@ async function scanDotnetProjects(rootDir, nugetCache, cache, projectScanTimeout
1814
1805
  try {
1815
1806
  const slnContent = cache ? await cache.readTextFile(slnPath) : await readTextFile(slnPath);
1816
1807
  const slnDir = path29.dirname(slnPath);
1817
- const projectRegex = /Project\("[^"]*"\)\s*=\s*"[^"]*",\s*"([^"]+\.(?:cs|vb)proj)"/g;
1808
+ const projectRegex = /Project\("[^"]*"\)\s*=\s*"[^"]*",\s*"([^"]+\.(?:cs|vb|sql)proj)"/g;
1818
1809
  let match;
1819
1810
  while ((match = projectRegex.exec(slnContent)) !== null) {
1820
1811
  if (match[1]) {
@@ -6605,7 +6596,166 @@ var PubCache = class {
6605
6596
  return p;
6606
6597
  }
6607
6598
  };
6608
- 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";
6609
6759
  var DEFAULT_THRESHOLDS = {
6610
6760
  failOnError: {
6611
6761
  eolDays: 180,
@@ -6617,7 +6767,7 @@ var DEFAULT_THRESHOLDS = {
6617
6767
  dependencyTwoPlusPercent: 30
6618
6768
  }
6619
6769
  };
6620
- function clamp(val, min, max) {
6770
+ function clamp2(val, min, max) {
6621
6771
  return Math.min(max, Math.max(min, val));
6622
6772
  }
6623
6773
  function runtimeScore(projects) {
@@ -6640,23 +6790,12 @@ function frameworkScore(projects) {
6640
6790
  const avgLag = lags.reduce((a, b) => a + b, 0) / lags.length;
6641
6791
  const maxPenalty = Math.min(maxLag * 20, 100);
6642
6792
  const avgPenalty = Math.min(avgLag * 15, 100);
6643
- return clamp(100 - (maxPenalty * 0.6 + avgPenalty * 0.4), 0, 100);
6793
+ return clamp2(100 - (maxPenalty * 0.6 + avgPenalty * 0.4), 0, 100);
6644
6794
  }
6645
6795
  function dependencyScore(projects) {
6646
- let totalCurrent = 0;
6647
- let totalOne = 0;
6648
- let totalTwo = 0;
6649
- for (const p of projects) {
6650
- totalCurrent += p.dependencyAgeBuckets.current;
6651
- totalOne += p.dependencyAgeBuckets.oneBehind;
6652
- totalTwo += p.dependencyAgeBuckets.twoPlusBehind;
6653
- }
6654
- const total = totalCurrent + totalOne + totalTwo;
6655
- if (total === 0) return null;
6656
- const currentPct = totalCurrent / total;
6657
- const onePct = totalOne / total;
6658
- const twoPct = totalTwo / total;
6659
- 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;
6660
6799
  }
6661
6800
  var MONTH_MS = 1e3 * 60 * 60 * 24 * 30;
6662
6801
  function eolScore(projects) {
@@ -6704,15 +6843,6 @@ function eolScore(projects) {
6704
6843
  }
6705
6844
  return score;
6706
6845
  }
6707
- function freshnessScore(projects) {
6708
- const aggs = projects.map((p) => p.libyears).filter((a) => !!a);
6709
- if (aggs.length === 0) return null;
6710
- const total = aggs.reduce((s, a) => s + a.total, 0);
6711
- const measured = aggs.reduce((s, a) => s + a.measured, 0);
6712
- const max = aggs.reduce((m, a) => Math.max(m, a.max), 0);
6713
- if (measured === 0) return null;
6714
- return freshnessScoreFromLibyears({ total, max, measured });
6715
- }
6716
6846
  function coverageConfidence(projects) {
6717
6847
  let known = 0;
6718
6848
  let unknown = 0;
@@ -6729,13 +6859,11 @@ function computeDriftScore(projects) {
6729
6859
  const fs9 = frameworkScore(projects);
6730
6860
  const ds = dependencyScore(projects);
6731
6861
  const es = eolScore(projects);
6732
- const frs = freshnessScore(projects);
6733
6862
  const components = [
6734
6863
  { score: rs, weight: 0.25 },
6735
6864
  { score: fs9, weight: 0.25 },
6736
6865
  { score: ds, weight: 0.3 },
6737
- { score: es, weight: 0.2 },
6738
- { score: frs, weight: 0.15 }
6866
+ { score: es, weight: 0.2 }
6739
6867
  ];
6740
6868
  const confidence = coverageConfidence(projects) ?? void 0;
6741
6869
  const toDrift = (health2) => 100 - health2;
@@ -6746,7 +6874,6 @@ function computeDriftScore(projects) {
6746
6874
  dependencyScore: toDrift(Math.round(ds ?? 100)),
6747
6875
  eolScore: toDrift(Math.round(es ?? 100))
6748
6876
  };
6749
- if (frs !== null) c.freshnessScore = toDrift(Math.round(frs));
6750
6877
  return c;
6751
6878
  };
6752
6879
  const active = components.filter((c) => c.score !== null);
@@ -6774,7 +6901,6 @@ function computeDriftScore(projects) {
6774
6901
  if (fs9 !== null) measured.push("framework");
6775
6902
  if (ds !== null) measured.push("dependency");
6776
6903
  if (es !== null) measured.push("eol");
6777
- if (frs !== null) measured.push("freshness");
6778
6904
  return {
6779
6905
  score,
6780
6906
  riskLevel,
@@ -7264,14 +7390,14 @@ function formatExtended(ext) {
7264
7390
  }
7265
7391
  }
7266
7392
  if (ext.tsModernity && ext.tsModernity.typescriptVersion) {
7267
- const ts2 = ext.tsModernity;
7393
+ const ts = ext.tsModernity;
7268
7394
  lines.push(chalk3.bold.underline(" TypeScript"));
7269
7395
  const parts = [];
7270
- parts.push(`v${ts2.typescriptVersion}`);
7271
- if (ts2.strict === true) parts.push(chalk3.green("strict \u2714"));
7272
- else if (ts2.strict === false) parts.push(chalk3.yellow("strict \u2716"));
7273
- if (ts2.moduleType) parts.push(ts2.moduleType.toUpperCase());
7274
- if (ts2.target) parts.push(`target: ${ts2.target}`);
7396
+ parts.push(`v${ts.typescriptVersion}`);
7397
+ if (ts.strict === true) parts.push(chalk3.green("strict \u2714"));
7398
+ else if (ts.strict === false) parts.push(chalk3.yellow("strict \u2716"));
7399
+ if (ts.moduleType) parts.push(ts.moduleType.toUpperCase());
7400
+ if (ts.target) parts.push(`target: ${ts.target}`);
7275
7401
  lines.push(` ${parts.join(chalk3.dim(" \xB7 "))}`);
7276
7402
  lines.push("");
7277
7403
  }
@@ -7346,6 +7472,26 @@ function formatExtended(ext) {
7346
7472
  }
7347
7473
  lines.push("");
7348
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
+ }
7349
7495
  if (ext.dependencyGraph) {
7350
7496
  const dg = ext.dependencyGraph;
7351
7497
  if (dg.lockfileType) {
@@ -7851,11 +7997,19 @@ var CONFIG_FILES = [
7851
7997
  "vibgrate.config.json"
7852
7998
  ];
7853
7999
  var TRUSTED_CONFIG_ENV = "VIBGRATE_TRUST_CONFIG";
8000
+ var tsPromise = null;
8001
+ function loadTypeScript() {
8002
+ tsPromise ??= import('typescript').then((m) => {
8003
+ const mod = m;
8004
+ return mod.default ?? m;
8005
+ });
8006
+ return tsPromise;
8007
+ }
7854
8008
  function isRecord(value) {
7855
8009
  return typeof value === "object" && value !== null && !Array.isArray(value);
7856
8010
  }
7857
- function toStaticValue(expr, constBindings) {
7858
- if (ts.isParenthesizedExpression(expr)) return toStaticValue(expr.expression, constBindings);
8011
+ function toStaticValue(expr, constBindings, ts) {
8012
+ if (ts.isParenthesizedExpression(expr)) return toStaticValue(expr.expression, constBindings, ts);
7859
8013
  if (ts.isStringLiteralLike(expr)) return expr.text;
7860
8014
  if (ts.isNumericLiteral(expr)) return Number(expr.text);
7861
8015
  if (expr.kind === ts.SyntaxKind.TrueKeyword) return true;
@@ -7864,7 +8018,7 @@ function toStaticValue(expr, constBindings) {
7864
8018
  if (ts.isArrayLiteralExpression(expr)) {
7865
8019
  return expr.elements.map((el) => {
7866
8020
  if (ts.isSpreadElement(el)) throw new Error("Spread not supported in static config arrays");
7867
- return toStaticValue(el, constBindings);
8021
+ return toStaticValue(el, constBindings, ts);
7868
8022
  });
7869
8023
  }
7870
8024
  if (ts.isObjectLiteralExpression(expr)) {
@@ -7880,18 +8034,19 @@ function toStaticValue(expr, constBindings) {
7880
8034
  if (key === null) {
7881
8035
  throw new Error("Unsupported object key in static config");
7882
8036
  }
7883
- out[key] = toStaticValue(prop.initializer, constBindings);
8037
+ out[key] = toStaticValue(prop.initializer, constBindings, ts);
7884
8038
  }
7885
8039
  return out;
7886
8040
  }
7887
8041
  if (ts.isIdentifier(expr)) {
7888
8042
  const bound = constBindings.get(expr.text);
7889
8043
  if (!bound) throw new Error(`Unknown identifier in static config: ${expr.text}`);
7890
- return toStaticValue(bound, constBindings);
8044
+ return toStaticValue(bound, constBindings, ts);
7891
8045
  }
7892
8046
  throw new Error("Non-static expression in config");
7893
8047
  }
7894
- function tryParseStaticConfig(text, configPath) {
8048
+ async function tryParseStaticConfig(text, configPath) {
8049
+ const ts = await loadTypeScript();
7895
8050
  const scriptKind = configPath.endsWith(".ts") ? ts.ScriptKind.TS : ts.ScriptKind.JS;
7896
8051
  const source = ts.createSourceFile(configPath, text, ts.ScriptTarget.ESNext, true, scriptKind);
7897
8052
  const constBindings = /* @__PURE__ */ new Map();
@@ -7906,7 +8061,7 @@ function tryParseStaticConfig(text, configPath) {
7906
8061
  }
7907
8062
  for (const stmt of source.statements) {
7908
8063
  if (!ts.isExportAssignment(stmt)) continue;
7909
- const parsed = toStaticValue(stmt.expression, constBindings);
8064
+ const parsed = toStaticValue(stmt.expression, constBindings, ts);
7910
8065
  if (!isRecord(parsed)) return null;
7911
8066
  return { ...DEFAULT_CONFIG, ...parsed };
7912
8067
  }
@@ -7943,7 +8098,7 @@ async function loadConfig(rootDir) {
7943
8098
  const txt = await readTextFile(configPath);
7944
8099
  let staticConfig = null;
7945
8100
  try {
7946
- staticConfig = tryParseStaticConfig(txt, configPath);
8101
+ staticConfig = await tryParseStaticConfig(txt, configPath);
7947
8102
  } catch {
7948
8103
  staticConfig = null;
7949
8104
  }
@@ -8227,7 +8382,7 @@ var ROBOT = [
8227
8382
  function getBrand(version) {
8228
8383
  return [
8229
8384
  chalk3.bold.white(" V I B G R A T E"),
8230
- chalk3.dim(` Code Intelligence Engine`) + chalk3.dim(` v${version}`)
8385
+ chalk3.dim(` Drift Intelligence Engine`) + chalk3.dim(` v${version}`)
8231
8386
  ];
8232
8387
  }
8233
8388
  var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
@@ -11135,6 +11290,20 @@ function dedupeRoutes(routes) {
11135
11290
  }
11136
11291
  var gzip2 = promisify(zlib.gzip);
11137
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
+ }
11138
11307
  function extractName(entry) {
11139
11308
  const match = entry.match(/^(.+?)\s*\(/);
11140
11309
  return match ? match[1].trim() : entry.trim();
@@ -11200,7 +11369,29 @@ function compactAssetBranding(result) {
11200
11369
  // Don't include logos
11201
11370
  };
11202
11371
  }
11203
- 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) {
11204
11395
  const compacted = { ...artifact };
11205
11396
  if (compacted.extended) {
11206
11397
  const ext = { ...compacted.extended };
@@ -11276,6 +11467,9 @@ function prepareArtifactForUpload(artifact) {
11276
11467
  duplicatedPackages: ext.dependencyGraph.duplicatedPackages.slice(0, MAX_ITEMS)
11277
11468
  };
11278
11469
  }
11470
+ if (ext.databaseSchema) {
11471
+ ext.databaseSchema = compactDatabaseSchema(ext.databaseSchema, opts?.databaseSchemaCaps);
11472
+ }
11279
11473
  compacted.extended = ext;
11280
11474
  }
11281
11475
  return compacted;
@@ -11284,8 +11478,8 @@ async function compressArtifact(artifact) {
11284
11478
  const json = JSON.stringify(artifact);
11285
11479
  return gzip2(json, { level: 9 });
11286
11480
  }
11287
- async function prepareCompressedUpload(artifact) {
11288
- const compacted = prepareArtifactForUpload(artifact);
11481
+ async function prepareCompressedUpload(artifact, opts) {
11482
+ const compacted = prepareArtifactForUpload(artifact, opts);
11289
11483
  const compressed = await compressArtifact(compacted);
11290
11484
  return { body: compressed, contentEncoding: "gzip" };
11291
11485
  }
@@ -11314,6 +11508,48 @@ async function fetchScanPreflight(parsed, ingestHost, options) {
11314
11508
  }
11315
11509
  return body;
11316
11510
  }
11511
+
11512
+ // src/core-open/utils/symbols-preflight.ts
11513
+ var PROJECT_TYPE_TO_OSV_ECOSYSTEM = {
11514
+ node: "npm",
11515
+ typescript: "npm",
11516
+ dotnet: "NuGet",
11517
+ "visual-basic": "NuGet",
11518
+ python: "PyPI",
11519
+ ruby: "RubyGems",
11520
+ java: "Maven",
11521
+ kotlin: "Maven",
11522
+ scala: "Maven",
11523
+ groovy: "Maven",
11524
+ clojure: "Maven",
11525
+ go: "Go",
11526
+ rust: "crates.io",
11527
+ php: "Packagist",
11528
+ dart: "Pub",
11529
+ elixir: "Hex"
11530
+ };
11531
+ var MAX_DEPENDENCIES = 4e3;
11532
+ async function fetchRiskySymbols(parsed, ingestHost, dependencies) {
11533
+ const url = `${parsed.scheme}://${ingestHost}/v1/ingest/scan/preflight/symbols`;
11534
+ const body = JSON.stringify({
11535
+ schemaVersion: "1",
11536
+ dependencies: dependencies.slice(0, MAX_DEPENDENCIES)
11537
+ });
11538
+ const response = await fetch(url, {
11539
+ method: "POST",
11540
+ headers: {
11541
+ "Content-Type": "application/json",
11542
+ "X-Vibgrate-Timestamp": String(Date.now()),
11543
+ Authorization: `VibgrateDSN ${parsed.keyId}:${parsed.secret}`
11544
+ },
11545
+ body
11546
+ });
11547
+ const payload = await response.json();
11548
+ if (!response.ok && payload.status !== "error") {
11549
+ throw new Error(`HTTP ${response.status}: ${JSON.stringify(payload)}`);
11550
+ }
11551
+ return payload;
11552
+ }
11317
11553
  var SKIP_DIRS2 = /* @__PURE__ */ new Set([
11318
11554
  "node_modules",
11319
11555
  ".git",
@@ -11417,6 +11653,6 @@ async function writeTextFile2(filePath, content) {
11417
11653
  await fs2.writeFile(filePath, content, "utf8");
11418
11654
  }
11419
11655
 
11420
- export { VERSION, brandProgressBar, buildVersionTimelines, compactUiPurpose, computeDriftScore, computeRepoFingerprint, computeUpgradeImpact, detectVcs, driftBar, ensureDir2 as ensureDir, 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 };
11421
- //# sourceMappingURL=chunk-2PCL4ZME.js.map
11422
- //# sourceMappingURL=chunk-2PCL4ZME.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