@vibgrate/cli 2026.728.2 → 2026.728.4
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/DOCS.md +3 -3
- package/dist/baseline-QD4HVNVJ.js +8 -0
- package/dist/{baseline-MRUM2P6H.js.map → baseline-QD4HVNVJ.js.map} +1 -1
- package/dist/{chunk-A2IYFNCQ.js → chunk-2ZHWF7C6.js} +227 -19
- package/dist/chunk-2ZHWF7C6.js.map +1 -0
- package/dist/{chunk-UZJS7GMK.js → chunk-3LSG7Z4I.js} +10 -6
- package/dist/chunk-3LSG7Z4I.js.map +1 -0
- package/dist/{chunk-KKRSQQ3A.js → chunk-7AVYKZEM.js} +4 -4
- package/dist/{chunk-KKRSQQ3A.js.map → chunk-7AVYKZEM.js.map} +1 -1
- package/dist/{chunk-3SDV6ADQ.js → chunk-CQDUBAQY.js} +3 -3
- package/dist/{chunk-3SDV6ADQ.js.map → chunk-CQDUBAQY.js.map} +1 -1
- package/dist/{chunk-R2QNFXE5.js → chunk-DBOT2ELH.js} +3 -3
- package/dist/{chunk-R2QNFXE5.js.map → chunk-DBOT2ELH.js.map} +1 -1
- package/dist/{chunk-6UK6QPTR.js → chunk-EETK7S43.js} +137 -34
- package/dist/chunk-EETK7S43.js.map +1 -0
- package/dist/{chunk-JRAGO6OB.js → chunk-EVWW3BPM.js} +4 -4
- package/dist/{chunk-JRAGO6OB.js.map → chunk-EVWW3BPM.js.map} +1 -1
- package/dist/chunk-G4HTI4ZM.js +1537 -0
- package/dist/chunk-G4HTI4ZM.js.map +1 -0
- package/dist/{chunk-NTW5UEKT.js → chunk-HY2RVURA.js} +3 -3
- package/dist/{chunk-NTW5UEKT.js.map → chunk-HY2RVURA.js.map} +1 -1
- package/dist/chunk-IPICO2RV.js +789 -0
- package/dist/chunk-IPICO2RV.js.map +1 -0
- package/dist/{chunk-IWP7MYIA.js → chunk-LYDH2PHN.js} +10 -10
- package/dist/{chunk-IWP7MYIA.js.map → chunk-LYDH2PHN.js.map} +1 -1
- package/dist/{chunk-PVZBYZZR.js → chunk-NZELMYT4.js} +27 -6
- package/dist/chunk-NZELMYT4.js.map +1 -0
- package/dist/{chunk-GYSOQH5C.js → chunk-OV4KGXPD.js} +30 -4
- package/dist/chunk-OV4KGXPD.js.map +1 -0
- package/dist/{chunk-6UQMXIAG.js → chunk-OWSFZQOP.js} +62 -12
- package/dist/chunk-OWSFZQOP.js.map +1 -0
- package/dist/{chunk-WH2N22S3.js → chunk-PRGCCW7D.js} +4 -4
- package/dist/{chunk-WH2N22S3.js.map → chunk-PRGCCW7D.js.map} +1 -1
- package/dist/{chunk-ZFTFCM7B.js → chunk-RCBMY7CR.js} +11 -11
- package/dist/{chunk-ZFTFCM7B.js.map → chunk-RCBMY7CR.js.map} +1 -1
- package/dist/{chunk-OSD546W7.js → chunk-REIGWTTH.js} +5 -3
- package/dist/chunk-REIGWTTH.js.map +1 -0
- package/dist/{chunk-B3YUO3NW.js → chunk-RYNAK4LK.js} +3 -3
- package/dist/{chunk-B3YUO3NW.js.map → chunk-RYNAK4LK.js.map} +1 -1
- package/dist/{chunk-YF43FOPP.js → chunk-RZEXHDCF.js} +33 -14
- package/dist/chunk-RZEXHDCF.js.map +1 -0
- package/dist/chunk-SA4BMEU6.js +2184 -0
- package/dist/chunk-SA4BMEU6.js.map +1 -0
- package/dist/{chunk-HK3AWUXH.js → chunk-TCJTQGAO.js} +3 -3
- package/dist/{chunk-HK3AWUXH.js.map → chunk-TCJTQGAO.js.map} +1 -1
- package/dist/{chunk-ZBTY6VV4.js → chunk-US2DAKCM.js} +15 -5
- package/dist/chunk-US2DAKCM.js.map +1 -0
- package/dist/{chunk-ON25BX6T.js → chunk-UTNNGKKX.js} +3 -3
- package/dist/{chunk-ON25BX6T.js.map → chunk-UTNNGKKX.js.map} +1 -1
- package/dist/chunk-WDJNUC6V.js +3059 -0
- package/dist/chunk-WDJNUC6V.js.map +1 -0
- package/dist/{chunk-UIOBFLE6.js → chunk-WHJMS7XC.js} +4 -4
- package/dist/{chunk-UIOBFLE6.js.map → chunk-WHJMS7XC.js.map} +1 -1
- package/dist/chunk-Z6ZWNWWR.js +30 -0
- package/dist/{chunk-DGUM43GV.js.map → chunk-Z6ZWNWWR.js.map} +1 -1
- package/dist/{chunk-WY6DGTBP.js → chunk-ZU7VD4QL.js} +7 -6
- package/dist/chunk-ZU7VD4QL.js.map +1 -0
- package/dist/cli.js +554 -175
- package/dist/cli.js.map +1 -1
- package/dist/{execution-env-ZU45JZ4G.js → execution-env-4MS5AYAN.js} +3 -3
- package/dist/{execution-env-ZU45JZ4G.js.map → execution-env-4MS5AYAN.js.map} +1 -1
- package/dist/{federation-SZWZIFZ7.js → federation-MDQPO3PW.js} +3 -3
- package/dist/{federation-SZWZIFZ7.js.map → federation-MDQPO3PW.js.map} +1 -1
- package/dist/{fs-O5IQYXHO.js → fs-4G5A65KS.js} +3 -3
- package/dist/fs-4G5A65KS.js.map +1 -0
- package/dist/{fs-B5HZ2MIU.js → fs-6JKZNQ3U.js} +3 -3
- package/dist/fs-6JKZNQ3U.js.map +1 -0
- package/dist/{git-ref-XDXB6JP5.js → git-ref-RSRAN4OH.js} +3 -3
- package/dist/{git-ref-XDXB6JP5.js.map → git-ref-RSRAN4OH.js.map} +1 -1
- package/dist/{graph-backend-UTOL3SHE.js → graph-backend-GBL33GMW.js} +5 -5
- package/dist/{graph-backend-UTOL3SHE.js.map → graph-backend-GBL33GMW.js.map} +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +14 -12
- package/dist/index.js.map +1 -1
- package/dist/{interactive-36ZZ64WL.js → interactive-32LSIBRG.js} +48 -27
- package/dist/interactive-32LSIBRG.js.map +1 -0
- package/dist/{llm-host-XYBT4267.js → llm-host-5RE34322.js} +3 -3
- package/dist/{llm-host-XYBT4267.js.map → llm-host-5RE34322.js.map} +1 -1
- package/dist/load-SEFJA3M5.js +8 -0
- package/dist/{load-QPOWQD7C.js.map → load-SEFJA3M5.js.map} +1 -1
- package/dist/local-runtime-2ED33KK6.js +6 -0
- package/dist/{local-runtime-5O2NN3GA.js.map → local-runtime-2ED33KK6.js.map} +1 -1
- package/dist/mcp-tools-KAJS34TN.js +4 -0
- package/dist/{mcp-tools-I7JK3S2M.js.map → mcp-tools-KAJS34TN.js.map} +1 -1
- package/dist/{model-execution-profile-TFBKCNJG.js → model-execution-profile-ELWF3Z6H.js} +3 -3
- package/dist/{model-execution-profile-TFBKCNJG.js.map → model-execution-profile-ELWF3Z6H.js.map} +1 -1
- package/dist/model-manager-GJ2YSTSK.js +10 -0
- package/dist/{model-manager-OEPY4I7W.js.map → model-manager-GJ2YSTSK.js.map} +1 -1
- package/dist/{model-orchestrator-4VSYP4J4.js → model-orchestrator-LHYPJBFH.js} +4 -4
- package/dist/{model-orchestrator-4VSYP4J4.js.map → model-orchestrator-LHYPJBFH.js.map} +1 -1
- package/dist/parse-worker.js +2 -2
- package/dist/{paths-2RAH3GME.js → paths-62AKTFSR.js} +3 -3
- package/dist/{paths-2RAH3GME.js.map → paths-62AKTFSR.js.map} +1 -1
- package/dist/resolve-gguf-SDIYGGI6.js +9 -0
- package/dist/{resolve-gguf-Y6FH3CNB.js.map → resolve-gguf-SDIYGGI6.js.map} +1 -1
- package/dist/{runtime-session-EJQZXANB.js → runtime-session-4IACVDSY.js} +7 -7
- package/dist/{runtime-session-EJQZXANB.js.map → runtime-session-4IACVDSY.js.map} +1 -1
- package/dist/session-2JT4AUZT.js +13 -0
- package/dist/{session-ZJGENHKX.js.map → session-2JT4AUZT.js.map} +1 -1
- package/dist/session-store-O4XPXKOV.js +4 -0
- package/dist/{session-store-WFBX7HXL.js.map → session-store-O4XPXKOV.js.map} +1 -1
- package/dist/{sql-extract-JELDZA6W.js → sql-extract-6UJOLJDL.js} +3 -3
- package/dist/{sql-extract-JELDZA6W.js.map → sql-extract-6UJOLJDL.js.map} +1 -1
- package/dist/stream-json-Y45JBNYP.js +112 -0
- package/dist/stream-json-Y45JBNYP.js.map +1 -0
- package/dist/ui-K7D3BCHD.js +5 -0
- package/dist/ui-K7D3BCHD.js.map +1 -0
- package/dist/vg-mcp-bridge-E4SJFL7Q.js +75 -0
- package/dist/vg-mcp-bridge-E4SJFL7Q.js.map +1 -0
- package/dist/{vgd-3MHSB4KA.js → vgd-KDQFS33M.js} +6 -6
- package/dist/vgd-KDQFS33M.js.map +1 -0
- package/package.json +1 -1
- package/dist/baseline-MRUM2P6H.js +0 -8
- package/dist/chunk-6AXHLQBV.js +0 -1892
- package/dist/chunk-6AXHLQBV.js.map +0 -1
- package/dist/chunk-6UK6QPTR.js.map +0 -1
- package/dist/chunk-6UQMXIAG.js.map +0 -1
- package/dist/chunk-A2IYFNCQ.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -10
- package/dist/chunk-GQTWDKMJ.js +0 -5645
- package/dist/chunk-GQTWDKMJ.js.map +0 -1
- package/dist/chunk-GYSOQH5C.js.map +0 -1
- package/dist/chunk-OSD546W7.js.map +0 -1
- package/dist/chunk-PVZBYZZR.js.map +0 -1
- package/dist/chunk-UZJS7GMK.js.map +0 -1
- package/dist/chunk-WY6DGTBP.js.map +0 -1
- package/dist/chunk-YF43FOPP.js.map +0 -1
- package/dist/chunk-ZBTY6VV4.js.map +0 -1
- package/dist/fs-B5HZ2MIU.js.map +0 -1
- package/dist/fs-O5IQYXHO.js.map +0 -1
- package/dist/interactive-36ZZ64WL.js.map +0 -1
- package/dist/load-QPOWQD7C.js +0 -8
- package/dist/local-runtime-5O2NN3GA.js +0 -5
- package/dist/mcp-tools-I7JK3S2M.js +0 -4
- package/dist/model-manager-OEPY4I7W.js +0 -10
- package/dist/resolve-gguf-Y6FH3CNB.js +0 -9
- package/dist/session-ZJGENHKX.js +0 -13
- package/dist/session-store-WFBX7HXL.js +0 -4
- package/dist/stream-json-Z5KC2DM3.js +0 -78
- package/dist/stream-json-Z5KC2DM3.js.map +0 -1
- package/dist/ui-Q6DJ3GCU.js +0 -5
- package/dist/ui-Q6DJ3GCU.js.map +0 -1
- package/dist/vgd-3MHSB4KA.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,46 +1,48 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { sha256Hex, generateKeypair, dssePae, DSSE_PAYLOAD_TYPE, keyId, registerBuild, readGlobal, applyGlobalOptions, ProgressBar, printLogo, fetchCatalog, resolveProviders, runBuild } from './chunk-
|
|
3
|
-
export { runBuild } from './chunk-
|
|
4
|
-
import { CONTEXT_POLICY_VERSION, computeFcsReport, renderFcsReportMarkdown, createTrajectoryCollector, runAgent } from './chunk-
|
|
5
|
-
import { loadAdvancedScanHook, baselineCommand } from './chunk-
|
|
6
|
-
import { runCodeSession } from './chunk-
|
|
7
|
-
import { summarizeDiffs, ScriptedProvider } from './chunk-
|
|
2
|
+
import { sha256Hex, generateKeypair, dssePae, DSSE_PAYLOAD_TYPE, keyId, registerBuild, readGlobal, applyGlobalOptions, ProgressBar, printLogo, fetchCatalog, resolveProviders, runBuild } from './chunk-LYDH2PHN.js';
|
|
3
|
+
export { runBuild } from './chunk-LYDH2PHN.js';
|
|
4
|
+
import { CONTEXT_POLICY_VERSION, computeFcsReport, renderFcsReportMarkdown, createTrajectoryCollector, runAgent } from './chunk-2ZHWF7C6.js';
|
|
5
|
+
import { loadAdvancedScanHook, baselineCommand } from './chunk-HY2RVURA.js';
|
|
6
|
+
import { runCodeSession } from './chunk-PRGCCW7D.js';
|
|
7
|
+
import { summarizeDiffs, ScriptedProvider } from './chunk-RZEXHDCF.js';
|
|
8
8
|
import { disableColor, info, c, json, out } from './chunk-CT5BS56U.js';
|
|
9
|
-
import { VGD_PROTOCOL_VERSION, startVgdServer } from './chunk-
|
|
9
|
+
import { VGD_PROTOCOL_VERSION, startVgdServer } from './chunk-EVWW3BPM.js';
|
|
10
10
|
import './chunk-5I4VSBWQ.js';
|
|
11
11
|
import './chunk-IS7VTH2Q.js';
|
|
12
|
-
import { gatherSystemMemory } from './chunk-
|
|
13
|
-
import { readOrchestratorState, writeOrchestratorState, parseMode, setDefaultMode, recommendMode, activePin, resolveMode, providerForBackend, QUALIFIED_PACKS, pinPack, unpinPack, buildOrchestratorStatus } from './chunk-
|
|
12
|
+
import { init_resolve_ollama, gatherSystemMemory, resolveOllamaBinary, hasOllamaBinary, resolve_ollama_exports } from './chunk-OWSFZQOP.js';
|
|
13
|
+
import { readOrchestratorState, writeOrchestratorState, parseMode, setDefaultMode, recommendMode, activePin, resolveMode, providerForBackend, QUALIFIED_PACKS, pinPack, unpinPack, buildOrchestratorStatus } from './chunk-NZELMYT4.js';
|
|
14
14
|
import { fmt, estimateModelBytes } from './chunk-7N4Y3E47.js';
|
|
15
15
|
import './chunk-IZDH67DX.js';
|
|
16
|
-
import './chunk-
|
|
16
|
+
import './chunk-TCJTQGAO.js';
|
|
17
17
|
import { vgdIsRunning, vgdRequest, vgdSocketPath } from './chunk-PMYWZRRS.js';
|
|
18
18
|
import { defaultProcessEndpoint, startProcessHostServer, resolveInferenceIsolation } from './chunk-SIPGDJT4.js';
|
|
19
19
|
import { clearHostSessionPool, acquireHostSession, generateOnSession, listHostSessions, hostSessionPoolSize } from './chunk-6HX47EBL.js';
|
|
20
20
|
import { buildIdentifierTrieFromGraph } from './chunk-JIBOJTGS.js';
|
|
21
|
-
import './chunk-
|
|
22
|
-
import { buildModelInstallPlan } from './chunk-
|
|
23
|
-
import { ensurePackage, ensureUnavailableMessage } from './chunk-
|
|
24
|
-
import { serveStdio, exportGraph, GraphSource, createServer, formatForExt } from './chunk-
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
21
|
+
import './chunk-7AVYKZEM.js';
|
|
22
|
+
import { buildModelInstallPlan } from './chunk-WHJMS7XC.js';
|
|
23
|
+
import { ensurePackage, ensureUnavailableMessage } from './chunk-REIGWTTH.js';
|
|
24
|
+
import { serveStdio, exportGraph, GraphSource, createServer, formatForExt } from './chunk-ZU7VD4QL.js';
|
|
25
|
+
import { CliError, ExitCode, refreshIfStale, driftCount, ASSISTANTS, detectAssistants, usageError, detectServeLaunch, installAssistant, writeNavigationConfig, uninstallAssistant, buildGraph, writeSnapshot, probeFreshness, discover, assistantById, SMALL_REPO_FILES, SKIP_DIRS, SKIP_FILES } from './chunk-WDJNUC6V.js';
|
|
26
|
+
import { resolveDsn, resolveIngestHost, dashHostForIngestHost, availableRegionIds, createWorkspaceDsn, writeStoredCredentials, credentialsPath, findGitRoot, ensureGitignored, gitignoreEntryForCredentials, clearStoredCredentials, parseDsn as parseDsn$1, uploadScanArtifact, ingestHostForRegionId, dsnCommand, pushCommand, countTokens, shortestPath, pathDisconnect, testsToRun, detectRunner, coveringTests, FREE_PACK, readScanArtifact, publishPrivateLibrary, assessDocQuality, symbolsFromApi, fetchHostedDocsCached, selectForBudget, hostedBase, readStoredCredentials, projectCredentialsPath, homeCredentialsPath } from './chunk-SA4BMEU6.js';
|
|
27
|
+
import './chunk-IPICO2RV.js';
|
|
28
|
+
import { inventory, enrichOnline, ECOSYSTEMS, catalogPath, libDir, loadCatalog, driftFor, addLibrary, resolveLib, libId, resolveVersion, readDoc, localPackageDocs, localApiSurface } from './chunk-G4HTI4ZM.js';
|
|
29
|
+
import { writeDefaultConfig, parseDsn, detectVcs, computeRepoFingerprint, resolveRepositoryName, fetchScanPreflight, runCoreScan, VERSION, loadConfig, prepareCompressedUpload, computeDriftScore, titleBox, projectTypeToVulnEcosystem, driftBar, gitHistoryAvailable, buildVersionTimelines, findPackageAnyEcosystem, normalizeConstraint, findVersionCrossings, versionSatisfies, PROJECT_TYPE_TO_OSV_ECOSYSTEM, fetchRiskySymbols } from './chunk-RCBMY7CR.js';
|
|
30
|
+
import { recordCliCall, CLI_TOOL_ALIASES, savingsLedgerPath, clearSavings, readSavings, readUsage, readModelSavings, CAPSULE_RANKING_VERSION, SAVINGS_TOOLS, sanitizeClient } from './chunk-US2DAKCM.js';
|
|
29
31
|
import { ensureDir, pathExists, readJsonFile, writeTextFile, writeJsonFile } from './chunk-CRAMOEBE.js';
|
|
30
32
|
import { resolveOne } from './chunk-J7LKEB2R.js';
|
|
31
|
-
import { embeddingsCached, resolveEmbedModel, loadEmbedder, getNodeEmbeddings, queryGraphSemantic, queryGraph, unavailableMessage, countPending, indexFor, impactOf, modelCacheInfo, clearModelCache } from './chunk-
|
|
32
|
-
import { discoverModels } from './chunk-
|
|
33
|
-
import { resolveCliInvocation, NPX_INVOCATION } from './chunk-
|
|
34
|
-
import { listCachedWeights, ensureWeightCached, catalogIntegrityReport
|
|
35
|
-
import { resolvedGrammarFiles, grammarSetVersion } from './chunk-
|
|
33
|
+
import { embeddingsCached, resolveEmbedModel, loadEmbedder, getNodeEmbeddings, queryGraphSemantic, queryGraph, unavailableMessage, countPending, indexFor, impactOf, modelCacheInfo, clearModelCache } from './chunk-EETK7S43.js';
|
|
34
|
+
import { discoverModels } from './chunk-CQDUBAQY.js';
|
|
35
|
+
import { init_cli_invocation, resolveCliInvocation, NPX_INVOCATION } from './chunk-3LSG7Z4I.js';
|
|
36
|
+
import { freeBytesOnVolume, weightStoreDir, listCachedWeights, ensureWeightCached, catalogIntegrityReport } from './chunk-OV4KGXPD.js';
|
|
37
|
+
import { resolvedGrammarFiles, grammarSetVersion } from './chunk-UTNNGKKX.js';
|
|
36
38
|
import './chunk-RXP66R2E.js';
|
|
37
|
-
import { resolveGraphPath, renderReport, loadGraph, writeArtifacts, vibgrateDir, SCHEMA_VERSION } from './chunk-
|
|
39
|
+
import { resolveGraphPath, renderReport, loadGraph, writeArtifacts, vibgrateDir, SCHEMA_VERSION } from './chunk-RYNAK4LK.js';
|
|
38
40
|
import { cacheDir, stableStringify } from './chunk-ZKNB4YH4.js';
|
|
39
41
|
import './chunk-BWPBB45M.js';
|
|
40
42
|
import { canonicalize, hashString, hashBytes } from './chunk-JFGYT6BI.js';
|
|
41
43
|
import './chunk-BPF3YX2U.js';
|
|
42
44
|
import { pathExists as pathExists$1, parseExcludePatterns } from './chunk-GI6W53LM.js';
|
|
43
|
-
import './chunk-
|
|
45
|
+
import { __toCommonJS } from './chunk-Z6ZWNWWR.js';
|
|
44
46
|
import * as fs8 from 'fs';
|
|
45
47
|
import fs8__default, { realpathSync } from 'fs';
|
|
46
48
|
import * as path37 from 'path';
|
|
@@ -56,6 +58,7 @@ import chalk7 from 'chalk';
|
|
|
56
58
|
import * as fs21 from 'fs/promises';
|
|
57
59
|
import semver2 from 'semver';
|
|
58
60
|
|
|
61
|
+
init_cli_invocation();
|
|
59
62
|
function registerStatus(program) {
|
|
60
63
|
const cmd = program.command("status").description("cache/freshness, counts, staleness, resolver rungs used").action(async function() {
|
|
61
64
|
await runStatus(readGlobal(this));
|
|
@@ -2136,7 +2139,10 @@ function runTree(graph, params) {
|
|
|
2136
2139
|
|
|
2137
2140
|
// src/lsp/enrich.ts
|
|
2138
2141
|
var OSV_QUERY_URL = "https://api.osv.dev/v1/query";
|
|
2142
|
+
var KEV_URL = "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json";
|
|
2139
2143
|
var cache = /* @__PURE__ */ new Map();
|
|
2144
|
+
var kevCache = null;
|
|
2145
|
+
var KEV_TTL_MS = 6 * 60 * 60 * 1e3;
|
|
2140
2146
|
var SEVERITY_RANK = {
|
|
2141
2147
|
critical: 4,
|
|
2142
2148
|
high: 3,
|
|
@@ -2170,7 +2176,24 @@ function severityOf(v) {
|
|
|
2170
2176
|
}
|
|
2171
2177
|
return "unknown";
|
|
2172
2178
|
}
|
|
2173
|
-
function
|
|
2179
|
+
function fixedVersionsOf(v, packageName) {
|
|
2180
|
+
const affected = Array.isArray(v.affected) ? v.affected : [];
|
|
2181
|
+
const lower = packageName.toLowerCase();
|
|
2182
|
+
const out2 = [];
|
|
2183
|
+
for (const a of affected) {
|
|
2184
|
+
const pkg = a.package;
|
|
2185
|
+
if (pkg?.name && pkg.name.toLowerCase() !== lower) continue;
|
|
2186
|
+
const ranges = Array.isArray(a.ranges) ? a.ranges : [];
|
|
2187
|
+
for (const range of ranges) {
|
|
2188
|
+
const events = Array.isArray(range.events) ? range.events : [];
|
|
2189
|
+
for (const ev of events) {
|
|
2190
|
+
if (typeof ev.fixed === "string" && ev.fixed && !out2.includes(ev.fixed)) out2.push(ev.fixed);
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
return out2;
|
|
2195
|
+
}
|
|
2196
|
+
function toSummary(raw, packageName = "") {
|
|
2174
2197
|
const v = raw ?? {};
|
|
2175
2198
|
const aliases = Array.isArray(v.aliases) ? v.aliases.map(String) : [];
|
|
2176
2199
|
const details = typeof v.details === "string" ? v.details : "";
|
|
@@ -2179,7 +2202,9 @@ function toSummary(raw) {
|
|
|
2179
2202
|
id: String(v.id ?? "unknown"),
|
|
2180
2203
|
cves: aliases.filter((a) => a.startsWith("CVE-")),
|
|
2181
2204
|
summary,
|
|
2182
|
-
severity: severityOf(v)
|
|
2205
|
+
severity: severityOf(v),
|
|
2206
|
+
fixedVersions: fixedVersionsOf(v, packageName),
|
|
2207
|
+
published: typeof v.published === "string" ? v.published : null
|
|
2183
2208
|
};
|
|
2184
2209
|
}
|
|
2185
2210
|
async function enrichVulns(ecosystem, name, version, opts = { offline: false }) {
|
|
@@ -2199,7 +2224,7 @@ async function enrichVulns(ecosystem, name, version, opts = { offline: false })
|
|
|
2199
2224
|
}).finally(() => clearTimeout(timer));
|
|
2200
2225
|
if (!res.ok) return { vulns: [], cveCount: 0, source: "error" };
|
|
2201
2226
|
const data = await res.json();
|
|
2202
|
-
const vulns = (data.vulns ?? []).map(toSummary);
|
|
2227
|
+
const vulns = (data.vulns ?? []).map((raw) => toSummary(raw, name));
|
|
2203
2228
|
const cveCount = new Set(vulns.flatMap((v) => v.cves)).size;
|
|
2204
2229
|
const result = { vulns, cveCount, source: "osv" };
|
|
2205
2230
|
cache.set(k, result);
|
|
@@ -2208,22 +2233,82 @@ async function enrichVulns(ecosystem, name, version, opts = { offline: false })
|
|
|
2208
2233
|
return { vulns: [], cveCount: 0, source: "error" };
|
|
2209
2234
|
}
|
|
2210
2235
|
}
|
|
2236
|
+
async function loadKevCves(opts = { offline: false }) {
|
|
2237
|
+
if (opts.offline) return { cves: /* @__PURE__ */ new Set(), source: "skipped" };
|
|
2238
|
+
if (kevCache && Date.now() - kevCache.at < KEV_TTL_MS) {
|
|
2239
|
+
return { cves: kevCache.cves, source: "cisa" };
|
|
2240
|
+
}
|
|
2241
|
+
try {
|
|
2242
|
+
const controller = new AbortController();
|
|
2243
|
+
const timer = setTimeout(() => controller.abort(), 12e3);
|
|
2244
|
+
const res = await fetch(KEV_URL, { signal: controller.signal }).finally(() => clearTimeout(timer));
|
|
2245
|
+
if (!res.ok) return { cves: /* @__PURE__ */ new Set(), source: "error" };
|
|
2246
|
+
const data = await res.json();
|
|
2247
|
+
const cves = /* @__PURE__ */ new Set();
|
|
2248
|
+
for (const v of data.vulnerabilities ?? []) {
|
|
2249
|
+
if (v.cveID) cves.add(v.cveID.toUpperCase());
|
|
2250
|
+
}
|
|
2251
|
+
kevCache = { at: Date.now(), cves };
|
|
2252
|
+
return { cves, source: "cisa" };
|
|
2253
|
+
} catch {
|
|
2254
|
+
return { cves: /* @__PURE__ */ new Set(), source: "error" };
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2211
2257
|
async function scanWorkspaceVulns(targets, opts = { offline: false }) {
|
|
2212
2258
|
if (opts.offline) {
|
|
2213
|
-
return {
|
|
2259
|
+
return {
|
|
2260
|
+
findings: [],
|
|
2261
|
+
counts: emptyCounts(),
|
|
2262
|
+
packagesChecked: 0,
|
|
2263
|
+
source: "offline",
|
|
2264
|
+
kevSource: "skipped"
|
|
2265
|
+
};
|
|
2214
2266
|
}
|
|
2215
2267
|
if (targets.length === 0) {
|
|
2216
|
-
return {
|
|
2268
|
+
return {
|
|
2269
|
+
findings: [],
|
|
2270
|
+
counts: emptyCounts(),
|
|
2271
|
+
packagesChecked: 0,
|
|
2272
|
+
source: "osv",
|
|
2273
|
+
kevSource: "skipped"
|
|
2274
|
+
};
|
|
2217
2275
|
}
|
|
2218
|
-
const
|
|
2219
|
-
const unique = [];
|
|
2276
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
2220
2277
|
for (const t of targets) {
|
|
2221
2278
|
if (!t.ecosystem || !t.package || !t.version) continue;
|
|
2222
2279
|
const k = key(t.ecosystem, t.package, t.version);
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2280
|
+
const locs = [];
|
|
2281
|
+
if (t.locations?.length) {
|
|
2282
|
+
for (const loc of t.locations) {
|
|
2283
|
+
if (loc?.file) locs.push({ file: loc.file, line: loc.line ?? null });
|
|
2284
|
+
}
|
|
2285
|
+
} else if (t.file) {
|
|
2286
|
+
locs.push({ file: t.file, line: t.line ?? null });
|
|
2287
|
+
}
|
|
2288
|
+
const existing = byKey.get(k);
|
|
2289
|
+
if (!existing) {
|
|
2290
|
+
byKey.set(k, {
|
|
2291
|
+
...t,
|
|
2292
|
+
file: t.file ?? locs[0]?.file ?? null,
|
|
2293
|
+
line: t.line ?? locs[0]?.line ?? null,
|
|
2294
|
+
locations: locs
|
|
2295
|
+
});
|
|
2296
|
+
continue;
|
|
2297
|
+
}
|
|
2298
|
+
for (const loc of locs) {
|
|
2299
|
+
if (!existing.locations.some((x) => x.file === loc.file && x.line === loc.line)) {
|
|
2300
|
+
existing.locations.push(loc);
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
if (t.reachability === "reached") existing.reachability = "reached";
|
|
2304
|
+
else if (t.reachability === "not-observed" && existing.reachability === "unknown") {
|
|
2305
|
+
existing.reachability = "not-observed";
|
|
2306
|
+
}
|
|
2307
|
+
if (!existing.latestStable && t.latestStable) existing.latestStable = t.latestStable;
|
|
2308
|
+
if (!existing.section && t.section) existing.section = t.section;
|
|
2226
2309
|
}
|
|
2310
|
+
const unique = [...byKey.values()];
|
|
2311
|
+
const [kev] = await Promise.all([loadKevCves({ offline: false })]);
|
|
2227
2312
|
const concurrency = Math.max(1, Math.min(opts.concurrency ?? 8, 16));
|
|
2228
2313
|
const findings = [];
|
|
2229
2314
|
let anyOk = false;
|
|
@@ -2237,7 +2322,12 @@ async function scanWorkspaceVulns(targets, opts = { offline: false }) {
|
|
|
2237
2322
|
const r = await enrichVulns(t.ecosystem, t.package, t.version, { offline: false });
|
|
2238
2323
|
if (r.source === "osv" || r.source === "cache") anyOk = true;
|
|
2239
2324
|
else if (r.source === "error") anyError = true;
|
|
2325
|
+
const locations = t.locations.length ? t.locations : t.file ? [{ file: t.file, line: t.line ?? null }] : [];
|
|
2326
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
2240
2327
|
for (const v of r.vulns) {
|
|
2328
|
+
if (seenIds.has(v.id)) continue;
|
|
2329
|
+
seenIds.add(v.id);
|
|
2330
|
+
const kevHit = v.cves.some((c2) => kev.cves.has(c2.toUpperCase()));
|
|
2241
2331
|
findings.push({
|
|
2242
2332
|
package: t.package,
|
|
2243
2333
|
version: t.version,
|
|
@@ -2245,14 +2335,23 @@ async function scanWorkspaceVulns(targets, opts = { offline: false }) {
|
|
|
2245
2335
|
id: v.id,
|
|
2246
2336
|
cves: v.cves,
|
|
2247
2337
|
summary: v.summary,
|
|
2248
|
-
severity: v.severity
|
|
2338
|
+
severity: v.severity,
|
|
2339
|
+
fixedVersions: v.fixedVersions,
|
|
2340
|
+
published: v.published,
|
|
2341
|
+
kev: kevHit,
|
|
2342
|
+
reachability: t.reachability ?? "unknown",
|
|
2343
|
+
file: locations[0]?.file ?? t.file ?? null,
|
|
2344
|
+
line: locations[0]?.line ?? t.line ?? null,
|
|
2345
|
+
locations,
|
|
2346
|
+
section: t.section ?? null,
|
|
2347
|
+
latestStable: t.latestStable ?? null
|
|
2249
2348
|
});
|
|
2250
2349
|
}
|
|
2251
2350
|
}
|
|
2252
2351
|
}
|
|
2253
2352
|
await Promise.all(Array.from({ length: Math.min(concurrency, unique.length) }, () => worker()));
|
|
2254
2353
|
findings.sort(
|
|
2255
|
-
(a, b) => SEVERITY_RANK[b.severity] - SEVERITY_RANK[a.severity] || a.package.localeCompare(b.package) || a.id.localeCompare(b.id)
|
|
2354
|
+
(a, b) => SEVERITY_RANK[b.severity] - SEVERITY_RANK[a.severity] || Number(b.kev) - Number(a.kev) || a.package.localeCompare(b.package) || a.id.localeCompare(b.id)
|
|
2256
2355
|
);
|
|
2257
2356
|
const counts = emptyCounts();
|
|
2258
2357
|
for (const f of findings) counts[f.severity]++;
|
|
@@ -2261,7 +2360,8 @@ async function scanWorkspaceVulns(targets, opts = { offline: false }) {
|
|
|
2261
2360
|
findings,
|
|
2262
2361
|
counts,
|
|
2263
2362
|
packagesChecked: unique.length,
|
|
2264
|
-
source
|
|
2363
|
+
source,
|
|
2364
|
+
kevSource: kev.source
|
|
2265
2365
|
};
|
|
2266
2366
|
}
|
|
2267
2367
|
|
|
@@ -2611,23 +2711,64 @@ var VibgrateLanguageServer = class {
|
|
|
2611
2711
|
* `vibgrate/vulns` — live OSV.dev pass over every resolved dependency in the
|
|
2612
2712
|
* current workspace artifact. Powers the Vulnerabilities panel. Empty
|
|
2613
2713
|
* findings with `source: 'osv'` means checked clean; `offline`/`error` mean
|
|
2614
|
-
* we could not check (absent ≠ zero).
|
|
2714
|
+
* we could not check (absent ≠ zero). Attaches manifest locations, fixed-in
|
|
2715
|
+
* versions, CISA KEV flags, and a best-effort code-map reachability signal.
|
|
2615
2716
|
*/
|
|
2616
2717
|
async onVulns() {
|
|
2617
2718
|
if (this.opts.offline) {
|
|
2618
|
-
return {
|
|
2719
|
+
return {
|
|
2720
|
+
findings: [],
|
|
2721
|
+
counts: { critical: 0, high: 0, moderate: 0, low: 0, unknown: 0 },
|
|
2722
|
+
packagesChecked: 0,
|
|
2723
|
+
source: "offline",
|
|
2724
|
+
kevSource: "skipped"
|
|
2725
|
+
};
|
|
2619
2726
|
}
|
|
2620
2727
|
const a = this.artifact;
|
|
2621
2728
|
if (!a) {
|
|
2622
|
-
return {
|
|
2729
|
+
return {
|
|
2730
|
+
findings: [],
|
|
2731
|
+
counts: { critical: 0, high: 0, moderate: 0, low: 0, unknown: 0 },
|
|
2732
|
+
packagesChecked: 0,
|
|
2733
|
+
source: "pending",
|
|
2734
|
+
kevSource: "skipped"
|
|
2735
|
+
};
|
|
2623
2736
|
}
|
|
2737
|
+
const reachedPkgs = packageReachSet(this.graph);
|
|
2624
2738
|
const targets = [];
|
|
2625
2739
|
for (const proj of a.projects ?? []) {
|
|
2626
2740
|
const ecosystem = osvEcosystem(proj.type);
|
|
2627
2741
|
if (!ecosystem) continue;
|
|
2742
|
+
const relManifest = manifestRelativePath(proj);
|
|
2743
|
+
const absManifest = path37.resolve(this.opts.root, relManifest);
|
|
2744
|
+
let text = null;
|
|
2745
|
+
try {
|
|
2746
|
+
if (fs8.existsSync(absManifest)) text = fs8.readFileSync(absManifest, "utf8");
|
|
2747
|
+
} catch {
|
|
2748
|
+
text = null;
|
|
2749
|
+
}
|
|
2750
|
+
const kind = manifestKind(absManifest);
|
|
2628
2751
|
for (const dep of proj.dependencies ?? []) {
|
|
2629
2752
|
if (!dep.resolvedVersion) continue;
|
|
2630
|
-
|
|
2753
|
+
let line = null;
|
|
2754
|
+
if (text && kind) {
|
|
2755
|
+
const l = findPackageLine(text, dep.package, kind);
|
|
2756
|
+
if (l >= 0) line = l + 1;
|
|
2757
|
+
}
|
|
2758
|
+
let reachability = "unknown";
|
|
2759
|
+
if (reachedPkgs) {
|
|
2760
|
+
reachability = packageReached(reachedPkgs, dep.package) ? "reached" : "not-observed";
|
|
2761
|
+
}
|
|
2762
|
+
targets.push({
|
|
2763
|
+
ecosystem,
|
|
2764
|
+
package: dep.package,
|
|
2765
|
+
version: dep.resolvedVersion,
|
|
2766
|
+
file: relManifest,
|
|
2767
|
+
line,
|
|
2768
|
+
section: dep.section ?? null,
|
|
2769
|
+
latestStable: dep.latestStable ?? null,
|
|
2770
|
+
reachability
|
|
2771
|
+
});
|
|
2631
2772
|
}
|
|
2632
2773
|
}
|
|
2633
2774
|
return scanWorkspaceVulns(targets, { offline: this.opts.offline });
|
|
@@ -2732,6 +2873,63 @@ function buildBreakdown(drift, projects) {
|
|
|
2732
2873
|
});
|
|
2733
2874
|
return items.length > 0 ? items : void 0;
|
|
2734
2875
|
}
|
|
2876
|
+
function manifestRelativePath(proj) {
|
|
2877
|
+
const base = proj.path === "." || proj.path === "" ? "" : proj.path;
|
|
2878
|
+
const join27 = (name) => base ? path37.join(base, name) : name;
|
|
2879
|
+
switch (proj.type) {
|
|
2880
|
+
case "node":
|
|
2881
|
+
case "typescript":
|
|
2882
|
+
return join27("package.json");
|
|
2883
|
+
case "python":
|
|
2884
|
+
return join27("pyproject.toml");
|
|
2885
|
+
case "go":
|
|
2886
|
+
return join27("go.mod");
|
|
2887
|
+
case "rust":
|
|
2888
|
+
return join27("Cargo.toml");
|
|
2889
|
+
case "ruby":
|
|
2890
|
+
return join27("Gemfile");
|
|
2891
|
+
case "php":
|
|
2892
|
+
return join27("composer.json");
|
|
2893
|
+
case "java":
|
|
2894
|
+
case "kotlin":
|
|
2895
|
+
case "scala":
|
|
2896
|
+
case "groovy":
|
|
2897
|
+
return join27("pom.xml");
|
|
2898
|
+
case "dotnet":
|
|
2899
|
+
return join27(proj.name ? `${proj.name}.csproj` : "Directory.Build.props");
|
|
2900
|
+
case "dart":
|
|
2901
|
+
return join27("pubspec.yaml");
|
|
2902
|
+
case "elixir":
|
|
2903
|
+
return join27("mix.exs");
|
|
2904
|
+
default:
|
|
2905
|
+
return join27("package.json");
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
function packageReachSet(graph) {
|
|
2909
|
+
if (!graph?.nodes?.length) return null;
|
|
2910
|
+
const set = /* @__PURE__ */ new Set();
|
|
2911
|
+
for (const n of graph.nodes) {
|
|
2912
|
+
if (n.kind !== "external" && n.kind !== "package" && n.kind !== "module") continue;
|
|
2913
|
+
const names = [n.name, n.qualifiedName].filter(Boolean);
|
|
2914
|
+
for (const raw of names) {
|
|
2915
|
+
const cleaned = raw.replace(/^node_modules\//, "").replace(/\\/g, "/");
|
|
2916
|
+
if (cleaned.startsWith("@")) {
|
|
2917
|
+
const parts = cleaned.split("/");
|
|
2918
|
+
if (parts.length >= 2) set.add(`${parts[0]}/${parts[1]}`.toLowerCase());
|
|
2919
|
+
} else {
|
|
2920
|
+
set.add(cleaned.split("/")[0].toLowerCase());
|
|
2921
|
+
}
|
|
2922
|
+
set.add(cleaned.toLowerCase());
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
return set;
|
|
2926
|
+
}
|
|
2927
|
+
function packageReached(set, pkg) {
|
|
2928
|
+
const p = pkg.toLowerCase();
|
|
2929
|
+
if (set.has(p)) return true;
|
|
2930
|
+
if (!p.startsWith("@") && set.has(p.split("/")[0])) return true;
|
|
2931
|
+
return false;
|
|
2932
|
+
}
|
|
2735
2933
|
function osvEcosystem(type) {
|
|
2736
2934
|
switch (type) {
|
|
2737
2935
|
case "node":
|
|
@@ -3745,10 +3943,15 @@ async function executeModelInstallPlan(plan, options = {}) {
|
|
|
3745
3943
|
return { ok: true, plan, installedDeps, pulledWeights };
|
|
3746
3944
|
}
|
|
3747
3945
|
function defaultOllamaPull(name, quiet) {
|
|
3748
|
-
const
|
|
3946
|
+
const { resolveOllamaBinary: resolveOllamaBinary2 } = (init_resolve_ollama(), __toCommonJS(resolve_ollama_exports));
|
|
3947
|
+
const ollama = resolveOllamaBinary2();
|
|
3948
|
+
if (!ollama) return 127;
|
|
3949
|
+
const res = spawnSync(ollama, ["pull", name], { stdio: quiet ? "ignore" : "inherit" });
|
|
3749
3950
|
return res.status ?? 1;
|
|
3750
3951
|
}
|
|
3952
|
+
init_resolve_ollama();
|
|
3751
3953
|
function defaultHasBinary(name) {
|
|
3954
|
+
if (name === "ollama" || name === "ollama.exe") return hasOllamaBinary();
|
|
3752
3955
|
const res = spawnSync(process.platform === "win32" ? "where" : "which", [name], { stdio: "ignore" });
|
|
3753
3956
|
return res.status === 0;
|
|
3754
3957
|
}
|
|
@@ -5073,6 +5276,7 @@ function applyRecommendedDefaultMode(opts) {
|
|
|
5073
5276
|
reason: `pinned default to ${recommended} from RAM/VRAM + repo fit`
|
|
5074
5277
|
};
|
|
5075
5278
|
}
|
|
5279
|
+
init_resolve_ollama();
|
|
5076
5280
|
function registerModels(program) {
|
|
5077
5281
|
const cmd = program.command("models").description("Code Modes (Spark/Flow/Forge) + local model fleet").option("--raw", "list discovered local models only (skip Code Modes status)").action(function(opts) {
|
|
5078
5282
|
const global = readGlobal(this);
|
|
@@ -5372,17 +5576,35 @@ function registerModels(program) {
|
|
|
5372
5576
|
}
|
|
5373
5577
|
});
|
|
5374
5578
|
applyGlobalOptions(pull);
|
|
5375
|
-
const uninstallCmd = cmd.command("uninstall").description("uninstall a locally-installed model
|
|
5579
|
+
const uninstallCmd = cmd.command("uninstall").description("uninstall a locally-installed model (Ollama, LM Studio, or GGUF)").argument("<name>", "installed model name, e.g. qwen2.5-coder:7b or a .gguf basename").option("--runtime <id>", "runtime: ollama | lm-studio | gguf (default: auto-detect from installed fleet)").option("--dry-run", "print the uninstall plan only \u2014 do not delete").option("--yes", "uninstall without an interactive confirm (required non-interactively)").action(async function(name, opts) {
|
|
5376
5580
|
const global = readGlobal(this);
|
|
5377
|
-
if (opts.runtime !== "ollama") {
|
|
5378
|
-
throw new CliError(`only the ollama runtime supports uninstall today (got --runtime ${opts.runtime}). LM Studio / gguf models are managed in their own apps.`, ExitCode.USAGE_ERROR);
|
|
5379
|
-
}
|
|
5380
5581
|
const dryRun = !!opts.dryRun;
|
|
5381
|
-
const
|
|
5582
|
+
const target = resolveUninstallTarget(name, opts.runtime);
|
|
5583
|
+
if (!target) {
|
|
5584
|
+
const hint = opts.runtime ? `no installed model named "${name}" for runtime ${opts.runtime}` : `no installed model named "${name}"`;
|
|
5585
|
+
throw new CliError(
|
|
5586
|
+
`${hint} \u2014 check the name with \`vg models --raw\`.`,
|
|
5587
|
+
ExitCode.NOT_FOUND
|
|
5588
|
+
);
|
|
5589
|
+
}
|
|
5590
|
+
const plan = target.runtime === "ollama" ? {
|
|
5591
|
+
runtime: "ollama",
|
|
5592
|
+
name: target.name,
|
|
5593
|
+
path: target.path,
|
|
5594
|
+
command: `ollama rm ${target.name}`,
|
|
5595
|
+
willRemove: !dryRun
|
|
5596
|
+
} : {
|
|
5597
|
+
runtime: target.runtime,
|
|
5598
|
+
name: target.name,
|
|
5599
|
+
path: target.path,
|
|
5600
|
+
command: `rm ${target.path}`,
|
|
5601
|
+
willRemove: !dryRun
|
|
5602
|
+
};
|
|
5382
5603
|
if (dryRun) {
|
|
5383
5604
|
if (global.json) json({ ...plan, willRemove: false, note: "dry-run \u2014 re-run without --dry-run to uninstall" });
|
|
5384
5605
|
else {
|
|
5385
5606
|
info(`${c.cyan("vg models uninstall")} \xB7 would run: ${c.bold(plan.command)}`);
|
|
5607
|
+
info(c.dim(` ${target.runtime} \xB7 ${target.name}`));
|
|
5386
5608
|
info(c.dim(" dry-run \u2014 re-run without --dry-run to uninstall (non-interactive: add --yes)"));
|
|
5387
5609
|
}
|
|
5388
5610
|
return;
|
|
@@ -5391,27 +5613,60 @@ function registerModels(program) {
|
|
|
5391
5613
|
if (!opts.yes) {
|
|
5392
5614
|
if (!interactive) {
|
|
5393
5615
|
throw new CliError(
|
|
5394
|
-
`refusing to uninstall "${name}" non-interactively without --yes \u2014 re-run with --yes, or pass --dry-run to preview.`,
|
|
5616
|
+
`refusing to uninstall "${target.name}" non-interactively without --yes \u2014 re-run with --yes, or pass --dry-run to preview.`,
|
|
5395
5617
|
ExitCode.USAGE_ERROR
|
|
5396
5618
|
);
|
|
5397
5619
|
}
|
|
5398
|
-
const ok = await confirmYesNo(`Uninstall local model ${name}?`);
|
|
5620
|
+
const ok = await confirmYesNo(`Uninstall local model ${target.name} (${target.runtime})?`);
|
|
5399
5621
|
if (!ok) {
|
|
5400
5622
|
if (global.json) json({ ...plan, willRemove: false, cancelled: true });
|
|
5401
5623
|
else info(c.dim(" cancelled"));
|
|
5402
5624
|
return;
|
|
5403
5625
|
}
|
|
5404
5626
|
}
|
|
5405
|
-
if (
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5627
|
+
if (target.runtime === "ollama") {
|
|
5628
|
+
const ollama = resolveOllamaBinary();
|
|
5629
|
+
if (!ollama) {
|
|
5630
|
+
throw new CliError(
|
|
5631
|
+
"ollama is not installed or not on PATH \u2014 install it from https://ollama.com, then re-run. (Dock-launched editors often miss Homebrew; open a terminal and try `which ollama`, or add /opt/homebrew/bin to PATH.)",
|
|
5632
|
+
ExitCode.NOT_FOUND
|
|
5633
|
+
);
|
|
5634
|
+
}
|
|
5635
|
+
if (!global.json) info(c.dim(` $ ${plan.command}`));
|
|
5636
|
+
const res = spawnSync(ollama, ["rm", target.name], {
|
|
5637
|
+
encoding: "utf8",
|
|
5638
|
+
stdio: global.json ? ["ignore", "pipe", "pipe"] : "inherit"
|
|
5639
|
+
});
|
|
5640
|
+
if (res.status !== 0) {
|
|
5641
|
+
const tail = [res.stderr, res.stdout].filter(Boolean).join("\n").split(/\r?\n/).map((l) => l.trim()).filter(Boolean).slice(-3).join(" \xB7 ");
|
|
5642
|
+
throw new CliError(
|
|
5643
|
+
`\`ollama rm ${target.name}\` failed (exit ${res.status ?? "signal"})${tail ? `: ${tail}` : ""} \u2014 check the model name with \`vg models --raw\`.`,
|
|
5644
|
+
ExitCode.ERROR
|
|
5645
|
+
);
|
|
5646
|
+
}
|
|
5647
|
+
} else {
|
|
5648
|
+
if (!target.path || !fs8.existsSync(target.path)) {
|
|
5649
|
+
throw new CliError(
|
|
5650
|
+
`model file not found at ${target.path || "(unknown path)"} \u2014 it may already be removed.`,
|
|
5651
|
+
ExitCode.NOT_FOUND
|
|
5652
|
+
);
|
|
5653
|
+
}
|
|
5654
|
+
if (!target.path.endsWith(".gguf")) {
|
|
5655
|
+
throw new CliError(
|
|
5656
|
+
`refusing to delete non-GGUF path for ${target.runtime} model "${target.name}"`,
|
|
5657
|
+
ExitCode.USAGE_ERROR
|
|
5658
|
+
);
|
|
5659
|
+
}
|
|
5660
|
+
if (!global.json) info(c.dim(` $ rm ${target.path}`));
|
|
5661
|
+
try {
|
|
5662
|
+
fs8.unlinkSync(target.path);
|
|
5663
|
+
} catch (e) {
|
|
5664
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
5665
|
+
throw new CliError(`could not delete ${target.path}: ${msg}`, ExitCode.ERROR);
|
|
5666
|
+
}
|
|
5412
5667
|
}
|
|
5413
5668
|
if (global.json) json({ ...plan, removed: true });
|
|
5414
|
-
else info(c.green(` \u2714 uninstalled ${name}`));
|
|
5669
|
+
else info(c.green(` \u2714 uninstalled ${target.name}`));
|
|
5415
5670
|
});
|
|
5416
5671
|
applyGlobalOptions(uninstallCmd);
|
|
5417
5672
|
const hostBench = cmd.command("host-bench").description("Approach B host measurement arms (TTFT / grammar / KV / sampler) + optional release gates").option("--mock", "registry metric shells only (no generate)").option("--simulate", "multi-turn warm-host simulation without a GPU (default)").option("--live", "run against a real binding + GGUF (requires --model-path)").option("--model-path <path>", "GGUF path for --live").option("--turns <n>", "turns per arm for simulate/live (default 2)", "2").option("--arms <ids>", "comma-separated arm ids (default: all)").option("--gate", "evaluate release gates; exit 2 on hard failure").option("--dry-run", "print planned arms only \u2014 do not run").action(async function(opts) {
|
|
@@ -5584,6 +5839,7 @@ function registerModels(program) {
|
|
|
5584
5839
|
applyGlobalOptions(catalog);
|
|
5585
5840
|
}
|
|
5586
5841
|
function hasBinary(bin) {
|
|
5842
|
+
if (bin === "ollama" || bin === "ollama.exe") return hasOllamaBinary();
|
|
5587
5843
|
const probe = spawnSync(process.platform === "win32" ? "where" : "which", [bin], { stdio: "ignore" });
|
|
5588
5844
|
return probe.status === 0;
|
|
5589
5845
|
}
|
|
@@ -5599,10 +5855,12 @@ function repoSignals(root2) {
|
|
|
5599
5855
|
}
|
|
5600
5856
|
function buildFullStatus(root2, models, sys) {
|
|
5601
5857
|
const state = readOrchestratorState();
|
|
5858
|
+
const freeDiskBytes = freeBytesOnVolume(weightStoreDir());
|
|
5602
5859
|
return buildOrchestratorStatus({
|
|
5603
5860
|
system: sys,
|
|
5604
5861
|
repo: repoSignals(root2),
|
|
5605
5862
|
installedNames: models.map((m) => m.name),
|
|
5863
|
+
freeDiskBytes,
|
|
5606
5864
|
pins: state.pins,
|
|
5607
5865
|
defaultMode: state.defaultMode
|
|
5608
5866
|
});
|
|
@@ -5621,7 +5879,8 @@ function printOrchestratorStatus(orch) {
|
|
|
5621
5879
|
const sys = orch.system;
|
|
5622
5880
|
const ram = `RAM ${fmt(sys.freeRamBytes)} free / ${fmt(sys.totalRamBytes)}`;
|
|
5623
5881
|
const vram = typeof sys.vramTotalBytes === "number" ? ` \xB7 VRAM ${fmt(sys.vramFreeBytes ?? 0)} free / ${fmt(sys.vramTotalBytes)}` : "";
|
|
5624
|
-
|
|
5882
|
+
const disk = typeof sys.freeDiskBytes === "number" ? ` \xB7 Disk ${fmt(sys.freeDiskBytes)} free (model cache)` : "";
|
|
5883
|
+
info(c.dim(` ${ram}${vram}${disk}`));
|
|
5625
5884
|
if (orch.memoryBreakdown) {
|
|
5626
5885
|
const b = orch.memoryBreakdown;
|
|
5627
5886
|
info(
|
|
@@ -5662,6 +5921,56 @@ function confirmYesNo(question) {
|
|
|
5662
5921
|
});
|
|
5663
5922
|
});
|
|
5664
5923
|
}
|
|
5924
|
+
function normalizeUninstallRuntime(raw) {
|
|
5925
|
+
if (!raw?.trim()) return void 0;
|
|
5926
|
+
const r = raw.trim().toLowerCase();
|
|
5927
|
+
if (r === "ollama") return "ollama";
|
|
5928
|
+
if (r === "lm-studio" || r === "lmstudio" || r === "lm_studio") return "lm-studio";
|
|
5929
|
+
if (r === "gguf" || r === "llama-cpp" || r === "llamacpp" || r === "vibgrate") return "gguf";
|
|
5930
|
+
throw new CliError(
|
|
5931
|
+
`unknown --runtime ${raw} (use ollama, lm-studio, or gguf)`,
|
|
5932
|
+
ExitCode.USAGE_ERROR
|
|
5933
|
+
);
|
|
5934
|
+
}
|
|
5935
|
+
function resolveUninstallTarget(name, runtimeOpt) {
|
|
5936
|
+
const want = name.trim();
|
|
5937
|
+
if (!want) return null;
|
|
5938
|
+
const wantLc = want.toLowerCase();
|
|
5939
|
+
const runtime = normalizeUninstallRuntime(runtimeOpt);
|
|
5940
|
+
const fleet = discoverModels().filter((m) => runtime ? m.runtime === runtime : true);
|
|
5941
|
+
const exact = fleet.filter((m) => m.name.toLowerCase() === wantLc);
|
|
5942
|
+
if (exact.length === 1) return exact[0];
|
|
5943
|
+
if (exact.length > 1) {
|
|
5944
|
+
const order = ["ollama", "gguf", "lm-studio"];
|
|
5945
|
+
for (const rt of order) {
|
|
5946
|
+
const hit = exact.find((m) => m.runtime === rt);
|
|
5947
|
+
if (hit) return hit;
|
|
5948
|
+
}
|
|
5949
|
+
return exact[0];
|
|
5950
|
+
}
|
|
5951
|
+
const base = path37.basename(wantLc);
|
|
5952
|
+
const soft = fleet.filter((m) => {
|
|
5953
|
+
const n = m.name.toLowerCase();
|
|
5954
|
+
return n === base || n.endsWith("/" + base) || n.endsWith(wantLc) || path37.basename(n) === base;
|
|
5955
|
+
});
|
|
5956
|
+
if (soft.length === 1) return soft[0];
|
|
5957
|
+
if (soft.length > 1) {
|
|
5958
|
+
const baseHits = soft.filter((m) => path37.basename(m.name).toLowerCase() === base);
|
|
5959
|
+
const pool = baseHits.length ? baseHits : soft;
|
|
5960
|
+
const order = ["ollama", "gguf", "lm-studio"];
|
|
5961
|
+
for (const rt of order) {
|
|
5962
|
+
const hit = pool.find((m) => m.runtime === rt);
|
|
5963
|
+
if (hit) return hit;
|
|
5964
|
+
}
|
|
5965
|
+
return pool[0];
|
|
5966
|
+
}
|
|
5967
|
+
if (!runtime || runtime === "ollama") {
|
|
5968
|
+
if (want.includes(":") || !want.includes("/") && !want.endsWith(".gguf")) {
|
|
5969
|
+
return { runtime: "ollama", name: want, path: "" };
|
|
5970
|
+
}
|
|
5971
|
+
}
|
|
5972
|
+
return null;
|
|
5973
|
+
}
|
|
5665
5974
|
function printInstallPlanHuman(label, plan) {
|
|
5666
5975
|
const title = plan.mode ? `${plan.mode} \u2192 ${plan.model}` : plan.model;
|
|
5667
5976
|
info(`${c.cyan(label)} \xB7 ${c.bold(title)}`);
|
|
@@ -5793,9 +6102,9 @@ function registerCode(program) {
|
|
|
5793
6102
|
const customSelection = !!(opts.provider || opts.model || opts.modelPath || config.provider || config.model);
|
|
5794
6103
|
if (!customSelection && (modeFlag || !provider && !model)) {
|
|
5795
6104
|
try {
|
|
5796
|
-
const { parseMode: parseMode2, resolveMode: resolveMode2, readOrchestratorState: readOrchestratorState2, activePin: activePin2 } = await import('./model-orchestrator-
|
|
5797
|
-
const { gatherSystemMemory: gatherSystemMemory2 } = await import('./local-runtime-
|
|
5798
|
-
const { loadGraph: loadGraph2 } = await import('./load-
|
|
6105
|
+
const { parseMode: parseMode2, resolveMode: resolveMode2, readOrchestratorState: readOrchestratorState2, activePin: activePin2 } = await import('./model-orchestrator-LHYPJBFH.js');
|
|
6106
|
+
const { gatherSystemMemory: gatherSystemMemory2 } = await import('./local-runtime-2ED33KK6.js');
|
|
6107
|
+
const { loadGraph: loadGraph2 } = await import('./load-SEFJA3M5.js');
|
|
5799
6108
|
const state = readOrchestratorState2();
|
|
5800
6109
|
const mode = parseMode2(modeFlag) ?? state.defaultMode ?? void 0;
|
|
5801
6110
|
const pin = mode ? activePin2(mode, state) : null;
|
|
@@ -5824,7 +6133,7 @@ function registerCode(program) {
|
|
|
5824
6133
|
ExitCode.ERROR
|
|
5825
6134
|
);
|
|
5826
6135
|
}
|
|
5827
|
-
const { resolveGgufPath } = await import('./resolve-gguf-
|
|
6136
|
+
const { resolveGgufPath } = await import('./resolve-gguf-SDIYGGI6.js');
|
|
5828
6137
|
const primaryRef = resolved.pack.primary.backend === "llama.cpp" ? resolved.pack.primary.weightsRef : resolved.underlying.weightsRef;
|
|
5829
6138
|
const gguf = resolveGgufPath({
|
|
5830
6139
|
modelRef: primaryRef,
|
|
@@ -5879,7 +6188,7 @@ function registerCode(program) {
|
|
|
5879
6188
|
if (!(process.stdin.isTTY && process.stdout.isTTY)) {
|
|
5880
6189
|
throw usageError('say what to change, e.g. `vg code "add a --timeout flag to the scan command"` (guided mode needs an interactive terminal)');
|
|
5881
6190
|
}
|
|
5882
|
-
const { runInteractive } = await import('./interactive-
|
|
6191
|
+
const { runInteractive } = await import('./interactive-32LSIBRG.js');
|
|
5883
6192
|
await runInteractive(
|
|
5884
6193
|
rootOf(global),
|
|
5885
6194
|
global,
|
|
@@ -5931,7 +6240,7 @@ function registerCode(program) {
|
|
|
5931
6240
|
{}
|
|
5932
6241
|
);
|
|
5933
6242
|
if (!opts.mock && route.providers[0]) {
|
|
5934
|
-
const { ensureManagerRuntime } = await import('./model-manager-
|
|
6243
|
+
const { ensureManagerRuntime } = await import('./model-manager-GJ2YSTSK.js');
|
|
5935
6244
|
const ensure = await ensureManagerRuntime({
|
|
5936
6245
|
providerId: route.providers[0].id,
|
|
5937
6246
|
model: route.providers[0].model,
|
|
@@ -5951,102 +6260,145 @@ function registerCode(program) {
|
|
|
5951
6260
|
for (const s of ensure.pulled) info(c.dim(` pulled ${s}`));
|
|
5952
6261
|
}
|
|
5953
6262
|
}
|
|
5954
|
-
if (!global.json && !global.quiet) {
|
|
6263
|
+
if (!global.json && !global.quiet && !opts.streamJson) {
|
|
5955
6264
|
info(`${c.cyan("vg code")} \xB7 ${c.dim(route.reason)}`);
|
|
5956
6265
|
info(`${c.cyan("vg code")} \xB7 manager ${c.bold(route.managerLine)}`);
|
|
5957
6266
|
}
|
|
5958
6267
|
if (opts.streamJson && !opts.mock) {
|
|
5959
|
-
const
|
|
5960
|
-
const { runCodeStreamJson } = await import('./stream-json-Z5KC2DM3.js');
|
|
5961
|
-
const { nodeCodeFs } = await import('./session-ZJGENHKX.js');
|
|
5962
|
-
const readline5 = await import('readline');
|
|
5963
|
-
const child = await import('child_process');
|
|
5964
|
-
const { loadOrDiscoverFederation } = await import('./federation-SZWZIFZ7.js');
|
|
5965
|
-
const { resolveExecutionEnv } = await import('./execution-env-ZU45JZ4G.js');
|
|
5966
|
-
const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-TFBKCNJG.js');
|
|
5967
|
-
const { startCodeRuntimeSession } = await import('./runtime-session-EJQZXANB.js');
|
|
5968
|
-
const { resolveGraphBackend } = await import('./graph-backend-UTOL3SHE.js');
|
|
5969
|
-
const { detectGitRef } = await import('./git-ref-XDXB6JP5.js');
|
|
5970
|
-
const { repositoryIdFromRoot } = await import('./paths-2RAH3GME.js');
|
|
5971
|
-
const { vgdRequest: vgdRequest2 } = await import('./vgd-3MHSB4KA.js');
|
|
5972
|
-
const federation = loadOrDiscoverFederation(root2);
|
|
5973
|
-
const modelProfile = mergeModelExecutionProfile(
|
|
5974
|
-
resolveModelExecutionProfile({
|
|
5975
|
-
providerId: primarySlug,
|
|
5976
|
-
model: route.providers[0]?.model,
|
|
5977
|
-
budget: Number(opts.budget) || void 0,
|
|
5978
|
-
securityTier
|
|
5979
|
-
}),
|
|
5980
|
-
config.modelProfile
|
|
5981
|
-
);
|
|
5982
|
-
const tier = securityTier ?? modelProfile.securityTier ?? (auto ? "L1" : "L0");
|
|
5983
|
-
const writableRoots = federation?.members.map((m) => m.root) ?? [root2];
|
|
5984
|
-
const executionEnv = resolveExecutionEnv(tier, { writableRoots });
|
|
5985
|
-
const runtime = await startCodeRuntimeSession({ root: root2 });
|
|
5986
|
-
const git2 = detectGitRef(root2);
|
|
5987
|
-
const repositoryId = repositoryIdFromRoot(root2);
|
|
5988
|
-
if (runtime.socketPath && git2.ref) {
|
|
5989
|
-
try {
|
|
5990
|
-
await vgdRequest2(
|
|
5991
|
-
{ op: "put-graph", repositoryId, gitRef: git2.ref, graph },
|
|
5992
|
-
{ socketPath: runtime.socketPath }
|
|
5993
|
-
);
|
|
5994
|
-
} catch {
|
|
5995
|
-
}
|
|
5996
|
-
}
|
|
5997
|
-
const graphBackend = resolveGraphBackend({
|
|
5998
|
-
graph,
|
|
5999
|
-
repositoryId,
|
|
6000
|
-
gitRef: git2.ref || null,
|
|
6001
|
-
socketPath: runtime.socketPath
|
|
6002
|
-
});
|
|
6003
|
-
const run = (command) => {
|
|
6004
|
-
const res = child.spawnSync(command, { cwd: root2, shell: true, encoding: "utf8", timeout: 12e4, maxBuffer: 10 * 1024 * 1024 });
|
|
6005
|
-
return { stdout: (res.stdout ?? "") + (res.stderr ? `
|
|
6006
|
-
${res.stderr}` : ""), exitCode: res.status ?? 1 };
|
|
6007
|
-
};
|
|
6008
|
-
const emit2 = (line) => {
|
|
6268
|
+
const emitStream = (line) => {
|
|
6009
6269
|
process.stdout.write(JSON.stringify(line) + "\n");
|
|
6010
6270
|
};
|
|
6011
6271
|
try {
|
|
6012
|
-
|
|
6272
|
+
const primarySlug = route.providers[0]?.model.includes("/") ? route.providers[0].model.split("/")[0] : route.providers[0]?.id;
|
|
6273
|
+
const { runCodeStreamJson } = await import('./stream-json-Y45JBNYP.js');
|
|
6274
|
+
const { nodeCodeFs } = await import('./session-2JT4AUZT.js');
|
|
6275
|
+
const readline5 = await import('readline');
|
|
6276
|
+
const child = await import('child_process');
|
|
6277
|
+
const { loadOrDiscoverFederation } = await import('./federation-MDQPO3PW.js');
|
|
6278
|
+
const { resolveExecutionEnv } = await import('./execution-env-4MS5AYAN.js');
|
|
6279
|
+
const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-ELWF3Z6H.js');
|
|
6280
|
+
const { startCodeRuntimeSession } = await import('./runtime-session-4IACVDSY.js');
|
|
6281
|
+
const { resolveGraphBackend } = await import('./graph-backend-GBL33GMW.js');
|
|
6282
|
+
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
6283
|
+
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
6284
|
+
const { vgdRequest: vgdRequest2 } = await import('./vgd-KDQFS33M.js');
|
|
6285
|
+
const federation = loadOrDiscoverFederation(root2);
|
|
6286
|
+
const modelProfile = mergeModelExecutionProfile(
|
|
6287
|
+
resolveModelExecutionProfile({
|
|
6288
|
+
providerId: primarySlug,
|
|
6289
|
+
model: route.providers[0]?.model,
|
|
6290
|
+
budget: Number(opts.budget) || void 0,
|
|
6291
|
+
securityTier
|
|
6292
|
+
}),
|
|
6293
|
+
config.modelProfile
|
|
6294
|
+
);
|
|
6295
|
+
const tier = securityTier ?? modelProfile.securityTier ?? (auto ? "L1" : "L0");
|
|
6296
|
+
const writableRoots = federation?.members.map((m) => m.root) ?? [root2];
|
|
6297
|
+
const executionEnv = resolveExecutionEnv(tier, { writableRoots });
|
|
6298
|
+
const runtime = await startCodeRuntimeSession({ root: root2 });
|
|
6299
|
+
const git2 = detectGitRef(root2);
|
|
6300
|
+
const repositoryId = repositoryIdFromRoot(root2);
|
|
6301
|
+
if (runtime.socketPath && git2.ref) {
|
|
6302
|
+
try {
|
|
6303
|
+
await vgdRequest2(
|
|
6304
|
+
{ op: "put-graph", repositoryId, gitRef: git2.ref, graph },
|
|
6305
|
+
{ socketPath: runtime.socketPath }
|
|
6306
|
+
);
|
|
6307
|
+
} catch {
|
|
6308
|
+
}
|
|
6309
|
+
}
|
|
6310
|
+
const graphBackend = resolveGraphBackend({
|
|
6013
6311
|
graph,
|
|
6312
|
+
repositoryId,
|
|
6313
|
+
gitRef: git2.ref || null,
|
|
6314
|
+
socketPath: runtime.socketPath
|
|
6315
|
+
});
|
|
6316
|
+
const run = (command) => {
|
|
6317
|
+
const res = child.spawnSync(command, {
|
|
6318
|
+
cwd: root2,
|
|
6319
|
+
shell: true,
|
|
6320
|
+
encoding: "utf8",
|
|
6321
|
+
timeout: 12e4,
|
|
6322
|
+
maxBuffer: 10 * 1024 * 1024
|
|
6323
|
+
});
|
|
6324
|
+
return {
|
|
6325
|
+
stdout: (res.stdout ?? "") + (res.stderr ? `
|
|
6326
|
+
${res.stderr}` : ""),
|
|
6327
|
+
exitCode: res.status ?? 1
|
|
6328
|
+
};
|
|
6329
|
+
};
|
|
6330
|
+
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-E4SJFL7Q.js');
|
|
6331
|
+
const vgBuiltin = createVgBuiltinMcpTools({
|
|
6332
|
+
getGraph: () => graph,
|
|
6014
6333
|
root: root2,
|
|
6015
|
-
|
|
6016
|
-
providers: route.providers,
|
|
6017
|
-
fsImpl: nodeCodeFs(root2),
|
|
6018
|
-
run,
|
|
6019
|
-
executionEnv,
|
|
6020
|
-
graphBackend,
|
|
6021
|
-
modelProfile,
|
|
6022
|
-
auto: !!auto,
|
|
6023
|
-
maxSteps,
|
|
6024
|
-
budget: modelProfile.capsuleBudgetTokens,
|
|
6025
|
-
contextBudget,
|
|
6026
|
-
denyCommands: config.denyCommands,
|
|
6027
|
-
testCommand: config.testCommand,
|
|
6028
|
-
stream: true,
|
|
6029
|
-
verify: verify3 ? { command: verify3.command, maxRounds: modelProfile.maxRepairRounds } : void 0,
|
|
6030
|
-
capsule,
|
|
6031
|
-
files: opts.file.length ? opts.file : void 0,
|
|
6032
|
-
worktreeOverlay: true,
|
|
6033
|
-
advancedMode: !capsule,
|
|
6034
|
-
attribution: { client: "vg-code", provider: primarySlug, model: route.providers[0]?.model },
|
|
6035
|
-
now: () => Date.now(),
|
|
6036
|
-
emit: emit2,
|
|
6037
|
-
bindDecisions: (session) => {
|
|
6038
|
-
const rl = readline5.createInterface({ input: process.stdin });
|
|
6039
|
-
rl.on("line", (raw) => {
|
|
6040
|
-
try {
|
|
6041
|
-
const msg = JSON.parse(raw);
|
|
6042
|
-
if (typeof msg.approveId === "number") session.submitDecision(msg.approveId, !!msg.approve);
|
|
6043
|
-
} catch {
|
|
6044
|
-
}
|
|
6045
|
-
});
|
|
6046
|
-
}
|
|
6334
|
+
local: global.local === true
|
|
6047
6335
|
});
|
|
6048
|
-
|
|
6049
|
-
|
|
6336
|
+
let disposeMcpStream;
|
|
6337
|
+
let projectMcp;
|
|
6338
|
+
let streamApprove = async () => !!auto;
|
|
6339
|
+
if (Object.keys(mcp.servers).length) {
|
|
6340
|
+
const { McpToolset, defaultMcpConnect } = await import('./mcp-tools-KAJS34TN.js');
|
|
6341
|
+
const { toolset } = await McpToolset.connect(mcp.servers, defaultMcpConnect);
|
|
6342
|
+
disposeMcpStream = () => toolset.dispose();
|
|
6343
|
+
projectMcp = {
|
|
6344
|
+
specs: toolset.specs(),
|
|
6345
|
+
owns: (n) => toolset.owns(n),
|
|
6346
|
+
execute: (call) => toolset.execute(call, (action) => streamApprove(action))
|
|
6347
|
+
};
|
|
6348
|
+
}
|
|
6349
|
+
const externalTools = mergeExternalToolsets(vgBuiltin, projectMcp);
|
|
6350
|
+
try {
|
|
6351
|
+
await runCodeStreamJson({
|
|
6352
|
+
graph,
|
|
6353
|
+
root: root2,
|
|
6354
|
+
instruction,
|
|
6355
|
+
providers: route.providers,
|
|
6356
|
+
fsImpl: nodeCodeFs(root2),
|
|
6357
|
+
run,
|
|
6358
|
+
executionEnv,
|
|
6359
|
+
graphBackend,
|
|
6360
|
+
modelProfile,
|
|
6361
|
+
auto: !!auto,
|
|
6362
|
+
maxSteps,
|
|
6363
|
+
budget: modelProfile.capsuleBudgetTokens,
|
|
6364
|
+
contextBudget,
|
|
6365
|
+
denyCommands: config.denyCommands,
|
|
6366
|
+
testCommand: config.testCommand,
|
|
6367
|
+
stream: true,
|
|
6368
|
+
verify: verify3 ? { command: verify3.command, maxRounds: modelProfile.maxRepairRounds } : void 0,
|
|
6369
|
+
capsule,
|
|
6370
|
+
files: opts.file.length ? opts.file : void 0,
|
|
6371
|
+
worktreeOverlay: true,
|
|
6372
|
+
advancedMode: !capsule,
|
|
6373
|
+
externalTools,
|
|
6374
|
+
attribution: {
|
|
6375
|
+
client: "vg-code",
|
|
6376
|
+
provider: primarySlug,
|
|
6377
|
+
model: route.providers[0]?.model
|
|
6378
|
+
},
|
|
6379
|
+
now: () => Date.now(),
|
|
6380
|
+
emit: emitStream,
|
|
6381
|
+
bindDecisions: (session) => {
|
|
6382
|
+
streamApprove = (action) => session.approve(action);
|
|
6383
|
+
const rl = readline5.createInterface({ input: process.stdin });
|
|
6384
|
+
rl.on("line", (raw) => {
|
|
6385
|
+
try {
|
|
6386
|
+
const msg = JSON.parse(raw);
|
|
6387
|
+
if (typeof msg.approveId === "number") session.submitDecision(msg.approveId, !!msg.approve);
|
|
6388
|
+
if (typeof msg.answerId === "number") session.submitAnswer(msg.answerId, String(msg.answer ?? ""));
|
|
6389
|
+
} catch {
|
|
6390
|
+
}
|
|
6391
|
+
});
|
|
6392
|
+
}
|
|
6393
|
+
});
|
|
6394
|
+
} finally {
|
|
6395
|
+
await disposeMcpStream?.();
|
|
6396
|
+
await runtime.dispose();
|
|
6397
|
+
}
|
|
6398
|
+
} catch (e) {
|
|
6399
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
6400
|
+
emitStream({ event: "error", message });
|
|
6401
|
+
process.exitCode = e instanceof CliError ? e.code : ExitCode.ERROR;
|
|
6050
6402
|
}
|
|
6051
6403
|
return;
|
|
6052
6404
|
}
|
|
@@ -6057,34 +6409,45 @@ ${res.stderr}` : ""), exitCode: res.status ?? 1 };
|
|
|
6057
6409
|
if (!autonomous && !tty) {
|
|
6058
6410
|
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).");
|
|
6059
6411
|
}
|
|
6060
|
-
const { agentTask } = await import('./interactive-
|
|
6061
|
-
const { nodeCodeFs } = await import('./session-
|
|
6062
|
-
const { TtyPrompter } = await import('./ui-
|
|
6412
|
+
const { agentTask } = await import('./interactive-32LSIBRG.js');
|
|
6413
|
+
const { nodeCodeFs } = await import('./session-2JT4AUZT.js');
|
|
6414
|
+
const { TtyPrompter } = await import('./ui-K7D3BCHD.js');
|
|
6063
6415
|
let priorSummary;
|
|
6064
6416
|
if (opts.continue) {
|
|
6065
|
-
const { loadLatestSession, summarizeSession } = await import('./session-store-
|
|
6417
|
+
const { loadLatestSession, summarizeSession } = await import('./session-store-O4XPXKOV.js');
|
|
6066
6418
|
const prev = loadLatestSession(root2);
|
|
6067
6419
|
if (prev) priorSummary = summarizeSession(prev);
|
|
6068
6420
|
}
|
|
6069
6421
|
const prompter = tty ? new TtyPrompter() : void 0;
|
|
6070
|
-
|
|
6422
|
+
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-E4SJFL7Q.js');
|
|
6423
|
+
const vgBuiltin = createVgBuiltinMcpTools({
|
|
6424
|
+
getGraph: () => graph,
|
|
6425
|
+
root: root2,
|
|
6426
|
+
local: global.local === true
|
|
6427
|
+
});
|
|
6428
|
+
let projectMcp;
|
|
6071
6429
|
let disposeMcp;
|
|
6072
6430
|
if (Object.keys(mcp.servers).length) {
|
|
6073
|
-
const { McpToolset, defaultMcpConnect } = await import('./mcp-tools-
|
|
6431
|
+
const { McpToolset, defaultMcpConnect } = await import('./mcp-tools-KAJS34TN.js');
|
|
6074
6432
|
const { toolset } = await McpToolset.connect(mcp.servers, defaultMcpConnect);
|
|
6075
6433
|
disposeMcp = () => toolset.dispose();
|
|
6076
6434
|
const approve = async (a) => autonomous || !!(prompter && a.kind === "tool" && await prompter.confirm("Call an external tool?", false));
|
|
6077
|
-
|
|
6435
|
+
projectMcp = {
|
|
6436
|
+
specs: toolset.specs(),
|
|
6437
|
+
owns: (n) => toolset.owns(n),
|
|
6438
|
+
execute: (call) => toolset.execute(call, approve)
|
|
6439
|
+
};
|
|
6078
6440
|
}
|
|
6441
|
+
const mcpTools = mergeExternalToolsets(vgBuiltin, projectMcp);
|
|
6079
6442
|
try {
|
|
6080
|
-
const { loadFederation } = await import('./federation-
|
|
6081
|
-
const { resolveExecutionEnv } = await import('./execution-env-
|
|
6082
|
-
const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-
|
|
6083
|
-
const { startCodeRuntimeSession } = await import('./runtime-session-
|
|
6084
|
-
const { resolveGraphBackend } = await import('./graph-backend-
|
|
6085
|
-
const { detectGitRef } = await import('./git-ref-
|
|
6086
|
-
const { repositoryIdFromRoot } = await import('./paths-
|
|
6087
|
-
const { vgdRequest: vgdRequest2 } = await import('./vgd-
|
|
6443
|
+
const { loadFederation } = await import('./federation-MDQPO3PW.js');
|
|
6444
|
+
const { resolveExecutionEnv } = await import('./execution-env-4MS5AYAN.js');
|
|
6445
|
+
const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-ELWF3Z6H.js');
|
|
6446
|
+
const { startCodeRuntimeSession } = await import('./runtime-session-4IACVDSY.js');
|
|
6447
|
+
const { resolveGraphBackend } = await import('./graph-backend-GBL33GMW.js');
|
|
6448
|
+
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
6449
|
+
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
6450
|
+
const { vgdRequest: vgdRequest2 } = await import('./vgd-KDQFS33M.js');
|
|
6088
6451
|
const federation = loadFederation(root2);
|
|
6089
6452
|
const modelProfile = mergeModelExecutionProfile(
|
|
6090
6453
|
resolveModelExecutionProfile({
|
|
@@ -6890,7 +7253,7 @@ function registerDaemon(program) {
|
|
|
6890
7253
|
if (!await vgdIsRunning({ socketPath })) {
|
|
6891
7254
|
throw new CliError(`vgd is not running \u2014 start it with \`vg daemon start\` (${socketPath})`, ExitCode.NOT_FOUND);
|
|
6892
7255
|
}
|
|
6893
|
-
const { loadFederation } = await import('./federation-
|
|
7256
|
+
const { loadFederation } = await import('./federation-MDQPO3PW.js');
|
|
6894
7257
|
const fed = loadFederation(primary);
|
|
6895
7258
|
if (!fed) throw new CliError(`could not load federation for ${primary}`, ExitCode.ERROR);
|
|
6896
7259
|
const res = await vgdRequest(
|
|
@@ -6918,9 +7281,9 @@ function registerDaemon(program) {
|
|
|
6918
7281
|
if (!await vgdIsRunning({ socketPath })) {
|
|
6919
7282
|
throw new CliError(`vgd is not running \u2014 start it with \`vg daemon ensure\` (${socketPath})`, ExitCode.NOT_FOUND);
|
|
6920
7283
|
}
|
|
6921
|
-
const { loadGraph: loadGraph2 } = await import('./load-
|
|
6922
|
-
const { detectGitRef } = await import('./git-ref-
|
|
6923
|
-
const { repositoryIdFromRoot } = await import('./paths-
|
|
7284
|
+
const { loadGraph: loadGraph2 } = await import('./load-SEFJA3M5.js');
|
|
7285
|
+
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
7286
|
+
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
6924
7287
|
const opts = this.opts();
|
|
6925
7288
|
const graph = loadGraph2(root2, global.graph);
|
|
6926
7289
|
if (!graph) {
|
|
@@ -7058,7 +7421,7 @@ function sleep(ms) {
|
|
|
7058
7421
|
return new Promise((r) => setTimeout(r, ms));
|
|
7059
7422
|
}
|
|
7060
7423
|
async function repositoryIdForCwd(socketPath, root2) {
|
|
7061
|
-
const { repositoryIdFromRoot } = await import('./paths-
|
|
7424
|
+
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
7062
7425
|
const reg = await vgdRequest({ op: "register", root: root2 }, { socketPath });
|
|
7063
7426
|
if (reg.ok && "workspace" in reg) return reg.workspace.id;
|
|
7064
7427
|
return repositoryIdFromRoot(root2);
|
|
@@ -7267,7 +7630,7 @@ var initCommand = new Command("init").description("Initialize vibgrate in a proj
|
|
|
7267
7630
|
console.log(chalk7.green("\u2714") + ` Created ${chalk7.bold("vibgrate.config.ts")}`);
|
|
7268
7631
|
}
|
|
7269
7632
|
if (opts.baseline) {
|
|
7270
|
-
const { runBaseline } = await import('./baseline-
|
|
7633
|
+
const { runBaseline } = await import('./baseline-QD4HVNVJ.js');
|
|
7271
7634
|
await runBaseline(rootDir);
|
|
7272
7635
|
}
|
|
7273
7636
|
console.log("");
|
|
@@ -7552,6 +7915,7 @@ function emitDriftScoreLine(score) {
|
|
|
7552
7915
|
if (process.env.VIBGRATE_EMIT_MARKERS !== "1") return;
|
|
7553
7916
|
console.log(`VIBGRATE_DRIFT_SCORE=${score}`);
|
|
7554
7917
|
}
|
|
7918
|
+
init_cli_invocation();
|
|
7555
7919
|
var AI_ASSISTANT_DETECTORS = [
|
|
7556
7920
|
{ files: ["CLAUDE.md", ".claude"], name: "claude" },
|
|
7557
7921
|
{ files: [".cursor", ".cursorrules"], name: "cursor" },
|
|
@@ -7592,6 +7956,7 @@ function printAiContextPrompt(detectedAssistant) {
|
|
|
7592
7956
|
}
|
|
7593
7957
|
|
|
7594
7958
|
// src/reporting/commands/scan.ts
|
|
7959
|
+
init_cli_invocation();
|
|
7595
7960
|
function shouldBuildCodeMap(opts) {
|
|
7596
7961
|
return opts.graph !== false && !opts.maxPrivacy && !opts.noLocalArtifacts;
|
|
7597
7962
|
}
|
|
@@ -8064,6 +8429,9 @@ function scanStaleness(rootDir, artifactPath) {
|
|
|
8064
8429
|
walk2(rootDir, 0);
|
|
8065
8430
|
return newest > ref ? { stale: true, newestChanged } : { stale: false };
|
|
8066
8431
|
}
|
|
8432
|
+
|
|
8433
|
+
// src/reporting/commands/fix.ts
|
|
8434
|
+
init_cli_invocation();
|
|
8067
8435
|
var MAX_CONTRACTS = 40;
|
|
8068
8436
|
function escapeRegExp(s) {
|
|
8069
8437
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -9870,6 +10238,7 @@ var reportCommand = new Command("report").description("Generate a drift report f
|
|
|
9870
10238
|
break;
|
|
9871
10239
|
}
|
|
9872
10240
|
});
|
|
10241
|
+
init_cli_invocation();
|
|
9873
10242
|
function openUrl(url) {
|
|
9874
10243
|
const platform = process.platform;
|
|
9875
10244
|
let command;
|
|
@@ -10907,7 +11276,7 @@ async function resolveAdvisory(id, opts) {
|
|
|
10907
11276
|
}
|
|
10908
11277
|
|
|
10909
11278
|
// src/reporting/commands/evidence/feeds.ts
|
|
10910
|
-
var
|
|
11279
|
+
var KEV_URL2 = "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json";
|
|
10911
11280
|
var OSV_BATCH_URL = "https://api.osv.dev/v1/querybatch";
|
|
10912
11281
|
var OSV_VULN_URL = "https://api.osv.dev/v1/vulns/";
|
|
10913
11282
|
async function getJson(url, init) {
|
|
@@ -10922,7 +11291,7 @@ async function getJson(url, init) {
|
|
|
10922
11291
|
return res.json();
|
|
10923
11292
|
}
|
|
10924
11293
|
async function fetchKevCatalog() {
|
|
10925
|
-
const data = await getJson(
|
|
11294
|
+
const data = await getJson(KEV_URL2);
|
|
10926
11295
|
const map = /* @__PURE__ */ new Map();
|
|
10927
11296
|
for (const v of data.vulnerabilities ?? []) {
|
|
10928
11297
|
if (v.cveID) map.set(v.cveID.toUpperCase(), v);
|
|
@@ -11393,7 +11762,7 @@ async function hasRecentDrill(root2, asOf) {
|
|
|
11393
11762
|
const dir = path37.join(evidenceDir(root2), "drills");
|
|
11394
11763
|
if (!await pathExists(dir)) return void 0;
|
|
11395
11764
|
const { readdir } = await import('fs/promises');
|
|
11396
|
-
const { readJsonFile: readJsonFile2 } = await import('./fs-
|
|
11765
|
+
const { readJsonFile: readJsonFile2 } = await import('./fs-4G5A65KS.js');
|
|
11397
11766
|
const files = (await readdir(dir)).filter((f) => f.endsWith(".json"));
|
|
11398
11767
|
if (files.length === 0) return void 0;
|
|
11399
11768
|
const cutoff = new Date(new Date(asOf).getTime() - 90 * 24 * 3600 * 1e3).toISOString();
|
|
@@ -12070,12 +12439,22 @@ function handleError(err) {
|
|
|
12070
12439
|
if (err.code === "commander.version") process.exit(ExitCode.OK);
|
|
12071
12440
|
process.exit(ExitCode.USAGE_ERROR);
|
|
12072
12441
|
}
|
|
12442
|
+
const streamJsonHost = process.argv.includes("--stream-json") || process.env.VG_CODE_STREAM_JSON === "1";
|
|
12443
|
+
const emitHostError = (message2) => {
|
|
12444
|
+
if (!streamJsonHost) return;
|
|
12445
|
+
try {
|
|
12446
|
+
process.stdout.write(JSON.stringify({ event: "error", message: message2 }) + "\n");
|
|
12447
|
+
} catch {
|
|
12448
|
+
}
|
|
12449
|
+
};
|
|
12073
12450
|
if (err instanceof CliError) {
|
|
12451
|
+
emitHostError(err.message);
|
|
12074
12452
|
info(c.red(`error: ${err.message}`));
|
|
12075
12453
|
process.exit(err.code);
|
|
12076
12454
|
}
|
|
12077
12455
|
const message = err instanceof Error ? err.message : String(err);
|
|
12078
12456
|
const correlation = Math.random().toString(36).slice(2, 10);
|
|
12457
|
+
emitHostError(message);
|
|
12079
12458
|
info(c.red(`error: ${message}`));
|
|
12080
12459
|
info(c.dim(` (ref ${correlation}) \u2014 re-run with --json for detail, or report at https://vibgrate.com/help`));
|
|
12081
12460
|
process.exit(ExitCode.ERROR);
|