pi-lens 4.4.12 → 4.5.0

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 (155) hide show
  1. package/CHANGELOG-USER.md +6 -6
  2. package/CHANGELOG.md +172 -0
  3. package/README.md +103 -217
  4. package/dist/{chunk-KXDQD34C.js → chunk-27JQHK7Y.js} +1 -1
  5. package/dist/{chunk-W6VLB6LL.js → chunk-2APSZHHI.js} +61 -3
  6. package/dist/{chunk-5EEWCJG7.js → chunk-2H5GHZKC.js} +8 -8
  7. package/dist/{chunk-TS5EIWEF.js → chunk-2H7NFZ4Q.js} +11 -11
  8. package/dist/{chunk-6GWCYEP7.js → chunk-37IDWT6O.js} +64 -16
  9. package/dist/{chunk-OEPWTSUG.js → chunk-3PAS2ERX.js} +8 -8
  10. package/dist/{chunk-ET3DSSFZ.js → chunk-3PO4YYOX.js} +9 -17
  11. package/dist/{chunk-C6V2DSZZ.js → chunk-3QXFUP6T.js} +11 -11
  12. package/dist/{chunk-HWMNTQBJ.js → chunk-3TSMQZG6.js} +32 -11
  13. package/dist/{chunk-QY6J2FTK.js → chunk-4DAHGU3V.js} +15 -14
  14. package/dist/{chunk-PCREZ4HJ.js → chunk-4IZZEN63.js} +33 -34
  15. package/dist/{chunk-OYXD2MOM.js → chunk-5HBQL7DH.js} +2 -2
  16. package/dist/{chunk-B4FAFEBP.js → chunk-5JB4WENL.js} +1 -1
  17. package/dist/chunk-5YJXF2IS.js +56 -0
  18. package/dist/{chunk-GHATCG2A.js → chunk-6CFSDLHE.js} +22 -18
  19. package/dist/{chunk-FVQKX5KI.js → chunk-6E5QLMWI.js} +24 -22
  20. package/dist/{chunk-AVBEPUCD.js → chunk-6GLMMGCX.js} +2 -2
  21. package/dist/{chunk-YTXFNCVN.js → chunk-74AMPWNC.js} +2 -2
  22. package/dist/{chunk-K2GV34T2.js → chunk-7CLWC2UH.js} +26 -37
  23. package/dist/{chunk-MOEWCPMC.js → chunk-7DPXUPRF.js} +2 -2
  24. package/dist/{chunk-7BEADGAZ.js → chunk-7U36VQL6.js} +2 -2
  25. package/dist/{chunk-PPYUBO6Y.js → chunk-7WKVCZI4.js} +1 -1
  26. package/dist/{chunk-ILC2B7IJ.js → chunk-7ZVTFLCC.js} +10 -10
  27. package/dist/{chunk-IT7MFVGP.js → chunk-ADYQRETD.js} +2 -2
  28. package/dist/{chunk-NCDH2JB7.js → chunk-ARTYCUGF.js} +25 -10
  29. package/dist/{chunk-Z6WTLVUL.js → chunk-AXAR5ZW2.js} +225 -104
  30. package/dist/{chunk-PK3GDU4M.js → chunk-AZG5UJYY.js} +1 -1
  31. package/dist/{chunk-NRVWLTOY.js → chunk-B2OXE4AH.js} +60 -21
  32. package/dist/{chunk-ORYQGVC3.js → chunk-B42AIWPJ.js} +2 -2
  33. package/dist/{chunk-IC4L65U7.js → chunk-BBSDJTOV.js} +12 -13
  34. package/dist/{chunk-HJWF7CGW.js → chunk-BKWFDWYM.js} +16 -16
  35. package/dist/{chunk-D2ZYRI7M.js → chunk-C5PLBTNR.js} +1 -1
  36. package/dist/{chunk-SRXYSLMW.js → chunk-CQY2HEH7.js} +1 -1
  37. package/dist/{chunk-7424ANRU.js → chunk-CXQYK4YT.js} +1 -1
  38. package/dist/{chunk-HYR25MV3.js → chunk-CZJGAOKL.js} +8 -7
  39. package/dist/{chunk-DIIDMDZU.js → chunk-DCA2MXVQ.js} +11 -11
  40. package/dist/{chunk-K2LD6YNH.js → chunk-DFKOA74L.js} +9 -9
  41. package/dist/{chunk-AYDE7RFV.js → chunk-DI4AZZNY.js} +2 -2
  42. package/dist/{chunk-6EXGCXM5.js → chunk-G53LBDNU.js} +99 -5
  43. package/dist/chunk-GCSDF5IE.js +27 -0
  44. package/dist/{chunk-5KLRCUDT.js → chunk-H5API74E.js} +6 -6
  45. package/dist/chunk-HBX55MWO.js +27 -0
  46. package/dist/{chunk-JRSS6KM4.js → chunk-HIJ4CHFF.js} +2 -2
  47. package/dist/{chunk-3MHY4BQY.js → chunk-HIRBC72R.js} +4 -4
  48. package/dist/{chunk-F7AMFFVK.js → chunk-HRLF35WL.js} +8 -8
  49. package/dist/{chunk-HSTN27NR.js → chunk-I2FYOZNW.js} +9 -9
  50. package/dist/{chunk-5FDUKJZO.js → chunk-I3NZVAMN.js} +9 -9
  51. package/dist/{chunk-NZINZCHB.js → chunk-INBK3HIT.js} +3 -3
  52. package/dist/{chunk-PXGVB2CY.js → chunk-J2ZB5MDS.js} +20 -18
  53. package/dist/{chunk-HYDJUVOE.js → chunk-JGUDT5KD.js} +4 -4
  54. package/dist/chunk-JOIKBUQN.js +88 -0
  55. package/dist/{chunk-AZXTLZHE.js → chunk-K4Z7MK6T.js} +169 -165
  56. package/dist/{chunk-WTSQKJAR.js → chunk-K7O6AHSJ.js} +10 -10
  57. package/dist/{chunk-S6ZQFPOX.js → chunk-KNJH6WJQ.js} +6 -6
  58. package/dist/{chunk-SUIZOCSY.js → chunk-KNSOA43J.js} +1 -1
  59. package/dist/{chunk-3QMLB4TI.js → chunk-KXGTLAUW.js} +2 -2
  60. package/dist/{chunk-OHEUOWYT.js → chunk-KZ732ZVW.js} +1 -1
  61. package/dist/{chunk-G3LR6V6N.js → chunk-L6BDRYUK.js} +19 -17
  62. package/dist/{chunk-OVPR3GQ6.js → chunk-LGH2HHZG.js} +24 -6
  63. package/dist/{chunk-3R3Z54J7.js → chunk-LOEJFTF2.js} +1 -1
  64. package/dist/{chunk-HGEE5LDW.js → chunk-LQQNFCQJ.js} +1 -1
  65. package/dist/chunk-LVLPA32Q.js +810 -0
  66. package/dist/chunk-M2YMBT5G.js +73 -0
  67. package/dist/{chunk-Z2W5YJBW.js → chunk-MJRGPEQ5.js} +11 -11
  68. package/dist/{chunk-3EIZMRXI.js → chunk-MOAVEPC4.js} +10 -10
  69. package/dist/{chunk-TOOXNL6M.js → chunk-NGNBJIUO.js} +7 -7
  70. package/dist/{chunk-AGEQRJ5A.js → chunk-NHA5K226.js} +1 -1
  71. package/dist/{chunk-YLW26OHX.js → chunk-NNEQOC3U.js} +31 -59
  72. package/dist/{chunk-ZWZD4TJ5.js → chunk-O2MHF7QM.js} +35 -36
  73. package/dist/{chunk-PTJXMYRY.js → chunk-OLWGYBYT.js} +15 -16
  74. package/dist/{chunk-JKAVKTMY.js → chunk-OZQQ3AIR.js} +17 -20
  75. package/dist/{chunk-6JLNZ6DP.js → chunk-P5MSLVUW.js} +10 -10
  76. package/dist/{chunk-OF2YGDUE.js → chunk-PFJLYRO3.js} +37 -38
  77. package/dist/chunk-PKWEBMCA.js +2957 -0
  78. package/dist/{chunk-JLMS7EMD.js → chunk-PPQHMSPH.js} +16 -15
  79. package/dist/{chunk-6EIV3H7O.js → chunk-PQF6YGYB.js} +12 -5
  80. package/dist/{chunk-VU2PRGRI.js → chunk-PQXUZYTQ.js} +4 -4
  81. package/dist/{chunk-MV6ST2KT.js → chunk-Q7J3JYJ2.js} +13 -12
  82. package/dist/{chunk-BMMRLJA4.js → chunk-QE5DJ7MX.js} +27 -10
  83. package/dist/{chunk-IZ36G463.js → chunk-QE7BJQ6K.js} +7 -7
  84. package/dist/{chunk-E5SSUV2A.js → chunk-QMWKSYWB.js} +4 -4
  85. package/dist/{chunk-QJ4T73J5.js → chunk-QV3JPCMK.js} +1 -1
  86. package/dist/{chunk-3PMLYGJN.js → chunk-R4L7KZ7R.js} +5 -5
  87. package/dist/{chunk-7ZVEFWOE.js → chunk-RIH3UBK4.js} +10 -10
  88. package/dist/{chunk-T5EGSBM2.js → chunk-RJ3APNIP.js} +3 -3
  89. package/dist/{chunk-AAIVSSUU.js → chunk-S6MCMD27.js} +35 -12
  90. package/dist/{chunk-SF7KSXB5.js → chunk-SCU62JLX.js} +6 -6
  91. package/dist/{chunk-FDLGJFAE.js → chunk-SDYLT45T.js} +3 -3
  92. package/dist/chunk-TFKN5EIR.js +27 -0
  93. package/dist/{chunk-Y7XMKBFP.js → chunk-TKOFTLGB.js} +34 -26
  94. package/dist/chunk-TQWRH25U.js +35 -0
  95. package/dist/{chunk-DZSQXG66.js → chunk-TWEOJE3D.js} +277 -62
  96. package/dist/{chunk-R67WQ5RY.js → chunk-UN72ZAJ5.js} +8 -8
  97. package/dist/{chunk-AD7JDEI6.js → chunk-UNP6Y4JV.js} +16 -16
  98. package/dist/{chunk-D6ANA6YU.js → chunk-VGRGW4UL.js} +63 -55
  99. package/dist/{chunk-DFAY7JUN.js → chunk-VSQT6IHZ.js} +2 -2
  100. package/dist/{chunk-7T64QA5D.js → chunk-VWEBZ2JV.js} +39 -38
  101. package/dist/{chunk-HRQTYU2T.js → chunk-W26QZ3OM.js} +1 -1
  102. package/dist/{chunk-2HWVG3IM.js → chunk-XDNWR7SG.js} +2 -2
  103. package/dist/{chunk-75TVYCQW.js → chunk-XSC3BCN3.js} +5 -5
  104. package/dist/{chunk-ME6MF2N2.js → chunk-YCR6ZYTE.js} +1 -1
  105. package/dist/{chunk-LD7SXICE.js → chunk-ZI7YHV6I.js} +5 -5
  106. package/dist/{chunk-E3PNZDPH.js → chunk-ZQSSO7LO.js} +33 -1
  107. package/dist/{chunk-T6PPK3T6.js → chunk-ZULZS2I6.js} +385 -407
  108. package/dist/index.js +6508 -5413
  109. package/dist/mcp/analyze-cli.js +9 -9
  110. package/dist/mcp/cli.js +39 -38
  111. package/dist/mcp/server.js +602 -345
  112. package/dist/mcp/worker.js +57 -58
  113. package/dist/probes/installer.js +19 -17
  114. package/docs/architecture.md +113 -0
  115. package/docs/ast-grep_rules_catalog.md +2 -2
  116. package/docs/ci.md +18 -4
  117. package/docs/defect-shapes.md +41 -3
  118. package/docs/dependencies.md +10 -10
  119. package/docs/features.md +3 -3
  120. package/docs/invariants/dispatch-runners.md +13 -1
  121. package/docs/invariants/lsp-trust-exec.md +19 -0
  122. package/docs/language-coverage.md +39 -0
  123. package/docs/lsp-capability-matrix.md +10 -4
  124. package/docs/lsp-idle-eviction.md +1 -1
  125. package/docs/pi-lens-fixer.md +4 -0
  126. package/docs/pi-lens-merge-policy.md +1 -1
  127. package/docs/pi-lens-reviewer.md +4 -5
  128. package/docs/pi-lens-subagent.md +5 -2
  129. package/docs/prose-standard.md +112 -0
  130. package/docs/servercapabilities.md +1 -1
  131. package/docs/usage.md +50 -0
  132. package/package.json +1 -1
  133. package/rules/ast-grep-rules/rule-tests/array-callback-return-js-test.yml +23 -0
  134. package/rules/ast-grep-rules/rule-tests/array-callback-return-test.yml +23 -0
  135. package/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-js-test.yml +8 -0
  136. package/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-test.yml +8 -0
  137. package/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-js-test.yml +16 -0
  138. package/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-test.yml +16 -0
  139. package/rules/ast-grep-rules/rules/array-callback-return-js.yml +8 -0
  140. package/rules/ast-grep-rules/rules/array-callback-return.yml +8 -0
  141. package/rules/ast-grep-rules/rules/no-negation-in-equality-check-js.yml +17 -5
  142. package/rules/ast-grep-rules/rules/no-negation-in-equality-check.yml +17 -5
  143. package/rules/ast-grep-rules/rules/unchecked-throwing-call-js.yml +8 -1
  144. package/rules/ast-grep-rules/rules/unchecked-throwing-call.yml +8 -1
  145. package/rules/tree-sitter-queries/typescript/ts-react-antipatterns.yml +8 -0
  146. package/dist/chunk-3VWEZ6H2.js +0 -72
  147. package/dist/chunk-7KWI5UHL.js +0 -28
  148. package/dist/chunk-7M64NTAK.js +0 -38
  149. package/dist/chunk-BEIPWPVR.js +0 -1037
  150. package/dist/chunk-D7OEGXDX.js +0 -2417
  151. package/dist/chunk-KUDUKKQE.js +0 -89
  152. package/dist/chunk-TM3A3K7T.js +0 -28
  153. package/dist/chunk-VD7MQFEV.js +0 -56
  154. package/dist/chunk-YLHJWAQS.js +0 -256
  155. package/dist/chunk-YULIERZW.js +0 -27
@@ -26,6 +26,9 @@ function checkedVerdict(tier, rows) {
26
26
  const completed = [first, ...rest];
27
27
  return { checked: true, tier, runnerIds: completed };
28
28
  }
29
+ function cleanVerdict(evidence) {
30
+ return evidence.findings === 0 && evidence.scope > 0 && evidence.proven === evidence.scope;
31
+ }
29
32
  function emptyDispatchResult(verdict) {
30
33
  return {
31
34
  diagnostics: [],
@@ -50,13 +53,56 @@ var RUNNER_SKIP_REASONS = [
50
53
  "dialect-unsupported",
51
54
  "covered-by-primary",
52
55
  "disabled-by-config",
53
- "not-enabled"
56
+ "not-enabled",
57
+ "not-installed",
58
+ "install-disabled",
59
+ "not-configured",
60
+ "not-preferred",
61
+ "probe-incomplete",
62
+ "probe-rejected",
63
+ "trust-refused",
64
+ "runtime-missing"
65
+ ];
66
+ var VERDICT_SKIP_REASONS = [
67
+ "no-files-matched",
68
+ "configured-non-biome-linter",
69
+ "dialect-unsupported",
70
+ "covered-by-primary",
71
+ "disabled-by-config"
72
+ ];
73
+ var TOOL_UNUSABLE_SKIP_REASONS = [
74
+ "not-installed",
75
+ "install-disabled",
76
+ "probe-incomplete",
77
+ "probe-rejected",
78
+ "trust-refused",
79
+ "runtime-missing"
54
80
  ];
81
+ var SKIP_REASON_PHRASE = {
82
+ "no-files-matched": "no file matched",
83
+ "configured-non-biome-linter": "the project is configured for another linter",
84
+ "dialect-unsupported": "its tool does not support this file's dialect",
85
+ "covered-by-primary": "the primary language server covers this file",
86
+ "disabled-by-config": "disabled in config by dispatch.disabledRunners",
87
+ "not-enabled": "not enabled",
88
+ "not-installed": "not installed",
89
+ "install-disabled": "not installed, and the managed install is off (PI_LENS_DISABLE_TOOL_INSTALL=1)",
90
+ "not-configured": "not configured",
91
+ "not-preferred": "the project's lint policy prefers another tool",
92
+ "probe-incomplete": "its availability probe did not finish",
93
+ // The binary may be a runtime the tool needs (Java for SpotBugs), not the
94
+ // tool itself, so the phrase does not say the tool was found.
95
+ "probe-rejected": "a binary it runs was found but rejected its version probe",
96
+ "trust-refused": "the project's own binary was refused (pi project trust is not granted)",
97
+ "runtime-missing": "a runtime it needs is not installed"
98
+ };
55
99
  var NOT_APPLICABLE_SKIP_REASONS = [
56
100
  "no-files-matched",
57
101
  "configured-non-biome-linter",
58
102
  "dialect-unsupported",
59
- "not-enabled"
103
+ "not-enabled",
104
+ "not-configured",
105
+ "not-preferred"
60
106
  ];
61
107
  function isNotApplicableSkipReason(value) {
62
108
  return NOT_APPLICABLE_SKIP_REASONS.some((reason) => reason === value);
@@ -103,6 +149,14 @@ function faultSkip(fault) {
103
149
  skipFault: fault
104
150
  };
105
151
  }
152
+ function skipped(reason) {
153
+ return {
154
+ status: "skipped",
155
+ diagnostics: [],
156
+ semantic: "none",
157
+ skipReason: reason
158
+ };
159
+ }
106
160
  function hasUsableResult(result) {
107
161
  return result.status === "succeeded" || result.status === "failed" && result.failureKind === BLOCKING_DIAGNOSTICS_FAILURE_KIND;
108
162
  }
@@ -115,7 +169,7 @@ function reachedNoVerdict(result) {
115
169
  case "deferred":
116
170
  return true;
117
171
  case "skipped":
118
- return !isRunnerSkipReason(result.skipReason) || result.skipReason === "not-enabled";
172
+ return !VERDICT_SKIP_REASONS.some((reason) => reason === result.skipReason);
119
173
  case "succeeded":
120
174
  default:
121
175
  return false;
@@ -129,17 +183,21 @@ export {
129
183
  verdictUncheckedReason,
130
184
  recordedUnchecked,
131
185
  checkedVerdict,
186
+ cleanVerdict,
132
187
  emptyDispatchResult,
133
188
  IN_FLIGHT_REASON,
134
189
  NO_ANALYZER_REASON,
135
190
  NO_SERVER_REASON,
136
191
  noPrimaryCheckerReason,
192
+ TOOL_UNUSABLE_SKIP_REASONS,
193
+ SKIP_REASON_PHRASE,
137
194
  isNotApplicableSkipReason,
138
195
  isRunnerSkipReason,
139
196
  isRunnerClaimSource,
140
197
  findingsResult,
141
198
  faultResult,
142
199
  faultSkip,
200
+ skipped,
143
201
  hasUsableResult,
144
202
  reachedNoVerdict
145
203
  };
@@ -1,27 +1,27 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  parseJsonc
4
- } from "./chunk-7424ANRU.js";
4
+ } from "./chunk-CXQYK4YT.js";
5
+ import {
6
+ resolveLanguage
7
+ } from "./chunk-DI4AZZNY.js";
5
8
  import {
6
9
  extractTomlTableSection,
7
10
  hasTomlTable,
8
11
  parseTomlScalarString,
9
12
  parseTomlStringArray
10
- } from "./chunk-SUIZOCSY.js";
11
- import {
12
- resolveLanguage
13
- } from "./chunk-AYDE7RFV.js";
13
+ } from "./chunk-KNSOA43J.js";
14
14
  import {
15
15
  getProjectTrustState
16
- } from "./chunk-HRQTYU2T.js";
16
+ } from "./chunk-W26QZ3OM.js";
17
17
  import {
18
18
  incrementDegradationCount,
19
19
  logExtension,
20
20
  recordDegradationOnce
21
- } from "./chunk-AGEQRJ5A.js";
21
+ } from "./chunk-NHA5K226.js";
22
22
  import {
23
23
  logLatency
24
- } from "./chunk-K2GV34T2.js";
24
+ } from "./chunk-7CLWC2UH.js";
25
25
  import {
26
26
  UV_WORKSPACE_EXCLUDE_DIALECT,
27
27
  UV_WORKSPACE_MEMBERS_DIALECT,
@@ -3,18 +3,18 @@ import {
3
3
  GoClient,
4
4
  goClient,
5
5
  resetGoAvailability
6
- } from "./chunk-MOEWCPMC.js";
7
- import "./chunk-E5SSUV2A.js";
8
- import "./chunk-3QMLB4TI.js";
9
- import "./chunk-AVBEPUCD.js";
10
- import "./chunk-ET3DSSFZ.js";
11
- import "./chunk-B4FAFEBP.js";
12
- import "./chunk-6EIV3H7O.js";
13
- import "./chunk-3R3Z54J7.js";
14
- import "./chunk-HRQTYU2T.js";
15
- import "./chunk-AGEQRJ5A.js";
6
+ } from "./chunk-7DPXUPRF.js";
7
+ import "./chunk-QMWKSYWB.js";
8
+ import "./chunk-KXGTLAUW.js";
9
+ import "./chunk-6GLMMGCX.js";
10
+ import "./chunk-3PO4YYOX.js";
11
+ import "./chunk-5JB4WENL.js";
12
+ import "./chunk-PQF6YGYB.js";
13
+ import "./chunk-LOEJFTF2.js";
14
+ import "./chunk-W26QZ3OM.js";
15
+ import "./chunk-NHA5K226.js";
16
16
  import "./chunk-S26LC76R.js";
17
- import "./chunk-K2GV34T2.js";
17
+ import "./chunk-7CLWC2UH.js";
18
18
  import "./chunk-LJDODBBZ.js";
19
19
  import "./chunk-WLD6BGON.js";
20
20
  import "./chunk-NXL4FFQQ.js";
@@ -2,28 +2,26 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  resolveWebTreeSitterPackageDir
4
4
  } from "./chunk-Z54ZSOBZ.js";
5
- import {
6
- getUserRuleRoot,
7
- ruleCorpusFingerprintForCycle
8
- } from "./chunk-7M64NTAK.js";
9
5
  import {
10
6
  getPackageRoot,
7
+ getUserRuleRoot,
11
8
  js_yaml_default,
12
- resolvePackagePath
13
- } from "./chunk-E3PNZDPH.js";
9
+ resolvePackagePath,
10
+ ruleCorpusFingerprintForCycle
11
+ } from "./chunk-ZQSSO7LO.js";
14
12
  import {
15
13
  EXTENSION_TO_GRAMMAR
16
- } from "./chunk-AYDE7RFV.js";
14
+ } from "./chunk-DI4AZZNY.js";
17
15
  import {
18
16
  transientRetryDelayMs
19
- } from "./chunk-AVBEPUCD.js";
17
+ } from "./chunk-6GLMMGCX.js";
20
18
  import {
21
19
  getProjectIgnoreMatcher,
22
20
  isExcludedDirName
23
- } from "./chunk-ET3DSSFZ.js";
21
+ } from "./chunk-3PO4YYOX.js";
24
22
  import {
25
23
  notifyUserDegradation
26
- } from "./chunk-6EIV3H7O.js";
24
+ } from "./chunk-PQF6YGYB.js";
27
25
  import {
28
26
  hashContentBytes
29
27
  } from "./chunk-CIA7X2PZ.js";
@@ -32,7 +30,7 @@ import {
32
30
  getProjectTrustGeneration,
33
31
  withTimeout,
34
32
  writeFileAtomic
35
- } from "./chunk-HRQTYU2T.js";
33
+ } from "./chunk-W26QZ3OM.js";
36
34
  import {
37
35
  compareOrdinal,
38
36
  escapeRegExp,
@@ -40,14 +38,14 @@ import {
40
38
  incrementDegradationCount,
41
39
  recordDegradation,
42
40
  recordDegradationOnce
43
- } from "./chunk-AGEQRJ5A.js";
41
+ } from "./chunk-NHA5K226.js";
44
42
  import {
45
43
  createNdjsonLogger,
46
44
  getGlobalPiLensLogDir,
47
45
  getMaxLogSizeMB,
48
46
  isTestMode,
49
47
  logLatency
50
- } from "./chunk-K2GV34T2.js";
48
+ } from "./chunk-7CLWC2UH.js";
51
49
  import {
52
50
  BoundedFifoMap,
53
51
  normalizeFilePath,
@@ -2039,6 +2037,11 @@ function queryBatchIdentity(queryDefs) {
2039
2037
  return crypto3.createHash("sha256").update(JSON.stringify(canonical)).digest("hex");
2040
2038
  }
2041
2039
  var NO_NESTED_ANCHOR_VISIT_CAP = 1e4;
2040
+ var REACT_FAMILY_MODULE_SEGMENT = /^(react|preact)(-[a-z0-9-]+)?$/;
2041
+ var REACT_JSX_NODE_TYPES = /* @__PURE__ */ new Set([
2042
+ "jsx_element",
2043
+ "jsx_self_closing_element"
2044
+ ]);
2042
2045
  var PYTHON_SQL_SINK_METHODS = /* @__PURE__ */ new Set([
2043
2046
  "execute",
2044
2047
  "executemany",
@@ -3610,6 +3613,7 @@ var TreeSitterClient = class _TreeSitterClient {
3610
3613
  (tree) => {
3611
3614
  try {
3612
3615
  const rootNode = tree.rootNode;
3616
+ const invocationState = {};
3613
3617
  for (const match of batch.query.matches(rootNode)) {
3614
3618
  const owner = batch.ownerOfPattern[match.patternIndex];
3615
3619
  if (owner === void 0)
@@ -3626,7 +3630,7 @@ var TreeSitterClient = class _TreeSitterClient {
3626
3630
  }
3627
3631
  if (!this.evaluatePredicates(batch.query, match))
3628
3632
  continue;
3629
- if (entry.postFilter && !this.applyPostFilter(entry.postFilter, entry.postFilterParams, captures, rootNode)) {
3633
+ if (entry.postFilter && !this.applyPostFilter(entry.postFilter, entry.postFilterParams, captures, rootNode, invocationState)) {
3630
3634
  continue;
3631
3635
  }
3632
3636
  if (match.captures.length === 0)
@@ -4531,7 +4535,7 @@ var TreeSitterClient = class _TreeSitterClient {
4531
4535
  * Each branch is an independent filter identified by name — flat dispatch, no nesting.
4532
4536
  */
4533
4537
  // biome-ignore lint/suspicious/noExplicitAny: postFilterParams is untyped per-filter config
4534
- applyPostFilter(postFilter, postFilterParams, captures, rootNode) {
4538
+ applyPostFilter(postFilter, postFilterParams, captures, rootNode, invocationState) {
4535
4539
  function extractSlots(classNode) {
4536
4540
  const classText = classNode.text ?? "";
4537
4541
  if (!classText.includes("__slots__"))
@@ -4633,6 +4637,49 @@ var TreeSitterClient = class _TreeSitterClient {
4633
4637
  return true;
4634
4638
  }
4635
4639
  }
4640
+ case "has_react_context": {
4641
+ if (invocationState?.reactContext !== void 0) {
4642
+ return invocationState.reactContext;
4643
+ }
4644
+ try {
4645
+ if (!rootNode)
4646
+ return true;
4647
+ for (const child of rootNode.children ?? []) {
4648
+ if (child.type !== "import_statement")
4649
+ continue;
4650
+ const source = child.childForFieldName?.("source")?.text ?? child.children?.find((node) => node.type === "string")?.text ?? "";
4651
+ const spec = source.replace(/^["'`]|["'`]$/g, "");
4652
+ const reactFamily = spec.startsWith("@preact/") || spec.split("/").some((segment) => REACT_FAMILY_MODULE_SEGMENT.test(segment));
4653
+ if (reactFamily) {
4654
+ if (invocationState)
4655
+ invocationState.reactContext = true;
4656
+ return true;
4657
+ }
4658
+ }
4659
+ const pending = [...rootNode.children ?? []];
4660
+ while (pending.length > 0) {
4661
+ const node = pending.pop();
4662
+ if (!node)
4663
+ continue;
4664
+ if (REACT_JSX_NODE_TYPES.has(node.type)) {
4665
+ if (invocationState)
4666
+ invocationState.reactContext = true;
4667
+ return true;
4668
+ }
4669
+ pending.push(...node.children);
4670
+ }
4671
+ if (invocationState)
4672
+ invocationState.reactContext = false;
4673
+ return false;
4674
+ } catch (thrown) {
4675
+ this.reportWasmAbort(thrown);
4676
+ const reason = thrown instanceof Error ? thrown.message : String(thrown);
4677
+ this.reportPostFilterFailure(postFilter, `context probe failed${reason ? `: ${reason}` : ""}`);
4678
+ if (invocationState)
4679
+ invocationState.reactContext = true;
4680
+ return true;
4681
+ }
4682
+ }
4636
4683
  case "missing_mimetype_and_download_name": {
4637
4684
  try {
4638
4685
  const firstArg = captures.FIRST_ARG;
@@ -5763,6 +5810,7 @@ var TreeSitterClient = class _TreeSitterClient {
5763
5810
  (tree) => {
5764
5811
  try {
5765
5812
  const rootNode = tree.rootNode;
5813
+ const invocationState = {};
5766
5814
  const queryMatches = query.matches(rootNode);
5767
5815
  for (const match of queryMatches) {
5768
5816
  const captures = {};
@@ -5774,7 +5822,7 @@ var TreeSitterClient = class _TreeSitterClient {
5774
5822
  if (!this.evaluatePredicates(query, match)) {
5775
5823
  continue;
5776
5824
  }
5777
- if (postFilter && !this.applyPostFilter(postFilter, postFilterParams, captures, rootNode)) {
5825
+ if (postFilter && !this.applyPostFilter(postFilter, postFilterParams, captures, rootNode, invocationState)) {
5778
5826
  continue;
5779
5827
  }
5780
5828
  if (match.captures.length > 0) {
@@ -1,35 +1,35 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  SecurityScanClient
4
- } from "./chunk-LD7SXICE.js";
4
+ } from "./chunk-ZI7YHV6I.js";
5
5
  import {
6
6
  firstOutputLine,
7
7
  spawnFailedWithNoOutput
8
- } from "./chunk-FDLGJFAE.js";
8
+ } from "./chunk-SDYLT45T.js";
9
9
  import {
10
10
  probeToolAsync
11
- } from "./chunk-3QMLB4TI.js";
11
+ } from "./chunk-KXGTLAUW.js";
12
12
  import {
13
13
  INSTALL_TRANSIENT_MAX_ATTEMPTS,
14
14
  classifyProbeFailure,
15
15
  describeProbeEvidence,
16
16
  logAvailabilityDecision,
17
17
  startHostStallSampler
18
- } from "./chunk-AVBEPUCD.js";
18
+ } from "./chunk-6GLMMGCX.js";
19
19
  import {
20
20
  isUntrustedProjectPath,
21
21
  recordProjectCommandRefusal,
22
22
  safeSpawnAsync
23
- } from "./chunk-ET3DSSFZ.js";
23
+ } from "./chunk-3PO4YYOX.js";
24
24
  import {
25
25
  assertInstallAllowed
26
- } from "./chunk-HRQTYU2T.js";
26
+ } from "./chunk-W26QZ3OM.js";
27
27
  import {
28
28
  recordDegradationOnce
29
- } from "./chunk-AGEQRJ5A.js";
29
+ } from "./chunk-NHA5K226.js";
30
30
  import {
31
31
  isToolInstallDisabled
32
- } from "./chunk-K2GV34T2.js";
32
+ } from "./chunk-7CLWC2UH.js";
33
33
 
34
34
  // dist/clients/govulncheck-client.js
35
35
  import * as fs from "node:fs";
@@ -15,7 +15,7 @@ import {
15
15
  spawnAbortScope,
16
16
  spawnCooldownScope,
17
17
  warnIgnoredConfigOnce
18
- } from "./chunk-6EIV3H7O.js";
18
+ } from "./chunk-PQF6YGYB.js";
19
19
  import {
20
20
  CANONICAL_GLOBAL_CONFIG_FILE,
21
21
  FRESHNESS_CADENCE_MS,
@@ -25,7 +25,7 @@ import {
25
25
  errorClassName,
26
26
  getPiLensGlobalConfigPath,
27
27
  getProductionGlobalConfigResolution
28
- } from "./chunk-3R3Z54J7.js";
28
+ } from "./chunk-LOEJFTF2.js";
29
29
  import {
30
30
  DEFAULT_MAX_OUTPUT_BYTES,
31
31
  createBoundedOutputSink,
@@ -33,7 +33,7 @@ import {
33
33
  truncatedByOutputCap,
34
34
  writeFileAtomic,
35
35
  writeFileAtomicAsync
36
- } from "./chunk-HRQTYU2T.js";
36
+ } from "./chunk-W26QZ3OM.js";
37
37
  import {
38
38
  GLOBAL_NON_FLAG_CONFIG_SECTIONS,
39
39
  LENS_FLAGS,
@@ -50,13 +50,13 @@ import {
50
50
  readToolConfig,
51
51
  recordDegradation,
52
52
  recordDegradationOnce
53
- } from "./chunk-AGEQRJ5A.js";
53
+ } from "./chunk-NHA5K226.js";
54
54
  import {
55
55
  getProcessSingleton,
56
56
  isToolInstallDisabled,
57
57
  logLatency,
58
58
  machineStateDir
59
- } from "./chunk-K2GV34T2.js";
59
+ } from "./chunk-7CLWC2UH.js";
60
60
  import {
61
61
  STAGE_TMP_PATTERN,
62
62
  stagePathFor,
@@ -932,19 +932,12 @@ function getResolvedGitDir(cwd) {
932
932
  }
933
933
  return resolved;
934
934
  }
935
- function canonicalDirectory(dir) {
936
- try {
937
- return fs.realpathSync.native(dir);
938
- } catch {
939
- return dir;
940
- }
941
- }
942
935
  function resolveGitCheckout(startPath) {
943
936
  const resolved = getResolvedGitDir(startPath);
944
937
  return resolved ? {
945
- root: canonicalDirectory(resolved.worktreeRoot),
938
+ root: realpathOrResolve(resolved.worktreeRoot),
946
939
  spelledRoot: resolved.worktreeRoot,
947
- commonDir: canonicalDirectory(resolved.commonDir)
940
+ commonDir: realpathOrResolve(resolved.commonDir)
948
941
  } : null;
949
942
  }
950
943
  function sameCheckoutOtherRoot(session, other) {
@@ -967,7 +960,7 @@ function listLinkedWorktreeRoots(commonDir) {
967
960
  const entryDir = join2(commonDir, "worktrees", name);
968
961
  const gitFile = fs.readFileSync(join2(entryDir, "gitdir"), "utf-8").trim();
969
962
  if (gitFile) {
970
- const root = canonicalDirectory(dirname(resolve2(entryDir, gitFile)));
963
+ const root = realpathOrResolve(dirname(resolve2(entryDir, gitFile)));
971
964
  if (fs.existsSync(join2(root, ".git")))
972
965
  roots.push(root);
973
966
  }
@@ -980,7 +973,7 @@ function listNestedLinkedWorktreeRoots(scanRoot) {
980
973
  const checkout = resolveGitCheckout(scanRoot);
981
974
  if (!checkout)
982
975
  return [];
983
- const base = canonicalDirectory(scanRoot);
976
+ const base = realpathOrResolve(scanRoot);
984
977
  const nested = [];
985
978
  for (const root of listLinkedWorktreeRoots(checkout.commonDir)) {
986
979
  if (!pathsEqual(root, base) && isUnderDir(root, base))
@@ -5944,7 +5937,6 @@ export {
5944
5937
  isInSpawnTimeoutCooldown,
5945
5938
  resetSpawnTimeoutCooldowns,
5946
5939
  createGitIdentityResolver,
5947
- canonicalDirectory,
5948
5940
  resolveGitCheckout,
5949
5941
  resolveLinkedWorktreeOwner,
5950
5942
  listNestedLinkedWorktreeRoots,
@@ -8,19 +8,19 @@ import {
8
8
  getDefaultStartupTools,
9
9
  resolveLanguageRootForFile,
10
10
  rootMarkersForFile
11
- } from "./chunk-75TVYCQW.js";
12
- import "./chunk-KXDQD34C.js";
13
- import "./chunk-3PMLYGJN.js";
14
- import "./chunk-YTXFNCVN.js";
15
- import "./chunk-ET3DSSFZ.js";
11
+ } from "./chunk-XSC3BCN3.js";
12
+ import "./chunk-27JQHK7Y.js";
13
+ import "./chunk-R4L7KZ7R.js";
14
+ import "./chunk-74AMPWNC.js";
15
+ import "./chunk-3PO4YYOX.js";
16
16
  import "./chunk-QYF5S6P6.js";
17
- import "./chunk-SRXYSLMW.js";
18
- import "./chunk-6EIV3H7O.js";
19
- import "./chunk-3R3Z54J7.js";
20
- import "./chunk-HRQTYU2T.js";
21
- import "./chunk-AGEQRJ5A.js";
17
+ import "./chunk-CQY2HEH7.js";
18
+ import "./chunk-PQF6YGYB.js";
19
+ import "./chunk-LOEJFTF2.js";
20
+ import "./chunk-W26QZ3OM.js";
21
+ import "./chunk-NHA5K226.js";
22
22
  import "./chunk-S26LC76R.js";
23
- import "./chunk-K2GV34T2.js";
23
+ import "./chunk-7CLWC2UH.js";
24
24
  import "./chunk-LJDODBBZ.js";
25
25
  import "./chunk-WLD6BGON.js";
26
26
  import "./chunk-NXL4FFQQ.js";
@@ -2,10 +2,10 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  DEFAULT_MAX_OUTPUT_BYTES,
4
4
  writeFileAtomic
5
- } from "./chunk-HRQTYU2T.js";
5
+ } from "./chunk-W26QZ3OM.js";
6
6
  import {
7
7
  incrementDegradationCount
8
- } from "./chunk-AGEQRJ5A.js";
8
+ } from "./chunk-NHA5K226.js";
9
9
 
10
10
  // dist/clients/mcp/ipc.js
11
11
  import * as crypto from "node:crypto";
@@ -41,12 +41,19 @@ function boundUnixSocketPath(endpoint, platform = process.platform) {
41
41
  return endpoint;
42
42
  return bytes.subarray(0, limit).toString();
43
43
  }
44
+ function boundUnixSocketKeepsIdentity(endpoint, options = {}) {
45
+ const bound = boundUnixSocketPath(endpoint, options.platform);
46
+ if (bound === endpoint)
47
+ return true;
48
+ const token = options.ownerPid === void 0 ? path.posix.basename(endpoint, ".sock") : `pi-lens-mcp-${options.ownerPid}-`;
49
+ return bound.startsWith(path.posix.join(path.posix.dirname(endpoint), token));
50
+ }
44
51
  function unlinkStaleUnixSocket(endpoint, options = {}) {
45
52
  if ((options.platform ?? process.platform) === "win32")
46
53
  return "absent";
47
- const bound = boundUnixSocketPath(endpoint, options.platform);
48
- if (options.ownerPid !== void 0 && bound !== endpoint && !bound.includes(`${path.sep}pi-lens-mcp-${options.ownerPid}-`))
54
+ if (options.ownerPid !== void 0 && !boundUnixSocketKeepsIdentity(endpoint, options))
49
55
  return "shared-name";
56
+ const bound = boundUnixSocketPath(endpoint, options.platform);
50
57
  try {
51
58
  if (!fs.lstatSync(bound).isSocket())
52
59
  return "not-a-socket";
@@ -63,7 +70,10 @@ function isNoListenerError(error) {
63
70
  function contentHash(content) {
64
71
  return crypto.createHash("sha256").update(content).digest("hex");
65
72
  }
66
- function requestOverWarmIpc(endpoint, timeoutMs, buildRequest, validate) {
73
+ function requestOverWarmIpc(target, timeoutMs, buildRequest, validate) {
74
+ const { endpoint } = target;
75
+ if (!boundUnixSocketKeepsIdentity(endpoint, target))
76
+ return Promise.resolve({ available: false, reason: "no-listener" });
67
77
  return new Promise((resolve2) => {
68
78
  let settled = false;
69
79
  const finish = (value) => {
@@ -75,7 +85,7 @@ function requestOverWarmIpc(endpoint, timeoutMs, buildRequest, validate) {
75
85
  resolve2(value);
76
86
  };
77
87
  const deadlineAt = Date.now() + timeoutMs;
78
- const socket = net.createConnection(endpoint);
88
+ const socket = net.createConnection(boundUnixSocketPath(endpoint));
79
89
  socket.setEncoding("utf8");
80
90
  const timer = setTimeout(() => finish({ available: false, reason: "timeout" }), timeoutMs);
81
91
  timer.unref();
@@ -113,7 +123,10 @@ function requestOverWarmIpc(endpoint, timeoutMs, buildRequest, validate) {
113
123
  }
114
124
  function requestWarmDiagnostics(cwd, incumbentPid, file, content, timeoutMs) {
115
125
  const expectedHash = contentHash(content);
116
- return requestOverWarmIpc(diagnosticsIpcPathForCwd(cwd, incumbentPid), timeoutMs, (deadlineAt) => ({
126
+ return requestOverWarmIpc({
127
+ endpoint: diagnosticsIpcPathForCwd(cwd, incumbentPid),
128
+ ownerPid: incumbentPid
129
+ }, timeoutMs, (deadlineAt) => ({
117
130
  route: "diagnostics",
118
131
  version: WARM_DIAGNOSTICS_SCHEMA_VERSION,
119
132
  file,
@@ -132,7 +145,10 @@ function requestWarmDiagnostics(cwd, incumbentPid, file, content, timeoutMs) {
132
145
  });
133
146
  }
134
147
  function requestWarmCodeActions(cwd, incumbentPid, file, expectedContentHash, ranges, timeoutMs) {
135
- return requestOverWarmIpc(diagnosticsIpcPathForCwd(cwd, incumbentPid), timeoutMs, (deadlineAt) => ({
148
+ return requestOverWarmIpc({
149
+ endpoint: diagnosticsIpcPathForCwd(cwd, incumbentPid),
150
+ ownerPid: incumbentPid
151
+ }, timeoutMs, (deadlineAt) => ({
136
152
  route: "code-actions",
137
153
  version: WARM_DIAGNOSTICS_SCHEMA_VERSION,
138
154
  file,
@@ -153,7 +169,7 @@ function requestWarmCodeActions(cwd, incumbentPid, file, expectedContentHash, ra
153
169
  var WARM_TURN_END_SCHEMA_VERSION = 2;
154
170
  async function requestWarmTurnEnd(cwd, timeoutMs = 55e3) {
155
171
  const startedAt = Date.now();
156
- const first = await requestOverWarmIpc(ipcPathForCwd(cwd), timeoutMs, () => ({
172
+ const first = await requestOverWarmIpc({ endpoint: ipcPathForCwd(cwd) }, timeoutMs, () => ({
157
173
  route: "turn-end",
158
174
  version: WARM_TURN_END_SCHEMA_VERSION,
159
175
  cwd
@@ -163,7 +179,7 @@ async function requestWarmTurnEnd(cwd, timeoutMs = 55e3) {
163
179
  const remainingMs = timeoutMs - (Date.now() - startedAt);
164
180
  if (remainingMs <= 0)
165
181
  return { available: false, reason: "timeout" };
166
- const ack = await requestOverWarmIpc(ipcPathForCwd(cwd), remainingMs, () => ({
182
+ const ack = await requestOverWarmIpc({ endpoint: ipcPathForCwd(cwd) }, remainingMs, () => ({
167
183
  route: "turn-end-ack",
168
184
  version: WARM_TURN_END_SCHEMA_VERSION,
169
185
  cwd,
@@ -226,6 +242,9 @@ function recordTurnEndOutcome(cwd, outcome, platform = process.platform) {
226
242
  }
227
243
  }
228
244
  function requestWarmAnalyze(cwd, file, timeoutMs = 3e4) {
245
+ const endpoint = ipcPathForCwd(cwd);
246
+ if (!boundUnixSocketKeepsIdentity(endpoint))
247
+ return Promise.resolve(void 0);
229
248
  return new Promise((resolve2) => {
230
249
  let settled = false;
231
250
  const finish = (value) => {
@@ -235,7 +254,7 @@ function requestWarmAnalyze(cwd, file, timeoutMs = 3e4) {
235
254
  clearTimeout(timer);
236
255
  resolve2(value);
237
256
  };
238
- const socket = net.createConnection(ipcPathForCwd(cwd));
257
+ const socket = net.createConnection(boundUnixSocketPath(endpoint));
239
258
  socket.setEncoding("utf8");
240
259
  const timer = setTimeout(() => {
241
260
  socket.destroy();
@@ -353,6 +372,8 @@ export {
353
372
  WARM_CODE_ACTION_LOOKUP_LIMIT,
354
373
  ipcPathForCwd,
355
374
  diagnosticsIpcPathForCwd,
375
+ boundUnixSocketPath,
376
+ boundUnixSocketKeepsIdentity,
356
377
  unlinkStaleUnixSocket,
357
378
  contentHash,
358
379
  requestWarmDiagnostics,