@vibgrate/cli 2026.728.5 → 2026.729.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/baseline-UOTGTJYT.js +9 -0
- package/dist/{baseline-Y5FBYWNJ.js.map → baseline-UOTGTJYT.js.map} +1 -1
- package/dist/{chunk-VBVY733D.js → chunk-67YG3R5F.js} +3 -3
- package/dist/{chunk-VBVY733D.js.map → chunk-67YG3R5F.js.map} +1 -1
- package/dist/{chunk-EVWW3BPM.js → chunk-74ZMAOVF.js} +3 -3
- package/dist/{chunk-EVWW3BPM.js.map → chunk-74ZMAOVF.js.map} +1 -1
- package/dist/{chunk-RCP2KQGG.js → chunk-CYC3ZI32.js} +5 -5
- package/dist/{chunk-RCP2KQGG.js.map → chunk-CYC3ZI32.js.map} +1 -1
- package/dist/{chunk-SGI5ZP2Y.js → chunk-F6ZPUKED.js} +3 -3
- package/dist/{chunk-SGI5ZP2Y.js.map → chunk-F6ZPUKED.js.map} +1 -1
- package/dist/{chunk-4JD63RUR.js → chunk-HDQG3QYV.js} +8 -7
- package/dist/chunk-HDQG3QYV.js.map +1 -0
- package/dist/{chunk-RYNAK4LK.js → chunk-P3QIO4ZU.js} +178 -39
- package/dist/chunk-P3QIO4ZU.js.map +1 -0
- package/dist/{chunk-NH5NJ3UO.js → chunk-PXXVLX7K.js} +7 -7
- package/dist/chunk-PXXVLX7K.js.map +1 -0
- package/dist/{chunk-643KXZ54.js → chunk-QDZ47G45.js} +6 -5
- package/dist/chunk-QDZ47G45.js.map +1 -0
- package/dist/{chunk-DBOT2ELH.js → chunk-VZRQUI54.js} +3 -3
- package/dist/{chunk-DBOT2ELH.js.map → chunk-VZRQUI54.js.map} +1 -1
- package/dist/chunk-WQE4OIZS.js +6 -0
- package/dist/chunk-WQE4OIZS.js.map +1 -0
- package/dist/cli.js +166 -144
- 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-HLGJJFLI.js} +11 -10
- package/dist/interactive-HLGJJFLI.js.map +1 -0
- package/dist/load-4MLIHGXF.js +9 -0
- package/dist/{load-SEFJA3M5.js.map → load-4MLIHGXF.js.map} +1 -1
- package/dist/{runtime-session-4IACVDSY.js → runtime-session-5M6QZZOS.js} +6 -5
- package/dist/{runtime-session-4IACVDSY.js.map → runtime-session-5M6QZZOS.js.map} +1 -1
- package/dist/{vg-mcp-bridge-B35WCSAS.js → vg-mcp-bridge-ZCKBYQ2D.js} +5 -4
- package/dist/vg-mcp-bridge-ZCKBYQ2D.js.map +1 -0
- package/dist/{vgd-KDQFS33M.js → vgd-TGGEAGQZ.js} +5 -4
- package/dist/vgd-TGGEAGQZ.js.map +1 -0
- 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/vgd-KDQFS33M.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-QDZ47G45.js';
|
|
3
|
+
export { runBuild } from './chunk-QDZ47G45.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-F6ZPUKED.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-74ZMAOVF.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-PXXVLX7K.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-CYC3ZI32.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-67YG3R5F.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-HDQG3QYV.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-P3QIO4ZU.js';
|
|
40
|
+
import { VERSION } from './chunk-WQE4OIZS.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';
|
|
@@ -52,11 +53,12 @@ import { Command, CommanderError, Option } from 'commander';
|
|
|
52
53
|
import * as os from 'os';
|
|
53
54
|
import * as crypto3 from 'crypto';
|
|
54
55
|
import { randomUUID } from 'crypto';
|
|
56
|
+
import * as semver3 from 'semver';
|
|
57
|
+
import semver3__default from 'semver';
|
|
55
58
|
import { execSync, spawn, spawnSync, execFileSync } from 'child_process';
|
|
56
59
|
import * as readline from 'readline';
|
|
57
60
|
import chalk7 from 'chalk';
|
|
58
|
-
import * as
|
|
59
|
-
import semver2 from 'semver';
|
|
61
|
+
import * as fs20 from 'fs/promises';
|
|
60
62
|
|
|
61
63
|
init_cli_invocation();
|
|
62
64
|
function registerStatus(program) {
|
|
@@ -69,7 +71,7 @@ async function runStatus(global) {
|
|
|
69
71
|
const root2 = path37.resolve(global.cwd ?? ".");
|
|
70
72
|
const graphPath = resolveGraphPath(root2, global.graph);
|
|
71
73
|
const graph = loadGraph(root2, graphPath);
|
|
72
|
-
const hasCache =
|
|
74
|
+
const hasCache = fs7.existsSync(path37.join(cacheDir(root2), "parse-cache.json"));
|
|
73
75
|
let stale = null;
|
|
74
76
|
let staleExact = false;
|
|
75
77
|
if (graph) {
|
|
@@ -866,14 +868,14 @@ function isCI(env = process.env) {
|
|
|
866
868
|
function installId(env = process.env) {
|
|
867
869
|
if (telemetryOptOut(env) !== null || isCI(env)) return randomUuid();
|
|
868
870
|
try {
|
|
869
|
-
const existing =
|
|
871
|
+
const existing = fs7.readFileSync(INSTALL_ID_FILE, "utf8").trim();
|
|
870
872
|
if (isUuid(existing)) return existing;
|
|
871
873
|
} catch {
|
|
872
874
|
}
|
|
873
875
|
const id = randomUuid();
|
|
874
876
|
try {
|
|
875
|
-
|
|
876
|
-
|
|
877
|
+
fs7.mkdirSync(INSTALL_ID_DIR, { recursive: true });
|
|
878
|
+
fs7.writeFileSync(INSTALL_ID_FILE, id + "\n", { mode: 384 });
|
|
877
879
|
} catch {
|
|
878
880
|
}
|
|
879
881
|
return id;
|
|
@@ -897,7 +899,7 @@ function ledgerFilePath(root2) {
|
|
|
897
899
|
}
|
|
898
900
|
function readOffset(root2) {
|
|
899
901
|
try {
|
|
900
|
-
const raw = JSON.parse(
|
|
902
|
+
const raw = JSON.parse(fs7.readFileSync(offsetPath(root2), "utf8"));
|
|
901
903
|
return typeof raw.offset === "number" && raw.offset >= 0 ? raw.offset : 0;
|
|
902
904
|
} catch {
|
|
903
905
|
return 0;
|
|
@@ -905,8 +907,8 @@ function readOffset(root2) {
|
|
|
905
907
|
}
|
|
906
908
|
function writeOffset(root2, offset) {
|
|
907
909
|
try {
|
|
908
|
-
|
|
909
|
-
|
|
910
|
+
fs7.mkdirSync(cacheDir(root2), { recursive: true });
|
|
911
|
+
fs7.writeFileSync(offsetPath(root2), JSON.stringify({ offset }) + "\n");
|
|
910
912
|
} catch {
|
|
911
913
|
}
|
|
912
914
|
}
|
|
@@ -914,7 +916,7 @@ function buildBatch(root2, fromOffset, id = installId()) {
|
|
|
914
916
|
const file = ledgerFilePath(root2);
|
|
915
917
|
let size = 0;
|
|
916
918
|
try {
|
|
917
|
-
size =
|
|
919
|
+
size = fs7.statSync(file).size;
|
|
918
920
|
} catch {
|
|
919
921
|
return { batch: null, newOffset: 0 };
|
|
920
922
|
}
|
|
@@ -922,13 +924,13 @@ function buildBatch(root2, fromOffset, id = installId()) {
|
|
|
922
924
|
if (start >= size) return { batch: null, newOffset: size };
|
|
923
925
|
let text = "";
|
|
924
926
|
try {
|
|
925
|
-
const fd =
|
|
927
|
+
const fd = fs7.openSync(file, "r");
|
|
926
928
|
try {
|
|
927
929
|
const buf = Buffer.alloc(size - start);
|
|
928
|
-
|
|
930
|
+
fs7.readSync(fd, buf, 0, buf.length, start);
|
|
929
931
|
text = buf.toString("utf8");
|
|
930
932
|
} finally {
|
|
931
|
-
|
|
933
|
+
fs7.closeSync(fd);
|
|
932
934
|
}
|
|
933
935
|
} catch {
|
|
934
936
|
return { batch: null, newOffset: fromOffset };
|
|
@@ -1069,7 +1071,7 @@ function liveStatsDir(root2) {
|
|
|
1069
1071
|
function reapOtherVersionServers(dir, keepVersion, now = Date.now(), kill = (pid, signal) => process.kill(pid, signal), selfPid = process.pid) {
|
|
1070
1072
|
let entries;
|
|
1071
1073
|
try {
|
|
1072
|
-
entries =
|
|
1074
|
+
entries = fs7.readdirSync(dir);
|
|
1073
1075
|
} catch {
|
|
1074
1076
|
return [];
|
|
1075
1077
|
}
|
|
@@ -1078,7 +1080,7 @@ function reapOtherVersionServers(dir, keepVersion, now = Date.now(), kill = (pid
|
|
|
1078
1080
|
if (!/^serve-\d+\.json$/.test(name)) continue;
|
|
1079
1081
|
let parsed;
|
|
1080
1082
|
try {
|
|
1081
|
-
parsed = JSON.parse(
|
|
1083
|
+
parsed = JSON.parse(fs7.readFileSync(path37.join(dir, name), "utf8"));
|
|
1082
1084
|
} catch {
|
|
1083
1085
|
continue;
|
|
1084
1086
|
}
|
|
@@ -1132,10 +1134,10 @@ var LiveStatsBus = class {
|
|
|
1132
1134
|
this.lastWriteAt = now;
|
|
1133
1135
|
const body = { pid: this.pid, updatedAt: now, version: VERSION, snapshot: snap };
|
|
1134
1136
|
try {
|
|
1135
|
-
|
|
1137
|
+
fs7.mkdirSync(this.dir, { recursive: true });
|
|
1136
1138
|
const tmp = `${this.file}.tmp`;
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
+
fs7.writeFileSync(tmp, JSON.stringify(body));
|
|
1140
|
+
fs7.renameSync(tmp, this.file);
|
|
1139
1141
|
} catch {
|
|
1140
1142
|
}
|
|
1141
1143
|
}
|
|
@@ -1146,7 +1148,7 @@ var LiveStatsBus = class {
|
|
|
1146
1148
|
siblings(now = Date.now()) {
|
|
1147
1149
|
let entries;
|
|
1148
1150
|
try {
|
|
1149
|
-
entries =
|
|
1151
|
+
entries = fs7.readdirSync(this.dir);
|
|
1150
1152
|
} catch {
|
|
1151
1153
|
return [];
|
|
1152
1154
|
}
|
|
@@ -1156,14 +1158,14 @@ var LiveStatsBus = class {
|
|
|
1156
1158
|
const file = path37.join(this.dir, name);
|
|
1157
1159
|
let parsed;
|
|
1158
1160
|
try {
|
|
1159
|
-
parsed = JSON.parse(
|
|
1161
|
+
parsed = JSON.parse(fs7.readFileSync(file, "utf8"));
|
|
1160
1162
|
} catch {
|
|
1161
1163
|
continue;
|
|
1162
1164
|
}
|
|
1163
1165
|
if (typeof parsed?.pid !== "number" || typeof parsed.updatedAt !== "number" || !parsed.snapshot?.totals) continue;
|
|
1164
1166
|
if (now - parsed.updatedAt > STALE_MS) {
|
|
1165
1167
|
try {
|
|
1166
|
-
|
|
1168
|
+
fs7.unlinkSync(file);
|
|
1167
1169
|
} catch {
|
|
1168
1170
|
}
|
|
1169
1171
|
continue;
|
|
@@ -1175,7 +1177,7 @@ var LiveStatsBus = class {
|
|
|
1175
1177
|
}
|
|
1176
1178
|
unlinkOwn = () => {
|
|
1177
1179
|
try {
|
|
1178
|
-
|
|
1180
|
+
fs7.unlinkSync(this.file);
|
|
1179
1181
|
} catch {
|
|
1180
1182
|
}
|
|
1181
1183
|
};
|
|
@@ -1488,12 +1490,12 @@ var LedgerTail = class {
|
|
|
1488
1490
|
if (size === this.offset) return;
|
|
1489
1491
|
let chunk;
|
|
1490
1492
|
try {
|
|
1491
|
-
const fd =
|
|
1493
|
+
const fd = fs7.openSync(this.file, "r");
|
|
1492
1494
|
try {
|
|
1493
1495
|
chunk = Buffer.alloc(size - this.offset);
|
|
1494
|
-
|
|
1496
|
+
fs7.readSync(fd, chunk, 0, chunk.length, this.offset);
|
|
1495
1497
|
} finally {
|
|
1496
|
-
|
|
1498
|
+
fs7.closeSync(fd);
|
|
1497
1499
|
}
|
|
1498
1500
|
} catch {
|
|
1499
1501
|
return;
|
|
@@ -1506,7 +1508,7 @@ var LedgerTail = class {
|
|
|
1506
1508
|
}
|
|
1507
1509
|
sizeOf() {
|
|
1508
1510
|
try {
|
|
1509
|
-
return
|
|
1511
|
+
return fs7.statSync(this.file).size;
|
|
1510
1512
|
} catch {
|
|
1511
1513
|
return 0;
|
|
1512
1514
|
}
|
|
@@ -1589,7 +1591,7 @@ function registerServe(program) {
|
|
|
1589
1591
|
}
|
|
1590
1592
|
async function ensureServableGraph(root2, graphPath, global, refresh, opts = {}) {
|
|
1591
1593
|
if (refresh) {
|
|
1592
|
-
if (!
|
|
1594
|
+
if (!mapFileExists(graphPath)) {
|
|
1593
1595
|
info(c.dim("vg \xB7 no map found \u2014 building it before serving\u2026"));
|
|
1594
1596
|
await runBuild(
|
|
1595
1597
|
[],
|
|
@@ -1615,7 +1617,7 @@ async function ensureServableGraph(root2, graphPath, global, refresh, opts = {})
|
|
|
1615
1617
|
if (opts.awaitStaleRefresh) await kick;
|
|
1616
1618
|
}
|
|
1617
1619
|
}
|
|
1618
|
-
if (!
|
|
1620
|
+
if (!mapFileExists(graphPath)) {
|
|
1619
1621
|
throw new CliError(
|
|
1620
1622
|
`no map found at ${graphPath} \u2014 run \`vg\` to build one first`,
|
|
1621
1623
|
ExitCode.NOT_FOUND
|
|
@@ -1898,7 +1900,7 @@ function manifestHash(root2) {
|
|
|
1898
1900
|
const walk2 = (dir) => {
|
|
1899
1901
|
let entries;
|
|
1900
1902
|
try {
|
|
1901
|
-
entries =
|
|
1903
|
+
entries = fs7.readdirSync(dir, { withFileTypes: true });
|
|
1902
1904
|
} catch {
|
|
1903
1905
|
return;
|
|
1904
1906
|
}
|
|
@@ -1914,7 +1916,7 @@ function manifestHash(root2) {
|
|
|
1914
1916
|
if (!isManifest(abs) && !SKIP_FILES.has(base)) continue;
|
|
1915
1917
|
try {
|
|
1916
1918
|
const rel = path37.relative(root2, abs).split(path37.sep).join("/");
|
|
1917
|
-
files.push({ rel, hash: hashBytes(
|
|
1919
|
+
files.push({ rel, hash: hashBytes(fs7.readFileSync(abs)) });
|
|
1918
1920
|
} catch {
|
|
1919
1921
|
}
|
|
1920
1922
|
}
|
|
@@ -1933,7 +1935,7 @@ function isDependencyFile(root2, filePath) {
|
|
|
1933
1935
|
}
|
|
1934
1936
|
function loadScanCache(root2, key2) {
|
|
1935
1937
|
try {
|
|
1936
|
-
const raw = JSON.parse(
|
|
1938
|
+
const raw = JSON.parse(fs7.readFileSync(cachePath(root2), "utf8"));
|
|
1937
1939
|
if (raw.version === CACHE_VERSION && raw.manifestHash === key2.manifestHash && raw.toolVersion === key2.toolVersion && raw.offline === key2.offline && raw.artifact) {
|
|
1938
1940
|
return { manifestHash: raw.manifestHash, artifact: raw.artifact };
|
|
1939
1941
|
}
|
|
@@ -1943,8 +1945,8 @@ function loadScanCache(root2, key2) {
|
|
|
1943
1945
|
}
|
|
1944
1946
|
function writeScanCache(root2, key2, artifact) {
|
|
1945
1947
|
try {
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
+
fs7.mkdirSync(cacheDir(root2), { recursive: true });
|
|
1949
|
+
fs7.writeFileSync(
|
|
1948
1950
|
cachePath(root2),
|
|
1949
1951
|
stableStringify(
|
|
1950
1952
|
{ version: CACHE_VERSION, manifestHash: key2.manifestHash, toolVersion: key2.toolVersion, offline: key2.offline, artifact },
|
|
@@ -2758,7 +2760,7 @@ var VibgrateLanguageServer = class {
|
|
|
2758
2760
|
const absManifest = path37.resolve(this.opts.root, relManifest);
|
|
2759
2761
|
let text = null;
|
|
2760
2762
|
try {
|
|
2761
|
-
if (
|
|
2763
|
+
if (fs7.existsSync(absManifest)) text = fs7.readFileSync(absManifest, "utf8");
|
|
2762
2764
|
} catch {
|
|
2763
2765
|
text = null;
|
|
2764
2766
|
}
|
|
@@ -2977,9 +2979,19 @@ function osvEcosystem(type) {
|
|
|
2977
2979
|
return null;
|
|
2978
2980
|
}
|
|
2979
2981
|
}
|
|
2982
|
+
function inRangeStep(dep) {
|
|
2983
|
+
const target = dep.latestSatisfying;
|
|
2984
|
+
if (!target || !dep.resolvedVersion) return null;
|
|
2985
|
+
if (!semver3.valid(target) || !semver3.valid(dep.resolvedVersion)) return null;
|
|
2986
|
+
if (!semver3.gt(target, dep.resolvedVersion)) return null;
|
|
2987
|
+
const diff2 = semver3.diff(dep.resolvedVersion, target);
|
|
2988
|
+
return { version: target, size: diff2 === "patch" || diff2 === "prepatch" ? "patch" : "minor" };
|
|
2989
|
+
}
|
|
2980
2990
|
function inlineLabel(dep) {
|
|
2981
2991
|
const bits = [];
|
|
2982
2992
|
if (dep.drift === "major-behind") {
|
|
2993
|
+
const step2 = inRangeStep(dep);
|
|
2994
|
+
if (step2) bits.push(`${step2.size} behind`, step2.version);
|
|
2983
2995
|
const n = dep.majorsBehind ?? 1;
|
|
2984
2996
|
bits.push(`${n} major behind`);
|
|
2985
2997
|
} else if (dep.drift === "minor-behind") {
|
|
@@ -3024,6 +3036,10 @@ function hoverMarkdown(dep, contribution) {
|
|
|
3024
3036
|
lines.push(`| | |`);
|
|
3025
3037
|
lines.push(`|---|---|`);
|
|
3026
3038
|
lines.push(`| yours | \`${yours}\` |`);
|
|
3039
|
+
const step2 = inRangeStep(dep);
|
|
3040
|
+
if (step2 && step2.version !== dep.latestStable) {
|
|
3041
|
+
lines.push(`| latest in range | \`${step2.version}\` |`);
|
|
3042
|
+
}
|
|
3027
3043
|
lines.push(`| latest | \`${dep.latestStable}\` |`);
|
|
3028
3044
|
const journey = versionJourney(yours, dep.latestStable);
|
|
3029
3045
|
if (journey) lines.push(`| journey | ${journey} |`);
|
|
@@ -3063,7 +3079,7 @@ function hoverMarkdown(dep, contribution) {
|
|
|
3063
3079
|
return lines.join("\n");
|
|
3064
3080
|
}
|
|
3065
3081
|
function startLanguageServer(opts) {
|
|
3066
|
-
if (!
|
|
3082
|
+
if (!fs7.existsSync(opts.root)) {
|
|
3067
3083
|
process.stderr.write(`vg lsp: root does not exist: ${opts.root}
|
|
3068
3084
|
`);
|
|
3069
3085
|
process.exit(1);
|
|
@@ -3201,7 +3217,7 @@ function registerShare(program) {
|
|
|
3201
3217
|
const global = readGlobal(this);
|
|
3202
3218
|
const root2 = rootOf(global);
|
|
3203
3219
|
const gitDir = path37.join(root2, ".git");
|
|
3204
|
-
if (!
|
|
3220
|
+
if (!fs7.existsSync(gitDir)) {
|
|
3205
3221
|
throw new CliError("not a git repository \u2014 run `vg share` inside a git repo", ExitCode.USAGE_ERROR);
|
|
3206
3222
|
}
|
|
3207
3223
|
if (opts.undo) {
|
|
@@ -3223,22 +3239,22 @@ function registerShare(program) {
|
|
|
3223
3239
|
}
|
|
3224
3240
|
function writeVibgrateGitignore(root2, reports) {
|
|
3225
3241
|
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"];
|
|
3242
|
+
fs7.mkdirSync(dir, { recursive: true });
|
|
3243
|
+
const lines = ["# Managed by `vg share` \u2014 keep graph.json committed, ignore the rest", "cache/", "facts.jsonl", "graph.snap"];
|
|
3228
3244
|
if (!reports) lines.push("graph.html", "GRAPH_REPORT.md");
|
|
3229
|
-
|
|
3245
|
+
fs7.writeFileSync(path37.join(dir, ".gitignore"), `${lines.join("\n")}
|
|
3230
3246
|
`);
|
|
3231
3247
|
}
|
|
3232
3248
|
function writeGitAttributes(root2) {
|
|
3233
3249
|
const file = path37.join(root2, ".gitattributes");
|
|
3234
3250
|
const line = ".vibgrate/graph.json merge=vg";
|
|
3235
|
-
let content =
|
|
3251
|
+
let content = fs7.existsSync(file) ? fs7.readFileSync(file, "utf8") : "";
|
|
3236
3252
|
if (!content.split("\n").some((l) => l.trim() === line)) {
|
|
3237
3253
|
content = content.length ? `${content.replace(/\s*$/, "")}
|
|
3238
3254
|
${line}
|
|
3239
3255
|
` : `${line}
|
|
3240
3256
|
`;
|
|
3241
|
-
|
|
3257
|
+
fs7.writeFileSync(file, content);
|
|
3242
3258
|
}
|
|
3243
3259
|
}
|
|
3244
3260
|
function configureMergeDriver(root2) {
|
|
@@ -3247,7 +3263,7 @@ function configureMergeDriver(root2) {
|
|
|
3247
3263
|
}
|
|
3248
3264
|
function installPreCommitHook(root2) {
|
|
3249
3265
|
const hooksDir = hookDir(root2);
|
|
3250
|
-
|
|
3266
|
+
fs7.mkdirSync(hooksDir, { recursive: true });
|
|
3251
3267
|
const file = path37.join(hooksDir, "pre-commit");
|
|
3252
3268
|
const block = [
|
|
3253
3269
|
HOOK_BEGIN,
|
|
@@ -3257,7 +3273,7 @@ function installPreCommitHook(root2) {
|
|
|
3257
3273
|
"fi",
|
|
3258
3274
|
HOOK_END
|
|
3259
3275
|
].join("\n");
|
|
3260
|
-
let content =
|
|
3276
|
+
let content = fs7.existsSync(file) ? fs7.readFileSync(file, "utf8") : "#!/bin/sh\n";
|
|
3261
3277
|
const re = new RegExp(`${escapeRe(HOOK_BEGIN)}[\\s\\S]*?${escapeRe(HOOK_END)}`);
|
|
3262
3278
|
if (re.test(content)) content = content.replace(re, block);
|
|
3263
3279
|
else content = `${content.replace(/\s*$/, "")}
|
|
@@ -3266,21 +3282,21 @@ ${block}
|
|
|
3266
3282
|
`;
|
|
3267
3283
|
if (!content.startsWith("#!")) content = `#!/bin/sh
|
|
3268
3284
|
${content}`;
|
|
3269
|
-
|
|
3270
|
-
|
|
3285
|
+
fs7.writeFileSync(file, content);
|
|
3286
|
+
fs7.chmodSync(file, 493);
|
|
3271
3287
|
}
|
|
3272
3288
|
function undo(root2) {
|
|
3273
3289
|
const hookFile = path37.join(hookDir(root2), "pre-commit");
|
|
3274
|
-
if (
|
|
3290
|
+
if (fs7.existsSync(hookFile)) {
|
|
3275
3291
|
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
|
|
3292
|
+
const next2 = fs7.readFileSync(hookFile, "utf8").replace(re, "\n");
|
|
3293
|
+
if (next2.trim() === "#!/bin/sh") fs7.rmSync(hookFile);
|
|
3294
|
+
else fs7.writeFileSync(hookFile, next2);
|
|
3279
3295
|
}
|
|
3280
3296
|
const attr = path37.join(root2, ".gitattributes");
|
|
3281
|
-
if (
|
|
3282
|
-
const next2 =
|
|
3283
|
-
|
|
3297
|
+
if (fs7.existsSync(attr)) {
|
|
3298
|
+
const next2 = fs7.readFileSync(attr, "utf8").split("\n").filter((l) => l.trim() !== ".vibgrate/graph.json merge=vg").join("\n");
|
|
3299
|
+
fs7.writeFileSync(attr, next2);
|
|
3284
3300
|
}
|
|
3285
3301
|
try {
|
|
3286
3302
|
git(root2, ["config", "--remove-section", "merge.vg"]);
|
|
@@ -3323,7 +3339,7 @@ function registerWatch(program) {
|
|
|
3323
3339
|
const debounceMs = Math.max(50, Number(opts.debounce) || DEFAULT_DEBOUNCE_MS);
|
|
3324
3340
|
const watchRoots = (paths.length ? paths : ["."]).map((p) => path37.resolve(root2, p));
|
|
3325
3341
|
for (const w of watchRoots) {
|
|
3326
|
-
if (!
|
|
3342
|
+
if (!fs7.existsSync(w)) {
|
|
3327
3343
|
throw new CliError(`watch path not found: ${w}`, ExitCode.USAGE_ERROR);
|
|
3328
3344
|
}
|
|
3329
3345
|
}
|
|
@@ -3376,7 +3392,7 @@ function registerWatch(program) {
|
|
|
3376
3392
|
const watchers = [];
|
|
3377
3393
|
for (const w of watchRoots) {
|
|
3378
3394
|
try {
|
|
3379
|
-
const watcher =
|
|
3395
|
+
const watcher = fs7.watch(w, { recursive: true }, (_event, filename) => {
|
|
3380
3396
|
if (!filename) {
|
|
3381
3397
|
schedule("change");
|
|
3382
3398
|
return;
|
|
@@ -3729,7 +3745,7 @@ function loadStandards(root2) {
|
|
|
3729
3745
|
const p = path37__default.join(root2, rel);
|
|
3730
3746
|
let text;
|
|
3731
3747
|
try {
|
|
3732
|
-
text =
|
|
3748
|
+
text = fs7__default.readFileSync(p, "utf8");
|
|
3733
3749
|
} catch {
|
|
3734
3750
|
continue;
|
|
3735
3751
|
}
|
|
@@ -5660,7 +5676,7 @@ function registerModels(program) {
|
|
|
5660
5676
|
);
|
|
5661
5677
|
}
|
|
5662
5678
|
} else {
|
|
5663
|
-
if (!target.path || !
|
|
5679
|
+
if (!target.path || !fs7.existsSync(target.path)) {
|
|
5664
5680
|
throw new CliError(
|
|
5665
5681
|
`model file not found at ${target.path || "(unknown path)"} \u2014 it may already be removed.`,
|
|
5666
5682
|
ExitCode.NOT_FOUND
|
|
@@ -5674,7 +5690,7 @@ function registerModels(program) {
|
|
|
5674
5690
|
}
|
|
5675
5691
|
if (!global.json) info(c.dim(` $ rm ${target.path}`));
|
|
5676
5692
|
try {
|
|
5677
|
-
|
|
5693
|
+
fs7.unlinkSync(target.path);
|
|
5678
5694
|
} catch (e) {
|
|
5679
5695
|
const msg = e instanceof Error ? e.message : String(e);
|
|
5680
5696
|
throw new CliError(`could not delete ${target.path}: ${msg}`, ExitCode.ERROR);
|
|
@@ -5813,8 +5829,8 @@ function registerModels(program) {
|
|
|
5813
5829
|
});
|
|
5814
5830
|
if (opts.out) {
|
|
5815
5831
|
const outPath = path37.resolve(opts.out);
|
|
5816
|
-
|
|
5817
|
-
|
|
5832
|
+
fs7.mkdirSync(path37.dirname(outPath), { recursive: true });
|
|
5833
|
+
fs7.writeFileSync(outPath, `${JSON.stringify(report, null, 2)}
|
|
5818
5834
|
`);
|
|
5819
5835
|
if (!global.json) info(c.dim(` wrote ${outPath}`));
|
|
5820
5836
|
}
|
|
@@ -6012,7 +6028,7 @@ function codeConfigPath(root2) {
|
|
|
6012
6028
|
}
|
|
6013
6029
|
function loadCodeConfig(root2) {
|
|
6014
6030
|
try {
|
|
6015
|
-
const raw = JSON.parse(
|
|
6031
|
+
const raw = JSON.parse(fs7.readFileSync(codeConfigPath(root2), "utf8"));
|
|
6016
6032
|
return sanitize(raw);
|
|
6017
6033
|
} catch {
|
|
6018
6034
|
return {};
|
|
@@ -6079,7 +6095,7 @@ function contextBudgetFor(config, modelContextWindow) {
|
|
|
6079
6095
|
var MCP_CONFIG_FILES = [".cursor/mcp.json", ".vscode/mcp.json", ".mcp.json"];
|
|
6080
6096
|
function readMcpServersFile(file) {
|
|
6081
6097
|
try {
|
|
6082
|
-
const raw = JSON.parse(
|
|
6098
|
+
const raw = JSON.parse(fs7.readFileSync(file, "utf8"));
|
|
6083
6099
|
const map = raw.mcpServers ?? raw.servers;
|
|
6084
6100
|
return map && typeof map === "object" ? parseMcpServers(map) : {};
|
|
6085
6101
|
} catch {
|
|
@@ -6119,7 +6135,7 @@ function registerCode(program) {
|
|
|
6119
6135
|
try {
|
|
6120
6136
|
const { parseMode: parseMode2, resolveMode: resolveMode2, readOrchestratorState: readOrchestratorState2, activePin: activePin2 } = await import('./model-orchestrator-LHYPJBFH.js');
|
|
6121
6137
|
const { gatherSystemMemory: gatherSystemMemory2 } = await import('./local-runtime-2ED33KK6.js');
|
|
6122
|
-
const { loadGraph: loadGraph2 } = await import('./load-
|
|
6138
|
+
const { loadGraph: loadGraph2 } = await import('./load-4MLIHGXF.js');
|
|
6123
6139
|
const state = readOrchestratorState2();
|
|
6124
6140
|
const mode = parseMode2(modeFlag) ?? state.defaultMode ?? void 0;
|
|
6125
6141
|
const pin = mode ? activePin2(mode, state) : null;
|
|
@@ -6203,7 +6219,7 @@ function registerCode(program) {
|
|
|
6203
6219
|
if (!(process.stdin.isTTY && process.stdout.isTTY)) {
|
|
6204
6220
|
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
6221
|
}
|
|
6206
|
-
const { runInteractive } = await import('./interactive-
|
|
6222
|
+
const { runInteractive } = await import('./interactive-HLGJJFLI.js');
|
|
6207
6223
|
await runInteractive(
|
|
6208
6224
|
rootOf(global),
|
|
6209
6225
|
global,
|
|
@@ -6236,7 +6252,7 @@ function registerCode(program) {
|
|
|
6236
6252
|
let mockReply;
|
|
6237
6253
|
if (opts.mock) {
|
|
6238
6254
|
try {
|
|
6239
|
-
mockReply =
|
|
6255
|
+
mockReply = fs7.readFileSync(opts.mock, "utf8");
|
|
6240
6256
|
} catch {
|
|
6241
6257
|
throw new CliError(`couldn't read the --mock file: ${opts.mock}`, ExitCode.USAGE_ERROR);
|
|
6242
6258
|
}
|
|
@@ -6292,11 +6308,11 @@ function registerCode(program) {
|
|
|
6292
6308
|
const { loadOrDiscoverFederation } = await import('./federation-MDQPO3PW.js');
|
|
6293
6309
|
const { resolveExecutionEnv } = await import('./execution-env-4MS5AYAN.js');
|
|
6294
6310
|
const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-ELWF3Z6H.js');
|
|
6295
|
-
const { startCodeRuntimeSession } = await import('./runtime-session-
|
|
6311
|
+
const { startCodeRuntimeSession } = await import('./runtime-session-5M6QZZOS.js');
|
|
6296
6312
|
const { resolveGraphBackend } = await import('./graph-backend-GBL33GMW.js');
|
|
6297
6313
|
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
6298
6314
|
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
6299
|
-
const { vgdRequest: vgdRequest2 } = await import('./vgd-
|
|
6315
|
+
const { vgdRequest: vgdRequest2 } = await import('./vgd-TGGEAGQZ.js');
|
|
6300
6316
|
const federation = loadOrDiscoverFederation(root2);
|
|
6301
6317
|
const modelProfile = mergeModelExecutionProfile(
|
|
6302
6318
|
resolveModelExecutionProfile({
|
|
@@ -6342,7 +6358,7 @@ ${res.stderr}` : ""),
|
|
|
6342
6358
|
exitCode: res.status ?? 1
|
|
6343
6359
|
};
|
|
6344
6360
|
};
|
|
6345
|
-
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-
|
|
6361
|
+
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-ZCKBYQ2D.js');
|
|
6346
6362
|
const vgBuiltin = createVgBuiltinMcpTools({
|
|
6347
6363
|
getGraph: () => graph,
|
|
6348
6364
|
root: root2,
|
|
@@ -6424,7 +6440,7 @@ ${res.stderr}` : ""),
|
|
|
6424
6440
|
if (!autonomous && !tty) {
|
|
6425
6441
|
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
6442
|
}
|
|
6427
|
-
const { agentTask } = await import('./interactive-
|
|
6443
|
+
const { agentTask } = await import('./interactive-HLGJJFLI.js');
|
|
6428
6444
|
const { nodeCodeFs } = await import('./session-2JT4AUZT.js');
|
|
6429
6445
|
const { TtyPrompter } = await import('./ui-K7D3BCHD.js');
|
|
6430
6446
|
let priorSummary;
|
|
@@ -6434,7 +6450,7 @@ ${res.stderr}` : ""),
|
|
|
6434
6450
|
if (prev) priorSummary = summarizeSession(prev);
|
|
6435
6451
|
}
|
|
6436
6452
|
const prompter = tty ? new TtyPrompter() : void 0;
|
|
6437
|
-
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-
|
|
6453
|
+
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-ZCKBYQ2D.js');
|
|
6438
6454
|
const vgBuiltin = createVgBuiltinMcpTools({
|
|
6439
6455
|
getGraph: () => graph,
|
|
6440
6456
|
root: root2,
|
|
@@ -6458,11 +6474,11 @@ ${res.stderr}` : ""),
|
|
|
6458
6474
|
const { loadFederation } = await import('./federation-MDQPO3PW.js');
|
|
6459
6475
|
const { resolveExecutionEnv } = await import('./execution-env-4MS5AYAN.js');
|
|
6460
6476
|
const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-ELWF3Z6H.js');
|
|
6461
|
-
const { startCodeRuntimeSession } = await import('./runtime-session-
|
|
6477
|
+
const { startCodeRuntimeSession } = await import('./runtime-session-5M6QZZOS.js');
|
|
6462
6478
|
const { resolveGraphBackend } = await import('./graph-backend-GBL33GMW.js');
|
|
6463
6479
|
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
6464
6480
|
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
6465
|
-
const { vgdRequest: vgdRequest2 } = await import('./vgd-
|
|
6481
|
+
const { vgdRequest: vgdRequest2 } = await import('./vgd-TGGEAGQZ.js');
|
|
6466
6482
|
const federation = loadFederation(root2);
|
|
6467
6483
|
const modelProfile = mergeModelExecutionProfile(
|
|
6468
6484
|
resolveModelExecutionProfile({
|
|
@@ -6554,7 +6570,7 @@ ${res.stderr}` : ""),
|
|
|
6554
6570
|
attribution: { client: "vg-code", provider: providerSlug, model: primary?.model }
|
|
6555
6571
|
});
|
|
6556
6572
|
if (opts.out) {
|
|
6557
|
-
|
|
6573
|
+
fs7.writeFileSync(opts.out, JSON.stringify(result, null, 2) + "\n");
|
|
6558
6574
|
}
|
|
6559
6575
|
if (global.json) {
|
|
6560
6576
|
json(result);
|
|
@@ -6767,7 +6783,7 @@ async function addCmd(root2, rest, opts, asJson) {
|
|
|
6767
6783
|
}
|
|
6768
6784
|
function readPackageVersion(root2) {
|
|
6769
6785
|
try {
|
|
6770
|
-
const pkg = JSON.parse(
|
|
6786
|
+
const pkg = JSON.parse(fs7__default.readFileSync(path37__default.join(root2, "package.json"), "utf8"));
|
|
6771
6787
|
return typeof pkg.version === "string" ? pkg.version : void 0;
|
|
6772
6788
|
} catch {
|
|
6773
6789
|
return void 0;
|
|
@@ -6775,7 +6791,7 @@ function readPackageVersion(root2) {
|
|
|
6775
6791
|
}
|
|
6776
6792
|
function readOptionalFile(p) {
|
|
6777
6793
|
try {
|
|
6778
|
-
const t =
|
|
6794
|
+
const t = fs7__default.readFileSync(p, "utf8");
|
|
6779
6795
|
return t.trim() ? t : void 0;
|
|
6780
6796
|
} catch {
|
|
6781
6797
|
return void 0;
|
|
@@ -6923,8 +6939,8 @@ function registerExport(program) {
|
|
|
6923
6939
|
out(content.trimEnd());
|
|
6924
6940
|
return;
|
|
6925
6941
|
}
|
|
6926
|
-
|
|
6927
|
-
|
|
6942
|
+
fs7.mkdirSync(path37.dirname(path37.resolve(file)), { recursive: true });
|
|
6943
|
+
fs7.writeFileSync(file, content);
|
|
6928
6944
|
info(`${c.green("\u2714")} wrote ${file} ${c.dim(`(${format})`)}`);
|
|
6929
6945
|
});
|
|
6930
6946
|
applyGlobalOptions(cmd);
|
|
@@ -6947,24 +6963,30 @@ function registerBundle(program) {
|
|
|
6947
6963
|
} catch {
|
|
6948
6964
|
throw new CliError("no grammars found to bundle (run a build first)", ExitCode.ERROR);
|
|
6949
6965
|
}
|
|
6950
|
-
|
|
6966
|
+
fs7.mkdirSync(path37.join(outDir, "grammars"), { recursive: true });
|
|
6951
6967
|
let grammarCount = 0;
|
|
6952
6968
|
for (const { fileName, absPath } of grammarFiles) {
|
|
6953
|
-
|
|
6969
|
+
fs7.copyFileSync(absPath, path37.join(outDir, "grammars", fileName));
|
|
6954
6970
|
grammarCount++;
|
|
6955
6971
|
}
|
|
6956
6972
|
const included = [`grammars/ (${grammarCount} .wasm)`];
|
|
6957
6973
|
const graphSrc = resolveGraphPath(root2, global.graph);
|
|
6958
|
-
if (
|
|
6959
|
-
|
|
6974
|
+
if (fs7.existsSync(graphSrc)) {
|
|
6975
|
+
fs7.copyFileSync(graphSrc, path37.join(outDir, "graph.json"));
|
|
6960
6976
|
included.push("graph.json");
|
|
6977
|
+
} else {
|
|
6978
|
+
const graph = loadGraphFileWithSnapshot(graphSrc);
|
|
6979
|
+
if (graph) {
|
|
6980
|
+
fs7.writeFileSync(path37.join(outDir, "graph.json"), serializeGraph(graph));
|
|
6981
|
+
included.push("graph.json");
|
|
6982
|
+
}
|
|
6961
6983
|
}
|
|
6962
6984
|
const cat = catalogPath(root2);
|
|
6963
|
-
if (
|
|
6964
|
-
|
|
6985
|
+
if (fs7.existsSync(cat)) {
|
|
6986
|
+
fs7.copyFileSync(cat, path37.join(outDir, "vibgrate.lib.json"));
|
|
6965
6987
|
included.push("vibgrate.lib.json");
|
|
6966
|
-
if (
|
|
6967
|
-
|
|
6988
|
+
if (fs7.existsSync(libDir(root2))) {
|
|
6989
|
+
fs7.cpSync(libDir(root2), path37.join(outDir, "lib"), { recursive: true });
|
|
6968
6990
|
included.push("lib/");
|
|
6969
6991
|
}
|
|
6970
6992
|
}
|
|
@@ -6976,7 +6998,7 @@ function registerBundle(program) {
|
|
|
6976
6998
|
included,
|
|
6977
6999
|
usage: "Run `vg build --grammars <this dir>/grammars` to build fully offline."
|
|
6978
7000
|
};
|
|
6979
|
-
|
|
7001
|
+
fs7.writeFileSync(path37.join(outDir, "MANIFEST.json"), `${stableStringify(manifest, 2)}
|
|
6980
7002
|
`);
|
|
6981
7003
|
if (global.json) {
|
|
6982
7004
|
json({ out: path37.relative(root2, outDir), ...manifest });
|
|
@@ -7002,7 +7024,7 @@ async function runDoctor(global) {
|
|
|
7002
7024
|
const root2 = rootOf(global);
|
|
7003
7025
|
const local = global.local === true;
|
|
7004
7026
|
const graphPath = resolveGraphPath(root2, global.graph);
|
|
7005
|
-
const configFile = CONFIG_BASENAMES.find((f) =>
|
|
7027
|
+
const configFile = CONFIG_BASENAMES.find((f) => fs7.existsSync(path37.join(root2, f))) ?? null;
|
|
7006
7028
|
const graph = loadGraph(root2, graphPath);
|
|
7007
7029
|
let staleFiles = null;
|
|
7008
7030
|
if (graph) {
|
|
@@ -7035,7 +7057,7 @@ async function runDoctor(global) {
|
|
|
7035
7057
|
},
|
|
7036
7058
|
libCatalog: {
|
|
7037
7059
|
path: path37.relative(root2, catalogPath(root2)),
|
|
7038
|
-
present:
|
|
7060
|
+
present: fs7.existsSync(catalogPath(root2)),
|
|
7039
7061
|
libraries: libCount
|
|
7040
7062
|
},
|
|
7041
7063
|
credentials: creds,
|
|
@@ -7296,7 +7318,7 @@ function registerDaemon(program) {
|
|
|
7296
7318
|
if (!await vgdIsRunning({ socketPath })) {
|
|
7297
7319
|
throw new CliError(`vgd is not running \u2014 start it with \`vg daemon ensure\` (${socketPath})`, ExitCode.NOT_FOUND);
|
|
7298
7320
|
}
|
|
7299
|
-
const { loadGraph: loadGraph2 } = await import('./load-
|
|
7321
|
+
const { loadGraph: loadGraph2 } = await import('./load-4MLIHGXF.js');
|
|
7300
7322
|
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
7301
7323
|
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
7302
7324
|
const opts = this.opts();
|
|
@@ -7513,7 +7535,7 @@ function registerPolicy(program) {
|
|
|
7513
7535
|
const global = readGlobal(this);
|
|
7514
7536
|
let raw;
|
|
7515
7537
|
try {
|
|
7516
|
-
raw =
|
|
7538
|
+
raw = fs7.readFileSync(file, "utf8");
|
|
7517
7539
|
} catch {
|
|
7518
7540
|
throw new CliError(`cannot read ${file}`, ExitCode.NOT_FOUND);
|
|
7519
7541
|
}
|
|
@@ -7645,7 +7667,7 @@ var initCommand = new Command("init").description("Initialize vibgrate in a proj
|
|
|
7645
7667
|
console.log(chalk7.green("\u2714") + ` Created ${chalk7.bold("vibgrate.config.ts")}`);
|
|
7646
7668
|
}
|
|
7647
7669
|
if (opts.baseline) {
|
|
7648
|
-
const { runBaseline } = await import('./baseline-
|
|
7670
|
+
const { runBaseline } = await import('./baseline-UOTGTJYT.js');
|
|
7649
7671
|
await runBaseline(rootDir);
|
|
7650
7672
|
}
|
|
7651
7673
|
console.log("");
|
|
@@ -7755,9 +7777,9 @@ async function fileReferencesIdentifier(rootDir, relFile, identifier, readFile3)
|
|
|
7755
7777
|
}
|
|
7756
7778
|
async function defaultReadFile(absPath) {
|
|
7757
7779
|
try {
|
|
7758
|
-
const stat2 = await
|
|
7780
|
+
const stat2 = await fs20.stat(absPath);
|
|
7759
7781
|
if (!stat2.isFile() || stat2.size > MAX_FILE_BYTES) return null;
|
|
7760
|
-
return await
|
|
7782
|
+
return await fs20.readFile(absPath, "utf8");
|
|
7761
7783
|
} catch {
|
|
7762
7784
|
return null;
|
|
7763
7785
|
}
|
|
@@ -8404,7 +8426,7 @@ var SKIP_DIRS2 = /* @__PURE__ */ new Set([
|
|
|
8404
8426
|
function scanStaleness(rootDir, artifactPath) {
|
|
8405
8427
|
let ref;
|
|
8406
8428
|
try {
|
|
8407
|
-
ref =
|
|
8429
|
+
ref = fs7.statSync(artifactPath).mtimeMs;
|
|
8408
8430
|
} catch {
|
|
8409
8431
|
return { stale: false };
|
|
8410
8432
|
}
|
|
@@ -8416,7 +8438,7 @@ function scanStaleness(rootDir, artifactPath) {
|
|
|
8416
8438
|
if (depth > 8 || scanned > MAX_ENTRIES) return;
|
|
8417
8439
|
let entries;
|
|
8418
8440
|
try {
|
|
8419
|
-
entries =
|
|
8441
|
+
entries = fs7.readdirSync(dir, { withFileTypes: true });
|
|
8420
8442
|
} catch {
|
|
8421
8443
|
return;
|
|
8422
8444
|
}
|
|
@@ -8431,7 +8453,7 @@ function scanStaleness(rootDir, artifactPath) {
|
|
|
8431
8453
|
const abs = path37.join(dir, e.name);
|
|
8432
8454
|
let mtimeMs;
|
|
8433
8455
|
try {
|
|
8434
|
-
mtimeMs =
|
|
8456
|
+
mtimeMs = fs7.statSync(abs).mtimeMs;
|
|
8435
8457
|
} catch {
|
|
8436
8458
|
continue;
|
|
8437
8459
|
}
|
|
@@ -8568,7 +8590,7 @@ function analyzeTree(root2, packages) {
|
|
|
8568
8590
|
if (depth > MAX_DEPTH || filesSeen >= MAX_FILES) return;
|
|
8569
8591
|
let entries;
|
|
8570
8592
|
try {
|
|
8571
|
-
entries =
|
|
8593
|
+
entries = fs7.readdirSync(dir, { withFileTypes: true });
|
|
8572
8594
|
} catch {
|
|
8573
8595
|
return;
|
|
8574
8596
|
}
|
|
@@ -8586,8 +8608,8 @@ function analyzeTree(root2, packages) {
|
|
|
8586
8608
|
const full = path37.join(dir, entry.name);
|
|
8587
8609
|
let content;
|
|
8588
8610
|
try {
|
|
8589
|
-
if (
|
|
8590
|
-
content =
|
|
8611
|
+
if (fs7.statSync(full).size > MAX_FILE_BYTES2) continue;
|
|
8612
|
+
content = fs7.readFileSync(full, "utf8");
|
|
8591
8613
|
} catch {
|
|
8592
8614
|
continue;
|
|
8593
8615
|
}
|
|
@@ -8946,7 +8968,7 @@ async function fetchLatestVersion() {
|
|
|
8946
8968
|
if (!response.ok) return null;
|
|
8947
8969
|
const data = await response.json();
|
|
8948
8970
|
const latest = data.version;
|
|
8949
|
-
if (!latest || !
|
|
8971
|
+
if (!latest || !semver3__default.valid(latest)) return null;
|
|
8950
8972
|
await writeCache({ latest, checkedAt: Date.now() });
|
|
8951
8973
|
return latest;
|
|
8952
8974
|
} catch {
|
|
@@ -8955,8 +8977,8 @@ async function fetchLatestVersion() {
|
|
|
8955
8977
|
}
|
|
8956
8978
|
async function writeCache(data) {
|
|
8957
8979
|
try {
|
|
8958
|
-
await
|
|
8959
|
-
await
|
|
8980
|
+
await fs20.mkdir(CACHE_DIR, { recursive: true });
|
|
8981
|
+
await fs20.writeFile(CACHE_FILE, JSON.stringify(data), "utf-8");
|
|
8960
8982
|
} catch {
|
|
8961
8983
|
}
|
|
8962
8984
|
}
|
|
@@ -8967,7 +8989,7 @@ function detectGlobalInstall(execPath = process.argv[1] || "", cwd = process.cwd
|
|
|
8967
8989
|
if (!execPath) return null;
|
|
8968
8990
|
let resolved = execPath;
|
|
8969
8991
|
try {
|
|
8970
|
-
resolved =
|
|
8992
|
+
resolved = fs7.realpathSync(execPath);
|
|
8971
8993
|
} catch {
|
|
8972
8994
|
}
|
|
8973
8995
|
const p = resolved.replace(/\\/g, "/");
|
|
@@ -9085,8 +9107,8 @@ var updateCommand = new Command("update").description("Update vibgrate to the la
|
|
|
9085
9107
|
console.error(chalk7.red("Could not reach the npm registry. Check your network connection."));
|
|
9086
9108
|
process.exit(1);
|
|
9087
9109
|
}
|
|
9088
|
-
const
|
|
9089
|
-
if (!
|
|
9110
|
+
const semver4 = await import('semver');
|
|
9111
|
+
if (!semver4.gt(latest, VERSION)) {
|
|
9090
9112
|
console.log(chalk7.green("\u2714") + ` You are on the latest version (${VERSION}).`);
|
|
9091
9113
|
if (opts.reap !== false) reapAndReport(process.cwd(), VERSION);
|
|
9092
9114
|
return;
|
|
@@ -10964,9 +10986,9 @@ async function loadReleases(root2, productId) {
|
|
|
10964
10986
|
return releases;
|
|
10965
10987
|
}
|
|
10966
10988
|
function coerce(version) {
|
|
10967
|
-
const parsed =
|
|
10989
|
+
const parsed = semver3__default.parse(version, { loose: true });
|
|
10968
10990
|
if (parsed) return parsed.version;
|
|
10969
|
-
const c2 =
|
|
10991
|
+
const c2 = semver3__default.coerce(version);
|
|
10970
10992
|
return c2 ? c2.version : null;
|
|
10971
10993
|
}
|
|
10972
10994
|
function versionAffected(version, range) {
|
|
@@ -10976,11 +10998,11 @@ function versionAffected(version, range) {
|
|
|
10976
10998
|
if (!range.introduced && !range.fixed && !range.versions) return false;
|
|
10977
10999
|
const introduced = range.introduced ? coerce(range.introduced) : "0.0.0";
|
|
10978
11000
|
if (!introduced) return false;
|
|
10979
|
-
if (
|
|
11001
|
+
if (semver3__default.lt(v, introduced)) return false;
|
|
10980
11002
|
if (range.fixed) {
|
|
10981
11003
|
const fixed = coerce(range.fixed);
|
|
10982
11004
|
if (!fixed) return false;
|
|
10983
|
-
if (
|
|
11005
|
+
if (semver3__default.gte(v, fixed)) return false;
|
|
10984
11006
|
}
|
|
10985
11007
|
return true;
|
|
10986
11008
|
}
|
|
@@ -11061,8 +11083,8 @@ function computeExposure(input) {
|
|
|
11061
11083
|
productName: product.name,
|
|
11062
11084
|
classification: product.classification,
|
|
11063
11085
|
status,
|
|
11064
|
-
affectedVersions: [...affectedVersions].sort(
|
|
11065
|
-
releases: affectedReleases.sort((a, b) =>
|
|
11086
|
+
affectedVersions: [...affectedVersions].sort(semver3__default.compareLoose),
|
|
11087
|
+
releases: affectedReleases.sort((a, b) => semver3__default.compareLoose(a.version, b.version)),
|
|
11066
11088
|
memberStates: product.memberStates,
|
|
11067
11089
|
supportStatus: support.status,
|
|
11068
11090
|
supportDetail: support.detail
|
|
@@ -11655,17 +11677,17 @@ function resolveSigningKey(root2, explicit) {
|
|
|
11655
11677
|
const chosen = process.env.VG_ATTEST_KEY;
|
|
11656
11678
|
const keyPath = chosen ? path37.resolve(chosen) : path37.join(root2, ".vibgrate", DEFAULT_KEY);
|
|
11657
11679
|
let minted = false;
|
|
11658
|
-
if (!
|
|
11680
|
+
if (!fs7.existsSync(keyPath)) {
|
|
11659
11681
|
if (chosen) throw new CliError(`signing key not found: ${chosen}`, ExitCode.USAGE_ERROR);
|
|
11660
11682
|
const kp = generateKeypair();
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11683
|
+
fs7.mkdirSync(path37.dirname(keyPath), { recursive: true });
|
|
11684
|
+
fs7.writeFileSync(keyPath, kp.privatePem, { mode: 384 });
|
|
11685
|
+
fs7.writeFileSync(`${keyPath}.pub`, kp.publicPem);
|
|
11664
11686
|
minted = true;
|
|
11665
11687
|
}
|
|
11666
11688
|
let key2;
|
|
11667
11689
|
try {
|
|
11668
|
-
key2 = crypto3.createPrivateKey(
|
|
11690
|
+
key2 = crypto3.createPrivateKey(fs7.readFileSync(keyPath, "utf8"));
|
|
11669
11691
|
} catch {
|
|
11670
11692
|
throw new CliError(`could not read an Ed25519 private key from ${keyPath}`, ExitCode.USAGE_ERROR);
|
|
11671
11693
|
}
|
|
@@ -11676,8 +11698,8 @@ function resolveSigningKey(root2, explicit) {
|
|
|
11676
11698
|
}
|
|
11677
11699
|
function writeBundle(input) {
|
|
11678
11700
|
const dir = input.outDir;
|
|
11679
|
-
|
|
11680
|
-
const write = (rel, data) =>
|
|
11701
|
+
fs7.mkdirSync(path37.join(dir, "inputs", "releases"), { recursive: true });
|
|
11702
|
+
const write = (rel, data) => fs7.writeFileSync(path37.join(dir, rel), `${JSON.stringify(data, null, 2)}
|
|
11681
11703
|
`);
|
|
11682
11704
|
write("result.json", input.result);
|
|
11683
11705
|
write(path37.join("inputs", "advisory.json"), input.advisory);
|
|
@@ -11701,13 +11723,13 @@ function writeBundle(input) {
|
|
|
11701
11723
|
disclaimer: input.regime.disclaimer
|
|
11702
11724
|
});
|
|
11703
11725
|
if (input.envelope) {
|
|
11704
|
-
|
|
11726
|
+
fs7.writeFileSync(path37.join(dir, "evidence.intoto.jsonl"), `${JSON.stringify(input.envelope)}
|
|
11705
11727
|
`);
|
|
11706
11728
|
}
|
|
11707
11729
|
if (input.timestampToken) {
|
|
11708
|
-
|
|
11730
|
+
fs7.writeFileSync(path37.join(dir, "timestamp.tsr"), input.timestampToken);
|
|
11709
11731
|
}
|
|
11710
|
-
|
|
11732
|
+
fs7.writeFileSync(path37.join(dir, "VERIFY.md"), verifyDoc(input));
|
|
11711
11733
|
return dir;
|
|
11712
11734
|
}
|
|
11713
11735
|
function verifyDoc(input) {
|
|
@@ -12050,7 +12072,7 @@ var packCmd = new Command("pack").description("Build the submission pack a human
|
|
|
12050
12072
|
const stage = opts.stage ?? regime.clocks[0]?.stage ?? "early-warning";
|
|
12051
12073
|
const md = buildPack(result, regime, org, stage);
|
|
12052
12074
|
if (opts.out) {
|
|
12053
|
-
|
|
12075
|
+
fs7.writeFileSync(path37.resolve(rootDir, opts.out), md);
|
|
12054
12076
|
console.error(chalk7.green("\u2714") + ` pack written to ${opts.out}`);
|
|
12055
12077
|
} else {
|
|
12056
12078
|
console.log(md);
|
|
@@ -12093,19 +12115,19 @@ var drillCmd = new Command("drill").description("Timed dry-run of the determinat
|
|
|
12093
12115
|
});
|
|
12094
12116
|
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
12117
|
const abs = path37.resolve(bundlePath);
|
|
12096
|
-
const envPath =
|
|
12097
|
-
if (!
|
|
12098
|
-
const envelope = JSON.parse(
|
|
12118
|
+
const envPath = fs7.statSync(abs).isDirectory() ? path37.join(abs, "evidence.intoto.jsonl") : abs;
|
|
12119
|
+
if (!fs7.existsSync(envPath)) throw new CliError(`no evidence.intoto.jsonl at ${bundlePath}`, ExitCode.NOT_FOUND);
|
|
12120
|
+
const envelope = JSON.parse(fs7.readFileSync(envPath, "utf8").trim().split("\n")[0]);
|
|
12099
12121
|
const resultPath = path37.join(path37.dirname(envPath), "result.json");
|
|
12100
|
-
const result =
|
|
12101
|
-
const publicKeyPem = opts.pub ?
|
|
12122
|
+
const result = fs7.existsSync(resultPath) ? JSON.parse(fs7.readFileSync(resultPath, "utf8")) : void 0;
|
|
12123
|
+
const publicKeyPem = opts.pub ? fs7.readFileSync(path37.resolve(opts.pub), "utf8") : void 0;
|
|
12102
12124
|
const v = verifyEvidenceEnvelope(envelope, { publicKeyPem, result });
|
|
12103
12125
|
const color = v.status === "verified" ? chalk7.green : v.status === "failed" ? chalk7.red : chalk7.yellow;
|
|
12104
12126
|
console.log(" " + color(v.status.toUpperCase()) + ` ${v.reason}`);
|
|
12105
12127
|
if (v.evidenceId) console.log(" " + chalk7.dim(`evidence ${v.evidenceId} \xB7 regime ${v.regime} \xB7 advisory ${v.advisoryId} \xB7 ${v.overallStatus}`));
|
|
12106
12128
|
const tsrPath = path37.join(path37.dirname(envPath), "timestamp.tsr");
|
|
12107
|
-
if (
|
|
12108
|
-
const t = verifyTimestamp(
|
|
12129
|
+
if (fs7.existsSync(tsrPath) && result) {
|
|
12130
|
+
const t = verifyTimestamp(fs7.readFileSync(tsrPath), exposureSubjectDigest(result));
|
|
12109
12131
|
const tcolor = t.imprintMatches ? chalk7.green : chalk7.red;
|
|
12110
12132
|
console.log(" " + tcolor("TIMESTAMP") + ` ${t.reason}`);
|
|
12111
12133
|
}
|
|
@@ -12204,9 +12226,9 @@ var pushCmd = new Command("push").description("Push the product registry (and an
|
|
|
12204
12226
|
let exposure;
|
|
12205
12227
|
if (opts.result) {
|
|
12206
12228
|
const raw = path37.resolve(rootDir, opts.result);
|
|
12207
|
-
const resultPath =
|
|
12208
|
-
if (!
|
|
12209
|
-
exposure = JSON.parse(
|
|
12229
|
+
const resultPath = fs7.existsSync(raw) && fs7.statSync(raw).isDirectory() ? path37.join(raw, "result.json") : raw;
|
|
12230
|
+
if (!fs7.existsSync(resultPath)) throw new CliError(`no result.json at ${opts.result}`, ExitCode.NOT_FOUND);
|
|
12231
|
+
exposure = JSON.parse(fs7.readFileSync(resultPath, "utf8"));
|
|
12210
12232
|
}
|
|
12211
12233
|
const payload = { schemaVersion: "evidence-push-1", regime: regime.id, generatedAt: nowIso(), signed: Boolean(opts.signed), products: productPayload, exposure };
|
|
12212
12234
|
const body = JSON.stringify(payload);
|
|
@@ -12396,7 +12418,7 @@ function dispatch(argv, cwd) {
|
|
|
12396
12418
|
}
|
|
12397
12419
|
const looksLikeQuestion = /\s/.test(first) || first.endsWith("?");
|
|
12398
12420
|
if (looksLikeQuestion) return ["ask", ...args];
|
|
12399
|
-
if (
|
|
12421
|
+
if (fs7.existsSync(path37.resolve(cwd, first))) {
|
|
12400
12422
|
return [hasBuildOnlyFlag(args) ? "build" : "scan", ...args];
|
|
12401
12423
|
}
|
|
12402
12424
|
const moved = MOVED_COMMANDS[first];
|