@vibgrate/cli 2026.721.1 → 2026.721.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/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, recordCliCall, CLI_TOOL_ALIASES, countPending, resolveOne, indexFor, countTokens, shortestPath, renderReport, impactOf, testsToRun, detectRunner, defaultGraphPath, savingsLedgerPath, serveStdio, ASSISTANTS, detectAssistants, usageError, loadGraph, detectServeLaunch, installAssistant, writeNavigationConfig, uninstallAssistant, coveringTests, FREE_PACK, readScanArtifact, enrichOnline, ECOSYSTEMS, discoverModels, clearSavings, readSavings, readUsage, exportGraph, catalogPath, libDir, stableStringify, buildGraph, writeArtifacts, writeSnapshot, UsageError, ResourceLimitError, refreshInstalledInstructions, SMALL_REPO_FILES, 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, fetchHostedDocsCached, selectForBudget, formatForExt, hostedBase, verifyDeterminism, renderHtml, isModelReady, SAVINGS_TOOLS, sanitizeClient, readStoredCredentials, projectCredentialsPath, homeCredentialsPath, SKIP_DIRS, SKIP_FILES } from './chunk-C4EDNPWN.js';
2
+ import { resolveDsn, resolveIngestHost, dashHostForIngestHost, resolveCliInvocation, availableRegionIds, createWorkspaceDsn, writeStoredCredentials, credentialsPath, findGitRoot, ensureGitignored, gitignoreEntryForCredentials, clearStoredCredentials, inventory, uploadScanArtifact, cacheDir, ingestHostForRegionId, dsnCommand, pushCommand, CliError, ExitCode, NPX_INVOCATION, refreshIfStale, driftCount, embeddingsCached, resolveEmbedModel, loadEmbedder, getNodeEmbeddings, queryGraphSemantic, queryGraph, unavailableMessage, recordCliCall, CLI_TOOL_ALIASES, countPending, resolveOne, indexFor, countTokens, shortestPath, renderReport, impactOf, testsToRun, detectRunner, defaultGraphPath, savingsLedgerPath, serveStdio, ASSISTANTS, detectAssistants, usageError, loadGraph, detectServeLaunch, installAssistant, writeNavigationConfig, uninstallAssistant, coveringTests, FREE_PACK, readScanArtifact, enrichOnline, ECOSYSTEMS, discoverModels, clearSavings, readSavings, readUsage, exportGraph, catalogPath, libDir, stableStringify, buildGraph, writeArtifacts, writeSnapshot, UsageError, ResourceLimitError, refreshInstalledInstructions, SMALL_REPO_FILES, epistemicBreakdown, 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, fetchHostedDocsCached, selectForBudget, formatForExt, hostedBase, verifyDeterminism, renderHtml, isModelReady, SAVINGS_TOOLS, sanitizeClient, readStoredCredentials, projectCredentialsPath, homeCredentialsPath, SKIP_DIRS, SKIP_FILES } from './chunk-3DPZQS2Q.js';
3
3
  import { resolvedGrammarFiles, grammarSetVersion, hashString, canonicalize, hashBytes } from './chunk-JWBS5GS6.js';
4
- import { loadAdvancedScanHook, baselineCommand } from './chunk-FR72DKYF.js';
5
- import { ensureDir, pathExists, writeDefaultConfig, parseDsn, detectVcs, computeRepoFingerprint, resolveRepositoryName, fetchScanPreflight, runCoreScan, VERSION, readJsonFile, writeTextFile, loadConfig, prepareCompressedUpload, computeDriftScore, titleBox, projectTypeToVulnEcosystem, driftBar, gitHistoryAvailable, buildVersionTimelines, findPackageAnyEcosystem, normalizeConstraint, findVersionCrossings, versionSatisfies, PROJECT_TYPE_TO_OSV_ECOSYSTEM, fetchRiskySymbols, brandProgressBar, resolveHead, workingTreeDirty } from './chunk-SHXV4VPX.js';
4
+ import { loadAdvancedScanHook, baselineCommand } from './chunk-MUMBLIDO.js';
5
+ import { ensureDir, pathExists, writeDefaultConfig, parseDsn, detectVcs, computeRepoFingerprint, resolveRepositoryName, fetchScanPreflight, runCoreScan, VERSION, readJsonFile, writeTextFile, loadConfig, prepareCompressedUpload, computeDriftScore, titleBox, projectTypeToVulnEcosystem, driftBar, gitHistoryAvailable, buildVersionTimelines, findPackageAnyEcosystem, normalizeConstraint, findVersionCrossings, versionSatisfies, PROJECT_TYPE_TO_OSV_ECOSYSTEM, fetchRiskySymbols, brandProgressBar, resolveHead, workingTreeDirty } from './chunk-NHLSAZ6N.js';
6
6
  import './chunk-RXP66R2E.js';
7
7
  import { pathExists as pathExists$1, parseExcludePatterns } from './chunk-GI6W53LM.js';
8
8
  import * as fs10 from 'fs';
@@ -1524,6 +1524,35 @@ var STALE_MS = 6e4;
1524
1524
  function liveStatsDir(root) {
1525
1525
  return path.join(cacheDir(root), "serve-live");
1526
1526
  }
1527
+ function reapOtherVersionServers(dir, keepVersion, now2 = Date.now(), kill = (pid, signal) => process.kill(pid, signal), selfPid = process.pid) {
1528
+ let entries;
1529
+ try {
1530
+ entries = fs10.readdirSync(dir);
1531
+ } catch {
1532
+ return [];
1533
+ }
1534
+ const reaped = [];
1535
+ for (const name of entries) {
1536
+ if (!/^serve-\d+\.json$/.test(name)) continue;
1537
+ let parsed;
1538
+ try {
1539
+ parsed = JSON.parse(fs10.readFileSync(path.join(dir, name), "utf8"));
1540
+ } catch {
1541
+ continue;
1542
+ }
1543
+ if (typeof parsed?.pid !== "number" || typeof parsed.updatedAt !== "number") continue;
1544
+ if (parsed.pid === selfPid) continue;
1545
+ if (now2 - parsed.updatedAt > STALE_MS) continue;
1546
+ const version = typeof parsed.version === "string" ? parsed.version : "unknown";
1547
+ if (version === keepVersion) continue;
1548
+ try {
1549
+ kill(parsed.pid, "SIGTERM");
1550
+ reaped.push({ pid: parsed.pid, version });
1551
+ } catch {
1552
+ }
1553
+ }
1554
+ return reaped;
1555
+ }
1527
1556
  var LiveStatsBus = class {
1528
1557
  constructor(dir, stats, pid = process.pid) {
1529
1558
  this.dir = dir;
@@ -1559,7 +1588,7 @@ var LiveStatsBus = class {
1559
1588
  if (snap.revision === this.lastRevision && now2 - this.lastWriteAt < KEEPALIVE_MS) return;
1560
1589
  this.lastRevision = snap.revision;
1561
1590
  this.lastWriteAt = now2;
1562
- const body = { pid: this.pid, updatedAt: now2, snapshot: snap };
1591
+ const body = { pid: this.pid, updatedAt: now2, version: VERSION, snapshot: snap };
1563
1592
  try {
1564
1593
  fs10.mkdirSync(this.dir, { recursive: true });
1565
1594
  const tmp = `${this.file}.tmp`;
@@ -4480,7 +4509,7 @@ var initCommand = new Command("init").description("Initialize vibgrate in a proj
4480
4509
  console.log(chalk8.green("\u2714") + ` Created ${chalk8.bold("vibgrate.config.ts")}`);
4481
4510
  }
4482
4511
  if (opts.baseline) {
4483
- const { runBaseline } = await import('./baseline-3S5NKMBP.js');
4512
+ const { runBaseline } = await import('./baseline-KK7ZLRZB.js');
4484
4513
  await runBaseline(rootDir);
4485
4514
  }
4486
4515
  console.log("");
@@ -5906,7 +5935,7 @@ async function confirmWorkspaceRoot(pm) {
5906
5935
  });
5907
5936
  });
5908
5937
  }
5909
- 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(
5938
+ 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)").option("--no-reap", "Do not signal running vg serve processes on an older version to restart").action(
5910
5939
  async (opts) => {
5911
5940
  console.log(chalk8.dim(`Current version: ${VERSION}`));
5912
5941
  console.log(chalk8.dim("Checking npm registry..."));
@@ -5918,6 +5947,7 @@ var updateCommand = new Command("update").description("Update vibgrate to the la
5918
5947
  const semver2 = await import('semver');
5919
5948
  if (!semver2.gt(latest, VERSION)) {
5920
5949
  console.log(chalk8.green("\u2714") + ` You are on the latest version (${VERSION}).`);
5950
+ if (opts.reap !== false) reapAndReport(process.cwd(), VERSION);
5921
5951
  return;
5922
5952
  }
5923
5953
  console.log(chalk8.yellow(`Update available: ${VERSION} \u2192 ${latest}`));
@@ -5973,8 +6003,29 @@ var updateCommand = new Command("update").description("Update vibgrate to the la
5973
6003
  console.error(chalk8.red(`Update failed. Run manually: ${cmd}`));
5974
6004
  process.exit(1);
5975
6005
  }
6006
+ if (opts.reap !== false) reapAndReport(cwd, latest);
5976
6007
  }
5977
6008
  );
6009
+ function reapAndReport(cwd, keepVersion) {
6010
+ let reaped = [];
6011
+ try {
6012
+ reaped = reapOtherVersionServers(liveStatsDir(cwd), keepVersion);
6013
+ } catch {
6014
+ return;
6015
+ }
6016
+ if (reaped.length === 0) return;
6017
+ const list = reaped.map((r) => `pid ${r.pid} (v${r.version})`).join(", ");
6018
+ console.log(
6019
+ chalk8.dim(
6020
+ `Signalled ${reaped.length} running vg serve process${reaped.length === 1 ? "" : "es"} on an older version to restart: ${list}.`
6021
+ )
6022
+ );
6023
+ console.log(
6024
+ chalk8.dim(
6025
+ "Your editor/agent will respawn them on the new version. Restart your AI session if a server does not reconnect."
6026
+ )
6027
+ );
6028
+ }
5978
6029
 
5979
6030
  // src/reporting/commands/fix.ts
5980
6031
  var SEVERITY_RANK = { unknown: 0, low: 1, moderate: 2, high: 3, critical: 4 };