@vibgrate/cli 2026.711.1 → 2026.711.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.
@@ -1,5 +1,5 @@
1
1
  import { hashString, langById, shortId, canonicalize, grammarSetVersion, hashBytes, langForExtension, setGrammarsOverride, parseSource } from './chunk-X5YT263H.js';
2
- import { writeTextFile, pathExists, readJsonFile, computeUpgradeImpact, getChangelogSignals, gitHistoryAvailable, buildVersionTimelines, findPackageTimeline, severityRank, projectTypeToVulnEcosystem, VERSION } from './chunk-2PCL4ZME.js';
2
+ import { writeTextFile, pathExists, readJsonFile, computeUpgradeImpact, getChangelogSignals, gitHistoryAvailable, buildVersionTimelines, findPackageTimeline, severityRank, projectTypeToVulnEcosystem, VERSION } from './chunk-NNU2PW2H.js';
3
3
  import * as fs19 from 'fs';
4
4
  import { spawnSync, execFileSync } from 'child_process';
5
5
  import * as path19 from 'path';
@@ -15,6 +15,7 @@ import { fileURLToPath } from 'url';
15
15
  import ts from 'typescript';
16
16
  import { bidirectional } from 'graphology-shortest-path/unweighted.js';
17
17
  import * as crypto from 'crypto';
18
+ import { createHash } from 'crypto';
18
19
  import { Command } from 'commander';
19
20
  import chalk from 'chalk';
20
21
  import * as zlib from 'zlib';
@@ -3675,10 +3676,10 @@ var MANIFEST_BY_FILE = {
3675
3676
  };
3676
3677
  function findManifests(root) {
3677
3678
  const set = Object.fromEntries(ECOSYSTEMS.map((e) => [e, []]));
3678
- const MAX_ENTRIES = 2e4;
3679
+ const MAX_ENTRIES2 = 2e4;
3679
3680
  let scanned = 0;
3680
3681
  const walk2 = (dir, depth) => {
3681
- if (depth > 8 || scanned > MAX_ENTRIES) return;
3682
+ if (depth > 8 || scanned > MAX_ENTRIES2) return;
3682
3683
  let entries;
3683
3684
  try {
3684
3685
  entries = fs19.readdirSync(dir, { withFileTypes: true });
@@ -3687,7 +3688,7 @@ function findManifests(root) {
3687
3688
  }
3688
3689
  for (const e of entries) {
3689
3690
  scanned++;
3690
- if (scanned > MAX_ENTRIES) break;
3691
+ if (scanned > MAX_ENTRIES2) break;
3691
3692
  if (e.isDirectory()) {
3692
3693
  if (!SKIP_DIRS2.has(e.name) && !e.name.startsWith(".")) walk2(path19.join(dir, e.name), depth + 1);
3693
3694
  continue;
@@ -5604,6 +5605,65 @@ async function publishPrivateLibrary(req, opts = {}) {
5604
5605
  }
5605
5606
  }
5606
5607
 
5608
+ // src/engine/hosted-cache.ts
5609
+ var CACHE_VERSION2 = "vg-hosted-docs/1";
5610
+ var HOSTED_DOCS_TTL_MS = 24 * 60 * 60 * 1e3;
5611
+ var MAX_ENTRIES = 64;
5612
+ function cachePath2(root) {
5613
+ return path19.join(cacheDir(root), "hosted-docs.json");
5614
+ }
5615
+ function hostedDocsCacheKey(req, opts = {}) {
5616
+ const material = JSON.stringify([
5617
+ req.name ?? "",
5618
+ req.targetId ?? "",
5619
+ req.query ?? "",
5620
+ req.verbosity ?? "",
5621
+ req.maxTokens ?? 0,
5622
+ hostedBase(opts),
5623
+ opts.auth?.keyId ?? "anon"
5624
+ ]);
5625
+ return createHash("sha256").update(material).digest("hex");
5626
+ }
5627
+ function loadFile(root) {
5628
+ try {
5629
+ const parsed = JSON.parse(fs19.readFileSync(cachePath2(root), "utf8"));
5630
+ if (parsed && parsed.version === CACHE_VERSION2 && parsed.entries && typeof parsed.entries === "object") return parsed;
5631
+ } catch {
5632
+ }
5633
+ return { version: CACHE_VERSION2, entries: {} };
5634
+ }
5635
+ function saveFile(root, file) {
5636
+ try {
5637
+ const keys = Object.keys(file.entries);
5638
+ if (keys.length > MAX_ENTRIES) {
5639
+ for (const k of keys.sort((a, b) => file.entries[a].at - file.entries[b].at).slice(0, keys.length - MAX_ENTRIES)) {
5640
+ delete file.entries[k];
5641
+ }
5642
+ }
5643
+ fs19.mkdirSync(cacheDir(root), { recursive: true });
5644
+ fs19.writeFileSync(cachePath2(root), JSON.stringify(file));
5645
+ } catch {
5646
+ }
5647
+ }
5648
+ async function fetchHostedDocsCached(root, req, opts = {}) {
5649
+ const now = opts.now ?? Date.now;
5650
+ const ttl = opts.ttlMs ?? HOSTED_DOCS_TTL_MS;
5651
+ const key = hostedDocsCacheKey(req, opts);
5652
+ const file = loadFile(root);
5653
+ if (!opts.bypass) {
5654
+ const hit = file.entries[key];
5655
+ if (hit && now() - hit.at < ttl && hit.result?.content) {
5656
+ return { ...hit.result, metadata: { ...hit.result.metadata ?? {}, cached: true } };
5657
+ }
5658
+ }
5659
+ const result = await fetchHostedDocs(req, opts);
5660
+ if (result) {
5661
+ file.entries[key] = { at: now(), result };
5662
+ saveFile(root, file);
5663
+ }
5664
+ return result;
5665
+ }
5666
+
5607
5667
  // src/mcp/response.ts
5608
5668
  var MAX_RESULT_TOKENS = 25e3;
5609
5669
  function renderToolResult(result, maxTokens = MAX_RESULT_TOKENS) {
@@ -6546,7 +6606,8 @@ var TOOLS = [
6546
6606
  return (async () => {
6547
6607
  const dsn = resolveDsn();
6548
6608
  const parsed = dsn ? parseDsn(dsn) : null;
6549
- const hosted = await fetchHostedDocs(
6609
+ const hosted = await fetchHostedDocsCached(
6610
+ ctx.root,
6550
6611
  { name: entry?.name ?? id, targetId: entry?.id, query: query || void 0, maxTokens: budget },
6551
6612
  { auth: parsed ? { keyId: parsed.keyId, secret: parsed.secret } : void 0 }
6552
6613
  );
@@ -7323,6 +7384,6 @@ function spdx(ctx) {
7323
7384
  return JSON.stringify(doc, null, 2) + "\n";
7324
7385
  }
7325
7386
 
7326
- 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, detectRunner, detectServeLaunch, discover, discoverModels, driftCount, driftFor, dsnCommand, embeddingsCached, enrichOnline, ensureGitignored, epistemicBreakdown, exportGraph, fetchHostedDocs, findGitRoot, findNodes, formatForExt, getNodeEmbeddings, gitignoreEntryForCredentials, groundGraph, hasDrift, identifierParts, impactOf, indexFor, ingestHostForRegionId, installAssistant, inventory, isModelReady, isTestFile, libDir, libId, loadCatalog, loadCoverage, loadEmbedder, loadGraph, loadSnapshot, localApiSurface, localPackageDocs, modelCacheInfo, nodeById, nodeEmbedText, parseDsn, parseGraph, parseJsonc, probeFreshness, publishPrivateLibrary, pushCommand, queryGraph, queryGraphSemantic, readDoc, readSavings, readScanArtifact, 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 };
7327
- //# sourceMappingURL=chunk-MIJ3ZSSF.js.map
7328
- //# sourceMappingURL=chunk-MIJ3ZSSF.js.map
7387
+ 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, detectRunner, detectServeLaunch, discover, discoverModels, driftCount, driftFor, dsnCommand, embeddingsCached, enrichOnline, ensureGitignored, epistemicBreakdown, exportGraph, fetchHostedDocsCached, findGitRoot, findNodes, formatForExt, getNodeEmbeddings, gitignoreEntryForCredentials, groundGraph, hasDrift, identifierParts, impactOf, indexFor, ingestHostForRegionId, installAssistant, inventory, isModelReady, isTestFile, libDir, libId, loadCatalog, loadCoverage, loadEmbedder, loadGraph, loadSnapshot, localApiSurface, localPackageDocs, modelCacheInfo, nodeById, nodeEmbedText, parseDsn, parseGraph, parseJsonc, probeFreshness, publishPrivateLibrary, pushCommand, queryGraph, queryGraphSemantic, readDoc, readSavings, readScanArtifact, 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 };
7388
+ //# sourceMappingURL=chunk-75ZJYYJE.js.map
7389
+ //# sourceMappingURL=chunk-75ZJYYJE.js.map