@herbertgao/pi-extensions 2026.9.0 → 2026.9.1

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 (293) hide show
  1. package/node_modules/@czottmann/pi-automode/CHANGELOG.md +13 -1
  2. package/node_modules/@czottmann/pi-automode/README.md +20 -0
  3. package/node_modules/@czottmann/pi-automode/docs/GLOSSARY.md +1 -1
  4. package/node_modules/@czottmann/pi-automode/docs/automode-classifier-flow.md +2 -1
  5. package/node_modules/@czottmann/pi-automode/docs/defaults.md +3 -2
  6. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/classifier.ts +38 -2
  7. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/constants.ts +5 -3
  8. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/extension.ts +11 -3
  9. package/node_modules/@czottmann/pi-automode/package.json +1 -1
  10. package/node_modules/@pi-plugins/fast-mode/README.md +5 -3
  11. package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts.map +1 -1
  12. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +20 -55
  13. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -1
  14. package/node_modules/@pi-plugins/fast-mode/package.json +1 -1
  15. package/node_modules/pi-lens/CHANGELOG.md +988 -0
  16. package/node_modules/pi-lens/README.md +3 -0
  17. package/node_modules/pi-lens/config/biome/core.jsonc +11 -2
  18. package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +13 -1
  19. package/node_modules/pi-lens/dist/clients/actionable-warnings-logger.js +2 -2
  20. package/node_modules/pi-lens/dist/clients/actionable-warnings.js +927 -80
  21. package/node_modules/pi-lens/dist/clients/agent-behavior-client.js +13 -4
  22. package/node_modules/pi-lens/dist/clients/ast-grep-client.js +123 -3
  23. package/node_modules/pi-lens/dist/clients/ast-grep-rule-manager.js +60 -5
  24. package/node_modules/pi-lens/dist/clients/ast-grep-tool-logger.js +2 -2
  25. package/node_modules/pi-lens/dist/clients/bash-file-access.js +1 -3
  26. package/node_modules/pi-lens/dist/clients/biome-client.js +9 -2
  27. package/node_modules/pi-lens/dist/clients/blocker-freshness.js +14 -0
  28. package/node_modules/pi-lens/dist/clients/bootstrap.js +509 -73
  29. package/node_modules/pi-lens/dist/clients/bounded-cache.js +152 -12
  30. package/node_modules/pi-lens/dist/clients/bounded-telemetry.js +59 -4
  31. package/node_modules/pi-lens/dist/clients/bundled-resource-health.js +113 -0
  32. package/node_modules/pi-lens/dist/clients/bus-events-logger.js +2 -2
  33. package/node_modules/pi-lens/dist/clients/cache/rule-cache.js +31 -4
  34. package/node_modules/pi-lens/dist/clients/cache-manager.js +105 -6
  35. package/node_modules/pi-lens/dist/clients/cache-observability.js +44 -18
  36. package/node_modules/pi-lens/dist/clients/cargo-manifest.js +422 -0
  37. package/node_modules/pi-lens/dist/clients/cascade-logger.js +2 -2
  38. package/node_modules/pi-lens/dist/clients/code-quality-warnings.js +13 -3
  39. package/node_modules/pi-lens/dist/clients/complexity-client.js +16 -5
  40. package/node_modules/pi-lens/dist/clients/config-core/deny.js +221 -0
  41. package/node_modules/pi-lens/dist/clients/config-core/index.js +47 -0
  42. package/node_modules/pi-lens/dist/clients/config-core/merge.js +357 -0
  43. package/node_modules/pi-lens/dist/clients/config-core/normalize.js +340 -0
  44. package/node_modules/pi-lens/dist/clients/config-core/process-spec.js +248 -0
  45. package/node_modules/pi-lens/dist/clients/config-core/provenance.js +171 -0
  46. package/node_modules/pi-lens/dist/clients/config-core/records.js +218 -0
  47. package/node_modules/pi-lens/dist/clients/config-core/resolve.js +125 -0
  48. package/node_modules/pi-lens/dist/clients/config-core/safe-object.js +78 -0
  49. package/node_modules/pi-lens/dist/clients/config-core/schema.js +167 -0
  50. package/node_modules/pi-lens/dist/clients/config-diagnostic-codes.js +281 -0
  51. package/node_modules/pi-lens/dist/clients/config-locations.js +160 -0
  52. package/node_modules/pi-lens/dist/clients/config-resolve.js +789 -0
  53. package/node_modules/pi-lens/dist/clients/config-schema.js +197 -0
  54. package/node_modules/pi-lens/dist/clients/config-warn.js +407 -0
  55. package/node_modules/pi-lens/dist/clients/dead-code-client.js +19 -14
  56. package/node_modules/pi-lens/dist/clients/dead-code-logger.js +2 -2
  57. package/node_modules/pi-lens/dist/clients/deadline-utils.js +178 -0
  58. package/node_modules/pi-lens/dist/clients/debug-handles.js +2 -2
  59. package/node_modules/pi-lens/dist/clients/debug-heap.js +3 -3
  60. package/node_modules/pi-lens/dist/clients/deferred-lsp-work.js +106 -0
  61. package/node_modules/pi-lens/dist/clients/degradation-ledger.js +113 -7
  62. package/node_modules/pi-lens/dist/clients/dependency-checker.js +8 -19
  63. package/node_modules/pi-lens/dist/clients/diagnostic-line-freshness.js +12 -9
  64. package/node_modules/pi-lens/dist/clients/diagnostic-logger.js +14 -4
  65. package/node_modules/pi-lens/dist/clients/dispatch/dispatcher.js +162 -18
  66. package/node_modules/pi-lens/dist/clients/dispatch/fact-store.js +97 -0
  67. package/node_modules/pi-lens/dist/clients/dispatch/integration.js +9 -7
  68. package/node_modules/pi-lens/dist/clients/dispatch/runners/actionlint.js +0 -1
  69. package/node_modules/pi-lens/dist/clients/dispatch/runners/ast-grep-napi.js +380 -26
  70. package/node_modules/pi-lens/dist/clients/dispatch/runners/biome-check.js +0 -1
  71. package/node_modules/pi-lens/dist/clients/dispatch/runners/cpp-check.js +0 -1
  72. package/node_modules/pi-lens/dist/clients/dispatch/runners/credo.js +0 -1
  73. package/node_modules/pi-lens/dist/clients/dispatch/runners/cue-vet.js +0 -1
  74. package/node_modules/pi-lens/dist/clients/dispatch/runners/dart-analyze.js +0 -1
  75. package/node_modules/pi-lens/dist/clients/dispatch/runners/detekt.js +0 -1
  76. package/node_modules/pi-lens/dist/clients/dispatch/runners/dotnet-build.js +0 -1
  77. package/node_modules/pi-lens/dist/clients/dispatch/runners/elixir-check.js +0 -1
  78. package/node_modules/pi-lens/dist/clients/dispatch/runners/eslint.js +0 -1
  79. package/node_modules/pi-lens/dist/clients/dispatch/runners/fact-rules.js +0 -1
  80. package/node_modules/pi-lens/dist/clients/dispatch/runners/fish-indent.js +0 -1
  81. package/node_modules/pi-lens/dist/clients/dispatch/runners/gleam-check.js +0 -1
  82. package/node_modules/pi-lens/dist/clients/dispatch/runners/go-vet.js +1 -3
  83. package/node_modules/pi-lens/dist/clients/dispatch/runners/golangci-lint.js +0 -1
  84. package/node_modules/pi-lens/dist/clients/dispatch/runners/hadolint.js +0 -1
  85. package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-lint.js +0 -1
  86. package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-render.js +0 -1
  87. package/node_modules/pi-lens/dist/clients/dispatch/runners/htmlhint.js +0 -1
  88. package/node_modules/pi-lens/dist/clients/dispatch/runners/javac.js +0 -1
  89. package/node_modules/pi-lens/dist/clients/dispatch/runners/ktlint.js +0 -1
  90. package/node_modules/pi-lens/dist/clients/dispatch/runners/lsp.js +0 -1
  91. package/node_modules/pi-lens/dist/clients/dispatch/runners/markdownlint.js +0 -1
  92. package/node_modules/pi-lens/dist/clients/dispatch/runners/mypy.js +0 -1
  93. package/node_modules/pi-lens/dist/clients/dispatch/runners/oxlint.js +13 -18
  94. package/node_modules/pi-lens/dist/clients/dispatch/runners/php-lint.js +0 -1
  95. package/node_modules/pi-lens/dist/clients/dispatch/runners/phpstan.js +0 -1
  96. package/node_modules/pi-lens/dist/clients/dispatch/runners/prisma-validate.js +0 -1
  97. package/node_modules/pi-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +0 -1
  98. package/node_modules/pi-lens/dist/clients/dispatch/runners/pyright.js +7 -4
  99. package/node_modules/pi-lens/dist/clients/dispatch/runners/rubocop.js +0 -1
  100. package/node_modules/pi-lens/dist/clients/dispatch/runners/ruff.js +0 -1
  101. package/node_modules/pi-lens/dist/clients/dispatch/runners/rust-clippy.js +1 -3
  102. package/node_modules/pi-lens/dist/clients/dispatch/runners/shellcheck.js +0 -1
  103. package/node_modules/pi-lens/dist/clients/dispatch/runners/shfmt.js +0 -1
  104. package/node_modules/pi-lens/dist/clients/dispatch/runners/spellcheck.js +0 -1
  105. package/node_modules/pi-lens/dist/clients/dispatch/runners/spotbugs.js +0 -1
  106. package/node_modules/pi-lens/dist/clients/dispatch/runners/sqlfluff.js +0 -1
  107. package/node_modules/pi-lens/dist/clients/dispatch/runners/stylelint.js +0 -1
  108. package/node_modules/pi-lens/dist/clients/dispatch/runners/swiftlint.js +0 -1
  109. package/node_modules/pi-lens/dist/clients/dispatch/runners/taplo.js +0 -1
  110. package/node_modules/pi-lens/dist/clients/dispatch/runners/terragrunt.js +0 -1
  111. package/node_modules/pi-lens/dist/clients/dispatch/runners/tflint.js +0 -1
  112. package/node_modules/pi-lens/dist/clients/dispatch/runners/tree-sitter.js +0 -1
  113. package/node_modules/pi-lens/dist/clients/dispatch/runners/trivy-config.js +0 -1
  114. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/availability-policy.js +3 -0
  115. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +3 -4
  116. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +194 -80
  117. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +84 -15
  118. package/node_modules/pi-lens/dist/clients/dispatch/runners/vale.js +0 -1
  119. package/node_modules/pi-lens/dist/clients/dispatch/runners/yamllint.js +0 -1
  120. package/node_modules/pi-lens/dist/clients/dispatch/runners/zig-check.js +0 -1
  121. package/node_modules/pi-lens/dist/clients/disposition-logger.js +3 -3
  122. package/node_modules/pi-lens/dist/clients/effective-config.js +403 -0
  123. package/node_modules/pi-lens/dist/clients/error-class.js +23 -0
  124. package/node_modules/pi-lens/dist/clients/event-loop-hold.js +274 -0
  125. package/node_modules/pi-lens/dist/clients/extension-log.js +2 -2
  126. package/node_modules/pi-lens/dist/clients/feature-hints.js +2 -1
  127. package/node_modules/pi-lens/dist/clients/file-time.js +6 -1
  128. package/node_modules/pi-lens/dist/clients/file-utils.js +112 -9
  129. package/node_modules/pi-lens/dist/clients/finding-delivery-gate.js +50 -13
  130. package/node_modules/pi-lens/dist/clients/format-service.js +6 -1
  131. package/node_modules/pi-lens/dist/clients/formatters.js +276 -102
  132. package/node_modules/pi-lens/dist/clients/freshness-cadence.js +17 -0
  133. package/node_modules/pi-lens/dist/clients/generated-artifacts.js +114 -19
  134. package/node_modules/pi-lens/dist/clients/generation-guard.js +4 -9
  135. package/node_modules/pi-lens/dist/clients/git-guard.js +1 -1
  136. package/node_modules/pi-lens/dist/clients/go-client.js +39 -0
  137. package/node_modules/pi-lens/dist/clients/gradle-ktfmt-style.js +252 -0
  138. package/node_modules/pi-lens/dist/clients/hashline-anchor.js +424 -0
  139. package/node_modules/pi-lens/dist/clients/hook-budgets.js +76 -0
  140. package/node_modules/pi-lens/dist/clients/host-edit-normalize.js +5 -2
  141. package/node_modules/pi-lens/dist/clients/host-ports.js +1 -1
  142. package/node_modules/pi-lens/dist/clients/installer/index.js +71 -52
  143. package/node_modules/pi-lens/dist/clients/instance-reaper.js +104 -230
  144. package/node_modules/pi-lens/dist/clients/instance-registry.js +6 -3
  145. package/node_modules/pi-lens/dist/clients/language-registry.js +595 -0
  146. package/node_modules/pi-lens/dist/clients/latency-logger.js +160 -2
  147. package/node_modules/pi-lens/dist/clients/ledger-bounds.js +13 -0
  148. package/node_modules/pi-lens/dist/clients/lens-config.js +141 -30
  149. package/node_modules/pi-lens/dist/clients/lens-engine.js +30 -37
  150. package/node_modules/pi-lens/dist/clients/lens-flag-registry.js +59 -6
  151. package/node_modules/pi-lens/dist/clients/log-cleanup.js +2 -2
  152. package/node_modules/pi-lens/dist/clients/lsp/aggregation.js +3 -1
  153. package/node_modules/pi-lens/dist/clients/lsp/client.js +168 -30
  154. package/node_modules/pi-lens/dist/clients/lsp/config.js +483 -158
  155. package/node_modules/pi-lens/dist/clients/lsp/diagnostic-binding.js +1 -1
  156. package/node_modules/pi-lens/dist/clients/lsp/edits.js +15 -2
  157. package/node_modules/pi-lens/dist/clients/lsp/index.js +676 -71
  158. package/node_modules/pi-lens/dist/clients/lsp/language.js +18 -169
  159. package/node_modules/pi-lens/dist/clients/lsp/launch.js +2 -1
  160. package/node_modules/pi-lens/dist/clients/lsp/pending-aux-coverage.js +5 -16
  161. package/node_modules/pi-lens/dist/clients/lsp/server.js +284 -147
  162. package/node_modules/pi-lens/dist/clients/lsp/session-roots.js +116 -23
  163. package/node_modules/pi-lens/dist/clients/lsp/spawn-history.js +2 -7
  164. package/node_modules/pi-lens/dist/clients/lsp/tsserver-sync.js +9 -2
  165. package/node_modules/pi-lens/dist/clients/lsp/workspace-diagnostics-cache.js +1 -1
  166. package/node_modules/pi-lens/dist/clients/lsp-mutation.js +163 -21
  167. package/node_modules/pi-lens/dist/clients/map-with-concurrency.js +36 -0
  168. package/node_modules/pi-lens/dist/clients/mcp/analyze.js +33 -4
  169. package/node_modules/pi-lens/dist/clients/mcp/session.js +5 -16
  170. package/node_modules/pi-lens/dist/clients/memory-sampler.js +8 -3
  171. package/node_modules/pi-lens/dist/clients/middle-man-analysis.js +2 -4
  172. package/node_modules/pi-lens/dist/clients/module-report.js +20 -45
  173. package/node_modules/pi-lens/dist/clients/mutating-tool.js +651 -0
  174. package/node_modules/pi-lens/dist/clients/mutation-attribution.js +368 -0
  175. package/node_modules/pi-lens/dist/clients/mutation-bridge.js +240 -0
  176. package/node_modules/pi-lens/dist/clients/ndjson-logger.js +247 -20
  177. package/node_modules/pi-lens/dist/clients/observed-mutation-sources.js +101 -0
  178. package/node_modules/pi-lens/dist/clients/observed-mutation.js +1215 -0
  179. package/node_modules/pi-lens/dist/clients/opaque-mutation-scan.js +68 -22
  180. package/node_modules/pi-lens/dist/clients/opengrep-config.js +4 -0
  181. package/node_modules/pi-lens/dist/clients/package-manager.js +195 -26
  182. package/node_modules/pi-lens/dist/clients/partial-edit-apply.js +359 -80
  183. package/node_modules/pi-lens/dist/clients/path-attribution-telemetry.js +23 -7
  184. package/node_modules/pi-lens/dist/clients/path-keyed-map.js +21 -2
  185. package/node_modules/pi-lens/dist/clients/path-utils.js +428 -13
  186. package/node_modules/pi-lens/dist/clients/persist-debounce.js +8 -1
  187. package/node_modules/pi-lens/dist/clients/php-cs-fixer-config.js +114 -0
  188. package/node_modules/pi-lens/dist/clients/pipeline.js +77 -16
  189. package/node_modules/pi-lens/dist/clients/probe-home-state.js +228 -0
  190. package/node_modules/pi-lens/dist/clients/process-bridge.js +66 -0
  191. package/node_modules/pi-lens/dist/clients/process-snapshot.js +68 -0
  192. package/node_modules/pi-lens/dist/clients/project-diagnostics/fresh-fetch.js +4 -3
  193. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +27 -3
  194. package/node_modules/pi-lens/dist/clients/project-diagnostics/scanner.js +51 -20
  195. package/node_modules/pi-lens/dist/clients/project-lens-config.js +393 -122
  196. package/node_modules/pi-lens/dist/clients/project-snapshot.js +52 -24
  197. package/node_modules/pi-lens/dist/clients/python-environment.js +217 -0
  198. package/node_modules/pi-lens/dist/clients/python-provenance.js +639 -0
  199. package/node_modules/pi-lens/dist/clients/quiet-window.js +6 -1
  200. package/node_modules/pi-lens/dist/clients/read-bridge.js +13 -21
  201. package/node_modules/pi-lens/dist/clients/read-expansion.js +9 -46
  202. package/node_modules/pi-lens/dist/clients/read-guard-logger.js +15 -4
  203. package/node_modules/pi-lens/dist/clients/read-guard-tool-lines.js +364 -212
  204. package/node_modules/pi-lens/dist/clients/read-guard.js +21 -0
  205. package/node_modules/pi-lens/dist/clients/resource-sampler.js +195 -96
  206. package/node_modules/pi-lens/dist/clients/review-graph/builder.js +152 -109
  207. package/node_modules/pi-lens/dist/clients/review-graph/service.js +55 -3
  208. package/node_modules/pi-lens/dist/clients/review-graph/shared-extraction-ir.js +7 -15
  209. package/node_modules/pi-lens/dist/clients/review-graph/workspace-modules.js +10 -74
  210. package/node_modules/pi-lens/dist/clients/review-graph-logger.js +9 -3
  211. package/node_modules/pi-lens/dist/clients/runtime-agent-end.js +18 -2
  212. package/node_modules/pi-lens/dist/clients/runtime-context.js +49 -16
  213. package/node_modules/pi-lens/dist/clients/runtime-coordinator.js +25 -6
  214. package/node_modules/pi-lens/dist/clients/runtime-session.js +139 -22
  215. package/node_modules/pi-lens/dist/clients/runtime-tool-call.js +168 -35
  216. package/node_modules/pi-lens/dist/clients/runtime-tool-result.js +797 -243
  217. package/node_modules/pi-lens/dist/clients/runtime-turn.js +1028 -53
  218. package/node_modules/pi-lens/dist/clients/rust-client.js +31 -0
  219. package/node_modules/pi-lens/dist/clients/safe-spawn.js +33 -10
  220. package/node_modules/pi-lens/dist/clients/sanitize.js +7 -1
  221. package/node_modules/pi-lens/dist/clients/scratch-tree-policy.js +1 -3
  222. package/node_modules/pi-lens/dist/clients/security-scan-client.js +3 -0
  223. package/node_modules/pi-lens/dist/clients/session-lifecycle.js +1 -1
  224. package/node_modules/pi-lens/dist/clients/session-start-observability.js +79 -0
  225. package/node_modules/pi-lens/dist/clients/sessionstart-logger.js +12 -3
  226. package/node_modules/pi-lens/dist/clients/sgconfig.js +6 -1
  227. package/node_modules/pi-lens/dist/clients/skills-resolver.js +105 -0
  228. package/node_modules/pi-lens/dist/clients/smells-rollup.js +2 -2
  229. package/node_modules/pi-lens/dist/clients/string-utils.js +13 -0
  230. package/node_modules/pi-lens/dist/clients/subagent-mode.js +17 -4
  231. package/node_modules/pi-lens/dist/clients/test-runner-client.js +176 -39
  232. package/node_modules/pi-lens/dist/clients/test-runner-delivery.js +239 -0
  233. package/node_modules/pi-lens/dist/clients/tool-definition.js +41 -1
  234. package/node_modules/pi-lens/dist/clients/tool-policy.js +91 -21
  235. package/node_modules/pi-lens/dist/clients/tree-sitter-cache.js +40 -40
  236. package/node_modules/pi-lens/dist/clients/tree-sitter-client.js +86 -48
  237. package/node_modules/pi-lens/dist/clients/tree-sitter-logger.js +2 -2
  238. package/node_modules/pi-lens/dist/clients/tree-sitter-query-loader.js +81 -1
  239. package/node_modules/pi-lens/dist/clients/tree-sitter-shared.js +51 -46
  240. package/node_modules/pi-lens/dist/clients/tree-sitter-symbol-extractor.js +28 -0
  241. package/node_modules/pi-lens/dist/clients/typos-config.js +5 -0
  242. package/node_modules/pi-lens/dist/clients/user-notify.js +6 -2
  243. package/node_modules/pi-lens/dist/clients/widget-state.js +191 -26
  244. package/node_modules/pi-lens/dist/clients/word-index-logger.js +2 -2
  245. package/node_modules/pi-lens/dist/clients/word-index-store.js +20 -5
  246. package/node_modules/pi-lens/dist/clients/word-index.js +243 -31
  247. package/node_modules/pi-lens/dist/clients/workspace-topology.js +8 -1
  248. package/node_modules/pi-lens/dist/clients/zizmor-config.js +3 -0
  249. package/node_modules/pi-lens/dist/index.js +64335 -54300
  250. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +3 -1
  251. package/node_modules/pi-lens/dist/mcp/server.js +127 -5
  252. package/node_modules/pi-lens/dist/scripts/lib/process-scan.mjs +583 -0
  253. package/node_modules/pi-lens/dist/scripts/lib/skills-predicate.mjs +129 -0
  254. package/node_modules/pi-lens/dist/tools/effective-config.js +89 -0
  255. package/node_modules/pi-lens/dist/tools/lens-diagnostics.js +95 -24
  256. package/node_modules/pi-lens/dist/tools/lsp-diagnostics.js +67 -80
  257. package/node_modules/pi-lens/dist/tools/lsp-navigation.js +37 -16
  258. package/node_modules/pi-lens/dist/tools/shared.js +0 -1
  259. package/node_modules/pi-lens/docs/agent-guide.md +64 -1
  260. package/node_modules/pi-lens/docs/configuration.md +222 -0
  261. package/node_modules/pi-lens/docs/dependencies.md +3 -3
  262. package/node_modules/pi-lens/docs/features.md +44 -5
  263. package/node_modules/pi-lens/docs/language-coverage.md +2 -2
  264. package/node_modules/pi-lens/docs/pi-lens-fixer.md +25 -0
  265. package/node_modules/pi-lens/docs/pi-lens-investigator.md +25 -0
  266. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +27 -0
  267. package/node_modules/pi-lens/docs/pi-lens-subagent.md +38 -0
  268. package/node_modules/pi-lens/docs/pi-lens-warden.md +55 -0
  269. package/node_modules/pi-lens/docs/public-api-stability.md +359 -0
  270. package/node_modules/pi-lens/docs/release-qa-baseline.md +182 -0
  271. package/node_modules/pi-lens/docs/subagent-compat.md +110 -30
  272. package/node_modules/pi-lens/docs/tree-sitter_rules_catalog.md +2 -2
  273. package/node_modules/pi-lens/package.json +15 -23
  274. package/node_modules/pi-lens/rules/tree-sitter-queries/python/python-cross-language-method.yml +3 -3
  275. package/node_modules/pi-lens/rules/tree-sitter-queries/python/python-hallucinated-import.yml +2 -2
  276. package/node_modules/pi-lens/rules/tree-sitter-queries/python/python-sql-injection.yml +12 -2
  277. package/node_modules/pi-lens/scripts/analyze-pi-lens-logs.mjs +192 -1
  278. package/node_modules/pi-lens/scripts/install-selftest.mjs +58 -2
  279. package/node_modules/pi-lens/scripts/lib/skills-predicate.mjs +129 -0
  280. package/node_modules/pi-lens/scripts/rpc-load-check.mjs +3 -1
  281. package/node_modules/pi-web-access/CHANGELOG.md +28 -0
  282. package/node_modules/pi-web-access/README.md +62 -15
  283. package/node_modules/pi-web-access/curator-page.ts +3 -1
  284. package/node_modules/pi-web-access/curator-server.ts +5 -1
  285. package/node_modules/pi-web-access/gemini-search.ts +8 -4
  286. package/node_modules/pi-web-access/github-extract.ts +242 -1
  287. package/node_modules/pi-web-access/index.ts +118 -64
  288. package/node_modules/pi-web-access/mistral-search.ts +281 -0
  289. package/node_modules/pi-web-access/package.json +2 -2
  290. package/node_modules/pi-web-access/perplexity.ts +14 -1
  291. package/node_modules/pi-web-access/utils.ts +23 -6
  292. package/node_modules/pi-web-access/xai-search.ts +96 -33
  293. package/package.json +5 -5
@@ -192,9 +192,12 @@ export function getInstanceRoots(entry) {
192
192
  * pi-lens process reads on every heartbeat. Eviction drops the OLDEST
193
193
  * NON-PRIMARY root: `projectRoot` is the host's own working directory and the
194
194
  * one the shared-checkout guard most needs, so it is never evicted.
195
- * Deliberately smaller than `SESSION_ROOT_CAP` (128,
196
- * `clients/lsp/session-roots.ts:45`) because that set lives in memory for one
197
- * process while this one is serialized to disk for all of them.
195
+ * Deliberately smaller than `SESSION_ROOT_CAP` (128, `clients/lsp/
196
+ * session-roots.ts`) because that registry lives in memory for one process
197
+ * while this one is serialized to disk for all of them. The two are not
198
+ * mirrors: they answer different questions about different populations, so
199
+ * #2518's one-store rule (a root's LSP config cannot be evicted while the
200
+ * root is served) does not extend to this cap.
198
201
  */
199
202
  const INSTANCE_ROOT_CAP = 32;
200
203
  /**
@@ -0,0 +1,595 @@
1
+ /**
2
+ * Canonical language registry (#2424, Phase 0a of #2415).
3
+ *
4
+ * ONE host-neutral answer to "what language is this file", from which every
5
+ * language-keyed subsystem projects its own vocabulary:
6
+ *
7
+ * - `clients/lsp/language.ts` LSP `languageId` (protocol spelling)
8
+ * - `clients/tree-sitter-shared.ts` extension -> tree-sitter grammar
9
+ * - `clients/project-diagnostics/scanner.ts` the same grammar map
10
+ * - `clients/read-expansion.ts` the same grammar map
11
+ * - `clients/review-graph/builder.ts` + `clients/module-report.ts`
12
+ * FileKind -> grammar for symbol extraction
13
+ * - `clients/grammar-source.ts` grammar -> wasm filename
14
+ *
15
+ * Before this file those were seven independently maintained tables, four of
16
+ * them hand-copied from each other, disagreeing on `.tsx`, `.sh`, `.h`,
17
+ * `.jsonc`, `.vue` and `.svelte` with nothing in CI able to see it.
18
+ *
19
+ * The rule for adding a column here: a per-consumer token belongs in an entry
20
+ * only when the consumer's PROTOCOL demands a different spelling than the
21
+ * canonical id — the LSP spec's `typescriptreact` / `shellscript` / `jsonc`,
22
+ * or the tree-sitter grammar's own name (`tsx`, `bash`). Anything else is one
23
+ * value on one entry.
24
+ *
25
+ * `FileKind` (file-kinds.ts) stays deliberately COARSE: `jsts` spans
26
+ * typescript/tsx/javascript/jsx/vue/svelte and `cxx` spans c/cpp. Several
27
+ * languages therefore map onto one kind, and `kind` here is the mapping, not a
28
+ * synonym for the language id.
29
+ */
30
+ import { SPECIAL_FILENAMES } from "./file-kinds.js";
31
+ /**
32
+ * The `LanguageId` inventory pinned as VALUES, and type-linked to the union in
33
+ * BOTH directions so neither half can move alone (#2424 review, F1):
34
+ *
35
+ * - `satisfies readonly LanguageId[]` rejects a pinned id that is not a
36
+ * union member;
37
+ * - {@link LANGUAGE_ID_PIN_IS_EXHAUSTIVE} rejects a union member that is not
38
+ * pinned;
39
+ * - `tests/clients/language-registry-drift.test.ts` asserts this list equals
40
+ * `LANGUAGES.map(e => e.id)`, so a pinned id with no registry ENTRY fails
41
+ * too.
42
+ *
43
+ * Together those make "add `| "brainfuck"` to the union and ship" impossible:
44
+ * the union edit alone fails `npm run build`, and satisfying the compiler
45
+ * forces the pin edit, which fails the drift test until an entry exists. Before
46
+ * this, the pin lived only in the test file as an unlinked string array, so a
47
+ * union member with no entry compiled clean and left all 22 drift tests green.
48
+ */
49
+ export const PINNED_LANGUAGE_IDS = [
50
+ "ada",
51
+ "astro",
52
+ "c",
53
+ "clojure",
54
+ "cmake",
55
+ "cobol",
56
+ "cpp",
57
+ "csharp",
58
+ "css",
59
+ "cue",
60
+ "dart",
61
+ "dockerfile",
62
+ "elixir",
63
+ "erlang",
64
+ "fish",
65
+ "fortran",
66
+ "fsharp",
67
+ "gleam",
68
+ "go",
69
+ "go-mod",
70
+ "graphql",
71
+ "haskell",
72
+ "helm",
73
+ "html",
74
+ "java",
75
+ "javascript",
76
+ "javascriptreact",
77
+ "json",
78
+ "jsonc",
79
+ "julia",
80
+ "kotlin",
81
+ "less",
82
+ "lua",
83
+ "markdown",
84
+ "nix",
85
+ "ocaml",
86
+ "pascal",
87
+ "perl",
88
+ "php",
89
+ "powershell",
90
+ "prisma",
91
+ "proto",
92
+ "python",
93
+ "r",
94
+ "ron",
95
+ "ruby",
96
+ "rust",
97
+ "sass",
98
+ "scala",
99
+ "scss",
100
+ "shell",
101
+ "sql",
102
+ "svelte",
103
+ "swift",
104
+ "systemverilog",
105
+ "terraform",
106
+ "terragrunt",
107
+ "toml",
108
+ "typescript",
109
+ "typescriptreact",
110
+ "typst",
111
+ "verilog",
112
+ "vhdl",
113
+ "vue",
114
+ "yaml",
115
+ "zig",
116
+ ];
117
+ /**
118
+ * Compile-time exhaustiveness for the pin above. When every `LanguageId` is
119
+ * pinned this type is `true` and the initializer type-checks; the moment a
120
+ * union member is added without being pinned, the type collapses to the
121
+ * literal message below and `true` stops being assignable to it, so
122
+ * `npm run build` fails at THIS line with the reason spelled out.
123
+ */
124
+ export const LANGUAGE_ID_PIN_IS_EXHAUSTIVE = true;
125
+ /** The registry. Sorted by id; one entry per language, one owner per extension. */
126
+ export const LANGUAGES = [
127
+ { id: "ada", extensions: [".adb", ".ads"] },
128
+ { id: "astro", extensions: [".astro"] },
129
+ { id: "c", kind: "cxx", extensions: [".c", ".h"], grammar: "c" },
130
+ {
131
+ id: "clojure",
132
+ kind: "clojure",
133
+ extensions: [".clj", ".cljc", ".cljs", ".edn"],
134
+ },
135
+ {
136
+ id: "cmake",
137
+ kind: "cmake",
138
+ extensions: [".cmake"],
139
+ filenames: ["CMakeLists.txt"],
140
+ },
141
+ { id: "cobol", extensions: [".cob", ".cbl"] },
142
+ {
143
+ id: "cpp",
144
+ kind: "cxx",
145
+ // The clang extension table (file-kinds.ts KIND_EXTENSIONS.cxx) minus the
146
+ // C header/source pair, which the `c` entry owns.
147
+ extensions: [
148
+ ".c++",
149
+ ".c++m",
150
+ ".cc",
151
+ ".cl",
152
+ ".clcpp",
153
+ ".cp",
154
+ ".cpp",
155
+ ".cppm",
156
+ ".cu",
157
+ ".cxx",
158
+ ".cxxm",
159
+ ".hh",
160
+ ".hip",
161
+ ".hpp",
162
+ ".hxx",
163
+ ".inl",
164
+ ".ipp",
165
+ ".ixx",
166
+ ".m",
167
+ ".mm",
168
+ ".tpp",
169
+ ".txx",
170
+ ],
171
+ grammar: "cpp",
172
+ // The module-interface (.c++m/.cppm/.cxxm/.ixx), Objective-C (.m/.mm),
173
+ // OpenCL (.cl/.clcpp) and .cp tail is classified cxx but has never been
174
+ // routed to the cpp grammar by extension; kind-keyed consumers still
175
+ // reach cpp through `kindFallback`.
176
+ grammarExtensions: [
177
+ ".c++",
178
+ ".cc",
179
+ ".cpp",
180
+ ".cu",
181
+ ".cxx",
182
+ ".hh",
183
+ ".hip",
184
+ ".hpp",
185
+ ".hxx",
186
+ ".inl",
187
+ ".ipp",
188
+ ".tpp",
189
+ ".txx",
190
+ ],
191
+ kindFallback: true,
192
+ },
193
+ { id: "csharp", kind: "csharp", extensions: [".cs"], grammar: "csharp" },
194
+ { id: "css", kind: "css", extensions: [".css"], grammar: "css" },
195
+ {
196
+ id: "cue",
197
+ kind: "cue",
198
+ extensions: [".cue"],
199
+ grammar: "cue",
200
+ // The cue grammar and its symbol queries ship, but no extension resolver
201
+ // has ever routed `.cue` to them; kind-keyed consumers reach it anyway.
202
+ grammarExtensions: [],
203
+ },
204
+ { id: "dart", kind: "dart", extensions: [".dart"], grammar: "dart" },
205
+ {
206
+ id: "dockerfile",
207
+ kind: "docker",
208
+ extensions: [".dockerfile"],
209
+ filenames: ["Dockerfile"],
210
+ },
211
+ {
212
+ id: "elixir",
213
+ kind: "elixir",
214
+ extensions: [".ex", ".exs"],
215
+ grammar: "elixir",
216
+ },
217
+ { id: "erlang", extensions: [".erl", ".hrl"] },
218
+ { id: "fish", kind: "fish", extensions: [".fish"] },
219
+ { id: "fortran", extensions: [".f", ".f90", ".f95"] },
220
+ { id: "fsharp", kind: "fsharp", extensions: [".fs", ".fsi", ".fsx"] },
221
+ { id: "gleam", kind: "gleam", extensions: [".gleam"] },
222
+ { id: "go", kind: "go", extensions: [".go"], grammar: "go" },
223
+ // go.mod / go.sum: the LSP id is plain `go`, but they are not Go source and
224
+ // file-kinds.ts deliberately does not classify them.
225
+ { id: "go-mod", extensions: [".mod", ".sum"], lspId: "go" },
226
+ { id: "graphql", extensions: [".graphql", ".gql"] },
227
+ { id: "haskell", kind: "haskell", extensions: [".hs", ".lhs"] },
228
+ { id: "helm", kind: "helm-template", extensions: [".tpl"] },
229
+ {
230
+ id: "html",
231
+ kind: "html",
232
+ extensions: [".htm", ".html"],
233
+ grammar: "html",
234
+ grammarExtensions: [],
235
+ },
236
+ { id: "java", kind: "java", extensions: [".java"], grammar: "java" },
237
+ {
238
+ id: "javascript",
239
+ kind: "jsts",
240
+ extensions: [".js", ".mjs", ".cjs"],
241
+ grammar: "javascript",
242
+ },
243
+ // `.jsx` is JSX-flavoured JavaScript: its own LSP id, but the plain
244
+ // javascript grammar (which parses JSX) rather than the tsx one.
245
+ {
246
+ id: "javascriptreact",
247
+ kind: "jsts",
248
+ extensions: [".jsx"],
249
+ grammar: "javascript",
250
+ },
251
+ {
252
+ id: "json",
253
+ kind: "json",
254
+ extensions: [".json", ".json5"],
255
+ grammar: "json",
256
+ grammarExtensions: [],
257
+ },
258
+ { id: "jsonc", kind: "json", extensions: [".jsonc"] },
259
+ { id: "julia", extensions: [".jl"] },
260
+ {
261
+ id: "kotlin",
262
+ kind: "kotlin",
263
+ extensions: [".kt", ".kts"],
264
+ grammar: "kotlin",
265
+ },
266
+ { id: "less", kind: "css", extensions: [".less"] },
267
+ { id: "lua", kind: "lua", extensions: [".lua"], grammar: "lua" },
268
+ { id: "markdown", kind: "markdown", extensions: [".md", ".mdx"] },
269
+ { id: "nix", kind: "nix", extensions: [".nix"] },
270
+ {
271
+ id: "ocaml",
272
+ kind: "ocaml",
273
+ extensions: [".ml", ".mli"],
274
+ grammar: "ocaml",
275
+ },
276
+ { id: "pascal", extensions: [".pas", ".pp"] },
277
+ { id: "perl", extensions: [".pl", ".pm"] },
278
+ {
279
+ id: "php",
280
+ kind: "php",
281
+ extensions: [".php", ".phtml", ".php3", ".php4", ".php5"],
282
+ grammar: "php",
283
+ },
284
+ {
285
+ id: "powershell",
286
+ kind: "powershell",
287
+ extensions: [".ps1", ".psm1", ".psd1"],
288
+ },
289
+ { id: "prisma", kind: "prisma", extensions: [".prisma"] },
290
+ { id: "proto", extensions: [".proto"] },
291
+ {
292
+ id: "python",
293
+ kind: "python",
294
+ extensions: [".py", ".pyi"],
295
+ grammar: "python",
296
+ // `.pyi` stubs are not routed to the grammar by extension today.
297
+ grammarExtensions: [".py"],
298
+ },
299
+ { id: "r", extensions: [".r"] },
300
+ // Rusty Object Notation: served as `rust` by the LSP seam, not Rust source.
301
+ { id: "ron", extensions: [".ron"], lspId: "rust" },
302
+ {
303
+ id: "ruby",
304
+ kind: "ruby",
305
+ extensions: [".rb", ".rake", ".gemspec", ".ru"],
306
+ grammar: "ruby",
307
+ grammarExtensions: [".rb"],
308
+ },
309
+ { id: "rust", kind: "rust", extensions: [".rs"], grammar: "rust" },
310
+ { id: "sass", kind: "css", extensions: [".sass"] },
311
+ { id: "scala", extensions: [".scala", ".sc"] },
312
+ { id: "scss", kind: "css", extensions: [".scss"] },
313
+ {
314
+ id: "shell",
315
+ kind: "shell",
316
+ extensions: [".sh", ".bash", ".zsh"],
317
+ filenames: ["Makefile"],
318
+ // The LSP spec spells it `shellscript`; the tree-sitter grammar is `bash`.
319
+ lspId: "shellscript",
320
+ grammar: "bash",
321
+ grammarExtensions: [".sh", ".bash"],
322
+ },
323
+ { id: "sql", kind: "sql", extensions: [".sql"] },
324
+ { id: "svelte", kind: "jsts", extensions: [".svelte"] },
325
+ { id: "swift", kind: "swift", extensions: [".swift"], grammar: "swift" },
326
+ { id: "systemverilog", extensions: [".sv"] },
327
+ { id: "terraform", kind: "terraform", extensions: [".tf", ".tfvars"] },
328
+ {
329
+ id: "terragrunt",
330
+ kind: "terragrunt",
331
+ extensions: [],
332
+ filenames: ["terragrunt.hcl", "root.hcl"],
333
+ },
334
+ {
335
+ id: "toml",
336
+ kind: "toml",
337
+ extensions: [".toml"],
338
+ grammar: "toml",
339
+ grammarExtensions: [],
340
+ },
341
+ {
342
+ id: "typescript",
343
+ kind: "jsts",
344
+ extensions: [".ts", ".mts", ".cts"],
345
+ grammar: "typescript",
346
+ },
347
+ // `.tsx` needs the tsx grammar (the typescript grammar ERRORs on JSX) and
348
+ // the LSP spec's `typescriptreact` id.
349
+ {
350
+ id: "typescriptreact",
351
+ kind: "jsts",
352
+ extensions: [".tsx"],
353
+ grammar: "tsx",
354
+ },
355
+ { id: "typst", extensions: [".typ", ".typc"] },
356
+ { id: "verilog", extensions: [".v"] },
357
+ { id: "vhdl", extensions: [".vhd", ".vhdl"] },
358
+ {
359
+ id: "vue",
360
+ kind: "jsts",
361
+ extensions: [".vue"],
362
+ grammar: "vue",
363
+ // The vue grammar ships as wasm but no extension resolver routes to it;
364
+ // the jsts fact providers deliberately skip .vue/.svelte (file-kinds.ts).
365
+ grammarExtensions: [],
366
+ },
367
+ {
368
+ id: "yaml",
369
+ kind: "yaml",
370
+ extensions: [".yaml", ".yml"],
371
+ grammar: "yaml",
372
+ grammarExtensions: [],
373
+ },
374
+ {
375
+ id: "zig",
376
+ kind: "zig",
377
+ extensions: [".zig", ".zon"],
378
+ grammar: "zig",
379
+ grammarExtensions: [".zig"],
380
+ },
381
+ ];
382
+ /** The LSP `languageId` for an entry (the id itself unless the protocol differs). */
383
+ export function lspLanguageId(entry) {
384
+ return entry.lspId ?? entry.id;
385
+ }
386
+ /** Extensions of `entry` that resolve to its grammar. */
387
+ export function grammarExtensionsOf(entry) {
388
+ if (!entry.grammar)
389
+ return [];
390
+ return entry.grammarExtensions ?? entry.extensions;
391
+ }
392
+ const BY_EXTENSION = new Map();
393
+ const BY_FILENAME = new Map();
394
+ for (const entry of LANGUAGES) {
395
+ for (const extension of entry.extensions) {
396
+ BY_EXTENSION.set(extension.toLowerCase(), entry);
397
+ }
398
+ for (const filename of entry.filenames ?? []) {
399
+ BY_FILENAME.set(filename.toLowerCase(), entry);
400
+ }
401
+ }
402
+ const BY_ID = new Map(LANGUAGES.map((entry) => [entry.id, entry]));
403
+ /**
404
+ * Every extension the registry gives the language with this canonical id, or
405
+ * `[]` for an id it does not know. The id-keyed half of the vocabulary a
406
+ * `lang:` filter accepts — see {@link GRAMMAR_TO_EXTENSIONS} for the other.
407
+ */
408
+ export function extensionsForLanguage(id) {
409
+ return BY_ID.get(id)?.extensions ?? [];
410
+ }
411
+ /**
412
+ * tree-sitter / ast-grep GRAMMAR name -> every extension owned by a language
413
+ * that uses that grammar (`javascript` collects both the `javascript` and
414
+ * `javascriptreact` entries; `bash` collects `shell`'s).
415
+ *
416
+ * This is the inverse of {@link EXTENSION_TO_GRAMMAR} widened back to the
417
+ * entry's full extension list rather than its `grammarExtensions` narrowing,
418
+ * because the consumer is a FILTER ("is this file a `java` file?"), not a
419
+ * parser routing decision: over-including an extension whose files carry no
420
+ * symbols is invisible, while under-including one hides real hits.
421
+ * `clients/lens-engine.ts`'s symbol_search `lang` filter projects this (#2424
422
+ * review, S2).
423
+ *
424
+ * Order is the registry's own declaration order, deduped — the same order
425
+ * {@link extensionsForLanguage} returns, so the two halves of
426
+ * {@link extensionsForLanguageToken} answer alike. Deliberately NOT `.sort()`:
427
+ * a locale-sensitive comparator over strings carrying `+` and `.` (`.c++` vs
428
+ * `.cc`) would make a frozen table's contents depend on the host's ICU data.
429
+ */
430
+ export const GRAMMAR_TO_EXTENSIONS = Object.freeze((() => {
431
+ const byGrammar = new Map();
432
+ for (const entry of LANGUAGES) {
433
+ if (!entry.grammar)
434
+ continue;
435
+ const list = byGrammar.get(entry.grammar) ?? [];
436
+ list.push(...entry.extensions);
437
+ byGrammar.set(entry.grammar, list);
438
+ }
439
+ return Object.fromEntries([...byGrammar].map(([grammar, extensions]) => [
440
+ grammar,
441
+ Object.freeze([...new Set(extensions)]),
442
+ ]));
443
+ })());
444
+ /**
445
+ * Extensions a caller-supplied language TOKEN selects, for consumers that take
446
+ * a language name from an agent/tool argument rather than from a file path —
447
+ * `symbol_search`'s `lang` filter today (#2424 review, S2).
448
+ *
449
+ * A token may be spelled either way round, because both vocabularies are in
450
+ * live use: `ast_grep_search`'s `lang` enum uses the tree-sitter GRAMMAR names
451
+ * (`bash`, `tsx`, `cpp`), while languages with no grammar are only nameable by
452
+ * their canonical id (`haskell`, `nix`, `scala`). Grammar wins on a collision,
453
+ * which is a no-op — `cpp`/`java`/`lua` name the same entry either way. An
454
+ * unrecognized token selects nothing, so a filter on it returns no hits.
455
+ */
456
+ export function extensionsForLanguageToken(token) {
457
+ return GRAMMAR_TO_EXTENSIONS[token] ?? extensionsForLanguage(token);
458
+ }
459
+ function basenameOf(filePath) {
460
+ const cut = Math.max(filePath.lastIndexOf("/"), filePath.lastIndexOf("\\"));
461
+ return cut === -1 ? filePath : filePath.slice(cut + 1);
462
+ }
463
+ function extensionOf(filePath) {
464
+ const base = basenameOf(filePath);
465
+ const dot = base.lastIndexOf(".");
466
+ return dot <= 0 ? "" : base.slice(dot).toLowerCase();
467
+ }
468
+ /** The sole registry entry for a kind, or the kind's declared fallback entry. */
469
+ const BY_KIND = new Map();
470
+ {
471
+ const owners = new Map();
472
+ for (const entry of LANGUAGES) {
473
+ if (!entry.kind)
474
+ continue;
475
+ const list = owners.get(entry.kind) ?? [];
476
+ list.push(entry);
477
+ owners.set(entry.kind, list);
478
+ }
479
+ for (const [kind, list] of owners) {
480
+ const resolved = list.length === 1 ? list[0] : list.find((entry) => entry.kindFallback);
481
+ if (resolved)
482
+ BY_KIND.set(kind, resolved);
483
+ }
484
+ }
485
+ /**
486
+ * Resolve a file to its language entry, with the SAME precedence
487
+ * `detectFileKind` uses: exact filename first, then extension, then
488
+ * file-kinds.ts's basename PATTERNS (`Dockerfile.<suffix>`) mapped through the
489
+ * kind they classify into. Returns undefined for a coarse kind owned by
490
+ * several languages with no fallback (a `jsts` basename pattern), because there
491
+ * is no single right answer to give.
492
+ */
493
+ export function resolveLanguage(filePath) {
494
+ if (!filePath)
495
+ return undefined;
496
+ const base = basenameOf(filePath);
497
+ const byName = BY_FILENAME.get(base.toLowerCase());
498
+ if (byName)
499
+ return byName;
500
+ const byExtension = BY_EXTENSION.get(extensionOf(filePath));
501
+ if (byExtension)
502
+ return byExtension;
503
+ for (const { pattern, kind } of SPECIAL_FILENAMES) {
504
+ if (pattern.test(base))
505
+ return BY_KIND.get(kind);
506
+ }
507
+ return undefined;
508
+ }
509
+ /**
510
+ * Extension -> LSP `languageId`, for every extension whose language has one.
511
+ * `clients/lsp/language.ts` projects this.
512
+ */
513
+ export const EXTENSION_TO_LSP_ID = Object.freeze(Object.fromEntries(LANGUAGES.flatMap((entry) => entry.extensions.map((extension) => [extension, lspLanguageId(entry)]))));
514
+ /**
515
+ * Extension -> tree-sitter grammar. The single ext->grammar authority:
516
+ * `tree-sitter-shared.ts`, `project-diagnostics/scanner.ts` and
517
+ * `read-expansion.ts` all project this one map.
518
+ */
519
+ export const EXTENSION_TO_GRAMMAR = Object.freeze(Object.fromEntries(LANGUAGES.flatMap((entry) => grammarExtensionsOf(entry).map((extension) => [extension, entry.grammar]))));
520
+ /**
521
+ * FileKind -> tree-sitter grammar, for KIND-keyed consumers (review-graph,
522
+ * module-report). A kind appears only when one language owns it, or when one
523
+ * of its languages is the declared {@link LanguageEntry.kindFallback} — so the
524
+ * extension-split `jsts` is deliberately absent and callers keep resolving it
525
+ * by path.
526
+ */
527
+ export const KIND_TO_GRAMMAR = Object.freeze(Object.fromEntries([...BY_KIND.entries()]
528
+ .filter(([, entry]) => Boolean(entry.grammar))
529
+ .map(([kind, entry]) => [kind, entry.grammar])));
530
+ /**
531
+ * Directory-scan priority (#2434), folding `tools/lsp-diagnostics.ts`'s former
532
+ * ad hoc `LANG_EXTENSIONS` table — the last one #2424 deliberately left out,
533
+ * because its iteration ORDER decides which language a MIXED directory scans
534
+ * as: `runDirectoryDiagnostics` walks this list of FAMILIES and, for each one,
535
+ * unions every member id's {@link extensionsForLanguage} into ONE
536
+ * `collectFiles` call — the first family with any matching file wins the
537
+ * whole directory for that pass. Family order mirrors the old table's key
538
+ * order exactly (`typescript`/`typescriptreact` before `javascript`/
539
+ * `javascriptreact`, ..., `json`/`jsonc` before `yaml`, down to `prisma`
540
+ * last).
541
+ *
542
+ * The old table sometimes bundled two now-distinct registry entries under one
543
+ * key (`.ts` also matched `.tsx`; `.css` also matched `.scss`/`.less`)
544
+ * because it predated the grammar split #2424 made explicit (`.tsx` needs the
545
+ * `tsx` grammar, not `typescript`; `scss`/`less` are their own entries with
546
+ * no grammar). Grouping each split into one FAMILY here — rather than listing
547
+ * the ids flat and scanning them one at a time — is what keeps a directory
548
+ * that mixes BOTH extensions of a split pair (e.g. `.ts` AND `.tsx` side by
549
+ * side) behavior-preserving: every member's extensions feed the SAME
550
+ * `collectFiles` call, so both sides are found in the one pass the old
551
+ * bundled key made, not whichever id happens to be tried first (a flat
552
+ * per-id loop broke this — #2458 fix-round F1). Every extension individually
553
+ * stays reachable — no id here was dropped — and
554
+ * `tests/clients/language-registry-drift.test.ts` pins each family against
555
+ * the golden `tests/fixtures/lsp-diagnostics-lang-extensions.json` capture,
556
+ * with every intentional widening (an id's registry extension set is a
557
+ * strict superset of the old table's) enumerated there and in the
558
+ * `.changelog/` entry, not left as a silent side effect.
559
+ *
560
+ * Reserved for #2416 (lsp namespace): this priority may become a config key
561
+ * there. Not implemented as one here — no loader, no env var, no
562
+ * `.pi-lens.json` field reads this array today.
563
+ */
564
+ export const SCAN_LANGUAGE_PRIORITY = [
565
+ ["typescript", "typescriptreact"],
566
+ ["javascript", "javascriptreact"],
567
+ ["python"],
568
+ ["rust"],
569
+ ["go"],
570
+ ["ruby"],
571
+ ["java"],
572
+ ["kotlin"],
573
+ ["swift"],
574
+ ["csharp"],
575
+ ["cpp"],
576
+ ["c"],
577
+ ["zig"],
578
+ ["haskell"],
579
+ ["elixir"],
580
+ ["gleam"],
581
+ ["terraform"],
582
+ ["nix"],
583
+ ["shell"],
584
+ ["php"],
585
+ ["lua"],
586
+ ["dart"],
587
+ ["vue"],
588
+ ["svelte"],
589
+ ["css", "scss", "less"],
590
+ ["html"],
591
+ ["json", "jsonc"],
592
+ ["yaml"],
593
+ ["toml"],
594
+ ["prisma"],
595
+ ];