@vibgrate/cli 2026.814.2 → 2026.817.1
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/agent-CUYQKC6S.js +26 -0
- package/dist/{agent-5ANHRYEI.js.map → agent-CUYQKC6S.js.map} +1 -1
- package/dist/{approvals-T2KXPJLV.js → approvals-IPMUDEDV.js} +5 -5
- package/dist/{approvals-T2KXPJLV.js.map → approvals-IPMUDEDV.js.map} +1 -1
- package/dist/baseline-NZFGLMER.js +9 -0
- package/dist/{baseline-WVD6P5IO.js.map → baseline-NZFGLMER.js.map} +1 -1
- package/dist/{chunk-TFAXW7VM.js → chunk-2BURPMYA.js} +3 -3
- package/dist/{chunk-TFAXW7VM.js.map → chunk-2BURPMYA.js.map} +1 -1
- package/dist/{chunk-X76VPOYH.js → chunk-2GSMCOIC.js} +4 -4
- package/dist/{chunk-X76VPOYH.js.map → chunk-2GSMCOIC.js.map} +1 -1
- package/dist/{chunk-KGPX4EUN.js → chunk-2TJ5EY4I.js} +4 -4
- package/dist/{chunk-KGPX4EUN.js.map → chunk-2TJ5EY4I.js.map} +1 -1
- package/dist/{chunk-BH54SLGZ.js → chunk-3GZSDY35.js} +4 -4
- package/dist/{chunk-BH54SLGZ.js.map → chunk-3GZSDY35.js.map} +1 -1
- package/dist/{chunk-REIGWTTH.js → chunk-3HNPVXUK.js} +3 -3
- package/dist/{chunk-REIGWTTH.js.map → chunk-3HNPVXUK.js.map} +1 -1
- package/dist/{chunk-7NMXE6KG.js → chunk-45AKSS4A.js} +4 -4
- package/dist/{chunk-7NMXE6KG.js.map → chunk-45AKSS4A.js.map} +1 -1
- package/dist/{chunk-FOW5IF73.js → chunk-4W5SYK2M.js} +11 -34
- package/dist/chunk-4W5SYK2M.js.map +1 -0
- package/dist/{chunk-UTNNGKKX.js → chunk-6NOGNOE4.js} +4 -4
- package/dist/chunk-6NOGNOE4.js.map +1 -0
- package/dist/{chunk-N3XFY3PX.js → chunk-74UBGF4P.js} +3 -3
- package/dist/{chunk-N3XFY3PX.js.map → chunk-74UBGF4P.js.map} +1 -1
- package/dist/{chunk-YNV5M3JW.js → chunk-A7EKFLAN.js} +8 -8
- package/dist/{chunk-YNV5M3JW.js.map → chunk-A7EKFLAN.js.map} +1 -1
- package/dist/{chunk-N6ZMZ5AI.js → chunk-ANYL7SUI.js} +349 -46
- package/dist/chunk-ANYL7SUI.js.map +1 -0
- package/dist/{chunk-75LJM5XD.js → chunk-ENFSSUNK.js} +7 -3
- package/dist/chunk-ENFSSUNK.js.map +1 -0
- package/dist/{chunk-3LSG7Z4I.js → chunk-EZ7UC5Y5.js} +25 -4
- package/dist/chunk-EZ7UC5Y5.js.map +1 -0
- package/dist/{chunk-WWGLVF7D.js → chunk-FD2HPGX2.js} +8 -8
- package/dist/{chunk-WWGLVF7D.js.map → chunk-FD2HPGX2.js.map} +1 -1
- package/dist/{chunk-OWSFZQOP.js → chunk-FJG5AXKZ.js} +3 -3
- package/dist/{chunk-OWSFZQOP.js.map → chunk-FJG5AXKZ.js.map} +1 -1
- package/dist/chunk-FMS6G67U.js +467 -0
- package/dist/chunk-FMS6G67U.js.map +1 -0
- package/dist/{chunk-WHJMS7XC.js → chunk-I5LP55B6.js} +3 -3
- package/dist/{chunk-WHJMS7XC.js.map → chunk-I5LP55B6.js.map} +1 -1
- package/dist/{chunk-JCN6MSXQ.js → chunk-JHLCKMKF.js} +16 -29
- package/dist/chunk-JHLCKMKF.js.map +1 -0
- package/dist/{chunk-IHLLWBZU.js → chunk-K267DHCF.js} +6 -6
- package/dist/{chunk-IHLLWBZU.js.map → chunk-K267DHCF.js.map} +1 -1
- package/dist/{chunk-WQLZSVNF.js → chunk-MIYXVY57.js} +7 -6
- package/dist/chunk-MIYXVY57.js.map +1 -0
- package/dist/chunk-MS6V5XKB.js +33 -0
- package/dist/chunk-MS6V5XKB.js.map +1 -0
- package/dist/{chunk-5GLQNMTI.js → chunk-NHB53JTV.js} +6 -6
- package/dist/{chunk-5GLQNMTI.js.map → chunk-NHB53JTV.js.map} +1 -1
- package/dist/{chunk-DSUGC7F5.js → chunk-NKRWKCME.js} +4 -4
- package/dist/{chunk-DSUGC7F5.js.map → chunk-NKRWKCME.js.map} +1 -1
- package/dist/{chunk-7QDHQLUS.js → chunk-NQUWC2IA.js} +13 -11
- package/dist/chunk-NQUWC2IA.js.map +1 -0
- package/dist/{chunk-NKFXXP6W.js → chunk-OWSXI3PJ.js} +8 -6
- package/dist/chunk-OWSXI3PJ.js.map +1 -0
- package/dist/chunk-OZ3IFXRD.js +22 -0
- package/dist/chunk-OZ3IFXRD.js.map +1 -0
- package/dist/chunk-PV76EO4G.js +6 -0
- package/dist/{chunk-2H2U3DC7.js.map → chunk-PV76EO4G.js.map} +1 -1
- package/dist/{chunk-2U37PFB2.js → chunk-QPXVTQ7O.js} +3 -3
- package/dist/{chunk-2U37PFB2.js.map → chunk-QPXVTQ7O.js.map} +1 -1
- package/dist/{chunk-TNROG5CO.js → chunk-RJCRWQNS.js} +1855 -175
- package/dist/chunk-RJCRWQNS.js.map +1 -0
- package/dist/{chunk-54RGT2T5.js → chunk-RQAKBRAV.js} +3 -3
- package/dist/{chunk-54RGT2T5.js.map → chunk-RQAKBRAV.js.map} +1 -1
- package/dist/{chunk-YQNTIBKS.js → chunk-UBEVY5UT.js} +6 -6
- package/dist/{chunk-YQNTIBKS.js.map → chunk-UBEVY5UT.js.map} +1 -1
- package/dist/{chunk-IHXNOY3R.js → chunk-YL4OIUA5.js} +12 -12
- package/dist/{chunk-IHXNOY3R.js.map → chunk-YL4OIUA5.js.map} +1 -1
- package/dist/{chunk-TVDYEHIM.js → chunk-ZSECAGSU.js} +3 -3
- package/dist/{chunk-TVDYEHIM.js.map → chunk-ZSECAGSU.js.map} +1 -1
- package/dist/cli.js +416 -717
- package/dist/cli.js.map +1 -1
- package/dist/daemon-J2HX4GY3.js +25 -0
- package/dist/daemon-J2HX4GY3.js.map +1 -0
- package/dist/embed-worker-main.js +4 -4
- package/dist/ensure-map-5C6KG66X.js +32 -0
- package/dist/{ensure-map-HQ7A5NDL.js.map → ensure-map-5C6KG66X.js.map} +1 -1
- package/dist/graph-backend-HH5IIQ55.js +14 -0
- package/dist/{graph-backend-W2TNTMY7.js.map → graph-backend-HH5IIQ55.js.map} +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.js +18 -16
- package/dist/index.js.map +1 -1
- package/dist/{interactive-EW2VJ3BZ.js → interactive-FXPAZAUJ.js} +33 -31
- package/dist/interactive-FXPAZAUJ.js.map +1 -0
- package/dist/load-OR2XVGAV.js +10 -0
- package/dist/{load-64RK5O6C.js.map → load-OR2XVGAV.js.map} +1 -1
- package/dist/local-runtime-6SNWKSA7.js +6 -0
- package/dist/{local-runtime-2ED33KK6.js.map → local-runtime-6SNWKSA7.js.map} +1 -1
- package/dist/model-manager-SXHZ5VD4.js +10 -0
- package/dist/{model-manager-GJ2YSTSK.js.map → model-manager-SXHZ5VD4.js.map} +1 -1
- package/dist/parse-worker.d.ts +1 -1
- package/dist/parse-worker.js +1 -1
- package/dist/{run-outcome-6QNQIHPV.js → run-outcome-M4546HLJ.js} +6 -6
- package/dist/{run-outcome-6QNQIHPV.js.map → run-outcome-M4546HLJ.js.map} +1 -1
- package/dist/runtime-session-6KKMFS6Q.js +21 -0
- package/dist/{runtime-session-RJHH3KMF.js.map → runtime-session-6KKMFS6Q.js.map} +1 -1
- package/dist/session-HCFJUSKN.js +16 -0
- package/dist/{session-4BGYASOH.js.map → session-HCFJUSKN.js.map} +1 -1
- package/dist/{stream-json-GY5N7WZT.js → stream-json-4DL65D6U.js} +16 -16
- package/dist/{stream-json-GY5N7WZT.js.map → stream-json-4DL65D6U.js.map} +1 -1
- package/dist/{types-DLH-Ritr.d.ts → types-8SYlXhzm.d.ts} +57 -6
- package/dist/version-UPIC3F4P.js +4 -0
- package/dist/{version-DPAMQW6M.js.map → version-UPIC3F4P.js.map} +1 -1
- package/dist/{vg-mcp-bridge-IGHJKKSL.js → vg-mcp-bridge-FZGX6DYO.js} +10 -10
- package/dist/{vg-mcp-bridge-IGHJKKSL.js.map → vg-mcp-bridge-FZGX6DYO.js.map} +1 -1
- package/dist/{vgd-ORPA5C2K.js → vgd-QR26FAZD.js} +9 -9
- package/dist/vgd-QR26FAZD.js.map +1 -0
- package/grammars/tree-sitter-hcl.wasm +0 -0
- package/package.json +3 -2
- package/dist/agent-5ANHRYEI.js +0 -26
- package/dist/baseline-WVD6P5IO.js +0 -9
- package/dist/chunk-2H2U3DC7.js +0 -6
- package/dist/chunk-3LSG7Z4I.js.map +0 -1
- package/dist/chunk-75LJM5XD.js.map +0 -1
- package/dist/chunk-7QDHQLUS.js.map +0 -1
- package/dist/chunk-FOW5IF73.js.map +0 -1
- package/dist/chunk-JCN6MSXQ.js.map +0 -1
- package/dist/chunk-N6ZMZ5AI.js.map +0 -1
- package/dist/chunk-NKFXXP6W.js.map +0 -1
- package/dist/chunk-TNROG5CO.js.map +0 -1
- package/dist/chunk-UTNNGKKX.js.map +0 -1
- package/dist/chunk-WQLZSVNF.js.map +0 -1
- package/dist/ensure-map-HQ7A5NDL.js +0 -30
- package/dist/graph-backend-W2TNTMY7.js +0 -14
- package/dist/interactive-EW2VJ3BZ.js.map +0 -1
- package/dist/load-64RK5O6C.js +0 -10
- package/dist/local-runtime-2ED33KK6.js +0 -6
- package/dist/model-manager-GJ2YSTSK.js +0 -10
- package/dist/runtime-session-RJHH3KMF.js +0 -21
- package/dist/session-4BGYASOH.js +0 -16
- package/dist/version-DPAMQW6M.js +0 -4
- package/dist/vgd-ORPA5C2K.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,59 +1,62 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { fetchCatalog, resolveProviders } from './chunk-
|
|
3
|
-
import { telemetryOptOut, StatsSharer, statsEndpoint, isCI } from './chunk-
|
|
4
|
-
import { loadAdvancedScanHook, baselineCommand } from './chunk-
|
|
5
|
-
import { sha256Hex, generateKeypair, dssePae, DSSE_PAYLOAD_TYPE, keyId, registerBuild,
|
|
6
|
-
export { runBuild } from './chunk-
|
|
2
|
+
import { fetchCatalog, resolveProviders } from './chunk-NHB53JTV.js';
|
|
3
|
+
import { telemetryOptOut, StatsSharer, statsEndpoint, isCI } from './chunk-45AKSS4A.js';
|
|
4
|
+
import { loadAdvancedScanHook, baselineCommand } from './chunk-2BURPMYA.js';
|
|
5
|
+
import { sha256Hex, generateKeypair, dssePae, DSSE_PAYLOAD_TYPE, keyId, registerBuild, ProgressBar, printLogo, runBuild } from './chunk-JHLCKMKF.js';
|
|
6
|
+
export { runBuild } from './chunk-JHLCKMKF.js';
|
|
7
|
+
import { restartVgdIfRunning, stopVgd, registerDaemon, rootOf, requireGraph } from './chunk-FMS6G67U.js';
|
|
8
|
+
import { readGlobal, applyGlobalOptions } from './chunk-OZ3IFXRD.js';
|
|
7
9
|
import { disableColor, info, c, json, out } from './chunk-CT5BS56U.js';
|
|
8
|
-
import
|
|
10
|
+
import './chunk-OWSXI3PJ.js';
|
|
9
11
|
import './chunk-IS7VTH2Q.js';
|
|
10
12
|
import { defaultProcessEndpoint, startProcessHostServer, resolveInferenceIsolation } from './chunk-JFE7XCAE.js';
|
|
11
13
|
import { clearHostSessionPool, acquireHostSession, generateOnSession, listHostSessions, hostSessionPoolSize } from './chunk-3LOWJSAF.js';
|
|
12
|
-
import { runCodeSession } from './chunk-
|
|
13
|
-
import { CONTEXT_POLICY_VERSION, computeFcsReport, renderFcsReportMarkdown, createTrajectoryCollector, runAgent } from './chunk-
|
|
14
|
+
import { runCodeSession } from './chunk-UBEVY5UT.js';
|
|
15
|
+
import { CONTEXT_POLICY_VERSION, computeFcsReport, renderFcsReportMarkdown, createTrajectoryCollector, runAgent } from './chunk-YL4OIUA5.js';
|
|
14
16
|
import './chunk-543E6WDJ.js';
|
|
15
|
-
import './chunk-
|
|
16
|
-
import './chunk-
|
|
17
|
-
import
|
|
17
|
+
import './chunk-ZSECAGSU.js';
|
|
18
|
+
import './chunk-RQAKBRAV.js';
|
|
19
|
+
import './chunk-RBIRXQR6.js';
|
|
18
20
|
import { buildIdentifierTrieFromGraph } from './chunk-5HYCB55P.js';
|
|
19
|
-
import { parseReasoningEffort, summarizeDiffs, ScriptedProvider } from './chunk-
|
|
21
|
+
import { parseReasoningEffort, summarizeDiffs, ScriptedProvider } from './chunk-74UBGF4P.js';
|
|
20
22
|
import './chunk-7AVYKZEM.js';
|
|
21
|
-
import { buildModelInstallPlan } from './chunk-
|
|
22
|
-
import { ensurePackage, ensureUnavailableMessage } from './chunk-
|
|
23
|
-
import { init_resolve_ollama, gatherSystemMemory, resolveOllamaBinary, hasOllamaBinary, resolve_ollama_exports } from './chunk-
|
|
23
|
+
import { buildModelInstallPlan } from './chunk-I5LP55B6.js';
|
|
24
|
+
import { ensurePackage, ensureUnavailableMessage } from './chunk-3HNPVXUK.js';
|
|
25
|
+
import { init_resolve_ollama, gatherSystemMemory, resolveOllamaBinary, hasOllamaBinary, resolve_ollama_exports } from './chunk-FJG5AXKZ.js';
|
|
24
26
|
import { readOrchestratorState, writeOrchestratorState, parseMode, setDefaultMode, recommendMode, activePin, resolveMode, providerForBackend, QUALIFIED_PACKS, pinPack, unpinPack, buildOrchestratorStatus } from './chunk-NZELMYT4.js';
|
|
25
27
|
import { fmt, estimateModelBytes } from './chunk-7N4Y3E47.js';
|
|
26
28
|
import './chunk-IZDH67DX.js';
|
|
27
|
-
import { serveStdio, isRelevantChange, exportGraph, GraphSource, createServer, formatForExt, RefreshScheduler } from './chunk-
|
|
28
|
-
import { refreshIfStale } from './chunk-
|
|
29
|
-
import {
|
|
30
|
-
import { resolveDsn, createWorkspaceDsn, writeStoredCredentials, credentialsPath, findGitRoot, ensureGitignored, gitignoreEntryForCredentials, clearStoredCredentials, parseDsn as parseDsn$1, uploadScanArtifact, dsnCommand, pushCommand, countTokens, shortestPath, pathDisconnect, testsToRun, detectRunner, coveringTests, FREE_PACK, readScanArtifact, publishPrivateLibrary, assessDocQuality, symbolsFromApi, fetchHostedDocsCached, selectForBudget, hostedBase, readStoredCredentials, projectCredentialsPath, homeCredentialsPath } from './chunk-
|
|
29
|
+
import { serveStdio, isRelevantChange, exportGraph, GraphSource, createServer, formatForExt, RefreshScheduler } from './chunk-A7EKFLAN.js';
|
|
30
|
+
import { refreshIfStale } from './chunk-K267DHCF.js';
|
|
31
|
+
import { driftCount, ASSISTANTS, detectAssistants, isAssistantInstalled, detectServeLaunch, installAssistant, writeNavigationConfig, uninstallAssistant, TOOLCHAIN_GRAMMARS, resolveToolchainGrammar, buildGraph, writeSnapshot, probeFreshness, discover, assistantById, SMALL_REPO_FILES, isSkippedDirName, SKIP_FILES, SKIP_DIRS } from './chunk-RJCRWQNS.js';
|
|
32
|
+
import { resolveDsn, createWorkspaceDsn, writeStoredCredentials, credentialsPath, findGitRoot, ensureGitignored, gitignoreEntryForCredentials, clearStoredCredentials, parseDsn as parseDsn$1, uploadScanArtifact, dsnCommand, pushCommand, countTokens, shortestPath, pathDisconnect, testsToRun, detectRunner, coveringTests, FREE_PACK, readScanArtifact, publishPrivateLibrary, assessDocQuality, symbolsFromApi, fetchHostedDocsCached, selectForBudget, hostedBase, readStoredCredentials, projectCredentialsPath, homeCredentialsPath } from './chunk-FD2HPGX2.js';
|
|
31
33
|
import { resolveIngestHost, dashHostForIngestHost, availableRegionIds, ingestHostForRegionId } from './chunk-HTLDXEHW.js';
|
|
32
|
-
import { writeDefaultConfig, parseDsn, detectVcs, computeRepoFingerprint, resolveRepositoryName, fetchScanPreflight, runCoreScan, loadConfig, prepareCompressedUpload, computeDriftScore, titleBox, projectTypeToVulnEcosystem, driftBar, gitHistoryAvailable, buildVersionTimelines, findPackageAnyEcosystem, normalizeConstraint, findVersionCrossings, versionSatisfies, PROJECT_TYPE_TO_OSV_ECOSYSTEM, fetchRiskySymbols, perDependencyDrift } from './chunk-
|
|
34
|
+
import { writeDefaultConfig, parseDsn, detectVcs, computeRepoFingerprint, resolveRepositoryName, fetchScanPreflight, runCoreScan, loadConfig, prepareCompressedUpload, computeDriftScore, titleBox, projectTypeToVulnEcosystem, driftBar, gitHistoryAvailable, buildVersionTimelines, findPackageAnyEcosystem, normalizeConstraint, findVersionCrossings, versionSatisfies, PROJECT_TYPE_TO_OSV_ECOSYSTEM, fetchRiskySymbols, perDependencyDrift } from './chunk-ANYL7SUI.js';
|
|
35
|
+
import { CliError, ExitCode, usageError, engineUnavailable } from './chunk-MS6V5XKB.js';
|
|
33
36
|
import './chunk-VIWZ4QT7.js';
|
|
34
|
-
import { inventory, enrichOnline, ECOSYSTEMS, catalogPath, libDir, loadCatalog, driftFor, addLibrary, resolveLib, libId, resolveVersion, readDoc, localPackageDocs, localApiSurface } from './chunk-
|
|
37
|
+
import { inventory, enrichOnline, ECOSYSTEMS, catalogPath, libDir, loadCatalog, driftFor, addLibrary, resolveLib, libId, resolveVersion, readDoc, localPackageDocs, localApiSurface } from './chunk-NQUWC2IA.js';
|
|
35
38
|
import { resolveOne } from './chunk-J7LKEB2R.js';
|
|
36
|
-
import { recordCliCall, CLI_TOOL_ALIASES, savingsLedgerPath, clearSavings, readSavings, readUsage, readModelSavings, CAPSULE_RANKING_VERSION, SAVINGS_TOOLS, sanitizeClient } from './chunk-
|
|
37
|
-
import { queryGraphSemantic, queryGraph, indexFor, impactOf } from './chunk-
|
|
39
|
+
import { recordCliCall, CLI_TOOL_ALIASES, savingsLedgerPath, clearSavings, readSavings, readUsage, readModelSavings, CAPSULE_RANKING_VERSION, SAVINGS_TOOLS, sanitizeClient } from './chunk-NKRWKCME.js';
|
|
40
|
+
import { queryGraphSemantic, queryGraph, indexFor, impactOf } from './chunk-2TJ5EY4I.js';
|
|
38
41
|
import { discoverModels } from './chunk-CQDUBAQY.js';
|
|
39
42
|
import { freeBytesOnVolume, weightStoreDir, listCachedWeights, ensureWeightCached, catalogIntegrityReport } from './chunk-OV4KGXPD.js';
|
|
40
|
-
import { loadGraph, loadGraphPreferIndex, SCHEMA_VERSION } from './chunk-
|
|
43
|
+
import { loadGraph, loadGraphPreferIndex, SCHEMA_VERSION } from './chunk-MIYXVY57.js';
|
|
41
44
|
import './chunk-5I4VSBWQ.js';
|
|
42
45
|
import { pathExists as pathExists$1, parseExcludePatterns } from './chunk-DT4KIVRI.js';
|
|
43
46
|
import { ensureDir, pathExists, readJsonFile, writeTextFile, writeJsonFile } from './chunk-CRAMOEBE.js';
|
|
44
|
-
import { init_cli_invocation, resolveCliInvocation, NPX_INVOCATION } from './chunk-
|
|
45
|
-
import { resolvedGrammarFiles, grammarSetVersion } from './chunk-
|
|
47
|
+
import { init_cli_invocation, resolveCliInvocation, NPX_INVOCATION } from './chunk-EZ7UC5Y5.js';
|
|
48
|
+
import { resolvedGrammarFiles, grammarSetVersion } from './chunk-6NOGNOE4.js';
|
|
46
49
|
import './chunk-RXP66R2E.js';
|
|
47
|
-
import { embeddingsCached, resolveEmbedModel, loadEmbedder, getNodeEmbeddings, unavailableMessage, countPending, modelCacheInfo, embeddingsPath, clearModelCache, withTimeout } from './chunk-
|
|
48
|
-
import { cacheDir } from './chunk-
|
|
49
|
-
import { resetRelevanceProviderCache, loadRelevanceProvider, relevanceModuleDir, resolveGraphPath, analyzeQuestion, loadTopicTags, renderReport, loadGraphFileWithSnapshot, serializeGraph, stableStringify, writeArtifacts, vibgrateDir, mapFileExists, parseGraph, ensureVibgrateGitignore } from './chunk-
|
|
50
|
-
import { VERSION } from './chunk-
|
|
50
|
+
import { embeddingsCached, resolveEmbedModel, loadEmbedder, getNodeEmbeddings, unavailableMessage, countPending, modelCacheInfo, embeddingsPath, clearModelCache, withTimeout } from './chunk-2GSMCOIC.js';
|
|
51
|
+
import { cacheDir } from './chunk-QPXVTQ7O.js';
|
|
52
|
+
import { resetRelevanceProviderCache, loadRelevanceProvider, relevanceModuleDir, resolveGraphPath, analyzeQuestion, loadTopicTags, renderReport, loadGraphFileWithSnapshot, serializeGraph, stableStringify, writeArtifacts, vibgrateDir, mapFileExists, parseGraph, ensureVibgrateGitignore } from './chunk-ENFSSUNK.js';
|
|
53
|
+
import { VERSION } from './chunk-PV76EO4G.js';
|
|
51
54
|
import './chunk-BWPBB45M.js';
|
|
52
55
|
import { canonicalize, hashString, hashBytes } from './chunk-JFGYT6BI.js';
|
|
53
56
|
import './chunk-BPF3YX2U.js';
|
|
54
57
|
import { __toCommonJS } from './chunk-Z6ZWNWWR.js';
|
|
55
|
-
import * as
|
|
56
|
-
import
|
|
58
|
+
import * as fs14 from 'fs';
|
|
59
|
+
import fs14__default, { realpathSync } from 'fs';
|
|
57
60
|
import * as path43 from 'path';
|
|
58
61
|
import path43__default from 'path';
|
|
59
62
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
@@ -67,7 +70,7 @@ import * as zlib from 'zlib';
|
|
|
67
70
|
import * as crypto3 from 'crypto';
|
|
68
71
|
import { randomUUID, createHash } from 'crypto';
|
|
69
72
|
import chalk7 from 'chalk';
|
|
70
|
-
import * as
|
|
73
|
+
import * as fs28 from 'fs/promises';
|
|
71
74
|
|
|
72
75
|
init_cli_invocation();
|
|
73
76
|
function registerStatus(program) {
|
|
@@ -80,7 +83,7 @@ async function runStatus(global) {
|
|
|
80
83
|
const root2 = path43.resolve(global.cwd ?? ".");
|
|
81
84
|
const graphPath = resolveGraphPath(root2, global.graph);
|
|
82
85
|
const graph = loadGraph(root2, graphPath);
|
|
83
|
-
const hasCache =
|
|
86
|
+
const hasCache = fs14.existsSync(path43.join(cacheDir(root2), "parse-cache.json"));
|
|
84
87
|
let stale = null;
|
|
85
88
|
let staleExact = false;
|
|
86
89
|
if (graph) {
|
|
@@ -136,20 +139,6 @@ async function runStatus(global) {
|
|
|
136
139
|
}
|
|
137
140
|
if (vibgrateDir(root2)) ;
|
|
138
141
|
}
|
|
139
|
-
function rootOf(global) {
|
|
140
|
-
return path43.resolve(global.cwd ?? ".");
|
|
141
|
-
}
|
|
142
|
-
function requireGraph(global) {
|
|
143
|
-
const root2 = rootOf(global);
|
|
144
|
-
const graph = loadGraph(root2, global.graph);
|
|
145
|
-
if (!graph) {
|
|
146
|
-
throw new CliError(
|
|
147
|
-
`no map found \u2014 run \`vg\` to build one first` + (global.graph ? ` (looked at ${global.graph})` : ""),
|
|
148
|
-
ExitCode.NOT_FOUND
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
return { root: root2, graph };
|
|
152
|
-
}
|
|
153
142
|
|
|
154
143
|
// src/commands/ask.ts
|
|
155
144
|
function registerAsk(program) {
|
|
@@ -256,7 +245,7 @@ function verdictPath(dir) {
|
|
|
256
245
|
}
|
|
257
246
|
function readVerdict(dir) {
|
|
258
247
|
try {
|
|
259
|
-
const raw = JSON.parse(
|
|
248
|
+
const raw = JSON.parse(fs14.readFileSync(verdictPath(dir), "utf8"));
|
|
260
249
|
if (raw?.status !== "ok" && raw?.status !== "crashed") return null;
|
|
261
250
|
if (raw.version !== VERSION) return null;
|
|
262
251
|
return raw;
|
|
@@ -266,8 +255,8 @@ function readVerdict(dir) {
|
|
|
266
255
|
}
|
|
267
256
|
function writeVerdict(dir, verdict) {
|
|
268
257
|
try {
|
|
269
|
-
|
|
270
|
-
|
|
258
|
+
fs14.mkdirSync(dir, { recursive: true });
|
|
259
|
+
fs14.writeFileSync(verdictPath(dir), JSON.stringify(verdict, null, 2) + "\n", "utf8");
|
|
271
260
|
} catch {
|
|
272
261
|
}
|
|
273
262
|
}
|
|
@@ -275,7 +264,7 @@ function probeModuleUrl(from = import.meta.url) {
|
|
|
275
264
|
const dir = path43.dirname(fileURLToPath(from));
|
|
276
265
|
for (const name of ["embeddings.js", "index.js"]) {
|
|
277
266
|
const candidate = path43.join(dir, name);
|
|
278
|
-
if (
|
|
267
|
+
if (fs14.existsSync(candidate)) return pathToFileURL(candidate).href;
|
|
279
268
|
}
|
|
280
269
|
return pathToFileURL(path43.join(dir, "index.js")).href;
|
|
281
270
|
}
|
|
@@ -296,7 +285,7 @@ function defaultRunProbe(timeoutMs) {
|
|
|
296
285
|
})
|
|
297
286
|
.catch(() => process.stdout.write('{"ok":false}'));
|
|
298
287
|
`;
|
|
299
|
-
return new Promise((
|
|
288
|
+
return new Promise((resolve21) => {
|
|
300
289
|
const child = spawn(process.execPath, ["--input-type=module", "-e", script], {
|
|
301
290
|
stdio: ["ignore", "pipe", "ignore"],
|
|
302
291
|
// The probe must never inherit a debugger port or loader flags that would
|
|
@@ -309,7 +298,7 @@ function defaultRunProbe(timeoutMs) {
|
|
|
309
298
|
if (settled) return;
|
|
310
299
|
settled = true;
|
|
311
300
|
clearTimeout(timer);
|
|
312
|
-
|
|
301
|
+
resolve21({ signal, status, stdout });
|
|
313
302
|
};
|
|
314
303
|
const timer = setTimeout(() => {
|
|
315
304
|
child.kill("SIGTERM");
|
|
@@ -352,7 +341,7 @@ async function embedderHealth(options = {}) {
|
|
|
352
341
|
}
|
|
353
342
|
function clearEmbedderHealth(cacheDir2) {
|
|
354
343
|
try {
|
|
355
|
-
|
|
344
|
+
fs14.unlinkSync(verdictPath(cacheDir2 ?? defaultCacheDir()));
|
|
356
345
|
} catch {
|
|
357
346
|
}
|
|
358
347
|
}
|
|
@@ -1027,7 +1016,7 @@ function liveStatsDir(root2) {
|
|
|
1027
1016
|
function reapOtherVersionServers(dir, keepVersion, now = Date.now(), kill = (pid, signal) => process.kill(pid, signal), selfPid = process.pid) {
|
|
1028
1017
|
let entries;
|
|
1029
1018
|
try {
|
|
1030
|
-
entries =
|
|
1019
|
+
entries = fs14.readdirSync(dir);
|
|
1031
1020
|
} catch {
|
|
1032
1021
|
return [];
|
|
1033
1022
|
}
|
|
@@ -1036,7 +1025,7 @@ function reapOtherVersionServers(dir, keepVersion, now = Date.now(), kill = (pid
|
|
|
1036
1025
|
if (!/^serve-\d+\.json$/.test(name)) continue;
|
|
1037
1026
|
let parsed;
|
|
1038
1027
|
try {
|
|
1039
|
-
parsed = JSON.parse(
|
|
1028
|
+
parsed = JSON.parse(fs14.readFileSync(path43.join(dir, name), "utf8"));
|
|
1040
1029
|
} catch {
|
|
1041
1030
|
continue;
|
|
1042
1031
|
}
|
|
@@ -1090,10 +1079,10 @@ var LiveStatsBus = class {
|
|
|
1090
1079
|
this.lastWriteAt = now;
|
|
1091
1080
|
const body = { pid: this.pid, updatedAt: now, version: VERSION, snapshot: snap };
|
|
1092
1081
|
try {
|
|
1093
|
-
|
|
1082
|
+
fs14.mkdirSync(this.dir, { recursive: true });
|
|
1094
1083
|
const tmp = `${this.file}.tmp`;
|
|
1095
|
-
|
|
1096
|
-
|
|
1084
|
+
fs14.writeFileSync(tmp, JSON.stringify(body));
|
|
1085
|
+
fs14.renameSync(tmp, this.file);
|
|
1097
1086
|
} catch {
|
|
1098
1087
|
}
|
|
1099
1088
|
}
|
|
@@ -1104,7 +1093,7 @@ var LiveStatsBus = class {
|
|
|
1104
1093
|
siblings(now = Date.now()) {
|
|
1105
1094
|
let entries;
|
|
1106
1095
|
try {
|
|
1107
|
-
entries =
|
|
1096
|
+
entries = fs14.readdirSync(this.dir);
|
|
1108
1097
|
} catch {
|
|
1109
1098
|
return [];
|
|
1110
1099
|
}
|
|
@@ -1114,14 +1103,14 @@ var LiveStatsBus = class {
|
|
|
1114
1103
|
const file = path43.join(this.dir, name);
|
|
1115
1104
|
let parsed;
|
|
1116
1105
|
try {
|
|
1117
|
-
parsed = JSON.parse(
|
|
1106
|
+
parsed = JSON.parse(fs14.readFileSync(file, "utf8"));
|
|
1118
1107
|
} catch {
|
|
1119
1108
|
continue;
|
|
1120
1109
|
}
|
|
1121
1110
|
if (typeof parsed?.pid !== "number" || typeof parsed.updatedAt !== "number" || !parsed.snapshot?.totals) continue;
|
|
1122
1111
|
if (now - parsed.updatedAt > STALE_MS) {
|
|
1123
1112
|
try {
|
|
1124
|
-
|
|
1113
|
+
fs14.unlinkSync(file);
|
|
1125
1114
|
} catch {
|
|
1126
1115
|
}
|
|
1127
1116
|
continue;
|
|
@@ -1133,7 +1122,7 @@ var LiveStatsBus = class {
|
|
|
1133
1122
|
}
|
|
1134
1123
|
unlinkOwn = () => {
|
|
1135
1124
|
try {
|
|
1136
|
-
|
|
1125
|
+
fs14.unlinkSync(this.file);
|
|
1137
1126
|
} catch {
|
|
1138
1127
|
}
|
|
1139
1128
|
};
|
|
@@ -1446,12 +1435,12 @@ var LedgerTail = class {
|
|
|
1446
1435
|
if (size === this.offset) return;
|
|
1447
1436
|
let chunk;
|
|
1448
1437
|
try {
|
|
1449
|
-
const fd =
|
|
1438
|
+
const fd = fs14.openSync(this.file, "r");
|
|
1450
1439
|
try {
|
|
1451
1440
|
chunk = Buffer.alloc(size - this.offset);
|
|
1452
|
-
|
|
1441
|
+
fs14.readSync(fd, chunk, 0, chunk.length, this.offset);
|
|
1453
1442
|
} finally {
|
|
1454
|
-
|
|
1443
|
+
fs14.closeSync(fd);
|
|
1455
1444
|
}
|
|
1456
1445
|
} catch {
|
|
1457
1446
|
return;
|
|
@@ -1464,7 +1453,7 @@ var LedgerTail = class {
|
|
|
1464
1453
|
}
|
|
1465
1454
|
sizeOf() {
|
|
1466
1455
|
try {
|
|
1467
|
-
return
|
|
1456
|
+
return fs14.statSync(this.file).size;
|
|
1468
1457
|
} catch {
|
|
1469
1458
|
return 0;
|
|
1470
1459
|
}
|
|
@@ -1643,7 +1632,7 @@ async function serveHttp(graphPath, host, port, opts, freshness, onReady) {
|
|
|
1643
1632
|
info(c.red(`vg serve: request error: ${err.message}`));
|
|
1644
1633
|
}
|
|
1645
1634
|
});
|
|
1646
|
-
await new Promise((
|
|
1635
|
+
await new Promise((resolve21) => httpServer.listen(port, host, resolve21));
|
|
1647
1636
|
info(c.dim(`vg \xB7 MCP server on http://${host}:${port}/mcp (read-only, local, ${freshness})`));
|
|
1648
1637
|
onReady?.();
|
|
1649
1638
|
await new Promise(() => {
|
|
@@ -1864,7 +1853,7 @@ function manifestHash(root2) {
|
|
|
1864
1853
|
const walk2 = (dir) => {
|
|
1865
1854
|
let entries;
|
|
1866
1855
|
try {
|
|
1867
|
-
entries =
|
|
1856
|
+
entries = fs14.readdirSync(dir, { withFileTypes: true });
|
|
1868
1857
|
} catch {
|
|
1869
1858
|
return;
|
|
1870
1859
|
}
|
|
@@ -1880,7 +1869,7 @@ function manifestHash(root2) {
|
|
|
1880
1869
|
if (!isManifest(abs) && !SKIP_FILES.has(base)) continue;
|
|
1881
1870
|
try {
|
|
1882
1871
|
const rel = path43.relative(root2, abs).split(path43.sep).join("/");
|
|
1883
|
-
files.push({ rel, hash: hashBytes(
|
|
1872
|
+
files.push({ rel, hash: hashBytes(fs14.readFileSync(abs)) });
|
|
1884
1873
|
} catch {
|
|
1885
1874
|
}
|
|
1886
1875
|
}
|
|
@@ -1899,7 +1888,7 @@ function isDependencyFile(root2, filePath) {
|
|
|
1899
1888
|
}
|
|
1900
1889
|
function loadScanCache(root2, key2) {
|
|
1901
1890
|
try {
|
|
1902
|
-
const raw = JSON.parse(
|
|
1891
|
+
const raw = JSON.parse(fs14.readFileSync(cachePath(root2), "utf8"));
|
|
1903
1892
|
if (raw.version === CACHE_VERSION && raw.manifestHash === key2.manifestHash && raw.toolVersion === key2.toolVersion && raw.offline === key2.offline && raw.artifact) {
|
|
1904
1893
|
return { manifestHash: raw.manifestHash, artifact: raw.artifact };
|
|
1905
1894
|
}
|
|
@@ -1909,8 +1898,8 @@ function loadScanCache(root2, key2) {
|
|
|
1909
1898
|
}
|
|
1910
1899
|
function writeScanCache(root2, key2, artifact) {
|
|
1911
1900
|
try {
|
|
1912
|
-
|
|
1913
|
-
|
|
1901
|
+
fs14.mkdirSync(cacheDir(root2), { recursive: true });
|
|
1902
|
+
fs14.writeFileSync(
|
|
1914
1903
|
cachePath(root2),
|
|
1915
1904
|
stableStringify(
|
|
1916
1905
|
{ version: CACHE_VERSION, manifestHash: key2.manifestHash, toolVersion: key2.toolVersion, offline: key2.offline, artifact },
|
|
@@ -1937,7 +1926,7 @@ function parseLine(line) {
|
|
|
1937
1926
|
}
|
|
1938
1927
|
function readHistory(root2) {
|
|
1939
1928
|
try {
|
|
1940
|
-
return
|
|
1929
|
+
return fs14.readFileSync(historyPath(root2), "utf8").split("\n").filter((l) => l.trim()).map(parseLine).filter((e) => e !== null);
|
|
1941
1930
|
} catch {
|
|
1942
1931
|
return [];
|
|
1943
1932
|
}
|
|
@@ -1964,14 +1953,14 @@ function recordScore(root2, entry) {
|
|
|
1964
1953
|
}
|
|
1965
1954
|
}
|
|
1966
1955
|
const file = historyPath(root2);
|
|
1967
|
-
|
|
1956
|
+
fs14.mkdirSync(path43.dirname(file), { recursive: true });
|
|
1968
1957
|
ensureVibgrateGitignore(root2);
|
|
1969
|
-
|
|
1958
|
+
fs14.appendFileSync(file, `${JSON.stringify(entry)}
|
|
1970
1959
|
`);
|
|
1971
1960
|
const all = readHistory(root2);
|
|
1972
1961
|
if (all.length > MAX_ENTRIES) {
|
|
1973
1962
|
const kept = all.slice(-KEEP_ENTRIES);
|
|
1974
|
-
|
|
1963
|
+
fs14.writeFileSync(file, kept.map((e) => JSON.stringify(e)).join("\n") + "\n");
|
|
1975
1964
|
}
|
|
1976
1965
|
} catch {
|
|
1977
1966
|
}
|
|
@@ -1981,6 +1970,71 @@ function deltaFrom(prev, current) {
|
|
|
1981
1970
|
if (prev.methodology !== current.methodology) return void 0;
|
|
1982
1971
|
return current.score - prev.score;
|
|
1983
1972
|
}
|
|
1973
|
+
function ignoreFilePath(root2) {
|
|
1974
|
+
return path43.join(root2, ".vibgrate", "ignore.json");
|
|
1975
|
+
}
|
|
1976
|
+
function isActive(entry, now = Date.now()) {
|
|
1977
|
+
if (!entry.until) return true;
|
|
1978
|
+
const t = Date.parse(entry.until);
|
|
1979
|
+
if (!Number.isFinite(t)) return true;
|
|
1980
|
+
return now <= t + 24 * 60 * 60 * 1e3 - 1;
|
|
1981
|
+
}
|
|
1982
|
+
function readIgnores(root2, now = Date.now()) {
|
|
1983
|
+
const out2 = /* @__PURE__ */ new Map();
|
|
1984
|
+
let raw;
|
|
1985
|
+
try {
|
|
1986
|
+
raw = fs14.readFileSync(ignoreFilePath(root2), "utf8");
|
|
1987
|
+
} catch {
|
|
1988
|
+
return out2;
|
|
1989
|
+
}
|
|
1990
|
+
try {
|
|
1991
|
+
const parsed = JSON.parse(raw);
|
|
1992
|
+
if (!Array.isArray(parsed.ignores)) return out2;
|
|
1993
|
+
for (const e of parsed.ignores) {
|
|
1994
|
+
const entry = e;
|
|
1995
|
+
if (typeof entry.package !== "string" || !entry.package.trim()) continue;
|
|
1996
|
+
const clean = { package: entry.package.trim() };
|
|
1997
|
+
if (typeof entry.reason === "string" && entry.reason.trim()) clean.reason = entry.reason.trim();
|
|
1998
|
+
if (typeof entry.until === "string" && entry.until.trim()) clean.until = entry.until.trim();
|
|
1999
|
+
if (isActive(clean, now)) out2.set(clean.package.toLowerCase(), clean);
|
|
2000
|
+
}
|
|
2001
|
+
} catch {
|
|
2002
|
+
}
|
|
2003
|
+
return out2;
|
|
2004
|
+
}
|
|
2005
|
+
function inventoryPath(root2) {
|
|
2006
|
+
return path43.join(root2, ".vibgrate", "inline-inventory.json");
|
|
2007
|
+
}
|
|
2008
|
+
function inventoryKey(projectPath, pkg) {
|
|
2009
|
+
return `${projectPath}::${pkg}`;
|
|
2010
|
+
}
|
|
2011
|
+
function readInventory(root2) {
|
|
2012
|
+
try {
|
|
2013
|
+
const parsed = JSON.parse(fs14.readFileSync(inventoryPath(root2), "utf8"));
|
|
2014
|
+
if (typeof parsed.ts === "string" && typeof parsed.methodology === "string" && Array.isArray(parsed.drifted) && parsed.drifted.every((d) => typeof d === "string")) {
|
|
2015
|
+
return parsed;
|
|
2016
|
+
}
|
|
2017
|
+
} catch {
|
|
2018
|
+
}
|
|
2019
|
+
return null;
|
|
2020
|
+
}
|
|
2021
|
+
function recordInventory(root2, snap) {
|
|
2022
|
+
try {
|
|
2023
|
+
ensureVibgrateGitignore(root2);
|
|
2024
|
+
fs14.writeFileSync(inventoryPath(root2), `${JSON.stringify(snap)}
|
|
2025
|
+
`);
|
|
2026
|
+
} catch {
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
function newlyDrifted(prev, current) {
|
|
2030
|
+
const out2 = /* @__PURE__ */ new Set();
|
|
2031
|
+
if (!prev || prev.methodology !== current.methodology || prev.ts === current.ts) return out2;
|
|
2032
|
+
const before = new Set(prev.drifted);
|
|
2033
|
+
for (const key2 of current.drifted) {
|
|
2034
|
+
if (!before.has(key2)) out2.add(key2);
|
|
2035
|
+
}
|
|
2036
|
+
return out2;
|
|
2037
|
+
}
|
|
1984
2038
|
|
|
1985
2039
|
// src/lsp/graph-query.ts
|
|
1986
2040
|
function semanticBudgetMs() {
|
|
@@ -2511,6 +2565,10 @@ var VibgrateLanguageServer = class {
|
|
|
2511
2565
|
docs = /* @__PURE__ */ new Map();
|
|
2512
2566
|
// uri → text
|
|
2513
2567
|
artifact = null;
|
|
2568
|
+
/** Active `.vibgrate/ignore.json` entries, refreshed once per scan. */
|
|
2569
|
+
ignores = /* @__PURE__ */ new Map();
|
|
2570
|
+
/** `project.path::package` drifted now but not in the previous snapshot. */
|
|
2571
|
+
newDrift = /* @__PURE__ */ new Set();
|
|
2514
2572
|
scanning = false;
|
|
2515
2573
|
queued = false;
|
|
2516
2574
|
/**
|
|
@@ -2711,6 +2769,18 @@ var VibgrateLanguageServer = class {
|
|
|
2711
2769
|
};
|
|
2712
2770
|
const delta = deltaFrom(lastEntry(this.opts.root), historyEntry);
|
|
2713
2771
|
recordScore(this.opts.root, historyEntry);
|
|
2772
|
+
this.ignores = readIgnores(this.opts.root);
|
|
2773
|
+
const driftedKeys = [];
|
|
2774
|
+
for (const proj of a.projects ?? []) {
|
|
2775
|
+
for (const dep of proj.dependencies ?? []) {
|
|
2776
|
+
if (dep.drift === "major-behind" || dep.drift === "minor-behind") {
|
|
2777
|
+
driftedKeys.push(inventoryKey(proj.path, dep.package));
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
const snapshot = { ts: a.timestamp, methodology: historyEntry.methodology, drifted: driftedKeys };
|
|
2782
|
+
this.newDrift = newlyDrifted(readInventory(this.opts.root), snapshot);
|
|
2783
|
+
recordInventory(this.opts.root, snapshot);
|
|
2714
2784
|
const payload = {
|
|
2715
2785
|
score: a.drift.score,
|
|
2716
2786
|
band,
|
|
@@ -2744,12 +2814,19 @@ var VibgrateLanguageServer = class {
|
|
|
2744
2814
|
if (dep.drift === "current" || dep.drift === "unknown") continue;
|
|
2745
2815
|
const line = findPackageLine(text, dep.package, kind);
|
|
2746
2816
|
if (line === -1) continue;
|
|
2817
|
+
const ignored = this.ignores.get(dep.package.toLowerCase());
|
|
2818
|
+
const isNew = project ? this.newDrift.has(inventoryKey(project.path, dep.package)) : false;
|
|
2747
2819
|
items.push({
|
|
2748
2820
|
line,
|
|
2749
2821
|
endCol: endOfLine(text, line),
|
|
2750
|
-
text: inlineLabel(dep),
|
|
2751
|
-
|
|
2752
|
-
|
|
2822
|
+
text: inlineLabel(dep, { ignored: !!ignored, isNew }),
|
|
2823
|
+
// An acknowledged ignore stops shouting: the engine calms the band to
|
|
2824
|
+
// low (presentation only — the score is untouched). The client still
|
|
2825
|
+
// never derives a band; it renders this one.
|
|
2826
|
+
band: ignored ? "low" : bandForDependency(dep),
|
|
2827
|
+
package: dep.package,
|
|
2828
|
+
...ignored ? { ignored: true } : {},
|
|
2829
|
+
...isNew ? { newSincePrev: true } : {}
|
|
2753
2830
|
});
|
|
2754
2831
|
}
|
|
2755
2832
|
this.conn.notify("vibgrate/inline", { uri, items });
|
|
@@ -2757,7 +2834,10 @@ var VibgrateLanguageServer = class {
|
|
|
2757
2834
|
this.conn.notify("textDocument/publishDiagnostics", { uri, diagnostics: [] });
|
|
2758
2835
|
return;
|
|
2759
2836
|
}
|
|
2760
|
-
const diagnostics = (a.findings ?? []).filter((f) => DIAGNOSTIC_RULES.has(f.ruleId)).filter((f) => project && sameProject(f.location, project.path)).
|
|
2837
|
+
const diagnostics = (a.findings ?? []).filter((f) => DIAGNOSTIC_RULES.has(f.ruleId)).filter((f) => project && sameProject(f.location, project.path)).filter((f) => {
|
|
2838
|
+
const pkg = f.details?.["package"];
|
|
2839
|
+
return !(typeof pkg === "string" && this.ignores.has(pkg.toLowerCase()));
|
|
2840
|
+
}).map((f) => {
|
|
2761
2841
|
const line = Math.max(0, findRuntimeLine(text, kind));
|
|
2762
2842
|
return {
|
|
2763
2843
|
range: {
|
|
@@ -2787,10 +2867,18 @@ var VibgrateLanguageServer = class {
|
|
|
2787
2867
|
const dep = (project?.dependencies ?? []).find(
|
|
2788
2868
|
(d) => findPackageLine(text, d.package, kind) === line
|
|
2789
2869
|
);
|
|
2790
|
-
if (!dep)
|
|
2870
|
+
if (!dep) {
|
|
2871
|
+
if (project && line === Math.max(0, findRuntimeLine(text, kind))) {
|
|
2872
|
+
const value = runtimeHoverMarkdown(project, a.findings ?? []);
|
|
2873
|
+
return value ? { contents: { kind: "markdown", value } } : null;
|
|
2874
|
+
}
|
|
2875
|
+
return null;
|
|
2876
|
+
}
|
|
2791
2877
|
const contribution = a.drift.dependencyDrift?.top.find((t) => t.package === dep.package)?.drift ?? null;
|
|
2878
|
+
const ignored = this.ignores.get(dep.package.toLowerCase());
|
|
2879
|
+
const isNew = project ? this.newDrift.has(inventoryKey(project.path, dep.package)) : false;
|
|
2792
2880
|
return {
|
|
2793
|
-
contents: { kind: "markdown", value: hoverMarkdown(dep, contribution) }
|
|
2881
|
+
contents: { kind: "markdown", value: hoverMarkdown(dep, contribution, { ignored, isNew }) }
|
|
2794
2882
|
};
|
|
2795
2883
|
}
|
|
2796
2884
|
onCodeLens(params) {
|
|
@@ -2946,7 +3034,7 @@ var VibgrateLanguageServer = class {
|
|
|
2946
3034
|
const absManifest = path43.resolve(this.opts.root, relManifest);
|
|
2947
3035
|
let text = null;
|
|
2948
3036
|
try {
|
|
2949
|
-
if (
|
|
3037
|
+
if (fs14.existsSync(absManifest)) text = fs14.readFileSync(absManifest, "utf8");
|
|
2950
3038
|
} catch {
|
|
2951
3039
|
text = null;
|
|
2952
3040
|
}
|
|
@@ -3220,7 +3308,7 @@ function buildBreakdown(rootDir, projects) {
|
|
|
3220
3308
|
const absManifest = path43.resolve(rootDir, relManifest);
|
|
3221
3309
|
let text = null;
|
|
3222
3310
|
try {
|
|
3223
|
-
if (
|
|
3311
|
+
if (fs14.existsSync(absManifest)) text = fs14.readFileSync(absManifest, "utf8");
|
|
3224
3312
|
} catch {
|
|
3225
3313
|
text = null;
|
|
3226
3314
|
}
|
|
@@ -3285,34 +3373,34 @@ function buildBreakdown(rootDir, projects) {
|
|
|
3285
3373
|
}
|
|
3286
3374
|
function manifestRelativePath(proj) {
|
|
3287
3375
|
const base = proj.path === "." || proj.path === "" ? "" : proj.path;
|
|
3288
|
-
const
|
|
3376
|
+
const join35 = (name) => base ? path43.join(base, name) : name;
|
|
3289
3377
|
switch (proj.type) {
|
|
3290
3378
|
case "node":
|
|
3291
3379
|
case "typescript":
|
|
3292
|
-
return
|
|
3380
|
+
return join35("package.json");
|
|
3293
3381
|
case "python":
|
|
3294
|
-
return
|
|
3382
|
+
return join35("pyproject.toml");
|
|
3295
3383
|
case "go":
|
|
3296
|
-
return
|
|
3384
|
+
return join35("go.mod");
|
|
3297
3385
|
case "rust":
|
|
3298
|
-
return
|
|
3386
|
+
return join35("Cargo.toml");
|
|
3299
3387
|
case "ruby":
|
|
3300
|
-
return
|
|
3388
|
+
return join35("Gemfile");
|
|
3301
3389
|
case "php":
|
|
3302
|
-
return
|
|
3390
|
+
return join35("composer.json");
|
|
3303
3391
|
case "java":
|
|
3304
3392
|
case "kotlin":
|
|
3305
3393
|
case "scala":
|
|
3306
3394
|
case "groovy":
|
|
3307
|
-
return
|
|
3395
|
+
return join35("pom.xml");
|
|
3308
3396
|
case "dotnet":
|
|
3309
|
-
return
|
|
3397
|
+
return join35(proj.name ? `${proj.name}.csproj` : "Directory.Build.props");
|
|
3310
3398
|
case "dart":
|
|
3311
|
-
return
|
|
3399
|
+
return join35("pubspec.yaml");
|
|
3312
3400
|
case "elixir":
|
|
3313
|
-
return
|
|
3401
|
+
return join35("mix.exs");
|
|
3314
3402
|
default:
|
|
3315
|
-
return
|
|
3403
|
+
return join35("package.json");
|
|
3316
3404
|
}
|
|
3317
3405
|
}
|
|
3318
3406
|
function lockfileRelativePath(rootDir, proj) {
|
|
@@ -3345,7 +3433,7 @@ function lockfileRelativePath(rootDir, proj) {
|
|
|
3345
3433
|
for (const name of candidateNames) {
|
|
3346
3434
|
const rel = dir ? path43.join(dir, name) : name;
|
|
3347
3435
|
try {
|
|
3348
|
-
if (
|
|
3436
|
+
if (fs14.existsSync(path43.join(rootDir, rel))) return rel;
|
|
3349
3437
|
} catch {
|
|
3350
3438
|
}
|
|
3351
3439
|
}
|
|
@@ -3417,9 +3505,9 @@ function lookupImportFiles(map, pkg) {
|
|
|
3417
3505
|
function firstPackageMentionLine(root2, relFile, pkg) {
|
|
3418
3506
|
try {
|
|
3419
3507
|
const abs = path43.resolve(root2, relFile);
|
|
3420
|
-
const stat2 =
|
|
3508
|
+
const stat2 = fs14.statSync(abs);
|
|
3421
3509
|
if (!stat2.isFile() || stat2.size > 256 * 1024) return null;
|
|
3422
|
-
const text =
|
|
3510
|
+
const text = fs14.readFileSync(abs, "utf8");
|
|
3423
3511
|
const tokens = [pkg];
|
|
3424
3512
|
if (pkg.startsWith("@")) {
|
|
3425
3513
|
const parts = pkg.split("/");
|
|
@@ -3479,8 +3567,11 @@ function inRangeStep(dep) {
|
|
|
3479
3567
|
const diff2 = semver3.diff(dep.resolvedVersion, target);
|
|
3480
3568
|
return { version: target, size: diff2 === "patch" || diff2 === "prepatch" ? "patch" : "minor" };
|
|
3481
3569
|
}
|
|
3482
|
-
function inlineLabel(dep) {
|
|
3570
|
+
function inlineLabel(dep, state) {
|
|
3483
3571
|
const bits = [];
|
|
3572
|
+
if (state?.ignored) bits.push("ignored");
|
|
3573
|
+
if (dep.unsupported) bits.push("unsupported");
|
|
3574
|
+
else if (dep.abandoned) bits.push("abandoned");
|
|
3484
3575
|
if (dep.drift === "major-behind") {
|
|
3485
3576
|
const step2 = inRangeStep(dep);
|
|
3486
3577
|
if (step2) bits.push(`${step2.size} behind`, step2.version);
|
|
@@ -3493,8 +3584,38 @@ function inlineLabel(dep) {
|
|
|
3493
3584
|
if (dep.ageDays != null && dep.ageDays >= 1) {
|
|
3494
3585
|
bits.push(`${Math.round(dep.ageDays).toLocaleString("en-US")}d stale`);
|
|
3495
3586
|
}
|
|
3587
|
+
if (state?.isNew) bits.push("new");
|
|
3496
3588
|
return bits.join(" \xB7 ");
|
|
3497
3589
|
}
|
|
3590
|
+
function runtimeHoverMarkdown(project, findings, now = Date.now()) {
|
|
3591
|
+
const lines = [];
|
|
3592
|
+
const label = runtimeHorizonLabel(project);
|
|
3593
|
+
if (project.runtimeEolDate) {
|
|
3594
|
+
const t = Date.parse(project.runtimeEolDate);
|
|
3595
|
+
if (Number.isFinite(t)) {
|
|
3596
|
+
const days = Math.round((t - now) / (24 * 60 * 60 * 1e3));
|
|
3597
|
+
const when = days < 0 ? `**EOL ${project.runtimeEolDate}** \u2014 ${Math.abs(days).toLocaleString("en-US")} days ago` : `EOL ${project.runtimeEolDate} \u2014 in ${days.toLocaleString("en-US")} days`;
|
|
3598
|
+
lines.push(`**${label}**`);
|
|
3599
|
+
lines.push("");
|
|
3600
|
+
lines.push(days < 0 ? `$(warning) ${when}` : when);
|
|
3601
|
+
}
|
|
3602
|
+
}
|
|
3603
|
+
const runtimeFindings = findings.filter(
|
|
3604
|
+
(f) => DIAGNOSTIC_RULES.has(f.ruleId) && (f.ruleId.startsWith("vibgrate/runtime") || f.ruleId === "vibgrate/eol")
|
|
3605
|
+
).filter((f) => sameProject(f.location, project.path));
|
|
3606
|
+
if (runtimeFindings.length) {
|
|
3607
|
+
if (!lines.length) {
|
|
3608
|
+
lines.push(`**${label}**`);
|
|
3609
|
+
}
|
|
3610
|
+
lines.push("");
|
|
3611
|
+
for (const f of runtimeFindings.slice(0, 4)) lines.push(`- ${f.message}`);
|
|
3612
|
+
}
|
|
3613
|
+
if (!lines.length) return null;
|
|
3614
|
+
lines.push("");
|
|
3615
|
+
lines.push("---");
|
|
3616
|
+
lines.push("$(shield) EOL dates from the Runtime Catalog (endoflife.date). Resolved locally.");
|
|
3617
|
+
return lines.join("\n");
|
|
3618
|
+
}
|
|
3498
3619
|
function commandUri(command, args) {
|
|
3499
3620
|
return `command:${command}?${encodeURIComponent(JSON.stringify([args]))}`;
|
|
3500
3621
|
}
|
|
@@ -3515,12 +3636,23 @@ function versionJourney(yours, latest) {
|
|
|
3515
3636
|
const shown = majors.length > 5 ? [majors[0], majors[1], -1, majors[majors.length - 2], majors[majors.length - 1]] : majors;
|
|
3516
3637
|
return shown.map((m) => m === -1 ? "\u2026" : `${m}.x`).join(" \u2192 ");
|
|
3517
3638
|
}
|
|
3518
|
-
function hoverMarkdown(dep, contribution) {
|
|
3639
|
+
function hoverMarkdown(dep, contribution, state) {
|
|
3519
3640
|
const lines = [];
|
|
3520
3641
|
const badge = driftBadge(dep);
|
|
3521
3642
|
const contributionText = contribution != null ? ` \xB7 contributes +${Math.round(contribution)} to drift` : "";
|
|
3522
3643
|
lines.push(badge ? `**${dep.package}** \`${badge}\`${contributionText}` : `**${dep.package}**`);
|
|
3523
3644
|
lines.push("");
|
|
3645
|
+
if (state?.ignored) {
|
|
3646
|
+
const ig = state.ignored;
|
|
3647
|
+
const why = ig.reason ? ` \u2014 ${ig.reason}` : "";
|
|
3648
|
+
const until = ig.until ? ` (until ${ig.until})` : "";
|
|
3649
|
+
lines.push(`$(eye-closed) **Ignored**${why}${until} \xB7 \`.vibgrate/ignore.json\``);
|
|
3650
|
+
lines.push("");
|
|
3651
|
+
}
|
|
3652
|
+
if (state?.isNew) {
|
|
3653
|
+
lines.push("_New drift \u2014 this dependency was not behind in the previous recorded scan._");
|
|
3654
|
+
lines.push("");
|
|
3655
|
+
}
|
|
3524
3656
|
const yours = dep.resolvedVersion ?? dep.currentSpec;
|
|
3525
3657
|
const drifted = dep.drift === "major-behind" || dep.drift === "minor-behind";
|
|
3526
3658
|
if (dep.latestStable && dep.latestStable !== yours) {
|
|
@@ -3571,7 +3703,7 @@ function hoverMarkdown(dep, contribution) {
|
|
|
3571
3703
|
return lines.join("\n");
|
|
3572
3704
|
}
|
|
3573
3705
|
function startLanguageServer(opts) {
|
|
3574
|
-
if (!
|
|
3706
|
+
if (!fs14.existsSync(opts.root)) {
|
|
3575
3707
|
process.stderr.write(`vg lsp: root does not exist: ${opts.root}
|
|
3576
3708
|
`);
|
|
3577
3709
|
process.exit(1);
|
|
@@ -3623,9 +3755,9 @@ function installClaudeHooks(root2, vgBin = "vg") {
|
|
|
3623
3755
|
const file = path43.join(root2, ".claude", "settings.json");
|
|
3624
3756
|
const rel = path43.join(".claude", "settings.json");
|
|
3625
3757
|
let settings = {};
|
|
3626
|
-
if (
|
|
3758
|
+
if (fs14.existsSync(file)) {
|
|
3627
3759
|
try {
|
|
3628
|
-
const parsed = JSON.parse(
|
|
3760
|
+
const parsed = JSON.parse(fs14.readFileSync(file, "utf8"));
|
|
3629
3761
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
3630
3762
|
return { file: rel, status: "skipped", note: "settings.json is not a JSON object \u2014 left untouched" };
|
|
3631
3763
|
}
|
|
@@ -3664,10 +3796,10 @@ function installClaudeHooks(root2, vgBin = "vg") {
|
|
|
3664
3796
|
function uninstallClaudeHooks(root2) {
|
|
3665
3797
|
const file = path43.join(root2, ".claude", "settings.json");
|
|
3666
3798
|
const rel = path43.join(".claude", "settings.json");
|
|
3667
|
-
if (!
|
|
3799
|
+
if (!fs14.existsSync(file)) return { file: rel, status: "unchanged" };
|
|
3668
3800
|
let settings;
|
|
3669
3801
|
try {
|
|
3670
|
-
settings = JSON.parse(
|
|
3802
|
+
settings = JSON.parse(fs14.readFileSync(file, "utf8"));
|
|
3671
3803
|
} catch {
|
|
3672
3804
|
return { file: rel, status: "skipped", note: "settings.json is not parseable JSON \u2014 left untouched" };
|
|
3673
3805
|
}
|
|
@@ -3689,8 +3821,8 @@ function uninstallClaudeHooks(root2) {
|
|
|
3689
3821
|
return { file: rel, status: "written" };
|
|
3690
3822
|
}
|
|
3691
3823
|
function writeSettings(file, settings) {
|
|
3692
|
-
|
|
3693
|
-
|
|
3824
|
+
fs14.mkdirSync(path43.dirname(file), { recursive: true });
|
|
3825
|
+
fs14.writeFileSync(file, `${JSON.stringify(settings, null, 2)}
|
|
3694
3826
|
`);
|
|
3695
3827
|
}
|
|
3696
3828
|
|
|
@@ -3738,7 +3870,7 @@ function registerInstall(program) {
|
|
|
3738
3870
|
}
|
|
3739
3871
|
return;
|
|
3740
3872
|
}
|
|
3741
|
-
const targets = opts.all ? ASSISTANTS : opts.detect ? detected.map((d) => d.assistant) : tools.map(
|
|
3873
|
+
const targets = opts.all ? ASSISTANTS : opts.detect ? detected.map((d) => d.assistant) : tools.map(resolve4);
|
|
3742
3874
|
if (targets.length === 0) {
|
|
3743
3875
|
if (opts.detect) {
|
|
3744
3876
|
if (global.json) json({ root: root2, detected: [], results: [] });
|
|
@@ -3775,8 +3907,8 @@ function registerInstall(program) {
|
|
|
3775
3907
|
const uninstall = program.command("uninstall").description("remove vg from an AI assistant").argument("<tools...>", "assistant ids").option("--purge", "also delete the skill file").action(function(tools, opts) {
|
|
3776
3908
|
const global = readGlobal(this);
|
|
3777
3909
|
const root2 = rootOf(global);
|
|
3778
|
-
const results = tools.map(
|
|
3779
|
-
if (tools.map(
|
|
3910
|
+
const results = tools.map(resolve4).map((a) => ({ id: a.id, removed: uninstallAssistant(a, root2, !!opts.purge) }));
|
|
3911
|
+
if (tools.map(resolve4).some((a) => a.id === "claude")) {
|
|
3780
3912
|
const hooksResult = uninstallClaudeHooks(root2);
|
|
3781
3913
|
if (hooksResult.status === "written") results.find((r) => r.id === "claude")?.removed.push(`${hooksResult.file} (vg hook entries)`);
|
|
3782
3914
|
}
|
|
@@ -3790,7 +3922,7 @@ function registerInstall(program) {
|
|
|
3790
3922
|
});
|
|
3791
3923
|
applyGlobalOptions(uninstall);
|
|
3792
3924
|
}
|
|
3793
|
-
function
|
|
3925
|
+
function resolve4(id) {
|
|
3794
3926
|
const a = assistantById(id);
|
|
3795
3927
|
if (!a) {
|
|
3796
3928
|
const near = ASSISTANTS.filter(
|
|
@@ -3817,15 +3949,15 @@ function stateFile() {
|
|
|
3817
3949
|
}
|
|
3818
3950
|
function readConsent() {
|
|
3819
3951
|
try {
|
|
3820
|
-
return JSON.parse(
|
|
3952
|
+
return JSON.parse(fs14.readFileSync(stateFile(), "utf8"));
|
|
3821
3953
|
} catch {
|
|
3822
3954
|
return {};
|
|
3823
3955
|
}
|
|
3824
3956
|
}
|
|
3825
3957
|
function writeConsent(state) {
|
|
3826
3958
|
try {
|
|
3827
|
-
|
|
3828
|
-
|
|
3959
|
+
fs14.mkdirSync(path43.dirname(stateFile()), { recursive: true });
|
|
3960
|
+
fs14.writeFileSync(stateFile(), JSON.stringify(state));
|
|
3829
3961
|
} catch {
|
|
3830
3962
|
}
|
|
3831
3963
|
}
|
|
@@ -3835,8 +3967,8 @@ function kernelDisabled() {
|
|
|
3835
3967
|
}
|
|
3836
3968
|
function moduleInstalledAt(dir) {
|
|
3837
3969
|
try {
|
|
3838
|
-
const meta = JSON.parse(
|
|
3839
|
-
if (
|
|
3970
|
+
const meta = JSON.parse(fs14.readFileSync(path43.join(dir, ".module.json"), "utf8"));
|
|
3971
|
+
if (fs14.existsSync(path43.join(dir, "index.js"))) {
|
|
3840
3972
|
return { installed: true, version: meta.version };
|
|
3841
3973
|
}
|
|
3842
3974
|
} catch {
|
|
@@ -3910,8 +4042,8 @@ async function installModule(mod, opts = {}) {
|
|
|
3910
4042
|
verifyIntegrity(gz, dist.integrity, dist.shasum);
|
|
3911
4043
|
const entries = untar(zlib.gunzipSync(gz));
|
|
3912
4044
|
const dir = mod.dir();
|
|
3913
|
-
|
|
3914
|
-
|
|
4045
|
+
fs14.rmSync(dir, { recursive: true, force: true });
|
|
4046
|
+
fs14.mkdirSync(dir, { recursive: true });
|
|
3915
4047
|
let wrote = 0;
|
|
3916
4048
|
for (const e of entries) {
|
|
3917
4049
|
let rel = null;
|
|
@@ -3920,15 +4052,15 @@ async function installModule(mod, opts = {}) {
|
|
|
3920
4052
|
if (!rel) continue;
|
|
3921
4053
|
const target = path43.join(dir, rel);
|
|
3922
4054
|
if (!target.startsWith(dir + path43.sep) && target !== dir) throw new Error(`unsafe extract path: ${rel}`);
|
|
3923
|
-
|
|
3924
|
-
|
|
4055
|
+
fs14.mkdirSync(path43.dirname(target), { recursive: true });
|
|
4056
|
+
fs14.writeFileSync(target, e.body);
|
|
3925
4057
|
wrote += 1;
|
|
3926
4058
|
}
|
|
3927
|
-
if (!wrote || !
|
|
3928
|
-
|
|
4059
|
+
if (!wrote || !fs14.existsSync(path43.join(dir, "index.js"))) {
|
|
4060
|
+
fs14.rmSync(dir, { recursive: true, force: true });
|
|
3929
4061
|
return { status: "unavailable", detail: "package layout not recognized (no dist/index.js)" };
|
|
3930
4062
|
}
|
|
3931
|
-
|
|
4063
|
+
fs14.writeFileSync(path43.join(dir, ".module.json"), JSON.stringify({ name: mod.npmName, version }));
|
|
3932
4064
|
mod.onChanged?.();
|
|
3933
4065
|
return { status: "installed", version };
|
|
3934
4066
|
} catch (e) {
|
|
@@ -3936,7 +4068,7 @@ async function installModule(mod, opts = {}) {
|
|
|
3936
4068
|
}
|
|
3937
4069
|
}
|
|
3938
4070
|
function removeModule(mod) {
|
|
3939
|
-
|
|
4071
|
+
fs14.rmSync(mod.dir(), { recursive: true, force: true });
|
|
3940
4072
|
mod.onChanged?.();
|
|
3941
4073
|
}
|
|
3942
4074
|
|
|
@@ -3981,7 +4113,7 @@ function candidatePaths() {
|
|
|
3981
4113
|
if (custom) {
|
|
3982
4114
|
const p = path43.resolve(custom);
|
|
3983
4115
|
try {
|
|
3984
|
-
if (
|
|
4116
|
+
if (fs14.statSync(p).isDirectory()) return [path43.join(p, "index.js")];
|
|
3985
4117
|
} catch {
|
|
3986
4118
|
}
|
|
3987
4119
|
return [p];
|
|
@@ -3997,7 +4129,7 @@ async function loadHcsEngine() {
|
|
|
3997
4129
|
cached = null;
|
|
3998
4130
|
if (disabled()) return cached;
|
|
3999
4131
|
for (const p of candidatePaths()) {
|
|
4000
|
-
if (!
|
|
4132
|
+
if (!fs14.existsSync(p)) continue;
|
|
4001
4133
|
try {
|
|
4002
4134
|
const mod = await import(pathToFileURL(p).href);
|
|
4003
4135
|
const engine = await mod.createHcsEngine?.();
|
|
@@ -4136,11 +4268,11 @@ function requireModule(name) {
|
|
|
4136
4268
|
return mod;
|
|
4137
4269
|
}
|
|
4138
4270
|
function confirm(question) {
|
|
4139
|
-
return new Promise((
|
|
4271
|
+
return new Promise((resolve21) => {
|
|
4140
4272
|
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
4141
4273
|
rl.question(question, (answer) => {
|
|
4142
4274
|
rl.close();
|
|
4143
|
-
|
|
4275
|
+
resolve21(answer.trim() === "" || /^y(es)?$/i.test(answer.trim()));
|
|
4144
4276
|
});
|
|
4145
4277
|
});
|
|
4146
4278
|
}
|
|
@@ -4164,7 +4296,7 @@ function hookContext(payloadText, root2, graphOverride) {
|
|
|
4164
4296
|
let graph;
|
|
4165
4297
|
try {
|
|
4166
4298
|
const preferred = loadGraphPreferIndex(root2, graphPath);
|
|
4167
|
-
graph = preferred ? preferred.graph : parseGraph(
|
|
4299
|
+
graph = preferred ? preferred.graph : parseGraph(fs14.readFileSync(graphPath, "utf8"));
|
|
4168
4300
|
} catch {
|
|
4169
4301
|
return null;
|
|
4170
4302
|
}
|
|
@@ -4186,7 +4318,7 @@ function registerHook(program) {
|
|
|
4186
4318
|
const global = readGlobal(this);
|
|
4187
4319
|
const root2 = rootOf(global);
|
|
4188
4320
|
try {
|
|
4189
|
-
const stdin =
|
|
4321
|
+
const stdin = fs14.readFileSync(0, "utf8");
|
|
4190
4322
|
const context = hookContext(stdin, root2, global.graph);
|
|
4191
4323
|
if (context) {
|
|
4192
4324
|
process.stdout.write(
|
|
@@ -4207,7 +4339,7 @@ function registerShare(program) {
|
|
|
4207
4339
|
const global = readGlobal(this);
|
|
4208
4340
|
const root2 = rootOf(global);
|
|
4209
4341
|
const gitDir = path43.join(root2, ".git");
|
|
4210
|
-
if (!
|
|
4342
|
+
if (!fs14.existsSync(gitDir)) {
|
|
4211
4343
|
throw new CliError("not a git repository \u2014 run `vg share` inside a git repo", ExitCode.USAGE_ERROR);
|
|
4212
4344
|
}
|
|
4213
4345
|
if (opts.undo) {
|
|
@@ -4229,22 +4361,22 @@ function registerShare(program) {
|
|
|
4229
4361
|
}
|
|
4230
4362
|
function writeVibgrateGitignore(root2, reports) {
|
|
4231
4363
|
const dir = path43.join(root2, ".vibgrate");
|
|
4232
|
-
|
|
4364
|
+
fs14.mkdirSync(dir, { recursive: true });
|
|
4233
4365
|
const lines = ["# Managed by `vg share` \u2014 keep graph.json committed, ignore the rest", "cache/", "facts.jsonl", "graph.snap"];
|
|
4234
4366
|
if (!reports) lines.push("graph.html", "GRAPH_REPORT.md");
|
|
4235
|
-
|
|
4367
|
+
fs14.writeFileSync(path43.join(dir, ".gitignore"), `${lines.join("\n")}
|
|
4236
4368
|
`);
|
|
4237
4369
|
}
|
|
4238
4370
|
function writeGitAttributes(root2) {
|
|
4239
4371
|
const file = path43.join(root2, ".gitattributes");
|
|
4240
4372
|
const line = ".vibgrate/graph.json merge=vg";
|
|
4241
|
-
let content =
|
|
4373
|
+
let content = fs14.existsSync(file) ? fs14.readFileSync(file, "utf8") : "";
|
|
4242
4374
|
if (!content.split("\n").some((l) => l.trim() === line)) {
|
|
4243
4375
|
content = content.length ? `${content.replace(/\s*$/, "")}
|
|
4244
4376
|
${line}
|
|
4245
4377
|
` : `${line}
|
|
4246
4378
|
`;
|
|
4247
|
-
|
|
4379
|
+
fs14.writeFileSync(file, content);
|
|
4248
4380
|
}
|
|
4249
4381
|
}
|
|
4250
4382
|
function configureMergeDriver(root2) {
|
|
@@ -4253,7 +4385,7 @@ function configureMergeDriver(root2) {
|
|
|
4253
4385
|
}
|
|
4254
4386
|
function installPreCommitHook(root2) {
|
|
4255
4387
|
const hooksDir = hookDir(root2);
|
|
4256
|
-
|
|
4388
|
+
fs14.mkdirSync(hooksDir, { recursive: true });
|
|
4257
4389
|
const file = path43.join(hooksDir, "pre-commit");
|
|
4258
4390
|
const block = [
|
|
4259
4391
|
HOOK_BEGIN,
|
|
@@ -4263,7 +4395,7 @@ function installPreCommitHook(root2) {
|
|
|
4263
4395
|
"fi",
|
|
4264
4396
|
HOOK_END
|
|
4265
4397
|
].join("\n");
|
|
4266
|
-
let content =
|
|
4398
|
+
let content = fs14.existsSync(file) ? fs14.readFileSync(file, "utf8") : "#!/bin/sh\n";
|
|
4267
4399
|
const re = new RegExp(`${escapeRe(HOOK_BEGIN)}[\\s\\S]*?${escapeRe(HOOK_END)}`);
|
|
4268
4400
|
if (re.test(content)) content = content.replace(re, block);
|
|
4269
4401
|
else content = `${content.replace(/\s*$/, "")}
|
|
@@ -4272,21 +4404,21 @@ ${block}
|
|
|
4272
4404
|
`;
|
|
4273
4405
|
if (!content.startsWith("#!")) content = `#!/bin/sh
|
|
4274
4406
|
${content}`;
|
|
4275
|
-
|
|
4276
|
-
|
|
4407
|
+
fs14.writeFileSync(file, content);
|
|
4408
|
+
fs14.chmodSync(file, 493);
|
|
4277
4409
|
}
|
|
4278
4410
|
function undo(root2) {
|
|
4279
4411
|
const hookFile = path43.join(hookDir(root2), "pre-commit");
|
|
4280
|
-
if (
|
|
4412
|
+
if (fs14.existsSync(hookFile)) {
|
|
4281
4413
|
const re = new RegExp(`\\n*${escapeRe(HOOK_BEGIN)}[\\s\\S]*?${escapeRe(HOOK_END)}\\n*`);
|
|
4282
|
-
const next2 =
|
|
4283
|
-
if (next2.trim() === "#!/bin/sh")
|
|
4284
|
-
else
|
|
4414
|
+
const next2 = fs14.readFileSync(hookFile, "utf8").replace(re, "\n");
|
|
4415
|
+
if (next2.trim() === "#!/bin/sh") fs14.rmSync(hookFile);
|
|
4416
|
+
else fs14.writeFileSync(hookFile, next2);
|
|
4285
4417
|
}
|
|
4286
4418
|
const attr = path43.join(root2, ".gitattributes");
|
|
4287
|
-
if (
|
|
4288
|
-
const next2 =
|
|
4289
|
-
|
|
4419
|
+
if (fs14.existsSync(attr)) {
|
|
4420
|
+
const next2 = fs14.readFileSync(attr, "utf8").split("\n").filter((l) => l.trim() !== ".vibgrate/graph.json merge=vg").join("\n");
|
|
4421
|
+
fs14.writeFileSync(attr, next2);
|
|
4290
4422
|
}
|
|
4291
4423
|
try {
|
|
4292
4424
|
git(root2, ["config", "--remove-section", "merge.vg"]);
|
|
@@ -4315,7 +4447,7 @@ function registerWatch(program) {
|
|
|
4315
4447
|
const debounceMs = Math.max(50, Number(opts.debounce) || DEFAULT_DEBOUNCE_MS);
|
|
4316
4448
|
const watchRoots = (paths.length ? paths : ["."]).map((p) => path43.resolve(root2, p));
|
|
4317
4449
|
for (const w of watchRoots) {
|
|
4318
|
-
if (!
|
|
4450
|
+
if (!fs14.existsSync(w)) {
|
|
4319
4451
|
throw new CliError(`watch path not found: ${w}`, ExitCode.USAGE_ERROR);
|
|
4320
4452
|
}
|
|
4321
4453
|
}
|
|
@@ -4368,7 +4500,7 @@ function registerWatch(program) {
|
|
|
4368
4500
|
const watchers = [];
|
|
4369
4501
|
for (const w of watchRoots) {
|
|
4370
4502
|
try {
|
|
4371
|
-
const watcher =
|
|
4503
|
+
const watcher = fs14.watch(w, { recursive: true }, (_event, filename) => {
|
|
4372
4504
|
if (!filename) {
|
|
4373
4505
|
schedule("change");
|
|
4374
4506
|
return;
|
|
@@ -4382,11 +4514,11 @@ function registerWatch(program) {
|
|
|
4382
4514
|
}
|
|
4383
4515
|
}
|
|
4384
4516
|
info(c.dim(`vg watch \xB7 watching ${watchRoots.map((p) => path43.relative(root2, p) || ".").join(", ")} (debounce ${debounceMs}ms) \xB7 Ctrl+C to stop`));
|
|
4385
|
-
await new Promise((
|
|
4517
|
+
await new Promise((resolve21) => {
|
|
4386
4518
|
const stop = () => {
|
|
4387
4519
|
for (const w of watchers) w.close();
|
|
4388
4520
|
if (timer) clearTimeout(timer);
|
|
4389
|
-
|
|
4521
|
+
resolve21();
|
|
4390
4522
|
};
|
|
4391
4523
|
process.once("SIGINT", stop);
|
|
4392
4524
|
process.once("SIGTERM", stop);
|
|
@@ -4717,7 +4849,7 @@ function loadStandards(root2) {
|
|
|
4717
4849
|
const p = path43__default.join(root2, rel);
|
|
4718
4850
|
let text;
|
|
4719
4851
|
try {
|
|
4720
|
-
text =
|
|
4852
|
+
text = fs14__default.readFileSync(p, "utf8");
|
|
4721
4853
|
} catch {
|
|
4722
4854
|
continue;
|
|
4723
4855
|
}
|
|
@@ -6379,7 +6511,7 @@ function registerModels(program) {
|
|
|
6379
6511
|
);
|
|
6380
6512
|
});
|
|
6381
6513
|
applyGlobalOptions(modeCmd);
|
|
6382
|
-
const
|
|
6514
|
+
const resolve21 = cmd.command("resolve").description("resolve a Code Mode to pack + underlying model + fit (no download)").argument("[mode]", "spark | flow | forge (default: auto-fit or configured default)").action(function(modeArg) {
|
|
6383
6515
|
const global = readGlobal(this);
|
|
6384
6516
|
const root2 = rootOf(global);
|
|
6385
6517
|
const sys = gatherSystemMemory();
|
|
@@ -6411,7 +6543,7 @@ function registerModels(program) {
|
|
|
6411
6543
|
info(c.yellow(" will not fit \u2014 choose a lower mode or free memory before loading"));
|
|
6412
6544
|
}
|
|
6413
6545
|
});
|
|
6414
|
-
applyGlobalOptions(
|
|
6546
|
+
applyGlobalOptions(resolve21);
|
|
6415
6547
|
const installCmd = cmd.command("install").description("resolve the best Code Mode for this machine and install the pack").argument("[mode]", "spark | flow | forge (default: auto-fit)").option("--dry-run", "print the install plan only \u2014 do not download").option("--yes", "skip prompts (install already runs by default)").action(async function(modeArg, opts) {
|
|
6416
6548
|
const global = readGlobal(this);
|
|
6417
6549
|
const root2 = rootOf(global);
|
|
@@ -6648,7 +6780,7 @@ function registerModels(program) {
|
|
|
6648
6780
|
);
|
|
6649
6781
|
}
|
|
6650
6782
|
} else {
|
|
6651
|
-
if (!target.path || !
|
|
6783
|
+
if (!target.path || !fs14.existsSync(target.path)) {
|
|
6652
6784
|
throw new CliError(
|
|
6653
6785
|
`model file not found at ${target.path || "(unknown path)"} \u2014 it may already be removed.`,
|
|
6654
6786
|
ExitCode.NOT_FOUND
|
|
@@ -6662,7 +6794,7 @@ function registerModels(program) {
|
|
|
6662
6794
|
}
|
|
6663
6795
|
if (!global.json) info(c.dim(` $ rm ${target.path}`));
|
|
6664
6796
|
try {
|
|
6665
|
-
|
|
6797
|
+
fs14.unlinkSync(target.path);
|
|
6666
6798
|
} catch (e) {
|
|
6667
6799
|
const msg = e instanceof Error ? e.message : String(e);
|
|
6668
6800
|
throw new CliError(`could not delete ${target.path}: ${msg}`, ExitCode.ERROR);
|
|
@@ -6801,8 +6933,8 @@ function registerModels(program) {
|
|
|
6801
6933
|
});
|
|
6802
6934
|
if (opts.out) {
|
|
6803
6935
|
const outPath = path43.resolve(opts.out);
|
|
6804
|
-
|
|
6805
|
-
|
|
6936
|
+
fs14.mkdirSync(path43.dirname(outPath), { recursive: true });
|
|
6937
|
+
fs14.writeFileSync(outPath, `${JSON.stringify(report, null, 2)}
|
|
6806
6938
|
`);
|
|
6807
6939
|
if (!global.json) info(c.dim(` wrote ${outPath}`));
|
|
6808
6940
|
}
|
|
@@ -6916,11 +7048,11 @@ function fitColor(label) {
|
|
|
6916
7048
|
return label;
|
|
6917
7049
|
}
|
|
6918
7050
|
function confirmYesNo(question) {
|
|
6919
|
-
return new Promise((
|
|
7051
|
+
return new Promise((resolve21) => {
|
|
6920
7052
|
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
6921
7053
|
rl.question(`${question} [y/N] `, (answer) => {
|
|
6922
7054
|
rl.close();
|
|
6923
|
-
|
|
7055
|
+
resolve21(/^y(es)?$/i.test(answer.trim()));
|
|
6924
7056
|
});
|
|
6925
7057
|
});
|
|
6926
7058
|
}
|
|
@@ -7000,7 +7132,7 @@ function codeConfigPath(root2) {
|
|
|
7000
7132
|
}
|
|
7001
7133
|
function loadCodeConfig(root2) {
|
|
7002
7134
|
try {
|
|
7003
|
-
const raw = JSON.parse(
|
|
7135
|
+
const raw = JSON.parse(fs14.readFileSync(codeConfigPath(root2), "utf8"));
|
|
7004
7136
|
return sanitize(raw);
|
|
7005
7137
|
} catch {
|
|
7006
7138
|
return {};
|
|
@@ -7067,7 +7199,7 @@ function contextBudgetFor(config, modelContextWindow) {
|
|
|
7067
7199
|
var MCP_CONFIG_FILES = [".cursor/mcp.json", ".vscode/mcp.json", ".mcp.json"];
|
|
7068
7200
|
function readMcpServersFile(file) {
|
|
7069
7201
|
try {
|
|
7070
|
-
const raw = JSON.parse(
|
|
7202
|
+
const raw = JSON.parse(fs14.readFileSync(file, "utf8"));
|
|
7071
7203
|
const map = raw.mcpServers ?? raw.servers;
|
|
7072
7204
|
return map && typeof map === "object" ? parseMcpServers(map) : {};
|
|
7073
7205
|
} catch {
|
|
@@ -7192,10 +7324,10 @@ function registerCode(program) {
|
|
|
7192
7324
|
return;
|
|
7193
7325
|
}
|
|
7194
7326
|
const patchFile = pathMod.join(
|
|
7195
|
-
|
|
7327
|
+
fs14.mkdtempSync(pathMod.join(os7.tmpdir(), "vg-wt-")),
|
|
7196
7328
|
"delta.patch"
|
|
7197
7329
|
);
|
|
7198
|
-
|
|
7330
|
+
fs14.writeFileSync(patchFile, diff2.patch);
|
|
7199
7331
|
const outcome = wt.applyWorktreePatch(gitRunner, root3, patchFile, diff2.files);
|
|
7200
7332
|
emitLine({ event: "worktree-applied", id: target.id, ...outcome });
|
|
7201
7333
|
if (!opts.streamJson && !global.json) {
|
|
@@ -7260,8 +7392,8 @@ function registerCode(program) {
|
|
|
7260
7392
|
if (!customSelection && (modeFlag || !provider && !model)) {
|
|
7261
7393
|
try {
|
|
7262
7394
|
const { parseMode: parseMode2, resolveMode: resolveMode2, readOrchestratorState: readOrchestratorState2, activePin: activePin2 } = await import('./model-orchestrator-LHYPJBFH.js');
|
|
7263
|
-
const { gatherSystemMemory: gatherSystemMemory2 } = await import('./local-runtime-
|
|
7264
|
-
const { loadGraph: loadGraph2 } = await import('./load-
|
|
7395
|
+
const { gatherSystemMemory: gatherSystemMemory2 } = await import('./local-runtime-6SNWKSA7.js');
|
|
7396
|
+
const { loadGraph: loadGraph2 } = await import('./load-OR2XVGAV.js');
|
|
7265
7397
|
const state = readOrchestratorState2();
|
|
7266
7398
|
const mode = parseMode2(modeFlag) ?? state.defaultMode ?? void 0;
|
|
7267
7399
|
const pin = mode ? activePin2(mode, state) : null;
|
|
@@ -7346,7 +7478,7 @@ function registerCode(program) {
|
|
|
7346
7478
|
if (!(process.stdin.isTTY && process.stdout.isTTY)) {
|
|
7347
7479
|
throw usageError('say what to change, e.g. `vg code "add a --timeout flag to the scan command"` (guided mode needs an interactive terminal)');
|
|
7348
7480
|
}
|
|
7349
|
-
const { runInteractive } = await import('./interactive-
|
|
7481
|
+
const { runInteractive } = await import('./interactive-FXPAZAUJ.js');
|
|
7350
7482
|
await runInteractive(
|
|
7351
7483
|
rootOf(global),
|
|
7352
7484
|
global,
|
|
@@ -7376,7 +7508,7 @@ function registerCode(program) {
|
|
|
7376
7508
|
}
|
|
7377
7509
|
if (!instruction && !stdinFirstTurn) throw usageError('say what to change, e.g. `vg code "add a --timeout flag to the scan command"`');
|
|
7378
7510
|
{
|
|
7379
|
-
const { ensureCodeMap } = await import('./ensure-map-
|
|
7511
|
+
const { ensureCodeMap } = await import('./ensure-map-5C6KG66X.js');
|
|
7380
7512
|
const mapRoot = rootOf(global);
|
|
7381
7513
|
try {
|
|
7382
7514
|
await ensureCodeMap(mapRoot, global, {
|
|
@@ -7413,7 +7545,7 @@ function registerCode(program) {
|
|
|
7413
7545
|
let mockReply;
|
|
7414
7546
|
if (opts.mock) {
|
|
7415
7547
|
try {
|
|
7416
|
-
mockReply =
|
|
7548
|
+
mockReply = fs14.readFileSync(opts.mock, "utf8");
|
|
7417
7549
|
} catch {
|
|
7418
7550
|
throw new CliError(`couldn't read the --mock file: ${opts.mock}`, ExitCode.USAGE_ERROR);
|
|
7419
7551
|
}
|
|
@@ -7432,7 +7564,7 @@ function registerCode(program) {
|
|
|
7432
7564
|
{}
|
|
7433
7565
|
);
|
|
7434
7566
|
if (!opts.mock && route.providers[0]) {
|
|
7435
|
-
const { ensureManagerRuntime } = await import('./model-manager-
|
|
7567
|
+
const { ensureManagerRuntime } = await import('./model-manager-SXHZ5VD4.js');
|
|
7436
7568
|
const ensure = await ensureManagerRuntime({
|
|
7437
7569
|
providerId: route.providers[0].id,
|
|
7438
7570
|
model: route.providers[0].model,
|
|
@@ -7461,20 +7593,20 @@ function registerCode(program) {
|
|
|
7461
7593
|
process.stdout.write(JSON.stringify(line) + "\n");
|
|
7462
7594
|
};
|
|
7463
7595
|
try {
|
|
7464
|
-
const { RunOutcomeRecorder, newOneShotRunId, turnRunId } = await import('./run-outcome-
|
|
7596
|
+
const { RunOutcomeRecorder, newOneShotRunId, turnRunId } = await import('./run-outcome-M4546HLJ.js');
|
|
7465
7597
|
const primarySlug = route.providers[0]?.model.includes("/") ? route.providers[0].model.split("/")[0] : route.providers[0]?.id;
|
|
7466
|
-
const { runCodeStreamJson, parseHostMessage } = await import('./stream-json-
|
|
7467
|
-
const { nodeCodeFs } = await import('./session-
|
|
7598
|
+
const { runCodeStreamJson, parseHostMessage } = await import('./stream-json-4DL65D6U.js');
|
|
7599
|
+
const { nodeCodeFs } = await import('./session-HCFJUSKN.js');
|
|
7468
7600
|
const readline6 = await import('readline');
|
|
7469
7601
|
const child = await import('child_process');
|
|
7470
7602
|
const { loadOrDiscoverFederation } = await import('./federation-MDQPO3PW.js');
|
|
7471
7603
|
const { resolveExecutionEnv } = await import('./execution-env-4MS5AYAN.js');
|
|
7472
7604
|
const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-ELWF3Z6H.js');
|
|
7473
|
-
const { startCodeRuntimeSession } = await import('./runtime-session-
|
|
7474
|
-
const { resolveGraphBackend } = await import('./graph-backend-
|
|
7605
|
+
const { startCodeRuntimeSession } = await import('./runtime-session-6KKMFS6Q.js');
|
|
7606
|
+
const { resolveGraphBackend } = await import('./graph-backend-HH5IIQ55.js');
|
|
7475
7607
|
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
7476
7608
|
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
7477
|
-
const { vgdRequest
|
|
7609
|
+
const { vgdRequest } = await import('./vgd-QR26FAZD.js');
|
|
7478
7610
|
const federation = loadOrDiscoverFederation(root2);
|
|
7479
7611
|
const modelProfile = mergeModelExecutionProfile(
|
|
7480
7612
|
resolveModelExecutionProfile({
|
|
@@ -7505,7 +7637,7 @@ function registerCode(program) {
|
|
|
7505
7637
|
};
|
|
7506
7638
|
if (runtime.socketPath && git2.ref) {
|
|
7507
7639
|
try {
|
|
7508
|
-
await
|
|
7640
|
+
await vgdRequest(
|
|
7509
7641
|
{ op: "put-graph", repositoryId, gitRef: git2.ref, graph },
|
|
7510
7642
|
{ socketPath: runtime.socketPath }
|
|
7511
7643
|
);
|
|
@@ -7532,7 +7664,7 @@ ${res.stderr}` : ""),
|
|
|
7532
7664
|
exitCode: res.status ?? 1
|
|
7533
7665
|
};
|
|
7534
7666
|
};
|
|
7535
|
-
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-
|
|
7667
|
+
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-FZGX6DYO.js');
|
|
7536
7668
|
const vgBuiltin = createVgBuiltinMcpTools({
|
|
7537
7669
|
getGraph: () => graph,
|
|
7538
7670
|
root: root2,
|
|
@@ -7556,7 +7688,7 @@ ${res.stderr}` : ""),
|
|
|
7556
7688
|
const os7 = await import('os');
|
|
7557
7689
|
const pathMod = await import('path');
|
|
7558
7690
|
const checkpointIndex = pathMod.join(
|
|
7559
|
-
|
|
7691
|
+
fs14.mkdtempSync(pathMod.join(os7.tmpdir(), "vg-code-cp-")),
|
|
7560
7692
|
"index"
|
|
7561
7693
|
);
|
|
7562
7694
|
const gitRunner = (gitArgs, gitEnv) => {
|
|
@@ -7577,7 +7709,7 @@ ${res.stderr}` : ""),
|
|
|
7577
7709
|
files,
|
|
7578
7710
|
indexFile: checkpointIndex
|
|
7579
7711
|
});
|
|
7580
|
-
const { loadApprovalRules, addApprovalRule, ruleForAction, ruleLabel } = await import('./approvals-
|
|
7712
|
+
const { loadApprovalRules, addApprovalRule, ruleForAction, ruleLabel } = await import('./approvals-IPMUDEDV.js');
|
|
7581
7713
|
const { loadProjectRules, nodeRulesReader } = await import('./rules-ASYEUNB5.js');
|
|
7582
7714
|
const projectRules = loadProjectRules(nodeRulesReader(root2));
|
|
7583
7715
|
if (projectRules.sources.length && !global.quiet) {
|
|
@@ -7635,8 +7767,8 @@ ${res.stderr}` : ""),
|
|
|
7635
7767
|
};
|
|
7636
7768
|
try {
|
|
7637
7769
|
if (opts.session) {
|
|
7638
|
-
const { runCodeStreamJsonSession, STREAM_JSON_PROTOCOL_VERSION } = await import('./stream-json-
|
|
7639
|
-
const { runAgent: runAgent2 } = await import('./agent-
|
|
7770
|
+
const { runCodeStreamJsonSession, STREAM_JSON_PROTOCOL_VERSION } = await import('./stream-json-4DL65D6U.js');
|
|
7771
|
+
const { runAgent: runAgent2 } = await import('./agent-CUYQKC6S.js');
|
|
7640
7772
|
const {
|
|
7641
7773
|
condenseSession,
|
|
7642
7774
|
loadLatestSession,
|
|
@@ -7647,7 +7779,7 @@ ${res.stderr}` : ""),
|
|
|
7647
7779
|
sessionsDir,
|
|
7648
7780
|
summarizeSession
|
|
7649
7781
|
} = await import('./session-store-AQUORKWB.js');
|
|
7650
|
-
const { VERSION: VERSION2 } = await import('./version-
|
|
7782
|
+
const { VERSION: VERSION2 } = await import('./version-UPIC3F4P.js');
|
|
7651
7783
|
const resumedRecord = typeof opts.continue === "string" ? loadSession(mainRoot, opts.continue) : opts.continue ? loadLatestSession(mainRoot) : void 0;
|
|
7652
7784
|
if (typeof opts.continue === "string" && !resumedRecord) {
|
|
7653
7785
|
emitStream({
|
|
@@ -7679,8 +7811,8 @@ ${res.stderr}` : ""),
|
|
|
7679
7811
|
if (ended) return Promise.resolve(null);
|
|
7680
7812
|
const queued = pendingTurns.shift();
|
|
7681
7813
|
if (queued !== void 0) return Promise.resolve(queued);
|
|
7682
|
-
return new Promise((
|
|
7683
|
-
wakeTurn =
|
|
7814
|
+
return new Promise((resolve21) => {
|
|
7815
|
+
wakeTurn = resolve21;
|
|
7684
7816
|
});
|
|
7685
7817
|
};
|
|
7686
7818
|
let turnIndex = 0;
|
|
@@ -7859,8 +7991,8 @@ ${res.stderr}` : ""),
|
|
|
7859
7991
|
if (!autonomous && !tty) {
|
|
7860
7992
|
throw usageError("the agent approves each edit/command \u2014 run in a terminal to approve interactively, or pass --auto to run autonomously (or --single for a one-shot diff).");
|
|
7861
7993
|
}
|
|
7862
|
-
const { agentTask } = await import('./interactive-
|
|
7863
|
-
const { nodeCodeFs } = await import('./session-
|
|
7994
|
+
const { agentTask } = await import('./interactive-FXPAZAUJ.js');
|
|
7995
|
+
const { nodeCodeFs } = await import('./session-HCFJUSKN.js');
|
|
7864
7996
|
const { TtyPrompter } = await import('./ui-K7D3BCHD.js');
|
|
7865
7997
|
let priorSummary;
|
|
7866
7998
|
let priorInstruction;
|
|
@@ -7875,7 +8007,7 @@ ${res.stderr}` : ""),
|
|
|
7875
8007
|
}
|
|
7876
8008
|
}
|
|
7877
8009
|
const prompter = tty ? new TtyPrompter() : void 0;
|
|
7878
|
-
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-
|
|
8010
|
+
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-FZGX6DYO.js');
|
|
7879
8011
|
const vgBuiltin = createVgBuiltinMcpTools({
|
|
7880
8012
|
getGraph: () => graph,
|
|
7881
8013
|
root: root2,
|
|
@@ -7899,11 +8031,11 @@ ${res.stderr}` : ""),
|
|
|
7899
8031
|
const { loadFederation } = await import('./federation-MDQPO3PW.js');
|
|
7900
8032
|
const { resolveExecutionEnv } = await import('./execution-env-4MS5AYAN.js');
|
|
7901
8033
|
const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-ELWF3Z6H.js');
|
|
7902
|
-
const { startCodeRuntimeSession } = await import('./runtime-session-
|
|
7903
|
-
const { resolveGraphBackend } = await import('./graph-backend-
|
|
8034
|
+
const { startCodeRuntimeSession } = await import('./runtime-session-6KKMFS6Q.js');
|
|
8035
|
+
const { resolveGraphBackend } = await import('./graph-backend-HH5IIQ55.js');
|
|
7904
8036
|
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
7905
8037
|
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
7906
|
-
const { vgdRequest
|
|
8038
|
+
const { vgdRequest } = await import('./vgd-QR26FAZD.js');
|
|
7907
8039
|
const federation = loadFederation(root2);
|
|
7908
8040
|
const modelProfile = mergeModelExecutionProfile(
|
|
7909
8041
|
resolveModelExecutionProfile({
|
|
@@ -7923,7 +8055,7 @@ ${res.stderr}` : ""),
|
|
|
7923
8055
|
const repositoryId = repositoryIdFromRoot(root2);
|
|
7924
8056
|
if (runtime.socketPath && git2.ref) {
|
|
7925
8057
|
try {
|
|
7926
|
-
await
|
|
8058
|
+
await vgdRequest(
|
|
7927
8059
|
{ op: "put-graph", repositoryId, gitRef: git2.ref, graph },
|
|
7928
8060
|
{ socketPath: runtime.socketPath }
|
|
7929
8061
|
);
|
|
@@ -7997,7 +8129,7 @@ ${res.stderr}` : ""),
|
|
|
7997
8129
|
attribution: { client: "vg-code", provider: providerSlug, model: primary?.model }
|
|
7998
8130
|
});
|
|
7999
8131
|
if (opts.out) {
|
|
8000
|
-
|
|
8132
|
+
fs14.writeFileSync(opts.out, JSON.stringify(result, null, 2) + "\n");
|
|
8001
8133
|
}
|
|
8002
8134
|
if (global.json) {
|
|
8003
8135
|
json(result);
|
|
@@ -8049,11 +8181,11 @@ function resolveSecurityTierFlag(flag, fromConfig, auto) {
|
|
|
8049
8181
|
return auto ? "L1" : "L0";
|
|
8050
8182
|
}
|
|
8051
8183
|
function confirm2(question) {
|
|
8052
|
-
return new Promise((
|
|
8184
|
+
return new Promise((resolve21) => {
|
|
8053
8185
|
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
8054
8186
|
rl.question(`${question} [y/N] `, (answer) => {
|
|
8055
8187
|
rl.close();
|
|
8056
|
-
|
|
8188
|
+
resolve21(/^y(es)?$/i.test(answer.trim()));
|
|
8057
8189
|
});
|
|
8058
8190
|
});
|
|
8059
8191
|
}
|
|
@@ -8210,7 +8342,7 @@ async function addCmd(root2, rest, opts, asJson) {
|
|
|
8210
8342
|
}
|
|
8211
8343
|
function readPackageVersion(root2) {
|
|
8212
8344
|
try {
|
|
8213
|
-
const pkg = JSON.parse(
|
|
8345
|
+
const pkg = JSON.parse(fs14__default.readFileSync(path43__default.join(root2, "package.json"), "utf8"));
|
|
8214
8346
|
return typeof pkg.version === "string" ? pkg.version : void 0;
|
|
8215
8347
|
} catch {
|
|
8216
8348
|
return void 0;
|
|
@@ -8218,7 +8350,7 @@ function readPackageVersion(root2) {
|
|
|
8218
8350
|
}
|
|
8219
8351
|
function readOptionalFile(p) {
|
|
8220
8352
|
try {
|
|
8221
|
-
const t =
|
|
8353
|
+
const t = fs14__default.readFileSync(p, "utf8");
|
|
8222
8354
|
return t.trim() ? t : void 0;
|
|
8223
8355
|
} catch {
|
|
8224
8356
|
return void 0;
|
|
@@ -8366,8 +8498,8 @@ function registerExport(program) {
|
|
|
8366
8498
|
out(content.trimEnd());
|
|
8367
8499
|
return;
|
|
8368
8500
|
}
|
|
8369
|
-
|
|
8370
|
-
|
|
8501
|
+
fs14.mkdirSync(path43.dirname(path43.resolve(file)), { recursive: true });
|
|
8502
|
+
fs14.writeFileSync(file, content);
|
|
8371
8503
|
info(`${c.green("\u2714")} wrote ${file} ${c.dim(`(${format})`)}`);
|
|
8372
8504
|
});
|
|
8373
8505
|
applyGlobalOptions(cmd);
|
|
@@ -8390,30 +8522,36 @@ function registerBundle(program) {
|
|
|
8390
8522
|
} catch {
|
|
8391
8523
|
throw new CliError("no grammars found to bundle (run a build first)", ExitCode.ERROR);
|
|
8392
8524
|
}
|
|
8393
|
-
|
|
8525
|
+
fs14.mkdirSync(path43.join(outDir, "grammars"), { recursive: true });
|
|
8394
8526
|
let grammarCount = 0;
|
|
8395
8527
|
for (const { fileName, absPath } of grammarFiles) {
|
|
8396
|
-
|
|
8528
|
+
fs14.copyFileSync(absPath, path43.join(outDir, "grammars", fileName));
|
|
8529
|
+
grammarCount++;
|
|
8530
|
+
}
|
|
8531
|
+
for (const id of Object.keys(TOOLCHAIN_GRAMMARS).sort()) {
|
|
8532
|
+
const absPath = resolveToolchainGrammar(id);
|
|
8533
|
+
if (!absPath) continue;
|
|
8534
|
+
fs14.copyFileSync(absPath, path43.join(outDir, "grammars", path43.basename(absPath)));
|
|
8397
8535
|
grammarCount++;
|
|
8398
8536
|
}
|
|
8399
8537
|
const included = [`grammars/ (${grammarCount} .wasm)`];
|
|
8400
8538
|
const graphSrc = resolveGraphPath(root2, global.graph);
|
|
8401
|
-
if (
|
|
8402
|
-
|
|
8539
|
+
if (fs14.existsSync(graphSrc)) {
|
|
8540
|
+
fs14.copyFileSync(graphSrc, path43.join(outDir, "graph.json"));
|
|
8403
8541
|
included.push("graph.json");
|
|
8404
8542
|
} else {
|
|
8405
8543
|
const graph = loadGraphFileWithSnapshot(graphSrc);
|
|
8406
8544
|
if (graph) {
|
|
8407
|
-
|
|
8545
|
+
fs14.writeFileSync(path43.join(outDir, "graph.json"), serializeGraph(graph));
|
|
8408
8546
|
included.push("graph.json");
|
|
8409
8547
|
}
|
|
8410
8548
|
}
|
|
8411
8549
|
const cat = catalogPath(root2);
|
|
8412
|
-
if (
|
|
8413
|
-
|
|
8550
|
+
if (fs14.existsSync(cat)) {
|
|
8551
|
+
fs14.copyFileSync(cat, path43.join(outDir, "vibgrate.lib.json"));
|
|
8414
8552
|
included.push("vibgrate.lib.json");
|
|
8415
|
-
if (
|
|
8416
|
-
|
|
8553
|
+
if (fs14.existsSync(libDir(root2))) {
|
|
8554
|
+
fs14.cpSync(libDir(root2), path43.join(outDir, "lib"), { recursive: true });
|
|
8417
8555
|
included.push("lib/");
|
|
8418
8556
|
}
|
|
8419
8557
|
}
|
|
@@ -8425,7 +8563,7 @@ function registerBundle(program) {
|
|
|
8425
8563
|
included,
|
|
8426
8564
|
usage: "Run `vg build --grammars <this dir>/grammars` to build fully offline."
|
|
8427
8565
|
};
|
|
8428
|
-
|
|
8566
|
+
fs14.writeFileSync(path43.join(outDir, "MANIFEST.json"), `${stableStringify(manifest, 2)}
|
|
8429
8567
|
`);
|
|
8430
8568
|
if (global.json) {
|
|
8431
8569
|
json({ out: path43.relative(root2, outDir), ...manifest });
|
|
@@ -8451,7 +8589,7 @@ async function runDoctor(global) {
|
|
|
8451
8589
|
const root2 = rootOf(global);
|
|
8452
8590
|
const local = global.local === true;
|
|
8453
8591
|
const graphPath = resolveGraphPath(root2, global.graph);
|
|
8454
|
-
const configFile = CONFIG_BASENAMES.find((f) =>
|
|
8592
|
+
const configFile = CONFIG_BASENAMES.find((f) => fs14.existsSync(path43.join(root2, f))) ?? null;
|
|
8455
8593
|
const graph = loadGraph(root2, graphPath);
|
|
8456
8594
|
let staleFiles = null;
|
|
8457
8595
|
if (graph) {
|
|
@@ -8484,7 +8622,7 @@ async function runDoctor(global) {
|
|
|
8484
8622
|
},
|
|
8485
8623
|
libCatalog: {
|
|
8486
8624
|
path: path43.relative(root2, catalogPath(root2)),
|
|
8487
|
-
present:
|
|
8625
|
+
present: fs14.existsSync(catalogPath(root2)),
|
|
8488
8626
|
libraries: libCount
|
|
8489
8627
|
},
|
|
8490
8628
|
credentials: creds,
|
|
@@ -8589,445 +8727,6 @@ async function probeReachable(base) {
|
|
|
8589
8727
|
clearTimeout(timer);
|
|
8590
8728
|
}
|
|
8591
8729
|
}
|
|
8592
|
-
function registerDaemon(program) {
|
|
8593
|
-
const cmd = program.command("daemon").description("local Fusion Runtime daemon (vgd) \u2014 workspace registry prototype").option("--socket <path>", "override the daemon socket path");
|
|
8594
|
-
const status = cmd.command("status").description("show whether vgd is running and how many workspaces it tracks").action(async function() {
|
|
8595
|
-
const global = readGlobal(this);
|
|
8596
|
-
const socketPath = socketOf(this);
|
|
8597
|
-
const running = await vgdIsRunning({ socketPath });
|
|
8598
|
-
if (!running) {
|
|
8599
|
-
if (global.json) {
|
|
8600
|
-
json({ running: false, socketPath, version: VGD_PROTOCOL_VERSION });
|
|
8601
|
-
} else {
|
|
8602
|
-
info(c.dim(`vgd \xB7 not running (${socketPath})`));
|
|
8603
|
-
}
|
|
8604
|
-
process.exitCode = ExitCode.NOT_FOUND;
|
|
8605
|
-
return;
|
|
8606
|
-
}
|
|
8607
|
-
const res = await vgdRequest({ op: "status" }, { socketPath });
|
|
8608
|
-
if (!res.ok) throw new CliError(res.error, ExitCode.ERROR);
|
|
8609
|
-
const semantic = await vgdRequest({ op: "embed-status" }, { socketPath }).catch(() => null);
|
|
8610
|
-
const semanticPayload = semantic && semantic.ok && "semantic" in semantic ? semantic.semantic : void 0;
|
|
8611
|
-
if (global.json) json({ running: true, ...res, semantic: semanticPayload });
|
|
8612
|
-
else if ("pid" in res) {
|
|
8613
|
-
const slots = typeof res.graphSlots === "number" ? ` \xB7 ${res.graphSlots} graph slot(s)` : "";
|
|
8614
|
-
info(
|
|
8615
|
-
`vgd \xB7 running pid ${res.pid} \xB7 ${res.workspaces} workspace(s)${slots} \xB7 ${res.uptimeMs}ms up \xB7 ${c.dim(res.socketPath)}`
|
|
8616
|
-
);
|
|
8617
|
-
if (semanticPayload) {
|
|
8618
|
-
const ready = semanticPayload.slots.filter((sl) => sl.state === "ready");
|
|
8619
|
-
const vectors = ready.reduce((n, sl) => n + sl.vectors, 0);
|
|
8620
|
-
const detail = semanticPayload.worker === "unavailable" ? c.dim(semanticPayload.reason ?? "semantic off \u2014 lexical only") : `${ready.length}/${semanticPayload.slots.length} index(es) ready \xB7 ${vectors} vector(s)` + (semanticPayload.model ? ` \xB7 ${semanticPayload.model}` : "");
|
|
8621
|
-
info(` semantic \xB7 worker ${semanticPayload.worker} \xB7 ${detail}`);
|
|
8622
|
-
for (const sl of semanticPayload.slots) {
|
|
8623
|
-
if (sl.state === "ready") continue;
|
|
8624
|
-
info(c.dim(` ${sl.repositoryId}@${sl.gitRef} \xB7 ${sl.state}${sl.error ? ` \u2014 ${sl.error}` : ""}`));
|
|
8625
|
-
}
|
|
8626
|
-
}
|
|
8627
|
-
}
|
|
8628
|
-
});
|
|
8629
|
-
applyGlobalOptions(status);
|
|
8630
|
-
const start = cmd.command("start").description("run vgd in the foreground (Ctrl-C to stop)").action(async function() {
|
|
8631
|
-
const global = readGlobal(this);
|
|
8632
|
-
const socketPath = socketOf(this);
|
|
8633
|
-
if (await vgdIsRunning({ socketPath })) {
|
|
8634
|
-
throw new CliError(`vgd is already running at ${socketPath}`, ExitCode.ERROR);
|
|
8635
|
-
}
|
|
8636
|
-
let requestShutdown = () => {
|
|
8637
|
-
};
|
|
8638
|
-
const server = await startVgdServer({
|
|
8639
|
-
socketPath,
|
|
8640
|
-
onShutdownRequest: () => requestShutdown(),
|
|
8641
|
-
// Show the daemon working: graph publishes, branch switches, new repos,
|
|
8642
|
-
// and every semantic index build. Silent under --quiet/--json.
|
|
8643
|
-
log: global.quiet || global.json ? void 0 : (message) => info(c.dim(`vgd \xB7 ${message}`))
|
|
8644
|
-
});
|
|
8645
|
-
if (!global.quiet) {
|
|
8646
|
-
info(`vgd \xB7 listening on ${c.dim(server.socketPath)} (${VGD_PROTOCOL_VERSION})`);
|
|
8647
|
-
info(c.dim(" register a workspace: vg daemon register"));
|
|
8648
|
-
info(c.dim(" status: vg daemon status"));
|
|
8649
|
-
}
|
|
8650
|
-
const shutdown = async () => {
|
|
8651
|
-
await server.close();
|
|
8652
|
-
if (!global.quiet) info(c.dim("vgd \xB7 stopped"));
|
|
8653
|
-
process.exit(0);
|
|
8654
|
-
};
|
|
8655
|
-
requestShutdown = () => void shutdown();
|
|
8656
|
-
process.on("SIGINT", () => void shutdown());
|
|
8657
|
-
process.on("SIGTERM", () => void shutdown());
|
|
8658
|
-
await new Promise(() => {
|
|
8659
|
-
});
|
|
8660
|
-
});
|
|
8661
|
-
applyGlobalOptions(start);
|
|
8662
|
-
const ensure = cmd.command("ensure").description("ensure vgd is running (start in background if needed)").action(async function() {
|
|
8663
|
-
const global = readGlobal(this);
|
|
8664
|
-
const socketPath = socketOf(this);
|
|
8665
|
-
if (await vgdIsRunning({ socketPath })) {
|
|
8666
|
-
const res2 = await vgdRequest({ op: "status" }, { socketPath });
|
|
8667
|
-
if (global.json) {
|
|
8668
|
-
json({ running: true, ensured: false, ...res2.ok ? res2 : { socketPath } });
|
|
8669
|
-
} else if (!global.quiet) {
|
|
8670
|
-
const pid = res2.ok && "pid" in res2 ? res2.pid : "?";
|
|
8671
|
-
info(`vgd \xB7 already running pid ${pid} \xB7 ${c.dim(socketPath)}`);
|
|
8672
|
-
}
|
|
8673
|
-
return;
|
|
8674
|
-
}
|
|
8675
|
-
const child = await startDetachedVgd(socketPath);
|
|
8676
|
-
const res = await vgdRequest({ op: "status" }, { socketPath });
|
|
8677
|
-
if (!res.ok) {
|
|
8678
|
-
throw new CliError(
|
|
8679
|
-
`vgd started (pid ${child ?? "?"}) but status failed: ${res.error} (${socketPath})`,
|
|
8680
|
-
ExitCode.ERROR
|
|
8681
|
-
);
|
|
8682
|
-
}
|
|
8683
|
-
if (global.json) {
|
|
8684
|
-
json({ running: true, ensured: true, ...res });
|
|
8685
|
-
} else if (!global.quiet) {
|
|
8686
|
-
const pid = "pid" in res ? res.pid : child;
|
|
8687
|
-
info(`vgd \xB7 started in background pid ${pid} \xB7 ${c.dim(socketPath)}`);
|
|
8688
|
-
}
|
|
8689
|
-
});
|
|
8690
|
-
applyGlobalOptions(ensure);
|
|
8691
|
-
const stop = cmd.command("stop").description("stop the running vgd (idempotent \u2014 succeeds if none is running)").action(async function() {
|
|
8692
|
-
const global = readGlobal(this);
|
|
8693
|
-
const socketPath = socketOf(this);
|
|
8694
|
-
const result = await stopVgd(socketPath);
|
|
8695
|
-
if (global.json) {
|
|
8696
|
-
json({ stopped: result === "stopped", result, socketPath });
|
|
8697
|
-
} else if (!global.quiet) {
|
|
8698
|
-
if (result === "stopped") info(`vgd \xB7 stopped ${c.dim(socketPath)}`);
|
|
8699
|
-
else if (result === "not-running") info(c.dim(`vgd \xB7 not running (${socketPath})`));
|
|
8700
|
-
}
|
|
8701
|
-
if (result === "refused") {
|
|
8702
|
-
throw new CliError(
|
|
8703
|
-
"this vgd is embedded in another process (e.g. vg code) \u2014 stop that process instead",
|
|
8704
|
-
ExitCode.ERROR
|
|
8705
|
-
);
|
|
8706
|
-
}
|
|
8707
|
-
if (result === "failed") {
|
|
8708
|
-
throw new CliError(
|
|
8709
|
-
`vgd did not stop within 5s (${socketPath}) \u2014 check \`vg daemon status\` and stop the process manually`,
|
|
8710
|
-
ExitCode.ERROR
|
|
8711
|
-
);
|
|
8712
|
-
}
|
|
8713
|
-
});
|
|
8714
|
-
applyGlobalOptions(stop);
|
|
8715
|
-
const restart = cmd.command("restart").description("restart vgd (stop if running, then start in the background)").action(async function() {
|
|
8716
|
-
const global = readGlobal(this);
|
|
8717
|
-
const socketPath = socketOf(this);
|
|
8718
|
-
const stopResult = await stopVgd(socketPath);
|
|
8719
|
-
if (stopResult === "refused") {
|
|
8720
|
-
throw new CliError(
|
|
8721
|
-
"this vgd is embedded in another process (e.g. vg code) \u2014 stop that process instead",
|
|
8722
|
-
ExitCode.ERROR
|
|
8723
|
-
);
|
|
8724
|
-
}
|
|
8725
|
-
if (stopResult === "failed") {
|
|
8726
|
-
throw new CliError(
|
|
8727
|
-
`vgd did not stop within 5s (${socketPath}) \u2014 check \`vg daemon status\` and stop the process manually`,
|
|
8728
|
-
ExitCode.ERROR
|
|
8729
|
-
);
|
|
8730
|
-
}
|
|
8731
|
-
await startDetachedVgd(socketPath);
|
|
8732
|
-
const res = await vgdRequest({ op: "status" }, { socketPath });
|
|
8733
|
-
if (global.json) {
|
|
8734
|
-
json({ running: true, restarted: true, ...res.ok ? res : { socketPath } });
|
|
8735
|
-
} else if (!global.quiet) {
|
|
8736
|
-
const pid = res.ok && "pid" in res ? res.pid : "?";
|
|
8737
|
-
info(`vgd \xB7 restarted pid ${pid} \xB7 ${c.dim(socketPath)}`);
|
|
8738
|
-
}
|
|
8739
|
-
});
|
|
8740
|
-
applyGlobalOptions(restart);
|
|
8741
|
-
const register = cmd.command("register").description("register the current repository with a running vgd").argument("[root]", "repository root (default: cwd)").action(async function(rootArg) {
|
|
8742
|
-
const global = readGlobal(this);
|
|
8743
|
-
const socketPath = socketOf(this);
|
|
8744
|
-
const root2 = path43.resolve(rootArg ?? rootOf(global));
|
|
8745
|
-
if (!await vgdIsRunning({ socketPath })) {
|
|
8746
|
-
throw new CliError(`vgd is not running \u2014 start it with \`vg daemon start\` (${socketPath})`, ExitCode.NOT_FOUND);
|
|
8747
|
-
}
|
|
8748
|
-
const res = await vgdRequest({ op: "register", root: root2 }, { socketPath });
|
|
8749
|
-
if (!res.ok) throw new CliError(res.error, ExitCode.ERROR);
|
|
8750
|
-
if (global.json) json(res);
|
|
8751
|
-
else if ("workspace" in res) {
|
|
8752
|
-
info(`vgd \xB7 registered ${res.workspace.root}`);
|
|
8753
|
-
info(c.dim(` id ${res.workspace.id}`));
|
|
8754
|
-
info(c.dim(` graph ${res.workspace.graphPath}`));
|
|
8755
|
-
}
|
|
8756
|
-
});
|
|
8757
|
-
applyGlobalOptions(register);
|
|
8758
|
-
const list = cmd.command("list").description("list workspaces registered with the running vgd").action(async function() {
|
|
8759
|
-
const global = readGlobal(this);
|
|
8760
|
-
const socketPath = socketOf(this);
|
|
8761
|
-
if (!await vgdIsRunning({ socketPath })) {
|
|
8762
|
-
throw new CliError(`vgd is not running (${socketPath})`, ExitCode.NOT_FOUND);
|
|
8763
|
-
}
|
|
8764
|
-
const res = await vgdRequest({ op: "list" }, { socketPath });
|
|
8765
|
-
if (!res.ok) throw new CliError(res.error, ExitCode.ERROR);
|
|
8766
|
-
if (global.json) json(res);
|
|
8767
|
-
else if ("workspaces" in res && Array.isArray(res.workspaces)) {
|
|
8768
|
-
if (res.workspaces.length === 0) info(c.dim("vgd \xB7 no workspaces registered"));
|
|
8769
|
-
for (const w of res.workspaces) {
|
|
8770
|
-
const tag = w.label ? ` (${w.label}${w.role ? `/${w.role}` : ""})` : "";
|
|
8771
|
-
info(`${w.root}${tag}`);
|
|
8772
|
-
info(c.dim(` id ${w.id} \xB7 graph ${w.graphPath}`));
|
|
8773
|
-
}
|
|
8774
|
-
}
|
|
8775
|
-
});
|
|
8776
|
-
applyGlobalOptions(list);
|
|
8777
|
-
const federation = cmd.command("federation").description("register a multi-root federation from .vibgrate/federation.json (or primary cwd)").argument("[root]", "primary repository root (default: cwd)").action(async function(rootArg) {
|
|
8778
|
-
const global = readGlobal(this);
|
|
8779
|
-
const socketPath = socketOf(this);
|
|
8780
|
-
const primary = path43.resolve(rootArg ?? rootOf(global));
|
|
8781
|
-
if (!await vgdIsRunning({ socketPath })) {
|
|
8782
|
-
throw new CliError(`vgd is not running \u2014 start it with \`vg daemon start\` (${socketPath})`, ExitCode.NOT_FOUND);
|
|
8783
|
-
}
|
|
8784
|
-
const { loadFederation } = await import('./federation-MDQPO3PW.js');
|
|
8785
|
-
const fed = loadFederation(primary);
|
|
8786
|
-
if (!fed) throw new CliError(`could not load federation for ${primary}`, ExitCode.ERROR);
|
|
8787
|
-
const res = await vgdRequest(
|
|
8788
|
-
{
|
|
8789
|
-
op: "register-federation",
|
|
8790
|
-
primaryRoot: fed.primaryRoot,
|
|
8791
|
-
members: fed.members.map((m) => ({ root: m.root, label: m.label, role: m.role }))
|
|
8792
|
-
},
|
|
8793
|
-
{ socketPath }
|
|
8794
|
-
);
|
|
8795
|
-
if (!res.ok) throw new CliError(res.error, ExitCode.ERROR);
|
|
8796
|
-
if (global.json) json(res);
|
|
8797
|
-
else if ("workspaces" in res && Array.isArray(res.workspaces)) {
|
|
8798
|
-
info(`vgd \xB7 federation registered (${res.workspaces.length} workspace(s))`);
|
|
8799
|
-
for (const w of res.workspaces) {
|
|
8800
|
-
info(c.dim(` ${w.label ?? w.root}${w.role ? ` [${w.role}]` : ""}`));
|
|
8801
|
-
}
|
|
8802
|
-
}
|
|
8803
|
-
});
|
|
8804
|
-
applyGlobalOptions(federation);
|
|
8805
|
-
const publish = cmd.command("publish").description("load the workspace code map into vgd ActiveGraph (from global/legacy store)").argument("[root]", "repository root (default: cwd)").option("--git-ref <ref>", "branch or SHA (default: detect HEAD)").action(async function(rootArg) {
|
|
8806
|
-
const global = readGlobal(this);
|
|
8807
|
-
const socketPath = socketOf(this);
|
|
8808
|
-
const root2 = path43.resolve(rootArg ?? rootOf(global));
|
|
8809
|
-
if (!await vgdIsRunning({ socketPath })) {
|
|
8810
|
-
throw new CliError(`vgd is not running \u2014 start it with \`vg daemon ensure\` (${socketPath})`, ExitCode.NOT_FOUND);
|
|
8811
|
-
}
|
|
8812
|
-
const opts = this.opts();
|
|
8813
|
-
const loaded = await vgdRequest(
|
|
8814
|
-
{ op: "load-graph", root: root2, gitRef: opts.gitRef?.trim() || void 0, graphPath: global.graph },
|
|
8815
|
-
{ socketPath }
|
|
8816
|
-
);
|
|
8817
|
-
let put = loaded;
|
|
8818
|
-
if (!loaded.ok && loaded.code === "no_map") {
|
|
8819
|
-
throw new CliError(loaded.error, ExitCode.NOT_FOUND);
|
|
8820
|
-
}
|
|
8821
|
-
if (!loaded.ok) {
|
|
8822
|
-
const { loadGraph: loadGraph2 } = await import('./load-64RK5O6C.js');
|
|
8823
|
-
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
8824
|
-
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
8825
|
-
const graph = loadGraph2(root2, global.graph);
|
|
8826
|
-
if (!graph) {
|
|
8827
|
-
throw new CliError(
|
|
8828
|
-
`no code map found for ${root2} \u2014 run \`vg build\` (or bare \`vg\`) first`,
|
|
8829
|
-
ExitCode.NOT_FOUND
|
|
8830
|
-
);
|
|
8831
|
-
}
|
|
8832
|
-
const reg = await vgdRequest({ op: "register", root: root2 }, { socketPath });
|
|
8833
|
-
if (!reg.ok) throw new CliError(reg.error, ExitCode.ERROR);
|
|
8834
|
-
const git2 = opts.gitRef?.trim() || detectGitRef(root2).ref || "HEAD";
|
|
8835
|
-
const repositoryId = reg.ok && "workspace" in reg ? reg.workspace.id : repositoryIdFromRoot(root2);
|
|
8836
|
-
put = await vgdRequest(
|
|
8837
|
-
{ op: "put-graph", repositoryId, gitRef: git2, graph },
|
|
8838
|
-
{ socketPath }
|
|
8839
|
-
);
|
|
8840
|
-
if (!put.ok) throw new CliError(put.error, ExitCode.ERROR);
|
|
8841
|
-
}
|
|
8842
|
-
if (global.json) json(put);
|
|
8843
|
-
else if (put.ok && "stored" in put) {
|
|
8844
|
-
info(`vgd \xB7 published graph \xB7 ${put.nodeCount} node(s) \xB7 ref ${put.gitRef}`);
|
|
8845
|
-
info(c.dim(` repositoryId ${put.repositoryId}`));
|
|
8846
|
-
}
|
|
8847
|
-
});
|
|
8848
|
-
applyGlobalOptions(publish);
|
|
8849
|
-
const query = cmd.command("query").description("query the ActiveGraph held by vgd (lexical/structural)").option("--repository-id <id>", "repository id from `vg daemon list` (default: cwd workspace)").argument("<query...>", "what to find").option("--limit <n>", "max matches", "12").option("--git-ref <ref>", "branch or SHA (default: current slot)").action(async function(queryParts) {
|
|
8850
|
-
const global = readGlobal(this);
|
|
8851
|
-
const socketPath = socketOf(this);
|
|
8852
|
-
const opts = this.opts();
|
|
8853
|
-
const q = (queryParts ?? []).join(" ").trim();
|
|
8854
|
-
if (!q) throw new CliError("say what to find", ExitCode.USAGE_ERROR);
|
|
8855
|
-
if (!await vgdIsRunning({ socketPath })) {
|
|
8856
|
-
throw new CliError(`vgd is not running (${socketPath})`, ExitCode.NOT_FOUND);
|
|
8857
|
-
}
|
|
8858
|
-
const repositoryId = opts.repositoryId?.trim() || await repositoryIdForCwd(socketPath, rootOf(global));
|
|
8859
|
-
const res = await vgdRequest(
|
|
8860
|
-
{
|
|
8861
|
-
op: "query-graph",
|
|
8862
|
-
repositoryId,
|
|
8863
|
-
query: q,
|
|
8864
|
-
limit: opts.limit ? Number(opts.limit) : 12,
|
|
8865
|
-
gitRef: opts.gitRef
|
|
8866
|
-
},
|
|
8867
|
-
{ socketPath }
|
|
8868
|
-
);
|
|
8869
|
-
if (!res.ok) throw new CliError(res.error, ExitCode.ERROR);
|
|
8870
|
-
if (global.json) json(res);
|
|
8871
|
-
else if ("matches" in res) {
|
|
8872
|
-
info(`vgd query \xB7 ${res.matches.length} match(es) \xB7 ref ${res.gitRef}`);
|
|
8873
|
-
for (const m of res.matches) {
|
|
8874
|
-
info(`${m.qualifiedName} (${m.kind}) ${m.file}:${m.line}`);
|
|
8875
|
-
info(c.dim(` score ${m.score} \xB7 ${m.why}`));
|
|
8876
|
-
}
|
|
8877
|
-
}
|
|
8878
|
-
});
|
|
8879
|
-
applyGlobalOptions(query);
|
|
8880
|
-
const impact = cmd.command("impact").description("blast radius for a symbol in the vgd ActiveGraph").option("--repository-id <id>", "repository id (default: cwd workspace)").argument("<symbol>", "symbol id or qualified name").option("--depth <n>", "max dependency depth", "4").option("--git-ref <ref>", "branch or SHA").action(async function(symbol) {
|
|
8881
|
-
const global = readGlobal(this);
|
|
8882
|
-
const socketPath = socketOf(this);
|
|
8883
|
-
const opts = this.opts();
|
|
8884
|
-
if (!await vgdIsRunning({ socketPath })) {
|
|
8885
|
-
throw new CliError(`vgd is not running (${socketPath})`, ExitCode.NOT_FOUND);
|
|
8886
|
-
}
|
|
8887
|
-
const repositoryId = opts.repositoryId?.trim() || await repositoryIdForCwd(socketPath, rootOf(global));
|
|
8888
|
-
const res = await vgdRequest(
|
|
8889
|
-
{
|
|
8890
|
-
op: "impact-of",
|
|
8891
|
-
repositoryId,
|
|
8892
|
-
symbol: symbol.trim(),
|
|
8893
|
-
depth: opts.depth ? Number(opts.depth) : 4,
|
|
8894
|
-
gitRef: opts.gitRef
|
|
8895
|
-
},
|
|
8896
|
-
{ socketPath }
|
|
8897
|
-
);
|
|
8898
|
-
if (!res.ok) throw new CliError(res.error, ExitCode.ERROR);
|
|
8899
|
-
if (global.json) json(res);
|
|
8900
|
-
else if ("affected" in res) {
|
|
8901
|
-
info(`vgd impact \xB7 ${res.root.name} \xB7 depth ${res.depth} \xB7 ${res.affected.length} affected`);
|
|
8902
|
-
for (const a of res.affected.slice(0, 30)) {
|
|
8903
|
-
info(`- ${a.name} (${a.file}:${a.line}) d=${a.depth}`);
|
|
8904
|
-
}
|
|
8905
|
-
}
|
|
8906
|
-
});
|
|
8907
|
-
applyGlobalOptions(impact);
|
|
8908
|
-
const graphs = cmd.command("graphs").description("list multi-branch ActiveGraph slots resident in the running vgd (Fusion \xA74.1.1)").option("--repository-id <id>", "filter slots to one repository id").action(async function() {
|
|
8909
|
-
const global = readGlobal(this);
|
|
8910
|
-
const socketPath = socketOf(this);
|
|
8911
|
-
const opts = this.opts();
|
|
8912
|
-
if (!await vgdIsRunning({ socketPath })) {
|
|
8913
|
-
throw new CliError(`vgd is not running (${socketPath})`, ExitCode.NOT_FOUND);
|
|
8914
|
-
}
|
|
8915
|
-
const res = await vgdRequest(
|
|
8916
|
-
{ op: "list-graph-slots", repositoryId: opts.repositoryId },
|
|
8917
|
-
{ socketPath }
|
|
8918
|
-
);
|
|
8919
|
-
if (!res.ok) throw new CliError(res.error, ExitCode.ERROR);
|
|
8920
|
-
if (global.json) json(res);
|
|
8921
|
-
else if ("slots" in res) {
|
|
8922
|
-
if (!res.slots.length) info(c.dim("vgd \xB7 no graph slots resident"));
|
|
8923
|
-
for (const s of res.slots) {
|
|
8924
|
-
const cur = s.current ? c.green(" current") : "";
|
|
8925
|
-
const idle = s.evictable ? c.yellow(" idle") : "";
|
|
8926
|
-
info(`${s.repositoryId.slice(0, 8)}\u2026 ${s.gitRef}${cur}${idle}`);
|
|
8927
|
-
info(c.dim(` nodes ${s.nodeCount} \xB7 idle ${Math.round(s.idleMs / 1e3)}s \xB7 loaded ${new Date(s.loadedAt).toISOString()}`));
|
|
8928
|
-
}
|
|
8929
|
-
}
|
|
8930
|
-
});
|
|
8931
|
-
applyGlobalOptions(graphs);
|
|
8932
|
-
applyGlobalOptions(cmd);
|
|
8933
|
-
}
|
|
8934
|
-
function socketOf(cmd) {
|
|
8935
|
-
let c2 = cmd;
|
|
8936
|
-
while (c2) {
|
|
8937
|
-
const opts = c2.opts();
|
|
8938
|
-
if (opts.socket) return path43.resolve(opts.socket);
|
|
8939
|
-
c2 = c2.parent;
|
|
8940
|
-
}
|
|
8941
|
-
return vgdSocketPath();
|
|
8942
|
-
}
|
|
8943
|
-
function spawnDetachedDaemonStart(socketPath) {
|
|
8944
|
-
const opts = {
|
|
8945
|
-
detached: true,
|
|
8946
|
-
stdio: "ignore",
|
|
8947
|
-
env: process.env,
|
|
8948
|
-
windowsHide: true
|
|
8949
|
-
};
|
|
8950
|
-
const entry = process.argv[1];
|
|
8951
|
-
if (entry && (entry.endsWith(".js") || entry.endsWith(".mjs") || entry.endsWith(".cjs"))) {
|
|
8952
|
-
return spawn(process.execPath, [entry, "daemon", "start", "--socket", socketPath], opts);
|
|
8953
|
-
}
|
|
8954
|
-
return spawn(process.argv[0] || "vg", ["daemon", "start", "--socket", socketPath], opts);
|
|
8955
|
-
}
|
|
8956
|
-
function sleep(ms) {
|
|
8957
|
-
return new Promise((r) => setTimeout(r, ms));
|
|
8958
|
-
}
|
|
8959
|
-
async function startDetachedVgd(socketPath) {
|
|
8960
|
-
const child = spawnDetachedDaemonStart(socketPath);
|
|
8961
|
-
child.unref();
|
|
8962
|
-
const readyMs = 3e4;
|
|
8963
|
-
const deadline = Date.now() + readyMs;
|
|
8964
|
-
while (Date.now() < deadline) {
|
|
8965
|
-
await sleep(150);
|
|
8966
|
-
if (await vgdIsRunning({ socketPath })) return child.pid;
|
|
8967
|
-
if (child.exitCode != null && child.exitCode !== 0) {
|
|
8968
|
-
throw new CliError(
|
|
8969
|
-
`vgd child exited ${child.exitCode} before becoming ready at ${socketPath}`,
|
|
8970
|
-
ExitCode.ERROR
|
|
8971
|
-
);
|
|
8972
|
-
}
|
|
8973
|
-
}
|
|
8974
|
-
throw new CliError(
|
|
8975
|
-
`vgd failed to become ready within ${Math.round(readyMs / 1e3)}s at ${socketPath}`,
|
|
8976
|
-
ExitCode.ERROR
|
|
8977
|
-
);
|
|
8978
|
-
}
|
|
8979
|
-
async function stopVgd(socketPath) {
|
|
8980
|
-
if (!await vgdIsRunning({ socketPath })) return "not-running";
|
|
8981
|
-
let acknowledged = false;
|
|
8982
|
-
try {
|
|
8983
|
-
const res = await vgdRequest({ op: "shutdown" }, { socketPath });
|
|
8984
|
-
if (res.ok) acknowledged = true;
|
|
8985
|
-
else if (res.code === "shutdown_unsupported") return "refused";
|
|
8986
|
-
} catch {
|
|
8987
|
-
}
|
|
8988
|
-
if (!acknowledged) {
|
|
8989
|
-
const pid = readVgdPid();
|
|
8990
|
-
if (pid == null) return "failed";
|
|
8991
|
-
try {
|
|
8992
|
-
process.kill(pid, "SIGTERM");
|
|
8993
|
-
} catch {
|
|
8994
|
-
return "failed";
|
|
8995
|
-
}
|
|
8996
|
-
}
|
|
8997
|
-
const deadline = Date.now() + 5e3;
|
|
8998
|
-
while (Date.now() < deadline) {
|
|
8999
|
-
await sleep(100);
|
|
9000
|
-
if (!await vgdIsRunning({ socketPath })) return "stopped";
|
|
9001
|
-
}
|
|
9002
|
-
return "failed";
|
|
9003
|
-
}
|
|
9004
|
-
async function restartVgdIfRunning(socketPath = vgdSocketPath()) {
|
|
9005
|
-
try {
|
|
9006
|
-
const stopResult = await stopVgd(socketPath);
|
|
9007
|
-
if (stopResult === "not-running") return "not-running";
|
|
9008
|
-
if (stopResult === "refused") return "refused";
|
|
9009
|
-
if (stopResult === "failed") return "failed";
|
|
9010
|
-
await startDetachedVgd(socketPath);
|
|
9011
|
-
return "restarted";
|
|
9012
|
-
} catch {
|
|
9013
|
-
return "failed";
|
|
9014
|
-
}
|
|
9015
|
-
}
|
|
9016
|
-
function readVgdPid() {
|
|
9017
|
-
try {
|
|
9018
|
-
const raw = fs12.readFileSync(vgdPidPath(), "utf8").trim();
|
|
9019
|
-
const pid = Number.parseInt(raw, 10);
|
|
9020
|
-
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
9021
|
-
} catch {
|
|
9022
|
-
return null;
|
|
9023
|
-
}
|
|
9024
|
-
}
|
|
9025
|
-
async function repositoryIdForCwd(socketPath, root2) {
|
|
9026
|
-
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
9027
|
-
const reg = await vgdRequest({ op: "register", root: root2 }, { socketPath });
|
|
9028
|
-
if (reg.ok && "workspace" in reg) return reg.workspace.id;
|
|
9029
|
-
return repositoryIdFromRoot(root2);
|
|
9030
|
-
}
|
|
9031
8730
|
function verifyContextPolicyPatch(patch) {
|
|
9032
8731
|
const { signature, contentHash, ...rest } = patch;
|
|
9033
8732
|
const expected = hashString(
|
|
@@ -9100,7 +8799,7 @@ function registerPolicy(program) {
|
|
|
9100
8799
|
const global = readGlobal(this);
|
|
9101
8800
|
let raw;
|
|
9102
8801
|
try {
|
|
9103
|
-
raw =
|
|
8802
|
+
raw = fs14.readFileSync(file, "utf8");
|
|
9104
8803
|
} catch {
|
|
9105
8804
|
throw new CliError(`cannot read ${file}`, ExitCode.NOT_FOUND);
|
|
9106
8805
|
}
|
|
@@ -9288,8 +8987,8 @@ async function readStdin() {
|
|
|
9288
8987
|
}
|
|
9289
8988
|
function readFileOrThrow(file, label) {
|
|
9290
8989
|
const p = path43.resolve(file);
|
|
9291
|
-
if (!
|
|
9292
|
-
return
|
|
8990
|
+
if (!fs14.existsSync(p)) throw usageError(`${label} file not found: ${p}`);
|
|
8991
|
+
return fs14.readFileSync(p, "utf-8");
|
|
9293
8992
|
}
|
|
9294
8993
|
async function readInput(file, label) {
|
|
9295
8994
|
return file ? readFileOrThrow(file, label) : readStdin();
|
|
@@ -9301,8 +9000,8 @@ function writeOutput(outFile, content) {
|
|
|
9301
9000
|
}
|
|
9302
9001
|
const outPath = path43.resolve(outFile);
|
|
9303
9002
|
const dir = path43.dirname(outPath);
|
|
9304
|
-
if (!
|
|
9305
|
-
|
|
9003
|
+
if (!fs14.existsSync(dir)) throw usageError(`output directory does not exist: ${dir}`);
|
|
9004
|
+
fs14.writeFileSync(outPath, content.endsWith("\n") ? content : content + "\n", "utf-8");
|
|
9306
9005
|
info(c.dim(`wrote ${outPath}`));
|
|
9307
9006
|
}
|
|
9308
9007
|
function requireChoice(value, valid2, flag) {
|
|
@@ -9336,7 +9035,7 @@ function registerHcs(program) {
|
|
|
9336
9035
|
const statePath = opts.previous ?? opts.out;
|
|
9337
9036
|
const useIncremental = canIncremental && statePath !== void 0;
|
|
9338
9037
|
const root2 = path43.resolve(dir);
|
|
9339
|
-
if (!
|
|
9038
|
+
if (!fs14.existsSync(root2) || !fs14.statSync(root2).isDirectory()) {
|
|
9340
9039
|
throw usageError(`not a directory: ${root2}`);
|
|
9341
9040
|
}
|
|
9342
9041
|
const supported = new Set(
|
|
@@ -9354,7 +9053,7 @@ function registerHcs(program) {
|
|
|
9354
9053
|
const walk2 = (abs, rel) => {
|
|
9355
9054
|
let entries;
|
|
9356
9055
|
try {
|
|
9357
|
-
entries =
|
|
9056
|
+
entries = fs14.readdirSync(abs, { withFileTypes: true });
|
|
9358
9057
|
} catch {
|
|
9359
9058
|
return;
|
|
9360
9059
|
}
|
|
@@ -9371,8 +9070,8 @@ function registerHcs(program) {
|
|
|
9371
9070
|
const lang = extToLang.get(path43.extname(entry.name).toLowerCase());
|
|
9372
9071
|
if (!lang) continue;
|
|
9373
9072
|
try {
|
|
9374
|
-
if (
|
|
9375
|
-
const content =
|
|
9073
|
+
if (fs14.statSync(absChild).size > MAX_EXTRACT_FILE_BYTES) continue;
|
|
9074
|
+
const content = fs14.readFileSync(absChild, "utf-8");
|
|
9376
9075
|
let bucket = byLanguage.get(lang);
|
|
9377
9076
|
if (!bucket) byLanguage.set(lang, bucket = []);
|
|
9378
9077
|
bucket.push({ path: relChild, content });
|
|
@@ -9403,7 +9102,7 @@ function registerHcs(program) {
|
|
|
9403
9102
|
return;
|
|
9404
9103
|
}
|
|
9405
9104
|
const previousPath = path43.resolve(statePath);
|
|
9406
|
-
const previousNdjson = !opts.full &&
|
|
9105
|
+
const previousNdjson = !opts.full && fs14.existsSync(previousPath) ? fs14.readFileSync(previousPath, "utf-8") : "";
|
|
9407
9106
|
if (opts.full) info(c.dim("running a full re-extraction (--full)"));
|
|
9408
9107
|
else if (!previousNdjson) info(c.dim(`previous stream not found at ${previousPath} \u2014 running a full extraction`));
|
|
9409
9108
|
const currentFilesJson = JSON.stringify(
|
|
@@ -9519,7 +9218,7 @@ var initCommand = new Command("init").description("Initialize vibgrate in a proj
|
|
|
9519
9218
|
console.log(chalk7.green("\u2714") + ` Created ${chalk7.bold("vibgrate.config.ts")}`);
|
|
9520
9219
|
}
|
|
9521
9220
|
if (opts.baseline) {
|
|
9522
|
-
const { runBaseline } = await import('./baseline-
|
|
9221
|
+
const { runBaseline } = await import('./baseline-NZFGLMER.js');
|
|
9523
9222
|
await runBaseline(rootDir);
|
|
9524
9223
|
}
|
|
9525
9224
|
console.log("");
|
|
@@ -9660,9 +9359,9 @@ function sitesFromImportFiles(files, limit = 10) {
|
|
|
9660
9359
|
}
|
|
9661
9360
|
async function defaultReadFile(absPath) {
|
|
9662
9361
|
try {
|
|
9663
|
-
const stat2 = await
|
|
9362
|
+
const stat2 = await fs28.stat(absPath);
|
|
9664
9363
|
if (!stat2.isFile() || stat2.size > MAX_FILE_BYTES) return null;
|
|
9665
|
-
return await
|
|
9364
|
+
return await fs28.readFile(absPath, "utf8");
|
|
9666
9365
|
} catch {
|
|
9667
9366
|
return null;
|
|
9668
9367
|
}
|
|
@@ -10329,7 +10028,7 @@ var SKIP_DIRS3 = /* @__PURE__ */ new Set([
|
|
|
10329
10028
|
function scanStaleness(rootDir, artifactPath) {
|
|
10330
10029
|
let ref;
|
|
10331
10030
|
try {
|
|
10332
|
-
ref =
|
|
10031
|
+
ref = fs14.statSync(artifactPath).mtimeMs;
|
|
10333
10032
|
} catch {
|
|
10334
10033
|
return { stale: false };
|
|
10335
10034
|
}
|
|
@@ -10341,7 +10040,7 @@ function scanStaleness(rootDir, artifactPath) {
|
|
|
10341
10040
|
if (depth > 8 || scanned > MAX_ENTRIES2) return;
|
|
10342
10041
|
let entries;
|
|
10343
10042
|
try {
|
|
10344
|
-
entries =
|
|
10043
|
+
entries = fs14.readdirSync(dir, { withFileTypes: true });
|
|
10345
10044
|
} catch {
|
|
10346
10045
|
return;
|
|
10347
10046
|
}
|
|
@@ -10356,7 +10055,7 @@ function scanStaleness(rootDir, artifactPath) {
|
|
|
10356
10055
|
const abs = path43.join(dir, e.name);
|
|
10357
10056
|
let mtimeMs;
|
|
10358
10057
|
try {
|
|
10359
|
-
mtimeMs =
|
|
10058
|
+
mtimeMs = fs14.statSync(abs).mtimeMs;
|
|
10360
10059
|
} catch {
|
|
10361
10060
|
continue;
|
|
10362
10061
|
}
|
|
@@ -10493,7 +10192,7 @@ function analyzeTree(root2, packages) {
|
|
|
10493
10192
|
if (depth > MAX_DEPTH || filesSeen >= MAX_FILES) return;
|
|
10494
10193
|
let entries;
|
|
10495
10194
|
try {
|
|
10496
|
-
entries =
|
|
10195
|
+
entries = fs14.readdirSync(dir, { withFileTypes: true });
|
|
10497
10196
|
} catch {
|
|
10498
10197
|
return;
|
|
10499
10198
|
}
|
|
@@ -10511,8 +10210,8 @@ function analyzeTree(root2, packages) {
|
|
|
10511
10210
|
const full = path43.join(dir, entry.name);
|
|
10512
10211
|
let content;
|
|
10513
10212
|
try {
|
|
10514
|
-
if (
|
|
10515
|
-
content =
|
|
10213
|
+
if (fs14.statSync(full).size > MAX_FILE_BYTES2) continue;
|
|
10214
|
+
content = fs14.readFileSync(full, "utf8");
|
|
10516
10215
|
} catch {
|
|
10517
10216
|
continue;
|
|
10518
10217
|
}
|
|
@@ -10880,8 +10579,8 @@ async function fetchLatestVersion() {
|
|
|
10880
10579
|
}
|
|
10881
10580
|
async function writeCache(data) {
|
|
10882
10581
|
try {
|
|
10883
|
-
await
|
|
10884
|
-
await
|
|
10582
|
+
await fs28.mkdir(CACHE_DIR, { recursive: true });
|
|
10583
|
+
await fs28.writeFile(CACHE_FILE, JSON.stringify(data), "utf-8");
|
|
10885
10584
|
} catch {
|
|
10886
10585
|
}
|
|
10887
10586
|
}
|
|
@@ -10919,7 +10618,7 @@ function scheduleDeferredUpdate(command, pid = process.pid, dir = os.tmpdir()) {
|
|
|
10919
10618
|
const scriptPath = path43.join(dir, `vg-update-${stamp}.cmd`);
|
|
10920
10619
|
const logPath = path43.join(dir, `vg-update-${stamp}.log`);
|
|
10921
10620
|
try {
|
|
10922
|
-
|
|
10621
|
+
fs14.writeFileSync(scriptPath, buildDeferredUpdateScript({ pid, command, logPath }), "utf8");
|
|
10923
10622
|
const child = spawn(process.env.ComSpec || "cmd.exe", ["/d", "/s", "/c", scriptPath], {
|
|
10924
10623
|
detached: true,
|
|
10925
10624
|
stdio: "ignore",
|
|
@@ -10943,7 +10642,7 @@ function detectGlobalInstall(execPath = process.argv[1] || "", cwd = process.cwd
|
|
|
10943
10642
|
if (!execPath) return null;
|
|
10944
10643
|
let resolved = execPath;
|
|
10945
10644
|
try {
|
|
10946
|
-
resolved =
|
|
10645
|
+
resolved = fs14.realpathSync(execPath);
|
|
10947
10646
|
} catch {
|
|
10948
10647
|
}
|
|
10949
10648
|
const p = resolved.replace(/\\/g, "/");
|
|
@@ -11049,19 +10748,19 @@ async function confirmWorkspaceRoot(pm) {
|
|
|
11049
10748
|
async function confirm3(question) {
|
|
11050
10749
|
if (!(process.stdin.isTTY && process.stdout.isTTY)) return false;
|
|
11051
10750
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
11052
|
-
return new Promise((
|
|
10751
|
+
return new Promise((resolve21) => {
|
|
11053
10752
|
rl.question(chalk7.yellow(question), (ans) => {
|
|
11054
10753
|
rl.close();
|
|
11055
10754
|
const t = ans.trim().toLowerCase();
|
|
11056
|
-
|
|
10755
|
+
resolve21(t === "y" || t === "yes");
|
|
11057
10756
|
});
|
|
11058
10757
|
});
|
|
11059
10758
|
}
|
|
11060
10759
|
var CAPTURED_OUTPUT_LIMIT = 64e3;
|
|
11061
10760
|
async function runInstall(cmd, cwd) {
|
|
11062
|
-
const { spawn:
|
|
11063
|
-
return new Promise((
|
|
11064
|
-
const child =
|
|
10761
|
+
const { spawn: spawn4 } = await import('child_process');
|
|
10762
|
+
return new Promise((resolve21) => {
|
|
10763
|
+
const child = spawn4(cmd, {
|
|
11065
10764
|
cwd,
|
|
11066
10765
|
shell: true,
|
|
11067
10766
|
stdio: ["inherit", "pipe", "pipe"],
|
|
@@ -11079,22 +10778,22 @@ async function runInstall(cmd, cwd) {
|
|
|
11079
10778
|
};
|
|
11080
10779
|
tee(child.stdout, process.stdout);
|
|
11081
10780
|
tee(child.stderr, process.stderr);
|
|
11082
|
-
child.on("error", (err) =>
|
|
10781
|
+
child.on("error", (err) => resolve21({ ok: false, output: `${output}
|
|
11083
10782
|
${String(err)}` }));
|
|
11084
|
-
child.on("close", (code) =>
|
|
10783
|
+
child.on("close", (code) => resolve21({ ok: code === 0, output }));
|
|
11085
10784
|
});
|
|
11086
10785
|
}
|
|
11087
10786
|
async function releaseWindowsFileLocks(cwd, keepVersion) {
|
|
11088
10787
|
reapAndReport(cwd, keepVersion);
|
|
11089
10788
|
try {
|
|
11090
|
-
const { vgdSocketPath
|
|
11091
|
-
const result = await stopVgd(
|
|
10789
|
+
const { vgdSocketPath } = await import('./vgd-QR26FAZD.js');
|
|
10790
|
+
const result = await stopVgd(vgdSocketPath());
|
|
11092
10791
|
if (result === "stopped") {
|
|
11093
10792
|
console.log(chalk7.dim("Stopped the vgd daemon so its files can be replaced \u2014 it restarts on the next command."));
|
|
11094
10793
|
} else if (result === "refused") {
|
|
11095
10794
|
console.log(
|
|
11096
10795
|
chalk7.dim(
|
|
11097
|
-
"A vgd
|
|
10796
|
+
"A vgd that cannot be stopped remotely is running \u2014 close the process holding the socket if the update reports a locked file."
|
|
11098
10797
|
)
|
|
11099
10798
|
);
|
|
11100
10799
|
}
|
|
@@ -11212,12 +10911,12 @@ var updateCommand = new Command("update").description("Update vibgrate to the la
|
|
|
11212
10911
|
);
|
|
11213
10912
|
async function rewarmVgdAndReport(cwd) {
|
|
11214
10913
|
try {
|
|
11215
|
-
const { vgdIsRunning
|
|
11216
|
-
if (!await
|
|
11217
|
-
const loaded = await
|
|
10914
|
+
const { vgdIsRunning, vgdRequest } = await import('./vgd-QR26FAZD.js');
|
|
10915
|
+
if (!await vgdIsRunning()) return;
|
|
10916
|
+
const loaded = await vgdRequest({ op: "load-graph", root: cwd });
|
|
11218
10917
|
if (!loaded.ok || !("repositoryId" in loaded)) return;
|
|
11219
10918
|
console.log(chalk7.dim("Re-published the code map into the restarted daemon."));
|
|
11220
|
-
const indexed = await
|
|
10919
|
+
const indexed = await vgdRequest({ op: "embed-index", repositoryId: loaded.repositoryId });
|
|
11221
10920
|
if (indexed.ok && "vectors" in indexed && indexed.state === "ready") {
|
|
11222
10921
|
console.log(chalk7.dim(`Semantic index warm again (${indexed.vectors} vectors).`));
|
|
11223
10922
|
}
|
|
@@ -11236,7 +10935,7 @@ async function restartVgdAndReport() {
|
|
|
11236
10935
|
console.log(chalk7.dim("Restarted the vgd daemon on the new version."));
|
|
11237
10936
|
} else if (result === "refused") {
|
|
11238
10937
|
console.log(
|
|
11239
|
-
chalk7.dim("A vgd
|
|
10938
|
+
chalk7.dim("A vgd that cannot be stopped remotely is running \u2014 restart the process holding the socket to pick up the update.")
|
|
11240
10939
|
);
|
|
11241
10940
|
} else {
|
|
11242
10941
|
console.log(
|
|
@@ -11536,14 +11235,14 @@ function promptPlanSelection(response) {
|
|
|
11536
11235
|
const defaultIdx = plans.findIndex((p) => p.tier === response.recommended);
|
|
11537
11236
|
const def = defaultIdx >= 0 ? defaultIdx + 1 : 1;
|
|
11538
11237
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
11539
|
-
return new Promise((
|
|
11238
|
+
return new Promise((resolve21) => {
|
|
11540
11239
|
rl.question(`Plan [1-${plans.length}, default ${def}, q to cancel]: `, (ans) => {
|
|
11541
11240
|
rl.close();
|
|
11542
11241
|
const t = ans.trim().toLowerCase();
|
|
11543
|
-
if (t === "q" || t === "quit") return
|
|
11242
|
+
if (t === "q" || t === "quit") return resolve21(null);
|
|
11544
11243
|
const n = t === "" ? def : Number.parseInt(t, 10);
|
|
11545
|
-
if (!Number.isInteger(n) || n < 1 || n > plans.length) return
|
|
11546
|
-
|
|
11244
|
+
if (!Number.isInteger(n) || n < 1 || n > plans.length) return resolve21(null);
|
|
11245
|
+
resolve21(plans[n - 1].tier);
|
|
11547
11246
|
});
|
|
11548
11247
|
});
|
|
11549
11248
|
}
|
|
@@ -12385,7 +12084,7 @@ function openUrl(url) {
|
|
|
12385
12084
|
}
|
|
12386
12085
|
|
|
12387
12086
|
// src/reporting/commands/login.ts
|
|
12388
|
-
var delay = (ms) => new Promise((
|
|
12087
|
+
var delay = (ms) => new Promise((resolve21) => setTimeout(resolve21, ms));
|
|
12389
12088
|
function isInside(dir, file) {
|
|
12390
12089
|
const rel = path43.relative(dir, file);
|
|
12391
12090
|
return !!rel && !rel.startsWith("..") && !path43.isAbsolute(rel);
|
|
@@ -13760,17 +13459,17 @@ function resolveSigningKey(root2, explicit) {
|
|
|
13760
13459
|
const chosen = process.env.VG_ATTEST_KEY;
|
|
13761
13460
|
const keyPath = chosen ? path43.resolve(chosen) : path43.join(root2, ".vibgrate", DEFAULT_KEY);
|
|
13762
13461
|
let minted = false;
|
|
13763
|
-
if (!
|
|
13462
|
+
if (!fs14.existsSync(keyPath)) {
|
|
13764
13463
|
if (chosen) throw new CliError(`signing key not found: ${chosen}`, ExitCode.USAGE_ERROR);
|
|
13765
13464
|
const kp = generateKeypair();
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
13465
|
+
fs14.mkdirSync(path43.dirname(keyPath), { recursive: true });
|
|
13466
|
+
fs14.writeFileSync(keyPath, kp.privatePem, { mode: 384 });
|
|
13467
|
+
fs14.writeFileSync(`${keyPath}.pub`, kp.publicPem);
|
|
13769
13468
|
minted = true;
|
|
13770
13469
|
}
|
|
13771
13470
|
let key2;
|
|
13772
13471
|
try {
|
|
13773
|
-
key2 = crypto3.createPrivateKey(
|
|
13472
|
+
key2 = crypto3.createPrivateKey(fs14.readFileSync(keyPath, "utf8"));
|
|
13774
13473
|
} catch {
|
|
13775
13474
|
throw new CliError(`could not read an Ed25519 private key from ${keyPath}`, ExitCode.USAGE_ERROR);
|
|
13776
13475
|
}
|
|
@@ -13781,8 +13480,8 @@ function resolveSigningKey(root2, explicit) {
|
|
|
13781
13480
|
}
|
|
13782
13481
|
function writeBundle(input) {
|
|
13783
13482
|
const dir = input.outDir;
|
|
13784
|
-
|
|
13785
|
-
const write = (rel, data) =>
|
|
13483
|
+
fs14.mkdirSync(path43.join(dir, "inputs", "releases"), { recursive: true });
|
|
13484
|
+
const write = (rel, data) => fs14.writeFileSync(path43.join(dir, rel), `${JSON.stringify(data, null, 2)}
|
|
13786
13485
|
`);
|
|
13787
13486
|
write("result.json", input.result);
|
|
13788
13487
|
write(path43.join("inputs", "advisory.json"), input.advisory);
|
|
@@ -13806,13 +13505,13 @@ function writeBundle(input) {
|
|
|
13806
13505
|
disclaimer: input.regime.disclaimer
|
|
13807
13506
|
});
|
|
13808
13507
|
if (input.envelope) {
|
|
13809
|
-
|
|
13508
|
+
fs14.writeFileSync(path43.join(dir, "evidence.intoto.jsonl"), `${JSON.stringify(input.envelope)}
|
|
13810
13509
|
`);
|
|
13811
13510
|
}
|
|
13812
13511
|
if (input.timestampToken) {
|
|
13813
|
-
|
|
13512
|
+
fs14.writeFileSync(path43.join(dir, "timestamp.tsr"), input.timestampToken);
|
|
13814
13513
|
}
|
|
13815
|
-
|
|
13514
|
+
fs14.writeFileSync(path43.join(dir, "VERIFY.md"), verifyDoc(input));
|
|
13816
13515
|
return dir;
|
|
13817
13516
|
}
|
|
13818
13517
|
function verifyDoc(input) {
|
|
@@ -14155,7 +13854,7 @@ var packCmd = new Command("pack").description("Build the submission pack a human
|
|
|
14155
13854
|
const stage = opts.stage ?? regime.clocks[0]?.stage ?? "early-warning";
|
|
14156
13855
|
const md = buildPack(result, regime, org, stage);
|
|
14157
13856
|
if (opts.out) {
|
|
14158
|
-
|
|
13857
|
+
fs14.writeFileSync(path43.resolve(rootDir, opts.out), md);
|
|
14159
13858
|
console.error(chalk7.green("\u2714") + ` pack written to ${opts.out}`);
|
|
14160
13859
|
} else {
|
|
14161
13860
|
console.log(md);
|
|
@@ -14198,19 +13897,19 @@ var drillCmd = new Command("drill").description("Timed dry-run of the determinat
|
|
|
14198
13897
|
});
|
|
14199
13898
|
var verifyCmd = new Command("verify").description("Verify an evidence bundle offline (no Vibgrate needed)").argument("<bundle>", "Path to an evidence bundle directory or evidence.intoto.jsonl").option("--pub <file>", "Public key PEM to pin the signer (establish trust)").action((bundlePath, opts) => {
|
|
14200
13899
|
const abs = path43.resolve(bundlePath);
|
|
14201
|
-
const envPath =
|
|
14202
|
-
if (!
|
|
14203
|
-
const envelope = JSON.parse(
|
|
13900
|
+
const envPath = fs14.statSync(abs).isDirectory() ? path43.join(abs, "evidence.intoto.jsonl") : abs;
|
|
13901
|
+
if (!fs14.existsSync(envPath)) throw new CliError(`no evidence.intoto.jsonl at ${bundlePath}`, ExitCode.NOT_FOUND);
|
|
13902
|
+
const envelope = JSON.parse(fs14.readFileSync(envPath, "utf8").trim().split("\n")[0]);
|
|
14204
13903
|
const resultPath = path43.join(path43.dirname(envPath), "result.json");
|
|
14205
|
-
const result =
|
|
14206
|
-
const publicKeyPem = opts.pub ?
|
|
13904
|
+
const result = fs14.existsSync(resultPath) ? JSON.parse(fs14.readFileSync(resultPath, "utf8")) : void 0;
|
|
13905
|
+
const publicKeyPem = opts.pub ? fs14.readFileSync(path43.resolve(opts.pub), "utf8") : void 0;
|
|
14207
13906
|
const v = verifyEvidenceEnvelope(envelope, { publicKeyPem, result });
|
|
14208
13907
|
const color = v.status === "verified" ? chalk7.green : v.status === "failed" ? chalk7.red : chalk7.yellow;
|
|
14209
13908
|
console.log(" " + color(v.status.toUpperCase()) + ` ${v.reason}`);
|
|
14210
13909
|
if (v.evidenceId) console.log(" " + chalk7.dim(`evidence ${v.evidenceId} \xB7 regime ${v.regime} \xB7 advisory ${v.advisoryId} \xB7 ${v.overallStatus}`));
|
|
14211
13910
|
const tsrPath = path43.join(path43.dirname(envPath), "timestamp.tsr");
|
|
14212
|
-
if (
|
|
14213
|
-
const t = verifyTimestamp(
|
|
13911
|
+
if (fs14.existsSync(tsrPath) && result) {
|
|
13912
|
+
const t = verifyTimestamp(fs14.readFileSync(tsrPath), exposureSubjectDigest(result));
|
|
14214
13913
|
const tcolor = t.imprintMatches ? chalk7.green : chalk7.red;
|
|
14215
13914
|
console.log(" " + tcolor("TIMESTAMP") + ` ${t.reason}`);
|
|
14216
13915
|
}
|
|
@@ -14309,9 +14008,9 @@ var pushCmd = new Command("push").description("Push the product registry (and an
|
|
|
14309
14008
|
let exposure;
|
|
14310
14009
|
if (opts.result) {
|
|
14311
14010
|
const raw = path43.resolve(rootDir, opts.result);
|
|
14312
|
-
const resultPath =
|
|
14313
|
-
if (!
|
|
14314
|
-
exposure = JSON.parse(
|
|
14011
|
+
const resultPath = fs14.existsSync(raw) && fs14.statSync(raw).isDirectory() ? path43.join(raw, "result.json") : raw;
|
|
14012
|
+
if (!fs14.existsSync(resultPath)) throw new CliError(`no result.json at ${opts.result}`, ExitCode.NOT_FOUND);
|
|
14013
|
+
exposure = JSON.parse(fs14.readFileSync(resultPath, "utf8"));
|
|
14315
14014
|
}
|
|
14316
14015
|
const payload = { schemaVersion: "evidence-push-1", regime: regime.id, generatedAt: nowIso(), signed: Boolean(opts.signed), products: productPayload, exposure };
|
|
14317
14016
|
const body = JSON.stringify(payload);
|
|
@@ -14507,7 +14206,7 @@ function dispatch(argv, cwd) {
|
|
|
14507
14206
|
}
|
|
14508
14207
|
const looksLikeQuestion = /\s/.test(first) || first.endsWith("?");
|
|
14509
14208
|
if (looksLikeQuestion) return ["ask", ...args];
|
|
14510
|
-
if (
|
|
14209
|
+
if (fs14.existsSync(path43.resolve(cwd, first))) {
|
|
14511
14210
|
return [hasBuildOnlyFlag(args) ? "build" : "scan", ...args];
|
|
14512
14211
|
}
|
|
14513
14212
|
const moved = MOVED_COMMANDS[first];
|