pi-lens 4.4.3 → 4.4.5

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 (185) hide show
  1. package/CHANGELOG.md +721 -0
  2. package/README.md +25 -3
  3. package/config/dependency-cruiser-eager-allowlist.json +1 -0
  4. package/dist/chunk-22Y2BM7H.js +23 -0
  5. package/dist/{chunk-WU567RSC.js → chunk-27VWVB23.js} +16 -14
  6. package/dist/{chunk-FLKWCIZH.js → chunk-2FYKETQJ.js} +10 -6
  7. package/dist/{chunk-MQLUAEOC.js → chunk-2LDMXL2M.js} +2 -2
  8. package/dist/{chunk-YSZNHOBY.js → chunk-2SDHYHHO.js} +17 -17
  9. package/dist/chunk-2Y6OJRSI.js +38 -0
  10. package/dist/chunk-3SNDVPOR.js +507 -0
  11. package/dist/{chunk-EJIUXPBX.js → chunk-3WCEHYOI.js} +1 -1
  12. package/dist/chunk-44X7VIKR.js +73 -0
  13. package/dist/{chunk-Q7DUK4LX.js → chunk-4FHUGDKU.js} +16 -14
  14. package/dist/{chunk-H6MF6EVN.js → chunk-4ODSZ35Z.js} +1498 -534
  15. package/dist/{chunk-ZGDGW2V3.js → chunk-4U7GDSZQ.js} +2 -2
  16. package/dist/chunk-54NIOJJZ.js +25 -0
  17. package/dist/{chunk-ZWFS3OEF.js → chunk-5DKE4HGX.js} +38 -37
  18. package/dist/{chunk-VRZP76YM.js → chunk-5LRUKYFA.js} +34 -4
  19. package/dist/{chunk-QOBUHWHX.js → chunk-63NMUNYP.js} +12 -16
  20. package/dist/{chunk-VWCXW2E7.js → chunk-6XSESGWD.js} +13 -6
  21. package/dist/{chunk-QGQ5CCCG.js → chunk-72J27ICO.js} +2 -3
  22. package/dist/{chunk-CSHFH5IN.js → chunk-7FLRUH6B.js} +1 -1
  23. package/dist/chunk-7IYC4ENJ.js +297 -0
  24. package/dist/chunk-7WWQAW5P.js +30 -0
  25. package/dist/{chunk-EU63SDCG.js → chunk-7ZS7MC24.js} +885 -451
  26. package/dist/{chunk-KBG47GHP.js → chunk-AHWA4AKM.js} +18 -12
  27. package/dist/{chunk-FMSO6RDZ.js → chunk-AI3GP74G.js} +17 -19
  28. package/dist/chunk-APFJKOP6.js +67 -0
  29. package/dist/{chunk-RXCOMYPY.js → chunk-ASRAO7KG.js} +31 -33
  30. package/dist/{chunk-BW5KFIQC.js → chunk-AWQWXSW4.js} +1 -0
  31. package/dist/{chunk-QILIYSJF.js → chunk-CG5V25HX.js} +1 -1
  32. package/dist/chunk-CKEQFGLT.js +32 -0
  33. package/dist/{chunk-RPLINGVB.js → chunk-COOUUC5W.js} +6 -6
  34. package/dist/{chunk-GBPP5P7X.js → chunk-CPZ5JJW6.js} +4 -4
  35. package/dist/{chunk-OCAGUNBC.js → chunk-DS2USX5G.js} +13 -15
  36. package/dist/chunk-EA2ZRG44.js +27 -0
  37. package/dist/{chunk-ZHFZWTZV.js → chunk-EDMLIW6W.js} +13 -14
  38. package/dist/{chunk-2EECBNC5.js → chunk-EIKRZ32J.js} +75 -0
  39. package/dist/chunk-EKNWOL2I.js +27 -0
  40. package/dist/{chunk-CMMHNUZ2.js → chunk-ELZRSR5N.js} +65 -43
  41. package/dist/{chunk-BKE7E7TC.js → chunk-EN5AM7PX.js} +11 -12
  42. package/dist/{chunk-N2H3ZPZY.js → chunk-EWXXLS26.js} +227 -24
  43. package/dist/chunk-EX4EXBW7.js +37 -0
  44. package/dist/{chunk-YYOIQFRS.js → chunk-EXVXBSGN.js} +130 -52
  45. package/dist/{chunk-6GFRNVYR.js → chunk-F7BO6FWH.js} +12 -13
  46. package/dist/chunk-FEDWAYDS.js +2485 -0
  47. package/dist/{chunk-JAU72XNY.js → chunk-FWZRGGGY.js} +73 -9
  48. package/dist/{chunk-GXW6K4YJ.js → chunk-G224FADB.js} +1 -1
  49. package/dist/chunk-G5UCJFT7.js +26 -0
  50. package/dist/{chunk-67WMNWEE.js → chunk-GLW3YDZZ.js} +22 -13
  51. package/dist/{chunk-724UL2TJ.js → chunk-GTDSYEA2.js} +72 -39
  52. package/dist/{chunk-PHDMFAKM.js → chunk-GYRZ72R4.js} +10 -4
  53. package/dist/chunk-HYVXA3BB.js +49 -0
  54. package/dist/{chunk-SAEFPSB6.js → chunk-IEBJF3PN.js} +23 -15
  55. package/dist/chunk-IJYGIDF4.js +186 -0
  56. package/dist/{chunk-ACXEQZOU.js → chunk-IL7K66ZQ.js} +101 -109
  57. package/dist/{chunk-ZXYDQ3TZ.js → chunk-JWOVP5BL.js} +50 -19
  58. package/dist/{chunk-OXXKQCSV.js → chunk-K2GUZ4DN.js} +4 -4
  59. package/dist/{chunk-AW7R2GWG.js → chunk-K4SZB56V.js} +39 -39
  60. package/dist/{chunk-WOA4LN2R.js → chunk-KCBRHV5E.js} +3 -3
  61. package/dist/{chunk-3W7IEVVL.js → chunk-KFXCL4OV.js} +47 -45
  62. package/dist/{chunk-2BBLFX75.js → chunk-KJJAVH3X.js} +81 -15
  63. package/dist/{chunk-VCHXCQFG.js → chunk-KPVLQHCZ.js} +4 -6
  64. package/dist/{chunk-P7266HLM.js → chunk-KX56K73G.js} +10 -13
  65. package/dist/{chunk-VSSBEUFT.js → chunk-LMCTHJ2H.js} +19 -19
  66. package/dist/{chunk-IBGIOBEE.js → chunk-MEFLGBCS.js} +69 -8
  67. package/dist/{chunk-TYM6OUIT.js → chunk-MKPCELNI.js} +17 -17
  68. package/dist/{chunk-XTMJ7XDT.js → chunk-N3PLNNCW.js} +1 -1
  69. package/dist/chunk-N5FBM25N.js +22 -0
  70. package/dist/{chunk-CHOW74WE.js → chunk-NFNVDDGB.js} +7 -12
  71. package/dist/{chunk-52FUZI6K.js → chunk-NLIVE7L6.js} +2 -30
  72. package/dist/{chunk-SS36ZX4J.js → chunk-OMJ3OFBJ.js} +6 -6
  73. package/dist/{chunk-4W4VLAPJ.js → chunk-OZNCKLOX.js} +13 -14
  74. package/dist/chunk-P5XUGPIX.js +31 -0
  75. package/dist/{chunk-5UCAH366.js → chunk-PJXNTPB2.js} +253 -33
  76. package/dist/chunk-PKOXJIVT.js +88 -0
  77. package/dist/{chunk-6C7JWPCP.js → chunk-PP2A5V2T.js} +27 -26
  78. package/dist/{chunk-L3BLXZG7.js → chunk-Q42LJANT.js} +31 -70
  79. package/dist/{chunk-AB3YYG6N.js → chunk-Q4BKKOVC.js} +8 -8
  80. package/dist/{chunk-3EFKIGZN.js → chunk-QT66NEYN.js} +4 -4
  81. package/dist/{chunk-3VPVG5SU.js → chunk-RCHO5W7M.js} +19 -18
  82. package/dist/{chunk-77M37OKR.js → chunk-RG3MXTRI.js} +7 -7
  83. package/dist/chunk-RG7OODGM.js +57 -0
  84. package/dist/{chunk-T6CPIZNT.js → chunk-RU34BA4D.js} +44 -39
  85. package/dist/{chunk-JMYYOTQG.js → chunk-S26LC76R.js} +13 -1
  86. package/dist/{chunk-5NGR67U5.js → chunk-S55TEC7I.js} +33 -5
  87. package/dist/{chunk-M6HSLBWY.js → chunk-SJHC3BCZ.js} +7956 -8047
  88. package/dist/{chunk-XCJN5IJU.js → chunk-SNEUMLM7.js} +4 -4
  89. package/dist/{chunk-UZ3TUTRV.js → chunk-T4NGVFYI.js} +2 -2
  90. package/dist/{chunk-2VUQMUMT.js → chunk-THEXI2QO.js} +49 -43
  91. package/dist/{chunk-R3PCY3YS.js → chunk-TL2TCJYL.js} +15 -16
  92. package/dist/{chunk-C34ZXZ7O.js → chunk-TPYYEDP5.js} +838 -352
  93. package/dist/{chunk-AOHZU2BM.js → chunk-TVZRLTG6.js} +8 -1
  94. package/dist/{chunk-XMSXXAHW.js → chunk-UCVMSOXF.js} +2 -2
  95. package/dist/chunk-UL5SXQVX.js +32 -0
  96. package/dist/{chunk-GAEGEPOC.js → chunk-UO66IMVP.js} +2 -2
  97. package/dist/{chunk-N3X6Q4YT.js → chunk-UVY4TOJH.js} +3 -3
  98. package/dist/{chunk-2CD5RS6M.js → chunk-VIDEKABZ.js} +23 -2
  99. package/dist/{chunk-JSQFTSC6.js → chunk-VITFDI3O.js} +13 -14
  100. package/dist/{chunk-YIUAVF7E.js → chunk-VUAVE3QC.js} +42 -42
  101. package/dist/{chunk-QOZXJ4NA.js → chunk-WUY4BZEP.js} +21 -20
  102. package/dist/{chunk-VCO24T4L.js → chunk-X3UTCXAA.js} +43 -53
  103. package/dist/chunk-XHDBJODR.js +45 -0
  104. package/dist/{chunk-MXGY6KPT.js → chunk-XHLK33VM.js} +28 -21
  105. package/dist/{chunk-RWWYJ623.js → chunk-XI34NWDI.js} +2 -2
  106. package/dist/{chunk-QQNQ7SJW.js → chunk-XWFIHYCH.js} +12 -4
  107. package/dist/{chunk-6SDEP3AJ.js → chunk-Y2TPADJR.js} +10 -11
  108. package/dist/{chunk-MRXKYPCS.js → chunk-Y5KTA2OB.js} +17 -17
  109. package/dist/{chunk-7DYBLXYA.js → chunk-YKVDBNPO.js} +11 -5
  110. package/dist/{chunk-2B73ZPOK.js → chunk-YSDPVDFC.js} +3 -3
  111. package/dist/chunk-YWNO5Q4R.js +44 -0
  112. package/dist/{chunk-QHJ6DQ2R.js → chunk-YWWG4AQA.js} +165 -32
  113. package/dist/{chunk-3JNKMP3B.js → chunk-YXDCRUKQ.js} +4 -4
  114. package/dist/{chunk-UXGETRP4.js → chunk-YXGRRORB.js} +16 -17
  115. package/dist/{chunk-SQ4TVJBR.js → chunk-ZAPSUBLU.js} +13 -7
  116. package/dist/{chunk-76MWC2K6.js → chunk-ZPJM7DID.js} +90 -97
  117. package/dist/{chunk-XVF2VVXP.js → chunk-ZSUX7KEM.js} +16 -15
  118. package/dist/index.js +31038 -20893
  119. package/dist/mcp/analyze-cli.js +11 -11
  120. package/dist/mcp/cli.js +47 -43
  121. package/dist/mcp/server.js +2188 -906
  122. package/dist/mcp/worker.js +66 -63
  123. package/dist/probes/installer.js +21 -23
  124. package/dist/workers/project-snapshot-persist-worker.js +28 -9
  125. package/dist/workers/review-graph-persist-worker.js +1 -1
  126. package/docs/adr/0010-trace-validation-session-lifecycle.md +390 -0
  127. package/docs/adr/README.md +1 -0
  128. package/docs/ast-grep_rules_catalog.md +5 -3
  129. package/docs/configuration.md +20 -0
  130. package/docs/engineering-principles.md +44 -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/lsp-capability-matrix.md +105 -12
  135. package/docs/lsp-idle-eviction.md +44 -36
  136. package/docs/pi-lens-fixer.md +139 -14
  137. package/docs/pi-lens-investigator.md +14 -0
  138. package/docs/pi-lens-merge-policy.md +120 -17
  139. package/docs/pi-lens-monitor.md +71 -9
  140. package/docs/pi-lens-retro.md +6 -3
  141. package/docs/pi-lens-reviewer.md +160 -5
  142. package/docs/pi-lens-subagent.md +29 -14
  143. package/docs/release-qa-baseline.md +21 -7
  144. package/docs/servercapabilities.md +53 -63
  145. package/docs/settings.md +9 -5
  146. package/docs/subagent-compat.md +1 -1
  147. package/docs/usage.md +1 -0
  148. package/package.json +9 -5
  149. package/rules/ast-grep-rules/rule-tests/no-return-value-in-generator-test.yml +17 -0
  150. package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-js-test.yml +86 -0
  151. package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-test.yml +86 -0
  152. package/rules/ast-grep-rules/rule-tests/unchecked-numeric-parse-python-test.yml +15 -0
  153. package/rules/ast-grep-rules/rules/no-return-value-in-generator.yml +9 -4
  154. package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +119 -0
  155. package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +119 -0
  156. package/rules/ast-grep-rules/rules/unchecked-numeric-parse-python.yml +13 -2
  157. package/rules/rule-catalog.json +25 -1
  158. package/scripts/analyze-pi-lens-logs.mjs +15 -5
  159. package/scripts/download-grammars.js +40 -7
  160. package/scripts/lib/is-main-module.mjs +27 -0
  161. package/scripts/lib/latency-log-phases.mjs +95 -0
  162. package/scripts/lib/scratch-home-env.mjs +21 -0
  163. package/scripts/rpc-load-check.mjs +568 -81
  164. package/scripts/warm-loader-cache.mjs +2 -5
  165. package/dist/chunk-23WOO7TX.js +0 -23
  166. package/dist/chunk-3YN6V5TV.js +0 -85
  167. package/dist/chunk-466Z26MG.js +0 -30
  168. package/dist/chunk-4UNXBNE2.js +0 -24
  169. package/dist/chunk-6STA6Z7I.js +0 -47
  170. package/dist/chunk-ABBOA7UD.js +0 -157
  171. package/dist/chunk-BRGDSBJE.js +0 -28
  172. package/dist/chunk-EC47DWFA.js +0 -56
  173. package/dist/chunk-FCSOVF55.js +0 -273
  174. package/dist/chunk-IZSHAIJ7.js +0 -26
  175. package/dist/chunk-KDERNTCQ.js +0 -28
  176. package/dist/chunk-KSX3TXSZ.js +0 -69
  177. package/dist/chunk-LOP6GRPH.js +0 -31
  178. package/dist/chunk-PNQDPDRC.js +0 -184
  179. package/dist/chunk-UOPVJQ4N.js +0 -103
  180. package/dist/chunk-XAGLWMJ4.js +0 -51
  181. package/dist/chunk-XIJZVPD5.js +0 -39
  182. package/dist/chunk-Z3CCVDUB.js +0 -76
  183. package/dist/chunk-Z527N6YQ.js +0 -28
  184. package/dist/chunk-ZANLILYD.js +0 -79
  185. /package/dist/{chunk-FC4RP4I2.js → chunk-6HWVI6MI.js} +0 -0
@@ -1,80 +1,81 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  formatToolFailure
4
- } from "./chunk-2CD5RS6M.js";
5
- import "./chunk-UZ3TUTRV.js";
4
+ } from "./chunk-VIDEKABZ.js";
5
+ import "./chunk-T4NGVFYI.js";
6
6
  import {
7
7
  scannerReportParentDir
8
- } from "./chunk-CSHFH5IN.js";
8
+ } from "./chunk-7FLRUH6B.js";
9
9
  import {
10
10
  nestedWorktreeOffsets
11
- } from "./chunk-VCHXCQFG.js";
11
+ } from "./chunk-KPVLQHCZ.js";
12
12
  import {
13
13
  createAvailabilityChecker,
14
14
  findManagedNodeToolBinary,
15
15
  resolveAvailableOrInstall
16
- } from "./chunk-YSZNHOBY.js";
17
- import "./chunk-RPLINGVB.js";
18
- import "./chunk-EU63SDCG.js";
19
- import "./chunk-VWCXW2E7.js";
20
- import "./chunk-FCSOVF55.js";
21
- import "./chunk-PNQDPDRC.js";
22
- import "./chunk-ZXYDQ3TZ.js";
23
- import "./chunk-724UL2TJ.js";
24
- import "./chunk-QOZXJ4NA.js";
25
- import "./chunk-P7266HLM.js";
26
- import "./chunk-52FUZI6K.js";
27
- import "./chunk-SAEFPSB6.js";
16
+ } from "./chunk-2SDHYHHO.js";
17
+ import "./chunk-COOUUC5W.js";
18
+ import "./chunk-7ZS7MC24.js";
19
+ import "./chunk-6XSESGWD.js";
20
+ import "./chunk-3SNDVPOR.js";
21
+ import "./chunk-JWOVP5BL.js";
22
+ import "./chunk-7IYC4ENJ.js";
23
+ import "./chunk-KX56K73G.js";
24
+ import "./chunk-2Y6OJRSI.js";
25
+ import "./chunk-WUY4BZEP.js";
26
+ import "./chunk-GTDSYEA2.js";
27
+ import "./chunk-UL5SXQVX.js";
28
+ import "./chunk-CKEQFGLT.js";
29
+ import "./chunk-NLIVE7L6.js";
30
+ import "./chunk-IEBJF3PN.js";
28
31
  import {
29
32
  getJscpdMaxEntriesDerived
30
- } from "./chunk-GAEGEPOC.js";
31
- import "./chunk-Z3CCVDUB.js";
33
+ } from "./chunk-UO66IMVP.js";
32
34
  import "./chunk-2BEMIWEW.js";
33
- import "./chunk-ACXEQZOU.js";
34
- import "./chunk-Q7DUK4LX.js";
35
+ import "./chunk-IJYGIDF4.js";
36
+ import "./chunk-IL7K66ZQ.js";
37
+ import "./chunk-4FHUGDKU.js";
35
38
  import {
36
39
  findNodeToolBinary
37
- } from "./chunk-AW7R2GWG.js";
40
+ } from "./chunk-K4SZB56V.js";
38
41
  import {
39
42
  getIsolatedNpxSpawnOptions
40
- } from "./chunk-RWWYJ623.js";
41
- import "./chunk-VRZP76YM.js";
42
- import "./chunk-QOBUHWHX.js";
43
- import "./chunk-QILIYSJF.js";
44
- import "./chunk-6C7JWPCP.js";
43
+ } from "./chunk-XI34NWDI.js";
44
+ import "./chunk-5LRUKYFA.js";
45
+ import "./chunk-63NMUNYP.js";
46
+ import "./chunk-CG5V25HX.js";
47
+ import "./chunk-PP2A5V2T.js";
45
48
  import {
46
49
  shouldRecurseIntoDir,
47
50
  walkTreeStackSync
48
- } from "./chunk-5NGR67U5.js";
51
+ } from "./chunk-S55TEC7I.js";
49
52
  import {
50
53
  getExcludedDirGlobs,
51
54
  getProjectIgnoreGlobs,
52
55
  getProjectIgnoreMatcher,
53
56
  safeSpawnAsync
54
- } from "./chunk-C34ZXZ7O.js";
55
- import "./chunk-BW5KFIQC.js";
57
+ } from "./chunk-TPYYEDP5.js";
58
+ import "./chunk-AWQWXSW4.js";
56
59
  import "./chunk-QYF5S6P6.js";
57
- import "./chunk-PHDMFAKM.js";
58
- import "./chunk-2BBLFX75.js";
59
- import "./chunk-XVF2VVXP.js";
60
- import "./chunk-ZANLILYD.js";
61
- import "./chunk-2EECBNC5.js";
60
+ import "./chunk-GYRZ72R4.js";
61
+ import "./chunk-KJJAVH3X.js";
62
+ import "./chunk-ZSUX7KEM.js";
63
+ import "./chunk-EIKRZ32J.js";
62
64
  import {
63
65
  incrementDegradationCount
64
- } from "./chunk-JAU72XNY.js";
66
+ } from "./chunk-FWZRGGGY.js";
65
67
  import {
66
68
  createSubsystemLogger
67
- } from "./chunk-XTMJ7XDT.js";
68
- import "./chunk-JMYYOTQG.js";
69
- import "./chunk-QQNQ7SJW.js";
70
- import "./chunk-AOHZU2BM.js";
69
+ } from "./chunk-N3PLNNCW.js";
70
+ import "./chunk-S26LC76R.js";
71
+ import "./chunk-XWFIHYCH.js";
72
+ import "./chunk-TVZRLTG6.js";
71
73
  import "./chunk-LJDODBBZ.js";
72
- import "./chunk-ABBOA7UD.js";
73
74
  import {
74
75
  isAtOrAboveHomeDir,
75
76
  isFullyQualified,
76
77
  toPosix
77
- } from "./chunk-N2H3ZPZY.js";
78
+ } from "./chunk-EWXXLS26.js";
78
79
  import "./chunk-NXL4FFQQ.js";
79
80
 
80
81
  // dist/clients/jscpd-client.js
@@ -148,6 +149,9 @@ var JscpdClient = class {
148
149
  // its own cwd via findNodeToolBinary.
149
150
  jscpdManagedPath = null;
150
151
  inFlight = /* @__PURE__ */ new Map();
152
+ // Pending availability probes. A scan holds no `inFlight` entry until its
153
+ // own probe settles, so `shutdown()` must see the probe too (#4505).
154
+ probing = /* @__PURE__ */ new Set();
151
155
  log;
152
156
  constructor(verbose = false) {
153
157
  this.log = verbose ? createSubsystemLogger("jscpd") : () => {
@@ -157,9 +161,20 @@ var JscpdClient = class {
157
161
  * Wait for scans already started by this client to settle. Test owners use
158
162
  * this as the lifecycle barrier before removing fixture roots; the scan
159
163
  * promise includes the jscpd child and its report-directory cleanup.
164
+ *
165
+ * A scan registers in `inFlight` only after its availability probe settles,
166
+ * and the session_start task probes once before `scan()` probes again. The
167
+ * loop therefore repeats until a pass finds no probe and no scan. Both sets
168
+ * drop an entry before its promise settles, so an empty pass ends the loop
169
+ * and a pass over pending work never spins. The wait is bounded by the work
170
+ * already started: each probe by `probeTimeout` (1.5 s, tool install off in
171
+ * tests) and each scan by `SCAN_TIMEOUT_MS` (30 s); the loop adds none of its
172
+ * own and ends once the client is idle.
160
173
  */
161
174
  async shutdown() {
162
- await Promise.allSettled(this.inFlight.values());
175
+ do {
176
+ await Promise.allSettled([...this.probing, ...this.inFlight.values()]);
177
+ } while (this.probing.size > 0 || this.inFlight.size > 0);
163
178
  }
164
179
  /**
165
180
  * Fast recursive source file presence check.
@@ -203,7 +218,14 @@ var JscpdClient = class {
203
218
  /**
204
219
  * Check if jscpd is available, auto-install if not
205
220
  */
206
- async ensureAvailable() {
221
+ ensureAvailable() {
222
+ const probe = this.probeAvailable().finally(() => {
223
+ this.probing.delete(probe);
224
+ });
225
+ this.probing.add(probe);
226
+ return probe;
227
+ }
228
+ async probeAvailable() {
207
229
  const resolved = await resolveAvailableOrInstall(jscpdAvailability, "jscpd", process.cwd());
208
230
  if (!resolved)
209
231
  return false;
@@ -7,20 +7,19 @@ import {
7
7
  loadCallGraph,
8
8
  parseSymbolKey,
9
9
  saveCallGraph
10
- } from "./chunk-WOA4LN2R.js";
10
+ } from "./chunk-KCBRHV5E.js";
11
11
  import "./chunk-3MED75HT.js";
12
- import "./chunk-C34ZXZ7O.js";
13
- import "./chunk-2BBLFX75.js";
14
- import "./chunk-XVF2VVXP.js";
15
- import "./chunk-2EECBNC5.js";
16
- import "./chunk-JAU72XNY.js";
17
- import "./chunk-XTMJ7XDT.js";
18
- import "./chunk-JMYYOTQG.js";
19
- import "./chunk-QQNQ7SJW.js";
20
- import "./chunk-AOHZU2BM.js";
12
+ import "./chunk-TPYYEDP5.js";
13
+ import "./chunk-KJJAVH3X.js";
14
+ import "./chunk-ZSUX7KEM.js";
15
+ import "./chunk-EIKRZ32J.js";
16
+ import "./chunk-FWZRGGGY.js";
17
+ import "./chunk-N3PLNNCW.js";
18
+ import "./chunk-S26LC76R.js";
19
+ import "./chunk-XWFIHYCH.js";
20
+ import "./chunk-TVZRLTG6.js";
21
21
  import "./chunk-LJDODBBZ.js";
22
- import "./chunk-ABBOA7UD.js";
23
- import "./chunk-N2H3ZPZY.js";
22
+ import "./chunk-EWXXLS26.js";
24
23
  import "./chunk-NXL4FFQQ.js";
25
24
  export {
26
25
  CALL_GRAPH_CACHE_VERSION,
@@ -1,5 +1,155 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
 
3
+ // dist/clients/bounded-cache.js
4
+ var BoundedFifoMap = class {
5
+ entries = /* @__PURE__ */ new Map();
6
+ maxEntries;
7
+ constructor(maxEntries) {
8
+ this.maxEntries = maxEntries;
9
+ }
10
+ get(key) {
11
+ return this.entries.get(key);
12
+ }
13
+ has(key) {
14
+ return this.entries.has(key);
15
+ }
16
+ /**
17
+ * Insert or update `key` without reordering. Evicts the oldest
18
+ * (insertion-order) entries once the map exceeds capacity.
19
+ *
20
+ * Returns the evicted `[key, value]` pairs, oldest first — callers with
21
+ * eviction-side bookkeeping use the return value instead of hand-rolling
22
+ * `keys().next().value` (#2442). The VALUE is returned, not just the key,
23
+ * because the eviction-coupled sites need it: `tree-sitter-cache.ts` has to
24
+ * retire the dropped entry's WASM-heap tree (#417/#890) and
25
+ * `tree-sitter-client.ts` has to `delete()` the dropped compiled query.
26
+ * Handing back only the key would force those sites to read the value out
27
+ * of the map before eviction — i.e. to hand-roll the block this class
28
+ * exists to delete.
29
+ */
30
+ set(key, value) {
31
+ this.entries.set(key, value);
32
+ return this.evictOverflow();
33
+ }
34
+ /**
35
+ * Change the capacity ceiling, evicting down to it immediately when it
36
+ * shrinks. Returns the evicted `[key, value]` pairs, oldest first, on the
37
+ * same contract as {@link set} — a caller with a DYNAMIC cap (an env-read
38
+ * ceiling, `TreeCache.setMaxSize`) needs the shrink to free the same
39
+ * resources an ordinary overflow frees.
40
+ */
41
+ setMaxEntries(maxEntries) {
42
+ this.maxEntries = maxEntries;
43
+ return this.evictOverflow();
44
+ }
45
+ /** Current capacity ceiling. */
46
+ getMaxEntries() {
47
+ return this.maxEntries;
48
+ }
49
+ /** Drop oldest-first until within capacity. The one eviction block. */
50
+ evictOverflow() {
51
+ const evicted = [];
52
+ while (this.entries.size > this.maxEntries) {
53
+ const oldest = this.entries.entries().next().value;
54
+ if (oldest === void 0)
55
+ break;
56
+ this.entries.delete(oldest[0]);
57
+ evicted.push(oldest);
58
+ }
59
+ return evicted;
60
+ }
61
+ delete(key) {
62
+ return this.entries.delete(key);
63
+ }
64
+ clear() {
65
+ this.entries.clear();
66
+ }
67
+ get size() {
68
+ return this.entries.size;
69
+ }
70
+ keys() {
71
+ return this.entries.keys();
72
+ }
73
+ values() {
74
+ return this.entries.values();
75
+ }
76
+ entriesArray() {
77
+ return [...this.entries.entries()];
78
+ }
79
+ [Symbol.iterator]() {
80
+ return this.entries[Symbol.iterator]();
81
+ }
82
+ };
83
+ var BoundedSet = class {
84
+ entries;
85
+ constructor(maxEntries) {
86
+ this.entries = new BoundedFifoMap(maxEntries);
87
+ }
88
+ has(value) {
89
+ return this.entries.has(value);
90
+ }
91
+ /**
92
+ * Insert `value` without reordering an already-present member. Evicts the
93
+ * oldest (insertion-order) members once the set exceeds capacity.
94
+ *
95
+ * Returns the evicted values, oldest first — see the class doc for why a
96
+ * call site consumes this instead of hand-rolling the drop.
97
+ */
98
+ add(value) {
99
+ return this.entries.set(value, true).map(([evicted]) => evicted);
100
+ }
101
+ /**
102
+ * Change the capacity ceiling, evicting down to it immediately when it
103
+ * shrinks. Returns the evicted values, oldest first, on the same contract
104
+ * as {@link add}.
105
+ */
106
+ setMaxEntries(maxEntries) {
107
+ return this.entries.setMaxEntries(maxEntries).map(([evicted]) => evicted);
108
+ }
109
+ /** Current capacity ceiling. */
110
+ getMaxEntries() {
111
+ return this.entries.getMaxEntries();
112
+ }
113
+ delete(value) {
114
+ return this.entries.delete(value);
115
+ }
116
+ clear() {
117
+ this.entries.clear();
118
+ }
119
+ get size() {
120
+ return this.entries.size;
121
+ }
122
+ values() {
123
+ return this.entries.keys();
124
+ }
125
+ [Symbol.iterator]() {
126
+ return this.entries.keys();
127
+ }
128
+ };
129
+ var BoundedLruCache = class extends BoundedFifoMap {
130
+ /**
131
+ * Read and promote to most-recently-used.
132
+ *
133
+ * A stored `undefined` value is NOT promoted — the hit is indistinguishable
134
+ * from a miss on this signature, and pre-#2442 `BoundedLruCache` behaved
135
+ * the same way. No caller stores `undefined`; the note exists so a future
136
+ * one does not assume otherwise.
137
+ */
138
+ get(key) {
139
+ const value = this.entries.get(key);
140
+ if (value !== void 0) {
141
+ this.entries.delete(key);
142
+ this.entries.set(key, value);
143
+ }
144
+ return value;
145
+ }
146
+ /** Insert or update `key`, moving it to the most-recently-used position. */
147
+ set(key, value) {
148
+ this.entries.delete(key);
149
+ return super.set(key, value);
150
+ }
151
+ };
152
+
3
153
  // node_modules/balanced-match/dist/esm/index.js
4
154
  var balanced = (a, b, str) => {
5
155
  const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
@@ -1916,6 +2066,12 @@ function adoptCanonicalCasing(held, canonical) {
1916
2066
  return changed ? heldParts.join("/") : held;
1917
2067
  }
1918
2068
  function normalizeFilePath(filePath) {
2069
+ return normalizePathForm(filePath, true);
2070
+ }
2071
+ function normalizePathSpelling(filePath) {
2072
+ return normalizePathForm(filePath, false);
2073
+ }
2074
+ function normalizePathForm(filePath, identity) {
1919
2075
  if (process.platform === "win32") {
1920
2076
  if (filePath === "")
1921
2077
  return "";
@@ -1925,7 +2081,10 @@ function normalizeFilePath(filePath) {
1925
2081
  }
1926
2082
  const normalized = filePath.replace(/\\/g, "/");
1927
2083
  if (process.platform !== "win32" && !isWindowsPath(normalized)) {
1928
- const folded = normalized === "" || normalized.startsWith("//") ? normalized : path2.posix.normalize(normalized);
2084
+ const sentinel = normalized === "" || normalized.startsWith("//");
2085
+ if (identity && !sentinel && normalized.startsWith("/"))
2086
+ return posixPathIdentity(normalized);
2087
+ const folded = sentinel ? normalized : path2.posix.normalize(normalized);
1929
2088
  try {
1930
2089
  const canonical = realpathSync.native(folded);
1931
2090
  if (canonical === folded)
@@ -1950,14 +2109,45 @@ function normalizeFilePath(filePath) {
1950
2109
  }
1951
2110
  }
1952
2111
  }
1953
- function realpathOrResolve(filePath) {
1954
- const resolved = path2.resolve(filePath);
1955
- try {
1956
- return realpathSync(resolved);
1957
- } catch {
1958
- return resolved;
2112
+ var pathIdentityFallbacks = new BoundedFifoMap(16);
2113
+ function recordPathIdentityFallback(code, spelled) {
2114
+ const existing = pathIdentityFallbacks.get(code);
2115
+ if (existing)
2116
+ existing.count += 1;
2117
+ else
2118
+ pathIdentityFallbacks.set(code, { code, count: 1, firstPath: spelled });
2119
+ }
2120
+ function getPathIdentityFallbacks() {
2121
+ return [...pathIdentityFallbacks.values()].map((row) => ({ ...row }));
2122
+ }
2123
+ function resetPathIdentityFallbacks() {
2124
+ pathIdentityFallbacks.clear();
2125
+ }
2126
+ function kernelRealPath(spelled, p) {
2127
+ let current = spelled;
2128
+ const tail = [];
2129
+ for (; ; ) {
2130
+ try {
2131
+ const real = realpathSync.native(current);
2132
+ return tail.length === 0 ? real : p.join(real, ...tail.reverse());
2133
+ } catch (refusal) {
2134
+ const code = refusal?.code;
2135
+ if (code !== "ENOENT" && code !== "ENOTDIR")
2136
+ recordPathIdentityFallback(code ?? "unknown", current);
2137
+ const parent = p.dirname(current);
2138
+ if (parent === current)
2139
+ return void 0;
2140
+ tail.push(p.basename(current));
2141
+ current = parent;
2142
+ }
1959
2143
  }
1960
2144
  }
2145
+ function posixPathIdentity(spelled) {
2146
+ return kernelRealPath(spelled, path2.posix) ?? path2.posix.normalize(spelled);
2147
+ }
2148
+ function realpathOrResolve(filePath) {
2149
+ return kernelRealPath(filePath, path2) ?? path2.resolve(filePath);
2150
+ }
1961
2151
  function normalizeLoggedPath(value) {
1962
2152
  return isFullyQualifiedWin32(value) || isFullyQualifiedPosix(value) ? normalizeFilePath(value) : value;
1963
2153
  }
@@ -2026,9 +2216,13 @@ function normalizeEphemeralMapKey(filePath) {
2026
2216
  function pathsEqual(a, b) {
2027
2217
  return normalizeFilePath(a) === normalizeFilePath(b);
2028
2218
  }
2029
- function* walkUpDirs(startDir) {
2030
- let current = path2.resolve(startDir);
2031
- while (true) {
2219
+ function* walkUpDirs(startDir, options = {}) {
2220
+ const axis = options.spelling ? path2.resolve : realpathOrResolve;
2221
+ let current = axis(startDir);
2222
+ const home = options.homeDir === void 0 ? void 0 : axis(options.homeDir);
2223
+ for (let yielded = 0; yielded < (options.maxDepth ?? Infinity); yielded++) {
2224
+ if (home !== void 0 && isAtOrAboveHomeDir(current, home))
2225
+ return;
2032
2226
  yield current;
2033
2227
  const parent = path2.dirname(current);
2034
2228
  if (parent === current)
@@ -2046,11 +2240,7 @@ function findNearestContaining(startDir, candidates) {
2046
2240
  return void 0;
2047
2241
  }
2048
2242
  function findLocalToolConfig(startDir, names, options = {}) {
2049
- const homeDir = options.homeDir !== void 0 ? path2.resolve(options.homeDir) : void 0;
2050
- for (const dir of walkUpDirs(startDir || process.cwd())) {
2051
- if (homeDir !== void 0 && isAtOrAboveHomeDir(dir, homeDir)) {
2052
- return void 0;
2053
- }
2243
+ for (const dir of walkUpDirs(startDir || process.cwd(), options)) {
2054
2244
  for (const name of names) {
2055
2245
  const candidate = path2.join(dir, name);
2056
2246
  if (existsSync(candidate))
@@ -2084,9 +2274,9 @@ function isRealGitMarker(markerPath, details) {
2084
2274
  }
2085
2275
  function findNearestMarkerRoot(startDir, markers, options = {}) {
2086
2276
  const boundaries = options.boundaries ?? [];
2087
- const homeDir = path2.resolve(options.homeDir ?? os.homedir());
2277
+ const homeDir = realpathOrResolve(options.homeDir ?? os.homedir());
2088
2278
  const markerPredicate = options.markerPredicate ?? (() => true);
2089
- let current = path2.resolve(startDir);
2279
+ let current = realpathOrResolve(startDir);
2090
2280
  for (let depth = 0; depth < 64; depth++) {
2091
2281
  if (isAtOrAboveHomeDir(current, homeDir))
2092
2282
  return null;
@@ -2102,8 +2292,8 @@ function findNearestMarkerRoot(startDir, markers, options = {}) {
2102
2292
  return null;
2103
2293
  }
2104
2294
  function findNearestMarkerRootDetailed(startDir, markers, options) {
2105
- const homeDir = path2.resolve(options.homeDir ?? os.homedir());
2106
- let current = path2.resolve(startDir);
2295
+ const homeDir = realpathOrResolve(options.homeDir ?? os.homedir());
2296
+ let current = realpathOrResolve(startDir);
2107
2297
  for (let depth = 0; depth < 64; depth++) {
2108
2298
  if (isAtOrAboveHomeDir(current, homeDir))
2109
2299
  return { kind: "not-found", reason: "home-ceiling" };
@@ -2143,10 +2333,15 @@ function homeRelativePath(filePath, homeDir = os.homedir()) {
2143
2333
  return `~${candidate.slice(home.length)}`;
2144
2334
  }
2145
2335
  function isUnderDir(child, parent) {
2146
- const normChild = normalizeFilePath(child);
2147
- const normParent = normalizeFilePath(parent);
2148
- const parentPrefix = normParent.endsWith("/") ? normParent : `${normParent}/`;
2149
- return normChild === normParent || normChild.startsWith(parentPrefix);
2336
+ if (isWithinForm(normalizePathSpelling(child), normalizePathSpelling(parent)))
2337
+ return true;
2338
+ if (process.platform === "win32")
2339
+ return false;
2340
+ return isWithinForm(normalizeFilePath(child), normalizeFilePath(parent));
2341
+ }
2342
+ function isWithinForm(child, parent) {
2343
+ const parentPrefix = parent.endsWith("/") ? parent : `${parent}/`;
2344
+ return child === parent || child.startsWith(parentPrefix);
2150
2345
  }
2151
2346
  function isOutsideProjectRoot(filePath, projectRoot) {
2152
2347
  return !isUnderDir(filePath, projectRoot);
@@ -2162,7 +2357,7 @@ var VENDOR_DIR_NAMES = /* @__PURE__ */ new Set([
2162
2357
  "bower_components"
2163
2358
  ]);
2164
2359
  function isVendorPath(filePath) {
2165
- return normalizeFilePath(filePath).split("/").some((segment) => VENDOR_DIR_NAMES.has(segment.toLowerCase()));
2360
+ return normalizePathSpelling(filePath).split("/").some((segment) => VENDOR_DIR_NAMES.has(segment.toLowerCase()));
2166
2361
  }
2167
2362
  function isExternalOrVendorFile(filePath, projectRoot) {
2168
2363
  if (isOutsideProjectRoot(filePath, projectRoot))
@@ -2367,6 +2562,9 @@ function resolveHostToolPath(input, baseDir) {
2367
2562
  }
2368
2563
 
2369
2564
  export {
2565
+ BoundedFifoMap,
2566
+ BoundedSet,
2567
+ BoundedLruCache,
2370
2568
  minimatch,
2371
2569
  Minimatch,
2372
2570
  isWindowsPath,
@@ -2375,6 +2573,9 @@ export {
2375
2573
  isFullyQualified,
2376
2574
  isAbsoluteFilePath,
2377
2575
  normalizeFilePath,
2576
+ normalizePathSpelling,
2577
+ getPathIdentityFallbacks,
2578
+ resetPathIdentityFallbacks,
2378
2579
  realpathOrResolve,
2379
2580
  normalizeLoggedPath,
2380
2581
  uriToPath,
@@ -2392,6 +2593,7 @@ export {
2392
2593
  isAtOrAboveHomeDir,
2393
2594
  homeRelativePath,
2394
2595
  isUnderDir,
2596
+ isWithinForm,
2395
2597
  isVendorPath,
2396
2598
  isExternalOrVendorFile,
2397
2599
  nameMatchesMarkerGlob,
@@ -2400,5 +2602,6 @@ export {
2400
2602
  UV_WORKSPACE_MEMBERS_DIALECT,
2401
2603
  UV_WORKSPACE_EXCLUDE_DIALECT,
2402
2604
  matchesWorkspaceMemberPattern,
2605
+ normalizeHostToolPath,
2403
2606
  resolveHostToolPath
2404
2607
  };
@@ -0,0 +1,37 @@
1
+ import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ GitleaksClient,
4
+ PLACEHOLDER_SECRET_REGEXES,
5
+ classifyAndFilterFindings,
6
+ hasGitRepo,
7
+ hasGitleaksSignal,
8
+ parseGitleaksReport,
9
+ writeScopedGitleaksConfig
10
+ } from "./chunk-OMJ3OFBJ.js";
11
+ import "./chunk-7FLRUH6B.js";
12
+ import "./chunk-KPVLQHCZ.js";
13
+ import "./chunk-QT66NEYN.js";
14
+ import "./chunk-XI34NWDI.js";
15
+ import "./chunk-5LRUKYFA.js";
16
+ import "./chunk-TPYYEDP5.js";
17
+ import "./chunk-AWQWXSW4.js";
18
+ import "./chunk-KJJAVH3X.js";
19
+ import "./chunk-ZSUX7KEM.js";
20
+ import "./chunk-EIKRZ32J.js";
21
+ import "./chunk-FWZRGGGY.js";
22
+ import "./chunk-N3PLNNCW.js";
23
+ import "./chunk-S26LC76R.js";
24
+ import "./chunk-XWFIHYCH.js";
25
+ import "./chunk-TVZRLTG6.js";
26
+ import "./chunk-LJDODBBZ.js";
27
+ import "./chunk-EWXXLS26.js";
28
+ import "./chunk-NXL4FFQQ.js";
29
+ export {
30
+ GitleaksClient,
31
+ PLACEHOLDER_SECRET_REGEXES,
32
+ classifyAndFilterFindings,
33
+ hasGitRepo,
34
+ hasGitleaksSignal,
35
+ parseGitleaksReport,
36
+ writeScopedGitleaksConfig
37
+ };