@herbertgao/pi-extensions 2026.11.11 → 2026.11.13

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 (262) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +13 -11
  3. package/THIRD_PARTY_NOTICES.md +3 -3
  4. package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +10 -0
  5. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +3 -4
  6. package/node_modules/@herbertgao/pi-cc-extensions/README.md +3 -4
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +22 -15
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/index.ts +22 -8
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +0 -29
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/prompt-editor.ts +5 -2
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +60 -39
  12. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +3 -2
  13. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +0 -40
  14. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-parse.ts +4 -1
  15. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +21 -3
  16. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/format.ts +15 -0
  17. package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
  18. package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +6 -0
  19. package/node_modules/@herbertgao/pi-impeccable/README.md +2 -2
  20. package/node_modules/@herbertgao/pi-impeccable/package.json +4 -4
  21. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +2 -2
  22. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/adapt.md +1 -1
  23. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/animate.md +17 -0
  24. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique-rubric.md +496 -0
  25. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique.md +12 -504
  26. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/motion-reviewer.md +29 -0
  27. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/hooks.md +3 -3
  28. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work-comp.md +24 -0
  29. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work-world.md +20 -0
  30. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work.md +5 -34
  31. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/typeset.md +6 -0
  32. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -1
  33. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +5 -5
  34. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +17 -18
  35. package/node_modules/@herbertgao/pi-inline-skill-commands/LICENSE +21 -0
  36. package/node_modules/@herbertgao/pi-inline-skill-commands/README.md +33 -0
  37. package/node_modules/@herbertgao/pi-inline-skill-commands/package.json +53 -0
  38. package/node_modules/@herbertgao/pi-inline-skill-commands/src/index.ts +213 -0
  39. package/node_modules/pi-antigravity/README.md +58 -9
  40. package/node_modules/pi-antigravity/docs/reader-guarantees.md +35 -0
  41. package/node_modules/pi-antigravity/package.json +15 -6
  42. package/node_modules/pi-antigravity/src/client/client.ts +63 -14
  43. package/node_modules/pi-antigravity/src/client/enterprise.ts +150 -0
  44. package/node_modules/pi-antigravity/src/client/index.ts +1 -0
  45. package/node_modules/pi-antigravity/src/diagnostics/diagnostics.ts +7 -0
  46. package/node_modules/pi-antigravity/src/features/generate-image.ts +56 -2
  47. package/node_modules/pi-antigravity/src/features/read-url-content.ts +124 -0
  48. package/node_modules/pi-antigravity/src/image/image.ts +16 -2
  49. package/node_modules/pi-antigravity/src/index.ts +145 -2
  50. package/node_modules/pi-antigravity/src/models/discovery.ts +3 -4
  51. package/node_modules/pi-antigravity/src/models/grouping.ts +39 -15
  52. package/node_modules/pi-antigravity/src/models/models.ts +126 -14
  53. package/node_modules/pi-antigravity/src/stream/stream.ts +189 -30
  54. package/node_modules/pi-antigravity/src/types/types.ts +30 -1
  55. package/node_modules/pi-antigravity/src/usage/usage.ts +58 -0
  56. package/node_modules/pi-antigravity/src/utils/address.ts +180 -0
  57. package/node_modules/pi-antigravity/src/utils/credits.ts +149 -0
  58. package/node_modules/pi-antigravity/src/utils/html.ts +31 -0
  59. package/node_modules/pi-antigravity/src/utils/index.ts +2 -0
  60. package/node_modules/pi-antigravity/src/utils/security.ts +172 -13
  61. package/node_modules/pi-antigravity/src/utils/text.ts +66 -0
  62. package/node_modules/pi-antigravity/src/utils/util.ts +5 -4
  63. package/node_modules/pi-antigravity/src/web-fetch/document.ts +83 -0
  64. package/node_modules/pi-antigravity/src/web-fetch/fences.ts +24 -0
  65. package/node_modules/pi-antigravity/src/web-fetch/header.ts +97 -0
  66. package/node_modules/pi-antigravity/src/web-fetch/index.ts +3 -0
  67. package/node_modules/pi-antigravity/src/web-fetch/inspect.ts +328 -0
  68. package/node_modules/pi-antigravity/src/web-fetch/limits.ts +4 -0
  69. package/node_modules/pi-antigravity/src/web-fetch/markdown.ts +744 -0
  70. package/node_modules/pi-antigravity/src/web-fetch/mdn.ts +164 -0
  71. package/node_modules/pi-antigravity/src/web-fetch/media.ts +11 -0
  72. package/node_modules/pi-antigravity/src/web-fetch/metadata.ts +9 -0
  73. package/node_modules/pi-antigravity/src/web-fetch/representation.ts +93 -0
  74. package/node_modules/pi-antigravity/src/web-fetch/save.ts +71 -0
  75. package/node_modules/pi-antigravity/src/web-fetch/sites.ts +138 -0
  76. package/node_modules/pi-antigravity/src/web-fetch/vendor.d.ts +9 -0
  77. package/node_modules/pi-antigravity/src/web-fetch/web-fetch.ts +957 -0
  78. package/node_modules/pi-antigravity/tsconfig.json +2 -2
  79. package/node_modules/pi-commandcode-provider/CHANGELOG.md +10 -0
  80. package/node_modules/pi-commandcode-provider/README.md +2 -2
  81. package/node_modules/pi-commandcode-provider/package.json +1 -1
  82. package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +15 -9
  83. package/node_modules/pi-commandcode-provider/src/oauth.ts +69 -12
  84. package/node_modules/pi-lens/CHANGELOG-USER.md +6 -6
  85. package/node_modules/pi-lens/CHANGELOG.md +172 -0
  86. package/node_modules/pi-lens/README.md +103 -217
  87. package/node_modules/pi-lens/dist/{chunk-KXDQD34C.js → chunk-27JQHK7Y.js} +1 -1
  88. package/node_modules/pi-lens/dist/{chunk-W6VLB6LL.js → chunk-2APSZHHI.js} +61 -3
  89. package/node_modules/pi-lens/dist/{chunk-5EEWCJG7.js → chunk-2H5GHZKC.js} +8 -8
  90. package/node_modules/pi-lens/dist/{chunk-TS5EIWEF.js → chunk-2H7NFZ4Q.js} +11 -11
  91. package/node_modules/pi-lens/dist/{chunk-6GWCYEP7.js → chunk-37IDWT6O.js} +64 -16
  92. package/node_modules/pi-lens/dist/{chunk-OEPWTSUG.js → chunk-3PAS2ERX.js} +8 -8
  93. package/node_modules/pi-lens/dist/{chunk-ET3DSSFZ.js → chunk-3PO4YYOX.js} +9 -17
  94. package/node_modules/pi-lens/dist/{chunk-C6V2DSZZ.js → chunk-3QXFUP6T.js} +11 -11
  95. package/node_modules/pi-lens/dist/{chunk-HWMNTQBJ.js → chunk-3TSMQZG6.js} +32 -11
  96. package/node_modules/pi-lens/dist/{chunk-QY6J2FTK.js → chunk-4DAHGU3V.js} +15 -14
  97. package/node_modules/pi-lens/dist/{chunk-PCREZ4HJ.js → chunk-4IZZEN63.js} +33 -34
  98. package/node_modules/pi-lens/dist/{chunk-OYXD2MOM.js → chunk-5HBQL7DH.js} +2 -2
  99. package/node_modules/pi-lens/dist/{chunk-B4FAFEBP.js → chunk-5JB4WENL.js} +1 -1
  100. package/node_modules/pi-lens/dist/chunk-5YJXF2IS.js +56 -0
  101. package/node_modules/pi-lens/dist/{chunk-GHATCG2A.js → chunk-6CFSDLHE.js} +22 -18
  102. package/node_modules/pi-lens/dist/{chunk-FVQKX5KI.js → chunk-6E5QLMWI.js} +24 -22
  103. package/node_modules/pi-lens/dist/{chunk-AVBEPUCD.js → chunk-6GLMMGCX.js} +2 -2
  104. package/node_modules/pi-lens/dist/{chunk-YTXFNCVN.js → chunk-74AMPWNC.js} +2 -2
  105. package/node_modules/pi-lens/dist/{chunk-K2GV34T2.js → chunk-7CLWC2UH.js} +26 -37
  106. package/node_modules/pi-lens/dist/{chunk-MOEWCPMC.js → chunk-7DPXUPRF.js} +2 -2
  107. package/node_modules/pi-lens/dist/{chunk-7BEADGAZ.js → chunk-7U36VQL6.js} +2 -2
  108. package/node_modules/pi-lens/dist/{chunk-PPYUBO6Y.js → chunk-7WKVCZI4.js} +1 -1
  109. package/node_modules/pi-lens/dist/{chunk-ILC2B7IJ.js → chunk-7ZVTFLCC.js} +10 -10
  110. package/node_modules/pi-lens/dist/{chunk-IT7MFVGP.js → chunk-ADYQRETD.js} +2 -2
  111. package/node_modules/pi-lens/dist/{chunk-NCDH2JB7.js → chunk-ARTYCUGF.js} +25 -10
  112. package/node_modules/pi-lens/dist/{chunk-Z6WTLVUL.js → chunk-AXAR5ZW2.js} +225 -104
  113. package/node_modules/pi-lens/dist/{chunk-PK3GDU4M.js → chunk-AZG5UJYY.js} +1 -1
  114. package/node_modules/pi-lens/dist/{chunk-NRVWLTOY.js → chunk-B2OXE4AH.js} +60 -21
  115. package/node_modules/pi-lens/dist/{chunk-ORYQGVC3.js → chunk-B42AIWPJ.js} +2 -2
  116. package/node_modules/pi-lens/dist/{chunk-IC4L65U7.js → chunk-BBSDJTOV.js} +12 -13
  117. package/node_modules/pi-lens/dist/{chunk-HJWF7CGW.js → chunk-BKWFDWYM.js} +16 -16
  118. package/node_modules/pi-lens/dist/{chunk-D2ZYRI7M.js → chunk-C5PLBTNR.js} +1 -1
  119. package/node_modules/pi-lens/dist/{chunk-SRXYSLMW.js → chunk-CQY2HEH7.js} +1 -1
  120. package/node_modules/pi-lens/dist/{chunk-7424ANRU.js → chunk-CXQYK4YT.js} +1 -1
  121. package/node_modules/pi-lens/dist/{chunk-HYR25MV3.js → chunk-CZJGAOKL.js} +8 -7
  122. package/node_modules/pi-lens/dist/{chunk-DIIDMDZU.js → chunk-DCA2MXVQ.js} +11 -11
  123. package/node_modules/pi-lens/dist/{chunk-K2LD6YNH.js → chunk-DFKOA74L.js} +9 -9
  124. package/node_modules/pi-lens/dist/{chunk-AYDE7RFV.js → chunk-DI4AZZNY.js} +2 -2
  125. package/node_modules/pi-lens/dist/{chunk-6EXGCXM5.js → chunk-G53LBDNU.js} +99 -5
  126. package/node_modules/pi-lens/dist/chunk-GCSDF5IE.js +27 -0
  127. package/node_modules/pi-lens/dist/{chunk-5KLRCUDT.js → chunk-H5API74E.js} +6 -6
  128. package/node_modules/pi-lens/dist/chunk-HBX55MWO.js +27 -0
  129. package/node_modules/pi-lens/dist/{chunk-JRSS6KM4.js → chunk-HIJ4CHFF.js} +2 -2
  130. package/node_modules/pi-lens/dist/{chunk-3MHY4BQY.js → chunk-HIRBC72R.js} +4 -4
  131. package/node_modules/pi-lens/dist/{chunk-F7AMFFVK.js → chunk-HRLF35WL.js} +8 -8
  132. package/node_modules/pi-lens/dist/{chunk-HSTN27NR.js → chunk-I2FYOZNW.js} +9 -9
  133. package/node_modules/pi-lens/dist/{chunk-5FDUKJZO.js → chunk-I3NZVAMN.js} +9 -9
  134. package/node_modules/pi-lens/dist/{chunk-NZINZCHB.js → chunk-INBK3HIT.js} +3 -3
  135. package/node_modules/pi-lens/dist/{chunk-PXGVB2CY.js → chunk-J2ZB5MDS.js} +20 -18
  136. package/node_modules/pi-lens/dist/{chunk-HYDJUVOE.js → chunk-JGUDT5KD.js} +4 -4
  137. package/node_modules/pi-lens/dist/chunk-JOIKBUQN.js +88 -0
  138. package/node_modules/pi-lens/dist/{chunk-AZXTLZHE.js → chunk-K4Z7MK6T.js} +169 -165
  139. package/node_modules/pi-lens/dist/{chunk-WTSQKJAR.js → chunk-K7O6AHSJ.js} +10 -10
  140. package/node_modules/pi-lens/dist/{chunk-S6ZQFPOX.js → chunk-KNJH6WJQ.js} +6 -6
  141. package/node_modules/pi-lens/dist/{chunk-SUIZOCSY.js → chunk-KNSOA43J.js} +1 -1
  142. package/node_modules/pi-lens/dist/{chunk-3QMLB4TI.js → chunk-KXGTLAUW.js} +2 -2
  143. package/node_modules/pi-lens/dist/{chunk-OHEUOWYT.js → chunk-KZ732ZVW.js} +1 -1
  144. package/node_modules/pi-lens/dist/{chunk-G3LR6V6N.js → chunk-L6BDRYUK.js} +19 -17
  145. package/node_modules/pi-lens/dist/{chunk-OVPR3GQ6.js → chunk-LGH2HHZG.js} +24 -6
  146. package/node_modules/pi-lens/dist/{chunk-3R3Z54J7.js → chunk-LOEJFTF2.js} +1 -1
  147. package/node_modules/pi-lens/dist/{chunk-HGEE5LDW.js → chunk-LQQNFCQJ.js} +1 -1
  148. package/node_modules/pi-lens/dist/chunk-LVLPA32Q.js +810 -0
  149. package/node_modules/pi-lens/dist/chunk-M2YMBT5G.js +73 -0
  150. package/node_modules/pi-lens/dist/{chunk-Z2W5YJBW.js → chunk-MJRGPEQ5.js} +11 -11
  151. package/node_modules/pi-lens/dist/{chunk-3EIZMRXI.js → chunk-MOAVEPC4.js} +10 -10
  152. package/node_modules/pi-lens/dist/{chunk-TOOXNL6M.js → chunk-NGNBJIUO.js} +7 -7
  153. package/node_modules/pi-lens/dist/{chunk-AGEQRJ5A.js → chunk-NHA5K226.js} +1 -1
  154. package/node_modules/pi-lens/dist/{chunk-YLW26OHX.js → chunk-NNEQOC3U.js} +31 -59
  155. package/node_modules/pi-lens/dist/{chunk-ZWZD4TJ5.js → chunk-O2MHF7QM.js} +35 -36
  156. package/node_modules/pi-lens/dist/{chunk-PTJXMYRY.js → chunk-OLWGYBYT.js} +15 -16
  157. package/node_modules/pi-lens/dist/{chunk-JKAVKTMY.js → chunk-OZQQ3AIR.js} +17 -20
  158. package/node_modules/pi-lens/dist/{chunk-6JLNZ6DP.js → chunk-P5MSLVUW.js} +10 -10
  159. package/node_modules/pi-lens/dist/{chunk-OF2YGDUE.js → chunk-PFJLYRO3.js} +37 -38
  160. package/node_modules/pi-lens/dist/chunk-PKWEBMCA.js +2957 -0
  161. package/node_modules/pi-lens/dist/{chunk-JLMS7EMD.js → chunk-PPQHMSPH.js} +16 -15
  162. package/node_modules/pi-lens/dist/{chunk-6EIV3H7O.js → chunk-PQF6YGYB.js} +12 -5
  163. package/node_modules/pi-lens/dist/{chunk-VU2PRGRI.js → chunk-PQXUZYTQ.js} +4 -4
  164. package/node_modules/pi-lens/dist/{chunk-MV6ST2KT.js → chunk-Q7J3JYJ2.js} +13 -12
  165. package/node_modules/pi-lens/dist/{chunk-BMMRLJA4.js → chunk-QE5DJ7MX.js} +27 -10
  166. package/node_modules/pi-lens/dist/{chunk-IZ36G463.js → chunk-QE7BJQ6K.js} +7 -7
  167. package/node_modules/pi-lens/dist/{chunk-E5SSUV2A.js → chunk-QMWKSYWB.js} +4 -4
  168. package/node_modules/pi-lens/dist/{chunk-QJ4T73J5.js → chunk-QV3JPCMK.js} +1 -1
  169. package/node_modules/pi-lens/dist/{chunk-3PMLYGJN.js → chunk-R4L7KZ7R.js} +5 -5
  170. package/node_modules/pi-lens/dist/{chunk-7ZVEFWOE.js → chunk-RIH3UBK4.js} +10 -10
  171. package/node_modules/pi-lens/dist/{chunk-T5EGSBM2.js → chunk-RJ3APNIP.js} +3 -3
  172. package/node_modules/pi-lens/dist/{chunk-AAIVSSUU.js → chunk-S6MCMD27.js} +35 -12
  173. package/node_modules/pi-lens/dist/{chunk-SF7KSXB5.js → chunk-SCU62JLX.js} +6 -6
  174. package/node_modules/pi-lens/dist/{chunk-FDLGJFAE.js → chunk-SDYLT45T.js} +3 -3
  175. package/node_modules/pi-lens/dist/chunk-TFKN5EIR.js +27 -0
  176. package/node_modules/pi-lens/dist/{chunk-Y7XMKBFP.js → chunk-TKOFTLGB.js} +34 -26
  177. package/node_modules/pi-lens/dist/chunk-TQWRH25U.js +35 -0
  178. package/node_modules/pi-lens/dist/{chunk-DZSQXG66.js → chunk-TWEOJE3D.js} +277 -62
  179. package/node_modules/pi-lens/dist/{chunk-R67WQ5RY.js → chunk-UN72ZAJ5.js} +8 -8
  180. package/node_modules/pi-lens/dist/{chunk-AD7JDEI6.js → chunk-UNP6Y4JV.js} +16 -16
  181. package/node_modules/pi-lens/dist/{chunk-D6ANA6YU.js → chunk-VGRGW4UL.js} +63 -55
  182. package/node_modules/pi-lens/dist/{chunk-DFAY7JUN.js → chunk-VSQT6IHZ.js} +2 -2
  183. package/node_modules/pi-lens/dist/{chunk-7T64QA5D.js → chunk-VWEBZ2JV.js} +39 -38
  184. package/node_modules/pi-lens/dist/{chunk-HRQTYU2T.js → chunk-W26QZ3OM.js} +1 -1
  185. package/node_modules/pi-lens/dist/{chunk-2HWVG3IM.js → chunk-XDNWR7SG.js} +2 -2
  186. package/node_modules/pi-lens/dist/{chunk-75TVYCQW.js → chunk-XSC3BCN3.js} +5 -5
  187. package/node_modules/pi-lens/dist/{chunk-ME6MF2N2.js → chunk-YCR6ZYTE.js} +1 -1
  188. package/node_modules/pi-lens/dist/{chunk-LD7SXICE.js → chunk-ZI7YHV6I.js} +5 -5
  189. package/node_modules/pi-lens/dist/{chunk-E3PNZDPH.js → chunk-ZQSSO7LO.js} +33 -1
  190. package/node_modules/pi-lens/dist/{chunk-T6PPK3T6.js → chunk-ZULZS2I6.js} +385 -407
  191. package/node_modules/pi-lens/dist/index.js +6508 -5413
  192. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +9 -9
  193. package/node_modules/pi-lens/dist/mcp/cli.js +39 -38
  194. package/node_modules/pi-lens/dist/mcp/server.js +602 -345
  195. package/node_modules/pi-lens/dist/mcp/worker.js +57 -58
  196. package/node_modules/pi-lens/dist/probes/installer.js +19 -17
  197. package/node_modules/pi-lens/docs/architecture.md +113 -0
  198. package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +2 -2
  199. package/node_modules/pi-lens/docs/ci.md +18 -4
  200. package/node_modules/pi-lens/docs/defect-shapes.md +41 -3
  201. package/node_modules/pi-lens/docs/dependencies.md +10 -10
  202. package/node_modules/pi-lens/docs/features.md +3 -3
  203. package/node_modules/pi-lens/docs/invariants/dispatch-runners.md +13 -1
  204. package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +19 -0
  205. package/node_modules/pi-lens/docs/language-coverage.md +39 -0
  206. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +10 -4
  207. package/node_modules/pi-lens/docs/lsp-idle-eviction.md +1 -1
  208. package/node_modules/pi-lens/docs/pi-lens-fixer.md +4 -0
  209. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +1 -1
  210. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +4 -5
  211. package/node_modules/pi-lens/docs/pi-lens-subagent.md +5 -2
  212. package/node_modules/pi-lens/docs/prose-standard.md +112 -0
  213. package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
  214. package/node_modules/pi-lens/docs/usage.md +50 -0
  215. package/node_modules/pi-lens/package.json +1 -1
  216. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/array-callback-return-js-test.yml +23 -0
  217. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/array-callback-return-test.yml +23 -0
  218. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-js-test.yml +8 -0
  219. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-test.yml +8 -0
  220. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-js-test.yml +16 -0
  221. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-test.yml +16 -0
  222. package/node_modules/pi-lens/rules/ast-grep-rules/rules/array-callback-return-js.yml +8 -0
  223. package/node_modules/pi-lens/rules/ast-grep-rules/rules/array-callback-return.yml +8 -0
  224. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-negation-in-equality-check-js.yml +17 -5
  225. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-negation-in-equality-check.yml +17 -5
  226. package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-throwing-call-js.yml +8 -1
  227. package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-throwing-call.yml +8 -1
  228. package/node_modules/pi-lens/rules/tree-sitter-queries/typescript/ts-react-antipatterns.yml +8 -0
  229. package/node_modules/pi-web-access/CHANGELOG.md +29 -0
  230. package/node_modules/pi-web-access/README.md +35 -15
  231. package/node_modules/pi-web-access/anysearch.ts +7 -3
  232. package/node_modules/pi-web-access/autom.ts +196 -0
  233. package/node_modules/pi-web-access/cloro.ts +254 -0
  234. package/node_modules/pi-web-access/curator-page.ts +7 -1
  235. package/node_modules/pi-web-access/curator-server.ts +3 -0
  236. package/node_modules/pi-web-access/dist/index.js +12931 -12111
  237. package/node_modules/pi-web-access/dist/mcp-cli.js +1188 -416
  238. package/node_modules/pi-web-access/domain-filter-normalization.ts +30 -0
  239. package/node_modules/pi-web-access/duckduckgo-rate-limit.ts +144 -34
  240. package/node_modules/pi-web-access/duckduckgo.ts +11 -3
  241. package/node_modules/pi-web-access/extract.ts +60 -4
  242. package/node_modules/pi-web-access/gemini-search.ts +25 -5
  243. package/node_modules/pi-web-access/index.ts +9 -1
  244. package/node_modules/pi-web-access/package.json +2 -2
  245. package/node_modules/pi-web-access/page-query.ts +12 -3
  246. package/node_modules/pi-web-access/specstream.ts +276 -0
  247. package/node_modules/pi-web-access/tool-activation.ts +21 -6
  248. package/node_modules/pi-web-access/utils.ts +4 -0
  249. package/node_modules/pi-web-access/video-extract.ts +2 -2
  250. package/node_modules/pi-web-access/web-tool-core.ts +24 -5
  251. package/node_modules/pi-web-access/youtube-extract.ts +2 -2
  252. package/package.json +13 -7
  253. package/node_modules/pi-lens/dist/chunk-3VWEZ6H2.js +0 -72
  254. package/node_modules/pi-lens/dist/chunk-7KWI5UHL.js +0 -28
  255. package/node_modules/pi-lens/dist/chunk-7M64NTAK.js +0 -38
  256. package/node_modules/pi-lens/dist/chunk-BEIPWPVR.js +0 -1037
  257. package/node_modules/pi-lens/dist/chunk-D7OEGXDX.js +0 -2417
  258. package/node_modules/pi-lens/dist/chunk-KUDUKKQE.js +0 -89
  259. package/node_modules/pi-lens/dist/chunk-TM3A3K7T.js +0 -28
  260. package/node_modules/pi-lens/dist/chunk-VD7MQFEV.js +0 -56
  261. package/node_modules/pi-lens/dist/chunk-YLHJWAQS.js +0 -256
  262. package/node_modules/pi-lens/dist/chunk-YULIERZW.js +0 -27
@@ -0,0 +1,2957 @@
1
+ import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ BUILTIN_SERVER_RUNNER_COVERS,
4
+ getServersForFileWithConfig,
5
+ isAuxiliary,
6
+ resolveAnalysisRootPath
7
+ } from "./chunk-AXAR5ZW2.js";
8
+ import {
9
+ emitBounded
10
+ } from "./chunk-2H5GHZKC.js";
11
+ import {
12
+ loadProjectSnapshotWithoutWordIndex
13
+ } from "./chunk-NNEQOC3U.js";
14
+ import {
15
+ resolvePackagePath
16
+ } from "./chunk-ZQSSO7LO.js";
17
+ import {
18
+ skipped
19
+ } from "./chunk-2APSZHHI.js";
20
+ import {
21
+ ensureTool,
22
+ findManagedToolBinary,
23
+ getInstallAttempt,
24
+ getLastEnsureResolutionSource,
25
+ getToolInstallStrategy,
26
+ isSpawnableCommand,
27
+ logSessionStart,
28
+ resetPathWalkMemo
29
+ } from "./chunk-B2OXE4AH.js";
30
+ import {
31
+ hasToolConfig,
32
+ resolveToolCwd,
33
+ toolConfigDirs
34
+ } from "./chunk-LVLPA32Q.js";
35
+ import {
36
+ findGlobalBinary,
37
+ findLocalBinAt,
38
+ findLocalBinUpwards,
39
+ isLocalBinTrustRefusal,
40
+ localBinPath
41
+ } from "./chunk-LGH2HHZG.js";
42
+ import {
43
+ createAvailabilityProbeFlight,
44
+ probeToolAsync
45
+ } from "./chunk-KXGTLAUW.js";
46
+ import {
47
+ normalizeToml
48
+ } from "./chunk-KNSOA43J.js";
49
+ import {
50
+ classifyProbeFailure,
51
+ createAvailabilityLatch,
52
+ describeInstallAttempt,
53
+ describeProbeEvidence,
54
+ isLatchingOutcome,
55
+ logAvailabilityDecision,
56
+ startHostStallSampler
57
+ } from "./chunk-6GLMMGCX.js";
58
+ import {
59
+ NODE_MODULES_BIN_DIRS,
60
+ VENDOR_BIN_DIRS,
61
+ VENV_BIN_DIRS,
62
+ createGenerationSource,
63
+ getGlobalPiLensDir,
64
+ isInSpawnTimeoutCooldown,
65
+ resolveWindowsCommandForEnvironment,
66
+ safeSpawnAsync
67
+ } from "./chunk-3PO4YYOX.js";
68
+ import {
69
+ TERRAGRUNT_FILENAMES,
70
+ isJstsFactFile
71
+ } from "./chunk-CQY2HEH7.js";
72
+ import {
73
+ PathKeyedMap
74
+ } from "./chunk-PQF6YGYB.js";
75
+ import {
76
+ getProjectTrustState
77
+ } from "./chunk-W26QZ3OM.js";
78
+ import {
79
+ compareOrdinal,
80
+ incrementDegradationCount,
81
+ recordDegradationOnce
82
+ } from "./chunk-NHA5K226.js";
83
+ import {
84
+ isToolInstallDisabled,
85
+ logLatency
86
+ } from "./chunk-7CLWC2UH.js";
87
+ import {
88
+ isUnderDir,
89
+ normalizeEphemeralMapKey,
90
+ normalizeMapKey,
91
+ relativeInside,
92
+ walkUpDirs
93
+ } from "./chunk-WLD6BGON.js";
94
+
95
+ // dist/clients/tool-policy.js
96
+ import * as fs from "node:fs";
97
+ import * as path from "node:path";
98
+ var FORMATTER_POLICY_BY_EXTENSION = /* @__PURE__ */ new Map([
99
+ [
100
+ ".js",
101
+ {
102
+ formatterNames: ["biome", "prettier", "oxfmt"],
103
+ defaultFormatter: "biome",
104
+ defaultWhenUnconfigured: true,
105
+ gate: "smart-default"
106
+ }
107
+ ],
108
+ [
109
+ ".jsx",
110
+ {
111
+ formatterNames: ["biome", "prettier", "oxfmt"],
112
+ defaultFormatter: "biome",
113
+ defaultWhenUnconfigured: true,
114
+ gate: "smart-default"
115
+ }
116
+ ],
117
+ [
118
+ ".mjs",
119
+ {
120
+ formatterNames: ["biome", "prettier", "oxfmt"],
121
+ defaultFormatter: "biome",
122
+ defaultWhenUnconfigured: true,
123
+ gate: "smart-default"
124
+ }
125
+ ],
126
+ [
127
+ ".cjs",
128
+ {
129
+ formatterNames: ["biome", "prettier", "oxfmt"],
130
+ defaultFormatter: "biome",
131
+ defaultWhenUnconfigured: true,
132
+ gate: "smart-default"
133
+ }
134
+ ],
135
+ [
136
+ ".ts",
137
+ {
138
+ formatterNames: ["biome", "prettier", "oxfmt"],
139
+ defaultFormatter: "biome",
140
+ defaultWhenUnconfigured: true,
141
+ gate: "smart-default"
142
+ }
143
+ ],
144
+ [
145
+ ".tsx",
146
+ {
147
+ formatterNames: ["biome", "prettier", "oxfmt"],
148
+ defaultFormatter: "biome",
149
+ defaultWhenUnconfigured: true,
150
+ gate: "smart-default"
151
+ }
152
+ ],
153
+ [
154
+ ".mts",
155
+ {
156
+ formatterNames: ["biome", "prettier", "oxfmt"],
157
+ defaultFormatter: "biome",
158
+ defaultWhenUnconfigured: true,
159
+ gate: "smart-default"
160
+ }
161
+ ],
162
+ [
163
+ ".cts",
164
+ {
165
+ formatterNames: ["biome", "prettier", "oxfmt"],
166
+ defaultFormatter: "biome",
167
+ defaultWhenUnconfigured: true,
168
+ gate: "smart-default"
169
+ }
170
+ ],
171
+ [
172
+ ".py",
173
+ {
174
+ formatterNames: ["black", "ruff"],
175
+ defaultFormatter: "ruff",
176
+ defaultWhenUnconfigured: true,
177
+ gate: "smart-default"
178
+ }
179
+ ],
180
+ [
181
+ ".pyi",
182
+ {
183
+ formatterNames: ["black", "ruff"],
184
+ defaultFormatter: "ruff",
185
+ defaultWhenUnconfigured: true,
186
+ gate: "smart-default"
187
+ }
188
+ ],
189
+ [
190
+ ".json",
191
+ {
192
+ formatterNames: ["biome", "prettier"],
193
+ defaultFormatter: "biome",
194
+ defaultWhenUnconfigured: false,
195
+ gate: "mixed"
196
+ }
197
+ ],
198
+ [
199
+ ".jsonc",
200
+ {
201
+ formatterNames: ["biome", "prettier"],
202
+ defaultFormatter: "biome",
203
+ defaultWhenUnconfigured: false,
204
+ gate: "mixed"
205
+ }
206
+ ],
207
+ [
208
+ ".css",
209
+ {
210
+ formatterNames: ["biome", "prettier", "oxfmt"],
211
+ defaultFormatter: "biome",
212
+ defaultWhenUnconfigured: true,
213
+ gate: "smart-default"
214
+ }
215
+ ],
216
+ [
217
+ ".scss",
218
+ {
219
+ formatterNames: ["biome", "prettier", "oxfmt"],
220
+ defaultFormatter: "biome",
221
+ defaultWhenUnconfigured: true,
222
+ gate: "smart-default"
223
+ }
224
+ ],
225
+ [
226
+ ".sass",
227
+ {
228
+ // #1135: no oxfmt (see map header comment).
229
+ formatterNames: ["biome", "prettier"],
230
+ defaultFormatter: "biome",
231
+ defaultWhenUnconfigured: true,
232
+ gate: "smart-default"
233
+ }
234
+ ],
235
+ [
236
+ ".less",
237
+ {
238
+ formatterNames: ["prettier"],
239
+ defaultFormatter: "prettier",
240
+ defaultWhenUnconfigured: true,
241
+ gate: "smart-default"
242
+ }
243
+ ],
244
+ [
245
+ ".html",
246
+ {
247
+ formatterNames: ["prettier"],
248
+ defaultFormatter: "prettier",
249
+ // HTML commonly carries template markers ({{JS}} embeds, Handlebars,
250
+ // Helm-adjacent Go templates). Prettier reinterprets them as code and
251
+ // corrupts them. Opt in via project prettier config; do not run by default.
252
+ defaultWhenUnconfigured: false,
253
+ gate: "smart-default"
254
+ }
255
+ ],
256
+ [
257
+ ".htm",
258
+ {
259
+ formatterNames: ["prettier"],
260
+ defaultFormatter: "prettier",
261
+ defaultWhenUnconfigured: false,
262
+ gate: "smart-default"
263
+ }
264
+ ],
265
+ [
266
+ ".yaml",
267
+ {
268
+ formatterNames: ["prettier"],
269
+ defaultFormatter: "prettier",
270
+ // YAML commonly carries template markers (Helm `{{ .Values.x }}`,
271
+ // Ansible `{{ var }}`). Prettier splits `{{` into `{ {` and reindents
272
+ // embedded templates. Opt in via project prettier config.
273
+ defaultWhenUnconfigured: false,
274
+ gate: "smart-default"
275
+ }
276
+ ],
277
+ [
278
+ ".yml",
279
+ {
280
+ formatterNames: ["prettier"],
281
+ defaultFormatter: "prettier",
282
+ defaultWhenUnconfigured: false,
283
+ gate: "smart-default"
284
+ }
285
+ ],
286
+ [
287
+ ".md",
288
+ {
289
+ formatterNames: ["prettier"],
290
+ defaultFormatter: "prettier",
291
+ // Prettier's markdown defaults reflow lines, normalize emphasis (* -> _),
292
+ // and restyle lists. Opt-in via project prettier config; do not run by default.
293
+ defaultWhenUnconfigured: false,
294
+ gate: "smart-default"
295
+ }
296
+ ],
297
+ [
298
+ ".mdx",
299
+ {
300
+ formatterNames: ["prettier"],
301
+ defaultFormatter: "prettier",
302
+ defaultWhenUnconfigured: false,
303
+ gate: "smart-default"
304
+ }
305
+ ],
306
+ [
307
+ ".graphql",
308
+ {
309
+ formatterNames: ["prettier"],
310
+ defaultFormatter: "prettier",
311
+ defaultWhenUnconfigured: true,
312
+ gate: "smart-default"
313
+ }
314
+ ],
315
+ [
316
+ ".gql",
317
+ {
318
+ formatterNames: ["prettier"],
319
+ defaultFormatter: "prettier",
320
+ defaultWhenUnconfigured: true,
321
+ gate: "smart-default"
322
+ }
323
+ ],
324
+ [
325
+ // ktfmt is offered alongside ktlint but only wins when the project opts in
326
+ // (hasExplicitFormatterConfig("ktfmt")). ktlint is the default formatter
327
+ // name, yet as a FORMATTER it also waits for its own Spotless config
328
+ // (`defaultWhenUnconfigured: false`): only ktlint's LINT policy is a
329
+ // smart default. #129, #5408
330
+ ".kt",
331
+ {
332
+ formatterNames: ["ktfmt", "ktlint"],
333
+ defaultFormatter: "ktlint",
334
+ defaultWhenUnconfigured: false,
335
+ gate: "smart-default"
336
+ }
337
+ ],
338
+ [
339
+ ".kts",
340
+ {
341
+ formatterNames: ["ktfmt", "ktlint"],
342
+ defaultFormatter: "ktlint",
343
+ defaultWhenUnconfigured: false,
344
+ gate: "smart-default"
345
+ }
346
+ ],
347
+ [
348
+ ".swift",
349
+ {
350
+ formatterNames: ["swiftformat"],
351
+ defaultFormatter: "swiftformat",
352
+ defaultWhenUnconfigured: false,
353
+ gate: "config-first"
354
+ }
355
+ ],
356
+ [
357
+ ".fs",
358
+ {
359
+ formatterNames: ["fantomas"],
360
+ defaultFormatter: "fantomas",
361
+ defaultWhenUnconfigured: false,
362
+ gate: "config-first"
363
+ }
364
+ ],
365
+ [
366
+ ".fsi",
367
+ {
368
+ formatterNames: ["fantomas"],
369
+ defaultFormatter: "fantomas",
370
+ defaultWhenUnconfigured: false,
371
+ gate: "config-first"
372
+ }
373
+ ],
374
+ [
375
+ ".fsx",
376
+ {
377
+ formatterNames: ["fantomas"],
378
+ defaultFormatter: "fantomas",
379
+ defaultWhenUnconfigured: false,
380
+ gate: "config-first"
381
+ }
382
+ ],
383
+ [
384
+ ".nix",
385
+ {
386
+ formatterNames: ["nixfmt"],
387
+ defaultFormatter: "nixfmt",
388
+ defaultWhenUnconfigured: false,
389
+ gate: "smart-default"
390
+ }
391
+ ],
392
+ [
393
+ ".ex",
394
+ {
395
+ formatterNames: ["mix"],
396
+ defaultFormatter: "mix",
397
+ defaultWhenUnconfigured: false,
398
+ gate: "config-first"
399
+ }
400
+ ],
401
+ [
402
+ ".exs",
403
+ {
404
+ formatterNames: ["mix"],
405
+ defaultFormatter: "mix",
406
+ defaultWhenUnconfigured: false,
407
+ gate: "config-first"
408
+ }
409
+ ],
410
+ [
411
+ ".eex",
412
+ {
413
+ formatterNames: ["mix"],
414
+ defaultFormatter: "mix",
415
+ defaultWhenUnconfigured: false,
416
+ gate: "config-first"
417
+ }
418
+ ],
419
+ [
420
+ ".heex",
421
+ {
422
+ formatterNames: ["mix"],
423
+ defaultFormatter: "mix",
424
+ defaultWhenUnconfigured: false,
425
+ gate: "config-first"
426
+ }
427
+ ],
428
+ [
429
+ ".leex",
430
+ {
431
+ formatterNames: ["mix"],
432
+ defaultFormatter: "mix",
433
+ defaultWhenUnconfigured: false,
434
+ gate: "config-first"
435
+ }
436
+ ],
437
+ [
438
+ ".gleam",
439
+ {
440
+ formatterNames: ["gleam"],
441
+ defaultFormatter: "gleam",
442
+ defaultWhenUnconfigured: true,
443
+ gate: "smart-default"
444
+ }
445
+ ],
446
+ [
447
+ ".typ",
448
+ {
449
+ formatterNames: ["typstyle"],
450
+ defaultFormatter: "typstyle",
451
+ defaultWhenUnconfigured: true,
452
+ gate: "smart-default"
453
+ }
454
+ ],
455
+ [
456
+ ".typc",
457
+ {
458
+ formatterNames: ["typstyle"],
459
+ defaultFormatter: "typstyle",
460
+ defaultWhenUnconfigured: true,
461
+ gate: "smart-default"
462
+ }
463
+ ],
464
+ [
465
+ ".c",
466
+ {
467
+ formatterNames: ["clang-format"],
468
+ defaultFormatter: "clang-format",
469
+ defaultWhenUnconfigured: false,
470
+ gate: "config-first"
471
+ }
472
+ ],
473
+ [
474
+ ".cc",
475
+ {
476
+ formatterNames: ["clang-format"],
477
+ defaultFormatter: "clang-format",
478
+ defaultWhenUnconfigured: false,
479
+ gate: "config-first"
480
+ }
481
+ ],
482
+ [
483
+ ".cpp",
484
+ {
485
+ formatterNames: ["clang-format"],
486
+ defaultFormatter: "clang-format",
487
+ defaultWhenUnconfigured: false,
488
+ gate: "config-first"
489
+ }
490
+ ],
491
+ [
492
+ ".cxx",
493
+ {
494
+ formatterNames: ["clang-format"],
495
+ defaultFormatter: "clang-format",
496
+ defaultWhenUnconfigured: false,
497
+ gate: "config-first"
498
+ }
499
+ ],
500
+ [
501
+ ".h",
502
+ {
503
+ formatterNames: ["clang-format"],
504
+ defaultFormatter: "clang-format",
505
+ defaultWhenUnconfigured: false,
506
+ gate: "config-first"
507
+ }
508
+ ],
509
+ [
510
+ ".hpp",
511
+ {
512
+ formatterNames: ["clang-format"],
513
+ defaultFormatter: "clang-format",
514
+ defaultWhenUnconfigured: false,
515
+ gate: "config-first"
516
+ }
517
+ ],
518
+ [
519
+ ".ino",
520
+ {
521
+ formatterNames: ["clang-format"],
522
+ defaultFormatter: "clang-format",
523
+ defaultWhenUnconfigured: false,
524
+ gate: "config-first"
525
+ }
526
+ ],
527
+ [
528
+ ".php",
529
+ {
530
+ formatterNames: ["php-cs-fixer"],
531
+ defaultFormatter: "php-cs-fixer",
532
+ defaultWhenUnconfigured: false,
533
+ gate: "config-first"
534
+ }
535
+ ],
536
+ [
537
+ ".cs",
538
+ {
539
+ formatterNames: ["csharpier"],
540
+ defaultFormatter: "csharpier",
541
+ defaultWhenUnconfigured: false,
542
+ gate: "config-first"
543
+ }
544
+ ],
545
+ [
546
+ ".lua",
547
+ {
548
+ formatterNames: ["stylua"],
549
+ defaultFormatter: "stylua",
550
+ defaultWhenUnconfigured: false,
551
+ gate: "config-first"
552
+ }
553
+ ],
554
+ [
555
+ ".hs",
556
+ {
557
+ formatterNames: ["ormolu"],
558
+ defaultFormatter: "ormolu",
559
+ defaultWhenUnconfigured: false,
560
+ gate: "config-first"
561
+ }
562
+ ],
563
+ [
564
+ ".lhs",
565
+ {
566
+ formatterNames: ["ormolu"],
567
+ defaultFormatter: "ormolu",
568
+ defaultWhenUnconfigured: false,
569
+ gate: "config-first"
570
+ }
571
+ ],
572
+ [
573
+ ".ml",
574
+ {
575
+ formatterNames: ["ocamlformat"],
576
+ defaultFormatter: "ocamlformat",
577
+ defaultWhenUnconfigured: false,
578
+ gate: "config-first"
579
+ }
580
+ ],
581
+ [
582
+ ".mli",
583
+ {
584
+ formatterNames: ["ocamlformat"],
585
+ defaultFormatter: "ocamlformat",
586
+ defaultWhenUnconfigured: false,
587
+ gate: "config-first"
588
+ }
589
+ ],
590
+ [
591
+ ".go",
592
+ {
593
+ formatterNames: ["gofmt"],
594
+ defaultFormatter: "gofmt",
595
+ defaultWhenUnconfigured: true,
596
+ gate: "smart-default"
597
+ }
598
+ ],
599
+ [
600
+ ".rs",
601
+ {
602
+ formatterNames: ["rustfmt"],
603
+ defaultFormatter: "rustfmt",
604
+ defaultWhenUnconfigured: true,
605
+ gate: "smart-default"
606
+ }
607
+ ],
608
+ [
609
+ ".sh",
610
+ {
611
+ formatterNames: ["shfmt"],
612
+ defaultFormatter: "shfmt",
613
+ defaultWhenUnconfigured: true,
614
+ gate: "smart-default"
615
+ }
616
+ ],
617
+ [
618
+ ".bash",
619
+ {
620
+ formatterNames: ["shfmt"],
621
+ defaultFormatter: "shfmt",
622
+ defaultWhenUnconfigured: true,
623
+ gate: "smart-default"
624
+ }
625
+ ],
626
+ [
627
+ ".toml",
628
+ {
629
+ formatterNames: ["taplo"],
630
+ defaultFormatter: "taplo",
631
+ defaultWhenUnconfigured: false,
632
+ gate: "config-first"
633
+ }
634
+ ],
635
+ [
636
+ ".tf",
637
+ {
638
+ formatterNames: ["terraform"],
639
+ defaultFormatter: "terraform",
640
+ defaultWhenUnconfigured: false,
641
+ gate: "config-first"
642
+ }
643
+ ],
644
+ [
645
+ ".tfvars",
646
+ {
647
+ formatterNames: ["terraform"],
648
+ defaultFormatter: "terraform",
649
+ defaultWhenUnconfigured: false,
650
+ gate: "config-first"
651
+ }
652
+ ],
653
+ [
654
+ ".dart",
655
+ {
656
+ formatterNames: ["dart"],
657
+ defaultFormatter: "dart",
658
+ defaultWhenUnconfigured: true,
659
+ gate: "smart-default"
660
+ }
661
+ ],
662
+ [
663
+ ".zig",
664
+ {
665
+ formatterNames: ["zig"],
666
+ defaultFormatter: "zig",
667
+ defaultWhenUnconfigured: true,
668
+ gate: "smart-default"
669
+ }
670
+ ],
671
+ [
672
+ ".zon",
673
+ {
674
+ formatterNames: ["zig"],
675
+ defaultFormatter: "zig",
676
+ defaultWhenUnconfigured: true,
677
+ gate: "smart-default"
678
+ }
679
+ ],
680
+ [
681
+ ".java",
682
+ {
683
+ formatterNames: ["google-java-format"],
684
+ defaultFormatter: "google-java-format",
685
+ defaultWhenUnconfigured: false,
686
+ gate: "config-first"
687
+ }
688
+ ],
689
+ [
690
+ ".clj",
691
+ {
692
+ formatterNames: ["cljfmt"],
693
+ defaultFormatter: "cljfmt",
694
+ defaultWhenUnconfigured: false,
695
+ gate: "config-first"
696
+ }
697
+ ],
698
+ [
699
+ ".cljc",
700
+ {
701
+ formatterNames: ["cljfmt"],
702
+ defaultFormatter: "cljfmt",
703
+ defaultWhenUnconfigured: false,
704
+ gate: "config-first"
705
+ }
706
+ ],
707
+ [
708
+ ".cljs",
709
+ {
710
+ formatterNames: ["cljfmt"],
711
+ defaultFormatter: "cljfmt",
712
+ defaultWhenUnconfigured: false,
713
+ gate: "config-first"
714
+ }
715
+ ],
716
+ [
717
+ ".cmake",
718
+ {
719
+ formatterNames: ["cmake-format"],
720
+ defaultFormatter: "cmake-format",
721
+ defaultWhenUnconfigured: false,
722
+ gate: "config-first"
723
+ }
724
+ ],
725
+ [
726
+ ".ps1",
727
+ {
728
+ formatterNames: ["psscriptanalyzer-format"],
729
+ defaultFormatter: "psscriptanalyzer-format",
730
+ defaultWhenUnconfigured: false,
731
+ gate: "smart-default"
732
+ }
733
+ ],
734
+ [
735
+ ".psm1",
736
+ {
737
+ formatterNames: ["psscriptanalyzer-format"],
738
+ defaultFormatter: "psscriptanalyzer-format",
739
+ defaultWhenUnconfigured: false,
740
+ gate: "smart-default"
741
+ }
742
+ ],
743
+ [
744
+ ".psd1",
745
+ {
746
+ formatterNames: ["psscriptanalyzer-format"],
747
+ defaultFormatter: "psscriptanalyzer-format",
748
+ defaultWhenUnconfigured: false,
749
+ gate: "smart-default"
750
+ }
751
+ ],
752
+ [
753
+ ".cue",
754
+ {
755
+ formatterNames: ["cue"],
756
+ defaultFormatter: "cue",
757
+ defaultWhenUnconfigured: true,
758
+ gate: "smart-default"
759
+ }
760
+ ]
761
+ ]);
762
+ var OXFMT_SUPPORTED_EXTENSIONS = /* @__PURE__ */ new Set([
763
+ ".js",
764
+ ".jsx",
765
+ ".mjs",
766
+ ".cjs",
767
+ ".ts",
768
+ ".tsx",
769
+ ".mts",
770
+ ".cts",
771
+ ".vue",
772
+ ".svelte",
773
+ ".css",
774
+ ".scss",
775
+ ".less",
776
+ ".html",
777
+ ".htm",
778
+ ".json",
779
+ ".jsonc",
780
+ ".yaml",
781
+ ".yml",
782
+ ".md",
783
+ ".mdx",
784
+ ".graphql",
785
+ ".gql",
786
+ ".toml"
787
+ ]);
788
+ FORMATTER_POLICY_BY_EXTENSION.set(".vue", {
789
+ formatterNames: ["prettier"],
790
+ defaultFormatter: "prettier",
791
+ defaultWhenUnconfigured: false,
792
+ gate: "config-first"
793
+ });
794
+ FORMATTER_POLICY_BY_EXTENSION.set(".svelte", {
795
+ formatterNames: [],
796
+ defaultFormatter: "oxfmt",
797
+ defaultWhenUnconfigured: false,
798
+ gate: "config-first"
799
+ });
800
+ for (const [ext, policy] of FORMATTER_POLICY_BY_EXTENSION) {
801
+ if (OXFMT_SUPPORTED_EXTENSIONS.has(ext) && !policy.formatterNames.includes("oxfmt")) {
802
+ policy.formatterNames.push("oxfmt");
803
+ }
804
+ }
805
+ var AUTO_INSTALLABLE_DEFAULT_FORMATTERS = /* @__PURE__ */ new Map([
806
+ ["biome", "biome"],
807
+ ["ruff", "ruff"],
808
+ ["prettier", "prettier"],
809
+ ["shfmt", "shfmt"],
810
+ ["taplo", "taplo"],
811
+ ["ktlint", "ktlint"],
812
+ ["typstyle", "typstyle"]
813
+ ]);
814
+ var TERRAGRUNT_FORMATTER_POLICY = {
815
+ formatterNames: ["terragrunt-hcl"],
816
+ defaultFormatter: "terragrunt-hcl",
817
+ defaultWhenUnconfigured: true,
818
+ gate: "smart-default"
819
+ };
820
+ var FORMATTER_POLICY_BY_FILENAME = new Map(TERRAGRUNT_FILENAMES.map((name) => [name, TERRAGRUNT_FORMATTER_POLICY]));
821
+ function getFormatterPolicyForExtension(ext) {
822
+ return FORMATTER_POLICY_BY_EXTENSION.get(ext.toLowerCase());
823
+ }
824
+ function getFormatterPolicyForFile(filePath) {
825
+ const byFilename = FORMATTER_POLICY_BY_FILENAME.get(path.basename(filePath).toLowerCase());
826
+ if (byFilename)
827
+ return byFilename;
828
+ return getFormatterPolicyForExtension(path.extname(filePath));
829
+ }
830
+ function getSmartDefaultFormatterName(filePath) {
831
+ const policy = getFormatterPolicyForFile(filePath);
832
+ if (!policy?.defaultWhenUnconfigured)
833
+ return void 0;
834
+ return policy.defaultFormatter;
835
+ }
836
+ function getAutoInstallToolIdForFormatter(formatterName) {
837
+ return AUTO_INSTALLABLE_DEFAULT_FORMATTERS.get(formatterName);
838
+ }
839
+ function getToolExecutionPolicy(toolId) {
840
+ return TOOL_EXECUTION_POLICY.get(toolId);
841
+ }
842
+ function shouldAutoInstallTool(toolId) {
843
+ return getToolExecutionPolicy(toolId)?.autoInstall ?? false;
844
+ }
845
+ function getAutofixCapability(toolId) {
846
+ return AUTOFIX_CAPABILITIES.get(toolId);
847
+ }
848
+ function getToolCommandSpec(toolId) {
849
+ return TOOL_COMMAND_SPECS.get(toolId);
850
+ }
851
+ var AUTOFIX_CAPABILITIES = /* @__PURE__ */ new Map([
852
+ [
853
+ "biome",
854
+ { toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
855
+ ],
856
+ [
857
+ "eslint",
858
+ { toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
859
+ ],
860
+ [
861
+ "ruff",
862
+ { toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
863
+ ],
864
+ [
865
+ "stylelint",
866
+ { toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
867
+ ],
868
+ [
869
+ "sqlfluff",
870
+ { toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
871
+ ],
872
+ [
873
+ "rubocop",
874
+ { toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
875
+ ],
876
+ [
877
+ "ktlint",
878
+ { toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
879
+ ],
880
+ [
881
+ "ktfmt",
882
+ { toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
883
+ ],
884
+ [
885
+ "rust-clippy",
886
+ { toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
887
+ ],
888
+ [
889
+ "dart-analyze",
890
+ { toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
891
+ ],
892
+ [
893
+ "golangci-lint",
894
+ { toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
895
+ ],
896
+ [
897
+ "detekt",
898
+ { toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
899
+ ],
900
+ [
901
+ "markdownlint",
902
+ { toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
903
+ ],
904
+ [
905
+ "oxlint",
906
+ { toolSupportsFix: true, safePipelineAutofix: true, fixKind: "pipeline" }
907
+ ]
908
+ ]);
909
+ var TOOL_EXECUTION_POLICY = /* @__PURE__ */ new Map([
910
+ // Dispatch/LSP runners use the shared availability/install seam. These
911
+ // managed tools are missing-command repair candidates; probe failures still
912
+ // fail closed before this policy is consulted.
913
+ ["pyright", { configEligibility: "smart-default", autoInstall: true }],
914
+ ["shellcheck", { configEligibility: "smart-default", autoInstall: true }],
915
+ ["shfmt", { configEligibility: "smart-default", autoInstall: true }],
916
+ ["tflint", { configEligibility: "smart-default", autoInstall: true }],
917
+ ["terragrunt", { configEligibility: "smart-default", autoInstall: true }],
918
+ ["trivy", { configEligibility: "config-first", autoInstall: true }],
919
+ ["biome", { configEligibility: "smart-default", autoInstall: true }],
920
+ ["ruff", { configEligibility: "smart-default", autoInstall: true }],
921
+ ["jscpd", { configEligibility: "smart-default", autoInstall: true }],
922
+ ["madge", { configEligibility: "smart-default", autoInstall: true }],
923
+ ["knip", { configEligibility: "smart-default", autoInstall: true }],
924
+ ["ast-grep", { configEligibility: "smart-default", autoInstall: true }],
925
+ ["oxlint", { configEligibility: "smart-default", autoInstall: true }],
926
+ ["stylelint", { configEligibility: "smart-default", autoInstall: true }],
927
+ ["sqlfluff", { configEligibility: "smart-default", autoInstall: true }],
928
+ ["rubocop", { configEligibility: "smart-default", autoInstall: true }],
929
+ ["yamllint", { configEligibility: "smart-default", autoInstall: true }],
930
+ ["actionlint", { configEligibility: "smart-default", autoInstall: true }],
931
+ ["markdownlint", { configEligibility: "smart-default", autoInstall: true }],
932
+ ["mypy", { configEligibility: "config-first", autoInstall: true }],
933
+ ["taplo", { configEligibility: "smart-default", autoInstall: true }],
934
+ ["hadolint", { configEligibility: "smart-default", autoInstall: true }],
935
+ ["helm", { configEligibility: "smart-default", autoInstall: true }],
936
+ ["htmlhint", { configEligibility: "smart-default", autoInstall: true }],
937
+ ["ktlint", { configEligibility: "smart-default", autoInstall: true }],
938
+ // ktfmt is opt-in (a project's explicit formatting choice), so it only runs
939
+ // when its config marker is present — config-first, but auto-installable via
940
+ // the maven-JAR strategy once elected (#129).
941
+ ["ktfmt", { configEligibility: "config-first", autoInstall: true }],
942
+ ["golangci-lint", { configEligibility: "config-first", autoInstall: true }],
943
+ // SpotBugs is opt-in (lens-spotbugs flag) + config-first (needs a Java build
944
+ // descriptor + compiled .class files), auto-installed via the archive
945
+ // strategy when elected (#133).
946
+ ["spotbugs", { configEligibility: "config-first", autoInstall: true }],
947
+ // Opengrep is opt-in (lens-opengrep flag or a discovered rule file) and
948
+ // config-first, but auto-installable via the GitHub single-binary strategy
949
+ // once elected — no login/token required, unlike Semgrep (#111).
950
+ ["opengrep", { configEligibility: "config-first", autoInstall: true }],
951
+ ["phpstan", { configEligibility: "config-first", autoInstall: false }],
952
+ ["eslint", { configEligibility: "config-first", autoInstall: false }],
953
+ ["prettier", { configEligibility: "smart-default", autoInstall: true }],
954
+ ["vale", { configEligibility: "config-first", autoInstall: false }],
955
+ ["swiftlint", { configEligibility: "smart-default", autoInstall: true }],
956
+ // typstyle is the default Typst formatter, so it carries the same
957
+ // smart-default/auto-install row its AUTO_INSTALLABLE_DEFAULT_FORMATTERS
958
+ // entry implies. The formatter path in `clients/formatters.ts` is what
959
+ // installs it; the row exists so the policy table does not disagree with the
960
+ // formatter table about a tool it names (#5418). The row states what already
961
+ // runs, and changes no install decision: whether typstyle should auto-install
962
+ // at all is an open product decision this branch deliberately leaves open.
963
+ ["typstyle", { configEligibility: "smart-default", autoInstall: true }]
964
+ ]);
965
+ var TOOL_COMMAND_SPECS = new Map([
966
+ [
967
+ // No managedToolId: the installer registry has no `eslint` entry (the
968
+ // runner resolves the project's own `node_modules/.bin/eslint` first), so
969
+ // a pointer here named an install path that does not exist (#5418).
970
+ "eslint",
971
+ {
972
+ command: "eslint",
973
+ windowsExt: ".cmd",
974
+ versionArgs: ["--version"]
975
+ }
976
+ ],
977
+ [
978
+ "stylelint",
979
+ {
980
+ command: "stylelint",
981
+ windowsExt: ".cmd",
982
+ versionArgs: ["--version"],
983
+ managedToolId: "stylelint"
984
+ }
985
+ ],
986
+ [
987
+ "sqlfluff",
988
+ {
989
+ command: "sqlfluff",
990
+ windowsExt: ".exe",
991
+ versionArgs: ["--version"],
992
+ managedToolId: "sqlfluff"
993
+ }
994
+ ],
995
+ [
996
+ "oxlint",
997
+ {
998
+ command: "oxlint",
999
+ windowsExt: ".exe",
1000
+ versionArgs: ["--version"],
1001
+ managedToolId: "oxlint"
1002
+ }
1003
+ ],
1004
+ [
1005
+ "ruff",
1006
+ {
1007
+ command: "ruff",
1008
+ windowsExt: ".exe",
1009
+ versionArgs: ["--version"],
1010
+ managedToolId: "ruff"
1011
+ }
1012
+ ],
1013
+ [
1014
+ "biome",
1015
+ {
1016
+ command: "biome",
1017
+ windowsExt: ".cmd",
1018
+ versionArgs: ["--version"],
1019
+ managedToolId: "biome"
1020
+ }
1021
+ ],
1022
+ [
1023
+ "rubocop",
1024
+ {
1025
+ command: "rubocop",
1026
+ versionArgs: ["--version"],
1027
+ managedToolId: "rubocop"
1028
+ }
1029
+ ],
1030
+ [
1031
+ "yamllint",
1032
+ {
1033
+ command: "yamllint",
1034
+ windowsExt: ".exe",
1035
+ versionArgs: ["--version"],
1036
+ managedToolId: "yamllint"
1037
+ }
1038
+ ],
1039
+ [
1040
+ "actionlint",
1041
+ {
1042
+ command: "actionlint",
1043
+ windowsExt: ".exe",
1044
+ versionArgs: ["--version"],
1045
+ managedToolId: "actionlint"
1046
+ }
1047
+ ],
1048
+ [
1049
+ "markdownlint",
1050
+ {
1051
+ command: "markdownlint-cli2",
1052
+ windowsExt: ".cmd",
1053
+ versionArgs: ["--no-globs", "-"],
1054
+ managedToolId: "markdownlint"
1055
+ }
1056
+ ],
1057
+ [
1058
+ "vale",
1059
+ {
1060
+ command: "vale",
1061
+ windowsExt: ".exe",
1062
+ versionArgs: ["--version"],
1063
+ managedToolId: "vale"
1064
+ }
1065
+ ],
1066
+ [
1067
+ "swiftlint",
1068
+ {
1069
+ command: "swiftlint",
1070
+ windowsExt: ".exe",
1071
+ versionArgs: ["--version"],
1072
+ managedToolId: "swiftlint"
1073
+ }
1074
+ ],
1075
+ [
1076
+ "mypy",
1077
+ {
1078
+ command: "mypy",
1079
+ versionArgs: ["--version"],
1080
+ managedToolId: "mypy"
1081
+ }
1082
+ ],
1083
+ [
1084
+ // No managedToolId: no installer entry for `phpstan` exists, so the
1085
+ // pointer resolved to nothing (#5418; auto-install stays an open decision).
1086
+ "phpstan",
1087
+ {
1088
+ command: "phpstan",
1089
+ windowsExt: ".bat",
1090
+ versionArgs: ["--version"]
1091
+ }
1092
+ ],
1093
+ [
1094
+ "taplo",
1095
+ {
1096
+ command: "taplo",
1097
+ windowsExt: ".exe",
1098
+ versionArgs: ["--version"],
1099
+ managedToolId: "taplo"
1100
+ }
1101
+ ],
1102
+ [
1103
+ "hadolint",
1104
+ {
1105
+ command: "hadolint",
1106
+ windowsExt: ".exe",
1107
+ versionArgs: ["--version"],
1108
+ managedToolId: "hadolint"
1109
+ }
1110
+ ],
1111
+ [
1112
+ // helm 4 has no --version flag ("Error: unknown flag: --version", exit 1);
1113
+ // the version lives under a subcommand (#4453).
1114
+ "helm",
1115
+ {
1116
+ command: "helm",
1117
+ windowsExt: ".exe",
1118
+ versionArgs: ["version", "--short"],
1119
+ managedToolId: "helm"
1120
+ }
1121
+ ],
1122
+ [
1123
+ "trivy",
1124
+ {
1125
+ command: "trivy",
1126
+ windowsExt: ".exe",
1127
+ versionArgs: ["--version"],
1128
+ managedToolId: "trivy"
1129
+ }
1130
+ ],
1131
+ [
1132
+ "golangci-lint",
1133
+ {
1134
+ command: "golangci-lint",
1135
+ windowsExt: ".exe",
1136
+ versionArgs: ["--version"],
1137
+ managedToolId: "golangci-lint"
1138
+ }
1139
+ ],
1140
+ [
1141
+ // No managedToolId: no installer entry for `detekt` exists, and it has no
1142
+ // execution-policy row, so nothing installs it (#5410).
1143
+ "detekt",
1144
+ {
1145
+ command: "detekt",
1146
+ windowsExt: ".bat",
1147
+ versionArgs: ["--version"]
1148
+ }
1149
+ ],
1150
+ [
1151
+ // The runtime SpotBugs needs, not a lint tool. The JVM prints its version
1152
+ // under `-version`; it has no `--version` flag. No managedToolId: pi-lens
1153
+ // never installs a JRE.
1154
+ "java",
1155
+ {
1156
+ command: "java",
1157
+ windowsExt: ".exe",
1158
+ versionArgs: ["-version"]
1159
+ }
1160
+ ],
1161
+ [
1162
+ "htmlhint",
1163
+ {
1164
+ command: "htmlhint",
1165
+ windowsExt: ".cmd",
1166
+ versionArgs: ["--version"],
1167
+ managedToolId: "htmlhint"
1168
+ }
1169
+ ],
1170
+ [
1171
+ "ktlint",
1172
+ {
1173
+ command: "ktlint",
1174
+ windowsExt: ".exe",
1175
+ versionArgs: ["--version"],
1176
+ managedToolId: "ktlint"
1177
+ }
1178
+ ],
1179
+ [
1180
+ "prettier",
1181
+ {
1182
+ command: "prettier",
1183
+ windowsExt: ".cmd",
1184
+ versionArgs: ["--version"],
1185
+ managedToolId: "prettier"
1186
+ }
1187
+ ],
1188
+ // The formatter binaries (#5410): the formatters resolve these through the
1189
+ // runners' ladder machinery (version-checked, one latch per cwd), in their
1190
+ // own order, PATH before managed (#5492 r2). Each id is also its installer
1191
+ // entry and its binary name.
1192
+ ...[
1193
+ ["shfmt", ".exe"],
1194
+ ["typstyle", ".exe"],
1195
+ ["ktfmt"],
1196
+ ["black", ".exe"],
1197
+ ["google-java-format"],
1198
+ ["cljfmt", ".exe"],
1199
+ ["cmake-format", ".exe"],
1200
+ ["stylua", ".cmd"],
1201
+ ["oxfmt", ".cmd"],
1202
+ ["php-cs-fixer", ".bat"]
1203
+ ].map(([id, windowsExt]) => [
1204
+ id,
1205
+ {
1206
+ command: id,
1207
+ ...windowsExt !== void 0 && { windowsExt },
1208
+ versionArgs: ["--version"],
1209
+ managedToolId: id
1210
+ }
1211
+ ])
1212
+ ]);
1213
+ function getLinterPolicyForFile(filePath, context = {}) {
1214
+ const ext = path.extname(filePath).toLowerCase();
1215
+ if (isJstsFactFile(filePath)) {
1216
+ const policy = getJstsLintPolicy({
1217
+ hasEslintConfig: context.hasEslintConfig,
1218
+ hasOxlintConfig: context.hasOxlintConfig,
1219
+ hasBiomeConfig: context.hasBiomeConfig
1220
+ });
1221
+ return {
1222
+ runnerNames: ["eslint", "oxlint", "biome-check-json"],
1223
+ preferredRunners: policy.preferredRunners,
1224
+ defaultRunner: policy.preferredRunners[0],
1225
+ defaultWhenUnconfigured: !policy.hasEslintConfig && !policy.hasOxlintConfig,
1226
+ gate: policy.hasEslintConfig ? "config-first" : "smart-default"
1227
+ };
1228
+ }
1229
+ if ([".py", ".pyi"].includes(ext)) {
1230
+ const preferredRunners = ["ruff-lint"];
1231
+ if (context.hasMypyConfig)
1232
+ preferredRunners.push("mypy");
1233
+ return {
1234
+ runnerNames: ["ruff-lint", "mypy"],
1235
+ preferredRunners,
1236
+ defaultRunner: "ruff-lint",
1237
+ defaultWhenUnconfigured: true,
1238
+ gate: context.hasMypyConfig ? "mixed" : "smart-default"
1239
+ };
1240
+ }
1241
+ if ([".css", ".scss", ".sass", ".less"].includes(ext)) {
1242
+ return {
1243
+ runnerNames: ["stylelint"],
1244
+ preferredRunners: ["stylelint"],
1245
+ defaultRunner: "stylelint",
1246
+ defaultWhenUnconfigured: true,
1247
+ gate: "smart-default"
1248
+ };
1249
+ }
1250
+ if (ext === ".sql") {
1251
+ return {
1252
+ runnerNames: ["sqlfluff"],
1253
+ preferredRunners: ["sqlfluff"],
1254
+ defaultRunner: "sqlfluff",
1255
+ defaultWhenUnconfigured: true,
1256
+ gate: "smart-default"
1257
+ };
1258
+ }
1259
+ if ([".rb", ".rake", ".gemspec", ".ru"].includes(ext)) {
1260
+ return {
1261
+ runnerNames: ["rubocop"],
1262
+ preferredRunners: ["rubocop"],
1263
+ defaultRunner: "rubocop",
1264
+ defaultWhenUnconfigured: true,
1265
+ gate: "smart-default"
1266
+ };
1267
+ }
1268
+ if ([".yaml", ".yml"].includes(ext)) {
1269
+ return {
1270
+ runnerNames: ["yamllint"],
1271
+ preferredRunners: ["yamllint"],
1272
+ defaultRunner: "yamllint",
1273
+ defaultWhenUnconfigured: true,
1274
+ gate: "smart-default"
1275
+ };
1276
+ }
1277
+ if ([".md", ".mdx"].includes(ext)) {
1278
+ return {
1279
+ runnerNames: ["markdownlint"],
1280
+ preferredRunners: ["markdownlint"],
1281
+ defaultRunner: "markdownlint",
1282
+ defaultWhenUnconfigured: true,
1283
+ gate: "smart-default"
1284
+ };
1285
+ }
1286
+ if ([".html", ".htm"].includes(ext)) {
1287
+ return {
1288
+ runnerNames: ["htmlhint"],
1289
+ preferredRunners: ["htmlhint"],
1290
+ defaultRunner: "htmlhint",
1291
+ defaultWhenUnconfigured: true,
1292
+ gate: "smart-default"
1293
+ };
1294
+ }
1295
+ if (path.basename(filePath).toLowerCase() === "dockerfile") {
1296
+ return {
1297
+ runnerNames: ["hadolint"],
1298
+ preferredRunners: ["hadolint"],
1299
+ defaultRunner: "hadolint",
1300
+ defaultWhenUnconfigured: true,
1301
+ gate: "smart-default"
1302
+ };
1303
+ }
1304
+ if (TERRAGRUNT_FILENAMES.includes(path.basename(filePath).toLowerCase())) {
1305
+ return {
1306
+ runnerNames: ["terragrunt"],
1307
+ preferredRunners: ["terragrunt"],
1308
+ defaultRunner: "terragrunt",
1309
+ defaultWhenUnconfigured: true,
1310
+ gate: "smart-default"
1311
+ };
1312
+ }
1313
+ if ([".kt", ".kts"].includes(ext)) {
1314
+ const preferredRunners = [];
1315
+ if (!context.hasKtfmtConfig)
1316
+ preferredRunners.push("ktlint");
1317
+ if (context.hasDetektConfig)
1318
+ preferredRunners.push("detekt");
1319
+ return {
1320
+ runnerNames: ["ktlint", "detekt"],
1321
+ preferredRunners,
1322
+ defaultRunner: preferredRunners[0],
1323
+ defaultWhenUnconfigured: true,
1324
+ gate: context.hasKtfmtConfig ? "config-first" : context.hasDetektConfig ? "mixed" : "smart-default"
1325
+ };
1326
+ }
1327
+ if (ext === ".toml") {
1328
+ return {
1329
+ runnerNames: ["taplo"],
1330
+ preferredRunners: ["taplo"],
1331
+ defaultRunner: "taplo",
1332
+ defaultWhenUnconfigured: true,
1333
+ gate: "smart-default"
1334
+ };
1335
+ }
1336
+ if (ext === ".go") {
1337
+ return {
1338
+ runnerNames: ["golangci-lint"],
1339
+ preferredRunners: context.hasGolangciConfig ? ["golangci-lint"] : [],
1340
+ defaultRunner: "golangci-lint",
1341
+ defaultWhenUnconfigured: false,
1342
+ gate: "config-first"
1343
+ };
1344
+ }
1345
+ if (ext === ".php") {
1346
+ return {
1347
+ runnerNames: ["phpstan"],
1348
+ preferredRunners: context.hasPhpstanConfig ? ["phpstan"] : [],
1349
+ defaultRunner: "phpstan",
1350
+ defaultWhenUnconfigured: false,
1351
+ gate: "config-first"
1352
+ };
1353
+ }
1354
+ if (ext === ".rs") {
1355
+ return {
1356
+ runnerNames: ["rust-clippy"],
1357
+ preferredRunners: ["rust-clippy"],
1358
+ defaultRunner: "rust-clippy",
1359
+ defaultWhenUnconfigured: true,
1360
+ gate: "smart-default"
1361
+ };
1362
+ }
1363
+ if ([".sh", ".bash"].includes(ext)) {
1364
+ return {
1365
+ runnerNames: ["shellcheck"],
1366
+ preferredRunners: ["shellcheck"],
1367
+ defaultRunner: "shellcheck",
1368
+ defaultWhenUnconfigured: true,
1369
+ gate: "smart-default"
1370
+ };
1371
+ }
1372
+ if (ext === ".fish") {
1373
+ return {
1374
+ runnerNames: ["fish-indent"],
1375
+ preferredRunners: ["fish-indent"],
1376
+ defaultRunner: "fish-indent",
1377
+ defaultWhenUnconfigured: true,
1378
+ gate: "smart-default"
1379
+ };
1380
+ }
1381
+ if ([".tf", ".tfvars"].includes(ext)) {
1382
+ return {
1383
+ runnerNames: ["tflint"],
1384
+ preferredRunners: ["tflint"],
1385
+ defaultRunner: "tflint",
1386
+ defaultWhenUnconfigured: true,
1387
+ gate: context.hasTflintConfig ? "config-first" : "smart-default"
1388
+ };
1389
+ }
1390
+ if ([".ex", ".exs", ".eex", ".heex", ".leex"].includes(ext)) {
1391
+ return {
1392
+ runnerNames: ["credo"],
1393
+ preferredRunners: ["credo"],
1394
+ defaultRunner: "credo",
1395
+ defaultWhenUnconfigured: true,
1396
+ gate: "smart-default"
1397
+ };
1398
+ }
1399
+ if ([".c", ".cc", ".cpp", ".cxx", ".h", ".hpp", ".ino"].includes(ext)) {
1400
+ return {
1401
+ runnerNames: ["cpp-check"],
1402
+ preferredRunners: ["cpp-check"],
1403
+ defaultRunner: "cpp-check",
1404
+ defaultWhenUnconfigured: true,
1405
+ gate: "smart-default"
1406
+ };
1407
+ }
1408
+ if (ext === ".dart") {
1409
+ return {
1410
+ runnerNames: ["dart-analyze"],
1411
+ preferredRunners: ["dart-analyze"],
1412
+ defaultRunner: "dart-analyze",
1413
+ defaultWhenUnconfigured: true,
1414
+ gate: "smart-default"
1415
+ };
1416
+ }
1417
+ if (ext === ".gleam") {
1418
+ return {
1419
+ runnerNames: ["gleam-check"],
1420
+ preferredRunners: ["gleam-check"],
1421
+ defaultRunner: "gleam-check",
1422
+ defaultWhenUnconfigured: true,
1423
+ gate: "smart-default"
1424
+ };
1425
+ }
1426
+ if ([".ps1", ".psm1", ".psd1"].includes(ext)) {
1427
+ return {
1428
+ runnerNames: ["psscriptanalyzer"],
1429
+ preferredRunners: ["psscriptanalyzer"],
1430
+ defaultRunner: "psscriptanalyzer",
1431
+ defaultWhenUnconfigured: true,
1432
+ gate: "smart-default"
1433
+ };
1434
+ }
1435
+ if (ext === ".prisma") {
1436
+ return {
1437
+ runnerNames: ["prisma-validate"],
1438
+ preferredRunners: ["prisma-validate"],
1439
+ defaultRunner: "prisma-validate",
1440
+ defaultWhenUnconfigured: true,
1441
+ gate: "smart-default"
1442
+ };
1443
+ }
1444
+ return void 0;
1445
+ }
1446
+ function getCachedProjectConventions(cwd) {
1447
+ const snapshot = loadProjectSnapshotWithoutWordIndex(cwd);
1448
+ return snapshot?.conventions;
1449
+ }
1450
+ function getLinterPolicyForCwd(filePath, cwd) {
1451
+ const context = {
1452
+ hasEslintConfig: hasToolConfig("eslint", cwd),
1453
+ hasOxlintConfig: hasToolConfig("oxlint", cwd),
1454
+ hasBiomeConfig: hasToolConfig("biome", cwd),
1455
+ hasStylelintConfig: hasToolConfig("stylelint", cwd),
1456
+ hasSqlfluffConfig: hasToolConfig("sqlfluff", cwd),
1457
+ hasRubocopConfig: hasToolConfig("rubocop", cwd),
1458
+ hasYamllintConfig: hasToolConfig("yamllint", cwd),
1459
+ hasMarkdownlintConfig: hasToolConfig("markdownlint", cwd),
1460
+ hasGolangciConfig: hasToolConfig("golangci-lint", cwd),
1461
+ hasPhpstanConfig: hasToolConfig("phpstan", cwd),
1462
+ hasMypyConfig: hasToolConfig("mypy", cwd),
1463
+ hasDetektConfig: hasToolConfig("detekt", cwd),
1464
+ hasKtfmtConfig: hasKtfmtConfig(cwd),
1465
+ // From the file's directory, not cwd: a `.tflint.hcl` in a terraform
1466
+ // subdirectory is invisible to an upward walk that starts at the repo root.
1467
+ hasTflintConfig: hasToolConfig("tflint", path.dirname(path.resolve(cwd, filePath)))
1468
+ };
1469
+ const policy = getLinterPolicyForFile(filePath, context);
1470
+ if (policy) {
1471
+ const conventions = getCachedProjectConventions(cwd);
1472
+ if (conventions && conventions.frameworks.length > 0) {
1473
+ policy.frameworkHints = conventions.frameworks.map((f) => f.id);
1474
+ }
1475
+ }
1476
+ logLatency({
1477
+ type: "phase",
1478
+ phase: "linter_selected",
1479
+ filePath,
1480
+ durationMs: 0,
1481
+ metadata: {
1482
+ runner: policy?.defaultRunner ?? null,
1483
+ gate: policy?.gate ?? null,
1484
+ cwd,
1485
+ context,
1486
+ frameworkHints: policy?.frameworkHints ?? null
1487
+ }
1488
+ });
1489
+ return policy;
1490
+ }
1491
+ function findNearestPackageJsonPath(cwd) {
1492
+ for (const dir of walkUpDirs(cwd)) {
1493
+ const pkgPath = path.join(dir, "package.json");
1494
+ if (fs.existsSync(pkgPath))
1495
+ return pkgPath;
1496
+ }
1497
+ return void 0;
1498
+ }
1499
+ function hasNearestPackageJsonDependency(cwd, dependencyName) {
1500
+ const pkgPath = findNearestPackageJsonPath(cwd);
1501
+ if (!pkgPath)
1502
+ return false;
1503
+ try {
1504
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
1505
+ return Boolean(pkg.dependencies?.[dependencyName] ?? pkg.devDependencies?.[dependencyName]);
1506
+ } catch {
1507
+ }
1508
+ return false;
1509
+ }
1510
+ var OXFMT_SVELTE_TOML_TRUE = /^[ \t]*svelte[ \t]*=[ \t]*true[ \t]*$/m;
1511
+ var TOML_TABLE_HEADING_LINE = /^[ \t]*\[{1,2}[^\]\n]+\]{1,2}[ \t]*$/m;
1512
+ function tomlTopLevel(content) {
1513
+ const normalized = normalizeToml(content);
1514
+ const heading = TOML_TABLE_HEADING_LINE.exec(normalized);
1515
+ return heading ? normalized.slice(0, heading.index) : normalized;
1516
+ }
1517
+ function hasOxfmtSvelteConfig(cwd) {
1518
+ if (!hasNearestPackageJsonDependency(cwd, "svelte"))
1519
+ return false;
1520
+ for (const dir of toolConfigDirs(cwd)) {
1521
+ const rcPath = path.join(dir, ".oxfmtrc.json");
1522
+ if (fs.existsSync(rcPath)) {
1523
+ try {
1524
+ const cfg = JSON.parse(fs.readFileSync(rcPath, "utf-8"));
1525
+ if (cfg.svelte === true)
1526
+ return true;
1527
+ } catch {
1528
+ }
1529
+ }
1530
+ const tomlPath = path.join(dir, "oxfmt.toml");
1531
+ if (fs.existsSync(tomlPath)) {
1532
+ try {
1533
+ const content = fs.readFileSync(tomlPath, "utf-8");
1534
+ if (OXFMT_SVELTE_TOML_TRUE.test(tomlTopLevel(content)))
1535
+ return true;
1536
+ } catch {
1537
+ }
1538
+ }
1539
+ }
1540
+ return false;
1541
+ }
1542
+ function configArgsWithFallback(hasConfig, toolArgs, packageConfigPath) {
1543
+ return hasConfig ? [] : [...toolArgs, resolvePackagePath(import.meta.url, packageConfigPath)];
1544
+ }
1545
+ function markdownlintConfigArgs(cwd) {
1546
+ return configArgsWithFallback(hasToolConfig("markdownlint", cwd), ["--config"], "config/markdownlint/core.json");
1547
+ }
1548
+ function optionSafeTargetArg(cwd, filePath) {
1549
+ const relative = relativeInside(cwd, filePath);
1550
+ if (relative === void 0)
1551
+ return filePath;
1552
+ return /^[A-Za-z0-9_.]/.test(relative) ? relative : `./${relative}`;
1553
+ }
1554
+ function ruffConfigArgs(cwd) {
1555
+ return configArgsWithFallback(hasToolConfig("ruff", cwd), ["--config"], "config/ruff/core.toml");
1556
+ }
1557
+ function biomeConfigArgs(cwd) {
1558
+ if (hasToolConfig("biome", cwd))
1559
+ return [];
1560
+ return [
1561
+ "--config-path=" + resolvePackagePath(import.meta.url, "config/biome/core.jsonc")
1562
+ ];
1563
+ }
1564
+ var KOTLIN_GRADLE_FILES = [
1565
+ "build.gradle.kts",
1566
+ "build.gradle",
1567
+ "settings.gradle.kts",
1568
+ "settings.gradle"
1569
+ ];
1570
+ var GRADLE_KTLINT_PLUGIN_PATTERN = /(?:id\s*\(\s*|id\s+|apply\s+plugin\s*:\s*)["']org\.jlleitschuh\.gradle\.ktlint["']/g;
1571
+ var GRADLE_BUILD_LOGIC_DIRS = ["buildSrc", "build-logic"];
1572
+ var GRADLE_BUILD_LOGIC_EXTENSIONS = [".gradle", ".gradle.kts", ".kt"];
1573
+ var GRADLE_INCLUDE_BUILD_PATTERN = /\bincludeBuild\s*\(\s*["']([^"']+)["']/g;
1574
+ var GRADLE_BUILD_LOGIC_SCAN_MAX_ENTRIES = 1e4;
1575
+ var spotlessKotlinConfigCache = /* @__PURE__ */ new Map();
1576
+ var spotlessGradleReadCount = 0;
1577
+ function stripGradleCommentsAndStrings(source, keep) {
1578
+ let result = "";
1579
+ let state = "code";
1580
+ let quote = "";
1581
+ for (let index = 0; index < source.length; index += 1) {
1582
+ const char = source[index];
1583
+ const next = source[index + 1];
1584
+ if (state === "code") {
1585
+ if (char === "/" && next === "/") {
1586
+ result += " ";
1587
+ index += 1;
1588
+ state = "line-comment";
1589
+ } else if (char === "/" && next === "*") {
1590
+ result += " ";
1591
+ index += 1;
1592
+ state = "block-comment";
1593
+ } else if (char === '"' || char === "'") {
1594
+ result += keep === "strings" ? char : " ";
1595
+ quote = char;
1596
+ state = "string";
1597
+ } else {
1598
+ result += char;
1599
+ }
1600
+ continue;
1601
+ }
1602
+ if (state === "line-comment") {
1603
+ if (char === "\n" || char === "\r") {
1604
+ result += char;
1605
+ state = "code";
1606
+ } else {
1607
+ result += " ";
1608
+ }
1609
+ continue;
1610
+ }
1611
+ if (state === "block-comment") {
1612
+ if (char === "*" && next === "/") {
1613
+ result += " ";
1614
+ index += 1;
1615
+ state = "code";
1616
+ } else {
1617
+ result += char === "\n" || char === "\r" ? char : " ";
1618
+ }
1619
+ continue;
1620
+ }
1621
+ const blank = (kept) => keep === "strings" ? kept ?? "" : " ";
1622
+ if (char === "\\") {
1623
+ result += blank(char);
1624
+ if (index + 1 < source.length) {
1625
+ const escaped = source[index + 1];
1626
+ result += escaped === "\n" ? "\n" : blank(escaped);
1627
+ index += 1;
1628
+ }
1629
+ } else if (char === quote) {
1630
+ result += blank(char);
1631
+ state = "code";
1632
+ } else {
1633
+ result += char === "\n" || char === "\r" ? char : blank(char);
1634
+ }
1635
+ }
1636
+ return result;
1637
+ }
1638
+ var GRADLE_IDENTIFIER_CHAR = /[A-Za-z0-9_$]/;
1639
+ function gradleBlockNameBefore(source, open) {
1640
+ let index = open - 1;
1641
+ while (index >= 0 && /\s/.test(source[index]))
1642
+ index -= 1;
1643
+ const end = index + 1;
1644
+ while (index >= 0 && GRADLE_IDENTIFIER_CHAR.test(source[index]))
1645
+ index -= 1;
1646
+ return source.slice(index + 1, end);
1647
+ }
1648
+ function gradleBlockRanges(source) {
1649
+ const ranges = [];
1650
+ const opens = [];
1651
+ for (let index = 0; index < source.length; index += 1) {
1652
+ const char = source[index];
1653
+ if (char === "{") {
1654
+ opens.push(index);
1655
+ continue;
1656
+ }
1657
+ if (char !== "}")
1658
+ continue;
1659
+ const open = opens.pop();
1660
+ if (open === void 0)
1661
+ continue;
1662
+ ranges.push({
1663
+ name: gradleBlockNameBefore(source, open),
1664
+ start: open + 1,
1665
+ end: index
1666
+ });
1667
+ }
1668
+ return ranges.sort((a, b) => a.start - b.start);
1669
+ }
1670
+ function namedGradleBlockRanges(source, name) {
1671
+ return gradleBlockRanges(source).filter((range) => range.name === name);
1672
+ }
1673
+ function namedGradleBlockBodies(source, name) {
1674
+ return namedGradleBlockRanges(source, name).map((range) => source.slice(range.start, range.end));
1675
+ }
1676
+ function getSpotlessKotlinFormatter(cwd) {
1677
+ for (const dir of toolConfigDirs(cwd)) {
1678
+ for (const gradle of KOTLIN_GRADLE_FILES) {
1679
+ const filePath = path.join(dir, gradle);
1680
+ if (!fs.existsSync(filePath))
1681
+ continue;
1682
+ try {
1683
+ const { mtimeMs: mtime, size } = fs.statSync(filePath);
1684
+ let config = spotlessKotlinConfigCache.get(filePath);
1685
+ if (!config || config.mtime !== mtime || config.size !== size) {
1686
+ const source = stripGradleCommentsAndStrings(fs.readFileSync(filePath, "utf-8"));
1687
+ spotlessGradleReadCount += 1;
1688
+ const kotlinBodies = namedGradleBlockBodies(source, "spotless").flatMap((spotless) => namedGradleBlockBodies(spotless, "kotlin"));
1689
+ config = {
1690
+ mtime,
1691
+ size,
1692
+ ktlintConfig: kotlinBodies.some((body) => /\bktlint\s*\(/.test(body)),
1693
+ ktfmtConfig: kotlinBodies.some((body) => /\bktfmt\s*\(/.test(body))
1694
+ };
1695
+ spotlessKotlinConfigCache.set(filePath, config);
1696
+ }
1697
+ if (config.ktlintConfig)
1698
+ return "ktlint";
1699
+ if (config.ktfmtConfig)
1700
+ return "ktfmt";
1701
+ } catch {
1702
+ }
1703
+ }
1704
+ }
1705
+ return void 0;
1706
+ }
1707
+ function hasKtlintConfig(cwd) {
1708
+ return getSpotlessKotlinFormatter(cwd) === "ktlint";
1709
+ }
1710
+ function hasGradleKtlintPlugin(cwd) {
1711
+ const files = /* @__PURE__ */ new Set();
1712
+ const scan = { entries: 0, exceeded: false, indeterminate: false };
1713
+ for (const dir of toolConfigDirs(cwd)) {
1714
+ for (const gradle of KOTLIN_GRADLE_FILES) {
1715
+ const filePath = path.join(dir, gradle);
1716
+ if (fs.existsSync(filePath))
1717
+ files.add(filePath);
1718
+ }
1719
+ for (const buildLogicDir of GRADLE_BUILD_LOGIC_DIRS) {
1720
+ if (!addGradleBuildLogicFiles(path.join(dir, buildLogicDir), files, scan)) {
1721
+ scan.exceeded = true;
1722
+ }
1723
+ }
1724
+ for (const settings of ["settings.gradle.kts", "settings.gradle"]) {
1725
+ const settingsPath = path.join(dir, settings);
1726
+ if (!fs.existsSync(settingsPath))
1727
+ continue;
1728
+ try {
1729
+ const raw = fs.readFileSync(settingsPath, "utf-8");
1730
+ const stripped = stripGradleCommentsAndStrings(raw);
1731
+ GRADLE_INCLUDE_BUILD_PATTERN.lastIndex = 0;
1732
+ let match;
1733
+ while ((match = GRADLE_INCLUDE_BUILD_PATTERN.exec(raw)) !== null) {
1734
+ const code = stripped.slice(match.index, match.index + match[0].length);
1735
+ const includedBuild = match[1];
1736
+ if (includedBuild && /^\s*includeBuild\s*\(\s*/.test(code)) {
1737
+ if (!addGradleBuildLogicFiles(path.resolve(dir, includedBuild), files, scan)) {
1738
+ scan.exceeded = true;
1739
+ }
1740
+ }
1741
+ }
1742
+ } catch {
1743
+ scan.indeterminate = true;
1744
+ }
1745
+ }
1746
+ }
1747
+ if (scan.exceeded) {
1748
+ recordDegradationOnce({
1749
+ kind: "gradle-ktlint-scan-budget-exceeded",
1750
+ subject: "ktlint:gradle-build-logic",
1751
+ reason: `Gradle build-logic ownership scan exceeded its ${GRADLE_BUILD_LOGIC_SCAN_MAX_ENTRIES}-entry budget; ownership cannot be established, so ktlint autofix is declined`
1752
+ });
1753
+ return { kind: "indeterminate" };
1754
+ }
1755
+ if (scan.indeterminate)
1756
+ return { kind: "indeterminate" };
1757
+ for (const filePath of files) {
1758
+ try {
1759
+ const raw = fs.readFileSync(filePath, "utf-8");
1760
+ const stripped = stripGradleCommentsAndStrings(raw);
1761
+ GRADLE_KTLINT_PLUGIN_PATTERN.lastIndex = 0;
1762
+ let match;
1763
+ while ((match = GRADLE_KTLINT_PLUGIN_PATTERN.exec(raw)) !== null) {
1764
+ const code = stripped.slice(match.index, match.index + match[0].length);
1765
+ if (!/^\s*$/.test(code))
1766
+ return { kind: "owned" };
1767
+ }
1768
+ } catch {
1769
+ return { kind: "indeterminate" };
1770
+ }
1771
+ }
1772
+ return { kind: "not-owned" };
1773
+ }
1774
+ function addGradleBuildLogicFiles(root, files, scan) {
1775
+ if (!fs.existsSync(root))
1776
+ return true;
1777
+ const pending = [root];
1778
+ while (pending.length > 0) {
1779
+ const dir = pending.pop();
1780
+ if (!dir)
1781
+ continue;
1782
+ let entries;
1783
+ try {
1784
+ entries = fs.readdirSync(dir, { withFileTypes: true });
1785
+ } catch {
1786
+ scan.indeterminate = true;
1787
+ continue;
1788
+ }
1789
+ for (const entry of entries) {
1790
+ scan.entries += 1;
1791
+ if (scan.entries > GRADLE_BUILD_LOGIC_SCAN_MAX_ENTRIES)
1792
+ return false;
1793
+ const entryPath = path.join(dir, entry.name);
1794
+ if (entry.isDirectory()) {
1795
+ pending.push(entryPath);
1796
+ } else if (entry.isFile() && GRADLE_BUILD_LOGIC_EXTENSIONS.some((extension) => entry.name.endsWith(extension))) {
1797
+ files.add(entryPath);
1798
+ }
1799
+ }
1800
+ }
1801
+ return true;
1802
+ }
1803
+ function hasKtfmtConfig(cwd) {
1804
+ const spotlessFormatter = getSpotlessKotlinFormatter(cwd);
1805
+ if (spotlessFormatter)
1806
+ return spotlessFormatter === "ktfmt";
1807
+ if (hasToolConfig("ktfmt", cwd))
1808
+ return true;
1809
+ for (const dir of toolConfigDirs(cwd)) {
1810
+ for (const gradle of KOTLIN_GRADLE_FILES) {
1811
+ const p = path.join(dir, gradle);
1812
+ if (fs.existsSync(p)) {
1813
+ try {
1814
+ if (/ktfmt/i.test(stripGradleCommentsAndStrings(fs.readFileSync(p, "utf-8"), "strings")))
1815
+ return true;
1816
+ } catch {
1817
+ }
1818
+ }
1819
+ }
1820
+ }
1821
+ return false;
1822
+ }
1823
+ var COMPILED_CLASSES_DIRS = [
1824
+ path.join("target", "classes"),
1825
+ path.join("build", "classes"),
1826
+ path.join("out", "production"),
1827
+ path.join("bin", "main")
1828
+ ];
1829
+ function findCompiledClassesDir(cwd) {
1830
+ for (const dir of walkUpDirs(cwd)) {
1831
+ for (const rel of COMPILED_CLASSES_DIRS) {
1832
+ const candidate = path.join(dir, rel);
1833
+ if (fs.existsSync(candidate))
1834
+ return candidate;
1835
+ }
1836
+ }
1837
+ return void 0;
1838
+ }
1839
+ function getRubocopCommand(cwd) {
1840
+ const gemfile = path.join(cwd, "Gemfile");
1841
+ if (fs.existsSync(gemfile)) {
1842
+ try {
1843
+ const content = fs.readFileSync(gemfile, "utf-8");
1844
+ if (content.includes("rubocop")) {
1845
+ return { cmd: "bundle", args: ["exec", "rubocop"] };
1846
+ }
1847
+ } catch {
1848
+ }
1849
+ }
1850
+ return { cmd: "rubocop", args: [] };
1851
+ }
1852
+ function getPreferredJstsLintRunners(context) {
1853
+ if (context.hasEslintConfig)
1854
+ return ["eslint"];
1855
+ if (context.hasOxlintConfig)
1856
+ return ["oxlint"];
1857
+ if (context.hasBiomeConfig)
1858
+ return ["biome-check-json"];
1859
+ return ["oxlint", "biome-check-json"];
1860
+ }
1861
+ function getJstsLintPolicy(context) {
1862
+ const hasEslint = !!context.hasEslintConfig;
1863
+ const hasOxlint = !!context.hasOxlintConfig;
1864
+ const hasBiome = !!context.hasBiomeConfig;
1865
+ return {
1866
+ hasEslintConfig: hasEslint,
1867
+ hasOxlintConfig: hasOxlint,
1868
+ hasBiomeConfig: hasBiome,
1869
+ preferredRunners: getPreferredJstsLintRunners({
1870
+ hasEslintConfig: hasEslint,
1871
+ hasOxlintConfig: hasOxlint,
1872
+ hasBiomeConfig: hasBiome
1873
+ }),
1874
+ hasExplicitNonBiomeLinter: hasEslint || hasOxlint
1875
+ };
1876
+ }
1877
+ function getJstsLintPolicyForCwd(cwd) {
1878
+ return getJstsLintPolicy({
1879
+ hasEslintConfig: hasToolConfig("eslint", cwd),
1880
+ hasOxlintConfig: hasToolConfig("oxlint", cwd),
1881
+ hasBiomeConfig: hasToolConfig("biome", cwd)
1882
+ });
1883
+ }
1884
+
1885
+ // dist/clients/dispatch/runners/utils/runner-helpers.js
1886
+ import * as fs2 from "node:fs";
1887
+ import * as path2 from "node:path";
1888
+ import { delimiter, resolve as resolveCommandPath } from "node:path";
1889
+ function toolAbsentSkip(cwd, tool = {}) {
1890
+ const ownVerdict = "verdict" in tool;
1891
+ const checker = ownVerdict ? void 0 : tool.checker ?? (tool.id ? toolBinaryChecker(tool.id, "managed-first") ?? void 0 : void 0);
1892
+ const verdict = ownVerdict ? tool.verdict : checker?.getVerdict(cwd);
1893
+ if (verdict?.outcome === "transient" || verdict?.cause === "bad-cwd")
1894
+ return skipped("probe-incomplete");
1895
+ if (verdict?.outcome === "non-installable")
1896
+ return skipped("probe-rejected");
1897
+ if (verdict?.cause === "policy-denied" || tool.trustRefused === true || checker?.projectBinaryRefused?.(cwd) === true)
1898
+ return skipped("trust-refused");
1899
+ if (tool.runtime === true)
1900
+ return skipped("runtime-missing");
1901
+ return skipped(isToolInstallDisabled() && tool.id !== void 0 && shouldAutoInstallTool(tool.id) ? "install-disabled" : "not-installed");
1902
+ }
1903
+ function lspPrimaryCoversFile(ctx, runnerId) {
1904
+ if (ctx.pi?.getFlag?.("no-lsp"))
1905
+ return void 0;
1906
+ const primary = getServersForFileWithConfig(ctx.filePath).find((s) => !isAuxiliary(s));
1907
+ if (!primary)
1908
+ return void 0;
1909
+ const fact = primary.custom ? void 0 : BUILTIN_SERVER_RUNNER_COVERS.get(primary.id);
1910
+ const covers = primary.covers ?? fact?.runnerIds;
1911
+ if (!covers?.includes(runnerId))
1912
+ return void 0;
1913
+ const gateCommands = fact ? fact.gateCommands : primary.custom ? primary.command ? [primary.command] : void 0 : [];
1914
+ if (gateCommands === void 0)
1915
+ return void 0;
1916
+ return {
1917
+ serverId: primary.id,
1918
+ gateCommands,
1919
+ claimSource: fact ? "builtin-fact" : "declared"
1920
+ };
1921
+ }
1922
+ async function coveringLaneAvailable(ctx, cover) {
1923
+ for (const gate of cover.gateCommands) {
1924
+ if (!await ctx.hasTool(gate))
1925
+ return false;
1926
+ }
1927
+ return true;
1928
+ }
1929
+ function managedNodeToolCandidates(tool) {
1930
+ const base = path2.join(getGlobalPiLensDir(), "tools", "node_modules", ".bin", tool);
1931
+ return process.platform === "win32" ? [`${base}.cmd`, `${base}.exe`, base] : [base];
1932
+ }
1933
+ var managedBinaryVerdicts = /* @__PURE__ */ new Map();
1934
+ var managedVerifyInFlight = /* @__PURE__ */ new Map();
1935
+ var MANAGED_VERIFY_TIMEOUT_MS = 5e3;
1936
+ var MANAGED_VERIFY_COOLDOWN_MS = 6e4;
1937
+ var MANAGED_VERIFY_COOLDOWN_MAX_MS = 15 * 6e4;
1938
+ function managedVerifyCooldownMs(attempts) {
1939
+ return Math.min(MANAGED_VERIFY_COOLDOWN_MAX_MS, MANAGED_VERIFY_COOLDOWN_MS * 2 ** (attempts - 1));
1940
+ }
1941
+ async function runManagedVerification(candidate, stamp, priorAttempts, generation, verificationArgs = ["--version"]) {
1942
+ let transient = false;
1943
+ let ok;
1944
+ try {
1945
+ const { verifyToolBinary } = await import("./probes/installer.js");
1946
+ ok = await verifyToolBinary(candidate, void 0, () => {
1947
+ transient = true;
1948
+ }, MANAGED_VERIFY_TIMEOUT_MS, verificationArgs);
1949
+ } catch {
1950
+ transient = true;
1951
+ ok = false;
1952
+ }
1953
+ if (!ok && transient) {
1954
+ const attempts = priorAttempts + 1;
1955
+ generation.guardedWrite(stamp, () => {
1956
+ managedBinaryVerdicts.set(stamp, {
1957
+ verdict: "unverified",
1958
+ attempts,
1959
+ retryAtMs: Date.now() + managedVerifyCooldownMs(attempts)
1960
+ });
1961
+ });
1962
+ return "unverified";
1963
+ }
1964
+ generation.guardedWrite(stamp, () => {
1965
+ managedBinaryVerdicts.set(stamp, { verdict: ok ? "ok" : "broken" });
1966
+ });
1967
+ if (!ok) {
1968
+ logSessionStart(`dispatch availability: managed shim ${candidate} exists but does not run; falling through to PATH`);
1969
+ }
1970
+ return ok ? "ok" : "broken";
1971
+ }
1972
+ async function verifyManagedCandidate(candidate, verificationArgs = ["--version"]) {
1973
+ let stamp;
1974
+ try {
1975
+ const stat = fs2.statSync(candidate);
1976
+ stamp = `${candidate}:${stat.mtimeMs}:${stat.size}`;
1977
+ } catch {
1978
+ return "absent";
1979
+ }
1980
+ const memo = managedBinaryVerdicts.get(stamp);
1981
+ let priorAttempts = 0;
1982
+ if (memo) {
1983
+ if (memo.verdict !== "unverified")
1984
+ return memo.verdict;
1985
+ if (Date.now() < memo.retryAtMs)
1986
+ return "unverified";
1987
+ priorAttempts = memo.attempts;
1988
+ }
1989
+ const existing = managedVerifyInFlight.get(stamp);
1990
+ if (existing)
1991
+ return existing;
1992
+ const generation = availabilityGeneration.capture();
1993
+ const probe = runManagedVerification(candidate, stamp, priorAttempts, generation, verificationArgs).finally(() => {
1994
+ generation.guardedWrite(stamp, () => {
1995
+ if (managedVerifyInFlight.get(stamp) === probe) {
1996
+ managedVerifyInFlight.delete(stamp);
1997
+ }
1998
+ });
1999
+ });
2000
+ managedVerifyInFlight.set(stamp, probe);
2001
+ return probe;
2002
+ }
2003
+ async function findManagedNodeToolBinary(tool, verificationArgs = ["--version"]) {
2004
+ for (const candidate of managedNodeToolCandidates(tool)) {
2005
+ const verdict = await verifyManagedCandidate(candidate, verificationArgs);
2006
+ if (verdict === "ok" || verdict === "unverified")
2007
+ return candidate;
2008
+ }
2009
+ return null;
2010
+ }
2011
+ async function findManagedReleaseBinary(tool, verificationArgs = ["--version"]) {
2012
+ const candidate = await findManagedToolBinary(tool);
2013
+ if (!candidate)
2014
+ return null;
2015
+ const verdict = await verifyManagedCandidate(candidate, verificationArgs);
2016
+ return verdict === "ok" || verdict === "unverified" ? candidate : null;
2017
+ }
2018
+ function resolveAdoptedRootCommand(command, ctx, cwd) {
2019
+ const candidates = managedNodeToolCandidates(command);
2020
+ let selected = candidates.find((candidate) => candidate && fs2.existsSync(candidate));
2021
+ if (!selected) {
2022
+ if (process.platform === "win32") {
2023
+ selected = resolveWindowsCommandForEnvironment(command, cwd, process.env)?.resolvedPath;
2024
+ } else {
2025
+ selected = (process.env.PATH ?? "").split(delimiter).map((dir) => resolveCommandPath(cwd, dir, command)).find((candidate) => {
2026
+ try {
2027
+ fs2.accessSync(candidate, fs2.constants.X_OK);
2028
+ return fs2.statSync(candidate).isFile();
2029
+ } catch {
2030
+ return false;
2031
+ }
2032
+ });
2033
+ }
2034
+ }
2035
+ if (!selected)
2036
+ return null;
2037
+ try {
2038
+ const binary = fs2.realpathSync.native(selected);
2039
+ const session = ctx.projectRoot ?? ctx.cwd;
2040
+ const adopted = resolveAnalysisRootPath(ctx.filePath, session);
2041
+ if (!adopted)
2042
+ return null;
2043
+ const roots = [adopted, session].map((root) => fs2.realpathSync.native(root));
2044
+ if (roots.some((root) => binary === root || isUnderDir(binary, root) || isUnderDir(selected, root))) {
2045
+ emitBounded("adopted_root_binary_refused", `${ctx.filePath}:${command}:${binary}`, {
2046
+ filePath: ctx.filePath,
2047
+ durationMs: 0,
2048
+ metadata: { command, binary }
2049
+ }, {
2050
+ ledgerKind: "adopted-root-binary-refused",
2051
+ risingEdgePer: "identity"
2052
+ });
2053
+ return null;
2054
+ }
2055
+ return binary;
2056
+ } catch {
2057
+ return null;
2058
+ }
2059
+ }
2060
+ function createVenvFinder(command, windowsExt = "", verificationArgs = ["--version"], allowProjectLocal = true, projectBinDirs = VENV_BIN_DIRS) {
2061
+ return async (cwd) => {
2062
+ if (allowProjectLocal) {
2063
+ const venvBin = localBinPath(findLocalBinAt(command, cwd, {
2064
+ windowsExt,
2065
+ binDirs: projectBinDirs
2066
+ }));
2067
+ if (venvBin)
2068
+ return { path: venvBin, rung: "venv" };
2069
+ }
2070
+ const managed = await findManagedRung(command, verificationArgs);
2071
+ if (managed)
2072
+ return managed;
2073
+ return { path: command, rung: "path" };
2074
+ };
2075
+ }
2076
+ async function findManagedRung(command, verificationArgs) {
2077
+ const managed = await findManagedNodeToolBinary(command, verificationArgs);
2078
+ if (managed)
2079
+ return { path: managed, rung: "managed-dir" };
2080
+ const release = await findManagedReleaseBinary(command, verificationArgs);
2081
+ if (release)
2082
+ return { path: release, rung: "managed-release" };
2083
+ return null;
2084
+ }
2085
+ async function resolveManagedToolClient(options) {
2086
+ const probed = await options.probe();
2087
+ if (probed.outcome !== "missing")
2088
+ return probed;
2089
+ if (!shouldAutoInstallTool(options.toolId))
2090
+ return probed;
2091
+ const state = installStateFor(options.cwd, options.toolId);
2092
+ if (state.suppressed)
2093
+ return probed;
2094
+ const installed = await ensureTool(options.toolId);
2095
+ if (!installed) {
2096
+ noteInstallFailure(options.toolId, options.cwd);
2097
+ return probed;
2098
+ }
2099
+ const value = await options.acceptInstalled(installed);
2100
+ if (value === null) {
2101
+ noteInstallFailure(options.toolId, options.cwd);
2102
+ return { outcome: "non-installable" };
2103
+ }
2104
+ noteInstallSuccess(options.toolId, options.cwd);
2105
+ return { outcome: "success", value };
2106
+ }
2107
+ var REJECTED_OUTPUT_CHARS = 2e3;
2108
+ async function getManagedToolEnvironment(_toolId, cwd) {
2109
+ let env;
2110
+ try {
2111
+ const { getToolEnvironment } = await import("./probes/installer.js");
2112
+ env = await getToolEnvironment();
2113
+ } catch {
2114
+ env = { ...process.env };
2115
+ }
2116
+ if (!cwd)
2117
+ return env;
2118
+ if (getProjectTrustState() !== "trusted")
2119
+ return env;
2120
+ const separator = process.platform === "win32" ? ";" : ":";
2121
+ const currentPath = env.PATH || env.Path || process.env.PATH || "";
2122
+ const localBin = path2.join(cwd, "node_modules", ".bin");
2123
+ const augmentedPath = `${localBin}${separator}${currentPath}`;
2124
+ return {
2125
+ ...env,
2126
+ PATH: augmentedPath,
2127
+ ...process.platform === "win32" ? { Path: augmentedPath } : {}
2128
+ };
2129
+ }
2130
+ async function discoverManagedTool(toolId) {
2131
+ return await ensureTool(toolId, { allowInstall: false }) ?? null;
2132
+ }
2133
+ var installAttemptsByCwd = new PathKeyedMap(normalizeMapKey);
2134
+ var resolveInstallInFlightByCwd = new PathKeyedMap(normalizeEphemeralMapKey);
2135
+ var correctedAvailabilityByCwd = new PathKeyedMap(normalizeMapKey);
2136
+ var uncorrectedEmissionsByCwd = new PathKeyedMap(normalizeMapKey);
2137
+ var latchedUnavailableByCwd = new PathKeyedMap(normalizeMapKey);
2138
+ var availabilityGeneration = createGenerationSource("dispatch-availability");
2139
+ var getDispatchAvailabilityGeneration = () => availabilityGeneration.current();
2140
+ var checkerProbeFlights = createAvailabilityProbeFlight({ generation: getDispatchAvailabilityGeneration });
2141
+ function recordAvailabilityProbeOverrun(tool, key, elapsedMs, budgetMs, failure) {
2142
+ if (budgetMs === void 0 || elapsedMs <= budgetMs)
2143
+ return;
2144
+ if (failure === "timeout" && elapsedMs <= budgetMs * 2)
2145
+ return;
2146
+ incrementDegradationCount({
2147
+ kind: "availability-probe-overrun",
2148
+ subject: `${tool}:${key}`,
2149
+ reason: `probe took ${Math.round(elapsedMs)}ms; budget was ${Math.round(budgetMs)}ms`
2150
+ });
2151
+ }
2152
+ function installStateFor(cwd, toolId) {
2153
+ let states = installAttemptsByCwd.get(cwd);
2154
+ if (!states) {
2155
+ states = /* @__PURE__ */ new Map();
2156
+ installAttemptsByCwd.set(cwd, states);
2157
+ }
2158
+ let state = states.get(toolId);
2159
+ if (!state) {
2160
+ state = { attempts: 0, suppressed: false };
2161
+ states.set(toolId, state);
2162
+ }
2163
+ return state;
2164
+ }
2165
+ function noteInstallFailure(toolId, cwd) {
2166
+ const state = installStateFor(cwd, toolId);
2167
+ state.attempts += 1;
2168
+ state.suppressed = true;
2169
+ logSessionStart(`dispatch availability ${toolId}: install attempt ${state.attempts} failed; suppressing retries until the next session or a successful install`);
2170
+ }
2171
+ function noteInstallSuccess(toolId, cwd) {
2172
+ const states = installAttemptsByCwd.get(cwd);
2173
+ states?.delete(toolId);
2174
+ if (states?.size === 0)
2175
+ installAttemptsByCwd.delete(cwd);
2176
+ }
2177
+ function hasId(map, cwd, id) {
2178
+ return map.get(cwd)?.has(id) ?? false;
2179
+ }
2180
+ function addId(map, cwd, id) {
2181
+ let ids = map.get(cwd);
2182
+ if (!ids) {
2183
+ ids = /* @__PURE__ */ new Set();
2184
+ map.set(cwd, ids);
2185
+ }
2186
+ ids.add(id);
2187
+ }
2188
+ function deleteIds(map, cwd, ids) {
2189
+ const existing = map.get(cwd);
2190
+ if (!existing)
2191
+ return;
2192
+ for (const id of ids)
2193
+ existing.delete(id);
2194
+ if (existing.size === 0)
2195
+ map.delete(cwd);
2196
+ }
2197
+ function hasCorrectedAvailability(cwd, toolId) {
2198
+ return hasId(correctedAvailabilityByCwd, cwd, toolId);
2199
+ }
2200
+ function noteAvailabilityCorrected(cwd, toolId) {
2201
+ addId(correctedAvailabilityByCwd, cwd, toolId);
2202
+ }
2203
+ function noteLatchedUnavailable(cwd, tool) {
2204
+ addId(latchedUnavailableByCwd, cwd, tool);
2205
+ }
2206
+ function clearLatchedUnavailable(cwd, ...tools) {
2207
+ deleteIds(latchedUnavailableByCwd, cwd, tools);
2208
+ }
2209
+ function latchKeysFor(toolId, command) {
2210
+ const keys = [toolId];
2211
+ if (command)
2212
+ keys.push(command, path2.basename(command));
2213
+ return keys;
2214
+ }
2215
+ function hasLatchedUnavailable(cwd, tools) {
2216
+ return tools.some((tool) => hasId(latchedUnavailableByCwd, cwd, tool));
2217
+ }
2218
+ function sourceTagForToolId(toolId) {
2219
+ switch (getToolInstallStrategy(toolId)) {
2220
+ case "npm":
2221
+ return "managed-dir";
2222
+ case "pip":
2223
+ return "pip-user";
2224
+ case "github":
2225
+ return "github-release";
2226
+ case "archive":
2227
+ return "archive-dist";
2228
+ case "maven":
2229
+ return "maven-jar";
2230
+ case "gem":
2231
+ case void 0:
2232
+ default:
2233
+ return void 0;
2234
+ }
2235
+ }
2236
+ function describeManagedResolution(tool, resolution) {
2237
+ if (resolution.rung !== "managed-dir" && resolution.rung !== "managed-release") {
2238
+ return {};
2239
+ }
2240
+ const source = sourceTagForToolId(tool);
2241
+ return {
2242
+ binary: path2.basename(resolution.path),
2243
+ ...source !== void 0 && { source }
2244
+ };
2245
+ }
2246
+ function resolvedTagForAttempt(toolId, attempt) {
2247
+ if (attempt?.outcome === "declined" || attempt?.outcome === "skipped") {
2248
+ return "declined";
2249
+ }
2250
+ return getLastEnsureResolutionSource(toolId) === "path" ? "path" : "cache";
2251
+ }
2252
+ function emitCompensatingAvailableRow(cwd, toolId, installStartedAt, installedPath, latchKeys) {
2253
+ if (hasCorrectedAvailability(cwd, toolId))
2254
+ return;
2255
+ const correctsLatchedRow = hasLatchedUnavailable(cwd, latchKeys);
2256
+ if (correctsLatchedRow) {
2257
+ noteAvailabilityCorrected(cwd, toolId);
2258
+ clearLatchedUnavailable(cwd, ...latchKeys);
2259
+ } else {
2260
+ if (hasId(uncorrectedEmissionsByCwd, cwd, toolId))
2261
+ return;
2262
+ addId(uncorrectedEmissionsByCwd, cwd, toolId);
2263
+ }
2264
+ const attempt = getInstallAttempt(toolId);
2265
+ const installEvidence = describeInstallAttempt(attempt);
2266
+ const evidence = {
2267
+ ...installEvidence,
2268
+ binary: path2.basename(installedPath),
2269
+ source: sourceTagForToolId(toolId),
2270
+ // Set alongside any non-"succeeded" outcome: the path is truthy but
2271
+ // nothing ran this call, so it came from an already-known-good answer
2272
+ // rather than a fresh attempt (#1612 review F2).
2273
+ ...installEvidence.install !== "succeeded" && {
2274
+ resolved: resolvedTagForAttempt(toolId, attempt)
2275
+ },
2276
+ // The whole point of the memo split, on the record: a reader can tell a
2277
+ // row that cleared a latched `unavailable` from one that corrected
2278
+ // nothing, without re-deriving it from the surrounding rows (#1674
2279
+ // review F4).
2280
+ correctsLatchedRow
2281
+ };
2282
+ logAvailabilityDecision({
2283
+ tool: toolId,
2284
+ verdict: "available",
2285
+ outcome: "success",
2286
+ cause: "ok",
2287
+ elapsedMs: Date.now() - installStartedAt,
2288
+ // `checker.reset()`/a fresh probe just cleared whatever cache stood
2289
+ // behind this call, so nothing is actually held pinned the instant
2290
+ // this row is written — the very next probe starts fresh
2291
+ // (#1612 review F3). Writing `true` here would claim a durability
2292
+ // this call doesn't have.
2293
+ latched: false,
2294
+ classifiedBy: "caller",
2295
+ evidence
2296
+ }, cwd);
2297
+ }
2298
+ function resetDispatchAvailabilityState() {
2299
+ installAttemptsByCwd.clear();
2300
+ resolveInstallInFlightByCwd.clear();
2301
+ correctedAvailabilityByCwd.clear();
2302
+ uncorrectedEmissionsByCwd.clear();
2303
+ latchedUnavailableByCwd.clear();
2304
+ managedBinaryVerdicts.clear();
2305
+ managedVerifyInFlight.clear();
2306
+ resetPathWalkMemo();
2307
+ availabilityGeneration.bump();
2308
+ checkerProbeFlights.clear();
2309
+ cwdProbeFlights.clear();
2310
+ }
2311
+ function createAvailabilityChecker(command, windowsExt = "", versionArgs = ["--version"], options = {}) {
2312
+ const cacheByCwd = new PathKeyedMap(normalizeEphemeralMapKey);
2313
+ const inFlightByCwd = new PathKeyedMap(normalizeEphemeralMapKey);
2314
+ let checkerGeneration = availabilityGeneration.current();
2315
+ let checkerFlightGeneration = 0;
2316
+ const pathFirst = options.order === "path-first";
2317
+ const allowProjectLocal = options.allowProjectLocal !== false;
2318
+ const pathRung = () => ({ path: command, rung: "path" });
2319
+ const projectRung = (cwd) => findLocalBinAt(command, cwd, {
2320
+ windowsExt,
2321
+ binDirs: options.projectBinDirs ?? VENV_BIN_DIRS
2322
+ });
2323
+ const findCommand = options.pathOnly ? async () => pathRung() : pathFirst ? async (cwd) => {
2324
+ const project = allowProjectLocal ? localBinPath(projectRung(cwd)) : void 0;
2325
+ return project ? { path: project, rung: "venv" } : pathRung();
2326
+ } : createVenvFinder(command, windowsExt, versionArgs, allowProjectLocal, options.projectBinDirs);
2327
+ const findBeyondProject = createVenvFinder(command, windowsExt, versionArgs, false);
2328
+ async function nextRung(from, cwd) {
2329
+ if (!pathFirst)
2330
+ return from === "venv" ? findBeyondProject(cwd) : null;
2331
+ if (from === "venv")
2332
+ return pathRung();
2333
+ if (from === "path")
2334
+ return findManagedRung(command, versionArgs);
2335
+ return null;
2336
+ }
2337
+ function ensureCurrentGeneration() {
2338
+ if (checkerGeneration === availabilityGeneration.current())
2339
+ return;
2340
+ cacheByCwd.clear();
2341
+ inFlightByCwd.clear();
2342
+ checkerGeneration = availabilityGeneration.current();
2343
+ checkerFlightGeneration++;
2344
+ }
2345
+ const reset = () => {
2346
+ cacheByCwd.clear();
2347
+ inFlightByCwd.clear();
2348
+ checkerGeneration = availabilityGeneration.current();
2349
+ checkerFlightGeneration++;
2350
+ };
2351
+ function getCache(cwd) {
2352
+ ensureCurrentGeneration();
2353
+ const key = path2.resolve(cwd || process.cwd());
2354
+ const existing = cacheByCwd.get(key);
2355
+ if (existing)
2356
+ return existing;
2357
+ const created = {
2358
+ latch: createAvailabilityLatch(),
2359
+ command: null,
2360
+ elapsedMs: 0
2361
+ };
2362
+ cacheByCwd.set(key, created);
2363
+ return created;
2364
+ }
2365
+ function noteDecision(cache, resolvedCwd, verdict) {
2366
+ cache.elapsedMs = verdict.elapsedMs;
2367
+ cache.rejectedOutput = verdict.available ? void 0 : verdict.rejectedOutput;
2368
+ let retryAfterMs;
2369
+ if (verdict.available) {
2370
+ cache.latch.noteAvailable(verdict.cause);
2371
+ } else {
2372
+ cache.command = null;
2373
+ const delay = cache.latch.noteUnavailable(verdict.outcome, verdict.cause);
2374
+ if (delay > 0)
2375
+ retryAfterMs = delay;
2376
+ }
2377
+ const latched = verdict.available || isLatchingOutcome(verdict.outcome);
2378
+ if (!verdict.available && latched) {
2379
+ noteLatchedUnavailable(resolvedCwd, command);
2380
+ } else if (verdict.available) {
2381
+ clearLatchedUnavailable(resolvedCwd, ...latchKeysFor(command));
2382
+ }
2383
+ logAvailabilityDecision({
2384
+ tool: command,
2385
+ verdict: verdict.available ? "available" : "unavailable",
2386
+ outcome: verdict.outcome,
2387
+ cause: verdict.cause,
2388
+ elapsedMs: verdict.elapsedMs,
2389
+ latched,
2390
+ // Every caller passes this (#2209); a direct key, not a conditional
2391
+ // spread, keeps it visible to the call-shaped classifiedBy sweep.
2392
+ classifiedBy: verdict.classifiedBy,
2393
+ ...verdict.evidence !== void 0 && { evidence: verdict.evidence },
2394
+ ...verdict.hostStallMs !== void 0 && {
2395
+ hostStallMs: verdict.hostStallMs
2396
+ },
2397
+ ...retryAfterMs !== void 0 && { retryAfterMs },
2398
+ budgetMs: options.probeTimeout ?? 5e3
2399
+ }, resolvedCwd);
2400
+ }
2401
+ async function isAvailableAsync(cwd) {
2402
+ ensureCurrentGeneration();
2403
+ const resolvedCwd = cwd || process.cwd();
2404
+ const cache = getCache(resolvedCwd);
2405
+ const answer = cache.latch.read();
2406
+ if (answer === false)
2407
+ return false;
2408
+ if (answer === true) {
2409
+ if (cache.command && await isSpawnableCommand(cache.command)) {
2410
+ return true;
2411
+ }
2412
+ cache.latch.reset();
2413
+ cache.command = null;
2414
+ }
2415
+ const key = path2.resolve(resolvedCwd);
2416
+ const existing = inFlightByCwd.get(key);
2417
+ if (existing)
2418
+ return existing;
2419
+ const promiseGeneration = checkerGeneration;
2420
+ let promise;
2421
+ promise = (async () => {
2422
+ const fastPath = await options.fastPath?.();
2423
+ if (fastPath) {
2424
+ cache.command = fastPath;
2425
+ noteDecision(cache, resolvedCwd, {
2426
+ available: true,
2427
+ outcome: "success",
2428
+ cause: "fast-path",
2429
+ elapsedMs: 0,
2430
+ // Caller-asserted, and justifiably: an on-disk shim IS the tool, so
2431
+ // there is no spawn to derive anything from (#1500).
2432
+ classifiedBy: "caller"
2433
+ });
2434
+ return true;
2435
+ }
2436
+ try {
2437
+ const cwdStat = await fs2.promises.stat(resolvedCwd);
2438
+ if (!cwdStat.isDirectory()) {
2439
+ noteDecision(cache, resolvedCwd, {
2440
+ available: false,
2441
+ outcome: "non-installable",
2442
+ cause: "bad-cwd",
2443
+ elapsedMs: 0,
2444
+ // The workspace is gone. Asserted from a stat, not a probe, and it
2445
+ // must never read as "the tool is missing" (#1500).
2446
+ classifiedBy: "caller"
2447
+ });
2448
+ return false;
2449
+ }
2450
+ } catch {
2451
+ noteDecision(cache, resolvedCwd, {
2452
+ available: false,
2453
+ outcome: "non-installable",
2454
+ cause: "bad-cwd",
2455
+ elapsedMs: 0,
2456
+ classifiedBy: "caller"
2457
+ });
2458
+ return false;
2459
+ }
2460
+ const resolveStartedAt = Date.now();
2461
+ let resolution = await findCommand(resolvedCwd);
2462
+ let resolveMs = Date.now() - resolveStartedAt;
2463
+ for (; ; ) {
2464
+ const cmd = resolution.path;
2465
+ if (isInSpawnTimeoutCooldown(cmd)) {
2466
+ noteDecision(cache, resolvedCwd, {
2467
+ available: false,
2468
+ outcome: "transient",
2469
+ cause: "probe-timeout",
2470
+ elapsedMs: 0,
2471
+ classifiedBy: "caller",
2472
+ evidence: {
2473
+ command: cmd,
2474
+ status: null
2475
+ }
2476
+ });
2477
+ return false;
2478
+ }
2479
+ const env = await options.environment?.(resolvedCwd);
2480
+ const stallSampler = startHostStallSampler();
2481
+ const startedAt = Date.now();
2482
+ let result;
2483
+ let hostStallMs;
2484
+ let probeJoined = false;
2485
+ try {
2486
+ const shared = checkerProbeFlights.run(`checker:${command}|${versionArgs.join("|")}|${key}|${checkerFlightGeneration}|${windowsExt}|${cmd}|${JSON.stringify(Object.entries(env ?? {}).sort(([a], [b]) => compareOrdinal(a, b)))}`, () => (
2487
+ // A bare PATH-only probe goes through the cwd-less probe seam
2488
+ // (#2894): nothing it answers is read out of a project.
2489
+ options.pathOnly ? probeToolAsync(cmd, versionArgs, {
2490
+ timeout: options.probeTimeout ?? 5e3,
2491
+ ...env !== void 0 && { env },
2492
+ input: ""
2493
+ }) : safeSpawnAsync(cmd, versionArgs, {
2494
+ timeout: options.probeTimeout ?? 5e3,
2495
+ cwd: resolvedCwd,
2496
+ env,
2497
+ input: ""
2498
+ })
2499
+ ));
2500
+ probeJoined = shared.joined;
2501
+ result = await shared.promise;
2502
+ } finally {
2503
+ hostStallMs = stallSampler.stop();
2504
+ }
2505
+ const elapsedMs = Date.now() - startedAt;
2506
+ recordAvailabilityProbeOverrun(command, resolvedCwd, elapsedMs, options.probeTimeout ?? 5e3, result.failure);
2507
+ if (!result.error && result.status === 0) {
2508
+ cache.command = cmd;
2509
+ noteDecision(cache, resolvedCwd, {
2510
+ available: true,
2511
+ outcome: "success",
2512
+ cause: "ok",
2513
+ elapsedMs,
2514
+ hostStallMs,
2515
+ classifiedBy: probeJoined ? "joined" : "probe",
2516
+ evidence: {
2517
+ ...describeProbeEvidence(result),
2518
+ ...describeManagedResolution(command, resolution),
2519
+ resolveMs
2520
+ }
2521
+ });
2522
+ return true;
2523
+ }
2524
+ const { outcome, cause, evidence } = classifyProbeFailure(result, {
2525
+ hostStallMs,
2526
+ unclassifiedFailureOutcome: options.unclassifiedFailureOutcome
2527
+ });
2528
+ if (isLatchingOutcome(outcome)) {
2529
+ const fallStartedAt = Date.now();
2530
+ const next = await nextRung(resolution.rung, resolvedCwd);
2531
+ resolveMs += Date.now() - fallStartedAt;
2532
+ if (next) {
2533
+ resolution = next;
2534
+ continue;
2535
+ }
2536
+ }
2537
+ if (result.spawnFailure?.kind === "tool-not-found")
2538
+ resetPathWalkMemo();
2539
+ noteDecision(cache, resolvedCwd, {
2540
+ available: false,
2541
+ outcome,
2542
+ cause,
2543
+ elapsedMs,
2544
+ hostStallMs,
2545
+ classifiedBy: probeJoined ? "joined" : "probe",
2546
+ evidence,
2547
+ ...cause === "probe-rejected" && {
2548
+ rejectedOutput: (result.stderr || result.stdout || "").slice(-REJECTED_OUTPUT_CHARS)
2549
+ }
2550
+ });
2551
+ return false;
2552
+ }
2553
+ })().finally(() => {
2554
+ if (checkerGeneration === promiseGeneration && inFlightByCwd.get(key) === promise) {
2555
+ inFlightByCwd.delete(key);
2556
+ }
2557
+ });
2558
+ inFlightByCwd.set(key, promise);
2559
+ return promise;
2560
+ }
2561
+ function getCommand(cwd) {
2562
+ ensureCurrentGeneration();
2563
+ const cache = getCache(cwd || process.cwd());
2564
+ return cache.command;
2565
+ }
2566
+ function getOutcome(cwd) {
2567
+ ensureCurrentGeneration();
2568
+ return getCache(cwd || process.cwd()).latch.getOutcome();
2569
+ }
2570
+ function getVerdict(cwd) {
2571
+ ensureCurrentGeneration();
2572
+ const { latch, elapsedMs, rejectedOutput } = getCache(cwd || process.cwd());
2573
+ const outcome = latch.getOutcome();
2574
+ return {
2575
+ outcome,
2576
+ cause: latch.getCause(),
2577
+ elapsedMs,
2578
+ latched: outcome === null || isLatchingOutcome(outcome),
2579
+ retryAtMs: latch.getRetryAtMs(),
2580
+ ...rejectedOutput !== void 0 && { rejectedOutput }
2581
+ };
2582
+ }
2583
+ function projectBinaryRefused(cwd) {
2584
+ return !options.pathOnly && allowProjectLocal && isLocalBinTrustRefusal(projectRung(cwd));
2585
+ }
2586
+ return {
2587
+ isAvailableAsync,
2588
+ getCommand,
2589
+ getOutcome,
2590
+ getVerdict,
2591
+ projectBinaryRefused,
2592
+ reset
2593
+ };
2594
+ }
2595
+ var cwdProbeFlights = createAvailabilityProbeFlight({
2596
+ generation: getDispatchAvailabilityGeneration
2597
+ });
2598
+ function createCwdCachedProbe(probe, options) {
2599
+ const latchByCwd = new PathKeyedMap(normalizeEphemeralMapKey);
2600
+ const inFlightByCwd = new PathKeyedMap(normalizeEphemeralMapKey);
2601
+ let probeGeneration = availabilityGeneration.current();
2602
+ function clear() {
2603
+ latchByCwd.clear();
2604
+ inFlightByCwd.clear();
2605
+ }
2606
+ function ensureCurrentGeneration() {
2607
+ if (probeGeneration === availabilityGeneration.current())
2608
+ return;
2609
+ clear();
2610
+ probeGeneration = availabilityGeneration.current();
2611
+ }
2612
+ function latchFor(key) {
2613
+ const existing = latchByCwd.get(key);
2614
+ if (existing)
2615
+ return existing;
2616
+ const created = createAvailabilityLatch();
2617
+ latchByCwd.set(key, created);
2618
+ return created;
2619
+ }
2620
+ function note(latch, key, verdict) {
2621
+ let retryAfterMs;
2622
+ if (verdict.available) {
2623
+ latch.noteAvailable(verdict.cause);
2624
+ } else {
2625
+ const delay = latch.noteUnavailable(verdict.outcome, verdict.cause);
2626
+ if (delay > 0)
2627
+ retryAfterMs = delay;
2628
+ }
2629
+ const latched = verdict.available || isLatchingOutcome(verdict.outcome);
2630
+ if (!verdict.available && latched) {
2631
+ noteLatchedUnavailable(key, options.tool);
2632
+ } else if (verdict.available) {
2633
+ clearLatchedUnavailable(key, ...latchKeysFor(options.tool));
2634
+ }
2635
+ logAvailabilityDecision({
2636
+ tool: options.tool,
2637
+ verdict: verdict.available ? "available" : "unavailable",
2638
+ outcome: verdict.outcome,
2639
+ cause: verdict.cause,
2640
+ elapsedMs: verdict.elapsedMs,
2641
+ latched,
2642
+ hostStallMs: verdict.hostStallMs,
2643
+ ...retryAfterMs !== void 0 && { retryAfterMs },
2644
+ ...options.budgetMs !== void 0 && { budgetMs: options.budgetMs },
2645
+ // Every verdict here is derived from the probe this seam just ran.
2646
+ classifiedBy: verdict.classifiedBy ?? "probe",
2647
+ ...verdict.evidence !== void 0 && { evidence: verdict.evidence }
2648
+ }, key);
2649
+ }
2650
+ const run = (cwd) => {
2651
+ ensureCurrentGeneration();
2652
+ const key = path2.resolve(cwd || process.cwd());
2653
+ const latch = latchFor(key);
2654
+ const memo = latch.read();
2655
+ if (memo !== null)
2656
+ return Promise.resolve(memo);
2657
+ const existing = inFlightByCwd.get(key);
2658
+ if (existing)
2659
+ return existing;
2660
+ const promiseGeneration = probeGeneration;
2661
+ let promise;
2662
+ promise = (async () => {
2663
+ const stallSampler = startHostStallSampler();
2664
+ const startedAt = Date.now();
2665
+ let result;
2666
+ let thrown;
2667
+ let probeJoined = false;
2668
+ try {
2669
+ const shared = cwdProbeFlights.run(`cwd:${options.tool}|${options.flightKeyComponent ?? ""}|${key}`, () => probe(key));
2670
+ probeJoined = shared.joined;
2671
+ result = await shared.promise;
2672
+ } catch (error) {
2673
+ thrown = error;
2674
+ }
2675
+ const hostStallMs = stallSampler.stop();
2676
+ const elapsedMs = Date.now() - startedAt;
2677
+ const shape = result ?? {
2678
+ error: thrown instanceof Error ? thrown : new Error(String(thrown))
2679
+ };
2680
+ recordAvailabilityProbeOverrun(options.tool, key, elapsedMs, options.budgetMs, shape.failure);
2681
+ if (result && !result.error && result.status === 0) {
2682
+ note(latch, key, {
2683
+ available: true,
2684
+ outcome: "success",
2685
+ cause: "ok",
2686
+ elapsedMs,
2687
+ hostStallMs,
2688
+ classifiedBy: probeJoined ? "joined" : "probe",
2689
+ evidence: describeProbeEvidence(result, options.tool)
2690
+ });
2691
+ return true;
2692
+ }
2693
+ const { outcome, cause, evidence } = classifyProbeFailure(shape, {
2694
+ hostStallMs,
2695
+ command: options.tool,
2696
+ unclassifiedFailureOutcome: options.unclassifiedFailureOutcome
2697
+ });
2698
+ note(latch, key, {
2699
+ available: false,
2700
+ outcome,
2701
+ cause,
2702
+ elapsedMs,
2703
+ hostStallMs,
2704
+ classifiedBy: probeJoined ? "joined" : "probe",
2705
+ evidence
2706
+ });
2707
+ return false;
2708
+ })().finally(() => {
2709
+ if (probeGeneration === promiseGeneration && inFlightByCwd.get(key) === promise) {
2710
+ inFlightByCwd.delete(key);
2711
+ }
2712
+ });
2713
+ inFlightByCwd.set(key, promise);
2714
+ return promise;
2715
+ };
2716
+ const cached = run;
2717
+ cached.getVerdict = (cwd) => {
2718
+ ensureCurrentGeneration();
2719
+ const latch = latchFor(path2.resolve(cwd || process.cwd()));
2720
+ const outcome = latch.getOutcome();
2721
+ return {
2722
+ outcome,
2723
+ cause: latch.getCause(),
2724
+ elapsedMs: 0,
2725
+ // Read the OUTCOME, never `read()`: `read()` answers `null` both for a
2726
+ // cwd that was never probed and for a transient verdict whose cooldown
2727
+ // expired, and `!== false` turned both of those into `latched: true` —
2728
+ // the opposite of the truth in the expired case.
2729
+ latched: outcome !== null && isLatchingOutcome(outcome),
2730
+ retryAtMs: latch.getRetryAtMs()
2731
+ };
2732
+ };
2733
+ cached.reset = () => {
2734
+ clear();
2735
+ probeGeneration = availabilityGeneration.current();
2736
+ };
2737
+ return cached;
2738
+ }
2739
+ function resolveNodeToolCommand(cwd, toolName, windowsExt = ".cmd") {
2740
+ const local = localBinPath(findLocalBinAt(toolName, cwd, { windowsExt }));
2741
+ if (local)
2742
+ return local;
2743
+ return toolName;
2744
+ }
2745
+ function resolveToolCommand(cwd, toolId) {
2746
+ const spec = getToolCommandSpec(toolId);
2747
+ if (!spec)
2748
+ return null;
2749
+ return resolveNodeToolCommand(cwd, spec.command, spec.windowsExt ?? ".cmd");
2750
+ }
2751
+ function resolveVendorToolCommand(cwd, toolName, windowsExt = ".bat") {
2752
+ return findLocalBinUpwards(toolName, cwd, {
2753
+ windowsExt,
2754
+ binDirs: VENDOR_BIN_DIRS
2755
+ }) ?? null;
2756
+ }
2757
+ var toolBinaryCheckers = /* @__PURE__ */ new Map();
2758
+ function toolBinaryChecker(toolId, order) {
2759
+ const key = `${toolId}|${order}`;
2760
+ const existing = toolBinaryCheckers.get(key);
2761
+ if (existing)
2762
+ return existing;
2763
+ const spec = getToolCommandSpec(toolId);
2764
+ if (!spec)
2765
+ return null;
2766
+ const checker = createAvailabilityChecker(spec.command, spec.windowsExt ?? "", spec.versionArgs ?? ["--version"], {
2767
+ projectBinDirs: [...VENV_BIN_DIRS, ...NODE_MODULES_BIN_DIRS],
2768
+ order
2769
+ });
2770
+ toolBinaryCheckers.set(key, checker);
2771
+ return checker;
2772
+ }
2773
+ async function resolveToolCommandWithInstallFallback(cwd, toolId) {
2774
+ const checker = toolBinaryChecker(toolId, "managed-first");
2775
+ if (!checker)
2776
+ return null;
2777
+ return resolveAvailableOrInstall(checker, getToolCommandSpec(toolId)?.managedToolId ?? toolId, cwd);
2778
+ }
2779
+ var UNPROBED_VERDICT = {
2780
+ outcome: null,
2781
+ cause: null,
2782
+ elapsedMs: 0,
2783
+ latched: false,
2784
+ retryAtMs: 0
2785
+ };
2786
+ function toolBinaryVerdict(toolId, cwd) {
2787
+ return toolBinaryChecker(toolId, "managed-first")?.getVerdict(cwd) ?? UNPROBED_VERDICT;
2788
+ }
2789
+ async function resolveInstalledToolCommand(cwd, toolId) {
2790
+ const checker = toolBinaryChecker(toolId, "path-first");
2791
+ if (!checker)
2792
+ return { command: null };
2793
+ if (await checker.isAvailableAsync(cwd)) {
2794
+ return { command: checker.getCommand(cwd) };
2795
+ }
2796
+ const { cause, rejectedOutput } = checker.getVerdict(cwd);
2797
+ return cause === "probe-rejected" ? { command: null, rejected: rejectedOutput ?? "" } : { command: null };
2798
+ }
2799
+ async function verifyOrInstallCommand(command, toolId, cwd, versionArgs = ["--version"], timeout = 5e3, onUnusable = () => {
2800
+ }) {
2801
+ const spawnable = await isSpawnableCommand(command);
2802
+ if (spawnable) {
2803
+ const versionCheck = await safeSpawnAsync(command, versionArgs, {
2804
+ timeout,
2805
+ cwd,
2806
+ input: "",
2807
+ cooldown: false
2808
+ });
2809
+ if (!versionCheck.error && versionCheck.status === 0) {
2810
+ return command;
2811
+ }
2812
+ const { outcome, cause } = classifyProbeFailure(versionCheck, { command });
2813
+ onUnusable({ outcome, cause });
2814
+ return null;
2815
+ }
2816
+ if (!shouldAutoInstallTool(toolId))
2817
+ return null;
2818
+ const state = installStateFor(cwd, toolId);
2819
+ if (state.suppressed)
2820
+ return null;
2821
+ const installStartedAt = Date.now();
2822
+ const installed = await ensureTool(toolId);
2823
+ if (installed) {
2824
+ noteInstallSuccess(toolId, cwd);
2825
+ emitCompensatingAvailableRow(cwd, toolId, installStartedAt, installed, latchKeysFor(toolId, command));
2826
+ return installed;
2827
+ }
2828
+ noteInstallFailure(toolId, cwd);
2829
+ return null;
2830
+ }
2831
+ async function resolveCommandArgsWithInstallFallback(command, toolId, cwd, versionArgs = ["--version"], timeout = 5e3, onUnusable) {
2832
+ const versionCheck = await safeSpawnAsync(command.cmd, [...command.args, ...versionArgs], { timeout, cwd, input: "", cooldown: false });
2833
+ if (!versionCheck.error && versionCheck.status === 0) {
2834
+ return command;
2835
+ }
2836
+ const installed = await verifyOrInstallCommand(command.cmd, toolId, cwd, versionArgs, timeout, onUnusable);
2837
+ if (!installed) {
2838
+ return null;
2839
+ }
2840
+ if (installed === command.cmd) {
2841
+ return command;
2842
+ }
2843
+ return { cmd: installed, args: [] };
2844
+ }
2845
+ async function resolveAvailableOrInstallUnshared(checker, toolId, cwd) {
2846
+ const available = await checker.isAvailableAsync(cwd);
2847
+ if (available) {
2848
+ return checker.getCommand(cwd);
2849
+ }
2850
+ if (checker.getOutcome?.(cwd) !== "missing")
2851
+ return null;
2852
+ if (!shouldAutoInstallTool(toolId))
2853
+ return null;
2854
+ const state = installStateFor(cwd, toolId);
2855
+ if (state.suppressed) {
2856
+ return null;
2857
+ }
2858
+ const installStartedAt = Date.now();
2859
+ const installed = await ensureTool(toolId);
2860
+ if (installed) {
2861
+ noteInstallSuccess(toolId, cwd);
2862
+ checker.reset?.();
2863
+ noteLatchedUnavailable(cwd, toolId);
2864
+ emitCompensatingAvailableRow(cwd, toolId, installStartedAt, installed, latchKeysFor(toolId, checker.getCommand(cwd) ?? void 0));
2865
+ return installed;
2866
+ }
2867
+ noteInstallFailure(toolId, cwd);
2868
+ return null;
2869
+ }
2870
+ function resolveAvailableOrInstall(checker, toolId, cwd) {
2871
+ const key = normalizeEphemeralMapKey(cwd);
2872
+ let byTool = resolveInstallInFlightByCwd.get(key);
2873
+ if (!byTool) {
2874
+ byTool = /* @__PURE__ */ new Map();
2875
+ resolveInstallInFlightByCwd.set(key, byTool);
2876
+ }
2877
+ const existing = byTool.get(toolId);
2878
+ if (existing)
2879
+ return existing;
2880
+ const generation = availabilityGeneration.capture();
2881
+ const promise = resolveAvailableOrInstallUnshared(checker, toolId, cwd).finally(() => {
2882
+ generation.guardedWrite(`${toolId}@${key}`, () => {
2883
+ const current = resolveInstallInFlightByCwd.get(key);
2884
+ if (current?.get(toolId) === promise) {
2885
+ current.delete(toolId);
2886
+ if (current.size === 0)
2887
+ resolveInstallInFlightByCwd.delete(key);
2888
+ }
2889
+ });
2890
+ });
2891
+ byTool.set(toolId, promise);
2892
+ return promise;
2893
+ }
2894
+ async function resolveLocalFirstAsync(toolName, cwd, windowsExt = ".cmd") {
2895
+ const local = localBinPath(findLocalBinAt(toolName, cwd, { windowsExt }));
2896
+ if (local)
2897
+ return { cmd: local, args: [] };
2898
+ const globalBin = await findGlobalBinary(toolName, windowsExt);
2899
+ if (globalBin)
2900
+ return { cmd: globalBin, args: [] };
2901
+ const globalCheck = await probeToolAsync(toolName, ["--version"], {
2902
+ timeout: 3e3
2903
+ });
2904
+ if (!globalCheck.error && globalCheck.status === 0) {
2905
+ return { cmd: toolName, args: [] };
2906
+ }
2907
+ return { cmd: "npx", args: ["--no", toolName] };
2908
+ }
2909
+ var pyright = createAvailabilityChecker("pyright", ".exe");
2910
+ var ruff = createAvailabilityChecker("ruff", ".exe");
2911
+ var biome = createAvailabilityChecker("biome");
2912
+ function resolveRunnerCwd(ctx, tool) {
2913
+ return resolveToolCwd("runner", tool, ctx.filePath, ctx).cwd;
2914
+ }
2915
+
2916
+ export {
2917
+ OXFMT_SUPPORTED_EXTENSIONS,
2918
+ getFormatterPolicyForFile,
2919
+ getSmartDefaultFormatterName,
2920
+ getAutoInstallToolIdForFormatter,
2921
+ getAutofixCapability,
2922
+ getLinterPolicyForCwd,
2923
+ hasNearestPackageJsonDependency,
2924
+ hasOxfmtSvelteConfig,
2925
+ markdownlintConfigArgs,
2926
+ optionSafeTargetArg,
2927
+ ruffConfigArgs,
2928
+ biomeConfigArgs,
2929
+ stripGradleCommentsAndStrings,
2930
+ gradleBlockRanges,
2931
+ hasKtlintConfig,
2932
+ hasGradleKtlintPlugin,
2933
+ hasKtfmtConfig,
2934
+ findCompiledClassesDir,
2935
+ getRubocopCommand,
2936
+ getJstsLintPolicyForCwd,
2937
+ toolAbsentSkip,
2938
+ lspPrimaryCoversFile,
2939
+ coveringLaneAvailable,
2940
+ findManagedNodeToolBinary,
2941
+ resolveAdoptedRootCommand,
2942
+ resolveManagedToolClient,
2943
+ getManagedToolEnvironment,
2944
+ discoverManagedTool,
2945
+ resetDispatchAvailabilityState,
2946
+ createAvailabilityChecker,
2947
+ createCwdCachedProbe,
2948
+ resolveToolCommand,
2949
+ resolveVendorToolCommand,
2950
+ resolveToolCommandWithInstallFallback,
2951
+ toolBinaryVerdict,
2952
+ resolveInstalledToolCommand,
2953
+ resolveCommandArgsWithInstallFallback,
2954
+ resolveAvailableOrInstall,
2955
+ resolveLocalFirstAsync,
2956
+ resolveRunnerCwd
2957
+ };