pi-lens 4.4.4 → 4.4.6

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 (191) hide show
  1. package/CHANGELOG.md +477 -0
  2. package/README.md +45 -3
  3. package/config/biome/core.jsonc +3 -3
  4. package/config/dependency-cruiser-eager-allowlist.json +1 -0
  5. package/dist/{chunk-UBOQLVT2.js → chunk-2DDDCJDL.js} +4 -4
  6. package/dist/{chunk-RKKOYPRA.js → chunk-2DMLM3ZO.js} +13 -15
  7. package/dist/chunk-2F47TQOA.js +73 -0
  8. package/dist/{chunk-O4NWQT6I.js → chunk-2PHMIAKO.js} +4 -4
  9. package/dist/{chunk-DGUKIYSI.js → chunk-2RLWJO5K.js} +8 -10
  10. package/dist/{chunk-S67KYG37.js → chunk-2X4VLOCC.js} +2 -2
  11. package/dist/{chunk-TIQ2PKDW.js → chunk-3MYEA7QD.js} +4 -4
  12. package/dist/{chunk-3DA2JDOL.js → chunk-3WEPUD2V.js} +551 -203
  13. package/dist/{chunk-AMERCH6V.js → chunk-4AVZ3TG7.js} +15 -16
  14. package/dist/{chunk-IYNJ6YPZ.js → chunk-4PCQCU47.js} +4 -4
  15. package/dist/chunk-4WX4CTUE.js +57 -0
  16. package/dist/{chunk-P63GXC37.js → chunk-5APMQ2IJ.js} +31 -4
  17. package/dist/{chunk-ZIVJBOO3.js → chunk-5CV5ITZF.js} +2 -2
  18. package/dist/{chunk-6DLWKFEX.js → chunk-5ZR3APIM.js} +41 -42
  19. package/dist/{chunk-XTBDCR27.js → chunk-63RIVFQI.js} +4 -4
  20. package/dist/{chunk-GSLNCYGG.js → chunk-75SY4F24.js} +13 -14
  21. package/dist/{chunk-U44DJXQP.js → chunk-7RQXA5GG.js} +15 -18
  22. package/dist/chunk-A3YNG5KP.js +45 -0
  23. package/dist/{chunk-5OFV52AM.js → chunk-AE37FEGH.js} +1 -1
  24. package/dist/{chunk-BWD5EPKO.js → chunk-AMXIUN2R.js} +4 -6
  25. package/dist/{chunk-3KAZU3VR.js → chunk-ARD426WI.js} +2 -2
  26. package/dist/{chunk-BW5KFIQC.js → chunk-AWQWXSW4.js} +1 -0
  27. package/dist/{chunk-YH5MVY2U.js → chunk-BHUWL2Y3.js} +7 -7
  28. package/dist/{chunk-CT4MN5IU.js → chunk-BI5LAQ3Y.js} +353 -359
  29. package/dist/{chunk-KAPJINKN.js → chunk-BM5GS6ZH.js} +2 -2
  30. package/dist/{chunk-TLX72JTG.js → chunk-BWYQUPOS.js} +1 -1
  31. package/dist/chunk-CFRQMBGP.js +49 -0
  32. package/dist/{chunk-RMLC67LF.js → chunk-CJYKEW2L.js} +2 -30
  33. package/dist/chunk-CKEQFGLT.js +32 -0
  34. package/dist/{chunk-IWDLU6K3.js → chunk-DC4CFXM5.js} +4 -6
  35. package/dist/{chunk-ZVUL7QYY.js → chunk-DMSLNKF7.js} +29 -32
  36. package/dist/{chunk-KN35K52N.js → chunk-DQXSPYRI.js} +3 -3
  37. package/dist/{chunk-HYGZEMX6.js → chunk-EVDGNG4F.js} +11 -5
  38. package/dist/{chunk-SRYEJNES.js → chunk-F5Z6URKM.js} +2 -2
  39. package/dist/{chunk-UMS2MFPZ.js → chunk-F6X3YJWD.js} +2 -3
  40. package/dist/{chunk-XYURS6EN.js → chunk-FA5LDARD.js} +15 -17
  41. package/dist/{chunk-24AKHFGP.js → chunk-FFL3A2VP.js} +6 -6
  42. package/dist/chunk-FJIVKLPH.js +31 -0
  43. package/dist/chunk-G2B7F6ZU.js +88 -0
  44. package/dist/{chunk-US7ECLD7.js → chunk-GAACZY6R.js} +131 -41
  45. package/dist/{chunk-MZGQNL3Y.js → chunk-GMTFDAOK.js} +12 -13
  46. package/dist/{chunk-VOOAPROD.js → chunk-GNSIWBAT.js} +3 -3
  47. package/dist/chunk-GTAI2J6U.js +27 -0
  48. package/dist/{chunk-RVK72CZX.js → chunk-GZE7WOI4.js} +1362 -459
  49. package/dist/{chunk-IUE7SSKV.js → chunk-H7HTEQUZ.js} +13 -7
  50. package/dist/{chunk-EUXZEFTV.js → chunk-HK6JVFZC.js} +3 -3
  51. package/dist/chunk-IPDG45G5.js +26 -0
  52. package/dist/{chunk-5HSRT26B.js → chunk-J6JP25XU.js} +16 -15
  53. package/dist/{chunk-HWCCCQNX.js → chunk-JL6CXUMW.js} +13 -6
  54. package/dist/{chunk-EBC36LNN.js → chunk-K2YGBXOA.js} +17 -17
  55. package/dist/{chunk-WMYE35PX.js → chunk-KLQVC3XC.js} +7 -5
  56. package/dist/{chunk-ATKJFDQN.js → chunk-KSR7RGQY.js} +12 -14
  57. package/dist/{chunk-POMLXPMY.js → chunk-KXF5R4UN.js} +1 -1
  58. package/dist/{chunk-LLJNQKQW.js → chunk-LEJOJDXL.js} +20 -13
  59. package/dist/{chunk-JUKMK5Y4.js → chunk-MA77RSFN.js} +10 -11
  60. package/dist/{chunk-GAQ7OQG6.js → chunk-MKVZQUEG.js} +85 -96
  61. package/dist/{chunk-2EECBNC5.js → chunk-MN7MHUXQ.js} +75 -0
  62. package/dist/{chunk-DEL2U6CM.js → chunk-MT6BVNFW.js} +16 -14
  63. package/dist/chunk-NDMCVUYK.js +507 -0
  64. package/dist/{chunk-HRNHZA3N.js → chunk-NIU2IPC5.js} +12 -16
  65. package/dist/{chunk-AGSS7277.js → chunk-NNKXDXXS.js} +7 -24
  66. package/dist/{chunk-V35JG4JB.js → chunk-OJLTLYHB.js} +152 -334
  67. package/dist/{chunk-J6MPGQTS.js → chunk-OLAWH5UQ.js} +81 -15
  68. package/dist/{chunk-T57LYLZT.js → chunk-OOU2WZZE.js} +1 -1
  69. package/dist/{chunk-CYRKQRPM.js → chunk-OSTKYB55.js} +2 -4
  70. package/dist/chunk-P4QNXS6I.js +27 -0
  71. package/dist/chunk-PKES3ISE.js +297 -0
  72. package/dist/{chunk-ROYSX2S5.js → chunk-PO45POGF.js} +2 -2
  73. package/dist/{chunk-T7FEBKXN.js → chunk-PPIBVH4R.js} +7 -9
  74. package/dist/{chunk-3RKP3FMS.js → chunk-PQJFG24Z.js} +295 -23
  75. package/dist/{chunk-KUA4OJ5Y.js → chunk-Q3UZHW6N.js} +846 -350
  76. package/dist/{chunk-N5FLEO7W.js → chunk-Q4EMRFNA.js} +37 -37
  77. package/dist/{chunk-5IUSNGOC.js → chunk-Q4FCYCRE.js} +28 -21
  78. package/dist/chunk-Q6D6VMI4.js +22 -0
  79. package/dist/{chunk-UZ2XCLYS.js → chunk-QGSTQH4D.js} +8 -8
  80. package/dist/{chunk-DUO2TU77.js → chunk-RZOXUSPC.js} +10 -4
  81. package/dist/{chunk-JMYYOTQG.js → chunk-S26LC76R.js} +13 -1
  82. package/dist/{chunk-GMX5OS7B.js → chunk-S67UJDGQ.js} +11 -12
  83. package/dist/chunk-SCIUNBPF.js +44 -0
  84. package/dist/{chunk-RKBXZN3A.js → chunk-SJJYRZB4.js} +2 -2
  85. package/dist/chunk-SXGD4ANG.js +25 -0
  86. package/dist/{chunk-YCWYO6TQ.js → chunk-T7FTXGS3.js} +48 -45
  87. package/dist/{chunk-FM4RDMKT.js → chunk-TIQJPRDD.js} +115 -61
  88. package/dist/{chunk-XHJBS436.js → chunk-TIYGSODX.js} +25 -25
  89. package/dist/{chunk-S2HEXIWI.js → chunk-U2SDMG7C.js} +10 -6
  90. package/dist/{chunk-2KXTHF3M.js → chunk-U6OC3QEM.js} +253 -33
  91. package/dist/{chunk-AWSCPCN2.js → chunk-UCGQT677.js} +19 -19
  92. package/dist/chunk-UHGF5UT5.js +32 -0
  93. package/dist/{chunk-JW3YWBVB.js → chunk-UN4TEBWN.js} +17 -19
  94. package/dist/{chunk-ZHH37KZL.js → chunk-V3APN3DY.js} +17 -17
  95. package/dist/{chunk-ED36RF6Y.js → chunk-V63BC55Q.js} +1 -1
  96. package/dist/{chunk-XBJVAEEO.js → chunk-VG5JS5SW.js} +3 -2
  97. package/dist/{chunk-W66O5E25.js → chunk-VPBIMOAQ.js} +13 -15
  98. package/dist/chunk-VQH24FIP.js +37 -0
  99. package/dist/{chunk-YNE3RP52.js → chunk-VSFLRN5Y.js} +8 -1
  100. package/dist/{chunk-7D6L4MTX.js → chunk-W2V54OCL.js} +3 -3
  101. package/dist/{chunk-2FN63LPV.js → chunk-W5LGKNET.js} +13 -14
  102. package/dist/{chunk-IQWN5JCP.js → chunk-W5R5SABV.js} +13 -14
  103. package/dist/{chunk-R3T7CLQ2.js → chunk-WIZWZR4C.js} +41 -41
  104. package/dist/{chunk-TOY6QKOH.js → chunk-WQOIR3QY.js} +17 -17
  105. package/dist/{chunk-Y6GZHWSJ.js → chunk-XAIT2YGS.js} +6 -6
  106. package/dist/chunk-XCUHKYCQ.js +23 -0
  107. package/dist/{chunk-GSM5UU7A.js → chunk-XQCSWV2G.js} +44 -35
  108. package/dist/{chunk-OHKJ7PQF.js → chunk-YBSONGSZ.js} +43 -39
  109. package/dist/{chunk-GXFV6MYU.js → chunk-YISME6ON.js} +72 -39
  110. package/dist/chunk-YRD4ISED.js +30 -0
  111. package/dist/{chunk-SD4I7ZO4.js → chunk-YSBHPOY6.js} +43 -53
  112. package/dist/{chunk-QBFBRV2B.js → chunk-Z2XAOKHK.js} +4 -2
  113. package/dist/{chunk-5VSF4UUQ.js → chunk-Z7IGUAXL.js} +34 -39
  114. package/dist/{chunk-MPNJLASA.js → chunk-ZKXQKGWZ.js} +10 -13
  115. package/dist/{chunk-J64T55EI.js → chunk-ZQ6NZZTB.js} +75 -9
  116. package/dist/chunk-ZUUI3ZSA.js +38 -0
  117. package/dist/{chunk-7HXE67BN.js → chunk-ZYNI26MI.js} +2 -2
  118. package/dist/index.js +32674 -27567
  119. package/dist/mcp/analyze-cli.js +11 -12
  120. package/dist/mcp/cli.js +46 -45
  121. package/dist/mcp/server.js +1210 -574
  122. package/dist/mcp/worker.js +65 -65
  123. package/dist/probes/installer.js +21 -23
  124. package/docs/adr/0010-trace-validation-session-lifecycle.md +390 -0
  125. package/docs/adr/README.md +1 -0
  126. package/docs/agent-tools.md +28 -7
  127. package/docs/ast-grep_rules_catalog.md +5 -3
  128. package/docs/configuration.md +12 -1
  129. package/docs/defect-shapes.md +738 -0
  130. package/docs/engineering-principles.md +12 -0
  131. package/docs/environment-variables.md +20 -0
  132. package/docs/features.md +16 -1
  133. package/docs/globalconfig.md +37 -8
  134. package/docs/invariants/caches-stores.md +30 -0
  135. package/docs/invariants/dispatch-runners.md +164 -0
  136. package/docs/invariants/git-guard-host.md +53 -0
  137. package/docs/invariants/language-config.md +31 -0
  138. package/docs/invariants/lsp-trust-exec.md +286 -0
  139. package/docs/invariants/paths-os.md +59 -0
  140. package/docs/invariants/session-telemetry.md +74 -0
  141. package/docs/lsp-capability-matrix.md +105 -12
  142. package/docs/lsp-idle-eviction.md +37 -18
  143. package/docs/pi-lens-fixer.md +24 -2
  144. package/docs/pi-lens-investigator.md +14 -0
  145. package/docs/pi-lens-merge-policy.md +32 -17
  146. package/docs/pi-lens-monitor.md +66 -10
  147. package/docs/pi-lens-orchestration.md +41 -0
  148. package/docs/pi-lens-release.md +20 -0
  149. package/docs/pi-lens-retro.md +5 -4
  150. package/docs/pi-lens-reviewer.md +54 -7
  151. package/docs/pi-lens-subagent.md +10 -3
  152. package/docs/release-qa-baseline.md +19 -7
  153. package/docs/servercapabilities.md +47 -47
  154. package/docs/settings.md +9 -5
  155. package/docs/subagent-compat.md +1 -1
  156. package/docs/usage.md +1 -0
  157. package/package.json +8 -5
  158. package/rules/ast-grep-rules/rule-tests/no-return-value-in-generator-test.yml +17 -0
  159. package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-js-test.yml +86 -0
  160. package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-test.yml +86 -0
  161. package/rules/ast-grep-rules/rule-tests/unchecked-numeric-parse-python-test.yml +15 -0
  162. package/rules/ast-grep-rules/rules/no-return-value-in-generator.yml +9 -4
  163. package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +119 -0
  164. package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +119 -0
  165. package/rules/ast-grep-rules/rules/unchecked-numeric-parse-python.yml +13 -2
  166. package/rules/rule-catalog.json +25 -1
  167. package/scripts/analyze-pi-lens-logs.mjs +15 -5
  168. package/scripts/lib/is-main-module.mjs +27 -0
  169. package/scripts/lib/scratch-home-env.mjs +21 -0
  170. package/scripts/rpc-load-check.mjs +4 -6
  171. package/scripts/warm-loader-cache.mjs +2 -5
  172. package/dist/chunk-3PTHXJXR.js +0 -28
  173. package/dist/chunk-3QED2P4V.js +0 -31
  174. package/dist/chunk-5WRPDP2A.js +0 -47
  175. package/dist/chunk-ABBOA7UD.js +0 -157
  176. package/dist/chunk-CUHSHSB6.js +0 -273
  177. package/dist/chunk-GL5LUMZE.js +0 -51
  178. package/dist/chunk-HAD7QRQI.js +0 -30
  179. package/dist/chunk-JORED7EX.js +0 -44
  180. package/dist/chunk-KYUB6QDC.js +0 -72
  181. package/dist/chunk-LZSEQW6A.js +0 -57
  182. package/dist/chunk-M2IFVFWU.js +0 -79
  183. package/dist/chunk-M2UD3LPU.js +0 -88
  184. package/dist/chunk-MBKQHGA7.js +0 -39
  185. package/dist/chunk-R7YOCSNV.js +0 -23
  186. package/dist/chunk-SKAMFC7A.js +0 -28
  187. package/dist/chunk-SYE6T2EB.js +0 -28
  188. package/dist/chunk-TRETHTQO.js +0 -26
  189. package/dist/chunk-UA7ZXYDR.js +0 -184
  190. package/dist/chunk-XTFDJI3T.js +0 -24
  191. package/dist/chunk-Z3CCVDUB.js +0 -76
@@ -14,7 +14,7 @@ import {
14
14
  findPiLensConfigMarkerInDir,
15
15
  getPiLensGlobalConfigPath,
16
16
  isResolvedGlobalConfigPath
17
- } from "./chunk-5HSRT26B.js";
17
+ } from "./chunk-J6JP25XU.js";
18
18
  import {
19
19
  DEGRADATION_ENTRIES_PER_KIND,
20
20
  GLOBAL_NON_FLAG_CONFIG_SECTIONS,
@@ -31,30 +31,29 @@ import {
31
31
  readFlagConfigValue,
32
32
  readToolConfig,
33
33
  recordDegradationOnce
34
- } from "./chunk-J64T55EI.js";
34
+ } from "./chunk-ZQ6NZZTB.js";
35
35
  import {
36
36
  logExtension
37
- } from "./chunk-POMLXPMY.js";
37
+ } from "./chunk-KXF5R4UN.js";
38
38
  import {
39
39
  CONFIG_SCHEMA_ANCHOR_KEY,
40
40
  CONFIG_SCHEMA_ID,
41
41
  DEPRECATED_CONFIG_SURFACES,
42
42
  STABILITY_TIER_KEY,
43
43
  withConfigDiagnosticCode
44
- } from "./chunk-JMYYOTQG.js";
44
+ } from "./chunk-S26LC76R.js";
45
45
  import {
46
46
  redactSecrets,
47
47
  toPositiveFinite
48
- } from "./chunk-YNE3RP52.js";
49
- import {
50
- BoundedLruCache
51
- } from "./chunk-ABBOA7UD.js";
48
+ } from "./chunk-VSFLRN5Y.js";
52
49
  import {
50
+ BoundedFifoMap,
51
+ BoundedLruCache,
53
52
  homeRelativePath,
54
- isAtOrAboveHomeDir,
55
53
  isWindowsPath,
54
+ realpathOrResolve,
56
55
  walkUpDirs
57
- } from "./chunk-3RKP3FMS.js";
56
+ } from "./chunk-PQJFG24Z.js";
58
57
 
59
58
  // dist/clients/generated-artifacts.js
60
59
  import * as fs from "node:fs";
@@ -313,6 +312,74 @@ function detectFileRole(filePath, content) {
313
312
  return "source";
314
313
  }
315
314
 
315
+ // dist/clients/path-keyed-map.js
316
+ var PathKeyedMap = class {
317
+ normalize;
318
+ store;
319
+ /**
320
+ * `maxEntries` bounds the map with insertion-order (FIFO) eviction, on
321
+ * `BoundedFifoMap` — the repo's one eviction implementation (#2442). Omit
322
+ * it for an unbounded map. A path-keyed map that needs a bound gets it
323
+ * here rather than hand-rolling `keys().next().value` at the call site,
324
+ * which is what `PartialApplyRecordStore` did before #2442's review round.
325
+ *
326
+ * FIFO, not LRU, and evicting AFTER the write, not before: a `set` of an
327
+ * already-resident path is an update, and must not drop an unrelated file
328
+ * to make room for a key that needs none.
329
+ */
330
+ constructor(normalize2, maxEntries) {
331
+ this.normalize = normalize2;
332
+ this.store = maxEntries === void 0 ? /* @__PURE__ */ new Map() : new BoundedFifoMap(maxEntries);
333
+ }
334
+ get size() {
335
+ return this.store.size;
336
+ }
337
+ get(path4) {
338
+ return this.store.get(this.normalize(path4))?.value;
339
+ }
340
+ has(path4) {
341
+ return this.store.has(this.normalize(path4));
342
+ }
343
+ set(path4, value) {
344
+ this.store.set(this.normalize(path4), { displayPath: path4, value });
345
+ return this;
346
+ }
347
+ delete(path4) {
348
+ if (this.store.delete(this.normalize(path4)))
349
+ return true;
350
+ for (const [key, entry] of this.store) {
351
+ if (entry.displayPath !== path4)
352
+ continue;
353
+ this.store.delete(key);
354
+ return true;
355
+ }
356
+ return false;
357
+ }
358
+ clear() {
359
+ this.store.clear();
360
+ }
361
+ *keys() {
362
+ for (const entry of this.store.values())
363
+ yield entry.displayPath;
364
+ }
365
+ *values() {
366
+ for (const entry of this.store.values())
367
+ yield entry.value;
368
+ }
369
+ *entries() {
370
+ for (const entry of this.store.values())
371
+ yield [entry.displayPath, entry.value];
372
+ }
373
+ forEach(callback) {
374
+ for (const entry of this.store.values()) {
375
+ callback(entry.value, entry.displayPath, this);
376
+ }
377
+ }
378
+ [Symbol.iterator]() {
379
+ return this.entries();
380
+ }
381
+ };
382
+
316
383
  // dist/clients/user-notify.js
317
384
  var notifierGetter;
318
385
  function notifyUserDegradation(message, level = "warning", options) {
@@ -2032,11 +2099,9 @@ function findPiLensConfigInDir(dir) {
2032
2099
  };
2033
2100
  }
2034
2101
  function findNestedProjectMutationValue(spec, editedFilePath, projectRoot, homeDir = os2.homedir()) {
2035
- const root = path3.resolve(projectRoot);
2036
- const start = path3.dirname(path3.resolve(editedFilePath));
2037
- for (const dir of walkUpDirs(start)) {
2038
- if (isAtOrAboveHomeDir(dir, homeDir))
2039
- break;
2102
+ const root = realpathOrResolve(projectRoot);
2103
+ const start = path3.dirname(realpathOrResolve(editedFilePath));
2104
+ for (const dir of walkUpDirs(start, { homeDir })) {
2040
2105
  const rel = path3.relative(root, dir);
2041
2106
  if (rel.startsWith("..") || path3.isAbsolute(rel))
2042
2107
  break;
@@ -2422,6 +2487,7 @@ export {
2422
2487
  classifyGeneratedOrArtifactDetailed,
2423
2488
  isTestFileName,
2424
2489
  detectFileRole,
2490
+ PathKeyedMap,
2425
2491
  notifyUserDegradation,
2426
2492
  warnIgnoredConfigOnce,
2427
2493
  isRepoTier,
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  withTreeSitterRoot
4
- } from "./chunk-US7ECLD7.js";
4
+ } from "./chunk-GAACZY6R.js";
5
5
 
6
6
  // dist/clients/dispatch/facts/tree-sitter-facts.js
7
7
  var withFactTree = withTreeSitterRoot;
@@ -1,11 +1,9 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  BoundedLruCache,
4
- BoundedSet
5
- } from "./chunk-ABBOA7UD.js";
6
- import {
4
+ BoundedSet,
7
5
  normalizeMapKey
8
- } from "./chunk-3RKP3FMS.js";
6
+ } from "./chunk-PQJFG24Z.js";
9
7
 
10
8
  // dist/clients/dispatch/fact-store.js
11
9
  var capacityEvictionReporter;
@@ -0,0 +1,27 @@
1
+ import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ RustClient,
4
+ resetRustAvailability,
5
+ rustClient
6
+ } from "./chunk-K2YGBXOA.js";
7
+ import "./chunk-EVDGNG4F.js";
8
+ import "./chunk-ARD426WI.js";
9
+ import "./chunk-5APMQ2IJ.js";
10
+ import "./chunk-Q3UZHW6N.js";
11
+ import "./chunk-AWQWXSW4.js";
12
+ import "./chunk-OLAWH5UQ.js";
13
+ import "./chunk-J6JP25XU.js";
14
+ import "./chunk-MN7MHUXQ.js";
15
+ import "./chunk-ZQ6NZZTB.js";
16
+ import "./chunk-KXF5R4UN.js";
17
+ import "./chunk-S26LC76R.js";
18
+ import "./chunk-Z2XAOKHK.js";
19
+ import "./chunk-VSFLRN5Y.js";
20
+ import "./chunk-LJDODBBZ.js";
21
+ import "./chunk-PQJFG24Z.js";
22
+ import "./chunk-NXL4FFQQ.js";
23
+ export {
24
+ RustClient,
25
+ resetRustAvailability,
26
+ rustClient
27
+ };
@@ -0,0 +1,297 @@
1
+ import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ findGoverningTsconfigDir,
4
+ getDirectoryMarkers,
5
+ registerWorkspaceTopologyReset
6
+ } from "./chunk-J6JP25XU.js";
7
+ import {
8
+ BoundedLruCache
9
+ } from "./chunk-PQJFG24Z.js";
10
+
11
+ // dist/clients/review-graph/tsconfig-paths.js
12
+ import * as fs from "node:fs";
13
+ import * as os from "node:os";
14
+ import * as path from "node:path";
15
+ var cache = new BoundedLruCache(64);
16
+ var referencesCache = new BoundedLruCache(64);
17
+ registerWorkspaceTopologyReset(() => {
18
+ cache.clear();
19
+ referencesCache.clear();
20
+ });
21
+ function stripTrailingCommas(content) {
22
+ let output = "";
23
+ let inString = false;
24
+ for (let i = 0; i < content.length; i++) {
25
+ const char = content[i];
26
+ if (inString) {
27
+ output += char;
28
+ if (char === "\\") {
29
+ output += content[i + 1] ?? "";
30
+ i++;
31
+ } else if (char === '"') {
32
+ inString = false;
33
+ }
34
+ continue;
35
+ }
36
+ if (char === '"') {
37
+ inString = true;
38
+ output += char;
39
+ continue;
40
+ }
41
+ if (char === ",") {
42
+ let lookahead = i + 1;
43
+ while (lookahead < content.length && /\s/.test(content[lookahead] ?? "")) {
44
+ lookahead++;
45
+ }
46
+ const next = content[lookahead];
47
+ if (next === "}" || next === "]")
48
+ continue;
49
+ }
50
+ output += char;
51
+ }
52
+ return output;
53
+ }
54
+ function parseJsonc(content) {
55
+ let output = "";
56
+ let inString = false;
57
+ let escaped = false;
58
+ for (let i = 0; i < content.length; i++) {
59
+ const char = content[i];
60
+ const next = content[i + 1];
61
+ if (inString) {
62
+ output += char;
63
+ if (escaped)
64
+ escaped = false;
65
+ else if (char === "\\")
66
+ escaped = true;
67
+ else if (char === '"')
68
+ inString = false;
69
+ continue;
70
+ }
71
+ if (char === '"') {
72
+ inString = true;
73
+ output += char;
74
+ } else if (char === "/" && next === "/") {
75
+ while (i < content.length && content[i] !== "\n")
76
+ i++;
77
+ output += "\n";
78
+ } else if (char === "/" && next === "*") {
79
+ i += 2;
80
+ while (i < content.length && !(content[i] === "*" && content[i + 1] === "/"))
81
+ i++;
82
+ i++;
83
+ } else {
84
+ output += char;
85
+ }
86
+ }
87
+ return JSON.parse(stripTrailingCommas(output));
88
+ }
89
+ function configSignature(configPath) {
90
+ try {
91
+ const stat = fs.statSync(configPath);
92
+ return `${stat.mtimeMs}:${stat.size}`;
93
+ } catch {
94
+ return "missing";
95
+ }
96
+ }
97
+ function configDependencyPaths(configPath) {
98
+ const paths = /* @__PURE__ */ new Set();
99
+ const visit = (currentPath) => {
100
+ const normalized = path.resolve(currentPath);
101
+ if (paths.has(normalized))
102
+ return;
103
+ paths.add(normalized);
104
+ let json;
105
+ try {
106
+ json = parseJsonc(fs.readFileSync(normalized, "utf8"));
107
+ } catch {
108
+ return;
109
+ }
110
+ if (typeof json.extends === "string") {
111
+ const parent = resolveExtends(normalized, json.extends);
112
+ if (parent)
113
+ visit(parent);
114
+ }
115
+ for (const reference of json.references ?? []) {
116
+ if (typeof reference?.path !== "string")
117
+ continue;
118
+ const referenced = resolveReferenceConfig(normalized, reference.path);
119
+ if (referenced)
120
+ visit(referenced);
121
+ }
122
+ };
123
+ visit(configPath);
124
+ return [...paths].sort((a, b) => a.localeCompare(b));
125
+ }
126
+ function dependencySignature(configPath) {
127
+ return configDependencyPaths(configPath).map((dependency) => `${dependency}:${configSignature(dependency)}`).join("|");
128
+ }
129
+ function resolveExtends(configPath, value) {
130
+ if (!value.startsWith("."))
131
+ return void 0;
132
+ const resolved = path.resolve(path.dirname(configPath), value);
133
+ return resolved.toLowerCase().endsWith(".json") ? resolved : `${resolved}.json`;
134
+ }
135
+ function readConfig(configPath, seen) {
136
+ const normalized = path.resolve(configPath);
137
+ if (seen.has(normalized))
138
+ return void 0;
139
+ seen.add(normalized);
140
+ let json;
141
+ try {
142
+ json = parseJsonc(fs.readFileSync(normalized, "utf8"));
143
+ } catch {
144
+ return void 0;
145
+ }
146
+ let inherited;
147
+ if (typeof json.extends === "string") {
148
+ const parentPath = resolveExtends(normalized, json.extends);
149
+ if (parentPath)
150
+ inherited = readConfig(parentPath, seen);
151
+ }
152
+ const options = json.compilerOptions;
153
+ const baseUrl = typeof options?.baseUrl === "string" ? path.resolve(path.dirname(normalized), options.baseUrl) : inherited?.baseUrl ?? path.dirname(normalized);
154
+ const paths = options?.paths && typeof options.paths === "object" ? Object.fromEntries(Object.entries(options.paths).map(([pattern, targets]) => [
155
+ pattern,
156
+ Array.isArray(targets) ? targets.map((target) => path.resolve(baseUrl, target)) : targets
157
+ ])) : inherited?.paths;
158
+ const rootDir = typeof options?.rootDir === "string" ? path.resolve(path.dirname(normalized), options.rootDir) : inherited?.rootDir;
159
+ const include = Array.isArray(json.include) ? json.include.filter((value) => typeof value === "string") : inherited?.include;
160
+ const references = Array.isArray(json.references) ? json.references.map((reference) => reference?.path).filter((value) => typeof value === "string" && value.startsWith(".")) : [];
161
+ return { baseUrl, paths, rootDir, include, references };
162
+ }
163
+ function resolveReferenceConfig(configPath, value) {
164
+ const target = path.resolve(path.dirname(configPath), value);
165
+ try {
166
+ if (fs.statSync(target).isDirectory()) {
167
+ return getDirectoryMarkers(target).tsconfigPath;
168
+ }
169
+ if (fs.statSync(target).isFile())
170
+ return target;
171
+ } catch {
172
+ return void 0;
173
+ }
174
+ return void 0;
175
+ }
176
+ function includeRoot(configDir, pattern) {
177
+ const wildcard = pattern.search(/[*?]/);
178
+ const prefix = wildcard === -1 ? pattern : pattern.slice(0, wildcard);
179
+ const trimmed = prefix.replace(/[\\/]+$/, "");
180
+ if (!trimmed)
181
+ return void 0;
182
+ const resolved = path.resolve(configDir, trimmed);
183
+ return path.extname(resolved) ? path.dirname(resolved) : resolved;
184
+ }
185
+ function firstSourceEntry(configPath, parsed) {
186
+ const configDir = path.dirname(configPath);
187
+ const roots = [
188
+ ...parsed.rootDir ? [parsed.rootDir] : [],
189
+ ...(parsed.include ?? []).map((pattern) => includeRoot(configDir, pattern)).filter((value) => value !== void 0)
190
+ ];
191
+ const candidates = [
192
+ ...roots.flatMap((root) => [
193
+ path.join(root, "index.ts"),
194
+ path.join(root, "index.tsx")
195
+ ]),
196
+ path.join(configDir, "src", "index.ts"),
197
+ path.join(configDir, "src", "index.tsx"),
198
+ path.join(configDir, "index.ts"),
199
+ path.join(configDir, "index.tsx")
200
+ ];
201
+ for (const candidate of candidates) {
202
+ try {
203
+ if (fs.statSync(candidate).isFile())
204
+ return candidate;
205
+ } catch {
206
+ }
207
+ }
208
+ return void 0;
209
+ }
210
+ function collectReferencedProjects(configPath, result, visited) {
211
+ const normalized = path.resolve(configPath);
212
+ if (visited.has(normalized))
213
+ return;
214
+ visited.add(normalized);
215
+ const parsed = readConfig(normalized, /* @__PURE__ */ new Set());
216
+ if (!parsed)
217
+ return;
218
+ for (const reference of parsed.references) {
219
+ const referencedConfig = resolveReferenceConfig(normalized, reference);
220
+ if (!referencedConfig)
221
+ continue;
222
+ const referenced = readConfig(referencedConfig, /* @__PURE__ */ new Set());
223
+ if (referenced) {
224
+ const packageJsonPath = getDirectoryMarkers(path.dirname(referencedConfig)).packageJsonPath;
225
+ const entry = firstSourceEntry(referencedConfig, referenced);
226
+ if (packageJsonPath && entry) {
227
+ try {
228
+ const pkg = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
229
+ if (typeof pkg.name === "string" && !result.has(pkg.name)) {
230
+ result.set(pkg.name, entry);
231
+ }
232
+ } catch {
233
+ }
234
+ }
235
+ }
236
+ collectReferencedProjects(referencedConfig, result, visited);
237
+ }
238
+ }
239
+ function parseTsconfigPaths(cwd, homeDir = os.homedir()) {
240
+ const normalizedCwd = path.resolve(cwd);
241
+ const configDir = findGoverningTsconfigDir(normalizedCwd, homeDir);
242
+ const configPath = configDir ? path.join(configDir, "tsconfig.json") : "";
243
+ const signature = configPath ? dependencySignature(configPath) : "missing";
244
+ const key = `${normalizedCwd}|${configPath}|${signature}`;
245
+ const cached = cache.get(key);
246
+ if (cached)
247
+ return cached;
248
+ if (!configDir) {
249
+ cache.set(key, []);
250
+ return [];
251
+ }
252
+ const parsed = readConfig(path.join(configDir, "tsconfig.json"), /* @__PURE__ */ new Set());
253
+ const matchers = Object.entries(parsed?.paths ?? {}).filter((entry) => Array.isArray(entry[1]) && entry[1].every((target) => typeof target === "string")).map(([pattern, targets]) => {
254
+ const star = pattern.indexOf("*");
255
+ return {
256
+ pattern,
257
+ prefix: star === -1 ? pattern : pattern.slice(0, star),
258
+ suffix: star === -1 ? "" : pattern.slice(star + 1),
259
+ targets
260
+ };
261
+ }).sort((a, b) => b.prefix.length - a.prefix.length);
262
+ cache.set(key, matchers);
263
+ return matchers;
264
+ }
265
+ function aliasedImportTargets(specifier, importerDir) {
266
+ for (const matcher of parseTsconfigPaths(importerDir)) {
267
+ if (!specifier.startsWith(matcher.prefix) || !specifier.endsWith(matcher.suffix))
268
+ continue;
269
+ const wildcard = specifier.slice(matcher.prefix.length, specifier.length - matcher.suffix.length);
270
+ if (!matcher.pattern.includes("*") && wildcard)
271
+ continue;
272
+ return matcher.targets.map((target) => target.replaceAll("*", wildcard));
273
+ }
274
+ return [];
275
+ }
276
+ function referencedProjectImportTarget(specifier, importerDir) {
277
+ const normalizedImporterDir = path.resolve(importerDir);
278
+ const governingDir = findGoverningTsconfigDir(normalizedImporterDir);
279
+ const governingPath = governingDir ? path.join(governingDir, "tsconfig.json") : "";
280
+ const key = `${normalizedImporterDir}|${governingPath}|${governingPath ? dependencySignature(governingPath) : "missing"}`;
281
+ let projects = referencesCache.get(key);
282
+ if (!projects) {
283
+ projects = /* @__PURE__ */ new Map();
284
+ const configDir = governingDir;
285
+ if (configDir) {
286
+ collectReferencedProjects(path.join(configDir, "tsconfig.json"), projects, /* @__PURE__ */ new Set());
287
+ }
288
+ referencesCache.set(key, projects);
289
+ }
290
+ return projects.get(specifier);
291
+ }
292
+
293
+ export {
294
+ parseJsonc,
295
+ aliasedImportTargets,
296
+ referencedProjectImportTarget
297
+ };
@@ -1,10 +1,10 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  createToolchainAvailability
4
- } from "./chunk-HYGZEMX6.js";
4
+ } from "./chunk-EVDGNG4F.js";
5
5
  import {
6
6
  createSubsystemLogger
7
- } from "./chunk-POMLXPMY.js";
7
+ } from "./chunk-KXF5R4UN.js";
8
8
 
9
9
  // dist/clients/go-client.js
10
10
  import * as path from "node:path";
@@ -3,7 +3,7 @@ import {
3
3
  deserializeWordIndex,
4
4
  recordPersistedWordIndexWireBytes,
5
5
  serializeWordIndex
6
- } from "./chunk-W66O5E25.js";
6
+ } from "./chunk-VPBIMOAQ.js";
7
7
  import {
8
8
  fingerprintProjectSnapshotJson
9
9
  } from "./chunk-2BEMIWEW.js";
@@ -15,22 +15,20 @@ import {
15
15
  getProjectDataDir,
16
16
  isStaleStageFile,
17
17
  withGenerationLockSync
18
- } from "./chunk-KUA4OJ5Y.js";
18
+ } from "./chunk-Q3UZHW6N.js";
19
19
  import {
20
20
  writeFileAtomic
21
- } from "./chunk-2EECBNC5.js";
21
+ } from "./chunk-MN7MHUXQ.js";
22
22
  import {
23
23
  incrementDegradationCount
24
- } from "./chunk-J64T55EI.js";
24
+ } from "./chunk-ZQ6NZZTB.js";
25
25
  import {
26
26
  logLatency
27
- } from "./chunk-QBFBRV2B.js";
28
- import {
29
- BoundedFifoMap
30
- } from "./chunk-ABBOA7UD.js";
27
+ } from "./chunk-Z2XAOKHK.js";
31
28
  import {
29
+ BoundedFifoMap,
32
30
  normalizeMapKey
33
- } from "./chunk-3RKP3FMS.js";
31
+ } from "./chunk-PQJFG24Z.js";
34
32
 
35
33
  // dist/clients/project-snapshot.js
36
34
  import * as fs3 from "node:fs";