@lzehrung/codegraph 2.3.15 → 2.3.17
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/README.md +1 -1
- package/codegraph-skill/codegraph/SKILL.md +11 -3
- package/dist/bin/cli.js +415 -170
- package/dist/cli/commandTable.d.ts.map +1 -1
- package/dist/cli/commandTable.js +14 -1
- package/dist/cli/commandTable.js.map +1 -1
- package/dist/cli/help.d.ts +4 -4
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +8 -7
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/mcp.js +11 -6
- package/dist/cli/mcp.js.map +1 -1
- package/dist/cli/options.d.ts.map +1 -1
- package/dist/cli/options.js +3 -2
- package/dist/cli/options.js.map +1 -1
- package/dist/cli/orient.d.ts +6 -2
- package/dist/cli/orient.d.ts.map +1 -1
- package/dist/cli/orient.js +13 -1
- package/dist/cli/orient.js.map +1 -1
- package/dist/cli/progress.d.ts.map +1 -1
- package/dist/cli/progress.js +23 -9
- package/dist/cli/progress.js.map +1 -1
- package/dist/cli/server.d.ts.map +1 -1
- package/dist/cli/server.js +6 -2
- package/dist/cli/server.js.map +1 -1
- package/dist/indexer/build-cache/module-cache.d.ts +17 -0
- package/dist/indexer/build-cache/module-cache.d.ts.map +1 -1
- package/dist/indexer/build-cache/module-cache.js +62 -1
- package/dist/indexer/build-cache/module-cache.js.map +1 -1
- package/dist/indexer/build-cache/project-snapshot.d.ts +1 -0
- package/dist/indexer/build-cache/project-snapshot.d.ts.map +1 -1
- package/dist/indexer/build-cache/project-snapshot.js +70 -11
- package/dist/indexer/build-cache/project-snapshot.js.map +1 -1
- package/dist/indexer/build-cache.d.ts +1 -1
- package/dist/indexer/build-cache.d.ts.map +1 -1
- package/dist/indexer/build-cache.js +1 -1
- package/dist/indexer/build-cache.js.map +1 -1
- package/dist/indexer/build-index.d.ts.map +1 -1
- package/dist/indexer/build-index.js +131 -28
- package/dist/indexer/build-index.js.map +1 -1
- package/dist/mcp/handlers.d.ts +6 -1
- package/dist/mcp/handlers.d.ts.map +1 -1
- package/dist/mcp/handlers.js +13 -9
- package/dist/mcp/handlers.js.map +1 -1
- package/dist/mcp/protocol.d.ts.map +1 -1
- package/dist/mcp/protocol.js +1 -1
- package/dist/mcp/protocol.js.map +1 -1
- package/docs/mcp.md +9 -9
- package/package.json +3 -3
package/dist/bin/cli.js
CHANGED
|
@@ -932,7 +932,7 @@ var init_options = __esm({
|
|
|
932
932
|
],
|
|
933
933
|
[
|
|
934
934
|
"mcp",
|
|
935
|
-
commandSchema([...SHARED_BUILD_FLAGS, "--allow-build", "--stdio", "--warmup", "--warmup-symbols"], [...SHARED_BUILD_OPTIONS, "--artifact", "--host", "--port", "--idle-timeout-ms"], {
|
|
935
|
+
commandSchema([...SHARED_BUILD_FLAGS, "--allow-build", "--stdio", "--warmup", "--warmup-symbols", "--no-warmup"], [...SHARED_BUILD_OPTIONS, "--artifact", "--host", "--port", "--idle-timeout-ms"], {
|
|
936
936
|
kind: "max",
|
|
937
937
|
max: 1,
|
|
938
938
|
usage: "Usage: codegraph mcp [serve] [--root <path>] [--stdio | --port <number>]"
|
|
@@ -947,6 +947,7 @@ var init_options = __esm({
|
|
|
947
947
|
"--replace",
|
|
948
948
|
"--warmup",
|
|
949
949
|
"--warmup-symbols",
|
|
950
|
+
"--no-warmup",
|
|
950
951
|
"--workers",
|
|
951
952
|
...JSON_OUTPUT_FLAGS
|
|
952
953
|
], [
|
|
@@ -969,7 +970,7 @@ var init_options = __esm({
|
|
|
969
970
|
],
|
|
970
971
|
[
|
|
971
972
|
"orient",
|
|
972
|
-
commandSchema([...SHARED_BUILD_FLAGS, ...JSON_OUTPUT_FLAGS], [...SHARED_BUILD_OPTIONS, "--budget", "--health"], {
|
|
973
|
+
commandSchema([...SHARED_BUILD_FLAGS, ...JSON_OUTPUT_FLAGS, ...REPORT_FLAGS], [...SHARED_BUILD_OPTIONS, ...REPORT_OPTIONS, "--budget", "--health"], {
|
|
973
974
|
kind: "any"
|
|
974
975
|
})
|
|
975
976
|
],
|
|
@@ -1159,6 +1160,7 @@ var init_options = __esm({
|
|
|
1159
1160
|
});
|
|
1160
1161
|
|
|
1161
1162
|
// dist/cli/progress.js
|
|
1163
|
+
import { performance as performance2 } from "node:perf_hooks";
|
|
1162
1164
|
function resolveCliProgressPresentation(input) {
|
|
1163
1165
|
if (input.policy === "never")
|
|
1164
1166
|
return "off";
|
|
@@ -1182,6 +1184,7 @@ function createInteractiveProgressDisplay(write, delayMs = 0) {
|
|
|
1182
1184
|
let activity = progressAction(mode);
|
|
1183
1185
|
let interval;
|
|
1184
1186
|
let delay2;
|
|
1187
|
+
let phaseStartedAt = performance2.now();
|
|
1185
1188
|
const clear = () => {
|
|
1186
1189
|
if (!rendered)
|
|
1187
1190
|
return;
|
|
@@ -1194,7 +1197,8 @@ function createInteractiveProgressDisplay(write, delayMs = 0) {
|
|
|
1194
1197
|
const frame = SPINNER_FRAMES[frameIndex % SPINNER_FRAMES.length];
|
|
1195
1198
|
frameIndex += 1;
|
|
1196
1199
|
const count = hasProgressCount(mode, current, total) ? formatProgressCount(current, total) : "";
|
|
1197
|
-
|
|
1200
|
+
const elapsed = ` (${formatDuration(performance2.now() - phaseStartedAt)})`;
|
|
1201
|
+
write(`${CLEAR_LINE}${activity}... ${frame}${count}${elapsed}`);
|
|
1198
1202
|
rendered = true;
|
|
1199
1203
|
};
|
|
1200
1204
|
const stopInterval = () => {
|
|
@@ -1217,6 +1221,7 @@ function createInteractiveProgressDisplay(write, delayMs = 0) {
|
|
|
1217
1221
|
total = update.total;
|
|
1218
1222
|
mode = update.mode ?? "build";
|
|
1219
1223
|
activity = update.activity ?? `${progressAction(mode)} project index`;
|
|
1224
|
+
phaseStartedAt = performance2.now();
|
|
1220
1225
|
const beginRendering = () => {
|
|
1221
1226
|
if (!active)
|
|
1222
1227
|
return;
|
|
@@ -1239,7 +1244,7 @@ function createInteractiveProgressDisplay(write, delayMs = 0) {
|
|
|
1239
1244
|
if (!rendered)
|
|
1240
1245
|
return;
|
|
1241
1246
|
clear();
|
|
1242
|
-
const verb = progressCompleteVerb(mode);
|
|
1247
|
+
const verb = progressCompleteVerb(update.mode ?? mode);
|
|
1243
1248
|
const fileCount = formatFileCount(update.total, "words");
|
|
1244
1249
|
const elapsed = update.elapsedMs === void 0 ? "" : ` in ${formatDuration(update.elapsedMs)}`;
|
|
1245
1250
|
write(`${verb} project index: ${fileCount}${elapsed}.
|
|
@@ -1263,6 +1268,8 @@ function createInteractiveProgressDisplay(write, delayMs = 0) {
|
|
|
1263
1268
|
current = update.current;
|
|
1264
1269
|
total = update.total;
|
|
1265
1270
|
mode = update.mode ?? mode;
|
|
1271
|
+
if (update.activity !== void 0 && update.activity !== activity)
|
|
1272
|
+
phaseStartedAt = performance2.now();
|
|
1266
1273
|
if (update.activity !== void 0)
|
|
1267
1274
|
activity = update.activity;
|
|
1268
1275
|
},
|
|
@@ -1296,6 +1303,7 @@ function createLogProgressDisplay(write, delayMs = 0) {
|
|
|
1296
1303
|
let activity = progressAction(mode);
|
|
1297
1304
|
let delay2;
|
|
1298
1305
|
let heartbeat;
|
|
1306
|
+
let phaseStartedAt = performance2.now();
|
|
1299
1307
|
const stopTimers = () => {
|
|
1300
1308
|
if (delay2 !== void 0) {
|
|
1301
1309
|
clearTimeout(delay2);
|
|
@@ -1316,7 +1324,8 @@ function createLogProgressDisplay(write, delayMs = 0) {
|
|
|
1316
1324
|
if (!active)
|
|
1317
1325
|
return;
|
|
1318
1326
|
const count = hasProgressCount(mode, current, total) ? `:${formatProgressCount(current, total)}` : "";
|
|
1319
|
-
|
|
1327
|
+
const elapsed = formatDuration(performance2.now() - phaseStartedAt);
|
|
1328
|
+
write(`[Progress] ${activity}${count}. (${elapsed})
|
|
1320
1329
|
`);
|
|
1321
1330
|
}, 1e3);
|
|
1322
1331
|
heartbeat.unref();
|
|
@@ -1329,6 +1338,7 @@ function createLogProgressDisplay(write, delayMs = 0) {
|
|
|
1329
1338
|
total = update.total;
|
|
1330
1339
|
mode = update.mode ?? "build";
|
|
1331
1340
|
activity = update.activity ?? `${progressAction(mode)} project index`;
|
|
1341
|
+
phaseStartedAt = performance2.now();
|
|
1332
1342
|
if (delayMs) {
|
|
1333
1343
|
delay2 = setTimeout(renderStart, delayMs);
|
|
1334
1344
|
delay2.unref();
|
|
@@ -1349,7 +1359,7 @@ function createLogProgressDisplay(write, delayMs = 0) {
|
|
|
1349
1359
|
stopTimers();
|
|
1350
1360
|
if (!rendered)
|
|
1351
1361
|
return;
|
|
1352
|
-
const verb = progressCompleteVerb(mode);
|
|
1362
|
+
const verb = progressCompleteVerb(update.mode ?? mode);
|
|
1353
1363
|
const elapsed = update.elapsedMs === void 0 ? "" : ` in ${formatDuration(update.elapsedMs)}`;
|
|
1354
1364
|
write(`[Progress] ${verb} project index: ${formatFileCount(update.total, "words")}${elapsed}.
|
|
1355
1365
|
`);
|
|
@@ -1366,17 +1376,22 @@ function createLogProgressDisplay(write, delayMs = 0) {
|
|
|
1366
1376
|
mode = update.mode ?? mode;
|
|
1367
1377
|
if (update.activity !== void 0)
|
|
1368
1378
|
activity = update.activity;
|
|
1369
|
-
|
|
1379
|
+
const activityChanged = activity !== previousActivity;
|
|
1380
|
+
if (activityChanged)
|
|
1381
|
+
phaseStartedAt = performance2.now();
|
|
1382
|
+
const isComplete = update.total > 0 && update.current >= update.total;
|
|
1383
|
+
const shouldPrintCount = rendered && (update.current === 1 || isComplete || update.current > 0 && update.current % 100 === 0);
|
|
1384
|
+
if (rendered && activityChanged && !shouldPrintCount) {
|
|
1370
1385
|
write(`[Progress] ${activity}.
|
|
1371
1386
|
`);
|
|
1372
1387
|
}
|
|
1373
|
-
|
|
1374
|
-
|
|
1388
|
+
if (shouldPrintCount) {
|
|
1389
|
+
const elapsed = formatDuration(performance2.now() - phaseStartedAt);
|
|
1375
1390
|
if (update.activity !== void 0) {
|
|
1376
|
-
write(`[Progress] ${activity}:${formatProgressCount(update.current, update.total)}.
|
|
1391
|
+
write(`[Progress] ${activity}:${formatProgressCount(update.current, update.total)}. (${elapsed})
|
|
1377
1392
|
`);
|
|
1378
1393
|
} else {
|
|
1379
|
-
write(`[Progress] ${formatFileCount(update.current)} processed.
|
|
1394
|
+
write(`[Progress] ${formatFileCount(update.current)} processed. (${elapsed})
|
|
1380
1395
|
`);
|
|
1381
1396
|
}
|
|
1382
1397
|
}
|
|
@@ -14221,12 +14236,12 @@ __export(projectFiles_exports, {
|
|
|
14221
14236
|
import fs6 from "node:fs";
|
|
14222
14237
|
import fsp5 from "node:fs/promises";
|
|
14223
14238
|
import path9 from "node:path";
|
|
14224
|
-
import { performance as
|
|
14239
|
+
import { performance as performance3 } from "node:perf_hooks";
|
|
14225
14240
|
function emitDiscoveryActivity(report, activity, current = 0, total = 0) {
|
|
14226
14241
|
report?.({ activity, current, total });
|
|
14227
14242
|
}
|
|
14228
14243
|
function emitDiscoveryTiming(record2, name, startedAt) {
|
|
14229
|
-
record2?.({ name, ms: Math.round(
|
|
14244
|
+
record2?.({ name, ms: Math.round(performance3.now() - startedAt) });
|
|
14230
14245
|
}
|
|
14231
14246
|
function createPathCheckProgressReporter(total, onProgress) {
|
|
14232
14247
|
onProgress?.(0, total);
|
|
@@ -14591,7 +14606,7 @@ async function listGitCandidateFiles(root, logLevel, opts) {
|
|
|
14591
14606
|
if (!gitRepositoryRoot)
|
|
14592
14607
|
return null;
|
|
14593
14608
|
emitDiscoveryActivity(opts?.onDiscoveryProgress, "Listing Git files");
|
|
14594
|
-
const listStartedAt =
|
|
14609
|
+
const listStartedAt = performance3.now();
|
|
14595
14610
|
gitListStart = listStartedAt;
|
|
14596
14611
|
const [tracked, untracked, stageSpecial] = await Promise.all([
|
|
14597
14612
|
listTrackedFiles(gitRoot, { recurseSubmodules: true, ...logLevel === void 0 ? {} : { logLevel } }),
|
|
@@ -14623,7 +14638,7 @@ async function listGitCandidateFiles(root, logLevel, opts) {
|
|
|
14623
14638
|
gitListStart = void 0;
|
|
14624
14639
|
emitDiscoveryActivity(opts?.onDiscoveryProgress, "Listing Git files", files.length, files.length);
|
|
14625
14640
|
emitDiscoveryActivity(opts?.onDiscoveryProgress, "Listing Git ignore files");
|
|
14626
|
-
const ignoreStartedAt =
|
|
14641
|
+
const ignoreStartedAt = performance3.now();
|
|
14627
14642
|
gitIgnoreStart = ignoreStartedAt;
|
|
14628
14643
|
const gitignoreFiles = await findGitIgnoreSources(sourceRoots, files);
|
|
14629
14644
|
emitDiscoveryTiming(opts?.onDiscoveryTiming, "git-ignore", ignoreStartedAt);
|
|
@@ -14696,7 +14711,7 @@ async function listProjectFilesInternal(projectRoot, patterns = DEFAULT_PROJECT_
|
|
|
14696
14711
|
files = gitCandidates.files;
|
|
14697
14712
|
} else {
|
|
14698
14713
|
emitDiscoveryActivity(options?.onDiscoveryProgress, "Scanning project files");
|
|
14699
|
-
const scanStart =
|
|
14714
|
+
const scanStart = performance3.now();
|
|
14700
14715
|
files = await (0, import_fast_glob2.default)(patterns, {
|
|
14701
14716
|
cwd: root,
|
|
14702
14717
|
absolute: true,
|
|
@@ -32971,6 +32986,8 @@ function getDiskModuleCache(projectRoot, opts) {
|
|
|
32971
32986
|
const cache = {
|
|
32972
32987
|
db,
|
|
32973
32988
|
load: db.prepare("SELECT sig, version, payload FROM module_cache WHERE file = ?"),
|
|
32989
|
+
loadAll: db.prepare("SELECT file, sig, version, payload FROM module_cache WHERE version = ?"),
|
|
32990
|
+
listFiles: db.prepare("SELECT file FROM module_cache WHERE version = ?"),
|
|
32974
32991
|
write: db.prepare(`INSERT INTO module_cache (file, sig, version, payload, updated_at)
|
|
32975
32992
|
VALUES (?, ?, ?, ?, ?)
|
|
32976
32993
|
ON CONFLICT(file) DO UPDATE SET
|
|
@@ -33174,6 +33191,54 @@ function transformModulePaths(projectRoot, module2, toRelative) {
|
|
|
33174
33191
|
imports: module2.imports.map((binding) => typeof binding.resolved === "string" ? { ...binding, resolved: transform2(binding.resolved) } : binding)
|
|
33175
33192
|
};
|
|
33176
33193
|
}
|
|
33194
|
+
function listDiskCachedModuleFiles(projectRoot, opts) {
|
|
33195
|
+
if ((opts?.cache ?? "off") !== "disk")
|
|
33196
|
+
return null;
|
|
33197
|
+
if (!isNodeSqliteUsable())
|
|
33198
|
+
return null;
|
|
33199
|
+
if (!diskModuleCacheExists(projectRoot, opts))
|
|
33200
|
+
return /* @__PURE__ */ new Set();
|
|
33201
|
+
try {
|
|
33202
|
+
const cache = getDiskModuleCache(projectRoot, opts);
|
|
33203
|
+
const rows = cache.listFiles.all(PARSED_CACHE_VERSION);
|
|
33204
|
+
return new Set(rows.map((row) => row.file));
|
|
33205
|
+
} catch (error51) {
|
|
33206
|
+
if (isNodeSqliteUnavailableError(error51)) {
|
|
33207
|
+
reportMissingNodeSqlite(opts?.logLevel, error51);
|
|
33208
|
+
return null;
|
|
33209
|
+
}
|
|
33210
|
+
return null;
|
|
33211
|
+
}
|
|
33212
|
+
}
|
|
33213
|
+
function loadAllCachedModules(projectRoot, opts) {
|
|
33214
|
+
if ((opts?.cache ?? "off") !== "disk")
|
|
33215
|
+
return null;
|
|
33216
|
+
if (!isNodeSqliteUsable())
|
|
33217
|
+
return null;
|
|
33218
|
+
if (!diskModuleCacheExists(projectRoot, opts))
|
|
33219
|
+
return /* @__PURE__ */ new Map();
|
|
33220
|
+
try {
|
|
33221
|
+
const cache = getDiskModuleCache(projectRoot, opts);
|
|
33222
|
+
return cache.db.transaction(() => {
|
|
33223
|
+
const rows = cache.loadAll.all(PARSED_CACHE_VERSION);
|
|
33224
|
+
const modules = /* @__PURE__ */ new Map();
|
|
33225
|
+
for (const row of rows) {
|
|
33226
|
+
const parsed = JSON.parse(brotliDecompressSync(row.payload).toString("utf8"));
|
|
33227
|
+
if (!isModuleIndex(parsed))
|
|
33228
|
+
continue;
|
|
33229
|
+
const rehydrated = transformModulePaths(projectRoot, parsed, false);
|
|
33230
|
+
modules.set(fileIdentityKey(rehydrated.file), { sig: row.sig, mod: rehydrated });
|
|
33231
|
+
}
|
|
33232
|
+
return modules;
|
|
33233
|
+
})();
|
|
33234
|
+
} catch (error51) {
|
|
33235
|
+
if (isNodeSqliteUnavailableError(error51)) {
|
|
33236
|
+
reportMissingNodeSqlite(opts?.logLevel, error51);
|
|
33237
|
+
return null;
|
|
33238
|
+
}
|
|
33239
|
+
return null;
|
|
33240
|
+
}
|
|
33241
|
+
}
|
|
33177
33242
|
function tryLoadFromCache(projectRoot, file2, sig, opts, report, diskCacheAvailable = true) {
|
|
33178
33243
|
const mode = opts?.cache ?? "off";
|
|
33179
33244
|
const cacheReport = initCacheReport(report, mode);
|
|
@@ -52756,8 +52821,9 @@ async function tryLoadProjectIndexSnapshot(projectRoot, opts, manifestEntries, r
|
|
|
52756
52821
|
if ((opts?.cache ?? "off") !== "disk")
|
|
52757
52822
|
return null;
|
|
52758
52823
|
try {
|
|
52759
|
-
const
|
|
52760
|
-
const
|
|
52824
|
+
const snapshotPath = projectSnapshotPath(projectRoot, opts);
|
|
52825
|
+
const parsedSnapshot = await readParsedSnapshot(snapshotPath);
|
|
52826
|
+
const payload = transformCachedProjectSnapshot(snapshotPath, parsedSnapshot.identity, parsedSnapshot.payload, projectRoot);
|
|
52761
52827
|
const nativeRuntimeFingerprint = getNativeRuntimeFingerprint(opts?.native);
|
|
52762
52828
|
const implementationFingerprint = getImplementationFingerprint();
|
|
52763
52829
|
if (!isProjectIndexSnapshotPayload(payload)) {
|
|
@@ -52772,7 +52838,11 @@ async function tryLoadProjectIndexSnapshot(projectRoot, opts, manifestEntries, r
|
|
|
52772
52838
|
nodes: new Set(payload.graph.nodes),
|
|
52773
52839
|
edges: payload.graph.edges
|
|
52774
52840
|
};
|
|
52775
|
-
const modules =
|
|
52841
|
+
const modules = collectSnapshotModules(projectRoot, opts, payload, snapshotPath, parsedSnapshot.identity);
|
|
52842
|
+
if (!modules || !thinSnapshotModulesComplete(payload, modules)) {
|
|
52843
|
+
recordSnapshotInvalidation(snapshotPath, "thin snapshot missing disk-cached modules", opts?.logLevel);
|
|
52844
|
+
return null;
|
|
52845
|
+
}
|
|
52776
52846
|
const shouldHydrateBloomFilters = opts?.useBloomFilters ?? true;
|
|
52777
52847
|
const index = {
|
|
52778
52848
|
graph,
|
|
@@ -52823,9 +52893,12 @@ async function tryLoadProjectSnapshotModules(projectRoot, opts, fileSignatures,
|
|
|
52823
52893
|
}
|
|
52824
52894
|
const normalizedFileSignatures = new Map(Object.entries(payload.fileSignatures).map(([file2, signature]) => [fileIdentityKey(file2), signature]));
|
|
52825
52895
|
const normalizedCurrentSignatures = new Map(Array.from(fileSignatures, ([file2, signature]) => [fileIdentityKey(file2), signature]));
|
|
52896
|
+
const snapshotPath = projectSnapshotPath(projectRoot, opts);
|
|
52897
|
+
const candidates = collectSnapshotModules(projectRoot, opts, payload, snapshotPath, parsedSnapshot.identity);
|
|
52898
|
+
if (!candidates)
|
|
52899
|
+
return /* @__PURE__ */ new Map();
|
|
52826
52900
|
const modules = /* @__PURE__ */ new Map();
|
|
52827
|
-
for (const mod2 of
|
|
52828
|
-
const moduleKey = fileIdentityKey(mod2.file);
|
|
52901
|
+
for (const [moduleKey, mod2] of candidates) {
|
|
52829
52902
|
const signature = normalizedCurrentSignatures.get(moduleKey);
|
|
52830
52903
|
const snapshotSignature = normalizedFileSignatures.get(moduleKey);
|
|
52831
52904
|
if (!signature || !snapshotSignature || !snapshotSignatureMatches(snapshotSignature, signature))
|
|
@@ -52896,7 +52969,7 @@ function persistedBloomFiltersFromSnapshot(value, projectRoot) {
|
|
|
52896
52969
|
if (!migrated || typeof migrated !== "object")
|
|
52897
52970
|
return null;
|
|
52898
52971
|
const payload = migrated;
|
|
52899
|
-
if (payload.version
|
|
52972
|
+
if (!isSupportedProjectSnapshotVersion(payload.version) || typeof payload.projectRoot !== "string" || payload.implementationFingerprint !== getImplementationFingerprint()) {
|
|
52900
52973
|
return null;
|
|
52901
52974
|
}
|
|
52902
52975
|
const bloomFilters = payload.bloomFilters;
|
|
@@ -52921,6 +52994,54 @@ function createPersistedBloomFilters(bloomFilters, fileSignatures, projectRoot)
|
|
|
52921
52994
|
}
|
|
52922
52995
|
};
|
|
52923
52996
|
}
|
|
52997
|
+
function isSupportedProjectSnapshotVersion(version3) {
|
|
52998
|
+
return version3 === PROJECT_SNAPSHOT_VERSION || version3 === LEGACY_EMBEDDED_MODULE_SNAPSHOT_VERSION;
|
|
52999
|
+
}
|
|
53000
|
+
function snapshotHydratesModulesFromDisk(version3) {
|
|
53001
|
+
return version3 === PROJECT_SNAPSHOT_VERSION;
|
|
53002
|
+
}
|
|
53003
|
+
function modulesForThinSnapshot(index, projectRoot, opts) {
|
|
53004
|
+
const modules = [...index.byFile.values()];
|
|
53005
|
+
const cachedFiles = listDiskCachedModuleFiles(projectRoot, opts);
|
|
53006
|
+
if (!cachedFiles)
|
|
53007
|
+
return modules;
|
|
53008
|
+
return modules.filter((module2) => !cachedFiles.has(cacheRelativePath(projectRoot, module2.file)));
|
|
53009
|
+
}
|
|
53010
|
+
function collectSnapshotModules(projectRoot, opts, payload, snapshotPath, identity) {
|
|
53011
|
+
const cached2 = hydratedSnapshotModulesCache.get(snapshotPath);
|
|
53012
|
+
if (cached2 && cached2.root === projectRoot && sameSnapshotFileIdentity(cached2.identity, identity)) {
|
|
53013
|
+
setBoundedSnapshotCache(hydratedSnapshotModulesCache, snapshotPath, cached2);
|
|
53014
|
+
return cached2.modules;
|
|
53015
|
+
}
|
|
53016
|
+
const modules = /* @__PURE__ */ new Map();
|
|
53017
|
+
for (const mod2 of payload.modules) {
|
|
53018
|
+
modules.set(fileIdentityKey(mod2.file), mod2);
|
|
53019
|
+
}
|
|
53020
|
+
if (snapshotHydratesModulesFromDisk(payload.version)) {
|
|
53021
|
+
const cachedModules = loadAllCachedModules(projectRoot, opts);
|
|
53022
|
+
if (!cachedModules && modules.size === 0)
|
|
53023
|
+
return null;
|
|
53024
|
+
if (cachedModules) {
|
|
53025
|
+
for (const [key, row] of cachedModules) {
|
|
53026
|
+
if (modules.has(key))
|
|
53027
|
+
continue;
|
|
53028
|
+
modules.set(key, freezeSnapshotPayload(row.mod));
|
|
53029
|
+
}
|
|
53030
|
+
}
|
|
53031
|
+
}
|
|
53032
|
+
const entry = { identity, root: projectRoot, modules };
|
|
53033
|
+
setBoundedSnapshotCache(hydratedSnapshotModulesCache, snapshotPath, entry);
|
|
53034
|
+
return modules;
|
|
53035
|
+
}
|
|
53036
|
+
function thinSnapshotModulesComplete(payload, modules) {
|
|
53037
|
+
if (!snapshotHydratesModulesFromDisk(payload.version))
|
|
53038
|
+
return true;
|
|
53039
|
+
for (const file2 of Object.keys(payload.fileSignatures)) {
|
|
53040
|
+
if (!modules.has(fileIdentityKey(file2)))
|
|
53041
|
+
return false;
|
|
53042
|
+
}
|
|
53043
|
+
return true;
|
|
53044
|
+
}
|
|
52924
53045
|
function snapshotSignatureMatches(snapshotSignature, currentSignature) {
|
|
52925
53046
|
const matchingGitSignature = !!snapshotSignature.gitSig && !!currentSignature.gitSig && snapshotSignature.gitSig === currentSignature.gitSig;
|
|
52926
53047
|
if (matchingGitSignature)
|
|
@@ -52946,7 +53067,7 @@ async function writeProjectIndexSnapshot(projectRoot, opts, index, filesSignatur
|
|
|
52946
53067
|
nodes: [...index.graph.nodes],
|
|
52947
53068
|
edges: index.graph.edges
|
|
52948
53069
|
},
|
|
52949
|
-
modules:
|
|
53070
|
+
modules: modulesForThinSnapshot(index, projectRoot, opts),
|
|
52950
53071
|
fileSignatures,
|
|
52951
53072
|
...index.languageExtensions ? { languageExtensions: index.languageExtensions } : {},
|
|
52952
53073
|
...normalizedSnapshotNativeMode(index.nativeMode) ? { nativeMode: normalizedSnapshotNativeMode(index.nativeMode) } : {},
|
|
@@ -52964,6 +53085,7 @@ async function writeProjectIndexSnapshot(projectRoot, opts, index, filesSignatur
|
|
|
52964
53085
|
const identity = await snapshotFileIdentity(snapshotPath);
|
|
52965
53086
|
transformedSnapshotCache.delete(snapshotPath);
|
|
52966
53087
|
transformedSnapshotModulesCache.delete(snapshotPath);
|
|
53088
|
+
hydratedSnapshotModulesCache.delete(snapshotPath);
|
|
52967
53089
|
setBoundedSnapshotCache(parsedSnapshotCache, snapshotPath, { identity, compressed, payload });
|
|
52968
53090
|
index.projectSnapshotIdentity = projectSnapshotIdentity;
|
|
52969
53091
|
if (serializedBloomFilters) {
|
|
@@ -53280,13 +53402,13 @@ function isProjectSnapshotModulesPayload(value) {
|
|
|
53280
53402
|
if (!value || typeof value !== "object")
|
|
53281
53403
|
return false;
|
|
53282
53404
|
const payload = value;
|
|
53283
|
-
return payload.version
|
|
53405
|
+
return isSupportedProjectSnapshotVersion(payload.version) && typeof payload.filesSignature === "string" && typeof payload.projectRoot === "string" && typeof payload.nativeRuntimeFingerprint === "string" && typeof payload.implementationFingerprint === "string" && /^[a-f0-9]{64}$/.test(payload.implementationFingerprint) && Array.isArray(payload.modules) && payload.modules.every(isModuleIndex2) && isSnapshotFileSignatureRecord(payload.fileSignatures) && (payload.nativeMode === void 0 || isSnapshotNativeMode(payload.nativeMode));
|
|
53284
53406
|
}
|
|
53285
53407
|
function isProjectIndexSnapshotPayload(value) {
|
|
53286
53408
|
if (!value || typeof value !== "object")
|
|
53287
53409
|
return false;
|
|
53288
53410
|
const payload = value;
|
|
53289
|
-
return payload.version
|
|
53411
|
+
return isSupportedProjectSnapshotVersion(payload.version) && typeof payload.filesSignature === "string" && typeof payload.projectRoot === "string" && typeof payload.nativeRuntimeFingerprint === "string" && typeof payload.implementationFingerprint === "string" && /^[a-f0-9]{64}$/.test(payload.implementationFingerprint) && !!payload.graph && Array.isArray(payload.graph.nodes) && payload.graph.nodes.every((node) => typeof node === "string") && Array.isArray(payload.graph.edges) && payload.graph.edges.every(isGraphEdge) && Array.isArray(payload.modules) && payload.modules.every(isModuleIndex2) && isSnapshotFileSignatureRecord(payload.fileSignatures) && (payload.nativeMode === void 0 || isSnapshotNativeMode(payload.nativeMode)) && (payload.languageExtensions === void 0 || isLanguageExtensionMap(payload.languageExtensions)) && (payload.bloomFilters === void 0 || isSerializedBloomFilterRecord(payload.bloomFilters)) && (payload.analysis === void 0 || isAnalysisSummary(payload.analysis)) && (payload.analysisReport === void 0 || isSnapshotAnalysisReport(payload.analysisReport)) && (payload.projectFiles === void 0 || Array.isArray(payload.projectFiles) && payload.projectFiles.every(isProjectFileInfo));
|
|
53290
53412
|
}
|
|
53291
53413
|
function analysisReportFromBuildReport(report) {
|
|
53292
53414
|
if (!report?.backend && !report?.graph) {
|
|
@@ -53510,7 +53632,7 @@ function isEdgeTo(value) {
|
|
|
53510
53632
|
return typeof edgeTo.name === "string";
|
|
53511
53633
|
return false;
|
|
53512
53634
|
}
|
|
53513
|
-
var SNAPSHOT_SYMBOL_KINDS, PROJECT_SNAPSHOT_VERSION, BLOOM_FILTER_SNAPSHOT_VERSION, BLOOM_FILTER_SNAPSHOT_FILENAME, BLOOM_FILTER_MIN_SIZE, BLOOM_FILTER_MAX_SIZE, BLOOM_FILTER_MIN_HASH_COUNT, BLOOM_FILTER_MAX_HASH_COUNT, DETAILED_SYMBOL_GRAPH_SNAPSHOT_VERSION, DETAILED_SYMBOL_GRAPH_SNAPSHOT_FILENAME, SNAPSHOT_TEMP_RETENTION_MS, SNAPSHOT_TEMP_SUFFIX, MAX_SNAPSHOT_CACHE_ENTRIES, parsedSnapshotCache, transformedSnapshotCache, transformedSnapshotModulesCache, detailedSymbolGraphCache;
|
|
53635
|
+
var SNAPSHOT_SYMBOL_KINDS, PROJECT_SNAPSHOT_VERSION, LEGACY_EMBEDDED_MODULE_SNAPSHOT_VERSION, BLOOM_FILTER_SNAPSHOT_VERSION, BLOOM_FILTER_SNAPSHOT_FILENAME, BLOOM_FILTER_MIN_SIZE, BLOOM_FILTER_MAX_SIZE, BLOOM_FILTER_MIN_HASH_COUNT, BLOOM_FILTER_MAX_HASH_COUNT, DETAILED_SYMBOL_GRAPH_SNAPSHOT_VERSION, DETAILED_SYMBOL_GRAPH_SNAPSHOT_FILENAME, SNAPSHOT_TEMP_RETENTION_MS, SNAPSHOT_TEMP_SUFFIX, MAX_SNAPSHOT_CACHE_ENTRIES, parsedSnapshotCache, transformedSnapshotCache, transformedSnapshotModulesCache, hydratedSnapshotModulesCache, detailedSymbolGraphCache;
|
|
53514
53636
|
var init_project_snapshot = __esm({
|
|
53515
53637
|
"dist/indexer/build-cache/project-snapshot.js"() {
|
|
53516
53638
|
"use strict";
|
|
@@ -53527,7 +53649,8 @@ var init_project_snapshot = __esm({
|
|
|
53527
53649
|
init_module_cache();
|
|
53528
53650
|
init_location();
|
|
53529
53651
|
SNAPSHOT_SYMBOL_KINDS = new Set(Object.values(SymbolKind));
|
|
53530
|
-
PROJECT_SNAPSHOT_VERSION =
|
|
53652
|
+
PROJECT_SNAPSHOT_VERSION = 11;
|
|
53653
|
+
LEGACY_EMBEDDED_MODULE_SNAPSHOT_VERSION = 10;
|
|
53531
53654
|
BLOOM_FILTER_SNAPSHOT_VERSION = 4;
|
|
53532
53655
|
BLOOM_FILTER_SNAPSHOT_FILENAME = "bloom-filters.json";
|
|
53533
53656
|
BLOOM_FILTER_MIN_SIZE = 1e3;
|
|
@@ -53542,6 +53665,7 @@ var init_project_snapshot = __esm({
|
|
|
53542
53665
|
parsedSnapshotCache = /* @__PURE__ */ new Map();
|
|
53543
53666
|
transformedSnapshotCache = /* @__PURE__ */ new Map();
|
|
53544
53667
|
transformedSnapshotModulesCache = /* @__PURE__ */ new Map();
|
|
53668
|
+
hydratedSnapshotModulesCache = /* @__PURE__ */ new Map();
|
|
53545
53669
|
detailedSymbolGraphCache = /* @__PURE__ */ new Map();
|
|
53546
53670
|
}
|
|
53547
53671
|
});
|
|
@@ -53753,19 +53877,19 @@ var init_parsed_cache = __esm({
|
|
|
53753
53877
|
});
|
|
53754
53878
|
|
|
53755
53879
|
// dist/indexer/finalize.js
|
|
53756
|
-
import { performance as
|
|
53880
|
+
import { performance as performance4 } from "node:perf_hooks";
|
|
53757
53881
|
async function finalizeProjectIndex(args) {
|
|
53758
53882
|
const discoveryTimings = args.opts?.report ? args.opts.report.timings ??= {} : void 0;
|
|
53759
|
-
const metadataDiscoveryStart = args.projectFiles === void 0 ?
|
|
53883
|
+
const metadataDiscoveryStart = args.projectFiles === void 0 ? performance4.now() : void 0;
|
|
53760
53884
|
const projectFiles = await (args.projectFiles ?? discoverProjectFilesWithGitCandidates(args.projectRoot, {
|
|
53761
53885
|
...args.opts?.logLevel ? { logLevel: args.opts.logLevel } : {},
|
|
53762
53886
|
...args.knownGitCandidates !== void 0 ? { knownGitCandidates: args.knownGitCandidates } : {}
|
|
53763
53887
|
}));
|
|
53764
53888
|
if (metadataDiscoveryStart !== void 0 && discoveryTimings) {
|
|
53765
|
-
discoveryTimings.metadataDiscoveryMs = Math.round(
|
|
53889
|
+
discoveryTimings.metadataDiscoveryMs = Math.round(performance4.now() - metadataDiscoveryStart);
|
|
53766
53890
|
}
|
|
53767
53891
|
if (args.timings)
|
|
53768
|
-
args.timings.totalMs = Math.round(
|
|
53892
|
+
args.timings.totalMs = Math.round(performance4.now() - args.totalStart);
|
|
53769
53893
|
const languageExtensions = normalizeLanguageExtensions(args.opts?.languageExtensions);
|
|
53770
53894
|
const parsed = retainedParsedCache(args.parsedMap, args.opts);
|
|
53771
53895
|
return {
|
|
@@ -53803,7 +53927,7 @@ var init_finalize = __esm({
|
|
|
53803
53927
|
// dist/indexer/build-manifest.js
|
|
53804
53928
|
import fsp24 from "node:fs/promises";
|
|
53805
53929
|
import path45 from "node:path";
|
|
53806
|
-
import { performance as
|
|
53930
|
+
import { performance as performance5 } from "node:perf_hooks";
|
|
53807
53931
|
function toManifestFileEntry(entry) {
|
|
53808
53932
|
if (!entry.sig)
|
|
53809
53933
|
return void 0;
|
|
@@ -53818,7 +53942,7 @@ async function writeIndexManifestSnapshot(args) {
|
|
|
53818
53942
|
const files = args.files instanceof Map ? Object.fromEntries(args.files) : args.files;
|
|
53819
53943
|
if (!Object.keys(files).length && !args.allowEmpty)
|
|
53820
53944
|
return;
|
|
53821
|
-
const writeManifestStart =
|
|
53945
|
+
const writeManifestStart = performance5.now();
|
|
53822
53946
|
const lastCommit = await getGitHead(args.projectRoot);
|
|
53823
53947
|
const configHashResult = await computeConfigHash(args.projectRoot, args.opts?.logLevel);
|
|
53824
53948
|
const projectRootMtimeMs = args.symlinkDirectories !== void 0 ? (await fsp24.stat(args.projectRoot)).mtimeMs : void 0;
|
|
@@ -53843,7 +53967,7 @@ async function writeIndexManifestSnapshot(args) {
|
|
|
53843
53967
|
if (manifestWritten)
|
|
53844
53968
|
pruneDiskModuleCache(args.projectRoot, Object.keys(files), args.opts);
|
|
53845
53969
|
if (args.timings) {
|
|
53846
|
-
args.timings.writeManifestMs = Math.round(
|
|
53970
|
+
args.timings.writeManifestMs = Math.round(performance5.now() - writeManifestStart);
|
|
53847
53971
|
}
|
|
53848
53972
|
}
|
|
53849
53973
|
var init_build_manifest = __esm({
|
|
@@ -55280,7 +55404,7 @@ var init_nativeWorkerPool = __esm({
|
|
|
55280
55404
|
});
|
|
55281
55405
|
|
|
55282
55406
|
// dist/indexer/build-workers.js
|
|
55283
|
-
import { performance as
|
|
55407
|
+
import { performance as performance6 } from "node:perf_hooks";
|
|
55284
55408
|
function shouldEnableNativeWorkers(opts, fileCount) {
|
|
55285
55409
|
if (opts?.native === "off")
|
|
55286
55410
|
return false;
|
|
@@ -55374,14 +55498,14 @@ async function setupWorkerPool(opts, fileCount) {
|
|
|
55374
55498
|
return {
|
|
55375
55499
|
pool,
|
|
55376
55500
|
report,
|
|
55377
|
-
startTime: pool ?
|
|
55501
|
+
startTime: pool ? performance6.now() : 0,
|
|
55378
55502
|
batchSize: NATIVE_WORKER_BATCH_SIZE
|
|
55379
55503
|
};
|
|
55380
55504
|
}
|
|
55381
55505
|
async function teardownWorkerPool(setup, buildReport2) {
|
|
55382
55506
|
if (setup.pool) {
|
|
55383
55507
|
if (setup.report) {
|
|
55384
|
-
setup.report.wallClockMs = Math.round(
|
|
55508
|
+
setup.report.wallClockMs = Math.round(performance6.now() - setup.startTime);
|
|
55385
55509
|
}
|
|
55386
55510
|
try {
|
|
55387
55511
|
await setup.pool.destroy();
|
|
@@ -55649,7 +55773,7 @@ import crypto10 from "node:crypto";
|
|
|
55649
55773
|
import fs23 from "node:fs";
|
|
55650
55774
|
import fsp26 from "node:fs/promises";
|
|
55651
55775
|
import path47 from "node:path";
|
|
55652
|
-
import { performance as
|
|
55776
|
+
import { performance as performance7 } from "node:perf_hooks";
|
|
55653
55777
|
function initParserBackendDegradationReport(report) {
|
|
55654
55778
|
if (!report)
|
|
55655
55779
|
return void 0;
|
|
@@ -55948,7 +56072,7 @@ function createIndexBuildRunState(projectRoot, opts, graphOptions = normalizeGra
|
|
|
55948
56072
|
normalizedProjectRoot: normalizePath(path47.resolve(projectRoot)),
|
|
55949
56073
|
report,
|
|
55950
56074
|
timings: report?.timings,
|
|
55951
|
-
totalStart:
|
|
56075
|
+
totalStart: performance7.now(),
|
|
55952
56076
|
cacheMode,
|
|
55953
56077
|
cacheEnabled: cacheMode !== "off",
|
|
55954
56078
|
graphOptions,
|
|
@@ -55993,6 +56117,26 @@ function emitIndexCheckActivity(opts, activity, current = 0, total = 0) {
|
|
|
55993
56117
|
total
|
|
55994
56118
|
});
|
|
55995
56119
|
}
|
|
56120
|
+
function emitIndexBuildActivity(opts, activity, current, total, mode = "build") {
|
|
56121
|
+
opts?.onProgress?.({
|
|
56122
|
+
type: "progress",
|
|
56123
|
+
phase: "update",
|
|
56124
|
+
mode,
|
|
56125
|
+
message: activity,
|
|
56126
|
+
activity,
|
|
56127
|
+
current,
|
|
56128
|
+
total
|
|
56129
|
+
});
|
|
56130
|
+
}
|
|
56131
|
+
async function timeIndexBuildPhase(args) {
|
|
56132
|
+
if (args.buildStartedAt !== void 0) {
|
|
56133
|
+
emitIndexBuildActivity(args.opts, args.activity, args.current, args.total, args.mode ?? "build");
|
|
56134
|
+
}
|
|
56135
|
+
const startedAt = performance7.now();
|
|
56136
|
+
const result = await args.fn();
|
|
56137
|
+
recordBuildTimingStep(args.timings, { name: args.stepName, ms: Math.round(performance7.now() - startedAt) });
|
|
56138
|
+
return result;
|
|
56139
|
+
}
|
|
55996
56140
|
function createCountedCheckProgress(opts, activity, total) {
|
|
55997
56141
|
emitIndexCheckActivity(opts, activity, 0, total);
|
|
55998
56142
|
let completed = 0;
|
|
@@ -56003,7 +56147,7 @@ function createCountedCheckProgress(opts, activity, total) {
|
|
|
56003
56147
|
}
|
|
56004
56148
|
};
|
|
56005
56149
|
}
|
|
56006
|
-
function
|
|
56150
|
+
function resetTransientBuildTimings(timings) {
|
|
56007
56151
|
if (!timings)
|
|
56008
56152
|
return;
|
|
56009
56153
|
delete timings.gitListMs;
|
|
@@ -56011,7 +56155,7 @@ function resetDiscoveryTimingSteps(timings) {
|
|
|
56011
56155
|
delete timings.sourceDiscoveryMs;
|
|
56012
56156
|
delete timings.metadataDiscoveryMs;
|
|
56013
56157
|
delete timings.cacheProbeMs;
|
|
56014
|
-
const remaining = (timings.steps ?? []).filter((step) => !
|
|
56158
|
+
const remaining = (timings.steps ?? []).filter((step) => !Object.hasOwn(TRANSIENT_BUILD_TIMING_STEP_NAMES, step.name));
|
|
56015
56159
|
if (remaining.length) {
|
|
56016
56160
|
timings.steps = remaining;
|
|
56017
56161
|
return;
|
|
@@ -56070,7 +56214,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56070
56214
|
const fileReport = initFileReport(report);
|
|
56071
56215
|
if (fileReport)
|
|
56072
56216
|
fileReport.total = normalizedFiles.length;
|
|
56073
|
-
const manifestStart =
|
|
56217
|
+
const manifestStart = performance7.now();
|
|
56074
56218
|
const manifest = useManifest && !helperOpts?.ignoreExistingManifest ? await loadManifest(projectRoot, opts, report) : null;
|
|
56075
56219
|
const manifestFiles = sanitizeManifestEntriesForRoot(projectRoot, manifest?.files);
|
|
56076
56220
|
const manifestOptionDiffs = manifest ? diffBuildOptions(manifest.buildOptions, opts) : [];
|
|
@@ -56085,7 +56229,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56085
56229
|
}
|
|
56086
56230
|
}
|
|
56087
56231
|
if (timings && useManifest) {
|
|
56088
|
-
timings.manifestMs = Math.round(
|
|
56232
|
+
timings.manifestMs = Math.round(performance7.now() - manifestStart);
|
|
56089
56233
|
}
|
|
56090
56234
|
const edgeProbeConcurrency = buildConcurrency(opts);
|
|
56091
56235
|
const staleCachedEdgeFiles = /* @__PURE__ */ new Set();
|
|
@@ -56114,7 +56258,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56114
56258
|
const moduleCacheAvailable = opts?.cache !== "disk" || diskModuleCacheExists(projectRoot, opts);
|
|
56115
56259
|
const shouldReportFileCacheCheck = Boolean(helperOpts?.reportDiscoveryProgress);
|
|
56116
56260
|
const reportFileCacheCheck = shouldReportFileCacheCheck ? createCountedCheckProgress(opts, "Checking file cache", normalizedFiles.length) : () => void 0;
|
|
56117
|
-
const cacheProbeStart =
|
|
56261
|
+
const cacheProbeStart = performance7.now();
|
|
56118
56262
|
const gitAvailable = await isGitRepo(projectRoot);
|
|
56119
56263
|
const needsPersistentSignatures = cacheEnabled || useManifest;
|
|
56120
56264
|
const useGitSignatures = gitAvailable && needsPersistentSignatures;
|
|
@@ -56187,7 +56331,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56187
56331
|
}
|
|
56188
56332
|
}));
|
|
56189
56333
|
if (timings) {
|
|
56190
|
-
const cacheProbeMs = Math.round(
|
|
56334
|
+
const cacheProbeMs = Math.round(performance7.now() - cacheProbeStart);
|
|
56191
56335
|
timings.cacheProbeMs = cacheProbeMs;
|
|
56192
56336
|
recordBuildTimingStep(timings, { name: "cache-probe", ms: cacheProbeMs });
|
|
56193
56337
|
}
|
|
@@ -56209,7 +56353,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56209
56353
|
}
|
|
56210
56354
|
return matchPath;
|
|
56211
56355
|
};
|
|
56212
|
-
const parseStart =
|
|
56356
|
+
const parseStart = performance7.now();
|
|
56213
56357
|
const graph = { nodes: new Set(normalizedFiles), edges: [] };
|
|
56214
56358
|
const onFileEdges = manifestEntries ? (file2, entry) => {
|
|
56215
56359
|
const manifestEntry = toManifestFileEntry(entry);
|
|
@@ -56223,7 +56367,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56223
56367
|
const ensureBuildProgressStarted = () => {
|
|
56224
56368
|
if (buildStartedAt !== void 0)
|
|
56225
56369
|
return;
|
|
56226
|
-
buildStartedAt =
|
|
56370
|
+
buildStartedAt = performance7.now();
|
|
56227
56371
|
emitIndexLifecycleProgress(opts, "start", "build", totalFiles);
|
|
56228
56372
|
};
|
|
56229
56373
|
if (cacheMisses.length)
|
|
@@ -56357,8 +56501,8 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56357
56501
|
}
|
|
56358
56502
|
});
|
|
56359
56503
|
if (timings)
|
|
56360
|
-
timings.parseMs = Math.round(
|
|
56361
|
-
const graphStart =
|
|
56504
|
+
timings.parseMs = Math.round(performance7.now() - parseStart);
|
|
56505
|
+
const graphStart = performance7.now();
|
|
56362
56506
|
const seenGraphEdges = /* @__PURE__ */ new Set();
|
|
56363
56507
|
const appendUniqueGraphEdges = (edges) => {
|
|
56364
56508
|
if (!edges.length)
|
|
@@ -56381,12 +56525,34 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56381
56525
|
pendingCacheWrites.push(cacheWrite);
|
|
56382
56526
|
}
|
|
56383
56527
|
if (pendingCacheWrites.length) {
|
|
56384
|
-
|
|
56528
|
+
if (opts?.cache === "disk") {
|
|
56529
|
+
await timeIndexBuildPhase({
|
|
56530
|
+
opts,
|
|
56531
|
+
timings,
|
|
56532
|
+
buildStartedAt,
|
|
56533
|
+
stepName: "persist-cache",
|
|
56534
|
+
activity: "Writing disk cache",
|
|
56535
|
+
current: totalFiles,
|
|
56536
|
+
total: totalFiles,
|
|
56537
|
+
fn: () => writeModulesToCache(projectRoot, pendingCacheWrites, opts)
|
|
56538
|
+
});
|
|
56539
|
+
} else {
|
|
56540
|
+
writeModulesToCache(projectRoot, pendingCacheWrites, opts);
|
|
56541
|
+
}
|
|
56385
56542
|
}
|
|
56386
|
-
const workspaceManifestEdges = await
|
|
56543
|
+
const workspaceManifestEdges = await timeIndexBuildPhase({
|
|
56544
|
+
opts,
|
|
56545
|
+
timings,
|
|
56546
|
+
buildStartedAt,
|
|
56547
|
+
stepName: "workspace-manifests",
|
|
56548
|
+
activity: "Resolving workspace manifests",
|
|
56549
|
+
current: totalFiles,
|
|
56550
|
+
total: totalFiles,
|
|
56551
|
+
fn: () => collectWorkspaceManifestDependencyEdges(projectRoot, normalizedFiles.filter((file2) => path47.basename(file2) === "package.json"), opts?.discovery, opts?.logLevel)
|
|
56552
|
+
});
|
|
56387
56553
|
appendUniqueGraphEdges(workspaceManifestEdges);
|
|
56388
56554
|
if (timings)
|
|
56389
|
-
timings.graphMs = Math.round(
|
|
56555
|
+
timings.graphMs = Math.round(performance7.now() - graphStart);
|
|
56390
56556
|
for (const jsonPath of jsonDependencies.values()) {
|
|
56391
56557
|
ensureJsonModule(modules, jsonPath);
|
|
56392
56558
|
}
|
|
@@ -56403,42 +56569,69 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56403
56569
|
}
|
|
56404
56570
|
}
|
|
56405
56571
|
if (manifestEntries) {
|
|
56406
|
-
await
|
|
56407
|
-
projectRoot,
|
|
56572
|
+
await timeIndexBuildPhase({
|
|
56408
56573
|
opts,
|
|
56409
|
-
graphOptions,
|
|
56410
|
-
...resolverEnvironmentFingerprint ? { resolverEnvironmentFingerprint } : {},
|
|
56411
|
-
files: manifestEntries,
|
|
56412
56574
|
timings,
|
|
56413
|
-
|
|
56414
|
-
|
|
56415
|
-
|
|
56575
|
+
buildStartedAt,
|
|
56576
|
+
stepName: "index-manifest",
|
|
56577
|
+
activity: "Writing index manifest",
|
|
56578
|
+
current: totalFiles,
|
|
56579
|
+
total: totalFiles,
|
|
56580
|
+
fn: () => writeIndexManifestSnapshot({
|
|
56581
|
+
projectRoot,
|
|
56582
|
+
opts,
|
|
56583
|
+
graphOptions,
|
|
56584
|
+
...resolverEnvironmentFingerprint ? { resolverEnvironmentFingerprint } : {},
|
|
56585
|
+
files: manifestEntries,
|
|
56586
|
+
timings,
|
|
56587
|
+
manifestReport: report?.manifest,
|
|
56588
|
+
...helperOpts?.transientFiles !== void 0 ? { transientFiles: helperOpts.transientFiles } : {},
|
|
56589
|
+
...helperOpts?.symlinkDirectories !== void 0 ? { symlinkDirectories: helperOpts.symlinkDirectories } : {}
|
|
56590
|
+
})
|
|
56416
56591
|
});
|
|
56417
56592
|
}
|
|
56418
56593
|
const indexManifestEntries = manifestEntries ? projectIndexManifestEntries2(Array.from(manifestEntries, ([file2, entry]) => {
|
|
56419
56594
|
const cacheSig = fileSignatures.get(file2)?.cacheSig;
|
|
56420
56595
|
return [file2, { ...entry, ...cacheSig ? { cacheSig } : {} }];
|
|
56421
56596
|
})) : manifestEntriesForIndex;
|
|
56422
|
-
const index = await
|
|
56423
|
-
projectRoot,
|
|
56424
|
-
normalizedProjectRoot,
|
|
56597
|
+
const index = await timeIndexBuildPhase({
|
|
56425
56598
|
opts,
|
|
56426
56599
|
timings,
|
|
56427
|
-
|
|
56428
|
-
|
|
56429
|
-
|
|
56430
|
-
|
|
56431
|
-
|
|
56432
|
-
|
|
56433
|
-
|
|
56434
|
-
|
|
56600
|
+
buildStartedAt,
|
|
56601
|
+
stepName: "finalize",
|
|
56602
|
+
activity: "Finalizing project graph",
|
|
56603
|
+
current: totalFiles,
|
|
56604
|
+
total: totalFiles,
|
|
56605
|
+
fn: () => finalizeProjectIndex({
|
|
56606
|
+
projectRoot,
|
|
56607
|
+
normalizedProjectRoot,
|
|
56608
|
+
opts,
|
|
56609
|
+
timings,
|
|
56610
|
+
totalStart,
|
|
56611
|
+
graph,
|
|
56612
|
+
modules,
|
|
56613
|
+
parsedMap,
|
|
56614
|
+
bloomFilterCache,
|
|
56615
|
+
...projectFiles !== void 0 ? { projectFiles } : {},
|
|
56616
|
+
buildReport: report,
|
|
56617
|
+
manifestEntries: indexManifestEntries
|
|
56618
|
+
})
|
|
56435
56619
|
});
|
|
56436
56620
|
if (manifestEntries) {
|
|
56437
|
-
await
|
|
56621
|
+
await timeIndexBuildPhase({
|
|
56622
|
+
opts,
|
|
56623
|
+
timings,
|
|
56624
|
+
buildStartedAt,
|
|
56625
|
+
stepName: "snapshot-write",
|
|
56626
|
+
activity: "Writing project snapshot",
|
|
56627
|
+
current: totalFiles,
|
|
56628
|
+
total: totalFiles,
|
|
56629
|
+
fn: () => writeProjectIndexSnapshot(projectRoot, opts, index, projectSnapshotFilesSignature(manifestEntries, projectRoot))
|
|
56630
|
+
});
|
|
56438
56631
|
}
|
|
56439
56632
|
if (buildStartedAt !== void 0) {
|
|
56440
56633
|
const progressStartedAt = opts?.progressStartedAt ?? buildStartedAt;
|
|
56441
|
-
emitIndexLifecycleProgress(opts, "complete", "build", index.byFile.size,
|
|
56634
|
+
emitIndexLifecycleProgress(opts, "complete", "build", index.byFile.size, performance7.now() - progressStartedAt);
|
|
56442
56635
|
}
|
|
56443
56636
|
return index;
|
|
56444
56637
|
} finally {
|
|
@@ -56447,7 +56640,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56447
56640
|
}
|
|
56448
56641
|
async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpts) {
|
|
56449
56642
|
const timings = opts?.report ? opts.report.timings ??= {} : void 0;
|
|
56450
|
-
|
|
56643
|
+
resetTransientBuildTimings(timings);
|
|
56451
56644
|
await initializeFileIdentityCaseSensitivity(projectRoot);
|
|
56452
56645
|
try {
|
|
56453
56646
|
const useDiskCache = (opts?.cache ?? "off") === "disk";
|
|
@@ -56471,7 +56664,7 @@ async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpt
|
|
|
56471
56664
|
const onDiscoveryTiming = timings ? (step) => recordBuildTimingStep(timings, step) : void 0;
|
|
56472
56665
|
if (helperOpts?.reportDiscoveryProgress)
|
|
56473
56666
|
emitIndexCheckActivity(opts, "Discovering source files");
|
|
56474
|
-
const sourceDiscoveryStart =
|
|
56667
|
+
const sourceDiscoveryStart = performance7.now();
|
|
56475
56668
|
const discoveredFiles = await listProjectFilesWithGitCandidates(projectRoot, projectPatternsForLanguageExtensions(opts), {
|
|
56476
56669
|
...opts?.discovery,
|
|
56477
56670
|
...opts?.logLevel ? { logLevel: opts.logLevel } : {},
|
|
@@ -56482,7 +56675,7 @@ async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpt
|
|
|
56482
56675
|
...onDiscoveryTiming ? { onDiscoveryTiming } : {}
|
|
56483
56676
|
});
|
|
56484
56677
|
if (timings)
|
|
56485
|
-
timings.sourceDiscoveryMs = Math.round(
|
|
56678
|
+
timings.sourceDiscoveryMs = Math.round(performance7.now() - sourceDiscoveryStart);
|
|
56486
56679
|
const additionalFileCandidates = await normalizeIndexedFileInputsWithinRoot(projectRoot, opts?.additionalFiles ?? [], "Additional index file");
|
|
56487
56680
|
const additionalFileExistence = await probePathExistence(additionalFileCandidates, buildConcurrency(opts));
|
|
56488
56681
|
const additionalFiles = additionalFileCandidates.filter((file2) => additionalFileExistence.get(file2));
|
|
@@ -56491,7 +56684,7 @@ async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpt
|
|
|
56491
56684
|
const transientFiles = additionalFiles.filter((file2) => !discoveredFileSet.has(file2));
|
|
56492
56685
|
if (helperOpts?.reportDiscoveryProgress)
|
|
56493
56686
|
emitIndexCheckActivity(opts, "Discovering project metadata");
|
|
56494
|
-
const metadataDiscoveryStart =
|
|
56687
|
+
const metadataDiscoveryStart = performance7.now();
|
|
56495
56688
|
const projectFiles = await discoverProjectFilesWithGitCandidates(projectRoot, {
|
|
56496
56689
|
...opts?.logLevel ? { logLevel: opts.logLevel } : {},
|
|
56497
56690
|
...discoveredSymlinkDirectories !== void 0 ? { knownSymlinkDirectories: discoveredSymlinkDirectories } : {},
|
|
@@ -56500,7 +56693,7 @@ async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpt
|
|
|
56500
56693
|
...onDiscoveryTiming ? { onDiscoveryTiming } : {}
|
|
56501
56694
|
});
|
|
56502
56695
|
if (timings)
|
|
56503
|
-
timings.metadataDiscoveryMs = Math.round(
|
|
56696
|
+
timings.metadataDiscoveryMs = Math.round(performance7.now() - metadataDiscoveryStart);
|
|
56504
56697
|
return await buildIndexFromFileListShared(projectRoot, files, opts, {
|
|
56505
56698
|
manifestMode: useDiskCache ? "read-write" : "off",
|
|
56506
56699
|
warnNoFilesMessage: `Warning: No files found in project root: ${projectRoot}. Check codegraph.config.json globs and CLI --include-glob/--ignore-glob filters. Diagnostic: codegraph doctor`,
|
|
@@ -56520,11 +56713,11 @@ async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpt
|
|
|
56520
56713
|
async function buildProjectIndex(projectRoot, opts) {
|
|
56521
56714
|
return buildProjectIndexWithManifestOptions(projectRoot, {
|
|
56522
56715
|
...opts,
|
|
56523
|
-
progressStartedAt: opts?.progressStartedAt ??
|
|
56716
|
+
progressStartedAt: opts?.progressStartedAt ?? performance7.now()
|
|
56524
56717
|
});
|
|
56525
56718
|
}
|
|
56526
56719
|
async function buildProjectIndexFromFiles(projectRoot, inputFiles, rawOpts) {
|
|
56527
|
-
const opts = { ...rawOpts, progressStartedAt: rawOpts?.progressStartedAt ??
|
|
56720
|
+
const opts = { ...rawOpts, progressStartedAt: rawOpts?.progressStartedAt ?? performance7.now() };
|
|
56528
56721
|
try {
|
|
56529
56722
|
const useDiskCache = (opts?.cache ?? "off") === "disk";
|
|
56530
56723
|
const normalizedInputFiles = await normalizeIndexedFileInputsWithinRoot(projectRoot, inputFiles, "Index file");
|
|
@@ -56556,7 +56749,7 @@ async function buildDeclaredScopeIndex(projectRoot, scopeFiles, opts) {
|
|
|
56556
56749
|
async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
56557
56750
|
const opts = {
|
|
56558
56751
|
...rawOpts,
|
|
56559
|
-
progressStartedAt: rawOpts?.progressStartedAt ??
|
|
56752
|
+
progressStartedAt: rawOpts?.progressStartedAt ?? performance7.now()
|
|
56560
56753
|
};
|
|
56561
56754
|
await initializeFileIdentityCaseSensitivity(projectRoot);
|
|
56562
56755
|
clearResolutionCaches();
|
|
@@ -56566,7 +56759,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
56566
56759
|
graphOptions.fast = false;
|
|
56567
56760
|
const { normalizedProjectRoot, report, timings, totalStart, cacheMode, cacheEnabled, onFallbackImportExtraction } = createIndexBuildRunState(projectRoot, opts, graphOptions);
|
|
56568
56761
|
const discoveryTimings = opts?.report ? opts.report.timings ??= {} : void 0;
|
|
56569
|
-
|
|
56762
|
+
resetTransientBuildTimings(discoveryTimings);
|
|
56570
56763
|
let checkProgressActive = false;
|
|
56571
56764
|
const startCheckProgress = () => {
|
|
56572
56765
|
if (checkProgressActive)
|
|
@@ -56592,7 +56785,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
56592
56785
|
message: "Checked project index",
|
|
56593
56786
|
current: total,
|
|
56594
56787
|
total,
|
|
56595
|
-
elapsedMs:
|
|
56788
|
+
elapsedMs: performance7.now() - totalStart
|
|
56596
56789
|
});
|
|
56597
56790
|
};
|
|
56598
56791
|
try {
|
|
@@ -56607,10 +56800,10 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
56607
56800
|
return await buildProjectIndexFromExport(projectRoot, opts, { ignoreExistingManifest: true });
|
|
56608
56801
|
}
|
|
56609
56802
|
startCheckProgress();
|
|
56610
|
-
const manifestStart =
|
|
56803
|
+
const manifestStart = performance7.now();
|
|
56611
56804
|
const manifest = await loadManifest(projectRoot, opts, report);
|
|
56612
56805
|
if (timings)
|
|
56613
|
-
timings.manifestMs = Math.round(
|
|
56806
|
+
timings.manifestMs = Math.round(performance7.now() - manifestStart);
|
|
56614
56807
|
const manifestUsed = !!manifest;
|
|
56615
56808
|
const manifestReport = initManifestReport(report, manifestUsed, false);
|
|
56616
56809
|
if (manifestReport && !manifestUsed)
|
|
@@ -56665,11 +56858,11 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
56665
56858
|
if (!discoveryTimings || opts?.filesAreProjectScope)
|
|
56666
56859
|
return await operation();
|
|
56667
56860
|
sourceDiscoveryPerformed = true;
|
|
56668
|
-
const start =
|
|
56861
|
+
const start = performance7.now();
|
|
56669
56862
|
try {
|
|
56670
56863
|
return await operation();
|
|
56671
56864
|
} finally {
|
|
56672
|
-
sourceDiscoveryMs +=
|
|
56865
|
+
sourceDiscoveryMs += performance7.now() - start;
|
|
56673
56866
|
}
|
|
56674
56867
|
};
|
|
56675
56868
|
let manifestDiffFiles = [];
|
|
@@ -56869,13 +57062,13 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
56869
57062
|
const snapshot = snapshotLoad.index;
|
|
56870
57063
|
snapshot.manifestSignaturesFresh = false;
|
|
56871
57064
|
if (snapshot.projectFiles === void 0) {
|
|
56872
|
-
const metadataDiscoveryStart =
|
|
57065
|
+
const metadataDiscoveryStart = performance7.now();
|
|
56873
57066
|
snapshot.projectFiles = await discoverProjectFilesWithGitCandidates(projectRoot, {
|
|
56874
57067
|
...opts?.logLevel ? { logLevel: opts.logLevel } : {},
|
|
56875
57068
|
...discoveredGitCandidates !== void 0 ? { knownGitCandidates: discoveredGitCandidates } : {}
|
|
56876
57069
|
});
|
|
56877
57070
|
if (discoveryTimings)
|
|
56878
|
-
discoveryTimings.metadataDiscoveryMs = Math.round(
|
|
57071
|
+
discoveryTimings.metadataDiscoveryMs = Math.round(performance7.now() - metadataDiscoveryStart);
|
|
56879
57072
|
}
|
|
56880
57073
|
if (opts?.cache) {
|
|
56881
57074
|
snapshot.cacheMode = opts.cache;
|
|
@@ -56913,7 +57106,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
56913
57106
|
const snapshot = await reuseUnchangedSnapshot();
|
|
56914
57107
|
if (snapshot) {
|
|
56915
57108
|
if (timings)
|
|
56916
|
-
timings.totalMs = Math.round(
|
|
57109
|
+
timings.totalMs = Math.round(performance7.now() - totalStart);
|
|
56917
57110
|
completeCheckProgress(allFiles.size);
|
|
56918
57111
|
return snapshot;
|
|
56919
57112
|
}
|
|
@@ -56983,7 +57176,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
56983
57176
|
unchangedSnapshot.manifestEntries = new Map(Array.from(fileSignatures, ([file2, signature]) => [file2, toProjectIndexManifestEntry(signature)]));
|
|
56984
57177
|
unchangedSnapshot.manifestSignaturesFresh = true;
|
|
56985
57178
|
if (timings)
|
|
56986
|
-
timings.totalMs = Math.round(
|
|
57179
|
+
timings.totalMs = Math.round(performance7.now() - totalStart);
|
|
56987
57180
|
completeCheckProgress(allFiles.size);
|
|
56988
57181
|
return unchangedSnapshot;
|
|
56989
57182
|
}
|
|
@@ -57025,13 +57218,13 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
57025
57218
|
workerSetup = await setupWorkerPool(opts, countNativeWorkerEligibleFiles(changedList, opts?.languageExtensions));
|
|
57026
57219
|
let updateStartedAt;
|
|
57027
57220
|
if (changedList.length || deletedTrackedFiles.size) {
|
|
57028
|
-
updateStartedAt =
|
|
57221
|
+
updateStartedAt = performance7.now();
|
|
57029
57222
|
emitIndexLifecycleProgress(opts, "start", "update", changedList.length);
|
|
57030
57223
|
}
|
|
57031
57224
|
if (fileReport)
|
|
57032
57225
|
fileReport.changed = changedList.length;
|
|
57033
57226
|
if (changedList.length) {
|
|
57034
|
-
const parseStart =
|
|
57227
|
+
const parseStart = performance7.now();
|
|
57035
57228
|
let processedFiles = 0;
|
|
57036
57229
|
const totalFiles = changedList.length;
|
|
57037
57230
|
const fileResults = await mapLimit(changedList, conc, async (file2) => {
|
|
@@ -57094,7 +57287,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
57094
57287
|
writeModulesToCache(projectRoot, pendingIncrementalCacheWrites, opts);
|
|
57095
57288
|
}
|
|
57096
57289
|
if (timings)
|
|
57097
|
-
timings.parseMs = Math.round(
|
|
57290
|
+
timings.parseMs = Math.round(performance7.now() - parseStart);
|
|
57098
57291
|
}
|
|
57099
57292
|
for (const jsonPath of jsonDependencies.values()) {
|
|
57100
57293
|
ensureJsonModule(modules, jsonPath);
|
|
@@ -57124,7 +57317,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
57124
57317
|
}
|
|
57125
57318
|
}
|
|
57126
57319
|
const filesList = Array.from(changedFiles);
|
|
57127
|
-
const graphStart =
|
|
57320
|
+
const graphStart = performance7.now();
|
|
57128
57321
|
const graph = !filesList.length && baseGraph ? { nodes: new Set(baseGraph.nodes), edges: [...baseGraph.edges] } : await collectGraph(projectRoot, filesList, {
|
|
57129
57322
|
parsed: parsedMap,
|
|
57130
57323
|
fast: !!graphOptions.fast,
|
|
@@ -57150,7 +57343,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
57150
57343
|
}
|
|
57151
57344
|
});
|
|
57152
57345
|
if (timings)
|
|
57153
|
-
timings.graphMs = Math.round(
|
|
57346
|
+
timings.graphMs = Math.round(performance7.now() - graphStart);
|
|
57154
57347
|
for (const file2 of /* @__PURE__ */ new Set([...changedFiles, ...transientFiles])) {
|
|
57155
57348
|
const signature = fileSignatures.get(file2);
|
|
57156
57349
|
if (!signature || manifestEntries.has(file2))
|
|
@@ -57208,9 +57401,19 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
57208
57401
|
),
|
|
57209
57402
|
buildReport: report
|
|
57210
57403
|
});
|
|
57211
|
-
await
|
|
57404
|
+
await timeIndexBuildPhase({
|
|
57405
|
+
opts,
|
|
57406
|
+
timings,
|
|
57407
|
+
buildStartedAt: updateStartedAt,
|
|
57408
|
+
stepName: "snapshot-write",
|
|
57409
|
+
activity: "Writing project snapshot",
|
|
57410
|
+
current: allFiles.size,
|
|
57411
|
+
total: allFiles.size,
|
|
57412
|
+
mode: "update",
|
|
57413
|
+
fn: () => writeProjectIndexSnapshot(projectRoot, opts, index, projectSnapshotFilesSignature(manifestEntries, projectRoot))
|
|
57414
|
+
});
|
|
57212
57415
|
if (updateStartedAt !== void 0) {
|
|
57213
|
-
emitIndexLifecycleProgress(opts, "complete", "update", index.byFile.size,
|
|
57416
|
+
emitIndexLifecycleProgress(opts, "complete", "update", index.byFile.size, performance7.now() - updateStartedAt);
|
|
57214
57417
|
} else {
|
|
57215
57418
|
completeCheckProgress(allFiles.size);
|
|
57216
57419
|
}
|
|
@@ -57356,7 +57559,7 @@ async function buildGraphDelta(projectRoot, opts) {
|
|
|
57356
57559
|
removed: removedRelative.sort(compareEdges)
|
|
57357
57560
|
};
|
|
57358
57561
|
}
|
|
57359
|
-
var
|
|
57562
|
+
var TRANSIENT_BUILD_TIMING_STEP_NAMES;
|
|
57360
57563
|
var init_build_index = __esm({
|
|
57361
57564
|
"dist/indexer/build-index.js"() {
|
|
57362
57565
|
"use strict";
|
|
@@ -57396,7 +57599,17 @@ var init_build_index = __esm({
|
|
|
57396
57599
|
init_build_workers();
|
|
57397
57600
|
init_incremental_plan();
|
|
57398
57601
|
init_parsed_cache();
|
|
57399
|
-
|
|
57602
|
+
TRANSIENT_BUILD_TIMING_STEP_NAMES = {
|
|
57603
|
+
"git-list": true,
|
|
57604
|
+
"git-ignore": true,
|
|
57605
|
+
"filesystem-scan": true,
|
|
57606
|
+
"cache-probe": true,
|
|
57607
|
+
"persist-cache": true,
|
|
57608
|
+
"workspace-manifests": true,
|
|
57609
|
+
"index-manifest": true,
|
|
57610
|
+
finalize: true,
|
|
57611
|
+
"snapshot-write": true
|
|
57612
|
+
};
|
|
57400
57613
|
}
|
|
57401
57614
|
});
|
|
57402
57615
|
|
|
@@ -68034,7 +68247,7 @@ var init_deleted = __esm({
|
|
|
68034
68247
|
});
|
|
68035
68248
|
|
|
68036
68249
|
// dist/review/candidates.js
|
|
68037
|
-
import { performance as
|
|
68250
|
+
import { performance as performance8 } from "node:perf_hooks";
|
|
68038
68251
|
function relativePath(root, file2) {
|
|
68039
68252
|
return toProjectDisplayPath(root, file2);
|
|
68040
68253
|
}
|
|
@@ -68067,7 +68280,7 @@ function mergeCandidateTestEntries(baseCandidates, additionalCandidates) {
|
|
|
68067
68280
|
return Array.from(merged.values());
|
|
68068
68281
|
}
|
|
68069
68282
|
async function collectReviewCandidateTests(input) {
|
|
68070
|
-
const candidateStart =
|
|
68283
|
+
const candidateStart = performance8.now();
|
|
68071
68284
|
const configuredMaxCandidates = input.appliedOptions.maxCandidates;
|
|
68072
68285
|
const maxCandidates = typeof configuredMaxCandidates === "number" && Number.isFinite(configuredMaxCandidates) ? Math.max(0, Math.floor(configuredMaxCandidates)) : REVIEW_DEFAULT_CANDIDATE_TEST_LIMIT;
|
|
68073
68286
|
const candidateTests = mergeCandidateTestEntries(listCandidateTestFiles(input.index, input.changedFileList, input.changedSymbolIds, {
|
|
@@ -68087,7 +68300,7 @@ async function collectReviewCandidateTests(input) {
|
|
|
68087
68300
|
return left.reason.localeCompare(right.reason);
|
|
68088
68301
|
}).slice(0, maxCandidates);
|
|
68089
68302
|
if (input.reviewTimings) {
|
|
68090
|
-
input.reviewTimings.candidatesMs = Math.round(
|
|
68303
|
+
input.reviewTimings.candidatesMs = Math.round(performance8.now() - candidateStart);
|
|
68091
68304
|
}
|
|
68092
68305
|
return candidateTests;
|
|
68093
68306
|
}
|
|
@@ -68383,7 +68596,7 @@ var init_parse4 = __esm({
|
|
|
68383
68596
|
});
|
|
68384
68597
|
|
|
68385
68598
|
// dist/review/changes.js
|
|
68386
|
-
import { performance as
|
|
68599
|
+
import { performance as performance9 } from "node:perf_hooks";
|
|
68387
68600
|
function deletedPathsForChange(change2) {
|
|
68388
68601
|
if (change2.kind === "deleted") {
|
|
68389
68602
|
return [change2.path];
|
|
@@ -68401,16 +68614,16 @@ async function collectReviewChanges(projectRoot, appliedOptions, reviewTimings)
|
|
|
68401
68614
|
const isIncludedReviewFile = createImpactIncludeMatcher(discoveryGlobRoot, appliedOptions.discovery?.includeGlobs ?? []);
|
|
68402
68615
|
const changedFiles = /* @__PURE__ */ new Set();
|
|
68403
68616
|
const explicitFiles = /* @__PURE__ */ new Set();
|
|
68404
|
-
const changesStart =
|
|
68617
|
+
const changesStart = performance9.now();
|
|
68405
68618
|
for (const file2 of appliedOptions.files ?? []) {
|
|
68406
68619
|
const normalized = normalizeFile(file2, "Review file");
|
|
68407
68620
|
changedFiles.add(normalized);
|
|
68408
68621
|
explicitFiles.add(normalized);
|
|
68409
68622
|
}
|
|
68410
68623
|
if (reviewTimings) {
|
|
68411
|
-
reviewTimings.changesMs = Math.round(
|
|
68624
|
+
reviewTimings.changesMs = Math.round(performance9.now() - changesStart);
|
|
68412
68625
|
}
|
|
68413
|
-
const diffStart =
|
|
68626
|
+
const diffStart = performance9.now();
|
|
68414
68627
|
const shouldLoadGitDiff = Boolean(appliedOptions.gitBase || appliedOptions.changedSince);
|
|
68415
68628
|
const diffText = appliedOptions.diffText ?? (shouldLoadGitDiff ? await getUnifiedDiff(projectRoot, {
|
|
68416
68629
|
base: appliedOptions.gitBase,
|
|
@@ -68419,7 +68632,7 @@ async function collectReviewChanges(projectRoot, appliedOptions, reviewTimings)
|
|
|
68419
68632
|
}) : "");
|
|
68420
68633
|
const diff = diffText ? parseUnifiedDiff(diffText) : null;
|
|
68421
68634
|
if (reviewTimings) {
|
|
68422
|
-
reviewTimings.diffMs = Math.round(
|
|
68635
|
+
reviewTimings.diffMs = Math.round(performance9.now() - diffStart);
|
|
68423
68636
|
}
|
|
68424
68637
|
const diffHunksByFile = /* @__PURE__ */ new Map();
|
|
68425
68638
|
const diffKindsByFile = /* @__PURE__ */ new Map();
|
|
@@ -69793,10 +70006,10 @@ var init_severity = __esm({
|
|
|
69793
70006
|
});
|
|
69794
70007
|
|
|
69795
70008
|
// dist/impact/budgets.js
|
|
69796
|
-
import { performance as
|
|
70009
|
+
import { performance as performance10 } from "node:perf_hooks";
|
|
69797
70010
|
function createImpactWorkBudget(options) {
|
|
69798
70011
|
return {
|
|
69799
|
-
...typeof options.timeBudgetMs === "number" && options.timeBudgetMs >= 0 ? { deadlineAt:
|
|
70012
|
+
...typeof options.timeBudgetMs === "number" && options.timeBudgetMs >= 0 ? { deadlineAt: performance10.now() + options.timeBudgetMs } : {},
|
|
69800
70013
|
...typeof options.maxReferenceLookups === "number" && options.maxReferenceLookups >= 0 ? { maxReferenceLookups: options.maxReferenceLookups } : {},
|
|
69801
70014
|
...typeof options.maxTotalReferences === "number" && options.maxTotalReferences >= 0 ? { maxTotalReferences: options.maxTotalReferences } : {},
|
|
69802
70015
|
referenceLookupsStarted: 0,
|
|
@@ -69811,7 +70024,7 @@ function isImpactDeadlineExceeded(budget) {
|
|
|
69811
70024
|
return true;
|
|
69812
70025
|
if (budget.deadlineAt === void 0)
|
|
69813
70026
|
return false;
|
|
69814
|
-
if (
|
|
70027
|
+
if (performance10.now() >= budget.deadlineAt) {
|
|
69815
70028
|
budget.deadlineExceeded = true;
|
|
69816
70029
|
return true;
|
|
69817
70030
|
}
|
|
@@ -71865,7 +72078,7 @@ var init_referenceCache = __esm({
|
|
|
71865
72078
|
// dist/review/summaries.js
|
|
71866
72079
|
import fsp37 from "node:fs/promises";
|
|
71867
72080
|
import path70 from "node:path";
|
|
71868
|
-
import { performance as
|
|
72081
|
+
import { performance as performance11 } from "node:perf_hooks";
|
|
71869
72082
|
function relativePath2(root, file2) {
|
|
71870
72083
|
return toProjectDisplayPath(root, file2);
|
|
71871
72084
|
}
|
|
@@ -72231,7 +72444,7 @@ async function summarizeChangedFiles2(input) {
|
|
|
72231
72444
|
}
|
|
72232
72445
|
}
|
|
72233
72446
|
const defsToResolve = fileEntries.flatMap((entry) => entry.locals);
|
|
72234
|
-
const referencesStart =
|
|
72447
|
+
const referencesStart = performance11.now();
|
|
72235
72448
|
const referenceResults = includeSymbolDetails && maxCallsites > 0 ? await mapLimit(defsToResolve, referenceConcurrency, async (def) => {
|
|
72236
72449
|
const refs = await referenceCache.get(index, def, {
|
|
72237
72450
|
maxReferences: maxCallsites + 1
|
|
@@ -72239,7 +72452,7 @@ async function summarizeChangedFiles2(input) {
|
|
|
72239
72452
|
return { def, refs };
|
|
72240
72453
|
}) : [];
|
|
72241
72454
|
if (reviewTimings) {
|
|
72242
|
-
reviewTimings.referencesMs = Math.round(
|
|
72455
|
+
reviewTimings.referencesMs = Math.round(performance11.now() - referencesStart);
|
|
72243
72456
|
}
|
|
72244
72457
|
const referencesByHandle = /* @__PURE__ */ new Map();
|
|
72245
72458
|
for (const entry of referenceResults) {
|
|
@@ -72419,7 +72632,7 @@ var init_summaries = __esm({
|
|
|
72419
72632
|
});
|
|
72420
72633
|
|
|
72421
72634
|
// dist/review.js
|
|
72422
|
-
import { performance as
|
|
72635
|
+
import { performance as performance12 } from "node:perf_hooks";
|
|
72423
72636
|
function mergeGraphOptions2(base, override) {
|
|
72424
72637
|
if (!base)
|
|
72425
72638
|
return override;
|
|
@@ -72463,7 +72676,7 @@ async function buildReviewIndex(input) {
|
|
|
72463
72676
|
diffChangesByFile,
|
|
72464
72677
|
graphOptions
|
|
72465
72678
|
});
|
|
72466
|
-
const indexStart =
|
|
72679
|
+
const indexStart = performance12.now();
|
|
72467
72680
|
const indexReport = reviewReport?.indexReport ?? (reviewReport ? { timings: {} } : void 0);
|
|
72468
72681
|
if (reviewReport && !reviewReport.indexReport && indexReport) {
|
|
72469
72682
|
reviewReport.indexReport = indexReport;
|
|
@@ -72496,7 +72709,7 @@ async function buildReviewIndex(input) {
|
|
|
72496
72709
|
});
|
|
72497
72710
|
}
|
|
72498
72711
|
if (reviewTimings) {
|
|
72499
|
-
reviewTimings.indexMs = Math.round(
|
|
72712
|
+
reviewTimings.indexMs = Math.round(performance12.now() - indexStart);
|
|
72500
72713
|
}
|
|
72501
72714
|
return {
|
|
72502
72715
|
index,
|
|
@@ -72515,7 +72728,7 @@ async function buildReviewReport(projectRoot, opts = {}, cached2) {
|
|
|
72515
72728
|
if (reviewReport && appliedOptions.duplicateTasks === false) {
|
|
72516
72729
|
delete reviewReport.duplicateAnalysis;
|
|
72517
72730
|
}
|
|
72518
|
-
const totalStart =
|
|
72731
|
+
const totalStart = performance12.now();
|
|
72519
72732
|
const { changedFiles, explicitFiles, diffHunksByFile, diffKindsByFile, diffChangesByFile } = await collectReviewChanges(projectRoot, appliedOptions, reviewTimings);
|
|
72520
72733
|
if (changedFiles.size === 0) {
|
|
72521
72734
|
const riskSummary = computeRiskSummary({
|
|
@@ -72549,7 +72762,7 @@ async function buildReviewReport(projectRoot, opts = {}, cached2) {
|
|
|
72549
72762
|
report2.base = appliedOptions.gitBase;
|
|
72550
72763
|
report2.head = appliedOptions.gitHead ?? "HEAD";
|
|
72551
72764
|
if (reviewTimings)
|
|
72552
|
-
reviewTimings.totalMs = Math.round(
|
|
72765
|
+
reviewTimings.totalMs = Math.round(performance12.now() - totalStart);
|
|
72553
72766
|
return report2;
|
|
72554
72767
|
}
|
|
72555
72768
|
const changedFileList = Array.from(changedFiles).sort(comparePaths2);
|
|
@@ -72627,7 +72840,7 @@ async function buildReviewReport(projectRoot, opts = {}, cached2) {
|
|
|
72627
72840
|
riskRelevantParseFailures,
|
|
72628
72841
|
exportedChangedCount
|
|
72629
72842
|
});
|
|
72630
|
-
const duplicateAnalysisStart =
|
|
72843
|
+
const duplicateAnalysisStart = performance12.now();
|
|
72631
72844
|
if (appliedOptions.duplicateTasks !== false) {
|
|
72632
72845
|
const duplicateReview = await collectReviewDuplicateTasks({
|
|
72633
72846
|
projectRoot,
|
|
@@ -72648,10 +72861,10 @@ async function buildReviewReport(projectRoot, opts = {}, cached2) {
|
|
|
72648
72861
|
}
|
|
72649
72862
|
}
|
|
72650
72863
|
if (reviewTimings && appliedOptions.duplicateTasks !== false) {
|
|
72651
|
-
reviewTimings.duplicateAnalysisMs = Math.round(
|
|
72864
|
+
reviewTimings.duplicateAnalysisMs = Math.round(performance12.now() - duplicateAnalysisStart);
|
|
72652
72865
|
}
|
|
72653
72866
|
if (reviewTimings)
|
|
72654
|
-
reviewTimings.totalMs = Math.round(
|
|
72867
|
+
reviewTimings.totalMs = Math.round(performance12.now() - totalStart);
|
|
72655
72868
|
return report;
|
|
72656
72869
|
}
|
|
72657
72870
|
function buildSymbolDefLookup(index) {
|
|
@@ -78279,7 +78492,7 @@ ${SHARED_INDEX_OPTIONS_HELP}
|
|
|
78279
78492
|
`;
|
|
78280
78493
|
ORIENT_HELP_TEXT = `codegraph orient - Build a compact first-turn packet for agent repo context
|
|
78281
78494
|
|
|
78282
|
-
Usage: codegraph orient [roots...] [--root <path>] [--budget small|medium|large] [--health skip|summary|full] [--json | --pretty]
|
|
78495
|
+
Usage: codegraph orient [roots...] [--root <path>] [--budget small|medium|large] [--health skip|summary|full] [--report [--report-file <path>]] [--json | --pretty]
|
|
78283
78496
|
|
|
78284
78497
|
Output:
|
|
78285
78498
|
Orientation includes summary bullets, ranked focus targets with follow-up commands, a bounded project tree, budgeted health counts, and omission counts.
|
|
@@ -78336,13 +78549,13 @@ ${SHARED_INDEX_OPTIONS_HELP}
|
|
|
78336
78549
|
SERVER_HELP_TEXT = `codegraph server - Manage a shared project-local MCP HTTP server
|
|
78337
78550
|
|
|
78338
78551
|
Usage:
|
|
78339
|
-
codegraph server start [--root <path>] [--host <host>] [--port <1-65535>] [--startup-timeout-ms <1-86400000>] [--json] [--replace] [--warmup | --warmup-symbols]
|
|
78552
|
+
codegraph server start [--root <path>] [--host <host>] [--port <1-65535>] [--startup-timeout-ms <1-86400000>] [--json] [--replace] [--warmup | --warmup-symbols | --no-warmup]
|
|
78340
78553
|
codegraph server status [--root <path>] [--json | --pretty]
|
|
78341
78554
|
codegraph server stop [--root <path>]
|
|
78342
78555
|
|
|
78343
78556
|
Behavior:
|
|
78344
78557
|
start runs codegraph mcp serve in a separate process, waits for a challenged /health proof, then writes .codegraph/server.json. --json emits the started registry with status and update fields; startup diagnostics go to .codegraph/server.log.
|
|
78345
|
-
The default server listens on 127.0.0.1:7331. A public bind requires an explicit --host. --startup-timeout-ms defaults to 15000 and allows up to 86400000 for long warmups.
|
|
78558
|
+
The default server listens on 127.0.0.1:7331. A public bind requires an explicit --host. --startup-timeout-ms defaults to 15000 and allows up to 86400000 for long warmups. Startup warms the base session cache by default; --no-warmup starts lazily instead, and --warmup-symbols also warms the detailed symbol graph.
|
|
78346
78559
|
status retries proven health checks and reports a verification remedy for an unreachable or mismatched server. stop removes only confirmed stale registries or signals a Codegraph server whose root, process, and startup time match the registry.
|
|
78347
78560
|
|
|
78348
78561
|
Forwarded startup options:
|
|
@@ -78354,13 +78567,14 @@ Safety:
|
|
|
78354
78567
|
`;
|
|
78355
78568
|
MCP_HELP_TEXT = `codegraph mcp - Serve MCP tools for agent graph navigation
|
|
78356
78569
|
|
|
78357
|
-
Usage: codegraph mcp [serve] [--root <path>] [--artifact <path>] [--stdio | --port <number>] [--host <host>] [--idle-timeout-ms <ms>] [--allow-build] [--warmup | --warmup-symbols]
|
|
78570
|
+
Usage: codegraph mcp [serve] [--root <path>] [--artifact <path>] [--stdio | --port <number>] [--host <host>] [--idle-timeout-ms <ms>] [--allow-build] [--warmup | --warmup-symbols | --no-warmup]
|
|
78358
78571
|
|
|
78359
78572
|
Transports:
|
|
78360
78573
|
--stdio Serve MCP over stdio (default)
|
|
78361
78574
|
--port <number> Serve Streamable HTTP at /mcp
|
|
78362
|
-
--warmup Build the base session cache at startup
|
|
78575
|
+
--warmup Build the base session cache at startup (default)
|
|
78363
78576
|
--warmup-symbols Build the base cache and detailed symbol graph at startup
|
|
78577
|
+
--no-warmup Skip startup warmup; the first tool call pays for discovery and building
|
|
78364
78578
|
|
|
78365
78579
|
Index Options:
|
|
78366
78580
|
--cache <mode> Session cache mode: disk, memory, off
|
|
@@ -78379,7 +78593,7 @@ Tools are read-only unless --allow-build is passed.
|
|
|
78379
78593
|
`;
|
|
78380
78594
|
MCP_SERVE_HELP_TEXT = `codegraph mcp serve - MCP server for agent graph navigation
|
|
78381
78595
|
|
|
78382
|
-
Usage: codegraph mcp [serve] [--root <path>] [--artifact <path>] [--stdio | --port <number>] [--host <host>] [--idle-timeout-ms <ms>] [--allow-build] [--warmup | --warmup-symbols]
|
|
78596
|
+
Usage: codegraph mcp [serve] [--root <path>] [--artifact <path>] [--stdio | --port <number>] [--host <host>] [--idle-timeout-ms <ms>] [--allow-build] [--warmup | --warmup-symbols | --no-warmup]
|
|
78383
78597
|
|
|
78384
78598
|
Tools:
|
|
78385
78599
|
orient Build a compact first-turn repo packet
|
|
@@ -78414,7 +78628,7 @@ Index Options:
|
|
|
78414
78628
|
Defaults:
|
|
78415
78629
|
Transport defaults to stdio.
|
|
78416
78630
|
HTTP transport binds to 127.0.0.1 unless --host is passed and serves /mcp.
|
|
78417
|
-
Startup
|
|
78631
|
+
Startup warms the base session cache by default. --warmup-symbols also warms the detailed symbol graph. --no-warmup starts lazily instead, leaving the first tool call to pay for discovery and building.
|
|
78418
78632
|
Warmup uses the configured session cache and shared index flags.
|
|
78419
78633
|
Tools are read-only unless --allow-build is passed.
|
|
78420
78634
|
`;
|
|
@@ -78739,7 +78953,7 @@ var search_exports = {};
|
|
|
78739
78953
|
__export(search_exports, {
|
|
78740
78954
|
handleSearchCommand: () => handleSearchCommand
|
|
78741
78955
|
});
|
|
78742
|
-
import { performance as
|
|
78956
|
+
import { performance as performance13 } from "node:perf_hooks";
|
|
78743
78957
|
function parseAgentSearchMode(rawValue) {
|
|
78744
78958
|
if (rawValue === void 0)
|
|
78745
78959
|
return "hybrid";
|
|
@@ -78749,7 +78963,7 @@ function parseAgentSearchMode(rawValue) {
|
|
|
78749
78963
|
throw new Error(`Invalid --mode value "${rawValue}". Expected hybrid, symbol, path, text, graph, or sql.`);
|
|
78750
78964
|
}
|
|
78751
78965
|
async function handleSearchCommand(context) {
|
|
78752
|
-
const commandStart =
|
|
78966
|
+
const commandStart = performance13.now();
|
|
78753
78967
|
const query = context.positionals.join(" ").trim();
|
|
78754
78968
|
if (!query) {
|
|
78755
78969
|
context.writeStderrLine(SEARCH_HELP_TEXT.trimEnd());
|
|
@@ -78773,7 +78987,7 @@ async function handleSearchCommand(context) {
|
|
|
78773
78987
|
context.writeStdoutLine(formatAgentSearchResponse(response));
|
|
78774
78988
|
}
|
|
78775
78989
|
if (context.commandReport && context.writeCommandReport) {
|
|
78776
|
-
context.commandReport.timings.commandMs = Math.round(
|
|
78990
|
+
context.commandReport.timings.commandMs = Math.round(performance13.now() - commandStart);
|
|
78777
78991
|
context.commandReport.timings.totalMs = context.commandReport.timings.commandMs;
|
|
78778
78992
|
await context.writeCommandReport(context.commandReport, context.reportFile);
|
|
78779
78993
|
}
|
|
@@ -85154,6 +85368,7 @@ __export(orient_exports, {
|
|
|
85154
85368
|
formatAgentOrientation: () => formatAgentOrientation,
|
|
85155
85369
|
handleOrientCommand: () => handleOrientCommand
|
|
85156
85370
|
});
|
|
85371
|
+
import { performance as performance14 } from "node:perf_hooks";
|
|
85157
85372
|
function parseAgentOrientBudget(rawValue) {
|
|
85158
85373
|
if (rawValue === void 0)
|
|
85159
85374
|
return "small";
|
|
@@ -85171,9 +85386,15 @@ function parseAgentOrientHealthMode(rawValue) {
|
|
|
85171
85386
|
throw new Error(`Invalid --health value "${rawValue}". Expected skip, summary, or full.`);
|
|
85172
85387
|
}
|
|
85173
85388
|
async function handleOrientCommand(context) {
|
|
85389
|
+
const commandStart = performance14.now();
|
|
85174
85390
|
const healthMode = parseAgentOrientHealthMode(context.getOpt("--health"));
|
|
85175
85391
|
const writesJson = context.hasFlag("--json");
|
|
85176
|
-
const
|
|
85392
|
+
const indexReport = context.commandReport?.index;
|
|
85393
|
+
const buildOptions = {
|
|
85394
|
+
...context.buildOptions ?? {},
|
|
85395
|
+
logLevel: "silent",
|
|
85396
|
+
...indexReport ? { report: indexReport } : {}
|
|
85397
|
+
};
|
|
85177
85398
|
const response = await orientCodegraph({
|
|
85178
85399
|
root: context.root,
|
|
85179
85400
|
includeRoots: context.positionals,
|
|
@@ -85186,6 +85407,11 @@ async function handleOrientCommand(context) {
|
|
|
85186
85407
|
} else {
|
|
85187
85408
|
context.writeStdoutLine(formatAgentOrientation(response));
|
|
85188
85409
|
}
|
|
85410
|
+
if (context.commandReport && context.writeCommandReport) {
|
|
85411
|
+
context.commandReport.timings.commandMs = Math.round(performance14.now() - commandStart);
|
|
85412
|
+
context.commandReport.timings.totalMs = context.commandReport.timings.commandMs;
|
|
85413
|
+
await context.writeCommandReport(context.commandReport, context.reportFile);
|
|
85414
|
+
}
|
|
85189
85415
|
}
|
|
85190
85416
|
function formatAgentOrientation(response) {
|
|
85191
85417
|
const lines = ["Summary", ...response.summary.map((entry) => `- ${entry}`)];
|
|
@@ -101673,19 +101899,19 @@ function createCodegraphMcpSession(options, root) {
|
|
|
101673
101899
|
freshness: { policy: "auto" }
|
|
101674
101900
|
});
|
|
101675
101901
|
}
|
|
101676
|
-
function startCodegraphMcpWarmup(session, warmup) {
|
|
101677
|
-
|
|
101678
|
-
|
|
101679
|
-
|
|
101680
|
-
if (
|
|
101902
|
+
function startCodegraphMcpWarmup(session, warmup, sessionProvidedExplicitly) {
|
|
101903
|
+
const mode = warmup ?? (sessionProvidedExplicitly ? "off" : "base");
|
|
101904
|
+
if (mode === "off")
|
|
101905
|
+
return void 0;
|
|
101906
|
+
if (mode === "symbols")
|
|
101681
101907
|
return session.loadProject();
|
|
101682
|
-
}
|
|
101683
|
-
return void 0;
|
|
101908
|
+
return session.loadProject({ symbolGraph: "skip" });
|
|
101684
101909
|
}
|
|
101685
101910
|
async function createWarmedCodegraphMcpResources(options) {
|
|
101686
101911
|
const root = path85.resolve(options.root);
|
|
101912
|
+
const sessionProvidedExplicitly = options.session !== void 0;
|
|
101687
101913
|
const session = createCodegraphMcpSession(options, root);
|
|
101688
|
-
await startCodegraphMcpWarmup(session, options.warmup);
|
|
101914
|
+
await startCodegraphMcpWarmup(session, options.warmup, sessionProvidedExplicitly);
|
|
101689
101915
|
const { warmup, host, port, onHttpListen, ...handlerOptions } = options;
|
|
101690
101916
|
void warmup;
|
|
101691
101917
|
void host;
|
|
@@ -102193,7 +102419,7 @@ function createCodegraphMcpHandlersForSession(options, session) {
|
|
|
102193
102419
|
sqlitePath = configuredSqlitePath;
|
|
102194
102420
|
sqliteOutDir = configuredSqliteOutDir;
|
|
102195
102421
|
sqliteCanRefresh = configuredSqliteCanRefresh;
|
|
102196
|
-
await startCodegraphMcpWarmup(session, warmup);
|
|
102422
|
+
await startCodegraphMcpWarmup(session, warmup, true);
|
|
102197
102423
|
})();
|
|
102198
102424
|
refreshPromise = refresh;
|
|
102199
102425
|
try {
|
|
@@ -105717,7 +105943,7 @@ var init_protocol = __esm({
|
|
|
105717
105943
|
init_runtime();
|
|
105718
105944
|
init_runtimeIdentity();
|
|
105719
105945
|
init_legacySessions();
|
|
105720
|
-
DEFAULT_MCP_TOOL_TIMEOUT_MS =
|
|
105946
|
+
DEFAULT_MCP_TOOL_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
105721
105947
|
MAX_MCP_TOOL_TIMEOUT_MS = 2147483647;
|
|
105722
105948
|
MAX_MCP_STDIO_FRAME_BYTES = 10 * 1024 * 1024;
|
|
105723
105949
|
DEFAULT_MCP_TOOL_CONCURRENCY = 4;
|
|
@@ -106296,7 +106522,7 @@ async function handleMcpServeCommand(context) {
|
|
|
106296
106522
|
...host !== void 0 ? { host } : {},
|
|
106297
106523
|
...artifactPath !== void 0 ? { artifactPath } : {},
|
|
106298
106524
|
...context.buildOptions !== void 0 ? { buildOptions: context.buildOptions } : {},
|
|
106299
|
-
|
|
106525
|
+
warmup,
|
|
106300
106526
|
...idleTimeoutMs !== void 0 ? { idleTimeoutMs } : {},
|
|
106301
106527
|
onHttpListen: (info) => {
|
|
106302
106528
|
context.writeStderrLine(`Codegraph MCP HTTP server listening at ${info.url}`);
|
|
@@ -106304,15 +106530,20 @@ async function handleMcpServeCommand(context) {
|
|
|
106304
106530
|
});
|
|
106305
106531
|
}
|
|
106306
106532
|
function parseMcpWarmupMode(context) {
|
|
106307
|
-
|
|
106308
|
-
context.
|
|
106533
|
+
const explicit = [
|
|
106534
|
+
context.hasFlag("--warmup"),
|
|
106535
|
+
context.hasFlag("--warmup-symbols"),
|
|
106536
|
+
context.hasFlag("--no-warmup")
|
|
106537
|
+
].filter(Boolean).length;
|
|
106538
|
+
if (explicit > 1) {
|
|
106539
|
+
context.writeStderrLine("Choose only one of --warmup, --warmup-symbols, or --no-warmup for mcp serve startup.");
|
|
106309
106540
|
context.exit(2);
|
|
106310
106541
|
}
|
|
106311
106542
|
if (context.hasFlag("--warmup-symbols"))
|
|
106312
106543
|
return "symbols";
|
|
106313
|
-
if (context.hasFlag("--warmup"))
|
|
106314
|
-
return "
|
|
106315
|
-
return
|
|
106544
|
+
if (context.hasFlag("--no-warmup"))
|
|
106545
|
+
return "off";
|
|
106546
|
+
return "base";
|
|
106316
106547
|
}
|
|
106317
106548
|
var init_mcp = __esm({
|
|
106318
106549
|
"dist/cli/mcp.js"() {
|
|
@@ -106393,8 +106624,8 @@ function parseServerStartOptions(context) {
|
|
|
106393
106624
|
}
|
|
106394
106625
|
}
|
|
106395
106626
|
async function startServerForRoot(context, root, options) {
|
|
106396
|
-
if (context.hasFlag("--warmup")
|
|
106397
|
-
throw new ServerUsageError("Choose
|
|
106627
|
+
if ([context.hasFlag("--warmup"), context.hasFlag("--warmup-symbols"), context.hasFlag("--no-warmup")].filter(Boolean).length > 1) {
|
|
106628
|
+
throw new ServerUsageError("Choose only one of --warmup, --warmup-symbols, or --no-warmup for server start.");
|
|
106398
106629
|
}
|
|
106399
106630
|
const existingStatus = await readServerStatus(root);
|
|
106400
106631
|
if (existingStatus.status === "live") {
|
|
@@ -106673,6 +106904,8 @@ async function spawnServerProcess(root, host, port, lifecycleCredential, context
|
|
|
106673
106904
|
args.push("--warmup");
|
|
106674
106905
|
if (context.hasFlag("--warmup-symbols"))
|
|
106675
106906
|
args.push("--warmup-symbols");
|
|
106907
|
+
if (context.hasFlag("--no-warmup"))
|
|
106908
|
+
args.push("--no-warmup");
|
|
106676
106909
|
for (const flag of FORWARDED_FLAGS) {
|
|
106677
106910
|
if (context.hasFlag(flag))
|
|
106678
106911
|
args.push(flag);
|
|
@@ -107165,6 +107398,7 @@ var init_server2 = __esm({
|
|
|
107165
107398
|
"--replace",
|
|
107166
107399
|
"--warmup",
|
|
107167
107400
|
"--warmup-symbols",
|
|
107401
|
+
"--no-warmup",
|
|
107168
107402
|
"--workers",
|
|
107169
107403
|
"--json",
|
|
107170
107404
|
"--pretty"
|
|
@@ -107754,7 +107988,7 @@ __export(graph_exports, {
|
|
|
107754
107988
|
import fs42 from "node:fs";
|
|
107755
107989
|
import fsp40 from "node:fs/promises";
|
|
107756
107990
|
import path88 from "node:path";
|
|
107757
|
-
import { performance as
|
|
107991
|
+
import { performance as performance15 } from "node:perf_hooks";
|
|
107758
107992
|
function resolveGraphCacheMode(cache) {
|
|
107759
107993
|
return cache ?? "disk";
|
|
107760
107994
|
}
|
|
@@ -107894,11 +108128,11 @@ function stabilizeSymbolGraph(graph) {
|
|
|
107894
108128
|
}
|
|
107895
108129
|
async function handleGraphCommand(context) {
|
|
107896
108130
|
const commandReport = context.reportEnabled ? { command: "graph", timings: {} } : void 0;
|
|
107897
|
-
const commandStart =
|
|
107898
|
-
const resolveStart =
|
|
108131
|
+
const commandStart = performance15.now();
|
|
108132
|
+
const resolveStart = performance15.now();
|
|
107899
108133
|
const files = await context.resolveFiles();
|
|
107900
108134
|
if (commandReport) {
|
|
107901
|
-
commandReport.timings.resolveFilesMs = Math.round(
|
|
108135
|
+
commandReport.timings.resolveFilesMs = Math.round(performance15.now() - resolveStart);
|
|
107902
108136
|
}
|
|
107903
108137
|
const hasExplicitSymbolFlag = context.hasFlag("--symbols") || context.hasFlag("--symbols-only") || context.hasFlag("--symbols-detailed");
|
|
107904
108138
|
const outputArg = context.getOpt("--output") ?? context.getOpt("--out");
|
|
@@ -107940,7 +108174,7 @@ async function handleGraphCommand(context) {
|
|
|
107940
108174
|
const finalizeReport = async () => {
|
|
107941
108175
|
if (!commandReport)
|
|
107942
108176
|
return;
|
|
107943
|
-
commandReport.timings.commandMs = Math.round(
|
|
108177
|
+
commandReport.timings.commandMs = Math.round(performance15.now() - commandStart);
|
|
107944
108178
|
commandReport.timings.totalMs = commandReport.timings.commandMs;
|
|
107945
108179
|
await context.writeCommandReport(commandReport, context.reportFile);
|
|
107946
108180
|
};
|
|
@@ -108160,7 +108394,7 @@ var cli_exports = {};
|
|
|
108160
108394
|
__export(cli_exports, {
|
|
108161
108395
|
handleIndexCommand: () => handleIndexCommand
|
|
108162
108396
|
});
|
|
108163
|
-
import { performance as
|
|
108397
|
+
import { performance as performance16 } from "node:perf_hooks";
|
|
108164
108398
|
function formatIndexOutput(output) {
|
|
108165
108399
|
const lines = [`Indexed ${output.files} file(s) with ${output.edges} edge(s).`];
|
|
108166
108400
|
if (output.analysis.mode !== "semantic") {
|
|
@@ -108178,11 +108412,11 @@ function formatIndexOutput(output) {
|
|
|
108178
108412
|
async function handleIndexCommand(context) {
|
|
108179
108413
|
const verbose = context.hasFlag("--verbose");
|
|
108180
108414
|
const commandReport = context.reportEnabled ? { command: "index", timings: {} } : void 0;
|
|
108181
|
-
const commandStart =
|
|
108182
|
-
const resolveStart =
|
|
108415
|
+
const commandStart = performance16.now();
|
|
108416
|
+
const resolveStart = performance16.now();
|
|
108183
108417
|
const files = await context.resolveFiles();
|
|
108184
108418
|
if (commandReport) {
|
|
108185
|
-
commandReport.timings.resolveFilesMs = Math.round(
|
|
108419
|
+
commandReport.timings.resolveFilesMs = Math.round(performance16.now() - resolveStart);
|
|
108186
108420
|
}
|
|
108187
108421
|
const threads = parseNonNegativeIntegerOption(context.getOpt("--threads"), "--threads", 0);
|
|
108188
108422
|
const cache = parseCacheModeOption(context.getOpt("--cache"));
|
|
@@ -108248,7 +108482,7 @@ async function handleIndexCommand(context) {
|
|
|
108248
108482
|
}
|
|
108249
108483
|
}
|
|
108250
108484
|
if (commandReport) {
|
|
108251
|
-
commandReport.timings.commandMs = Math.round(
|
|
108485
|
+
commandReport.timings.commandMs = Math.round(performance16.now() - commandStart);
|
|
108252
108486
|
commandReport.timings.totalMs = commandReport.timings.commandMs;
|
|
108253
108487
|
await context.writeCommandReport(commandReport, context.reportFile);
|
|
108254
108488
|
}
|
|
@@ -111241,7 +111475,7 @@ var review_exports = {};
|
|
|
111241
111475
|
__export(review_exports, {
|
|
111242
111476
|
handleReviewCommand: () => handleReviewCommand
|
|
111243
111477
|
});
|
|
111244
|
-
import { performance as
|
|
111478
|
+
import { performance as performance17 } from "node:perf_hooks";
|
|
111245
111479
|
import path92 from "node:path";
|
|
111246
111480
|
function parseReviewDepth(value) {
|
|
111247
111481
|
if (value === "minimal" || value === "standard" || value === "deep") {
|
|
@@ -111433,7 +111667,7 @@ async function collectReviewDuplicateSummary(input) {
|
|
|
111433
111667
|
});
|
|
111434
111668
|
}
|
|
111435
111669
|
async function handleReviewCommand(context) {
|
|
111436
|
-
const commandStart =
|
|
111670
|
+
const commandStart = performance17.now();
|
|
111437
111671
|
const changedSince = context.getOpt("--changed-since");
|
|
111438
111672
|
const base = context.getOpt("--base") ?? (changedSince === void 0 ? "HEAD" : void 0);
|
|
111439
111673
|
const head = context.getOpt("--head") ?? (changedSince === void 0 ? "WORKTREE" : void 0);
|
|
@@ -111528,7 +111762,7 @@ async function handleReviewCommand(context) {
|
|
|
111528
111762
|
context.writeJSONLine(report);
|
|
111529
111763
|
}
|
|
111530
111764
|
if (context.commandReport) {
|
|
111531
|
-
context.commandReport.timings.commandMs = Math.round(
|
|
111765
|
+
context.commandReport.timings.commandMs = Math.round(performance17.now() - commandStart);
|
|
111532
111766
|
context.commandReport.timings.totalMs = context.commandReport.timings.commandMs;
|
|
111533
111767
|
await context.writeCommandReport(context.commandReport, context.reportFile);
|
|
111534
111768
|
}
|
|
@@ -111817,7 +112051,7 @@ __export(inspect_exports, {
|
|
|
111817
112051
|
handleHotspotsCommand: () => handleHotspotsCommand,
|
|
111818
112052
|
handleInspectCommand: () => handleInspectCommand
|
|
111819
112053
|
});
|
|
111820
|
-
import { performance as
|
|
112054
|
+
import { performance as performance18 } from "node:perf_hooks";
|
|
111821
112055
|
import fs44 from "node:fs";
|
|
111822
112056
|
import path93 from "node:path";
|
|
111823
112057
|
function defaultCacheIndexPath(projectRoot, cacheDir, cacheLocation) {
|
|
@@ -112079,18 +112313,18 @@ async function buildInspectReport(projectRoot, includeRoots, files, discovery, g
|
|
|
112079
112313
|
};
|
|
112080
112314
|
}
|
|
112081
112315
|
async function handleInspectCommand(context) {
|
|
112082
|
-
const commandStart =
|
|
112316
|
+
const commandStart = performance18.now();
|
|
112083
112317
|
const cache = parseCacheModeOption(context.getOpt("--cache"));
|
|
112084
112318
|
const limit = parsePositiveIntegerOption(context.getOpt("--limit"), "--limit", 20);
|
|
112085
|
-
const resolveStart =
|
|
112319
|
+
const resolveStart = performance18.now();
|
|
112086
112320
|
const files = await context.resolveFilesFromRoots();
|
|
112087
112321
|
if (context.commandReport) {
|
|
112088
|
-
context.commandReport.timings.resolveFilesMs = Math.round(
|
|
112322
|
+
context.commandReport.timings.resolveFilesMs = Math.round(performance18.now() - resolveStart);
|
|
112089
112323
|
}
|
|
112090
112324
|
const report = await buildInspectReport(context.projectRootFs, context.includeRootsAbs, files, context.discoveryOptions, context.graphOptions, context.languageExtensions, cache, context.getOpt("--cache-dir"), context.cacheLocation, context.nativeMode, context.workerOpts, context.progressHandler, context.commandReport?.index, limit, context.hasFlag("--duplicates"), context.writeStderrLine);
|
|
112091
112325
|
writeCliOutput(context, report, formatInspectReport);
|
|
112092
112326
|
if (context.commandReport && context.writeCommandReport) {
|
|
112093
|
-
context.commandReport.timings.commandMs = Math.round(
|
|
112327
|
+
context.commandReport.timings.commandMs = Math.round(performance18.now() - commandStart);
|
|
112094
112328
|
context.commandReport.timings.totalMs = context.commandReport.timings.commandMs;
|
|
112095
112329
|
await context.writeCommandReport(context.commandReport, context.reportFile);
|
|
112096
112330
|
}
|
|
@@ -112434,8 +112668,19 @@ var init_commandTable = __esm({
|
|
|
112434
112668
|
orient: {
|
|
112435
112669
|
stage: "project",
|
|
112436
112670
|
run: async (ctx) => {
|
|
112671
|
+
const commandReport = ctx.reportEnabled ? { command: "orient", timings: {} } : void 0;
|
|
112672
|
+
const indexReport = ctx.reportEnabled ? { timings: {} } : void 0;
|
|
112673
|
+
if (commandReport && indexReport)
|
|
112674
|
+
commandReport.index = indexReport;
|
|
112437
112675
|
const { handleOrientCommand: handleOrientCommand2 } = await Promise.resolve().then(() => (init_orient2(), orient_exports));
|
|
112438
|
-
await handleOrientCommand2({
|
|
112676
|
+
await handleOrientCommand2({
|
|
112677
|
+
...agentIo(ctx),
|
|
112678
|
+
positionals: ctx.includeRoots,
|
|
112679
|
+
reportFile: ctx.reportFile,
|
|
112680
|
+
commandReport,
|
|
112681
|
+
writeCommandReport,
|
|
112682
|
+
...agentIoWriters
|
|
112683
|
+
});
|
|
112439
112684
|
}
|
|
112440
112685
|
},
|
|
112441
112686
|
packet: {
|