@vibgrate/cli 2026.708.1 → 2026.708.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/dist/baseline-AMQ7VEB5.js +6 -0
- package/dist/{baseline-RRO4NNNF.js.map → baseline-AMQ7VEB5.js.map} +1 -1
- package/dist/{chunk-2J7DPIAL.js → chunk-AWEAREOE.js} +186 -48
- package/dist/chunk-AWEAREOE.js.map +1 -0
- package/dist/{chunk-FMCI3MXH.js → chunk-GHLYQZWT.js} +3 -3
- package/dist/{chunk-FMCI3MXH.js.map → chunk-GHLYQZWT.js.map} +1 -1
- package/dist/{chunk-SRWMZBLG.js → chunk-ICBBG6U3.js} +4 -4
- package/dist/{chunk-SRWMZBLG.js.map → chunk-ICBBG6U3.js.map} +1 -1
- package/dist/cli.js +119 -56
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/baseline-RRO4NNNF.js +0 -6
- package/dist/chunk-2J7DPIAL.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { resolveDsn, resolveIngestHost, dashHostForIngestHost, resolveCliInvocation, availableRegionIds, createWorkspaceDsn, writeStoredCredentials, credentialsPath, findGitRoot, ensureGitignored, gitignoreEntryForCredentials, clearStoredCredentials, inventory, uploadScanArtifact, ingestHostForRegionId, dsnCommand, pushCommand, CliError, ExitCode, NPX_INVOCATION, refreshIfStale, driftCount, embeddingsCached, resolveEmbedModel, loadEmbedder, getNodeEmbeddings, queryGraphSemantic, queryGraph, unavailableMessage, countPending, resolveOne, GraphIndex, shortestPath, renderReport, impactOf, testsToRun, detectRunner, defaultGraphPath, serveStdio, ASSISTANTS, usageError, loadGraph, detectServeLaunch, installAssistant, writeNavigationConfig, uninstallAssistant, coveringTests, FREE_PACK, readScanArtifact, enrichOnline, ECOSYSTEMS, discoverModels, readSavings, exportGraph, catalogPath, libDir, stableStringify, buildGraph, writeArtifacts, writeSnapshot, UsageError, ResourceLimitError, epistemicBreakdown, cacheDir, probeFreshness, discover, vibgrateDir, modelCacheInfo, clearModelCache, GraphSource, createServer, assistantById, serializeGraph, resolveLimits, loadCatalog, driftFor, addLibrary, parseDsn as parseDsn$1, publishPrivateLibrary, resolveLib, libId, resolveVersion, readDoc, localPackageDocs, localApiSurface, assessDocQuality, symbolsFromApi, fetchHostedDocs, selectForBudget, formatForExt, verifyDeterminism, renderHtml, isModelReady } from './chunk-
|
|
2
|
+
import { resolveDsn, resolveIngestHost, dashHostForIngestHost, resolveCliInvocation, availableRegionIds, createWorkspaceDsn, writeStoredCredentials, credentialsPath, findGitRoot, ensureGitignored, gitignoreEntryForCredentials, clearStoredCredentials, inventory, uploadScanArtifact, ingestHostForRegionId, dsnCommand, pushCommand, CliError, ExitCode, NPX_INVOCATION, refreshIfStale, driftCount, embeddingsCached, resolveEmbedModel, loadEmbedder, getNodeEmbeddings, queryGraphSemantic, queryGraph, unavailableMessage, countPending, resolveOne, GraphIndex, shortestPath, renderReport, impactOf, testsToRun, detectRunner, defaultGraphPath, serveStdio, ASSISTANTS, usageError, loadGraph, detectServeLaunch, installAssistant, writeNavigationConfig, uninstallAssistant, coveringTests, FREE_PACK, readScanArtifact, enrichOnline, ECOSYSTEMS, discoverModels, readSavings, readUsage, exportGraph, catalogPath, libDir, stableStringify, buildGraph, writeArtifacts, writeSnapshot, UsageError, ResourceLimitError, epistemicBreakdown, cacheDir, probeFreshness, discover, vibgrateDir, modelCacheInfo, clearModelCache, GraphSource, createServer, assistantById, serializeGraph, resolveLimits, loadCatalog, driftFor, addLibrary, parseDsn as parseDsn$1, publishPrivateLibrary, resolveLib, libId, resolveVersion, readDoc, localPackageDocs, localApiSurface, assessDocQuality, symbolsFromApi, fetchHostedDocs, selectForBudget, formatForExt, verifyDeterminism, renderHtml, isModelReady } from './chunk-AWEAREOE.js';
|
|
3
3
|
import { resolvedGrammarFiles, grammarSetVersion, canonicalize } from './chunk-X5YT263H.js';
|
|
4
|
-
import { loadAdvancedScanHook, baselineCommand } from './chunk-
|
|
5
|
-
import { ensureDir, pathExists, writeDefaultConfig, parseDsn, detectVcs, computeRepoFingerprint, resolveRepositoryName, fetchScanPreflight, runCoreScan, VERSION, readJsonFile, writeTextFile, prepareCompressedUpload, computeDriftScore, titleBox, projectTypeToVulnEcosystem, driftBar, gitHistoryAvailable, buildVersionTimelines, findPackageAnyEcosystem, normalizeConstraint, findVersionCrossings, versionSatisfies, brandProgressBar, resolveHead, workingTreeDirty } from './chunk-
|
|
4
|
+
import { loadAdvancedScanHook, baselineCommand } from './chunk-GHLYQZWT.js';
|
|
5
|
+
import { ensureDir, pathExists, writeDefaultConfig, parseDsn, detectVcs, computeRepoFingerprint, resolveRepositoryName, fetchScanPreflight, runCoreScan, VERSION, readJsonFile, writeTextFile, prepareCompressedUpload, computeDriftScore, titleBox, projectTypeToVulnEcosystem, driftBar, gitHistoryAvailable, buildVersionTimelines, findPackageAnyEcosystem, normalizeConstraint, findVersionCrossings, versionSatisfies, brandProgressBar, resolveHead, workingTreeDirty } from './chunk-ICBBG6U3.js';
|
|
6
6
|
import './chunk-RXP66R2E.js';
|
|
7
7
|
import { pathExists as pathExists$1, parseExcludePatterns } from './chunk-GI6W53LM.js';
|
|
8
8
|
import * as fs5 from 'fs';
|
|
@@ -295,7 +295,7 @@ function logoLines(root) {
|
|
|
295
295
|
` ${ROBOT[1]}`,
|
|
296
296
|
` ${ROBOT[2]}`,
|
|
297
297
|
` ${ROBOT[3]}`,
|
|
298
|
-
` ${c.bold.white("
|
|
298
|
+
` ${c.bold.white("Vibgrate")} ${teal("Graph")} ${c.dim(`\xB7 Code Intelligence Engine \xB7 v${VERSION}`)}`,
|
|
299
299
|
...root ? [` ${c.dim(root)}`] : [],
|
|
300
300
|
""
|
|
301
301
|
];
|
|
@@ -2034,23 +2034,29 @@ function registerSavings(program) {
|
|
|
2034
2034
|
const cmd = program.command("savings").description("local, privacy-safe report of tokens/$ saved vs a grep baseline (estimates)").option("--days <n>", "window in days", "30").action(function() {
|
|
2035
2035
|
const global = readGlobal(this);
|
|
2036
2036
|
const days = Number(this.opts().days) || 30;
|
|
2037
|
-
const
|
|
2037
|
+
const root = rootOf(global);
|
|
2038
|
+
const now2 = Date.now();
|
|
2039
|
+
const report = readSavings(root, days, now2);
|
|
2040
|
+
const usage = readUsage(root, days, now2);
|
|
2038
2041
|
if (global.json) {
|
|
2039
|
-
json(report);
|
|
2042
|
+
json({ ...report, usage });
|
|
2040
2043
|
return;
|
|
2041
2044
|
}
|
|
2042
2045
|
info(`${c.cyan("vg savings")} \xB7 last ${days} days ${c.dim("(local, nothing left your machine)")}`);
|
|
2043
|
-
if (
|
|
2044
|
-
info(
|
|
2046
|
+
if (usage.totals.calls === 0) {
|
|
2047
|
+
info(
|
|
2048
|
+
c.dim(
|
|
2049
|
+
report.enabled ? " no calls recorded yet in this window" : " recording is off. Enable with `vg serve --savings`, then query via MCP."
|
|
2050
|
+
)
|
|
2051
|
+
);
|
|
2045
2052
|
return;
|
|
2046
2053
|
}
|
|
2047
|
-
if (report.queries
|
|
2048
|
-
info(
|
|
2049
|
-
|
|
2054
|
+
if (report.queries > 0) {
|
|
2055
|
+
info(` queries ${report.queries} \xB7 context tokens ${fmt(report.vgTokens)} (grep/read baseline \u2248 ${fmt(report.baselineTokens)}) \u2192 ${report.ratio}\xD7 fewer`);
|
|
2056
|
+
info(` est. cost (${report.rateLabel}): $${report.estCostVg} vs $${report.estCostBaseline} \u2192 saved \u2248 $${report.saved}`);
|
|
2057
|
+
info(c.dim(" estimates with stated assumptions (~4 chars/token; ~400 tokens/file baseline); scales with repo size."));
|
|
2050
2058
|
}
|
|
2051
|
-
|
|
2052
|
-
info(` est. cost (${report.rateLabel}): $${report.estCostVg} vs $${report.estCostBaseline} \u2192 saved \u2248 $${report.saved}`);
|
|
2053
|
-
info(c.dim(" estimates with stated assumptions (~4 chars/token; ~400 tokens/file baseline); scales with repo size."));
|
|
2059
|
+
printBreakdown(usage);
|
|
2054
2060
|
});
|
|
2055
2061
|
applyGlobalOptions(cmd);
|
|
2056
2062
|
}
|
|
@@ -2059,6 +2065,24 @@ function fmt(n) {
|
|
|
2059
2065
|
if (n >= 1e3) return `${(n / 1e3).toFixed(1)}k`;
|
|
2060
2066
|
return String(n);
|
|
2061
2067
|
}
|
|
2068
|
+
function printBreakdown(usage) {
|
|
2069
|
+
info("");
|
|
2070
|
+
info(c.bold(" by command") + c.dim(" (complete = full result \xB7 partial = capped/paginated \xB7 miss = no result)"));
|
|
2071
|
+
const nameW = Math.max(7, ...usage.commands.map((cmd) => cmd.tool.length));
|
|
2072
|
+
const header = " " + "command".padEnd(nameW) + ["calls", "complete", "partial", "miss", "success%"].map((h) => h.padStart(9)).join("");
|
|
2073
|
+
info(c.dim(header));
|
|
2074
|
+
for (const cmd of usage.commands) {
|
|
2075
|
+
info(
|
|
2076
|
+
" " + cmd.tool.padEnd(nameW) + String(cmd.calls).padStart(9) + String(cmd.complete).padStart(9) + String(cmd.partial).padStart(9) + String(cmd.miss).padStart(9) + `${cmd.successPct}%`.padStart(9)
|
|
2077
|
+
);
|
|
2078
|
+
}
|
|
2079
|
+
const t = usage.totals;
|
|
2080
|
+
info(c.dim(" " + "\u2500".repeat(nameW + 45)));
|
|
2081
|
+
info(
|
|
2082
|
+
" " + c.bold("total".padEnd(nameW)) + String(t.calls).padStart(9) + String(t.complete).padStart(9) + String(t.partial).padStart(9) + String(t.miss).padStart(9) + "".padStart(9)
|
|
2083
|
+
);
|
|
2084
|
+
info(c.dim(` avg success across commands: ${usage.avgSuccessPct}%`));
|
|
2085
|
+
}
|
|
2062
2086
|
function registerLib(program) {
|
|
2063
2087
|
const cmd = program.command("lib").description("library currency: version-correct, drift-annotated usage docs").argument("[args...]", "a library name, or: add <source> | publish <name> | resolve <name> | refresh").option("--name <name>", "library name for `add`").option("--version <v>", "pin the doc version for `add`/`publish`").option("--online", "(deprecated; network is on by default) allow network for add/refresh URL sources").option("-b, --budget <n>", "trim docs to ~N tokens").option("--readme <path>", "README path for `publish` (default ./README.md)").option("--dts <path>", "TypeScript declaration (.d.ts) path for `publish`").option("--language <lang>", "primary language for `publish`").option("--region <region>", "data-residency region for the hosted catalog (same as scans; default us)").option("--ingest <url>", "hosted catalog/ingest URL override (host extracted; wins over --region)").action(async function(args, opts) {
|
|
2064
2088
|
const global = readGlobal(this);
|
|
@@ -2343,7 +2367,7 @@ var initCommand = new Command("init").description("Initialize vibgrate in a proj
|
|
|
2343
2367
|
console.log(chalk7.green("\u2714") + ` Created ${chalk7.bold("vibgrate.config.ts")}`);
|
|
2344
2368
|
}
|
|
2345
2369
|
if (opts.baseline) {
|
|
2346
|
-
const { runBaseline } = await import('./baseline-
|
|
2370
|
+
const { runBaseline } = await import('./baseline-AMQ7VEB5.js');
|
|
2347
2371
|
await runBaseline(rootDir);
|
|
2348
2372
|
}
|
|
2349
2373
|
console.log("");
|
|
@@ -3559,7 +3583,7 @@ function formatText(artifact) {
|
|
|
3559
3583
|
lines.push("");
|
|
3560
3584
|
lines.push(" " + teal2("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u256E") + mint2("\u279C"));
|
|
3561
3585
|
lines.push(" " + chalk7.dim("\u2524") + teal2("\u2502") + " " + mint2("\u25FC") + " " + mint2("\u25FC") + " " + teal2("\u2502") + chalk7.dim("\u251C") + " " + chalk7.bold.white("vibgrate"));
|
|
3562
|
-
lines.push(" " + chalk7.dim("\u2524") + teal2("\u2502") + " " + chalk7.dim("\u2581\u2581") + " " + teal2("\u2502") + chalk7.dim("\u251C") + " " + chalk7.dim(`
|
|
3586
|
+
lines.push(" " + chalk7.dim("\u2524") + teal2("\u2502") + " " + chalk7.dim("\u2581\u2581") + " " + teal2("\u2502") + chalk7.dim("\u251C") + " " + chalk7.dim(`Code Intelligence Engine v${VERSION}`));
|
|
3563
3587
|
lines.push(" " + teal2("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u256F"));
|
|
3564
3588
|
lines.push("");
|
|
3565
3589
|
lines.push(...titleBox("Vibgrate Drift Report", teal2));
|
|
@@ -4532,11 +4556,23 @@ async function detectPackageManager(cwd) {
|
|
|
4532
4556
|
if (await pathExists(path.join(cwd, "yarn.lock"))) return "yarn";
|
|
4533
4557
|
return "npm";
|
|
4534
4558
|
}
|
|
4535
|
-
function
|
|
4559
|
+
async function detectWorkspaceRoot(cwd) {
|
|
4560
|
+
if (await pathExists(path.join(cwd, "pnpm-workspace.yaml"))) return true;
|
|
4561
|
+
try {
|
|
4562
|
+
const pkgPath = path.join(cwd, "package.json");
|
|
4563
|
+
const raw = await (await import('fs/promises')).readFile(pkgPath, "utf-8");
|
|
4564
|
+
const pkg = JSON.parse(raw);
|
|
4565
|
+
return pkg.workspaces != null;
|
|
4566
|
+
} catch {
|
|
4567
|
+
return false;
|
|
4568
|
+
}
|
|
4569
|
+
}
|
|
4570
|
+
function getInstallCommand(pm, pkg, version, isDev, opts = {}) {
|
|
4536
4571
|
const spec = `${pkg}@${version}`;
|
|
4572
|
+
const ws = opts.workspaceRoot && pm === "pnpm" ? " -w" : "";
|
|
4537
4573
|
switch (pm) {
|
|
4538
4574
|
case "pnpm":
|
|
4539
|
-
return isDev ? `pnpm add -D ${spec}` : `pnpm add ${spec}`;
|
|
4575
|
+
return isDev ? `pnpm add${ws} -D ${spec}` : `pnpm add${ws} ${spec}`;
|
|
4540
4576
|
case "yarn":
|
|
4541
4577
|
return isDev ? `yarn add --dev ${spec}` : `yarn add ${spec}`;
|
|
4542
4578
|
case "bun":
|
|
@@ -4556,45 +4592,72 @@ async function isDevDependency(cwd) {
|
|
|
4556
4592
|
return true;
|
|
4557
4593
|
}
|
|
4558
4594
|
}
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
console.log(chalk7.
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4595
|
+
async function confirmWorkspaceRoot(pm) {
|
|
4596
|
+
if (!(process.stdin.isTTY && process.stdout.isTTY)) return false;
|
|
4597
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
4598
|
+
return new Promise((resolve16) => {
|
|
4599
|
+
rl.question(chalk7.yellow(`Update the ${pm} workspace root with -w? [y/N]: `), (ans) => {
|
|
4600
|
+
rl.close();
|
|
4601
|
+
const t = ans.trim().toLowerCase();
|
|
4602
|
+
resolve16(t === "y" || t === "yes");
|
|
4603
|
+
});
|
|
4604
|
+
});
|
|
4605
|
+
}
|
|
4606
|
+
var updateCommand = new Command("update").description("Update vibgrate to the latest version").option("--check", "Only check for updates, do not install").option("--pm <manager>", "Package manager to use (npm, pnpm, yarn, bun)").option("--global", "Update global installation").option("-y, --yes", "Skip confirmation prompts (e.g. installing at a workspace root)").option("-w, --workspace-root", "Allow updating the pnpm workspace root (implies --yes for that prompt)").action(
|
|
4607
|
+
async (opts) => {
|
|
4608
|
+
console.log(chalk7.dim(`Current version: ${VERSION}`));
|
|
4609
|
+
console.log(chalk7.dim("Checking npm registry..."));
|
|
4610
|
+
const latest = await fetchLatestVersion();
|
|
4611
|
+
if (!latest) {
|
|
4612
|
+
console.error(chalk7.red("Could not reach the npm registry. Check your network connection."));
|
|
4613
|
+
process.exit(1);
|
|
4614
|
+
}
|
|
4615
|
+
const semver2 = await import('semver');
|
|
4616
|
+
if (!semver2.gt(latest, VERSION)) {
|
|
4617
|
+
console.log(chalk7.green("\u2714") + ` You are on the latest version (${VERSION}).`);
|
|
4618
|
+
return;
|
|
4619
|
+
}
|
|
4620
|
+
console.log(chalk7.yellow(`Update available: ${VERSION} \u2192 ${latest}`));
|
|
4621
|
+
if (opts.check) {
|
|
4622
|
+
console.log(chalk7.dim('Run "vg update" to install.'));
|
|
4623
|
+
return;
|
|
4624
|
+
}
|
|
4625
|
+
const cwd = process.cwd();
|
|
4626
|
+
const globalPm = detectGlobalInstall();
|
|
4627
|
+
const isGlobal = opts.global || globalPm !== null;
|
|
4628
|
+
const pm = opts.pm || (globalPm ?? await detectPackageManager(cwd));
|
|
4629
|
+
let cmd;
|
|
4630
|
+
if (isGlobal) {
|
|
4631
|
+
cmd = getGlobalUpdateCommand(pm, "@vibgrate/cli", latest);
|
|
4632
|
+
console.log(chalk7.dim(`Updating global installation with ${pm}: ${cmd}`));
|
|
4633
|
+
} else {
|
|
4634
|
+
const isDev = await isDevDependency(cwd);
|
|
4635
|
+
let workspaceRoot = false;
|
|
4636
|
+
if (pm === "pnpm" && await detectWorkspaceRoot(cwd)) {
|
|
4637
|
+
console.log(
|
|
4638
|
+
chalk7.yellow("Detected a pnpm workspace root.") + chalk7.dim(" Installing here needs the -w flag and updates the root package.json.")
|
|
4639
|
+
);
|
|
4640
|
+
const proceed = opts.yes || opts.workspaceRoot || await confirmWorkspaceRoot(pm);
|
|
4641
|
+
if (!proceed) {
|
|
4642
|
+
const rootCmd = getInstallCommand(pm, "@vibgrate/cli", latest, isDev, { workspaceRoot: true });
|
|
4643
|
+
console.log(chalk7.dim(`Skipped. To update the workspace root, run: ${rootCmd}`));
|
|
4644
|
+
console.log(chalk7.dim('or re-run "vg update --yes" (or --workspace-root) to let vg do it.'));
|
|
4645
|
+
return;
|
|
4646
|
+
}
|
|
4647
|
+
workspaceRoot = true;
|
|
4648
|
+
}
|
|
4649
|
+
cmd = getInstallCommand(pm, "@vibgrate/cli", latest, isDev, { workspaceRoot });
|
|
4650
|
+
console.log(chalk7.dim(`Using ${pm}: ${cmd}`));
|
|
4651
|
+
}
|
|
4652
|
+
try {
|
|
4653
|
+
execSync(cmd, { cwd, stdio: "inherit" });
|
|
4654
|
+
console.log(chalk7.green("\u2714") + ` Updated to @vibgrate/cli@${latest}`);
|
|
4655
|
+
} catch {
|
|
4656
|
+
console.error(chalk7.red(`Update failed. Run manually: ${cmd}`));
|
|
4657
|
+
process.exit(1);
|
|
4658
|
+
}
|
|
4596
4659
|
}
|
|
4597
|
-
|
|
4660
|
+
);
|
|
4598
4661
|
var OPENVEX_CONTEXT = "https://openvex.dev/ns/v0.2.0";
|
|
4599
4662
|
var VEX_STATUSES = ["not_affected", "affected", "fixed", "under_investigation"];
|
|
4600
4663
|
var VEX_JUSTIFICATIONS = [
|