@vibgrate/cli 2026.720.3 → 2026.720.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.
@@ -0,0 +1,6 @@
1
+ export { baselineCommand, runBaseline } from './chunk-ULAYELSU.js';
2
+ import './chunk-RAQBGOP5.js';
3
+ import './chunk-RXP66R2E.js';
4
+ import './chunk-GI6W53LM.js';
5
+ //# sourceMappingURL=baseline-YJT32DP2.js.map
6
+ //# sourceMappingURL=baseline-YJT32DP2.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"baseline-FALF7ULT.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"baseline-YJT32DP2.js"}
@@ -1,5 +1,5 @@
1
1
  import { hashString, langById, shortId, canonicalize, grammarSetVersion, hashBytes, langForExtension, setGrammarsOverride, parseSource } from './chunk-BHA7QIPD.js';
2
- import { writeTextFile, pathExists, readJsonFile, loadConfig, computeUpgradeImpact, getChangelogSignals, gitHistoryAvailable, buildVersionTimelines, findPackageTimeline, severityRank, projectTypeToVulnEcosystem, VERSION } from './chunk-B6ZWB3WH.js';
2
+ import { writeTextFile, pathExists, readJsonFile, loadConfig, computeUpgradeImpact, getChangelogSignals, gitHistoryAvailable, buildVersionTimelines, findPackageTimeline, severityRank, projectTypeToVulnEcosystem, VERSION } from './chunk-RAQBGOP5.js';
3
3
  import * as fs17 from 'fs';
4
4
  import { spawnSync, execFileSync } from 'child_process';
5
5
  import * as path17 from 'path';
@@ -5665,13 +5665,19 @@ var ROW_CAP = 1e4;
5665
5665
  async function scanCandidates(root, files, needle, opts) {
5666
5666
  const needleLower = needle.toLowerCase();
5667
5667
  if (!needleLower || files.length === 0) return { hits: [], total: 0, truncated: false };
5668
- if (!opts.collectAll) return scanInline(root, files, needleLower, opts.budget, true, void 0);
5669
5668
  if (files.length < PARALLEL_MIN_FILES && !process.env.VG_PARALLEL_MIN_BYTES) {
5670
- return scanInline(root, files, needleLower, ROW_CAP, false, void 0);
5669
+ return opts.collectAll ? scanInline(root, files, needleLower, ROW_CAP, false, void 0) : scanInline(root, files, needleLower, opts.budget, true, void 0);
5671
5670
  }
5672
5671
  const { over, sizes } = measure(root, files);
5673
- if (!over) return scanInline(root, files, needleLower, ROW_CAP, false, sizes);
5674
- return scanParallel(root, files, needleLower);
5672
+ if (!over) {
5673
+ return opts.collectAll ? scanInline(root, files, needleLower, ROW_CAP, false, sizes) : scanInline(root, files, needleLower, opts.budget, true, sizes);
5674
+ }
5675
+ const out = await scanParallel(root, files, needleLower);
5676
+ if (!opts.collectAll && out.hits.length > opts.budget) {
5677
+ out.hits.length = opts.budget;
5678
+ out.truncated = true;
5679
+ }
5680
+ return out;
5675
5681
  }
5676
5682
  function parallelMinBytes() {
5677
5683
  const v = Number(process.env.VG_PARALLEL_MIN_BYTES);
@@ -5802,8 +5808,70 @@ function runWorker(root, files, needleLower) {
5802
5808
  }
5803
5809
 
5804
5810
  // src/engine/search.ts
5805
- var IGNORE_DIRS = /* @__PURE__ */ new Set([".git", ".vibgrate", "node_modules", "dist", "build", "out", "target", "vendor", "__pycache__"]);
5811
+ var IGNORE_DIRS = /* @__PURE__ */ new Set([
5812
+ ".git",
5813
+ ".vibgrate",
5814
+ "node_modules",
5815
+ "dist",
5816
+ "build",
5817
+ "out",
5818
+ "target",
5819
+ "vendor",
5820
+ "__pycache__",
5821
+ // .NET intermediate output and coverage reports: purely generated trees that a
5822
+ // C#/coverage-heavy repo pays for on every literal sweep. `bin` is deliberately
5823
+ // NOT here — plenty of repos keep real scripts in bin/ (rails, node CLIs), and
5824
+ // completeness beats speed; the binary-extension skip below keeps a .NET bin/
5825
+ // cheap anyway.
5826
+ "obj",
5827
+ "coverage"
5828
+ ]);
5806
5829
  var MAX_FILES_SCANNED = 2e4;
5830
+ var BINARY_EXTS = /* @__PURE__ */ new Set([
5831
+ ".dll",
5832
+ ".pdb",
5833
+ ".exe",
5834
+ ".so",
5835
+ ".dylib",
5836
+ ".a",
5837
+ ".lib",
5838
+ ".o",
5839
+ ".class",
5840
+ ".jar",
5841
+ ".wasm",
5842
+ ".node",
5843
+ ".png",
5844
+ ".jpg",
5845
+ ".jpeg",
5846
+ ".gif",
5847
+ ".webp",
5848
+ ".ico",
5849
+ ".icns",
5850
+ ".bmp",
5851
+ ".zip",
5852
+ ".gz",
5853
+ ".tgz",
5854
+ ".bz2",
5855
+ ".xz",
5856
+ ".7z",
5857
+ ".rar",
5858
+ ".woff",
5859
+ ".woff2",
5860
+ ".ttf",
5861
+ ".otf",
5862
+ ".eot",
5863
+ ".mp3",
5864
+ ".mp4",
5865
+ ".mov",
5866
+ ".avi",
5867
+ ".pdf"
5868
+ ]);
5869
+ function hasBinaryExt(rel2) {
5870
+ return BINARY_EXTS.has(path17.extname(rel2).toLowerCase());
5871
+ }
5872
+ function toPosix2(rel2) {
5873
+ return path17.sep === "\\" ? rel2.replaceAll("\\", "/") : rel2;
5874
+ }
5807
5875
  async function searchSymbols(graph, root, query, limit) {
5808
5876
  const q2 = query.trim();
5809
5877
  if (!q2) return { matches: [], moreAvailable: false, hint: "query is required" };
@@ -5828,7 +5896,8 @@ async function searchSymbols(graph, root, query, limit) {
5828
5896
  const textHits = [];
5829
5897
  let truncatedScan = false;
5830
5898
  let totalTextMatches;
5831
- if (spare > 0) {
5899
+ const skipScan = !isPhrase && hasExactSymbolMatch(nodes, q2);
5900
+ if (spare > 0 && !skipScan) {
5832
5901
  const seen = new Set(symbolHits.map((h) => `${h.file}:${h.line}`));
5833
5902
  const scan = await scanFiles(root, q2, spare, seen, textHits, isPhrase);
5834
5903
  truncatedScan = scan.truncated;
@@ -5851,6 +5920,12 @@ async function searchSymbols(graph, root, query, limit) {
5851
5920
  }
5852
5921
  return result;
5853
5922
  }
5923
+ function hasExactSymbolMatch(nodes, q2) {
5924
+ if (nodes.length === 0) return false;
5925
+ if (/^(.*):(\d+)$/.test(q2)) return true;
5926
+ const lower = q2.toLowerCase();
5927
+ return nodes.some((n) => n.id === q2 || n.qualifiedName.toLowerCase() === lower || n.name.toLowerCase() === lower);
5928
+ }
5854
5929
  function queryTokens(q2) {
5855
5930
  return [...new Set(q2.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length >= 2))];
5856
5931
  }
@@ -5889,7 +5964,23 @@ async function scanFiles(root, needle, budget, seen, out, countAll) {
5889
5964
  return { total: outcome.total - overlap, truncated: listing.truncated || outcome.truncated };
5890
5965
  }
5891
5966
  function listCandidateFiles(root, needle) {
5892
- return ripgrepCandidates(root, needle) ?? walkCandidates(root);
5967
+ return ripgrepCandidates(root, needle) ?? walkCandidatesCached(root);
5968
+ }
5969
+ var LISTING_TTL_MS = 2e3;
5970
+ var listingCache = /* @__PURE__ */ new Map();
5971
+ function listingTtlMs() {
5972
+ const v = Number(process.env.VG_LISTING_TTL_MS);
5973
+ return Number.isFinite(v) && v >= 0 ? v : LISTING_TTL_MS;
5974
+ }
5975
+ function walkCandidatesCached(root) {
5976
+ const ttl = listingTtlMs();
5977
+ if (ttl > 0) {
5978
+ const hit = listingCache.get(root);
5979
+ if (hit && Date.now() - hit.at < ttl) return hit.listing;
5980
+ }
5981
+ const listing = walkCandidates(root);
5982
+ if (ttl > 0) listingCache.set(root, { listing, at: Date.now() });
5983
+ return listing;
5893
5984
  }
5894
5985
  function walkCandidates(root) {
5895
5986
  const files = [];
@@ -5910,11 +6001,12 @@ function walkCandidates(root) {
5910
6001
  stack.push(abs);
5911
6002
  continue;
5912
6003
  }
6004
+ if (hasBinaryExt(e.name)) continue;
5913
6005
  if (files.length >= MAX_FILES_SCANNED) {
5914
6006
  truncated = true;
5915
6007
  continue;
5916
6008
  }
5917
- files.push(path17.relative(root, abs));
6009
+ files.push(toPosix2(path17.relative(root, abs)));
5918
6010
  }
5919
6011
  }
5920
6012
  files.sort();
@@ -5941,17 +6033,23 @@ function ripgrepCandidates(root, needle) {
5941
6033
  { cwd: root, encoding: "utf8", timeout: 15e3, maxBuffer: 32 * 1024 * 1024 }
5942
6034
  );
5943
6035
  if (res.error || res.status !== 0 && res.status !== 1 || res.signal) return null;
6036
+ const files = parseRgFileList(res.stdout);
6037
+ if (files.length > MAX_FILES_SCANNED) return { files: files.slice(0, MAX_FILES_SCANNED), truncated: true };
6038
+ return { files, truncated: false };
6039
+ }
6040
+ function parseRgFileList(stdout, sep10 = path17.sep) {
5944
6041
  const seen = /* @__PURE__ */ new Set();
5945
- for (const raw of res.stdout.split("\n")) {
5946
- const rel2 = raw.startsWith("./") ? raw.slice(2) : raw;
6042
+ for (const raw of stdout.split("\n")) {
6043
+ if (!raw) continue;
6044
+ const posix3 = sep10 === "\\" ? raw.replaceAll("\\", "/") : raw;
6045
+ const rel2 = posix3.startsWith("./") ? posix3.slice(2) : posix3;
5947
6046
  if (!rel2) continue;
5948
6047
  const segs = rel2.split("/");
5949
6048
  if (segs.some((s) => s.startsWith(".") || IGNORE_DIRS.has(s))) continue;
6049
+ if (hasBinaryExt(rel2)) continue;
5950
6050
  seen.add(rel2);
5951
6051
  }
5952
- const files = [...seen].sort();
5953
- if (files.length > MAX_FILES_SCANNED) return { files: files.slice(0, MAX_FILES_SCANNED), truncated: true };
5954
- return { files, truncated: false };
6052
+ return [...seen].sort();
5955
6053
  }
5956
6054
 
5957
6055
  // src/mcp/tools.ts
@@ -7113,7 +7211,7 @@ async function refreshIfStale(root, opts = {}) {
7113
7211
  }
7114
7212
  var LEDGER = "savings.jsonl";
7115
7213
  var PER_FILE_TOKENS = 400;
7116
- var SAVINGS_TOOLS = /* @__PURE__ */ new Set(["query_graph", "get_node"]);
7214
+ var SAVINGS_TOOLS = /* @__PURE__ */ new Set(["query_graph", "get_node", "search_symbols"]);
7117
7215
  var CLI_TOOL_ALIASES = {
7118
7216
  ask: "query_graph",
7119
7217
  show: "get_node",
@@ -7682,5 +7780,5 @@ function spdx(ctx) {
7682
7780
  }
7683
7781
 
7684
7782
  export { ASSISTANTS, CLI_TOOL_ALIASES, CliError, ECOSYSTEMS, ExitCode, FREE_PACK, GraphIndex, GraphSource, NPX_INVOCATION, ResourceLimitError, SAVINGS_TOOLS, SCHEMA_VERSION, SKIP_DIRS, SKIP_FILES, SMALL_REPO_FILES, TOOLS, UsageError, addLibrary, analyze, applyCoverage, applyStaticTestLinkage, assessDocQuality, assistantById, availableRegionIds, buildFacts, buildGraph, buildModuleResolver, cacheDir, catalogPath, clearModelCache, clearStoredCredentials, cosine, countPending, countTokens, coveringTests, createServer, createWorkspaceDsn, credentialsPath, dashHostForIngestHost, decodeScipIndex, defaultGraphPath, detectAssistants, detectRunner, detectServeLaunch, discover, discoverModels, driftCount, driftFor, dsnCommand, embeddingsCached, enrichOnline, ensureGitignored, epistemicBreakdown, exportGraph, fetchHostedDocsCached, findGitRoot, findNodes, formatForExt, getNodeEmbeddings, gitignoreEntryForCredentials, groundGraph, hasDrift, homeCredentialsPath, hostedBase, identifierParts, impactOf, indexFor, ingestHostForRegionId, installAssistant, inventory, isModelReady, isTestFile, libDir, libId, loadCatalog, loadCoverage, loadEmbedder, loadGraph, loadSnapshot, localApiSurface, localPackageDocs, modelCacheInfo, nodeById, nodeEmbedText, parseDsn, parseGraph, parseJsonc, probeFreshness, projectCredentialsPath, publishPrivateLibrary, pushCommand, queryGraph, queryGraphSemantic, readDoc, readSavings, readScanArtifact, readStoredCredentials, readUsage, recordCliCall, recordSaving, refreshIfStale, refreshInstalledInstructions, relativeResolver, renderHtml, renderReport, resolveCliInvocation, resolveDsn, resolveEmbedModel, resolveIngestHost, resolveLib, resolveLimits, resolveOne, resolveVersion, sanitizeClient, saveCatalog, savingsLedgerPath, savingsRecorded, scipEdges, selectForBudget, serializeGraph, serveStdio, shortestPath, stableStringify, symbolsFromApi, testsToRun, unavailableMessage, uninstallAssistant, uploadScanArtifact, usageError, verifyDeterminism, vibgrateDir, writeArtifacts, writeNavigationConfig, writeSnapshot, writeStoredCredentials };
7685
- //# sourceMappingURL=chunk-ZFDVHKID.js.map
7686
- //# sourceMappingURL=chunk-ZFDVHKID.js.map
7783
+ //# sourceMappingURL=chunk-AS7DIHZZ.js.map
7784
+ //# sourceMappingURL=chunk-AS7DIHZZ.js.map