@vibgrate/cli 2026.703.4 → 2026.703.7

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,4 +1,4 @@
1
- import { runCoreScan, writeJsonFile } from './chunk-HRETUZQJ.js';
1
+ import { runCoreScan, writeJsonFile } from './chunk-QWS7M7DG.js';
2
2
  import * as path from 'path';
3
3
  import { Command } from 'commander';
4
4
  import chalk from 'chalk';
@@ -27,5 +27,5 @@ var baselineCommand = new Command("baseline").description("Create a drift baseli
27
27
  });
28
28
 
29
29
  export { baselineCommand, loadAdvancedScanHook, runBaseline };
30
- //# sourceMappingURL=chunk-O5R2MV6Z.js.map
31
- //# sourceMappingURL=chunk-O5R2MV6Z.js.map
30
+ //# sourceMappingURL=chunk-ZNVLRKWK.js.map
31
+ //# sourceMappingURL=chunk-ZNVLRKWK.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/reporting/advanced-hook.ts","../src/reporting/commands/baseline.ts"],"names":[],"mappings":";;;;;;AAUA,eAAsB,oBAAA,GAA8D;AAClF,EAAA,OAAO,MAAA;AACT;;;ACLA,eAAsB,YAAY,OAAA,EAAgC;AAChE,EAAA,OAAA,CAAQ,GAAA,CAAI,KAAA,CAAM,GAAA,CAAI,sBAAsB,CAAC,CAAA;AAE7C,EAAA,MAAM,QAAA,GAAW,MAAM,oBAAA,EAAqB;AAC5C,EAAA,MAAM,QAAA,GAAW,MAAM,WAAA,CAAY,OAAA,EAAS;AAAA,IAC1C,MAAA,EAAQ,MAAA;AAAA,IACR,WAAA,EAAa;AAAA,KACZ,QAAQ,CAAA;AAEX,EAAA,MAAM,YAAA,GAAoB,IAAA,CAAA,IAAA,CAAK,OAAA,EAAS,WAAA,EAAa,eAAe,CAAA;AACpE,EAAA,MAAM,aAAA,CAAc,cAAc,QAAQ,CAAA;AAC1C,EAAA,OAAA,CAAQ,GAAA,CAAI,KAAA,CAAM,KAAA,CAAM,QAAG,CAAA,GAAI,sBAAsB,KAAA,CAAM,IAAA,CAAK,yBAAyB,CAAC,CAAA,CAAE,CAAA;AAC5F,EAAA,OAAA,CAAQ,GAAA,CAAI,MAAM,GAAA,CAAI,CAAA,kBAAA,EAAqB,SAAS,KAAA,CAAM,KAAK,MAAM,CAAC,CAAA;AACxE;AAEO,IAAM,eAAA,GAAkB,IAAI,OAAA,CAAQ,UAAU,EAClD,WAAA,CAAY,kCAAkC,CAAA,CAC9C,QAAA,CAAS,UAAU,kBAAA,EAAoB,GAAG,CAAA,CAC1C,MAAA,CAAO,OAAO,UAAA,KAAuB;AACpC,EAAA,MAAM,OAAA,GAAe,aAAQ,UAAU,CAAA;AACvC,EAAA,MAAM,YAAY,OAAO,CAAA;AAC3B,CAAC","file":"chunk-O5R2MV6Z.js","sourcesContent":["import type { AdvancedScanHook } from '../core-open/index.js';\n\n/**\n * Open build: there is no proprietary advanced-analysis hook.\n *\n * In the public, Apache-2.0 distribution every reporting command runs purely on\n * the open base engine (`runCoreScan` from `@vibgrate/core-open`). This shim\n * keeps the call sites in `scan`/`baseline` unchanged while always resolving to\n * `undefined`, so the scan falls back to the open base engine.\n */\nexport async function loadAdvancedScanHook(): Promise<AdvancedScanHook | undefined> {\n return undefined;\n}\n","import * as path from 'node:path';\nimport { Command } from 'commander';\nimport chalk from 'chalk';\nimport { runCoreScan } from '../../core-open/index.js';\nimport { writeJsonFile } from '../utils/fs.js';\nimport { loadAdvancedScanHook } from '../advanced-hook.js';\n\nexport async function runBaseline(rootDir: string): Promise<void> {\n console.log(chalk.dim('Creating baseline...'));\n\n const advanced = await loadAdvancedScanHook();\n const artifact = await runCoreScan(rootDir, {\n format: 'text',\n concurrency: 8,\n }, advanced);\n\n const baselinePath = path.join(rootDir, '.vibgrate', 'baseline.json');\n await writeJsonFile(baselinePath, artifact);\n console.log(chalk.green('✔') + ` Baseline saved to ${chalk.bold('.vibgrate/baseline.json')}`);\n console.log(chalk.dim(` Baseline score: ${artifact.drift.score}/100`));\n}\n\nexport const baselineCommand = new Command('baseline')\n .description('Create a drift baseline snapshot')\n .argument('[path]', 'Path to baseline', '.')\n .action(async (targetPath: string) => {\n const rootDir = path.resolve(targetPath);\n await runBaseline(rootDir);\n });\n"]}
1
+ {"version":3,"sources":["../src/reporting/advanced-hook.ts","../src/reporting/commands/baseline.ts"],"names":[],"mappings":";;;;;;AAUA,eAAsB,oBAAA,GAA8D;AAClF,EAAA,OAAO,MAAA;AACT;;;ACLA,eAAsB,YAAY,OAAA,EAAgC;AAChE,EAAA,OAAA,CAAQ,GAAA,CAAI,KAAA,CAAM,GAAA,CAAI,sBAAsB,CAAC,CAAA;AAE7C,EAAA,MAAM,QAAA,GAAW,MAAM,oBAAA,EAAqB;AAC5C,EAAA,MAAM,QAAA,GAAW,MAAM,WAAA,CAAY,OAAA,EAAS;AAAA,IAC1C,MAAA,EAAQ,MAAA;AAAA,IACR,WAAA,EAAa;AAAA,KACZ,QAAQ,CAAA;AAEX,EAAA,MAAM,YAAA,GAAoB,IAAA,CAAA,IAAA,CAAK,OAAA,EAAS,WAAA,EAAa,eAAe,CAAA;AACpE,EAAA,MAAM,aAAA,CAAc,cAAc,QAAQ,CAAA;AAC1C,EAAA,OAAA,CAAQ,GAAA,CAAI,KAAA,CAAM,KAAA,CAAM,QAAG,CAAA,GAAI,sBAAsB,KAAA,CAAM,IAAA,CAAK,yBAAyB,CAAC,CAAA,CAAE,CAAA;AAC5F,EAAA,OAAA,CAAQ,GAAA,CAAI,MAAM,GAAA,CAAI,CAAA,kBAAA,EAAqB,SAAS,KAAA,CAAM,KAAK,MAAM,CAAC,CAAA;AACxE;AAEO,IAAM,eAAA,GAAkB,IAAI,OAAA,CAAQ,UAAU,EAClD,WAAA,CAAY,kCAAkC,CAAA,CAC9C,QAAA,CAAS,UAAU,kBAAA,EAAoB,GAAG,CAAA,CAC1C,MAAA,CAAO,OAAO,UAAA,KAAuB;AACpC,EAAA,MAAM,OAAA,GAAe,aAAQ,UAAU,CAAA;AACvC,EAAA,MAAM,YAAY,OAAO,CAAA;AAC3B,CAAC","file":"chunk-ZNVLRKWK.js","sourcesContent":["import type { AdvancedScanHook } from '../core-open/index.js';\n\n/**\n * Open build: there is no proprietary advanced-analysis hook.\n *\n * In the public, Apache-2.0 distribution every reporting command runs purely on\n * the open base engine (`runCoreScan` from `@vibgrate/core-open`). This shim\n * keeps the call sites in `scan`/`baseline` unchanged while always resolving to\n * `undefined`, so the scan falls back to the open base engine.\n */\nexport async function loadAdvancedScanHook(): Promise<AdvancedScanHook | undefined> {\n return undefined;\n}\n","import * as path from 'node:path';\nimport { Command } from 'commander';\nimport chalk from 'chalk';\nimport { runCoreScan } from '../../core-open/index.js';\nimport { writeJsonFile } from '../utils/fs.js';\nimport { loadAdvancedScanHook } from '../advanced-hook.js';\n\nexport async function runBaseline(rootDir: string): Promise<void> {\n console.log(chalk.dim('Creating baseline...'));\n\n const advanced = await loadAdvancedScanHook();\n const artifact = await runCoreScan(rootDir, {\n format: 'text',\n concurrency: 8,\n }, advanced);\n\n const baselinePath = path.join(rootDir, '.vibgrate', 'baseline.json');\n await writeJsonFile(baselinePath, artifact);\n console.log(chalk.green('✔') + ` Baseline saved to ${chalk.bold('.vibgrate/baseline.json')}`);\n console.log(chalk.dim(` Baseline score: ${artifact.drift.score}/100`));\n}\n\nexport const baselineCommand = new Command('baseline')\n .description('Create a drift baseline snapshot')\n .argument('[path]', 'Path to baseline', '.')\n .action(async (targetPath: string) => {\n const rootDir = path.resolve(targetPath);\n await runBaseline(rootDir);\n });\n"]}
package/dist/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { resolveDsn, resolveIngestHost, dashHostForIngestHost, availableRegionIds, createWorkspaceDsn, writeStoredCredentials, credentialsPath, findGitRoot, ensureGitignored, gitignoreEntryForCredentials, clearStoredCredentials, inventory, uploadScanArtifact, dsnCommand, pushCommand, ExitCode, CliError, verifyDeterminism, refreshIfStale, driftCount, embeddingsCached, resolveEmbedModel, loadEmbedder, getNodeEmbeddings, queryGraphSemantic, queryGraph, unavailableMessage, countPending, resolveOne, GraphIndex, shortestPath, renderReport, impactOf, testsToRun, detectRunner, defaultGraphPath, serveStdio, ASSISTANTS, usageError, loadGraph, detectServeLaunch, installAssistant, uninstallAssistant, buildGraph, serializeGraph, coveringTests, FREE_PACK, readScanArtifact, enrichOnline, ECOSYSTEMS, discoverModels, readSavings, exportGraph, catalogPath, libDir, stableStringify, writeArtifacts, writeSnapshot, UsageError, cacheDir, probeFreshness, discover, vibgrateDir, modelCacheInfo, clearModelCache, GraphSource, createServer, assistantById, loadCatalog, driftFor, addLibrary, parseDsn as parseDsn$1, publishPrivateLibrary, resolveLib, libId, resolveVersion, readDoc, localPackageDocs, localApiSurface, assessDocQuality, symbolsFromApi, fetchHostedDocs, selectForBudget, formatForExt, renderHtml, isModelReady } from './chunk-SXKYCVEQ.js';
2
+ import { resolveDsn, resolveIngestHost, dashHostForIngestHost, resolveCliInvocation, availableRegionIds, createWorkspaceDsn, writeStoredCredentials, credentialsPath, findGitRoot, ensureGitignored, gitignoreEntryForCredentials, clearStoredCredentials, inventory, uploadScanArtifact, dsnCommand, pushCommand, ExitCode, CliError, NPX_INVOCATION, verifyDeterminism, refreshIfStale, driftCount, embeddingsCached, resolveEmbedModel, loadEmbedder, getNodeEmbeddings, queryGraphSemantic, queryGraph, unavailableMessage, countPending, resolveOne, GraphIndex, shortestPath, renderReport, impactOf, testsToRun, detectRunner, defaultGraphPath, serveStdio, ASSISTANTS, usageError, loadGraph, detectServeLaunch, installAssistant, uninstallAssistant, buildGraph, serializeGraph, coveringTests, FREE_PACK, readScanArtifact, enrichOnline, ECOSYSTEMS, discoverModels, readSavings, exportGraph, catalogPath, libDir, stableStringify, writeArtifacts, writeSnapshot, UsageError, cacheDir, probeFreshness, discover, vibgrateDir, modelCacheInfo, clearModelCache, GraphSource, createServer, assistantById, loadCatalog, driftFor, addLibrary, parseDsn as parseDsn$1, publishPrivateLibrary, resolveLib, libId, resolveVersion, readDoc, localPackageDocs, localApiSurface, assessDocQuality, symbolsFromApi, fetchHostedDocs, selectForBudget, formatForExt, renderHtml, isModelReady } from './chunk-WGXDYBAN.js';
3
3
  import { resolvedGrammarFiles, grammarSetVersion } from './chunk-X5YT263H.js';
4
- import { loadAdvancedScanHook, baselineCommand } from './chunk-O5R2MV6Z.js';
5
- import { ensureDir, pathExists, writeDefaultConfig, parseDsn, detectVcs, computeRepoFingerprint, resolveRepositoryName, fetchScanPreflight, runCoreScan, VERSION, readJsonFile, writeTextFile, prepareCompressedUpload, titleBox, driftBar, gitHistoryAvailable, buildVersionTimelines, findPackageAnyEcosystem, normalizeConstraint, findVersionCrossings, versionSatisfies, brandProgressBar } from './chunk-HRETUZQJ.js';
4
+ import { loadAdvancedScanHook, baselineCommand } from './chunk-ZNVLRKWK.js';
5
+ import { ensureDir, pathExists, writeDefaultConfig, parseDsn, detectVcs, computeRepoFingerprint, resolveRepositoryName, fetchScanPreflight, runCoreScan, VERSION, readJsonFile, writeTextFile, prepareCompressedUpload, titleBox, driftBar, gitHistoryAvailable, buildVersionTimelines, findPackageAnyEcosystem, normalizeConstraint, findVersionCrossings, versionSatisfies, brandProgressBar } from './chunk-QWS7M7DG.js';
6
6
  import './chunk-RXP66R2E.js';
7
- import { pathExists as pathExists$1, parseExcludePatterns } from './chunk-4M2MUQRO.js';
7
+ import { pathExists as pathExists$1, parseExcludePatterns } from './chunk-UPPWLMVD.js';
8
8
  import * as fs4 from 'fs';
9
9
  import fs4__default, { realpathSync } from 'fs';
10
10
  import * as path9 from 'path';
@@ -1882,7 +1882,7 @@ var initCommand = new Command("init").description("Initialize vibgrate in a proj
1882
1882
  console.log(chalk5.green("\u2714") + ` Created ${chalk5.bold("vibgrate.config.ts")}`);
1883
1883
  }
1884
1884
  if (opts.baseline) {
1885
- const { runBaseline } = await import('./baseline-YIXK7MXF.js');
1885
+ const { runBaseline } = await import('./baseline-HBRBXJHJ.js');
1886
1886
  await runBaseline(rootDir);
1887
1887
  }
1888
1888
  console.log("");
@@ -1925,7 +1925,9 @@ async function detectAiAssistant(rootDir) {
1925
1925
  function printAiContextPrompt(detectedAssistant) {
1926
1926
  const teal2 = chalk5.hex("#3FB0A4");
1927
1927
  const mint2 = chalk5.hex("#4FE3C1");
1928
- const installCmd = detectedAssistant ? `vg install ${detectedAssistant}` : "vg install --all";
1928
+ const cli = resolveCliInvocation();
1929
+ const installArgs = detectedAssistant ? `install ${detectedAssistant}` : "install --all";
1930
+ const installCmd = `${cli} ${installArgs}`;
1929
1931
  const detectedNote = detectedAssistant ? chalk5.dim(` (${detectedAssistant} config detected)`) : "";
1930
1932
  console.log("");
1931
1933
  console.log(teal2(" \u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E"));
@@ -1941,6 +1943,9 @@ function printAiContextPrompt(detectedAssistant) {
1941
1943
  }
1942
1944
 
1943
1945
  // src/reporting/commands/scan.ts
1946
+ function shouldBuildCodeMap(opts) {
1947
+ return opts.graph !== false && !opts.maxPrivacy && !opts.noLocalArtifacts;
1948
+ }
1944
1949
  async function autoPush(artifact, rootDir, opts) {
1945
1950
  const dsn = resolveDsn(opts.dsn);
1946
1951
  if (!dsn) {
@@ -2063,6 +2068,7 @@ var scanCommand = new Command("scan").description("Scan a project for upgrade dr
2063
2068
  }
2064
2069
  const hasDsn = !!resolveDsn(opts.dsn);
2065
2070
  const willPush = !opts.offline && (opts.push || hasDsn);
2071
+ const noLocalArtifacts = opts.localArtifacts === false;
2066
2072
  const isFirstRun = !await pathExists$1(path9.join(rootDir, ".vibgrate", "scan_result.json"));
2067
2073
  let pinnedRegion;
2068
2074
  if (willPush && hasDsn) {
@@ -2157,7 +2163,7 @@ var scanCommand = new Command("scan").description("Scan a project for upgrade dr
2157
2163
  region: opts.region ?? pinnedRegion,
2158
2164
  strict: opts.strict,
2159
2165
  uiPurpose: opts.uiPurpose,
2160
- noLocalArtifacts: opts.noLocalArtifacts,
2166
+ noLocalArtifacts,
2161
2167
  maxPrivacy: opts.maxPrivacy,
2162
2168
  offline: opts.offline,
2163
2169
  // `--full` is the comprehensive umbrella: it turns on vulnerability scanning.
@@ -2168,9 +2174,12 @@ var scanCommand = new Command("scan").description("Scan a project for upgrade dr
2168
2174
  projectScanTimeout: opts.projectScanTimeout ? parseInt(opts.projectScanTimeout, 10) || void 0 : void 0,
2169
2175
  repositoryName: opts.repositoryName?.trim() || void 0,
2170
2176
  force: opts.force,
2171
- quiet: opts.quiet
2177
+ quiet: opts.quiet,
2178
+ // Prefix for the upsell panel's `login → push` hint — `vg` when installed,
2179
+ // `npx @vibgrate/cli` when the user ran via npx (where bare `vg` fails).
2180
+ invocation: resolveCliInvocation()
2172
2181
  };
2173
- const wantGraph = opts.graph !== false && !opts.maxPrivacy;
2182
+ const wantGraph = shouldBuildCodeMap({ graph: opts.graph, maxPrivacy: opts.maxPrivacy, noLocalArtifacts });
2174
2183
  if (wantGraph) {
2175
2184
  scanOpts.postScan = async (report) => {
2176
2185
  const result = await buildGraph({
@@ -2230,7 +2239,7 @@ Failing fitness function: drift worsened by ${worseningPercent.toFixed(2)}% (thr
2230
2239
  if (willPush) {
2231
2240
  await autoPush(artifact, rootDir, scanOpts);
2232
2241
  }
2233
- const showAiPrompt = scanOpts.format === "text" && !opts.quiet && !hasDsn && !opts.offline && !opts.noLocalArtifacts && !opts.maxPrivacy && isFirstRun;
2242
+ const showAiPrompt = scanOpts.format === "text" && !opts.quiet && !hasDsn && !opts.offline && !noLocalArtifacts && !opts.maxPrivacy && isFirstRun;
2234
2243
  if (showAiPrompt) {
2235
2244
  const detectedAssistant = await detectAiAssistant(rootDir);
2236
2245
  printAiContextPrompt(detectedAssistant);
@@ -2980,7 +2989,14 @@ function openUrl(url) {
2980
2989
 
2981
2990
  // src/reporting/commands/login.ts
2982
2991
  var delay = (ms) => new Promise((resolve15) => setTimeout(resolve15, ms));
2983
- var loginCommand = new Command("login").description("Authenticate the CLI with your Vibgrate workspace via the browser").option("--ingest <url>", "Ingest API URL (overrides --region)").option("--region <region>", `Data residency region (${availableRegionIds().join(", ")})`, "us").option("--no-browser", "Do not attempt to open a browser automatically").action(async (opts) => {
2992
+ function isInside(dir, file) {
2993
+ const rel2 = path9.relative(dir, file);
2994
+ return !!rel2 && !rel2.startsWith("..") && !path9.isAbsolute(rel2);
2995
+ }
2996
+ var loginCommand = new Command("login").description("Authenticate the CLI with your Vibgrate workspace via the browser").option("--ingest <url>", "Ingest API URL (overrides --region)").option("--region <region>", `Data residency region (${availableRegionIds().join(", ")})`, "us").option("--no-browser", "Do not attempt to open a browser automatically").option(
2997
+ "--local",
2998
+ "Store credentials in this project (.vibgrate/credentials.json) instead of ~/.vibgrate"
2999
+ ).action(async (opts) => {
2984
3000
  let ingestHost;
2985
3001
  try {
2986
3002
  ingestHost = resolveIngestHost(opts.region, opts.ingest);
@@ -3069,17 +3085,19 @@ var loginCommand = new Command("login").description("Authenticate the CLI with y
3069
3085
  process.exit(1);
3070
3086
  }
3071
3087
  }
3072
- writeStoredCredentials(creds);
3088
+ const storeOpts = { local: opts.local === true };
3089
+ writeStoredCredentials(creds, storeOpts);
3090
+ const credsFile = credentialsPath(storeOpts);
3073
3091
  console.log("");
3074
3092
  console.log(chalk5.green("\u2714") + " Logged in.");
3075
3093
  if (creds.workspaceId) {
3076
3094
  console.log(" Workspace: " + chalk5.bold(creds.workspaceId));
3077
3095
  }
3078
- console.log(chalk5.dim(` Credentials saved to ${credentialsPath()}`));
3096
+ console.log(chalk5.dim(` Credentials saved to ${credsFile}`));
3079
3097
  try {
3080
3098
  const root = findGitRoot();
3081
- if (root) {
3082
- const res = ensureGitignored(gitignoreEntryForCredentials(root), root);
3099
+ if (root && isInside(root, credsFile)) {
3100
+ const res = ensureGitignored(gitignoreEntryForCredentials(root, credsFile), root);
3083
3101
  if (res.status === "created") {
3084
3102
  console.log(chalk5.dim(` Created .gitignore and ignored ${res.entry}`));
3085
3103
  } else if (res.status === "added") {
@@ -3088,7 +3106,7 @@ var loginCommand = new Command("login").description("Authenticate the CLI with y
3088
3106
  }
3089
3107
  } catch {
3090
3108
  }
3091
- console.log(chalk5.dim(' You can now run "vibgrate scan --push".'));
3109
+ console.log(chalk5.dim(` You can now run "${resolveCliInvocation()} scan --push".`));
3092
3110
  return;
3093
3111
  }
3094
3112
  if (token.status === "access_denied") {
@@ -3646,10 +3664,14 @@ function buildProgram() {
3646
3664
  const program = new Command();
3647
3665
  program.name("vg").description(
3648
3666
  "vg \u2014 local codebase intelligence for AI coding agents: a deterministic, no-API-key code graph + MCP server, drift reporting, and version-correct library docs"
3649
- ).version(VERSION, "--version", "output the version number").showSuggestionAfterError(true).addHelpText(
3650
- "after",
3651
- '\nRun `vg` to scan + map the current folder, `vg "<question>"` to ask, `vg status`/`vg verify` for state.\nDrift: `vg scan` / `vg report`. Wire into your AI agent: `vg install`.\nThe `vibgrate` command is an alias for `vg`.\nDocs: https://vibgrate.com/help'
3652
- );
3667
+ ).version(VERSION, "--version", "output the version number").showSuggestionAfterError(true).addHelpText("after", () => {
3668
+ const cli = resolveCliInvocation();
3669
+ const aliasNote = cli === "vg" ? "The `vibgrate` command is an alias for `vg`.\n" : cli === NPX_INVOCATION ? "Install globally (`npm i -g @vibgrate/cli`) to use the shorter `vg` command.\n" : "";
3670
+ return `
3671
+ Run \`${cli}\` to scan + map the current folder, \`${cli} "<question>"\` to ask, \`${cli} status\`/\`${cli} verify\` for state.
3672
+ Drift: \`${cli} scan\` / \`${cli} report\`. Wire into your AI agent: \`${cli} install\`.
3673
+ ${aliasNote}Docs: https://vibgrate.com/help`;
3674
+ });
3653
3675
  registerBuild(program);
3654
3676
  registerStatus(program);
3655
3677
  registerVerify(program);