@vibgrate/cli 2026.728.5 → 2026.729.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/baseline-MROWBNK7.js +9 -0
- package/dist/{baseline-Y5FBYWNJ.js.map → baseline-MROWBNK7.js.map} +1 -1
- package/dist/{chunk-EVWW3BPM.js → chunk-2JV3J5NF.js} +3 -3
- package/dist/{chunk-EVWW3BPM.js.map → chunk-2JV3J5NF.js.map} +1 -1
- package/dist/{chunk-DBOT2ELH.js → chunk-3IJB5UJI.js} +3 -3
- package/dist/{chunk-DBOT2ELH.js.map → chunk-3IJB5UJI.js.map} +1 -1
- package/dist/{chunk-SGI5ZP2Y.js → chunk-CF2MLSOV.js} +3 -3
- package/dist/{chunk-SGI5ZP2Y.js.map → chunk-CF2MLSOV.js.map} +1 -1
- package/dist/{chunk-643KXZ54.js → chunk-EEVZVXT2.js} +6 -5
- package/dist/chunk-EEVZVXT2.js.map +1 -0
- package/dist/chunk-NQ4FSRXL.js +6 -0
- package/dist/chunk-NQ4FSRXL.js.map +1 -0
- package/dist/{chunk-4JD63RUR.js → chunk-OIWHR57Q.js} +3 -5
- package/dist/chunk-OIWHR57Q.js.map +1 -0
- package/dist/{chunk-VBVY733D.js → chunk-QS5BTBRX.js} +3 -3
- package/dist/{chunk-VBVY733D.js.map → chunk-QS5BTBRX.js.map} +1 -1
- package/dist/{chunk-NH5NJ3UO.js → chunk-TQFY6OSV.js} +7 -7
- package/dist/chunk-TQFY6OSV.js.map +1 -0
- package/dist/{chunk-RYNAK4LK.js → chunk-YKVNMNEM.js} +178 -39
- package/dist/chunk-YKVNMNEM.js.map +1 -0
- package/dist/{chunk-RCP2KQGG.js → chunk-YMHQZ24Q.js} +5 -5
- package/dist/{chunk-RCP2KQGG.js.map → chunk-YMHQZ24Q.js.map} +1 -1
- package/dist/cli.js +141 -134
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/{interactive-KVDKRKNK.js → interactive-R5VQGDWP.js} +11 -10
- package/dist/interactive-R5VQGDWP.js.map +1 -0
- package/dist/load-WKIZF2AK.js +9 -0
- package/dist/{load-SEFJA3M5.js.map → load-WKIZF2AK.js.map} +1 -1
- package/dist/{runtime-session-4IACVDSY.js → runtime-session-5NRB6BTR.js} +6 -5
- package/dist/{runtime-session-4IACVDSY.js.map → runtime-session-5NRB6BTR.js.map} +1 -1
- package/dist/{vg-mcp-bridge-B35WCSAS.js → vg-mcp-bridge-YXQS6HTO.js} +5 -4
- package/dist/vg-mcp-bridge-YXQS6HTO.js.map +1 -0
- package/dist/{vgd-KDQFS33M.js → vgd-KC5RCOP6.js} +5 -4
- package/dist/{vgd-KDQFS33M.js.map → vgd-KC5RCOP6.js.map} +1 -1
- package/package.json +2 -1
- package/dist/baseline-Y5FBYWNJ.js +0 -8
- package/dist/chunk-4JD63RUR.js.map +0 -1
- package/dist/chunk-643KXZ54.js.map +0 -1
- package/dist/chunk-NH5NJ3UO.js.map +0 -1
- package/dist/chunk-RYNAK4LK.js.map +0 -1
- package/dist/interactive-KVDKRKNK.js.map +0 -1
- package/dist/load-SEFJA3M5.js +0 -8
- package/dist/vg-mcp-bridge-B35WCSAS.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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-EEVZVXT2.js';
|
|
3
|
+
export { runBuild } from './chunk-EEVZVXT2.js';
|
|
4
4
|
import { CONTEXT_POLICY_VERSION, computeFcsReport, renderFcsReportMarkdown, createTrajectoryCollector, runAgent } from './chunk-2ZHWF7C6.js';
|
|
5
|
-
import { loadAdvancedScanHook, baselineCommand } from './chunk-
|
|
5
|
+
import { loadAdvancedScanHook, baselineCommand } from './chunk-CF2MLSOV.js';
|
|
6
6
|
import { runCodeSession } from './chunk-PRGCCW7D.js';
|
|
7
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-2JV3J5NF.js';
|
|
10
10
|
import './chunk-5I4VSBWQ.js';
|
|
11
11
|
import './chunk-IS7VTH2Q.js';
|
|
12
12
|
import { init_resolve_ollama, gatherSystemMemory, resolveOllamaBinary, hasOllamaBinary, resolve_ollama_exports } from './chunk-OWSFZQOP.js';
|
|
@@ -21,12 +21,12 @@ import { buildIdentifierTrieFromGraph } from './chunk-JIBOJTGS.js';
|
|
|
21
21
|
import './chunk-7AVYKZEM.js';
|
|
22
22
|
import { buildModelInstallPlan } from './chunk-WHJMS7XC.js';
|
|
23
23
|
import { ensurePackage, ensureUnavailableMessage } from './chunk-REIGWTTH.js';
|
|
24
|
-
import { serveStdio, exportGraph, GraphSource, createServer, formatForExt } from './chunk-
|
|
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-
|
|
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-
|
|
24
|
+
import { serveStdio, exportGraph, GraphSource, createServer, formatForExt } from './chunk-TQFY6OSV.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-YMHQZ24Q.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-QS5BTBRX.js';
|
|
27
27
|
import './chunk-IPICO2RV.js';
|
|
28
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,
|
|
29
|
+
import { writeDefaultConfig, parseDsn, detectVcs, computeRepoFingerprint, resolveRepositoryName, fetchScanPreflight, runCoreScan, loadConfig, prepareCompressedUpload, computeDriftScore, titleBox, projectTypeToVulnEcosystem, driftBar, gitHistoryAvailable, buildVersionTimelines, findPackageAnyEcosystem, normalizeConstraint, findVersionCrossings, versionSatisfies, PROJECT_TYPE_TO_OSV_ECOSYSTEM, fetchRiskySymbols } from './chunk-OIWHR57Q.js';
|
|
30
30
|
import { recordCliCall, CLI_TOOL_ALIASES, savingsLedgerPath, clearSavings, readSavings, readUsage, readModelSavings, CAPSULE_RANKING_VERSION, SAVINGS_TOOLS, sanitizeClient } from './chunk-US2DAKCM.js';
|
|
31
31
|
import { ensureDir, pathExists, readJsonFile, writeTextFile, writeJsonFile } from './chunk-CRAMOEBE.js';
|
|
32
32
|
import { resolveOne } from './chunk-J7LKEB2R.js';
|
|
@@ -36,15 +36,16 @@ import { init_cli_invocation, resolveCliInvocation, NPX_INVOCATION } from './chu
|
|
|
36
36
|
import { freeBytesOnVolume, weightStoreDir, listCachedWeights, ensureWeightCached, catalogIntegrityReport } from './chunk-OV4KGXPD.js';
|
|
37
37
|
import { resolvedGrammarFiles, grammarSetVersion } from './chunk-UTNNGKKX.js';
|
|
38
38
|
import './chunk-RXP66R2E.js';
|
|
39
|
-
import { resolveGraphPath, renderReport, loadGraph, writeArtifacts, vibgrateDir, SCHEMA_VERSION } from './chunk-
|
|
40
|
-
import {
|
|
39
|
+
import { resolveGraphPath, renderReport, loadGraph, loadGraphFileWithSnapshot, writeArtifacts, vibgrateDir, mapFileExists, SCHEMA_VERSION } from './chunk-YKVNMNEM.js';
|
|
40
|
+
import { VERSION } from './chunk-NQ4FSRXL.js';
|
|
41
|
+
import { cacheDir, serializeGraph, stableStringify } from './chunk-ZKNB4YH4.js';
|
|
41
42
|
import './chunk-BWPBB45M.js';
|
|
42
43
|
import { canonicalize, hashString, hashBytes } from './chunk-JFGYT6BI.js';
|
|
43
44
|
import './chunk-BPF3YX2U.js';
|
|
44
45
|
import { pathExists as pathExists$1, parseExcludePatterns } from './chunk-GI6W53LM.js';
|
|
45
46
|
import { __toCommonJS } from './chunk-Z6ZWNWWR.js';
|
|
46
|
-
import * as
|
|
47
|
-
import
|
|
47
|
+
import * as fs7 from 'fs';
|
|
48
|
+
import fs7__default, { realpathSync } from 'fs';
|
|
48
49
|
import * as path37 from 'path';
|
|
49
50
|
import path37__default from 'path';
|
|
50
51
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
@@ -55,7 +56,7 @@ import { randomUUID } from 'crypto';
|
|
|
55
56
|
import { execSync, spawn, spawnSync, execFileSync } from 'child_process';
|
|
56
57
|
import * as readline from 'readline';
|
|
57
58
|
import chalk7 from 'chalk';
|
|
58
|
-
import * as
|
|
59
|
+
import * as fs20 from 'fs/promises';
|
|
59
60
|
import semver2 from 'semver';
|
|
60
61
|
|
|
61
62
|
init_cli_invocation();
|
|
@@ -69,7 +70,7 @@ async function runStatus(global) {
|
|
|
69
70
|
const root2 = path37.resolve(global.cwd ?? ".");
|
|
70
71
|
const graphPath = resolveGraphPath(root2, global.graph);
|
|
71
72
|
const graph = loadGraph(root2, graphPath);
|
|
72
|
-
const hasCache =
|
|
73
|
+
const hasCache = fs7.existsSync(path37.join(cacheDir(root2), "parse-cache.json"));
|
|
73
74
|
let stale = null;
|
|
74
75
|
let staleExact = false;
|
|
75
76
|
if (graph) {
|
|
@@ -866,14 +867,14 @@ function isCI(env = process.env) {
|
|
|
866
867
|
function installId(env = process.env) {
|
|
867
868
|
if (telemetryOptOut(env) !== null || isCI(env)) return randomUuid();
|
|
868
869
|
try {
|
|
869
|
-
const existing =
|
|
870
|
+
const existing = fs7.readFileSync(INSTALL_ID_FILE, "utf8").trim();
|
|
870
871
|
if (isUuid(existing)) return existing;
|
|
871
872
|
} catch {
|
|
872
873
|
}
|
|
873
874
|
const id = randomUuid();
|
|
874
875
|
try {
|
|
875
|
-
|
|
876
|
-
|
|
876
|
+
fs7.mkdirSync(INSTALL_ID_DIR, { recursive: true });
|
|
877
|
+
fs7.writeFileSync(INSTALL_ID_FILE, id + "\n", { mode: 384 });
|
|
877
878
|
} catch {
|
|
878
879
|
}
|
|
879
880
|
return id;
|
|
@@ -897,7 +898,7 @@ function ledgerFilePath(root2) {
|
|
|
897
898
|
}
|
|
898
899
|
function readOffset(root2) {
|
|
899
900
|
try {
|
|
900
|
-
const raw = JSON.parse(
|
|
901
|
+
const raw = JSON.parse(fs7.readFileSync(offsetPath(root2), "utf8"));
|
|
901
902
|
return typeof raw.offset === "number" && raw.offset >= 0 ? raw.offset : 0;
|
|
902
903
|
} catch {
|
|
903
904
|
return 0;
|
|
@@ -905,8 +906,8 @@ function readOffset(root2) {
|
|
|
905
906
|
}
|
|
906
907
|
function writeOffset(root2, offset) {
|
|
907
908
|
try {
|
|
908
|
-
|
|
909
|
-
|
|
909
|
+
fs7.mkdirSync(cacheDir(root2), { recursive: true });
|
|
910
|
+
fs7.writeFileSync(offsetPath(root2), JSON.stringify({ offset }) + "\n");
|
|
910
911
|
} catch {
|
|
911
912
|
}
|
|
912
913
|
}
|
|
@@ -914,7 +915,7 @@ function buildBatch(root2, fromOffset, id = installId()) {
|
|
|
914
915
|
const file = ledgerFilePath(root2);
|
|
915
916
|
let size = 0;
|
|
916
917
|
try {
|
|
917
|
-
size =
|
|
918
|
+
size = fs7.statSync(file).size;
|
|
918
919
|
} catch {
|
|
919
920
|
return { batch: null, newOffset: 0 };
|
|
920
921
|
}
|
|
@@ -922,13 +923,13 @@ function buildBatch(root2, fromOffset, id = installId()) {
|
|
|
922
923
|
if (start >= size) return { batch: null, newOffset: size };
|
|
923
924
|
let text = "";
|
|
924
925
|
try {
|
|
925
|
-
const fd =
|
|
926
|
+
const fd = fs7.openSync(file, "r");
|
|
926
927
|
try {
|
|
927
928
|
const buf = Buffer.alloc(size - start);
|
|
928
|
-
|
|
929
|
+
fs7.readSync(fd, buf, 0, buf.length, start);
|
|
929
930
|
text = buf.toString("utf8");
|
|
930
931
|
} finally {
|
|
931
|
-
|
|
932
|
+
fs7.closeSync(fd);
|
|
932
933
|
}
|
|
933
934
|
} catch {
|
|
934
935
|
return { batch: null, newOffset: fromOffset };
|
|
@@ -1069,7 +1070,7 @@ function liveStatsDir(root2) {
|
|
|
1069
1070
|
function reapOtherVersionServers(dir, keepVersion, now = Date.now(), kill = (pid, signal) => process.kill(pid, signal), selfPid = process.pid) {
|
|
1070
1071
|
let entries;
|
|
1071
1072
|
try {
|
|
1072
|
-
entries =
|
|
1073
|
+
entries = fs7.readdirSync(dir);
|
|
1073
1074
|
} catch {
|
|
1074
1075
|
return [];
|
|
1075
1076
|
}
|
|
@@ -1078,7 +1079,7 @@ function reapOtherVersionServers(dir, keepVersion, now = Date.now(), kill = (pid
|
|
|
1078
1079
|
if (!/^serve-\d+\.json$/.test(name)) continue;
|
|
1079
1080
|
let parsed;
|
|
1080
1081
|
try {
|
|
1081
|
-
parsed = JSON.parse(
|
|
1082
|
+
parsed = JSON.parse(fs7.readFileSync(path37.join(dir, name), "utf8"));
|
|
1082
1083
|
} catch {
|
|
1083
1084
|
continue;
|
|
1084
1085
|
}
|
|
@@ -1132,10 +1133,10 @@ var LiveStatsBus = class {
|
|
|
1132
1133
|
this.lastWriteAt = now;
|
|
1133
1134
|
const body = { pid: this.pid, updatedAt: now, version: VERSION, snapshot: snap };
|
|
1134
1135
|
try {
|
|
1135
|
-
|
|
1136
|
+
fs7.mkdirSync(this.dir, { recursive: true });
|
|
1136
1137
|
const tmp = `${this.file}.tmp`;
|
|
1137
|
-
|
|
1138
|
-
|
|
1138
|
+
fs7.writeFileSync(tmp, JSON.stringify(body));
|
|
1139
|
+
fs7.renameSync(tmp, this.file);
|
|
1139
1140
|
} catch {
|
|
1140
1141
|
}
|
|
1141
1142
|
}
|
|
@@ -1146,7 +1147,7 @@ var LiveStatsBus = class {
|
|
|
1146
1147
|
siblings(now = Date.now()) {
|
|
1147
1148
|
let entries;
|
|
1148
1149
|
try {
|
|
1149
|
-
entries =
|
|
1150
|
+
entries = fs7.readdirSync(this.dir);
|
|
1150
1151
|
} catch {
|
|
1151
1152
|
return [];
|
|
1152
1153
|
}
|
|
@@ -1156,14 +1157,14 @@ var LiveStatsBus = class {
|
|
|
1156
1157
|
const file = path37.join(this.dir, name);
|
|
1157
1158
|
let parsed;
|
|
1158
1159
|
try {
|
|
1159
|
-
parsed = JSON.parse(
|
|
1160
|
+
parsed = JSON.parse(fs7.readFileSync(file, "utf8"));
|
|
1160
1161
|
} catch {
|
|
1161
1162
|
continue;
|
|
1162
1163
|
}
|
|
1163
1164
|
if (typeof parsed?.pid !== "number" || typeof parsed.updatedAt !== "number" || !parsed.snapshot?.totals) continue;
|
|
1164
1165
|
if (now - parsed.updatedAt > STALE_MS) {
|
|
1165
1166
|
try {
|
|
1166
|
-
|
|
1167
|
+
fs7.unlinkSync(file);
|
|
1167
1168
|
} catch {
|
|
1168
1169
|
}
|
|
1169
1170
|
continue;
|
|
@@ -1175,7 +1176,7 @@ var LiveStatsBus = class {
|
|
|
1175
1176
|
}
|
|
1176
1177
|
unlinkOwn = () => {
|
|
1177
1178
|
try {
|
|
1178
|
-
|
|
1179
|
+
fs7.unlinkSync(this.file);
|
|
1179
1180
|
} catch {
|
|
1180
1181
|
}
|
|
1181
1182
|
};
|
|
@@ -1488,12 +1489,12 @@ var LedgerTail = class {
|
|
|
1488
1489
|
if (size === this.offset) return;
|
|
1489
1490
|
let chunk;
|
|
1490
1491
|
try {
|
|
1491
|
-
const fd =
|
|
1492
|
+
const fd = fs7.openSync(this.file, "r");
|
|
1492
1493
|
try {
|
|
1493
1494
|
chunk = Buffer.alloc(size - this.offset);
|
|
1494
|
-
|
|
1495
|
+
fs7.readSync(fd, chunk, 0, chunk.length, this.offset);
|
|
1495
1496
|
} finally {
|
|
1496
|
-
|
|
1497
|
+
fs7.closeSync(fd);
|
|
1497
1498
|
}
|
|
1498
1499
|
} catch {
|
|
1499
1500
|
return;
|
|
@@ -1506,7 +1507,7 @@ var LedgerTail = class {
|
|
|
1506
1507
|
}
|
|
1507
1508
|
sizeOf() {
|
|
1508
1509
|
try {
|
|
1509
|
-
return
|
|
1510
|
+
return fs7.statSync(this.file).size;
|
|
1510
1511
|
} catch {
|
|
1511
1512
|
return 0;
|
|
1512
1513
|
}
|
|
@@ -1589,7 +1590,7 @@ function registerServe(program) {
|
|
|
1589
1590
|
}
|
|
1590
1591
|
async function ensureServableGraph(root2, graphPath, global, refresh, opts = {}) {
|
|
1591
1592
|
if (refresh) {
|
|
1592
|
-
if (!
|
|
1593
|
+
if (!mapFileExists(graphPath)) {
|
|
1593
1594
|
info(c.dim("vg \xB7 no map found \u2014 building it before serving\u2026"));
|
|
1594
1595
|
await runBuild(
|
|
1595
1596
|
[],
|
|
@@ -1615,7 +1616,7 @@ async function ensureServableGraph(root2, graphPath, global, refresh, opts = {})
|
|
|
1615
1616
|
if (opts.awaitStaleRefresh) await kick;
|
|
1616
1617
|
}
|
|
1617
1618
|
}
|
|
1618
|
-
if (!
|
|
1619
|
+
if (!mapFileExists(graphPath)) {
|
|
1619
1620
|
throw new CliError(
|
|
1620
1621
|
`no map found at ${graphPath} \u2014 run \`vg\` to build one first`,
|
|
1621
1622
|
ExitCode.NOT_FOUND
|
|
@@ -1898,7 +1899,7 @@ function manifestHash(root2) {
|
|
|
1898
1899
|
const walk2 = (dir) => {
|
|
1899
1900
|
let entries;
|
|
1900
1901
|
try {
|
|
1901
|
-
entries =
|
|
1902
|
+
entries = fs7.readdirSync(dir, { withFileTypes: true });
|
|
1902
1903
|
} catch {
|
|
1903
1904
|
return;
|
|
1904
1905
|
}
|
|
@@ -1914,7 +1915,7 @@ function manifestHash(root2) {
|
|
|
1914
1915
|
if (!isManifest(abs) && !SKIP_FILES.has(base)) continue;
|
|
1915
1916
|
try {
|
|
1916
1917
|
const rel = path37.relative(root2, abs).split(path37.sep).join("/");
|
|
1917
|
-
files.push({ rel, hash: hashBytes(
|
|
1918
|
+
files.push({ rel, hash: hashBytes(fs7.readFileSync(abs)) });
|
|
1918
1919
|
} catch {
|
|
1919
1920
|
}
|
|
1920
1921
|
}
|
|
@@ -1933,7 +1934,7 @@ function isDependencyFile(root2, filePath) {
|
|
|
1933
1934
|
}
|
|
1934
1935
|
function loadScanCache(root2, key2) {
|
|
1935
1936
|
try {
|
|
1936
|
-
const raw = JSON.parse(
|
|
1937
|
+
const raw = JSON.parse(fs7.readFileSync(cachePath(root2), "utf8"));
|
|
1937
1938
|
if (raw.version === CACHE_VERSION && raw.manifestHash === key2.manifestHash && raw.toolVersion === key2.toolVersion && raw.offline === key2.offline && raw.artifact) {
|
|
1938
1939
|
return { manifestHash: raw.manifestHash, artifact: raw.artifact };
|
|
1939
1940
|
}
|
|
@@ -1943,8 +1944,8 @@ function loadScanCache(root2, key2) {
|
|
|
1943
1944
|
}
|
|
1944
1945
|
function writeScanCache(root2, key2, artifact) {
|
|
1945
1946
|
try {
|
|
1946
|
-
|
|
1947
|
-
|
|
1947
|
+
fs7.mkdirSync(cacheDir(root2), { recursive: true });
|
|
1948
|
+
fs7.writeFileSync(
|
|
1948
1949
|
cachePath(root2),
|
|
1949
1950
|
stableStringify(
|
|
1950
1951
|
{ version: CACHE_VERSION, manifestHash: key2.manifestHash, toolVersion: key2.toolVersion, offline: key2.offline, artifact },
|
|
@@ -2758,7 +2759,7 @@ var VibgrateLanguageServer = class {
|
|
|
2758
2759
|
const absManifest = path37.resolve(this.opts.root, relManifest);
|
|
2759
2760
|
let text = null;
|
|
2760
2761
|
try {
|
|
2761
|
-
if (
|
|
2762
|
+
if (fs7.existsSync(absManifest)) text = fs7.readFileSync(absManifest, "utf8");
|
|
2762
2763
|
} catch {
|
|
2763
2764
|
text = null;
|
|
2764
2765
|
}
|
|
@@ -3063,7 +3064,7 @@ function hoverMarkdown(dep, contribution) {
|
|
|
3063
3064
|
return lines.join("\n");
|
|
3064
3065
|
}
|
|
3065
3066
|
function startLanguageServer(opts) {
|
|
3066
|
-
if (!
|
|
3067
|
+
if (!fs7.existsSync(opts.root)) {
|
|
3067
3068
|
process.stderr.write(`vg lsp: root does not exist: ${opts.root}
|
|
3068
3069
|
`);
|
|
3069
3070
|
process.exit(1);
|
|
@@ -3201,7 +3202,7 @@ function registerShare(program) {
|
|
|
3201
3202
|
const global = readGlobal(this);
|
|
3202
3203
|
const root2 = rootOf(global);
|
|
3203
3204
|
const gitDir = path37.join(root2, ".git");
|
|
3204
|
-
if (!
|
|
3205
|
+
if (!fs7.existsSync(gitDir)) {
|
|
3205
3206
|
throw new CliError("not a git repository \u2014 run `vg share` inside a git repo", ExitCode.USAGE_ERROR);
|
|
3206
3207
|
}
|
|
3207
3208
|
if (opts.undo) {
|
|
@@ -3223,22 +3224,22 @@ function registerShare(program) {
|
|
|
3223
3224
|
}
|
|
3224
3225
|
function writeVibgrateGitignore(root2, reports) {
|
|
3225
3226
|
const dir = path37.join(root2, ".vibgrate");
|
|
3226
|
-
|
|
3227
|
-
const lines = ["# Managed by `vg share` \u2014 keep graph.json committed, ignore the rest", "cache/", "facts.jsonl"];
|
|
3227
|
+
fs7.mkdirSync(dir, { recursive: true });
|
|
3228
|
+
const lines = ["# Managed by `vg share` \u2014 keep graph.json committed, ignore the rest", "cache/", "facts.jsonl", "graph.snap"];
|
|
3228
3229
|
if (!reports) lines.push("graph.html", "GRAPH_REPORT.md");
|
|
3229
|
-
|
|
3230
|
+
fs7.writeFileSync(path37.join(dir, ".gitignore"), `${lines.join("\n")}
|
|
3230
3231
|
`);
|
|
3231
3232
|
}
|
|
3232
3233
|
function writeGitAttributes(root2) {
|
|
3233
3234
|
const file = path37.join(root2, ".gitattributes");
|
|
3234
3235
|
const line = ".vibgrate/graph.json merge=vg";
|
|
3235
|
-
let content =
|
|
3236
|
+
let content = fs7.existsSync(file) ? fs7.readFileSync(file, "utf8") : "";
|
|
3236
3237
|
if (!content.split("\n").some((l) => l.trim() === line)) {
|
|
3237
3238
|
content = content.length ? `${content.replace(/\s*$/, "")}
|
|
3238
3239
|
${line}
|
|
3239
3240
|
` : `${line}
|
|
3240
3241
|
`;
|
|
3241
|
-
|
|
3242
|
+
fs7.writeFileSync(file, content);
|
|
3242
3243
|
}
|
|
3243
3244
|
}
|
|
3244
3245
|
function configureMergeDriver(root2) {
|
|
@@ -3247,7 +3248,7 @@ function configureMergeDriver(root2) {
|
|
|
3247
3248
|
}
|
|
3248
3249
|
function installPreCommitHook(root2) {
|
|
3249
3250
|
const hooksDir = hookDir(root2);
|
|
3250
|
-
|
|
3251
|
+
fs7.mkdirSync(hooksDir, { recursive: true });
|
|
3251
3252
|
const file = path37.join(hooksDir, "pre-commit");
|
|
3252
3253
|
const block = [
|
|
3253
3254
|
HOOK_BEGIN,
|
|
@@ -3257,7 +3258,7 @@ function installPreCommitHook(root2) {
|
|
|
3257
3258
|
"fi",
|
|
3258
3259
|
HOOK_END
|
|
3259
3260
|
].join("\n");
|
|
3260
|
-
let content =
|
|
3261
|
+
let content = fs7.existsSync(file) ? fs7.readFileSync(file, "utf8") : "#!/bin/sh\n";
|
|
3261
3262
|
const re = new RegExp(`${escapeRe(HOOK_BEGIN)}[\\s\\S]*?${escapeRe(HOOK_END)}`);
|
|
3262
3263
|
if (re.test(content)) content = content.replace(re, block);
|
|
3263
3264
|
else content = `${content.replace(/\s*$/, "")}
|
|
@@ -3266,21 +3267,21 @@ ${block}
|
|
|
3266
3267
|
`;
|
|
3267
3268
|
if (!content.startsWith("#!")) content = `#!/bin/sh
|
|
3268
3269
|
${content}`;
|
|
3269
|
-
|
|
3270
|
-
|
|
3270
|
+
fs7.writeFileSync(file, content);
|
|
3271
|
+
fs7.chmodSync(file, 493);
|
|
3271
3272
|
}
|
|
3272
3273
|
function undo(root2) {
|
|
3273
3274
|
const hookFile = path37.join(hookDir(root2), "pre-commit");
|
|
3274
|
-
if (
|
|
3275
|
+
if (fs7.existsSync(hookFile)) {
|
|
3275
3276
|
const re = new RegExp(`\\n*${escapeRe(HOOK_BEGIN)}[\\s\\S]*?${escapeRe(HOOK_END)}\\n*`);
|
|
3276
|
-
const next2 =
|
|
3277
|
-
if (next2.trim() === "#!/bin/sh")
|
|
3278
|
-
else
|
|
3277
|
+
const next2 = fs7.readFileSync(hookFile, "utf8").replace(re, "\n");
|
|
3278
|
+
if (next2.trim() === "#!/bin/sh") fs7.rmSync(hookFile);
|
|
3279
|
+
else fs7.writeFileSync(hookFile, next2);
|
|
3279
3280
|
}
|
|
3280
3281
|
const attr = path37.join(root2, ".gitattributes");
|
|
3281
|
-
if (
|
|
3282
|
-
const next2 =
|
|
3283
|
-
|
|
3282
|
+
if (fs7.existsSync(attr)) {
|
|
3283
|
+
const next2 = fs7.readFileSync(attr, "utf8").split("\n").filter((l) => l.trim() !== ".vibgrate/graph.json merge=vg").join("\n");
|
|
3284
|
+
fs7.writeFileSync(attr, next2);
|
|
3284
3285
|
}
|
|
3285
3286
|
try {
|
|
3286
3287
|
git(root2, ["config", "--remove-section", "merge.vg"]);
|
|
@@ -3323,7 +3324,7 @@ function registerWatch(program) {
|
|
|
3323
3324
|
const debounceMs = Math.max(50, Number(opts.debounce) || DEFAULT_DEBOUNCE_MS);
|
|
3324
3325
|
const watchRoots = (paths.length ? paths : ["."]).map((p) => path37.resolve(root2, p));
|
|
3325
3326
|
for (const w of watchRoots) {
|
|
3326
|
-
if (!
|
|
3327
|
+
if (!fs7.existsSync(w)) {
|
|
3327
3328
|
throw new CliError(`watch path not found: ${w}`, ExitCode.USAGE_ERROR);
|
|
3328
3329
|
}
|
|
3329
3330
|
}
|
|
@@ -3376,7 +3377,7 @@ function registerWatch(program) {
|
|
|
3376
3377
|
const watchers = [];
|
|
3377
3378
|
for (const w of watchRoots) {
|
|
3378
3379
|
try {
|
|
3379
|
-
const watcher =
|
|
3380
|
+
const watcher = fs7.watch(w, { recursive: true }, (_event, filename) => {
|
|
3380
3381
|
if (!filename) {
|
|
3381
3382
|
schedule("change");
|
|
3382
3383
|
return;
|
|
@@ -3729,7 +3730,7 @@ function loadStandards(root2) {
|
|
|
3729
3730
|
const p = path37__default.join(root2, rel);
|
|
3730
3731
|
let text;
|
|
3731
3732
|
try {
|
|
3732
|
-
text =
|
|
3733
|
+
text = fs7__default.readFileSync(p, "utf8");
|
|
3733
3734
|
} catch {
|
|
3734
3735
|
continue;
|
|
3735
3736
|
}
|
|
@@ -5660,7 +5661,7 @@ function registerModels(program) {
|
|
|
5660
5661
|
);
|
|
5661
5662
|
}
|
|
5662
5663
|
} else {
|
|
5663
|
-
if (!target.path || !
|
|
5664
|
+
if (!target.path || !fs7.existsSync(target.path)) {
|
|
5664
5665
|
throw new CliError(
|
|
5665
5666
|
`model file not found at ${target.path || "(unknown path)"} \u2014 it may already be removed.`,
|
|
5666
5667
|
ExitCode.NOT_FOUND
|
|
@@ -5674,7 +5675,7 @@ function registerModels(program) {
|
|
|
5674
5675
|
}
|
|
5675
5676
|
if (!global.json) info(c.dim(` $ rm ${target.path}`));
|
|
5676
5677
|
try {
|
|
5677
|
-
|
|
5678
|
+
fs7.unlinkSync(target.path);
|
|
5678
5679
|
} catch (e) {
|
|
5679
5680
|
const msg = e instanceof Error ? e.message : String(e);
|
|
5680
5681
|
throw new CliError(`could not delete ${target.path}: ${msg}`, ExitCode.ERROR);
|
|
@@ -5813,8 +5814,8 @@ function registerModels(program) {
|
|
|
5813
5814
|
});
|
|
5814
5815
|
if (opts.out) {
|
|
5815
5816
|
const outPath = path37.resolve(opts.out);
|
|
5816
|
-
|
|
5817
|
-
|
|
5817
|
+
fs7.mkdirSync(path37.dirname(outPath), { recursive: true });
|
|
5818
|
+
fs7.writeFileSync(outPath, `${JSON.stringify(report, null, 2)}
|
|
5818
5819
|
`);
|
|
5819
5820
|
if (!global.json) info(c.dim(` wrote ${outPath}`));
|
|
5820
5821
|
}
|
|
@@ -6012,7 +6013,7 @@ function codeConfigPath(root2) {
|
|
|
6012
6013
|
}
|
|
6013
6014
|
function loadCodeConfig(root2) {
|
|
6014
6015
|
try {
|
|
6015
|
-
const raw = JSON.parse(
|
|
6016
|
+
const raw = JSON.parse(fs7.readFileSync(codeConfigPath(root2), "utf8"));
|
|
6016
6017
|
return sanitize(raw);
|
|
6017
6018
|
} catch {
|
|
6018
6019
|
return {};
|
|
@@ -6079,7 +6080,7 @@ function contextBudgetFor(config, modelContextWindow) {
|
|
|
6079
6080
|
var MCP_CONFIG_FILES = [".cursor/mcp.json", ".vscode/mcp.json", ".mcp.json"];
|
|
6080
6081
|
function readMcpServersFile(file) {
|
|
6081
6082
|
try {
|
|
6082
|
-
const raw = JSON.parse(
|
|
6083
|
+
const raw = JSON.parse(fs7.readFileSync(file, "utf8"));
|
|
6083
6084
|
const map = raw.mcpServers ?? raw.servers;
|
|
6084
6085
|
return map && typeof map === "object" ? parseMcpServers(map) : {};
|
|
6085
6086
|
} catch {
|
|
@@ -6119,7 +6120,7 @@ function registerCode(program) {
|
|
|
6119
6120
|
try {
|
|
6120
6121
|
const { parseMode: parseMode2, resolveMode: resolveMode2, readOrchestratorState: readOrchestratorState2, activePin: activePin2 } = await import('./model-orchestrator-LHYPJBFH.js');
|
|
6121
6122
|
const { gatherSystemMemory: gatherSystemMemory2 } = await import('./local-runtime-2ED33KK6.js');
|
|
6122
|
-
const { loadGraph: loadGraph2 } = await import('./load-
|
|
6123
|
+
const { loadGraph: loadGraph2 } = await import('./load-WKIZF2AK.js');
|
|
6123
6124
|
const state = readOrchestratorState2();
|
|
6124
6125
|
const mode = parseMode2(modeFlag) ?? state.defaultMode ?? void 0;
|
|
6125
6126
|
const pin = mode ? activePin2(mode, state) : null;
|
|
@@ -6203,7 +6204,7 @@ function registerCode(program) {
|
|
|
6203
6204
|
if (!(process.stdin.isTTY && process.stdout.isTTY)) {
|
|
6204
6205
|
throw usageError('say what to change, e.g. `vg code "add a --timeout flag to the scan command"` (guided mode needs an interactive terminal)');
|
|
6205
6206
|
}
|
|
6206
|
-
const { runInteractive } = await import('./interactive-
|
|
6207
|
+
const { runInteractive } = await import('./interactive-R5VQGDWP.js');
|
|
6207
6208
|
await runInteractive(
|
|
6208
6209
|
rootOf(global),
|
|
6209
6210
|
global,
|
|
@@ -6236,7 +6237,7 @@ function registerCode(program) {
|
|
|
6236
6237
|
let mockReply;
|
|
6237
6238
|
if (opts.mock) {
|
|
6238
6239
|
try {
|
|
6239
|
-
mockReply =
|
|
6240
|
+
mockReply = fs7.readFileSync(opts.mock, "utf8");
|
|
6240
6241
|
} catch {
|
|
6241
6242
|
throw new CliError(`couldn't read the --mock file: ${opts.mock}`, ExitCode.USAGE_ERROR);
|
|
6242
6243
|
}
|
|
@@ -6292,11 +6293,11 @@ function registerCode(program) {
|
|
|
6292
6293
|
const { loadOrDiscoverFederation } = await import('./federation-MDQPO3PW.js');
|
|
6293
6294
|
const { resolveExecutionEnv } = await import('./execution-env-4MS5AYAN.js');
|
|
6294
6295
|
const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-ELWF3Z6H.js');
|
|
6295
|
-
const { startCodeRuntimeSession } = await import('./runtime-session-
|
|
6296
|
+
const { startCodeRuntimeSession } = await import('./runtime-session-5NRB6BTR.js');
|
|
6296
6297
|
const { resolveGraphBackend } = await import('./graph-backend-GBL33GMW.js');
|
|
6297
6298
|
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
6298
6299
|
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
6299
|
-
const { vgdRequest: vgdRequest2 } = await import('./vgd-
|
|
6300
|
+
const { vgdRequest: vgdRequest2 } = await import('./vgd-KC5RCOP6.js');
|
|
6300
6301
|
const federation = loadOrDiscoverFederation(root2);
|
|
6301
6302
|
const modelProfile = mergeModelExecutionProfile(
|
|
6302
6303
|
resolveModelExecutionProfile({
|
|
@@ -6342,7 +6343,7 @@ ${res.stderr}` : ""),
|
|
|
6342
6343
|
exitCode: res.status ?? 1
|
|
6343
6344
|
};
|
|
6344
6345
|
};
|
|
6345
|
-
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-
|
|
6346
|
+
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-YXQS6HTO.js');
|
|
6346
6347
|
const vgBuiltin = createVgBuiltinMcpTools({
|
|
6347
6348
|
getGraph: () => graph,
|
|
6348
6349
|
root: root2,
|
|
@@ -6424,7 +6425,7 @@ ${res.stderr}` : ""),
|
|
|
6424
6425
|
if (!autonomous && !tty) {
|
|
6425
6426
|
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).");
|
|
6426
6427
|
}
|
|
6427
|
-
const { agentTask } = await import('./interactive-
|
|
6428
|
+
const { agentTask } = await import('./interactive-R5VQGDWP.js');
|
|
6428
6429
|
const { nodeCodeFs } = await import('./session-2JT4AUZT.js');
|
|
6429
6430
|
const { TtyPrompter } = await import('./ui-K7D3BCHD.js');
|
|
6430
6431
|
let priorSummary;
|
|
@@ -6434,7 +6435,7 @@ ${res.stderr}` : ""),
|
|
|
6434
6435
|
if (prev) priorSummary = summarizeSession(prev);
|
|
6435
6436
|
}
|
|
6436
6437
|
const prompter = tty ? new TtyPrompter() : void 0;
|
|
6437
|
-
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-
|
|
6438
|
+
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-YXQS6HTO.js');
|
|
6438
6439
|
const vgBuiltin = createVgBuiltinMcpTools({
|
|
6439
6440
|
getGraph: () => graph,
|
|
6440
6441
|
root: root2,
|
|
@@ -6458,11 +6459,11 @@ ${res.stderr}` : ""),
|
|
|
6458
6459
|
const { loadFederation } = await import('./federation-MDQPO3PW.js');
|
|
6459
6460
|
const { resolveExecutionEnv } = await import('./execution-env-4MS5AYAN.js');
|
|
6460
6461
|
const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-ELWF3Z6H.js');
|
|
6461
|
-
const { startCodeRuntimeSession } = await import('./runtime-session-
|
|
6462
|
+
const { startCodeRuntimeSession } = await import('./runtime-session-5NRB6BTR.js');
|
|
6462
6463
|
const { resolveGraphBackend } = await import('./graph-backend-GBL33GMW.js');
|
|
6463
6464
|
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
6464
6465
|
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
6465
|
-
const { vgdRequest: vgdRequest2 } = await import('./vgd-
|
|
6466
|
+
const { vgdRequest: vgdRequest2 } = await import('./vgd-KC5RCOP6.js');
|
|
6466
6467
|
const federation = loadFederation(root2);
|
|
6467
6468
|
const modelProfile = mergeModelExecutionProfile(
|
|
6468
6469
|
resolveModelExecutionProfile({
|
|
@@ -6554,7 +6555,7 @@ ${res.stderr}` : ""),
|
|
|
6554
6555
|
attribution: { client: "vg-code", provider: providerSlug, model: primary?.model }
|
|
6555
6556
|
});
|
|
6556
6557
|
if (opts.out) {
|
|
6557
|
-
|
|
6558
|
+
fs7.writeFileSync(opts.out, JSON.stringify(result, null, 2) + "\n");
|
|
6558
6559
|
}
|
|
6559
6560
|
if (global.json) {
|
|
6560
6561
|
json(result);
|
|
@@ -6767,7 +6768,7 @@ async function addCmd(root2, rest, opts, asJson) {
|
|
|
6767
6768
|
}
|
|
6768
6769
|
function readPackageVersion(root2) {
|
|
6769
6770
|
try {
|
|
6770
|
-
const pkg = JSON.parse(
|
|
6771
|
+
const pkg = JSON.parse(fs7__default.readFileSync(path37__default.join(root2, "package.json"), "utf8"));
|
|
6771
6772
|
return typeof pkg.version === "string" ? pkg.version : void 0;
|
|
6772
6773
|
} catch {
|
|
6773
6774
|
return void 0;
|
|
@@ -6775,7 +6776,7 @@ function readPackageVersion(root2) {
|
|
|
6775
6776
|
}
|
|
6776
6777
|
function readOptionalFile(p) {
|
|
6777
6778
|
try {
|
|
6778
|
-
const t =
|
|
6779
|
+
const t = fs7__default.readFileSync(p, "utf8");
|
|
6779
6780
|
return t.trim() ? t : void 0;
|
|
6780
6781
|
} catch {
|
|
6781
6782
|
return void 0;
|
|
@@ -6923,8 +6924,8 @@ function registerExport(program) {
|
|
|
6923
6924
|
out(content.trimEnd());
|
|
6924
6925
|
return;
|
|
6925
6926
|
}
|
|
6926
|
-
|
|
6927
|
-
|
|
6927
|
+
fs7.mkdirSync(path37.dirname(path37.resolve(file)), { recursive: true });
|
|
6928
|
+
fs7.writeFileSync(file, content);
|
|
6928
6929
|
info(`${c.green("\u2714")} wrote ${file} ${c.dim(`(${format})`)}`);
|
|
6929
6930
|
});
|
|
6930
6931
|
applyGlobalOptions(cmd);
|
|
@@ -6947,24 +6948,30 @@ function registerBundle(program) {
|
|
|
6947
6948
|
} catch {
|
|
6948
6949
|
throw new CliError("no grammars found to bundle (run a build first)", ExitCode.ERROR);
|
|
6949
6950
|
}
|
|
6950
|
-
|
|
6951
|
+
fs7.mkdirSync(path37.join(outDir, "grammars"), { recursive: true });
|
|
6951
6952
|
let grammarCount = 0;
|
|
6952
6953
|
for (const { fileName, absPath } of grammarFiles) {
|
|
6953
|
-
|
|
6954
|
+
fs7.copyFileSync(absPath, path37.join(outDir, "grammars", fileName));
|
|
6954
6955
|
grammarCount++;
|
|
6955
6956
|
}
|
|
6956
6957
|
const included = [`grammars/ (${grammarCount} .wasm)`];
|
|
6957
6958
|
const graphSrc = resolveGraphPath(root2, global.graph);
|
|
6958
|
-
if (
|
|
6959
|
-
|
|
6959
|
+
if (fs7.existsSync(graphSrc)) {
|
|
6960
|
+
fs7.copyFileSync(graphSrc, path37.join(outDir, "graph.json"));
|
|
6960
6961
|
included.push("graph.json");
|
|
6962
|
+
} else {
|
|
6963
|
+
const graph = loadGraphFileWithSnapshot(graphSrc);
|
|
6964
|
+
if (graph) {
|
|
6965
|
+
fs7.writeFileSync(path37.join(outDir, "graph.json"), serializeGraph(graph));
|
|
6966
|
+
included.push("graph.json");
|
|
6967
|
+
}
|
|
6961
6968
|
}
|
|
6962
6969
|
const cat = catalogPath(root2);
|
|
6963
|
-
if (
|
|
6964
|
-
|
|
6970
|
+
if (fs7.existsSync(cat)) {
|
|
6971
|
+
fs7.copyFileSync(cat, path37.join(outDir, "vibgrate.lib.json"));
|
|
6965
6972
|
included.push("vibgrate.lib.json");
|
|
6966
|
-
if (
|
|
6967
|
-
|
|
6973
|
+
if (fs7.existsSync(libDir(root2))) {
|
|
6974
|
+
fs7.cpSync(libDir(root2), path37.join(outDir, "lib"), { recursive: true });
|
|
6968
6975
|
included.push("lib/");
|
|
6969
6976
|
}
|
|
6970
6977
|
}
|
|
@@ -6976,7 +6983,7 @@ function registerBundle(program) {
|
|
|
6976
6983
|
included,
|
|
6977
6984
|
usage: "Run `vg build --grammars <this dir>/grammars` to build fully offline."
|
|
6978
6985
|
};
|
|
6979
|
-
|
|
6986
|
+
fs7.writeFileSync(path37.join(outDir, "MANIFEST.json"), `${stableStringify(manifest, 2)}
|
|
6980
6987
|
`);
|
|
6981
6988
|
if (global.json) {
|
|
6982
6989
|
json({ out: path37.relative(root2, outDir), ...manifest });
|
|
@@ -7002,7 +7009,7 @@ async function runDoctor(global) {
|
|
|
7002
7009
|
const root2 = rootOf(global);
|
|
7003
7010
|
const local = global.local === true;
|
|
7004
7011
|
const graphPath = resolveGraphPath(root2, global.graph);
|
|
7005
|
-
const configFile = CONFIG_BASENAMES.find((f) =>
|
|
7012
|
+
const configFile = CONFIG_BASENAMES.find((f) => fs7.existsSync(path37.join(root2, f))) ?? null;
|
|
7006
7013
|
const graph = loadGraph(root2, graphPath);
|
|
7007
7014
|
let staleFiles = null;
|
|
7008
7015
|
if (graph) {
|
|
@@ -7035,7 +7042,7 @@ async function runDoctor(global) {
|
|
|
7035
7042
|
},
|
|
7036
7043
|
libCatalog: {
|
|
7037
7044
|
path: path37.relative(root2, catalogPath(root2)),
|
|
7038
|
-
present:
|
|
7045
|
+
present: fs7.existsSync(catalogPath(root2)),
|
|
7039
7046
|
libraries: libCount
|
|
7040
7047
|
},
|
|
7041
7048
|
credentials: creds,
|
|
@@ -7296,7 +7303,7 @@ function registerDaemon(program) {
|
|
|
7296
7303
|
if (!await vgdIsRunning({ socketPath })) {
|
|
7297
7304
|
throw new CliError(`vgd is not running \u2014 start it with \`vg daemon ensure\` (${socketPath})`, ExitCode.NOT_FOUND);
|
|
7298
7305
|
}
|
|
7299
|
-
const { loadGraph: loadGraph2 } = await import('./load-
|
|
7306
|
+
const { loadGraph: loadGraph2 } = await import('./load-WKIZF2AK.js');
|
|
7300
7307
|
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
7301
7308
|
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
7302
7309
|
const opts = this.opts();
|
|
@@ -7513,7 +7520,7 @@ function registerPolicy(program) {
|
|
|
7513
7520
|
const global = readGlobal(this);
|
|
7514
7521
|
let raw;
|
|
7515
7522
|
try {
|
|
7516
|
-
raw =
|
|
7523
|
+
raw = fs7.readFileSync(file, "utf8");
|
|
7517
7524
|
} catch {
|
|
7518
7525
|
throw new CliError(`cannot read ${file}`, ExitCode.NOT_FOUND);
|
|
7519
7526
|
}
|
|
@@ -7645,7 +7652,7 @@ var initCommand = new Command("init").description("Initialize vibgrate in a proj
|
|
|
7645
7652
|
console.log(chalk7.green("\u2714") + ` Created ${chalk7.bold("vibgrate.config.ts")}`);
|
|
7646
7653
|
}
|
|
7647
7654
|
if (opts.baseline) {
|
|
7648
|
-
const { runBaseline } = await import('./baseline-
|
|
7655
|
+
const { runBaseline } = await import('./baseline-MROWBNK7.js');
|
|
7649
7656
|
await runBaseline(rootDir);
|
|
7650
7657
|
}
|
|
7651
7658
|
console.log("");
|
|
@@ -7755,9 +7762,9 @@ async function fileReferencesIdentifier(rootDir, relFile, identifier, readFile3)
|
|
|
7755
7762
|
}
|
|
7756
7763
|
async function defaultReadFile(absPath) {
|
|
7757
7764
|
try {
|
|
7758
|
-
const stat2 = await
|
|
7765
|
+
const stat2 = await fs20.stat(absPath);
|
|
7759
7766
|
if (!stat2.isFile() || stat2.size > MAX_FILE_BYTES) return null;
|
|
7760
|
-
return await
|
|
7767
|
+
return await fs20.readFile(absPath, "utf8");
|
|
7761
7768
|
} catch {
|
|
7762
7769
|
return null;
|
|
7763
7770
|
}
|
|
@@ -8404,7 +8411,7 @@ var SKIP_DIRS2 = /* @__PURE__ */ new Set([
|
|
|
8404
8411
|
function scanStaleness(rootDir, artifactPath) {
|
|
8405
8412
|
let ref;
|
|
8406
8413
|
try {
|
|
8407
|
-
ref =
|
|
8414
|
+
ref = fs7.statSync(artifactPath).mtimeMs;
|
|
8408
8415
|
} catch {
|
|
8409
8416
|
return { stale: false };
|
|
8410
8417
|
}
|
|
@@ -8416,7 +8423,7 @@ function scanStaleness(rootDir, artifactPath) {
|
|
|
8416
8423
|
if (depth > 8 || scanned > MAX_ENTRIES) return;
|
|
8417
8424
|
let entries;
|
|
8418
8425
|
try {
|
|
8419
|
-
entries =
|
|
8426
|
+
entries = fs7.readdirSync(dir, { withFileTypes: true });
|
|
8420
8427
|
} catch {
|
|
8421
8428
|
return;
|
|
8422
8429
|
}
|
|
@@ -8431,7 +8438,7 @@ function scanStaleness(rootDir, artifactPath) {
|
|
|
8431
8438
|
const abs = path37.join(dir, e.name);
|
|
8432
8439
|
let mtimeMs;
|
|
8433
8440
|
try {
|
|
8434
|
-
mtimeMs =
|
|
8441
|
+
mtimeMs = fs7.statSync(abs).mtimeMs;
|
|
8435
8442
|
} catch {
|
|
8436
8443
|
continue;
|
|
8437
8444
|
}
|
|
@@ -8568,7 +8575,7 @@ function analyzeTree(root2, packages) {
|
|
|
8568
8575
|
if (depth > MAX_DEPTH || filesSeen >= MAX_FILES) return;
|
|
8569
8576
|
let entries;
|
|
8570
8577
|
try {
|
|
8571
|
-
entries =
|
|
8578
|
+
entries = fs7.readdirSync(dir, { withFileTypes: true });
|
|
8572
8579
|
} catch {
|
|
8573
8580
|
return;
|
|
8574
8581
|
}
|
|
@@ -8586,8 +8593,8 @@ function analyzeTree(root2, packages) {
|
|
|
8586
8593
|
const full = path37.join(dir, entry.name);
|
|
8587
8594
|
let content;
|
|
8588
8595
|
try {
|
|
8589
|
-
if (
|
|
8590
|
-
content =
|
|
8596
|
+
if (fs7.statSync(full).size > MAX_FILE_BYTES2) continue;
|
|
8597
|
+
content = fs7.readFileSync(full, "utf8");
|
|
8591
8598
|
} catch {
|
|
8592
8599
|
continue;
|
|
8593
8600
|
}
|
|
@@ -8955,8 +8962,8 @@ async function fetchLatestVersion() {
|
|
|
8955
8962
|
}
|
|
8956
8963
|
async function writeCache(data) {
|
|
8957
8964
|
try {
|
|
8958
|
-
await
|
|
8959
|
-
await
|
|
8965
|
+
await fs20.mkdir(CACHE_DIR, { recursive: true });
|
|
8966
|
+
await fs20.writeFile(CACHE_FILE, JSON.stringify(data), "utf-8");
|
|
8960
8967
|
} catch {
|
|
8961
8968
|
}
|
|
8962
8969
|
}
|
|
@@ -8967,7 +8974,7 @@ function detectGlobalInstall(execPath = process.argv[1] || "", cwd = process.cwd
|
|
|
8967
8974
|
if (!execPath) return null;
|
|
8968
8975
|
let resolved = execPath;
|
|
8969
8976
|
try {
|
|
8970
|
-
resolved =
|
|
8977
|
+
resolved = fs7.realpathSync(execPath);
|
|
8971
8978
|
} catch {
|
|
8972
8979
|
}
|
|
8973
8980
|
const p = resolved.replace(/\\/g, "/");
|
|
@@ -11655,17 +11662,17 @@ function resolveSigningKey(root2, explicit) {
|
|
|
11655
11662
|
const chosen = process.env.VG_ATTEST_KEY;
|
|
11656
11663
|
const keyPath = chosen ? path37.resolve(chosen) : path37.join(root2, ".vibgrate", DEFAULT_KEY);
|
|
11657
11664
|
let minted = false;
|
|
11658
|
-
if (!
|
|
11665
|
+
if (!fs7.existsSync(keyPath)) {
|
|
11659
11666
|
if (chosen) throw new CliError(`signing key not found: ${chosen}`, ExitCode.USAGE_ERROR);
|
|
11660
11667
|
const kp = generateKeypair();
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11668
|
+
fs7.mkdirSync(path37.dirname(keyPath), { recursive: true });
|
|
11669
|
+
fs7.writeFileSync(keyPath, kp.privatePem, { mode: 384 });
|
|
11670
|
+
fs7.writeFileSync(`${keyPath}.pub`, kp.publicPem);
|
|
11664
11671
|
minted = true;
|
|
11665
11672
|
}
|
|
11666
11673
|
let key2;
|
|
11667
11674
|
try {
|
|
11668
|
-
key2 = crypto3.createPrivateKey(
|
|
11675
|
+
key2 = crypto3.createPrivateKey(fs7.readFileSync(keyPath, "utf8"));
|
|
11669
11676
|
} catch {
|
|
11670
11677
|
throw new CliError(`could not read an Ed25519 private key from ${keyPath}`, ExitCode.USAGE_ERROR);
|
|
11671
11678
|
}
|
|
@@ -11676,8 +11683,8 @@ function resolveSigningKey(root2, explicit) {
|
|
|
11676
11683
|
}
|
|
11677
11684
|
function writeBundle(input) {
|
|
11678
11685
|
const dir = input.outDir;
|
|
11679
|
-
|
|
11680
|
-
const write = (rel, data) =>
|
|
11686
|
+
fs7.mkdirSync(path37.join(dir, "inputs", "releases"), { recursive: true });
|
|
11687
|
+
const write = (rel, data) => fs7.writeFileSync(path37.join(dir, rel), `${JSON.stringify(data, null, 2)}
|
|
11681
11688
|
`);
|
|
11682
11689
|
write("result.json", input.result);
|
|
11683
11690
|
write(path37.join("inputs", "advisory.json"), input.advisory);
|
|
@@ -11701,13 +11708,13 @@ function writeBundle(input) {
|
|
|
11701
11708
|
disclaimer: input.regime.disclaimer
|
|
11702
11709
|
});
|
|
11703
11710
|
if (input.envelope) {
|
|
11704
|
-
|
|
11711
|
+
fs7.writeFileSync(path37.join(dir, "evidence.intoto.jsonl"), `${JSON.stringify(input.envelope)}
|
|
11705
11712
|
`);
|
|
11706
11713
|
}
|
|
11707
11714
|
if (input.timestampToken) {
|
|
11708
|
-
|
|
11715
|
+
fs7.writeFileSync(path37.join(dir, "timestamp.tsr"), input.timestampToken);
|
|
11709
11716
|
}
|
|
11710
|
-
|
|
11717
|
+
fs7.writeFileSync(path37.join(dir, "VERIFY.md"), verifyDoc(input));
|
|
11711
11718
|
return dir;
|
|
11712
11719
|
}
|
|
11713
11720
|
function verifyDoc(input) {
|
|
@@ -12050,7 +12057,7 @@ var packCmd = new Command("pack").description("Build the submission pack a human
|
|
|
12050
12057
|
const stage = opts.stage ?? regime.clocks[0]?.stage ?? "early-warning";
|
|
12051
12058
|
const md = buildPack(result, regime, org, stage);
|
|
12052
12059
|
if (opts.out) {
|
|
12053
|
-
|
|
12060
|
+
fs7.writeFileSync(path37.resolve(rootDir, opts.out), md);
|
|
12054
12061
|
console.error(chalk7.green("\u2714") + ` pack written to ${opts.out}`);
|
|
12055
12062
|
} else {
|
|
12056
12063
|
console.log(md);
|
|
@@ -12093,19 +12100,19 @@ var drillCmd = new Command("drill").description("Timed dry-run of the determinat
|
|
|
12093
12100
|
});
|
|
12094
12101
|
var verifyCmd = new Command("verify").description("Verify an evidence bundle offline (no Vibgrate needed)").argument("<bundle>", "Path to an evidence bundle directory or evidence.intoto.jsonl").option("--pub <file>", "Public key PEM to pin the signer (establish trust)").action((bundlePath, opts) => {
|
|
12095
12102
|
const abs = path37.resolve(bundlePath);
|
|
12096
|
-
const envPath =
|
|
12097
|
-
if (!
|
|
12098
|
-
const envelope = JSON.parse(
|
|
12103
|
+
const envPath = fs7.statSync(abs).isDirectory() ? path37.join(abs, "evidence.intoto.jsonl") : abs;
|
|
12104
|
+
if (!fs7.existsSync(envPath)) throw new CliError(`no evidence.intoto.jsonl at ${bundlePath}`, ExitCode.NOT_FOUND);
|
|
12105
|
+
const envelope = JSON.parse(fs7.readFileSync(envPath, "utf8").trim().split("\n")[0]);
|
|
12099
12106
|
const resultPath = path37.join(path37.dirname(envPath), "result.json");
|
|
12100
|
-
const result =
|
|
12101
|
-
const publicKeyPem = opts.pub ?
|
|
12107
|
+
const result = fs7.existsSync(resultPath) ? JSON.parse(fs7.readFileSync(resultPath, "utf8")) : void 0;
|
|
12108
|
+
const publicKeyPem = opts.pub ? fs7.readFileSync(path37.resolve(opts.pub), "utf8") : void 0;
|
|
12102
12109
|
const v = verifyEvidenceEnvelope(envelope, { publicKeyPem, result });
|
|
12103
12110
|
const color = v.status === "verified" ? chalk7.green : v.status === "failed" ? chalk7.red : chalk7.yellow;
|
|
12104
12111
|
console.log(" " + color(v.status.toUpperCase()) + ` ${v.reason}`);
|
|
12105
12112
|
if (v.evidenceId) console.log(" " + chalk7.dim(`evidence ${v.evidenceId} \xB7 regime ${v.regime} \xB7 advisory ${v.advisoryId} \xB7 ${v.overallStatus}`));
|
|
12106
12113
|
const tsrPath = path37.join(path37.dirname(envPath), "timestamp.tsr");
|
|
12107
|
-
if (
|
|
12108
|
-
const t = verifyTimestamp(
|
|
12114
|
+
if (fs7.existsSync(tsrPath) && result) {
|
|
12115
|
+
const t = verifyTimestamp(fs7.readFileSync(tsrPath), exposureSubjectDigest(result));
|
|
12109
12116
|
const tcolor = t.imprintMatches ? chalk7.green : chalk7.red;
|
|
12110
12117
|
console.log(" " + tcolor("TIMESTAMP") + ` ${t.reason}`);
|
|
12111
12118
|
}
|
|
@@ -12204,9 +12211,9 @@ var pushCmd = new Command("push").description("Push the product registry (and an
|
|
|
12204
12211
|
let exposure;
|
|
12205
12212
|
if (opts.result) {
|
|
12206
12213
|
const raw = path37.resolve(rootDir, opts.result);
|
|
12207
|
-
const resultPath =
|
|
12208
|
-
if (!
|
|
12209
|
-
exposure = JSON.parse(
|
|
12214
|
+
const resultPath = fs7.existsSync(raw) && fs7.statSync(raw).isDirectory() ? path37.join(raw, "result.json") : raw;
|
|
12215
|
+
if (!fs7.existsSync(resultPath)) throw new CliError(`no result.json at ${opts.result}`, ExitCode.NOT_FOUND);
|
|
12216
|
+
exposure = JSON.parse(fs7.readFileSync(resultPath, "utf8"));
|
|
12210
12217
|
}
|
|
12211
12218
|
const payload = { schemaVersion: "evidence-push-1", regime: regime.id, generatedAt: nowIso(), signed: Boolean(opts.signed), products: productPayload, exposure };
|
|
12212
12219
|
const body = JSON.stringify(payload);
|
|
@@ -12396,7 +12403,7 @@ function dispatch(argv, cwd) {
|
|
|
12396
12403
|
}
|
|
12397
12404
|
const looksLikeQuestion = /\s/.test(first) || first.endsWith("?");
|
|
12398
12405
|
if (looksLikeQuestion) return ["ask", ...args];
|
|
12399
|
-
if (
|
|
12406
|
+
if (fs7.existsSync(path37.resolve(cwd, first))) {
|
|
12400
12407
|
return [hasBuildOnlyFlag(args) ? "build" : "scan", ...args];
|
|
12401
12408
|
}
|
|
12402
12409
|
const moved = MOVED_COMMANDS[first];
|