pi-lens 4.4.4 → 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 (179) hide show
  1. package/CHANGELOG.md +440 -0
  2. package/README.md +13 -3
  3. package/config/dependency-cruiser-eager-allowlist.json +1 -0
  4. package/dist/chunk-22Y2BM7H.js +23 -0
  5. package/dist/{chunk-ATKJFDQN.js → chunk-27VWVB23.js} +12 -14
  6. package/dist/{chunk-S2HEXIWI.js → chunk-2FYKETQJ.js} +10 -6
  7. package/dist/{chunk-SRYEJNES.js → chunk-2LDMXL2M.js} +2 -2
  8. package/dist/{chunk-ZHH37KZL.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-5OFV52AM.js → chunk-3WCEHYOI.js} +1 -1
  12. package/dist/chunk-44X7VIKR.js +73 -0
  13. package/dist/{chunk-DEL2U6CM.js → chunk-4FHUGDKU.js} +16 -14
  14. package/dist/{chunk-CT4MN5IU.js → chunk-4ODSZ35Z.js} +353 -359
  15. package/dist/{chunk-ZIVJBOO3.js → chunk-4U7GDSZQ.js} +2 -2
  16. package/dist/chunk-54NIOJJZ.js +25 -0
  17. package/dist/{chunk-N5FLEO7W.js → chunk-5DKE4HGX.js} +37 -37
  18. package/dist/{chunk-P63GXC37.js → chunk-5LRUKYFA.js} +31 -4
  19. package/dist/{chunk-HRNHZA3N.js → chunk-63NMUNYP.js} +12 -16
  20. package/dist/{chunk-HWCCCQNX.js → chunk-6XSESGWD.js} +13 -6
  21. package/dist/{chunk-UMS2MFPZ.js → chunk-72J27ICO.js} +2 -3
  22. package/dist/{chunk-ED36RF6Y.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-3DA2JDOL.js → chunk-7ZS7MC24.js} +551 -203
  26. package/dist/{chunk-WMYE35PX.js → chunk-AHWA4AKM.js} +7 -5
  27. package/dist/{chunk-JW3YWBVB.js → chunk-AI3GP74G.js} +17 -19
  28. package/dist/{chunk-AGSS7277.js → chunk-APFJKOP6.js} +6 -23
  29. package/dist/{chunk-ZVUL7QYY.js → chunk-ASRAO7KG.js} +29 -32
  30. package/dist/{chunk-BW5KFIQC.js → chunk-AWQWXSW4.js} +1 -0
  31. package/dist/{chunk-TLX72JTG.js → chunk-CG5V25HX.js} +1 -1
  32. package/dist/chunk-CKEQFGLT.js +32 -0
  33. package/dist/{chunk-Y6GZHWSJ.js → chunk-COOUUC5W.js} +6 -6
  34. package/dist/{chunk-XTBDCR27.js → chunk-CPZ5JJW6.js} +4 -4
  35. package/dist/{chunk-RKKOYPRA.js → chunk-DS2USX5G.js} +13 -15
  36. package/dist/chunk-EA2ZRG44.js +27 -0
  37. package/dist/{chunk-GSLNCYGG.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-R3T7CLQ2.js → chunk-ELZRSR5N.js} +41 -41
  41. package/dist/{chunk-GMX5OS7B.js → chunk-EN5AM7PX.js} +11 -12
  42. package/dist/{chunk-3RKP3FMS.js → chunk-EWXXLS26.js} +226 -24
  43. package/dist/chunk-EX4EXBW7.js +37 -0
  44. package/dist/{chunk-XHJBS436.js → chunk-EXVXBSGN.js} +25 -25
  45. package/dist/{chunk-MZGQNL3Y.js → chunk-F7BO6FWH.js} +12 -13
  46. package/dist/{chunk-V35JG4JB.js → chunk-FEDWAYDS.js} +152 -334
  47. package/dist/{chunk-J64T55EI.js → chunk-FWZRGGGY.js} +73 -9
  48. package/dist/{chunk-T57LYLZT.js → chunk-G224FADB.js} +1 -1
  49. package/dist/chunk-G5UCJFT7.js +26 -0
  50. package/dist/{chunk-LLJNQKQW.js → chunk-GLW3YDZZ.js} +20 -13
  51. package/dist/{chunk-GXFV6MYU.js → chunk-GTDSYEA2.js} +72 -39
  52. package/dist/{chunk-DUO2TU77.js → chunk-GYRZ72R4.js} +10 -4
  53. package/dist/chunk-HYVXA3BB.js +49 -0
  54. package/dist/{chunk-W66O5E25.js → chunk-IEBJF3PN.js} +13 -15
  55. package/dist/{chunk-GAQ7OQG6.js → chunk-IL7K66ZQ.js} +83 -94
  56. package/dist/{chunk-T7FEBKXN.js → chunk-JWOVP5BL.js} +7 -9
  57. package/dist/{chunk-UBOQLVT2.js → chunk-K2GUZ4DN.js} +4 -4
  58. package/dist/{chunk-5VSF4UUQ.js → chunk-K4SZB56V.js} +34 -39
  59. package/dist/{chunk-7D6L4MTX.js → chunk-KCBRHV5E.js} +3 -3
  60. package/dist/{chunk-GSM5UU7A.js → chunk-KFXCL4OV.js} +38 -28
  61. package/dist/{chunk-J6MPGQTS.js → chunk-KJJAVH3X.js} +81 -15
  62. package/dist/{chunk-BWD5EPKO.js → chunk-KPVLQHCZ.js} +4 -6
  63. package/dist/{chunk-MPNJLASA.js → chunk-KX56K73G.js} +10 -13
  64. package/dist/{chunk-AWSCPCN2.js → chunk-LMCTHJ2H.js} +19 -19
  65. package/dist/{chunk-IWDLU6K3.js → chunk-MEFLGBCS.js} +4 -6
  66. package/dist/{chunk-TOY6QKOH.js → chunk-MKPCELNI.js} +17 -17
  67. package/dist/{chunk-POMLXPMY.js → chunk-N3PLNNCW.js} +1 -1
  68. package/dist/chunk-N5FBM25N.js +22 -0
  69. package/dist/{chunk-CYRKQRPM.js → chunk-NFNVDDGB.js} +2 -4
  70. package/dist/{chunk-RMLC67LF.js → chunk-NLIVE7L6.js} +2 -30
  71. package/dist/{chunk-24AKHFGP.js → chunk-OMJ3OFBJ.js} +6 -6
  72. package/dist/{chunk-IQWN5JCP.js → chunk-OZNCKLOX.js} +13 -14
  73. package/dist/chunk-P5XUGPIX.js +31 -0
  74. package/dist/{chunk-2KXTHF3M.js → chunk-PJXNTPB2.js} +253 -33
  75. package/dist/chunk-PKOXJIVT.js +88 -0
  76. package/dist/{chunk-DGUKIYSI.js → chunk-PP2A5V2T.js} +8 -10
  77. package/dist/{chunk-KAPJINKN.js → chunk-Q42LJANT.js} +2 -2
  78. package/dist/{chunk-UZ2XCLYS.js → chunk-Q4BKKOVC.js} +8 -8
  79. package/dist/{chunk-TIQ2PKDW.js → chunk-QT66NEYN.js} +4 -4
  80. package/dist/{chunk-U44DJXQP.js → chunk-RCHO5W7M.js} +15 -18
  81. package/dist/{chunk-YH5MVY2U.js → chunk-RG3MXTRI.js} +7 -7
  82. package/dist/chunk-RG7OODGM.js +57 -0
  83. package/dist/{chunk-OHKJ7PQF.js → chunk-RU34BA4D.js} +43 -39
  84. package/dist/{chunk-JMYYOTQG.js → chunk-S26LC76R.js} +13 -1
  85. package/dist/{chunk-XBJVAEEO.js → chunk-S55TEC7I.js} +3 -2
  86. package/dist/{chunk-RVK72CZX.js → chunk-SJHC3BCZ.js} +1397 -481
  87. package/dist/{chunk-IYNJ6YPZ.js → chunk-SNEUMLM7.js} +4 -4
  88. package/dist/{chunk-S67KYG37.js → chunk-T4NGVFYI.js} +2 -2
  89. package/dist/{chunk-YCWYO6TQ.js → chunk-THEXI2QO.js} +48 -45
  90. package/dist/{chunk-AMERCH6V.js → chunk-TL2TCJYL.js} +15 -16
  91. package/dist/{chunk-KUA4OJ5Y.js → chunk-TPYYEDP5.js} +823 -350
  92. package/dist/{chunk-YNE3RP52.js → chunk-TVZRLTG6.js} +8 -1
  93. package/dist/{chunk-ROYSX2S5.js → chunk-UCVMSOXF.js} +2 -2
  94. package/dist/chunk-UL5SXQVX.js +32 -0
  95. package/dist/{chunk-7HXE67BN.js → chunk-UO66IMVP.js} +2 -2
  96. package/dist/{chunk-VOOAPROD.js → chunk-UVY4TOJH.js} +3 -3
  97. package/dist/{chunk-RKBXZN3A.js → chunk-VIDEKABZ.js} +2 -2
  98. package/dist/{chunk-2FN63LPV.js → chunk-VITFDI3O.js} +13 -14
  99. package/dist/{chunk-6DLWKFEX.js → chunk-VUAVE3QC.js} +41 -42
  100. package/dist/{chunk-FM4RDMKT.js → chunk-WUY4BZEP.js} +10 -12
  101. package/dist/{chunk-SD4I7ZO4.js → chunk-X3UTCXAA.js} +43 -53
  102. package/dist/chunk-XHDBJODR.js +45 -0
  103. package/dist/{chunk-5IUSNGOC.js → chunk-XHLK33VM.js} +28 -21
  104. package/dist/{chunk-3KAZU3VR.js → chunk-XI34NWDI.js} +2 -2
  105. package/dist/{chunk-QBFBRV2B.js → chunk-XWFIHYCH.js} +4 -2
  106. package/dist/{chunk-JUKMK5Y4.js → chunk-Y2TPADJR.js} +10 -11
  107. package/dist/{chunk-EBC36LNN.js → chunk-Y5KTA2OB.js} +17 -17
  108. package/dist/{chunk-HYGZEMX6.js → chunk-YKVDBNPO.js} +11 -5
  109. package/dist/{chunk-KN35K52N.js → chunk-YSDPVDFC.js} +3 -3
  110. package/dist/chunk-YWNO5Q4R.js +44 -0
  111. package/dist/{chunk-US7ECLD7.js → chunk-YWWG4AQA.js} +119 -28
  112. package/dist/{chunk-O4NWQT6I.js → chunk-YXDCRUKQ.js} +4 -4
  113. package/dist/{chunk-XYURS6EN.js → chunk-YXGRRORB.js} +15 -17
  114. package/dist/{chunk-IUE7SSKV.js → chunk-ZAPSUBLU.js} +13 -7
  115. package/dist/{chunk-EUXZEFTV.js → chunk-ZPJM7DID.js} +3 -3
  116. package/dist/{chunk-5HSRT26B.js → chunk-ZSUX7KEM.js} +16 -15
  117. package/dist/index.js +37155 -32210
  118. package/dist/mcp/analyze-cli.js +11 -12
  119. package/dist/mcp/cli.js +46 -45
  120. package/dist/mcp/server.js +1210 -574
  121. package/dist/mcp/worker.js +65 -65
  122. package/dist/probes/installer.js +21 -23
  123. package/docs/adr/0010-trace-validation-session-lifecycle.md +390 -0
  124. package/docs/adr/README.md +1 -0
  125. package/docs/ast-grep_rules_catalog.md +5 -3
  126. package/docs/configuration.md +9 -0
  127. package/docs/engineering-principles.md +12 -0
  128. package/docs/environment-variables.md +20 -0
  129. package/docs/features.md +16 -1
  130. package/docs/globalconfig.md +37 -8
  131. package/docs/lsp-capability-matrix.md +105 -12
  132. package/docs/lsp-idle-eviction.md +37 -18
  133. package/docs/pi-lens-fixer.md +22 -1
  134. package/docs/pi-lens-investigator.md +14 -0
  135. package/docs/pi-lens-merge-policy.md +23 -10
  136. package/docs/pi-lens-monitor.md +64 -8
  137. package/docs/pi-lens-retro.md +2 -2
  138. package/docs/pi-lens-reviewer.md +48 -1
  139. package/docs/pi-lens-subagent.md +8 -1
  140. package/docs/release-qa-baseline.md +19 -7
  141. package/docs/servercapabilities.md +47 -47
  142. package/docs/settings.md +9 -5
  143. package/docs/subagent-compat.md +1 -1
  144. package/docs/usage.md +1 -0
  145. package/package.json +6 -4
  146. package/rules/ast-grep-rules/rule-tests/no-return-value-in-generator-test.yml +17 -0
  147. package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-js-test.yml +86 -0
  148. package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-test.yml +86 -0
  149. package/rules/ast-grep-rules/rule-tests/unchecked-numeric-parse-python-test.yml +15 -0
  150. package/rules/ast-grep-rules/rules/no-return-value-in-generator.yml +9 -4
  151. package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +119 -0
  152. package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +119 -0
  153. package/rules/ast-grep-rules/rules/unchecked-numeric-parse-python.yml +13 -2
  154. package/rules/rule-catalog.json +25 -1
  155. package/scripts/analyze-pi-lens-logs.mjs +15 -5
  156. package/scripts/lib/is-main-module.mjs +27 -0
  157. package/scripts/lib/scratch-home-env.mjs +21 -0
  158. package/scripts/rpc-load-check.mjs +4 -6
  159. package/scripts/warm-loader-cache.mjs +2 -5
  160. package/dist/chunk-3PTHXJXR.js +0 -28
  161. package/dist/chunk-3QED2P4V.js +0 -31
  162. package/dist/chunk-5WRPDP2A.js +0 -47
  163. package/dist/chunk-ABBOA7UD.js +0 -157
  164. package/dist/chunk-CUHSHSB6.js +0 -273
  165. package/dist/chunk-GL5LUMZE.js +0 -51
  166. package/dist/chunk-HAD7QRQI.js +0 -30
  167. package/dist/chunk-JORED7EX.js +0 -44
  168. package/dist/chunk-KYUB6QDC.js +0 -72
  169. package/dist/chunk-LZSEQW6A.js +0 -57
  170. package/dist/chunk-M2IFVFWU.js +0 -79
  171. package/dist/chunk-M2UD3LPU.js +0 -88
  172. package/dist/chunk-MBKQHGA7.js +0 -39
  173. package/dist/chunk-R7YOCSNV.js +0 -23
  174. package/dist/chunk-SKAMFC7A.js +0 -28
  175. package/dist/chunk-SYE6T2EB.js +0 -28
  176. package/dist/chunk-TRETHTQO.js +0 -26
  177. package/dist/chunk-UA7ZXYDR.js +0 -184
  178. package/dist/chunk-XTFDJI3T.js +0 -24
  179. package/dist/chunk-Z3CCVDUB.js +0 -76
@@ -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-IWDLU6K3.js";
4
+ } from "./chunk-MEFLGBCS.js";
5
5
  import {
6
6
  normalizeMapKey
7
- } from "./chunk-3RKP3FMS.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,73 +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-ZHH37KZL.js";
4
+ } from "./chunk-2SDHYHHO.js";
5
5
  import {
6
6
  biomeConfigArgs
7
- } from "./chunk-Y6GZHWSJ.js";
8
- import "./chunk-3DA2JDOL.js";
9
- import "./chunk-HWCCCQNX.js";
10
- import "./chunk-CUHSHSB6.js";
11
- import "./chunk-UA7ZXYDR.js";
12
- import "./chunk-T7FEBKXN.js";
13
- import "./chunk-MPNJLASA.js";
14
- import "./chunk-GXFV6MYU.js";
15
- import "./chunk-FM4RDMKT.js";
16
- import "./chunk-RMLC67LF.js";
17
- import "./chunk-W66O5E25.js";
18
- import "./chunk-7HXE67BN.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
23
  import "./chunk-IJYGIDF4.js";
22
- import "./chunk-GAQ7OQG6.js";
24
+ import "./chunk-IL7K66ZQ.js";
23
25
  import {
24
26
  resolveToolCwd
25
- } from "./chunk-DEL2U6CM.js";
27
+ } from "./chunk-4FHUGDKU.js";
26
28
  import {
27
29
  findGlobalBinary,
28
30
  findLocalBinAt,
29
31
  localBinPath
30
- } from "./chunk-5VSF4UUQ.js";
32
+ } from "./chunk-K4SZB56V.js";
31
33
  import {
32
34
  getIsolatedNpxSpawnOptions,
33
35
  probeToolAsync
34
- } from "./chunk-3KAZU3VR.js";
36
+ } from "./chunk-XI34NWDI.js";
35
37
  import {
36
38
  classifyProbeFailure,
37
39
  createAvailabilityLatch,
38
40
  describeInstallAttempt,
39
41
  logAvailabilityDecision,
40
42
  startHostStallSampler
41
- } from "./chunk-P63GXC37.js";
42
- import "./chunk-HRNHZA3N.js";
43
- import "./chunk-TLX72JTG.js";
44
- import "./chunk-DGUKIYSI.js";
45
- import "./chunk-XBJVAEEO.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";
46
48
  import {
47
49
  getGlobalPiLensDir,
48
50
  safeSpawnAsync
49
- } from "./chunk-KUA4OJ5Y.js";
51
+ } from "./chunk-TPYYEDP5.js";
50
52
  import {
51
53
  createSingleFlight
52
- } from "./chunk-BW5KFIQC.js";
54
+ } from "./chunk-AWQWXSW4.js";
53
55
  import "./chunk-QYF5S6P6.js";
54
56
  import {
55
57
  isFileKind
56
- } from "./chunk-DUO2TU77.js";
57
- import "./chunk-J6MPGQTS.js";
58
- import "./chunk-5HSRT26B.js";
59
- import "./chunk-M2IFVFWU.js";
60
- import "./chunk-2EECBNC5.js";
61
- import "./chunk-J64T55EI.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";
62
63
  import {
63
64
  createSubsystemLogger
64
- } from "./chunk-POMLXPMY.js";
65
- import "./chunk-JMYYOTQG.js";
66
- import "./chunk-QBFBRV2B.js";
67
- import "./chunk-YNE3RP52.js";
65
+ } from "./chunk-N3PLNNCW.js";
66
+ import "./chunk-S26LC76R.js";
67
+ import "./chunk-XWFIHYCH.js";
68
+ import "./chunk-TVZRLTG6.js";
68
69
  import "./chunk-LJDODBBZ.js";
69
- import "./chunk-ABBOA7UD.js";
70
- import "./chunk-3RKP3FMS.js";
70
+ import "./chunk-EWXXLS26.js";
71
71
  import "./chunk-NXL4FFQQ.js";
72
72
 
73
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-QBFBRV2B.js";
7
+ } from "./chunk-XWFIHYCH.js";
5
8
 
6
9
  // dist/clients/dispatch/runners/utils/availability-policy.js
7
10
  function describeProbeEvidence(result, command) {
@@ -130,6 +133,8 @@ function createAvailabilityLatch(options = {}) {
130
133
  let provisional = false;
131
134
  const maxCooldownMs = options.maxCooldownMs ?? TRANSIENT_MAX_COOLDOWN_MS;
132
135
  let installGeneration = installRetryGeneration;
136
+ let verdictTrustGeneration = getProjectTrustGeneration();
137
+ let owedTrustGeneration = null;
133
138
  function clearVerdict() {
134
139
  available = null;
135
140
  outcome = null;
@@ -155,23 +160,41 @@ function createAvailabilityLatch(options = {}) {
155
160
  function effectiveRetryAtMs() {
156
161
  return Math.max(retryAtMs, installRetryAtMs);
157
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
+ }
158
179
  return {
159
180
  read() {
181
+ settleTrustGeneration(getProjectTrustGeneration());
160
182
  syncInstallGeneration();
161
183
  if (available === true) {
162
184
  if (provisional && Date.now() >= effectiveRetryAtMs())
163
- return null;
185
+ return owe(null);
164
186
  return true;
165
187
  }
166
188
  if (available !== false)
167
- return available;
189
+ return owe(available);
168
190
  if (installExhausted)
169
191
  return false;
170
192
  if (outcome !== "transient")
171
193
  return false;
172
- return Date.now() >= effectiveRetryAtMs() ? null : false;
194
+ return Date.now() >= effectiveRetryAtMs() ? owe(null) : false;
173
195
  },
174
196
  noteAvailable(nextCause = "ok") {
197
+ settleNote();
175
198
  installGeneration = installRetryGeneration;
176
199
  available = true;
177
200
  outcome = "success";
@@ -184,6 +207,7 @@ function createAvailabilityLatch(options = {}) {
184
207
  provisional = false;
185
208
  },
186
209
  noteProvisionallyAvailable(transientCause) {
210
+ settleNote();
187
211
  syncInstallGeneration();
188
212
  available = true;
189
213
  outcome = "success";
@@ -198,6 +222,7 @@ function createAvailabilityLatch(options = {}) {
198
222
  return delay;
199
223
  },
200
224
  noteUnavailable(nextOutcome, nextCause, opts) {
225
+ settleNote();
201
226
  syncInstallGeneration();
202
227
  available = false;
203
228
  outcome = nextOutcome;
@@ -228,6 +253,8 @@ function createAvailabilityLatch(options = {}) {
228
253
  },
229
254
  reset() {
230
255
  installGeneration = installRetryGeneration;
256
+ verdictTrustGeneration = getProjectTrustGeneration();
257
+ owedTrustGeneration = null;
231
258
  clearVerdict();
232
259
  },
233
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-TLX72JTG.js";
4
+ } from "./chunk-CG5V25HX.js";
5
5
  import {
6
6
  readDirEntriesSafe,
7
7
  shouldRecurseIntoDir
8
- } from "./chunk-XBJVAEEO.js";
8
+ } from "./chunk-S55TEC7I.js";
9
9
  import {
10
10
  getProjectIgnoreMatcher
11
- } from "./chunk-KUA4OJ5Y.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-DUO2TU77.js";
20
+ } from "./chunk-GYRZ72R4.js";
21
21
  import {
22
22
  findNearestDirWithAnyBasename,
23
23
  registerWorkspaceTopologyReset
24
- } from "./chunk-5HSRT26B.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-3RKP3FMS.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-3RKP3FMS.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-CYRKQRPM.js";
7
- import "./chunk-ABBOA7UD.js";
8
- import "./chunk-3RKP3FMS.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-YNE3RP52.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
+ };