@vibgrate/cli 2026.728.2 → 2026.728.3
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-PPZJBYAJ.js +8 -0
- package/dist/{baseline-MRUM2P6H.js.map → baseline-PPZJBYAJ.js.map} +1 -1
- package/dist/{chunk-ZFTFCM7B.js → chunk-3BIRGSRS.js} +3 -3
- package/dist/{chunk-ZFTFCM7B.js.map → chunk-3BIRGSRS.js.map} +1 -1
- package/dist/{chunk-GQTWDKMJ.js → chunk-57QU36P6.js} +4 -4
- package/dist/{chunk-GQTWDKMJ.js.map → chunk-57QU36P6.js.map} +1 -1
- package/dist/{chunk-IWP7MYIA.js → chunk-6GRLZ4Z2.js} +7 -7
- package/dist/{chunk-IWP7MYIA.js.map → chunk-6GRLZ4Z2.js.map} +1 -1
- 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-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-UIOBFLE6.js → chunk-SZSNPXSW.js} +3 -3
- package/dist/{chunk-UIOBFLE6.js.map → chunk-SZSNPXSW.js.map} +1 -1
- package/dist/{chunk-WY6DGTBP.js → chunk-VI4ITXHQ.js} +4 -4
- package/dist/{chunk-WY6DGTBP.js.map → chunk-VI4ITXHQ.js.map} +1 -1
- package/dist/{chunk-NTW5UEKT.js → chunk-VYGEOOLY.js} +3 -3
- package/dist/{chunk-NTW5UEKT.js.map → chunk-VYGEOOLY.js.map} +1 -1
- package/dist/cli.js +426 -134
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/{interactive-36ZZ64WL.js → interactive-OCWQ326U.js} +10 -10
- package/dist/{interactive-36ZZ64WL.js.map → interactive-OCWQ326U.js.map} +1 -1
- package/dist/{model-manager-OEPY4I7W.js → model-manager-LB54VSV7.js} +4 -4
- package/dist/{model-manager-OEPY4I7W.js.map → model-manager-LB54VSV7.js.map} +1 -1
- package/dist/{model-orchestrator-4VSYP4J4.js → model-orchestrator-4M5FG6MN.js} +3 -3
- package/dist/{model-orchestrator-4VSYP4J4.js.map → model-orchestrator-4M5FG6MN.js.map} +1 -1
- package/dist/resolve-gguf-4AFRN4CP.js +9 -0
- package/dist/{resolve-gguf-Y6FH3CNB.js.map → resolve-gguf-4AFRN4CP.js.map} +1 -1
- package/package.json +1 -1
- package/dist/baseline-MRUM2P6H.js +0 -8
- package/dist/chunk-GYSOQH5C.js.map +0 -1
- package/dist/chunk-PVZBYZZR.js.map +0 -1
- package/dist/resolve-gguf-Y6FH3CNB.js +0 -9
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
2
|
+
import { sha256Hex, generateKeypair, dssePae, DSSE_PAYLOAD_TYPE, keyId, registerBuild, readGlobal, applyGlobalOptions, ProgressBar, printLogo, fetchCatalog, resolveProviders, runBuild } from './chunk-6GRLZ4Z2.js';
|
|
3
|
+
export { runBuild } from './chunk-6GRLZ4Z2.js';
|
|
4
4
|
import { CONTEXT_POLICY_VERSION, computeFcsReport, renderFcsReportMarkdown, createTrajectoryCollector, runAgent } from './chunk-A2IYFNCQ.js';
|
|
5
|
-
import { loadAdvancedScanHook, baselineCommand } from './chunk-
|
|
5
|
+
import { loadAdvancedScanHook, baselineCommand } from './chunk-VYGEOOLY.js';
|
|
6
6
|
import { runCodeSession } from './chunk-WH2N22S3.js';
|
|
7
7
|
import { summarizeDiffs, ScriptedProvider } from './chunk-YF43FOPP.js';
|
|
8
8
|
import { disableColor, info, c, json, out } from './chunk-CT5BS56U.js';
|
|
@@ -10,7 +10,7 @@ import { VGD_PROTOCOL_VERSION, startVgdServer } from './chunk-JRAGO6OB.js';
|
|
|
10
10
|
import './chunk-5I4VSBWQ.js';
|
|
11
11
|
import './chunk-IS7VTH2Q.js';
|
|
12
12
|
import { gatherSystemMemory } from './chunk-6UQMXIAG.js';
|
|
13
|
-
import { readOrchestratorState, writeOrchestratorState, parseMode, setDefaultMode, recommendMode, activePin, resolveMode, providerForBackend, QUALIFIED_PACKS, pinPack, unpinPack, buildOrchestratorStatus } from './chunk-
|
|
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
16
|
import './chunk-HK3AWUXH.js';
|
|
@@ -18,20 +18,20 @@ 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-
|
|
21
|
+
import './chunk-7AVYKZEM.js';
|
|
22
|
+
import { buildModelInstallPlan } from './chunk-SZSNPXSW.js';
|
|
23
23
|
import { ensurePackage, ensureUnavailableMessage } from './chunk-OSD546W7.js';
|
|
24
|
-
import { serveStdio, exportGraph, GraphSource, createServer, formatForExt } from './chunk-
|
|
25
|
-
import { resolveDsn, resolveIngestHost, dashHostForIngestHost, availableRegionIds, createWorkspaceDsn, writeStoredCredentials, credentialsPath, findGitRoot, ensureGitignored, gitignoreEntryForCredentials, clearStoredCredentials, CliError, ExitCode, parseDsn as parseDsn$1, uploadScanArtifact, ingestHostForRegionId, dsnCommand, pushCommand, refreshIfStale, driftCount, countTokens, shortestPath, pathDisconnect, testsToRun, detectRunner, ASSISTANTS, detectAssistants, usageError, detectServeLaunch, installAssistant, writeNavigationConfig, uninstallAssistant, coveringTests, FREE_PACK, readScanArtifact, buildGraph, writeSnapshot, probeFreshness, discover, assistantById, SMALL_REPO_FILES, publishPrivateLibrary, assessDocQuality, symbolsFromApi, fetchHostedDocsCached, selectForBudget, hostedBase, readStoredCredentials, projectCredentialsPath, homeCredentialsPath, SKIP_DIRS, SKIP_FILES } from './chunk-
|
|
24
|
+
import { serveStdio, exportGraph, GraphSource, createServer, formatForExt } from './chunk-VI4ITXHQ.js';
|
|
25
|
+
import { resolveDsn, resolveIngestHost, dashHostForIngestHost, availableRegionIds, createWorkspaceDsn, writeStoredCredentials, credentialsPath, findGitRoot, ensureGitignored, gitignoreEntryForCredentials, clearStoredCredentials, CliError, ExitCode, parseDsn as parseDsn$1, uploadScanArtifact, ingestHostForRegionId, dsnCommand, pushCommand, refreshIfStale, driftCount, countTokens, shortestPath, pathDisconnect, testsToRun, detectRunner, ASSISTANTS, detectAssistants, usageError, detectServeLaunch, installAssistant, writeNavigationConfig, uninstallAssistant, coveringTests, FREE_PACK, readScanArtifact, buildGraph, writeSnapshot, probeFreshness, discover, assistantById, SMALL_REPO_FILES, publishPrivateLibrary, assessDocQuality, symbolsFromApi, fetchHostedDocsCached, selectForBudget, hostedBase, readStoredCredentials, projectCredentialsPath, homeCredentialsPath, SKIP_DIRS, SKIP_FILES } from './chunk-57QU36P6.js';
|
|
26
26
|
import { inventory, enrichOnline, ECOSYSTEMS, catalogPath, libDir, loadCatalog, driftFor, addLibrary, resolveLib, libId, resolveVersion, readDoc, localPackageDocs, localApiSurface } from './chunk-6AXHLQBV.js';
|
|
27
|
-
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-
|
|
27
|
+
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-3BIRGSRS.js';
|
|
28
28
|
import { recordCliCall, CLI_TOOL_ALIASES, savingsLedgerPath, clearSavings, readSavings, readUsage, readModelSavings, CAPSULE_RANKING_VERSION, SAVINGS_TOOLS, sanitizeClient } from './chunk-ZBTY6VV4.js';
|
|
29
29
|
import { ensureDir, pathExists, readJsonFile, writeTextFile, writeJsonFile } from './chunk-CRAMOEBE.js';
|
|
30
30
|
import { resolveOne } from './chunk-J7LKEB2R.js';
|
|
31
31
|
import { embeddingsCached, resolveEmbedModel, loadEmbedder, getNodeEmbeddings, queryGraphSemantic, queryGraph, unavailableMessage, countPending, indexFor, impactOf, modelCacheInfo, clearModelCache } from './chunk-6UK6QPTR.js';
|
|
32
|
-
import { discoverModels } from './chunk-
|
|
32
|
+
import { discoverModels } from './chunk-CQDUBAQY.js';
|
|
33
33
|
import { resolveCliInvocation, NPX_INVOCATION } from './chunk-UZJS7GMK.js';
|
|
34
|
-
import { listCachedWeights, ensureWeightCached, catalogIntegrityReport
|
|
34
|
+
import { freeBytesOnVolume, weightStoreDir, listCachedWeights, ensureWeightCached, catalogIntegrityReport } from './chunk-OV4KGXPD.js';
|
|
35
35
|
import { resolvedGrammarFiles, grammarSetVersion } from './chunk-ON25BX6T.js';
|
|
36
36
|
import './chunk-RXP66R2E.js';
|
|
37
37
|
import { resolveGraphPath, renderReport, loadGraph, writeArtifacts, vibgrateDir, SCHEMA_VERSION } from './chunk-B3YUO3NW.js';
|
|
@@ -2136,7 +2136,10 @@ function runTree(graph, params) {
|
|
|
2136
2136
|
|
|
2137
2137
|
// src/lsp/enrich.ts
|
|
2138
2138
|
var OSV_QUERY_URL = "https://api.osv.dev/v1/query";
|
|
2139
|
+
var KEV_URL = "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json";
|
|
2139
2140
|
var cache = /* @__PURE__ */ new Map();
|
|
2141
|
+
var kevCache = null;
|
|
2142
|
+
var KEV_TTL_MS = 6 * 60 * 60 * 1e3;
|
|
2140
2143
|
var SEVERITY_RANK = {
|
|
2141
2144
|
critical: 4,
|
|
2142
2145
|
high: 3,
|
|
@@ -2170,7 +2173,24 @@ function severityOf(v) {
|
|
|
2170
2173
|
}
|
|
2171
2174
|
return "unknown";
|
|
2172
2175
|
}
|
|
2173
|
-
function
|
|
2176
|
+
function fixedVersionsOf(v, packageName) {
|
|
2177
|
+
const affected = Array.isArray(v.affected) ? v.affected : [];
|
|
2178
|
+
const lower = packageName.toLowerCase();
|
|
2179
|
+
const out2 = [];
|
|
2180
|
+
for (const a of affected) {
|
|
2181
|
+
const pkg = a.package;
|
|
2182
|
+
if (pkg?.name && pkg.name.toLowerCase() !== lower) continue;
|
|
2183
|
+
const ranges = Array.isArray(a.ranges) ? a.ranges : [];
|
|
2184
|
+
for (const range of ranges) {
|
|
2185
|
+
const events = Array.isArray(range.events) ? range.events : [];
|
|
2186
|
+
for (const ev of events) {
|
|
2187
|
+
if (typeof ev.fixed === "string" && ev.fixed && !out2.includes(ev.fixed)) out2.push(ev.fixed);
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
return out2;
|
|
2192
|
+
}
|
|
2193
|
+
function toSummary(raw, packageName = "") {
|
|
2174
2194
|
const v = raw ?? {};
|
|
2175
2195
|
const aliases = Array.isArray(v.aliases) ? v.aliases.map(String) : [];
|
|
2176
2196
|
const details = typeof v.details === "string" ? v.details : "";
|
|
@@ -2179,7 +2199,9 @@ function toSummary(raw) {
|
|
|
2179
2199
|
id: String(v.id ?? "unknown"),
|
|
2180
2200
|
cves: aliases.filter((a) => a.startsWith("CVE-")),
|
|
2181
2201
|
summary,
|
|
2182
|
-
severity: severityOf(v)
|
|
2202
|
+
severity: severityOf(v),
|
|
2203
|
+
fixedVersions: fixedVersionsOf(v, packageName),
|
|
2204
|
+
published: typeof v.published === "string" ? v.published : null
|
|
2183
2205
|
};
|
|
2184
2206
|
}
|
|
2185
2207
|
async function enrichVulns(ecosystem, name, version, opts = { offline: false }) {
|
|
@@ -2199,7 +2221,7 @@ async function enrichVulns(ecosystem, name, version, opts = { offline: false })
|
|
|
2199
2221
|
}).finally(() => clearTimeout(timer));
|
|
2200
2222
|
if (!res.ok) return { vulns: [], cveCount: 0, source: "error" };
|
|
2201
2223
|
const data = await res.json();
|
|
2202
|
-
const vulns = (data.vulns ?? []).map(toSummary);
|
|
2224
|
+
const vulns = (data.vulns ?? []).map((raw) => toSummary(raw, name));
|
|
2203
2225
|
const cveCount = new Set(vulns.flatMap((v) => v.cves)).size;
|
|
2204
2226
|
const result = { vulns, cveCount, source: "osv" };
|
|
2205
2227
|
cache.set(k, result);
|
|
@@ -2208,12 +2230,45 @@ async function enrichVulns(ecosystem, name, version, opts = { offline: false })
|
|
|
2208
2230
|
return { vulns: [], cveCount: 0, source: "error" };
|
|
2209
2231
|
}
|
|
2210
2232
|
}
|
|
2233
|
+
async function loadKevCves(opts = { offline: false }) {
|
|
2234
|
+
if (opts.offline) return { cves: /* @__PURE__ */ new Set(), source: "skipped" };
|
|
2235
|
+
if (kevCache && Date.now() - kevCache.at < KEV_TTL_MS) {
|
|
2236
|
+
return { cves: kevCache.cves, source: "cisa" };
|
|
2237
|
+
}
|
|
2238
|
+
try {
|
|
2239
|
+
const controller = new AbortController();
|
|
2240
|
+
const timer = setTimeout(() => controller.abort(), 12e3);
|
|
2241
|
+
const res = await fetch(KEV_URL, { signal: controller.signal }).finally(() => clearTimeout(timer));
|
|
2242
|
+
if (!res.ok) return { cves: /* @__PURE__ */ new Set(), source: "error" };
|
|
2243
|
+
const data = await res.json();
|
|
2244
|
+
const cves = /* @__PURE__ */ new Set();
|
|
2245
|
+
for (const v of data.vulnerabilities ?? []) {
|
|
2246
|
+
if (v.cveID) cves.add(v.cveID.toUpperCase());
|
|
2247
|
+
}
|
|
2248
|
+
kevCache = { at: Date.now(), cves };
|
|
2249
|
+
return { cves, source: "cisa" };
|
|
2250
|
+
} catch {
|
|
2251
|
+
return { cves: /* @__PURE__ */ new Set(), source: "error" };
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2211
2254
|
async function scanWorkspaceVulns(targets, opts = { offline: false }) {
|
|
2212
2255
|
if (opts.offline) {
|
|
2213
|
-
return {
|
|
2256
|
+
return {
|
|
2257
|
+
findings: [],
|
|
2258
|
+
counts: emptyCounts(),
|
|
2259
|
+
packagesChecked: 0,
|
|
2260
|
+
source: "offline",
|
|
2261
|
+
kevSource: "skipped"
|
|
2262
|
+
};
|
|
2214
2263
|
}
|
|
2215
2264
|
if (targets.length === 0) {
|
|
2216
|
-
return {
|
|
2265
|
+
return {
|
|
2266
|
+
findings: [],
|
|
2267
|
+
counts: emptyCounts(),
|
|
2268
|
+
packagesChecked: 0,
|
|
2269
|
+
source: "osv",
|
|
2270
|
+
kevSource: "skipped"
|
|
2271
|
+
};
|
|
2217
2272
|
}
|
|
2218
2273
|
const seen = /* @__PURE__ */ new Set();
|
|
2219
2274
|
const unique = [];
|
|
@@ -2224,6 +2279,7 @@ async function scanWorkspaceVulns(targets, opts = { offline: false }) {
|
|
|
2224
2279
|
seen.add(k);
|
|
2225
2280
|
unique.push(t);
|
|
2226
2281
|
}
|
|
2282
|
+
const [kev] = await Promise.all([loadKevCves({ offline: false })]);
|
|
2227
2283
|
const concurrency = Math.max(1, Math.min(opts.concurrency ?? 8, 16));
|
|
2228
2284
|
const findings = [];
|
|
2229
2285
|
let anyOk = false;
|
|
@@ -2238,6 +2294,7 @@ async function scanWorkspaceVulns(targets, opts = { offline: false }) {
|
|
|
2238
2294
|
if (r.source === "osv" || r.source === "cache") anyOk = true;
|
|
2239
2295
|
else if (r.source === "error") anyError = true;
|
|
2240
2296
|
for (const v of r.vulns) {
|
|
2297
|
+
const kevHit = v.cves.some((c2) => kev.cves.has(c2.toUpperCase()));
|
|
2241
2298
|
findings.push({
|
|
2242
2299
|
package: t.package,
|
|
2243
2300
|
version: t.version,
|
|
@@ -2245,14 +2302,22 @@ async function scanWorkspaceVulns(targets, opts = { offline: false }) {
|
|
|
2245
2302
|
id: v.id,
|
|
2246
2303
|
cves: v.cves,
|
|
2247
2304
|
summary: v.summary,
|
|
2248
|
-
severity: v.severity
|
|
2305
|
+
severity: v.severity,
|
|
2306
|
+
fixedVersions: v.fixedVersions,
|
|
2307
|
+
published: v.published,
|
|
2308
|
+
kev: kevHit,
|
|
2309
|
+
reachability: t.reachability ?? "unknown",
|
|
2310
|
+
file: t.file ?? null,
|
|
2311
|
+
line: t.line ?? null,
|
|
2312
|
+
section: t.section ?? null,
|
|
2313
|
+
latestStable: t.latestStable ?? null
|
|
2249
2314
|
});
|
|
2250
2315
|
}
|
|
2251
2316
|
}
|
|
2252
2317
|
}
|
|
2253
2318
|
await Promise.all(Array.from({ length: Math.min(concurrency, unique.length) }, () => worker()));
|
|
2254
2319
|
findings.sort(
|
|
2255
|
-
(a, b) => SEVERITY_RANK[b.severity] - SEVERITY_RANK[a.severity] || a.package.localeCompare(b.package) || a.id.localeCompare(b.id)
|
|
2320
|
+
(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
2321
|
);
|
|
2257
2322
|
const counts = emptyCounts();
|
|
2258
2323
|
for (const f of findings) counts[f.severity]++;
|
|
@@ -2261,7 +2326,8 @@ async function scanWorkspaceVulns(targets, opts = { offline: false }) {
|
|
|
2261
2326
|
findings,
|
|
2262
2327
|
counts,
|
|
2263
2328
|
packagesChecked: unique.length,
|
|
2264
|
-
source
|
|
2329
|
+
source,
|
|
2330
|
+
kevSource: kev.source
|
|
2265
2331
|
};
|
|
2266
2332
|
}
|
|
2267
2333
|
|
|
@@ -2611,23 +2677,64 @@ var VibgrateLanguageServer = class {
|
|
|
2611
2677
|
* `vibgrate/vulns` — live OSV.dev pass over every resolved dependency in the
|
|
2612
2678
|
* current workspace artifact. Powers the Vulnerabilities panel. Empty
|
|
2613
2679
|
* findings with `source: 'osv'` means checked clean; `offline`/`error` mean
|
|
2614
|
-
* we could not check (absent ≠ zero).
|
|
2680
|
+
* we could not check (absent ≠ zero). Attaches manifest locations, fixed-in
|
|
2681
|
+
* versions, CISA KEV flags, and a best-effort code-map reachability signal.
|
|
2615
2682
|
*/
|
|
2616
2683
|
async onVulns() {
|
|
2617
2684
|
if (this.opts.offline) {
|
|
2618
|
-
return {
|
|
2685
|
+
return {
|
|
2686
|
+
findings: [],
|
|
2687
|
+
counts: { critical: 0, high: 0, moderate: 0, low: 0, unknown: 0 },
|
|
2688
|
+
packagesChecked: 0,
|
|
2689
|
+
source: "offline",
|
|
2690
|
+
kevSource: "skipped"
|
|
2691
|
+
};
|
|
2619
2692
|
}
|
|
2620
2693
|
const a = this.artifact;
|
|
2621
2694
|
if (!a) {
|
|
2622
|
-
return {
|
|
2695
|
+
return {
|
|
2696
|
+
findings: [],
|
|
2697
|
+
counts: { critical: 0, high: 0, moderate: 0, low: 0, unknown: 0 },
|
|
2698
|
+
packagesChecked: 0,
|
|
2699
|
+
source: "pending",
|
|
2700
|
+
kevSource: "skipped"
|
|
2701
|
+
};
|
|
2623
2702
|
}
|
|
2703
|
+
const reachedPkgs = packageReachSet(this.graph);
|
|
2624
2704
|
const targets = [];
|
|
2625
2705
|
for (const proj of a.projects ?? []) {
|
|
2626
2706
|
const ecosystem = osvEcosystem(proj.type);
|
|
2627
2707
|
if (!ecosystem) continue;
|
|
2708
|
+
const relManifest = manifestRelativePath(proj);
|
|
2709
|
+
const absManifest = path37.resolve(this.opts.root, relManifest);
|
|
2710
|
+
let text = null;
|
|
2711
|
+
try {
|
|
2712
|
+
if (fs8.existsSync(absManifest)) text = fs8.readFileSync(absManifest, "utf8");
|
|
2713
|
+
} catch {
|
|
2714
|
+
text = null;
|
|
2715
|
+
}
|
|
2716
|
+
const kind = manifestKind(absManifest);
|
|
2628
2717
|
for (const dep of proj.dependencies ?? []) {
|
|
2629
2718
|
if (!dep.resolvedVersion) continue;
|
|
2630
|
-
|
|
2719
|
+
let line = null;
|
|
2720
|
+
if (text && kind) {
|
|
2721
|
+
const l = findPackageLine(text, dep.package, kind);
|
|
2722
|
+
if (l >= 0) line = l + 1;
|
|
2723
|
+
}
|
|
2724
|
+
let reachability = "unknown";
|
|
2725
|
+
if (reachedPkgs) {
|
|
2726
|
+
reachability = packageReached(reachedPkgs, dep.package) ? "reached" : "not-observed";
|
|
2727
|
+
}
|
|
2728
|
+
targets.push({
|
|
2729
|
+
ecosystem,
|
|
2730
|
+
package: dep.package,
|
|
2731
|
+
version: dep.resolvedVersion,
|
|
2732
|
+
file: relManifest,
|
|
2733
|
+
line,
|
|
2734
|
+
section: dep.section ?? null,
|
|
2735
|
+
latestStable: dep.latestStable ?? null,
|
|
2736
|
+
reachability
|
|
2737
|
+
});
|
|
2631
2738
|
}
|
|
2632
2739
|
}
|
|
2633
2740
|
return scanWorkspaceVulns(targets, { offline: this.opts.offline });
|
|
@@ -2732,6 +2839,63 @@ function buildBreakdown(drift, projects) {
|
|
|
2732
2839
|
});
|
|
2733
2840
|
return items.length > 0 ? items : void 0;
|
|
2734
2841
|
}
|
|
2842
|
+
function manifestRelativePath(proj) {
|
|
2843
|
+
const base = proj.path === "." || proj.path === "" ? "" : proj.path;
|
|
2844
|
+
const join27 = (name) => base ? path37.join(base, name) : name;
|
|
2845
|
+
switch (proj.type) {
|
|
2846
|
+
case "node":
|
|
2847
|
+
case "typescript":
|
|
2848
|
+
return join27("package.json");
|
|
2849
|
+
case "python":
|
|
2850
|
+
return join27("pyproject.toml");
|
|
2851
|
+
case "go":
|
|
2852
|
+
return join27("go.mod");
|
|
2853
|
+
case "rust":
|
|
2854
|
+
return join27("Cargo.toml");
|
|
2855
|
+
case "ruby":
|
|
2856
|
+
return join27("Gemfile");
|
|
2857
|
+
case "php":
|
|
2858
|
+
return join27("composer.json");
|
|
2859
|
+
case "java":
|
|
2860
|
+
case "kotlin":
|
|
2861
|
+
case "scala":
|
|
2862
|
+
case "groovy":
|
|
2863
|
+
return join27("pom.xml");
|
|
2864
|
+
case "dotnet":
|
|
2865
|
+
return join27(proj.name ? `${proj.name}.csproj` : "Directory.Build.props");
|
|
2866
|
+
case "dart":
|
|
2867
|
+
return join27("pubspec.yaml");
|
|
2868
|
+
case "elixir":
|
|
2869
|
+
return join27("mix.exs");
|
|
2870
|
+
default:
|
|
2871
|
+
return join27("package.json");
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
function packageReachSet(graph) {
|
|
2875
|
+
if (!graph?.nodes?.length) return null;
|
|
2876
|
+
const set = /* @__PURE__ */ new Set();
|
|
2877
|
+
for (const n of graph.nodes) {
|
|
2878
|
+
if (n.kind !== "external" && n.kind !== "package" && n.kind !== "module") continue;
|
|
2879
|
+
const names = [n.name, n.qualifiedName].filter(Boolean);
|
|
2880
|
+
for (const raw of names) {
|
|
2881
|
+
const cleaned = raw.replace(/^node_modules\//, "").replace(/\\/g, "/");
|
|
2882
|
+
if (cleaned.startsWith("@")) {
|
|
2883
|
+
const parts = cleaned.split("/");
|
|
2884
|
+
if (parts.length >= 2) set.add(`${parts[0]}/${parts[1]}`.toLowerCase());
|
|
2885
|
+
} else {
|
|
2886
|
+
set.add(cleaned.split("/")[0].toLowerCase());
|
|
2887
|
+
}
|
|
2888
|
+
set.add(cleaned.toLowerCase());
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
return set;
|
|
2892
|
+
}
|
|
2893
|
+
function packageReached(set, pkg) {
|
|
2894
|
+
const p = pkg.toLowerCase();
|
|
2895
|
+
if (set.has(p)) return true;
|
|
2896
|
+
if (!p.startsWith("@") && set.has(p.split("/")[0])) return true;
|
|
2897
|
+
return false;
|
|
2898
|
+
}
|
|
2735
2899
|
function osvEcosystem(type) {
|
|
2736
2900
|
switch (type) {
|
|
2737
2901
|
case "node":
|
|
@@ -5372,17 +5536,35 @@ function registerModels(program) {
|
|
|
5372
5536
|
}
|
|
5373
5537
|
});
|
|
5374
5538
|
applyGlobalOptions(pull);
|
|
5375
|
-
const uninstallCmd = cmd.command("uninstall").description("uninstall a locally-installed model
|
|
5539
|
+
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
5540
|
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
5541
|
const dryRun = !!opts.dryRun;
|
|
5381
|
-
const
|
|
5542
|
+
const target = resolveUninstallTarget(name, opts.runtime);
|
|
5543
|
+
if (!target) {
|
|
5544
|
+
const hint = opts.runtime ? `no installed model named "${name}" for runtime ${opts.runtime}` : `no installed model named "${name}"`;
|
|
5545
|
+
throw new CliError(
|
|
5546
|
+
`${hint} \u2014 check the name with \`vg models --raw\`.`,
|
|
5547
|
+
ExitCode.NOT_FOUND
|
|
5548
|
+
);
|
|
5549
|
+
}
|
|
5550
|
+
const plan = target.runtime === "ollama" ? {
|
|
5551
|
+
runtime: "ollama",
|
|
5552
|
+
name: target.name,
|
|
5553
|
+
path: target.path,
|
|
5554
|
+
command: `ollama rm ${target.name}`,
|
|
5555
|
+
willRemove: !dryRun
|
|
5556
|
+
} : {
|
|
5557
|
+
runtime: target.runtime,
|
|
5558
|
+
name: target.name,
|
|
5559
|
+
path: target.path,
|
|
5560
|
+
command: `rm ${target.path}`,
|
|
5561
|
+
willRemove: !dryRun
|
|
5562
|
+
};
|
|
5382
5563
|
if (dryRun) {
|
|
5383
5564
|
if (global.json) json({ ...plan, willRemove: false, note: "dry-run \u2014 re-run without --dry-run to uninstall" });
|
|
5384
5565
|
else {
|
|
5385
5566
|
info(`${c.cyan("vg models uninstall")} \xB7 would run: ${c.bold(plan.command)}`);
|
|
5567
|
+
info(c.dim(` ${target.runtime} \xB7 ${target.name}`));
|
|
5386
5568
|
info(c.dim(" dry-run \u2014 re-run without --dry-run to uninstall (non-interactive: add --yes)"));
|
|
5387
5569
|
}
|
|
5388
5570
|
return;
|
|
@@ -5391,27 +5573,55 @@ function registerModels(program) {
|
|
|
5391
5573
|
if (!opts.yes) {
|
|
5392
5574
|
if (!interactive) {
|
|
5393
5575
|
throw new CliError(
|
|
5394
|
-
`refusing to uninstall "${name}" non-interactively without --yes \u2014 re-run with --yes, or pass --dry-run to preview.`,
|
|
5576
|
+
`refusing to uninstall "${target.name}" non-interactively without --yes \u2014 re-run with --yes, or pass --dry-run to preview.`,
|
|
5395
5577
|
ExitCode.USAGE_ERROR
|
|
5396
5578
|
);
|
|
5397
5579
|
}
|
|
5398
|
-
const ok = await confirmYesNo(`Uninstall local model ${name}?`);
|
|
5580
|
+
const ok = await confirmYesNo(`Uninstall local model ${target.name} (${target.runtime})?`);
|
|
5399
5581
|
if (!ok) {
|
|
5400
5582
|
if (global.json) json({ ...plan, willRemove: false, cancelled: true });
|
|
5401
5583
|
else info(c.dim(" cancelled"));
|
|
5402
5584
|
return;
|
|
5403
5585
|
}
|
|
5404
5586
|
}
|
|
5405
|
-
if (
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5587
|
+
if (target.runtime === "ollama") {
|
|
5588
|
+
if (!hasBinary("ollama")) {
|
|
5589
|
+
throw new CliError(
|
|
5590
|
+
"ollama is not installed or not on PATH \u2014 install it from https://ollama.com, then re-run.",
|
|
5591
|
+
ExitCode.NOT_FOUND
|
|
5592
|
+
);
|
|
5593
|
+
}
|
|
5594
|
+
if (!global.json) info(c.dim(` $ ${plan.command}`));
|
|
5595
|
+
const res = spawnSync("ollama", ["rm", target.name], { stdio: global.json ? "ignore" : "inherit" });
|
|
5596
|
+
if (res.status !== 0) {
|
|
5597
|
+
throw new CliError(
|
|
5598
|
+
`\`ollama rm ${target.name}\` failed (exit ${res.status ?? "signal"}) \u2014 check the model name with \`vg models --raw\`.`,
|
|
5599
|
+
ExitCode.ERROR
|
|
5600
|
+
);
|
|
5601
|
+
}
|
|
5602
|
+
} else {
|
|
5603
|
+
if (!target.path || !fs8.existsSync(target.path)) {
|
|
5604
|
+
throw new CliError(
|
|
5605
|
+
`model file not found at ${target.path || "(unknown path)"} \u2014 it may already be removed.`,
|
|
5606
|
+
ExitCode.NOT_FOUND
|
|
5607
|
+
);
|
|
5608
|
+
}
|
|
5609
|
+
if (!target.path.endsWith(".gguf")) {
|
|
5610
|
+
throw new CliError(
|
|
5611
|
+
`refusing to delete non-GGUF path for ${target.runtime} model "${target.name}"`,
|
|
5612
|
+
ExitCode.USAGE_ERROR
|
|
5613
|
+
);
|
|
5614
|
+
}
|
|
5615
|
+
if (!global.json) info(c.dim(` $ rm ${target.path}`));
|
|
5616
|
+
try {
|
|
5617
|
+
fs8.unlinkSync(target.path);
|
|
5618
|
+
} catch (e) {
|
|
5619
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
5620
|
+
throw new CliError(`could not delete ${target.path}: ${msg}`, ExitCode.ERROR);
|
|
5621
|
+
}
|
|
5412
5622
|
}
|
|
5413
5623
|
if (global.json) json({ ...plan, removed: true });
|
|
5414
|
-
else info(c.green(` \u2714 uninstalled ${name}`));
|
|
5624
|
+
else info(c.green(` \u2714 uninstalled ${target.name}`));
|
|
5415
5625
|
});
|
|
5416
5626
|
applyGlobalOptions(uninstallCmd);
|
|
5417
5627
|
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) {
|
|
@@ -5599,10 +5809,12 @@ function repoSignals(root2) {
|
|
|
5599
5809
|
}
|
|
5600
5810
|
function buildFullStatus(root2, models, sys) {
|
|
5601
5811
|
const state = readOrchestratorState();
|
|
5812
|
+
const freeDiskBytes = freeBytesOnVolume(weightStoreDir());
|
|
5602
5813
|
return buildOrchestratorStatus({
|
|
5603
5814
|
system: sys,
|
|
5604
5815
|
repo: repoSignals(root2),
|
|
5605
5816
|
installedNames: models.map((m) => m.name),
|
|
5817
|
+
freeDiskBytes,
|
|
5606
5818
|
pins: state.pins,
|
|
5607
5819
|
defaultMode: state.defaultMode
|
|
5608
5820
|
});
|
|
@@ -5621,7 +5833,8 @@ function printOrchestratorStatus(orch) {
|
|
|
5621
5833
|
const sys = orch.system;
|
|
5622
5834
|
const ram = `RAM ${fmt(sys.freeRamBytes)} free / ${fmt(sys.totalRamBytes)}`;
|
|
5623
5835
|
const vram = typeof sys.vramTotalBytes === "number" ? ` \xB7 VRAM ${fmt(sys.vramFreeBytes ?? 0)} free / ${fmt(sys.vramTotalBytes)}` : "";
|
|
5624
|
-
|
|
5836
|
+
const disk = typeof sys.freeDiskBytes === "number" ? ` \xB7 Disk ${fmt(sys.freeDiskBytes)} free (model cache)` : "";
|
|
5837
|
+
info(c.dim(` ${ram}${vram}${disk}`));
|
|
5625
5838
|
if (orch.memoryBreakdown) {
|
|
5626
5839
|
const b = orch.memoryBreakdown;
|
|
5627
5840
|
info(
|
|
@@ -5662,6 +5875,56 @@ function confirmYesNo(question) {
|
|
|
5662
5875
|
});
|
|
5663
5876
|
});
|
|
5664
5877
|
}
|
|
5878
|
+
function normalizeUninstallRuntime(raw) {
|
|
5879
|
+
if (!raw?.trim()) return void 0;
|
|
5880
|
+
const r = raw.trim().toLowerCase();
|
|
5881
|
+
if (r === "ollama") return "ollama";
|
|
5882
|
+
if (r === "lm-studio" || r === "lmstudio" || r === "lm_studio") return "lm-studio";
|
|
5883
|
+
if (r === "gguf" || r === "llama-cpp" || r === "llamacpp" || r === "vibgrate") return "gguf";
|
|
5884
|
+
throw new CliError(
|
|
5885
|
+
`unknown --runtime ${raw} (use ollama, lm-studio, or gguf)`,
|
|
5886
|
+
ExitCode.USAGE_ERROR
|
|
5887
|
+
);
|
|
5888
|
+
}
|
|
5889
|
+
function resolveUninstallTarget(name, runtimeOpt) {
|
|
5890
|
+
const want = name.trim();
|
|
5891
|
+
if (!want) return null;
|
|
5892
|
+
const wantLc = want.toLowerCase();
|
|
5893
|
+
const runtime = normalizeUninstallRuntime(runtimeOpt);
|
|
5894
|
+
const fleet = discoverModels().filter((m) => runtime ? m.runtime === runtime : true);
|
|
5895
|
+
const exact = fleet.filter((m) => m.name.toLowerCase() === wantLc);
|
|
5896
|
+
if (exact.length === 1) return exact[0];
|
|
5897
|
+
if (exact.length > 1) {
|
|
5898
|
+
const order = ["ollama", "gguf", "lm-studio"];
|
|
5899
|
+
for (const rt of order) {
|
|
5900
|
+
const hit = exact.find((m) => m.runtime === rt);
|
|
5901
|
+
if (hit) return hit;
|
|
5902
|
+
}
|
|
5903
|
+
return exact[0];
|
|
5904
|
+
}
|
|
5905
|
+
const base = path37.basename(wantLc);
|
|
5906
|
+
const soft = fleet.filter((m) => {
|
|
5907
|
+
const n = m.name.toLowerCase();
|
|
5908
|
+
return n === base || n.endsWith("/" + base) || n.endsWith(wantLc) || path37.basename(n) === base;
|
|
5909
|
+
});
|
|
5910
|
+
if (soft.length === 1) return soft[0];
|
|
5911
|
+
if (soft.length > 1) {
|
|
5912
|
+
const baseHits = soft.filter((m) => path37.basename(m.name).toLowerCase() === base);
|
|
5913
|
+
const pool = baseHits.length ? baseHits : soft;
|
|
5914
|
+
const order = ["ollama", "gguf", "lm-studio"];
|
|
5915
|
+
for (const rt of order) {
|
|
5916
|
+
const hit = pool.find((m) => m.runtime === rt);
|
|
5917
|
+
if (hit) return hit;
|
|
5918
|
+
}
|
|
5919
|
+
return pool[0];
|
|
5920
|
+
}
|
|
5921
|
+
if (!runtime || runtime === "ollama") {
|
|
5922
|
+
if (want.includes(":") || !want.includes("/") && !want.endsWith(".gguf")) {
|
|
5923
|
+
return { runtime: "ollama", name: want, path: "" };
|
|
5924
|
+
}
|
|
5925
|
+
}
|
|
5926
|
+
return null;
|
|
5927
|
+
}
|
|
5665
5928
|
function printInstallPlanHuman(label, plan) {
|
|
5666
5929
|
const title = plan.mode ? `${plan.mode} \u2192 ${plan.model}` : plan.model;
|
|
5667
5930
|
info(`${c.cyan(label)} \xB7 ${c.bold(title)}`);
|
|
@@ -5793,7 +6056,7 @@ function registerCode(program) {
|
|
|
5793
6056
|
const customSelection = !!(opts.provider || opts.model || opts.modelPath || config.provider || config.model);
|
|
5794
6057
|
if (!customSelection && (modeFlag || !provider && !model)) {
|
|
5795
6058
|
try {
|
|
5796
|
-
const { parseMode: parseMode2, resolveMode: resolveMode2, readOrchestratorState: readOrchestratorState2, activePin: activePin2 } = await import('./model-orchestrator-
|
|
6059
|
+
const { parseMode: parseMode2, resolveMode: resolveMode2, readOrchestratorState: readOrchestratorState2, activePin: activePin2 } = await import('./model-orchestrator-4M5FG6MN.js');
|
|
5797
6060
|
const { gatherSystemMemory: gatherSystemMemory2 } = await import('./local-runtime-5O2NN3GA.js');
|
|
5798
6061
|
const { loadGraph: loadGraph2 } = await import('./load-QPOWQD7C.js');
|
|
5799
6062
|
const state = readOrchestratorState2();
|
|
@@ -5824,7 +6087,7 @@ function registerCode(program) {
|
|
|
5824
6087
|
ExitCode.ERROR
|
|
5825
6088
|
);
|
|
5826
6089
|
}
|
|
5827
|
-
const { resolveGgufPath } = await import('./resolve-gguf-
|
|
6090
|
+
const { resolveGgufPath } = await import('./resolve-gguf-4AFRN4CP.js');
|
|
5828
6091
|
const primaryRef = resolved.pack.primary.backend === "llama.cpp" ? resolved.pack.primary.weightsRef : resolved.underlying.weightsRef;
|
|
5829
6092
|
const gguf = resolveGgufPath({
|
|
5830
6093
|
modelRef: primaryRef,
|
|
@@ -5879,7 +6142,7 @@ function registerCode(program) {
|
|
|
5879
6142
|
if (!(process.stdin.isTTY && process.stdout.isTTY)) {
|
|
5880
6143
|
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
6144
|
}
|
|
5882
|
-
const { runInteractive } = await import('./interactive-
|
|
6145
|
+
const { runInteractive } = await import('./interactive-OCWQ326U.js');
|
|
5883
6146
|
await runInteractive(
|
|
5884
6147
|
rootOf(global),
|
|
5885
6148
|
global,
|
|
@@ -5931,7 +6194,7 @@ function registerCode(program) {
|
|
|
5931
6194
|
{}
|
|
5932
6195
|
);
|
|
5933
6196
|
if (!opts.mock && route.providers[0]) {
|
|
5934
|
-
const { ensureManagerRuntime } = await import('./model-manager-
|
|
6197
|
+
const { ensureManagerRuntime } = await import('./model-manager-LB54VSV7.js');
|
|
5935
6198
|
const ensure = await ensureManagerRuntime({
|
|
5936
6199
|
providerId: route.providers[0].id,
|
|
5937
6200
|
model: route.providers[0].model,
|
|
@@ -5951,102 +6214,121 @@ function registerCode(program) {
|
|
|
5951
6214
|
for (const s of ensure.pulled) info(c.dim(` pulled ${s}`));
|
|
5952
6215
|
}
|
|
5953
6216
|
}
|
|
5954
|
-
if (!global.json && !global.quiet) {
|
|
6217
|
+
if (!global.json && !global.quiet && !opts.streamJson) {
|
|
5955
6218
|
info(`${c.cyan("vg code")} \xB7 ${c.dim(route.reason)}`);
|
|
5956
6219
|
info(`${c.cyan("vg code")} \xB7 manager ${c.bold(route.managerLine)}`);
|
|
5957
6220
|
}
|
|
5958
6221
|
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) => {
|
|
6222
|
+
const emitStream = (line) => {
|
|
6009
6223
|
process.stdout.write(JSON.stringify(line) + "\n");
|
|
6010
6224
|
};
|
|
6011
6225
|
try {
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
}
|
|
6045
|
-
|
|
6226
|
+
const primarySlug = route.providers[0]?.model.includes("/") ? route.providers[0].model.split("/")[0] : route.providers[0]?.id;
|
|
6227
|
+
const { runCodeStreamJson } = await import('./stream-json-Z5KC2DM3.js');
|
|
6228
|
+
const { nodeCodeFs } = await import('./session-ZJGENHKX.js');
|
|
6229
|
+
const readline5 = await import('readline');
|
|
6230
|
+
const child = await import('child_process');
|
|
6231
|
+
const { loadOrDiscoverFederation } = await import('./federation-SZWZIFZ7.js');
|
|
6232
|
+
const { resolveExecutionEnv } = await import('./execution-env-ZU45JZ4G.js');
|
|
6233
|
+
const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-TFBKCNJG.js');
|
|
6234
|
+
const { startCodeRuntimeSession } = await import('./runtime-session-EJQZXANB.js');
|
|
6235
|
+
const { resolveGraphBackend } = await import('./graph-backend-UTOL3SHE.js');
|
|
6236
|
+
const { detectGitRef } = await import('./git-ref-XDXB6JP5.js');
|
|
6237
|
+
const { repositoryIdFromRoot } = await import('./paths-2RAH3GME.js');
|
|
6238
|
+
const { vgdRequest: vgdRequest2 } = await import('./vgd-3MHSB4KA.js');
|
|
6239
|
+
const federation = loadOrDiscoverFederation(root2);
|
|
6240
|
+
const modelProfile = mergeModelExecutionProfile(
|
|
6241
|
+
resolveModelExecutionProfile({
|
|
6242
|
+
providerId: primarySlug,
|
|
6243
|
+
model: route.providers[0]?.model,
|
|
6244
|
+
budget: Number(opts.budget) || void 0,
|
|
6245
|
+
securityTier
|
|
6246
|
+
}),
|
|
6247
|
+
config.modelProfile
|
|
6248
|
+
);
|
|
6249
|
+
const tier = securityTier ?? modelProfile.securityTier ?? (auto ? "L1" : "L0");
|
|
6250
|
+
const writableRoots = federation?.members.map((m) => m.root) ?? [root2];
|
|
6251
|
+
const executionEnv = resolveExecutionEnv(tier, { writableRoots });
|
|
6252
|
+
const runtime = await startCodeRuntimeSession({ root: root2 });
|
|
6253
|
+
const git2 = detectGitRef(root2);
|
|
6254
|
+
const repositoryId = repositoryIdFromRoot(root2);
|
|
6255
|
+
if (runtime.socketPath && git2.ref) {
|
|
6256
|
+
try {
|
|
6257
|
+
await vgdRequest2(
|
|
6258
|
+
{ op: "put-graph", repositoryId, gitRef: git2.ref, graph },
|
|
6259
|
+
{ socketPath: runtime.socketPath }
|
|
6260
|
+
);
|
|
6261
|
+
} catch {
|
|
6046
6262
|
}
|
|
6263
|
+
}
|
|
6264
|
+
const graphBackend = resolveGraphBackend({
|
|
6265
|
+
graph,
|
|
6266
|
+
repositoryId,
|
|
6267
|
+
gitRef: git2.ref || null,
|
|
6268
|
+
socketPath: runtime.socketPath
|
|
6047
6269
|
});
|
|
6048
|
-
|
|
6049
|
-
|
|
6270
|
+
const run = (command) => {
|
|
6271
|
+
const res = child.spawnSync(command, {
|
|
6272
|
+
cwd: root2,
|
|
6273
|
+
shell: true,
|
|
6274
|
+
encoding: "utf8",
|
|
6275
|
+
timeout: 12e4,
|
|
6276
|
+
maxBuffer: 10 * 1024 * 1024
|
|
6277
|
+
});
|
|
6278
|
+
return {
|
|
6279
|
+
stdout: (res.stdout ?? "") + (res.stderr ? `
|
|
6280
|
+
${res.stderr}` : ""),
|
|
6281
|
+
exitCode: res.status ?? 1
|
|
6282
|
+
};
|
|
6283
|
+
};
|
|
6284
|
+
try {
|
|
6285
|
+
await runCodeStreamJson({
|
|
6286
|
+
graph,
|
|
6287
|
+
root: root2,
|
|
6288
|
+
instruction,
|
|
6289
|
+
providers: route.providers,
|
|
6290
|
+
fsImpl: nodeCodeFs(root2),
|
|
6291
|
+
run,
|
|
6292
|
+
executionEnv,
|
|
6293
|
+
graphBackend,
|
|
6294
|
+
modelProfile,
|
|
6295
|
+
auto: !!auto,
|
|
6296
|
+
maxSteps,
|
|
6297
|
+
budget: modelProfile.capsuleBudgetTokens,
|
|
6298
|
+
contextBudget,
|
|
6299
|
+
denyCommands: config.denyCommands,
|
|
6300
|
+
testCommand: config.testCommand,
|
|
6301
|
+
stream: true,
|
|
6302
|
+
verify: verify3 ? { command: verify3.command, maxRounds: modelProfile.maxRepairRounds } : void 0,
|
|
6303
|
+
capsule,
|
|
6304
|
+
files: opts.file.length ? opts.file : void 0,
|
|
6305
|
+
worktreeOverlay: true,
|
|
6306
|
+
advancedMode: !capsule,
|
|
6307
|
+
attribution: {
|
|
6308
|
+
client: "vg-code",
|
|
6309
|
+
provider: primarySlug,
|
|
6310
|
+
model: route.providers[0]?.model
|
|
6311
|
+
},
|
|
6312
|
+
now: () => Date.now(),
|
|
6313
|
+
emit: emitStream,
|
|
6314
|
+
bindDecisions: (session) => {
|
|
6315
|
+
const rl = readline5.createInterface({ input: process.stdin });
|
|
6316
|
+
rl.on("line", (raw) => {
|
|
6317
|
+
try {
|
|
6318
|
+
const msg = JSON.parse(raw);
|
|
6319
|
+
if (typeof msg.approveId === "number") session.submitDecision(msg.approveId, !!msg.approve);
|
|
6320
|
+
} catch {
|
|
6321
|
+
}
|
|
6322
|
+
});
|
|
6323
|
+
}
|
|
6324
|
+
});
|
|
6325
|
+
} finally {
|
|
6326
|
+
await runtime.dispose();
|
|
6327
|
+
}
|
|
6328
|
+
} catch (e) {
|
|
6329
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
6330
|
+
emitStream({ event: "error", message });
|
|
6331
|
+
process.exitCode = e instanceof CliError ? e.code : ExitCode.ERROR;
|
|
6050
6332
|
}
|
|
6051
6333
|
return;
|
|
6052
6334
|
}
|
|
@@ -6057,7 +6339,7 @@ ${res.stderr}` : ""), exitCode: res.status ?? 1 };
|
|
|
6057
6339
|
if (!autonomous && !tty) {
|
|
6058
6340
|
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
6341
|
}
|
|
6060
|
-
const { agentTask } = await import('./interactive-
|
|
6342
|
+
const { agentTask } = await import('./interactive-OCWQ326U.js');
|
|
6061
6343
|
const { nodeCodeFs } = await import('./session-ZJGENHKX.js');
|
|
6062
6344
|
const { TtyPrompter } = await import('./ui-Q6DJ3GCU.js');
|
|
6063
6345
|
let priorSummary;
|
|
@@ -7267,7 +7549,7 @@ var initCommand = new Command("init").description("Initialize vibgrate in a proj
|
|
|
7267
7549
|
console.log(chalk7.green("\u2714") + ` Created ${chalk7.bold("vibgrate.config.ts")}`);
|
|
7268
7550
|
}
|
|
7269
7551
|
if (opts.baseline) {
|
|
7270
|
-
const { runBaseline } = await import('./baseline-
|
|
7552
|
+
const { runBaseline } = await import('./baseline-PPZJBYAJ.js');
|
|
7271
7553
|
await runBaseline(rootDir);
|
|
7272
7554
|
}
|
|
7273
7555
|
console.log("");
|
|
@@ -10907,7 +11189,7 @@ async function resolveAdvisory(id, opts) {
|
|
|
10907
11189
|
}
|
|
10908
11190
|
|
|
10909
11191
|
// src/reporting/commands/evidence/feeds.ts
|
|
10910
|
-
var
|
|
11192
|
+
var KEV_URL2 = "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json";
|
|
10911
11193
|
var OSV_BATCH_URL = "https://api.osv.dev/v1/querybatch";
|
|
10912
11194
|
var OSV_VULN_URL = "https://api.osv.dev/v1/vulns/";
|
|
10913
11195
|
async function getJson(url, init) {
|
|
@@ -10922,7 +11204,7 @@ async function getJson(url, init) {
|
|
|
10922
11204
|
return res.json();
|
|
10923
11205
|
}
|
|
10924
11206
|
async function fetchKevCatalog() {
|
|
10925
|
-
const data = await getJson(
|
|
11207
|
+
const data = await getJson(KEV_URL2);
|
|
10926
11208
|
const map = /* @__PURE__ */ new Map();
|
|
10927
11209
|
for (const v of data.vulnerabilities ?? []) {
|
|
10928
11210
|
if (v.cveID) map.set(v.cveID.toUpperCase(), v);
|
|
@@ -12070,12 +12352,22 @@ function handleError(err) {
|
|
|
12070
12352
|
if (err.code === "commander.version") process.exit(ExitCode.OK);
|
|
12071
12353
|
process.exit(ExitCode.USAGE_ERROR);
|
|
12072
12354
|
}
|
|
12355
|
+
const streamJsonHost = process.argv.includes("--stream-json") || process.env.VG_CODE_STREAM_JSON === "1";
|
|
12356
|
+
const emitHostError = (message2) => {
|
|
12357
|
+
if (!streamJsonHost) return;
|
|
12358
|
+
try {
|
|
12359
|
+
process.stdout.write(JSON.stringify({ event: "error", message: message2 }) + "\n");
|
|
12360
|
+
} catch {
|
|
12361
|
+
}
|
|
12362
|
+
};
|
|
12073
12363
|
if (err instanceof CliError) {
|
|
12364
|
+
emitHostError(err.message);
|
|
12074
12365
|
info(c.red(`error: ${err.message}`));
|
|
12075
12366
|
process.exit(err.code);
|
|
12076
12367
|
}
|
|
12077
12368
|
const message = err instanceof Error ? err.message : String(err);
|
|
12078
12369
|
const correlation = Math.random().toString(36).slice(2, 10);
|
|
12370
|
+
emitHostError(message);
|
|
12079
12371
|
info(c.red(`error: ${message}`));
|
|
12080
12372
|
info(c.dim(` (ref ${correlation}) \u2014 re-run with --json for detail, or report at https://vibgrate.com/help`));
|
|
12081
12373
|
process.exit(ExitCode.ERROR);
|