@lzehrung/codegraph 2.3.15 → 2.3.16
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 +10 -2
- package/dist/bin/cli.js +282 -156
- 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 +21 -7
- 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-index.d.ts.map +1 -1
- package/dist/indexer/build-index.js +120 -27
- 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;
|
|
@@ -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();
|
|
@@ -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,
|
|
@@ -53753,19 +53768,19 @@ var init_parsed_cache = __esm({
|
|
|
53753
53768
|
});
|
|
53754
53769
|
|
|
53755
53770
|
// dist/indexer/finalize.js
|
|
53756
|
-
import { performance as
|
|
53771
|
+
import { performance as performance4 } from "node:perf_hooks";
|
|
53757
53772
|
async function finalizeProjectIndex(args) {
|
|
53758
53773
|
const discoveryTimings = args.opts?.report ? args.opts.report.timings ??= {} : void 0;
|
|
53759
|
-
const metadataDiscoveryStart = args.projectFiles === void 0 ?
|
|
53774
|
+
const metadataDiscoveryStart = args.projectFiles === void 0 ? performance4.now() : void 0;
|
|
53760
53775
|
const projectFiles = await (args.projectFiles ?? discoverProjectFilesWithGitCandidates(args.projectRoot, {
|
|
53761
53776
|
...args.opts?.logLevel ? { logLevel: args.opts.logLevel } : {},
|
|
53762
53777
|
...args.knownGitCandidates !== void 0 ? { knownGitCandidates: args.knownGitCandidates } : {}
|
|
53763
53778
|
}));
|
|
53764
53779
|
if (metadataDiscoveryStart !== void 0 && discoveryTimings) {
|
|
53765
|
-
discoveryTimings.metadataDiscoveryMs = Math.round(
|
|
53780
|
+
discoveryTimings.metadataDiscoveryMs = Math.round(performance4.now() - metadataDiscoveryStart);
|
|
53766
53781
|
}
|
|
53767
53782
|
if (args.timings)
|
|
53768
|
-
args.timings.totalMs = Math.round(
|
|
53783
|
+
args.timings.totalMs = Math.round(performance4.now() - args.totalStart);
|
|
53769
53784
|
const languageExtensions = normalizeLanguageExtensions(args.opts?.languageExtensions);
|
|
53770
53785
|
const parsed = retainedParsedCache(args.parsedMap, args.opts);
|
|
53771
53786
|
return {
|
|
@@ -53803,7 +53818,7 @@ var init_finalize = __esm({
|
|
|
53803
53818
|
// dist/indexer/build-manifest.js
|
|
53804
53819
|
import fsp24 from "node:fs/promises";
|
|
53805
53820
|
import path45 from "node:path";
|
|
53806
|
-
import { performance as
|
|
53821
|
+
import { performance as performance5 } from "node:perf_hooks";
|
|
53807
53822
|
function toManifestFileEntry(entry) {
|
|
53808
53823
|
if (!entry.sig)
|
|
53809
53824
|
return void 0;
|
|
@@ -53818,7 +53833,7 @@ async function writeIndexManifestSnapshot(args) {
|
|
|
53818
53833
|
const files = args.files instanceof Map ? Object.fromEntries(args.files) : args.files;
|
|
53819
53834
|
if (!Object.keys(files).length && !args.allowEmpty)
|
|
53820
53835
|
return;
|
|
53821
|
-
const writeManifestStart =
|
|
53836
|
+
const writeManifestStart = performance5.now();
|
|
53822
53837
|
const lastCommit = await getGitHead(args.projectRoot);
|
|
53823
53838
|
const configHashResult = await computeConfigHash(args.projectRoot, args.opts?.logLevel);
|
|
53824
53839
|
const projectRootMtimeMs = args.symlinkDirectories !== void 0 ? (await fsp24.stat(args.projectRoot)).mtimeMs : void 0;
|
|
@@ -53843,7 +53858,7 @@ async function writeIndexManifestSnapshot(args) {
|
|
|
53843
53858
|
if (manifestWritten)
|
|
53844
53859
|
pruneDiskModuleCache(args.projectRoot, Object.keys(files), args.opts);
|
|
53845
53860
|
if (args.timings) {
|
|
53846
|
-
args.timings.writeManifestMs = Math.round(
|
|
53861
|
+
args.timings.writeManifestMs = Math.round(performance5.now() - writeManifestStart);
|
|
53847
53862
|
}
|
|
53848
53863
|
}
|
|
53849
53864
|
var init_build_manifest = __esm({
|
|
@@ -55280,7 +55295,7 @@ var init_nativeWorkerPool = __esm({
|
|
|
55280
55295
|
});
|
|
55281
55296
|
|
|
55282
55297
|
// dist/indexer/build-workers.js
|
|
55283
|
-
import { performance as
|
|
55298
|
+
import { performance as performance6 } from "node:perf_hooks";
|
|
55284
55299
|
function shouldEnableNativeWorkers(opts, fileCount) {
|
|
55285
55300
|
if (opts?.native === "off")
|
|
55286
55301
|
return false;
|
|
@@ -55374,14 +55389,14 @@ async function setupWorkerPool(opts, fileCount) {
|
|
|
55374
55389
|
return {
|
|
55375
55390
|
pool,
|
|
55376
55391
|
report,
|
|
55377
|
-
startTime: pool ?
|
|
55392
|
+
startTime: pool ? performance6.now() : 0,
|
|
55378
55393
|
batchSize: NATIVE_WORKER_BATCH_SIZE
|
|
55379
55394
|
};
|
|
55380
55395
|
}
|
|
55381
55396
|
async function teardownWorkerPool(setup, buildReport2) {
|
|
55382
55397
|
if (setup.pool) {
|
|
55383
55398
|
if (setup.report) {
|
|
55384
|
-
setup.report.wallClockMs = Math.round(
|
|
55399
|
+
setup.report.wallClockMs = Math.round(performance6.now() - setup.startTime);
|
|
55385
55400
|
}
|
|
55386
55401
|
try {
|
|
55387
55402
|
await setup.pool.destroy();
|
|
@@ -55649,7 +55664,7 @@ import crypto10 from "node:crypto";
|
|
|
55649
55664
|
import fs23 from "node:fs";
|
|
55650
55665
|
import fsp26 from "node:fs/promises";
|
|
55651
55666
|
import path47 from "node:path";
|
|
55652
|
-
import { performance as
|
|
55667
|
+
import { performance as performance7 } from "node:perf_hooks";
|
|
55653
55668
|
function initParserBackendDegradationReport(report) {
|
|
55654
55669
|
if (!report)
|
|
55655
55670
|
return void 0;
|
|
@@ -55948,7 +55963,7 @@ function createIndexBuildRunState(projectRoot, opts, graphOptions = normalizeGra
|
|
|
55948
55963
|
normalizedProjectRoot: normalizePath(path47.resolve(projectRoot)),
|
|
55949
55964
|
report,
|
|
55950
55965
|
timings: report?.timings,
|
|
55951
|
-
totalStart:
|
|
55966
|
+
totalStart: performance7.now(),
|
|
55952
55967
|
cacheMode,
|
|
55953
55968
|
cacheEnabled: cacheMode !== "off",
|
|
55954
55969
|
graphOptions,
|
|
@@ -55993,6 +56008,26 @@ function emitIndexCheckActivity(opts, activity, current = 0, total = 0) {
|
|
|
55993
56008
|
total
|
|
55994
56009
|
});
|
|
55995
56010
|
}
|
|
56011
|
+
function emitIndexBuildActivity(opts, activity, current, total) {
|
|
56012
|
+
opts?.onProgress?.({
|
|
56013
|
+
type: "progress",
|
|
56014
|
+
phase: "update",
|
|
56015
|
+
mode: "build",
|
|
56016
|
+
message: activity,
|
|
56017
|
+
activity,
|
|
56018
|
+
current,
|
|
56019
|
+
total
|
|
56020
|
+
});
|
|
56021
|
+
}
|
|
56022
|
+
async function timeIndexBuildPhase(args) {
|
|
56023
|
+
if (args.buildStartedAt !== void 0) {
|
|
56024
|
+
emitIndexBuildActivity(args.opts, args.activity, args.current, args.total);
|
|
56025
|
+
}
|
|
56026
|
+
const startedAt = performance7.now();
|
|
56027
|
+
const result = await args.fn();
|
|
56028
|
+
recordBuildTimingStep(args.timings, { name: args.stepName, ms: Math.round(performance7.now() - startedAt) });
|
|
56029
|
+
return result;
|
|
56030
|
+
}
|
|
55996
56031
|
function createCountedCheckProgress(opts, activity, total) {
|
|
55997
56032
|
emitIndexCheckActivity(opts, activity, 0, total);
|
|
55998
56033
|
let completed = 0;
|
|
@@ -56003,7 +56038,7 @@ function createCountedCheckProgress(opts, activity, total) {
|
|
|
56003
56038
|
}
|
|
56004
56039
|
};
|
|
56005
56040
|
}
|
|
56006
|
-
function
|
|
56041
|
+
function resetTransientBuildTimings(timings) {
|
|
56007
56042
|
if (!timings)
|
|
56008
56043
|
return;
|
|
56009
56044
|
delete timings.gitListMs;
|
|
@@ -56011,7 +56046,7 @@ function resetDiscoveryTimingSteps(timings) {
|
|
|
56011
56046
|
delete timings.sourceDiscoveryMs;
|
|
56012
56047
|
delete timings.metadataDiscoveryMs;
|
|
56013
56048
|
delete timings.cacheProbeMs;
|
|
56014
|
-
const remaining = (timings.steps ?? []).filter((step) => !
|
|
56049
|
+
const remaining = (timings.steps ?? []).filter((step) => !Object.hasOwn(TRANSIENT_BUILD_TIMING_STEP_NAMES, step.name));
|
|
56015
56050
|
if (remaining.length) {
|
|
56016
56051
|
timings.steps = remaining;
|
|
56017
56052
|
return;
|
|
@@ -56070,7 +56105,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56070
56105
|
const fileReport = initFileReport(report);
|
|
56071
56106
|
if (fileReport)
|
|
56072
56107
|
fileReport.total = normalizedFiles.length;
|
|
56073
|
-
const manifestStart =
|
|
56108
|
+
const manifestStart = performance7.now();
|
|
56074
56109
|
const manifest = useManifest && !helperOpts?.ignoreExistingManifest ? await loadManifest(projectRoot, opts, report) : null;
|
|
56075
56110
|
const manifestFiles = sanitizeManifestEntriesForRoot(projectRoot, manifest?.files);
|
|
56076
56111
|
const manifestOptionDiffs = manifest ? diffBuildOptions(manifest.buildOptions, opts) : [];
|
|
@@ -56085,7 +56120,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56085
56120
|
}
|
|
56086
56121
|
}
|
|
56087
56122
|
if (timings && useManifest) {
|
|
56088
|
-
timings.manifestMs = Math.round(
|
|
56123
|
+
timings.manifestMs = Math.round(performance7.now() - manifestStart);
|
|
56089
56124
|
}
|
|
56090
56125
|
const edgeProbeConcurrency = buildConcurrency(opts);
|
|
56091
56126
|
const staleCachedEdgeFiles = /* @__PURE__ */ new Set();
|
|
@@ -56114,7 +56149,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56114
56149
|
const moduleCacheAvailable = opts?.cache !== "disk" || diskModuleCacheExists(projectRoot, opts);
|
|
56115
56150
|
const shouldReportFileCacheCheck = Boolean(helperOpts?.reportDiscoveryProgress);
|
|
56116
56151
|
const reportFileCacheCheck = shouldReportFileCacheCheck ? createCountedCheckProgress(opts, "Checking file cache", normalizedFiles.length) : () => void 0;
|
|
56117
|
-
const cacheProbeStart =
|
|
56152
|
+
const cacheProbeStart = performance7.now();
|
|
56118
56153
|
const gitAvailable = await isGitRepo(projectRoot);
|
|
56119
56154
|
const needsPersistentSignatures = cacheEnabled || useManifest;
|
|
56120
56155
|
const useGitSignatures = gitAvailable && needsPersistentSignatures;
|
|
@@ -56187,7 +56222,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56187
56222
|
}
|
|
56188
56223
|
}));
|
|
56189
56224
|
if (timings) {
|
|
56190
|
-
const cacheProbeMs = Math.round(
|
|
56225
|
+
const cacheProbeMs = Math.round(performance7.now() - cacheProbeStart);
|
|
56191
56226
|
timings.cacheProbeMs = cacheProbeMs;
|
|
56192
56227
|
recordBuildTimingStep(timings, { name: "cache-probe", ms: cacheProbeMs });
|
|
56193
56228
|
}
|
|
@@ -56209,7 +56244,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56209
56244
|
}
|
|
56210
56245
|
return matchPath;
|
|
56211
56246
|
};
|
|
56212
|
-
const parseStart =
|
|
56247
|
+
const parseStart = performance7.now();
|
|
56213
56248
|
const graph = { nodes: new Set(normalizedFiles), edges: [] };
|
|
56214
56249
|
const onFileEdges = manifestEntries ? (file2, entry) => {
|
|
56215
56250
|
const manifestEntry = toManifestFileEntry(entry);
|
|
@@ -56223,7 +56258,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56223
56258
|
const ensureBuildProgressStarted = () => {
|
|
56224
56259
|
if (buildStartedAt !== void 0)
|
|
56225
56260
|
return;
|
|
56226
|
-
buildStartedAt =
|
|
56261
|
+
buildStartedAt = performance7.now();
|
|
56227
56262
|
emitIndexLifecycleProgress(opts, "start", "build", totalFiles);
|
|
56228
56263
|
};
|
|
56229
56264
|
if (cacheMisses.length)
|
|
@@ -56357,8 +56392,8 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56357
56392
|
}
|
|
56358
56393
|
});
|
|
56359
56394
|
if (timings)
|
|
56360
|
-
timings.parseMs = Math.round(
|
|
56361
|
-
const graphStart =
|
|
56395
|
+
timings.parseMs = Math.round(performance7.now() - parseStart);
|
|
56396
|
+
const graphStart = performance7.now();
|
|
56362
56397
|
const seenGraphEdges = /* @__PURE__ */ new Set();
|
|
56363
56398
|
const appendUniqueGraphEdges = (edges) => {
|
|
56364
56399
|
if (!edges.length)
|
|
@@ -56381,12 +56416,34 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56381
56416
|
pendingCacheWrites.push(cacheWrite);
|
|
56382
56417
|
}
|
|
56383
56418
|
if (pendingCacheWrites.length) {
|
|
56384
|
-
|
|
56419
|
+
if (opts?.cache === "disk") {
|
|
56420
|
+
await timeIndexBuildPhase({
|
|
56421
|
+
opts,
|
|
56422
|
+
timings,
|
|
56423
|
+
buildStartedAt,
|
|
56424
|
+
stepName: "persist-cache",
|
|
56425
|
+
activity: "Writing disk cache",
|
|
56426
|
+
current: totalFiles,
|
|
56427
|
+
total: totalFiles,
|
|
56428
|
+
fn: () => writeModulesToCache(projectRoot, pendingCacheWrites, opts)
|
|
56429
|
+
});
|
|
56430
|
+
} else {
|
|
56431
|
+
writeModulesToCache(projectRoot, pendingCacheWrites, opts);
|
|
56432
|
+
}
|
|
56385
56433
|
}
|
|
56386
|
-
const workspaceManifestEdges = await
|
|
56434
|
+
const workspaceManifestEdges = await timeIndexBuildPhase({
|
|
56435
|
+
opts,
|
|
56436
|
+
timings,
|
|
56437
|
+
buildStartedAt,
|
|
56438
|
+
stepName: "workspace-manifests",
|
|
56439
|
+
activity: "Resolving workspace manifests",
|
|
56440
|
+
current: totalFiles,
|
|
56441
|
+
total: totalFiles,
|
|
56442
|
+
fn: () => collectWorkspaceManifestDependencyEdges(projectRoot, normalizedFiles.filter((file2) => path47.basename(file2) === "package.json"), opts?.discovery, opts?.logLevel)
|
|
56443
|
+
});
|
|
56387
56444
|
appendUniqueGraphEdges(workspaceManifestEdges);
|
|
56388
56445
|
if (timings)
|
|
56389
|
-
timings.graphMs = Math.round(
|
|
56446
|
+
timings.graphMs = Math.round(performance7.now() - graphStart);
|
|
56390
56447
|
for (const jsonPath of jsonDependencies.values()) {
|
|
56391
56448
|
ensureJsonModule(modules, jsonPath);
|
|
56392
56449
|
}
|
|
@@ -56403,42 +56460,69 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56403
56460
|
}
|
|
56404
56461
|
}
|
|
56405
56462
|
if (manifestEntries) {
|
|
56406
|
-
await
|
|
56407
|
-
projectRoot,
|
|
56463
|
+
await timeIndexBuildPhase({
|
|
56408
56464
|
opts,
|
|
56409
|
-
graphOptions,
|
|
56410
|
-
...resolverEnvironmentFingerprint ? { resolverEnvironmentFingerprint } : {},
|
|
56411
|
-
files: manifestEntries,
|
|
56412
56465
|
timings,
|
|
56413
|
-
|
|
56414
|
-
|
|
56415
|
-
|
|
56466
|
+
buildStartedAt,
|
|
56467
|
+
stepName: "index-manifest",
|
|
56468
|
+
activity: "Writing index manifest",
|
|
56469
|
+
current: totalFiles,
|
|
56470
|
+
total: totalFiles,
|
|
56471
|
+
fn: () => writeIndexManifestSnapshot({
|
|
56472
|
+
projectRoot,
|
|
56473
|
+
opts,
|
|
56474
|
+
graphOptions,
|
|
56475
|
+
...resolverEnvironmentFingerprint ? { resolverEnvironmentFingerprint } : {},
|
|
56476
|
+
files: manifestEntries,
|
|
56477
|
+
timings,
|
|
56478
|
+
manifestReport: report?.manifest,
|
|
56479
|
+
...helperOpts?.transientFiles !== void 0 ? { transientFiles: helperOpts.transientFiles } : {},
|
|
56480
|
+
...helperOpts?.symlinkDirectories !== void 0 ? { symlinkDirectories: helperOpts.symlinkDirectories } : {}
|
|
56481
|
+
})
|
|
56416
56482
|
});
|
|
56417
56483
|
}
|
|
56418
56484
|
const indexManifestEntries = manifestEntries ? projectIndexManifestEntries2(Array.from(manifestEntries, ([file2, entry]) => {
|
|
56419
56485
|
const cacheSig = fileSignatures.get(file2)?.cacheSig;
|
|
56420
56486
|
return [file2, { ...entry, ...cacheSig ? { cacheSig } : {} }];
|
|
56421
56487
|
})) : manifestEntriesForIndex;
|
|
56422
|
-
const index = await
|
|
56423
|
-
projectRoot,
|
|
56424
|
-
normalizedProjectRoot,
|
|
56488
|
+
const index = await timeIndexBuildPhase({
|
|
56425
56489
|
opts,
|
|
56426
56490
|
timings,
|
|
56427
|
-
|
|
56428
|
-
|
|
56429
|
-
|
|
56430
|
-
|
|
56431
|
-
|
|
56432
|
-
|
|
56433
|
-
|
|
56434
|
-
|
|
56491
|
+
buildStartedAt,
|
|
56492
|
+
stepName: "finalize",
|
|
56493
|
+
activity: "Finalizing project graph",
|
|
56494
|
+
current: totalFiles,
|
|
56495
|
+
total: totalFiles,
|
|
56496
|
+
fn: () => finalizeProjectIndex({
|
|
56497
|
+
projectRoot,
|
|
56498
|
+
normalizedProjectRoot,
|
|
56499
|
+
opts,
|
|
56500
|
+
timings,
|
|
56501
|
+
totalStart,
|
|
56502
|
+
graph,
|
|
56503
|
+
modules,
|
|
56504
|
+
parsedMap,
|
|
56505
|
+
bloomFilterCache,
|
|
56506
|
+
...projectFiles !== void 0 ? { projectFiles } : {},
|
|
56507
|
+
buildReport: report,
|
|
56508
|
+
manifestEntries: indexManifestEntries
|
|
56509
|
+
})
|
|
56435
56510
|
});
|
|
56436
56511
|
if (manifestEntries) {
|
|
56437
|
-
await
|
|
56512
|
+
await timeIndexBuildPhase({
|
|
56513
|
+
opts,
|
|
56514
|
+
timings,
|
|
56515
|
+
buildStartedAt,
|
|
56516
|
+
stepName: "snapshot-write",
|
|
56517
|
+
activity: "Writing project snapshot",
|
|
56518
|
+
current: totalFiles,
|
|
56519
|
+
total: totalFiles,
|
|
56520
|
+
fn: () => writeProjectIndexSnapshot(projectRoot, opts, index, projectSnapshotFilesSignature(manifestEntries, projectRoot))
|
|
56521
|
+
});
|
|
56438
56522
|
}
|
|
56439
56523
|
if (buildStartedAt !== void 0) {
|
|
56440
56524
|
const progressStartedAt = opts?.progressStartedAt ?? buildStartedAt;
|
|
56441
|
-
emitIndexLifecycleProgress(opts, "complete", "build", index.byFile.size,
|
|
56525
|
+
emitIndexLifecycleProgress(opts, "complete", "build", index.byFile.size, performance7.now() - progressStartedAt);
|
|
56442
56526
|
}
|
|
56443
56527
|
return index;
|
|
56444
56528
|
} finally {
|
|
@@ -56447,7 +56531,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
|
|
|
56447
56531
|
}
|
|
56448
56532
|
async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpts) {
|
|
56449
56533
|
const timings = opts?.report ? opts.report.timings ??= {} : void 0;
|
|
56450
|
-
|
|
56534
|
+
resetTransientBuildTimings(timings);
|
|
56451
56535
|
await initializeFileIdentityCaseSensitivity(projectRoot);
|
|
56452
56536
|
try {
|
|
56453
56537
|
const useDiskCache = (opts?.cache ?? "off") === "disk";
|
|
@@ -56471,7 +56555,7 @@ async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpt
|
|
|
56471
56555
|
const onDiscoveryTiming = timings ? (step) => recordBuildTimingStep(timings, step) : void 0;
|
|
56472
56556
|
if (helperOpts?.reportDiscoveryProgress)
|
|
56473
56557
|
emitIndexCheckActivity(opts, "Discovering source files");
|
|
56474
|
-
const sourceDiscoveryStart =
|
|
56558
|
+
const sourceDiscoveryStart = performance7.now();
|
|
56475
56559
|
const discoveredFiles = await listProjectFilesWithGitCandidates(projectRoot, projectPatternsForLanguageExtensions(opts), {
|
|
56476
56560
|
...opts?.discovery,
|
|
56477
56561
|
...opts?.logLevel ? { logLevel: opts.logLevel } : {},
|
|
@@ -56482,7 +56566,7 @@ async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpt
|
|
|
56482
56566
|
...onDiscoveryTiming ? { onDiscoveryTiming } : {}
|
|
56483
56567
|
});
|
|
56484
56568
|
if (timings)
|
|
56485
|
-
timings.sourceDiscoveryMs = Math.round(
|
|
56569
|
+
timings.sourceDiscoveryMs = Math.round(performance7.now() - sourceDiscoveryStart);
|
|
56486
56570
|
const additionalFileCandidates = await normalizeIndexedFileInputsWithinRoot(projectRoot, opts?.additionalFiles ?? [], "Additional index file");
|
|
56487
56571
|
const additionalFileExistence = await probePathExistence(additionalFileCandidates, buildConcurrency(opts));
|
|
56488
56572
|
const additionalFiles = additionalFileCandidates.filter((file2) => additionalFileExistence.get(file2));
|
|
@@ -56491,7 +56575,7 @@ async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpt
|
|
|
56491
56575
|
const transientFiles = additionalFiles.filter((file2) => !discoveredFileSet.has(file2));
|
|
56492
56576
|
if (helperOpts?.reportDiscoveryProgress)
|
|
56493
56577
|
emitIndexCheckActivity(opts, "Discovering project metadata");
|
|
56494
|
-
const metadataDiscoveryStart =
|
|
56578
|
+
const metadataDiscoveryStart = performance7.now();
|
|
56495
56579
|
const projectFiles = await discoverProjectFilesWithGitCandidates(projectRoot, {
|
|
56496
56580
|
...opts?.logLevel ? { logLevel: opts.logLevel } : {},
|
|
56497
56581
|
...discoveredSymlinkDirectories !== void 0 ? { knownSymlinkDirectories: discoveredSymlinkDirectories } : {},
|
|
@@ -56500,7 +56584,7 @@ async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpt
|
|
|
56500
56584
|
...onDiscoveryTiming ? { onDiscoveryTiming } : {}
|
|
56501
56585
|
});
|
|
56502
56586
|
if (timings)
|
|
56503
|
-
timings.metadataDiscoveryMs = Math.round(
|
|
56587
|
+
timings.metadataDiscoveryMs = Math.round(performance7.now() - metadataDiscoveryStart);
|
|
56504
56588
|
return await buildIndexFromFileListShared(projectRoot, files, opts, {
|
|
56505
56589
|
manifestMode: useDiskCache ? "read-write" : "off",
|
|
56506
56590
|
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 +56604,11 @@ async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpt
|
|
|
56520
56604
|
async function buildProjectIndex(projectRoot, opts) {
|
|
56521
56605
|
return buildProjectIndexWithManifestOptions(projectRoot, {
|
|
56522
56606
|
...opts,
|
|
56523
|
-
progressStartedAt: opts?.progressStartedAt ??
|
|
56607
|
+
progressStartedAt: opts?.progressStartedAt ?? performance7.now()
|
|
56524
56608
|
});
|
|
56525
56609
|
}
|
|
56526
56610
|
async function buildProjectIndexFromFiles(projectRoot, inputFiles, rawOpts) {
|
|
56527
|
-
const opts = { ...rawOpts, progressStartedAt: rawOpts?.progressStartedAt ??
|
|
56611
|
+
const opts = { ...rawOpts, progressStartedAt: rawOpts?.progressStartedAt ?? performance7.now() };
|
|
56528
56612
|
try {
|
|
56529
56613
|
const useDiskCache = (opts?.cache ?? "off") === "disk";
|
|
56530
56614
|
const normalizedInputFiles = await normalizeIndexedFileInputsWithinRoot(projectRoot, inputFiles, "Index file");
|
|
@@ -56556,7 +56640,7 @@ async function buildDeclaredScopeIndex(projectRoot, scopeFiles, opts) {
|
|
|
56556
56640
|
async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
56557
56641
|
const opts = {
|
|
56558
56642
|
...rawOpts,
|
|
56559
|
-
progressStartedAt: rawOpts?.progressStartedAt ??
|
|
56643
|
+
progressStartedAt: rawOpts?.progressStartedAt ?? performance7.now()
|
|
56560
56644
|
};
|
|
56561
56645
|
await initializeFileIdentityCaseSensitivity(projectRoot);
|
|
56562
56646
|
clearResolutionCaches();
|
|
@@ -56566,7 +56650,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
56566
56650
|
graphOptions.fast = false;
|
|
56567
56651
|
const { normalizedProjectRoot, report, timings, totalStart, cacheMode, cacheEnabled, onFallbackImportExtraction } = createIndexBuildRunState(projectRoot, opts, graphOptions);
|
|
56568
56652
|
const discoveryTimings = opts?.report ? opts.report.timings ??= {} : void 0;
|
|
56569
|
-
|
|
56653
|
+
resetTransientBuildTimings(discoveryTimings);
|
|
56570
56654
|
let checkProgressActive = false;
|
|
56571
56655
|
const startCheckProgress = () => {
|
|
56572
56656
|
if (checkProgressActive)
|
|
@@ -56592,7 +56676,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
56592
56676
|
message: "Checked project index",
|
|
56593
56677
|
current: total,
|
|
56594
56678
|
total,
|
|
56595
|
-
elapsedMs:
|
|
56679
|
+
elapsedMs: performance7.now() - totalStart
|
|
56596
56680
|
});
|
|
56597
56681
|
};
|
|
56598
56682
|
try {
|
|
@@ -56607,10 +56691,10 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
56607
56691
|
return await buildProjectIndexFromExport(projectRoot, opts, { ignoreExistingManifest: true });
|
|
56608
56692
|
}
|
|
56609
56693
|
startCheckProgress();
|
|
56610
|
-
const manifestStart =
|
|
56694
|
+
const manifestStart = performance7.now();
|
|
56611
56695
|
const manifest = await loadManifest(projectRoot, opts, report);
|
|
56612
56696
|
if (timings)
|
|
56613
|
-
timings.manifestMs = Math.round(
|
|
56697
|
+
timings.manifestMs = Math.round(performance7.now() - manifestStart);
|
|
56614
56698
|
const manifestUsed = !!manifest;
|
|
56615
56699
|
const manifestReport = initManifestReport(report, manifestUsed, false);
|
|
56616
56700
|
if (manifestReport && !manifestUsed)
|
|
@@ -56665,11 +56749,11 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
56665
56749
|
if (!discoveryTimings || opts?.filesAreProjectScope)
|
|
56666
56750
|
return await operation();
|
|
56667
56751
|
sourceDiscoveryPerformed = true;
|
|
56668
|
-
const start =
|
|
56752
|
+
const start = performance7.now();
|
|
56669
56753
|
try {
|
|
56670
56754
|
return await operation();
|
|
56671
56755
|
} finally {
|
|
56672
|
-
sourceDiscoveryMs +=
|
|
56756
|
+
sourceDiscoveryMs += performance7.now() - start;
|
|
56673
56757
|
}
|
|
56674
56758
|
};
|
|
56675
56759
|
let manifestDiffFiles = [];
|
|
@@ -56869,13 +56953,13 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
56869
56953
|
const snapshot = snapshotLoad.index;
|
|
56870
56954
|
snapshot.manifestSignaturesFresh = false;
|
|
56871
56955
|
if (snapshot.projectFiles === void 0) {
|
|
56872
|
-
const metadataDiscoveryStart =
|
|
56956
|
+
const metadataDiscoveryStart = performance7.now();
|
|
56873
56957
|
snapshot.projectFiles = await discoverProjectFilesWithGitCandidates(projectRoot, {
|
|
56874
56958
|
...opts?.logLevel ? { logLevel: opts.logLevel } : {},
|
|
56875
56959
|
...discoveredGitCandidates !== void 0 ? { knownGitCandidates: discoveredGitCandidates } : {}
|
|
56876
56960
|
});
|
|
56877
56961
|
if (discoveryTimings)
|
|
56878
|
-
discoveryTimings.metadataDiscoveryMs = Math.round(
|
|
56962
|
+
discoveryTimings.metadataDiscoveryMs = Math.round(performance7.now() - metadataDiscoveryStart);
|
|
56879
56963
|
}
|
|
56880
56964
|
if (opts?.cache) {
|
|
56881
56965
|
snapshot.cacheMode = opts.cache;
|
|
@@ -56913,7 +56997,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
56913
56997
|
const snapshot = await reuseUnchangedSnapshot();
|
|
56914
56998
|
if (snapshot) {
|
|
56915
56999
|
if (timings)
|
|
56916
|
-
timings.totalMs = Math.round(
|
|
57000
|
+
timings.totalMs = Math.round(performance7.now() - totalStart);
|
|
56917
57001
|
completeCheckProgress(allFiles.size);
|
|
56918
57002
|
return snapshot;
|
|
56919
57003
|
}
|
|
@@ -56983,7 +57067,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
56983
57067
|
unchangedSnapshot.manifestEntries = new Map(Array.from(fileSignatures, ([file2, signature]) => [file2, toProjectIndexManifestEntry(signature)]));
|
|
56984
57068
|
unchangedSnapshot.manifestSignaturesFresh = true;
|
|
56985
57069
|
if (timings)
|
|
56986
|
-
timings.totalMs = Math.round(
|
|
57070
|
+
timings.totalMs = Math.round(performance7.now() - totalStart);
|
|
56987
57071
|
completeCheckProgress(allFiles.size);
|
|
56988
57072
|
return unchangedSnapshot;
|
|
56989
57073
|
}
|
|
@@ -57025,13 +57109,13 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
57025
57109
|
workerSetup = await setupWorkerPool(opts, countNativeWorkerEligibleFiles(changedList, opts?.languageExtensions));
|
|
57026
57110
|
let updateStartedAt;
|
|
57027
57111
|
if (changedList.length || deletedTrackedFiles.size) {
|
|
57028
|
-
updateStartedAt =
|
|
57112
|
+
updateStartedAt = performance7.now();
|
|
57029
57113
|
emitIndexLifecycleProgress(opts, "start", "update", changedList.length);
|
|
57030
57114
|
}
|
|
57031
57115
|
if (fileReport)
|
|
57032
57116
|
fileReport.changed = changedList.length;
|
|
57033
57117
|
if (changedList.length) {
|
|
57034
|
-
const parseStart =
|
|
57118
|
+
const parseStart = performance7.now();
|
|
57035
57119
|
let processedFiles = 0;
|
|
57036
57120
|
const totalFiles = changedList.length;
|
|
57037
57121
|
const fileResults = await mapLimit(changedList, conc, async (file2) => {
|
|
@@ -57094,7 +57178,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
57094
57178
|
writeModulesToCache(projectRoot, pendingIncrementalCacheWrites, opts);
|
|
57095
57179
|
}
|
|
57096
57180
|
if (timings)
|
|
57097
|
-
timings.parseMs = Math.round(
|
|
57181
|
+
timings.parseMs = Math.round(performance7.now() - parseStart);
|
|
57098
57182
|
}
|
|
57099
57183
|
for (const jsonPath of jsonDependencies.values()) {
|
|
57100
57184
|
ensureJsonModule(modules, jsonPath);
|
|
@@ -57124,7 +57208,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
57124
57208
|
}
|
|
57125
57209
|
}
|
|
57126
57210
|
const filesList = Array.from(changedFiles);
|
|
57127
|
-
const graphStart =
|
|
57211
|
+
const graphStart = performance7.now();
|
|
57128
57212
|
const graph = !filesList.length && baseGraph ? { nodes: new Set(baseGraph.nodes), edges: [...baseGraph.edges] } : await collectGraph(projectRoot, filesList, {
|
|
57129
57213
|
parsed: parsedMap,
|
|
57130
57214
|
fast: !!graphOptions.fast,
|
|
@@ -57150,7 +57234,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
57150
57234
|
}
|
|
57151
57235
|
});
|
|
57152
57236
|
if (timings)
|
|
57153
|
-
timings.graphMs = Math.round(
|
|
57237
|
+
timings.graphMs = Math.round(performance7.now() - graphStart);
|
|
57154
57238
|
for (const file2 of /* @__PURE__ */ new Set([...changedFiles, ...transientFiles])) {
|
|
57155
57239
|
const signature = fileSignatures.get(file2);
|
|
57156
57240
|
if (!signature || manifestEntries.has(file2))
|
|
@@ -57210,7 +57294,7 @@ async function buildProjectIndexIncremental(projectRoot, rawOpts) {
|
|
|
57210
57294
|
});
|
|
57211
57295
|
await writeProjectIndexSnapshot(projectRoot, opts, index, projectSnapshotFilesSignature(manifestEntries, projectRoot));
|
|
57212
57296
|
if (updateStartedAt !== void 0) {
|
|
57213
|
-
emitIndexLifecycleProgress(opts, "complete", "update", index.byFile.size,
|
|
57297
|
+
emitIndexLifecycleProgress(opts, "complete", "update", index.byFile.size, performance7.now() - updateStartedAt);
|
|
57214
57298
|
} else {
|
|
57215
57299
|
completeCheckProgress(allFiles.size);
|
|
57216
57300
|
}
|
|
@@ -57356,7 +57440,7 @@ async function buildGraphDelta(projectRoot, opts) {
|
|
|
57356
57440
|
removed: removedRelative.sort(compareEdges)
|
|
57357
57441
|
};
|
|
57358
57442
|
}
|
|
57359
|
-
var
|
|
57443
|
+
var TRANSIENT_BUILD_TIMING_STEP_NAMES;
|
|
57360
57444
|
var init_build_index = __esm({
|
|
57361
57445
|
"dist/indexer/build-index.js"() {
|
|
57362
57446
|
"use strict";
|
|
@@ -57396,7 +57480,17 @@ var init_build_index = __esm({
|
|
|
57396
57480
|
init_build_workers();
|
|
57397
57481
|
init_incremental_plan();
|
|
57398
57482
|
init_parsed_cache();
|
|
57399
|
-
|
|
57483
|
+
TRANSIENT_BUILD_TIMING_STEP_NAMES = {
|
|
57484
|
+
"git-list": true,
|
|
57485
|
+
"git-ignore": true,
|
|
57486
|
+
"filesystem-scan": true,
|
|
57487
|
+
"cache-probe": true,
|
|
57488
|
+
"persist-cache": true,
|
|
57489
|
+
"workspace-manifests": true,
|
|
57490
|
+
"index-manifest": true,
|
|
57491
|
+
finalize: true,
|
|
57492
|
+
"snapshot-write": true
|
|
57493
|
+
};
|
|
57400
57494
|
}
|
|
57401
57495
|
});
|
|
57402
57496
|
|
|
@@ -68034,7 +68128,7 @@ var init_deleted = __esm({
|
|
|
68034
68128
|
});
|
|
68035
68129
|
|
|
68036
68130
|
// dist/review/candidates.js
|
|
68037
|
-
import { performance as
|
|
68131
|
+
import { performance as performance8 } from "node:perf_hooks";
|
|
68038
68132
|
function relativePath(root, file2) {
|
|
68039
68133
|
return toProjectDisplayPath(root, file2);
|
|
68040
68134
|
}
|
|
@@ -68067,7 +68161,7 @@ function mergeCandidateTestEntries(baseCandidates, additionalCandidates) {
|
|
|
68067
68161
|
return Array.from(merged.values());
|
|
68068
68162
|
}
|
|
68069
68163
|
async function collectReviewCandidateTests(input) {
|
|
68070
|
-
const candidateStart =
|
|
68164
|
+
const candidateStart = performance8.now();
|
|
68071
68165
|
const configuredMaxCandidates = input.appliedOptions.maxCandidates;
|
|
68072
68166
|
const maxCandidates = typeof configuredMaxCandidates === "number" && Number.isFinite(configuredMaxCandidates) ? Math.max(0, Math.floor(configuredMaxCandidates)) : REVIEW_DEFAULT_CANDIDATE_TEST_LIMIT;
|
|
68073
68167
|
const candidateTests = mergeCandidateTestEntries(listCandidateTestFiles(input.index, input.changedFileList, input.changedSymbolIds, {
|
|
@@ -68087,7 +68181,7 @@ async function collectReviewCandidateTests(input) {
|
|
|
68087
68181
|
return left.reason.localeCompare(right.reason);
|
|
68088
68182
|
}).slice(0, maxCandidates);
|
|
68089
68183
|
if (input.reviewTimings) {
|
|
68090
|
-
input.reviewTimings.candidatesMs = Math.round(
|
|
68184
|
+
input.reviewTimings.candidatesMs = Math.round(performance8.now() - candidateStart);
|
|
68091
68185
|
}
|
|
68092
68186
|
return candidateTests;
|
|
68093
68187
|
}
|
|
@@ -68383,7 +68477,7 @@ var init_parse4 = __esm({
|
|
|
68383
68477
|
});
|
|
68384
68478
|
|
|
68385
68479
|
// dist/review/changes.js
|
|
68386
|
-
import { performance as
|
|
68480
|
+
import { performance as performance9 } from "node:perf_hooks";
|
|
68387
68481
|
function deletedPathsForChange(change2) {
|
|
68388
68482
|
if (change2.kind === "deleted") {
|
|
68389
68483
|
return [change2.path];
|
|
@@ -68401,16 +68495,16 @@ async function collectReviewChanges(projectRoot, appliedOptions, reviewTimings)
|
|
|
68401
68495
|
const isIncludedReviewFile = createImpactIncludeMatcher(discoveryGlobRoot, appliedOptions.discovery?.includeGlobs ?? []);
|
|
68402
68496
|
const changedFiles = /* @__PURE__ */ new Set();
|
|
68403
68497
|
const explicitFiles = /* @__PURE__ */ new Set();
|
|
68404
|
-
const changesStart =
|
|
68498
|
+
const changesStart = performance9.now();
|
|
68405
68499
|
for (const file2 of appliedOptions.files ?? []) {
|
|
68406
68500
|
const normalized = normalizeFile(file2, "Review file");
|
|
68407
68501
|
changedFiles.add(normalized);
|
|
68408
68502
|
explicitFiles.add(normalized);
|
|
68409
68503
|
}
|
|
68410
68504
|
if (reviewTimings) {
|
|
68411
|
-
reviewTimings.changesMs = Math.round(
|
|
68505
|
+
reviewTimings.changesMs = Math.round(performance9.now() - changesStart);
|
|
68412
68506
|
}
|
|
68413
|
-
const diffStart =
|
|
68507
|
+
const diffStart = performance9.now();
|
|
68414
68508
|
const shouldLoadGitDiff = Boolean(appliedOptions.gitBase || appliedOptions.changedSince);
|
|
68415
68509
|
const diffText = appliedOptions.diffText ?? (shouldLoadGitDiff ? await getUnifiedDiff(projectRoot, {
|
|
68416
68510
|
base: appliedOptions.gitBase,
|
|
@@ -68419,7 +68513,7 @@ async function collectReviewChanges(projectRoot, appliedOptions, reviewTimings)
|
|
|
68419
68513
|
}) : "");
|
|
68420
68514
|
const diff = diffText ? parseUnifiedDiff(diffText) : null;
|
|
68421
68515
|
if (reviewTimings) {
|
|
68422
|
-
reviewTimings.diffMs = Math.round(
|
|
68516
|
+
reviewTimings.diffMs = Math.round(performance9.now() - diffStart);
|
|
68423
68517
|
}
|
|
68424
68518
|
const diffHunksByFile = /* @__PURE__ */ new Map();
|
|
68425
68519
|
const diffKindsByFile = /* @__PURE__ */ new Map();
|
|
@@ -69793,10 +69887,10 @@ var init_severity = __esm({
|
|
|
69793
69887
|
});
|
|
69794
69888
|
|
|
69795
69889
|
// dist/impact/budgets.js
|
|
69796
|
-
import { performance as
|
|
69890
|
+
import { performance as performance10 } from "node:perf_hooks";
|
|
69797
69891
|
function createImpactWorkBudget(options) {
|
|
69798
69892
|
return {
|
|
69799
|
-
...typeof options.timeBudgetMs === "number" && options.timeBudgetMs >= 0 ? { deadlineAt:
|
|
69893
|
+
...typeof options.timeBudgetMs === "number" && options.timeBudgetMs >= 0 ? { deadlineAt: performance10.now() + options.timeBudgetMs } : {},
|
|
69800
69894
|
...typeof options.maxReferenceLookups === "number" && options.maxReferenceLookups >= 0 ? { maxReferenceLookups: options.maxReferenceLookups } : {},
|
|
69801
69895
|
...typeof options.maxTotalReferences === "number" && options.maxTotalReferences >= 0 ? { maxTotalReferences: options.maxTotalReferences } : {},
|
|
69802
69896
|
referenceLookupsStarted: 0,
|
|
@@ -69811,7 +69905,7 @@ function isImpactDeadlineExceeded(budget) {
|
|
|
69811
69905
|
return true;
|
|
69812
69906
|
if (budget.deadlineAt === void 0)
|
|
69813
69907
|
return false;
|
|
69814
|
-
if (
|
|
69908
|
+
if (performance10.now() >= budget.deadlineAt) {
|
|
69815
69909
|
budget.deadlineExceeded = true;
|
|
69816
69910
|
return true;
|
|
69817
69911
|
}
|
|
@@ -71865,7 +71959,7 @@ var init_referenceCache = __esm({
|
|
|
71865
71959
|
// dist/review/summaries.js
|
|
71866
71960
|
import fsp37 from "node:fs/promises";
|
|
71867
71961
|
import path70 from "node:path";
|
|
71868
|
-
import { performance as
|
|
71962
|
+
import { performance as performance11 } from "node:perf_hooks";
|
|
71869
71963
|
function relativePath2(root, file2) {
|
|
71870
71964
|
return toProjectDisplayPath(root, file2);
|
|
71871
71965
|
}
|
|
@@ -72231,7 +72325,7 @@ async function summarizeChangedFiles2(input) {
|
|
|
72231
72325
|
}
|
|
72232
72326
|
}
|
|
72233
72327
|
const defsToResolve = fileEntries.flatMap((entry) => entry.locals);
|
|
72234
|
-
const referencesStart =
|
|
72328
|
+
const referencesStart = performance11.now();
|
|
72235
72329
|
const referenceResults = includeSymbolDetails && maxCallsites > 0 ? await mapLimit(defsToResolve, referenceConcurrency, async (def) => {
|
|
72236
72330
|
const refs = await referenceCache.get(index, def, {
|
|
72237
72331
|
maxReferences: maxCallsites + 1
|
|
@@ -72239,7 +72333,7 @@ async function summarizeChangedFiles2(input) {
|
|
|
72239
72333
|
return { def, refs };
|
|
72240
72334
|
}) : [];
|
|
72241
72335
|
if (reviewTimings) {
|
|
72242
|
-
reviewTimings.referencesMs = Math.round(
|
|
72336
|
+
reviewTimings.referencesMs = Math.round(performance11.now() - referencesStart);
|
|
72243
72337
|
}
|
|
72244
72338
|
const referencesByHandle = /* @__PURE__ */ new Map();
|
|
72245
72339
|
for (const entry of referenceResults) {
|
|
@@ -72419,7 +72513,7 @@ var init_summaries = __esm({
|
|
|
72419
72513
|
});
|
|
72420
72514
|
|
|
72421
72515
|
// dist/review.js
|
|
72422
|
-
import { performance as
|
|
72516
|
+
import { performance as performance12 } from "node:perf_hooks";
|
|
72423
72517
|
function mergeGraphOptions2(base, override) {
|
|
72424
72518
|
if (!base)
|
|
72425
72519
|
return override;
|
|
@@ -72463,7 +72557,7 @@ async function buildReviewIndex(input) {
|
|
|
72463
72557
|
diffChangesByFile,
|
|
72464
72558
|
graphOptions
|
|
72465
72559
|
});
|
|
72466
|
-
const indexStart =
|
|
72560
|
+
const indexStart = performance12.now();
|
|
72467
72561
|
const indexReport = reviewReport?.indexReport ?? (reviewReport ? { timings: {} } : void 0);
|
|
72468
72562
|
if (reviewReport && !reviewReport.indexReport && indexReport) {
|
|
72469
72563
|
reviewReport.indexReport = indexReport;
|
|
@@ -72496,7 +72590,7 @@ async function buildReviewIndex(input) {
|
|
|
72496
72590
|
});
|
|
72497
72591
|
}
|
|
72498
72592
|
if (reviewTimings) {
|
|
72499
|
-
reviewTimings.indexMs = Math.round(
|
|
72593
|
+
reviewTimings.indexMs = Math.round(performance12.now() - indexStart);
|
|
72500
72594
|
}
|
|
72501
72595
|
return {
|
|
72502
72596
|
index,
|
|
@@ -72515,7 +72609,7 @@ async function buildReviewReport(projectRoot, opts = {}, cached2) {
|
|
|
72515
72609
|
if (reviewReport && appliedOptions.duplicateTasks === false) {
|
|
72516
72610
|
delete reviewReport.duplicateAnalysis;
|
|
72517
72611
|
}
|
|
72518
|
-
const totalStart =
|
|
72612
|
+
const totalStart = performance12.now();
|
|
72519
72613
|
const { changedFiles, explicitFiles, diffHunksByFile, diffKindsByFile, diffChangesByFile } = await collectReviewChanges(projectRoot, appliedOptions, reviewTimings);
|
|
72520
72614
|
if (changedFiles.size === 0) {
|
|
72521
72615
|
const riskSummary = computeRiskSummary({
|
|
@@ -72549,7 +72643,7 @@ async function buildReviewReport(projectRoot, opts = {}, cached2) {
|
|
|
72549
72643
|
report2.base = appliedOptions.gitBase;
|
|
72550
72644
|
report2.head = appliedOptions.gitHead ?? "HEAD";
|
|
72551
72645
|
if (reviewTimings)
|
|
72552
|
-
reviewTimings.totalMs = Math.round(
|
|
72646
|
+
reviewTimings.totalMs = Math.round(performance12.now() - totalStart);
|
|
72553
72647
|
return report2;
|
|
72554
72648
|
}
|
|
72555
72649
|
const changedFileList = Array.from(changedFiles).sort(comparePaths2);
|
|
@@ -72627,7 +72721,7 @@ async function buildReviewReport(projectRoot, opts = {}, cached2) {
|
|
|
72627
72721
|
riskRelevantParseFailures,
|
|
72628
72722
|
exportedChangedCount
|
|
72629
72723
|
});
|
|
72630
|
-
const duplicateAnalysisStart =
|
|
72724
|
+
const duplicateAnalysisStart = performance12.now();
|
|
72631
72725
|
if (appliedOptions.duplicateTasks !== false) {
|
|
72632
72726
|
const duplicateReview = await collectReviewDuplicateTasks({
|
|
72633
72727
|
projectRoot,
|
|
@@ -72648,10 +72742,10 @@ async function buildReviewReport(projectRoot, opts = {}, cached2) {
|
|
|
72648
72742
|
}
|
|
72649
72743
|
}
|
|
72650
72744
|
if (reviewTimings && appliedOptions.duplicateTasks !== false) {
|
|
72651
|
-
reviewTimings.duplicateAnalysisMs = Math.round(
|
|
72745
|
+
reviewTimings.duplicateAnalysisMs = Math.round(performance12.now() - duplicateAnalysisStart);
|
|
72652
72746
|
}
|
|
72653
72747
|
if (reviewTimings)
|
|
72654
|
-
reviewTimings.totalMs = Math.round(
|
|
72748
|
+
reviewTimings.totalMs = Math.round(performance12.now() - totalStart);
|
|
72655
72749
|
return report;
|
|
72656
72750
|
}
|
|
72657
72751
|
function buildSymbolDefLookup(index) {
|
|
@@ -78279,7 +78373,7 @@ ${SHARED_INDEX_OPTIONS_HELP}
|
|
|
78279
78373
|
`;
|
|
78280
78374
|
ORIENT_HELP_TEXT = `codegraph orient - Build a compact first-turn packet for agent repo context
|
|
78281
78375
|
|
|
78282
|
-
Usage: codegraph orient [roots...] [--root <path>] [--budget small|medium|large] [--health skip|summary|full] [--json | --pretty]
|
|
78376
|
+
Usage: codegraph orient [roots...] [--root <path>] [--budget small|medium|large] [--health skip|summary|full] [--report [--report-file <path>]] [--json | --pretty]
|
|
78283
78377
|
|
|
78284
78378
|
Output:
|
|
78285
78379
|
Orientation includes summary bullets, ranked focus targets with follow-up commands, a bounded project tree, budgeted health counts, and omission counts.
|
|
@@ -78336,13 +78430,13 @@ ${SHARED_INDEX_OPTIONS_HELP}
|
|
|
78336
78430
|
SERVER_HELP_TEXT = `codegraph server - Manage a shared project-local MCP HTTP server
|
|
78337
78431
|
|
|
78338
78432
|
Usage:
|
|
78339
|
-
codegraph server start [--root <path>] [--host <host>] [--port <1-65535>] [--startup-timeout-ms <1-86400000>] [--json] [--replace] [--warmup | --warmup-symbols]
|
|
78433
|
+
codegraph server start [--root <path>] [--host <host>] [--port <1-65535>] [--startup-timeout-ms <1-86400000>] [--json] [--replace] [--warmup | --warmup-symbols | --no-warmup]
|
|
78340
78434
|
codegraph server status [--root <path>] [--json | --pretty]
|
|
78341
78435
|
codegraph server stop [--root <path>]
|
|
78342
78436
|
|
|
78343
78437
|
Behavior:
|
|
78344
78438
|
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.
|
|
78439
|
+
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
78440
|
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
78441
|
|
|
78348
78442
|
Forwarded startup options:
|
|
@@ -78354,13 +78448,14 @@ Safety:
|
|
|
78354
78448
|
`;
|
|
78355
78449
|
MCP_HELP_TEXT = `codegraph mcp - Serve MCP tools for agent graph navigation
|
|
78356
78450
|
|
|
78357
|
-
Usage: codegraph mcp [serve] [--root <path>] [--artifact <path>] [--stdio | --port <number>] [--host <host>] [--idle-timeout-ms <ms>] [--allow-build] [--warmup | --warmup-symbols]
|
|
78451
|
+
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
78452
|
|
|
78359
78453
|
Transports:
|
|
78360
78454
|
--stdio Serve MCP over stdio (default)
|
|
78361
78455
|
--port <number> Serve Streamable HTTP at /mcp
|
|
78362
|
-
--warmup Build the base session cache at startup
|
|
78456
|
+
--warmup Build the base session cache at startup (default)
|
|
78363
78457
|
--warmup-symbols Build the base cache and detailed symbol graph at startup
|
|
78458
|
+
--no-warmup Skip startup warmup; the first tool call pays for discovery and building
|
|
78364
78459
|
|
|
78365
78460
|
Index Options:
|
|
78366
78461
|
--cache <mode> Session cache mode: disk, memory, off
|
|
@@ -78379,7 +78474,7 @@ Tools are read-only unless --allow-build is passed.
|
|
|
78379
78474
|
`;
|
|
78380
78475
|
MCP_SERVE_HELP_TEXT = `codegraph mcp serve - MCP server for agent graph navigation
|
|
78381
78476
|
|
|
78382
|
-
Usage: codegraph mcp [serve] [--root <path>] [--artifact <path>] [--stdio | --port <number>] [--host <host>] [--idle-timeout-ms <ms>] [--allow-build] [--warmup | --warmup-symbols]
|
|
78477
|
+
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
78478
|
|
|
78384
78479
|
Tools:
|
|
78385
78480
|
orient Build a compact first-turn repo packet
|
|
@@ -78414,7 +78509,7 @@ Index Options:
|
|
|
78414
78509
|
Defaults:
|
|
78415
78510
|
Transport defaults to stdio.
|
|
78416
78511
|
HTTP transport binds to 127.0.0.1 unless --host is passed and serves /mcp.
|
|
78417
|
-
Startup
|
|
78512
|
+
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
78513
|
Warmup uses the configured session cache and shared index flags.
|
|
78419
78514
|
Tools are read-only unless --allow-build is passed.
|
|
78420
78515
|
`;
|
|
@@ -78739,7 +78834,7 @@ var search_exports = {};
|
|
|
78739
78834
|
__export(search_exports, {
|
|
78740
78835
|
handleSearchCommand: () => handleSearchCommand
|
|
78741
78836
|
});
|
|
78742
|
-
import { performance as
|
|
78837
|
+
import { performance as performance13 } from "node:perf_hooks";
|
|
78743
78838
|
function parseAgentSearchMode(rawValue) {
|
|
78744
78839
|
if (rawValue === void 0)
|
|
78745
78840
|
return "hybrid";
|
|
@@ -78749,7 +78844,7 @@ function parseAgentSearchMode(rawValue) {
|
|
|
78749
78844
|
throw new Error(`Invalid --mode value "${rawValue}". Expected hybrid, symbol, path, text, graph, or sql.`);
|
|
78750
78845
|
}
|
|
78751
78846
|
async function handleSearchCommand(context) {
|
|
78752
|
-
const commandStart =
|
|
78847
|
+
const commandStart = performance13.now();
|
|
78753
78848
|
const query = context.positionals.join(" ").trim();
|
|
78754
78849
|
if (!query) {
|
|
78755
78850
|
context.writeStderrLine(SEARCH_HELP_TEXT.trimEnd());
|
|
@@ -78773,7 +78868,7 @@ async function handleSearchCommand(context) {
|
|
|
78773
78868
|
context.writeStdoutLine(formatAgentSearchResponse(response));
|
|
78774
78869
|
}
|
|
78775
78870
|
if (context.commandReport && context.writeCommandReport) {
|
|
78776
|
-
context.commandReport.timings.commandMs = Math.round(
|
|
78871
|
+
context.commandReport.timings.commandMs = Math.round(performance13.now() - commandStart);
|
|
78777
78872
|
context.commandReport.timings.totalMs = context.commandReport.timings.commandMs;
|
|
78778
78873
|
await context.writeCommandReport(context.commandReport, context.reportFile);
|
|
78779
78874
|
}
|
|
@@ -85154,6 +85249,7 @@ __export(orient_exports, {
|
|
|
85154
85249
|
formatAgentOrientation: () => formatAgentOrientation,
|
|
85155
85250
|
handleOrientCommand: () => handleOrientCommand
|
|
85156
85251
|
});
|
|
85252
|
+
import { performance as performance14 } from "node:perf_hooks";
|
|
85157
85253
|
function parseAgentOrientBudget(rawValue) {
|
|
85158
85254
|
if (rawValue === void 0)
|
|
85159
85255
|
return "small";
|
|
@@ -85171,9 +85267,15 @@ function parseAgentOrientHealthMode(rawValue) {
|
|
|
85171
85267
|
throw new Error(`Invalid --health value "${rawValue}". Expected skip, summary, or full.`);
|
|
85172
85268
|
}
|
|
85173
85269
|
async function handleOrientCommand(context) {
|
|
85270
|
+
const commandStart = performance14.now();
|
|
85174
85271
|
const healthMode = parseAgentOrientHealthMode(context.getOpt("--health"));
|
|
85175
85272
|
const writesJson = context.hasFlag("--json");
|
|
85176
|
-
const
|
|
85273
|
+
const indexReport = context.commandReport?.index;
|
|
85274
|
+
const buildOptions = {
|
|
85275
|
+
...context.buildOptions ?? {},
|
|
85276
|
+
logLevel: "silent",
|
|
85277
|
+
...indexReport ? { report: indexReport } : {}
|
|
85278
|
+
};
|
|
85177
85279
|
const response = await orientCodegraph({
|
|
85178
85280
|
root: context.root,
|
|
85179
85281
|
includeRoots: context.positionals,
|
|
@@ -85186,6 +85288,11 @@ async function handleOrientCommand(context) {
|
|
|
85186
85288
|
} else {
|
|
85187
85289
|
context.writeStdoutLine(formatAgentOrientation(response));
|
|
85188
85290
|
}
|
|
85291
|
+
if (context.commandReport && context.writeCommandReport) {
|
|
85292
|
+
context.commandReport.timings.commandMs = Math.round(performance14.now() - commandStart);
|
|
85293
|
+
context.commandReport.timings.totalMs = context.commandReport.timings.commandMs;
|
|
85294
|
+
await context.writeCommandReport(context.commandReport, context.reportFile);
|
|
85295
|
+
}
|
|
85189
85296
|
}
|
|
85190
85297
|
function formatAgentOrientation(response) {
|
|
85191
85298
|
const lines = ["Summary", ...response.summary.map((entry) => `- ${entry}`)];
|
|
@@ -101673,19 +101780,19 @@ function createCodegraphMcpSession(options, root) {
|
|
|
101673
101780
|
freshness: { policy: "auto" }
|
|
101674
101781
|
});
|
|
101675
101782
|
}
|
|
101676
|
-
function startCodegraphMcpWarmup(session, warmup) {
|
|
101677
|
-
|
|
101678
|
-
|
|
101679
|
-
|
|
101680
|
-
if (
|
|
101783
|
+
function startCodegraphMcpWarmup(session, warmup, sessionProvidedExplicitly) {
|
|
101784
|
+
const mode = warmup ?? (sessionProvidedExplicitly ? "off" : "base");
|
|
101785
|
+
if (mode === "off")
|
|
101786
|
+
return void 0;
|
|
101787
|
+
if (mode === "symbols")
|
|
101681
101788
|
return session.loadProject();
|
|
101682
|
-
}
|
|
101683
|
-
return void 0;
|
|
101789
|
+
return session.loadProject({ symbolGraph: "skip" });
|
|
101684
101790
|
}
|
|
101685
101791
|
async function createWarmedCodegraphMcpResources(options) {
|
|
101686
101792
|
const root = path85.resolve(options.root);
|
|
101793
|
+
const sessionProvidedExplicitly = options.session !== void 0;
|
|
101687
101794
|
const session = createCodegraphMcpSession(options, root);
|
|
101688
|
-
await startCodegraphMcpWarmup(session, options.warmup);
|
|
101795
|
+
await startCodegraphMcpWarmup(session, options.warmup, sessionProvidedExplicitly);
|
|
101689
101796
|
const { warmup, host, port, onHttpListen, ...handlerOptions } = options;
|
|
101690
101797
|
void warmup;
|
|
101691
101798
|
void host;
|
|
@@ -102193,7 +102300,7 @@ function createCodegraphMcpHandlersForSession(options, session) {
|
|
|
102193
102300
|
sqlitePath = configuredSqlitePath;
|
|
102194
102301
|
sqliteOutDir = configuredSqliteOutDir;
|
|
102195
102302
|
sqliteCanRefresh = configuredSqliteCanRefresh;
|
|
102196
|
-
await startCodegraphMcpWarmup(session, warmup);
|
|
102303
|
+
await startCodegraphMcpWarmup(session, warmup, true);
|
|
102197
102304
|
})();
|
|
102198
102305
|
refreshPromise = refresh;
|
|
102199
102306
|
try {
|
|
@@ -105717,7 +105824,7 @@ var init_protocol = __esm({
|
|
|
105717
105824
|
init_runtime();
|
|
105718
105825
|
init_runtimeIdentity();
|
|
105719
105826
|
init_legacySessions();
|
|
105720
|
-
DEFAULT_MCP_TOOL_TIMEOUT_MS =
|
|
105827
|
+
DEFAULT_MCP_TOOL_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
105721
105828
|
MAX_MCP_TOOL_TIMEOUT_MS = 2147483647;
|
|
105722
105829
|
MAX_MCP_STDIO_FRAME_BYTES = 10 * 1024 * 1024;
|
|
105723
105830
|
DEFAULT_MCP_TOOL_CONCURRENCY = 4;
|
|
@@ -106296,7 +106403,7 @@ async function handleMcpServeCommand(context) {
|
|
|
106296
106403
|
...host !== void 0 ? { host } : {},
|
|
106297
106404
|
...artifactPath !== void 0 ? { artifactPath } : {},
|
|
106298
106405
|
...context.buildOptions !== void 0 ? { buildOptions: context.buildOptions } : {},
|
|
106299
|
-
|
|
106406
|
+
warmup,
|
|
106300
106407
|
...idleTimeoutMs !== void 0 ? { idleTimeoutMs } : {},
|
|
106301
106408
|
onHttpListen: (info) => {
|
|
106302
106409
|
context.writeStderrLine(`Codegraph MCP HTTP server listening at ${info.url}`);
|
|
@@ -106304,15 +106411,20 @@ async function handleMcpServeCommand(context) {
|
|
|
106304
106411
|
});
|
|
106305
106412
|
}
|
|
106306
106413
|
function parseMcpWarmupMode(context) {
|
|
106307
|
-
|
|
106308
|
-
context.
|
|
106414
|
+
const explicit = [
|
|
106415
|
+
context.hasFlag("--warmup"),
|
|
106416
|
+
context.hasFlag("--warmup-symbols"),
|
|
106417
|
+
context.hasFlag("--no-warmup")
|
|
106418
|
+
].filter(Boolean).length;
|
|
106419
|
+
if (explicit > 1) {
|
|
106420
|
+
context.writeStderrLine("Choose only one of --warmup, --warmup-symbols, or --no-warmup for mcp serve startup.");
|
|
106309
106421
|
context.exit(2);
|
|
106310
106422
|
}
|
|
106311
106423
|
if (context.hasFlag("--warmup-symbols"))
|
|
106312
106424
|
return "symbols";
|
|
106313
|
-
if (context.hasFlag("--warmup"))
|
|
106314
|
-
return "
|
|
106315
|
-
return
|
|
106425
|
+
if (context.hasFlag("--no-warmup"))
|
|
106426
|
+
return "off";
|
|
106427
|
+
return "base";
|
|
106316
106428
|
}
|
|
106317
106429
|
var init_mcp = __esm({
|
|
106318
106430
|
"dist/cli/mcp.js"() {
|
|
@@ -106393,8 +106505,8 @@ function parseServerStartOptions(context) {
|
|
|
106393
106505
|
}
|
|
106394
106506
|
}
|
|
106395
106507
|
async function startServerForRoot(context, root, options) {
|
|
106396
|
-
if (context.hasFlag("--warmup")
|
|
106397
|
-
throw new ServerUsageError("Choose
|
|
106508
|
+
if ([context.hasFlag("--warmup"), context.hasFlag("--warmup-symbols"), context.hasFlag("--no-warmup")].filter(Boolean).length > 1) {
|
|
106509
|
+
throw new ServerUsageError("Choose only one of --warmup, --warmup-symbols, or --no-warmup for server start.");
|
|
106398
106510
|
}
|
|
106399
106511
|
const existingStatus = await readServerStatus(root);
|
|
106400
106512
|
if (existingStatus.status === "live") {
|
|
@@ -106673,6 +106785,8 @@ async function spawnServerProcess(root, host, port, lifecycleCredential, context
|
|
|
106673
106785
|
args.push("--warmup");
|
|
106674
106786
|
if (context.hasFlag("--warmup-symbols"))
|
|
106675
106787
|
args.push("--warmup-symbols");
|
|
106788
|
+
if (context.hasFlag("--no-warmup"))
|
|
106789
|
+
args.push("--no-warmup");
|
|
106676
106790
|
for (const flag of FORWARDED_FLAGS) {
|
|
106677
106791
|
if (context.hasFlag(flag))
|
|
106678
106792
|
args.push(flag);
|
|
@@ -107165,6 +107279,7 @@ var init_server2 = __esm({
|
|
|
107165
107279
|
"--replace",
|
|
107166
107280
|
"--warmup",
|
|
107167
107281
|
"--warmup-symbols",
|
|
107282
|
+
"--no-warmup",
|
|
107168
107283
|
"--workers",
|
|
107169
107284
|
"--json",
|
|
107170
107285
|
"--pretty"
|
|
@@ -107754,7 +107869,7 @@ __export(graph_exports, {
|
|
|
107754
107869
|
import fs42 from "node:fs";
|
|
107755
107870
|
import fsp40 from "node:fs/promises";
|
|
107756
107871
|
import path88 from "node:path";
|
|
107757
|
-
import { performance as
|
|
107872
|
+
import { performance as performance15 } from "node:perf_hooks";
|
|
107758
107873
|
function resolveGraphCacheMode(cache) {
|
|
107759
107874
|
return cache ?? "disk";
|
|
107760
107875
|
}
|
|
@@ -107894,11 +108009,11 @@ function stabilizeSymbolGraph(graph) {
|
|
|
107894
108009
|
}
|
|
107895
108010
|
async function handleGraphCommand(context) {
|
|
107896
108011
|
const commandReport = context.reportEnabled ? { command: "graph", timings: {} } : void 0;
|
|
107897
|
-
const commandStart =
|
|
107898
|
-
const resolveStart =
|
|
108012
|
+
const commandStart = performance15.now();
|
|
108013
|
+
const resolveStart = performance15.now();
|
|
107899
108014
|
const files = await context.resolveFiles();
|
|
107900
108015
|
if (commandReport) {
|
|
107901
|
-
commandReport.timings.resolveFilesMs = Math.round(
|
|
108016
|
+
commandReport.timings.resolveFilesMs = Math.round(performance15.now() - resolveStart);
|
|
107902
108017
|
}
|
|
107903
108018
|
const hasExplicitSymbolFlag = context.hasFlag("--symbols") || context.hasFlag("--symbols-only") || context.hasFlag("--symbols-detailed");
|
|
107904
108019
|
const outputArg = context.getOpt("--output") ?? context.getOpt("--out");
|
|
@@ -107940,7 +108055,7 @@ async function handleGraphCommand(context) {
|
|
|
107940
108055
|
const finalizeReport = async () => {
|
|
107941
108056
|
if (!commandReport)
|
|
107942
108057
|
return;
|
|
107943
|
-
commandReport.timings.commandMs = Math.round(
|
|
108058
|
+
commandReport.timings.commandMs = Math.round(performance15.now() - commandStart);
|
|
107944
108059
|
commandReport.timings.totalMs = commandReport.timings.commandMs;
|
|
107945
108060
|
await context.writeCommandReport(commandReport, context.reportFile);
|
|
107946
108061
|
};
|
|
@@ -108160,7 +108275,7 @@ var cli_exports = {};
|
|
|
108160
108275
|
__export(cli_exports, {
|
|
108161
108276
|
handleIndexCommand: () => handleIndexCommand
|
|
108162
108277
|
});
|
|
108163
|
-
import { performance as
|
|
108278
|
+
import { performance as performance16 } from "node:perf_hooks";
|
|
108164
108279
|
function formatIndexOutput(output) {
|
|
108165
108280
|
const lines = [`Indexed ${output.files} file(s) with ${output.edges} edge(s).`];
|
|
108166
108281
|
if (output.analysis.mode !== "semantic") {
|
|
@@ -108178,11 +108293,11 @@ function formatIndexOutput(output) {
|
|
|
108178
108293
|
async function handleIndexCommand(context) {
|
|
108179
108294
|
const verbose = context.hasFlag("--verbose");
|
|
108180
108295
|
const commandReport = context.reportEnabled ? { command: "index", timings: {} } : void 0;
|
|
108181
|
-
const commandStart =
|
|
108182
|
-
const resolveStart =
|
|
108296
|
+
const commandStart = performance16.now();
|
|
108297
|
+
const resolveStart = performance16.now();
|
|
108183
108298
|
const files = await context.resolveFiles();
|
|
108184
108299
|
if (commandReport) {
|
|
108185
|
-
commandReport.timings.resolveFilesMs = Math.round(
|
|
108300
|
+
commandReport.timings.resolveFilesMs = Math.round(performance16.now() - resolveStart);
|
|
108186
108301
|
}
|
|
108187
108302
|
const threads = parseNonNegativeIntegerOption(context.getOpt("--threads"), "--threads", 0);
|
|
108188
108303
|
const cache = parseCacheModeOption(context.getOpt("--cache"));
|
|
@@ -108248,7 +108363,7 @@ async function handleIndexCommand(context) {
|
|
|
108248
108363
|
}
|
|
108249
108364
|
}
|
|
108250
108365
|
if (commandReport) {
|
|
108251
|
-
commandReport.timings.commandMs = Math.round(
|
|
108366
|
+
commandReport.timings.commandMs = Math.round(performance16.now() - commandStart);
|
|
108252
108367
|
commandReport.timings.totalMs = commandReport.timings.commandMs;
|
|
108253
108368
|
await context.writeCommandReport(commandReport, context.reportFile);
|
|
108254
108369
|
}
|
|
@@ -111241,7 +111356,7 @@ var review_exports = {};
|
|
|
111241
111356
|
__export(review_exports, {
|
|
111242
111357
|
handleReviewCommand: () => handleReviewCommand
|
|
111243
111358
|
});
|
|
111244
|
-
import { performance as
|
|
111359
|
+
import { performance as performance17 } from "node:perf_hooks";
|
|
111245
111360
|
import path92 from "node:path";
|
|
111246
111361
|
function parseReviewDepth(value) {
|
|
111247
111362
|
if (value === "minimal" || value === "standard" || value === "deep") {
|
|
@@ -111433,7 +111548,7 @@ async function collectReviewDuplicateSummary(input) {
|
|
|
111433
111548
|
});
|
|
111434
111549
|
}
|
|
111435
111550
|
async function handleReviewCommand(context) {
|
|
111436
|
-
const commandStart =
|
|
111551
|
+
const commandStart = performance17.now();
|
|
111437
111552
|
const changedSince = context.getOpt("--changed-since");
|
|
111438
111553
|
const base = context.getOpt("--base") ?? (changedSince === void 0 ? "HEAD" : void 0);
|
|
111439
111554
|
const head = context.getOpt("--head") ?? (changedSince === void 0 ? "WORKTREE" : void 0);
|
|
@@ -111528,7 +111643,7 @@ async function handleReviewCommand(context) {
|
|
|
111528
111643
|
context.writeJSONLine(report);
|
|
111529
111644
|
}
|
|
111530
111645
|
if (context.commandReport) {
|
|
111531
|
-
context.commandReport.timings.commandMs = Math.round(
|
|
111646
|
+
context.commandReport.timings.commandMs = Math.round(performance17.now() - commandStart);
|
|
111532
111647
|
context.commandReport.timings.totalMs = context.commandReport.timings.commandMs;
|
|
111533
111648
|
await context.writeCommandReport(context.commandReport, context.reportFile);
|
|
111534
111649
|
}
|
|
@@ -111817,7 +111932,7 @@ __export(inspect_exports, {
|
|
|
111817
111932
|
handleHotspotsCommand: () => handleHotspotsCommand,
|
|
111818
111933
|
handleInspectCommand: () => handleInspectCommand
|
|
111819
111934
|
});
|
|
111820
|
-
import { performance as
|
|
111935
|
+
import { performance as performance18 } from "node:perf_hooks";
|
|
111821
111936
|
import fs44 from "node:fs";
|
|
111822
111937
|
import path93 from "node:path";
|
|
111823
111938
|
function defaultCacheIndexPath(projectRoot, cacheDir, cacheLocation) {
|
|
@@ -112079,18 +112194,18 @@ async function buildInspectReport(projectRoot, includeRoots, files, discovery, g
|
|
|
112079
112194
|
};
|
|
112080
112195
|
}
|
|
112081
112196
|
async function handleInspectCommand(context) {
|
|
112082
|
-
const commandStart =
|
|
112197
|
+
const commandStart = performance18.now();
|
|
112083
112198
|
const cache = parseCacheModeOption(context.getOpt("--cache"));
|
|
112084
112199
|
const limit = parsePositiveIntegerOption(context.getOpt("--limit"), "--limit", 20);
|
|
112085
|
-
const resolveStart =
|
|
112200
|
+
const resolveStart = performance18.now();
|
|
112086
112201
|
const files = await context.resolveFilesFromRoots();
|
|
112087
112202
|
if (context.commandReport) {
|
|
112088
|
-
context.commandReport.timings.resolveFilesMs = Math.round(
|
|
112203
|
+
context.commandReport.timings.resolveFilesMs = Math.round(performance18.now() - resolveStart);
|
|
112089
112204
|
}
|
|
112090
112205
|
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
112206
|
writeCliOutput(context, report, formatInspectReport);
|
|
112092
112207
|
if (context.commandReport && context.writeCommandReport) {
|
|
112093
|
-
context.commandReport.timings.commandMs = Math.round(
|
|
112208
|
+
context.commandReport.timings.commandMs = Math.round(performance18.now() - commandStart);
|
|
112094
112209
|
context.commandReport.timings.totalMs = context.commandReport.timings.commandMs;
|
|
112095
112210
|
await context.writeCommandReport(context.commandReport, context.reportFile);
|
|
112096
112211
|
}
|
|
@@ -112434,8 +112549,19 @@ var init_commandTable = __esm({
|
|
|
112434
112549
|
orient: {
|
|
112435
112550
|
stage: "project",
|
|
112436
112551
|
run: async (ctx) => {
|
|
112552
|
+
const commandReport = ctx.reportEnabled ? { command: "orient", timings: {} } : void 0;
|
|
112553
|
+
const indexReport = ctx.reportEnabled ? { timings: {} } : void 0;
|
|
112554
|
+
if (commandReport && indexReport)
|
|
112555
|
+
commandReport.index = indexReport;
|
|
112437
112556
|
const { handleOrientCommand: handleOrientCommand2 } = await Promise.resolve().then(() => (init_orient2(), orient_exports));
|
|
112438
|
-
await handleOrientCommand2({
|
|
112557
|
+
await handleOrientCommand2({
|
|
112558
|
+
...agentIo(ctx),
|
|
112559
|
+
positionals: ctx.includeRoots,
|
|
112560
|
+
reportFile: ctx.reportFile,
|
|
112561
|
+
commandReport,
|
|
112562
|
+
writeCommandReport,
|
|
112563
|
+
...agentIoWriters
|
|
112564
|
+
});
|
|
112439
112565
|
}
|
|
112440
112566
|
},
|
|
112441
112567
|
packet: {
|