@vibgrate/cli 2026.720.4 → 2026.721.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/DOCS.md CHANGED
@@ -621,6 +621,8 @@ Maps source code into a graph artifact, enabling all downstream queries (`vg sho
621
621
  | `--grammars <dir>` | — | Grammar `.wasm` directory for offline/air-gapped use |
622
622
  | `-o, --export <file>` | — | Also write the map to a file (format from extension) |
623
623
 
624
+ **Local by default — no git churn.** The first time vg writes into `.vibgrate/` it also creates `.vibgrate/.gitignore`, keeping the graph artifacts (`graph.json`, `graph.html`, `GRAPH_REPORT.md`, `facts.jsonl`, `mcp-navigation.json`) and the cache out of git — so builds, auto-refreshes, and MCP use never leave your branch dirty. Run `vg share` when you want the map committed for your team (it rewrites that ignore file). vg never touches an existing `.vibgrate/.gitignore`, so edit it (or leave it empty) to manage the ignores yourself.
625
+
624
626
  ---
625
627
 
626
628
  ### vg bundle
@@ -849,6 +851,7 @@ Reads the counts-only usage ledger recorded when you run `vg serve --savings` (o
849
851
  | Flag | Default | Description |
850
852
  |------|---------|-------------|
851
853
  | `--days <n>` | `30` | Reporting window in days |
854
+ | `--clear` | — | Delete the recorded usage data for this repo (the ledger under `.vibgrate/cache/`, plus the opt-in stats-share upload state and per-install id) |
852
855
 
853
856
  Add `--json` for machine-readable output.
854
857
 
@@ -902,7 +905,7 @@ Make the code map committable and auto-updating for your team.
902
905
  vg share
903
906
  ```
904
907
 
905
- Installs a pre-commit hook, deterministic merge driver, and `.gitignore` so the map stays fresh without any manual steps.
908
+ Installs a pre-commit hook, deterministic merge driver, and `.gitignore` so the map stays fresh without any manual steps. This rewrites the default `.vibgrate/.gitignore` (which ignores the graph artifacts, `graph.json` included) so `graph.json` is committed while the cache and volatile reports stay ignored.
906
909
 
907
910
  | Flag | Description |
908
911
  |------|-------------|
@@ -0,0 +1,6 @@
1
+ export { baselineCommand, runBaseline } from './chunk-FR72DKYF.js';
2
+ import './chunk-SHXV4VPX.js';
3
+ import './chunk-RXP66R2E.js';
4
+ import './chunk-GI6W53LM.js';
5
+ //# sourceMappingURL=baseline-3S5NKMBP.js.map
6
+ //# sourceMappingURL=baseline-3S5NKMBP.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"baseline-YJT32DP2.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"baseline-3S5NKMBP.js"}
@@ -1,5 +1,5 @@
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-RAQBGOP5.js';
1
+ import { hashString, langById, shortId, canonicalize, grammarSetVersion, hashBytes, langForExtension, setGrammarsOverride, parseSource } from './chunk-JWBS5GS6.js';
2
+ import { writeTextFile, pathExists, readJsonFile, loadConfig, computeUpgradeImpact, getChangelogSignals, gitHistoryAvailable, buildVersionTimelines, findPackageTimeline, severityRank, projectTypeToVulnEcosystem, VERSION } from './chunk-SHXV4VPX.js';
3
3
  import * as fs17 from 'fs';
4
4
  import { spawnSync, execFileSync } from 'child_process';
5
5
  import * as path17 from 'path';
@@ -2471,12 +2471,33 @@ function esc(s) {
2471
2471
  function vibgrateDir(root) {
2472
2472
  return path17.join(root, ".vibgrate");
2473
2473
  }
2474
+ var DEFAULT_GITIGNORE = [
2475
+ "# Created once by vg \u2014 local graph artifacts stay out of git by default.",
2476
+ "# Run `vg share` to commit the map for your team (it rewrites this file).",
2477
+ "# vg never touches an existing .vibgrate/.gitignore: edit it (or leave it",
2478
+ "# empty) to manage these ignores yourself.",
2479
+ ".gitignore",
2480
+ "cache/",
2481
+ "graph.json",
2482
+ "graph.html",
2483
+ "GRAPH_REPORT.md",
2484
+ "facts.jsonl",
2485
+ "mcp-navigation.json"
2486
+ ];
2487
+ function ensureVibgrateGitignore(root) {
2488
+ const file = path17.join(vibgrateDir(root), ".gitignore");
2489
+ if (fs17.existsSync(file)) return;
2490
+ fs17.mkdirSync(vibgrateDir(root), { recursive: true });
2491
+ fs17.writeFileSync(file, `${DEFAULT_GITIGNORE.join("\n")}
2492
+ `);
2493
+ }
2474
2494
  function defaultGraphPath(root) {
2475
2495
  return path17.join(vibgrateDir(root), "graph.json");
2476
2496
  }
2477
2497
  function writeArtifacts(graph, options) {
2478
2498
  const dir = vibgrateDir(options.root);
2479
2499
  fs17.mkdirSync(dir, { recursive: true });
2500
+ ensureVibgrateGitignore(options.root);
2480
2501
  const graphPath = options.graphPath ?? defaultGraphPath(options.root);
2481
2502
  fs17.mkdirSync(path17.dirname(graphPath), { recursive: true });
2482
2503
  const tmp = `${graphPath}.${process.pid}.tmp`;
@@ -5873,10 +5894,15 @@ function toPosix2(rel2) {
5873
5894
  return path17.sep === "\\" ? rel2.replaceAll("\\", "/") : rel2;
5874
5895
  }
5875
5896
  async function searchSymbols(graph, root, query, limit) {
5876
- const q2 = query.trim();
5897
+ let q2 = query.trim();
5877
5898
  if (!q2) return { matches: [], moreAvailable: false, hint: "query is required" };
5878
- const isPhrase = /\s/.test(q2);
5899
+ const quoted = /^(["'`])(.+)\1$/.exec(q2);
5900
+ if (quoted && quoted[2].trim()) q2 = quoted[2].trim();
5901
+ const isPhrase = Boolean(quoted) || /\s/.test(q2) || /[/\\]/.test(q2) && !q2.includes(":") && !/[*?]/.test(q2);
5879
5902
  let nodes = findNodes(graph, q2).filter((n) => n.kind !== "file");
5903
+ if (nodes.length === 0) {
5904
+ nodes = fileSymbolNodes(graph, q2);
5905
+ }
5880
5906
  if (nodes.length === 0 && isPhrase) {
5881
5907
  nodes = reconstructedIdentifierNodes(graph, q2);
5882
5908
  }
@@ -5920,6 +5946,14 @@ async function searchSymbols(graph, root, query, limit) {
5920
5946
  }
5921
5947
  return result;
5922
5948
  }
5949
+ function fileSymbolNodes(graph, q2) {
5950
+ if (!/[/\\]/.test(q2) && !/\.\w+$/.test(q2)) return [];
5951
+ const norm = q2.replaceAll("\\", "/").replace(/^\.\//, "");
5952
+ const inFile = graph.nodes.filter(
5953
+ (n) => n.kind !== "file" && (n.file === norm || n.file.endsWith(`/${norm}`))
5954
+ );
5955
+ return [...inFile].sort((a, b) => b.importance - a.importance || a.qualifiedName.localeCompare(b.qualifiedName));
5956
+ }
5923
5957
  function hasExactSymbolMatch(nodes, q2) {
5924
5958
  if (nodes.length === 0) return false;
5925
5959
  if (/^(.*):(\d+)$/.test(q2)) return true;
@@ -5938,16 +5972,22 @@ function reconstructedIdentifierNodes(graph, q2) {
5938
5972
  return snake.filter((n) => n.kind !== "file");
5939
5973
  }
5940
5974
  function multiTokenNodes(graph, tokens) {
5941
- const cov = /* @__PURE__ */ new Map();
5942
- for (const t of tokens) {
5943
- for (const n of findNodes(graph, t)) {
5944
- if (n.kind === "file") continue;
5945
- const e = cov.get(n.id);
5946
- if (e) e.hits++;
5947
- else cov.set(n.id, { node: n, hits: 1 });
5975
+ const scored = [];
5976
+ for (const n of graph.nodes) {
5977
+ if (n.kind === "file") continue;
5978
+ const name = n.name.toLowerCase();
5979
+ const qn = n.qualifiedName.toLowerCase();
5980
+ let hits = 0;
5981
+ let exact = false;
5982
+ for (const t of tokens) {
5983
+ if (name === t || qn === t) {
5984
+ hits++;
5985
+ exact = true;
5986
+ } else if (qn.includes(t)) hits++;
5948
5987
  }
5988
+ if (exact || hits >= 2) scored.push({ node: n, hits, exact });
5949
5989
  }
5950
- return [...cov.values()].sort((a, b) => b.hits - a.hits || b.node.importance - a.node.importance).map((e) => e.node);
5990
+ return scored.sort((a, b) => Number(b.exact) - Number(a.exact) || b.hits - a.hits || b.node.importance - a.node.importance || a.node.qualifiedName.localeCompare(b.node.qualifiedName)).map((e) => e.node);
5951
5991
  }
5952
5992
  async function scanFiles(root, needle, budget, seen, out, countAll) {
5953
5993
  const listing = listCandidateFiles(root, needle);
@@ -6168,7 +6208,7 @@ var TOOLS = [
6168
6208
  },
6169
6209
  {
6170
6210
  name: "search_symbols",
6171
- description: "Find a known name or literal string fast: ranked symbol lookup, plus a complete literal file-search for any quoted/multi-word phrase (config keys, log lines, UI copy). A phrase query reports totalTextMatches so you know you have every occurrence \u2014 use it instead of grep. Use first for most discovery; use query_graph for meaning.",
6211
+ description: 'Find a known name or literal string fast: ranked symbol lookup, plus a complete literal file-search for any quoted, multi-word, or path-like query (config keys, routes, log lines, UI copy). Quote a single name ("AddJwtBearer") to sweep every occurrence of it as text. A sweep reports totalTextMatches so you know you have every occurrence \u2014 use it instead of grep. Use first for most discovery; use query_graph for meaning.',
6172
6212
  inputSchema: obj(
6173
6213
  {
6174
6214
  query: { type: "string", maxLength: 120, description: "a symbol name, or a literal phrase to sweep for every occurrence of" },
@@ -7020,6 +7060,7 @@ function writeFileEnsured(file, content) {
7020
7060
  fs17.writeFileSync(file, content);
7021
7061
  }
7022
7062
  function writeNavigationConfig(root) {
7063
+ ensureVibgrateGitignore(root);
7023
7064
  const rel2 = path17.join(".vibgrate", "mcp-navigation.json");
7024
7065
  const doc = {
7025
7066
  _readme: "Deferred-loading config for agents embedding `vg serve` via the Claude API (defer_loading + tool-search). The hot navigation core stays in context; the rest load on demand \u2014 ~350-450 schema tokens/step vs ~1,881 for the full set. Hosts without defer_loading ignore this and serve the whole (already optimized) tool set. See docs/graph/VG-NAVIGATION-PROFILE.md.",
@@ -7249,6 +7290,13 @@ function ledgerPath(root) {
7249
7290
  function savingsRecorded(root) {
7250
7291
  return fs17.existsSync(ledgerPath(root));
7251
7292
  }
7293
+ function clearSavings(root) {
7294
+ const file = ledgerPath(root);
7295
+ const existed = fs17.existsSync(file);
7296
+ fs17.rmSync(file, { force: true });
7297
+ fs17.rmSync(path17.join(cacheDir(root), "stats-share.json"), { force: true });
7298
+ return existed;
7299
+ }
7252
7300
  function recordSaving(root, entry, now) {
7253
7301
  try {
7254
7302
  fs17.mkdirSync(cacheDir(root), { recursive: true });
@@ -7779,6 +7827,6 @@ function spdx(ctx) {
7779
7827
  return JSON.stringify(doc, null, 2) + "\n";
7780
7828
  }
7781
7829
 
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 };
7783
- //# sourceMappingURL=chunk-AS7DIHZZ.js.map
7784
- //# sourceMappingURL=chunk-AS7DIHZZ.js.map
7830
+ 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, clearSavings, 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 };
7831
+ //# sourceMappingURL=chunk-C4EDNPWN.js.map
7832
+ //# sourceMappingURL=chunk-C4EDNPWN.js.map