@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,810 @@
1
+ import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ readJsonCache
4
+ } from "./chunk-TQWRH25U.js";
5
+ import {
6
+ hasTomlTable,
7
+ normalizeToml
8
+ } from "./chunk-KNSOA43J.js";
9
+ import {
10
+ rootMarkersForFile
11
+ } from "./chunk-XSC3BCN3.js";
12
+ import {
13
+ createGenerationMap,
14
+ createGenerationSource
15
+ } from "./chunk-3PO4YYOX.js";
16
+ import {
17
+ getDegradationLedgerGeneration,
18
+ logExtension,
19
+ recordDegradationOnce
20
+ } from "./chunk-NHA5K226.js";
21
+ import {
22
+ isRealGitMarker,
23
+ isUnderDir,
24
+ isWindowsPath,
25
+ nameMatchesMarkerGlob,
26
+ normalizeEphemeralMapKey,
27
+ pathsEqual,
28
+ realpathOrResolve,
29
+ toPosix,
30
+ walkUpDirs
31
+ } from "./chunk-WLD6BGON.js";
32
+
33
+ // dist/clients/tool-config-presence.js
34
+ import * as fs2 from "node:fs";
35
+ import * as os from "node:os";
36
+ import * as path from "node:path";
37
+
38
+ // dist/clients/dispatch/runners/utils.js
39
+ import * as fs from "node:fs";
40
+ function readFileContent(filePath) {
41
+ try {
42
+ return fs.readFileSync(filePath, "utf-8");
43
+ } catch {
44
+ return void 0;
45
+ }
46
+ }
47
+
48
+ // dist/clients/tool-config-presence.js
49
+ var TOOL_CONFIG_SPECS = {
50
+ detekt: {
51
+ files: [
52
+ "detekt.yml",
53
+ ".detekt.yml",
54
+ path.join("config", "detekt", "detekt.yml"),
55
+ path.join("detekt", "detekt.yml")
56
+ ]
57
+ },
58
+ // tflint ships built-in rules and runs without config, so `.tflint.hcl` is
59
+ // the project electing it, not a prerequisite. It resolves config from its
60
+ // own working directory and never walks parents, so the runner hands the
61
+ // found file over with `--config`.
62
+ tflint: { files: [".tflint.hcl"] },
63
+ black: {
64
+ tomlTables: [{ file: "pyproject.toml", table: String.raw`tool\.black` }],
65
+ dependency: { names: ["black"], files: ["requirements.txt", "Pipfile"] }
66
+ },
67
+ // Ruff ignores a `pyproject.toml` without `[tool.ruff]` (measured, see
68
+ // `python-environment.ts`), so the table is the evidence.
69
+ ruff: {
70
+ files: ["ruff.toml", ".ruff.toml"],
71
+ tomlTables: [{ file: "pyproject.toml", table: String.raw`tool\.ruff` }]
72
+ },
73
+ sqlfluff: {
74
+ files: [".sqlfluff"],
75
+ tomlTables: [{ file: "pyproject.toml", table: String.raw`tool\.sqlfluff` }],
76
+ iniSections: [
77
+ { file: "setup.cfg", section: "sqlfluff" },
78
+ { file: "tox.ini", section: "sqlfluff" }
79
+ ],
80
+ dependency: {
81
+ names: ["sqlfluff"],
82
+ files: ["requirements.txt", "Pipfile", "pyproject.toml"]
83
+ }
84
+ },
85
+ yamllint: {
86
+ files: [".yamllint", ".yamllint.yml", ".yamllint.yaml"],
87
+ tomlTables: [{ file: "pyproject.toml", table: String.raw`tool\.yamllint` }],
88
+ iniSections: [
89
+ { file: "setup.cfg", section: "yamllint" },
90
+ { file: "tox.ini", section: "yamllint" }
91
+ ],
92
+ dependency: {
93
+ names: ["yamllint"],
94
+ files: ["requirements.txt", "Pipfile", "pyproject.toml"]
95
+ }
96
+ },
97
+ mypy: {
98
+ files: ["mypy.ini", ".mypy.ini"],
99
+ tomlTables: [{ file: "pyproject.toml", table: String.raw`tool\.mypy` }],
100
+ iniSections: [{ file: "setup.cfg", section: "mypy" }]
101
+ },
102
+ // The Mix project descriptor, the evidence credo and `mix compile` need.
103
+ mix: { files: ["mix.exs"], exactDir: true },
104
+ // shfmt's only config source, and the formatters' indentation opt-out.
105
+ editorconfig: { files: [".editorconfig"] },
106
+ // Flat configs resolve like ESLint itself: every ancestor, past an
107
+ // intermediate package.json (#3017, shape 39); the legacy forms keep the
108
+ // per-package boundary.
109
+ eslint: {
110
+ files: [
111
+ "eslint.config.js",
112
+ "eslint.config.mjs",
113
+ "eslint.config.cjs",
114
+ "eslint.config.ts",
115
+ "eslint.config.mts",
116
+ "eslint.config.cts"
117
+ ],
118
+ withinNearestPackage: {
119
+ files: [
120
+ ".eslintrc",
121
+ ".eslintrc.js",
122
+ ".eslintrc.cjs",
123
+ ".eslintrc.json",
124
+ ".eslintrc.yaml",
125
+ ".eslintrc.yml"
126
+ ],
127
+ jsonFields: [{ file: "package.json", field: "eslintConfig" }]
128
+ }
129
+ },
130
+ // `biome.jsonc` is probed first, so it wins where both names sit in one
131
+ // directory. No caller reads the biome match's file; presence is the answer.
132
+ biome: { files: ["biome.jsonc", "biome.json"] },
133
+ stylelint: {
134
+ files: [
135
+ ".stylelintrc",
136
+ ".stylelintrc.json",
137
+ ".stylelintrc.jsonc",
138
+ ".stylelintrc.yaml",
139
+ ".stylelintrc.yml",
140
+ ".stylelintrc.js",
141
+ ".stylelintrc.cjs",
142
+ "stylelint.config.js",
143
+ "stylelint.config.cjs",
144
+ "stylelint.config.mjs"
145
+ ],
146
+ jsonFields: [{ file: "package.json", field: "stylelint" }]
147
+ },
148
+ markdownlint: {
149
+ files: [
150
+ // markdownlint-cli2's built-in config names (keep in sync with the
151
+ // installed CLI's supported configuration file names).
152
+ ".markdownlint-cli2.jsonc",
153
+ ".markdownlint-cli2.yaml",
154
+ ".markdownlint-cli2.yml",
155
+ ".markdownlint-cli2.cjs",
156
+ ".markdownlint-cli2.mjs",
157
+ ".markdownlint.jsonc",
158
+ ".markdownlint.json",
159
+ ".markdownlint.yaml",
160
+ ".markdownlint.yml",
161
+ ".markdownlint.cjs",
162
+ ".markdownlint.mjs",
163
+ // The legacy name, retained for existing policy behaviour even though
164
+ // current markdownlint-cli2 versions do not prefer it.
165
+ ".markdownlintrc"
166
+ ]
167
+ },
168
+ "golangci-lint": {
169
+ files: [
170
+ ".golangci.yml",
171
+ ".golangci.yaml",
172
+ ".golangci.toml",
173
+ ".golangci.json"
174
+ ]
175
+ },
176
+ phpstan: {
177
+ files: ["phpstan.neon", "phpstan.neon.dist", "phpstan.dist.neon"]
178
+ },
179
+ // Vite+ (oxfmt / oxlint through `vp`): its own file, the package as a
180
+ // dependency, or a Vite config importing it.
181
+ vitePlus: {
182
+ files: ["vite-plus.json"],
183
+ dependency: {
184
+ names: ["vite-plus", "@voidzero-dev/vite-plus-core"],
185
+ files: ["package.json"]
186
+ },
187
+ sourceImports: {
188
+ files: [
189
+ "vite.config.ts",
190
+ "vite.config.mts",
191
+ "vite.config.cts",
192
+ "vite.config.js",
193
+ "vite.config.mjs",
194
+ "vite.config.cjs"
195
+ ],
196
+ // The core package is Vite+ too: master matched it by substring.
197
+ modules: ["vite-plus", "@voidzero-dev/vite-plus-core"]
198
+ }
199
+ },
200
+ // SpotBugs and javac ask whether a Maven/Gradle descriptor is in scope.
201
+ javaBuild: {
202
+ files: [
203
+ "pom.xml",
204
+ "build.gradle",
205
+ "build.gradle.kts",
206
+ "settings.gradle",
207
+ "settings.gradle.kts"
208
+ ]
209
+ },
210
+ vale: { files: [".vale.ini"] },
211
+ shellcheck: { files: [".shellcheckrc"] },
212
+ prettier: {
213
+ files: [
214
+ ".prettierrc",
215
+ ".prettierrc.json",
216
+ ".prettierrc.yml",
217
+ ".prettierrc.yaml",
218
+ ".prettierrc.js",
219
+ ".prettierrc.cjs",
220
+ ".prettierrc.mjs",
221
+ "prettier.config.js",
222
+ "prettier.config.cjs",
223
+ "prettier.config.mjs",
224
+ "prettier.config.ts"
225
+ ],
226
+ // The key being there is the election, even as `false` or `null`.
227
+ jsonFields: [{ file: "package.json", field: "prettier", anyValue: true }]
228
+ },
229
+ rubocop: {
230
+ files: [".rubocop.yml", ".rubocop.yaml"],
231
+ dependency: { names: ["rubocop"], files: ["Gemfile"] }
232
+ },
233
+ // `standard` is the gem standardrb ships as.
234
+ standardrb: { dependency: { names: ["standard"], files: ["Gemfile"] } },
235
+ // The published package is `oxfmt`; the scoped name does not exist on npm,
236
+ // and stays for forward-compat.
237
+ oxfmt: {
238
+ files: ["oxfmt.toml", ".oxfmtrc.json"],
239
+ dependency: {
240
+ names: ["oxfmt", "@oxc-project/oxfmt"],
241
+ files: ["package.json"]
242
+ },
243
+ also: ["vitePlus"]
244
+ },
245
+ // Per https://oxc.rs/docs/guide/usage/linter/config.html, oxlint
246
+ // auto-discovers these names (`oxlint.json` is the legacy one). Nearest
247
+ // config by location, so a package.json never bounds the walk (#3017).
248
+ oxlint: {
249
+ files: [
250
+ ".oxlintrc.json",
251
+ ".oxlintrc.jsonc",
252
+ "oxlint.json",
253
+ "oxlint.config.ts",
254
+ "oxlint.config.mts"
255
+ ],
256
+ also: ["vitePlus"]
257
+ },
258
+ "clang-format": { files: [".clang-format", "_clang-format"] },
259
+ "php-cs-fixer": { files: [".php-cs-fixer.php", ".php-cs-fixer.dist.php"] },
260
+ stylua: { files: ["stylua.toml", ".stylua.toml"] },
261
+ ocamlformat: { files: [".ocamlformat"] },
262
+ // google-java-format has no config file of its own: `.editorconfig` is the
263
+ // common Java project signal, `.google-java-format` the explicit marker.
264
+ "google-java-format": { files: [".google-java-format", ".editorconfig"] },
265
+ cljfmt: { files: [".cljfmt.edn", "cljfmt.edn", ".cljfmt"] },
266
+ "cmake-format": {
267
+ files: [
268
+ ".cmake-format",
269
+ ".cmake-format.yaml",
270
+ ".cmake-format.yml",
271
+ ".cmake-format.json",
272
+ ".cmake-format.py",
273
+ "cmake-format.yaml",
274
+ "cmake-format.yml"
275
+ ]
276
+ },
277
+ // The settings file `Invoke-Formatter -Settings` takes (#1572); the runner
278
+ // hands the found file over, so the hit's `file` is the path.
279
+ psscriptanalyzer: {
280
+ files: ["PSScriptAnalyzerSettings.psd1", "ScriptAnalyzerSettings.psd1"]
281
+ },
282
+ csharpier: {
283
+ files: [
284
+ ".csharpierrc",
285
+ ".csharpierrc.json",
286
+ ".csharpierrc.yaml",
287
+ ".csharpierrc.yml"
288
+ ]
289
+ },
290
+ // Ormolu has no general settings file; `.ormolu` carries fixity declarations.
291
+ ormolu: { files: [".ormolu"] },
292
+ taplo: { files: ["taplo.toml", ".taplo.toml"] },
293
+ // `terraform fmt` is unconfigurable; `.terraform.lock.hcl` (written only by
294
+ // `terraform init`) marks a directory the user set up as a Terraform root.
295
+ terraform: { files: [".terraform.lock.hcl"] },
296
+ swiftformat: { files: [".swiftformat"] },
297
+ // Fantomas reads `.editorconfig` (`fsharp_*` keys) and `.fantomasignore`.
298
+ fantomas: { files: [".fantomasignore", ".editorconfig"] },
299
+ // `.formatter.exs` is what `mix format` reads project config from.
300
+ mixFormat: { files: [".formatter.exs"] },
301
+ // ktfmt has no native config file; these are pi-lens opt-in markers. The
302
+ // other ktfmt evidence (a Spotless block, a Gradle mention) is a value read
303
+ // in `tool-policy.ts`, which climbs `toolConfigDirs`.
304
+ ktfmt: { files: [".ktfmt", ".ktfmt.kts"] }
305
+ };
306
+ function normalizeDistributionName(name) {
307
+ return name.toLowerCase().replace(/[-_.]+/g, "-");
308
+ }
309
+ var REQUIREMENT_NAME = /^\s*([A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?)\s*(?:\[[^\]]*\])?\s*(?:$|[<>=!~;@(,\s])/;
310
+ function requirementName(requirement) {
311
+ const match = REQUIREMENT_NAME.exec(requirement);
312
+ return match ? normalizeDistributionName(match[1] ?? "") : void 0;
313
+ }
314
+ function requirementsNames(content) {
315
+ const names = [];
316
+ for (const raw of content.replace(/^/, "").split(/\r?\n/)) {
317
+ const line = raw.replace(/(^|\s)#.*$/, "").trim();
318
+ if (line === "" || line.startsWith("-"))
319
+ continue;
320
+ const name = requirementName(line);
321
+ if (name)
322
+ names.push(name);
323
+ }
324
+ return names;
325
+ }
326
+ var TOML_TABLE_HEADING = /^[ \t]*\[([^[\]]+)\][ \t]*$/;
327
+ var TOML_KEY_LINE = /^[ \t]*("[^"]+"|'[^']+'|[A-Za-z0-9_.-]+)[ \t]*=[ \t]*(.*)$/;
328
+ function bracketDelta(text) {
329
+ let depth = 0;
330
+ let quote;
331
+ for (const ch of text) {
332
+ if (quote) {
333
+ if (ch === quote)
334
+ quote = void 0;
335
+ } else if (ch === '"' || ch === "'")
336
+ quote = ch;
337
+ else if (ch === "[")
338
+ depth += 1;
339
+ else if (ch === "]")
340
+ depth -= 1;
341
+ }
342
+ return depth;
343
+ }
344
+ function tomlEntries(content) {
345
+ const entries = [];
346
+ const lines = normalizeToml(content).split("\n");
347
+ let table = "";
348
+ for (let i = 0; i < lines.length; i++) {
349
+ const line = lines[i] ?? "";
350
+ if (/^[ \t]*\[\[/.test(line)) {
351
+ table = "";
352
+ continue;
353
+ }
354
+ const heading = TOML_TABLE_HEADING.exec(line);
355
+ if (heading) {
356
+ table = (heading[1] ?? "").replace(/["'\s]/g, "");
357
+ continue;
358
+ }
359
+ const keyLine = TOML_KEY_LINE.exec(line);
360
+ if (!keyLine)
361
+ continue;
362
+ let value = keyLine[2] ?? "";
363
+ let depth = bracketDelta(value);
364
+ while (depth > 0 && i + 1 < lines.length) {
365
+ i += 1;
366
+ value += `
367
+ ${lines[i] ?? ""}`;
368
+ depth += bracketDelta(lines[i] ?? "");
369
+ }
370
+ entries.push({
371
+ table,
372
+ key: (keyLine[1] ?? "").replace(/^["']|["']$/g, ""),
373
+ value
374
+ });
375
+ }
376
+ return entries;
377
+ }
378
+ function quotedStrings(value) {
379
+ return [...value.matchAll(/"((?:[^"\\]|\\.)*)"|'([^']*)'/g)].map((m) => m[1] ?? m[2] ?? "");
380
+ }
381
+ var POETRY_DEPENDENCY_TABLE = /^tool\.poetry(?:\.group\.[^.]+)?\.(?:dev-)?dependencies$/;
382
+ function pyprojectDependencyNames(content) {
383
+ const names = [];
384
+ for (const { table, key, value } of tomlEntries(content)) {
385
+ if (POETRY_DEPENDENCY_TABLE.test(table)) {
386
+ names.push(normalizeDistributionName(key));
387
+ } else if (table === "project" && key === "dependencies" || table === "tool.uv" && key === "dev-dependencies" || table === "project.optional-dependencies" || table === "dependency-groups") {
388
+ for (const text of quotedStrings(value)) {
389
+ const name = requirementName(text);
390
+ if (name)
391
+ names.push(name);
392
+ }
393
+ }
394
+ }
395
+ return names;
396
+ }
397
+ function gemfileNames(content) {
398
+ return content.split(/\r?\n/).flatMap((line) => {
399
+ const match = /^\s*gem\s*\(?\s*["']([^"']+)["']/.exec(line);
400
+ return match?.[1] ? [match[1]] : [];
401
+ });
402
+ }
403
+ function pipfileNames(content) {
404
+ return tomlEntries(content).flatMap(({ table, key }) => table === "packages" || table === "dev-packages" ? [normalizeDistributionName(key)] : []);
405
+ }
406
+ function readPackageJson(file) {
407
+ return readJsonCache(file, (parsed) => typeof parsed === "object" && parsed !== null ? parsed : void 0);
408
+ }
409
+ function packageJsonNames(file) {
410
+ const pkg = readPackageJson(file);
411
+ if (!pkg)
412
+ return [];
413
+ return ["dependencies", "devDependencies"].flatMap((group) => {
414
+ const table = pkg[group];
415
+ return typeof table === "object" && table !== null ? Object.entries(table).flatMap(([name, spec]) => spec ? [name] : []) : [];
416
+ });
417
+ }
418
+ function blankJsComments(source) {
419
+ let out = "";
420
+ let quote;
421
+ for (let i = 0; i < source.length; i++) {
422
+ const ch = source[i] ?? "";
423
+ const next = source[i + 1];
424
+ if (quote) {
425
+ out += ch;
426
+ if (ch === "\\")
427
+ out += source[++i] ?? "";
428
+ else if (ch === quote)
429
+ quote = void 0;
430
+ } else if (ch === '"' || ch === "'" || ch === "`") {
431
+ quote = ch;
432
+ out += ch;
433
+ } else if (ch === "/" && next === "/") {
434
+ while (i < source.length && source[i] !== "\n")
435
+ i++;
436
+ out += "\n";
437
+ } else if (ch === "/" && next === "*") {
438
+ const end = source.indexOf("*/", i + 2);
439
+ i = end === -1 ? source.length : end + 1;
440
+ out += " ";
441
+ } else
442
+ out += ch;
443
+ }
444
+ return out;
445
+ }
446
+ function importsModule(source, modules) {
447
+ const alternation = modules.map((module) => module.replace(/[.*+?^${}()|[\]\\/-]/g, "\\$&")).join("|");
448
+ return new RegExp(String.raw`(?:\bfrom|\bimport|\brequire)\s*\(?\s*["'](?:${alternation})(?:/[^"']*)?["']`).test(blankJsComments(source));
449
+ }
450
+ function dependencyNames(file, candidate) {
451
+ if (file === "package.json")
452
+ return packageJsonNames(candidate);
453
+ const content = readFileContent(candidate);
454
+ if (content === void 0)
455
+ return [];
456
+ switch (file) {
457
+ case "requirements.txt":
458
+ return requirementsNames(content);
459
+ case "Pipfile":
460
+ return pipfileNames(content);
461
+ case "pyproject.toml":
462
+ return pyprojectDependencyNames(content);
463
+ case "Gemfile":
464
+ return gemfileNames(content);
465
+ }
466
+ }
467
+ function hasIniSection(content, section) {
468
+ return new RegExp(`^[ \\t]*\\[${section}\\][ \\t]*(?:[#;].*)?$`, "m").test(content);
469
+ }
470
+ function findInDir(spec, dir) {
471
+ for (const name of spec.files ?? []) {
472
+ const candidate = path.join(dir, name);
473
+ if (fs2.existsSync(candidate)) {
474
+ return { file: candidate, dir, source: "file" };
475
+ }
476
+ }
477
+ for (const { file, table } of spec.tomlTables ?? []) {
478
+ const candidate = path.join(dir, file);
479
+ const content = readFileContent(candidate);
480
+ if (content !== void 0 && hasTomlTable(content, table)) {
481
+ return { file: candidate, dir, source: "toml-table" };
482
+ }
483
+ }
484
+ for (const { file, section } of spec.iniSections ?? []) {
485
+ const candidate = path.join(dir, file);
486
+ const content = readFileContent(candidate);
487
+ if (content !== void 0 && hasIniSection(content, section)) {
488
+ return { file: candidate, dir, source: "ini-section" };
489
+ }
490
+ }
491
+ for (const { file, field, anyValue } of spec.jsonFields ?? []) {
492
+ const candidate = path.join(dir, file);
493
+ const pkg = readPackageJson(candidate);
494
+ if (anyValue ? pkg && Object.hasOwn(pkg, field) : pkg?.[field]) {
495
+ return { file: candidate, dir, source: "json-field" };
496
+ }
497
+ }
498
+ if (spec.dependency) {
499
+ for (const file of spec.dependency.files) {
500
+ const wanted = spec.dependency.names;
501
+ const candidate = path.join(dir, file);
502
+ if (dependencyNames(file, candidate).some((name) => wanted.includes(name))) {
503
+ return { file: candidate, dir, source: "dependency" };
504
+ }
505
+ }
506
+ }
507
+ for (const file of spec.sourceImports?.files ?? []) {
508
+ const candidate = path.join(dir, file);
509
+ const content = readFileContent(candidate);
510
+ if (content !== void 0 && importsModule(content, spec.sourceImports?.modules ?? [])) {
511
+ return { file: candidate, dir, source: "import" };
512
+ }
513
+ }
514
+ return void 0;
515
+ }
516
+ function findToolConfig(tool, startDir, options = {}) {
517
+ const spec = TOOL_CONFIG_SPECS[tool];
518
+ const own = climbForSpec(spec, startDir, options);
519
+ if (own)
520
+ return own;
521
+ for (const other of spec.also ?? []) {
522
+ const hit = findToolConfig(other, startDir, options);
523
+ if (hit)
524
+ return hit;
525
+ }
526
+ return void 0;
527
+ }
528
+ function* toolConfigDirs(startDir, options = {}) {
529
+ const home = realpathOrResolve(options.homeDir ?? os.homedir());
530
+ const ceiling = options.ceiling === void 0 ? void 0 : realpathOrResolve(options.ceiling);
531
+ for (const dir of walkUpDirs(startDir)) {
532
+ yield dir;
533
+ if (pathsEqual(dir, home))
534
+ return;
535
+ if (ceiling !== void 0 && pathsEqual(dir, ceiling))
536
+ return;
537
+ }
538
+ }
539
+ function climbForSpec(spec, startDir, options) {
540
+ if (spec.exactDir)
541
+ return findInDir(spec, realpathOrResolve(startDir));
542
+ let pastPackage = false;
543
+ for (const dir of toolConfigDirs(startDir, options)) {
544
+ const hit = findInDir(spec, dir) ?? (spec.withinNearestPackage && !pastPackage ? findInDir(spec.withinNearestPackage, dir) : void 0);
545
+ if (hit)
546
+ return hit;
547
+ if (fs2.existsSync(path.join(dir, "package.json")))
548
+ pastPackage = true;
549
+ }
550
+ return void 0;
551
+ }
552
+ function hasToolConfig(tool, startDir, options = {}) {
553
+ return findToolConfig(tool, startDir, options) !== void 0;
554
+ }
555
+
556
+ // dist/clients/tool-cwd.js
557
+ import * as os2 from "node:os";
558
+ import { existsSync as existsSync2, readdirSync } from "node:fs";
559
+ import * as path2 from "node:path";
560
+ import { basename } from "node:path";
561
+ var FORMATTER_MARKERS = {
562
+ biome: ["biome.json", "biome.jsonc", "package.json", ".gitignore"],
563
+ prettier: [
564
+ ".prettierrc",
565
+ ".prettierrc.json",
566
+ ".prettierrc.yaml",
567
+ ".prettierrc.yml",
568
+ ".prettierrc.js",
569
+ ".prettierrc.cjs",
570
+ ".prettierrc.mjs",
571
+ "prettier.config.js",
572
+ "prettier.config.cjs",
573
+ "prettier.config.mjs",
574
+ ".prettierignore",
575
+ "package.json",
576
+ ".gitignore"
577
+ ],
578
+ ruff: ["pyproject.toml", "ruff.toml", ".ruff.toml", ".gitignore"],
579
+ black: ["pyproject.toml", "black.toml", ".black", ".gitignore"],
580
+ "php-cs-fixer": [".php-cs-fixer.php", ".php-cs-fixer.dist.php", ".gitignore"],
581
+ sqlfluff: [".sqlfluff", "pyproject.toml", "setup.cfg", ".gitignore"],
582
+ oxfmt: [
583
+ "oxfmt.toml",
584
+ ".oxfmtrc.json",
585
+ "vite-plus.json",
586
+ "package.json",
587
+ ".gitignore"
588
+ ],
589
+ rustfmt: ["rustfmt.toml", ".rustfmt.toml", "Cargo.toml", ".gitignore"],
590
+ rubocop: [".rubocop.yml", ".rubocop.yaml", ".gitignore"],
591
+ standardrb: [".standard.yml", ".standard.yaml", ".gitignore"],
592
+ "clang-format": [".clang-format", "_clang-format", ".gitignore"],
593
+ stylua: ["stylua.toml", ".stylua.toml", ".gitignore"],
594
+ ocamlformat: [".ocamlformat", ".gitignore"],
595
+ "google-java-format": [".google-java-format", ".editorconfig", ".gitignore"],
596
+ cljfmt: [".cljfmt.edn", "cljfmt.edn", ".cljfmt", ".gitignore"],
597
+ "cmake-format": [
598
+ ".cmake-format",
599
+ ".cmake-format.yaml",
600
+ ".cmake-format.yml",
601
+ ".cmake-format.json",
602
+ ".cmake-format.py",
603
+ "cmake-format.yaml",
604
+ "cmake-format.yml",
605
+ ".editorconfig",
606
+ ".gitignore"
607
+ ],
608
+ "psscriptanalyzer-format": [
609
+ "PSScriptAnalyzerSettings.psd1",
610
+ "ScriptAnalyzerSettings.psd1",
611
+ ".gitignore"
612
+ ],
613
+ csharpier: [
614
+ ".csharpierrc",
615
+ ".csharpierrc.json",
616
+ ".csharpierrc.yaml",
617
+ ".csharpierrc.yml",
618
+ ".gitignore"
619
+ ],
620
+ ormolu: [".ormolu", ".gitignore"],
621
+ taplo: ["taplo.toml", ".taplo.toml", ".gitignore"],
622
+ terraform: [".terraform.lock.hcl", ".gitignore"],
623
+ swiftformat: [".swiftformat", ".gitignore"],
624
+ fantomas: [".fantomasignore", ".editorconfig", ".gitignore"],
625
+ mix: [".formatter.exs", ".gitignore"],
626
+ shfmt: [".editorconfig", ".gitignore"],
627
+ ktlint: [".editorconfig", ".gitignore"],
628
+ ktfmt: [
629
+ ".editorconfig",
630
+ ".ktfmt",
631
+ ".ktfmt.kts",
632
+ "build.gradle",
633
+ "build.gradle.kts",
634
+ "settings.gradle",
635
+ "settings.gradle.kts",
636
+ ".gitignore"
637
+ ],
638
+ typstyle: [".gitignore"]
639
+ };
640
+ var toolCwdGeneration = createGenerationSource("tool-cwd");
641
+ var logged = createGenerationMap("tool-cwd-resolution-log");
642
+ function _toolCwdEphemeralKey(parts) {
643
+ return parts.map(normalizeEphemeralMapKey).join("\0");
644
+ }
645
+ function syncGeneration() {
646
+ if (toolCwdGeneration.current() === getDegradationLedgerGeneration())
647
+ return;
648
+ logged.clear();
649
+ while (toolCwdGeneration.current() < getDegradationLedgerGeneration()) {
650
+ toolCwdGeneration.bump();
651
+ }
652
+ }
653
+ function walkMarkerRoot(startDir, markers, homeDir) {
654
+ for (const current of walkUpDirs(startDir, { homeDir, maxDepth: 64 })) {
655
+ for (const marker of markers) {
656
+ const slash = toPosix(marker).lastIndexOf("/");
657
+ const parent = slash >= 0 ? marker.slice(0, slash) : "";
658
+ const basename2 = slash >= 0 ? marker.slice(slash + 1) : marker;
659
+ const target = parent ? path2.join(current, ...parent.split("/").filter(Boolean)) : current;
660
+ let found = false;
661
+ if (basename2.includes("*")) {
662
+ try {
663
+ found = readdirSync(target, { withFileTypes: true }).some((entry) => (entry.isFile() || entry.isSymbolicLink()) && nameMatchesMarkerGlob(entry.name, basename2));
664
+ } catch {
665
+ found = false;
666
+ }
667
+ } else {
668
+ found = existsSync2(path2.join(target, basename2));
669
+ }
670
+ if (found)
671
+ return { root: current, marker };
672
+ }
673
+ }
674
+ return { root: null };
675
+ }
676
+ function findMarkerRoot(startDir, markers, homeDir) {
677
+ syncGeneration();
678
+ return walkMarkerRoot(startDir, markers, homeDir);
679
+ }
680
+ function markersFor(kind, tool, file, ctx) {
681
+ if (kind === "lsp")
682
+ return ctx.rootMarkers ?? [];
683
+ if (kind === "runner")
684
+ return ctx.rootMarkers ?? rootMarkersForFile(file, tool);
685
+ return FORMATTER_MARKERS[tool] ?? [".gitignore"];
686
+ }
687
+ function emitResolution(kind, tool, cwd, reason) {
688
+ syncGeneration();
689
+ const key = _toolCwdEphemeralKey([kind, tool, cwd, reason]);
690
+ if (logged.current(key) !== 0)
691
+ return;
692
+ logged.bump(key);
693
+ logExtension({
694
+ subsystem: "tool-cwd",
695
+ level: "debug",
696
+ message: `cwd ${kind} ${tool} cwd=${cwd} reason=${reason}`
697
+ });
698
+ }
699
+ function logRunnerAdvisoryOnce(ctx, tool, root, message) {
700
+ syncGeneration();
701
+ const key = _toolCwdEphemeralKey(["runner-advisory", tool, root]);
702
+ if (logged.current(key) !== 0)
703
+ return;
704
+ logged.bump(key);
705
+ ctx.log(message, "debug");
706
+ }
707
+ var CONFIG_ANCHORED_RUNNERS = [
708
+ "oxlint",
709
+ "eslint"
710
+ ];
711
+ function configAnchorOf(tool, fromDir, options) {
712
+ const anchored = CONFIG_ANCHORED_RUNNERS.find((id) => id === tool);
713
+ return anchored ? findToolConfig(anchored, fromDir, options) : void 0;
714
+ }
715
+ function resolveToolCwd(kind, tool, file, ctx) {
716
+ if (ctx.serverRoot) {
717
+ const rootPath = isWindowsPath(ctx.serverRoot) ? path2.win32 : path2;
718
+ const serverRoot = rootPath.resolve(ctx.serverRoot);
719
+ if (!ctx.suppressTelemetry)
720
+ emitResolution(kind, tool, serverRoot, "server-root");
721
+ return { cwd: serverRoot };
722
+ }
723
+ const dispatchRoot = path2.resolve(ctx.cwd ?? process.cwd());
724
+ const absoluteFile = realpathOrResolve(file);
725
+ const fileDir = path2.dirname(absoluteFile);
726
+ const homeDir = ctx.homeDir ?? os2.homedir();
727
+ const homeCeiling = realpathOrResolve(homeDir);
728
+ const insideDispatch = isUnderDir(absoluteFile, dispatchRoot);
729
+ const markers = markersFor(kind, tool, absoluteFile, ctx);
730
+ const markerResult = markers.length ? findMarkerRoot(fileDir, markers, ctx.allowHomeMarker ? path2.parse(homeCeiling).root : homeCeiling) : { root: null };
731
+ const markerRoot = markerResult.root;
732
+ if (markerRoot && (insideDispatch ? isUnderDir(markerRoot, dispatchRoot) : true)) {
733
+ const anchor = kind === "runner" && !ctx.rootMarkers ? configAnchorOf(tool, markerRoot, {
734
+ homeDir,
735
+ ...insideDispatch ? { ceiling: dispatchRoot } : {}
736
+ }) : void 0;
737
+ if (anchor && !pathsEqual(anchor.dir, markerRoot) && !pathsEqual(anchor.dir, homeCeiling)) {
738
+ const anchorMarker = basename(anchor.file);
739
+ if (!ctx.suppressTelemetry)
740
+ emitResolution(kind, tool, anchor.dir, `marker:${anchorMarker}`);
741
+ return { cwd: anchor.dir, marker: anchorMarker, packageDir: markerRoot };
742
+ }
743
+ const finalReason = `marker:${markerResult.marker ?? markers[0]}`;
744
+ if (!ctx.suppressTelemetry)
745
+ emitResolution(kind, tool, markerRoot, finalReason);
746
+ return {
747
+ cwd: markerRoot,
748
+ ...markerResult.marker !== void 0 ? { marker: markerResult.marker } : {}
749
+ };
750
+ }
751
+ const memo = ctx.toolCwdMemo;
752
+ if (memo && memo.gitRoot === void 0) {
753
+ const gitResult = findMarkerRoot(fileDir, [".git"], homeCeiling);
754
+ memo.gitRoot = gitResult.root && isRealGitMarker(path2.join(gitResult.root, ".git")) ? gitResult.root : null;
755
+ }
756
+ const gitRoot = memo && memo.gitRoot !== void 0 ? memo.gitRoot : (() => {
757
+ const gitResult = findMarkerRoot(fileDir, [".git"], homeCeiling);
758
+ return gitResult.root && isRealGitMarker(path2.join(gitResult.root, ".git")) ? gitResult.root : null;
759
+ })();
760
+ if (gitRoot && (insideDispatch ? isUnderDir(gitRoot, dispatchRoot) : true)) {
761
+ if (!ctx.suppressTelemetry)
762
+ emitResolution(kind, tool, gitRoot, "git-root");
763
+ return { cwd: gitRoot, marker: ".git" };
764
+ }
765
+ if (insideDispatch) {
766
+ if (kind === "formatter") {
767
+ if (!ctx.suppressTelemetry)
768
+ emitResolution(kind, tool, fileDir, "file-dir-fallback");
769
+ if (!ctx.suppressTelemetry && !isUnderDir(fileDir, homeDir)) {
770
+ recordDegradationOnce({
771
+ kind: "tool-cwd-resolution",
772
+ subject: tool,
773
+ reason: `${kind}:home-cap:${absoluteFile}`
774
+ });
775
+ }
776
+ return { cwd: fileDir };
777
+ }
778
+ if (!ctx.suppressTelemetry)
779
+ emitResolution(kind, tool, dispatchRoot, "dispatch-root");
780
+ return { cwd: dispatchRoot };
781
+ }
782
+ const reason = isUnderDir(fileDir, homeDir) ? "file-dir-fallback" : "home-cap";
783
+ const fallback = isUnderDir(fileDir, homeDir) ? fileDir : homeDir;
784
+ if (!ctx.suppressTelemetry)
785
+ recordDegradationOnce({
786
+ kind: "tool-cwd-resolution",
787
+ subject: tool,
788
+ reason: `${kind}:${reason}:${absoluteFile}`
789
+ });
790
+ if (!ctx.suppressTelemetry)
791
+ emitResolution(kind, tool, fallback, reason);
792
+ return { cwd: fallback };
793
+ }
794
+ function resolveRunnerCwd(ctx, tool) {
795
+ return resolveToolCwd("runner", tool, ctx.filePath, ctx).cwd;
796
+ }
797
+ function resolveRunnerCwdWithReason(ctx, tool) {
798
+ return resolveToolCwd("runner", tool, ctx.filePath, ctx);
799
+ }
800
+
801
+ export {
802
+ readFileContent,
803
+ findToolConfig,
804
+ toolConfigDirs,
805
+ hasToolConfig,
806
+ logRunnerAdvisoryOnce,
807
+ resolveToolCwd,
808
+ resolveRunnerCwd,
809
+ resolveRunnerCwdWithReason
810
+ };