@vibgrate/cli 2026.728.4 → 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-QD4HVNVJ.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-HY2RVURA.js → chunk-CF2MLSOV.js} +3 -3
- package/dist/{chunk-HY2RVURA.js.map → chunk-CF2MLSOV.js.map} +1 -1
- package/dist/{chunk-LYDH2PHN.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-RCBMY7CR.js → chunk-OIWHR57Q.js} +3 -5
- package/dist/chunk-OIWHR57Q.js.map +1 -0
- package/dist/{chunk-SA4BMEU6.js → chunk-QS5BTBRX.js} +3 -3
- package/dist/{chunk-SA4BMEU6.js.map → chunk-QS5BTBRX.js.map} +1 -1
- package/dist/{chunk-ZU7VD4QL.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-WDJNUC6V.js → chunk-YMHQZ24Q.js} +5 -5
- package/dist/{chunk-WDJNUC6V.js.map → chunk-YMHQZ24Q.js.map} +1 -1
- package/dist/cli.js +175 -153
- 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-32LSIBRG.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-E4SJFL7Q.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-QD4HVNVJ.js +0 -8
- package/dist/chunk-LYDH2PHN.js.map +0 -1
- package/dist/chunk-RCBMY7CR.js.map +0 -1
- package/dist/chunk-RYNAK4LK.js.map +0 -1
- package/dist/chunk-ZU7VD4QL.js.map +0 -1
- package/dist/interactive-32LSIBRG.js.map +0 -1
- package/dist/load-SEFJA3M5.js +0 -8
- package/dist/vg-mcp-bridge-E4SJFL7Q.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
|
|
@@ -1677,7 +1678,7 @@ async function serveHttp(graphPath, host, port, opts, freshness, onReady) {
|
|
|
1677
1678
|
info(c.red(`vg serve: request error: ${err.message}`));
|
|
1678
1679
|
}
|
|
1679
1680
|
});
|
|
1680
|
-
await new Promise((
|
|
1681
|
+
await new Promise((resolve21) => httpServer.listen(port, host, resolve21));
|
|
1681
1682
|
info(c.dim(`vg \xB7 MCP server on http://${host}:${port}/mcp (read-only, local, ${freshness})`));
|
|
1682
1683
|
onReady?.();
|
|
1683
1684
|
await new Promise(() => {
|
|
@@ -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
|
}
|
|
@@ -1923,9 +1924,17 @@ function manifestHash(root2) {
|
|
|
1923
1924
|
files.sort((a, b) => a.rel < b.rel ? -1 : a.rel > b.rel ? 1 : 0);
|
|
1924
1925
|
return hashString(canonicalize(files));
|
|
1925
1926
|
}
|
|
1927
|
+
function isDependencyFile(root2, filePath) {
|
|
1928
|
+
const rel = path37.relative(path37.resolve(root2), path37.resolve(filePath));
|
|
1929
|
+
if (rel === "" || rel.startsWith("..") || path37.isAbsolute(rel)) return false;
|
|
1930
|
+
const parts = rel.split(path37.sep);
|
|
1931
|
+
if (parts.slice(0, -1).some((dir) => SKIP_DIRS.has(dir))) return false;
|
|
1932
|
+
const base = parts[parts.length - 1].toLowerCase();
|
|
1933
|
+
return isManifest(filePath) || SKIP_FILES.has(base);
|
|
1934
|
+
}
|
|
1926
1935
|
function loadScanCache(root2, key2) {
|
|
1927
1936
|
try {
|
|
1928
|
-
const raw = JSON.parse(
|
|
1937
|
+
const raw = JSON.parse(fs7.readFileSync(cachePath(root2), "utf8"));
|
|
1929
1938
|
if (raw.version === CACHE_VERSION && raw.manifestHash === key2.manifestHash && raw.toolVersion === key2.toolVersion && raw.offline === key2.offline && raw.artifact) {
|
|
1930
1939
|
return { manifestHash: raw.manifestHash, artifact: raw.artifact };
|
|
1931
1940
|
}
|
|
@@ -1935,8 +1944,8 @@ function loadScanCache(root2, key2) {
|
|
|
1935
1944
|
}
|
|
1936
1945
|
function writeScanCache(root2, key2, artifact) {
|
|
1937
1946
|
try {
|
|
1938
|
-
|
|
1939
|
-
|
|
1947
|
+
fs7.mkdirSync(cacheDir(root2), { recursive: true });
|
|
1948
|
+
fs7.writeFileSync(
|
|
1940
1949
|
cachePath(root2),
|
|
1941
1950
|
stableStringify(
|
|
1942
1951
|
{ version: CACHE_VERSION, manifestHash: key2.manifestHash, toolVersion: key2.toolVersion, offline: key2.offline, artifact },
|
|
@@ -2442,6 +2451,13 @@ var VibgrateLanguageServer = class {
|
|
|
2442
2451
|
if (!uri || !this.docs.has(uri)) return;
|
|
2443
2452
|
this.scheduleScan(400);
|
|
2444
2453
|
});
|
|
2454
|
+
this.conn.onNotification("workspace/didChangeWatchedFiles", (_m, params) => {
|
|
2455
|
+
const p = params;
|
|
2456
|
+
const relevant = (p.changes ?? []).some(
|
|
2457
|
+
(c2) => c2.uri && isDependencyFile(this.opts.root, uriToPath(c2.uri))
|
|
2458
|
+
);
|
|
2459
|
+
if (relevant) this.scheduleScan(400);
|
|
2460
|
+
});
|
|
2445
2461
|
this.conn.onNotification("textDocument/didClose", (_m, params) => {
|
|
2446
2462
|
const p = params;
|
|
2447
2463
|
if (p.textDocument?.uri) this.docs.delete(p.textDocument.uri);
|
|
@@ -2743,7 +2759,7 @@ var VibgrateLanguageServer = class {
|
|
|
2743
2759
|
const absManifest = path37.resolve(this.opts.root, relManifest);
|
|
2744
2760
|
let text = null;
|
|
2745
2761
|
try {
|
|
2746
|
-
if (
|
|
2762
|
+
if (fs7.existsSync(absManifest)) text = fs7.readFileSync(absManifest, "utf8");
|
|
2747
2763
|
} catch {
|
|
2748
2764
|
text = null;
|
|
2749
2765
|
}
|
|
@@ -3048,7 +3064,7 @@ function hoverMarkdown(dep, contribution) {
|
|
|
3048
3064
|
return lines.join("\n");
|
|
3049
3065
|
}
|
|
3050
3066
|
function startLanguageServer(opts) {
|
|
3051
|
-
if (!
|
|
3067
|
+
if (!fs7.existsSync(opts.root)) {
|
|
3052
3068
|
process.stderr.write(`vg lsp: root does not exist: ${opts.root}
|
|
3053
3069
|
`);
|
|
3054
3070
|
process.exit(1);
|
|
@@ -3123,7 +3139,7 @@ function registerInstall(program) {
|
|
|
3123
3139
|
}
|
|
3124
3140
|
return;
|
|
3125
3141
|
}
|
|
3126
|
-
const targets = opts.all ? ASSISTANTS : opts.detect ? detected.map((d) => d.assistant) : tools.map(
|
|
3142
|
+
const targets = opts.all ? ASSISTANTS : opts.detect ? detected.map((d) => d.assistant) : tools.map(resolve5);
|
|
3127
3143
|
if (targets.length === 0) {
|
|
3128
3144
|
if (opts.detect) {
|
|
3129
3145
|
if (global.json) json({ root: root2, detected: [], results: [] });
|
|
@@ -3154,7 +3170,7 @@ function registerInstall(program) {
|
|
|
3154
3170
|
const uninstall = program.command("uninstall").description("remove vg from an AI assistant").argument("<tools...>", "assistant ids").option("--purge", "also delete the skill file").action(function(tools, opts) {
|
|
3155
3171
|
const global = readGlobal(this);
|
|
3156
3172
|
const root2 = rootOf(global);
|
|
3157
|
-
const results = tools.map(
|
|
3173
|
+
const results = tools.map(resolve5).map((a) => ({ id: a.id, removed: uninstallAssistant(a, root2, !!opts.purge) }));
|
|
3158
3174
|
if (global.json) {
|
|
3159
3175
|
json({ root: root2, results });
|
|
3160
3176
|
return;
|
|
@@ -3165,7 +3181,7 @@ function registerInstall(program) {
|
|
|
3165
3181
|
});
|
|
3166
3182
|
applyGlobalOptions(uninstall);
|
|
3167
3183
|
}
|
|
3168
|
-
function
|
|
3184
|
+
function resolve5(id) {
|
|
3169
3185
|
const a = assistantById(id);
|
|
3170
3186
|
if (!a) {
|
|
3171
3187
|
const near = ASSISTANTS.filter(
|
|
@@ -3186,7 +3202,7 @@ function registerShare(program) {
|
|
|
3186
3202
|
const global = readGlobal(this);
|
|
3187
3203
|
const root2 = rootOf(global);
|
|
3188
3204
|
const gitDir = path37.join(root2, ".git");
|
|
3189
|
-
if (!
|
|
3205
|
+
if (!fs7.existsSync(gitDir)) {
|
|
3190
3206
|
throw new CliError("not a git repository \u2014 run `vg share` inside a git repo", ExitCode.USAGE_ERROR);
|
|
3191
3207
|
}
|
|
3192
3208
|
if (opts.undo) {
|
|
@@ -3208,22 +3224,22 @@ function registerShare(program) {
|
|
|
3208
3224
|
}
|
|
3209
3225
|
function writeVibgrateGitignore(root2, reports) {
|
|
3210
3226
|
const dir = path37.join(root2, ".vibgrate");
|
|
3211
|
-
|
|
3212
|
-
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"];
|
|
3213
3229
|
if (!reports) lines.push("graph.html", "GRAPH_REPORT.md");
|
|
3214
|
-
|
|
3230
|
+
fs7.writeFileSync(path37.join(dir, ".gitignore"), `${lines.join("\n")}
|
|
3215
3231
|
`);
|
|
3216
3232
|
}
|
|
3217
3233
|
function writeGitAttributes(root2) {
|
|
3218
3234
|
const file = path37.join(root2, ".gitattributes");
|
|
3219
3235
|
const line = ".vibgrate/graph.json merge=vg";
|
|
3220
|
-
let content =
|
|
3236
|
+
let content = fs7.existsSync(file) ? fs7.readFileSync(file, "utf8") : "";
|
|
3221
3237
|
if (!content.split("\n").some((l) => l.trim() === line)) {
|
|
3222
3238
|
content = content.length ? `${content.replace(/\s*$/, "")}
|
|
3223
3239
|
${line}
|
|
3224
3240
|
` : `${line}
|
|
3225
3241
|
`;
|
|
3226
|
-
|
|
3242
|
+
fs7.writeFileSync(file, content);
|
|
3227
3243
|
}
|
|
3228
3244
|
}
|
|
3229
3245
|
function configureMergeDriver(root2) {
|
|
@@ -3232,7 +3248,7 @@ function configureMergeDriver(root2) {
|
|
|
3232
3248
|
}
|
|
3233
3249
|
function installPreCommitHook(root2) {
|
|
3234
3250
|
const hooksDir = hookDir(root2);
|
|
3235
|
-
|
|
3251
|
+
fs7.mkdirSync(hooksDir, { recursive: true });
|
|
3236
3252
|
const file = path37.join(hooksDir, "pre-commit");
|
|
3237
3253
|
const block = [
|
|
3238
3254
|
HOOK_BEGIN,
|
|
@@ -3242,7 +3258,7 @@ function installPreCommitHook(root2) {
|
|
|
3242
3258
|
"fi",
|
|
3243
3259
|
HOOK_END
|
|
3244
3260
|
].join("\n");
|
|
3245
|
-
let content =
|
|
3261
|
+
let content = fs7.existsSync(file) ? fs7.readFileSync(file, "utf8") : "#!/bin/sh\n";
|
|
3246
3262
|
const re = new RegExp(`${escapeRe(HOOK_BEGIN)}[\\s\\S]*?${escapeRe(HOOK_END)}`);
|
|
3247
3263
|
if (re.test(content)) content = content.replace(re, block);
|
|
3248
3264
|
else content = `${content.replace(/\s*$/, "")}
|
|
@@ -3251,21 +3267,21 @@ ${block}
|
|
|
3251
3267
|
`;
|
|
3252
3268
|
if (!content.startsWith("#!")) content = `#!/bin/sh
|
|
3253
3269
|
${content}`;
|
|
3254
|
-
|
|
3255
|
-
|
|
3270
|
+
fs7.writeFileSync(file, content);
|
|
3271
|
+
fs7.chmodSync(file, 493);
|
|
3256
3272
|
}
|
|
3257
3273
|
function undo(root2) {
|
|
3258
3274
|
const hookFile = path37.join(hookDir(root2), "pre-commit");
|
|
3259
|
-
if (
|
|
3275
|
+
if (fs7.existsSync(hookFile)) {
|
|
3260
3276
|
const re = new RegExp(`\\n*${escapeRe(HOOK_BEGIN)}[\\s\\S]*?${escapeRe(HOOK_END)}\\n*`);
|
|
3261
|
-
const next2 =
|
|
3262
|
-
if (next2.trim() === "#!/bin/sh")
|
|
3263
|
-
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);
|
|
3264
3280
|
}
|
|
3265
3281
|
const attr = path37.join(root2, ".gitattributes");
|
|
3266
|
-
if (
|
|
3267
|
-
const next2 =
|
|
3268
|
-
|
|
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);
|
|
3269
3285
|
}
|
|
3270
3286
|
try {
|
|
3271
3287
|
git(root2, ["config", "--remove-section", "merge.vg"]);
|
|
@@ -3308,7 +3324,7 @@ function registerWatch(program) {
|
|
|
3308
3324
|
const debounceMs = Math.max(50, Number(opts.debounce) || DEFAULT_DEBOUNCE_MS);
|
|
3309
3325
|
const watchRoots = (paths.length ? paths : ["."]).map((p) => path37.resolve(root2, p));
|
|
3310
3326
|
for (const w of watchRoots) {
|
|
3311
|
-
if (!
|
|
3327
|
+
if (!fs7.existsSync(w)) {
|
|
3312
3328
|
throw new CliError(`watch path not found: ${w}`, ExitCode.USAGE_ERROR);
|
|
3313
3329
|
}
|
|
3314
3330
|
}
|
|
@@ -3361,7 +3377,7 @@ function registerWatch(program) {
|
|
|
3361
3377
|
const watchers = [];
|
|
3362
3378
|
for (const w of watchRoots) {
|
|
3363
3379
|
try {
|
|
3364
|
-
const watcher =
|
|
3380
|
+
const watcher = fs7.watch(w, { recursive: true }, (_event, filename) => {
|
|
3365
3381
|
if (!filename) {
|
|
3366
3382
|
schedule("change");
|
|
3367
3383
|
return;
|
|
@@ -3379,11 +3395,11 @@ function registerWatch(program) {
|
|
|
3379
3395
|
}
|
|
3380
3396
|
}
|
|
3381
3397
|
info(c.dim(`vg watch \xB7 watching ${watchRoots.map((p) => path37.relative(root2, p) || ".").join(", ")} (debounce ${debounceMs}ms) \xB7 Ctrl+C to stop`));
|
|
3382
|
-
await new Promise((
|
|
3398
|
+
await new Promise((resolve21) => {
|
|
3383
3399
|
const stop = () => {
|
|
3384
3400
|
for (const w of watchers) w.close();
|
|
3385
3401
|
if (timer) clearTimeout(timer);
|
|
3386
|
-
|
|
3402
|
+
resolve21();
|
|
3387
3403
|
};
|
|
3388
3404
|
process.once("SIGINT", stop);
|
|
3389
3405
|
process.once("SIGTERM", stop);
|
|
@@ -3714,7 +3730,7 @@ function loadStandards(root2) {
|
|
|
3714
3730
|
const p = path37__default.join(root2, rel);
|
|
3715
3731
|
let text;
|
|
3716
3732
|
try {
|
|
3717
|
-
text =
|
|
3733
|
+
text = fs7__default.readFileSync(p, "utf8");
|
|
3718
3734
|
} catch {
|
|
3719
3735
|
continue;
|
|
3720
3736
|
}
|
|
@@ -5376,7 +5392,7 @@ function registerModels(program) {
|
|
|
5376
5392
|
);
|
|
5377
5393
|
});
|
|
5378
5394
|
applyGlobalOptions(modeCmd);
|
|
5379
|
-
const
|
|
5395
|
+
const resolve21 = cmd.command("resolve").description("resolve a Code Mode to pack + underlying model + fit (no download)").argument("[mode]", "spark | flow | forge (default: auto-fit or configured default)").action(function(modeArg) {
|
|
5380
5396
|
const global = readGlobal(this);
|
|
5381
5397
|
const root2 = rootOf(global);
|
|
5382
5398
|
const sys = gatherSystemMemory();
|
|
@@ -5408,7 +5424,7 @@ function registerModels(program) {
|
|
|
5408
5424
|
info(c.yellow(" will not fit \u2014 choose a lower mode or free memory before loading"));
|
|
5409
5425
|
}
|
|
5410
5426
|
});
|
|
5411
|
-
applyGlobalOptions(
|
|
5427
|
+
applyGlobalOptions(resolve21);
|
|
5412
5428
|
const installCmd = cmd.command("install").description("resolve the best Code Mode for this machine and install the pack").argument("[mode]", "spark | flow | forge (default: auto-fit)").option("--dry-run", "print the install plan only \u2014 do not download").option("--yes", "skip prompts (install already runs by default)").action(async function(modeArg, opts) {
|
|
5413
5429
|
const global = readGlobal(this);
|
|
5414
5430
|
const root2 = rootOf(global);
|
|
@@ -5645,7 +5661,7 @@ function registerModels(program) {
|
|
|
5645
5661
|
);
|
|
5646
5662
|
}
|
|
5647
5663
|
} else {
|
|
5648
|
-
if (!target.path || !
|
|
5664
|
+
if (!target.path || !fs7.existsSync(target.path)) {
|
|
5649
5665
|
throw new CliError(
|
|
5650
5666
|
`model file not found at ${target.path || "(unknown path)"} \u2014 it may already be removed.`,
|
|
5651
5667
|
ExitCode.NOT_FOUND
|
|
@@ -5659,7 +5675,7 @@ function registerModels(program) {
|
|
|
5659
5675
|
}
|
|
5660
5676
|
if (!global.json) info(c.dim(` $ rm ${target.path}`));
|
|
5661
5677
|
try {
|
|
5662
|
-
|
|
5678
|
+
fs7.unlinkSync(target.path);
|
|
5663
5679
|
} catch (e) {
|
|
5664
5680
|
const msg = e instanceof Error ? e.message : String(e);
|
|
5665
5681
|
throw new CliError(`could not delete ${target.path}: ${msg}`, ExitCode.ERROR);
|
|
@@ -5798,8 +5814,8 @@ function registerModels(program) {
|
|
|
5798
5814
|
});
|
|
5799
5815
|
if (opts.out) {
|
|
5800
5816
|
const outPath = path37.resolve(opts.out);
|
|
5801
|
-
|
|
5802
|
-
|
|
5817
|
+
fs7.mkdirSync(path37.dirname(outPath), { recursive: true });
|
|
5818
|
+
fs7.writeFileSync(outPath, `${JSON.stringify(report, null, 2)}
|
|
5803
5819
|
`);
|
|
5804
5820
|
if (!global.json) info(c.dim(` wrote ${outPath}`));
|
|
5805
5821
|
}
|
|
@@ -5913,11 +5929,11 @@ function fitColor(label) {
|
|
|
5913
5929
|
return label;
|
|
5914
5930
|
}
|
|
5915
5931
|
function confirmYesNo(question) {
|
|
5916
|
-
return new Promise((
|
|
5932
|
+
return new Promise((resolve21) => {
|
|
5917
5933
|
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
5918
5934
|
rl.question(`${question} [y/N] `, (answer) => {
|
|
5919
5935
|
rl.close();
|
|
5920
|
-
|
|
5936
|
+
resolve21(/^y(es)?$/i.test(answer.trim()));
|
|
5921
5937
|
});
|
|
5922
5938
|
});
|
|
5923
5939
|
}
|
|
@@ -5997,7 +6013,7 @@ function codeConfigPath(root2) {
|
|
|
5997
6013
|
}
|
|
5998
6014
|
function loadCodeConfig(root2) {
|
|
5999
6015
|
try {
|
|
6000
|
-
const raw = JSON.parse(
|
|
6016
|
+
const raw = JSON.parse(fs7.readFileSync(codeConfigPath(root2), "utf8"));
|
|
6001
6017
|
return sanitize(raw);
|
|
6002
6018
|
} catch {
|
|
6003
6019
|
return {};
|
|
@@ -6064,7 +6080,7 @@ function contextBudgetFor(config, modelContextWindow) {
|
|
|
6064
6080
|
var MCP_CONFIG_FILES = [".cursor/mcp.json", ".vscode/mcp.json", ".mcp.json"];
|
|
6065
6081
|
function readMcpServersFile(file) {
|
|
6066
6082
|
try {
|
|
6067
|
-
const raw = JSON.parse(
|
|
6083
|
+
const raw = JSON.parse(fs7.readFileSync(file, "utf8"));
|
|
6068
6084
|
const map = raw.mcpServers ?? raw.servers;
|
|
6069
6085
|
return map && typeof map === "object" ? parseMcpServers(map) : {};
|
|
6070
6086
|
} catch {
|
|
@@ -6104,7 +6120,7 @@ function registerCode(program) {
|
|
|
6104
6120
|
try {
|
|
6105
6121
|
const { parseMode: parseMode2, resolveMode: resolveMode2, readOrchestratorState: readOrchestratorState2, activePin: activePin2 } = await import('./model-orchestrator-LHYPJBFH.js');
|
|
6106
6122
|
const { gatherSystemMemory: gatherSystemMemory2 } = await import('./local-runtime-2ED33KK6.js');
|
|
6107
|
-
const { loadGraph: loadGraph2 } = await import('./load-
|
|
6123
|
+
const { loadGraph: loadGraph2 } = await import('./load-WKIZF2AK.js');
|
|
6108
6124
|
const state = readOrchestratorState2();
|
|
6109
6125
|
const mode = parseMode2(modeFlag) ?? state.defaultMode ?? void 0;
|
|
6110
6126
|
const pin = mode ? activePin2(mode, state) : null;
|
|
@@ -6188,7 +6204,7 @@ function registerCode(program) {
|
|
|
6188
6204
|
if (!(process.stdin.isTTY && process.stdout.isTTY)) {
|
|
6189
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)');
|
|
6190
6206
|
}
|
|
6191
|
-
const { runInteractive } = await import('./interactive-
|
|
6207
|
+
const { runInteractive } = await import('./interactive-R5VQGDWP.js');
|
|
6192
6208
|
await runInteractive(
|
|
6193
6209
|
rootOf(global),
|
|
6194
6210
|
global,
|
|
@@ -6221,7 +6237,7 @@ function registerCode(program) {
|
|
|
6221
6237
|
let mockReply;
|
|
6222
6238
|
if (opts.mock) {
|
|
6223
6239
|
try {
|
|
6224
|
-
mockReply =
|
|
6240
|
+
mockReply = fs7.readFileSync(opts.mock, "utf8");
|
|
6225
6241
|
} catch {
|
|
6226
6242
|
throw new CliError(`couldn't read the --mock file: ${opts.mock}`, ExitCode.USAGE_ERROR);
|
|
6227
6243
|
}
|
|
@@ -6277,11 +6293,11 @@ function registerCode(program) {
|
|
|
6277
6293
|
const { loadOrDiscoverFederation } = await import('./federation-MDQPO3PW.js');
|
|
6278
6294
|
const { resolveExecutionEnv } = await import('./execution-env-4MS5AYAN.js');
|
|
6279
6295
|
const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-ELWF3Z6H.js');
|
|
6280
|
-
const { startCodeRuntimeSession } = await import('./runtime-session-
|
|
6296
|
+
const { startCodeRuntimeSession } = await import('./runtime-session-5NRB6BTR.js');
|
|
6281
6297
|
const { resolveGraphBackend } = await import('./graph-backend-GBL33GMW.js');
|
|
6282
6298
|
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
6283
6299
|
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
6284
|
-
const { vgdRequest: vgdRequest2 } = await import('./vgd-
|
|
6300
|
+
const { vgdRequest: vgdRequest2 } = await import('./vgd-KC5RCOP6.js');
|
|
6285
6301
|
const federation = loadOrDiscoverFederation(root2);
|
|
6286
6302
|
const modelProfile = mergeModelExecutionProfile(
|
|
6287
6303
|
resolveModelExecutionProfile({
|
|
@@ -6327,7 +6343,7 @@ ${res.stderr}` : ""),
|
|
|
6327
6343
|
exitCode: res.status ?? 1
|
|
6328
6344
|
};
|
|
6329
6345
|
};
|
|
6330
|
-
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-
|
|
6346
|
+
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-YXQS6HTO.js');
|
|
6331
6347
|
const vgBuiltin = createVgBuiltinMcpTools({
|
|
6332
6348
|
getGraph: () => graph,
|
|
6333
6349
|
root: root2,
|
|
@@ -6409,7 +6425,7 @@ ${res.stderr}` : ""),
|
|
|
6409
6425
|
if (!autonomous && !tty) {
|
|
6410
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).");
|
|
6411
6427
|
}
|
|
6412
|
-
const { agentTask } = await import('./interactive-
|
|
6428
|
+
const { agentTask } = await import('./interactive-R5VQGDWP.js');
|
|
6413
6429
|
const { nodeCodeFs } = await import('./session-2JT4AUZT.js');
|
|
6414
6430
|
const { TtyPrompter } = await import('./ui-K7D3BCHD.js');
|
|
6415
6431
|
let priorSummary;
|
|
@@ -6419,7 +6435,7 @@ ${res.stderr}` : ""),
|
|
|
6419
6435
|
if (prev) priorSummary = summarizeSession(prev);
|
|
6420
6436
|
}
|
|
6421
6437
|
const prompter = tty ? new TtyPrompter() : void 0;
|
|
6422
|
-
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-
|
|
6438
|
+
const { createVgBuiltinMcpTools, mergeExternalToolsets } = await import('./vg-mcp-bridge-YXQS6HTO.js');
|
|
6423
6439
|
const vgBuiltin = createVgBuiltinMcpTools({
|
|
6424
6440
|
getGraph: () => graph,
|
|
6425
6441
|
root: root2,
|
|
@@ -6443,11 +6459,11 @@ ${res.stderr}` : ""),
|
|
|
6443
6459
|
const { loadFederation } = await import('./federation-MDQPO3PW.js');
|
|
6444
6460
|
const { resolveExecutionEnv } = await import('./execution-env-4MS5AYAN.js');
|
|
6445
6461
|
const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-ELWF3Z6H.js');
|
|
6446
|
-
const { startCodeRuntimeSession } = await import('./runtime-session-
|
|
6462
|
+
const { startCodeRuntimeSession } = await import('./runtime-session-5NRB6BTR.js');
|
|
6447
6463
|
const { resolveGraphBackend } = await import('./graph-backend-GBL33GMW.js');
|
|
6448
6464
|
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
6449
6465
|
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
6450
|
-
const { vgdRequest: vgdRequest2 } = await import('./vgd-
|
|
6466
|
+
const { vgdRequest: vgdRequest2 } = await import('./vgd-KC5RCOP6.js');
|
|
6451
6467
|
const federation = loadFederation(root2);
|
|
6452
6468
|
const modelProfile = mergeModelExecutionProfile(
|
|
6453
6469
|
resolveModelExecutionProfile({
|
|
@@ -6539,7 +6555,7 @@ ${res.stderr}` : ""),
|
|
|
6539
6555
|
attribution: { client: "vg-code", provider: providerSlug, model: primary?.model }
|
|
6540
6556
|
});
|
|
6541
6557
|
if (opts.out) {
|
|
6542
|
-
|
|
6558
|
+
fs7.writeFileSync(opts.out, JSON.stringify(result, null, 2) + "\n");
|
|
6543
6559
|
}
|
|
6544
6560
|
if (global.json) {
|
|
6545
6561
|
json(result);
|
|
@@ -6591,11 +6607,11 @@ function resolveSecurityTierFlag(flag, fromConfig, auto) {
|
|
|
6591
6607
|
return auto ? "L1" : "L0";
|
|
6592
6608
|
}
|
|
6593
6609
|
function confirm(question) {
|
|
6594
|
-
return new Promise((
|
|
6610
|
+
return new Promise((resolve21) => {
|
|
6595
6611
|
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
6596
6612
|
rl.question(`${question} [y/N] `, (answer) => {
|
|
6597
6613
|
rl.close();
|
|
6598
|
-
|
|
6614
|
+
resolve21(/^y(es)?$/i.test(answer.trim()));
|
|
6599
6615
|
});
|
|
6600
6616
|
});
|
|
6601
6617
|
}
|
|
@@ -6752,7 +6768,7 @@ async function addCmd(root2, rest, opts, asJson) {
|
|
|
6752
6768
|
}
|
|
6753
6769
|
function readPackageVersion(root2) {
|
|
6754
6770
|
try {
|
|
6755
|
-
const pkg = JSON.parse(
|
|
6771
|
+
const pkg = JSON.parse(fs7__default.readFileSync(path37__default.join(root2, "package.json"), "utf8"));
|
|
6756
6772
|
return typeof pkg.version === "string" ? pkg.version : void 0;
|
|
6757
6773
|
} catch {
|
|
6758
6774
|
return void 0;
|
|
@@ -6760,7 +6776,7 @@ function readPackageVersion(root2) {
|
|
|
6760
6776
|
}
|
|
6761
6777
|
function readOptionalFile(p) {
|
|
6762
6778
|
try {
|
|
6763
|
-
const t =
|
|
6779
|
+
const t = fs7__default.readFileSync(p, "utf8");
|
|
6764
6780
|
return t.trim() ? t : void 0;
|
|
6765
6781
|
} catch {
|
|
6766
6782
|
return void 0;
|
|
@@ -6908,8 +6924,8 @@ function registerExport(program) {
|
|
|
6908
6924
|
out(content.trimEnd());
|
|
6909
6925
|
return;
|
|
6910
6926
|
}
|
|
6911
|
-
|
|
6912
|
-
|
|
6927
|
+
fs7.mkdirSync(path37.dirname(path37.resolve(file)), { recursive: true });
|
|
6928
|
+
fs7.writeFileSync(file, content);
|
|
6913
6929
|
info(`${c.green("\u2714")} wrote ${file} ${c.dim(`(${format})`)}`);
|
|
6914
6930
|
});
|
|
6915
6931
|
applyGlobalOptions(cmd);
|
|
@@ -6932,24 +6948,30 @@ function registerBundle(program) {
|
|
|
6932
6948
|
} catch {
|
|
6933
6949
|
throw new CliError("no grammars found to bundle (run a build first)", ExitCode.ERROR);
|
|
6934
6950
|
}
|
|
6935
|
-
|
|
6951
|
+
fs7.mkdirSync(path37.join(outDir, "grammars"), { recursive: true });
|
|
6936
6952
|
let grammarCount = 0;
|
|
6937
6953
|
for (const { fileName, absPath } of grammarFiles) {
|
|
6938
|
-
|
|
6954
|
+
fs7.copyFileSync(absPath, path37.join(outDir, "grammars", fileName));
|
|
6939
6955
|
grammarCount++;
|
|
6940
6956
|
}
|
|
6941
6957
|
const included = [`grammars/ (${grammarCount} .wasm)`];
|
|
6942
6958
|
const graphSrc = resolveGraphPath(root2, global.graph);
|
|
6943
|
-
if (
|
|
6944
|
-
|
|
6959
|
+
if (fs7.existsSync(graphSrc)) {
|
|
6960
|
+
fs7.copyFileSync(graphSrc, path37.join(outDir, "graph.json"));
|
|
6945
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
|
+
}
|
|
6946
6968
|
}
|
|
6947
6969
|
const cat = catalogPath(root2);
|
|
6948
|
-
if (
|
|
6949
|
-
|
|
6970
|
+
if (fs7.existsSync(cat)) {
|
|
6971
|
+
fs7.copyFileSync(cat, path37.join(outDir, "vibgrate.lib.json"));
|
|
6950
6972
|
included.push("vibgrate.lib.json");
|
|
6951
|
-
if (
|
|
6952
|
-
|
|
6973
|
+
if (fs7.existsSync(libDir(root2))) {
|
|
6974
|
+
fs7.cpSync(libDir(root2), path37.join(outDir, "lib"), { recursive: true });
|
|
6953
6975
|
included.push("lib/");
|
|
6954
6976
|
}
|
|
6955
6977
|
}
|
|
@@ -6961,7 +6983,7 @@ function registerBundle(program) {
|
|
|
6961
6983
|
included,
|
|
6962
6984
|
usage: "Run `vg build --grammars <this dir>/grammars` to build fully offline."
|
|
6963
6985
|
};
|
|
6964
|
-
|
|
6986
|
+
fs7.writeFileSync(path37.join(outDir, "MANIFEST.json"), `${stableStringify(manifest, 2)}
|
|
6965
6987
|
`);
|
|
6966
6988
|
if (global.json) {
|
|
6967
6989
|
json({ out: path37.relative(root2, outDir), ...manifest });
|
|
@@ -6987,7 +7009,7 @@ async function runDoctor(global) {
|
|
|
6987
7009
|
const root2 = rootOf(global);
|
|
6988
7010
|
const local = global.local === true;
|
|
6989
7011
|
const graphPath = resolveGraphPath(root2, global.graph);
|
|
6990
|
-
const configFile = CONFIG_BASENAMES.find((f) =>
|
|
7012
|
+
const configFile = CONFIG_BASENAMES.find((f) => fs7.existsSync(path37.join(root2, f))) ?? null;
|
|
6991
7013
|
const graph = loadGraph(root2, graphPath);
|
|
6992
7014
|
let staleFiles = null;
|
|
6993
7015
|
if (graph) {
|
|
@@ -7020,7 +7042,7 @@ async function runDoctor(global) {
|
|
|
7020
7042
|
},
|
|
7021
7043
|
libCatalog: {
|
|
7022
7044
|
path: path37.relative(root2, catalogPath(root2)),
|
|
7023
|
-
present:
|
|
7045
|
+
present: fs7.existsSync(catalogPath(root2)),
|
|
7024
7046
|
libraries: libCount
|
|
7025
7047
|
},
|
|
7026
7048
|
credentials: creds,
|
|
@@ -7281,7 +7303,7 @@ function registerDaemon(program) {
|
|
|
7281
7303
|
if (!await vgdIsRunning({ socketPath })) {
|
|
7282
7304
|
throw new CliError(`vgd is not running \u2014 start it with \`vg daemon ensure\` (${socketPath})`, ExitCode.NOT_FOUND);
|
|
7283
7305
|
}
|
|
7284
|
-
const { loadGraph: loadGraph2 } = await import('./load-
|
|
7306
|
+
const { loadGraph: loadGraph2 } = await import('./load-WKIZF2AK.js');
|
|
7285
7307
|
const { detectGitRef } = await import('./git-ref-RSRAN4OH.js');
|
|
7286
7308
|
const { repositoryIdFromRoot } = await import('./paths-62AKTFSR.js');
|
|
7287
7309
|
const opts = this.opts();
|
|
@@ -7498,7 +7520,7 @@ function registerPolicy(program) {
|
|
|
7498
7520
|
const global = readGlobal(this);
|
|
7499
7521
|
let raw;
|
|
7500
7522
|
try {
|
|
7501
|
-
raw =
|
|
7523
|
+
raw = fs7.readFileSync(file, "utf8");
|
|
7502
7524
|
} catch {
|
|
7503
7525
|
throw new CliError(`cannot read ${file}`, ExitCode.NOT_FOUND);
|
|
7504
7526
|
}
|
|
@@ -7630,7 +7652,7 @@ var initCommand = new Command("init").description("Initialize vibgrate in a proj
|
|
|
7630
7652
|
console.log(chalk7.green("\u2714") + ` Created ${chalk7.bold("vibgrate.config.ts")}`);
|
|
7631
7653
|
}
|
|
7632
7654
|
if (opts.baseline) {
|
|
7633
|
-
const { runBaseline } = await import('./baseline-
|
|
7655
|
+
const { runBaseline } = await import('./baseline-MROWBNK7.js');
|
|
7634
7656
|
await runBaseline(rootDir);
|
|
7635
7657
|
}
|
|
7636
7658
|
console.log("");
|
|
@@ -7740,9 +7762,9 @@ async function fileReferencesIdentifier(rootDir, relFile, identifier, readFile3)
|
|
|
7740
7762
|
}
|
|
7741
7763
|
async function defaultReadFile(absPath) {
|
|
7742
7764
|
try {
|
|
7743
|
-
const stat2 = await
|
|
7765
|
+
const stat2 = await fs20.stat(absPath);
|
|
7744
7766
|
if (!stat2.isFile() || stat2.size > MAX_FILE_BYTES) return null;
|
|
7745
|
-
return await
|
|
7767
|
+
return await fs20.readFile(absPath, "utf8");
|
|
7746
7768
|
} catch {
|
|
7747
7769
|
return null;
|
|
7748
7770
|
}
|
|
@@ -8389,7 +8411,7 @@ var SKIP_DIRS2 = /* @__PURE__ */ new Set([
|
|
|
8389
8411
|
function scanStaleness(rootDir, artifactPath) {
|
|
8390
8412
|
let ref;
|
|
8391
8413
|
try {
|
|
8392
|
-
ref =
|
|
8414
|
+
ref = fs7.statSync(artifactPath).mtimeMs;
|
|
8393
8415
|
} catch {
|
|
8394
8416
|
return { stale: false };
|
|
8395
8417
|
}
|
|
@@ -8401,7 +8423,7 @@ function scanStaleness(rootDir, artifactPath) {
|
|
|
8401
8423
|
if (depth > 8 || scanned > MAX_ENTRIES) return;
|
|
8402
8424
|
let entries;
|
|
8403
8425
|
try {
|
|
8404
|
-
entries =
|
|
8426
|
+
entries = fs7.readdirSync(dir, { withFileTypes: true });
|
|
8405
8427
|
} catch {
|
|
8406
8428
|
return;
|
|
8407
8429
|
}
|
|
@@ -8416,7 +8438,7 @@ function scanStaleness(rootDir, artifactPath) {
|
|
|
8416
8438
|
const abs = path37.join(dir, e.name);
|
|
8417
8439
|
let mtimeMs;
|
|
8418
8440
|
try {
|
|
8419
|
-
mtimeMs =
|
|
8441
|
+
mtimeMs = fs7.statSync(abs).mtimeMs;
|
|
8420
8442
|
} catch {
|
|
8421
8443
|
continue;
|
|
8422
8444
|
}
|
|
@@ -8553,7 +8575,7 @@ function analyzeTree(root2, packages) {
|
|
|
8553
8575
|
if (depth > MAX_DEPTH || filesSeen >= MAX_FILES) return;
|
|
8554
8576
|
let entries;
|
|
8555
8577
|
try {
|
|
8556
|
-
entries =
|
|
8578
|
+
entries = fs7.readdirSync(dir, { withFileTypes: true });
|
|
8557
8579
|
} catch {
|
|
8558
8580
|
return;
|
|
8559
8581
|
}
|
|
@@ -8571,8 +8593,8 @@ function analyzeTree(root2, packages) {
|
|
|
8571
8593
|
const full = path37.join(dir, entry.name);
|
|
8572
8594
|
let content;
|
|
8573
8595
|
try {
|
|
8574
|
-
if (
|
|
8575
|
-
content =
|
|
8596
|
+
if (fs7.statSync(full).size > MAX_FILE_BYTES2) continue;
|
|
8597
|
+
content = fs7.readFileSync(full, "utf8");
|
|
8576
8598
|
} catch {
|
|
8577
8599
|
continue;
|
|
8578
8600
|
}
|
|
@@ -8940,8 +8962,8 @@ async function fetchLatestVersion() {
|
|
|
8940
8962
|
}
|
|
8941
8963
|
async function writeCache(data) {
|
|
8942
8964
|
try {
|
|
8943
|
-
await
|
|
8944
|
-
await
|
|
8965
|
+
await fs20.mkdir(CACHE_DIR, { recursive: true });
|
|
8966
|
+
await fs20.writeFile(CACHE_FILE, JSON.stringify(data), "utf-8");
|
|
8945
8967
|
} catch {
|
|
8946
8968
|
}
|
|
8947
8969
|
}
|
|
@@ -8952,7 +8974,7 @@ function detectGlobalInstall(execPath = process.argv[1] || "", cwd = process.cwd
|
|
|
8952
8974
|
if (!execPath) return null;
|
|
8953
8975
|
let resolved = execPath;
|
|
8954
8976
|
try {
|
|
8955
|
-
resolved =
|
|
8977
|
+
resolved = fs7.realpathSync(execPath);
|
|
8956
8978
|
} catch {
|
|
8957
8979
|
}
|
|
8958
8980
|
const p = resolved.replace(/\\/g, "/");
|
|
@@ -9053,11 +9075,11 @@ async function getLocalDependencyState(cwd, pkg = PACKAGE_NAME) {
|
|
|
9053
9075
|
async function confirmWorkspaceRoot(pm) {
|
|
9054
9076
|
if (!(process.stdin.isTTY && process.stdout.isTTY)) return false;
|
|
9055
9077
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
9056
|
-
return new Promise((
|
|
9078
|
+
return new Promise((resolve21) => {
|
|
9057
9079
|
rl.question(chalk7.yellow(`Update the ${pm} workspace root with -w? [y/N]: `), (ans) => {
|
|
9058
9080
|
rl.close();
|
|
9059
9081
|
const t = ans.trim().toLowerCase();
|
|
9060
|
-
|
|
9082
|
+
resolve21(t === "y" || t === "yes");
|
|
9061
9083
|
});
|
|
9062
9084
|
});
|
|
9063
9085
|
}
|
|
@@ -9424,14 +9446,14 @@ function promptPlanSelection(response) {
|
|
|
9424
9446
|
const defaultIdx = plans.findIndex((p) => p.tier === response.recommended);
|
|
9425
9447
|
const def = defaultIdx >= 0 ? defaultIdx + 1 : 1;
|
|
9426
9448
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
9427
|
-
return new Promise((
|
|
9449
|
+
return new Promise((resolve21) => {
|
|
9428
9450
|
rl.question(`Plan [1-${plans.length}, default ${def}, q to cancel]: `, (ans) => {
|
|
9429
9451
|
rl.close();
|
|
9430
9452
|
const t = ans.trim().toLowerCase();
|
|
9431
|
-
if (t === "q" || t === "quit") return
|
|
9453
|
+
if (t === "q" || t === "quit") return resolve21(null);
|
|
9432
9454
|
const n = t === "" ? def : Number.parseInt(t, 10);
|
|
9433
|
-
if (!Number.isInteger(n) || n < 1 || n > plans.length) return
|
|
9434
|
-
|
|
9455
|
+
if (!Number.isInteger(n) || n < 1 || n > plans.length) return resolve21(null);
|
|
9456
|
+
resolve21(plans[n - 1].tier);
|
|
9435
9457
|
});
|
|
9436
9458
|
});
|
|
9437
9459
|
}
|
|
@@ -10265,7 +10287,7 @@ function openUrl(url) {
|
|
|
10265
10287
|
}
|
|
10266
10288
|
|
|
10267
10289
|
// src/reporting/commands/login.ts
|
|
10268
|
-
var delay = (ms) => new Promise((
|
|
10290
|
+
var delay = (ms) => new Promise((resolve21) => setTimeout(resolve21, ms));
|
|
10269
10291
|
function isInside(dir, file) {
|
|
10270
10292
|
const rel = path37.relative(dir, file);
|
|
10271
10293
|
return !!rel && !rel.startsWith("..") && !path37.isAbsolute(rel);
|
|
@@ -11640,17 +11662,17 @@ function resolveSigningKey(root2, explicit) {
|
|
|
11640
11662
|
const chosen = process.env.VG_ATTEST_KEY;
|
|
11641
11663
|
const keyPath = chosen ? path37.resolve(chosen) : path37.join(root2, ".vibgrate", DEFAULT_KEY);
|
|
11642
11664
|
let minted = false;
|
|
11643
|
-
if (!
|
|
11665
|
+
if (!fs7.existsSync(keyPath)) {
|
|
11644
11666
|
if (chosen) throw new CliError(`signing key not found: ${chosen}`, ExitCode.USAGE_ERROR);
|
|
11645
11667
|
const kp = generateKeypair();
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11668
|
+
fs7.mkdirSync(path37.dirname(keyPath), { recursive: true });
|
|
11669
|
+
fs7.writeFileSync(keyPath, kp.privatePem, { mode: 384 });
|
|
11670
|
+
fs7.writeFileSync(`${keyPath}.pub`, kp.publicPem);
|
|
11649
11671
|
minted = true;
|
|
11650
11672
|
}
|
|
11651
11673
|
let key2;
|
|
11652
11674
|
try {
|
|
11653
|
-
key2 = crypto3.createPrivateKey(
|
|
11675
|
+
key2 = crypto3.createPrivateKey(fs7.readFileSync(keyPath, "utf8"));
|
|
11654
11676
|
} catch {
|
|
11655
11677
|
throw new CliError(`could not read an Ed25519 private key from ${keyPath}`, ExitCode.USAGE_ERROR);
|
|
11656
11678
|
}
|
|
@@ -11661,8 +11683,8 @@ function resolveSigningKey(root2, explicit) {
|
|
|
11661
11683
|
}
|
|
11662
11684
|
function writeBundle(input) {
|
|
11663
11685
|
const dir = input.outDir;
|
|
11664
|
-
|
|
11665
|
-
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)}
|
|
11666
11688
|
`);
|
|
11667
11689
|
write("result.json", input.result);
|
|
11668
11690
|
write(path37.join("inputs", "advisory.json"), input.advisory);
|
|
@@ -11686,13 +11708,13 @@ function writeBundle(input) {
|
|
|
11686
11708
|
disclaimer: input.regime.disclaimer
|
|
11687
11709
|
});
|
|
11688
11710
|
if (input.envelope) {
|
|
11689
|
-
|
|
11711
|
+
fs7.writeFileSync(path37.join(dir, "evidence.intoto.jsonl"), `${JSON.stringify(input.envelope)}
|
|
11690
11712
|
`);
|
|
11691
11713
|
}
|
|
11692
11714
|
if (input.timestampToken) {
|
|
11693
|
-
|
|
11715
|
+
fs7.writeFileSync(path37.join(dir, "timestamp.tsr"), input.timestampToken);
|
|
11694
11716
|
}
|
|
11695
|
-
|
|
11717
|
+
fs7.writeFileSync(path37.join(dir, "VERIFY.md"), verifyDoc(input));
|
|
11696
11718
|
return dir;
|
|
11697
11719
|
}
|
|
11698
11720
|
function verifyDoc(input) {
|
|
@@ -12035,7 +12057,7 @@ var packCmd = new Command("pack").description("Build the submission pack a human
|
|
|
12035
12057
|
const stage = opts.stage ?? regime.clocks[0]?.stage ?? "early-warning";
|
|
12036
12058
|
const md = buildPack(result, regime, org, stage);
|
|
12037
12059
|
if (opts.out) {
|
|
12038
|
-
|
|
12060
|
+
fs7.writeFileSync(path37.resolve(rootDir, opts.out), md);
|
|
12039
12061
|
console.error(chalk7.green("\u2714") + ` pack written to ${opts.out}`);
|
|
12040
12062
|
} else {
|
|
12041
12063
|
console.log(md);
|
|
@@ -12078,19 +12100,19 @@ var drillCmd = new Command("drill").description("Timed dry-run of the determinat
|
|
|
12078
12100
|
});
|
|
12079
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) => {
|
|
12080
12102
|
const abs = path37.resolve(bundlePath);
|
|
12081
|
-
const envPath =
|
|
12082
|
-
if (!
|
|
12083
|
-
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]);
|
|
12084
12106
|
const resultPath = path37.join(path37.dirname(envPath), "result.json");
|
|
12085
|
-
const result =
|
|
12086
|
-
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;
|
|
12087
12109
|
const v = verifyEvidenceEnvelope(envelope, { publicKeyPem, result });
|
|
12088
12110
|
const color = v.status === "verified" ? chalk7.green : v.status === "failed" ? chalk7.red : chalk7.yellow;
|
|
12089
12111
|
console.log(" " + color(v.status.toUpperCase()) + ` ${v.reason}`);
|
|
12090
12112
|
if (v.evidenceId) console.log(" " + chalk7.dim(`evidence ${v.evidenceId} \xB7 regime ${v.regime} \xB7 advisory ${v.advisoryId} \xB7 ${v.overallStatus}`));
|
|
12091
12113
|
const tsrPath = path37.join(path37.dirname(envPath), "timestamp.tsr");
|
|
12092
|
-
if (
|
|
12093
|
-
const t = verifyTimestamp(
|
|
12114
|
+
if (fs7.existsSync(tsrPath) && result) {
|
|
12115
|
+
const t = verifyTimestamp(fs7.readFileSync(tsrPath), exposureSubjectDigest(result));
|
|
12094
12116
|
const tcolor = t.imprintMatches ? chalk7.green : chalk7.red;
|
|
12095
12117
|
console.log(" " + tcolor("TIMESTAMP") + ` ${t.reason}`);
|
|
12096
12118
|
}
|
|
@@ -12189,9 +12211,9 @@ var pushCmd = new Command("push").description("Push the product registry (and an
|
|
|
12189
12211
|
let exposure;
|
|
12190
12212
|
if (opts.result) {
|
|
12191
12213
|
const raw = path37.resolve(rootDir, opts.result);
|
|
12192
|
-
const resultPath =
|
|
12193
|
-
if (!
|
|
12194
|
-
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"));
|
|
12195
12217
|
}
|
|
12196
12218
|
const payload = { schemaVersion: "evidence-push-1", regime: regime.id, generatedAt: nowIso(), signed: Boolean(opts.signed), products: productPayload, exposure };
|
|
12197
12219
|
const body = JSON.stringify(payload);
|
|
@@ -12381,7 +12403,7 @@ function dispatch(argv, cwd) {
|
|
|
12381
12403
|
}
|
|
12382
12404
|
const looksLikeQuestion = /\s/.test(first) || first.endsWith("?");
|
|
12383
12405
|
if (looksLikeQuestion) return ["ask", ...args];
|
|
12384
|
-
if (
|
|
12406
|
+
if (fs7.existsSync(path37.resolve(cwd, first))) {
|
|
12385
12407
|
return [hasBuildOnlyFlag(args) ? "build" : "scan", ...args];
|
|
12386
12408
|
}
|
|
12387
12409
|
const moved = MOVED_COMMANDS[first];
|