@vibgrate/cli 2026.718.2 → 2026.720.2
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 +2 -0
- package/dist/baseline-WIZAFIJS.js +6 -0
- package/dist/{baseline-DKPQWOQ6.js.map → baseline-WIZAFIJS.js.map} +1 -1
- package/dist/{chunk-H5M7CXE6.js → chunk-7R4O5CZD.js} +71 -25
- package/dist/chunk-7R4O5CZD.js.map +1 -0
- package/dist/{chunk-VFO5UDAT.js → chunk-BHA7QIPD.js} +185 -16
- package/dist/chunk-BHA7QIPD.js.map +1 -0
- package/dist/{chunk-BFXDF6ZE.js → chunk-DDQ5JGBV.js} +3 -3
- package/dist/{chunk-BFXDF6ZE.js.map → chunk-DDQ5JGBV.js.map} +1 -1
- package/dist/{chunk-RME7BFMU.js → chunk-OD5654VF.js} +3 -3
- package/dist/{chunk-RME7BFMU.js.map → chunk-OD5654VF.js.map} +1 -1
- package/dist/cli.js +435 -111
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +132 -46
- package/dist/index.js +3 -3
- package/dist/parse-worker.js +1 -1
- package/grammars/tree-sitter-objc.wasm +0 -0
- package/grammars/tree-sitter-ocaml.wasm +0 -0
- package/grammars/tree-sitter-rescript.wasm +0 -0
- package/grammars/tree-sitter-solidity.wasm +0 -0
- package/package.json +9 -7
- package/dist/baseline-DKPQWOQ6.js +0 -6
- package/dist/chunk-H5M7CXE6.js.map +0 -1
- package/dist/chunk-VFO5UDAT.js.map +0 -1
package/DOCS.md
CHANGED
|
@@ -874,6 +874,8 @@ vg serve
|
|
|
874
874
|
|
|
875
875
|
Via stdio (default), your AI assistant spawns the server. Via `--http`, it runs as a local HTTP endpoint for browser or shared access.
|
|
876
876
|
|
|
877
|
+
**A live status display shows what the server is doing for you.** While `vg serve` runs in a terminal, a status block on stderr updates in place: uptime, which AI clients are connected (detected from the MCP handshake), calls and average response time per tool, and — for the navigation tools with a grep/read baseline — the context tokens served vs the estimated tokens a grep-and-read agent would have burned instead, with the estimated saving labelled as such. Outside a terminal (when your assistant spawns the server) it degrades to a quiet one-line heartbeat in the server logs every 15 minutes, and only when there has been activity. The display is in-memory only and always on — nothing is written to disk or uploaded (recording and sharing below stay opt-in) — and `--quiet` turns it off.
|
|
878
|
+
|
|
877
879
|
**Usage stats — local by default, sharing is opt-in.** `--savings` records a *counts-only* ledger under `.vibgrate/` — per navigation call: which tool, how it resolved (complete/partial/miss), the vg-vs-grep token figures, whether it came over the MCP (`mcp`) or the `vg` CLI (`cli`), and a coarse client label (which AI). `vg savings` reports it locally; nothing leaves your machine. `--share-stats` additionally uploads that same counts-only ledger to Vibgrate periodically, so we can see how the local MCP is used and improve it. It **never** sends code, file paths, question text, repo identity, or any credential — only counts, outcomes, token figures, the vg version, your OS/arch, and a random per-install id. It's off unless you pass the flag, is disabled entirely under `--local`, and the endpoint can be overridden with `VIBGRATE_STATS_ENDPOINT`.
|
|
878
880
|
|
|
879
881
|
**Attributing CLI calls.** The MCP path detects the calling client automatically from the connection handshake. For CLI calls, pass `--client=<ai>` (e.g. `vg "how does auth work" --client=claude`) so the call is attributed in `vg savings` and any shared stats — this is what `vg install` writes into each assistant's skill. Without `--client`, a bare `vg ask` records nothing.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"baseline-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"baseline-WIZAFIJS.js"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { hashString, langById, shortId, canonicalize, grammarSetVersion, hashBytes, langForExtension, setGrammarsOverride, parseSource } from './chunk-
|
|
2
|
-
import { writeTextFile, pathExists, readJsonFile, loadConfig, computeUpgradeImpact, getChangelogSignals, gitHistoryAvailable, buildVersionTimelines, findPackageTimeline, severityRank, projectTypeToVulnEcosystem, VERSION } from './chunk-
|
|
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-OD5654VF.js';
|
|
3
3
|
import * as fs19 from 'fs';
|
|
4
4
|
import { spawnSync, execFileSync } from 'child_process';
|
|
5
5
|
import * as path19 from 'path';
|
|
@@ -336,7 +336,7 @@ function formatBytes(n) {
|
|
|
336
336
|
if (n >= 1024) return `${(n / 1024).toFixed(1)} KiB`;
|
|
337
337
|
return `${n} B`;
|
|
338
338
|
}
|
|
339
|
-
var JS_TS_EXT = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
|
|
339
|
+
var JS_TS_EXT = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs", ".vue", ".svelte", ".astro"];
|
|
340
340
|
var OTHER_EXT = [
|
|
341
341
|
".py",
|
|
342
342
|
".pyi",
|
|
@@ -365,7 +365,13 @@ var OTHER_EXT = [
|
|
|
365
365
|
".hpp",
|
|
366
366
|
".hh",
|
|
367
367
|
".hxx",
|
|
368
|
-
".h"
|
|
368
|
+
".h",
|
|
369
|
+
".m",
|
|
370
|
+
".mm",
|
|
371
|
+
".ml",
|
|
372
|
+
".mli",
|
|
373
|
+
".res",
|
|
374
|
+
".sol"
|
|
369
375
|
];
|
|
370
376
|
var EXT_GROUPS = {
|
|
371
377
|
".py": [".py", ".pyi"],
|
|
@@ -399,7 +405,19 @@ Object.assign(EXT_GROUPS, {
|
|
|
399
405
|
".hpp": CPP_EXT,
|
|
400
406
|
".hh": CPP_EXT,
|
|
401
407
|
".hxx": CPP_EXT,
|
|
402
|
-
".h": [...CPP_EXT, ".c"]
|
|
408
|
+
".h": [...CPP_EXT, ".c"],
|
|
409
|
+
// ObjC #imports headers; ObjC++ additionally reaches C++ headers.
|
|
410
|
+
".m": [".h", ".m", ".mm"],
|
|
411
|
+
".mm": [".h", ".m", ".mm", ...CPP_EXT],
|
|
412
|
+
".ml": [".ml", ".mli"],
|
|
413
|
+
".mli": [".ml", ".mli"],
|
|
414
|
+
".res": [".res"],
|
|
415
|
+
".sol": [".sol"],
|
|
416
|
+
// Template containers: ERB fragments are Ruby; HTML/EJS script is JS.
|
|
417
|
+
".erb": [".rb", ".erb"],
|
|
418
|
+
".html": JS_TS_EXT,
|
|
419
|
+
".htm": JS_TS_EXT,
|
|
420
|
+
".ejs": JS_TS_EXT
|
|
403
421
|
});
|
|
404
422
|
function buildModuleResolver(root, relSet) {
|
|
405
423
|
const probe = makeProbe(relSet);
|
|
@@ -3372,9 +3390,12 @@ function recordCliCall(root, entry, now) {
|
|
|
3372
3390
|
now
|
|
3373
3391
|
);
|
|
3374
3392
|
}
|
|
3375
|
-
function
|
|
3393
|
+
function savingsLedgerPath(root) {
|
|
3376
3394
|
return path19.join(cacheDir(root), LEDGER);
|
|
3377
3395
|
}
|
|
3396
|
+
function ledgerPath(root) {
|
|
3397
|
+
return savingsLedgerPath(root);
|
|
3398
|
+
}
|
|
3378
3399
|
function savingsRecorded(root) {
|
|
3379
3400
|
return fs19.existsSync(ledgerPath(root));
|
|
3380
3401
|
}
|
|
@@ -3445,6 +3466,7 @@ function readUsage(root, days, now) {
|
|
|
3445
3466
|
const byTool = /* @__PURE__ */ new Map();
|
|
3446
3467
|
const bySource = /* @__PURE__ */ new Map();
|
|
3447
3468
|
const byClient = /* @__PURE__ */ new Map();
|
|
3469
|
+
const msByTool = /* @__PURE__ */ new Map();
|
|
3448
3470
|
const bump2 = (m, key, outcome) => {
|
|
3449
3471
|
const row = m.get(key) ?? { complete: 0, partial: 0, miss: 0 };
|
|
3450
3472
|
row[outcome]++;
|
|
@@ -3460,18 +3482,28 @@ function readUsage(root, days, now) {
|
|
|
3460
3482
|
bump2(byTool, e.tool, outcome);
|
|
3461
3483
|
bump2(bySource, e.source ?? "mcp", outcome);
|
|
3462
3484
|
bump2(byClient, e.client ?? "unknown", outcome);
|
|
3485
|
+
if (typeof e.ms === "number" && e.ms >= 0) {
|
|
3486
|
+
const timing = msByTool.get(e.tool) ?? { sum: 0, n: 0 };
|
|
3487
|
+
timing.sum += e.ms;
|
|
3488
|
+
timing.n++;
|
|
3489
|
+
msByTool.set(e.tool, timing);
|
|
3490
|
+
}
|
|
3463
3491
|
} catch {
|
|
3464
3492
|
}
|
|
3465
3493
|
}
|
|
3466
3494
|
}
|
|
3467
|
-
const commands = toDimensionStats(byTool).map((d) =>
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3495
|
+
const commands = toDimensionStats(byTool).map((d) => {
|
|
3496
|
+
const timing = msByTool.get(d.key);
|
|
3497
|
+
return {
|
|
3498
|
+
tool: d.key,
|
|
3499
|
+
calls: d.calls,
|
|
3500
|
+
complete: d.complete,
|
|
3501
|
+
partial: d.partial,
|
|
3502
|
+
miss: d.miss,
|
|
3503
|
+
successPct: d.successPct,
|
|
3504
|
+
avgMs: timing && timing.n > 0 ? Math.round(timing.sum / timing.n) : null
|
|
3505
|
+
};
|
|
3506
|
+
});
|
|
3475
3507
|
const totals = commands.reduce(
|
|
3476
3508
|
(t, c) => ({
|
|
3477
3509
|
calls: t.calls + c.calls,
|
|
@@ -6878,7 +6910,7 @@ var GraphSource = class {
|
|
|
6878
6910
|
}
|
|
6879
6911
|
};
|
|
6880
6912
|
function createServer(source, opts = {}) {
|
|
6881
|
-
const { savings = false, shareStats = false, local = false, dedup = false } = opts;
|
|
6913
|
+
const { savings = false, shareStats = false, local = false, dedup = false, stats } = opts;
|
|
6882
6914
|
const record = savings || shareStats;
|
|
6883
6915
|
const root = path19.dirname(path19.dirname(source.graphPath));
|
|
6884
6916
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -6913,12 +6945,23 @@ function createServer(source, opts = {}) {
|
|
|
6913
6945
|
"no code map found. Run `vg` in the project to build .vibgrate/graph.json, then retry."
|
|
6914
6946
|
);
|
|
6915
6947
|
}
|
|
6948
|
+
const startedAt = Date.now();
|
|
6916
6949
|
try {
|
|
6917
6950
|
const args = request.params.arguments ?? {};
|
|
6918
6951
|
const result = await tool.handler(graph, args, { root, local, dedup, seen });
|
|
6919
|
-
|
|
6952
|
+
const ms = Date.now() - startedAt;
|
|
6953
|
+
stats?.record({ ...measureCall(tool.name, result), client: sanitizeClient(detectClient(server)), ms });
|
|
6954
|
+
if (record) recordUsage(root, tool.name, result, detectClient(server), ms);
|
|
6920
6955
|
return renderToolResult(result);
|
|
6921
6956
|
} catch (err) {
|
|
6957
|
+
stats?.record({
|
|
6958
|
+
tool: tool.name,
|
|
6959
|
+
client: sanitizeClient(detectClient(server)),
|
|
6960
|
+
outcome: "miss",
|
|
6961
|
+
ms: Date.now() - startedAt,
|
|
6962
|
+
vgTokens: 0,
|
|
6963
|
+
baselineTokens: 0
|
|
6964
|
+
});
|
|
6922
6965
|
return errorResult(`tool "${tool.name}" failed: ${err.message}`);
|
|
6923
6966
|
}
|
|
6924
6967
|
});
|
|
@@ -6936,7 +6979,14 @@ function sleep(ms) {
|
|
|
6936
6979
|
timer.unref?.();
|
|
6937
6980
|
});
|
|
6938
6981
|
}
|
|
6939
|
-
function recordUsage(root, tool, result, client) {
|
|
6982
|
+
function recordUsage(root, tool, result, client, ms) {
|
|
6983
|
+
recordSaving(
|
|
6984
|
+
root,
|
|
6985
|
+
{ ...measureCall(tool, result), source: "mcp", client: sanitizeClient(client), ...ms !== void 0 ? { ms } : {} },
|
|
6986
|
+
Date.now()
|
|
6987
|
+
);
|
|
6988
|
+
}
|
|
6989
|
+
function measureCall(tool, result) {
|
|
6940
6990
|
const outcome = classifyOutcome(result);
|
|
6941
6991
|
let vgTokens = 0;
|
|
6942
6992
|
let baselineTokens = 0;
|
|
@@ -6944,11 +6994,7 @@ function recordUsage(root, tool, result, client) {
|
|
|
6944
6994
|
vgTokens = countTokens(renderedText(renderToolResult(result)));
|
|
6945
6995
|
baselineTokens = referencedFiles(result).size * PER_FILE_TOKENS;
|
|
6946
6996
|
}
|
|
6947
|
-
|
|
6948
|
-
root,
|
|
6949
|
-
{ tool, outcome, vgTokens, baselineTokens, source: "mcp", client: sanitizeClient(client) },
|
|
6950
|
-
Date.now()
|
|
6951
|
-
);
|
|
6997
|
+
return { tool, outcome, vgTokens, baselineTokens };
|
|
6952
6998
|
}
|
|
6953
6999
|
function detectClient(server) {
|
|
6954
7000
|
try {
|
|
@@ -7564,6 +7610,6 @@ function spdx(ctx) {
|
|
|
7564
7610
|
return JSON.stringify(doc, null, 2) + "\n";
|
|
7565
7611
|
}
|
|
7566
7612
|
|
|
7567
|
-
export { ASSISTANTS, CLI_TOOL_ALIASES, CliError, ECOSYSTEMS, ExitCode, FREE_PACK, GraphIndex, GraphSource, NPX_INVOCATION, ResourceLimitError, SCHEMA_VERSION, SKIP_DIRS, SKIP_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, relativeResolver, renderHtml, renderReport, resolveCliInvocation, resolveDsn, resolveEmbedModel, resolveIngestHost, resolveLib, resolveLimits, resolveOne, resolveVersion, saveCatalog, savingsRecorded, scipEdges, selectForBudget, serializeGraph, serveStdio, shortestPath, stableStringify, symbolsFromApi, testsToRun, unavailableMessage, uninstallAssistant, uploadScanArtifact, usageError, verifyDeterminism, vibgrateDir, writeArtifacts, writeNavigationConfig, writeSnapshot, writeStoredCredentials };
|
|
7568
|
-
//# sourceMappingURL=chunk-
|
|
7569
|
-
//# sourceMappingURL=chunk-
|
|
7613
|
+
export { ASSISTANTS, CLI_TOOL_ALIASES, CliError, ECOSYSTEMS, ExitCode, FREE_PACK, GraphIndex, GraphSource, NPX_INVOCATION, ResourceLimitError, SAVINGS_TOOLS, SCHEMA_VERSION, SKIP_DIRS, SKIP_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, 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 };
|
|
7614
|
+
//# sourceMappingURL=chunk-7R4O5CZD.js.map
|
|
7615
|
+
//# sourceMappingURL=chunk-7R4O5CZD.js.map
|