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,10 +1,10 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  isMutatingToolName
4
- } from "./chunk-IBGIOBEE.js";
4
+ } from "./chunk-MEFLGBCS.js";
5
5
  import {
6
6
  normalizeMapKey
7
- } from "./chunk-N2H3ZPZY.js";
7
+ } from "./chunk-EWXXLS26.js";
8
8
 
9
9
  // dist/clients/agent-behavior-client.js
10
10
  var READ_OPS = /* @__PURE__ */ new Set(["read", "bash", "grep", "glob", "find", "rg"]);
@@ -0,0 +1,25 @@
1
+ import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ getSourceFiles,
4
+ getSourceFilesAsync
5
+ } from "./chunk-CG5V25HX.js";
6
+ import "./chunk-PP2A5V2T.js";
7
+ import "./chunk-S55TEC7I.js";
8
+ import "./chunk-TPYYEDP5.js";
9
+ import "./chunk-QYF5S6P6.js";
10
+ import "./chunk-GYRZ72R4.js";
11
+ import "./chunk-KJJAVH3X.js";
12
+ import "./chunk-ZSUX7KEM.js";
13
+ import "./chunk-EIKRZ32J.js";
14
+ import "./chunk-FWZRGGGY.js";
15
+ import "./chunk-N3PLNNCW.js";
16
+ import "./chunk-S26LC76R.js";
17
+ import "./chunk-XWFIHYCH.js";
18
+ import "./chunk-TVZRLTG6.js";
19
+ import "./chunk-LJDODBBZ.js";
20
+ import "./chunk-EWXXLS26.js";
21
+ import "./chunk-NXL4FFQQ.js";
22
+ export {
23
+ getSourceFiles,
24
+ getSourceFilesAsync
25
+ };
@@ -1,72 +1,73 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  resolveManagedToolClient
4
- } from "./chunk-YSZNHOBY.js";
4
+ } from "./chunk-2SDHYHHO.js";
5
5
  import {
6
6
  biomeConfigArgs
7
- } from "./chunk-RPLINGVB.js";
8
- import "./chunk-EU63SDCG.js";
9
- import "./chunk-VWCXW2E7.js";
10
- import "./chunk-FCSOVF55.js";
11
- import "./chunk-PNQDPDRC.js";
12
- import "./chunk-ZXYDQ3TZ.js";
13
- import "./chunk-724UL2TJ.js";
14
- import "./chunk-QOZXJ4NA.js";
15
- import "./chunk-P7266HLM.js";
16
- import "./chunk-52FUZI6K.js";
17
- import "./chunk-SAEFPSB6.js";
18
- import "./chunk-GAEGEPOC.js";
19
- import "./chunk-Z3CCVDUB.js";
7
+ } from "./chunk-COOUUC5W.js";
8
+ import "./chunk-7ZS7MC24.js";
9
+ import "./chunk-6XSESGWD.js";
10
+ import "./chunk-3SNDVPOR.js";
11
+ import "./chunk-JWOVP5BL.js";
12
+ import "./chunk-7IYC4ENJ.js";
13
+ import "./chunk-KX56K73G.js";
14
+ import "./chunk-2Y6OJRSI.js";
15
+ import "./chunk-WUY4BZEP.js";
16
+ import "./chunk-GTDSYEA2.js";
17
+ import "./chunk-UL5SXQVX.js";
18
+ import "./chunk-CKEQFGLT.js";
19
+ import "./chunk-NLIVE7L6.js";
20
+ import "./chunk-IEBJF3PN.js";
21
+ import "./chunk-UO66IMVP.js";
20
22
  import "./chunk-2BEMIWEW.js";
21
- import "./chunk-ACXEQZOU.js";
23
+ import "./chunk-IJYGIDF4.js";
24
+ import "./chunk-IL7K66ZQ.js";
22
25
  import {
23
26
  resolveToolCwd
24
- } from "./chunk-Q7DUK4LX.js";
27
+ } from "./chunk-4FHUGDKU.js";
25
28
  import {
26
29
  findGlobalBinary,
27
30
  findLocalBinAt,
28
31
  localBinPath
29
- } from "./chunk-AW7R2GWG.js";
32
+ } from "./chunk-K4SZB56V.js";
30
33
  import {
31
34
  getIsolatedNpxSpawnOptions,
32
35
  probeToolAsync
33
- } from "./chunk-RWWYJ623.js";
36
+ } from "./chunk-XI34NWDI.js";
34
37
  import {
35
38
  classifyProbeFailure,
36
39
  createAvailabilityLatch,
37
40
  describeInstallAttempt,
38
41
  logAvailabilityDecision,
39
42
  startHostStallSampler
40
- } from "./chunk-VRZP76YM.js";
41
- import "./chunk-QOBUHWHX.js";
42
- import "./chunk-QILIYSJF.js";
43
- import "./chunk-6C7JWPCP.js";
44
- import "./chunk-5NGR67U5.js";
43
+ } from "./chunk-5LRUKYFA.js";
44
+ import "./chunk-63NMUNYP.js";
45
+ import "./chunk-CG5V25HX.js";
46
+ import "./chunk-PP2A5V2T.js";
47
+ import "./chunk-S55TEC7I.js";
45
48
  import {
46
49
  getGlobalPiLensDir,
47
50
  safeSpawnAsync
48
- } from "./chunk-C34ZXZ7O.js";
51
+ } from "./chunk-TPYYEDP5.js";
49
52
  import {
50
53
  createSingleFlight
51
- } from "./chunk-BW5KFIQC.js";
54
+ } from "./chunk-AWQWXSW4.js";
52
55
  import "./chunk-QYF5S6P6.js";
53
56
  import {
54
57
  isFileKind
55
- } from "./chunk-PHDMFAKM.js";
56
- import "./chunk-2BBLFX75.js";
57
- import "./chunk-XVF2VVXP.js";
58
- import "./chunk-ZANLILYD.js";
59
- import "./chunk-2EECBNC5.js";
60
- import "./chunk-JAU72XNY.js";
58
+ } from "./chunk-GYRZ72R4.js";
59
+ import "./chunk-KJJAVH3X.js";
60
+ import "./chunk-ZSUX7KEM.js";
61
+ import "./chunk-EIKRZ32J.js";
62
+ import "./chunk-FWZRGGGY.js";
61
63
  import {
62
64
  createSubsystemLogger
63
- } from "./chunk-XTMJ7XDT.js";
64
- import "./chunk-JMYYOTQG.js";
65
- import "./chunk-QQNQ7SJW.js";
66
- import "./chunk-AOHZU2BM.js";
65
+ } from "./chunk-N3PLNNCW.js";
66
+ import "./chunk-S26LC76R.js";
67
+ import "./chunk-XWFIHYCH.js";
68
+ import "./chunk-TVZRLTG6.js";
67
69
  import "./chunk-LJDODBBZ.js";
68
- import "./chunk-ABBOA7UD.js";
69
- import "./chunk-N2H3ZPZY.js";
70
+ import "./chunk-EWXXLS26.js";
70
71
  import "./chunk-NXL4FFQQ.js";
71
72
 
72
73
  // dist/clients/biome-client.js
@@ -1,7 +1,10 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ getProjectTrustGeneration
4
+ } from "./chunk-EIKRZ32J.js";
2
5
  import {
3
6
  logLatency
4
- } from "./chunk-QQNQ7SJW.js";
7
+ } from "./chunk-XWFIHYCH.js";
5
8
 
6
9
  // dist/clients/dispatch/runners/utils/availability-policy.js
7
10
  function describeProbeEvidence(result, command) {
@@ -75,6 +78,9 @@ function classifyProbeFailure(result, options = {}) {
75
78
  if (result.spawnFailure?.kind === "tool-not-found") {
76
79
  return { outcome: "missing", cause: "not-found", evidence };
77
80
  }
81
+ if (result.spawnFailure?.kind === "trust-refused") {
82
+ return { outcome: "missing", cause: "policy-denied", evidence };
83
+ }
78
84
  if (result.failure === "timeout" || result.failure === "aborted" || result.failure === "signal" || result.spawnFailure?.kind === "killed" || result.spawnFailure?.kind === "timeout" || errorCode === "EAGAIN" || errorCode === "EBUSY") {
79
85
  const stalled = (options.hostStallMs ?? 0) >= HOST_STALL_EVIDENCE_MS;
80
86
  return {
@@ -127,6 +133,8 @@ function createAvailabilityLatch(options = {}) {
127
133
  let provisional = false;
128
134
  const maxCooldownMs = options.maxCooldownMs ?? TRANSIENT_MAX_COOLDOWN_MS;
129
135
  let installGeneration = installRetryGeneration;
136
+ let verdictTrustGeneration = getProjectTrustGeneration();
137
+ let owedTrustGeneration = null;
130
138
  function clearVerdict() {
131
139
  available = null;
132
140
  outcome = null;
@@ -152,23 +160,41 @@ function createAvailabilityLatch(options = {}) {
152
160
  function effectiveRetryAtMs() {
153
161
  return Math.max(retryAtMs, installRetryAtMs);
154
162
  }
163
+ function settleTrustGeneration(generation) {
164
+ if (verdictTrustGeneration === generation)
165
+ return;
166
+ verdictTrustGeneration = generation;
167
+ clearVerdict();
168
+ }
169
+ function settleNote() {
170
+ const generation = owedTrustGeneration ?? verdictTrustGeneration;
171
+ owedTrustGeneration = null;
172
+ settleTrustGeneration(generation);
173
+ }
174
+ function owe(answer) {
175
+ if (answer === null)
176
+ owedTrustGeneration ??= verdictTrustGeneration;
177
+ return answer;
178
+ }
155
179
  return {
156
180
  read() {
181
+ settleTrustGeneration(getProjectTrustGeneration());
157
182
  syncInstallGeneration();
158
183
  if (available === true) {
159
184
  if (provisional && Date.now() >= effectiveRetryAtMs())
160
- return null;
185
+ return owe(null);
161
186
  return true;
162
187
  }
163
188
  if (available !== false)
164
- return available;
189
+ return owe(available);
165
190
  if (installExhausted)
166
191
  return false;
167
192
  if (outcome !== "transient")
168
193
  return false;
169
- return Date.now() >= effectiveRetryAtMs() ? null : false;
194
+ return Date.now() >= effectiveRetryAtMs() ? owe(null) : false;
170
195
  },
171
196
  noteAvailable(nextCause = "ok") {
197
+ settleNote();
172
198
  installGeneration = installRetryGeneration;
173
199
  available = true;
174
200
  outcome = "success";
@@ -181,6 +207,7 @@ function createAvailabilityLatch(options = {}) {
181
207
  provisional = false;
182
208
  },
183
209
  noteProvisionallyAvailable(transientCause) {
210
+ settleNote();
184
211
  syncInstallGeneration();
185
212
  available = true;
186
213
  outcome = "success";
@@ -195,6 +222,7 @@ function createAvailabilityLatch(options = {}) {
195
222
  return delay;
196
223
  },
197
224
  noteUnavailable(nextOutcome, nextCause, opts) {
225
+ settleNote();
198
226
  syncInstallGeneration();
199
227
  available = false;
200
228
  outcome = nextOutcome;
@@ -225,6 +253,8 @@ function createAvailabilityLatch(options = {}) {
225
253
  },
226
254
  reset() {
227
255
  installGeneration = installRetryGeneration;
256
+ verdictTrustGeneration = getProjectTrustGeneration();
257
+ owedTrustGeneration = null;
228
258
  clearVerdict();
229
259
  },
230
260
  getOutcome: () => outcome,
@@ -1,14 +1,14 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  getSourceFiles
4
- } from "./chunk-QILIYSJF.js";
4
+ } from "./chunk-CG5V25HX.js";
5
5
  import {
6
6
  readDirEntriesSafe,
7
7
  shouldRecurseIntoDir
8
- } from "./chunk-5NGR67U5.js";
8
+ } from "./chunk-S55TEC7I.js";
9
9
  import {
10
10
  getProjectIgnoreMatcher
11
- } from "./chunk-C34ZXZ7O.js";
11
+ } from "./chunk-TPYYEDP5.js";
12
12
  import {
13
13
  CODE_KINDS,
14
14
  DOTNET_CSHARP_ROOT_MARKERS,
@@ -17,18 +17,18 @@ import {
17
17
  LEAN_ROOT_MARKERS,
18
18
  TERRAGRUNT_FILENAMES,
19
19
  detectFileKind
20
- } from "./chunk-PHDMFAKM.js";
20
+ } from "./chunk-GYRZ72R4.js";
21
21
  import {
22
22
  findNearestDirWithAnyBasename,
23
23
  registerWorkspaceTopologyReset
24
- } from "./chunk-XVF2VVXP.js";
25
- import {
26
- BoundedLruCache
27
- } from "./chunk-ABBOA7UD.js";
24
+ } from "./chunk-ZSUX7KEM.js";
28
25
  import {
26
+ BoundedLruCache,
29
27
  direntsHaveMarkerGlobMatch,
30
- normalizeMapKey
31
- } from "./chunk-N2H3ZPZY.js";
28
+ isUnderDir,
29
+ normalizeMapKey,
30
+ realpathOrResolve
31
+ } from "./chunk-EWXXLS26.js";
32
32
 
33
33
  // dist/clients/language-profile.js
34
34
  import * as fs from "node:fs";
@@ -473,7 +473,7 @@ function getDefaultStartupTools(profile) {
473
473
  }
474
474
  function resolveLanguageRootForFile(filePath, workspaceRoot) {
475
475
  const absoluteFilePath = path.resolve(filePath);
476
- const startDir = path.dirname(absoluteFilePath);
476
+ const startDir = path.dirname(realpathOrResolve(absoluteFilePath));
477
477
  const kind = detectFileKind(absoluteFilePath);
478
478
  if (!kind)
479
479
  return path.resolve(workspaceRoot);
@@ -485,11 +485,7 @@ function resolveLanguageRootForFile(filePath, workspaceRoot) {
485
485
  if (!found)
486
486
  return path.resolve(workspaceRoot);
487
487
  const workspace = path.resolve(workspaceRoot);
488
- const relative2 = path.relative(workspace, found);
489
- if (relative2.startsWith("..") || path.isAbsolute(relative2)) {
490
- return workspace;
491
- }
492
- return found;
488
+ return isUnderDir(found, workspace) ? found : workspace;
493
489
  }
494
490
  var WARMUP_SOURCE_EXTS = new Set(SUPPORTED_FILE_KINDS.flatMap((kind) => KIND_EXTENSIONS[kind]));
495
491
  var WARMUP_CODE_EXTS = new Set(SUPPORTED_FILE_KINDS.filter((kind) => CODE_KINDS.has(kind)).flatMap((kind) => KIND_EXTENSIONS[kind]));
@@ -1,7 +1,10 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ resolveOpengrepRulePack
4
+ } from "./chunk-UL5SXQVX.js";
2
5
  import {
3
6
  findLocalToolConfig
4
- } from "./chunk-N2H3ZPZY.js";
7
+ } from "./chunk-EWXXLS26.js";
5
8
 
6
9
  // dist/clients/opengrep-config.js
7
10
  import * as path from "node:path";
@@ -36,11 +39,15 @@ function resolveOpengrepConfig(cwd, flags) {
36
39
  const flagConfig = typeof flags?.config === "string" && flags.config.trim() ? flags.config.trim() : void 0;
37
40
  if (flags?.enabled || flagConfig) {
38
41
  const explicit = normalizeOpengrepConfigArg(flagConfig ?? localConfig, cwd);
39
- return {
40
- enabled: true,
41
- configArg: explicit ?? "auto",
42
- source: explicit && localConfig && !flagConfig ? "local" : "flag"
43
- };
42
+ if (explicit) {
43
+ return {
44
+ enabled: true,
45
+ configArg: explicit,
46
+ source: localConfig && !flagConfig ? "local" : "flag"
47
+ };
48
+ }
49
+ const pack = resolveOpengrepRulePack();
50
+ return pack ? { enabled: true, configArg: pack, source: "pack" } : { enabled: true, configArg: "auto", source: "flag" };
44
51
  }
45
52
  if (localConfig) {
46
53
  return {
@@ -3,9 +3,8 @@ import {
3
3
  FactStore,
4
4
  getFactStoreEvictionReporter,
5
5
  setFactStoreEvictionReporter
6
- } from "./chunk-CHOW74WE.js";
7
- import "./chunk-ABBOA7UD.js";
8
- import "./chunk-N2H3ZPZY.js";
6
+ } from "./chunk-NFNVDDGB.js";
7
+ import "./chunk-EWXXLS26.js";
9
8
  import "./chunk-NXL4FFQQ.js";
10
9
  export {
11
10
  FactStore,
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  isTestMode
4
- } from "./chunk-AOHZU2BM.js";
4
+ } from "./chunk-TVZRLTG6.js";
5
5
 
6
6
  // dist/clients/scanner-temp-root.js
7
7
  import * as os from "node:os";
@@ -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-ZSUX7KEM.js";
7
+ import {
8
+ BoundedLruCache
9
+ } from "./chunk-EWXXLS26.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
+ };