pi-lens 4.5.0 → 4.5.2

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 (148) hide show
  1. package/CHANGELOG-USER.md +12 -12
  2. package/CHANGELOG.md +253 -0
  3. package/README.md +11 -2
  4. package/config/dependency-cruiser-eager-allowlist.json +1 -0
  5. package/dist/{chunk-ZULZS2I6.js → chunk-2ERVW2UF.js} +1115 -423
  6. package/dist/{chunk-BBSDJTOV.js → chunk-2K7BUOKS.js} +13 -13
  7. package/dist/{chunk-I2FYOZNW.js → chunk-3JJ4OAJI.js} +10 -10
  8. package/dist/{chunk-5JB4WENL.js → chunk-3UHGSUVL.js} +1 -1
  9. package/dist/{chunk-W26QZ3OM.js → chunk-463WN3VP.js} +10 -10
  10. package/dist/{chunk-4IZZEN63.js → chunk-4X3ML2UQ.js} +31 -34
  11. package/dist/{chunk-I3NZVAMN.js → chunk-5BI5YP57.js} +10 -10
  12. package/dist/{chunk-7U36VQL6.js → chunk-5Z4XLUFF.js} +3 -3
  13. package/dist/{chunk-DCA2MXVQ.js → chunk-62AJH3IN.js} +51 -29
  14. package/dist/{chunk-37IDWT6O.js → chunk-6F34GMP7.js} +16 -14
  15. package/dist/{chunk-VSQT6IHZ.js → chunk-6LIUVGOR.js} +28 -4
  16. package/dist/{chunk-27JQHK7Y.js → chunk-6REF4GCO.js} +1 -1
  17. package/dist/{chunk-INBK3HIT.js → chunk-7KRR24GO.js} +3 -3
  18. package/dist/{chunk-OZQQ3AIR.js → chunk-7OMOMBEQ.js} +9 -9
  19. package/dist/{chunk-ARTYCUGF.js → chunk-7ZFXICNN.js} +123 -20
  20. package/dist/{chunk-K4Z7MK6T.js → chunk-ABKRQVOY.js} +28 -52
  21. package/dist/{chunk-C5PLBTNR.js → chunk-ANSLRJBG.js} +1 -1
  22. package/dist/{chunk-HRLF35WL.js → chunk-AWMFBPGJ.js} +9 -9
  23. package/dist/{chunk-CXQYK4YT.js → chunk-BG7KHGNX.js} +2 -2
  24. package/dist/{chunk-ZI7YHV6I.js → chunk-BK2R2223.js} +10 -8
  25. package/dist/chunk-BXXC6KRR.js +107 -0
  26. package/dist/{chunk-QMWKSYWB.js → chunk-CKJS2AUI.js} +4 -4
  27. package/dist/{chunk-PPQHMSPH.js → chunk-COGU5KQJ.js} +15 -15
  28. package/dist/{chunk-NHA5K226.js → chunk-CQNXALZJ.js} +27 -6
  29. package/dist/{chunk-KZ732ZVW.js → chunk-CSZESDPP.js} +1 -1
  30. package/dist/chunk-CZ5TCJPB.js +98 -0
  31. package/dist/{chunk-LOEJFTF2.js → chunk-D2LFEA5U.js} +9 -2
  32. package/dist/chunk-D3KLF5CD.js +50 -0
  33. package/dist/{chunk-4DAHGU3V.js → chunk-ENJ2M76Y.js} +31 -29
  34. package/dist/{chunk-ZQSSO7LO.js → chunk-EQKF6BAK.js} +3 -3
  35. package/dist/{chunk-PFJLYRO3.js → chunk-F2SAP2FM.js} +40 -47
  36. package/dist/{chunk-ADYQRETD.js → chunk-F6QAJXQV.js} +2 -2
  37. package/dist/chunk-GR2QDWH5.js +25 -0
  38. package/dist/{chunk-LVLPA32Q.js → chunk-GVE5VZYQ.js} +48 -11
  39. package/dist/{chunk-AZG5UJYY.js → chunk-GWZZOJD2.js} +1 -1
  40. package/dist/chunk-GZS6VPIE.js +27 -0
  41. package/dist/chunk-H4B4SC7I.js +71 -0
  42. package/dist/{chunk-YCR6ZYTE.js → chunk-HA6TUJOE.js} +1 -1
  43. package/dist/{chunk-DI4AZZNY.js → chunk-HKPJTI47.js} +2 -2
  44. package/dist/{chunk-O6LCSHHI.js → chunk-HPKC55MA.js} +1 -1
  45. package/dist/{chunk-LQQNFCQJ.js → chunk-I65CQLCG.js} +1 -1
  46. package/dist/{chunk-P5MSLVUW.js → chunk-IDKLWVKY.js} +11 -11
  47. package/dist/chunk-IUM2Q7NF.js +25 -0
  48. package/dist/{chunk-L6BDRYUK.js → chunk-J24IS3KZ.js} +5 -5
  49. package/dist/{chunk-KNSOA43J.js → chunk-J2DAHH4T.js} +2 -2
  50. package/dist/{chunk-7ZVTFLCC.js → chunk-JBDZVOFL.js} +11 -11
  51. package/dist/{chunk-HIJ4CHFF.js → chunk-JC6NFC57.js} +3 -3
  52. package/dist/{chunk-K7O6AHSJ.js → chunk-JTHEUTW7.js} +11 -11
  53. package/dist/{chunk-KXGTLAUW.js → chunk-JWW3ODBN.js} +2 -2
  54. package/dist/{chunk-HIRBC72R.js → chunk-K3ZIYLHT.js} +4 -4
  55. package/dist/{chunk-6GLMMGCX.js → chunk-KDPZA2UE.js} +2 -3
  56. package/dist/{chunk-AXAR5ZW2.js → chunk-KMY2OU4T.js} +553 -434
  57. package/dist/{chunk-DFKOA74L.js → chunk-KQF7VT26.js} +10 -10
  58. package/dist/{chunk-S6MCMD27.js → chunk-KVGA7X76.js} +3 -3
  59. package/dist/{chunk-74AMPWNC.js → chunk-KW7O72AK.js} +2 -2
  60. package/dist/{chunk-UN72ZAJ5.js → chunk-LEQTVRSV.js} +9 -9
  61. package/dist/{chunk-B42AIWPJ.js → chunk-LKPSBM6S.js} +3 -3
  62. package/dist/{chunk-R4L7KZ7R.js → chunk-LKW2HFSZ.js} +9 -9
  63. package/dist/{chunk-3PO4YYOX.js → chunk-LURFD4HD.js} +4240 -3734
  64. package/dist/{chunk-PQXUZYTQ.js → chunk-M6ELTECW.js} +4 -4
  65. package/dist/{chunk-3QXFUP6T.js → chunk-MGVVYYKW.js} +12 -12
  66. package/dist/{chunk-CZJGAOKL.js → chunk-MQBKGRSB.js} +7 -7
  67. package/dist/{chunk-NNEQOC3U.js → chunk-MVG2ZEAO.js} +9 -7
  68. package/dist/{chunk-VWEBZ2JV.js → chunk-MY4XNNTX.js} +39 -41
  69. package/dist/{chunk-RIH3UBK4.js → chunk-N4AJVFRF.js} +11 -11
  70. package/dist/{chunk-TKOFTLGB.js → chunk-OFKKMXWM.js} +31 -36
  71. package/dist/{chunk-3PAS2ERX.js → chunk-OFZE4ANN.js} +8 -8
  72. package/dist/chunk-OLXBUTJR.js +61 -0
  73. package/dist/{chunk-6CFSDLHE.js → chunk-OZGEHOSG.js} +38 -17
  74. package/dist/{chunk-3TSMQZG6.js → chunk-PKGOROPQ.js} +40 -2
  75. package/dist/{chunk-OLWGYBYT.js → chunk-Q6D5QKRG.js} +17 -17
  76. package/dist/{chunk-QE7BJQ6K.js → chunk-QECLJFHI.js} +12 -17
  77. package/dist/{chunk-RJ3APNIP.js → chunk-QJA33VD5.js} +4 -4
  78. package/dist/{chunk-MOAVEPC4.js → chunk-R5XVJ6AN.js} +11 -11
  79. package/dist/{chunk-ZRQMENT4.js → chunk-REZL4OM4.js} +1 -1
  80. package/dist/{chunk-PKWEBMCA.js → chunk-RK5RBREN.js} +251 -201
  81. package/dist/chunk-RP5ZQTHO.js +86 -0
  82. package/dist/{chunk-J2ZB5MDS.js → chunk-RURPX2YV.js} +23 -23
  83. package/dist/chunk-TB5MGZLS.js +53 -0
  84. package/dist/chunk-TC63XRYP.js +27 -0
  85. package/dist/chunk-TJOYHAXJ.js +69 -0
  86. package/dist/{chunk-Q7J3JYJ2.js → chunk-TRXKDCBP.js} +13 -13
  87. package/dist/{chunk-6E5QLMWI.js → chunk-TTK37D7R.js} +22 -23
  88. package/dist/{chunk-XDNWR7SG.js → chunk-UH3QHLR5.js} +2 -2
  89. package/dist/{chunk-SCU62JLX.js → chunk-UNTJJ7GN.js} +7 -7
  90. package/dist/{chunk-O2MHF7QM.js → chunk-UPAFSETJ.js} +58 -63
  91. package/dist/{chunk-PQF6YGYB.js → chunk-UX75PTQW.js} +50 -31
  92. package/dist/{chunk-TWEOJE3D.js → chunk-V353PYMK.js} +1233 -576
  93. package/dist/{chunk-CQY2HEH7.js → chunk-V4TFQY5G.js} +2 -2
  94. package/dist/{chunk-B2OXE4AH.js → chunk-VC3W54G3.js} +446 -293
  95. package/dist/{chunk-JGUDT5KD.js → chunk-VSBCJVPC.js} +5 -5
  96. package/dist/{chunk-5HBQL7DH.js → chunk-WAQQGXVV.js} +3 -3
  97. package/dist/{chunk-7DPXUPRF.js → chunk-WLEVWR7Y.js} +2 -2
  98. package/dist/{chunk-QE5DJ7MX.js → chunk-WPMPVP5I.js} +4 -4
  99. package/dist/{chunk-KNJH6WJQ.js → chunk-WXNLFOC2.js} +7 -7
  100. package/dist/{chunk-XSC3BCN3.js → chunk-Y3ZNOZZS.js} +6 -6
  101. package/dist/{chunk-VGRGW4UL.js → chunk-YL6JQTWC.js} +29 -32
  102. package/dist/{chunk-7CLWC2UH.js → chunk-YVE5Q2UU.js} +86 -217
  103. package/dist/{chunk-LGH2HHZG.js → chunk-YZNARDMM.js} +42 -28
  104. package/dist/{chunk-NGNBJIUO.js → chunk-ZDWNFZJ2.js} +8 -8
  105. package/dist/{chunk-X33QECRJ.js → chunk-ZEUF7BIN.js} +2 -2
  106. package/dist/{chunk-2H5GHZKC.js → chunk-ZIF4WLWR.js} +45 -25
  107. package/dist/{chunk-WLD6BGON.js → chunk-ZSPVF7KI.js} +231 -24
  108. package/dist/{chunk-SDYLT45T.js → chunk-ZX6OKBVO.js} +2 -2
  109. package/dist/index.js +10566 -6819
  110. package/dist/mcp/analyze-cli.js +8 -8
  111. package/dist/mcp/cli.js +39 -41
  112. package/dist/mcp/server.js +1083 -685
  113. package/dist/mcp/worker.js +68 -59
  114. package/dist/probes/installer.js +21 -22
  115. package/docs/ci-bot-pr-checks.md +18 -9
  116. package/docs/ci.md +7 -0
  117. package/docs/configuration.md +24 -10
  118. package/docs/defect-shapes.md +61 -30
  119. package/docs/environment-variables.md +18 -9
  120. package/docs/globalconfig.md +17 -0
  121. package/docs/invariants/dispatch-runners.md +22 -0
  122. package/docs/invariants/lsp-trust-exec.md +33 -3
  123. package/docs/lsp-capability-matrix.md +23 -10
  124. package/docs/lsp-idle-eviction.md +7 -1
  125. package/docs/module-report-read-symbol.md +6 -2
  126. package/docs/pi-lens-merge-policy.md +3 -2
  127. package/docs/pi-lens-orchestration.md +2 -1
  128. package/docs/pi-lens-subagent.md +2 -1
  129. package/docs/release-qa-baseline.md +22 -17
  130. package/docs/servercapabilities.md +1 -1
  131. package/docs/settings.md +10 -2
  132. package/docs/tools.md +1 -1
  133. package/docs/usage.md +1 -0
  134. package/package.json +3 -3
  135. package/dist/chunk-2H7NFZ4Q.js +0 -25
  136. package/dist/chunk-5YJXF2IS.js +0 -56
  137. package/dist/chunk-7WKVCZI4.js +0 -69
  138. package/dist/chunk-BKWFDWYM.js +0 -46
  139. package/dist/chunk-G53LBDNU.js +0 -255
  140. package/dist/chunk-GCSDF5IE.js +0 -27
  141. package/dist/chunk-H5API74E.js +0 -67
  142. package/dist/chunk-HBX55MWO.js +0 -27
  143. package/dist/chunk-JOIKBUQN.js +0 -88
  144. package/dist/chunk-M2YMBT5G.js +0 -73
  145. package/dist/chunk-MJRGPEQ5.js +0 -25
  146. package/dist/chunk-QV3JPCMK.js +0 -17
  147. package/dist/chunk-TFKN5EIR.js +0 -27
  148. package/dist/chunk-UNP6Y4JV.js +0 -38
@@ -2,23 +2,21 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  COLLECT_LATER_THRESHOLD_MS,
4
4
  classifyObservedRunner,
5
- getLazyInstallAttempt,
6
5
  holdFlight,
7
6
  observeRunnerLatency,
8
7
  runCollectLater,
9
- runnerFlightKey,
10
- tryLazyInstall
11
- } from "./chunk-G53LBDNU.js";
8
+ runnerFlightKey
9
+ } from "./chunk-CZ5TCJPB.js";
12
10
  import {
13
11
  computeImpactCascade
14
- } from "./chunk-HIJ4CHFF.js";
12
+ } from "./chunk-JC6NFC57.js";
15
13
  import {
16
14
  goClient
17
- } from "./chunk-7DPXUPRF.js";
15
+ } from "./chunk-WLEVWR7Y.js";
18
16
  import {
19
17
  isTrivyEnabled,
20
18
  resolveSeverityFloor
21
- } from "./chunk-CZJGAOKL.js";
19
+ } from "./chunk-MQBKGRSB.js";
22
20
  import {
23
21
  faultIfCutShort,
24
22
  finishParsedRun,
@@ -28,10 +26,10 @@ import {
28
26
  skipUnlessToolRan,
29
27
  spawnFailedWithNoOutput,
30
28
  spawnTimedOut
31
- } from "./chunk-SDYLT45T.js";
29
+ } from "./chunk-ZX6OKBVO.js";
32
30
  import {
33
31
  rustClient
34
- } from "./chunk-XDNWR7SG.js";
32
+ } from "./chunk-UH3QHLR5.js";
35
33
  import {
36
34
  biomeConfigArgs,
37
35
  coveringLaneAvailable,
@@ -46,9 +44,7 @@ import {
46
44
  markdownlintConfigArgs,
47
45
  optionSafeTargetArg,
48
46
  resolveAdoptedRootCommand,
49
- resolveAvailableOrInstall,
50
- resolveCommandArgsWithInstallFallback,
51
- resolveLocalFirstAsync,
47
+ resolveRubocopCommand,
52
48
  resolveRunnerCwd as resolveRunnerCwd2,
53
49
  resolveToolCommand,
54
50
  resolveToolCommandWithInstallFallback,
@@ -56,24 +52,25 @@ import {
56
52
  ruffConfigArgs,
57
53
  toolAbsentSkip,
58
54
  toolBinaryVerdict
59
- } from "./chunk-PKWEBMCA.js";
55
+ } from "./chunk-RK5RBREN.js";
60
56
  import {
61
57
  importFactProvider
62
- } from "./chunk-HIRBC72R.js";
58
+ } from "./chunk-K3ZIYLHT.js";
63
59
  import {
64
60
  functionFactProvider
65
- } from "./chunk-PQXUZYTQ.js";
61
+ } from "./chunk-M6ELTECW.js";
66
62
  import {
67
63
  extractFactsFromTree
68
- } from "./chunk-KZ732ZVW.js";
64
+ } from "./chunk-CSZESDPP.js";
69
65
  import {
70
66
  buildOrUpdateGraph,
71
67
  clearReviewGraphWorkspaceCache,
72
68
  fileContentProvider
73
- } from "./chunk-4DAHGU3V.js";
69
+ } from "./chunk-ENJ2M76Y.js";
74
70
  import {
75
71
  MAX_BLOCKING_RULE_COMPLEXITY,
76
72
  PRIMARY_UNAVAILABLE_CAUSE,
73
+ TOUCH_INCONCLUSIVE_REASON_PHRASE,
77
74
  applyDispositions,
78
75
  applyDispositionsMultiFile,
79
76
  buildEffectiveAstGrepCatalog,
@@ -91,6 +88,7 @@ import {
91
88
  hasAnyDispositionMarks,
92
89
  hasAuxiliaryLspPublishedForRoot,
93
90
  hasPendingAuxiliaryCoverage,
91
+ isCrossFileBlocker,
94
92
  isOverlyBroadPattern,
95
93
  isRuleIgnoredForPath,
96
94
  isStructuredRule,
@@ -107,13 +105,13 @@ import {
107
105
  tryWarmAttachedCodeActions,
108
106
  tryWarmAttachedDiagnostics,
109
107
  warmAnswerBinding
110
- } from "./chunk-TWEOJE3D.js";
108
+ } from "./chunk-V353PYMK.js";
111
109
  import {
112
110
  ANY_POSITION,
113
111
  displayedMessage,
114
112
  hashText,
115
113
  retainRecordedFindings
116
- } from "./chunk-VSQT6IHZ.js";
114
+ } from "./chunk-6LIUVGOR.js";
117
115
  import {
118
116
  mapWithConcurrency
119
117
  } from "./chunk-XIMYZ3JA.js";
@@ -129,7 +127,7 @@ import {
129
127
  resolveSessionConfigRoot,
130
128
  resolveShellFileDialect,
131
129
  runnerIdentityPopulated
132
- } from "./chunk-AXAR5ZW2.js";
130
+ } from "./chunk-KMY2OU4T.js";
133
131
  import {
134
132
  augmentPythonEnvironment,
135
133
  describePythonCompileWithheld,
@@ -137,24 +135,19 @@ import {
137
135
  detectPythonTargetVersion,
138
136
  emitBounded,
139
137
  partitionOutrankedPythonCompileVerdicts,
140
- recordPythonCompileVerdictDrop
141
- } from "./chunk-2H5GHZKC.js";
142
- import {
138
+ recordPythonCompileVerdictDrop,
143
139
  scannerReportParentDir
144
- } from "./chunk-QV3JPCMK.js";
145
- import {
146
- loadProjectSnapshot
147
- } from "./chunk-NNEQOC3U.js";
140
+ } from "./chunk-ZIF4WLWR.js";
148
141
  import {
149
142
  RUNTIME_CONFIG,
150
143
  exceedsLspSyncLimits,
151
144
  getRunnerTimeoutFloorMs,
152
145
  loadAstGrepNapi
153
- } from "./chunk-ARTYCUGF.js";
146
+ } from "./chunk-7ZFXICNN.js";
154
147
  import {
155
148
  buildModuleGraph,
156
149
  clearModuleGraphCache
157
- } from "./chunk-JGUDT5KD.js";
150
+ } from "./chunk-VSBCJVPC.js";
158
151
  import {
159
152
  BUNDLED_QUERIES_ROOT,
160
153
  classifyTreeSitterWasmError,
@@ -174,13 +167,17 @@ import {
174
167
  ruleFilesForLanguage,
175
168
  ruleSourceLanguages,
176
169
  walk
177
- } from "./chunk-37IDWT6O.js";
170
+ } from "./chunk-6F34GMP7.js";
178
171
  import {
172
+ js_yaml_default,
179
173
  resolvePackagePath
180
- } from "./chunk-ZQSSO7LO.js";
174
+ } from "./chunk-EQKF6BAK.js";
181
175
  import {
182
176
  stripAnsi
183
177
  } from "./chunk-6HWVI6MI.js";
178
+ import {
179
+ loadProjectSnapshot
180
+ } from "./chunk-MVG2ZEAO.js";
184
181
  import {
185
182
  WORD_INDEX_MAX_BYTES,
186
183
  deserializeWordIndex,
@@ -189,14 +186,14 @@ import {
189
186
  scheduleWordIndexPersist,
190
187
  setWordIndexPublishedListener,
191
188
  updateWordIndexDocumentForEdit
192
- } from "./chunk-P5MSLVUW.js";
189
+ } from "./chunk-IDKLWVKY.js";
193
190
  import {
194
191
  isTypeScriptFile
195
- } from "./chunk-DI4AZZNY.js";
192
+ } from "./chunk-HKPJTI47.js";
196
193
  import {
197
194
  WARM_CODE_ACTION_LOOKUP_LIMIT,
198
195
  contentHash
199
- } from "./chunk-3TSMQZG6.js";
196
+ } from "./chunk-PKGOROPQ.js";
200
197
  import {
201
198
  IN_FLIGHT_REASON,
202
199
  NO_ANALYZER_REASON,
@@ -222,46 +219,47 @@ import {
222
219
  import {
223
220
  resolveRunnerPath,
224
221
  toRunnerDisplayPath
225
- } from "./chunk-ZRQMENT4.js";
222
+ } from "./chunk-REZL4OM4.js";
226
223
  import {
227
- findCommandOnPath,
228
224
  isSpawnableCommand
229
- } from "./chunk-B2OXE4AH.js";
225
+ } from "./chunk-VC3W54G3.js";
230
226
  import {
227
+ configCeiling,
228
+ findCommandOnPath,
231
229
  findToolConfig,
232
230
  hasToolConfig,
233
231
  logRunnerAdvisoryOnce,
234
232
  readFileContent,
235
233
  resolveRunnerCwd,
236
234
  resolveRunnerCwdWithReason
237
- } from "./chunk-LVLPA32Q.js";
235
+ } from "./chunk-GVE5VZYQ.js";
238
236
  import {
237
+ findGlobalBinary,
239
238
  findLocalBinUpwards,
240
239
  isLocalBinTrustRefusal,
241
240
  localBinPath
242
- } from "./chunk-LGH2HHZG.js";
241
+ } from "./chunk-YZNARDMM.js";
243
242
  import {
244
243
  getIsolatedNpxSpawnOptions,
245
244
  probeToolAsync
246
- } from "./chunk-KXGTLAUW.js";
247
- import {
248
- readJsonCache,
249
- readJsonCacheAsync
250
- } from "./chunk-TQWRH25U.js";
245
+ } from "./chunk-JWW3ODBN.js";
251
246
  import {
252
247
  classifyProbeFailure,
253
248
  createAvailabilityLatch,
254
- describeInstallAttempt,
255
249
  describeUnavailability,
256
250
  isLatchingOutcome,
257
251
  logAvailabilityDecision,
258
252
  startHostStallSampler
259
- } from "./chunk-6GLMMGCX.js";
253
+ } from "./chunk-KDPZA2UE.js";
260
254
  import {
261
255
  getLspCapableKinds,
262
256
  getPrimaryDispatchGroup,
263
257
  resolveLanguageRootForFile
264
- } from "./chunk-XSC3BCN3.js";
258
+ } from "./chunk-Y3ZNOZZS.js";
259
+ import {
260
+ readJsonCache,
261
+ readJsonCacheAsync
262
+ } from "./chunk-TQWRH25U.js";
265
263
  import {
266
264
  getGlobalPiLensDir,
267
265
  getProjectDataDir,
@@ -272,13 +270,7 @@ import {
272
270
  realIsPidAlive,
273
271
  resolvePiLensFlag,
274
272
  safeSpawnAsync
275
- } from "./chunk-3PO4YYOX.js";
276
- import {
277
- DOTNET_CSHARP_PROJECT_MARKERS,
278
- DOTNET_CSHARP_SOLUTION_MARKERS,
279
- detectFileKind,
280
- isJstsFactFile
281
- } from "./chunk-CQY2HEH7.js";
273
+ } from "./chunk-LURFD4HD.js";
282
274
  import {
283
275
  PathKeyedMap,
284
276
  boundedKeyLabel,
@@ -289,13 +281,19 @@ import {
289
281
  migrationSubject,
290
282
  reportPiLensConfigRecords,
291
283
  resolveOnePiLensConfigDocument,
292
- resolvePiLensConfig,
293
- spawnCooldownScope
294
- } from "./chunk-PQF6YGYB.js";
284
+ resolvePiLensConfig
285
+ } from "./chunk-UX75PTQW.js";
286
+ import {
287
+ DOTNET_CSHARP_PROJECT_MARKERS,
288
+ DOTNET_CSHARP_SOLUTION_MARKERS,
289
+ detectFileKind,
290
+ isJstsFactFile
291
+ } from "./chunk-V4TFQY5G.js";
295
292
  import {
296
293
  findNearestDirWithMarker,
297
- getPiLensGlobalConfigPath
298
- } from "./chunk-LOEJFTF2.js";
294
+ getPiLensGlobalConfigPath,
295
+ holdsCanonicalProjectConfig
296
+ } from "./chunk-D2LFEA5U.js";
299
297
  import {
300
298
  getProjectTrustState,
301
299
  killedForOutputCap,
@@ -303,13 +301,14 @@ import {
303
301
  truncatedByOutputCap,
304
302
  withBudget,
305
303
  writeFileAtomic
306
- } from "./chunk-W26QZ3OM.js";
304
+ } from "./chunk-463WN3VP.js";
307
305
  import {
308
306
  createSubsystemLogger,
309
307
  incrementDegradationCount,
310
308
  logExtension,
311
- recordDegradationOnce
312
- } from "./chunk-NHA5K226.js";
309
+ recordDegradationOnce,
310
+ spawnCooldownScope
311
+ } from "./chunk-CQNXALZJ.js";
313
312
  import {
314
313
  createNdjsonLogger,
315
314
  getGlobalPiLensLogDir,
@@ -319,11 +318,11 @@ import {
319
318
  nonNegativeIntEnv,
320
319
  phaseFinished,
321
320
  phaseStarted
322
- } from "./chunk-7CLWC2UH.js";
321
+ } from "./chunk-YVE5Q2UU.js";
323
322
  import {
324
323
  FactStore,
325
324
  setFactStoreEvictionReporter
326
- } from "./chunk-O6LCSHHI.js";
325
+ } from "./chunk-HPKC55MA.js";
327
326
  import {
328
327
  BoundedFifoMap,
329
328
  BoundedLruCache,
@@ -333,6 +332,7 @@ import {
333
332
  isWindowsPath,
334
333
  isWithinIdentity,
335
334
  normalizeEphemeralMapKey,
335
+ normalizeFilePath,
336
336
  normalizeLoggedPath,
337
337
  normalizeMapKey,
338
338
  pathsEqual,
@@ -341,11 +341,11 @@ import {
341
341
  resolveHostToolPath,
342
342
  toPosix,
343
343
  toProjectRelativePath
344
- } from "./chunk-WLD6BGON.js";
344
+ } from "./chunk-ZSPVF7KI.js";
345
345
 
346
346
  // dist/clients/mcp/analyze.js
347
- import * as fs15 from "node:fs";
348
- import * as path50 from "node:path";
347
+ import * as fs16 from "node:fs";
348
+ import * as path51 from "node:path";
349
349
 
350
350
  // dist/clients/cache-manager.js
351
351
  import * as fs from "node:fs";
@@ -1225,7 +1225,8 @@ function resolveDispatchPolicyConfig(root) {
1225
1225
  return resolvePiLensConfig({
1226
1226
  cwd: root,
1227
1227
  globalDir: getGlobalPiLensDir(),
1228
- globalConfigPath: getPiLensGlobalConfigPath()
1228
+ globalConfigPath: getPiLensGlobalConfigPath(),
1229
+ excludeLegacyProjectDocuments: holdsCanonicalProjectConfig(root)
1229
1230
  });
1230
1231
  }
1231
1232
  function configOwnerFor(filePath, root) {
@@ -1263,8 +1264,7 @@ function anchoredIgnorePaths(documents, root) {
1263
1264
  const rules2 = resolveOnePiLensConfigDocument(document).value.rules;
1264
1265
  if (!rules2 || typeof rules2 !== "object" || Array.isArray(rules2))
1265
1266
  continue;
1266
- const prefix = document.tier === "global" ? void 0 : anchorPrefix(document, root);
1267
- const baseDir = prefix ? nodePath.resolve(root, prefix) : root;
1267
+ const baseDir = document.tier === "global" ? root : ignoreBaseDir(document, root);
1268
1268
  for (const [key, rawEntry] of Object.entries(rules2)) {
1269
1269
  const ignorePaths = rawEntry?.ignorePaths;
1270
1270
  if (!Array.isArray(ignorePaths))
@@ -1281,15 +1281,19 @@ function anchoredIgnorePaths(documents, root) {
1281
1281
  }
1282
1282
  return byKey;
1283
1283
  }
1284
- function anchorPrefix(document, root) {
1284
+ function ignoreBaseDir(document, root) {
1285
1285
  const pathApi = isWindowsPath(root) || isWindowsPath(document.file) ? nodePath.win32 : nodePath.posix;
1286
1286
  let dir = document.file;
1287
1287
  for (const _segment of document.location.relativePath.split("/")) {
1288
1288
  dir = pathApi.dirname(dir);
1289
1289
  }
1290
- if (pathsEqual(dir, root) || !isUnderDir(dir, root))
1291
- return void 0;
1292
- return toProjectRelativePath(dir, root);
1290
+ if (pathsEqual(dir, root))
1291
+ return root;
1292
+ if (isUnderDir(dir, root)) {
1293
+ return nodePath.resolve(root, toProjectRelativePath(dir, root));
1294
+ }
1295
+ const above = pathApi.resolve(root, pathApi.relative(normalizeFilePath(root), dir));
1296
+ return pathsEqual(above, dir) ? above : root;
1293
1297
  }
1294
1298
  function projectRulePolicy(root, known) {
1295
1299
  const ownerByDir = /* @__PURE__ */ new Map();
@@ -1556,7 +1560,8 @@ function filterDisposed(diagnostics, options) {
1556
1560
  ...diagnostic.line !== void 0 && { line: diagnostic.line },
1557
1561
  ...diagnostic.semantic !== void 0 && {
1558
1562
  semantic: diagnostic.semantic
1559
- }
1563
+ },
1564
+ finding: diagnostic
1560
1565
  }
1561
1566
  })));
1562
1567
  const survivors = new Set(applyDispositions(expanded.map((entry) => entry.candidate), options.cwd, options.filePath, options.content));
@@ -1695,7 +1700,8 @@ function filterFindingsByDisposition(findings, cwd, toDiagnostic3) {
1695
1700
  semantic: diagnostic.semantic
1696
1701
  },
1697
1702
  ...identity.tool !== void 0 && { tool: identity.tool },
1698
- ...identity.rule !== void 0 && { rule: identity.rule }
1703
+ ...identity.rule !== void 0 && { rule: identity.rule },
1704
+ finding: diagnostic
1699
1705
  }
1700
1706
  }));
1701
1707
  });
@@ -2289,20 +2295,38 @@ var PRE_EDIT_SEED_RUNNER_IDS = /* @__PURE__ */ new Set([
2289
2295
  "vale",
2290
2296
  "yamllint"
2291
2297
  ]);
2298
+ var PRE_EDIT_EDIT_GATED_RUNNER_IDS = /* @__PURE__ */ new Set([
2299
+ "ast-grep-napi",
2300
+ "tree-sitter"
2301
+ ]);
2302
+ var PRE_EDIT_SEED_SPANLESS_RUNNER_IDS = /* @__PURE__ */ new Set([
2303
+ ...PRE_EDIT_SEED_RUNNER_IDS,
2304
+ ...PRE_EDIT_EDIT_GATED_RUNNER_IDS
2305
+ ]);
2292
2306
  function preEditSeedFactKey(filePath) {
2293
2307
  return `session.preEdit.${filePath}`;
2294
2308
  }
2295
- function classifyPreExisting(seed, current, content, answered) {
2296
- let lines;
2309
+ function coversEveryLine(ranges, lineCount) {
2310
+ let next = 1;
2311
+ for (const r of [...ranges].sort((a, b) => a.start - b.start)) {
2312
+ if (r.start > next)
2313
+ return false;
2314
+ next = Math.max(next, r.end + 1);
2315
+ }
2316
+ return next > lineCount;
2317
+ }
2318
+ function classifyPreExisting(seed, current, content, answered, modifiedRanges) {
2319
+ const lines = content.split(/\r?\n/);
2297
2320
  const hashAt = (line) => {
2298
2321
  if (line === void 0)
2299
2322
  return void 0;
2300
- lines ??= content.split(/\r?\n/);
2301
2323
  const text = lines[line - 1];
2302
2324
  return text === void 0 ? void 0 : lineHashOf(text);
2303
2325
  };
2304
- const candidates = current.filter((d) => d.runnerId !== void 0 && PRE_EDIT_SEED_RUNNER_IDS.has(d.runnerId));
2305
- const { kept } = retainRecordedFindings(seed, candidates, {
2326
+ const spanGated = modifiedRanges !== void 0 && modifiedRanges.length > 0 && !coversEveryLine(modifiedRanges, lines.length);
2327
+ const usable = (d) => !spanGated || d.runnerId === void 0 || !PRE_EDIT_EDIT_GATED_RUNNER_IDS.has(d.runnerId);
2328
+ const candidates = current.filter((d) => d.runnerId !== void 0 && PRE_EDIT_SEED_SPANLESS_RUNNER_IDS.has(d.runnerId));
2329
+ const { kept } = retainRecordedFindings(seed.filter(usable), candidates, {
2306
2330
  positionOf: () => ANY_POSITION,
2307
2331
  keepUnobserved: (d) => d.runnerId === void 0 || !answered.has(d.runnerId),
2308
2332
  matchesAnywhere: (prior, observed2) => prior.lineHash !== void 0 && prior.lineHash === hashAt(observed2.line)
@@ -2324,12 +2348,16 @@ var EMOJI = {
2324
2348
  silent: "\u{1F4CA}",
2325
2349
  none: ""
2326
2350
  };
2327
- function formatDiagnostic(d) {
2351
+ function crossFileRowLabel(d, editedFile, root) {
2352
+ return editedFile !== void 0 && isCrossFileBlocker(d, editedFile, root) ? `${d.filePath} ` : "";
2353
+ }
2354
+ function formatDiagnostic(d, renderedFor) {
2328
2355
  const line = d.line ? `L${d.line}: ` : "";
2329
2356
  const indented = d.message.split("\n").join("\n ");
2330
2357
  const fix = d.fixSuggestion ? `
2331
2358
  \u{1F4A1} Fix: ${d.fixSuggestion}` : "";
2332
- return ` ${line}${indented}${fix}`;
2359
+ const label = renderedFor ? crossFileRowLabel(d, renderedFor.editedFile, renderedFor.root) : "";
2360
+ return ` ${label}${line}${indented}${fix}`;
2333
2361
  }
2334
2362
  var DELTA_UNUSED_PROMOTION_NOTE = "new in this edit \u2192 blocks in delta mode; pre-existing unused declarations only advise.";
2335
2363
  function formatPromotionNotes(diagnostics) {
@@ -2343,7 +2371,7 @@ function formatPromotionNotes(diagnostics) {
2343
2371
  return [...notes].map((note) => ` \u2139\uFE0F ${note}
2344
2372
  `).join("");
2345
2373
  }
2346
- function formatDiagnostics(diagnostics, semantic, maxDisplay = 10) {
2374
+ function formatDiagnostics(diagnostics, semantic, maxDisplay = 10, renderedFor) {
2347
2375
  if (diagnostics.length === 0)
2348
2376
  return "";
2349
2377
  const emoji = EMOJI[semantic] ?? EMOJI.warning;
@@ -2362,7 +2390,7 @@ ${emoji} Auto-fixed ${diagnostics.length} issue(s):
2362
2390
  `;
2363
2391
  }
2364
2392
  for (const d of diagnostics.slice(0, maxDisplay)) {
2365
- output += `${formatDiagnostic(d)}
2393
+ output += `${formatDiagnostic(d, renderedFor)}
2366
2394
  `;
2367
2395
  }
2368
2396
  if (diagnostics.length > maxDisplay) {
@@ -2679,6 +2707,16 @@ function buildCoverageNotice(ctx, runnerLatencies, dedupe) {
2679
2707
  const unconfirmedServerIds = [
2680
2708
  ...new Set(relevant.flatMap((r) => r.unconfirmedServerIds ?? []))
2681
2709
  ];
2710
+ const inconclusiveDetails = [
2711
+ ...new Set(relevant.flatMap((r) => {
2712
+ if (r.inconclusiveReason === void 0 || r.inconclusiveReason === "primary-unavailable")
2713
+ return [];
2714
+ const ids = r.unconfirmedServerIds ?? [];
2715
+ const subject = ids.length > 0 ? `${ids.join(", ")}: ` : "";
2716
+ const cause2 = TOUCH_INCONCLUSIVE_REASON_PHRASE[r.inconclusiveReason];
2717
+ return [`${subject}${cause2}`];
2718
+ }))
2719
+ ];
2682
2720
  if (unconfirmedServerIds.length > 0) {
2683
2721
  const deferredIds = new Set(relevant.flatMap((r) => r.deferredServerIds ?? []));
2684
2722
  const markerFor = (ids) => {
@@ -2708,6 +2746,9 @@ function buildCoverageNotice(ctx, runnerLatencies, dedupe) {
2708
2746
  if (silentServerIds.length > 0) {
2709
2747
  coverageParts.push(`coverage: ${markerFor(silentServerIds)} silent \u2014 diagnostics are incomplete (not a clean result).`);
2710
2748
  }
2749
+ if (inconclusiveDetails.length > 0) {
2750
+ coverageParts.push(`cause: ${inconclusiveDetails.join("; ")}.`);
2751
+ }
2711
2752
  return {
2712
2753
  notice: {
2713
2754
  id: `coverage-partial:${ctx.kind}:${path4.basename(ctx.filePath)}`,
@@ -2762,7 +2803,8 @@ function buildCoverageNotice(ctx, runnerLatencies, dedupe) {
2762
2803
  const statedCauses = causesOf(statedRows);
2763
2804
  const everyRowStated = statedRows.length === relevant.length;
2764
2805
  const unexplainedCauses = causesOf(statedRows.filter((r) => !isNotApplicableSkipReason(r.skipReason)));
2765
- const unavailableReason = cause ? `no primary language server answered (${PRIMARY_UNAVAILABLE_CAUSE[cause]})${deniedRunnerIds.length > 0 ? `; ${deniedNote}` : ""}` : deniedRunnerIds.length > 0 ? onlySwitchedOff ? `not checked (${deniedNote})` : `not fully checked (a language tool is missing, timed out, or failed to run; ${deniedNote})` : everyRowStated ? `not checked (${statedCauses.join("; ")})` : `not fully checked (a language tool is missing, timed out, or failed to run${unexplainedCauses.length > 0 ? `; ${unexplainedCauses.join("; ")}` : ""})`;
2806
+ const carriedInconclusiveReason = inconclusiveDetails.length > 0 ? `; ${inconclusiveDetails.join("; ")}` : "";
2807
+ const unavailableReason = cause ? `no primary language server answered (${PRIMARY_UNAVAILABLE_CAUSE[cause]})${deniedRunnerIds.length > 0 ? `; ${deniedNote}` : ""}` : deniedRunnerIds.length > 0 ? onlySwitchedOff ? `not checked (${deniedNote})` : `not fully checked (a language tool is missing, timed out, or failed to run; ${deniedNote})` : everyRowStated ? `not checked (${statedCauses.join("; ")})` : `not fully checked (a language tool is missing, timed out, or failed to run${unexplainedCauses.length > 0 ? `; ${unexplainedCauses.join("; ")}` : ""}${carriedInconclusiveReason})`;
2766
2808
  const verdict = unchecked(unavailableReason);
2767
2809
  if (ctx.analysisRootMode === "adopted") {
2768
2810
  return { verdict: unchecked(`not analyzed (${unavailableReason})`) };
@@ -2802,7 +2844,7 @@ function buildCoverageNotice(ctx, runnerLatencies, dedupe) {
2802
2844
  return {
2803
2845
  notice: {
2804
2846
  id: `coverage-unavailable:${ctx.kind}:${path4.basename(ctx.filePath)}`,
2805
- message: everyRowStated && deniedRunnerIds.length === 0 ? `Pi-lens ${ctx.kind} analysis unavailable \u2014 ${statedCauses.join("; ")}, so this file was not checked (not a clean result).` : `Pi-lens ${ctx.kind} analysis unavailable \u2014 a language tool is missing, timed out, or failed to run, or the LSP server isn't ready yet, so this file was not fully checked (not a clean result).${unexplainedCauses.length > 0 ? ` Stated: ${unexplainedCauses.join("; ")}.` : ""}${deniedRunnerIds.length > 0 ? ` Runner (${deniedRunnerIds.join(", ")}) is also disabled in config by dispatch.disabledRunners.` : ""}`,
2847
+ message: everyRowStated && deniedRunnerIds.length === 0 ? `Pi-lens ${ctx.kind} analysis unavailable \u2014 ${statedCauses.join("; ")}, so this file was not checked (not a clean result).` : `Pi-lens ${ctx.kind} analysis unavailable \u2014 a language tool is missing, timed out, or failed to run, or the LSP server isn't ready yet, so this file was not fully checked (not a clean result).${unexplainedCauses.length > 0 ? ` Stated: ${unexplainedCauses.join("; ")}.` : ""}${inconclusiveDetails.length > 0 ? ` Stated: ${inconclusiveDetails.join("; ")}.` : ""}${deniedRunnerIds.length > 0 ? ` Runner (${deniedRunnerIds.join(", ")}) is also disabled in config by dispatch.disabledRunners.` : ""}`,
2806
2848
  filePath: ctx.filePath,
2807
2849
  severity: "warning",
2808
2850
  semantic: "warning",
@@ -2840,6 +2882,7 @@ async function runGroup(ctx, group, registry, onRunnerResult) {
2840
2882
  const outOfEditScope = [];
2841
2883
  const inconclusiveRunnerIds = [];
2842
2884
  const inconclusiveServerIds = [];
2885
+ const answeredServerIds = [];
2843
2886
  const collectLaterRunnerIds = [];
2844
2887
  const editScopedRunnerIds = [];
2845
2888
  const answeredRunnerIds = [];
@@ -3090,6 +3133,9 @@ async function runGroup(ctx, group, registry, onRunnerResult) {
3090
3133
  failureKind: result.failureKind
3091
3134
  },
3092
3135
  ...result.inconclusive === true && { inconclusive: true },
3136
+ ...result.inconclusiveReason !== void 0 && {
3137
+ inconclusiveReason: result.inconclusiveReason
3138
+ },
3093
3139
  ...skipReason !== void 0 && {
3094
3140
  skipReason
3095
3141
  },
@@ -3127,7 +3173,13 @@ async function runGroup(ctx, group, registry, onRunnerResult) {
3127
3173
  line: d.line,
3128
3174
  semantic: d.semantic
3129
3175
  })) : void 0,
3130
- metadata: failureRowMetadata(result) ?? (skipReason ? { skipReason, ...claimSource !== void 0 && { claimSource } } : void 0)
3176
+ metadata: failureRowMetadata(result) ?? (skipReason !== void 0 || result.inconclusiveReason !== void 0 ? {
3177
+ ...skipReason !== void 0 && { skipReason },
3178
+ ...result.inconclusiveReason !== void 0 && {
3179
+ inconclusiveReason: result.inconclusiveReason
3180
+ },
3181
+ ...claimSource !== void 0 && { claimSource }
3182
+ } : void 0)
3131
3183
  });
3132
3184
  if (!ctx.preEditCapture)
3133
3185
  recordRunner(ctx.filePath, runnerId, result.status, result.diagnostics.length, duration, ctx.writeIndex);
@@ -3137,9 +3189,11 @@ async function runGroup(ctx, group, registry, onRunnerResult) {
3137
3189
  d.runnerId ??= runnerId;
3138
3190
  outOfEditScope.push(d);
3139
3191
  }
3140
- if (reachedNoVerdict(result))
3192
+ if (reachedNoVerdict(result)) {
3141
3193
  inconclusiveRunnerIds.push(runnerId);
3142
- else {
3194
+ if (result.answeredServerIds?.length)
3195
+ answeredServerIds.push([runnerId, result.answeredServerIds]);
3196
+ } else {
3143
3197
  answeredRunnerIds.push(runnerId);
3144
3198
  if (result.coveredBy)
3145
3199
  coveredRunners.push({
@@ -3167,6 +3221,7 @@ async function runGroup(ctx, group, registry, onRunnerResult) {
3167
3221
  outOfEditScope,
3168
3222
  inconclusiveRunnerIds,
3169
3223
  inconclusiveServerIds,
3224
+ answeredServerIds,
3170
3225
  collectLaterRunnerIds,
3171
3226
  editScopedRunnerIds,
3172
3227
  answeredRunnerIds,
@@ -3250,17 +3305,22 @@ async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
3250
3305
  const outOfEditScope = [];
3251
3306
  const inconclusiveRunnerIds = /* @__PURE__ */ new Set();
3252
3307
  const inconclusiveServerIds = /* @__PURE__ */ new Set();
3308
+ const answeredServerIds = /* @__PURE__ */ new Map();
3253
3309
  const collectLaterRunnerIds = /* @__PURE__ */ new Set();
3254
3310
  const editScopedRunnerIds = [];
3255
3311
  const answeredRunnerIds = /* @__PURE__ */ new Set();
3256
3312
  const coveredRunners = [];
3257
- for (const { diagnostics: groupDiags, latencies, hadBlocker, outOfEditScope: groupOutOfScope, inconclusiveRunnerIds: groupRunnerIds, inconclusiveServerIds: groupServerIds, collectLaterRunnerIds: groupCollectLater, editScopedRunnerIds: groupEditScoped, answeredRunnerIds: groupAnswered, coveredRunners: groupCovered } of groupResults) {
3313
+ for (const { diagnostics: groupDiags, latencies, hadBlocker, outOfEditScope: groupOutOfScope, inconclusiveRunnerIds: groupRunnerIds, inconclusiveServerIds: groupServerIds, answeredServerIds: groupAnsweredServers, collectLaterRunnerIds: groupCollectLater, editScopedRunnerIds: groupEditScoped, answeredRunnerIds: groupAnswered, coveredRunners: groupCovered } of groupResults) {
3258
3314
  runnerLatencies.push(...latencies);
3259
3315
  outOfEditScope.push(...groupOutOfScope);
3260
3316
  for (const id of groupRunnerIds)
3261
3317
  inconclusiveRunnerIds.add(id);
3262
3318
  for (const id of groupServerIds)
3263
3319
  inconclusiveServerIds.add(id);
3320
+ for (const [runnerId, ids] of groupAnsweredServers)
3321
+ answeredServerIds.set(runnerId, [
3322
+ .../* @__PURE__ */ new Set([...answeredServerIds.get(runnerId) ?? [], ...ids])
3323
+ ]);
3264
3324
  for (const id of groupCollectLater)
3265
3325
  collectLaterRunnerIds.add(id);
3266
3326
  editScopedRunnerIds.push(...groupEditScoped);
@@ -3298,7 +3358,8 @@ async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
3298
3358
  cwd: rulePolicyRoot,
3299
3359
  filePath: ctx.filePath,
3300
3360
  content: fileContent,
3301
- policyMap: void 0
3361
+ policyMap: void 0,
3362
+ identities: (d) => d.semantic === "blocking" ? inlineBlockerIdentities(d) : [{ tool: d.tool, ...d.rule !== void 0 && { rule: d.rule } }]
3302
3363
  });
3303
3364
  return applyRulePolicy(disposition, rulePolicy, {
3304
3365
  root: rulePolicyRoot,
@@ -3327,7 +3388,7 @@ async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
3327
3388
  // seed holds it before the raise can block on it.
3328
3389
  ...visibleDiagnostics.filter((d) => d.semantic === "blocking" || blocksAsClassMember(d)),
3329
3390
  ...heldBackBlockers
3330
- ], seedContent, new Set([...answeredRunnerIds].filter((id) => !inconclusiveRunnerIds.has(id))));
3391
+ ], seedContent, new Set([...answeredRunnerIds].filter((id) => !inconclusiveRunnerIds.has(id))), ctx.modifiedRanges);
3331
3392
  if (classified.preExisting.length > 0) {
3332
3393
  const held = new Set(classified.preExisting);
3333
3394
  visibleDiagnostics = visibleDiagnostics.filter((d) => !held.has(d));
@@ -3348,14 +3409,14 @@ async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
3348
3409
  provider: ctx.telemetryProvider
3349
3410
  };
3350
3411
  if (fixedItems.length > 0) {
3351
- import("./chunk-SCU62JLX.js").then(({ appendToWorklog }) => {
3412
+ import("./chunk-UNTJJ7GN.js").then(({ appendToWorklog }) => {
3352
3413
  appendToWorklog(ctx.cwd, fixedItems, true, worklogIdentity);
3353
3414
  }).catch(() => {
3354
3415
  });
3355
3416
  }
3356
3417
  const fixableWarnings = warnings.filter((d) => d.fixable);
3357
3418
  if (fixableWarnings.length > 0) {
3358
- import("./chunk-SCU62JLX.js").then(({ appendToWorklog }) => {
3419
+ import("./chunk-UNTJJ7GN.js").then(({ appendToWorklog }) => {
3359
3420
  appendToWorklog(ctx.cwd, fixableWarnings, false, worklogIdentity);
3360
3421
  }).catch(() => {
3361
3422
  });
@@ -3363,7 +3424,7 @@ async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
3363
3424
  const inlineBlockers = blockers;
3364
3425
  const inlineFixed = fixedItems;
3365
3426
  const { notice: coverageNotice, verdict, coverage } = buildCoverageNotice(ctx, runnerLatencies, options?.dedupeCoverageNotice ?? true);
3366
- const blockerOutput = formatDiagnostics(inlineBlockers, "blocking");
3427
+ const blockerOutput = formatDiagnostics(inlineBlockers, "blocking", void 0, { editedFile: ctx.filePath, root: ctx.projectRoot ?? ctx.cwd });
3367
3428
  let output = blockerOutput;
3368
3429
  output += formatDiagnostics(inlineFixed, "fixed");
3369
3430
  const withheldMessages = [
@@ -3410,6 +3471,19 @@ async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
3410
3471
  }
3411
3472
  const sumMs = runnerLatencies.reduce((s, r) => s + r.durationMs, 0);
3412
3473
  const wallClockMs = latencyReport.totalDurationMs;
3474
+ const runnerMetadata = runnerLatencies.map((r) => {
3475
+ const row = {
3476
+ id: r.runnerId,
3477
+ startedAt: new Date(r.startTime).toISOString(),
3478
+ duration: r.durationMs,
3479
+ status: r.status
3480
+ };
3481
+ if (r.skipReason !== void 0)
3482
+ row.skipReason = r.skipReason;
3483
+ if (r.inconclusiveReason !== void 0)
3484
+ row.inconclusiveReason = r.inconclusiveReason;
3485
+ return row;
3486
+ });
3413
3487
  logLatency({
3414
3488
  type: "tool_result",
3415
3489
  filePath: ctx.filePath,
@@ -3419,12 +3493,7 @@ async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
3419
3493
  parallelGainMs: Math.max(0, sumMs - wallClockMs),
3420
3494
  result: "dispatch_complete",
3421
3495
  metadata: {
3422
- runners: runnerLatencies.map((r) => ({
3423
- id: r.runnerId,
3424
- startedAt: new Date(r.startTime).toISOString(),
3425
- duration: r.durationMs,
3426
- status: r.status
3427
- })),
3496
+ runners: runnerMetadata,
3428
3497
  totalDiagnostics: visibleDiagnostics.length,
3429
3498
  blockers: blockers.length,
3430
3499
  // #2489 round 2: distinguishes a delta baseline HIT (a prior snapshot
@@ -3469,7 +3538,8 @@ async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
3469
3538
  inconclusiveSources: {
3470
3539
  runnerIds: [...inconclusiveRunnerIds],
3471
3540
  serverIds: [...inconclusiveServerIds],
3472
- collectLaterRunnerIds: [...collectLaterRunnerIds]
3541
+ collectLaterRunnerIds: [...collectLaterRunnerIds],
3542
+ ...answeredServerIds.size > 0 && { answeredServerIds }
3473
3543
  }
3474
3544
  },
3475
3545
  verdict,
@@ -3830,6 +3900,7 @@ var DELIVERY_SURFACES = {
3830
3900
  "applyProbeFindingPolicy("
3831
3901
  ]),
3832
3902
  "git-guard:commit-blocked": labeled("clients/git-guard.ts", "Git-guard commit/push \u{1F534} COMMIT BLOCKED verdict (--lens-guard).", "Synchronous preflight rejection returned inline with the failed git command. The blocker map it reads is refreshed at decision time: the gate first judges settled collect-later runner answers through the freshness gate and the finding policy (#3814), so a stale answer cannot block.", "live"),
3903
+ "staged-delta:commit-blocked": labeled("clients/staged-delta.ts", "Staged-delta \u{1F534} COMMIT BLOCKED verdict (--lens-guard) for blockers the commit adds, and the degraded refusal when that read gave no answer (#5553).", "Synchronous preflight rejection returned inline with the failed git command. The gate lists the staged set and runs the lanes over the bytes at decision time, so nothing stored is replayed and a finding cannot go stale between detection and delivery.", "live"),
3833
3904
  "shared-checkout-guard:worktree-mutation-blocked": labeled("clients/shared-checkout-guard.ts", "Shared-checkout \u{1F534} WORKING-TREE CHANGE BLOCKED verdict (--lens-checkout-guard).", "Synchronous preflight rejection returned inline with the failed git command. Both inputs are read at decision time \u2014 the instance registry and `git status` \u2014 so no stored finding is replayed and nothing can go stale between detection and delivery.", "live"),
3834
3905
  "read-guard-tool-lines:preflight-errors": labeled("clients/read-guard-tool-lines.ts", "Read-guard hashline BLOCKED / RE-READ REQUIRED / PARTIAL APPLY / ALREADY APPLIED preflight errors (#2402).", "Computed fresh per edit attempt and returned as that attempt's rejection \u2014 no cached findings are replayed, so there is no staleness window. The PARTIAL APPLY and ALREADY APPLIED variants describe the same attempt's commit outcome; applied-edit recognition reads RuntimeCoordinator's session-scoped record, which resets with the session.", "live"),
3835
3906
  "mutating-tool:adapter-preflight-errors": labeled("clients/mutating-tool.ts", "Shape-adapter BLOCKED preflight errors for hashline edit inputs the adapter recognized but could not resolve to a range (#2423).", "Computed fresh from the tool input on each attempt and returned as that attempt's rejection, so there is no staleness window. The adapters read only the call's own arguments; nothing cached is replayed.", "live"),
@@ -5821,7 +5892,113 @@ ${result.stderr ?? ""}`.trim();
5821
5892
  var cpp_check_default = cppCheckRunner;
5822
5893
 
5823
5894
  // dist/clients/dispatch/runners/credo.js
5895
+ import * as path11 from "node:path";
5896
+
5897
+ // dist/clients/dispatch/runners/utils/ignore-anchor.js
5898
+ import * as fs6 from "node:fs";
5824
5899
  import * as path10 from "node:path";
5900
+ function escapeGlobLiteral(literal) {
5901
+ return literal.replace(/[\\*?[\]{}]/g, "\\$&");
5902
+ }
5903
+ function globRoot(root) {
5904
+ const slashed = toPosix(root);
5905
+ const trimmed = slashed.length > 1 ? slashed.replace(/\/+$/, "") : slashed;
5906
+ return escapeGlobLiteral(trimmed);
5907
+ }
5908
+ function isAbsolutePattern(pattern) {
5909
+ return pattern.startsWith("/") || /^[A-Za-z]:[\\/]/.test(pattern);
5910
+ }
5911
+ function tailIsBounded(tail, dialect) {
5912
+ if (dialect === "fnmatch")
5913
+ return /^[^*?[\\/]/.test(tail);
5914
+ if (tail === "")
5915
+ return false;
5916
+ if (!tail.includes("/") && !tail.includes("**"))
5917
+ return true;
5918
+ const head = (tail.split("/")[0] ?? "").replace(/\[[^\]]*\]|\{[^{}]*\}/g, "");
5919
+ return !/[{}\\]/.test(head) && /[^*?]/.test(head);
5920
+ }
5921
+ function anchorIgnorePattern(pattern, root, dialect) {
5922
+ let rest = pattern;
5923
+ if (dialect === "java-glob") {
5924
+ if (rest.startsWith("glob:"))
5925
+ rest = rest.slice("glob:".length);
5926
+ else if (/^[A-Za-z][A-Za-z0-9+.-]+:/.test(rest))
5927
+ return null;
5928
+ }
5929
+ if (rest.length === 0)
5930
+ return null;
5931
+ if (isAbsolutePattern(rest))
5932
+ return [rest];
5933
+ const anchor = globRoot(root);
5934
+ if (dialect === "java-glob") {
5935
+ if (rest.startsWith("**/")) {
5936
+ const tail = rest.slice(3);
5937
+ if (!tailIsBounded(tail, dialect))
5938
+ return null;
5939
+ return [`${anchor}/${tail}`, `${anchor}/**/${tail}`];
5940
+ }
5941
+ return /^[A-Za-z0-9_.-]/.test(rest) ? [rest] : null;
5942
+ }
5943
+ if (rest.startsWith("*")) {
5944
+ const lead = /^\*+\/(.*)$/.exec(rest);
5945
+ const tail = lead ? lead[1] ?? "" : rest.replace(/^\*+/, "");
5946
+ if (!tailIsBounded(tail, dialect))
5947
+ return null;
5948
+ if (lead)
5949
+ return [`${anchor}/${tail}`, `${anchor}/*/${tail}`];
5950
+ return [`${anchor}/${rest}`];
5951
+ }
5952
+ return null;
5953
+ }
5954
+ function anchorIgnorePatterns(patterns, root, dialect) {
5955
+ const out = [];
5956
+ for (const pattern of patterns) {
5957
+ const anchored = anchorIgnorePattern(pattern, root, dialect);
5958
+ if (anchored === null)
5959
+ return { unrecognized: pattern };
5960
+ for (const entry of anchored)
5961
+ if (!out.includes(entry))
5962
+ out.push(entry);
5963
+ }
5964
+ return { patterns: out };
5965
+ }
5966
+ function pathExists(entry) {
5967
+ return fs6.existsSync(entry);
5968
+ }
5969
+ function readConfigText(tool, file) {
5970
+ try {
5971
+ return { kind: "read", text: fs6.readFileSync(file, "utf8") };
5972
+ } catch (err) {
5973
+ return {
5974
+ kind: "unapplied",
5975
+ reason: `its ${tool} config is unreadable (${err.code ?? "read failed"})`
5976
+ };
5977
+ }
5978
+ }
5979
+ async function withOverlayFile(tool, fileName, text, use) {
5980
+ const dir = fs6.mkdtempSync(path10.join(scannerReportParentDir(), `pi-lens-${tool}-anchor-`));
5981
+ try {
5982
+ const tmpFile = path10.join(dir, fileName);
5983
+ fs6.writeFileSync(tmpFile, text);
5984
+ return await use(tmpFile);
5985
+ } finally {
5986
+ fs6.rmSync(dir, { recursive: true, force: true });
5987
+ }
5988
+ }
5989
+ function markUnanchored(tool, reason, result) {
5990
+ incrementDegradationCount({
5991
+ kind: "runner-ignore-unanchored",
5992
+ subject: tool,
5993
+ reason: `${tool} ran on the project's own config: ${reason}`
5994
+ });
5995
+ if (result.status === "succeeded" && result.diagnostics.length === 0) {
5996
+ return { ...result, inconclusive: true };
5997
+ }
5998
+ return result;
5999
+ }
6000
+
6001
+ // dist/clients/dispatch/runners/credo.js
5825
6002
  var CREDO_PROBE_BUDGET_MS = 1e4;
5826
6003
  var probeCredo = createCwdCachedProbe((cwd) => safeSpawnAsync("mix", ["credo", "--version"], {
5827
6004
  timeout: CREDO_PROBE_BUDGET_MS,
@@ -5833,7 +6010,7 @@ function parseCredoJson(raw, fallbackPath, cwd) {
5833
6010
  return (output.issues ?? []).map((issue) => ({
5834
6011
  id: `credo:${issue.check}:${issue.line_no}`,
5835
6012
  message: `[${issue.check}] ${issue.message}`,
5836
- filePath: issue.filename && issue.filename.trim() ? path10.isAbsolute(issue.filename) ? issue.filename : path10.resolve(cwd, issue.filename) : fallbackPath,
6013
+ filePath: issue.filename && issue.filename.trim() ? path11.isAbsolute(issue.filename) ? issue.filename : path11.resolve(cwd, issue.filename) : fallbackPath,
5837
6014
  line: issue.line_no,
5838
6015
  column: issue.column ?? 1,
5839
6016
  severity: issue.priority <= 10 ? "error" : "warning",
@@ -5846,6 +6023,119 @@ function parseCredoJson(raw, fallbackPath, cwd) {
5846
6023
  return [];
5847
6024
  }
5848
6025
  }
6026
+ var CREDO_ANCHOR_OVERLAY = `refuse = fn why -> raise "pi-lens-ignore-unanchored: #{why}" end
6027
+
6028
+ try do
6029
+ root = System.get_env("PI_LENS_ANCHOR_ROOT") || refuse.("no project root")
6030
+ target = System.get_env("PI_LENS_ANCHOR_TARGET") || refuse.("no target file")
6031
+ prefix = String.trim_trailing(root, "/") <> "/"
6032
+
6033
+ if not String.starts_with?(target, prefix),
6034
+ do: refuse.("the file is outside the project root")
6035
+
6036
+ rel = "/" <> binary_part(target, byte_size(prefix), byte_size(target) - byte_size(prefix))
6037
+ overlay = Path.expand(__ENV__.file)
6038
+
6039
+ inner =
6040
+ exec
6041
+ |> Credo.Execution.get_config_files()
6042
+ |> Enum.reject(fn {origin, file, _} -> origin == :file and Path.expand(file) == overlay end)
6043
+ |> Enum.reduce(Credo.Execution.build([]), &Credo.Execution.append_config_file(&2, &1))
6044
+
6045
+ dir = Credo.CLI.Filename.remove_line_no_and_column(exec.cli_options.path)
6046
+ name = exec.cli_options.switches[:config_name]
6047
+
6048
+ config =
6049
+ case Credo.ConfigFile.read_or_default(inner, dir, name) do
6050
+ {:ok, config} -> config
6051
+ {:error, _} -> refuse.("the project's credo config did not load")
6052
+ end
6053
+
6054
+ neutral = "/pi-lens-anchor/pi-lens-root" <> rel
6055
+
6056
+ decide = fn regex ->
6057
+ here = Regex.match?(regex, target)
6058
+
6059
+ cond do
6060
+ Regex.match?(regex, neutral) == here -> here
6061
+ here and Regex.match?(regex, prefix) -> false
6062
+ true -> refuse.("a files.excluded regex reads the project's own path")
6063
+ end
6064
+ end
6065
+
6066
+ anchor_excluded = fn listed ->
6067
+ {regexes, others} = Enum.split_with(List.wrap(listed), &match?(%Regex{}, &1))
6068
+ if Enum.any?(Enum.map(regexes, decide)), do: others ++ [target], else: others
6069
+ end
6070
+
6071
+ excluded = anchor_excluded.(config.files.excluded)
6072
+
6073
+ fix_params = fn params ->
6074
+ if Keyword.keyword?(params) do
6075
+ Enum.map(params, fn
6076
+ {key, files} when key in [:files, :__files__] and (is_map(files) or is_list(files)) ->
6077
+ case files[:excluded] do
6078
+ nil ->
6079
+ {key, files}
6080
+
6081
+ listed ->
6082
+ kept = anchor_excluded.(listed)
6083
+
6084
+ {key,
6085
+ if(is_map(files),
6086
+ do: Map.put(files, :excluded, kept),
6087
+ else: Keyword.put(files, :excluded, kept)
6088
+ )}
6089
+ end
6090
+
6091
+ other ->
6092
+ other
6093
+ end)
6094
+ else
6095
+ params
6096
+ end
6097
+ end
6098
+
6099
+ fix_check = fn
6100
+ {check, params} when is_list(params) -> {check, fix_params.(params)}
6101
+ other -> other
6102
+ end
6103
+
6104
+ checks =
6105
+ case config.checks do
6106
+ %{} = grouped ->
6107
+ Map.new(grouped, fn
6108
+ {group, list} when is_list(list) -> {group, Enum.map(list, fix_check)}
6109
+ other -> other
6110
+ end)
6111
+
6112
+ list when is_list(list) ->
6113
+ Enum.map(list, fix_check)
6114
+
6115
+ other ->
6116
+ other
6117
+ end
6118
+
6119
+ %{
6120
+ configs: [
6121
+ %{
6122
+ name: name || "default",
6123
+ files: %{included: config.files.included, excluded: excluded},
6124
+ checks: checks,
6125
+ color: config.color,
6126
+ parse_timeout: config.parse_timeout,
6127
+ plugins: config.plugins,
6128
+ requires: config.requires,
6129
+ strict: config.strict
6130
+ }
6131
+ ]
6132
+ }
6133
+ rescue
6134
+ error ->
6135
+ reason = String.replace_prefix(Exception.message(error), "pi-lens-ignore-unanchored: ", "")
6136
+ refuse.(reason)
6137
+ end`;
6138
+ var CREDO_UNANCHORED_REFUSAL = /^warning: Execution halted during [^\n]*%RuntimeError\{message: "pi-lens-ignore-unanchored: ((?:[^"\\\n]|\\.)*)"/m;
5849
6139
  var credoRunner = {
5850
6140
  id: "credo",
5851
6141
  appliesTo: ["elixir"],
@@ -5861,29 +6151,168 @@ var credoRunner = {
5861
6151
  if (!await probeCredo(cwd)) {
5862
6152
  return toolAbsentSkip(cwd, { checker: probeCredo });
5863
6153
  }
5864
- const absPath = path10.resolve(cwd, ctx.filePath);
5865
- const result = await safeSpawnAsync("mix", ["credo", "--format", "json", "--strict", absPath], { timeout: 3e4, cwd });
6154
+ const absPath = path11.resolve(cwd, ctx.filePath);
6155
+ const spawnCredo = (config, env) => safeSpawnAsync("mix", ["credo", "--format", "json", "--strict", ...config, absPath], { timeout: 3e4, cwd, ...env ? { env } : {} });
6156
+ const anchoredRun = await withOverlayFile("credo", "anchor.exs", CREDO_ANCHOR_OVERLAY, (file) => spawnCredo(["--config-file", file], {
6157
+ PI_LENS_ANCHOR_ROOT: cwd,
6158
+ PI_LENS_ANCHOR_TARGET: absPath
6159
+ }));
6160
+ const refusal = CREDO_UNANCHORED_REFUSAL.exec(anchoredRun.stderr ?? "");
6161
+ const result = refusal ? await spawnCredo([]) : anchoredRun;
6162
+ const finish = (verdict) => refusal ? markUnanchored("credo", refusal[1] ?? "no reason given", verdict) : verdict;
5866
6163
  const parsed = parseToolRun("credo", {
5867
6164
  result,
5868
- // EXIT TABLE (Credo 1.7 measured fixture): 0 clean; 1 findings; 2 error; other nonzero rejected.
5869
- exitCodes: { ran: [1, 2] }
6165
+ // EXIT TABLE (Credo 1.7 measured fixture): the nonzero status is a
6166
+ // category bitmask. Stock categories set bits 1, 2, 4, 8 and 16, so a
6167
+ // stock run exits 1..31; 32..127 come only from custom checks.
6168
+ // Admitted statuses (the full bitmask): 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127; rejected statuses: 128+.
6169
+ exitCodes: {
6170
+ ran: [
6171
+ 1,
6172
+ 2,
6173
+ 3,
6174
+ 4,
6175
+ 5,
6176
+ 6,
6177
+ 7,
6178
+ 8,
6179
+ 9,
6180
+ 10,
6181
+ 11,
6182
+ 12,
6183
+ 13,
6184
+ 14,
6185
+ 15,
6186
+ 16,
6187
+ 17,
6188
+ 18,
6189
+ 19,
6190
+ 20,
6191
+ 21,
6192
+ 22,
6193
+ 23,
6194
+ 24,
6195
+ 25,
6196
+ 26,
6197
+ 27,
6198
+ 28,
6199
+ 29,
6200
+ 30,
6201
+ 31,
6202
+ 32,
6203
+ 33,
6204
+ 34,
6205
+ 35,
6206
+ 36,
6207
+ 37,
6208
+ 38,
6209
+ 39,
6210
+ 40,
6211
+ 41,
6212
+ 42,
6213
+ 43,
6214
+ 44,
6215
+ 45,
6216
+ 46,
6217
+ 47,
6218
+ 48,
6219
+ 49,
6220
+ 50,
6221
+ 51,
6222
+ 52,
6223
+ 53,
6224
+ 54,
6225
+ 55,
6226
+ 56,
6227
+ 57,
6228
+ 58,
6229
+ 59,
6230
+ 60,
6231
+ 61,
6232
+ 62,
6233
+ 63,
6234
+ 64,
6235
+ 65,
6236
+ 66,
6237
+ 67,
6238
+ 68,
6239
+ 69,
6240
+ 70,
6241
+ 71,
6242
+ 72,
6243
+ 73,
6244
+ 74,
6245
+ 75,
6246
+ 76,
6247
+ 77,
6248
+ 78,
6249
+ 79,
6250
+ 80,
6251
+ 81,
6252
+ 82,
6253
+ 83,
6254
+ 84,
6255
+ 85,
6256
+ 86,
6257
+ 87,
6258
+ 88,
6259
+ 89,
6260
+ 90,
6261
+ 91,
6262
+ 92,
6263
+ 93,
6264
+ 94,
6265
+ 95,
6266
+ 96,
6267
+ 97,
6268
+ 98,
6269
+ 99,
6270
+ 100,
6271
+ 101,
6272
+ 102,
6273
+ 103,
6274
+ 104,
6275
+ 105,
6276
+ 106,
6277
+ 107,
6278
+ 108,
6279
+ 109,
6280
+ 110,
6281
+ 111,
6282
+ 112,
6283
+ 113,
6284
+ 114,
6285
+ 115,
6286
+ 116,
6287
+ 117,
6288
+ 118,
6289
+ 119,
6290
+ 120,
6291
+ 121,
6292
+ 122,
6293
+ 123,
6294
+ 124,
6295
+ 125,
6296
+ 126,
6297
+ 127
6298
+ ]
6299
+ }
5870
6300
  }, (raw) => parseCredoJson(raw, ctx.filePath, cwd), { parseStreams: "stdout-else-stderr" });
5871
6301
  if (parsed.skipped)
5872
6302
  return parsed.skipped;
5873
- return finishParsedRun({
6303
+ return finish(finishParsedRun({
5874
6304
  tool: "credo",
5875
6305
  ctx,
5876
6306
  result,
5877
6307
  diagnostics: parsed.diagnostics
5878
- });
6308
+ }));
5879
6309
  }
5880
6310
  };
5881
6311
  var credo_default = credoRunner;
5882
6312
 
5883
6313
  // dist/clients/dispatch/runners/cue-vet.js
5884
- import * as fs6 from "node:fs";
5885
- import * as path11 from "node:path";
5886
- var cue = createAvailabilityChecker("cue", ".exe", ["version"]);
6314
+ import * as fs7 from "node:fs";
6315
+ import * as path12 from "node:path";
5887
6316
  function parseCueVetOutput(raw) {
5888
6317
  const errors = [];
5889
6318
  let current = null;
@@ -5928,7 +6357,7 @@ function hasPackageClause(content) {
5928
6357
  return false;
5929
6358
  }
5930
6359
  function locationMatchesFile(location, absTarget, vetCwd) {
5931
- return pathsEqual(path11.resolve(vetCwd, location.file), absTarget);
6360
+ return pathsEqual(path12.resolve(vetCwd, location.file), absTarget);
5932
6361
  }
5933
6362
  function toDiagnostic2(id, message, fileName, line, column) {
5934
6363
  return {
@@ -5947,7 +6376,7 @@ function toDiagnostic2(id, message, fileName, line, column) {
5947
6376
  function filterToTouchedFile(errors, fileName, vetCwd) {
5948
6377
  if (errors.length === 0)
5949
6378
  return void 0;
5950
- const absTarget = path11.resolve(vetCwd, fileName);
6379
+ const absTarget = path12.resolve(vetCwd, fileName);
5951
6380
  const withLocation = errors.filter((error) => error.locations.length > 0);
5952
6381
  const unattributable = errors.filter((error) => error.locations.length === 0);
5953
6382
  if (withLocation.length === 0)
@@ -5972,21 +6401,16 @@ var cueVetRunner = {
5972
6401
  timeoutMs: 3e4,
5973
6402
  async run(ctx) {
5974
6403
  const cwd = resolveRunnerCwd(ctx, "cue-vet");
5975
- let cmd = null;
5976
- if (await cue.isAvailableAsync(cwd)) {
5977
- cmd = cue.getCommand(cwd);
5978
- } else {
5979
- cmd = await resolveAvailableOrInstall(cue, "cue", cwd);
5980
- }
6404
+ const cmd = await resolveToolCommandWithInstallFallback(cwd, "cue");
5981
6405
  if (!cmd)
5982
- return toolAbsentSkip(cwd, { id: "cue", checker: cue });
5983
- const absPath = path11.resolve(cwd, ctx.filePath);
5984
- const fileDir = path11.dirname(absPath);
5985
- const fileName = path11.basename(absPath);
6406
+ return toolAbsentSkip(cwd, { id: "cue" });
6407
+ const absPath = path12.resolve(cwd, ctx.filePath);
6408
+ const fileDir = path12.dirname(absPath);
6409
+ const fileName = path12.basename(absPath);
5986
6410
  const singleFileArgs = ["vet", "-c=false", `./${fileName}`];
5987
6411
  let touchedContent = null;
5988
6412
  try {
5989
- touchedContent = fs6.readFileSync(absPath, "utf8");
6413
+ touchedContent = fs7.readFileSync(absPath, "utf8");
5990
6414
  } catch {
5991
6415
  touchedContent = null;
5992
6416
  }
@@ -6044,7 +6468,7 @@ ${result.stderr || ""}`.trim();
6044
6468
  var cue_vet_default = cueVetRunner;
6045
6469
 
6046
6470
  // dist/clients/dispatch/runners/dart-analyze.js
6047
- import * as path12 from "node:path";
6471
+ import * as path13 from "node:path";
6048
6472
  var dart = createAvailabilityChecker("dart", ".exe");
6049
6473
  var flutter = createAvailabilityChecker("flutter", ".bat");
6050
6474
  var DART_FIXABLE_RULES = /* @__PURE__ */ new Set([
@@ -6131,7 +6555,7 @@ var DART_FIXABLE_RULES = /* @__PURE__ */ new Set([
6131
6555
  ]);
6132
6556
  function parseDartMachineOutput(raw, filePath, cwd) {
6133
6557
  const diagnostics = [];
6134
- const absTarget = path12.resolve(cwd, filePath);
6558
+ const absTarget = path13.resolve(cwd, filePath);
6135
6559
  for (const line of raw.split(/\r?\n/)) {
6136
6560
  if (!line.trim())
6137
6561
  continue;
@@ -6142,7 +6566,7 @@ function parseDartMachineOutput(raw, filePath, cwd) {
6142
6566
  const message = messageParts.join("|").trim();
6143
6567
  const lineNum = parseInt(lineStr, 10);
6144
6568
  const colNum = parseInt(colStr, 10);
6145
- if (!pathsEqual(path12.resolve(cwd, file?.trim() ?? ""), absTarget))
6569
+ if (!pathsEqual(path13.resolve(cwd, file?.trim() ?? ""), absTarget))
6146
6570
  continue;
6147
6571
  const severity = severityStr?.trim().toLowerCase() === "error" ? "error" : "warning";
6148
6572
  const ruleId = code?.trim() ?? "dart";
@@ -6171,7 +6595,7 @@ var dartAnalyzeRunner = {
6171
6595
  skipTestFiles: false,
6172
6596
  async run(ctx) {
6173
6597
  const cwd = resolveRunnerCwd(ctx, "dart-analyze");
6174
- const absPath = path12.resolve(cwd, ctx.filePath);
6598
+ const absPath = path13.resolve(cwd, ctx.filePath);
6175
6599
  const dartAvailable = await dart.isAvailableAsync(cwd);
6176
6600
  const flutterAvailable = !dartAvailable && await flutter.isAvailableAsync(cwd);
6177
6601
  if (!dartAvailable && !flutterAvailable) {
@@ -6203,7 +6627,7 @@ var dartAnalyzeRunner = {
6203
6627
  var dart_analyze_default = dartAnalyzeRunner;
6204
6628
 
6205
6629
  // dist/clients/dispatch/runners/detekt.js
6206
- import * as path13 from "node:path";
6630
+ import * as path14 from "node:path";
6207
6631
  var DETEKT_FIXABLE_RULES = /* @__PURE__ */ new Set([
6208
6632
  // formatting (ktlint wrapper) — every rule supports autocorrect
6209
6633
  "AnnotationOnSeparateLine",
@@ -6272,11 +6696,11 @@ function parseDetektOutput(raw, filePath, cwd) {
6272
6696
  return diagnostics;
6273
6697
  let located = 0;
6274
6698
  const pattern = /^(.+?):(\d+):(\d+): (?:(error|warning): )?(.+?)(?:\s+\[([^\]]+)\])?$/gm;
6275
- const absTarget = path13.resolve(cwd, filePath);
6699
+ const absTarget = path14.resolve(cwd, filePath);
6276
6700
  for (const match of raw.matchAll(pattern)) {
6277
6701
  const [, file, lineStr, colStr, level, message, rule] = match;
6278
6702
  located += 1;
6279
- if (!pathsEqual(path13.resolve(cwd, file.trim()), absTarget))
6703
+ if (!pathsEqual(path14.resolve(cwd, file.trim()), absTarget))
6280
6704
  continue;
6281
6705
  const severity = level === "error" ? "error" : "warning";
6282
6706
  const lineNum = Number.parseInt(lineStr, 10);
@@ -6300,6 +6724,98 @@ function parseDetektOutput(raw, filePath, cwd) {
6300
6724
  }
6301
6725
  return located > 0 ? diagnostics : null;
6302
6726
  }
6727
+ var DETEKT_NON_RULESET_KEYS = /* @__PURE__ */ new Set([
6728
+ "build",
6729
+ "config",
6730
+ "processors",
6731
+ "console-reports",
6732
+ "output-reports"
6733
+ ]);
6734
+ var DETEKT_PATH_FILTER_KEYS = ["excludes", "includes"];
6735
+ function isPlainObject(value) {
6736
+ return typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
6737
+ }
6738
+ function anchorDetektConfig(text, root) {
6739
+ if (text.trim() === "")
6740
+ return { kind: "unchanged" };
6741
+ let tree;
6742
+ try {
6743
+ tree = js_yaml_default.load(text);
6744
+ } catch (err) {
6745
+ return {
6746
+ kind: "unapplied",
6747
+ reason: `its detekt config is not readable YAML (${err instanceof Error ? err.message.split("\n")[0] : "load failed"})`
6748
+ };
6749
+ }
6750
+ if (tree === null || tree === void 0)
6751
+ return { kind: "unchanged" };
6752
+ if (!isPlainObject(tree)) {
6753
+ return {
6754
+ kind: "unapplied",
6755
+ reason: "its detekt config is not a map of rule sets"
6756
+ };
6757
+ }
6758
+ const overlay = /* @__PURE__ */ Object.create(null);
6759
+ let refused;
6760
+ const rewrite = (holder, place) => {
6761
+ for (const key of DETEKT_PATH_FILTER_KEYS) {
6762
+ const value = holder[key];
6763
+ if (value === void 0 || value === null)
6764
+ continue;
6765
+ let entries;
6766
+ if (typeof value === "string") {
6767
+ if (/[{}]/.test(value)) {
6768
+ refused = `an ${key} string holds braces: ${value}`;
6769
+ return;
6770
+ }
6771
+ entries = value.split(",").flatMap((entry) => {
6772
+ const trimmed = entry.trim();
6773
+ return trimmed.length > 0 ? [trimmed] : [];
6774
+ });
6775
+ } else if (Array.isArray(value) && value.every((entry) => typeof entry === "string")) {
6776
+ entries = value;
6777
+ } else {
6778
+ refused = `an ${key} value is not a glob list`;
6779
+ return;
6780
+ }
6781
+ const anchored = anchorIgnorePatterns(entries, root, "java-glob");
6782
+ if ("unrecognized" in anchored) {
6783
+ refused = `${key} entry ${JSON.stringify(anchored.unrecognized)} is not a form it can anchor`;
6784
+ return;
6785
+ }
6786
+ if (anchored.patterns.length !== entries.length || anchored.patterns.some((entry, index) => entry !== entries[index])) {
6787
+ place()[key] = anchored.patterns;
6788
+ }
6789
+ }
6790
+ };
6791
+ for (const [name, ruleset] of Object.entries(tree)) {
6792
+ if (DETEKT_NON_RULESET_KEYS.has(name) || !isPlainObject(ruleset))
6793
+ continue;
6794
+ const rulesetPlace = () => overlay[name] ??= /* @__PURE__ */ Object.create(null);
6795
+ rewrite(ruleset, rulesetPlace);
6796
+ for (const [ruleName, rule] of Object.entries(ruleset)) {
6797
+ if (refused)
6798
+ break;
6799
+ if (isPlainObject(rule)) {
6800
+ rewrite(rule, () => {
6801
+ const set = rulesetPlace();
6802
+ return set[ruleName] ??= /* @__PURE__ */ Object.create(null);
6803
+ });
6804
+ }
6805
+ }
6806
+ if (refused)
6807
+ break;
6808
+ }
6809
+ if (refused) {
6810
+ return { kind: "unapplied", reason: `its detekt config: ${refused}` };
6811
+ }
6812
+ if (Object.keys(overlay).length === 0)
6813
+ return { kind: "unchanged" };
6814
+ return {
6815
+ kind: "rewritten",
6816
+ text: js_yaml_default.dump(overlay, { lineWidth: -1, noRefs: true })
6817
+ };
6818
+ }
6303
6819
  var detektRunner = {
6304
6820
  id: "detekt",
6305
6821
  appliesTo: ["kotlin"],
@@ -6320,8 +6836,15 @@ var detektRunner = {
6320
6836
  const cmd = await resolveToolCommandWithInstallFallback(cwd, "detekt");
6321
6837
  if (!cmd)
6322
6838
  return toolAbsentSkip(cwd, { id: "detekt" });
6323
- const absPath = path13.resolve(cwd, ctx.filePath);
6324
- const result = await safeSpawnAsync(cmd, ["--input", absPath, "--config", configPath], { cwd, timeout: 6e4 });
6839
+ const absPath = path14.resolve(cwd, ctx.filePath);
6840
+ const read = readConfigText("detekt", configPath);
6841
+ const anchored = read.kind === "read" ? anchorDetektConfig(read.text, cwd) : read;
6842
+ const finish = (verdict2) => anchored.kind === "unapplied" ? markUnanchored("detekt", anchored.reason, verdict2) : verdict2;
6843
+ const spawnDetekt = (config) => safeSpawnAsync(cmd, ["--input", absPath, "--config", config], {
6844
+ cwd,
6845
+ timeout: 6e4
6846
+ });
6847
+ const result = anchored.kind === "rewritten" ? await withOverlayFile("detekt", "detekt.yml", anchored.text, (file) => spawnDetekt(`${configPath},${file}`)) : await spawnDetekt(configPath);
6325
6848
  const raw = `${result.stdout ?? ""}${result.stderr ?? ""}`;
6326
6849
  const run = parseToolRun("detekt", {
6327
6850
  result,
@@ -6352,18 +6875,18 @@ var detektRunner = {
6352
6875
  }
6353
6876
  });
6354
6877
  if (run.diagnostics.length === 0)
6355
- return verdict;
6356
- return result.status === 1 ? { ...verdict, inconclusive: true } : verdict;
6878
+ return finish(verdict);
6879
+ return finish(result.status === 1 ? { ...verdict, inconclusive: true } : verdict);
6357
6880
  }
6358
6881
  };
6359
6882
  var detekt_default = detektRunner;
6360
6883
 
6361
6884
  // dist/clients/dispatch/runners/dotnet-build.js
6362
- import * as fs7 from "node:fs";
6363
- import * as path14 from "node:path";
6885
+ import * as fs8 from "node:fs";
6886
+ import * as path15 from "node:path";
6364
6887
  var dotnet = createAvailabilityChecker("dotnet", ".exe");
6365
6888
  function findProjectTarget(cwd) {
6366
- const entries = fs7.readdirSync(cwd, { withFileTypes: true });
6889
+ const entries = fs8.readdirSync(cwd, { withFileTypes: true });
6367
6890
  for (const patterns of [
6368
6891
  DOTNET_CSHARP_SOLUTION_MARKERS,
6369
6892
  DOTNET_CSHARP_PROJECT_MARKERS
@@ -6441,13 +6964,13 @@ function parseDotnetDiagnosticLine(line) {
6441
6964
  }
6442
6965
  function parseDotnetBuildOutput(raw, filePath, cwd) {
6443
6966
  const diagnostics = [];
6444
- const absTarget = path14.resolve(cwd, filePath);
6967
+ const absTarget = path15.resolve(cwd, filePath);
6445
6968
  for (const line of raw.split(/\r?\n/)) {
6446
6969
  const parsed = parseDotnetDiagnosticLine(line);
6447
6970
  if (!parsed)
6448
6971
  continue;
6449
6972
  const { reportedFile, lineStr, colStr, severityLabel, rule, message } = parsed;
6450
- if (!pathsEqual(path14.resolve(cwd, reportedFile), absTarget))
6973
+ if (!pathsEqual(path15.resolve(cwd, reportedFile), absTarget))
6451
6974
  continue;
6452
6975
  const severity = severityLabel.toLowerCase() === "error" ? "error" : "warning";
6453
6976
  const lineNum = Number.parseInt(lineStr, 10) || 1;
@@ -6518,16 +7041,16 @@ ${result.stderr ?? ""}`.trim();
6518
7041
  var dotnet_build_default = dotnetBuildRunner;
6519
7042
 
6520
7043
  // dist/clients/dispatch/runners/elixir-check.js
6521
- import * as fs8 from "node:fs";
6522
- import * as path15 from "node:path";
7044
+ import * as fs9 from "node:fs";
7045
+ import * as path16 from "node:path";
6523
7046
  var mix = createAvailabilityChecker("mix", ".bat");
6524
7047
  var elixirc = createAvailabilityChecker("elixirc", ".bat");
6525
7048
  var ELIXIR_SNIPPET_LOCATION = /└─\s+(.+?):(\d+)(?::(\d+))?(?::|$)/;
6526
7049
  function parseElixirOutput(raw, filePath, cwd = process.cwd()) {
6527
7050
  const diagnostics = [];
6528
- const resolvedTarget = path15.resolve(cwd, filePath);
7051
+ const resolvedTarget = path16.resolve(cwd, filePath);
6529
7052
  const lines = raw.split(/\r?\n/);
6530
- const matchesTarget = (sourcePath) => pathsEqual(path15.resolve(cwd, sourcePath.trim()), resolvedTarget);
7053
+ const matchesTarget = (sourcePath) => pathsEqual(path16.resolve(cwd, sourcePath.trim()), resolvedTarget);
6531
7054
  for (let index = 0; index < lines.length; index++) {
6532
7055
  const line = lines[index];
6533
7056
  if (line.length > 2e3)
@@ -6612,7 +7135,7 @@ var elixirCheckRunner = {
6612
7135
  skipTestFiles: false,
6613
7136
  async run(ctx) {
6614
7137
  const cwd = resolveRunnerCwd(ctx, "elixir-check");
6615
- const absPath = path15.resolve(cwd, ctx.filePath);
7138
+ const absPath = path16.resolve(cwd, ctx.filePath);
6616
7139
  let command;
6617
7140
  let args = [];
6618
7141
  const mixProject = hasToolConfig("mix", cwd);
@@ -6620,8 +7143,8 @@ var elixirCheckRunner = {
6620
7143
  command = "mix";
6621
7144
  args = ["compile", "--warnings-as-errors"];
6622
7145
  } else if (await elixirc.isAvailableAsync(cwd)) {
6623
- const outDir = path15.join(getProjectDataDir(cwd), "elixir-check");
6624
- fs8.mkdirSync(outDir, { recursive: true });
7146
+ const outDir = path16.join(getProjectDataDir(cwd), "elixir-check");
7147
+ fs9.mkdirSync(outDir, { recursive: true });
6625
7148
  command = "elixirc";
6626
7149
  args = ["-o", outDir, absPath];
6627
7150
  }
@@ -6666,7 +7189,7 @@ ${result.stdout || ""}`;
6666
7189
  var elixir_check_default = elixirCheckRunner;
6667
7190
 
6668
7191
  // dist/clients/dispatch/runners/eslint.js
6669
- import * as path16 from "node:path";
7192
+ import * as path17 from "node:path";
6670
7193
  var ESLINT_PROBE_BUDGET_MS = 5e3;
6671
7194
  function makeEslintProbe(cmd) {
6672
7195
  return createCwdCachedProbe((cwd) => safeSpawnAsync(cmd, ["--version"], {
@@ -6692,9 +7215,9 @@ function parseEslintJson(raw, filePath, cwd) {
6692
7215
  const results = JSON.parse(raw);
6693
7216
  const autofix = getAutofixCapability("eslint");
6694
7217
  const diagnostics = [];
6695
- const absTarget = path16.resolve(cwd, filePath);
7218
+ const absTarget = path17.resolve(cwd, filePath);
6696
7219
  for (const fileResult of results) {
6697
- if (fileResult.filePath && !pathsEqual(path16.resolve(cwd, fileResult.filePath), absTarget))
7220
+ if (fileResult.filePath && !pathsEqual(path17.resolve(cwd, fileResult.filePath), absTarget))
6698
7221
  continue;
6699
7222
  for (const msg of fileResult.messages) {
6700
7223
  const severity = msg.severity === 2 ? "error" : "warning";
@@ -6727,6 +7250,7 @@ var eslintRunner = {
6727
7250
  appliesTo: ["jsts"],
6728
7251
  priority: PRIORITY.LINT_SECONDARY,
6729
7252
  requiresConfig: (cwd) => hasToolConfig("eslint", cwd),
7253
+ lintsGivenContent: true,
6730
7254
  async run(ctx) {
6731
7255
  const resolution = resolveRunnerCwdWithReason(ctx, "eslint");
6732
7256
  const cwd = resolution.cwd;
@@ -6739,7 +7263,16 @@ var eslintRunner = {
6739
7263
  if (!await eslintProbe(packageDir)) {
6740
7264
  return toolAbsentSkip(packageDir, { checker: eslintProbe });
6741
7265
  }
6742
- const result = await safeSpawnAsync(cmd, ["--format", "json", "--no-error-on-unmatched-pattern", ctx.filePath], { timeout: 3e4, cwd });
7266
+ const result = await safeSpawnAsync(cmd, [
7267
+ "--format",
7268
+ "json",
7269
+ "--no-error-on-unmatched-pattern",
7270
+ ...ctx.givenContent === void 0 ? [ctx.filePath] : ["--stdin", "--stdin-filename", ctx.filePath]
7271
+ ], {
7272
+ timeout: 3e4,
7273
+ cwd,
7274
+ ...ctx.givenContent !== void 0 && { input: ctx.givenContent }
7275
+ });
6743
7276
  const parsed = parseToolRun("eslint", {
6744
7277
  result,
6745
7278
  // EXIT TABLE (ESLint 9.10 docs https://eslint.org/docs/latest/use/command-line-interface): 0 clean; 1 findings; 2 fatal findings/error; other nonzero rejected.
@@ -6793,7 +7326,7 @@ var factRulesRunner = {
6793
7326
  var fact_rules_default = factRulesRunner;
6794
7327
 
6795
7328
  // dist/clients/dispatch/runners/gleam-check.js
6796
- import * as path17 from "node:path";
7329
+ import * as path18 from "node:path";
6797
7330
  var gleam = createAvailabilityChecker("gleam", ".exe");
6798
7331
  var GLEAM_LOCUS = /^\s*┌─\s+(.+?):(\d+):(\d+)$/;
6799
7332
  var GLEAM_HEADER = /^\s*(error|warning):\s*(.+?)\s*$/;
@@ -6815,7 +7348,7 @@ function gleamMessage(title, body) {
6815
7348
  }
6816
7349
  function parseGleamOutput(raw, filePath, cwd) {
6817
7350
  const diagnostics = [];
6818
- const absTarget = path17.resolve(cwd, filePath);
7351
+ const absTarget = path18.resolve(cwd, filePath);
6819
7352
  const lines = stripAnsi(raw).split(/\r?\n/);
6820
7353
  for (const { header, body } of gleamBlocks(lines)) {
6821
7354
  const severity = header[1] === "warning" ? "warning" : "error";
@@ -6824,7 +7357,7 @@ function parseGleamOutput(raw, filePath, cwd) {
6824
7357
  if (!location)
6825
7358
  continue;
6826
7359
  const [, sourcePath, lineStr, colStr] = location;
6827
- if (!pathsEqual(path17.resolve(cwd, sourcePath.trim()), absTarget))
7360
+ if (!pathsEqual(path18.resolve(cwd, sourcePath.trim()), absTarget))
6828
7361
  continue;
6829
7362
  diagnostics.push({
6830
7363
  id: `gleam-check-${lineStr}-${colStr}`,
@@ -6891,11 +7424,11 @@ var gleam_check_default = gleamCheckRunner;
6891
7424
  import { resolve as resolve15 } from "node:path";
6892
7425
 
6893
7426
  // dist/clients/dispatch/runners/utils/diagnostic-parsers.js
6894
- import * as path18 from "node:path";
7427
+ import * as path19 from "node:path";
6895
7428
  function createLineParser(config) {
6896
7429
  return (raw, filePath, cwd) => {
6897
7430
  const diagnostics = [];
6898
- const absTarget = path18.resolve(cwd, filePath);
7431
+ const absTarget = path19.resolve(cwd, filePath);
6899
7432
  const clean = config.stripAnsi !== false ? stripAnsi(raw) : raw;
6900
7433
  const lines = clean.split("\n").filter((l) => l.trim());
6901
7434
  for (const line of lines) {
@@ -6903,7 +7436,7 @@ function createLineParser(config) {
6903
7436
  if (!match)
6904
7437
  continue;
6905
7438
  const reported = match[1];
6906
- if (reported && !pathsEqual(path18.resolve(cwd, reported), absTarget))
7439
+ if (reported && !pathsEqual(path19.resolve(cwd, reported), absTarget))
6907
7440
  continue;
6908
7441
  const lineNum = parseInt(match[2], 10);
6909
7442
  const colNum = parseInt(match[3], 10);
@@ -7003,7 +7536,7 @@ var goVetRunner = {
7003
7536
  var go_vet_default = goVetRunner;
7004
7537
 
7005
7538
  // dist/clients/dispatch/runners/golangci-lint.js
7006
- import * as path19 from "node:path";
7539
+ import * as path20 from "node:path";
7007
7540
  var OTHER_OUTPUT_FORMATS = [
7008
7541
  "text",
7009
7542
  "tab",
@@ -7034,8 +7567,8 @@ function parseGolangciJson(raw, filePath, cwd) {
7034
7567
  const output = JSON.parse(raw);
7035
7568
  if (!output.Issues)
7036
7569
  return [];
7037
- const absFile = path19.resolve(cwd, filePath);
7038
- return output.Issues.filter((issue) => pathsEqual(path19.resolve(cwd, issue.Pos.Filename), absFile)).map((issue) => {
7570
+ const absFile = path20.resolve(cwd, filePath);
7571
+ return output.Issues.filter((issue) => pathsEqual(path20.resolve(cwd, issue.Pos.Filename), absFile)).map((issue) => {
7039
7572
  const severity = issue.Severity === "error" ? "error" : "warning";
7040
7573
  const fixSuggestion = describeReplacement(issue.Replacement);
7041
7574
  return {
@@ -7101,15 +7634,15 @@ var golangciRunner = {
7101
7634
  var golangci_lint_default = golangciRunner;
7102
7635
 
7103
7636
  // dist/clients/dispatch/runners/hadolint.js
7104
- import * as path20 from "node:path";
7637
+ import * as path21 from "node:path";
7105
7638
  function parseHadolintOutput(raw, filePath, cwd) {
7106
7639
  try {
7107
7640
  const parsed = JSON.parse(raw);
7108
7641
  if (!Array.isArray(parsed))
7109
7642
  return [];
7110
- const absTarget = path20.resolve(cwd, filePath);
7643
+ const absTarget = path21.resolve(cwd, filePath);
7111
7644
  return parsed.flatMap((item) => {
7112
- if (item.file && !pathsEqual(path20.resolve(cwd, item.file), absTarget))
7645
+ if (item.file && !pathsEqual(path21.resolve(cwd, item.file), absTarget))
7113
7646
  return [];
7114
7647
  const severity = item.level === "error" ? "error" : "warning";
7115
7648
  return [
@@ -7146,7 +7679,7 @@ var hadolintRunner = {
7146
7679
  if (!cmd) {
7147
7680
  return toolAbsentSkip(cwd, { id: "hadolint" });
7148
7681
  }
7149
- const result = await safeSpawnAsync(cmd, ["--format", "json", "--no-fail", path20.resolve(cwd, ctx.filePath)], { cwd });
7682
+ const result = await safeSpawnAsync(cmd, ["--format", "json", "--no-fail", path21.resolve(cwd, ctx.filePath)], { cwd });
7150
7683
  const run = parseToolRun("hadolint", {
7151
7684
  result,
7152
7685
  // EXIT TABLE (Hadolint 2.12 measured fixture): 0 clean; 1 findings; 2 error; other nonzero rejected.
@@ -7173,7 +7706,7 @@ var hadolintRunner = {
7173
7706
  var hadolint_default = hadolintRunner;
7174
7707
 
7175
7708
  // dist/clients/dispatch/runners/helm-lint.js
7176
- import * as path21 from "node:path";
7709
+ import * as path22 from "node:path";
7177
7710
  var inFlightByChartRoot = new PathKeyedMap(normalizeMapKey);
7178
7711
  var HELM_LINT_TIMEOUT_MS = 3e4;
7179
7712
  var MAX_HELM_LINT_OUTPUT_BYTES = 8 * 1024 * 1024;
@@ -7186,13 +7719,13 @@ function diagnosticLocation(message, chartRoot) {
7186
7719
  const location = message.match(/(?:^|[\s(])((?:[^\s:()\r\n]*\/[^:()\r\n"]*?|[^\s:()\r\n]+)\.(?:ya?ml|tpl|json))(?::(\d+))?(?=[:\s)]|$)/i);
7187
7720
  const [, found, rawLine] = location ?? [];
7188
7721
  if (!found) {
7189
- return { filePath: path21.join(chartRoot, "Chart.yaml"), message };
7722
+ return { filePath: path22.join(chartRoot, "Chart.yaml"), message };
7190
7723
  }
7191
7724
  const embedded = !message.startsWith(found);
7192
7725
  const relative2 = embedded ? found.slice(found.indexOf("/") + 1) : found;
7193
- const candidate = path21.resolve(chartRoot, relative2);
7726
+ const candidate = path22.resolve(chartRoot, relative2);
7194
7727
  return {
7195
- filePath: isWithinIdentity(candidate, chartRoot) ? candidate : path21.join(chartRoot, "Chart.yaml"),
7728
+ filePath: isWithinIdentity(candidate, chartRoot) ? candidate : path22.join(chartRoot, "Chart.yaml"),
7196
7729
  line: rawLine ? Number(rawLine) : void 0,
7197
7730
  message
7198
7731
  };
@@ -7289,12 +7822,12 @@ var helmLintRunner = {
7289
7822
  timeoutMs: 35e3,
7290
7823
  async run(ctx) {
7291
7824
  const cwd = resolveRunnerCwd(ctx, "helm");
7292
- const workspaceRoot = path21.resolve(ctx.projectRoot ?? ctx.cwd);
7293
- const startDir = path21.dirname(path21.resolve(ctx.filePath));
7825
+ const workspaceRoot = path22.resolve(ctx.projectRoot ?? ctx.cwd);
7826
+ const startDir = path22.dirname(path22.resolve(ctx.filePath));
7294
7827
  const discovered = findNearestDirWithMarker(startDir, "chartYamlPath");
7295
7828
  if (!discovered)
7296
7829
  return SKIPPED;
7297
- const chartRoot = path21.resolve(discovered);
7830
+ const chartRoot = path22.resolve(discovered);
7298
7831
  if (!isWithinIdentity(chartRoot, workspaceRoot))
7299
7832
  return SKIPPED;
7300
7833
  const existing = inFlightByChartRoot.get(chartRoot);
@@ -7311,8 +7844,8 @@ var helmLintRunner = {
7311
7844
  var helm_lint_default = helmLintRunner;
7312
7845
 
7313
7846
  // dist/clients/dispatch/runners/helm-render.js
7314
- import * as fs9 from "node:fs";
7315
- import * as path22 from "node:path";
7847
+ import * as fs10 from "node:fs";
7848
+ import * as path23 from "node:path";
7316
7849
  var inFlightByChartRoot2 = new PathKeyedMap(normalizeMapKey);
7317
7850
  var RENDER_TIMEOUT_MS = 3e4;
7318
7851
  var TRIVY_TIMEOUT_MS = 45e3;
@@ -7338,14 +7871,14 @@ function resolveTemplateSource(sourceRef, chartRoot, realChartRoot) {
7338
7871
  const segments = sourceRef.split(/[\\/]+/).filter((segment) => segment && segment !== ".");
7339
7872
  if (segments.length < 2)
7340
7873
  return null;
7341
- const candidate = path22.resolve(chartRoot, ...segments.slice(1));
7874
+ const candidate = path23.resolve(chartRoot, ...segments.slice(1));
7342
7875
  if (!isWithinIdentity(candidate, chartRoot))
7343
7876
  return null;
7344
7877
  try {
7345
- if (!fs9.lstatSync(candidate).isFile())
7878
+ if (!fs10.lstatSync(candidate).isFile())
7346
7879
  return null;
7347
- const root = realChartRoot ?? fs9.realpathSync(chartRoot);
7348
- if (!isWithinIdentity(fs9.realpathSync(candidate), root))
7880
+ const root = realChartRoot ?? fs10.realpathSync(chartRoot);
7881
+ if (!isWithinIdentity(fs10.realpathSync(candidate), root))
7349
7882
  return null;
7350
7883
  } catch {
7351
7884
  return null;
@@ -7354,13 +7887,13 @@ function resolveTemplateSource(sourceRef, chartRoot, realChartRoot) {
7354
7887
  }
7355
7888
  function canonicalChartRoot(chartRoot) {
7356
7889
  try {
7357
- return fs9.realpathSync(chartRoot);
7890
+ return fs10.realpathSync(chartRoot);
7358
7891
  } catch {
7359
7892
  return chartRoot;
7360
7893
  }
7361
7894
  }
7362
7895
  function chartYaml(chartRoot) {
7363
- return path22.join(chartRoot, "Chart.yaml");
7896
+ return path23.join(chartRoot, "Chart.yaml");
7364
7897
  }
7365
7898
  var HELM_INSTALL_HINT = "https://helm.sh/docs/intro/install/";
7366
7899
  var TRIVY_INSTALL_HINT = "https://trivy.dev/latest/getting-started/installation/";
@@ -7405,7 +7938,7 @@ function parseHelmTemplateFailure(raw, chartRoot) {
7405
7938
  continue;
7406
7939
  const location = extractTemplateRef(trimmed);
7407
7940
  const resolved = location ? resolveTemplateSource(location.ref, chartRoot, realRoot) : null;
7408
- const chartName = path22.basename(chartRoot);
7941
+ const chartName = path23.basename(chartRoot);
7409
7942
  diagnostics.push({
7410
7943
  id: `helm-render-error-${diagnostics.length + 1}`,
7411
7944
  message: resolved ? trimmed : `${trimmed} (helm template failed for chart ${chartName})`,
@@ -7593,12 +8126,12 @@ function collectRenderedFiles(root) {
7593
8126
  const dir = stack.pop();
7594
8127
  let entries;
7595
8128
  try {
7596
- entries = fs9.readdirSync(dir, { withFileTypes: true });
8129
+ entries = fs10.readdirSync(dir, { withFileTypes: true });
7597
8130
  } catch {
7598
8131
  continue;
7599
8132
  }
7600
8133
  for (const entry of entries) {
7601
- const full = path22.join(dir, entry.name);
8134
+ const full = path23.join(dir, entry.name);
7602
8135
  if (entry.isDirectory()) {
7603
8136
  stack.push(full);
7604
8137
  } else if (entry.isFile() && /\.ya?ml$/i.test(entry.name)) {
@@ -7632,7 +8165,7 @@ function readRenderedTree(outputDir, chartRoot) {
7632
8165
  for (const renderedPath of walk2.files) {
7633
8166
  let content;
7634
8167
  try {
7635
- content = fs9.readFileSync(renderedPath, "utf-8");
8168
+ content = fs10.readFileSync(renderedPath, "utf-8");
7636
8169
  } catch {
7637
8170
  unreadable += 1;
7638
8171
  continue;
@@ -7646,7 +8179,7 @@ function readRenderedTree(outputDir, chartRoot) {
7646
8179
  });
7647
8180
  manifests.push({
7648
8181
  renderedPath,
7649
- relativePath: path22.relative(outputDir, renderedPath),
8182
+ relativePath: path23.relative(outputDir, renderedPath),
7650
8183
  content,
7651
8184
  sourcePath: mapping.filePath,
7652
8185
  sourceMapped: mapping.mapped
@@ -7729,7 +8262,7 @@ async function runIacPass(options) {
7729
8262
  });
7730
8263
  }
7731
8264
  const report = parseRenderedTrivyOutput(scan.stdout || "", (target) => {
7732
- const hit = sourceByRendered.get(path22.resolve(outputDir, target));
8265
+ const hit = sourceByRendered.get(path23.resolve(outputDir, target));
7733
8266
  return hit ?? {
7734
8267
  filePath: chartYaml(chartRoot),
7735
8268
  detail: target || "rendered manifest"
@@ -7751,7 +8284,7 @@ function logRenderPass(filePath, chartRoot, startedAt, metadata) {
7751
8284
  metadata: { chartRoot, ...metadata }
7752
8285
  });
7753
8286
  }
7754
- function discardScratchDir(outputDir, filePath, remove = (target) => fs9.rmSync(target, { recursive: true, force: true })) {
8287
+ function discardScratchDir(outputDir, filePath, remove = (target) => fs10.rmSync(target, { recursive: true, force: true })) {
7755
8288
  try {
7756
8289
  remove(outputDir);
7757
8290
  } catch (error) {
@@ -7772,7 +8305,7 @@ async function renderAndValidate(chartRoot, cwd, filePath) {
7772
8305
  const helmCmd = await resolveToolCommandWithInstallFallback(cwd, "helm");
7773
8306
  if (!helmCmd)
7774
8307
  return helmUnavailableResult(cwd);
7775
- const outputDir = fs9.mkdtempSync(path22.join(scannerReportParentDir(), "pi-lens-helm-render-"));
8308
+ const outputDir = fs10.mkdtempSync(path23.join(scannerReportParentDir(), "pi-lens-helm-render-"));
7776
8309
  try {
7777
8310
  const render = await safeSpawnAsync(helmCmd, ["template", "pi-lens-render", chartRoot, "--output-dir", outputDir], {
7778
8311
  cwd,
@@ -7872,14 +8405,14 @@ var helmRenderRunner = {
7872
8405
  timeoutMs: RENDER_TIMEOUT_MS + TRIVY_TIMEOUT_MS + 1e4,
7873
8406
  async run(ctx) {
7874
8407
  const cwd = resolveRunnerCwd(ctx, "helm-render");
7875
- const workspaceRoot = path22.resolve(ctx.projectRoot ?? cwd);
8408
+ const workspaceRoot = path23.resolve(ctx.projectRoot ?? cwd);
7876
8409
  if (!isHelmRenderEnabled(workspaceRoot))
7877
8410
  return NOT_ENABLED;
7878
- const startDir = path22.dirname(path22.resolve(ctx.filePath));
8411
+ const startDir = path23.dirname(path23.resolve(ctx.filePath));
7879
8412
  const discovered = findNearestDirWithMarker(startDir, "chartYamlPath");
7880
8413
  if (!discovered)
7881
8414
  return SKIPPED2;
7882
- const chartRoot = path22.resolve(discovered);
8415
+ const chartRoot = path23.resolve(discovered);
7883
8416
  if (!isWithinIdentity(chartRoot, workspaceRoot))
7884
8417
  return SKIPPED2;
7885
8418
  if (getProjectTrustState() === "untrusted") {
@@ -7904,7 +8437,7 @@ var helmRenderRunner = {
7904
8437
  var helm_render_default = helmRenderRunner;
7905
8438
 
7906
8439
  // dist/clients/dispatch/runners/htmlhint.js
7907
- import * as path23 from "node:path";
8440
+ import * as path24 from "node:path";
7908
8441
  var HTMLHINT_RULES = {
7909
8442
  "tag-pair": true,
7910
8443
  "attr-no-duplication": true,
@@ -7915,13 +8448,13 @@ var HTMLHINT_RULES = {
7915
8448
  };
7916
8449
  function parseHtmlhintOutput(raw, filePath, cwd) {
7917
8450
  const diagnostics = [];
7918
- const absTarget = path23.resolve(cwd, filePath);
8451
+ const absTarget = path24.resolve(cwd, filePath);
7919
8452
  const lineRe = /^(.+?):(\d+):(\d+): (.+?) \[(error|warning)\/([^\]]+)\]/;
7920
8453
  for (const line of raw.split("\n")) {
7921
8454
  const match = line.match(lineRe);
7922
8455
  if (!match)
7923
8456
  continue;
7924
- if (!pathsEqual(path23.resolve(cwd, match[1]), absTarget))
8457
+ if (!pathsEqual(path24.resolve(cwd, match[1]), absTarget))
7925
8458
  continue;
7926
8459
  const lineNum = parseInt(match[2], 10);
7927
8460
  const col = parseInt(match[3], 10);
@@ -7965,7 +8498,7 @@ var htmlhintRunner = {
7965
8498
  rulesArg,
7966
8499
  "--format",
7967
8500
  "unix",
7968
- path23.resolve(cwd, ctx.filePath)
8501
+ path24.resolve(cwd, ctx.filePath)
7969
8502
  ], { cwd });
7970
8503
  const output = result.stdout || result.stderr || "";
7971
8504
  const run = parseToolRun("htmlhint", {
@@ -7995,18 +8528,18 @@ var htmlhintRunner = {
7995
8528
  var htmlhint_default = htmlhintRunner;
7996
8529
 
7997
8530
  // dist/clients/dispatch/runners/javac.js
7998
- import * as path24 from "node:path";
8531
+ import * as path25 from "node:path";
7999
8532
  var javac = createAvailabilityChecker("javac", ".exe");
8000
8533
  function parseJavacOutput(raw, filePath, cwd) {
8001
8534
  const diagnostics = [];
8002
8535
  const lines = raw.split(/\r?\n/);
8003
- const absTarget = path24.resolve(cwd, filePath);
8536
+ const absTarget = path25.resolve(cwd, filePath);
8004
8537
  for (const line of lines) {
8005
8538
  const match = line.match(/^(.*?\.java):(\d+):\s+(error|warning):\s+(.+)$/i);
8006
8539
  if (!match)
8007
8540
  continue;
8008
8541
  const [, reportedFile, lineStr, severityLabel, message] = match;
8009
- if (!pathsEqual(path24.resolve(cwd, reportedFile.trim()), absTarget))
8542
+ if (!pathsEqual(path25.resolve(cwd, reportedFile.trim()), absTarget))
8010
8543
  continue;
8011
8544
  const severity = severityLabel.toLowerCase() === "error" ? "error" : "warning";
8012
8545
  const lineNum = Number.parseInt(lineStr, 10) || 1;
@@ -8034,9 +8567,9 @@ var javacRunner = {
8034
8567
  skipTestFiles: false,
8035
8568
  async run(ctx) {
8036
8569
  const cwd = resolveRunnerCwd(ctx, "javac");
8037
- const absPath = path24.resolve(cwd, ctx.filePath);
8038
- if (hasToolConfig("javaBuild", path24.dirname(absPath), {
8039
- ceiling: ctx.projectRoot ?? ctx.cwd
8570
+ const absPath = path25.resolve(cwd, ctx.filePath);
8571
+ if (hasToolConfig("javaBuild", path25.dirname(absPath), {
8572
+ ceiling: configCeiling(ctx.cwd, ctx.projectRoot)
8040
8573
  })) {
8041
8574
  ctx.log?.("javac: skipped \u2014 file is inside a Maven/Gradle project; a classpath-less compile would emit false positives");
8042
8575
  return { status: "skipped", diagnostics: [], semantic: "none" };
@@ -8077,7 +8610,7 @@ ${result.stderr ?? ""}`.trim();
8077
8610
  var javac_default = javacRunner;
8078
8611
 
8079
8612
  // dist/clients/dispatch/runners/ktlint.js
8080
- import * as path25 from "node:path";
8613
+ import * as path26 from "node:path";
8081
8614
  var KTLINT_EXIT_CODES = { ran: [1, 2, 3] };
8082
8615
  function normalizeKtlintResults(parsed) {
8083
8616
  if (Array.isArray(parsed)) {
@@ -8116,9 +8649,9 @@ function parseKtlintOutput(raw, filePath, cwd) {
8116
8649
  return null;
8117
8650
  const autofix = getAutofixCapability("ktlint");
8118
8651
  const diagnostics = [];
8119
- const absTarget = path25.resolve(cwd, filePath);
8652
+ const absTarget = path26.resolve(cwd, filePath);
8120
8653
  for (const result of parsed) {
8121
- if (result.file && !pathsEqual(path25.resolve(cwd, result.file), absTarget))
8654
+ if (result.file && !pathsEqual(path26.resolve(cwd, result.file), absTarget))
8122
8655
  continue;
8123
8656
  for (const err of result.errors ?? []) {
8124
8657
  diagnostics.push({
@@ -8156,7 +8689,7 @@ var ktlintRunner = {
8156
8689
  const cmd = await resolveToolCommandWithInstallFallback(cwd, "ktlint");
8157
8690
  if (!cmd)
8158
8691
  return toolAbsentSkip(cwd, { id: "ktlint" });
8159
- const absPath = path25.resolve(cwd, ctx.filePath);
8692
+ const absPath = path26.resolve(cwd, ctx.filePath);
8160
8693
  const result = await safeSpawnAsync(cmd, ["--reporter=json", absPath], {
8161
8694
  cwd,
8162
8695
  timeout: 3e4
@@ -8231,9 +8764,11 @@ var lspRunner = {
8231
8764
  let lspClientReady = true;
8232
8765
  let diagnosticsInconclusive = false;
8233
8766
  let inconclusiveServerIds = [];
8767
+ let inconclusiveReason;
8234
8768
  let primaryUnavailable;
8235
8769
  let unconfirmedServerIds = [];
8236
8770
  let deferredServerIds = [];
8771
+ let answeredServerIds = [];
8237
8772
  let primaryAnswered = false;
8238
8773
  let primaryAnswerStale = false;
8239
8774
  let usedWarmAttach = false;
@@ -8288,6 +8823,7 @@ var lspRunner = {
8288
8823
  lspDiags = touched.diags;
8289
8824
  diagnosticsInconclusive = touched.inconclusive === true;
8290
8825
  inconclusiveServerIds = touched.inconclusiveServerIds ?? [];
8826
+ inconclusiveReason = touched.inconclusiveReason;
8291
8827
  if (touched.inconclusiveReason === "primary-unavailable") {
8292
8828
  const disabledPrimaryServerIds = touched.disabledPrimaryServerIds ?? [];
8293
8829
  primaryUnavailable = {
@@ -8304,6 +8840,7 @@ var lspRunner = {
8304
8840
  ])
8305
8841
  ];
8306
8842
  deferredServerIds = touched.deferredServerIds ?? [];
8843
+ answeredServerIds = touched.answeredServerIds ?? [];
8307
8844
  primaryAnswerStale = readBoundToCurrentDisk(touched) === false;
8308
8845
  primaryAnswered = touchCompletedConfirmationPolicy(touched) && !primaryAnswerStale;
8309
8846
  if (primaryAnswerStale) {
@@ -8316,6 +8853,8 @@ var lspRunner = {
8316
8853
  }
8317
8854
  }
8318
8855
  lspDiags = currentContentDiags;
8856
+ if (!namesStaleContributor)
8857
+ answeredServerIds = [];
8319
8858
  }
8320
8859
  }
8321
8860
  } catch (err) {
@@ -8362,6 +8901,16 @@ var lspRunner = {
8362
8901
  status: "skipped",
8363
8902
  diagnostics: [],
8364
8903
  semantic: "none",
8904
+ ...inconclusiveReason !== void 0 && {
8905
+ inconclusiveReason
8906
+ },
8907
+ ...inconclusiveServerIds.length > 0 && inconclusiveReason !== "primary-unavailable" && {
8908
+ unconfirmedServerIds: [...inconclusiveServerIds]
8909
+ },
8910
+ // #5727: the run has no verdict, but these servers answered clean.
8911
+ ...answeredServerIds.length > 0 && {
8912
+ answeredServerIds: [...answeredServerIds]
8913
+ },
8365
8914
  ...primaryUnavailable
8366
8915
  };
8367
8916
  }
@@ -8467,12 +9016,16 @@ var lspRunner = {
8467
9016
  // reading (a diagnostics-unsupported primary, an incumbent built before the
8468
9017
  // confirmation field), which is today's behaviour.
8469
9018
  ...diagnosticsInconclusive && { inconclusive: true },
9019
+ ...inconclusiveReason !== void 0 && { inconclusiveReason },
8470
9020
  ...unconfirmedServerIds.length > 0 && {
8471
9021
  unconfirmedServerIds: [...unconfirmedServerIds]
8472
9022
  },
8473
9023
  ...deferredServerIds.length > 0 && {
8474
9024
  deferredServerIds: [...deferredServerIds]
8475
9025
  },
9026
+ ...answeredServerIds.length > 0 && {
9027
+ answeredServerIds: [...answeredServerIds]
9028
+ },
8476
9029
  ...outOfEditScope.length > 0 && { outOfEditScope },
8477
9030
  ...withheldNotice !== void 0 && { withheldNotice }
8478
9031
  };
@@ -8481,32 +9034,32 @@ var lspRunner = {
8481
9034
  var lsp_default = lspRunner;
8482
9035
 
8483
9036
  // dist/clients/dispatch/runners/markdownlint.js
8484
- import * as path27 from "node:path";
9037
+ import * as path28 from "node:path";
8485
9038
 
8486
9039
  // dist/clients/dispatch/runners/utils/markdownlint-api.js
8487
- import * as fs10 from "node:fs";
8488
- import * as path26 from "node:path";
9040
+ import * as fs11 from "node:fs";
9041
+ import * as path27 from "node:path";
8489
9042
  var PACKAGE_NAME = "markdownlint-cli2";
8490
9043
  function locateCli2Entry(command) {
8491
9044
  const shim = /[\\/]/.test(command) ? command : findCommandOnPath(command, process.platform === "win32");
8492
9045
  if (!shim)
8493
9046
  return null;
8494
- const shimDir = path26.dirname(shim);
9047
+ const shimDir = path27.dirname(shim);
8495
9048
  const candidates = [
8496
- path26.join(shimDir, "..", PACKAGE_NAME),
8497
- path26.join(shimDir, "node_modules", PACKAGE_NAME)
9049
+ path27.join(shimDir, "..", PACKAGE_NAME),
9050
+ path27.join(shimDir, "node_modules", PACKAGE_NAME)
8498
9051
  ];
8499
- candidates.push(path26.dirname(realpathOrResolve(shim)));
9052
+ candidates.push(path27.dirname(realpathOrResolve(shim)));
8500
9053
  for (const dir of candidates) {
8501
9054
  try {
8502
- const manifest = JSON.parse(fs10.readFileSync(path26.join(dir, "package.json"), "utf8"));
9055
+ const manifest = JSON.parse(fs11.readFileSync(path27.join(dir, "package.json"), "utf8"));
8503
9056
  if (manifest.name !== PACKAGE_NAME)
8504
9057
  continue;
8505
9058
  const root = manifest.exports && typeof manifest.exports === "object" ? manifest.exports["."] : manifest.exports;
8506
9059
  if (typeof root !== "string")
8507
9060
  continue;
8508
- const entry = path26.resolve(dir, root);
8509
- if (fs10.statSync(entry).isFile())
9061
+ const entry = path27.resolve(dir, root);
9062
+ if (fs11.statSync(entry).isFile())
8510
9063
  return entry;
8511
9064
  } catch {
8512
9065
  }
@@ -8570,7 +9123,7 @@ var MARKDOWNLINT_FIXABLE_RULES = /* @__PURE__ */ new Set([
8570
9123
  ]);
8571
9124
  function parseMarkdownlintOutput(raw, filePath, cwd) {
8572
9125
  const diagnostics = [];
8573
- const absTarget = path27.resolve(cwd, filePath);
9126
+ const absTarget = path28.resolve(cwd, filePath);
8574
9127
  for (const line of raw.split(/\r?\n/)) {
8575
9128
  if (!line.trim())
8576
9129
  continue;
@@ -8578,7 +9131,7 @@ function parseMarkdownlintOutput(raw, filePath, cwd) {
8578
9131
  if (!match)
8579
9132
  continue;
8580
9133
  const [, reported, lineNum, col, ruleCode, message] = match;
8581
- if (reported && !pathsEqual(path27.resolve(cwd, reported), absTarget))
9134
+ if (reported && !pathsEqual(path28.resolve(cwd, reported), absTarget))
8582
9135
  continue;
8583
9136
  const ruleName = ruleCode.split("/")[0];
8584
9137
  const fixable = MARKDOWNLINT_FIXABLE_RULES.has(ruleName);
@@ -8642,7 +9195,7 @@ var markdownlintRunner = {
8642
9195
  var markdownlint_default = markdownlintRunner;
8643
9196
 
8644
9197
  // dist/clients/dispatch/runners/mypy.js
8645
- import * as path28 from "node:path";
9198
+ import * as path29 from "node:path";
8646
9199
  var MYPY_EXIT_CODES = { ran: [1, 2] };
8647
9200
  function parseMypyOutput(raw, fallbackPath, cwd) {
8648
9201
  const diagnostics = [];
@@ -8655,7 +9208,7 @@ function parseMypyOutput(raw, fallbackPath, cwd) {
8655
9208
  continue;
8656
9209
  const severity = level === "error" ? "error" : "warning";
8657
9210
  const rule = errorCode ?? "mypy";
8658
- const filePath = file && file.trim() ? path28.isAbsolute(file) ? file : path28.resolve(cwd, file) : fallbackPath;
9211
+ const filePath = file && file.trim() ? path29.isAbsolute(file) ? file : path29.resolve(cwd, file) : fallbackPath;
8659
9212
  diagnostics.push({
8660
9213
  id: `mypy-${lineNum}-${rule}`,
8661
9214
  message: errorCode ? `[${errorCode}] ${message}` : message,
@@ -8702,7 +9255,7 @@ var mypyRunner = {
8702
9255
  var mypy_default = mypyRunner;
8703
9256
 
8704
9257
  // dist/clients/dispatch/runners/oxlint.js
8705
- import * as path29 from "node:path";
9258
+ import * as path30 from "node:path";
8706
9259
  var MAX_OXLINT_OUTPUT_BYTES = 8 * 1024 * 1024;
8707
9260
  var OXLINT_NO_FILES = /* @__PURE__ */ Symbol("oxlint-no-files");
8708
9261
  var OXLINT_NO_FILES_UNCONFIRMED = /* @__PURE__ */ Symbol("oxlint-no-files-unconfirmed");
@@ -8721,11 +9274,7 @@ async function resolveVitePlusCommand(packageDir, cwd) {
8721
9274
  const local = resolveLocalVp(packageDir);
8722
9275
  if (local)
8723
9276
  return local;
8724
- const version = await safeSpawnAsync("vp", ["--version"], {
8725
- timeout: 5e3,
8726
- cwd
8727
- });
8728
- return !version.error && version.status === 0 ? "vp" : null;
9277
+ return resolveToolCommandWithInstallFallback(cwd, "vp");
8729
9278
  }
8730
9279
  var oxlintRunner = {
8731
9280
  id: "oxlint",
@@ -8938,9 +9487,9 @@ function parseOxlintJson(raw, filePath, cwd) {
8938
9487
  if (!Array.isArray(parsed.diagnostics))
8939
9488
  return [];
8940
9489
  const diagnostics = [];
8941
- const absTarget = path29.resolve(cwd, filePath);
9490
+ const absTarget = path30.resolve(cwd, filePath);
8942
9491
  for (const d of parsed.diagnostics) {
8943
- if (!d.filename || !pathsEqual(path29.resolve(cwd, d.filename), absTarget)) {
9492
+ if (!d.filename || !pathsEqual(path30.resolve(cwd, d.filename), absTarget)) {
8944
9493
  continue;
8945
9494
  }
8946
9495
  const rule = extractOxlintRule(d.code);
@@ -8970,14 +9519,14 @@ function parseOxlintJson(raw, filePath, cwd) {
8970
9519
  }
8971
9520
  function parseOxlintUnix(raw, filePath, cwd) {
8972
9521
  const diagnostics = [];
8973
- const absTarget = path29.resolve(cwd, filePath);
9522
+ const absTarget = path30.resolve(cwd, filePath);
8974
9523
  for (const line of raw.split("\n")) {
8975
9524
  const match = line.match(/^(.+):(\d+):(\d+):\s*(.+?)\s*\(([^)]+)\)$/);
8976
9525
  if (match) {
8977
9526
  const [, reportedPath, lineStr, _col, message, rule] = match;
8978
9527
  if (!reportedPath || !lineStr || !message || !rule)
8979
9528
  continue;
8980
- if (!pathsEqual(path29.resolve(cwd, reportedPath), absTarget))
9529
+ if (!pathsEqual(path30.resolve(cwd, reportedPath), absTarget))
8981
9530
  continue;
8982
9531
  diagnostics.push({
8983
9532
  id: `oxlint-${rule}-${lineStr}`,
@@ -8996,7 +9545,7 @@ function parseOxlintUnix(raw, filePath, cwd) {
8996
9545
  var oxlint_default = oxlintRunner;
8997
9546
 
8998
9547
  // dist/clients/dispatch/runners/php-lint.js
8999
- import * as path30 from "node:path";
9548
+ import * as path31 from "node:path";
9000
9549
  var PHP_LINT_EXIT_CODES = { ran: [1, 255] };
9001
9550
  var php = createAvailabilityChecker("php", ".exe");
9002
9551
  function parsePhpLintOutput(raw, filePath, cwd) {
@@ -9006,7 +9555,7 @@ function parsePhpLintOutput(raw, filePath, cwd) {
9006
9555
  const lineMatch = output.match(/on line (\d+)/i);
9007
9556
  const messageMatch = output.match(/PHP Parse error:\s*(.+?)(?:\s+in\s+(.+?)\s+on line \d+)?$/im) ?? output.match(/Parse error:\s*(.+?)(?:\s+in\s+(.+?)\s+on line \d+)?$/im);
9008
9557
  const reported = messageMatch?.[2]?.trim();
9009
- if (reported && !pathsEqual(path30.resolve(cwd, reported), path30.resolve(cwd, filePath)))
9558
+ if (reported && !pathsEqual(path31.resolve(cwd, reported), path31.resolve(cwd, filePath)))
9010
9559
  return [];
9011
9560
  return [
9012
9561
  {
@@ -9033,7 +9582,7 @@ var phpLintRunner = {
9033
9582
  const cmd = ctx.analysisRootMode === "adopted" ? resolveAdoptedRootCommand("php", ctx, cwd) : await php.isAvailableAsync(cwd) ? php.getCommand(cwd) : null;
9034
9583
  if (!cmd)
9035
9584
  return toolAbsentSkip(cwd, { checker: php });
9036
- const absPath = path30.resolve(cwd, ctx.filePath);
9585
+ const absPath = path31.resolve(cwd, ctx.filePath);
9037
9586
  const result = await safeSpawnAsync(cmd, ["-l", absPath], {
9038
9587
  timeout: 15e3,
9039
9588
  cwd
@@ -9058,7 +9607,7 @@ ${result.stderr ?? ""}`,
9058
9607
  var php_lint_default = phpLintRunner;
9059
9608
 
9060
9609
  // dist/clients/dispatch/runners/phpstan.js
9061
- import * as path31 from "node:path";
9610
+ import * as path32 from "node:path";
9062
9611
  var PHPSTAN_EXIT_CODES = { ran: [1] };
9063
9612
  var phpstan = createAvailabilityChecker("phpstan", ".phar");
9064
9613
  function parsePhpstanJson(raw, fallbackPath, cwd) {
@@ -9066,7 +9615,7 @@ function parsePhpstanJson(raw, fallbackPath, cwd) {
9066
9615
  const output = JSON.parse(raw);
9067
9616
  const diagnostics = [];
9068
9617
  for (const [file, fileErrors] of Object.entries(output.files ?? {})) {
9069
- const filePath = file && file.trim() ? path31.isAbsolute(file) ? file : path31.resolve(cwd, file) : fallbackPath;
9618
+ const filePath = file && file.trim() ? path32.isAbsolute(file) ? file : path32.resolve(cwd, file) : fallbackPath;
9070
9619
  for (const err of fileErrors?.messages ?? []) {
9071
9620
  diagnostics.push({
9072
9621
  id: `phpstan:${err.line ?? 1}:${err.message.slice(0, 40)}`,
@@ -9108,6 +9657,180 @@ async function resolvePhpstan(cwd) {
9108
9657
  return phpstan.getCommand(cwd);
9109
9658
  return resolveVendorToolCommand(cwd, "phpstan", ".bat");
9110
9659
  }
9660
+ var PHPSTAN_DUMP_TIMEOUT_MS = 15e3;
9661
+ var PHPSTAN_DOTTED_CONFIGS = [
9662
+ ".phpstan.neon",
9663
+ ".phpstan.neon.dist",
9664
+ ".phpstan.dist.neon"
9665
+ ];
9666
+ function phpstanConfigMayExclude(text) {
9667
+ return /exclude|includes/i.test(text) || /ignoreErrors[\s\S]*\bpaths?['"]?\s*:/i.test(text);
9668
+ }
9669
+ function neonString(value) {
9670
+ return JSON.stringify(value).replace(/%/g, "%%");
9671
+ }
9672
+ function neonValue(value) {
9673
+ if (typeof value === "string")
9674
+ return neonString(value);
9675
+ if (Array.isArray(value))
9676
+ return `[${value.map(neonValue).join(", ")}]`;
9677
+ if (typeof value === "object" && value !== null) {
9678
+ return `{${Object.entries(value).map(([key, entry]) => `${neonString(key)}: ${neonValue(entry)}`).join(", ")}}`;
9679
+ }
9680
+ return JSON.stringify(value) ?? "null";
9681
+ }
9682
+ function keptPath(entry) {
9683
+ return /[*?[]/.test(entry) || pathExists(entry) ? entry : `${entry} (?)`;
9684
+ }
9685
+ function anchorPathList(name, entries, root) {
9686
+ const out = [];
9687
+ let touched = false;
9688
+ for (const entry of entries) {
9689
+ const anchored = anchorIgnorePattern(entry, root, "fnmatch");
9690
+ if (anchored === null) {
9691
+ return {
9692
+ unapplied: `${name} entry ${JSON.stringify(entry)} is not a form it can anchor`
9693
+ };
9694
+ }
9695
+ if (anchored.length === 1 && anchored[0] === entry) {
9696
+ out.push(keptPath(entry));
9697
+ continue;
9698
+ }
9699
+ touched = true;
9700
+ out.push(...anchored);
9701
+ }
9702
+ return { entries: out, touched };
9703
+ }
9704
+ function anchorIgnoreErrors(entries, root) {
9705
+ const out = [];
9706
+ let touched = false;
9707
+ const sharedPath = /* @__PURE__ */ new Map();
9708
+ for (const entry of entries) {
9709
+ const singular = entry?.path;
9710
+ if (singular !== void 0) {
9711
+ sharedPath.set(singular, (sharedPath.get(singular) ?? 0) + 1);
9712
+ }
9713
+ }
9714
+ for (const entry of entries) {
9715
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
9716
+ out.push(entry);
9717
+ continue;
9718
+ }
9719
+ const map = { ...entry };
9720
+ const singular = map.path;
9721
+ const plural = map.paths;
9722
+ if (singular !== void 0 && typeof singular !== "string") {
9723
+ return { unapplied: "an ignoreErrors path is not a string" };
9724
+ }
9725
+ if (plural !== void 0 && !(Array.isArray(plural) && plural.every((p) => typeof p === "string"))) {
9726
+ return { unapplied: "an ignoreErrors paths is not a list of strings" };
9727
+ }
9728
+ const parts = [
9729
+ ...typeof singular === "string" ? [singular] : [],
9730
+ ...plural ?? []
9731
+ ];
9732
+ const anchored = anchorPathList("ignoreErrors path", parts, root);
9733
+ if ("unapplied" in anchored)
9734
+ return anchored;
9735
+ if (anchored.touched) {
9736
+ touched = true;
9737
+ if (typeof singular === "string") {
9738
+ if (map.count !== void 0) {
9739
+ return {
9740
+ unapplied: `an ignoreErrors entry with count names the wildcard path ${JSON.stringify(singular)}`
9741
+ };
9742
+ }
9743
+ if ((sharedPath.get(singular) ?? 0) > 1) {
9744
+ return {
9745
+ unapplied: `two ignoreErrors entries share the wildcard path ${JSON.stringify(singular)}`
9746
+ };
9747
+ }
9748
+ }
9749
+ delete map.path;
9750
+ map.paths = [...new Set(anchored.entries)];
9751
+ }
9752
+ out.push(map);
9753
+ }
9754
+ return { entries: out, touched };
9755
+ }
9756
+ function anchorPhpstanConfig(dump, userConfig, root) {
9757
+ if (dump.status !== 0) {
9758
+ return {
9759
+ kind: "unapplied",
9760
+ reason: `phpstan dump-parameters exited ${dump.status ?? "without a status"}`
9761
+ };
9762
+ }
9763
+ let parameters;
9764
+ try {
9765
+ parameters = JSON.parse(dump.stdout ?? "");
9766
+ } catch {
9767
+ return {
9768
+ kind: "unapplied",
9769
+ reason: "phpstan dump-parameters printed no JSON"
9770
+ };
9771
+ }
9772
+ const excludePaths = parameters?.excludePaths;
9773
+ if (typeof excludePaths !== "object" || excludePaths === null || Array.isArray(excludePaths)) {
9774
+ return {
9775
+ kind: "unapplied",
9776
+ reason: "phpstan dump-parameters printed no excludePaths object"
9777
+ };
9778
+ }
9779
+ const lists = {
9780
+ analyse: [],
9781
+ analyseAndScan: []
9782
+ };
9783
+ let excludeTouched = false;
9784
+ for (const [name, entries] of Object.entries(excludePaths)) {
9785
+ if (name !== "analyse" && name !== "analyseAndScan") {
9786
+ return {
9787
+ kind: "unapplied",
9788
+ reason: `phpstan excludePaths has an unknown list ${JSON.stringify(name)}`
9789
+ };
9790
+ }
9791
+ if (!Array.isArray(entries) || !entries.every((entry) => typeof entry === "string")) {
9792
+ return {
9793
+ kind: "unapplied",
9794
+ reason: `phpstan excludePaths.${name} is not a list of strings`
9795
+ };
9796
+ }
9797
+ const anchored = anchorPathList(`excludePaths.${name}`, entries, root);
9798
+ if ("unapplied" in anchored) {
9799
+ return { kind: "unapplied", reason: anchored.unapplied };
9800
+ }
9801
+ lists[name] = anchored.entries;
9802
+ excludeTouched ||= anchored.touched;
9803
+ }
9804
+ const ignoreDumped = parameters?.ignoreErrors ?? [];
9805
+ if (!Array.isArray(ignoreDumped)) {
9806
+ return {
9807
+ kind: "unapplied",
9808
+ reason: "phpstan dump-parameters printed ignoreErrors that is not a list"
9809
+ };
9810
+ }
9811
+ const ignored = anchorIgnoreErrors(ignoreDumped, root);
9812
+ if ("unapplied" in ignored) {
9813
+ return { kind: "unapplied", reason: ignored.unapplied };
9814
+ }
9815
+ if (!excludeTouched && !ignored.touched)
9816
+ return { kind: "unchanged" };
9817
+ const block = (name) => lists[name].length === 0 ? ` ${name}: []
9818
+ ` : ` ${name}:
9819
+ ${lists[name].map((entry) => ` - ${neonString(entry)}
9820
+ `).join("")}`;
9821
+ const excludeText = excludeTouched ? ` excludePaths!:
9822
+ ${block("analyse")}${block("analyseAndScan")}` : "";
9823
+ const ignoreText = ignored.touched ? ` ignoreErrors!:
9824
+ ${ignored.entries.map((entry) => ` - ${neonValue(entry)}
9825
+ `).join("")}` : "";
9826
+ return {
9827
+ kind: "rewritten",
9828
+ text: `includes:
9829
+ - ${neonString(userConfig)}
9830
+ parameters:
9831
+ ${excludeText}${ignoreText}`
9832
+ };
9833
+ }
9111
9834
  var phpstanRunner = {
9112
9835
  id: "phpstan",
9113
9836
  appliesTo: ["php"],
@@ -9130,25 +9853,45 @@ var phpstanRunner = {
9130
9853
  checker: phpstan,
9131
9854
  trustRefused: isLocalBinTrustRefusal(lookup)
9132
9855
  });
9133
- const absPath = path31.resolve(cwd, ctx.filePath);
9134
- const result = await safeSpawnAsync(cmd, ["analyse", "--error-format=json", "--no-progress", absPath], { timeout: 3e4, cwd });
9856
+ const absPath = path32.resolve(cwd, ctx.filePath);
9857
+ let anchored = { kind: "unchanged" };
9858
+ const ownConfig = findToolConfig("phpstan", cwd, { ceiling: cwd })?.file;
9859
+ const read = ownConfig ? readConfigText("phpstan", ownConfig) : void 0;
9860
+ const dotted = ownConfig ? PHPSTAN_DOTTED_CONFIGS.find((name) => pathExists(path32.join(cwd, name))) : void 0;
9861
+ if (dotted) {
9862
+ anchored = {
9863
+ kind: "unapplied",
9864
+ reason: `phpstan may read ${dotted} in place of ${path32.basename(ownConfig ?? "")}`
9865
+ };
9866
+ } else if (read?.kind === "unapplied")
9867
+ anchored = read;
9868
+ if (!dotted && ownConfig && read?.kind === "read" && phpstanConfigMayExclude(read.text)) {
9869
+ const dump = await safeSpawnAsync(cmd, ["dump-parameters", "--json"], {
9870
+ cwd,
9871
+ timeout: PHPSTAN_DUMP_TIMEOUT_MS
9872
+ });
9873
+ anchored = anchorPhpstanConfig(dump, path32.resolve(cwd, ownConfig), cwd);
9874
+ }
9875
+ const analyse = (config) => safeSpawnAsync(cmd, ["analyse", "--error-format=json", "--no-progress", ...config, absPath], { timeout: 3e4, cwd });
9876
+ const result = anchored.kind === "rewritten" ? await withOverlayFile("phpstan", "phpstan.neon", anchored.text, (file) => analyse(["-c", file])) : await analyse([]);
9135
9877
  const run = parseToolRun("phpstan", { result, exitCodes: PHPSTAN_EXIT_CODES }, (out) => parsePhpstanJson(out, ctx.filePath, cwd), { parseOutput: result.stdout ?? "" });
9136
9878
  if (run.skipped)
9137
9879
  return run.skipped;
9138
9880
  const diagnostics = run.diagnostics;
9139
- return finishParsedRun({
9881
+ const verdict = finishParsedRun({
9140
9882
  tool: "phpstan",
9141
9883
  ctx,
9142
9884
  result,
9143
9885
  diagnostics,
9144
9886
  classify: () => ({ status: "failed", semantic: "blocking" })
9145
9887
  });
9888
+ return anchored.kind === "unapplied" ? markUnanchored("phpstan", anchored.reason, verdict) : verdict;
9146
9889
  }
9147
9890
  };
9148
9891
  var phpstan_default = phpstanRunner;
9149
9892
 
9150
9893
  // dist/clients/dispatch/runners/prisma-validate.js
9151
- import * as path32 from "node:path";
9894
+ import * as path33 from "node:path";
9152
9895
  var PRISMA_VALIDATION_REPORT = /\bValidation Error Count:\s*\d+/;
9153
9896
  function parsePrismaValidateOutput(raw, filePath) {
9154
9897
  const output = raw.split("\n").map((line) => line.trim()).filter(Boolean).filter((line) => !line.startsWith("Environment variables loaded")).filter((line) => !line.startsWith("Prisma schema loaded")).join(" ");
@@ -9171,6 +9914,15 @@ function parsePrismaValidateOutput(raw, filePath) {
9171
9914
  }
9172
9915
  ];
9173
9916
  }
9917
+ async function resolvePrisma(cwd) {
9918
+ const resolved = await resolveToolCommandWithInstallFallback(cwd, "prisma");
9919
+ if (resolved)
9920
+ return { cmd: resolved, args: [] };
9921
+ const globalBin = await findGlobalBinary("prisma");
9922
+ if (globalBin)
9923
+ return { cmd: globalBin, args: [] };
9924
+ return { cmd: "npx", args: ["--no", "prisma"] };
9925
+ }
9174
9926
  var prismaValidateRunner = {
9175
9927
  id: "prisma-validate",
9176
9928
  appliesTo: ["prisma"],
@@ -9178,8 +9930,8 @@ var prismaValidateRunner = {
9178
9930
  skipTestFiles: false,
9179
9931
  async run(ctx) {
9180
9932
  const cwd = resolveRunnerCwd(ctx, "prisma-validate");
9181
- const resolved = await resolveLocalFirstAsync("prisma", cwd);
9182
- const absPath = path32.resolve(cwd, ctx.filePath);
9933
+ const resolved = await resolvePrisma(cwd);
9934
+ const absPath = path33.resolve(cwd, ctx.filePath);
9183
9935
  const result = await safeSpawnAsync(resolved.cmd, [...resolved.args, "validate", "--schema", absPath], {
9184
9936
  timeout: 2e4,
9185
9937
  // ONE neutral-cwd seam for npx fallbacks (#4193, #4268 acceptance 3),
@@ -9218,8 +9970,8 @@ ${result.stderr ?? ""}`;
9218
9970
  var prisma_validate_default = prismaValidateRunner;
9219
9971
 
9220
9972
  // dist/clients/dispatch/runners/psscriptanalyzer.js
9221
- import * as fs11 from "node:fs/promises";
9222
- import * as path33 from "node:path";
9973
+ import * as fs12 from "node:fs/promises";
9974
+ import * as path34 from "node:path";
9223
9975
  var PS_SCRIPT = `
9224
9976
  param([string]$FilePath)
9225
9977
  Import-Module PSScriptAnalyzer -ErrorAction Stop
@@ -9422,9 +10174,9 @@ var psScriptAnalyzerRunner = {
9422
10174
  return { status: "skipped", diagnostics: [], semantic: "none" };
9423
10175
  }
9424
10176
  const cwd = resolveRunnerCwd(ctx, "psscriptanalyzer");
9425
- const absPath = path33.resolve(cwd, ctx.filePath);
9426
- const tmpScript = path33.join(scannerReportParentDir(), `pi-lens-psa-${process.pid}.ps1`);
9427
- await fs11.writeFile(tmpScript, PS_SCRIPT, "utf-8");
10177
+ const absPath = path34.resolve(cwd, ctx.filePath);
10178
+ const tmpScript = path34.join(scannerReportParentDir(), `pi-lens-psa-${process.pid}.ps1`);
10179
+ await fs12.writeFile(tmpScript, PS_SCRIPT, "utf-8");
9428
10180
  try {
9429
10181
  const sampler = startHostStallSampler();
9430
10182
  const startedAt = Date.now();
@@ -9524,7 +10276,7 @@ var psScriptAnalyzerRunner = {
9524
10276
  semantic: hasErrors ? "blocking" : "warning"
9525
10277
  });
9526
10278
  } finally {
9527
- await fs11.unlink(tmpScript).catch(() => {
10279
+ await fs12.unlink(tmpScript).catch(() => {
9528
10280
  });
9529
10281
  }
9530
10282
  }
@@ -9532,7 +10284,6 @@ var psScriptAnalyzerRunner = {
9532
10284
  var psscriptanalyzer_default = psScriptAnalyzerRunner;
9533
10285
 
9534
10286
  // dist/clients/dispatch/runners/pyright.js
9535
- var pyright = createAvailabilityChecker("pyright", ".exe");
9536
10287
  var pyrightRunner = {
9537
10288
  id: "pyright",
9538
10289
  appliesTo: ["python"],
@@ -9544,24 +10295,9 @@ var pyrightRunner = {
9544
10295
  await lspService.getClientForFile(ctx.filePath);
9545
10296
  }
9546
10297
  const cwd = resolveRunnerCwd(ctx, "pyright");
9547
- let cmd = null;
9548
- if (await pyright.isAvailableAsync(cwd)) {
9549
- cmd = pyright.getCommand(cwd);
9550
- }
9551
- if (!cmd) {
9552
- const installedPath = await resolveAvailableOrInstall(pyright, "pyright", cwd);
9553
- if (installedPath)
9554
- cmd = installedPath;
9555
- }
9556
- if (!cmd) {
9557
- const { findCommandAsync } = await import("./chunk-H5API74E.js");
9558
- const foundCmd = await findCommandAsync("pyright");
9559
- if (foundCmd)
9560
- cmd = foundCmd;
9561
- }
9562
- if (!cmd) {
9563
- return toolAbsentSkip(cwd, { id: "pyright", checker: pyright });
9564
- }
10298
+ const cmd = await resolveToolCommandWithInstallFallback(cwd, "pyright");
10299
+ if (!cmd)
10300
+ return toolAbsentSkip(cwd, { id: "pyright" });
9565
10301
  const pythonEnvironment = await detectPythonEnvironment(cwd);
9566
10302
  const env = augmentPythonEnvironment(process.env, pythonEnvironment);
9567
10303
  const result = await safeSpawnAsync(cmd, ["--outputjson", ctx.filePath], {
@@ -9659,7 +10395,7 @@ function parsePyrightOutput(data, _filePath) {
9659
10395
  var pyright_default = pyrightRunner;
9660
10396
 
9661
10397
  // dist/clients/dispatch/runners/rubocop.js
9662
- import * as path34 from "node:path";
10398
+ import * as path35 from "node:path";
9663
10399
  var SEVERITY_MAP = {
9664
10400
  fatal: "error",
9665
10401
  error: "error",
@@ -9672,9 +10408,9 @@ function parseRubocopJson(raw, filePath, cwd) {
9672
10408
  const output = JSON.parse(raw);
9673
10409
  const autofix = getAutofixCapability("rubocop");
9674
10410
  const diagnostics = [];
9675
- const absTarget = path34.resolve(cwd, filePath);
10411
+ const absTarget = path35.resolve(cwd, filePath);
9676
10412
  for (const file of output.files) {
9677
- if (file.path && !pathsEqual(path34.resolve(cwd, file.path), absTarget))
10413
+ if (file.path && !pathsEqual(path35.resolve(cwd, file.path), absTarget))
9678
10414
  continue;
9679
10415
  for (const offense of file.offenses) {
9680
10416
  const severity = SEVERITY_MAP[offense.severity] ?? "warning";
@@ -9709,13 +10445,9 @@ var rubocopRunner = {
9709
10445
  if (policy && !policy.preferredRunners.includes("rubocop")) {
9710
10446
  return skipped("not-preferred");
9711
10447
  }
9712
- let verdict = null;
9713
- const resolved = await resolveCommandArgsWithInstallFallback(getRubocopCommand(cwd), "rubocop", cwd, ["--version"], 1e4, (found) => {
9714
- verdict = found;
9715
- });
9716
- if (!resolved) {
9717
- return toolAbsentSkip(cwd, { id: "rubocop", verdict });
9718
- }
10448
+ const resolved = await resolveRubocopCommand(getRubocopCommand(cwd), cwd);
10449
+ if (!resolved)
10450
+ return toolAbsentSkip(cwd, { id: "rubocop" });
9719
10451
  const { cmd, args } = resolved;
9720
10452
  const result = await safeSpawnAsync(cmd, [...args, "--format", "json", "--no-color", ctx.filePath], { timeout: 3e4, cwd });
9721
10453
  const run = parseToolRun("rubocop", { result, exitCodes: { ran: [1, 2] } }, (output) => parseRubocopJson(output, ctx.filePath, cwd), { parseStreams: "stdout-else-stderr" });
@@ -9765,6 +10497,7 @@ var ruffRunner = {
9765
10497
  id: "ruff-lint",
9766
10498
  appliesTo: ["python"],
9767
10499
  priority: PRIORITY.FORMAT_AND_LINT_PRIMARY,
10500
+ lintsGivenContent: true,
9768
10501
  async run(ctx) {
9769
10502
  const cwd = resolveRunnerCwd2(ctx, "ruff");
9770
10503
  const policy = getLinterPolicyForCwd(ctx.filePath, cwd);
@@ -9783,8 +10516,14 @@ var ruffRunner = {
9783
10516
  "--output-format",
9784
10517
  "json",
9785
10518
  ...configArgs,
9786
- ctx.filePath
9787
- ], { cwd, timeout: 3e4 });
10519
+ // #5621: given bytes arrive on stdin under the file's real path, so
10520
+ // the config, the ignores and the reported filename are the file's.
10521
+ ...ctx.givenContent === void 0 ? [ctx.filePath] : ["--stdin-filename", ctx.filePath, "-"]
10522
+ ], {
10523
+ cwd,
10524
+ timeout: 3e4,
10525
+ ...ctx.givenContent !== void 0 && { input: ctx.givenContent }
10526
+ });
9788
10527
  const run = parseToolRun("ruff", { result: checkResult, exitCodes: { ran: [1, 2] } }, (rawOutput) => {
9789
10528
  const output = stripAnsi(rawOutput);
9790
10529
  const diagnostics = parseRuffJson(output, ctx.filePath);
@@ -9838,22 +10577,7 @@ var rustClippyRunner = {
9838
10577
  if (clippyProbe.getVerdict(ctx.cwd).outcome === "transient") {
9839
10578
  return { status: "skipped", diagnostics: [], semantic: "none" };
9840
10579
  }
9841
- await tryLazyInstall("rust-clippy", ctx.cwd);
9842
- const refreshedProbe = refreshClippyProbe(cargoExe);
9843
- if (!await refreshedProbe(ctx.cwd)) {
9844
- const verdict = refreshedProbe.getVerdict(ctx.cwd);
9845
- logAvailabilityDecision({
9846
- tool: "rust-clippy",
9847
- verdict: "unavailable",
9848
- outcome: verdict.outcome ?? "missing",
9849
- cause: verdict.cause ?? "not-found",
9850
- classifiedBy: "caller",
9851
- evidence: describeInstallAttempt(getLazyInstallAttempt("rust-clippy", ctx.cwd)),
9852
- elapsedMs: 0,
9853
- latched: false
9854
- });
9855
- return toolAbsentSkip(ctx.cwd, { checker: refreshedProbe });
9856
- }
10580
+ return toolAbsentSkip(ctx.cwd, { checker: clippyProbe });
9857
10581
  }
9858
10582
  const cargoResolution = resolveRunnerCwdWithReason(ctx, "rust-clippy");
9859
10583
  const cargoDir = cargoResolution.cwd;
@@ -9968,9 +10692,8 @@ var rust_clippy_default = rustClippyRunner;
9968
10692
 
9969
10693
  // dist/clients/dispatch/runners/spotbugs.js
9970
10694
  import { randomUUID } from "node:crypto";
9971
- import * as fs12 from "node:fs";
9972
- import * as path35 from "node:path";
9973
- var spotbugs = createAvailabilityChecker("spotbugs", ".bat", ["-version"]);
10695
+ import * as fs13 from "node:fs";
10696
+ import * as path36 from "node:path";
9974
10697
  var MAX_DIAGNOSTICS = 50;
9975
10698
  var MAX_XML_BYTES = 4 * 1024 * 1024;
9976
10699
  var scanCache = new BoundedLruCache(32);
@@ -9984,18 +10707,18 @@ function classesSignature(classesDir) {
9984
10707
  break;
9985
10708
  let entries;
9986
10709
  try {
9987
- entries = fs12.readdirSync(dir, { withFileTypes: true });
10710
+ entries = fs13.readdirSync(dir, { withFileTypes: true });
9988
10711
  } catch {
9989
10712
  continue;
9990
10713
  }
9991
10714
  for (const entry of entries) {
9992
- const full = path35.join(dir, entry.name);
10715
+ const full = path36.join(dir, entry.name);
9993
10716
  if (entry.isDirectory()) {
9994
10717
  stack.push(full);
9995
10718
  } else if (entry.isFile() && entry.name.endsWith(".class")) {
9996
10719
  count++;
9997
10720
  try {
9998
- const m = fs12.statSync(full).mtimeMs;
10721
+ const m = fs13.statSync(full).mtimeMs;
9999
10722
  if (m > newest)
10000
10723
  newest = m;
10001
10724
  } catch {
@@ -10080,7 +10803,7 @@ function parseSpotbugsXml(raw) {
10080
10803
  const message = shortMsg || longMsg || type;
10081
10804
  const fixSuggestion = longMsg ? firstSentence(longMsg) : void 0;
10082
10805
  diagnostics.push({
10083
- id: `spotbugs:${type}:${path35.basename(filePath)}:${line}:${index}`,
10806
+ id: `spotbugs:${type}:${path36.basename(filePath)}:${line}:${index}`,
10084
10807
  message: `[${type}] ${message}`,
10085
10808
  filePath,
10086
10809
  line,
@@ -10128,10 +10851,10 @@ var spotbugsRunner = {
10128
10851
  semantic: cached.diagnostics.length > 0 ? "warning" : "none"
10129
10852
  };
10130
10853
  }
10131
- const cmd = await resolveAvailableOrInstall(spotbugs, "spotbugs", cwd);
10854
+ const cmd = await resolveToolCommandWithInstallFallback(cwd, "spotbugs");
10132
10855
  if (!cmd)
10133
- return toolAbsentSkip(cwd, { id: "spotbugs", checker: spotbugs });
10134
- const tmpXml = path35.join(scannerReportParentDir(), `pi-lens-spotbugs-${process.pid}-${randomUUID()}.xml`);
10856
+ return toolAbsentSkip(cwd, { id: "spotbugs" });
10857
+ const tmpXml = path36.join(scannerReportParentDir(), `pi-lens-spotbugs-${process.pid}-${randomUUID()}.xml`);
10135
10858
  const result = await safeSpawnAsync(cmd, [
10136
10859
  "-textui",
10137
10860
  "-xml:withMessages",
@@ -10143,7 +10866,7 @@ var spotbugsRunner = {
10143
10866
  ], { cwd, timeout: 12e4 });
10144
10867
  let xml = "";
10145
10868
  try {
10146
- xml = fs12.readFileSync(tmpXml, "utf8");
10869
+ xml = fs13.readFileSync(tmpXml, "utf8");
10147
10870
  } catch {
10148
10871
  if (result.error || (result.status ?? 0) > 1) {
10149
10872
  return {
@@ -10156,7 +10879,7 @@ var spotbugsRunner = {
10156
10879
  return { status: "succeeded", diagnostics: [], semantic: "none" };
10157
10880
  } finally {
10158
10881
  try {
10159
- fs12.rmSync(tmpXml, { force: true });
10882
+ fs13.rmSync(tmpXml, { force: true });
10160
10883
  } catch {
10161
10884
  }
10162
10885
  }
@@ -10172,12 +10895,11 @@ var spotbugsRunner = {
10172
10895
  var spotbugs_default = spotbugsRunner;
10173
10896
 
10174
10897
  // dist/clients/dispatch/runners/shellcheck.js
10175
- import * as path36 from "node:path";
10176
- var shellcheck = createAvailabilityChecker("shellcheck", ".exe");
10898
+ import * as path37 from "node:path";
10177
10899
  var SHELLCHECK_EXIT_CODES = { ran: [1] };
10178
10900
  function parseShellcheckOutput(raw, filePath, cwd) {
10179
10901
  const diagnostics = [];
10180
- const absTarget = path36.resolve(cwd, filePath);
10902
+ const absTarget = path37.resolve(cwd, filePath);
10181
10903
  if (!raw.trim()) {
10182
10904
  return diagnostics;
10183
10905
  }
@@ -10189,7 +10911,7 @@ function parseShellcheckOutput(raw, filePath, cwd) {
10189
10911
  for (const item of parsed) {
10190
10912
  if (!item.message || !item.line)
10191
10913
  continue;
10192
- if (!item.file || !pathsEqual(path36.resolve(cwd, item.file), absTarget))
10914
+ if (!item.file || !pathsEqual(path37.resolve(cwd, item.file), absTarget))
10193
10915
  continue;
10194
10916
  const severityMap = {
10195
10917
  error: "error",
@@ -10251,21 +10973,14 @@ var shellcheckRunner = {
10251
10973
  skipReason: "dialect-unsupported"
10252
10974
  };
10253
10975
  }
10254
- let cmd = null;
10255
- if (await shellcheck.isAvailableAsync(cwd)) {
10256
- cmd = shellcheck.getCommand(cwd);
10257
- } else {
10258
- const managed = await resolveAvailableOrInstall(shellcheck, "shellcheck", cwd);
10259
- if (managed)
10260
- cmd = managed;
10261
- }
10976
+ const cmd = await resolveToolCommandWithInstallFallback(cwd, "shellcheck");
10262
10977
  if (!cmd)
10263
- return toolAbsentSkip(cwd, { id: "shellcheck", checker: shellcheck });
10978
+ return toolAbsentSkip(cwd, { id: "shellcheck" });
10264
10979
  const args = ["--format", "json"];
10265
10980
  if (!dialectInfo.shebang && !dialectInfo.directive) {
10266
10981
  args.push("--shell", dialectInfo.dialect);
10267
10982
  }
10268
- const configDir = path36.dirname(path36.resolve(cwd, ctx.filePath));
10983
+ const configDir = path37.dirname(path37.resolve(cwd, ctx.filePath));
10269
10984
  if (!hasToolConfig("shellcheck", configDir)) {
10270
10985
  args.push("--severity", "info");
10271
10986
  }
@@ -10400,7 +11115,6 @@ var fishIndentRunner = {
10400
11115
  var fish_indent_default = fishIndentRunner;
10401
11116
 
10402
11117
  // dist/clients/dispatch/runners/shfmt.js
10403
- var shfmt = createAvailabilityChecker("shfmt", ".exe");
10404
11118
  var shfmtRunner = {
10405
11119
  id: "shfmt",
10406
11120
  appliesTo: ["shell"],
@@ -10408,18 +11122,9 @@ var shfmtRunner = {
10408
11122
  skipTestFiles: false,
10409
11123
  async run(ctx) {
10410
11124
  const cwd = resolveRunnerCwd(ctx, "shfmt");
10411
- let cmd = null;
10412
- if (await shfmt.isAvailableAsync(cwd)) {
10413
- cmd = shfmt.getCommand(cwd);
10414
- } else {
10415
- const installed = await resolveAvailableOrInstall(shfmt, "shfmt", cwd);
10416
- if (!installed) {
10417
- return toolAbsentSkip(cwd, { id: "shfmt", checker: shfmt });
10418
- }
10419
- cmd = installed;
10420
- }
11125
+ const cmd = await resolveToolCommandWithInstallFallback(cwd, "shfmt");
10421
11126
  if (!cmd)
10422
- return toolAbsentSkip(cwd, { id: "shfmt", checker: shfmt });
11127
+ return toolAbsentSkip(cwd, { id: "shfmt" });
10423
11128
  const result = await safeSpawnAsync(cmd, ["--diff", ctx.filePath], {
10424
11129
  timeout: 1e4,
10425
11130
  cwd
@@ -10483,13 +11188,12 @@ var shfmtRunner = {
10483
11188
  var shfmt_default = shfmtRunner;
10484
11189
 
10485
11190
  // dist/clients/dispatch/runners/spellcheck.js
10486
- import * as path37 from "node:path";
10487
- var typos = createAvailabilityChecker("typos", ".exe");
11191
+ import * as path38 from "node:path";
10488
11192
  var TYPOS_EXIT_CODES = { ran: [2] };
10489
11193
  function parseTyposOutput(raw, filePath, cwd) {
10490
11194
  const diagnostics = [];
10491
11195
  let readRecords = 0;
10492
- const absTarget = path37.resolve(cwd, filePath);
11196
+ const absTarget = path38.resolve(cwd, filePath);
10493
11197
  if (!raw.trim()) {
10494
11198
  return diagnostics;
10495
11199
  }
@@ -10501,7 +11205,7 @@ function parseTyposOutput(raw, filePath, cwd) {
10501
11205
  readRecords += 1;
10502
11206
  if (!parsed.typo || !parsed.line_num)
10503
11207
  continue;
10504
- if (parsed.path && !pathsEqual(path37.resolve(cwd, parsed.path), absTarget))
11208
+ if (parsed.path && !pathsEqual(path38.resolve(cwd, parsed.path), absTarget))
10505
11209
  continue;
10506
11210
  const corrections = parsed.corrections?.join(", ") || "no suggestions";
10507
11211
  const message = `Typo: "${parsed.typo}" \u2192 ${corrections}`;
@@ -10535,11 +11239,11 @@ var spellcheckRunner = {
10535
11239
  // Check docs in test files too
10536
11240
  async run(ctx) {
10537
11241
  const cwd = resolveRunnerCwd2(ctx, "spellcheck/typos");
10538
- if (!await typos.isAvailableAsync(cwd)) {
10539
- return toolAbsentSkip(cwd, { id: "typos", checker: typos });
10540
- }
11242
+ const cmd = await resolveToolCommandWithInstallFallback(cwd, "typos");
11243
+ if (!cmd)
11244
+ return toolAbsentSkip(cwd, { id: "typos" });
10541
11245
  const args = ["--format", "json", ctx.filePath];
10542
- const result = await safeSpawnAsync(typos.getCommand(cwd), args, {
11246
+ const result = await safeSpawnAsync(cmd, args, {
10543
11247
  cwd,
10544
11248
  timeout: 15e3
10545
11249
  });
@@ -10559,7 +11263,7 @@ var spellcheckRunner = {
10559
11263
  var spellcheck_default = spellcheckRunner;
10560
11264
 
10561
11265
  // dist/clients/dispatch/runners/sqlfluff.js
10562
- import * as path38 from "node:path";
11266
+ import * as path39 from "node:path";
10563
11267
  var SQLFLUFF_EXIT_CODES = { ran: [1] };
10564
11268
  var SQLFLUFF_FIXABLE_RULES = /* @__PURE__ */ new Set([
10565
11269
  // Layout — pure formatting
@@ -10613,9 +11317,9 @@ function parseSqlfluffOutput(raw, filePath, cwd) {
10613
11317
  if (!Array.isArray(parsed))
10614
11318
  return [];
10615
11319
  const diagnostics = [];
10616
- const absTarget = path38.resolve(cwd, filePath);
11320
+ const absTarget = path39.resolve(cwd, filePath);
10617
11321
  for (const item of parsed) {
10618
- if (item.filepath && !pathsEqual(path38.resolve(cwd, item.filepath), absTarget))
11322
+ if (item.filepath && !pathsEqual(path39.resolve(cwd, item.filepath), absTarget))
10619
11323
  continue;
10620
11324
  for (const v of item.violations ?? []) {
10621
11325
  if (!v.description)
@@ -10685,7 +11389,7 @@ var sqlfluffRunner = {
10685
11389
  var sqlfluff_default = sqlfluffRunner;
10686
11390
 
10687
11391
  // dist/clients/dispatch/runners/stylelint.js
10688
- import * as path39 from "node:path";
11392
+ import * as path40 from "node:path";
10689
11393
  var STYLELINT_EXIT_CODES = { ran: [1, 2] };
10690
11394
  function stylelintReport(stdout, stderr) {
10691
11395
  for (const stream of [stdout, stderr]) {
@@ -10729,9 +11433,9 @@ function parseStylelintJson(raw, filePath, cwd) {
10729
11433
  try {
10730
11434
  const results = JSON.parse(raw);
10731
11435
  const diagnostics = [];
10732
- const absTarget = path39.resolve(cwd, filePath);
11436
+ const absTarget = path40.resolve(cwd, filePath);
10733
11437
  for (const result of results) {
10734
- if (result.source && !pathsEqual(path39.resolve(cwd, result.source), absTarget))
11438
+ if (result.source && !pathsEqual(path40.resolve(cwd, result.source), absTarget))
10735
11439
  continue;
10736
11440
  for (const w of result.warnings) {
10737
11441
  const severity = w.severity === "error" ? "error" : "warning";
@@ -10767,7 +11471,7 @@ var stylelintRunner = {
10767
11471
  if (policy && !policy.preferredRunners.includes("stylelint")) {
10768
11472
  return skipped("not-preferred");
10769
11473
  }
10770
- const fileDir = path39.dirname(path39.resolve(cwd, ctx.filePath));
11474
+ const fileDir = path40.dirname(path40.resolve(cwd, ctx.filePath));
10771
11475
  const hasConfig = hasToolConfig("stylelint", fileDir) || hasToolConfig("stylelint", cwd);
10772
11476
  if (!hasConfig) {
10773
11477
  logRunnerAdvisoryOnce(ctx, "stylelint", cwd, "stylelint: no config detected, running with default rules");
@@ -10792,7 +11496,7 @@ var stylelintRunner = {
10792
11496
  var stylelint_default = stylelintRunner;
10793
11497
 
10794
11498
  // dist/clients/dispatch/runners/swiftlint.js
10795
- import * as path40 from "node:path";
11499
+ import * as path41 from "node:path";
10796
11500
  var SWIFTLINT_FIXABLE_RULES = /* @__PURE__ */ new Set([
10797
11501
  "closing_brace",
10798
11502
  "colon",
@@ -10854,7 +11558,7 @@ function parseSwiftLintOutput(raw, filePath, cwd) {
10854
11558
  const diagnostics = [];
10855
11559
  if (!raw.trim())
10856
11560
  return diagnostics;
10857
- const absTarget = path40.resolve(cwd, filePath);
11561
+ const absTarget = path41.resolve(cwd, filePath);
10858
11562
  try {
10859
11563
  const parsed = JSON.parse(raw);
10860
11564
  if (!Array.isArray(parsed))
@@ -10862,7 +11566,7 @@ function parseSwiftLintOutput(raw, filePath, cwd) {
10862
11566
  for (const item of parsed) {
10863
11567
  if (!item.reason)
10864
11568
  continue;
10865
- if (item.file && !pathsEqual(path40.resolve(cwd, item.file), absTarget))
11569
+ if (item.file && !pathsEqual(path41.resolve(cwd, item.file), absTarget))
10866
11570
  continue;
10867
11571
  const severityMap = {
10868
11572
  error: "error",
@@ -10902,7 +11606,7 @@ var swiftlintRunner = {
10902
11606
  const cmd = await resolveToolCommandWithInstallFallback(cwd, "swiftlint");
10903
11607
  if (!cmd)
10904
11608
  return toolAbsentSkip(cwd, { id: "swiftlint" });
10905
- const result = await safeSpawnAsync(cmd, ["--reporter", "json", path40.resolve(cwd, ctx.filePath)], { cwd, timeout: 15e3 });
11609
+ const result = await safeSpawnAsync(cmd, ["--reporter", "json", path41.resolve(cwd, ctx.filePath)], { cwd, timeout: 15e3 });
10906
11610
  const run = parseToolRun("swiftlint", {
10907
11611
  result,
10908
11612
  // EXIT TABLE (SwiftLint 0.56 measured fixture): 0 clean; 1 findings; 2 error; other nonzero rejected.
@@ -10925,7 +11629,7 @@ var swiftlintRunner = {
10925
11629
  var swiftlint_default = swiftlintRunner;
10926
11630
 
10927
11631
  // dist/clients/dispatch/runners/taplo.js
10928
- import * as path41 from "node:path";
11632
+ import * as path42 from "node:path";
10929
11633
  var TAPLO_EXIT_CODES = { ran: [1] };
10930
11634
  var HEADER_PATTERN = /^\s*(error|warning):(.*)$/;
10931
11635
  var LOCATION_LEAD = "\u250C\u2500";
@@ -10935,7 +11639,7 @@ function parseTaploOutput(raw, filePath, cwd) {
10935
11639
  let located = 0;
10936
11640
  if (!raw.trim())
10937
11641
  return diagnostics;
10938
- const absTarget = path41.resolve(cwd, filePath);
11642
+ const absTarget = path42.resolve(cwd, filePath);
10939
11643
  const lines = stripAnsi(raw ?? "").split(/\r?\n/);
10940
11644
  for (let i = 0; i < lines.length; i++) {
10941
11645
  const header = HEADER_PATTERN.exec(lines[i].trimEnd());
@@ -10954,7 +11658,7 @@ function parseTaploOutput(raw, filePath, cwd) {
10954
11658
  if (!location)
10955
11659
  continue;
10956
11660
  located += 1;
10957
- if (!pathsEqual(path41.resolve(cwd, location[1].trim()), absTarget))
11661
+ if (!pathsEqual(path42.resolve(cwd, location[1].trim()), absTarget))
10958
11662
  continue;
10959
11663
  line = Number.parseInt(location[2], 10) || 1;
10960
11664
  column = Number.parseInt(location[3], 10) || 1;
@@ -11016,7 +11720,7 @@ var taploRunner = {
11016
11720
  id: "taplo",
11017
11721
  trustRefused: isLocalBinTrustRefusal(projectTaplo)
11018
11722
  });
11019
- const absPath = path41.resolve(cwd, ctx.filePath);
11723
+ const absPath = path42.resolve(cwd, ctx.filePath);
11020
11724
  const result = await safeSpawnAsync(cmd, ["check", "--colors", "never", absPath], { cwd, timeout: 15e3 });
11021
11725
  const raw = result.stderr?.trim() ? result.stderr : result.stdout ?? "";
11022
11726
  const run = parseToolRun("taplo", { result, output: raw, exitCodes: TAPLO_EXIT_CODES }, (out) => parseTaploOutput(out, ctx.filePath, cwd));
@@ -11035,8 +11739,7 @@ var taploRunner = {
11035
11739
  var taplo_default = taploRunner;
11036
11740
 
11037
11741
  // dist/clients/dispatch/runners/terragrunt.js
11038
- import * as path42 from "node:path";
11039
- var terragrunt = createAvailabilityChecker("terragrunt", ".exe");
11742
+ import * as path43 from "node:path";
11040
11743
  function normalizeSeverity(raw) {
11041
11744
  if (typeof raw === "number")
11042
11745
  return raw === 1 ? "error" : "warning";
@@ -11054,7 +11757,7 @@ function toRawDiagnostics(parsed) {
11054
11757
  return [];
11055
11758
  return invalidFiles.flatMap((f) => Array.isArray(f?.diagnostics) ? f.diagnostics : []);
11056
11759
  }
11057
- function parseTerragruntOutput(raw, filePath, absPath = path42.resolve(filePath)) {
11760
+ function parseTerragruntOutput(raw, filePath, absPath = path43.resolve(filePath)) {
11058
11761
  if (!raw.trim())
11059
11762
  return [];
11060
11763
  let parsed;
@@ -11063,13 +11766,13 @@ function parseTerragruntOutput(raw, filePath, absPath = path42.resolve(filePath)
11063
11766
  } catch {
11064
11767
  return [];
11065
11768
  }
11066
- const unitDir = path42.dirname(absPath);
11769
+ const unitDir = path43.dirname(absPath);
11067
11770
  const diagnostics = [];
11068
11771
  for (const d of toRawDiagnostics(parsed)) {
11069
11772
  if (!d || typeof d !== "object")
11070
11773
  continue;
11071
11774
  const diagFile = d.range?.filename;
11072
- if (diagFile && !pathsEqual(path42.resolve(unitDir, diagFile), absPath))
11775
+ if (diagFile && !pathsEqual(path43.resolve(unitDir, diagFile), absPath))
11073
11776
  continue;
11074
11777
  const line = d.range?.start?.line ?? 1;
11075
11778
  const column = d.range?.start?.column ?? 1;
@@ -11100,18 +11803,11 @@ var terragruntRunner = {
11100
11803
  const policy = getLinterPolicyForCwd(ctx.filePath, cwd);
11101
11804
  if (policy && !policy.preferredRunners.includes("terragrunt"))
11102
11805
  return skipped("not-preferred");
11103
- let cmd = null;
11104
- if (await terragrunt.isAvailableAsync(cwd)) {
11105
- cmd = terragrunt.getCommand(cwd);
11106
- } else {
11107
- const managed = await resolveAvailableOrInstall(terragrunt, "terragrunt", cwd);
11108
- if (managed)
11109
- cmd = managed;
11110
- }
11806
+ const cmd = await resolveToolCommandWithInstallFallback(cwd, "terragrunt");
11111
11807
  if (!cmd)
11112
- return toolAbsentSkip(cwd, { id: "terragrunt", checker: terragrunt });
11113
- const absPath = path42.resolve(cwd, ctx.filePath);
11114
- const fileDir = path42.dirname(absPath);
11808
+ return toolAbsentSkip(cwd, { id: "terragrunt" });
11809
+ const absPath = path43.resolve(cwd, ctx.filePath);
11810
+ const fileDir = path43.dirname(absPath);
11115
11811
  const result = await safeSpawnAsync(cmd, ["hcl", "validate", "--json", "--non-interactive"], { cwd: fileDir, timeout: 3e4 });
11116
11812
  if (spawnFailedWithNoOutput(result))
11117
11813
  return faultSkip("did-not-run");
@@ -11137,15 +11833,14 @@ var terragruntRunner = {
11137
11833
  var terragrunt_default = terragruntRunner;
11138
11834
 
11139
11835
  // dist/clients/dispatch/runners/tflint.js
11140
- import * as path43 from "node:path";
11141
- var tflint = createAvailabilityChecker("tflint", ".exe");
11836
+ import * as path44 from "node:path";
11142
11837
  function parseTflintOutput(raw, filePath, toolCwd) {
11143
11838
  try {
11144
11839
  const parsed = JSON.parse(raw);
11145
11840
  const issues = parsed.issues ?? [];
11146
- const absTarget = path43.resolve(toolCwd, filePath);
11841
+ const absTarget = path44.resolve(toolCwd, filePath);
11147
11842
  return issues.flatMap((issue) => {
11148
- if (issue.range?.filename && !pathsEqual(path43.resolve(toolCwd, issue.range.filename), absTarget))
11843
+ if (issue.range?.filename && !pathsEqual(path44.resolve(toolCwd, issue.range.filename), absTarget))
11149
11844
  return [];
11150
11845
  const severity = issue.rule.severity === "error" ? "error" : "warning";
11151
11846
  return [
@@ -11178,22 +11873,15 @@ var tflintRunner = {
11178
11873
  if (policy && !policy.preferredRunners.includes("tflint")) {
11179
11874
  return skipped("not-preferred");
11180
11875
  }
11181
- let cmd = null;
11182
- if (await tflint.isAvailableAsync(cwd)) {
11183
- cmd = tflint.getCommand(cwd);
11184
- } else {
11185
- const managed = await resolveAvailableOrInstall(tflint, "tflint", cwd);
11186
- if (managed)
11187
- cmd = managed;
11188
- }
11876
+ const cmd = await resolveToolCommandWithInstallFallback(cwd, "tflint");
11189
11877
  if (!cmd)
11190
- return toolAbsentSkip(cwd, { id: "tflint", checker: tflint });
11191
- const absPath = path43.resolve(cwd, ctx.filePath);
11192
- const fileDir = path43.dirname(absPath);
11878
+ return toolAbsentSkip(cwd, { id: "tflint" });
11879
+ const absPath = path44.resolve(cwd, ctx.filePath);
11880
+ const fileDir = path44.dirname(absPath);
11193
11881
  const args = [
11194
11882
  "--format=json",
11195
11883
  "--no-color",
11196
- `--filter=${path43.basename(absPath)}`
11884
+ `--filter=${path44.basename(absPath)}`
11197
11885
  ];
11198
11886
  const configPath = process.env.TFLINT_CONFIG_FILE ? void 0 : findToolConfig("tflint", fileDir)?.file;
11199
11887
  if (configPath)
@@ -11228,8 +11916,8 @@ var tflintRunner = {
11228
11916
  var tflint_default = tflintRunner;
11229
11917
 
11230
11918
  // dist/clients/dispatch/runners/trivy-config.js
11231
- import * as fs13 from "node:fs";
11232
- import * as path44 from "node:path";
11919
+ import * as fs14 from "node:fs";
11920
+ import * as path45 from "node:path";
11233
11921
  function looksLikeKubernetesManifest(content) {
11234
11922
  for (const doc of content.split(/^---\s*$/m)) {
11235
11923
  if (/^apiVersion:\s*\S/m.test(doc) && /^kind:\s*\S/m.test(doc)) {
@@ -11265,12 +11953,12 @@ function parseTrivyConfigOutput(raw, filePath, cwd = process.cwd()) {
11265
11953
  if (!Array.isArray(results))
11266
11954
  return [];
11267
11955
  const diagnostics = [];
11268
- const absTarget = path44.resolve(cwd, filePath);
11956
+ const absTarget = path45.resolve(cwd, filePath);
11269
11957
  for (const resultEntry of results) {
11270
11958
  if (!resultEntry || typeof resultEntry !== "object")
11271
11959
  continue;
11272
11960
  const target = resultEntry.Target;
11273
- if (typeof target !== "string" || !pathsEqual(path44.resolve(cwd, target), absTarget))
11961
+ if (typeof target !== "string" || !pathsEqual(path45.resolve(cwd, target), absTarget))
11274
11962
  continue;
11275
11963
  const rows = resultEntry.Misconfigurations;
11276
11964
  if (!Array.isArray(rows))
@@ -11320,11 +12008,11 @@ var trivyConfigRunner = {
11320
12008
  skipReason: "not-enabled"
11321
12009
  };
11322
12010
  }
11323
- const absPath = path44.resolve(cwd, ctx.filePath);
12011
+ const absPath = path45.resolve(cwd, ctx.filePath);
11324
12012
  if (ctx.kind === "yaml" || ctx.kind === "json") {
11325
12013
  let content = "";
11326
12014
  try {
11327
- content = fs13.readFileSync(absPath, "utf-8");
12015
+ content = fs14.readFileSync(absPath, "utf-8");
11328
12016
  } catch {
11329
12017
  return { status: "skipped", diagnostics: [], semantic: "none" };
11330
12018
  }
@@ -11385,12 +12073,12 @@ var trivyConfigRunner = {
11385
12073
  var trivy_config_default = trivyConfigRunner;
11386
12074
 
11387
12075
  // dist/clients/dispatch/runners/vale.js
11388
- import * as path45 from "node:path";
12076
+ import * as path46 from "node:path";
11389
12077
  function parseValeOutput(raw, filePath, cwd) {
11390
12078
  const diagnostics = [];
11391
12079
  if (!raw.trim())
11392
12080
  return diagnostics;
11393
- const absTarget = path45.resolve(cwd, filePath);
12081
+ const absTarget = path46.resolve(cwd, filePath);
11394
12082
  try {
11395
12083
  const parsed = JSON.parse(raw);
11396
12084
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
@@ -11398,7 +12086,7 @@ function parseValeOutput(raw, filePath, cwd) {
11398
12086
  for (const [reported, alerts] of Object.entries(parsed)) {
11399
12087
  if (!Array.isArray(alerts))
11400
12088
  continue;
11401
- if (reported && !pathsEqual(path45.resolve(cwd, reported), absTarget))
12089
+ if (reported && !pathsEqual(path46.resolve(cwd, reported), absTarget))
11402
12090
  continue;
11403
12091
  for (const alert of alerts) {
11404
12092
  if (!alert.Message)
@@ -11443,7 +12131,7 @@ var valeRunner = {
11443
12131
  const cmd = await resolveToolCommandWithInstallFallback(cwd, "vale");
11444
12132
  if (!cmd)
11445
12133
  return toolAbsentSkip(cwd, { id: "vale" });
11446
- const result = await safeSpawnAsync(cmd, ["--output", "JSON", ctx.filePath], { cwd, timeout: 15e3 });
12134
+ const result = await safeSpawnAsync(cmd, ["--output", "JSON", optionSafeTargetArg(cwd, ctx.filePath)], { cwd, timeout: 15e3 });
11447
12135
  const run = parseToolRun("vale", {
11448
12136
  result,
11449
12137
  // EXIT TABLE (Vale 3.9.6 docs https://vale.sh/docs/topics/metrics/): 0 clean; 1 findings; 2 error; other nonzero rejected.
@@ -11466,11 +12154,11 @@ var valeRunner = {
11466
12154
  var vale_default = valeRunner;
11467
12155
 
11468
12156
  // dist/clients/dispatch/runners/tree-sitter.js
11469
- import * as path47 from "node:path";
12157
+ import * as path48 from "node:path";
11470
12158
 
11471
12159
  // dist/clients/cache/rule-cache.js
11472
- import * as fs14 from "node:fs";
11473
- import * as path46 from "node:path";
12160
+ import * as fs15 from "node:fs";
12161
+ import * as path47 from "node:path";
11474
12162
  var CACHE_VERSION = "v7";
11475
12163
  function reportBundledRulesRootHealth() {
11476
12164
  reportBundledResourceDirHealth("tree-sitter-queries-dir-missing", BUNDLED_QUERIES_ROOT, getBundledQueriesRootHealth(), "bundled tree-sitter query rules");
@@ -11482,12 +12170,12 @@ var RuleCache = class {
11482
12170
  constructor(language, rootDir = process.cwd()) {
11483
12171
  this.language = language;
11484
12172
  reportBundledRulesRootHealth();
11485
- this.cacheDir = path46.join(getProjectDataDir(rootDir), "cache");
11486
- this.cacheFile = path46.join(this.cacheDir, `${language}-rules-${CACHE_VERSION}.json`);
12173
+ this.cacheDir = path47.join(getProjectDataDir(rootDir), "cache");
12174
+ this.cacheFile = path47.join(this.cacheDir, `${language}-rules-${CACHE_VERSION}.json`);
11487
12175
  }
11488
12176
  ensureCacheDir() {
11489
- if (!fs14.existsSync(this.cacheDir)) {
11490
- fs14.mkdirSync(this.cacheDir, { recursive: true });
12177
+ if (!fs15.existsSync(this.cacheDir)) {
12178
+ fs15.mkdirSync(this.cacheDir, { recursive: true });
11491
12179
  }
11492
12180
  }
11493
12181
  computeRuleHash(ruleFiles) {
@@ -11496,7 +12184,7 @@ var RuleCache = class {
11496
12184
  get(ruleFiles) {
11497
12185
  try {
11498
12186
  this.ensureCacheDir();
11499
- if (!fs14.existsSync(this.cacheFile))
12187
+ if (!fs15.existsSync(this.cacheFile))
11500
12188
  return null;
11501
12189
  const currentHash = this.computeRuleHash(ruleFiles);
11502
12190
  const cached = readJsonCache(this.cacheFile, (parsed) => {
@@ -11530,11 +12218,11 @@ var RuleCache = class {
11530
12218
  // on their own — nothing ever read or removed them again once the version
11531
12219
  // bumped. Delete every sibling for this language that isn't the current file.
11532
12220
  pruneStaleVersions() {
11533
- const currentName = path46.basename(this.cacheFile);
12221
+ const currentName = path47.basename(this.cacheFile);
11534
12222
  const pattern = new RegExp(`^${this.language}-rules-v\\d+\\.json$`);
11535
12223
  let dirents;
11536
12224
  try {
11537
- dirents = fs14.readdirSync(this.cacheDir);
12225
+ dirents = fs15.readdirSync(this.cacheDir);
11538
12226
  } catch {
11539
12227
  return;
11540
12228
  }
@@ -11542,15 +12230,15 @@ var RuleCache = class {
11542
12230
  if (name === currentName || !pattern.test(name))
11543
12231
  continue;
11544
12232
  try {
11545
- fs14.unlinkSync(path46.join(this.cacheDir, name));
12233
+ fs15.unlinkSync(path47.join(this.cacheDir, name));
11546
12234
  } catch {
11547
12235
  }
11548
12236
  }
11549
12237
  }
11550
12238
  clear() {
11551
12239
  try {
11552
- if (fs14.existsSync(this.cacheFile)) {
11553
- fs14.unlinkSync(this.cacheFile);
12240
+ if (fs15.existsSync(this.cacheFile)) {
12241
+ fs15.unlinkSync(this.cacheFile);
11554
12242
  }
11555
12243
  } catch {
11556
12244
  }
@@ -11841,6 +12529,8 @@ var treeSitterRunner = {
11841
12529
  priority: PRIORITY.STRUCTURAL_ANALYSIS,
11842
12530
  skipTestFiles: false,
11843
12531
  // Run on test files too (structural issues matter there)
12532
+ // #5621: it reads the `file.content` fact, never the disk.
12533
+ lintsGivenContent: true,
11844
12534
  async run(ctx) {
11845
12535
  const client = getSharedTreeSitterClient();
11846
12536
  logTreeSitter({ phase: "runner_start", filePath: ctx.filePath });
@@ -11864,7 +12554,7 @@ var treeSitterRunner = {
11864
12554
  return { status: "skipped", diagnostics: [], semantic: "none" };
11865
12555
  }
11866
12556
  const filePath = ctx.filePath;
11867
- const ext = path47.extname(filePath).toLowerCase();
12557
+ const ext = path48.extname(filePath).toLowerCase();
11868
12558
  const languageId = resolveTreeSitterLanguage(filePath);
11869
12559
  if (!languageId) {
11870
12560
  logTreeSitter({
@@ -12098,17 +12788,17 @@ var treeSitterRunner = {
12098
12788
  var tree_sitter_default = treeSitterRunner;
12099
12789
 
12100
12790
  // dist/clients/dispatch/runners/yamllint.js
12101
- import * as path48 from "node:path";
12791
+ import * as path49 from "node:path";
12102
12792
  function parseYamllintParsable(raw, filePath, cwd) {
12103
12793
  const diagnostics = [];
12104
- const absTarget = path48.resolve(cwd, filePath);
12794
+ const absTarget = path49.resolve(cwd, filePath);
12105
12795
  for (const line of raw.split(/\r?\n/)) {
12106
12796
  if (!line.trim())
12107
12797
  continue;
12108
12798
  const match = line.match(/^(.*?):(\d+):(\d+):\s*\[(error|warning)\]\s*(.*?)\s*\(([^)]+)\)\s*$/i);
12109
12799
  if (!match)
12110
12800
  continue;
12111
- if (!pathsEqual(path48.resolve(cwd, match[1]), absTarget))
12801
+ if (!pathsEqual(path49.resolve(cwd, match[1]), absTarget))
12112
12802
  continue;
12113
12803
  const severity = match[4].toLowerCase() === "error" ? "error" : "warning";
12114
12804
  diagnostics.push({
@@ -12176,17 +12866,17 @@ var yamllintRunner = {
12176
12866
  var yamllint_default = yamllintRunner;
12177
12867
 
12178
12868
  // dist/clients/dispatch/runners/zig-check.js
12179
- import * as path49 from "node:path";
12869
+ import * as path50 from "node:path";
12180
12870
  var zig = createAvailabilityChecker("zig", ".exe", ["version"]);
12181
12871
  function parseZigOutput(raw, filePath, cwd) {
12182
12872
  const diagnostics = [];
12183
- const absTarget = path49.resolve(cwd, filePath);
12873
+ const absTarget = path50.resolve(cwd, filePath);
12184
12874
  for (const line of raw.split(/\r?\n/)) {
12185
12875
  const match = line.match(/^(.*?):(\d+):(\d+):\s*(error|warning|note):\s*(.+)$/);
12186
12876
  if (!match)
12187
12877
  continue;
12188
12878
  const [, rawFile, lineStr, colStr, level, message] = match;
12189
- if (!pathsEqual(path49.resolve(cwd, rawFile.trim()), absTarget))
12879
+ if (!pathsEqual(path50.resolve(cwd, rawFile.trim()), absTarget))
12190
12880
  continue;
12191
12881
  const severity = level === "error" ? "error" : "warning";
12192
12882
  diagnostics.push({
@@ -12217,7 +12907,7 @@ var zigCheckRunner = {
12217
12907
  return toolAbsentSkip(cwd, { checker: zig });
12218
12908
  }
12219
12909
  const cmd = zig.getCommand(cwd);
12220
- const absPath = path49.resolve(cwd, ctx.filePath);
12910
+ const absPath = path50.resolve(cwd, ctx.filePath);
12221
12911
  const result = await safeSpawnAsync(cmd, ["build-exe", absPath, "-fno-emit-bin"], { cwd, timeout: 3e4 });
12222
12912
  if (result.error && !result.stdout && !result.stderr) {
12223
12913
  return faultSkip("did-not-run");
@@ -12923,6 +13613,7 @@ function applyProjectLensConfig(cwd) {
12923
13613
  var sessionFacts = new FactStore("dispatch");
12924
13614
  var preEditCaptureFacts = new FactStore("pre-edit-capture");
12925
13615
  var preEditCapturesInFlight = /* @__PURE__ */ new Map();
13616
+ var stagedDeltaFacts = new FactStore("staged-delta");
12926
13617
  setFactStoreEvictionReporter((subject, axis, reason) => {
12927
13618
  if (axis === "pinned-over-budget") {
12928
13619
  recordDegradationOnce({
@@ -13107,6 +13798,7 @@ function resetDispatchBaselines(cwd) {
13107
13798
  for (const controller of preEditCapturesInFlight.values())
13108
13799
  controller.abort();
13109
13800
  preEditCaptureFacts.clearAll();
13801
+ stagedDeltaFacts.clearAll();
13110
13802
  resetSessionSlopScore();
13111
13803
  clearCoverageNoticeState();
13112
13804
  clearReviewGraphWorkspaceCache();
@@ -13281,7 +13973,7 @@ function usableWarmWordIndex(index) {
13281
13973
  return index?.forward ? index : void 0;
13282
13974
  }
13283
13975
  function acquireWarmWordIndex(cwd) {
13284
- const key = path50.resolve(cwd);
13976
+ const key = path51.resolve(cwd);
13285
13977
  let entry = warmWordIndexes.get(key);
13286
13978
  if (!entry) {
13287
13979
  const snapshot = loadProjectSnapshot(key);
@@ -13319,7 +14011,7 @@ function adoptPublishedWarmWordIndex(cwd, published, trigger) {
13319
14011
  const index = usableWarmWordIndex(published);
13320
14012
  if (!index)
13321
14013
  return;
13322
- const key = path50.resolve(cwd);
14014
+ const key = path51.resolve(cwd);
13323
14015
  const entry = warmWordIndexes.get(key);
13324
14016
  if (!entry || entry.index)
13325
14017
  return;
@@ -13386,7 +14078,7 @@ async function warmLspForFile(absPath, host) {
13386
14078
  return;
13387
14079
  let content;
13388
14080
  try {
13389
- content = fs15.readFileSync(absPath, "utf8");
14081
+ content = fs16.readFileSync(absPath, "utf8");
13390
14082
  } catch {
13391
14083
  return;
13392
14084
  }
@@ -13444,7 +14136,7 @@ async function analyzeFile(filePath, workspaceCwd, options = {}) {
13444
14136
  }
13445
14137
  if (options.registerTurnState) {
13446
14138
  try {
13447
- const lineCount = fs15.readFileSync(absPath, "utf8").split("\n").length;
14139
+ const lineCount = fs16.readFileSync(absPath, "utf8").split("\n").length;
13448
14140
  new CacheManager().addModifiedRange(absPath, { start: 1, end: lineCount }, true, cwd, options.ownerId ?? MCP_TURN_STATE_OWNER_ID, "mcp");
13449
14141
  } catch {
13450
14142
  }
@@ -13462,7 +14154,7 @@ async function analyzeFile(filePath, workspaceCwd, options = {}) {
13462
14154
  try {
13463
14155
  if (warmIndex) {
13464
14156
  try {
13465
- const content = fs15.readFileSync(absPath, "utf8");
14157
+ const content = fs16.readFileSync(absPath, "utf8");
13466
14158
  if (!canWriteAnalysisRoot(analysisRootMode)) {
13467
14159
  emitBounded("adopted_root_writer_skipped", `${absPath}:word-index`, {
13468
14160
  filePath: absPath,