@herbertgao/pi-extensions 2026.9.0 → 2026.9.2

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