@lzehrung/codegraph 2.3.2 → 2.3.4

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.
Files changed (74) hide show
  1. package/codegraph-skill/codegraph/SKILL.md +1 -1
  2. package/dist/agent/query-index/content.d.ts.map +1 -1
  3. package/dist/agent/query-index/content.js +4 -1
  4. package/dist/agent/query-index/content.js.map +1 -1
  5. package/dist/agent/query-index/update.js +2 -2
  6. package/dist/agent/query-index/update.js.map +1 -1
  7. package/dist/agent/query-index/workerPool.d.ts +22 -0
  8. package/dist/agent/query-index/workerPool.d.ts.map +1 -1
  9. package/dist/agent/query-index/workerPool.js +31 -1
  10. package/dist/agent/query-index/workerPool.js.map +1 -1
  11. package/dist/bin/cli.js +2183 -343
  12. package/dist/bin/queryIndexWorker.js +2 -2
  13. package/dist/cli/progress.js +27 -7
  14. package/dist/cli/progress.js.map +1 -1
  15. package/dist/duplicate-identifier-ranges.d.ts +5 -0
  16. package/dist/duplicate-identifier-ranges.d.ts.map +1 -0
  17. package/dist/duplicate-identifier-ranges.js +1500 -0
  18. package/dist/duplicate-identifier-ranges.js.map +1 -0
  19. package/dist/duplicate-token-normalization.d.ts.map +1 -1
  20. package/dist/duplicate-token-normalization.js +15 -1
  21. package/dist/duplicate-token-normalization.js.map +1 -1
  22. package/dist/duplicates/unitCache.d.ts +1 -1
  23. package/dist/duplicates/unitCache.d.ts.map +1 -1
  24. package/dist/duplicates/unitCache.js +5 -1
  25. package/dist/duplicates/unitCache.js.map +1 -1
  26. package/dist/indexer/build-cache/manifest.d.ts.map +1 -1
  27. package/dist/indexer/build-cache/manifest.js +25 -7
  28. package/dist/indexer/build-cache/manifest.js.map +1 -1
  29. package/dist/indexer/build-cache/module-cache.d.ts.map +1 -1
  30. package/dist/indexer/build-cache/module-cache.js +29 -14
  31. package/dist/indexer/build-cache/module-cache.js.map +1 -1
  32. package/dist/indexer/build-cache/project-snapshot.d.ts.map +1 -1
  33. package/dist/indexer/build-cache/project-snapshot.js +4 -1
  34. package/dist/indexer/build-cache/project-snapshot.js.map +1 -1
  35. package/dist/indexer/build-index.d.ts.map +1 -1
  36. package/dist/indexer/build-index.js +61 -13
  37. package/dist/indexer/build-index.js.map +1 -1
  38. package/dist/indexer/build-workers.d.ts +5 -2
  39. package/dist/indexer/build-workers.d.ts.map +1 -1
  40. package/dist/indexer/build-workers.js +5 -3
  41. package/dist/indexer/build-workers.js.map +1 -1
  42. package/dist/indexer/finalize.d.ts +2 -1
  43. package/dist/indexer/finalize.d.ts.map +1 -1
  44. package/dist/indexer/finalize.js +3 -2
  45. package/dist/indexer/finalize.js.map +1 -1
  46. package/dist/indexer/types.d.ts +1 -1
  47. package/dist/indexer/types.d.ts.map +1 -1
  48. package/dist/types.d.ts +5 -0
  49. package/dist/types.d.ts.map +1 -1
  50. package/dist/util/bloomFilter.d.ts +1 -1
  51. package/dist/util/bloomFilter.d.ts.map +1 -1
  52. package/dist/util/bloomFilter.js +2 -1
  53. package/dist/util/bloomFilter.js.map +1 -1
  54. package/dist/util/git.d.ts +2 -18
  55. package/dist/util/git.d.ts.map +1 -1
  56. package/dist/util/git.js +23 -6
  57. package/dist/util/git.js.map +1 -1
  58. package/dist/util/identifiers.d.ts +0 -6
  59. package/dist/util/identifiers.d.ts.map +1 -1
  60. package/dist/util/identifiers.js +0 -6
  61. package/dist/util/identifiers.js.map +1 -1
  62. package/dist/util/projectFiles.d.ts +54 -6
  63. package/dist/util/projectFiles.d.ts.map +1 -1
  64. package/dist/util/projectFiles.js +277 -104
  65. package/dist/util/projectFiles.js.map +1 -1
  66. package/dist/worker/nativeExtractWorker.d.ts +8 -0
  67. package/dist/worker/nativeExtractWorker.d.ts.map +1 -1
  68. package/dist/worker/nativeExtractWorker.js +25 -2
  69. package/dist/worker/nativeExtractWorker.js.map +1 -1
  70. package/dist/worker/nativeWorkerPool.d.ts +2 -0
  71. package/dist/worker/nativeWorkerPool.d.ts.map +1 -1
  72. package/dist/worker/nativeWorkerPool.js +13 -1
  73. package/dist/worker/nativeWorkerPool.js.map +1 -1
  74. package/package.json +3 -3
package/dist/bin/cli.js CHANGED
@@ -1179,6 +1179,7 @@ function createInteractiveProgressDisplay(write, delayMs = 0) {
1179
1179
  let current = 0;
1180
1180
  let total = 0;
1181
1181
  let mode = "build";
1182
+ let activity = progressAction(mode);
1182
1183
  let interval;
1183
1184
  let delay;
1184
1185
  const clear = () => {
@@ -1190,11 +1191,10 @@ function createInteractiveProgressDisplay(write, delayMs = 0) {
1190
1191
  const render = () => {
1191
1192
  if (!active)
1192
1193
  return;
1193
- const action = progressAction(mode);
1194
1194
  const frame = SPINNER_FRAMES[frameIndex % SPINNER_FRAMES.length];
1195
1195
  frameIndex += 1;
1196
- const count = formatProgressCount(current, total);
1197
- write(`${CLEAR_LINE}${action} project index... ${frame}${count}`);
1196
+ const count = hasProgressCount(mode, current, total) ? formatProgressCount(current, total) : "";
1197
+ write(`${CLEAR_LINE}${activity}... ${frame}${count}`);
1198
1198
  rendered = true;
1199
1199
  };
1200
1200
  const stopInterval = () => {
@@ -1216,6 +1216,7 @@ function createInteractiveProgressDisplay(write, delayMs = 0) {
1216
1216
  current = update.current;
1217
1217
  total = update.total;
1218
1218
  mode = update.mode ?? "build";
1219
+ activity = update.activity ?? `${progressAction(mode)} project index`;
1219
1220
  const beginRendering = () => {
1220
1221
  if (!active)
1221
1222
  return;
@@ -1262,6 +1263,8 @@ function createInteractiveProgressDisplay(write, delayMs = 0) {
1262
1263
  current = update.current;
1263
1264
  total = update.total;
1264
1265
  mode = update.mode ?? mode;
1266
+ if (update.activity !== void 0)
1267
+ activity = update.activity;
1265
1268
  },
1266
1269
  clear,
1267
1270
  dispose: () => {
@@ -1281,12 +1284,16 @@ function formatProgressCount(current, total) {
1281
1284
  return ` ${current}/${formatFileCount(total)}`;
1282
1285
  return ` ${formatFileCount(current)} processed`;
1283
1286
  }
1287
+ function hasProgressCount(mode, current, total) {
1288
+ return mode !== "check" || current > 0 || total > 0;
1289
+ }
1284
1290
  function createLogProgressDisplay(write, delayMs = 0) {
1285
1291
  let active = false;
1286
1292
  let rendered = false;
1287
1293
  let current = 0;
1288
1294
  let total = 0;
1289
1295
  let mode = "build";
1296
+ let activity = progressAction(mode);
1290
1297
  let delay;
1291
1298
  let heartbeat;
1292
1299
  const stopTimers = () => {
@@ -1303,12 +1310,13 @@ function createLogProgressDisplay(write, delayMs = 0) {
1303
1310
  if (!active || rendered)
1304
1311
  return;
1305
1312
  rendered = true;
1306
- write(`[Progress] ${progressAction(mode)} project index.
1313
+ write(`[Progress] ${activity}.
1307
1314
  `);
1308
1315
  heartbeat = setInterval(() => {
1309
1316
  if (!active)
1310
1317
  return;
1311
- write(`[Progress] ${progressAction(mode)} project index:${formatProgressCount(current, total)}.
1318
+ const count = hasProgressCount(mode, current, total) ? `:${formatProgressCount(current, total)}` : "";
1319
+ write(`[Progress] ${activity}${count}.
1312
1320
  `);
1313
1321
  }, 1e3);
1314
1322
  heartbeat.unref();
@@ -1320,6 +1328,7 @@ function createLogProgressDisplay(write, delayMs = 0) {
1320
1328
  current = update.current;
1321
1329
  total = update.total;
1322
1330
  mode = update.mode ?? "build";
1331
+ activity = update.activity ?? `${progressAction(mode)} project index`;
1323
1332
  if (delayMs) {
1324
1333
  delay = setTimeout(renderStart, delayMs);
1325
1334
  delay.unref();
@@ -1351,13 +1360,25 @@ function createLogProgressDisplay(write, delayMs = 0) {
1351
1360
  return;
1352
1361
  start(update);
1353
1362
  }
1363
+ const previousActivity = activity;
1354
1364
  current = update.current;
1355
1365
  total = update.total;
1356
1366
  mode = update.mode ?? mode;
1367
+ if (update.activity !== void 0)
1368
+ activity = update.activity;
1369
+ if (rendered && activity !== previousActivity) {
1370
+ write(`[Progress] ${activity}.
1371
+ `);
1372
+ }
1357
1373
  const isComplete = update.total > 0 && update.current >= update.total;
1358
- if (rendered && (update.current === 1 || isComplete || update.current % 100 === 0)) {
1359
- write(`[Progress] ${formatFileCount(update.current)} processed.
1374
+ if (rendered && (update.current === 1 || isComplete || update.current > 0 && update.current % 100 === 0)) {
1375
+ if (update.activity !== void 0) {
1376
+ write(`[Progress] ${activity}:${formatProgressCount(update.current, update.total)}.
1377
+ `);
1378
+ } else {
1379
+ write(`[Progress] ${formatFileCount(update.current)} processed.
1360
1380
  `);
1381
+ }
1361
1382
  }
1362
1383
  },
1363
1384
  clear: () => {
@@ -2395,12 +2416,11 @@ function hasNonAsciiCodePoint(value, includeC0Controls = false) {
2395
2416
  }
2396
2417
  return false;
2397
2418
  }
2398
- var ECMASCRIPT_IDENTIFIER_SOURCE, DUPLICATE_TOKENIZER_IDENTIFIER_SOURCE, BLOOM_FILTER_IDENTIFIER_SOURCE, XID_IDENTIFIER_SOURCE, PYTHON_IDENTIFIER_SOURCE, PHP_IDENTIFIER_SOURCE, JAVA_IDENTIFIER_IGNORABLE_SOURCE, CSHARP_IDENTIFIER_FORMAT_SOURCE, JAVA_IDENTIFIER_SOURCE, CSHARP_IDENTIFIER_SOURCE, GO_IDENTIFIER_SOURCE, KOTLIN_IDENTIFIER_SOURCE;
2419
+ var ECMASCRIPT_IDENTIFIER_SOURCE, BLOOM_FILTER_IDENTIFIER_SOURCE, XID_IDENTIFIER_SOURCE, PYTHON_IDENTIFIER_SOURCE, PHP_IDENTIFIER_SOURCE, JAVA_IDENTIFIER_IGNORABLE_SOURCE, CSHARP_IDENTIFIER_FORMAT_SOURCE, JAVA_IDENTIFIER_SOURCE, CSHARP_IDENTIFIER_SOURCE, GO_IDENTIFIER_SOURCE, KOTLIN_IDENTIFIER_SOURCE;
2399
2420
  var init_identifiers = __esm({
2400
2421
  "dist/util/identifiers.js"() {
2401
2422
  "use strict";
2402
2423
  ECMASCRIPT_IDENTIFIER_SOURCE = String.raw`[$_\p{ID_Start}](?:[$_\p{ID_Continue}]|\u200c|\u200d)*`;
2403
- DUPLICATE_TOKENIZER_IDENTIFIER_SOURCE = String.raw`[$_\p{XID_Start}\u1885\u1886\u2118\u212E\u309B\u309C](?:[$_\p{XID_Continue}\u00B7\u0387\u1369-\u1371\u19DA\u200C\u200D\u1885\u1886\u2118\u212E\u309B\u309C])*`;
2404
2424
  BLOOM_FILTER_IDENTIFIER_SOURCE = String.raw`[A-Za-z0-9_$\u0000-\u0008\u000E-\u001B\u007F-\u009F\u200C\u200D\u0080-\u{10FFFF}]+`;
2405
2425
  XID_IDENTIFIER_SOURCE = String.raw`[_\p{XID_Start}][_\p{XID_Continue}]*`;
2406
2426
  PYTHON_IDENTIFIER_SOURCE = XID_IDENTIFIER_SOURCE;
@@ -4761,9 +4781,9 @@ var require_path = __commonJS({
4761
4781
  "use strict";
4762
4782
  Object.defineProperty(exports, "__esModule", { value: true });
4763
4783
  exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
4764
- var os12 = __require("os");
4784
+ var os13 = __require("os");
4765
4785
  var path99 = __require("path");
4766
- var IS_WINDOWS_PLATFORM = os12.platform() === "win32";
4786
+ var IS_WINDOWS_PLATFORM = os13.platform() === "win32";
4767
4787
  var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
4768
4788
  var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
4769
4789
  var WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
@@ -10281,8 +10301,8 @@ var require_settings4 = __commonJS({
10281
10301
  Object.defineProperty(exports, "__esModule", { value: true });
10282
10302
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
10283
10303
  var fs49 = __require("fs");
10284
- var os12 = __require("os");
10285
- var CPU_COUNT = Math.max(os12.cpus().length, 1);
10304
+ var os13 = __require("os");
10305
+ var CPU_COUNT = Math.max(os13.cpus().length, 1);
10286
10306
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
10287
10307
  lstat: fs49.lstat,
10288
10308
  lstatSync: fs49.lstatSync,
@@ -13503,6 +13523,7 @@ __export(git_exports, {
13503
13523
  decodeGitPath: () => decodeGitPath,
13504
13524
  getGitBlobHashes: () => getGitBlobHashes,
13505
13525
  getGitHead: () => getGitHead,
13526
+ getGitRepositoryRoot: () => getGitRepositoryRoot,
13506
13527
  getUnifiedDiff: () => getUnifiedDiff,
13507
13528
  gitDiffArgs: () => gitDiffArgs,
13508
13529
  isGitIndexSentinel: () => isGitIndexSentinel,
@@ -13796,6 +13817,15 @@ async function isGitRepo(projectRoot) {
13796
13817
  gitRepositoryChecks.set(resolvedRoot, check2);
13797
13818
  return await check2;
13798
13819
  }
13820
+ async function getGitRepositoryRoot(projectRoot) {
13821
+ try {
13822
+ const { stdout } = await runGit(projectRoot, ["rev-parse", "--show-toplevel"]);
13823
+ const root = normalizePath(stdout.trim());
13824
+ return root || null;
13825
+ } catch {
13826
+ return null;
13827
+ }
13828
+ }
13799
13829
  async function isGitPathTracked(projectRoot, file2) {
13800
13830
  return await runGitPathPredicate(projectRoot, ["ls-files", "--error-unmatch", "--", normalizePath(file2)]);
13801
13831
  }
@@ -13917,6 +13947,9 @@ async function listChangedFiles(projectRoot, opts) {
13917
13947
  throw createGitError(projectRoot, args, error51);
13918
13948
  }
13919
13949
  }
13950
+ function resolveGitListedPath(projectRoot, listedPath) {
13951
+ return normalizePath(path8.isAbsolute(listedPath) ? listedPath : path8.resolve(projectRoot, listedPath));
13952
+ }
13920
13953
  async function listTrackedFiles(projectRoot, opts) {
13921
13954
  if (!(opts?.gitAvailable ?? true))
13922
13955
  return [];
@@ -13927,7 +13960,7 @@ async function listTrackedFiles(projectRoot, opts) {
13927
13960
  const { stdout } = await runGit(projectRoot, args, { maxBuffer: 64 * 1024 * 1024 });
13928
13961
  const out = [];
13929
13962
  for (const rel of stdout.split("\0").filter(Boolean)) {
13930
- const abs = normalizePath(path8.resolve(projectRoot, rel));
13963
+ const abs = resolveGitListedPath(projectRoot, rel);
13931
13964
  if (abs)
13932
13965
  out.push(abs);
13933
13966
  }
@@ -13987,7 +14020,7 @@ async function listGitExcludeFilesUncached(projectRoot) {
13987
14020
  const { stdout } = await runGit(projectRoot, ["rev-parse", "--git-path", "info/exclude"]);
13988
14021
  const resolved = stdout.trim();
13989
14022
  if (resolved)
13990
- candidates.push(normalizePath(path8.resolve(projectRoot, resolved)));
14023
+ candidates.push({ file: normalizePath(path8.resolve(projectRoot, resolved)), priority: 1 });
13991
14024
  } catch {
13992
14025
  }
13993
14026
  try {
@@ -13995,15 +14028,19 @@ async function listGitExcludeFilesUncached(projectRoot) {
13995
14028
  const configured = stdout.trim();
13996
14029
  if (configured) {
13997
14030
  const expanded = configured.startsWith("~") ? path8.join(os2.homedir(), configured.slice(1)) : path8.resolve(projectRoot, configured);
13998
- candidates.push(normalizePath(expanded));
14031
+ candidates.push({ file: normalizePath(expanded), priority: 0 });
13999
14032
  }
14000
14033
  } catch {
14001
14034
  }
14002
14035
  const sources = [];
14003
- for (const file2 of Array.from(new Set(candidates))) {
14036
+ const uniqueCandidates = /* @__PURE__ */ new Map();
14037
+ for (const candidate of candidates) {
14038
+ uniqueCandidates.set(candidate.file, Math.max(uniqueCandidates.get(candidate.file) ?? candidate.priority, candidate.priority));
14039
+ }
14040
+ for (const [file2, priority] of uniqueCandidates) {
14004
14041
  try {
14005
14042
  if ((await fsp4.stat(file2)).isFile())
14006
- sources.push({ file: file2, baseDir });
14043
+ sources.push({ file: file2, baseDir, priority });
14007
14044
  } catch {
14008
14045
  }
14009
14046
  }
@@ -14021,7 +14058,7 @@ async function listUntrackedFiles(projectRoot, opts) {
14021
14058
  const relFiles = stdout.toString().split("\0").filter(Boolean);
14022
14059
  const out = [];
14023
14060
  for (const rel of relFiles) {
14024
- const abs = normalizePath(path8.resolve(projectRoot, rel));
14061
+ const abs = resolveGitListedPath(projectRoot, rel);
14025
14062
  if (abs)
14026
14063
  out.push(abs);
14027
14064
  }
@@ -14098,15 +14135,26 @@ __export(projectFiles_exports, {
14098
14135
  DEFAULT_PROJECT_PATTERNS: () => DEFAULT_PROJECT_PATTERNS,
14099
14136
  createDiscoveredFileMatcher: () => createDiscoveredFileMatcher,
14100
14137
  discoverProjectFiles: () => discoverProjectFiles,
14138
+ discoverProjectFilesWithGitCandidates: () => discoverProjectFilesWithGitCandidates,
14101
14139
  filterRealPathsWithinRoot: () => filterRealPathsWithinRoot,
14102
14140
  isRelativePathInside: () => isRelativePathInside,
14103
14141
  listProjectFiles: () => listProjectFiles,
14142
+ listProjectFilesWithGitCandidates: () => listProjectFilesWithGitCandidates,
14104
14143
  matchesDiscoveryGlob: () => matchesDiscoveryGlob,
14105
14144
  translateGlobRootIgnoreGlobsForScanRoot: () => translateGlobRootIgnoreGlobsForScanRoot
14106
14145
  });
14107
14146
  import fs6 from "node:fs";
14108
14147
  import fsp5 from "node:fs/promises";
14109
14148
  import path9 from "node:path";
14149
+ function createPathCheckProgressReporter(total, onProgress) {
14150
+ onProgress?.(0, total);
14151
+ let completed = 0;
14152
+ return () => {
14153
+ completed += 1;
14154
+ if (completed === total || completed % 100 === 0)
14155
+ onProgress?.(completed, total);
14156
+ };
14157
+ }
14110
14158
  function isPresent(value) {
14111
14159
  return value !== void 0;
14112
14160
  }
@@ -14187,20 +14235,34 @@ function parseGitignoreRule(baseDir, rawLine) {
14187
14235
  matches
14188
14236
  };
14189
14237
  }
14190
- async function buildGitignoreIndex(sources) {
14191
- const sorted = [...sources].map(({ file: file2, baseDir }) => ({ file: normalizePath(file2), baseDir: normalizePath(baseDir) })).sort((left, right) => {
14192
- const leftFile = left.file;
14193
- const rightFile = right.file;
14194
- const depthDelta = leftFile.split("/").length - rightFile.split("/").length;
14195
- if (depthDelta !== 0)
14196
- return depthDelta;
14197
- if (leftFile < rightFile)
14238
+ async function buildGitignoreIndex(sources, repositoryRoots = [], repositoryAliases = []) {
14239
+ const sorted = [...sources].map(({ file: file2, baseDir, repositoryRoot, priority }) => ({
14240
+ file: normalizePath(file2),
14241
+ baseDir: normalizePath(baseDir),
14242
+ priority: priority ?? 2,
14243
+ ...repositoryRoot === void 0 ? {} : { repositoryRoot: normalizePath(repositoryRoot) }
14244
+ })).sort((left, right) => {
14245
+ const baseDepthDelta = left.baseDir.split("/").length - right.baseDir.split("/").length;
14246
+ if (baseDepthDelta !== 0)
14247
+ return baseDepthDelta;
14248
+ const priorityDelta = left.priority - right.priority;
14249
+ if (priorityDelta !== 0)
14250
+ return priorityDelta;
14251
+ if (left.file < right.file)
14198
14252
  return -1;
14199
- return leftFile > rightFile ? 1 : 0;
14253
+ return left.file > right.file ? 1 : 0;
14200
14254
  });
14201
- const gitignoreIndex = { hasRules: false, byBaseDir: /* @__PURE__ */ new Map() };
14202
- for (const { file: file2, baseDir } of sorted) {
14203
- if (isIgnoredByGitignore(file2, gitignoreIndex)) {
14255
+ const gitignoreIndex = {
14256
+ hasRules: false,
14257
+ repositoryRoots: Array.from(new Set(repositoryRoots.map(normalizePath))).sort((left, right) => right.length - left.length),
14258
+ repositoryAliases: Array.from(new Map(repositoryAliases.map(({ path: aliasPath, repositoryRoot }) => [
14259
+ fileIdentityKey(aliasPath),
14260
+ { path: normalizePath(aliasPath), repositoryRoot: normalizePath(repositoryRoot) }
14261
+ ])).values()).sort((left, right) => right.path.length - left.path.length),
14262
+ byBaseDir: /* @__PURE__ */ new Map()
14263
+ };
14264
+ for (const { file: file2, baseDir, repositoryRoot } of sorted) {
14265
+ if (isIgnoredByGitignore(path9.dirname(file2), gitignoreIndex, true)) {
14204
14266
  continue;
14205
14267
  }
14206
14268
  let raw;
@@ -14218,7 +14280,7 @@ async function buildGitignoreIndex(sources) {
14218
14280
  if (existing)
14219
14281
  existing.rules.push(rule);
14220
14282
  else
14221
- gitignoreIndex.byBaseDir.set(baseKey, { baseDir, rules: [rule] });
14283
+ gitignoreIndex.byBaseDir.set(baseKey, { baseDir, repositoryRoot, rules: [rule] });
14222
14284
  gitignoreIndex.hasRules = true;
14223
14285
  }
14224
14286
  }
@@ -14247,9 +14309,10 @@ async function loadGitignoreIndexForRootAliases(projectRoot) {
14247
14309
  }
14248
14310
  return await buildGitignoreIndex(sources);
14249
14311
  }
14250
- function isIgnoredByGitignore(absolutePath, gitignoreIndex) {
14312
+ function isIgnoredByGitignore(absolutePath, gitignoreIndex, isDirectory2 = false) {
14251
14313
  if (!gitignoreIndex.hasRules)
14252
14314
  return false;
14315
+ const owningRepositoryRoot = gitignoreIndex.repositoryRoots.find((root) => isFilePathWithinRoot(root, absolutePath)) ?? gitignoreIndex.repositoryAliases.find(({ path: aliasPath }) => isFilePathWithinRoot(aliasPath, absolutePath))?.repositoryRoot;
14253
14316
  const chain = [];
14254
14317
  let current = normalizePath(path9.dirname(absolutePath));
14255
14318
  for (; ; ) {
@@ -14264,6 +14327,9 @@ function isIgnoredByGitignore(absolutePath, gitignoreIndex) {
14264
14327
  let ignored = false;
14265
14328
  for (let depth = chain.length - 1; depth >= 0; depth -= 1) {
14266
14329
  const group = chain[depth];
14330
+ if (group.repositoryRoot !== void 0 && owningRepositoryRoot !== void 0 && fileIdentityKey(group.repositoryRoot) !== fileIdentityKey(owningRepositoryRoot)) {
14331
+ continue;
14332
+ }
14267
14333
  const relativePath3 = path9.relative(group.baseDir, absolutePath);
14268
14334
  if (!isRelativePathInside(relativePath3)) {
14269
14335
  continue;
@@ -14271,10 +14337,11 @@ function isIgnoredByGitignore(absolutePath, gitignoreIndex) {
14271
14337
  const normalizedRelativePath2 = normalizePath(relativePath3);
14272
14338
  const hasSeparator = normalizedRelativePath2.includes("/");
14273
14339
  for (const rule of group.rules) {
14274
- if (rule.dirOnly && !hasSeparator) {
14340
+ if (rule.dirOnly && !hasSeparator && !isDirectory2) {
14275
14341
  continue;
14276
14342
  }
14277
- if (rule.matches(normalizedRelativePath2)) {
14343
+ const matchesDirectory = isDirectory2 && rule.dirOnly && rule.matches(`${normalizedRelativePath2}/.directory`);
14344
+ if (rule.matches(normalizedRelativePath2) || matchesDirectory) {
14278
14345
  ignored = !rule.negated;
14279
14346
  }
14280
14347
  }
@@ -14313,40 +14380,89 @@ function collectCandidateAncestorDirectories(root, files) {
14313
14380
  }
14314
14381
  return directories;
14315
14382
  }
14316
- async function findGitIgnoreSources(root, files) {
14317
- const directories = collectCandidateAncestorDirectories(root, files);
14318
- const present = await mapLimitSemaphore(directories, REALPATH_FILTER_CONCURRENCY, async (directory) => {
14319
- const candidate = normalizePath(path9.join(directory, ".gitignore"));
14320
- try {
14321
- return (await fsp5.stat(candidate)).isFile() ? { file: candidate, baseDir: directory } : null;
14322
- } catch {
14323
- return null;
14324
- }
14325
- });
14326
- const sources = present.filter((entry) => entry !== null);
14327
- sources.push(...await listGitExcludeFiles(root));
14383
+ async function findGitIgnoreSources(sourceRoots, files) {
14384
+ const roots = Array.from(new Map(sourceRoots.map(({ path: sourceRoot, repositoryRoot }) => [
14385
+ fileIdentityKey(sourceRoot),
14386
+ { path: normalizePath(sourceRoot), repositoryRoot: normalizePath(repositoryRoot) }
14387
+ ])).values());
14388
+ const sources = [];
14389
+ for (const { path: sourceRoot, repositoryRoot } of roots) {
14390
+ const directories = collectCandidateAncestorDirectories(sourceRoot, files.filter((file2) => isFilePathWithinRoot(sourceRoot, file2)));
14391
+ const present = await mapLimitSemaphore(directories, REALPATH_FILTER_CONCURRENCY, async (directory) => {
14392
+ const candidate = normalizePath(path9.join(directory, ".gitignore"));
14393
+ try {
14394
+ return (await fsp5.stat(candidate)).isFile() ? { file: candidate, baseDir: directory, repositoryRoot, priority: 2 } : null;
14395
+ } catch {
14396
+ return null;
14397
+ }
14398
+ });
14399
+ sources.push(...present.filter((entry) => entry !== null));
14400
+ sources.push(...(await listGitExcludeFiles(sourceRoot)).map((source) => ({
14401
+ ...source,
14402
+ repositoryRoot: source.baseDir
14403
+ })));
14404
+ }
14328
14405
  return sources;
14329
14406
  }
14330
14407
  async function listGitCandidateFiles(root, logLevel) {
14331
14408
  try {
14332
- if (!await isGitRepo(root))
14409
+ const realRoot = normalizePath(await fsp5.realpath(root));
14410
+ const gitRoot = await isGitRepo(root) ? root : realRoot;
14411
+ if (!await isGitRepo(gitRoot))
14412
+ return null;
14413
+ if (await isGitProjectRootIgnored(realRoot))
14333
14414
  return null;
14334
- if (await isGitProjectRootIgnored(root))
14415
+ const gitRepositoryRoot = await getGitRepositoryRoot(gitRoot);
14416
+ if (!gitRepositoryRoot)
14335
14417
  return null;
14336
14418
  const [tracked, untracked, submoduleDirectories] = await Promise.all([
14337
- listTrackedFiles(root, { recurseSubmodules: true, ...logLevel === void 0 ? {} : { logLevel } }),
14338
- listUntrackedFiles(root, { respectGitignore: true }),
14339
- listGitSubmoduleDirectories(root, { recurse: true })
14419
+ listTrackedFiles(gitRoot, { recurseSubmodules: true, ...logLevel === void 0 ? {} : { logLevel } }),
14420
+ listUntrackedFiles(gitRoot, { respectGitignore: true }),
14421
+ listGitSubmoduleDirectories(gitRoot, { recurse: true })
14340
14422
  ]);
14341
- const submoduleUntracked = await Promise.all(submoduleDirectories.map(async (directory) => await listUntrackedFiles(directory, { respectGitignore: true })));
14342
- const files = Array.from(/* @__PURE__ */ new Set([...tracked, ...untracked, ...submoduleUntracked.flat()])).sort();
14343
- return { files, gitignoreFiles: await findGitIgnoreSources(root, files) };
14423
+ const submoduleRoots = await Promise.all(submoduleDirectories.map(async (logicalPath) => ({
14424
+ logicalPath: normalizePath(logicalPath),
14425
+ physicalPath: normalizePath(await fsp5.realpath(logicalPath).catch(() => logicalPath))
14426
+ })));
14427
+ const submoduleUntracked = await Promise.all(submoduleRoots.map(async ({ physicalPath }) => await listUntrackedFiles(physicalPath, { respectGitignore: true })));
14428
+ const rawFiles = Array.from(/* @__PURE__ */ new Set([...tracked, ...untracked, ...submoduleUntracked.flat()])).sort();
14429
+ const needsLogicalRemap = normalizePath(gitRoot) !== normalizePath(root);
14430
+ const files = Array.from(new Set(rawFiles.map((file2) => needsLogicalRemap && isFilePathWithinRoot(realRoot, file2) ? normalizePath(path9.resolve(root, path9.relative(realRoot, file2))) : normalizePath(file2)))).sort();
14431
+ const physicalFiles = normalizePath(root) === realRoot ? [] : (await mapLimitSemaphore(files, REALPATH_FILTER_CONCURRENCY, async (file2) => {
14432
+ try {
14433
+ return normalizePath(await fsp5.realpath(file2));
14434
+ } catch {
14435
+ return null;
14436
+ }
14437
+ })).filter((file2) => file2 !== null);
14438
+ const gitignoreRoots = [gitRepositoryRoot, ...submoduleRoots.map(({ physicalPath }) => physicalPath)].map(normalizePath);
14439
+ const sourceRoots = [
14440
+ { path: root, repositoryRoot: gitRepositoryRoot },
14441
+ { path: realRoot, repositoryRoot: gitRepositoryRoot },
14442
+ { path: gitRepositoryRoot, repositoryRoot: gitRepositoryRoot },
14443
+ ...submoduleRoots.flatMap(({ logicalPath, physicalPath }) => [
14444
+ { path: logicalPath, repositoryRoot: physicalPath },
14445
+ { path: physicalPath, repositoryRoot: physicalPath }
14446
+ ])
14447
+ ];
14448
+ return {
14449
+ files,
14450
+ gitignoreFiles: await findGitIgnoreSources(sourceRoots, [...rawFiles, ...files, ...physicalFiles]),
14451
+ gitignoreRoots,
14452
+ gitignoreAliases: sourceRoots
14453
+ };
14344
14454
  } catch (error51) {
14345
14455
  logWithLevel(logLevel, "debug", `Git discovery unavailable for ${root}: ${stringifyUnknown(error51)}`);
14346
14456
  return null;
14347
14457
  }
14348
14458
  }
14349
14459
  async function listProjectFiles(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS, options) {
14460
+ return await listProjectFilesInternal(projectRoot, patterns, options);
14461
+ }
14462
+ async function listProjectFilesWithGitCandidates(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS, options) {
14463
+ return await listProjectFilesInternal(projectRoot, patterns, options);
14464
+ }
14465
+ async function listProjectFilesInternal(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS, options) {
14350
14466
  const root = await ensureDirectoryReadable(projectRoot, "Project root");
14351
14467
  const globRoot = options?.globRoot ? await ensureDirectoryReadable(options.globRoot, "Glob root") : root;
14352
14468
  const includeGlobs = (options?.includeGlobs ?? []).map(normalizeGlobPattern).filter(Boolean);
@@ -14364,10 +14480,14 @@ async function listProjectFiles(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS
14364
14480
  try {
14365
14481
  const useGitignore = options?.useGitignore ?? true;
14366
14482
  const realRoot = await fsp5.realpath(root);
14367
- const gitCandidates = useGitignore && options?.gitignoreRoot === void 0 && normalizePath(realRoot) === normalizePath(root) ? await listGitCandidateFiles(root, options?.logLevel) : null;
14483
+ const attemptedGitCandidates = useGitignore && options?.gitignoreRoot === void 0 && normalizePath(realRoot) === normalizePath(root);
14484
+ const gitCandidates = attemptedGitCandidates ? await listGitCandidateFiles(root, options?.logLevel) : null;
14485
+ if (attemptedGitCandidates) {
14486
+ options?.onGitCandidatesDiscovered?.(gitCandidates);
14487
+ }
14368
14488
  let gitignoreIndex = EMPTY_GITIGNORE_INDEX;
14369
14489
  if (useGitignore && gitCandidates) {
14370
- gitignoreIndex = await buildGitignoreIndex(gitCandidates.gitignoreFiles);
14490
+ gitignoreIndex = await buildGitignoreIndex(gitCandidates.gitignoreFiles, gitCandidates.gitignoreRoots, gitCandidates.gitignoreAliases);
14371
14491
  } else if (useGitignore) {
14372
14492
  const gitignoreRoot = options?.gitignoreRoot ? await ensureDirectoryReadable(options.gitignoreRoot, "Gitignore root") : root;
14373
14493
  gitignoreIndex = await loadGitignoreIndexForRootAliases(gitignoreRoot);
@@ -14386,11 +14506,14 @@ async function listProjectFiles(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS
14386
14506
  followSymbolicLinks: false,
14387
14507
  ignore: translatedUserIgnoreGlobs
14388
14508
  }) : [];
14509
+ const reportSourceSymlinkChecks = options?.onDiscoveryProgress ? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking source symlinks", current, total }) : void 0;
14510
+ const reportSourcePathChecks = options?.onDiscoveryProgress ? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking source file paths", current, total }) : void 0;
14389
14511
  const symlinkOptions = {
14390
14512
  globRoot,
14391
14513
  ...gitCandidates ? { candidatePaths: gitCandidates.files } : {},
14392
14514
  ...options?.knownSymlinkDirectories !== void 0 ? { knownSymlinkDirectories: options.knownSymlinkDirectories } : {},
14393
- ...options?.onSymlinkDirectoriesDiscovered ? { onSymlinkDirectoriesDiscovered: options.onSymlinkDirectoriesDiscovered } : {}
14515
+ ...options?.onSymlinkDirectoriesDiscovered ? { onSymlinkDirectoriesDiscovered: options.onSymlinkDirectoriesDiscovered } : {},
14516
+ ...reportSourceSymlinkChecks ? { onPathCheckProgress: reportSourceSymlinkChecks } : {}
14394
14517
  };
14395
14518
  const safeSymlinkDirectories = await resolveSafeSymlinkDirectories(root, realRoot, symlinkProbeIgnoreGlobs, symlinkOptions);
14396
14519
  const linkedFiles = await listEntriesFromSafeSymlinkDirectories(root, realRoot, patterns, fastGlobIgnoreGlobs, {
@@ -14403,7 +14526,7 @@ async function listProjectFiles(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS
14403
14526
  filterIgnoreGlobs: userIgnoreGlobs,
14404
14527
  resolvedSafeSymlinkDirectories: safeSymlinkDirectories
14405
14528
  });
14406
- const rootSafeFiles = await filterRealPathsWithinRootEntries([...files, ...includedOverrideFiles, ...linkedFiles, ...linkedOverrideFiles], realRoot);
14529
+ const rootSafeFiles = await filterRealPathsWithinRootEntries([...files, ...includedOverrideFiles, ...linkedFiles, ...linkedOverrideFiles], realRoot, reportSourcePathChecks);
14407
14530
  const seen = /* @__PURE__ */ new Set();
14408
14531
  return rootSafeFiles.map(({ path: filePath, realPath }) => ({ filePath: normalizePath(filePath), realPath })).filter(({ filePath, realPath }) => {
14409
14532
  if (seen.has(filePath))
@@ -14471,10 +14594,20 @@ async function isSafeSymlinkDirectory(root, linkPath, realRoot) {
14471
14594
  return false;
14472
14595
  }
14473
14596
  }
14597
+ async function verifySafeSymlinkDirectories(root, realRoot, paths, onPathCheckProgress) {
14598
+ const reportPathCheck = createPathCheckProgressReporter(paths.length, onPathCheckProgress);
14599
+ const verified = await mapLimitSemaphore(Array.from(paths), REALPATH_FILTER_CONCURRENCY, async (linkPath) => {
14600
+ try {
14601
+ return await isSafeSymlinkDirectory(root, linkPath, realRoot) ? linkPath : null;
14602
+ } finally {
14603
+ reportPathCheck();
14604
+ }
14605
+ });
14606
+ return verified.filter((entry) => entry !== null);
14607
+ }
14474
14608
  async function resolveSafeSymlinkDirectories(root, realRoot, ignore, options) {
14475
14609
  if (options.knownSymlinkDirectories !== void 0) {
14476
- const verified = await mapLimitSemaphore(Array.from(new Set(options.knownSymlinkDirectories)), REALPATH_FILTER_CONCURRENCY, async (linkPath) => await isSafeSymlinkDirectory(root, linkPath, realRoot) ? linkPath : null);
14477
- const resolved = verified.filter((entry) => entry !== null);
14610
+ const resolved = await verifySafeSymlinkDirectories(root, realRoot, Array.from(new Set(options.knownSymlinkDirectories)), options.onPathCheckProgress);
14478
14611
  options.onSymlinkDirectoriesDiscovered?.(resolved, "known");
14479
14612
  return resolved;
14480
14613
  }
@@ -14486,8 +14619,7 @@ async function resolveSafeSymlinkDirectories(root, realRoot, ignore, options) {
14486
14619
  return false;
14487
14620
  return !ignoreMatchers.some((matcher) => matcher(relativePath3));
14488
14621
  });
14489
- const verified = await mapLimitSemaphore(candidatePaths, REALPATH_FILTER_CONCURRENCY, async (linkPath) => await isSafeSymlinkDirectory(root, linkPath, realRoot) ? linkPath : null);
14490
- const discovered2 = verified.filter((entry) => entry !== null);
14622
+ const discovered2 = await verifySafeSymlinkDirectories(root, realRoot, candidatePaths, options.onPathCheckProgress);
14491
14623
  options.onSymlinkDirectoriesDiscovered?.(discovered2, "git-candidates");
14492
14624
  return discovered2;
14493
14625
  }
@@ -14500,8 +14632,7 @@ async function resolveSafeSymlinkDirectories(root, realRoot, ignore, options) {
14500
14632
  objectMode: true,
14501
14633
  ignore
14502
14634
  });
14503
- const candidates = await mapLimitSemaphore(entries.filter((entry) => entry.dirent.isSymbolicLink()).map((entry) => entry.path), REALPATH_FILTER_CONCURRENCY, async (linkPath) => await isSafeSymlinkDirectory(root, linkPath, realRoot) ? linkPath : null);
14504
- const discovered = candidates.filter((entry) => entry !== null);
14635
+ const discovered = await verifySafeSymlinkDirectories(root, realRoot, entries.filter((entry) => entry.dirent.isSymbolicLink()).map((entry) => entry.path), options.onPathCheckProgress);
14505
14636
  options.onSymlinkDirectoriesDiscovered?.(discovered, "filesystem");
14506
14637
  return discovered;
14507
14638
  }
@@ -14533,19 +14664,22 @@ async function listEntriesFromSafeSymlinkDirectories(root, realRoot, patterns, i
14533
14664
  }
14534
14665
  return [...filesByPath.values()];
14535
14666
  }
14536
- async function filterRealPathsWithinRootEntries(paths, realRoot) {
14667
+ async function filterRealPathsWithinRootEntries(paths, realRoot, onPathCheckProgress) {
14668
+ const reportPathCheck = createPathCheckProgressReporter(paths.length, onPathCheckProgress);
14537
14669
  const filtered = await mapLimitSemaphore(paths, REALPATH_FILTER_CONCURRENCY, async (filePath) => {
14538
14670
  try {
14539
14671
  const realPath = await fsp5.realpath(filePath);
14540
14672
  return isFilePathWithinRoot(realRoot, realPath) ? { path: filePath, realPath } : null;
14541
14673
  } catch {
14542
14674
  return null;
14675
+ } finally {
14676
+ reportPathCheck();
14543
14677
  }
14544
14678
  });
14545
14679
  return filtered.filter((entry) => entry !== null);
14546
14680
  }
14547
- async function filterRealPathsWithinRoot(paths, realRoot) {
14548
- const entries = await filterRealPathsWithinRootEntries(paths, realRoot);
14681
+ async function filterRealPathsWithinRoot(paths, realRoot, onPathCheckProgress) {
14682
+ const entries = await filterRealPathsWithinRootEntries(paths, realRoot, onPathCheckProgress);
14549
14683
  return entries.map((entry) => entry.path);
14550
14684
  }
14551
14685
  function toProjectGlob(pattern) {
@@ -14580,27 +14714,94 @@ async function buildProjectFileInfo(def, filePath) {
14580
14714
  };
14581
14715
  }
14582
14716
  async function discoverProjectFiles(projectRoot, options) {
14717
+ return await discoverProjectFilesInternal(projectRoot, options);
14718
+ }
14719
+ async function discoverProjectFilesWithGitCandidates(projectRoot, options) {
14720
+ return await discoverProjectFilesInternal(projectRoot, options);
14721
+ }
14722
+ async function discoverProjectFilesInternal(projectRoot, options) {
14583
14723
  const root = await ensureDirectoryReadable(projectRoot, "Project root");
14584
14724
  try {
14585
14725
  const realRoot = await fsp5.realpath(root);
14586
- const allPatterns = PROJECT_FILE_DEFINITIONS.flatMap((def) => def.patterns.map(toProjectGlob));
14587
- const matches = await (0, import_fast_glob2.default)(allPatterns, {
14588
- cwd: root,
14589
- absolute: true,
14590
- dot: true,
14591
- followSymbolicLinks: false,
14592
- ignore: DEFAULT_PROJECT_FILE_IGNORES,
14593
- markDirectories: true,
14594
- onlyFiles: false
14595
- });
14596
- const linkedMatches = await listEntriesFromSafeSymlinkDirectories(root, realRoot, allPatterns, DEFAULT_PROJECT_FILE_IGNORES, {
14597
- markDirectories: true,
14598
- onlyFiles: false,
14599
- ...options?.knownSymlinkDirectories !== void 0 ? { knownSymlinkDirectories: options.knownSymlinkDirectories } : {},
14600
- ...options?.onSymlinkDirectoriesDiscovered ? { onSymlinkDirectoriesDiscovered: options.onSymlinkDirectoriesDiscovered } : {}
14601
- });
14602
- const rootSafeMatches = await filterRealPathsWithinRoot([...matches, ...linkedMatches].map((match) => match.endsWith("/") ? match.slice(0, -1) : match), realRoot);
14603
14726
  const projectFileDefinitionMatchers = PROJECT_FILE_DEFINITIONS.map((definition) => definition.patterns.map((pattern) => pattern.includes("*") || pattern.includes("?") ? new RegExp("^" + pattern.replace(/\./g, "\\.").replace(/\*/g, ".*") + "$") : void 0));
14727
+ const matchesDefinition = (fileName, definitionIndex) => {
14728
+ const definition = PROJECT_FILE_DEFINITIONS[definitionIndex];
14729
+ return definition.patterns.some((pattern, patternIndex) => {
14730
+ const matcher = projectFileDefinitionMatchers[definitionIndex][patternIndex];
14731
+ return matcher ? matcher.test(fileName) : pattern === fileName;
14732
+ });
14733
+ };
14734
+ let gitCandidates;
14735
+ if (options?.knownGitCandidates !== void 0) {
14736
+ gitCandidates = options.knownGitCandidates;
14737
+ } else {
14738
+ gitCandidates = await listGitCandidateFiles(root, options?.logLevel);
14739
+ }
14740
+ options?.onGitCandidatesDiscovered?.(gitCandidates);
14741
+ const reportMetadataSymlinkChecks = options?.onDiscoveryProgress ? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking project metadata symlinks", current, total }) : void 0;
14742
+ const reportMetadataFileChecks = options?.onDiscoveryProgress ? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking project metadata files", current, total }) : void 0;
14743
+ const reportMetadataDirectoryChecks = options?.onDiscoveryProgress ? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking project metadata directories", current, total }) : void 0;
14744
+ let rootSafeMatches;
14745
+ if (gitCandidates) {
14746
+ const gitignoreIndex = await buildGitignoreIndex(gitCandidates.gitignoreFiles, gitCandidates.gitignoreRoots, gitCandidates.gitignoreAliases);
14747
+ const defaultIgnoreMatchers = DEFAULT_PROJECT_FILE_IGNORES.map((globPattern) => (0, import_picomatch.default)(globPattern, { dot: true }));
14748
+ const filterGitIgnoredEntries = (entries2, directoryKeys = /* @__PURE__ */ new Set()) => entries2.map(({ path: filePath, realPath }) => ({ filePath: normalizePath(filePath), realPath })).filter(({ filePath, realPath }) => {
14749
+ const isDirectory2 = directoryKeys.has(fileIdentityKey(filePath));
14750
+ const rootRelative = normalizePath(path9.relative(root, filePath));
14751
+ if (!isRelativePathInside(rootRelative))
14752
+ return false;
14753
+ if (defaultIgnoreMatchers.some((matcher) => matcher(rootRelative)))
14754
+ return false;
14755
+ if (isIgnoredByGitignore(filePath, gitignoreIndex, isDirectory2))
14756
+ return false;
14757
+ return normalizePath(realPath) === filePath || !isIgnoredByGitignore(realPath, gitignoreIndex, isDirectory2);
14758
+ }).map(({ filePath }) => filePath);
14759
+ const symlinkOptions = {
14760
+ candidatePaths: gitCandidates.files,
14761
+ ...options?.knownSymlinkDirectories !== void 0 ? { knownSymlinkDirectories: options.knownSymlinkDirectories } : {},
14762
+ ...options?.onSymlinkDirectoriesDiscovered ? { onSymlinkDirectoriesDiscovered: options.onSymlinkDirectoriesDiscovered } : {},
14763
+ ...reportMetadataSymlinkChecks ? { onPathCheckProgress: reportMetadataSymlinkChecks } : {}
14764
+ };
14765
+ const safeSymlinkDirectories = await resolveSafeSymlinkDirectories(root, realRoot, DEFAULT_PROJECT_FILE_IGNORES, symlinkOptions);
14766
+ const allPatterns = PROJECT_FILE_DEFINITIONS.flatMap((definition) => definition.patterns.map(toProjectGlob));
14767
+ const linkedMatches = await listEntriesFromSafeSymlinkDirectories(root, realRoot, allPatterns, DEFAULT_PROJECT_FILE_IGNORES, {
14768
+ markDirectories: true,
14769
+ onlyFiles: false,
14770
+ resolvedSafeSymlinkDirectories: safeSymlinkDirectories
14771
+ });
14772
+ const rootSafeCandidateEntries = await filterRealPathsWithinRootEntries(gitCandidates.files, realRoot, reportMetadataFileChecks);
14773
+ const filteredFiles = filterGitIgnoredEntries(rootSafeCandidateEntries);
14774
+ const fileMatches = filteredFiles.filter((file2) => PROJECT_FILE_DEFINITIONS.some((definition, definitionIndex) => definition.kind === "file" && matchesDefinition(path9.basename(file2), definitionIndex)));
14775
+ const rawCandidateDirectories = collectCandidateAncestorDirectories(root, rootSafeCandidateEntries.map(({ path: filePath }) => filePath));
14776
+ const candidateDirectoryKeys = new Set(rawCandidateDirectories.map(fileIdentityKey));
14777
+ const safeSymlinkDirectoryKeys = new Set(safeSymlinkDirectories.map(fileIdentityKey));
14778
+ const directoryMatches = [
14779
+ ...filterGitIgnoredEntries(await filterRealPathsWithinRootEntries(rawCandidateDirectories, realRoot, reportMetadataDirectoryChecks), candidateDirectoryKeys),
14780
+ ...filterGitIgnoredEntries(await filterRealPathsWithinRootEntries(safeSymlinkDirectories, realRoot, reportMetadataDirectoryChecks), safeSymlinkDirectoryKeys)
14781
+ ].filter((directory) => PROJECT_FILE_DEFINITIONS.some((definition, definitionIndex) => definition.kind === "dir" && matchesDefinition(path9.basename(directory), definitionIndex)));
14782
+ const linkedDirectoryKeys = new Set(linkedMatches.filter((match) => match.endsWith("/")).map((match) => fileIdentityKey(match.slice(0, -1))));
14783
+ const rootSafeLinked = filterGitIgnoredEntries(await filterRealPathsWithinRootEntries(linkedMatches.map((match) => match.endsWith("/") ? match.slice(0, -1) : match), realRoot, reportMetadataFileChecks), linkedDirectoryKeys);
14784
+ rootSafeMatches = [...fileMatches, ...directoryMatches, ...rootSafeLinked];
14785
+ } else {
14786
+ const allPatterns = PROJECT_FILE_DEFINITIONS.flatMap((definition) => definition.patterns.map(toProjectGlob));
14787
+ const matches = await (0, import_fast_glob2.default)(allPatterns, {
14788
+ cwd: root,
14789
+ absolute: true,
14790
+ dot: true,
14791
+ followSymbolicLinks: false,
14792
+ ignore: DEFAULT_PROJECT_FILE_IGNORES,
14793
+ markDirectories: true,
14794
+ onlyFiles: false
14795
+ });
14796
+ const linkedMatches = await listEntriesFromSafeSymlinkDirectories(root, realRoot, allPatterns, DEFAULT_PROJECT_FILE_IGNORES, {
14797
+ markDirectories: true,
14798
+ onlyFiles: false,
14799
+ ...options?.knownSymlinkDirectories !== void 0 ? { knownSymlinkDirectories: options.knownSymlinkDirectories } : {},
14800
+ ...options?.onSymlinkDirectoriesDiscovered ? { onSymlinkDirectoriesDiscovered: options.onSymlinkDirectoriesDiscovered } : {},
14801
+ ...reportMetadataSymlinkChecks ? { onPathCheckProgress: reportMetadataSymlinkChecks } : {}
14802
+ });
14803
+ rootSafeMatches = await filterRealPathsWithinRoot([...matches, ...linkedMatches].map((match) => match.endsWith("/") ? match.slice(0, -1) : match), realRoot, reportMetadataFileChecks);
14804
+ }
14604
14805
  const entries = [];
14605
14806
  const matchTasks = rootSafeMatches.map(async (cleanMatch) => {
14606
14807
  const stats = await fsp5.stat(cleanMatch);
@@ -14612,10 +14813,7 @@ async function discoverProjectFiles(projectRoot, options) {
14612
14813
  continue;
14613
14814
  if (!isDir && def.kind !== "file")
14614
14815
  continue;
14615
- const matchesPattern = def.patterns.some((pattern, patternIndex) => {
14616
- const matcher = projectFileDefinitionMatchers[definitionIndex][patternIndex];
14617
- return matcher ? matcher.test(fileName) : pattern === fileName;
14618
- });
14816
+ const matchesPattern = matchesDefinition(fileName, definitionIndex);
14619
14817
  if (matchesPattern) {
14620
14818
  entries.push(await buildProjectFileInfo(def, cleanMatch));
14621
14819
  }
@@ -14742,7 +14940,12 @@ var init_projectFiles = __esm({
14742
14940
  ...DEFAULT_PROJECT_MANIFESTS.map((name) => `**/${name}`)
14743
14941
  ];
14744
14942
  REALPATH_FILTER_CONCURRENCY = 64;
14745
- EMPTY_GITIGNORE_INDEX = { hasRules: false, byBaseDir: /* @__PURE__ */ new Map() };
14943
+ EMPTY_GITIGNORE_INDEX = {
14944
+ hasRules: false,
14945
+ repositoryRoots: [],
14946
+ repositoryAliases: [],
14947
+ byBaseDir: /* @__PURE__ */ new Map()
14948
+ };
14746
14949
  }
14747
14950
  });
14748
14951
 
@@ -25606,12 +25809,210 @@ var init_adjacency = __esm({
25606
25809
  }
25607
25810
  });
25608
25811
 
25812
+ // dist/util/bloomFilter.js
25813
+ var bloomFilter_exports = {};
25814
+ __export(bloomFilter_exports, {
25815
+ BloomFilter: () => BloomFilter,
25816
+ BloomFilterCache: () => BloomFilterCache,
25817
+ buildBloomFilterFromSource: () => buildBloomFilterFromSource,
25818
+ calculateOptimalBloomParams: () => calculateOptimalBloomParams
25819
+ });
25820
+ import crypto3 from "node:crypto";
25821
+ function calculateOptimalBloomParams(expectedItems, falsePositiveRate = 0.01) {
25822
+ const n = Math.max(1, expectedItems);
25823
+ const p = Math.max(1e-4, Math.min(0.5, falsePositiveRate));
25824
+ const ln2 = Math.LN2;
25825
+ const ln2Squared = ln2 * ln2;
25826
+ const optimalSize = Math.ceil(-n * Math.log(p) / ln2Squared);
25827
+ const optimalHashCount = Math.max(1, Math.round(optimalSize / n * ln2));
25828
+ const size = Math.max(1e3, Math.min(1e6, optimalSize));
25829
+ const hashCount = Math.max(1, Math.min(10, optimalHashCount));
25830
+ return { size, hashCount };
25831
+ }
25832
+ function buildBloomFilterFromSource(source, support, falsePositiveRate = 0.01) {
25833
+ const identifierPattern = new RegExp(BLOOM_FILTER_IDENTIFIER_SOURCE, "gu");
25834
+ const matches = source.match(identifierPattern);
25835
+ const unique = /* @__PURE__ */ new Set();
25836
+ for (const identifier of matches ?? []) {
25837
+ unique.add(support.normalizeIdentifier(identifier));
25838
+ }
25839
+ const filter = BloomFilter.createOptimal(unique.size || 100, falsePositiveRate);
25840
+ for (const identifier of unique) {
25841
+ filter.add(identifier);
25842
+ }
25843
+ return filter;
25844
+ }
25845
+ var BloomFilter, BloomFilterCache;
25846
+ var init_bloomFilter = __esm({
25847
+ "dist/util/bloomFilter.js"() {
25848
+ "use strict";
25849
+ init_identifiers();
25850
+ init_paths();
25851
+ BloomFilter = class _BloomFilter {
25852
+ bits;
25853
+ size;
25854
+ hashCount;
25855
+ itemCount = 0;
25856
+ /**
25857
+ * Create a bloom filter
25858
+ * @param size - Number of bits in the filter (default: 10000)
25859
+ * @param hashCount - Number of hash functions to use (default: 3)
25860
+ */
25861
+ constructor(size = 1e4, hashCount = 3) {
25862
+ this.size = size;
25863
+ this.hashCount = hashCount;
25864
+ this.bits = new Uint8Array(Math.ceil(size / 8));
25865
+ }
25866
+ /**
25867
+ * Create an optimally-sized bloom filter for the expected number of items.
25868
+ * @param expectedItems - Expected number of items to be added
25869
+ * @param falsePositiveRate - Target false positive rate (default: 0.01 = 1%)
25870
+ */
25871
+ static createOptimal(expectedItems, falsePositiveRate = 0.01) {
25872
+ const { size, hashCount } = calculateOptimalBloomParams(expectedItems, falsePositiveRate);
25873
+ return new _BloomFilter(size, hashCount);
25874
+ }
25875
+ /**
25876
+ * Add an item to the bloom filter
25877
+ */
25878
+ add(item) {
25879
+ for (const hash2 of this.getHashes(item)) {
25880
+ const byteIndex = Math.floor(hash2 / 8);
25881
+ const bitIndex = hash2 % 8;
25882
+ if (byteIndex < 0 || byteIndex >= this.bits.length)
25883
+ return;
25884
+ const currentByte = this.bits[byteIndex];
25885
+ if (currentByte !== void 0) {
25886
+ this.bits[byteIndex] = currentByte | 1 << bitIndex;
25887
+ }
25888
+ }
25889
+ this.itemCount++;
25890
+ }
25891
+ /**
25892
+ * Get the number of items added to the filter
25893
+ */
25894
+ getItemCount() {
25895
+ return this.itemCount;
25896
+ }
25897
+ /**
25898
+ * Get the current estimated false positive rate based on items added
25899
+ */
25900
+ getCurrentFalsePositiveRate() {
25901
+ return this.getFalsePositiveRate(this.itemCount);
25902
+ }
25903
+ /**
25904
+ * Check if an item might be in the set
25905
+ * Returns false if definitely not present, true if might be present
25906
+ */
25907
+ mightContain(item) {
25908
+ for (const hash2 of this.getHashes(item)) {
25909
+ const byteIndex = Math.floor(hash2 / 8);
25910
+ const bitIndex = hash2 % 8;
25911
+ if (byteIndex < 0 || byteIndex >= this.bits.length)
25912
+ return false;
25913
+ const currentByte = this.bits[byteIndex];
25914
+ if (currentByte === void 0 || (currentByte & 1 << bitIndex) === 0) {
25915
+ return false;
25916
+ }
25917
+ }
25918
+ return true;
25919
+ }
25920
+ /**
25921
+ * Generate multiple hash values for an item
25922
+ */
25923
+ *getHashes(item) {
25924
+ const hash2 = crypto3.createHash("sha256").update(item).digest();
25925
+ for (let i = 0; i < this.hashCount; i++) {
25926
+ const offset = i * 4 % (hash2.length - 4);
25927
+ const value = hash2.readUInt32LE(offset);
25928
+ yield value % this.size;
25929
+ }
25930
+ }
25931
+ /**
25932
+ * Get the approximate false positive rate
25933
+ */
25934
+ getFalsePositiveRate(itemCount) {
25935
+ const exp = Math.exp(-this.hashCount * itemCount / this.size);
25936
+ return Math.pow(1 - exp, this.hashCount);
25937
+ }
25938
+ /**
25939
+ * Serialize to buffer for caching
25940
+ */
25941
+ toBuffer() {
25942
+ return Buffer.from(this.bits);
25943
+ }
25944
+ /**
25945
+ * Deserialize from buffer
25946
+ */
25947
+ static fromBuffer(buffer, size, hashCount, itemCount = 0) {
25948
+ const filter = new _BloomFilter(size, hashCount);
25949
+ filter.bits = new Uint8Array(buffer);
25950
+ filter.itemCount = itemCount;
25951
+ return filter;
25952
+ }
25953
+ /**
25954
+ * Get metadata for serialization
25955
+ */
25956
+ getMetadata() {
25957
+ return { size: this.size, hashCount: this.hashCount };
25958
+ }
25959
+ };
25960
+ BloomFilterCache = class {
25961
+ filters = /* @__PURE__ */ new Map();
25962
+ set(file2, filter) {
25963
+ this.filters.set(fileIdentityKey(file2), filter);
25964
+ }
25965
+ get(file2) {
25966
+ return this.filters.get(fileIdentityKey(file2));
25967
+ }
25968
+ has(file2) {
25969
+ return this.filters.has(fileIdentityKey(file2));
25970
+ }
25971
+ /**
25972
+ * Check if a symbol might be in any of the provided files
25973
+ * Returns only files that might contain the symbol
25974
+ */
25975
+ filterFiles(symbol2, files) {
25976
+ const candidates = [];
25977
+ for (const file2 of files) {
25978
+ const filter = this.filters.get(fileIdentityKey(file2));
25979
+ if (!filter) {
25980
+ candidates.push(file2);
25981
+ } else if (filter.mightContain(symbol2)) {
25982
+ candidates.push(file2);
25983
+ }
25984
+ }
25985
+ return candidates;
25986
+ }
25987
+ clear() {
25988
+ this.filters.clear();
25989
+ }
25990
+ size() {
25991
+ return this.filters.size;
25992
+ }
25993
+ };
25994
+ }
25995
+ });
25996
+
25609
25997
  // dist/worker/nativeExtractWorker.js
25610
25998
  import fsp17 from "node:fs/promises";
25611
25999
  import { createRequire as createRequire3 } from "node:module";
25612
26000
  import path32 from "node:path";
25613
26001
  import { fileURLToPath as fileURLToPath3 } from "node:url";
25614
26002
  import { isMainThread, workerData } from "node:worker_threads";
26003
+ function buildBloomFilterPayload(source, languageId) {
26004
+ const support = supportById(languageId);
26005
+ if (!support)
26006
+ return void 0;
26007
+ const filter = buildBloomFilterFromSource(source, support);
26008
+ const { size, hashCount } = filter.getMetadata();
26009
+ return {
26010
+ bits: filter.toBuffer(),
26011
+ size,
26012
+ hashCount,
26013
+ itemCount: filter.getItemCount()
26014
+ };
26015
+ }
25615
26016
  function readWorkerBindingHandoff(source = isMainThread ? void 0 : workerData) {
25616
26017
  if (!source || typeof source !== "object")
25617
26018
  return null;
@@ -25647,7 +26048,7 @@ function resolveSourceMaxBytes(task) {
25647
26048
  }
25648
26049
  return DEFAULT_NATIVE_SOURCE_MAX_BYTES;
25649
26050
  }
25650
- function resourceLimitFallback(task, source, error51) {
26051
+ function resourceLimitFallback(task, source, error51, bloomFilter) {
25651
26052
  const includeSource = task.includeSourceInResult ?? true;
25652
26053
  return {
25653
26054
  filePath: task.filePath,
@@ -25656,6 +26057,7 @@ function resourceLimitFallback(task, source, error51) {
25656
26057
  nativeResults: null,
25657
26058
  compactResults: null,
25658
26059
  syntaxTree: null,
26060
+ ...bloomFilter ? { bloomFilter } : {},
25659
26061
  fallbackReason: "queryFailure",
25660
26062
  error: error51
25661
26063
  };
@@ -25721,6 +26123,7 @@ function createNativeExtractor(deps) {
25721
26123
  }
25722
26124
  const includeSource = task.includeSourceInResult ?? true;
25723
26125
  const source = loaded.source;
26126
+ const bloomFilter = task.includeBloomFilter ? buildBloomFilterPayload(source, task.languageId) : void 0;
25724
26127
  if (!binding || !supportedIds) {
25725
26128
  return {
25726
26129
  filePath: task.filePath,
@@ -25729,6 +26132,7 @@ function createNativeExtractor(deps) {
25729
26132
  nativeResults: null,
25730
26133
  compactResults: null,
25731
26134
  syntaxTree: null,
26135
+ ...bloomFilter ? { bloomFilter } : {},
25732
26136
  fallbackReason: "unavailable",
25733
26137
  ...loadError ? { error: loadError } : {}
25734
26138
  };
@@ -25741,6 +26145,7 @@ function createNativeExtractor(deps) {
25741
26145
  nativeResults: null,
25742
26146
  compactResults: null,
25743
26147
  syntaxTree: null,
26148
+ ...bloomFilter ? { bloomFilter } : {},
25744
26149
  fallbackReason: "unsupportedLanguage"
25745
26150
  };
25746
26151
  }
@@ -25753,7 +26158,8 @@ function createNativeExtractor(deps) {
25753
26158
  ...includeSource ? { source } : {},
25754
26159
  nativeResults: null,
25755
26160
  compactResults,
25756
- syntaxTree: null
26161
+ syntaxTree: null,
26162
+ ...bloomFilter ? { bloomFilter } : {}
25757
26163
  };
25758
26164
  }
25759
26165
  const extraction = binding.extractLanguage(source, task.languageId, task.importsQuery, task.exportsQuery, task.localsQuery, task.importBindingsQuery);
@@ -25767,6 +26173,7 @@ function createNativeExtractor(deps) {
25767
26173
  nativeResults: extraction.results,
25768
26174
  compactResults: null,
25769
26175
  syntaxTree: null,
26176
+ ...bloomFilter ? { bloomFilter } : {},
25770
26177
  fallbackReason: "unavailable",
25771
26178
  error: loadError
25772
26179
  };
@@ -25777,12 +26184,13 @@ function createNativeExtractor(deps) {
25777
26184
  ...includeSource ? { source } : {},
25778
26185
  nativeResults: extraction.results,
25779
26186
  compactResults: null,
25780
- syntaxTree
26187
+ syntaxTree,
26188
+ ...bloomFilter ? { bloomFilter } : {}
25781
26189
  };
25782
26190
  } catch (err) {
25783
26191
  const message = err instanceof Error ? err.message : String(err);
25784
26192
  if (/max (node|depth) limit/i.test(message)) {
25785
- return resourceLimitFallback(task, source, message);
26193
+ return resourceLimitFallback(task, source, message, bloomFilter);
25786
26194
  }
25787
26195
  return {
25788
26196
  filePath: task.filePath,
@@ -25791,6 +26199,7 @@ function createNativeExtractor(deps) {
25791
26199
  nativeResults: null,
25792
26200
  compactResults: null,
25793
26201
  syntaxTree: null,
26202
+ ...bloomFilter ? { bloomFilter } : {},
25794
26203
  fallbackReason: "queryFailure",
25795
26204
  error: message
25796
26205
  };
@@ -25803,6 +26212,8 @@ var init_nativeExtractWorker = __esm({
25803
26212
  "use strict";
25804
26213
  init_bindingLoader();
25805
26214
  init_treeShape();
26215
+ init_languages();
26216
+ init_bloomFilter();
25806
26217
  init_treeShape();
25807
26218
  NATIVE_WORKER_BATCH_SIZE = 32;
25808
26219
  DEFAULT_NATIVE_SOURCE_MAX_BYTES = 8 * 1024 * 1024;
@@ -28504,190 +28915,6 @@ var init_locals_and_exports = __esm({
28504
28915
  }
28505
28916
  });
28506
28917
 
28507
- // dist/util/bloomFilter.js
28508
- var bloomFilter_exports = {};
28509
- __export(bloomFilter_exports, {
28510
- BloomFilter: () => BloomFilter,
28511
- BloomFilterCache: () => BloomFilterCache,
28512
- buildBloomFilterFromSource: () => buildBloomFilterFromSource,
28513
- calculateOptimalBloomParams: () => calculateOptimalBloomParams
28514
- });
28515
- import crypto3 from "node:crypto";
28516
- function calculateOptimalBloomParams(expectedItems, falsePositiveRate = 0.01) {
28517
- const n = Math.max(1, expectedItems);
28518
- const p = Math.max(1e-4, Math.min(0.5, falsePositiveRate));
28519
- const ln2 = Math.LN2;
28520
- const ln2Squared = ln2 * ln2;
28521
- const optimalSize = Math.ceil(-n * Math.log(p) / ln2Squared);
28522
- const optimalHashCount = Math.max(1, Math.round(optimalSize / n * ln2));
28523
- const size = Math.max(1e3, Math.min(1e6, optimalSize));
28524
- const hashCount = Math.max(1, Math.min(10, optimalHashCount));
28525
- return { size, hashCount };
28526
- }
28527
- function buildBloomFilterFromSource(source, support, falsePositiveRate = 0.01) {
28528
- const identifierPattern = new RegExp(BLOOM_FILTER_IDENTIFIER_SOURCE, "gu");
28529
- const matches = source.match(identifierPattern);
28530
- const unique = /* @__PURE__ */ new Set();
28531
- for (const identifier of matches ?? []) {
28532
- unique.add(support.normalizeIdentifier(identifier));
28533
- }
28534
- const filter = BloomFilter.createOptimal(unique.size || 100, falsePositiveRate);
28535
- for (const identifier of unique) {
28536
- filter.add(identifier);
28537
- }
28538
- return filter;
28539
- }
28540
- var BloomFilter, BloomFilterCache;
28541
- var init_bloomFilter = __esm({
28542
- "dist/util/bloomFilter.js"() {
28543
- "use strict";
28544
- init_identifiers();
28545
- init_paths();
28546
- BloomFilter = class _BloomFilter {
28547
- bits;
28548
- size;
28549
- hashCount;
28550
- itemCount = 0;
28551
- /**
28552
- * Create a bloom filter
28553
- * @param size - Number of bits in the filter (default: 10000)
28554
- * @param hashCount - Number of hash functions to use (default: 3)
28555
- */
28556
- constructor(size = 1e4, hashCount = 3) {
28557
- this.size = size;
28558
- this.hashCount = hashCount;
28559
- this.bits = new Uint8Array(Math.ceil(size / 8));
28560
- }
28561
- /**
28562
- * Create an optimally-sized bloom filter for the expected number of items.
28563
- * @param expectedItems - Expected number of items to be added
28564
- * @param falsePositiveRate - Target false positive rate (default: 0.01 = 1%)
28565
- */
28566
- static createOptimal(expectedItems, falsePositiveRate = 0.01) {
28567
- const { size, hashCount } = calculateOptimalBloomParams(expectedItems, falsePositiveRate);
28568
- return new _BloomFilter(size, hashCount);
28569
- }
28570
- /**
28571
- * Add an item to the bloom filter
28572
- */
28573
- add(item) {
28574
- for (const hash2 of this.getHashes(item)) {
28575
- const byteIndex = Math.floor(hash2 / 8);
28576
- const bitIndex = hash2 % 8;
28577
- if (byteIndex < 0 || byteIndex >= this.bits.length)
28578
- return;
28579
- const currentByte = this.bits[byteIndex];
28580
- if (currentByte !== void 0) {
28581
- this.bits[byteIndex] = currentByte | 1 << bitIndex;
28582
- }
28583
- }
28584
- this.itemCount++;
28585
- }
28586
- /**
28587
- * Get the number of items added to the filter
28588
- */
28589
- getItemCount() {
28590
- return this.itemCount;
28591
- }
28592
- /**
28593
- * Get the current estimated false positive rate based on items added
28594
- */
28595
- getCurrentFalsePositiveRate() {
28596
- return this.getFalsePositiveRate(this.itemCount);
28597
- }
28598
- /**
28599
- * Check if an item might be in the set
28600
- * Returns false if definitely not present, true if might be present
28601
- */
28602
- mightContain(item) {
28603
- for (const hash2 of this.getHashes(item)) {
28604
- const byteIndex = Math.floor(hash2 / 8);
28605
- const bitIndex = hash2 % 8;
28606
- if (byteIndex < 0 || byteIndex >= this.bits.length)
28607
- return false;
28608
- const currentByte = this.bits[byteIndex];
28609
- if (currentByte === void 0 || (currentByte & 1 << bitIndex) === 0) {
28610
- return false;
28611
- }
28612
- }
28613
- return true;
28614
- }
28615
- /**
28616
- * Generate multiple hash values for an item
28617
- */
28618
- *getHashes(item) {
28619
- const hash2 = crypto3.createHash("sha256").update(item).digest();
28620
- for (let i = 0; i < this.hashCount; i++) {
28621
- const offset = i * 4 % (hash2.length - 4);
28622
- const value = hash2.readUInt32LE(offset);
28623
- yield value % this.size;
28624
- }
28625
- }
28626
- /**
28627
- * Get the approximate false positive rate
28628
- */
28629
- getFalsePositiveRate(itemCount) {
28630
- const exp = Math.exp(-this.hashCount * itemCount / this.size);
28631
- return Math.pow(1 - exp, this.hashCount);
28632
- }
28633
- /**
28634
- * Serialize to buffer for caching
28635
- */
28636
- toBuffer() {
28637
- return Buffer.from(this.bits);
28638
- }
28639
- /**
28640
- * Deserialize from buffer
28641
- */
28642
- static fromBuffer(buffer, size, hashCount) {
28643
- const filter = new _BloomFilter(size, hashCount);
28644
- filter.bits = new Uint8Array(buffer);
28645
- return filter;
28646
- }
28647
- /**
28648
- * Get metadata for serialization
28649
- */
28650
- getMetadata() {
28651
- return { size: this.size, hashCount: this.hashCount };
28652
- }
28653
- };
28654
- BloomFilterCache = class {
28655
- filters = /* @__PURE__ */ new Map();
28656
- set(file2, filter) {
28657
- this.filters.set(fileIdentityKey(file2), filter);
28658
- }
28659
- get(file2) {
28660
- return this.filters.get(fileIdentityKey(file2));
28661
- }
28662
- has(file2) {
28663
- return this.filters.has(fileIdentityKey(file2));
28664
- }
28665
- /**
28666
- * Check if a symbol might be in any of the provided files
28667
- * Returns only files that might contain the symbol
28668
- */
28669
- filterFiles(symbol2, files) {
28670
- const candidates = [];
28671
- for (const file2 of files) {
28672
- const filter = this.filters.get(fileIdentityKey(file2));
28673
- if (!filter) {
28674
- candidates.push(file2);
28675
- } else if (filter.mightContain(symbol2)) {
28676
- candidates.push(file2);
28677
- }
28678
- }
28679
- return candidates;
28680
- }
28681
- clear() {
28682
- this.filters.clear();
28683
- }
28684
- size() {
28685
- return this.filters.size;
28686
- }
28687
- };
28688
- }
28689
- });
28690
-
28691
28918
  // dist/languages/queryGenerator.js
28692
28919
  function generateChunkingQuery(def) {
28693
28920
  const parts = [];
@@ -29686,7 +29913,1509 @@ var init_duplicate_keywords = __esm({
29686
29913
  }
29687
29914
  });
29688
29915
 
29916
+ // dist/duplicate-identifier-ranges.js
29917
+ var DUPLICATE_IDENTIFIER_START_RANGES, DUPLICATE_IDENTIFIER_CONTINUE_RANGES;
29918
+ var init_duplicate_identifier_ranges = __esm({
29919
+ "dist/duplicate-identifier-ranges.js"() {
29920
+ "use strict";
29921
+ DUPLICATE_IDENTIFIER_START_RANGES = [
29922
+ [36, 36],
29923
+ [65, 90],
29924
+ [95, 95],
29925
+ [97, 122],
29926
+ [170, 170],
29927
+ [181, 181],
29928
+ [186, 186],
29929
+ [192, 214],
29930
+ [216, 246],
29931
+ [248, 705],
29932
+ [710, 721],
29933
+ [736, 740],
29934
+ [748, 748],
29935
+ [750, 750],
29936
+ [880, 884],
29937
+ [886, 887],
29938
+ [891, 893],
29939
+ [895, 895],
29940
+ [902, 902],
29941
+ [904, 906],
29942
+ [908, 908],
29943
+ [910, 929],
29944
+ [931, 1013],
29945
+ [1015, 1153],
29946
+ [1162, 1327],
29947
+ [1329, 1366],
29948
+ [1369, 1369],
29949
+ [1376, 1416],
29950
+ [1488, 1514],
29951
+ [1519, 1522],
29952
+ [1568, 1610],
29953
+ [1646, 1647],
29954
+ [1649, 1747],
29955
+ [1749, 1749],
29956
+ [1765, 1766],
29957
+ [1774, 1775],
29958
+ [1786, 1788],
29959
+ [1791, 1791],
29960
+ [1808, 1808],
29961
+ [1810, 1839],
29962
+ [1869, 1957],
29963
+ [1969, 1969],
29964
+ [1994, 2026],
29965
+ [2036, 2037],
29966
+ [2042, 2042],
29967
+ [2048, 2069],
29968
+ [2074, 2074],
29969
+ [2084, 2084],
29970
+ [2088, 2088],
29971
+ [2112, 2136],
29972
+ [2144, 2154],
29973
+ [2160, 2183],
29974
+ [2185, 2190],
29975
+ [2208, 2249],
29976
+ [2308, 2361],
29977
+ [2365, 2365],
29978
+ [2384, 2384],
29979
+ [2392, 2401],
29980
+ [2417, 2432],
29981
+ [2437, 2444],
29982
+ [2447, 2448],
29983
+ [2451, 2472],
29984
+ [2474, 2480],
29985
+ [2482, 2482],
29986
+ [2486, 2489],
29987
+ [2493, 2493],
29988
+ [2510, 2510],
29989
+ [2524, 2525],
29990
+ [2527, 2529],
29991
+ [2544, 2545],
29992
+ [2556, 2556],
29993
+ [2565, 2570],
29994
+ [2575, 2576],
29995
+ [2579, 2600],
29996
+ [2602, 2608],
29997
+ [2610, 2611],
29998
+ [2613, 2614],
29999
+ [2616, 2617],
30000
+ [2649, 2652],
30001
+ [2654, 2654],
30002
+ [2674, 2676],
30003
+ [2693, 2701],
30004
+ [2703, 2705],
30005
+ [2707, 2728],
30006
+ [2730, 2736],
30007
+ [2738, 2739],
30008
+ [2741, 2745],
30009
+ [2749, 2749],
30010
+ [2768, 2768],
30011
+ [2784, 2785],
30012
+ [2809, 2809],
30013
+ [2821, 2828],
30014
+ [2831, 2832],
30015
+ [2835, 2856],
30016
+ [2858, 2864],
30017
+ [2866, 2867],
30018
+ [2869, 2873],
30019
+ [2877, 2877],
30020
+ [2908, 2909],
30021
+ [2911, 2913],
30022
+ [2929, 2929],
30023
+ [2947, 2947],
30024
+ [2949, 2954],
30025
+ [2958, 2960],
30026
+ [2962, 2965],
30027
+ [2969, 2970],
30028
+ [2972, 2972],
30029
+ [2974, 2975],
30030
+ [2979, 2980],
30031
+ [2984, 2986],
30032
+ [2990, 3001],
30033
+ [3024, 3024],
30034
+ [3077, 3084],
30035
+ [3086, 3088],
30036
+ [3090, 3112],
30037
+ [3114, 3129],
30038
+ [3133, 3133],
30039
+ [3160, 3162],
30040
+ [3165, 3165],
30041
+ [3168, 3169],
30042
+ [3200, 3200],
30043
+ [3205, 3212],
30044
+ [3214, 3216],
30045
+ [3218, 3240],
30046
+ [3242, 3251],
30047
+ [3253, 3257],
30048
+ [3261, 3261],
30049
+ [3293, 3294],
30050
+ [3296, 3297],
30051
+ [3313, 3314],
30052
+ [3332, 3340],
30053
+ [3342, 3344],
30054
+ [3346, 3386],
30055
+ [3389, 3389],
30056
+ [3406, 3406],
30057
+ [3412, 3414],
30058
+ [3423, 3425],
30059
+ [3450, 3455],
30060
+ [3461, 3478],
30061
+ [3482, 3505],
30062
+ [3507, 3515],
30063
+ [3517, 3517],
30064
+ [3520, 3526],
30065
+ [3585, 3632],
30066
+ [3634, 3634],
30067
+ [3648, 3654],
30068
+ [3713, 3714],
30069
+ [3716, 3716],
30070
+ [3718, 3722],
30071
+ [3724, 3747],
30072
+ [3749, 3749],
30073
+ [3751, 3760],
30074
+ [3762, 3762],
30075
+ [3773, 3773],
30076
+ [3776, 3780],
30077
+ [3782, 3782],
30078
+ [3804, 3807],
30079
+ [3840, 3840],
30080
+ [3904, 3911],
30081
+ [3913, 3948],
30082
+ [3976, 3980],
30083
+ [4096, 4138],
30084
+ [4159, 4159],
30085
+ [4176, 4181],
30086
+ [4186, 4189],
30087
+ [4193, 4193],
30088
+ [4197, 4198],
30089
+ [4206, 4208],
30090
+ [4213, 4225],
30091
+ [4238, 4238],
30092
+ [4256, 4293],
30093
+ [4295, 4295],
30094
+ [4301, 4301],
30095
+ [4304, 4346],
30096
+ [4348, 4680],
30097
+ [4682, 4685],
30098
+ [4688, 4694],
30099
+ [4696, 4696],
30100
+ [4698, 4701],
30101
+ [4704, 4744],
30102
+ [4746, 4749],
30103
+ [4752, 4784],
30104
+ [4786, 4789],
30105
+ [4792, 4798],
30106
+ [4800, 4800],
30107
+ [4802, 4805],
30108
+ [4808, 4822],
30109
+ [4824, 4880],
30110
+ [4882, 4885],
30111
+ [4888, 4954],
30112
+ [4992, 5007],
30113
+ [5024, 5109],
30114
+ [5112, 5117],
30115
+ [5121, 5740],
30116
+ [5743, 5759],
30117
+ [5761, 5786],
30118
+ [5792, 5866],
30119
+ [5870, 5880],
30120
+ [5888, 5905],
30121
+ [5919, 5937],
30122
+ [5952, 5969],
30123
+ [5984, 5996],
30124
+ [5998, 6e3],
30125
+ [6016, 6067],
30126
+ [6103, 6103],
30127
+ [6108, 6108],
30128
+ [6176, 6264],
30129
+ [6272, 6312],
30130
+ [6314, 6314],
30131
+ [6320, 6389],
30132
+ [6400, 6430],
30133
+ [6480, 6509],
30134
+ [6512, 6516],
30135
+ [6528, 6571],
30136
+ [6576, 6601],
30137
+ [6656, 6678],
30138
+ [6688, 6740],
30139
+ [6823, 6823],
30140
+ [6917, 6963],
30141
+ [6981, 6988],
30142
+ [7043, 7072],
30143
+ [7086, 7087],
30144
+ [7098, 7141],
30145
+ [7168, 7203],
30146
+ [7245, 7247],
30147
+ [7258, 7293],
30148
+ [7296, 7306],
30149
+ [7312, 7354],
30150
+ [7357, 7359],
30151
+ [7401, 7404],
30152
+ [7406, 7411],
30153
+ [7413, 7414],
30154
+ [7418, 7418],
30155
+ [7424, 7615],
30156
+ [7680, 7957],
30157
+ [7960, 7965],
30158
+ [7968, 8005],
30159
+ [8008, 8013],
30160
+ [8016, 8023],
30161
+ [8025, 8025],
30162
+ [8027, 8027],
30163
+ [8029, 8029],
30164
+ [8031, 8061],
30165
+ [8064, 8116],
30166
+ [8118, 8124],
30167
+ [8126, 8126],
30168
+ [8130, 8132],
30169
+ [8134, 8140],
30170
+ [8144, 8147],
30171
+ [8150, 8155],
30172
+ [8160, 8172],
30173
+ [8178, 8180],
30174
+ [8182, 8188],
30175
+ [8305, 8305],
30176
+ [8319, 8319],
30177
+ [8336, 8348],
30178
+ [8450, 8450],
30179
+ [8455, 8455],
30180
+ [8458, 8467],
30181
+ [8469, 8469],
30182
+ [8472, 8477],
30183
+ [8484, 8484],
30184
+ [8486, 8486],
30185
+ [8488, 8488],
30186
+ [8490, 8505],
30187
+ [8508, 8511],
30188
+ [8517, 8521],
30189
+ [8526, 8526],
30190
+ [8544, 8584],
30191
+ [11264, 11492],
30192
+ [11499, 11502],
30193
+ [11506, 11507],
30194
+ [11520, 11557],
30195
+ [11559, 11559],
30196
+ [11565, 11565],
30197
+ [11568, 11623],
30198
+ [11631, 11631],
30199
+ [11648, 11670],
30200
+ [11680, 11686],
30201
+ [11688, 11694],
30202
+ [11696, 11702],
30203
+ [11704, 11710],
30204
+ [11712, 11718],
30205
+ [11720, 11726],
30206
+ [11728, 11734],
30207
+ [11736, 11742],
30208
+ [12293, 12295],
30209
+ [12321, 12329],
30210
+ [12337, 12341],
30211
+ [12344, 12348],
30212
+ [12353, 12438],
30213
+ [12443, 12447],
30214
+ [12449, 12538],
30215
+ [12540, 12543],
30216
+ [12549, 12591],
30217
+ [12593, 12686],
30218
+ [12704, 12735],
30219
+ [12784, 12799],
30220
+ [13312, 19903],
30221
+ [19968, 42124],
30222
+ [42192, 42237],
30223
+ [42240, 42508],
30224
+ [42512, 42527],
30225
+ [42538, 42539],
30226
+ [42560, 42606],
30227
+ [42623, 42653],
30228
+ [42656, 42735],
30229
+ [42775, 42783],
30230
+ [42786, 42888],
30231
+ [42891, 42957],
30232
+ [42960, 42961],
30233
+ [42963, 42963],
30234
+ [42965, 42972],
30235
+ [42994, 43009],
30236
+ [43011, 43013],
30237
+ [43015, 43018],
30238
+ [43020, 43042],
30239
+ [43072, 43123],
30240
+ [43138, 43187],
30241
+ [43250, 43255],
30242
+ [43259, 43259],
30243
+ [43261, 43262],
30244
+ [43274, 43301],
30245
+ [43312, 43334],
30246
+ [43360, 43388],
30247
+ [43396, 43442],
30248
+ [43471, 43471],
30249
+ [43488, 43492],
30250
+ [43494, 43503],
30251
+ [43514, 43518],
30252
+ [43520, 43560],
30253
+ [43584, 43586],
30254
+ [43588, 43595],
30255
+ [43616, 43638],
30256
+ [43642, 43642],
30257
+ [43646, 43695],
30258
+ [43697, 43697],
30259
+ [43701, 43702],
30260
+ [43705, 43709],
30261
+ [43712, 43712],
30262
+ [43714, 43714],
30263
+ [43739, 43741],
30264
+ [43744, 43754],
30265
+ [43762, 43764],
30266
+ [43777, 43782],
30267
+ [43785, 43790],
30268
+ [43793, 43798],
30269
+ [43808, 43814],
30270
+ [43816, 43822],
30271
+ [43824, 43866],
30272
+ [43868, 43881],
30273
+ [43888, 44002],
30274
+ [44032, 55203],
30275
+ [55216, 55238],
30276
+ [55243, 55291],
30277
+ [63744, 64109],
30278
+ [64112, 64217],
30279
+ [64256, 64262],
30280
+ [64275, 64279],
30281
+ [64285, 64285],
30282
+ [64287, 64296],
30283
+ [64298, 64310],
30284
+ [64312, 64316],
30285
+ [64318, 64318],
30286
+ [64320, 64321],
30287
+ [64323, 64324],
30288
+ [64326, 64433],
30289
+ [64467, 64605],
30290
+ [64612, 64829],
30291
+ [64848, 64911],
30292
+ [64914, 64967],
30293
+ [65008, 65017],
30294
+ [65137, 65137],
30295
+ [65139, 65139],
30296
+ [65143, 65143],
30297
+ [65145, 65145],
30298
+ [65147, 65147],
30299
+ [65149, 65149],
30300
+ [65151, 65276],
30301
+ [65313, 65338],
30302
+ [65345, 65370],
30303
+ [65382, 65437],
30304
+ [65440, 65470],
30305
+ [65474, 65479],
30306
+ [65482, 65487],
30307
+ [65490, 65495],
30308
+ [65498, 65500],
30309
+ [65536, 65547],
30310
+ [65549, 65574],
30311
+ [65576, 65594],
30312
+ [65596, 65597],
30313
+ [65599, 65613],
30314
+ [65616, 65629],
30315
+ [65664, 65786],
30316
+ [65856, 65908],
30317
+ [66176, 66204],
30318
+ [66208, 66256],
30319
+ [66304, 66335],
30320
+ [66349, 66378],
30321
+ [66384, 66421],
30322
+ [66432, 66461],
30323
+ [66464, 66499],
30324
+ [66504, 66511],
30325
+ [66513, 66517],
30326
+ [66560, 66717],
30327
+ [66736, 66771],
30328
+ [66776, 66811],
30329
+ [66816, 66855],
30330
+ [66864, 66915],
30331
+ [66928, 66938],
30332
+ [66940, 66954],
30333
+ [66956, 66962],
30334
+ [66964, 66965],
30335
+ [66967, 66977],
30336
+ [66979, 66993],
30337
+ [66995, 67001],
30338
+ [67003, 67004],
30339
+ [67008, 67059],
30340
+ [67072, 67382],
30341
+ [67392, 67413],
30342
+ [67424, 67431],
30343
+ [67456, 67461],
30344
+ [67463, 67504],
30345
+ [67506, 67514],
30346
+ [67584, 67589],
30347
+ [67592, 67592],
30348
+ [67594, 67637],
30349
+ [67639, 67640],
30350
+ [67644, 67644],
30351
+ [67647, 67669],
30352
+ [67680, 67702],
30353
+ [67712, 67742],
30354
+ [67808, 67826],
30355
+ [67828, 67829],
30356
+ [67840, 67861],
30357
+ [67872, 67897],
30358
+ [67968, 68023],
30359
+ [68030, 68031],
30360
+ [68096, 68096],
30361
+ [68112, 68115],
30362
+ [68117, 68119],
30363
+ [68121, 68149],
30364
+ [68192, 68220],
30365
+ [68224, 68252],
30366
+ [68288, 68295],
30367
+ [68297, 68324],
30368
+ [68352, 68405],
30369
+ [68416, 68437],
30370
+ [68448, 68466],
30371
+ [68480, 68497],
30372
+ [68608, 68680],
30373
+ [68736, 68786],
30374
+ [68800, 68850],
30375
+ [68864, 68899],
30376
+ [68938, 68965],
30377
+ [68975, 68997],
30378
+ [69248, 69289],
30379
+ [69296, 69297],
30380
+ [69314, 69316],
30381
+ [69376, 69404],
30382
+ [69415, 69415],
30383
+ [69424, 69445],
30384
+ [69488, 69505],
30385
+ [69552, 69572],
30386
+ [69600, 69622],
30387
+ [69635, 69687],
30388
+ [69745, 69746],
30389
+ [69749, 69749],
30390
+ [69763, 69807],
30391
+ [69840, 69864],
30392
+ [69891, 69926],
30393
+ [69956, 69956],
30394
+ [69959, 69959],
30395
+ [69968, 70002],
30396
+ [70006, 70006],
30397
+ [70019, 70066],
30398
+ [70081, 70084],
30399
+ [70106, 70106],
30400
+ [70108, 70108],
30401
+ [70144, 70161],
30402
+ [70163, 70187],
30403
+ [70207, 70208],
30404
+ [70272, 70278],
30405
+ [70280, 70280],
30406
+ [70282, 70285],
30407
+ [70287, 70301],
30408
+ [70303, 70312],
30409
+ [70320, 70366],
30410
+ [70405, 70412],
30411
+ [70415, 70416],
30412
+ [70419, 70440],
30413
+ [70442, 70448],
30414
+ [70450, 70451],
30415
+ [70453, 70457],
30416
+ [70461, 70461],
30417
+ [70480, 70480],
30418
+ [70493, 70497],
30419
+ [70528, 70537],
30420
+ [70539, 70539],
30421
+ [70542, 70542],
30422
+ [70544, 70581],
30423
+ [70583, 70583],
30424
+ [70609, 70609],
30425
+ [70611, 70611],
30426
+ [70656, 70708],
30427
+ [70727, 70730],
30428
+ [70751, 70753],
30429
+ [70784, 70831],
30430
+ [70852, 70853],
30431
+ [70855, 70855],
30432
+ [71040, 71086],
30433
+ [71128, 71131],
30434
+ [71168, 71215],
30435
+ [71236, 71236],
30436
+ [71296, 71338],
30437
+ [71352, 71352],
30438
+ [71424, 71450],
30439
+ [71488, 71494],
30440
+ [71680, 71723],
30441
+ [71840, 71903],
30442
+ [71935, 71942],
30443
+ [71945, 71945],
30444
+ [71948, 71955],
30445
+ [71957, 71958],
30446
+ [71960, 71983],
30447
+ [71999, 71999],
30448
+ [72001, 72001],
30449
+ [72096, 72103],
30450
+ [72106, 72144],
30451
+ [72161, 72161],
30452
+ [72163, 72163],
30453
+ [72192, 72192],
30454
+ [72203, 72242],
30455
+ [72250, 72250],
30456
+ [72272, 72272],
30457
+ [72284, 72329],
30458
+ [72349, 72349],
30459
+ [72368, 72440],
30460
+ [72640, 72672],
30461
+ [72704, 72712],
30462
+ [72714, 72750],
30463
+ [72768, 72768],
30464
+ [72818, 72847],
30465
+ [72960, 72966],
30466
+ [72968, 72969],
30467
+ [72971, 73008],
30468
+ [73030, 73030],
30469
+ [73056, 73061],
30470
+ [73063, 73064],
30471
+ [73066, 73097],
30472
+ [73112, 73112],
30473
+ [73440, 73458],
30474
+ [73474, 73474],
30475
+ [73476, 73488],
30476
+ [73490, 73523],
30477
+ [73648, 73648],
30478
+ [73728, 74649],
30479
+ [74752, 74862],
30480
+ [74880, 75075],
30481
+ [77712, 77808],
30482
+ [77824, 78895],
30483
+ [78913, 78918],
30484
+ [78944, 82938],
30485
+ [82944, 83526],
30486
+ [90368, 90397],
30487
+ [92160, 92728],
30488
+ [92736, 92766],
30489
+ [92784, 92862],
30490
+ [92880, 92909],
30491
+ [92928, 92975],
30492
+ [92992, 92995],
30493
+ [93027, 93047],
30494
+ [93053, 93071],
30495
+ [93504, 93548],
30496
+ [93760, 93823],
30497
+ [93952, 94026],
30498
+ [94032, 94032],
30499
+ [94099, 94111],
30500
+ [94176, 94177],
30501
+ [94179, 94179],
30502
+ [94208, 100343],
30503
+ [100352, 101589],
30504
+ [101631, 101640],
30505
+ [110576, 110579],
30506
+ [110581, 110587],
30507
+ [110589, 110590],
30508
+ [110592, 110882],
30509
+ [110898, 110898],
30510
+ [110928, 110930],
30511
+ [110933, 110933],
30512
+ [110948, 110951],
30513
+ [110960, 111355],
30514
+ [113664, 113770],
30515
+ [113776, 113788],
30516
+ [113792, 113800],
30517
+ [113808, 113817],
30518
+ [119808, 119892],
30519
+ [119894, 119964],
30520
+ [119966, 119967],
30521
+ [119970, 119970],
30522
+ [119973, 119974],
30523
+ [119977, 119980],
30524
+ [119982, 119993],
30525
+ [119995, 119995],
30526
+ [119997, 120003],
30527
+ [120005, 120069],
30528
+ [120071, 120074],
30529
+ [120077, 120084],
30530
+ [120086, 120092],
30531
+ [120094, 120121],
30532
+ [120123, 120126],
30533
+ [120128, 120132],
30534
+ [120134, 120134],
30535
+ [120138, 120144],
30536
+ [120146, 120485],
30537
+ [120488, 120512],
30538
+ [120514, 120538],
30539
+ [120540, 120570],
30540
+ [120572, 120596],
30541
+ [120598, 120628],
30542
+ [120630, 120654],
30543
+ [120656, 120686],
30544
+ [120688, 120712],
30545
+ [120714, 120744],
30546
+ [120746, 120770],
30547
+ [120772, 120779],
30548
+ [122624, 122654],
30549
+ [122661, 122666],
30550
+ [122928, 122989],
30551
+ [123136, 123180],
30552
+ [123191, 123197],
30553
+ [123214, 123214],
30554
+ [123536, 123565],
30555
+ [123584, 123627],
30556
+ [124112, 124139],
30557
+ [124368, 124397],
30558
+ [124400, 124400],
30559
+ [124896, 124902],
30560
+ [124904, 124907],
30561
+ [124909, 124910],
30562
+ [124912, 124926],
30563
+ [124928, 125124],
30564
+ [125184, 125251],
30565
+ [125259, 125259],
30566
+ [126464, 126467],
30567
+ [126469, 126495],
30568
+ [126497, 126498],
30569
+ [126500, 126500],
30570
+ [126503, 126503],
30571
+ [126505, 126514],
30572
+ [126516, 126519],
30573
+ [126521, 126521],
30574
+ [126523, 126523],
30575
+ [126530, 126530],
30576
+ [126535, 126535],
30577
+ [126537, 126537],
30578
+ [126539, 126539],
30579
+ [126541, 126543],
30580
+ [126545, 126546],
30581
+ [126548, 126548],
30582
+ [126551, 126551],
30583
+ [126553, 126553],
30584
+ [126555, 126555],
30585
+ [126557, 126557],
30586
+ [126559, 126559],
30587
+ [126561, 126562],
30588
+ [126564, 126564],
30589
+ [126567, 126570],
30590
+ [126572, 126578],
30591
+ [126580, 126583],
30592
+ [126585, 126588],
30593
+ [126590, 126590],
30594
+ [126592, 126601],
30595
+ [126603, 126619],
30596
+ [126625, 126627],
30597
+ [126629, 126633],
30598
+ [126635, 126651],
30599
+ [131072, 173791],
30600
+ [173824, 177977],
30601
+ [177984, 178205],
30602
+ [178208, 183969],
30603
+ [183984, 191456],
30604
+ [191472, 192093],
30605
+ [194560, 195101],
30606
+ [196608, 201546],
30607
+ [201552, 205743]
30608
+ ];
30609
+ DUPLICATE_IDENTIFIER_CONTINUE_RANGES = [
30610
+ [36, 36],
30611
+ [48, 57],
30612
+ [65, 90],
30613
+ [95, 95],
30614
+ [97, 122],
30615
+ [170, 170],
30616
+ [181, 181],
30617
+ [183, 183],
30618
+ [186, 186],
30619
+ [192, 214],
30620
+ [216, 246],
30621
+ [248, 705],
30622
+ [710, 721],
30623
+ [736, 740],
30624
+ [748, 748],
30625
+ [750, 750],
30626
+ [768, 884],
30627
+ [886, 887],
30628
+ [891, 893],
30629
+ [895, 895],
30630
+ [902, 906],
30631
+ [908, 908],
30632
+ [910, 929],
30633
+ [931, 1013],
30634
+ [1015, 1153],
30635
+ [1155, 1159],
30636
+ [1162, 1327],
30637
+ [1329, 1366],
30638
+ [1369, 1369],
30639
+ [1376, 1416],
30640
+ [1425, 1469],
30641
+ [1471, 1471],
30642
+ [1473, 1474],
30643
+ [1476, 1477],
30644
+ [1479, 1479],
30645
+ [1488, 1514],
30646
+ [1519, 1522],
30647
+ [1552, 1562],
30648
+ [1568, 1641],
30649
+ [1646, 1747],
30650
+ [1749, 1756],
30651
+ [1759, 1768],
30652
+ [1770, 1788],
30653
+ [1791, 1791],
30654
+ [1808, 1866],
30655
+ [1869, 1969],
30656
+ [1984, 2037],
30657
+ [2042, 2042],
30658
+ [2045, 2045],
30659
+ [2048, 2093],
30660
+ [2112, 2139],
30661
+ [2144, 2154],
30662
+ [2160, 2183],
30663
+ [2185, 2190],
30664
+ [2199, 2273],
30665
+ [2275, 2403],
30666
+ [2406, 2415],
30667
+ [2417, 2435],
30668
+ [2437, 2444],
30669
+ [2447, 2448],
30670
+ [2451, 2472],
30671
+ [2474, 2480],
30672
+ [2482, 2482],
30673
+ [2486, 2489],
30674
+ [2492, 2500],
30675
+ [2503, 2504],
30676
+ [2507, 2510],
30677
+ [2519, 2519],
30678
+ [2524, 2525],
30679
+ [2527, 2531],
30680
+ [2534, 2545],
30681
+ [2556, 2556],
30682
+ [2558, 2558],
30683
+ [2561, 2563],
30684
+ [2565, 2570],
30685
+ [2575, 2576],
30686
+ [2579, 2600],
30687
+ [2602, 2608],
30688
+ [2610, 2611],
30689
+ [2613, 2614],
30690
+ [2616, 2617],
30691
+ [2620, 2620],
30692
+ [2622, 2626],
30693
+ [2631, 2632],
30694
+ [2635, 2637],
30695
+ [2641, 2641],
30696
+ [2649, 2652],
30697
+ [2654, 2654],
30698
+ [2662, 2677],
30699
+ [2689, 2691],
30700
+ [2693, 2701],
30701
+ [2703, 2705],
30702
+ [2707, 2728],
30703
+ [2730, 2736],
30704
+ [2738, 2739],
30705
+ [2741, 2745],
30706
+ [2748, 2757],
30707
+ [2759, 2761],
30708
+ [2763, 2765],
30709
+ [2768, 2768],
30710
+ [2784, 2787],
30711
+ [2790, 2799],
30712
+ [2809, 2815],
30713
+ [2817, 2819],
30714
+ [2821, 2828],
30715
+ [2831, 2832],
30716
+ [2835, 2856],
30717
+ [2858, 2864],
30718
+ [2866, 2867],
30719
+ [2869, 2873],
30720
+ [2876, 2884],
30721
+ [2887, 2888],
30722
+ [2891, 2893],
30723
+ [2901, 2903],
30724
+ [2908, 2909],
30725
+ [2911, 2915],
30726
+ [2918, 2927],
30727
+ [2929, 2929],
30728
+ [2946, 2947],
30729
+ [2949, 2954],
30730
+ [2958, 2960],
30731
+ [2962, 2965],
30732
+ [2969, 2970],
30733
+ [2972, 2972],
30734
+ [2974, 2975],
30735
+ [2979, 2980],
30736
+ [2984, 2986],
30737
+ [2990, 3001],
30738
+ [3006, 3010],
30739
+ [3014, 3016],
30740
+ [3018, 3021],
30741
+ [3024, 3024],
30742
+ [3031, 3031],
30743
+ [3046, 3055],
30744
+ [3072, 3084],
30745
+ [3086, 3088],
30746
+ [3090, 3112],
30747
+ [3114, 3129],
30748
+ [3132, 3140],
30749
+ [3142, 3144],
30750
+ [3146, 3149],
30751
+ [3157, 3158],
30752
+ [3160, 3162],
30753
+ [3165, 3165],
30754
+ [3168, 3171],
30755
+ [3174, 3183],
30756
+ [3200, 3203],
30757
+ [3205, 3212],
30758
+ [3214, 3216],
30759
+ [3218, 3240],
30760
+ [3242, 3251],
30761
+ [3253, 3257],
30762
+ [3260, 3268],
30763
+ [3270, 3272],
30764
+ [3274, 3277],
30765
+ [3285, 3286],
30766
+ [3293, 3294],
30767
+ [3296, 3299],
30768
+ [3302, 3311],
30769
+ [3313, 3315],
30770
+ [3328, 3340],
30771
+ [3342, 3344],
30772
+ [3346, 3396],
30773
+ [3398, 3400],
30774
+ [3402, 3406],
30775
+ [3412, 3415],
30776
+ [3423, 3427],
30777
+ [3430, 3439],
30778
+ [3450, 3455],
30779
+ [3457, 3459],
30780
+ [3461, 3478],
30781
+ [3482, 3505],
30782
+ [3507, 3515],
30783
+ [3517, 3517],
30784
+ [3520, 3526],
30785
+ [3530, 3530],
30786
+ [3535, 3540],
30787
+ [3542, 3542],
30788
+ [3544, 3551],
30789
+ [3558, 3567],
30790
+ [3570, 3571],
30791
+ [3585, 3642],
30792
+ [3648, 3662],
30793
+ [3664, 3673],
30794
+ [3713, 3714],
30795
+ [3716, 3716],
30796
+ [3718, 3722],
30797
+ [3724, 3747],
30798
+ [3749, 3749],
30799
+ [3751, 3773],
30800
+ [3776, 3780],
30801
+ [3782, 3782],
30802
+ [3784, 3790],
30803
+ [3792, 3801],
30804
+ [3804, 3807],
30805
+ [3840, 3840],
30806
+ [3864, 3865],
30807
+ [3872, 3881],
30808
+ [3893, 3893],
30809
+ [3895, 3895],
30810
+ [3897, 3897],
30811
+ [3902, 3911],
30812
+ [3913, 3948],
30813
+ [3953, 3972],
30814
+ [3974, 3991],
30815
+ [3993, 4028],
30816
+ [4038, 4038],
30817
+ [4096, 4169],
30818
+ [4176, 4253],
30819
+ [4256, 4293],
30820
+ [4295, 4295],
30821
+ [4301, 4301],
30822
+ [4304, 4346],
30823
+ [4348, 4680],
30824
+ [4682, 4685],
30825
+ [4688, 4694],
30826
+ [4696, 4696],
30827
+ [4698, 4701],
30828
+ [4704, 4744],
30829
+ [4746, 4749],
30830
+ [4752, 4784],
30831
+ [4786, 4789],
30832
+ [4792, 4798],
30833
+ [4800, 4800],
30834
+ [4802, 4805],
30835
+ [4808, 4822],
30836
+ [4824, 4880],
30837
+ [4882, 4885],
30838
+ [4888, 4954],
30839
+ [4957, 4959],
30840
+ [4969, 4977],
30841
+ [4992, 5007],
30842
+ [5024, 5109],
30843
+ [5112, 5117],
30844
+ [5121, 5740],
30845
+ [5743, 5759],
30846
+ [5761, 5786],
30847
+ [5792, 5866],
30848
+ [5870, 5880],
30849
+ [5888, 5909],
30850
+ [5919, 5940],
30851
+ [5952, 5971],
30852
+ [5984, 5996],
30853
+ [5998, 6e3],
30854
+ [6002, 6003],
30855
+ [6016, 6099],
30856
+ [6103, 6103],
30857
+ [6108, 6109],
30858
+ [6112, 6121],
30859
+ [6155, 6157],
30860
+ [6159, 6169],
30861
+ [6176, 6264],
30862
+ [6272, 6314],
30863
+ [6320, 6389],
30864
+ [6400, 6430],
30865
+ [6432, 6443],
30866
+ [6448, 6459],
30867
+ [6470, 6509],
30868
+ [6512, 6516],
30869
+ [6528, 6571],
30870
+ [6576, 6601],
30871
+ [6608, 6618],
30872
+ [6656, 6683],
30873
+ [6688, 6750],
30874
+ [6752, 6780],
30875
+ [6783, 6793],
30876
+ [6800, 6809],
30877
+ [6823, 6823],
30878
+ [6832, 6845],
30879
+ [6847, 6862],
30880
+ [6912, 6988],
30881
+ [6992, 7001],
30882
+ [7019, 7027],
30883
+ [7040, 7155],
30884
+ [7168, 7223],
30885
+ [7232, 7241],
30886
+ [7245, 7293],
30887
+ [7296, 7306],
30888
+ [7312, 7354],
30889
+ [7357, 7359],
30890
+ [7376, 7378],
30891
+ [7380, 7418],
30892
+ [7424, 7957],
30893
+ [7960, 7965],
30894
+ [7968, 8005],
30895
+ [8008, 8013],
30896
+ [8016, 8023],
30897
+ [8025, 8025],
30898
+ [8027, 8027],
30899
+ [8029, 8029],
30900
+ [8031, 8061],
30901
+ [8064, 8116],
30902
+ [8118, 8124],
30903
+ [8126, 8126],
30904
+ [8130, 8132],
30905
+ [8134, 8140],
30906
+ [8144, 8147],
30907
+ [8150, 8155],
30908
+ [8160, 8172],
30909
+ [8178, 8180],
30910
+ [8182, 8188],
30911
+ [8204, 8205],
30912
+ [8255, 8256],
30913
+ [8276, 8276],
30914
+ [8305, 8305],
30915
+ [8319, 8319],
30916
+ [8336, 8348],
30917
+ [8400, 8412],
30918
+ [8417, 8417],
30919
+ [8421, 8432],
30920
+ [8450, 8450],
30921
+ [8455, 8455],
30922
+ [8458, 8467],
30923
+ [8469, 8469],
30924
+ [8472, 8477],
30925
+ [8484, 8484],
30926
+ [8486, 8486],
30927
+ [8488, 8488],
30928
+ [8490, 8505],
30929
+ [8508, 8511],
30930
+ [8517, 8521],
30931
+ [8526, 8526],
30932
+ [8544, 8584],
30933
+ [11264, 11492],
30934
+ [11499, 11507],
30935
+ [11520, 11557],
30936
+ [11559, 11559],
30937
+ [11565, 11565],
30938
+ [11568, 11623],
30939
+ [11631, 11631],
30940
+ [11647, 11670],
30941
+ [11680, 11686],
30942
+ [11688, 11694],
30943
+ [11696, 11702],
30944
+ [11704, 11710],
30945
+ [11712, 11718],
30946
+ [11720, 11726],
30947
+ [11728, 11734],
30948
+ [11736, 11742],
30949
+ [11744, 11775],
30950
+ [12293, 12295],
30951
+ [12321, 12335],
30952
+ [12337, 12341],
30953
+ [12344, 12348],
30954
+ [12353, 12438],
30955
+ [12441, 12447],
30956
+ [12449, 12543],
30957
+ [12549, 12591],
30958
+ [12593, 12686],
30959
+ [12704, 12735],
30960
+ [12784, 12799],
30961
+ [13312, 19903],
30962
+ [19968, 42124],
30963
+ [42192, 42237],
30964
+ [42240, 42508],
30965
+ [42512, 42539],
30966
+ [42560, 42607],
30967
+ [42612, 42621],
30968
+ [42623, 42737],
30969
+ [42775, 42783],
30970
+ [42786, 42888],
30971
+ [42891, 42957],
30972
+ [42960, 42961],
30973
+ [42963, 42963],
30974
+ [42965, 42972],
30975
+ [42994, 43047],
30976
+ [43052, 43052],
30977
+ [43072, 43123],
30978
+ [43136, 43205],
30979
+ [43216, 43225],
30980
+ [43232, 43255],
30981
+ [43259, 43259],
30982
+ [43261, 43309],
30983
+ [43312, 43347],
30984
+ [43360, 43388],
30985
+ [43392, 43456],
30986
+ [43471, 43481],
30987
+ [43488, 43518],
30988
+ [43520, 43574],
30989
+ [43584, 43597],
30990
+ [43600, 43609],
30991
+ [43616, 43638],
30992
+ [43642, 43714],
30993
+ [43739, 43741],
30994
+ [43744, 43759],
30995
+ [43762, 43766],
30996
+ [43777, 43782],
30997
+ [43785, 43790],
30998
+ [43793, 43798],
30999
+ [43808, 43814],
31000
+ [43816, 43822],
31001
+ [43824, 43866],
31002
+ [43868, 43881],
31003
+ [43888, 44010],
31004
+ [44012, 44013],
31005
+ [44016, 44025],
31006
+ [44032, 55203],
31007
+ [55216, 55238],
31008
+ [55243, 55291],
31009
+ [63744, 64109],
31010
+ [64112, 64217],
31011
+ [64256, 64262],
31012
+ [64275, 64279],
31013
+ [64285, 64296],
31014
+ [64298, 64310],
31015
+ [64312, 64316],
31016
+ [64318, 64318],
31017
+ [64320, 64321],
31018
+ [64323, 64324],
31019
+ [64326, 64433],
31020
+ [64467, 64605],
31021
+ [64612, 64829],
31022
+ [64848, 64911],
31023
+ [64914, 64967],
31024
+ [65008, 65017],
31025
+ [65024, 65039],
31026
+ [65056, 65071],
31027
+ [65075, 65076],
31028
+ [65101, 65103],
31029
+ [65137, 65137],
31030
+ [65139, 65139],
31031
+ [65143, 65143],
31032
+ [65145, 65145],
31033
+ [65147, 65147],
31034
+ [65149, 65149],
31035
+ [65151, 65276],
31036
+ [65296, 65305],
31037
+ [65313, 65338],
31038
+ [65343, 65343],
31039
+ [65345, 65370],
31040
+ [65381, 65470],
31041
+ [65474, 65479],
31042
+ [65482, 65487],
31043
+ [65490, 65495],
31044
+ [65498, 65500],
31045
+ [65536, 65547],
31046
+ [65549, 65574],
31047
+ [65576, 65594],
31048
+ [65596, 65597],
31049
+ [65599, 65613],
31050
+ [65616, 65629],
31051
+ [65664, 65786],
31052
+ [65856, 65908],
31053
+ [66045, 66045],
31054
+ [66176, 66204],
31055
+ [66208, 66256],
31056
+ [66272, 66272],
31057
+ [66304, 66335],
31058
+ [66349, 66378],
31059
+ [66384, 66426],
31060
+ [66432, 66461],
31061
+ [66464, 66499],
31062
+ [66504, 66511],
31063
+ [66513, 66517],
31064
+ [66560, 66717],
31065
+ [66720, 66729],
31066
+ [66736, 66771],
31067
+ [66776, 66811],
31068
+ [66816, 66855],
31069
+ [66864, 66915],
31070
+ [66928, 66938],
31071
+ [66940, 66954],
31072
+ [66956, 66962],
31073
+ [66964, 66965],
31074
+ [66967, 66977],
31075
+ [66979, 66993],
31076
+ [66995, 67001],
31077
+ [67003, 67004],
31078
+ [67008, 67059],
31079
+ [67072, 67382],
31080
+ [67392, 67413],
31081
+ [67424, 67431],
31082
+ [67456, 67461],
31083
+ [67463, 67504],
31084
+ [67506, 67514],
31085
+ [67584, 67589],
31086
+ [67592, 67592],
31087
+ [67594, 67637],
31088
+ [67639, 67640],
31089
+ [67644, 67644],
31090
+ [67647, 67669],
31091
+ [67680, 67702],
31092
+ [67712, 67742],
31093
+ [67808, 67826],
31094
+ [67828, 67829],
31095
+ [67840, 67861],
31096
+ [67872, 67897],
31097
+ [67968, 68023],
31098
+ [68030, 68031],
31099
+ [68096, 68099],
31100
+ [68101, 68102],
31101
+ [68108, 68115],
31102
+ [68117, 68119],
31103
+ [68121, 68149],
31104
+ [68152, 68154],
31105
+ [68159, 68159],
31106
+ [68192, 68220],
31107
+ [68224, 68252],
31108
+ [68288, 68295],
31109
+ [68297, 68326],
31110
+ [68352, 68405],
31111
+ [68416, 68437],
31112
+ [68448, 68466],
31113
+ [68480, 68497],
31114
+ [68608, 68680],
31115
+ [68736, 68786],
31116
+ [68800, 68850],
31117
+ [68864, 68903],
31118
+ [68912, 68921],
31119
+ [68928, 68965],
31120
+ [68969, 68973],
31121
+ [68975, 68997],
31122
+ [69248, 69289],
31123
+ [69291, 69292],
31124
+ [69296, 69297],
31125
+ [69314, 69316],
31126
+ [69372, 69404],
31127
+ [69415, 69415],
31128
+ [69424, 69456],
31129
+ [69488, 69509],
31130
+ [69552, 69572],
31131
+ [69600, 69622],
31132
+ [69632, 69702],
31133
+ [69734, 69749],
31134
+ [69759, 69818],
31135
+ [69826, 69826],
31136
+ [69840, 69864],
31137
+ [69872, 69881],
31138
+ [69888, 69940],
31139
+ [69942, 69951],
31140
+ [69956, 69959],
31141
+ [69968, 70003],
31142
+ [70006, 70006],
31143
+ [70016, 70084],
31144
+ [70089, 70092],
31145
+ [70094, 70106],
31146
+ [70108, 70108],
31147
+ [70144, 70161],
31148
+ [70163, 70199],
31149
+ [70206, 70209],
31150
+ [70272, 70278],
31151
+ [70280, 70280],
31152
+ [70282, 70285],
31153
+ [70287, 70301],
31154
+ [70303, 70312],
31155
+ [70320, 70378],
31156
+ [70384, 70393],
31157
+ [70400, 70403],
31158
+ [70405, 70412],
31159
+ [70415, 70416],
31160
+ [70419, 70440],
31161
+ [70442, 70448],
31162
+ [70450, 70451],
31163
+ [70453, 70457],
31164
+ [70459, 70468],
31165
+ [70471, 70472],
31166
+ [70475, 70477],
31167
+ [70480, 70480],
31168
+ [70487, 70487],
31169
+ [70493, 70499],
31170
+ [70502, 70508],
31171
+ [70512, 70516],
31172
+ [70528, 70537],
31173
+ [70539, 70539],
31174
+ [70542, 70542],
31175
+ [70544, 70581],
31176
+ [70583, 70592],
31177
+ [70594, 70594],
31178
+ [70597, 70597],
31179
+ [70599, 70602],
31180
+ [70604, 70611],
31181
+ [70625, 70626],
31182
+ [70656, 70730],
31183
+ [70736, 70745],
31184
+ [70750, 70753],
31185
+ [70784, 70853],
31186
+ [70855, 70855],
31187
+ [70864, 70873],
31188
+ [71040, 71093],
31189
+ [71096, 71104],
31190
+ [71128, 71133],
31191
+ [71168, 71232],
31192
+ [71236, 71236],
31193
+ [71248, 71257],
31194
+ [71296, 71352],
31195
+ [71360, 71369],
31196
+ [71376, 71395],
31197
+ [71424, 71450],
31198
+ [71453, 71467],
31199
+ [71472, 71481],
31200
+ [71488, 71494],
31201
+ [71680, 71738],
31202
+ [71840, 71913],
31203
+ [71935, 71942],
31204
+ [71945, 71945],
31205
+ [71948, 71955],
31206
+ [71957, 71958],
31207
+ [71960, 71989],
31208
+ [71991, 71992],
31209
+ [71995, 72003],
31210
+ [72016, 72025],
31211
+ [72096, 72103],
31212
+ [72106, 72151],
31213
+ [72154, 72161],
31214
+ [72163, 72164],
31215
+ [72192, 72254],
31216
+ [72263, 72263],
31217
+ [72272, 72345],
31218
+ [72349, 72349],
31219
+ [72368, 72440],
31220
+ [72640, 72672],
31221
+ [72688, 72697],
31222
+ [72704, 72712],
31223
+ [72714, 72758],
31224
+ [72760, 72768],
31225
+ [72784, 72793],
31226
+ [72818, 72847],
31227
+ [72850, 72871],
31228
+ [72873, 72886],
31229
+ [72960, 72966],
31230
+ [72968, 72969],
31231
+ [72971, 73014],
31232
+ [73018, 73018],
31233
+ [73020, 73021],
31234
+ [73023, 73031],
31235
+ [73040, 73049],
31236
+ [73056, 73061],
31237
+ [73063, 73064],
31238
+ [73066, 73102],
31239
+ [73104, 73105],
31240
+ [73107, 73112],
31241
+ [73120, 73129],
31242
+ [73440, 73462],
31243
+ [73472, 73488],
31244
+ [73490, 73530],
31245
+ [73534, 73538],
31246
+ [73552, 73562],
31247
+ [73648, 73648],
31248
+ [73728, 74649],
31249
+ [74752, 74862],
31250
+ [74880, 75075],
31251
+ [77712, 77808],
31252
+ [77824, 78895],
31253
+ [78912, 78933],
31254
+ [78944, 82938],
31255
+ [82944, 83526],
31256
+ [90368, 90425],
31257
+ [92160, 92728],
31258
+ [92736, 92766],
31259
+ [92768, 92777],
31260
+ [92784, 92862],
31261
+ [92864, 92873],
31262
+ [92880, 92909],
31263
+ [92912, 92916],
31264
+ [92928, 92982],
31265
+ [92992, 92995],
31266
+ [93008, 93017],
31267
+ [93027, 93047],
31268
+ [93053, 93071],
31269
+ [93504, 93548],
31270
+ [93552, 93561],
31271
+ [93760, 93823],
31272
+ [93952, 94026],
31273
+ [94031, 94087],
31274
+ [94095, 94111],
31275
+ [94176, 94177],
31276
+ [94179, 94180],
31277
+ [94192, 94193],
31278
+ [94208, 100343],
31279
+ [100352, 101589],
31280
+ [101631, 101640],
31281
+ [110576, 110579],
31282
+ [110581, 110587],
31283
+ [110589, 110590],
31284
+ [110592, 110882],
31285
+ [110898, 110898],
31286
+ [110928, 110930],
31287
+ [110933, 110933],
31288
+ [110948, 110951],
31289
+ [110960, 111355],
31290
+ [113664, 113770],
31291
+ [113776, 113788],
31292
+ [113792, 113800],
31293
+ [113808, 113817],
31294
+ [113821, 113822],
31295
+ [118e3, 118009],
31296
+ [118528, 118573],
31297
+ [118576, 118598],
31298
+ [119141, 119145],
31299
+ [119149, 119154],
31300
+ [119163, 119170],
31301
+ [119173, 119179],
31302
+ [119210, 119213],
31303
+ [119362, 119364],
31304
+ [119808, 119892],
31305
+ [119894, 119964],
31306
+ [119966, 119967],
31307
+ [119970, 119970],
31308
+ [119973, 119974],
31309
+ [119977, 119980],
31310
+ [119982, 119993],
31311
+ [119995, 119995],
31312
+ [119997, 120003],
31313
+ [120005, 120069],
31314
+ [120071, 120074],
31315
+ [120077, 120084],
31316
+ [120086, 120092],
31317
+ [120094, 120121],
31318
+ [120123, 120126],
31319
+ [120128, 120132],
31320
+ [120134, 120134],
31321
+ [120138, 120144],
31322
+ [120146, 120485],
31323
+ [120488, 120512],
31324
+ [120514, 120538],
31325
+ [120540, 120570],
31326
+ [120572, 120596],
31327
+ [120598, 120628],
31328
+ [120630, 120654],
31329
+ [120656, 120686],
31330
+ [120688, 120712],
31331
+ [120714, 120744],
31332
+ [120746, 120770],
31333
+ [120772, 120779],
31334
+ [120782, 120831],
31335
+ [121344, 121398],
31336
+ [121403, 121452],
31337
+ [121461, 121461],
31338
+ [121476, 121476],
31339
+ [121499, 121503],
31340
+ [121505, 121519],
31341
+ [122624, 122654],
31342
+ [122661, 122666],
31343
+ [122880, 122886],
31344
+ [122888, 122904],
31345
+ [122907, 122913],
31346
+ [122915, 122916],
31347
+ [122918, 122922],
31348
+ [122928, 122989],
31349
+ [123023, 123023],
31350
+ [123136, 123180],
31351
+ [123184, 123197],
31352
+ [123200, 123209],
31353
+ [123214, 123214],
31354
+ [123536, 123566],
31355
+ [123584, 123641],
31356
+ [124112, 124153],
31357
+ [124368, 124410],
31358
+ [124896, 124902],
31359
+ [124904, 124907],
31360
+ [124909, 124910],
31361
+ [124912, 124926],
31362
+ [124928, 125124],
31363
+ [125136, 125142],
31364
+ [125184, 125259],
31365
+ [125264, 125273],
31366
+ [126464, 126467],
31367
+ [126469, 126495],
31368
+ [126497, 126498],
31369
+ [126500, 126500],
31370
+ [126503, 126503],
31371
+ [126505, 126514],
31372
+ [126516, 126519],
31373
+ [126521, 126521],
31374
+ [126523, 126523],
31375
+ [126530, 126530],
31376
+ [126535, 126535],
31377
+ [126537, 126537],
31378
+ [126539, 126539],
31379
+ [126541, 126543],
31380
+ [126545, 126546],
31381
+ [126548, 126548],
31382
+ [126551, 126551],
31383
+ [126553, 126553],
31384
+ [126555, 126555],
31385
+ [126557, 126557],
31386
+ [126559, 126559],
31387
+ [126561, 126562],
31388
+ [126564, 126564],
31389
+ [126567, 126570],
31390
+ [126572, 126578],
31391
+ [126580, 126583],
31392
+ [126585, 126588],
31393
+ [126590, 126590],
31394
+ [126592, 126601],
31395
+ [126603, 126619],
31396
+ [126625, 126627],
31397
+ [126629, 126633],
31398
+ [126635, 126651],
31399
+ [130032, 130041],
31400
+ [131072, 173791],
31401
+ [173824, 177977],
31402
+ [177984, 178205],
31403
+ [178208, 183969],
31404
+ [183984, 191456],
31405
+ [191472, 192093],
31406
+ [194560, 195101],
31407
+ [196608, 201546],
31408
+ [201552, 205743],
31409
+ [917760, 917999]
31410
+ ];
31411
+ }
31412
+ });
31413
+
29689
31414
  // dist/duplicate-token-normalization.js
31415
+ function characterClassSource(ranges) {
31416
+ const escape2 = (codePoint) => `\\u{${codePoint.toString(16)}}`;
31417
+ return ranges.map(([from, to]) => from === to ? escape2(from) : `${escape2(from)}-${escape2(to)}`).join("");
31418
+ }
29690
31419
  function tokenizeDuplicateSource(text) {
29691
31420
  return text.match(duplicateTokenPattern) ?? [];
29692
31421
  }
@@ -29736,12 +31465,13 @@ function hasUnterminatedQuotedLiteral(text) {
29736
31465
  }
29737
31466
  return false;
29738
31467
  }
29739
- var duplicateTokenPattern, identifierTokenPattern;
31468
+ var DUPLICATE_TOKENIZER_IDENTIFIER_SOURCE, duplicateTokenPattern, identifierTokenPattern;
29740
31469
  var init_duplicate_token_normalization = __esm({
29741
31470
  "dist/duplicate-token-normalization.js"() {
29742
31471
  "use strict";
29743
31472
  init_duplicate_keywords();
29744
- init_identifiers();
31473
+ init_duplicate_identifier_ranges();
31474
+ DUPLICATE_TOKENIZER_IDENTIFIER_SOURCE = `[${characterClassSource(DUPLICATE_IDENTIFIER_START_RANGES)}](?:[${characterClassSource(DUPLICATE_IDENTIFIER_CONTINUE_RANGES)}])*`;
29745
31475
  duplicateTokenPattern = new RegExp([
29746
31476
  String.raw`"(?:\\.|[^"\\])*"`,
29747
31477
  String.raw`'(?:\\.|[^'\\])*'`,
@@ -30779,23 +32509,38 @@ function transformPersistedExportFromModule(projectRoot, entry, toRelative) {
30779
32509
  entry.fromModule = assertFilePathWithinRoot(projectRoot, cacheAbsolutePath(projectRoot, entry.fromModule), "Persisted cache path");
30780
32510
  }
30781
32511
  function transformModulePaths(projectRoot, module2, toRelative) {
30782
- const copy = structuredClone(module2);
30783
32512
  const transform2 = (file2) => toRelative ? cacheRelativePath(projectRoot, file2) : assertFilePathWithinRoot(projectRoot, cacheAbsolutePath(projectRoot, file2), "Persisted cache path");
30784
- copy.file = transform2(copy.file);
30785
- for (const local of copy.locals)
30786
- local.file = transform2(local.file);
30787
- for (const entry of copy.exports) {
30788
- if (entry.type === "local") {
30789
- entry.target.file = transform2(entry.target.file);
30790
- } else {
30791
- transformPersistedExportFromModule(projectRoot, entry, toRelative);
32513
+ if (!toRelative) {
32514
+ module2.file = transform2(module2.file);
32515
+ for (const local of module2.locals)
32516
+ local.file = transform2(local.file);
32517
+ for (const entry of module2.exports) {
32518
+ if (entry.type === "local") {
32519
+ entry.target.file = transform2(entry.target.file);
32520
+ } else {
32521
+ transformPersistedExportFromModule(projectRoot, entry, false);
32522
+ }
30792
32523
  }
32524
+ for (const binding of module2.imports) {
32525
+ if (typeof binding.resolved === "string")
32526
+ binding.resolved = transform2(binding.resolved);
32527
+ }
32528
+ return module2;
30793
32529
  }
30794
- for (const binding of copy.imports) {
30795
- if (typeof binding.resolved === "string")
30796
- binding.resolved = transform2(binding.resolved);
30797
- }
30798
- return copy;
32530
+ return {
32531
+ ...module2,
32532
+ file: transform2(module2.file),
32533
+ locals: module2.locals.map((local) => ({ ...local, file: transform2(local.file) })),
32534
+ exports: module2.exports.map((entry) => {
32535
+ if (entry.type === "local") {
32536
+ return { ...entry, target: { ...entry.target, file: transform2(entry.target.file) } };
32537
+ }
32538
+ const copy = { ...entry };
32539
+ transformPersistedExportFromModule(projectRoot, copy, true);
32540
+ return copy;
32541
+ }),
32542
+ imports: module2.imports.map((binding) => typeof binding.resolved === "string" ? { ...binding, resolved: transform2(binding.resolved) } : binding)
32543
+ };
30799
32544
  }
30800
32545
  function tryLoadFromCache(projectRoot, file2, sig, opts, report, diskCacheAvailable = true) {
30801
32546
  const mode = opts?.cache ?? "off";
@@ -31409,7 +33154,7 @@ var init_unitCache = __esm({
31409
33154
  DUPLICATE_UNIT_CACHE_SCHEMA_VERSION = 2;
31410
33155
  DUPLICATE_UNIT_CACHE_TABLE = "duplicate_unit_cache";
31411
33156
  DUPLICATE_UNIT_CACHE_SCHEMA_VERSION_KEY = "duplicate_unit_cache.schema_version";
31412
- DUPLICATE_TOKENIZER_REVISION = 5;
33157
+ DUPLICATE_TOKENIZER_REVISION = 6;
31413
33158
  DUPLICATE_UNIT_CACHE_MAX_ROWS = 5e3;
31414
33159
  DUPLICATE_UNIT_CACHE_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1e3;
31415
33160
  DUPLICATE_UNIT_MEMORY_CACHE_MAX_ENTRIES = 2048;
@@ -49038,14 +50783,32 @@ function resolveManifestSymlinkDirectories(projectRoot, storedProjectRoot, direc
49038
50783
  }
49039
50784
  return [...resolvedDirectories];
49040
50785
  }
50786
+ async function gitIgnoreConfigFiles(projectRoot) {
50787
+ const gitRoot = await getGitRepositoryRoot(projectRoot);
50788
+ if (!gitRoot)
50789
+ return [];
50790
+ const submoduleDirectories = await listGitSubmoduleDirectories(gitRoot, { recurse: true });
50791
+ const sourceRoots = [projectRoot, gitRoot, ...submoduleDirectories];
50792
+ const gitignoreFiles = await Promise.all(sourceRoots.map(async (root) => await (0, import_fast_glob3.default)(["**/.gitignore"], {
50793
+ cwd: root,
50794
+ absolute: true,
50795
+ dot: true,
50796
+ ignore: DEFAULT_PROJECT_FILE_IGNORES
50797
+ })));
50798
+ const excludeFiles = await Promise.all([gitRoot, ...submoduleDirectories].map(async (root) => await listGitExcludeFiles(root)));
50799
+ return Array.from(/* @__PURE__ */ new Set([...gitignoreFiles.flat(), ...excludeFiles.flat().map(({ file: file2 }) => file2)])).sort();
50800
+ }
49041
50801
  async function computeConfigHash(projectRoot, logLevel) {
49042
50802
  try {
49043
- const configFiles = await (0, import_fast_glob3.default)([...DEFAULT_PROJECT_MANIFESTS, CODEGRAPH_CONFIG_FILE, "**/.gitignore"], {
49044
- cwd: projectRoot,
49045
- absolute: true,
49046
- dot: true,
49047
- ignore: DEFAULT_PROJECT_FILE_IGNORES
49048
- });
50803
+ const configFiles = Array.from(/* @__PURE__ */ new Set([
50804
+ ...await (0, import_fast_glob3.default)([...DEFAULT_PROJECT_MANIFESTS, CODEGRAPH_CONFIG_FILE, "**/.gitignore"], {
50805
+ cwd: projectRoot,
50806
+ absolute: true,
50807
+ dot: true,
50808
+ ignore: DEFAULT_PROJECT_FILE_IGNORES
50809
+ }),
50810
+ ...await gitIgnoreConfigFiles(projectRoot)
50811
+ ]));
49049
50812
  configFiles.sort();
49050
50813
  const hash2 = crypto8.createHash("sha1");
49051
50814
  let firstError;
@@ -50095,6 +51858,7 @@ function migrateProjectSnapshotPayload(value, currentRoot) {
50095
51858
  const migrated = transformSnapshotPaths(relative, currentRoot, false);
50096
51859
  migrated.version = PROJECT_SNAPSHOT_VERSION;
50097
51860
  migrated.projectRoot = serializedProjectRoot(currentRoot);
51861
+ delete migrated.projectFiles;
50098
51862
  return migrated;
50099
51863
  }
50100
51864
  function transformDetailedGraph(graph, root, toRelative) {
@@ -51082,7 +52846,7 @@ var init_project_snapshot = __esm({
51082
52846
  init_module_cache();
51083
52847
  init_location();
51084
52848
  SNAPSHOT_SYMBOL_KINDS = new Set(Object.values(SymbolKind));
51085
- PROJECT_SNAPSHOT_VERSION = 9;
52849
+ PROJECT_SNAPSHOT_VERSION = 10;
51086
52850
  BLOOM_FILTER_SNAPSHOT_VERSION = 4;
51087
52851
  BLOOM_FILTER_SNAPSHOT_FILENAME = "bloom-filters.json";
51088
52852
  BLOOM_FILTER_MIN_SIZE = 1e3;
@@ -51312,8 +53076,9 @@ import { performance as performance2 } from "node:perf_hooks";
51312
53076
  async function finalizeProjectIndex(args) {
51313
53077
  if (args.timings)
51314
53078
  args.timings.totalMs = Math.round(performance2.now() - args.totalStart);
51315
- const projectFiles = await (args.projectFiles ?? discoverProjectFiles(args.projectRoot, {
51316
- ...args.opts?.logLevel ? { logLevel: args.opts.logLevel } : {}
53079
+ const projectFiles = await (args.projectFiles ?? discoverProjectFilesWithGitCandidates(args.projectRoot, {
53080
+ ...args.opts?.logLevel ? { logLevel: args.opts.logLevel } : {},
53081
+ ...args.knownGitCandidates !== void 0 ? { knownGitCandidates: args.knownGitCandidates } : {}
51317
53082
  }));
51318
53083
  const languageExtensions = normalizeLanguageExtensions(args.opts?.languageExtensions);
51319
53084
  const parsed = retainedParsedCache(args.parsedMap, args.opts);
@@ -52769,13 +54534,26 @@ var init_esm_wrapper = __esm({
52769
54534
  var nativeWorkerPool_exports = {};
52770
54535
  __export(nativeWorkerPool_exports, {
52771
54536
  createNativeWorkerPool: () => createNativeWorkerPool,
52772
- resolveNativeWorkerPath: () => resolveNativeWorkerPath
54537
+ defaultNativeWorkerThreadCount: () => defaultNativeWorkerThreadCount,
54538
+ resolveNativeWorkerPath: () => resolveNativeWorkerPath,
54539
+ resolveNativeWorkerThreadCount: () => resolveNativeWorkerThreadCount
52773
54540
  });
54541
+ import os6 from "node:os";
52774
54542
  import fs21 from "node:fs";
52775
54543
  import { fileURLToPath as fileURLToPath4 } from "node:url";
52776
54544
  import path46 from "node:path";
54545
+ function defaultNativeWorkerThreadCount(availableParallelism = os6.availableParallelism()) {
54546
+ return Math.min(DEFAULT_NATIVE_THREAD_CAP, Math.max(1, Math.floor(availableParallelism * 0.75)));
54547
+ }
54548
+ function resolveNativeWorkerThreadCount(requested, availableParallelism = os6.availableParallelism()) {
54549
+ return resolveWorkerThreadCount({
54550
+ requested,
54551
+ defaultCount: defaultNativeWorkerThreadCount(availableParallelism),
54552
+ max: HARD_MAX_THREADS
54553
+ });
54554
+ }
52777
54555
  function resolveThreadCount(requested) {
52778
- return resolveWorkerThreadCount({ requested, max: HARD_MAX_THREADS });
54556
+ return resolveNativeWorkerThreadCount(requested);
52779
54557
  }
52780
54558
  function resolveNativeWorkerPath() {
52781
54559
  const selfDir = path46.dirname(fileURLToPath4(import.meta.url));
@@ -52802,13 +54580,14 @@ function createNativeWorkerPool(opts) {
52802
54580
  ...opts?.workerData === void 0 ? {} : { workerData: opts.workerData }
52803
54581
  });
52804
54582
  }
52805
- var HARD_MAX_THREADS;
54583
+ var HARD_MAX_THREADS, DEFAULT_NATIVE_THREAD_CAP;
52806
54584
  var init_nativeWorkerPool = __esm({
52807
54585
  "dist/worker/nativeWorkerPool.js"() {
52808
54586
  "use strict";
52809
54587
  init_esm_wrapper();
52810
54588
  init_workerThreads();
52811
54589
  HARD_MAX_THREADS = 64;
54590
+ DEFAULT_NATIVE_THREAD_CAP = 8;
52812
54591
  }
52813
54592
  });
52814
54593
 
@@ -52844,11 +54623,12 @@ function countNativeWorkerEligibleFiles(files, languageExtensions) {
52844
54623
  }
52845
54624
  return count;
52846
54625
  }
52847
- function buildWorkerTask(filePath, sup, source) {
54626
+ function buildWorkerTask(filePath, sup, source, includeBloomFilter = false) {
52848
54627
  return {
52849
54628
  filePath,
52850
54629
  languageId: sup.id,
52851
54630
  ...source !== void 0 ? { source, includeSourceInResult: false } : {},
54631
+ ...includeBloomFilter ? { includeBloomFilter: true } : {},
52852
54632
  importsQuery: getCachedNormalizedQuery(sup, "imports"),
52853
54633
  exportsQuery: getCachedNormalizedQuery(sup, "exports"),
52854
54634
  localsQuery: getCachedNormalizedQuery(sup, "locals"),
@@ -52867,7 +54647,8 @@ function workerResultToPrepared(result, sup, filePath, ownedSource) {
52867
54647
  nativeQueries: result.nativeResults,
52868
54648
  syntaxTree: result.syntaxTree,
52869
54649
  ...result.fallbackReason ? { nativeFallbackReason: result.fallbackReason } : {},
52870
- ...result.error ? { nativeError: result.error } : {}
54650
+ ...result.error ? { nativeError: result.error } : {},
54651
+ ...result.bloomFilter ? { workerBloomFilter: result.bloomFilter } : {}
52871
54652
  };
52872
54653
  }
52873
54654
  async function setupWorkerPool(opts, fileCount) {
@@ -52947,7 +54728,7 @@ function createOversizedNativeSourceFallback(file2, support, source) {
52947
54728
  nativeError: `source exceeds native byte limit (${bytes} > ${DEFAULT_NATIVE_SOURCE_MAX_BYTES})`
52948
54729
  };
52949
54730
  }
52950
- async function prepareFileContextForBuild(file2, support, opts, workerSetup, report, confinedRoot, lexicalRoot, trustedSource) {
54731
+ async function prepareFileContextForBuild(file2, support, opts, workerSetup, report, confinedRoot, lexicalRoot, trustedSource, includeBloomFilter = false) {
52951
54732
  const source = trustedSource ?? (confinedRoot ? await readConfinedUtf8File(confinedRoot, lexicalRoot ?? confinedRoot, file2) : void 0);
52952
54733
  if (source && Buffer.byteLength(source, "utf8") > DEFAULT_NATIVE_SOURCE_MAX_BYTES) {
52953
54734
  const prepared2 = createOversizedNativeSourceFallback(file2, support, source);
@@ -52959,7 +54740,7 @@ async function prepareFileContextForBuild(file2, support, opts, workerSetup, rep
52959
54740
  if (workerSetup.report)
52960
54741
  workerSetup.report.tasksSubmitted++;
52961
54742
  try {
52962
- const workerResult = await workerSetup.pool.run(buildWorkerTask(file2, support, source));
54743
+ const workerResult = await workerSetup.pool.run(buildWorkerTask(file2, support, source, includeBloomFilter));
52963
54744
  prepared = workerResultToPrepared(workerResult, support, file2, source);
52964
54745
  } catch (error51) {
52965
54746
  if (isNativeRequiredUnavailableError(error51) && error51 instanceof Error)
@@ -53250,7 +55031,7 @@ async function resolveCrossModuleSymbolExports(file2, mod2, support, projectRoot
53250
55031
  }
53251
55032
  }
53252
55033
  async function buildIndexedModuleForFile(args) {
53253
- const prepared = await prepareFileContextForBuild(args.file, args.support, args.opts, args.workerSetup, args.report, args.confinedRoot, args.projectRoot, args.trustedSource);
55034
+ const prepared = await prepareFileContextForBuild(args.file, args.support, args.opts, args.workerSetup, args.report, args.confinedRoot, args.projectRoot, args.trustedSource, !!args.bloomFilterCache);
53254
55035
  const { source, sup, nativeQueries, embeddedBlocks } = prepared;
53255
55036
  let tree;
53256
55037
  const graphOnlyLanguage = isGraphOnlyLanguage(sup.id), nativeSourceLimitFallback = prepared.nativeFallbackReason === "queryFailure" && !!prepared.nativeError?.startsWith("source exceeds native byte limit");
@@ -53289,7 +55070,7 @@ async function buildIndexedModuleForFile(args) {
53289
55070
  }
53290
55071
  const lacksParserContext = !nativeQueries && !tree;
53291
55072
  if (args.bloomFilterCache && !nativeSourceLimitFallback) {
53292
- const filter = buildBloomFilterFromSource(source, sup);
55073
+ const filter = prepared.workerBloomFilter ? BloomFilter.fromBuffer(Buffer.from(prepared.workerBloomFilter.bits), prepared.workerBloomFilter.size, prepared.workerBloomFilter.hashCount, prepared.workerBloomFilter.itemCount) : buildBloomFilterFromSource(source, sup);
53293
55074
  args.bloomFilterCache.set(args.file, filter);
53294
55075
  }
53295
55076
  const sharedImportOptions = {
@@ -53502,6 +55283,17 @@ function emitIndexLifecycleProgress(opts, phase, mode, total, elapsedMs2) {
53502
55283
  ...elapsedMs2 !== void 0 ? { elapsedMs: elapsedMs2 } : {}
53503
55284
  });
53504
55285
  }
55286
+ function emitIndexCheckActivity(opts, activity, current = 0, total = 0) {
55287
+ opts?.onProgress?.({
55288
+ type: "progress",
55289
+ phase: "update",
55290
+ mode: "check",
55291
+ message: activity,
55292
+ activity,
55293
+ current,
55294
+ total
55295
+ });
55296
+ }
53505
55297
  function buildConcurrency(opts) {
53506
55298
  return resolveWorkerThreadCount({ requested: Number(opts?.threads || 0), defaultCount: 8, max: 64 });
53507
55299
  }
@@ -53918,11 +55710,20 @@ async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpt
53918
55710
  const onSymlinkDirectoriesDiscovered = (directories) => {
53919
55711
  discoveredSymlinkDirectories = Array.from(directories);
53920
55712
  };
53921
- const discoveredFiles = await listProjectFiles(projectRoot, projectPatternsForLanguageExtensions(opts), {
55713
+ let discoveredGitCandidates;
55714
+ const onGitCandidatesDiscovered = (candidates) => {
55715
+ discoveredGitCandidates = candidates;
55716
+ };
55717
+ const onDiscoveryProgress = helperOpts?.reportDiscoveryProgress ? (progress) => emitIndexCheckActivity(opts, progress.activity, progress.current, progress.total) : void 0;
55718
+ if (helperOpts?.reportDiscoveryProgress)
55719
+ emitIndexCheckActivity(opts, "Discovering source files");
55720
+ const discoveredFiles = await listProjectFilesWithGitCandidates(projectRoot, projectPatternsForLanguageExtensions(opts), {
53922
55721
  ...opts?.discovery,
53923
55722
  ...opts?.logLevel ? { logLevel: opts.logLevel } : {},
53924
55723
  ...knownSymlinkDirectories !== void 0 ? { knownSymlinkDirectories } : {},
53925
- onSymlinkDirectoriesDiscovered
55724
+ onSymlinkDirectoriesDiscovered,
55725
+ onGitCandidatesDiscovered,
55726
+ ...onDiscoveryProgress ? { onDiscoveryProgress } : {}
53926
55727
  });
53927
55728
  const additionalFileCandidates = await normalizeIndexedFileInputsWithinRoot(projectRoot, opts?.additionalFiles ?? [], "Additional index file");
53928
55729
  const additionalFileExistence = await probePathExistence(additionalFileCandidates, buildConcurrency(opts));
@@ -53930,9 +55731,13 @@ async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpt
53930
55731
  const discoveredFileSet = new Set(discoveredFiles);
53931
55732
  const files = Array.from(/* @__PURE__ */ new Set([...discoveredFiles, ...additionalFiles]));
53932
55733
  const transientFiles = additionalFiles.filter((file2) => !discoveredFileSet.has(file2));
53933
- const projectFiles = await discoverProjectFiles(projectRoot, {
55734
+ if (helperOpts?.reportDiscoveryProgress)
55735
+ emitIndexCheckActivity(opts, "Discovering project metadata");
55736
+ const projectFiles = await discoverProjectFilesWithGitCandidates(projectRoot, {
53934
55737
  ...opts?.logLevel ? { logLevel: opts.logLevel } : {},
53935
- ...discoveredSymlinkDirectories !== void 0 ? { knownSymlinkDirectories: discoveredSymlinkDirectories } : {}
55738
+ ...discoveredSymlinkDirectories !== void 0 ? { knownSymlinkDirectories: discoveredSymlinkDirectories } : {},
55739
+ ...discoveredGitCandidates !== void 0 ? { knownGitCandidates: discoveredGitCandidates } : {},
55740
+ ...onDiscoveryProgress ? { onDiscoveryProgress } : {}
53936
55741
  });
53937
55742
  return await buildIndexFromFileListShared(projectRoot, files, opts, {
53938
55743
  manifestMode: useDiskCache ? "read-write" : "off",
@@ -54072,7 +55877,10 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
54072
55877
  manifestReport.reason = reason;
54073
55878
  manifestReport.reused = false;
54074
55879
  }
54075
- return await buildProjectIndexFromExport(projectRoot, opts, { ignoreExistingManifest: true });
55880
+ return await buildProjectIndexFromExport(projectRoot, opts, {
55881
+ ignoreExistingManifest: true,
55882
+ reportDiscoveryProgress: true
55883
+ });
54076
55884
  }
54077
55885
  const gitAvailable = await isGitRepo(projectRoot);
54078
55886
  const hasExplicitGitRange = !!opts?.gitBase || !!opts?.gitHead;
@@ -54093,7 +55901,10 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
54093
55901
  manifestReport.reused = false;
54094
55902
  }
54095
55903
  logWithLevel(opts?.logLevel, "warn", "Warning: Manifest commit is no longer available; rebuilding full index.");
54096
- const rebuiltIndex = await buildProjectIndexFromExport(projectRoot, opts, { ignoreExistingManifest: true });
55904
+ const rebuiltIndex = await buildProjectIndexFromExport(projectRoot, opts, {
55905
+ ignoreExistingManifest: true,
55906
+ reportDiscoveryProgress: true
55907
+ });
54097
55908
  if (manifestReport) {
54098
55909
  manifestReport.reason = "staleGitCommit";
54099
55910
  manifestReport.reused = false;
@@ -54111,7 +55922,10 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
54111
55922
  }
54112
55923
  if (mismatches > 0 || missing > 0) {
54113
55924
  logWithLevel(opts?.logLevel, "warn", `Warning: Manifest verification failed (mismatches: ${mismatches}, missing: ${missing}). Rebuilding full index.`);
54114
- return await buildProjectIndexFromExport(projectRoot, opts, { ignoreExistingManifest: true });
55925
+ return await buildProjectIndexFromExport(projectRoot, opts, {
55926
+ ignoreExistingManifest: true,
55927
+ reportDiscoveryProgress: true
55928
+ });
54115
55929
  }
54116
55930
  }
54117
55931
  const trackedEntries = sanitizeManifestEntriesForRoot(projectRoot, manifest.files);
@@ -54126,6 +55940,7 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
54126
55940
  const gitFiles = needsGitScan ? await listChangedFiles(projectRoot, buildIncrementalGitDiffOptions(opts)) : [];
54127
55941
  let untrackedFiles = [];
54128
55942
  let rediscoveredFiles = [];
55943
+ let discoveredGitCandidates;
54129
55944
  if (canUseIncrementalDiscoveryFastPath(gitAvailable, opts?.cacheStrict)) {
54130
55945
  try {
54131
55946
  untrackedFiles = (canReuseReconciliation ? opts?.reconciledUntrackedFiles : void 0) ?? await listUntrackedProjectFiles(projectRoot, opts?.discovery, gitAvailable);
@@ -54135,13 +55950,19 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
54135
55950
  manifestReport.reused = false;
54136
55951
  }
54137
55952
  logWithLevel(opts?.logLevel, "warn", "Warning: Failed to list untracked project files via Git; rebuilding full index.", error51);
54138
- return await buildProjectIndexFromExport(projectRoot, opts, { ignoreExistingManifest: true });
55953
+ return await buildProjectIndexFromExport(projectRoot, opts, {
55954
+ ignoreExistingManifest: true,
55955
+ reportDiscoveryProgress: true
55956
+ });
54139
55957
  }
54140
55958
  } else if (!opts?.filesAreProjectScope) {
54141
- rediscoveredFiles = await listProjectFiles(projectRoot, projectPatternsForLanguageExtensions(opts), {
55959
+ rediscoveredFiles = await listProjectFilesWithGitCandidates(projectRoot, projectPatternsForLanguageExtensions(opts), {
54142
55960
  ...opts?.discovery,
54143
55961
  ...opts?.logLevel ? { logLevel: opts.logLevel } : {},
54144
- ...!opts?.cacheStrict && manifest.symlinkDirectories !== void 0 ? { knownSymlinkDirectories: manifest.symlinkDirectories } : {}
55962
+ ...!opts?.cacheStrict && manifest.symlinkDirectories !== void 0 ? { knownSymlinkDirectories: manifest.symlinkDirectories } : {},
55963
+ onGitCandidatesDiscovered: (candidates) => {
55964
+ discoveredGitCandidates = candidates;
55965
+ }
54145
55966
  });
54146
55967
  }
54147
55968
  const candidateFiles = [
@@ -54241,8 +56062,9 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
54241
56062
  if (!snapshotLoad)
54242
56063
  return null;
54243
56064
  const snapshot = snapshotLoad.index;
54244
- snapshot.projectFiles ??= await discoverProjectFiles(projectRoot, {
54245
- ...opts?.logLevel ? { logLevel: opts.logLevel } : {}
56065
+ snapshot.projectFiles ??= await discoverProjectFilesWithGitCandidates(projectRoot, {
56066
+ ...opts?.logLevel ? { logLevel: opts.logLevel } : {},
56067
+ ...discoveredGitCandidates !== void 0 ? { knownGitCandidates: discoveredGitCandidates } : {}
54246
56068
  });
54247
56069
  if (opts?.cache) {
54248
56070
  snapshot.cacheMode = opts.cache;
@@ -54549,6 +56371,7 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
54549
56371
  modules,
54550
56372
  parsedMap,
54551
56373
  bloomFilterCache,
56374
+ ...discoveredGitCandidates !== void 0 ? { knownGitCandidates: discoveredGitCandidates } : {},
54552
56375
  manifestEntries: projectIndexManifestEntries2(
54553
56376
  // `manifestEntries` (a `ManifestFileEntry`) never carries `cacheSig` -- that field
54554
56377
  // only lives on `FileSignature`. Overlay each entry with the `cacheSig` this build
@@ -57808,13 +59631,13 @@ __export(skill_exports, {
57808
59631
  handleSkillCommand: () => handleSkillCommand
57809
59632
  });
57810
59633
  import fsp30 from "node:fs/promises";
57811
- import os6 from "node:os";
59634
+ import os7 from "node:os";
57812
59635
  import path53 from "node:path";
57813
59636
  function getBundledSkillDir(packageRoot) {
57814
59637
  const candidate = path53.join(packageRoot, "codegraph-skill", "codegraph");
57815
59638
  return pathExists(path53.join(candidate, "SKILL.md")) ? candidate : null;
57816
59639
  }
57817
- function getSkillTargetDirForAgent(agent, homeDir = os6.homedir(), env = process.env) {
59640
+ function getSkillTargetDirForAgent(agent, homeDir = os7.homedir(), env = process.env) {
57818
59641
  if (agent === "agents") {
57819
59642
  return path53.join(homeDir, ".agents", "skills", "codegraph");
57820
59643
  }
@@ -58033,7 +59856,7 @@ var init_skill = __esm({
58033
59856
  // dist/installer/locks.js
58034
59857
  import { createHash as createHash5, randomUUID as randomUUID3 } from "node:crypto";
58035
59858
  import fsp31, {} from "node:fs/promises";
58036
- import os7 from "node:os";
59859
+ import os8 from "node:os";
58037
59860
  import path54 from "node:path";
58038
59861
  function opencodeConfigHome(settings) {
58039
59862
  const configHome = settings.env.XDG_CONFIG_HOME?.trim();
@@ -58069,7 +59892,7 @@ function installerTransactionLockScopes(settings) {
58069
59892
  }
58070
59893
  function installerTransactionLockPath(scope) {
58071
59894
  const digest = createHash5("sha256").update(scope).digest("hex");
58072
- return path54.join(os7.tmpdir(), `codegraph-installer-${digest}.lock`);
59895
+ return path54.join(os8.tmpdir(), `codegraph-installer-${digest}.lock`);
58073
59896
  }
58074
59897
  async function withInstallerLeaseLock(lockPath, resourceName, operation) {
58075
59898
  const lock = await acquireInstallerLeaseLock(lockPath, resourceName);
@@ -58235,7 +60058,7 @@ var init_locks = __esm({
58235
60058
  // dist/installer/registry.js
58236
60059
  import { createHash as createHash6, randomUUID as randomUUID4 } from "node:crypto";
58237
60060
  import fsp32 from "node:fs/promises";
58238
- import os8 from "node:os";
60061
+ import os9 from "node:os";
58239
60062
  import path55 from "node:path";
58240
60063
  import { applyEdits, modify, parse as parseJsonc2 } from "jsonc-parser";
58241
60064
  function listInstallTargets() {
@@ -58984,7 +60807,7 @@ function installerSettings(options) {
58984
60807
  if (env === void 0)
58985
60808
  env = options.homeDir === void 0 ? process.env : {};
58986
60809
  return {
58987
- homeDir: options.homeDir ?? os8.homedir(),
60810
+ homeDir: options.homeDir ?? os9.homedir(),
58988
60811
  env
58989
60812
  };
58990
60813
  }
@@ -59321,7 +61144,7 @@ __export(doctor_exports, {
59321
61144
  formatDoctorSummary: () => formatDoctorSummary
59322
61145
  });
59323
61146
  import fs25 from "node:fs";
59324
- import os9 from "node:os";
61147
+ import os10 from "node:os";
59325
61148
  import path57 from "node:path";
59326
61149
  function statIfExists(filePath) {
59327
61150
  try {
@@ -59549,7 +61372,7 @@ function readCacheLocationField(configPath) {
59549
61372
  }
59550
61373
  }
59551
61374
  function readUserCacheLocation() {
59552
- const configRoot = process.platform === "win32" ? process.env.APPDATA?.trim() || path57.join(os9.homedir(), "AppData", "Roaming") : process.env.XDG_CONFIG_HOME?.trim() || path57.join(os9.homedir(), ".config");
61375
+ const configRoot = process.platform === "win32" ? process.env.APPDATA?.trim() || path57.join(os10.homedir(), "AppData", "Roaming") : process.env.XDG_CONFIG_HOME?.trim() || path57.join(os10.homedir(), ".config");
59553
61376
  return readCacheLocationField(path57.join(configRoot, "codegraph", "config.json"));
59554
61377
  }
59555
61378
  function readEffectiveCacheLocation(root) {
@@ -72138,9 +73961,10 @@ var init_packet = __esm({
72138
73961
  import fs32 from "node:fs/promises";
72139
73962
  import { brotliCompressSync as brotliCompressSync4, constants as zlibConstants4 } from "node:zlib";
72140
73963
  function compressQueryText(text) {
72141
- return brotliCompressSync4(text, {
73964
+ const compressed = brotliCompressSync4(text, {
72142
73965
  params: { [zlibConstants4.BROTLI_PARAM_QUALITY]: 4 }
72143
73966
  });
73967
+ return new Uint8Array(compressed.buffer, compressed.byteOffset, compressed.byteLength);
72144
73968
  }
72145
73969
  function normalizeQuerySearchText(input) {
72146
73970
  return input.replace(/([\p{Ll}\p{Nd}])(\p{Lu})/gu, "$1 $2").replace(/(\p{Lu}+)(\p{Lu}\p{Ll})/gu, "$1 $2").toLowerCase().replace(/[^\p{L}\p{N}\p{M}_]+/gu, " ").trim();
@@ -72982,12 +74806,19 @@ var init_sourceIdentity = __esm({
72982
74806
  // dist/agent/query-index/workerPool.js
72983
74807
  var workerPool_exports = {};
72984
74808
  __export(workerPool_exports, {
74809
+ QUERY_INDEX_WORKER_MIN_FILES: () => QUERY_INDEX_WORKER_MIN_FILES,
74810
+ prepareQueryIndexFiles: () => prepareQueryIndexFiles,
74811
+ prepareQueryIndexFilesInProcess: () => prepareQueryIndexFilesInProcess,
72985
74812
  prepareQueryIndexFilesInWorker: () => prepareQueryIndexFilesInWorker,
72986
- resolveQueryIndexWorkerPath: () => resolveQueryIndexWorkerPath
74813
+ resolveQueryIndexWorkerPath: () => resolveQueryIndexWorkerPath,
74814
+ shouldPrepareQueryIndexFilesInWorker: () => shouldPrepareQueryIndexFilesInWorker
72987
74815
  });
72988
74816
  import fs33 from "node:fs";
72989
74817
  import path75 from "node:path";
72990
74818
  import { fileURLToPath as fileURLToPath6 } from "node:url";
74819
+ function shouldPrepareQueryIndexFilesInWorker(fileCount, threadCount = resolveWorkerThreads()) {
74820
+ return threadCount > 1 && fileCount >= QUERY_INDEX_WORKER_MIN_FILES;
74821
+ }
72991
74822
  function resolveWorkerThreads() {
72992
74823
  return resolveWorkerThreadCount({ max: QUERY_INDEX_MAX_THREADS });
72993
74824
  }
@@ -73052,7 +74883,15 @@ async function prepareQueryIndexFilesInWorker(projectRoot, files) {
73052
74883
  await pool.destroy();
73053
74884
  }
73054
74885
  }
73055
- var QUERY_INDEX_MAX_THREADS;
74886
+ async function prepareQueryIndexFiles(projectRoot, files) {
74887
+ if (!files.length)
74888
+ return [];
74889
+ if (!shouldPrepareQueryIndexFilesInWorker(files.length)) {
74890
+ return await prepareQueryIndexFilesInProcess(projectRoot, files);
74891
+ }
74892
+ return await prepareQueryIndexFilesInWorker(projectRoot, files);
74893
+ }
74894
+ var QUERY_INDEX_MAX_THREADS, QUERY_INDEX_WORKER_MIN_FILES;
73056
74895
  var init_workerPool = __esm({
73057
74896
  "dist/agent/query-index/workerPool.js"() {
73058
74897
  "use strict";
@@ -73062,6 +74901,7 @@ var init_workerPool = __esm({
73062
74901
  init_paths2();
73063
74902
  init_workerThreads();
73064
74903
  QUERY_INDEX_MAX_THREADS = 4;
74904
+ QUERY_INDEX_WORKER_MIN_FILES = 512;
73065
74905
  }
73066
74906
  });
73067
74907
 
@@ -73146,8 +74986,8 @@ function buildMetadata(current) {
73146
74986
  }
73147
74987
  async function prepareFiles(projectRoot, files, diagnostics) {
73148
74988
  try {
73149
- const { prepareQueryIndexFilesInWorker: prepareQueryIndexFilesInWorker2 } = await Promise.resolve().then(() => (init_workerPool(), workerPool_exports));
73150
- const prepared = await prepareQueryIndexFilesInWorker2(projectRoot, files.map((file2) => ({
74989
+ const { prepareQueryIndexFiles: prepareQueryIndexFiles2 } = await Promise.resolve().then(() => (init_workerPool(), workerPool_exports));
74990
+ const prepared = await prepareQueryIndexFiles2(projectRoot, files.map((file2) => ({
73151
74991
  relativePath: file2.path,
73152
74992
  sourceIdentity: file2.sourceIdentity
73153
74993
  })));
@@ -102040,7 +103880,7 @@ var init_dist4 = __esm({
102040
103880
  });
102041
103881
 
102042
103882
  // dist/mcp/http.js
102043
- import os10 from "node:os";
103883
+ import os11 from "node:os";
102044
103884
  function getRequestPath(request) {
102045
103885
  return new URL(request.url ?? "/", "http://127.0.0.1").pathname;
102046
103886
  }
@@ -102243,11 +104083,11 @@ function isWildcardBindHost(host) {
102243
104083
  }
102244
104084
  function localInterfaceHostnames() {
102245
104085
  const hosts = /* @__PURE__ */ new Set();
102246
- const hostname3 = os10.hostname().trim().toLowerCase();
104086
+ const hostname3 = os11.hostname().trim().toLowerCase();
102247
104087
  if (hostname3) {
102248
104088
  hosts.add(hostname3);
102249
104089
  }
102250
- const interfaces = os10.networkInterfaces();
104090
+ const interfaces = os11.networkInterfaces();
102251
104091
  for (const entries of Object.values(interfaces)) {
102252
104092
  for (const entry of entries ?? []) {
102253
104093
  if (entry.internal)
@@ -106287,7 +108127,7 @@ var init_artifact3 = __esm({
106287
108127
  // dist/drift/git.js
106288
108128
  import { execFile } from "node:child_process";
106289
108129
  import fsp42 from "node:fs/promises";
106290
- import os11 from "node:os";
108130
+ import os12 from "node:os";
106291
108131
  import path91 from "node:path";
106292
108132
  import { promisify } from "node:util";
106293
108133
  function snapshotOptions(options) {
@@ -106326,7 +108166,7 @@ async function materializeGitRef(root, ref, prefix) {
106326
108166
  }
106327
108167
  if (checkoutRef === void 0 || checkoutRef === "." || isGitWorktreeSentinel(checkoutRef))
106328
108168
  return { root };
106329
- const tempRoot = await fsp42.mkdtemp(path91.join(os11.tmpdir(), prefix));
108169
+ const tempRoot = await fsp42.mkdtemp(path91.join(os12.tmpdir(), prefix));
106330
108170
  try {
106331
108171
  await execFileAsync("git", ["clone", "--quiet", "--no-checkout", root, tempRoot], { env: process.env });
106332
108172
  const checkoutCommit = await resolveGitCommit(root, checkoutRef);