@duckmind/dm-linux-x64 0.66.0 → 0.66.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 (546) hide show
  1. package/dm +2 -2
  2. package/extensions/.dm-extensions.json +12 -546
  3. package/extensions/dm-lens/clients/dispatch/runners/utils/runner-helpers.js +1 -1
  4. package/extensions/dm-mcp-adapter/mcp-keyring-helper.cjs +1 -1
  5. package/extensions/dm-ponytail/hooks/ponytail-activate.js +1 -1
  6. package/extensions/dm-ponytail/hooks/ponytail-instructions.js +1 -1
  7. package/extensions/dm-subagents/src/runs/background/runner-aliases.js +2 -2
  8. package/extensions/dm-subagents/src/runs/foreground/prompt-audit.js +4 -1
  9. package/extensions/dm-subagents/src/runs/shared/child-session.js +8 -6
  10. package/extensions/dm-subagents/src/watchdog/permission-arbiter.js +9 -1
  11. package/extensions/dm-subagents/src/watchdog/review.js +4 -1
  12. package/package.json +1 -1
  13. package/extensions/dm-lens/dist/clients/actionable-warnings-logger.js +0 -24
  14. package/extensions/dm-lens/dist/clients/actionable-warnings.js +0 -1014
  15. package/extensions/dm-lens/dist/clients/advisory-provenance.js +0 -385
  16. package/extensions/dm-lens/dist/clients/agent-behavior-client.js +0 -94
  17. package/extensions/dm-lens/dist/clients/agent-nudge.js +0 -151
  18. package/extensions/dm-lens/dist/clients/analysed-root.js +0 -1
  19. package/extensions/dm-lens/dist/clients/ast-grep-client.js +0 -576
  20. package/extensions/dm-lens/dist/clients/ast-grep-rule-manager.js +0 -114
  21. package/extensions/dm-lens/dist/clients/ast-grep-tool-logger.js +0 -85
  22. package/extensions/dm-lens/dist/clients/ast-grep-types.js +0 -1
  23. package/extensions/dm-lens/dist/clients/ast-grep-yaml-synth.js +0 -109
  24. package/extensions/dm-lens/dist/clients/atomic-write-staging.js +0 -66
  25. package/extensions/dm-lens/dist/clients/atomic-write.js +0 -37
  26. package/extensions/dm-lens/dist/clients/availability-probe-flight.js +0 -11
  27. package/extensions/dm-lens/dist/clients/bash-file-access.js +0 -830
  28. package/extensions/dm-lens/dist/clients/biome-client.js +0 -221
  29. package/extensions/dm-lens/dist/clients/blocker-freshness.js +0 -385
  30. package/extensions/dm-lens/dist/clients/blocker-past-eof.js +0 -49
  31. package/extensions/dm-lens/dist/clients/bootstrap.js +0 -246
  32. package/extensions/dm-lens/dist/clients/bounded-cache.js +0 -105
  33. package/extensions/dm-lens/dist/clients/bounded-pid-file-lock.js +0 -173
  34. package/extensions/dm-lens/dist/clients/bounded-telemetry.js +0 -104
  35. package/extensions/dm-lens/dist/clients/build-identity.js +0 -45
  36. package/extensions/dm-lens/dist/clients/bundled-resource-health.js +0 -41
  37. package/extensions/dm-lens/dist/clients/bus-events-logger.js +0 -48
  38. package/extensions/dm-lens/dist/clients/bus-publish.js +0 -117
  39. package/extensions/dm-lens/dist/clients/cache/rule-cache.js +0 -103
  40. package/extensions/dm-lens/dist/clients/cache-manager.js +0 -340
  41. package/extensions/dm-lens/dist/clients/cache-observability.js +0 -847
  42. package/extensions/dm-lens/dist/clients/call-graph.js +0 -628
  43. package/extensions/dm-lens/dist/clients/cargo-manifest.js +0 -151
  44. package/extensions/dm-lens/dist/clients/cascade-budget.js +0 -52
  45. package/extensions/dm-lens/dist/clients/cascade-format.js +0 -160
  46. package/extensions/dm-lens/dist/clients/cascade-logger.js +0 -22
  47. package/extensions/dm-lens/dist/clients/cascade-types.js +0 -1
  48. package/extensions/dm-lens/dist/clients/child-unref.js +0 -59
  49. package/extensions/dm-lens/dist/clients/code-quality-warnings.js +0 -192
  50. package/extensions/dm-lens/dist/clients/codebase-model.js +0 -110
  51. package/extensions/dm-lens/dist/clients/collateral-test-role.js +0 -8
  52. package/extensions/dm-lens/dist/clients/complexity-client.js +0 -398
  53. package/extensions/dm-lens/dist/clients/config-core/deny.js +0 -117
  54. package/extensions/dm-lens/dist/clients/config-core/index.js +0 -2
  55. package/extensions/dm-lens/dist/clients/config-core/merge.js +0 -228
  56. package/extensions/dm-lens/dist/clients/config-core/normalize.js +0 -217
  57. package/extensions/dm-lens/dist/clients/config-core/process-spec.js +0 -147
  58. package/extensions/dm-lens/dist/clients/config-core/provenance.js +0 -54
  59. package/extensions/dm-lens/dist/clients/config-core/records.js +0 -79
  60. package/extensions/dm-lens/dist/clients/config-core/resolve.js +0 -48
  61. package/extensions/dm-lens/dist/clients/config-core/safe-object.js +0 -22
  62. package/extensions/dm-lens/dist/clients/config-core/schema.js +0 -90
  63. package/extensions/dm-lens/dist/clients/config-diagnostic-codes.js +0 -90
  64. package/extensions/dm-lens/dist/clients/config-locations.js +0 -175
  65. package/extensions/dm-lens/dist/clients/config-resolve.js +0 -359
  66. package/extensions/dm-lens/dist/clients/config-schema.js +0 -128
  67. package/extensions/dm-lens/dist/clients/config-warn.js +0 -146
  68. package/extensions/dm-lens/dist/clients/console-guard-install.js +0 -4
  69. package/extensions/dm-lens/dist/clients/cooperative-budget.js +0 -36
  70. package/extensions/dm-lens/dist/clients/dead-code-client.js +0 -342
  71. package/extensions/dm-lens/dist/clients/dead-code-logger.js +0 -18
  72. package/extensions/dm-lens/dist/clients/deadline-utils.js +0 -117
  73. package/extensions/dm-lens/dist/clients/debug-handles.js +0 -121
  74. package/extensions/dm-lens/dist/clients/debug-heap.js +0 -80
  75. package/extensions/dm-lens/dist/clients/deferred-lsp-work.js +0 -33
  76. package/extensions/dm-lens/dist/clients/degradation-ledger.js +0 -272
  77. package/extensions/dm-lens/dist/clients/demoted-finding-render.js +0 -61
  78. package/extensions/dm-lens/dist/clients/dependency-checker.js +0 -525
  79. package/extensions/dm-lens/dist/clients/deps/ast-grep-napi.js +0 -17
  80. package/extensions/dm-lens/dist/clients/deps/dm-host-deps.js +0 -10
  81. package/extensions/dm-lens/dist/clients/deps/dm-tui-compat.js +0 -58
  82. package/extensions/dm-lens/dist/clients/deps/js-yaml.js +0 -7
  83. package/extensions/dm-lens/dist/clients/deps/minimatch.js +0 -6
  84. package/extensions/dm-lens/dist/clients/deps/pidusage.js +0 -5
  85. package/extensions/dm-lens/dist/clients/deps/typebox.js +0 -5
  86. package/extensions/dm-lens/dist/clients/deps/vscode-jsonrpc.js +0 -8
  87. package/extensions/dm-lens/dist/clients/deps/web-tree-sitter.js +0 -11
  88. package/extensions/dm-lens/dist/clients/diagnostic-dispositions.js +0 -318
  89. package/extensions/dm-lens/dist/clients/diagnostic-line-freshness.js +0 -144
  90. package/extensions/dm-lens/dist/clients/diagnostic-logger.js +0 -60
  91. package/extensions/dm-lens/dist/clients/diagnostic-tracker.js +0 -89
  92. package/extensions/dm-lens/dist/clients/diagnostics-publish.js +0 -134
  93. package/extensions/dm-lens/dist/clients/dispatch/ast-grep-catalog.js +0 -16
  94. package/extensions/dm-lens/dist/clients/dispatch/auxiliary-lsp.js +0 -158
  95. package/extensions/dm-lens/dist/clients/dispatch/collect-later-tier.js +0 -25
  96. package/extensions/dm-lens/dist/clients/dispatch/diagnostic-taxonomy.js +0 -58
  97. package/extensions/dm-lens/dist/clients/dispatch/dispatcher.js +0 -953
  98. package/extensions/dm-lens/dist/clients/dispatch/fact-provider-types.js +0 -1
  99. package/extensions/dm-lens/dist/clients/dispatch/fact-rule-runner.js +0 -17
  100. package/extensions/dm-lens/dist/clients/dispatch/fact-runner.js +0 -18
  101. package/extensions/dm-lens/dist/clients/dispatch/fact-scheduler.js +0 -52
  102. package/extensions/dm-lens/dist/clients/dispatch/fact-store.js +0 -199
  103. package/extensions/dm-lens/dist/clients/dispatch/facts/comment-facts.js +0 -20
  104. package/extensions/dm-lens/dist/clients/dispatch/facts/file-content.js +0 -18
  105. package/extensions/dm-lens/dist/clients/dispatch/facts/function-facts.js +0 -281
  106. package/extensions/dm-lens/dist/clients/dispatch/facts/import-facts.js +0 -169
  107. package/extensions/dm-lens/dist/clients/dispatch/facts/tree-sitter-facts.js +0 -19
  108. package/extensions/dm-lens/dist/clients/dispatch/facts/try-catch-facts.js +0 -95
  109. package/extensions/dm-lens/dist/clients/dispatch/finding-policy.js +0 -159
  110. package/extensions/dm-lens/dist/clients/dispatch/indent-detect.js +0 -227
  111. package/extensions/dm-lens/dist/clients/dispatch/inline-suppressions.js +0 -52
  112. package/extensions/dm-lens/dist/clients/dispatch/integration.js +0 -1463
  113. package/extensions/dm-lens/dist/clients/dispatch/lazy.js +0 -8
  114. package/extensions/dm-lens/dist/clients/dispatch/pending-runner-findings.js +0 -75
  115. package/extensions/dm-lens/dist/clients/dispatch/plan.js +0 -278
  116. package/extensions/dm-lens/dist/clients/dispatch/priorities.js +0 -14
  117. package/extensions/dm-lens/dist/clients/dispatch/rule-id-normalize.js +0 -42
  118. package/extensions/dm-lens/dist/clients/dispatch/rule-ignores.js +0 -21
  119. package/extensions/dm-lens/dist/clients/dispatch/rule-policy.js +0 -73
  120. package/extensions/dm-lens/dist/clients/dispatch/rules/async-noise.js +0 -31
  121. package/extensions/dm-lens/dist/clients/dispatch/rules/async-unnecessary-wrapper.js +0 -27
  122. package/extensions/dm-lens/dist/clients/dispatch/rules/cors-wildcard.js +0 -35
  123. package/extensions/dm-lens/dist/clients/dispatch/rules/error-obscuring.js +0 -29
  124. package/extensions/dm-lens/dist/clients/dispatch/rules/error-swallowing.js +0 -29
  125. package/extensions/dm-lens/dist/clients/dispatch/rules/framework-call-noise.js +0 -31
  126. package/extensions/dm-lens/dist/clients/dispatch/rules/high-complexity.js +0 -56
  127. package/extensions/dm-lens/dist/clients/dispatch/rules/high-fan-out.js +0 -45
  128. package/extensions/dm-lens/dist/clients/dispatch/rules/high-import-coupling.js +0 -31
  129. package/extensions/dm-lens/dist/clients/dispatch/rules/missing-error-propagation.js +0 -45
  130. package/extensions/dm-lens/dist/clients/dispatch/rules/no-commented-credentials.js +0 -46
  131. package/extensions/dm-lens/dist/clients/dispatch/rules/pass-through-wrappers.js +0 -38
  132. package/extensions/dm-lens/dist/clients/dispatch/rules/placeholder-comments.js +0 -40
  133. package/extensions/dm-lens/dist/clients/dispatch/rules/unsafe-boundary.js +0 -101
  134. package/extensions/dm-lens/dist/clients/dispatch/runner-context.js +0 -46
  135. package/extensions/dm-lens/dist/clients/dispatch/runners/actionlint.js +0 -98
  136. package/extensions/dm-lens/dist/clients/dispatch/runners/ast-grep-napi.js +0 -690
  137. package/extensions/dm-lens/dist/clients/dispatch/runners/biome-check.js +0 -202
  138. package/extensions/dm-lens/dist/clients/dispatch/runners/cpp-check.js +0 -190
  139. package/extensions/dm-lens/dist/clients/dispatch/runners/credo.js +0 -66
  140. package/extensions/dm-lens/dist/clients/dispatch/runners/cue-vet.js +0 -167
  141. package/extensions/dm-lens/dist/clients/dispatch/runners/dart-analyze.js +0 -151
  142. package/extensions/dm-lens/dist/clients/dispatch/runners/detekt.js +0 -157
  143. package/extensions/dm-lens/dist/clients/dispatch/runners/dotnet-build.js +0 -157
  144. package/extensions/dm-lens/dist/clients/dispatch/runners/elixir-check.js +0 -153
  145. package/extensions/dm-lens/dist/clients/dispatch/runners/eslint.js +0 -99
  146. package/extensions/dm-lens/dist/clients/dispatch/runners/fact-rules.js +0 -20
  147. package/extensions/dm-lens/dist/clients/dispatch/runners/fish-indent.js +0 -65
  148. package/extensions/dm-lens/dist/clients/dispatch/runners/gleam-check.js +0 -107
  149. package/extensions/dm-lens/dist/clients/dispatch/runners/go-vet.js +0 -51
  150. package/extensions/dm-lens/dist/clients/dispatch/runners/golangci-lint.js +0 -89
  151. package/extensions/dm-lens/dist/clients/dispatch/runners/hadolint.js +0 -83
  152. package/extensions/dm-lens/dist/clients/dispatch/runners/helm-lint.js +0 -144
  153. package/extensions/dm-lens/dist/clients/dispatch/runners/helm-render.js +0 -593
  154. package/extensions/dm-lens/dist/clients/dispatch/runners/htmlhint.js +0 -103
  155. package/extensions/dm-lens/dist/clients/dispatch/runners/index.js +0 -100
  156. package/extensions/dm-lens/dist/clients/dispatch/runners/javac.js +0 -82
  157. package/extensions/dm-lens/dist/clients/dispatch/runners/ktlint.js +0 -93
  158. package/extensions/dm-lens/dist/clients/dispatch/runners/lsp.js +0 -206
  159. package/extensions/dm-lens/dist/clients/dispatch/runners/markdownlint.js +0 -129
  160. package/extensions/dm-lens/dist/clients/dispatch/runners/mypy.js +0 -70
  161. package/extensions/dm-lens/dist/clients/dispatch/runners/oxlint.js +0 -305
  162. package/extensions/dm-lens/dist/clients/dispatch/runners/php-lint.js +0 -70
  163. package/extensions/dm-lens/dist/clients/dispatch/runners/phpstan.js +0 -90
  164. package/extensions/dm-lens/dist/clients/dispatch/runners/prisma-validate.js +0 -56
  165. package/extensions/dm-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +0 -307
  166. package/extensions/dm-lens/dist/clients/dispatch/runners/pyright.js +0 -118
  167. package/extensions/dm-lens/dist/clients/dispatch/runners/rubocop.js +0 -79
  168. package/extensions/dm-lens/dist/clients/dispatch/runners/ruff.js +0 -69
  169. package/extensions/dm-lens/dist/clients/dispatch/runners/rust-clippy.js +0 -147
  170. package/extensions/dm-lens/dist/clients/dispatch/runners/shellcheck.js +0 -111
  171. package/extensions/dm-lens/dist/clients/dispatch/runners/shfmt.js +0 -81
  172. package/extensions/dm-lens/dist/clients/dispatch/runners/spellcheck.js +0 -74
  173. package/extensions/dm-lens/dist/clients/dispatch/runners/spotbugs.js +0 -208
  174. package/extensions/dm-lens/dist/clients/dispatch/runners/sqlfluff.js +0 -136
  175. package/extensions/dm-lens/dist/clients/dispatch/runners/stylelint.js +0 -118
  176. package/extensions/dm-lens/dist/clients/dispatch/runners/swiftlint.js +0 -143
  177. package/extensions/dm-lens/dist/clients/dispatch/runners/taplo.js +0 -97
  178. package/extensions/dm-lens/dist/clients/dispatch/runners/terragrunt.js +0 -110
  179. package/extensions/dm-lens/dist/clients/dispatch/runners/tflint.js +0 -104
  180. package/extensions/dm-lens/dist/clients/dispatch/runners/tree-sitter.js +0 -516
  181. package/extensions/dm-lens/dist/clients/dispatch/runners/trivy-config.js +0 -155
  182. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/availability-policy.js +0 -285
  183. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/candidate-probe.js +0 -61
  184. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +0 -61
  185. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/lazy-installer.js +0 -130
  186. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +0 -1067
  187. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/spawn-outcome.js +0 -40
  188. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/tool-failure.js +0 -117
  189. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +0 -88
  190. package/extensions/dm-lens/dist/clients/dispatch/runners/utils.js +0 -8
  191. package/extensions/dm-lens/dist/clients/dispatch/runners/vale.js +0 -106
  192. package/extensions/dm-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +0 -163
  193. package/extensions/dm-lens/dist/clients/dispatch/runners/yamllint.js +0 -83
  194. package/extensions/dm-lens/dist/clients/dispatch/runners/zig-check.js +0 -72
  195. package/extensions/dm-lens/dist/clients/dispatch/suppress-writer.js +0 -57
  196. package/extensions/dm-lens/dist/clients/dispatch/tool-profile.js +0 -30
  197. package/extensions/dm-lens/dist/clients/dispatch/types.js +0 -7
  198. package/extensions/dm-lens/dist/clients/dispatch/utils/format-utils.js +0 -45
  199. package/extensions/dm-lens/dist/clients/dispatch/utils/lsp-diagnostics.js +0 -31
  200. package/extensions/dm-lens/dist/clients/disposition-logger.js +0 -19
  201. package/extensions/dm-lens/dist/clients/disposition-publish.js +0 -88
  202. package/extensions/dm-lens/dist/clients/durable-store.js +0 -77
  203. package/extensions/dm-lens/dist/clients/effective-config.js +0 -160
  204. package/extensions/dm-lens/dist/clients/env-utils.js +0 -26
  205. package/extensions/dm-lens/dist/clients/error-class.js +0 -3
  206. package/extensions/dm-lens/dist/clients/eval-timestamp.js +0 -2
  207. package/extensions/dm-lens/dist/clients/event-loop-hold.js +0 -119
  208. package/extensions/dm-lens/dist/clients/event-loop-monitor.js +0 -84
  209. package/extensions/dm-lens/dist/clients/extension-log.js +0 -230
  210. package/extensions/dm-lens/dist/clients/extension-mode.js +0 -20
  211. package/extensions/dm-lens/dist/clients/feature-hints.js +0 -88
  212. package/extensions/dm-lens/dist/clients/file-kinds.js +0 -304
  213. package/extensions/dm-lens/dist/clients/file-role.js +0 -50
  214. package/extensions/dm-lens/dist/clients/file-time.js +0 -112
  215. package/extensions/dm-lens/dist/clients/file-utils.js +0 -630
  216. package/extensions/dm-lens/dist/clients/finding-delivery-gate.js +0 -129
  217. package/extensions/dm-lens/dist/clients/finding-identity.js +0 -23
  218. package/extensions/dm-lens/dist/clients/fix-worklog.js +0 -75
  219. package/extensions/dm-lens/dist/clients/format-events-publish.js +0 -230
  220. package/extensions/dm-lens/dist/clients/format-service.js +0 -154
  221. package/extensions/dm-lens/dist/clients/formatters-lazy.js +0 -8
  222. package/extensions/dm-lens/dist/clients/formatters.js +0 -1351
  223. package/extensions/dm-lens/dist/clients/freshness-cadence.js +0 -1
  224. package/extensions/dm-lens/dist/clients/freshness.js +0 -8
  225. package/extensions/dm-lens/dist/clients/generated-artifacts.js +0 -209
  226. package/extensions/dm-lens/dist/clients/generation-guard.js +0 -105
  227. package/extensions/dm-lens/dist/clients/git-guard.js +0 -770
  228. package/extensions/dm-lens/dist/clients/git-tracked-ignore.js +0 -120
  229. package/extensions/dm-lens/dist/clients/gitleaks-client.js +0 -282
  230. package/extensions/dm-lens/dist/clients/go-client.js +0 -47
  231. package/extensions/dm-lens/dist/clients/govulncheck-client.js +0 -411
  232. package/extensions/dm-lens/dist/clients/gradle-ktfmt-style.js +0 -177
  233. package/extensions/dm-lens/dist/clients/grammar-source.js +0 -224
  234. package/extensions/dm-lens/dist/clients/gzip-stage-write.js +0 -85
  235. package/extensions/dm-lens/dist/clients/hashline-anchor.js +0 -222
  236. package/extensions/dm-lens/dist/clients/hook-budgets.js +0 -16
  237. package/extensions/dm-lens/dist/clients/host-edit-normalize.js +0 -87
  238. package/extensions/dm-lens/dist/clients/host-ports.js +0 -35
  239. package/extensions/dm-lens/dist/clients/indent-retarget.js +0 -102
  240. package/extensions/dm-lens/dist/clients/inline-blocker-dispositions.js +0 -103
  241. package/extensions/dm-lens/dist/clients/install-diagnostics.js +0 -123
  242. package/extensions/dm-lens/dist/clients/installer/index.js +0 -3770
  243. package/extensions/dm-lens/dist/clients/installer/managed-tool-refresh-session.js +0 -17
  244. package/extensions/dm-lens/dist/clients/installer/managed-tool-refresh.js +0 -522
  245. package/extensions/dm-lens/dist/clients/instance-reaper-state.js +0 -3
  246. package/extensions/dm-lens/dist/clients/instance-reaper.js +0 -577
  247. package/extensions/dm-lens/dist/clients/instance-registry-lock.js +0 -131
  248. package/extensions/dm-lens/dist/clients/instance-registry.js +0 -452
  249. package/extensions/dm-lens/dist/clients/jscpd-client.js +0 -252
  250. package/extensions/dm-lens/dist/clients/json-cache-read.js +0 -25
  251. package/extensions/dm-lens/dist/clients/knip-client.js +0 -472
  252. package/extensions/dm-lens/dist/clients/language-policy.js +0 -242
  253. package/extensions/dm-lens/dist/clients/language-profile.js +0 -261
  254. package/extensions/dm-lens/dist/clients/language-registry.js +0 -424
  255. package/extensions/dm-lens/dist/clients/latency-logger.js +0 -192
  256. package/extensions/dm-lens/dist/clients/lazy-import.js +0 -14
  257. package/extensions/dm-lens/dist/clients/ledger-bounds.js +0 -21
  258. package/extensions/dm-lens/dist/clients/lens-config.js +0 -237
  259. package/extensions/dm-lens/dist/clients/lens-engine.js +0 -181
  260. package/extensions/dm-lens/dist/clients/lens-events.js +0 -105
  261. package/extensions/dm-lens/dist/clients/lens-flag-registry.js +0 -302
  262. package/extensions/dm-lens/dist/clients/lens-map.js +0 -980
  263. package/extensions/dm-lens/dist/clients/live-bus-emitter.js +0 -53
  264. package/extensions/dm-lens/dist/clients/log-cleanup.js +0 -138
  265. package/extensions/dm-lens/dist/clients/lsp/aggregation.js +0 -88
  266. package/extensions/dm-lens/dist/clients/lsp/cascade-tier.js +0 -203
  267. package/extensions/dm-lens/dist/clients/lsp/client.js +0 -2709
  268. package/extensions/dm-lens/dist/clients/lsp/config.js +0 -252
  269. package/extensions/dm-lens/dist/clients/lsp/content-limits.js +0 -21
  270. package/extensions/dm-lens/dist/clients/lsp/diagnostic-binding.js +0 -79
  271. package/extensions/dm-lens/dist/clients/lsp/document-drift.js +0 -312
  272. package/extensions/dm-lens/dist/clients/lsp/edits.js +0 -930
  273. package/extensions/dm-lens/dist/clients/lsp/index.js +0 -4448
  274. package/extensions/dm-lens/dist/clients/lsp/inferred-project.js +0 -121
  275. package/extensions/dm-lens/dist/clients/lsp/jvm-runtime.js +0 -194
  276. package/extensions/dm-lens/dist/clients/lsp/language.js +0 -23
  277. package/extensions/dm-lens/dist/clients/lsp/launch.js +0 -468
  278. package/extensions/dm-lens/dist/clients/lsp/lombok.js +0 -146
  279. package/extensions/dm-lens/dist/clients/lsp/path-utils.js +0 -1
  280. package/extensions/dm-lens/dist/clients/lsp/pending-aux-coverage.js +0 -90
  281. package/extensions/dm-lens/dist/clients/lsp/position-encoding.js +0 -28
  282. package/extensions/dm-lens/dist/clients/lsp/ruby-drive-dirs.js +0 -42
  283. package/extensions/dm-lens/dist/clients/lsp/server.js +0 -2422
  284. package/extensions/dm-lens/dist/clients/lsp/session-roots.js +0 -52
  285. package/extensions/dm-lens/dist/clients/lsp/spawn-history.js +0 -15
  286. package/extensions/dm-lens/dist/clients/lsp/sync-kind.js +0 -30
  287. package/extensions/dm-lens/dist/clients/lsp/tsserver-sync.js +0 -156
  288. package/extensions/dm-lens/dist/clients/lsp/wait-policy/capability-snapshot.js +0 -1
  289. package/extensions/dm-lens/dist/clients/lsp/wait-policy/classification.js +0 -36
  290. package/extensions/dm-lens/dist/clients/lsp/wait-policy/index.js +0 -3
  291. package/extensions/dm-lens/dist/clients/lsp/wait-policy/strategies.js +0 -175
  292. package/extensions/dm-lens/dist/clients/lsp/watch-queue.js +0 -40
  293. package/extensions/dm-lens/dist/clients/lsp/workspace-diagnostics-cache.js +0 -267
  294. package/extensions/dm-lens/dist/clients/lsp/workspace-diagnostics-session.js +0 -7
  295. package/extensions/dm-lens/dist/clients/lsp/workspace-sweep-hold.js +0 -93
  296. package/extensions/dm-lens/dist/clients/lsp-budget.js +0 -83
  297. package/extensions/dm-lens/dist/clients/lsp-document-symbols.js +0 -93
  298. package/extensions/dm-lens/dist/clients/lsp-lazy.js +0 -8
  299. package/extensions/dm-lens/dist/clients/lsp-mutation.js +0 -273
  300. package/extensions/dm-lens/dist/clients/lsp-status.js +0 -37
  301. package/extensions/dm-lens/dist/clients/map-with-concurrency.js +0 -20
  302. package/extensions/dm-lens/dist/clients/mcp/analyze.js +0 -251
  303. package/extensions/dm-lens/dist/clients/mcp/host-shim.js +0 -14
  304. package/extensions/dm-lens/dist/clients/mcp/ipc.js +0 -302
  305. package/extensions/dm-lens/dist/clients/mcp/review.js +0 -137
  306. package/extensions/dm-lens/dist/clients/mcp/session.js +0 -305
  307. package/extensions/dm-lens/dist/clients/memory-sampler.js +0 -107
  308. package/extensions/dm-lens/dist/clients/message-end-attribution.js +0 -18
  309. package/extensions/dm-lens/dist/clients/metrics-client.js +0 -80
  310. package/extensions/dm-lens/dist/clients/metrics-history.js +0 -255
  311. package/extensions/dm-lens/dist/clients/middle-man-analysis.js +0 -161
  312. package/extensions/dm-lens/dist/clients/model-provider.js +0 -31
  313. package/extensions/dm-lens/dist/clients/module-report-lsp.js +0 -140
  314. package/extensions/dm-lens/dist/clients/module-report.js +0 -1642
  315. package/extensions/dm-lens/dist/clients/mutating-tool.js +0 -377
  316. package/extensions/dm-lens/dist/clients/mutation-attribution.js +0 -168
  317. package/extensions/dm-lens/dist/clients/mutation-bridge.js +0 -102
  318. package/extensions/dm-lens/dist/clients/ndjson-logger.js +0 -471
  319. package/extensions/dm-lens/dist/clients/observed-mutation-sources.js +0 -43
  320. package/extensions/dm-lens/dist/clients/observed-mutation.js +0 -709
  321. package/extensions/dm-lens/dist/clients/oldtext-autopatch.js +0 -100
  322. package/extensions/dm-lens/dist/clients/opaque-mutation-scan.js +0 -313
  323. package/extensions/dm-lens/dist/clients/opengrep-client.js +0 -216
  324. package/extensions/dm-lens/dist/clients/opengrep-config.js +0 -52
  325. package/extensions/dm-lens/dist/clients/package-manager.js +0 -303
  326. package/extensions/dm-lens/dist/clients/package-root.js +0 -25
  327. package/extensions/dm-lens/dist/clients/partial-edit-apply.js +0 -337
  328. package/extensions/dm-lens/dist/clients/path-attribution-telemetry.js +0 -31
  329. package/extensions/dm-lens/dist/clients/path-keyed-map.js +0 -57
  330. package/extensions/dm-lens/dist/clients/path-utils.js +0 -476
  331. package/extensions/dm-lens/dist/clients/performance-report.js +0 -291
  332. package/extensions/dm-lens/dist/clients/persist-debounce.js +0 -37
  333. package/extensions/dm-lens/dist/clients/persistent-reverify.js +0 -165
  334. package/extensions/dm-lens/dist/clients/php-cs-fixer-config.js +0 -15
  335. package/extensions/dm-lens/dist/clients/pipeline.js +0 -1091
  336. package/extensions/dm-lens/dist/clients/post-autofix-notice.js +0 -19
  337. package/extensions/dm-lens/dist/clients/print-mode.js +0 -3
  338. package/extensions/dm-lens/dist/clients/probe-home-state.js +0 -62
  339. package/extensions/dm-lens/dist/clients/process-bridge.js +0 -20
  340. package/extensions/dm-lens/dist/clients/process-singletons.js +0 -69
  341. package/extensions/dm-lens/dist/clients/process-snapshot.js +0 -22
  342. package/extensions/dm-lens/dist/clients/project-changes.js +0 -112
  343. package/extensions/dm-lens/dist/clients/project-conventions.js +0 -152
  344. package/extensions/dm-lens/dist/clients/project-diagnostics/cache.js +0 -91
  345. package/extensions/dm-lens/dist/clients/project-diagnostics/extractors.js +0 -53
  346. package/extensions/dm-lens/dist/clients/project-diagnostics/fresh-fetch.js +0 -408
  347. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/call-graph-impact.js +0 -64
  348. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/dead-code.js +0 -38
  349. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/gitleaks.js +0 -21
  350. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/govulncheck.js +0 -23
  351. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/jscpd.js +0 -28
  352. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/knip.js +0 -45
  353. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/madge.js +0 -34
  354. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/opengrep.js +0 -32
  355. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +0 -79
  356. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/trivy.js +0 -41
  357. package/extensions/dm-lens/dist/clients/project-diagnostics/scanner.js +0 -349
  358. package/extensions/dm-lens/dist/clients/project-diagnostics/types.js +0 -1
  359. package/extensions/dm-lens/dist/clients/project-lens-config.js +0 -437
  360. package/extensions/dm-lens/dist/clients/project-report.js +0 -527
  361. package/extensions/dm-lens/dist/clients/project-scale.js +0 -60
  362. package/extensions/dm-lens/dist/clients/project-scan-policy.js +0 -4
  363. package/extensions/dm-lens/dist/clients/project-snapshot-fingerprint.js +0 -39
  364. package/extensions/dm-lens/dist/clients/project-snapshot-persist-worker.js +0 -14
  365. package/extensions/dm-lens/dist/clients/project-snapshot.js +0 -1178
  366. package/extensions/dm-lens/dist/clients/project-trust.js +0 -104
  367. package/extensions/dm-lens/dist/clients/python-environment.js +0 -120
  368. package/extensions/dm-lens/dist/clients/python-provenance.js +0 -551
  369. package/extensions/dm-lens/dist/clients/quiet-window-config.js +0 -16
  370. package/extensions/dm-lens/dist/clients/quiet-window.js +0 -126
  371. package/extensions/dm-lens/dist/clients/read-bridge.js +0 -46
  372. package/extensions/dm-lens/dist/clients/read-expansion.js +0 -218
  373. package/extensions/dm-lens/dist/clients/read-guard-logger.js +0 -178
  374. package/extensions/dm-lens/dist/clients/read-guard-tool-lines.js +0 -1042
  375. package/extensions/dm-lens/dist/clients/read-guard.js +0 -1096
  376. package/extensions/dm-lens/dist/clients/recent-touches.js +0 -126
  377. package/extensions/dm-lens/dist/clients/redact/secrets.js +0 -386
  378. package/extensions/dm-lens/dist/clients/resource-sampler.js +0 -344
  379. package/extensions/dm-lens/dist/clients/reverse-deps.js +0 -227
  380. package/extensions/dm-lens/dist/clients/review-graph/builder.js +0 -3635
  381. package/extensions/dm-lens/dist/clients/review-graph/format.js +0 -30
  382. package/extensions/dm-lens/dist/clients/review-graph/git-identity.js +0 -115
  383. package/extensions/dm-lens/dist/clients/review-graph/import-resolvers.js +0 -325
  384. package/extensions/dm-lens/dist/clients/review-graph/persist-worker.js +0 -8
  385. package/extensions/dm-lens/dist/clients/review-graph/query.js +0 -195
  386. package/extensions/dm-lens/dist/clients/review-graph/revision-drift.js +0 -3
  387. package/extensions/dm-lens/dist/clients/review-graph/service.js +0 -60
  388. package/extensions/dm-lens/dist/clients/review-graph/shared-extraction-ir.js +0 -54
  389. package/extensions/dm-lens/dist/clients/review-graph/symbol-id.js +0 -29
  390. package/extensions/dm-lens/dist/clients/review-graph/tsconfig-paths.js +0 -253
  391. package/extensions/dm-lens/dist/clients/review-graph/types.js +0 -1
  392. package/extensions/dm-lens/dist/clients/review-graph/workspace-modules.js +0 -374
  393. package/extensions/dm-lens/dist/clients/review-graph-logger.js +0 -51
  394. package/extensions/dm-lens/dist/clients/ruff-client.js +0 -109
  395. package/extensions/dm-lens/dist/clients/rules-scanner.js +0 -113
  396. package/extensions/dm-lens/dist/clients/run-duration.js +0 -9
  397. package/extensions/dm-lens/dist/clients/runtime-agent-end.js +0 -608
  398. package/extensions/dm-lens/dist/clients/runtime-config.js +0 -39
  399. package/extensions/dm-lens/dist/clients/runtime-context.js +0 -155
  400. package/extensions/dm-lens/dist/clients/runtime-coordinator.js +0 -817
  401. package/extensions/dm-lens/dist/clients/runtime-session.js +0 -1625
  402. package/extensions/dm-lens/dist/clients/runtime-tool-call.js +0 -868
  403. package/extensions/dm-lens/dist/clients/runtime-tool-result.js +0 -1317
  404. package/extensions/dm-lens/dist/clients/runtime-turn.js +0 -2333
  405. package/extensions/dm-lens/dist/clients/rust-client.js +0 -48
  406. package/extensions/dm-lens/dist/clients/safe-spawn.js +0 -1267
  407. package/extensions/dm-lens/dist/clients/sanitize.js +0 -174
  408. package/extensions/dm-lens/dist/clients/scan-utils.js +0 -7
  409. package/extensions/dm-lens/dist/clients/scratch-tree-policy.js +0 -57
  410. package/extensions/dm-lens/dist/clients/search-read-registration.js +0 -59
  411. package/extensions/dm-lens/dist/clients/secret-findings.js +0 -69
  412. package/extensions/dm-lens/dist/clients/security-scan-client.js +0 -208
  413. package/extensions/dm-lens/dist/clients/session-event-guard.js +0 -111
  414. package/extensions/dm-lens/dist/clients/session-lifecycle.js +0 -173
  415. package/extensions/dm-lens/dist/clients/session-start-observability.js +0 -47
  416. package/extensions/dm-lens/dist/clients/session-state-store.js +0 -63
  417. package/extensions/dm-lens/dist/clients/session-summary.js +0 -8
  418. package/extensions/dm-lens/dist/clients/sessionstart-logger.js +0 -22
  419. package/extensions/dm-lens/dist/clients/sg-runner.js +0 -627
  420. package/extensions/dm-lens/dist/clients/sgconfig.js +0 -280
  421. package/extensions/dm-lens/dist/clients/shared-checkout-guard.js +0 -177
  422. package/extensions/dm-lens/dist/clients/single-flight.js +0 -52
  423. package/extensions/dm-lens/dist/clients/situational-tool-telemetry.js +0 -85
  424. package/extensions/dm-lens/dist/clients/skills-resolver.js +0 -38
  425. package/extensions/dm-lens/dist/clients/slow-fs.js +0 -77
  426. package/extensions/dm-lens/dist/clients/smells-rollup.js +0 -118
  427. package/extensions/dm-lens/dist/clients/source-filter.js +0 -320
  428. package/extensions/dm-lens/dist/clients/source-walker.js +0 -96
  429. package/extensions/dm-lens/dist/clients/spawn-output-cap.js +0 -35
  430. package/extensions/dm-lens/dist/clients/spawn-timeout-cooldown.js +0 -51
  431. package/extensions/dm-lens/dist/clients/stale-marker.js +0 -1
  432. package/extensions/dm-lens/dist/clients/startup-scan.js +0 -222
  433. package/extensions/dm-lens/dist/clients/startup-timing.js +0 -67
  434. package/extensions/dm-lens/dist/clients/string-utils.js +0 -6
  435. package/extensions/dm-lens/dist/clients/subagent-mode.js +0 -40
  436. package/extensions/dm-lens/dist/clients/symbol-containment.js +0 -16
  437. package/extensions/dm-lens/dist/clients/symbol-types.js +0 -1
  438. package/extensions/dm-lens/dist/clients/test-runner-client.js +0 -1504
  439. package/extensions/dm-lens/dist/clients/test-runner-delivery.js +0 -260
  440. package/extensions/dm-lens/dist/clients/todo-scanner.js +0 -164
  441. package/extensions/dm-lens/dist/clients/tool-agreement.js +0 -377
  442. package/extensions/dm-lens/dist/clients/tool-config.js +0 -218
  443. package/extensions/dm-lens/dist/clients/tool-cwd.js +0 -235
  444. package/extensions/dm-lens/dist/clients/tool-definition.js +0 -22
  445. package/extensions/dm-lens/dist/clients/tool-event.js +0 -18
  446. package/extensions/dm-lens/dist/clients/tool-policy.js +0 -2393
  447. package/extensions/dm-lens/dist/clients/tool-probe.js +0 -5
  448. package/extensions/dm-lens/dist/clients/tool-render.js +0 -79
  449. package/extensions/dm-lens/dist/clients/tool-set-policy.js +0 -70
  450. package/extensions/dm-lens/dist/clients/tree-sitter-cache.js +0 -206
  451. package/extensions/dm-lens/dist/clients/tree-sitter-client.js +0 -2787
  452. package/extensions/dm-lens/dist/clients/tree-sitter-logger.js +0 -77
  453. package/extensions/dm-lens/dist/clients/tree-sitter-navigator.js +0 -198
  454. package/extensions/dm-lens/dist/clients/tree-sitter-query-loader.js +0 -318
  455. package/extensions/dm-lens/dist/clients/tree-sitter-shared.js +0 -87
  456. package/extensions/dm-lens/dist/clients/tree-sitter-symbol-extractor.js +0 -957
  457. package/extensions/dm-lens/dist/clients/trivy-client.js +0 -305
  458. package/extensions/dm-lens/dist/clients/tui-fit.js +0 -26
  459. package/extensions/dm-lens/dist/clients/turn-context.js +0 -48
  460. package/extensions/dm-lens/dist/clients/turn-end/lane.js +0 -1
  461. package/extensions/dm-lens/dist/clients/turn-end/lanes/govulncheck.js +0 -54
  462. package/extensions/dm-lens/dist/clients/turn-end/lanes/secrets.js +0 -131
  463. package/extensions/dm-lens/dist/clients/turn-summary-render.js +0 -56
  464. package/extensions/dm-lens/dist/clients/turn-summary.js +0 -84
  465. package/extensions/dm-lens/dist/clients/typos-config.js +0 -9
  466. package/extensions/dm-lens/dist/clients/user-notify.js +0 -15
  467. package/extensions/dm-lens/dist/clients/vanished-instance-marker.js +0 -18
  468. package/extensions/dm-lens/dist/clients/warm-attach.js +0 -210
  469. package/extensions/dm-lens/dist/clients/widget-state.js +0 -963
  470. package/extensions/dm-lens/dist/clients/word-index-logger.js +0 -21
  471. package/extensions/dm-lens/dist/clients/word-index-store.js +0 -222
  472. package/extensions/dm-lens/dist/clients/word-index.js +0 -1426
  473. package/extensions/dm-lens/dist/clients/workspace-topology.js +0 -261
  474. package/extensions/dm-lens/dist/clients/write-ordering-guard.js +0 -24
  475. package/extensions/dm-lens/dist/clients/zizmor-config.js +0 -160
  476. package/extensions/dm-lens/dist/i18n.js +0 -67
  477. package/extensions/dm-lens/dist/index.js +0 -1782
  478. package/extensions/dm-lens/dist/mcp/analyze-cli.js +0 -178
  479. package/extensions/dm-lens/dist/mcp/build-staleness.js +0 -55
  480. package/extensions/dm-lens/dist/mcp/cli.js +0 -78
  481. package/extensions/dm-lens/dist/mcp/server.js +0 -1208
  482. package/extensions/dm-lens/dist/mcp/worker.js +0 -33
  483. package/extensions/dm-lens/dist/scripts/lib/process-scan.mjs +0 -256
  484. package/extensions/dm-lens/dist/scripts/lib/skills-predicate.mjs +0 -53
  485. package/extensions/dm-lens/dist/scripts/lib/web-tree-sitter-dir.mjs +0 -45
  486. package/extensions/dm-lens/dist/tools/activate-tools.js +0 -61
  487. package/extensions/dm-lens/dist/tools/ast-grep-outline.js +0 -127
  488. package/extensions/dm-lens/dist/tools/ast-grep-replace.js +0 -226
  489. package/extensions/dm-lens/dist/tools/ast-grep-search.js +0 -687
  490. package/extensions/dm-lens/dist/tools/effective-config.js +0 -59
  491. package/extensions/dm-lens/dist/tools/lens-diagnostic-mark.js +0 -240
  492. package/extensions/dm-lens/dist/tools/lens-diagnostics.js +0 -1484
  493. package/extensions/dm-lens/dist/tools/lsp-diagnostics.js +0 -1088
  494. package/extensions/dm-lens/dist/tools/lsp-navigation.js +0 -1194
  495. package/extensions/dm-lens/dist/tools/lsp-structured-output.js +0 -277
  496. package/extensions/dm-lens/dist/tools/module-report.js +0 -332
  497. package/extensions/dm-lens/dist/tools/project-report.js +0 -72
  498. package/extensions/dm-lens/dist/tools/render-compact.js +0 -272
  499. package/extensions/dm-lens/dist/tools/scan-progress.js +0 -31
  500. package/extensions/dm-lens/dist/tools/shared.js +0 -26
  501. package/extensions/dm-lens/dist/tools/symbol-search.js +0 -133
  502. package/extensions/dm-mcp-adapter/dist/abort.js +0 -35
  503. package/extensions/dm-mcp-adapter/dist/agent-dir.js +0 -45
  504. package/extensions/dm-mcp-adapter/dist/agent-plugin-loader.js +0 -392
  505. package/extensions/dm-mcp-adapter/dist/agent-plugin-provenance.js +0 -26
  506. package/extensions/dm-mcp-adapter/dist/bearer-command-resolver.js +0 -182
  507. package/extensions/dm-mcp-adapter/dist/claude-plugin-loader.js +0 -350
  508. package/extensions/dm-mcp-adapter/dist/config.js +0 -1310
  509. package/extensions/dm-mcp-adapter/dist/consent-manager.js +0 -84
  510. package/extensions/dm-mcp-adapter/dist/elicitation-handler.js +0 -308
  511. package/extensions/dm-mcp-adapter/dist/errors.js +0 -225
  512. package/extensions/dm-mcp-adapter/dist/http-ca.js +0 -71
  513. package/extensions/dm-mcp-adapter/dist/jev-client.js +0 -359
  514. package/extensions/dm-mcp-adapter/dist/jev-contracts.js +0 -1
  515. package/extensions/dm-mcp-adapter/dist/jev-key-store.js +0 -176
  516. package/extensions/dm-mcp-adapter/dist/json-schema-validator.js +0 -70
  517. package/extensions/dm-mcp-adapter/dist/lifecycle.js +0 -387
  518. package/extensions/dm-mcp-adapter/dist/logger.js +0 -115
  519. package/extensions/dm-mcp-adapter/dist/mcp-auth-fetch.js +0 -86
  520. package/extensions/dm-mcp-adapter/dist/mcp-auth-flow.js +0 -949
  521. package/extensions/dm-mcp-adapter/dist/mcp-auth.js +0 -997
  522. package/extensions/dm-mcp-adapter/dist/mcp-bearer-store.js +0 -182
  523. package/extensions/dm-mcp-adapter/dist/mcp-callback-server.js +0 -381
  524. package/extensions/dm-mcp-adapter/dist/mcp-oauth-provider.js +0 -524
  525. package/extensions/dm-mcp-adapter/dist/mcp-probe.js +0 -151
  526. package/extensions/dm-mcp-adapter/dist/mcp-tasks.js +0 -300
  527. package/extensions/dm-mcp-adapter/dist/mcp-trace.js +0 -215
  528. package/extensions/dm-mcp-adapter/dist/metadata-cache.js +0 -267
  529. package/extensions/dm-mcp-adapter/dist/npx-resolver.js +0 -465
  530. package/extensions/dm-mcp-adapter/dist/package-mcp-loader.js +0 -135
  531. package/extensions/dm-mcp-adapter/dist/request-headers-command.js +0 -294
  532. package/extensions/dm-mcp-adapter/dist/resource-tools.js +0 -7
  533. package/extensions/dm-mcp-adapter/dist/runtime-owner.js +0 -94
  534. package/extensions/dm-mcp-adapter/dist/sampling-handler.js +0 -213
  535. package/extensions/dm-mcp-adapter/dist/secure-keyring.js +0 -191
  536. package/extensions/dm-mcp-adapter/dist/server-manager.js +0 -1514
  537. package/extensions/dm-mcp-adapter/dist/session-approvals.js +0 -127
  538. package/extensions/dm-mcp-adapter/dist/session-recovery.js +0 -82
  539. package/extensions/dm-mcp-adapter/dist/state.js +0 -1
  540. package/extensions/dm-mcp-adapter/dist/types.js +0 -286
  541. package/extensions/dm-mcp-adapter/dist/ui-app-bridge-helpers.js +0 -36
  542. package/extensions/dm-mcp-adapter/dist/ui-resource-handler.js +0 -204
  543. package/extensions/dm-mcp-adapter/dist/ui-stream-types.js +0 -58
  544. package/extensions/dm-mcp-adapter/dist/ui-tool-visibility.js +0 -26
  545. package/extensions/dm-mcp-adapter/dist/unix-socket-transport.js +0 -83
  546. package/extensions/dm-mcp-adapter/dist/utils.js +0 -382
@@ -1,2422 +0,0 @@
1
- import { existsSync, mkdirSync, statSync } from "node:fs";
2
- import { access, readFile, readdir, stat } from "node:fs/promises";
3
- import os from "node:os";
4
- import path from "node:path";
5
- import { getGlobalDmLensDir, getProjectIgnoreGlobs, isPathIgnoredByProject } from "../file-utils.js";
6
- import { augmentPythonEnvironment, detectPythonEnvironment, detectPythonVenv, pythonEnvironmentToolCandidates } from "../python-environment.js";
7
-
8
- export { detectPythonVenv };
9
- import { STAGE_TMP_PATTERN } from "../atomic-write-staging.js";
10
- import { DOTNET_CSHARP_ROOT_MARKERS, DOTNET_FSHARP_ROOT_MARKERS, KIND_EXTENSIONS } from "../file-kinds.js";
11
- import { extensionsForLanguage } from "../language-registry.js";
12
- import { CARGO_WORKSPACE_MEMBER_DIALECT, direntsHaveMarkerGlobMatch, isAtOrAboveHomeDir, isFullyQualified, isWindowsPath, matchesWorkspaceMemberPattern, normalizeEphemeralMapKey, pathsEqual, toPosix } from "../path-utils.js";
13
- import { ensureTool, findManagedToolBinary, getToolEnvironment, getToolPath } from "../installer/index.js";
14
- import * as installer from "../installer/index.js";
15
- import { classifyProbeFailure, describeInstallAttempt, logAvailabilityDecision } from "../dispatch/runners/utils/availability-policy.js";
16
- import { resolveOpengrepConfig } from "../opengrep-config.js";
17
- import { isZizmorAuditTarget, resolveZizmorGitHubToken } from "../zizmor-config.js";
18
- import { logLatency } from "../latency-logger.js";
19
- import { logSessionStart } from "../sessionstart-logger.js";
20
- import { findLocalSgconfig, resolveBaselineSgconfig } from "../sgconfig.js";
21
- import { findLocalTyposConfig } from "../typos-config.js";
22
- import { resolvePackagePath } from "../package-root.js";
23
- import { resolveToolCwd } from "../tool-cwd.js";
24
- import { dirMtimeRecordsAsync, dirMtimesStillFreshAsync, unknownDirMtimeRecords } from "../workspace-topology.js";
25
- import { bounded } from "../deadline-utils.js";
26
- import { FRESHNESS_CADENCE_MS } from "../freshness-cadence.js";
27
- import { HOOK_WALL_BUDGET_MS } from "../hook-budgets.js";
28
- import { recordDegradationOnce } from "../degradation-ledger.js";
29
- import { hasCargoWorkspaceTable, readCargoWorkspaceExclude, readCargoWorkspaceMembers, readTextFileOrUndefined } from "../cargo-manifest.js";
30
- import { resolveAstGrepNativeExe } from "./wait-policy/index.js";
31
- import { hasSpawnFailureKind, isCommandAvailableAsync, safeSpawnAsync } from "../safe-spawn.js";
32
- import { launchLSP } from "./launch.js";
33
- import { createLombokJdtlsArgs } from "./lombok.js";
34
- import { resolveJavaRuntimeEnv } from "./jvm-runtime.js";
35
- import { normalizeMapKey } from "./path-utils.js";
36
- import { getRubyVersionDirNamesSync } from "./ruby-drive-dirs.js";
37
- import { getProcessSingleton } from "../process-singletons.js";
38
- import { createGenerationSource } from "../generation-guard.js";
39
- function withRootMarkers(root, markers) {
40
- root.rootMarkers = markers;
41
- return root;
42
- }
43
- export async function resolveLspServerCwd(server, filePath, sessionCwd, onRootFailure) {
44
- const rootMarkers = server.rootMarkers ?? server.root.rootMarkers;
45
- let serverRoot;
46
- let rootFailed = false;
47
- try {
48
- serverRoot = await server.root(filePath);
49
- } catch (error) {
50
- const reason = error instanceof Error ? error.message : String(error);
51
- rootFailed = true;
52
- onRootFailure?.(reason);
53
- }
54
- const isFileDirFallback = serverRoot !== undefined && rootMarkers?.length && path.resolve(serverRoot) === path.resolve(path.dirname(filePath));
55
- if (!serverRoot || isFileDirFallback) {
56
- if (!serverRoot) {
57
- recordDegradationOnce({
58
- kind: "tool-cwd-resolution",
59
- subject: server.id,
60
- reason: `lsp:server-root-${rootFailed ? "failed" : "fallback"}:${filePath}`
61
- });
62
- }
63
- if (!rootMarkers?.length)
64
- return;
65
- return resolveToolCwd("lsp", server.id, filePath, {
66
- cwd: path.dirname(path.resolve(filePath)),
67
- rootMarkers
68
- }).cwd;
69
- }
70
- const boundedServerRoot = enforceLspRootCeiling(serverRoot, sessionCwd, filePath);
71
- return resolveToolCwd("lsp", server.id, filePath, {
72
- cwd: sessionCwd,
73
- rootMarkers,
74
- serverRoot: boundedServerRoot
75
- }).cwd;
76
- }
77
- const FIXTURE_ROOT_SEGMENTS = new Set(["__fixtures__", "testdata"]);
78
- const FALLBACK_PROJECT_MARKERS = [
79
- ".git",
80
- "package.json",
81
- "go.work",
82
- "go.mod",
83
- "Cargo.toml",
84
- "pyproject.toml",
85
- "pom.xml",
86
- "build.gradle",
87
- "build.gradle.kts",
88
- "mix.exs",
89
- "pubspec.yaml",
90
- "Package.swift"
91
- ];
92
- const PROJECT_BOUNDARY_MARKERS = [
93
- "package.json",
94
- "package-lock.json",
95
- "pnpm-lock.yaml",
96
- "yarn.lock",
97
- "bun.lock",
98
- "bun.lockb",
99
- "go.work",
100
- "go.mod",
101
- "Cargo.toml",
102
- "Cargo.lock",
103
- "pyproject.toml",
104
- "uv.lock",
105
- "poetry.lock",
106
- "Pipfile",
107
- "Pipfile.lock",
108
- "pom.xml",
109
- "build.gradle",
110
- "build.gradle.kts",
111
- "settings.gradle",
112
- "settings.gradle.kts",
113
- "mix.exs",
114
- "pubspec.yaml",
115
- "Package.swift"
116
- ];
117
- const loggedRootCeilingClamps = new Set;
118
- const posixCaseInsensitiveByPath = new Map;
119
- function posixFilesystemIsCaseInsensitive(root) {
120
- const resolved = path.resolve(root);
121
- const cached = posixCaseInsensitiveByPath.get(resolved);
122
- if (cached !== undefined)
123
- return cached;
124
- if (!existsSync(resolved)) {
125
- return false;
126
- }
127
- const name = path.basename(resolved);
128
- const alternate = name.toLowerCase() === name ? name.toUpperCase() : name.toLowerCase();
129
- let insensitive = false;
130
- const alternatePath = path.join(path.dirname(resolved), alternate);
131
- if (alternate !== name && existsSync(alternatePath)) {
132
- try {
133
- const actual = statSync(resolved);
134
- const alternateStat = statSync(alternatePath);
135
- insensitive = actual.dev === alternateStat.dev && actual.ino === alternateStat.ino;
136
- } catch {
137
- insensitive = false;
138
- }
139
- }
140
- posixCaseInsensitiveByPath.set(resolved, insensitive);
141
- return insensitive;
142
- }
143
- export function resetLSPCaseSensitivityState() {
144
- posixCaseInsensitiveByPath.clear();
145
- }
146
- export function _getPosixCaseSensitivityCacheSizeForTests() {
147
- return posixCaseInsensitiveByPath.size;
148
- }
149
- export function isSameOrWithin(ancestor, candidate, deps = {}) {
150
- const windowsShaped = isWindowsPath(ancestor) || isWindowsPath(candidate);
151
- const pathApi = windowsShaped ? path.win32 : path;
152
- const resolvedAncestor = pathApi.resolve(ancestor);
153
- const resolvedCandidate = pathApi.resolve(candidate);
154
- let caseInsensitive = false;
155
- if (!windowsShaped) {
156
- if (deps.caseInsensitiveProbe) {
157
- const cached = posixCaseInsensitiveByPath.get(resolvedAncestor);
158
- caseInsensitive = cached ?? deps.caseInsensitiveProbe(resolvedAncestor);
159
- if (cached === undefined) {
160
- posixCaseInsensitiveByPath.set(resolvedAncestor, caseInsensitive);
161
- }
162
- } else {
163
- caseInsensitive = posixFilesystemIsCaseInsensitive(resolvedAncestor);
164
- }
165
- }
166
- const relative = pathApi.relative(caseInsensitive ? resolvedAncestor.toLowerCase() : resolvedAncestor, caseInsensitive ? resolvedCandidate.toLowerCase() : resolvedCandidate);
167
- return relative === "" || !relative.startsWith("..") && !pathApi.isAbsolute(relative);
168
- }
169
- export function enforceLspRootCeiling(root, sessionCwd, filePath) {
170
- const windowsShaped = isWindowsPath(root) || isWindowsPath(sessionCwd);
171
- const pathApi = windowsShaped ? path.win32 : path;
172
- const resolvedRoot = pathApi.resolve(root);
173
- const resolvedCwd = pathApi.resolve(sessionCwd);
174
- if (filePath && !isSameOrWithin(resolvedCwd, pathApi.resolve(filePath))) {
175
- return resolvedRoot;
176
- }
177
- if (isSameOrWithin(resolvedCwd, resolvedRoot))
178
- return resolvedRoot;
179
- const logKey = `${normalizeMapKey(resolvedCwd)}:${normalizeMapKey(resolvedRoot)}`;
180
- if (!loggedRootCeilingClamps.has(logKey)) {
181
- loggedRootCeilingClamps.add(logKey);
182
- logSessionStart(`lsp root clamped to session cwd: candidate=${resolvedRoot} cwd=${resolvedCwd}`);
183
- }
184
- return resolvedCwd;
185
- }
186
- export async function hasProjectBoundaryMarker(dir) {
187
- if (await markerExists(dir, ".git"))
188
- return true;
189
- for (const marker of PROJECT_BOUNDARY_MARKERS) {
190
- if (await markerExists(dir, marker))
191
- return true;
192
- }
193
- return false;
194
- }
195
- function pathSegments(dir) {
196
- const parsed = path.parse(path.resolve(dir));
197
- return path.relative(parsed.root, path.resolve(dir)).split(path.sep).filter(Boolean).map((segment) => segment.toLowerCase());
198
- }
199
- function hasFixtureConvention(dir) {
200
- const segments = pathSegments(dir);
201
- if (segments.some((segment) => FIXTURE_ROOT_SEGMENTS.has(segment)))
202
- return true;
203
- return segments.some((segment, index) => segment === "tests" && segments[index + 1] === "fixtures");
204
- }
205
- function hasAtomicStageSegment(dir) {
206
- return pathSegments(dir).some((segment) => STAGE_TMP_PATTERN.test(segment));
207
- }
208
- async function findGitBoundary(dir) {
209
- let current = path.resolve(dir);
210
- const fsRoot = path.parse(current).root;
211
- while (true) {
212
- if (await markerExists(current, ".git"))
213
- return current;
214
- if (current === fsRoot)
215
- return;
216
- current = path.dirname(current);
217
- }
218
- }
219
- async function isExcludedLspRoot(dir) {
220
- const candidate = path.resolve(dir);
221
- if (hasFixtureConvention(candidate) || hasAtomicStageSegment(candidate))
222
- return true;
223
- const gitRoot = await findGitBoundary(candidate);
224
- if (!gitRoot || gitRoot === candidate)
225
- return false;
226
- if (getProjectIgnoreGlobs(gitRoot).length === 0)
227
- return false;
228
- return isPathIgnoredByProject(candidate, gitRoot, true);
229
- }
230
- async function nearestNonExcludedFallbackRoot(candidate) {
231
- if (!await isExcludedLspRoot(candidate))
232
- return path.resolve(candidate);
233
- let current = path.dirname(path.resolve(candidate));
234
- const fsRoot = path.parse(current).root;
235
- let nearestAllowed;
236
- while (true) {
237
- if (!await isExcludedLspRoot(current)) {
238
- nearestAllowed ??= current;
239
- for (const marker of FALLBACK_PROJECT_MARKERS) {
240
- if (await markerExists(current, marker))
241
- return current;
242
- }
243
- }
244
- if (current === fsRoot)
245
- break;
246
- current = path.dirname(current);
247
- }
248
- return nearestAllowed ?? fsRoot;
249
- }
250
- function isLspInstallDisabled() {
251
- return process.env.DM_LENS_DISABLE_LSP_INSTALL === "1";
252
- }
253
- function canInstall(allowInstall) {
254
- return allowInstall !== false && !isLspInstallDisabled();
255
- }
256
- const DIRECT_LSP_NEGATIVE_TTL_MS = Math.max(30000, Number.parseInt(process.env.DM_LENS_DIRECT_LSP_NEGATIVE_TTL_MS ?? "600000", 10) || 600000);
257
- const directLspCommandUnavailableUntil = new Map;
258
- const directLspCommandSkipLoggedUntil = new Map;
259
- const lspLaunchAvailabilityGeneration = createGenerationSource("lsp-launch-availability");
260
- export function resetLspLaunchAvailabilityGeneration() {
261
- lspLaunchAvailabilityGeneration.bump();
262
- }
263
- function staleLaunch(generation, subject, proc) {
264
- if (generation.isCurrent())
265
- return false;
266
- try {
267
- proc?.process?.kill();
268
- } catch {}
269
- generation.guardedWrite(subject, () => {
270
- return;
271
- });
272
- return true;
273
- }
274
- async function installEvidenceForLaunch(toolId, installed, attempt) {
275
- const evidence = describeInstallAttempt(attempt);
276
- const confirmedManagedPath = await findManagedToolBinary(toolId);
277
- return {
278
- ...evidence,
279
- binary: path.basename(installed),
280
- ...confirmedManagedPath !== undefined && pathsEqual(confirmedManagedPath, installed) && {
281
- source: "managed-dir"
282
- }
283
- };
284
- }
285
- function captureInstallAttempt(toolId) {
286
- try {
287
- return installer.getInstallAttempt?.(toolId);
288
- } catch {}
289
- return;
290
- }
291
- export function resetDirectLspCommandAvailability() {
292
- directLspCommandUnavailableUntil.clear();
293
- directLspCommandSkipLoggedUntil.clear();
294
- }
295
- export function _markDirectLspCommandUnavailableForTests(command) {
296
- markDirectLspCommandUnavailable(command);
297
- }
298
- function pruneExpiredDirectLspNegativeEntries(now = Date.now()) {
299
- for (const [command, until] of directLspCommandUnavailableUntil) {
300
- if (until <= now) {
301
- directLspCommandUnavailableUntil.delete(command);
302
- directLspCommandSkipLoggedUntil.delete(command);
303
- }
304
- }
305
- for (const [command, until] of directLspCommandSkipLoggedUntil) {
306
- if (until <= now)
307
- directLspCommandSkipLoggedUntil.delete(command);
308
- }
309
- }
310
- function isSimpleCommand(command) {
311
- return !isFullyQualified(command) && !command.includes("/") && !command.includes("\\");
312
- }
313
- export function isDirectLspCommandTemporarilyUnavailable(command) {
314
- const now = Date.now();
315
- pruneExpiredDirectLspNegativeEntries(now);
316
- const until = directLspCommandUnavailableUntil.get(command);
317
- if (!until || until <= now) {
318
- directLspCommandUnavailableUntil.delete(command);
319
- return false;
320
- }
321
- const loggedUntil = directLspCommandSkipLoggedUntil.get(command) ?? 0;
322
- if (loggedUntil <= now) {
323
- logSessionStart(`lsp direct command ${command}: skipped by negative availability cache (${Math.max(0, until - now)}ms remaining)`);
324
- directLspCommandSkipLoggedUntil.set(command, until);
325
- }
326
- return true;
327
- }
328
- function markDirectLspCommandUnavailable(command) {
329
- if (!isSimpleCommand(command))
330
- return;
331
- directLspCommandUnavailableUntil.set(command, Date.now() + DIRECT_LSP_NEGATIVE_TTL_MS);
332
- directLspCommandSkipLoggedUntil.delete(command);
333
- }
334
- const DM_LENS_BIN_DIR = path.join(getGlobalDmLensDir(), "bin");
335
- export async function resolveAndLaunch(spec, allowInstall) {
336
- const generation = lspLaunchAvailabilityGeneration.capture();
337
- const toolLabel = spec.managedToolId ?? spec.candidates[spec.candidates.length - 1] ?? "unknown";
338
- let lastRuntimeFailure;
339
- const trackRuntimeFailure = (err) => {
340
- const message = err instanceof Error ? err.message : String(err);
341
- if (!hasSpawnFailureKind(err, "tool-not-found")) {
342
- lastRuntimeFailure = err instanceof Error ? err : new Error(message);
343
- }
344
- };
345
- const managedProbeStartedAt = Date.now();
346
- const managedCandidate = spec.managedToolId ? await findManagedToolBinary(spec.managedToolId) : undefined;
347
- if (staleLaunch(generation, `${toolLabel}:findManagedToolBinary`)) {
348
- return;
349
- }
350
- const candidates = managedCandidate && !spec.candidates.includes(managedCandidate) ? [managedCandidate, ...spec.candidates] : spec.candidates;
351
- const candidateFailures = [];
352
- for (const [index, command] of candidates.entries()) {
353
- logLatency({
354
- type: "phase",
355
- phase: "lsp_launch_candidate_attempt",
356
- filePath: spec.cwd,
357
- durationMs: 0,
358
- metadata: {
359
- tool: toolLabel,
360
- command,
361
- index,
362
- totalCandidates: candidates.length,
363
- allowInstall: canInstall(allowInstall)
364
- }
365
- });
366
- logSessionStart(`lsp launch candidate attempt tool=${toolLabel} idx=${index}/${candidates.length - 1} command=${command} cwd=${spec.cwd}`);
367
- try {
368
- const proc = await launchLSP(command, spec.args, {
369
- cwd: spec.cwd,
370
- env: spec.env
371
- });
372
- if (staleLaunch(generation, `${toolLabel}:launchLSP:${command}`, proc)) {
373
- return;
374
- }
375
- logLatency({
376
- type: "phase",
377
- phase: "lsp_launch_candidate_success",
378
- filePath: spec.cwd,
379
- durationMs: 0,
380
- metadata: {
381
- tool: toolLabel,
382
- command,
383
- index,
384
- source: "direct"
385
- }
386
- });
387
- logSessionStart(`lsp launch candidate success tool=${toolLabel} idx=${index} command=${command} source=direct`);
388
- if (managedCandidate !== undefined && command === managedCandidate) {
389
- logAvailabilityDecision({
390
- tool: toolLabel,
391
- verdict: "available",
392
- outcome: "success",
393
- cause: "ok",
394
- elapsedMs: Date.now() - managedProbeStartedAt,
395
- latched: false,
396
- producer: "lsp-launch",
397
- classifiedBy: "probe",
398
- evidence: {
399
- binary: path.basename(managedCandidate),
400
- source: "managed-dir",
401
- correctsLatchedRow: false
402
- }
403
- });
404
- }
405
- return { process: proc, source: "direct" };
406
- } catch (err) {
407
- if (staleLaunch(generation, `${toolLabel}:launchLSP:${command}`)) {
408
- return;
409
- }
410
- const message = err instanceof Error ? err.message : String(err);
411
- candidateFailures.push({ index, command, message, err });
412
- }
413
- }
414
- for (const failure of candidateFailures) {
415
- logLatency({
416
- type: "phase",
417
- phase: "lsp_launch_candidate_failed",
418
- filePath: spec.cwd,
419
- durationMs: 0,
420
- metadata: {
421
- tool: toolLabel,
422
- command: failure.command,
423
- index: failure.index,
424
- error: failure.message
425
- }
426
- });
427
- logSessionStart(`lsp launch candidate failed tool=${toolLabel} idx=${failure.index} command=${failure.command} error=${failure.message}`);
428
- trackRuntimeFailure(failure.err);
429
- }
430
- const hasOnlyRepairableCandidateFailures = candidateFailures.every((failure) => hasSpawnFailureKind(failure.err, "tool-not-found"));
431
- if (!hasOnlyRepairableCandidateFailures) {
432
- if (lastRuntimeFailure)
433
- throw lastRuntimeFailure;
434
- return;
435
- }
436
- if (!canInstall(allowInstall)) {
437
- logSessionStart(`lsp launch install blocked tool=${toolLabel} cwd=${spec.cwd} allowInstall=${allowInstall !== false} globalDisabled=${isLspInstallDisabled()}`);
438
- logLatency({
439
- type: "phase",
440
- phase: "lsp_launch_install_blocked",
441
- filePath: spec.cwd,
442
- durationMs: 0,
443
- metadata: {
444
- tool: toolLabel,
445
- allowInstall,
446
- globalInstallDisabled: isLspInstallDisabled()
447
- }
448
- });
449
- return;
450
- }
451
- if (spec.managedToolId) {
452
- const failedCandidate = candidateFailures.at(-1);
453
- const classifiedFailure = classifyProbeFailure({
454
- error: failedCandidate?.err instanceof Error ? failedCandidate.err : undefined,
455
- spawnFailure: {
456
- kind: hasSpawnFailureKind(failedCandidate?.err, "tool-not-found") ? "tool-not-found" : undefined
457
- }
458
- }, { command: failedCandidate?.command });
459
- logAvailabilityDecision({
460
- tool: spec.managedToolId,
461
- verdict: "unavailable",
462
- outcome: classifiedFailure.outcome,
463
- cause: classifiedFailure.cause,
464
- elapsedMs: Date.now() - managedProbeStartedAt,
465
- latched: false,
466
- classifiedBy: "probe",
467
- producer: "lsp-launch",
468
- evidence: classifiedFailure.evidence
469
- });
470
- logSessionStart(`lsp launch ensure-tool start tool=${spec.managedToolId} cwd=${spec.cwd}`);
471
- const installStartedAt = Date.now();
472
- const installed = await ensureTool(spec.managedToolId);
473
- const installAttempt = captureInstallAttempt(spec.managedToolId);
474
- if (staleLaunch(generation, `${toolLabel}:ensureTool`)) {
475
- return;
476
- }
477
- logSessionStart(`lsp launch ensure-tool result tool=${spec.managedToolId} installed=${installed ? "yes" : "no"} path=${installed ?? ""}`);
478
- logLatency({
479
- type: "phase",
480
- phase: "lsp_launch_ensure_tool_result",
481
- filePath: spec.cwd,
482
- durationMs: 0,
483
- metadata: {
484
- tool: spec.managedToolId,
485
- installed: Boolean(installed),
486
- path: installed
487
- }
488
- });
489
- if (installed) {
490
- try {
491
- const proc = await launchLSP(installed, spec.args, {
492
- cwd: spec.cwd,
493
- env: spec.env
494
- });
495
- if (staleLaunch(generation, `${toolLabel}:launchLSP:managed`, proc)) {
496
- return;
497
- }
498
- logSessionStart(`lsp launch managed success tool=${spec.managedToolId} command=${installed} source=managed`);
499
- logLatency({
500
- type: "phase",
501
- phase: "lsp_launch_managed_success",
502
- filePath: spec.cwd,
503
- durationMs: 0,
504
- metadata: {
505
- tool: spec.managedToolId,
506
- command: installed
507
- }
508
- });
509
- const evidence = await installEvidenceForLaunch(spec.managedToolId, installed, installAttempt);
510
- if (staleLaunch(generation, `${toolLabel}:managed-evidence`, proc)) {
511
- return;
512
- }
513
- logAvailabilityDecision({
514
- tool: spec.managedToolId,
515
- verdict: "available",
516
- outcome: "success",
517
- cause: "ok",
518
- elapsedMs: Date.now() - installStartedAt,
519
- latched: false,
520
- classifiedBy: "caller",
521
- producer: "lsp-launch",
522
- evidence: {
523
- ...evidence,
524
- correctsLatchedRow: false
525
- }
526
- });
527
- return { process: proc, source: "managed" };
528
- } catch (err) {
529
- if (staleLaunch(generation, `${toolLabel}:launchLSP:managed-rejection`)) {
530
- return;
531
- }
532
- const message = err instanceof Error ? err.message : String(err);
533
- logSessionStart(`lsp launch managed failed tool=${spec.managedToolId} command=${installed} error=${message}`);
534
- logLatency({
535
- type: "phase",
536
- phase: "lsp_launch_managed_failed",
537
- filePath: spec.cwd,
538
- durationMs: 0,
539
- metadata: {
540
- tool: spec.managedToolId,
541
- command: installed,
542
- error: message
543
- }
544
- });
545
- trackRuntimeFailure(err);
546
- const looksPathResolved = !installed.includes("/") && !installed.includes("\\");
547
- if (looksPathResolved && hasSpawnFailureKind(err, "tool-not-found")) {
548
- logSessionStart(`lsp launch managed retry force-reinstall tool=${spec.managedToolId}`);
549
- const reinstalled = await ensureTool(spec.managedToolId, {
550
- forceReinstall: true
551
- });
552
- const reinstallAttempt = captureInstallAttempt(spec.managedToolId);
553
- if (staleLaunch(generation, `${toolLabel}:forceReinstall`)) {
554
- return;
555
- }
556
- if (reinstalled) {
557
- try {
558
- const proc = await launchLSP(reinstalled, spec.args, {
559
- cwd: spec.cwd,
560
- env: spec.env
561
- });
562
- if (staleLaunch(generation, `${toolLabel}:launchLSP:forceReinstall`, proc)) {
563
- return;
564
- }
565
- logSessionStart(`lsp launch managed force-reinstall success tool=${spec.managedToolId} command=${reinstalled}`);
566
- logLatency({
567
- type: "phase",
568
- phase: "lsp_launch_managed_force_reinstall_success",
569
- filePath: spec.cwd,
570
- durationMs: 0,
571
- metadata: {
572
- tool: spec.managedToolId,
573
- command: reinstalled
574
- }
575
- });
576
- const evidence = await installEvidenceForLaunch(spec.managedToolId, reinstalled, reinstallAttempt);
577
- if (staleLaunch(generation, `${toolLabel}:forceReinstall-evidence`, proc)) {
578
- return;
579
- }
580
- logAvailabilityDecision({
581
- tool: spec.managedToolId,
582
- verdict: "available",
583
- outcome: "success",
584
- cause: "ok",
585
- elapsedMs: Date.now() - installStartedAt,
586
- latched: false,
587
- classifiedBy: "caller",
588
- producer: "lsp-launch",
589
- evidence: {
590
- ...evidence,
591
- correctsLatchedRow: false
592
- }
593
- });
594
- return { process: proc, source: "managed" };
595
- } catch (retryErr) {
596
- logSessionStart(`lsp launch managed force-reinstall failed tool=${spec.managedToolId} error=${retryErr instanceof Error ? retryErr.message : String(retryErr)}`);
597
- }
598
- }
599
- }
600
- }
601
- }
602
- }
603
- const runtimeInstall = spec.runtimeInstall;
604
- const runtimeAvailable = runtimeInstall ? await isOnPath(runtimeInstall.runtimeCommand) : false;
605
- if (staleLaunch(generation, `${toolLabel}:runtimeAvailability`)) {
606
- return;
607
- }
608
- if (runtimeInstall && runtimeAvailable) {
609
- const ok = await runtimeInstall.install();
610
- if (staleLaunch(generation, `${toolLabel}:runtimeInstall`)) {
611
- return;
612
- }
613
- if (ok) {
614
- const retry = runtimeInstall.retryCandidates ?? spec.candidates;
615
- for (const command of retry) {
616
- try {
617
- const proc = await launchLSP(command, spec.args, {
618
- cwd: spec.cwd,
619
- env: spec.env
620
- });
621
- if (staleLaunch(generation, `${toolLabel}:launchLSP:runtime`, proc)) {
622
- return;
623
- }
624
- return { process: proc, source: "managed" };
625
- } catch (err) {
626
- if (staleLaunch(generation, `${toolLabel}:launchLSP:runtime`)) {
627
- return;
628
- }
629
- trackRuntimeFailure(err);
630
- }
631
- }
632
- }
633
- }
634
- if (lastRuntimeFailure) {
635
- throw lastRuntimeFailure;
636
- }
637
- return;
638
- }
639
- async function resolveAndLaunchBundle(spec, allowInstall) {
640
- let runtime;
641
- for (const candidate of spec.runtimeCandidates) {
642
- if (await isOnPath(candidate)) {
643
- runtime = candidate;
644
- break;
645
- }
646
- }
647
- if (!runtime) {
648
- logSessionStart(`lsp launch bundle skip tool=${spec.bundleToolId}: no runtime on PATH (tried ${spec.runtimeCandidates.join(", ")})`);
649
- return;
650
- }
651
- let bundleDir = await getToolPath(spec.bundleToolId);
652
- if (!bundleDir && canInstall(allowInstall)) {
653
- bundleDir = await ensureTool(spec.bundleToolId);
654
- }
655
- if (!bundleDir) {
656
- logSessionStart(`lsp launch bundle skip tool=${spec.bundleToolId}: bundle not installed (allowInstall=${allowInstall !== false})`);
657
- return;
658
- }
659
- try {
660
- const proc = await launchLSP(runtime, spec.args(bundleDir), {
661
- cwd: spec.cwd,
662
- env: spec.env
663
- });
664
- logSessionStart(`lsp launch bundle success tool=${spec.bundleToolId} runtime=${runtime} bundle=${bundleDir}`);
665
- return { process: proc, source: "managed" };
666
- } catch (err) {
667
- const message = err instanceof Error ? err.message : String(err);
668
- logSessionStart(`lsp launch bundle failed tool=${spec.bundleToolId} runtime=${runtime} error=${message}`);
669
- return;
670
- }
671
- }
672
- async function resolveAndLaunchTreeBinary(spec, allowInstall) {
673
- for (const command of spec.candidates) {
674
- try {
675
- const proc = await launchLSP(command, spec.args, {
676
- cwd: spec.cwd,
677
- env: spec.env
678
- });
679
- return { process: proc, source: "direct" };
680
- } catch {}
681
- }
682
- let bundleDir = await getToolPath(spec.bundleToolId);
683
- if (!bundleDir && canInstall(allowInstall)) {
684
- bundleDir = await ensureTool(spec.bundleToolId);
685
- }
686
- if (!bundleDir) {
687
- logSessionStart(`lsp launch tree-bin skip tool=${spec.bundleToolId}: not on PATH and bundle not installed (allowInstall=${allowInstall !== false})`);
688
- return;
689
- }
690
- const suffix = process.platform === "win32" ? ".exe" : "";
691
- const binPath = path.join(bundleDir, ...spec.binRelPath.split("/")) + suffix;
692
- try {
693
- const proc = await launchLSP(binPath, spec.args, {
694
- cwd: spec.cwd,
695
- env: spec.env
696
- });
697
- logSessionStart(`lsp launch tree-bin success tool=${spec.bundleToolId} bin=${binPath}`);
698
- return { process: proc, source: "managed" };
699
- } catch (err) {
700
- const message = err instanceof Error ? err.message : String(err);
701
- logSessionStart(`lsp launch tree-bin failed tool=${spec.bundleToolId} bin=${binPath} error=${message}`);
702
- return;
703
- }
704
- }
705
- function nodeBinLocalCandidates(root, baseName) {
706
- const localBase = path.join(root, "node_modules", ".bin", baseName);
707
- if (process.platform === "win32") {
708
- return [`${localBase}.cmd`, `${localBase}.exe`];
709
- }
710
- return [localBase];
711
- }
712
- function nodeBinCandidates(root, baseName) {
713
- return [...nodeBinLocalCandidates(root, baseName), baseName];
714
- }
715
- function piAgentExtensionsRootKey(file) {
716
- const dirKey = normalizeEphemeralMapKey(path.dirname(path.resolve(file)));
717
- const marker = "/.pi/agent/extensions";
718
- const index = dirKey.indexOf(marker);
719
- if (index === -1)
720
- return;
721
- return dirKey.slice(0, index + marker.length);
722
- }
723
- function IgnoreHomeRoot(primary) {
724
- const homeKey = normalizeEphemeralMapKey(path.resolve(os.homedir()));
725
- return withRootMarkers(async (file) => {
726
- const root = await primary(file);
727
- if (!root)
728
- return;
729
- return normalizeEphemeralMapKey(path.resolve(root)) === homeKey ? undefined : root;
730
- }, primary.rootMarkers ?? []);
731
- }
732
- function rubyBinCandidates(baseName) {
733
- const candidates = [];
734
- const home = os.homedir();
735
- const isWin = process.platform === "win32";
736
- const ext = isWin ? ".bat" : "";
737
- candidates.push(path.join(home, ".local", "share", "mise", "installs", "ruby", "bin", `${baseName}${ext}`));
738
- candidates.push(path.join(home, ".asdf", "installs", "ruby", "bin", `${baseName}${ext}`));
739
- if (isWin) {
740
- const driveRoot = path.parse(home).root;
741
- for (const entry of getRubyVersionDirNamesSync(driveRoot)) {
742
- candidates.push(path.join(driveRoot, entry, "bin", `${baseName}.bat`));
743
- candidates.push(path.join(driveRoot, entry, "bin", baseName));
744
- }
745
- }
746
- return candidates;
747
- }
748
- function createInteractiveServer(spec) {
749
- return {
750
- id: spec.id,
751
- name: spec.name,
752
- extensions: spec.extensions,
753
- root: spec.root,
754
- rootMarkers: spec.root.rootMarkers,
755
- fallbackFor: spec.fallbackFor,
756
- availabilityKey: typeof spec.command === "string" && isSimpleCommand(spec.command) ? spec.command : undefined,
757
- async spawn(root) {
758
- const command = typeof spec.command === "function" ? spec.command(root) : spec.command;
759
- const args = typeof spec.args === "function" ? spec.args(root) : spec.args || [];
760
- if (isSimpleCommand(command) && isDirectLspCommandTemporarilyUnavailable(command)) {
761
- return;
762
- }
763
- const runtimeEnv = spec.runtime === "java" ? await resolveJavaRuntimeEnv() : undefined;
764
- try {
765
- const proc = await launchLSP(command, args, {
766
- cwd: root,
767
- ...runtimeEnv ? { env: runtimeEnv } : {}
768
- });
769
- const initialization = typeof spec.initialization === "function" ? spec.initialization(root) : spec.initialization;
770
- return { process: proc, source: "direct", initialization };
771
- } catch (err) {
772
- if (hasSpawnFailureKind(err, "tool-not-found")) {
773
- markDirectLspCommandUnavailable(command);
774
- }
775
- return;
776
- }
777
- }
778
- };
779
- }
780
- export function PriorityRoot(markerGroups, excludePatterns, stopDir) {
781
- const resolvers = markerGroups.map((markers) => NearestRoot(markers, excludePatterns, stopDir));
782
- return withRootMarkers(async (file) => {
783
- for (const resolve of resolvers) {
784
- const root = await resolve(file);
785
- if (root)
786
- return root;
787
- }
788
- return;
789
- }, markerGroups.flat());
790
- }
791
- export const FileDirRoot = async (file) => {
792
- const candidate = path.resolve(path.dirname(file));
793
- return nearestNonExcludedFallbackRoot(candidate);
794
- };
795
- export function RootWithFallback(primary, fallback = FileDirRoot) {
796
- return withRootMarkers(async (file) => {
797
- const primaryRoot = await primary(file);
798
- if (primaryRoot)
799
- return primaryRoot;
800
- return fallback(file);
801
- }, primary.rootMarkers ?? []);
802
- }
803
- export function WorkspacePriorityRoot(markerGroups, excludePatterns) {
804
- return withRootMarkers(async (file) => PriorityRoot(markerGroups, excludePatterns, process.cwd())(file), markerGroups.flat());
805
- }
806
- function isPermissionFsError(err) {
807
- const code = err?.code;
808
- return code === "EACCES" || code === "EPERM";
809
- }
810
- function markerProbeDir(dir, pattern) {
811
- const normalized = toPosix(pattern);
812
- const slash = normalized.lastIndexOf("/");
813
- const parentPattern = slash >= 0 ? normalized.slice(0, slash) : "";
814
- return parentPattern ? path.join(dir, ...parentPattern.split("/").filter(Boolean)) : dir;
815
- }
816
- async function markerExists(dir, pattern) {
817
- if (!pattern.includes("*")) {
818
- try {
819
- await stat(path.join(dir, pattern));
820
- return true;
821
- } catch (err) {
822
- if (isPermissionFsError(err)) {
823
- logSessionStart(`lsp root marker skipped: permission error stat ${path.join(dir, pattern)}`);
824
- }
825
- return false;
826
- }
827
- }
828
- const normalized = pattern.replace(/\\/g, "/");
829
- const slash = normalized.lastIndexOf("/");
830
- const basenamePattern = slash >= 0 ? normalized.slice(slash + 1) : normalized;
831
- if (!basenamePattern)
832
- return false;
833
- const targetDir = markerProbeDir(dir, normalized);
834
- try {
835
- const entries = await readdir(targetDir, { withFileTypes: true });
836
- return direntsHaveMarkerGlobMatch(entries, basenamePattern);
837
- } catch (err) {
838
- if (isPermissionFsError(err)) {
839
- logSessionStart(`lsp root marker skipped: permission error read ${targetDir}`);
840
- }
841
- return false;
842
- }
843
- }
844
- const rootMtimeBound = (label) => ({
845
- ms: HOOK_WALL_BUDGET_MS.tool_result_edit,
846
- signal: undefined,
847
- hook: "tool_result_edit",
848
- label
849
- });
850
- export function NearestRoot(includePatterns, excludePatterns, stopDir) {
851
- const cache = new Map;
852
- const inFlight = new Map;
853
- const subdirPatterns = [];
854
- for (const pattern of [...includePatterns, ...excludePatterns ?? []]) {
855
- if (markerProbeDir("", pattern))
856
- subdirPatterns.push(pattern);
857
- }
858
- return withRootMarkers(async (file) => {
859
- const startDir = path.resolve(path.dirname(file));
860
- const dirKey = normalizeMapKey(startDir);
861
- const cached = cache.get(dirKey);
862
- if (cached !== undefined && Date.now() - cached.walkedAt < FRESHNESS_CADENCE_MS && await bounded(dirMtimesStillFreshAsync(cached.probedDirs), rootMtimeBound("lsp-root-memo-freshness")) === true)
863
- return cached.root;
864
- const flying = inFlight.get(dirKey);
865
- if (flying)
866
- return flying;
867
- const probedDirs = [];
868
- const walkedAt = Date.now();
869
- const promise = (async () => {
870
- let currentDir = startDir;
871
- const fsRoot = path.parse(currentDir).root;
872
- const stop = stopDir ? path.resolve(stopDir) : fsRoot;
873
- while (true) {
874
- if (stop !== fsRoot && currentDir.startsWith(stop + path.sep) === false && currentDir !== stop) {
875
- break;
876
- }
877
- const stepDirs = [
878
- currentDir,
879
- ...subdirPatterns.map((pattern) => markerProbeDir(currentDir, pattern))
880
- ];
881
- const stepRecords = await bounded(dirMtimeRecordsAsync(stepDirs), rootMtimeBound("lsp-root-walk-dir-mtimes"));
882
- probedDirs.push(...stepRecords ?? unknownDirMtimeRecords(stepDirs));
883
- if (excludePatterns) {
884
- let excluded = false;
885
- for (const pattern of excludePatterns) {
886
- if (await markerExists(currentDir, pattern)) {
887
- excluded = true;
888
- break;
889
- }
890
- }
891
- if (excluded) {
892
- currentDir = path.dirname(currentDir);
893
- continue;
894
- }
895
- }
896
- for (const pattern of includePatterns) {
897
- if (await markerExists(currentDir, pattern) && (pattern !== ".git" || currentDir !== os.tmpdir()) && !await isExcludedLspRoot(currentDir)) {
898
- return enforceLspRootCeiling(currentDir, process.cwd(), file);
899
- }
900
- }
901
- if (currentDir === stop || currentDir === fsRoot) {
902
- break;
903
- }
904
- currentDir = path.dirname(currentDir);
905
- }
906
- return;
907
- })();
908
- inFlight.set(dirKey, promise);
909
- try {
910
- const result = await promise;
911
- if (result !== undefined)
912
- cache.set(dirKey, { root: result, probedDirs, walkedAt });
913
- return result;
914
- } finally {
915
- inFlight.delete(dirKey);
916
- }
917
- }, includePatterns);
918
- }
919
- export const createRootDetector = NearestRoot;
920
- function isOnPath(command) {
921
- return isCommandAvailableAsync(command);
922
- }
923
- export async function tryGoInstallGopls() {
924
- const isWindows = process.platform === "win32";
925
- const result = await safeSpawnAsync(isWindows ? "go.exe" : "go", ["install", "golang.org/x/tools/gopls@latest"], { timeout: 180000, ignoreAmbientSignal: true });
926
- return !result.error && result.status === 0;
927
- }
928
- export async function tryDotnetToolInstall(tool) {
929
- mkdirSync(DM_LENS_BIN_DIR, { recursive: true });
930
- const result = await safeSpawnAsync("dotnet", ["tool", "install", "--tool-path", DM_LENS_BIN_DIR, tool], { timeout: 180000, ignoreAmbientSignal: true });
931
- if (!result.error && result.status === 0)
932
- return true;
933
- const stderr = result.stderr ?? "";
934
- if (stderr.includes("No NuGet sources are defined or enabled")) {
935
- logSessionStart(`lsp dotnet-install: NuGet sources missing — cannot install ${tool}. ` + `Run: dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org`);
936
- return false;
937
- }
938
- const updateResult = await safeSpawnAsync("dotnet", ["tool", "update", "--tool-path", DM_LENS_BIN_DIR, tool], { timeout: 180000, ignoreAmbientSignal: true });
939
- return !updateResult.error && updateResult.status === 0;
940
- }
941
- async function findAncestorFile(startDir, ...relativeSegments) {
942
- return findAncestorFileAmong(startDir, [relativeSegments]);
943
- }
944
- async function findAncestorFileAmong(startDir, candidateSegmentLists) {
945
- const fs = await import("node:fs/promises");
946
- let currentDir = path.resolve(startDir);
947
- while (!isAtOrAboveHomeDir(currentDir)) {
948
- for (const segments of candidateSegmentLists) {
949
- const candidate = path.join(currentDir, ...segments);
950
- try {
951
- await fs.access(candidate);
952
- return candidate;
953
- } catch {}
954
- }
955
- const parent = path.dirname(currentDir);
956
- if (parent === currentDir)
957
- break;
958
- currentDir = parent;
959
- }
960
- return;
961
- }
962
- const CLASSIC_TS_REPAIR_FAMILY = "lsp.classic-ts-repair-guard";
963
- const CLASSIC_TS_REPAIR_VERSION = 1;
964
- function classicTsRepairState() {
965
- return getProcessSingleton(CLASSIC_TS_REPAIR_FAMILY, CLASSIC_TS_REPAIR_VERSION, () => ({ attempted: false }));
966
- }
967
- export function resetClassicTsRepairGuard() {
968
- classicTsRepairState().attempted = false;
969
- }
970
- export function _resetClassicTsRepairForTests() {
971
- resetClassicTsRepairGuard();
972
- }
973
- function typescriptDirsForTsc(tscPath) {
974
- const binDir = path.dirname(tscPath);
975
- return [
976
- path.join(binDir, "..", "typescript"),
977
- path.join(binDir, "..", "..", "typescript")
978
- ];
979
- }
980
- async function typescriptVersionForTsc(tscPath) {
981
- if (!path.isAbsolute(tscPath))
982
- return;
983
- for (const dir of typescriptDirsForTsc(tscPath)) {
984
- let manifest;
985
- try {
986
- manifest = await readFile(path.join(dir, "package.json"), "utf8");
987
- } catch {
988
- continue;
989
- }
990
- let version;
991
- try {
992
- const parsed = JSON.parse(manifest);
993
- if (typeof parsed !== "object" || parsed === null || !("version" in parsed) || typeof parsed.version !== "string") {
994
- return;
995
- }
996
- version = parsed.version;
997
- } catch {
998
- return;
999
- }
1000
- const majorText = version.split(".", 1)[0] ?? "";
1001
- const major = /^\d+$/.test(majorText) ? Number(majorText) : Number.NaN;
1002
- if (!Number.isFinite(major))
1003
- return;
1004
- return { version, major };
1005
- }
1006
- return;
1007
- }
1008
- async function findTsserverPath(root, allowInstall) {
1009
- const fs = await import("node:fs/promises");
1010
- const ancestorHit = await findAncestorFile(root, "node_modules", "typescript", "lib", "tsserver.js");
1011
- if (ancestorHit)
1012
- return ancestorHit;
1013
- const cwdCandidate = path.join(process.cwd(), "node_modules", "typescript", "lib", "tsserver.js");
1014
- try {
1015
- await fs.access(cwdCandidate);
1016
- return cwdCandidate;
1017
- } catch {}
1018
- const tsserverForTsc = async (tscPath) => {
1019
- if (!tscPath)
1020
- return;
1021
- for (const dir of typescriptDirsForTsc(tscPath)) {
1022
- const candidate = path.join(dir, "lib", "tsserver.js");
1023
- try {
1024
- await fs.access(candidate);
1025
- return candidate;
1026
- } catch {}
1027
- }
1028
- return;
1029
- };
1030
- const installAllowed = canInstall(allowInstall);
1031
- const discoveredTsc = await ensureTool("typescript", {
1032
- allowInstall: installAllowed
1033
- });
1034
- const discoveredTsserver = await tsserverForTsc(discoveredTsc);
1035
- if (discoveredTsserver || !discoveredTsc || !installAllowed || classicTsRepairState().attempted) {
1036
- return discoveredTsserver;
1037
- }
1038
- const discoveredVersion = await typescriptVersionForTsc(discoveredTsc);
1039
- if (!discoveredVersion || discoveredVersion.major < 7)
1040
- return;
1041
- classicTsRepairState().attempted = true;
1042
- logSessionStart(`lsp typescript: managed compiler resolved to TypeScript ${discoveredVersion.version}, which ships no tsserver.js; reinstalling pinned classic fallback`);
1043
- const repairedTsc = await ensureTool("typescript", {
1044
- allowInstall: true,
1045
- forceReinstall: true
1046
- });
1047
- return tsserverForTsc(repairedTsc);
1048
- }
1049
- async function findNativeTypeScriptLsp(root) {
1050
- let currentDir = path.resolve(root);
1051
- while (!isAtOrAboveHomeDir(currentDir)) {
1052
- const typescriptDir = path.join(currentDir, "node_modules", "typescript");
1053
- const packageJsonPath = path.join(typescriptDir, "package.json");
1054
- let packageJsonText;
1055
- try {
1056
- packageJsonText = await readFile(packageJsonPath, "utf8");
1057
- } catch (error) {
1058
- if (error.code !== "ENOENT") {
1059
- return;
1060
- }
1061
- try {
1062
- const dirStat = await stat(typescriptDir);
1063
- if (dirStat.isDirectory())
1064
- return;
1065
- } catch {}
1066
- const parent = path.dirname(currentDir);
1067
- if (parent === currentDir)
1068
- return;
1069
- currentDir = parent;
1070
- continue;
1071
- }
1072
- let version;
1073
- try {
1074
- const parsed = JSON.parse(packageJsonText);
1075
- if (typeof parsed !== "object" || parsed === null || !("version" in parsed) || typeof parsed.version !== "string") {
1076
- return;
1077
- }
1078
- version = parsed.version;
1079
- } catch {
1080
- return;
1081
- }
1082
- const majorText = version.split(".", 1)[0] ?? "";
1083
- const major = /^\d+$/.test(majorText) ? Number(majorText) : Number.NaN;
1084
- if (!Number.isFinite(major) || major < 7)
1085
- return;
1086
- const localTsc = path.join(currentDir, "node_modules", ".bin", "tsc");
1087
- const candidates = process.platform === "win32" ? [`${localTsc}.cmd`, `${localTsc}.exe`, localTsc] : [localTsc];
1088
- for (const command of candidates) {
1089
- try {
1090
- await access(command);
1091
- return { command, version };
1092
- } catch {}
1093
- }
1094
- return;
1095
- }
1096
- return;
1097
- }
1098
- function dotnetToolCandidates(tool) {
1099
- const home = os.homedir();
1100
- return [
1101
- path.join(DM_LENS_BIN_DIR, `${tool}.exe`),
1102
- path.join(DM_LENS_BIN_DIR, tool),
1103
- path.join(home, ".dotnet", "tools", `${tool}.exe`),
1104
- path.join(home, ".dotnet", "tools", tool),
1105
- tool
1106
- ].filter(Boolean);
1107
- }
1108
- function binExeVariants(dir, tool) {
1109
- return process.platform === "win32" ? [path.join(dir, `${tool}.exe`), path.join(dir, tool)] : [path.join(dir, tool)];
1110
- }
1111
- export function goBinCandidates(tool) {
1112
- const gopath = process.env.GOPATH?.split(path.delimiter)[0] || path.join(os.homedir(), "go");
1113
- return [tool, ...binExeVariants(path.join(gopath, "bin"), tool)];
1114
- }
1115
- export function cargoBinCandidates(tool) {
1116
- const cargoHome = process.env.CARGO_HOME || path.join(os.homedir(), ".cargo");
1117
- return [tool, ...binExeVariants(path.join(cargoHome, "bin"), tool)];
1118
- }
1119
- export async function tryGemInstall(gem) {
1120
- const { join } = await import("node:path");
1121
- const binDir = join(getGlobalDmLensDir(), "bin");
1122
- const { mkdir } = await import("node:fs/promises");
1123
- await mkdir(binDir, { recursive: true });
1124
- const result = await safeSpawnAsync("gem", ["install", gem, "--bindir", binDir, "--no-document"], { timeout: 180000, ignoreAmbientSignal: true });
1125
- const ok = !result.error && result.status === 0;
1126
- if (ok) {
1127
- const sep = process.platform === "win32" ? ";" : ":";
1128
- if (!process.env.PATH?.includes(binDir)) {
1129
- process.env.PATH = `${binDir}${sep}${process.env.PATH ?? ""}`;
1130
- }
1131
- }
1132
- return ok;
1133
- }
1134
- export function DenoExcludeRoot(primary) {
1135
- const denoDetector = createRootDetector(["deno.json", "deno.jsonc"]);
1136
- return async (file) => {
1137
- const denoRoot = await denoDetector(file);
1138
- if (denoRoot)
1139
- return;
1140
- return primary(file);
1141
- };
1142
- }
1143
- const JS_TS_LSP_EXTENSIONS = KIND_EXTENSIONS["jsts"].filter((ext) => ext !== ".svelte" && ext !== ".vue");
1144
- const TS_CONFIG_MARKERS = ["tsconfig.json", "jsconfig.json"];
1145
- const TS_TOOLING_MARKERS = [
1146
- "package-lock.json",
1147
- "bun.lockb",
1148
- "bun.lock",
1149
- "pnpm-lock.yaml",
1150
- "yarn.lock",
1151
- "package.json"
1152
- ];
1153
- const TS_FAMILY_EXTENSIONS = new Set([".ts", ".tsx", ".mts", ".cts"]);
1154
- function isTsFamilyFile(file) {
1155
- return TS_FAMILY_EXTENSIONS.has(path.extname(file).toLowerCase());
1156
- }
1157
- function tsConfigMarkersForFile(file) {
1158
- return isTsFamilyFile(file) ? ["tsconfig.json"] : TS_CONFIG_MARKERS;
1159
- }
1160
- const TypeScriptConfigRootTsOnly = IgnoreHomeRoot(createRootDetector(["tsconfig.json"]));
1161
- const TypeScriptConfigRootEither = IgnoreHomeRoot(createRootDetector([...TS_CONFIG_MARKERS]));
1162
- const TypeScriptToolingRoot = IgnoreHomeRoot(createRootDetector([...TS_TOOLING_MARKERS]));
1163
- async function findTypeScriptProjectRoot(file) {
1164
- const configDetector = isTsFamilyFile(file) ? TypeScriptConfigRootTsOnly : TypeScriptConfigRootEither;
1165
- const [configRoot, toolingRoot] = await Promise.all([
1166
- configDetector(file),
1167
- TypeScriptToolingRoot(file)
1168
- ]);
1169
- if (!configRoot)
1170
- return toolingRoot;
1171
- if (!toolingRoot)
1172
- return configRoot;
1173
- return isSameOrWithin(toolingRoot, configRoot) ? configRoot : toolingRoot;
1174
- }
1175
- async function findExtensionBoundedRoot(file, extensionRootKey) {
1176
- const startDir = path.resolve(path.dirname(file));
1177
- let currentDir = startDir;
1178
- const configMarkers = tsConfigMarkersForFile(file);
1179
- while (true) {
1180
- for (const pattern of configMarkers) {
1181
- try {
1182
- await stat(path.join(currentDir, pattern));
1183
- return currentDir;
1184
- } catch {}
1185
- }
1186
- for (const pattern of TS_TOOLING_MARKERS) {
1187
- try {
1188
- await stat(path.join(currentDir, pattern));
1189
- return currentDir;
1190
- } catch {}
1191
- }
1192
- const currentKey = normalizeEphemeralMapKey(path.resolve(currentDir));
1193
- if (currentKey === extensionRootKey)
1194
- return;
1195
- const parent = path.dirname(currentDir);
1196
- if (parent === currentDir)
1197
- return;
1198
- currentDir = parent;
1199
- }
1200
- }
1201
- async function hasAgentLevelProjectMarker(extensionRootKey) {
1202
- const agentDir = path.dirname(extensionRootKey);
1203
- if (!agentDir || agentDir === extensionRootKey)
1204
- return false;
1205
- for (const pattern of [...TS_CONFIG_MARKERS, ...TS_TOOLING_MARKERS]) {
1206
- try {
1207
- await stat(path.join(agentDir, pattern));
1208
- return true;
1209
- } catch {}
1210
- }
1211
- return false;
1212
- }
1213
- const TypeScriptRoot = withRootMarkers(DenoExcludeRoot(async (file) => {
1214
- const extensionRootKey = piAgentExtensionsRootKey(file);
1215
- if (extensionRootKey) {
1216
- const bounded = await findExtensionBoundedRoot(file, extensionRootKey);
1217
- if (bounded)
1218
- return bounded;
1219
- if (await hasAgentLevelProjectMarker(extensionRootKey)) {
1220
- return FileDirRoot(file);
1221
- }
1222
- return;
1223
- }
1224
- const projectRoot = await findTypeScriptProjectRoot(file);
1225
- if (projectRoot)
1226
- return projectRoot;
1227
- return FileDirRoot(file);
1228
- }), [...TS_CONFIG_MARKERS, ...TS_TOOLING_MARKERS]);
1229
- export const TypeScriptServer = {
1230
- id: "typescript",
1231
- name: "TypeScript Language Server",
1232
- extensions: JS_TS_LSP_EXTENSIONS,
1233
- autoPropagateDiagnostics: true,
1234
- root: TypeScriptRoot,
1235
- rootMarkers: TypeScriptRoot.rootMarkers,
1236
- async spawn(root, options) {
1237
- const fs = await import("node:fs/promises");
1238
- const nativeLsp = await findNativeTypeScriptLsp(root);
1239
- if (nativeLsp) {
1240
- const env = await getToolEnvironment();
1241
- logSessionStart(`lsp typescript-native: version=${nativeLsp.version} command=${nativeLsp.command}`);
1242
- const proc = await launchLSP(nativeLsp.command, ["--lsp", "--stdio"], {
1243
- cwd: root,
1244
- env
1245
- });
1246
- return { process: proc, source: "direct", launchVariant: "native-ts7" };
1247
- }
1248
- let source = "direct";
1249
- let lspPath = await findAncestorFileAmong(root, [
1250
- ["node_modules", ".bin", "typescript-language-server.cmd"],
1251
- ["node_modules", ".bin", "typescript-language-server"]
1252
- ]);
1253
- if (!lspPath) {
1254
- lspPath = await ensureTool("typescript-language-server", {
1255
- allowInstall: canInstall(options?.allowInstall)
1256
- });
1257
- if (lspPath)
1258
- source = "managed";
1259
- if (!lspPath) {
1260
- return;
1261
- }
1262
- }
1263
- let tsserverPath = await findTsserverPath(root, options?.allowInstall);
1264
- if (!tsserverPath) {
1265
- const localCandidate = path.join(path.dirname(lspPath), "..", "typescript", "lib", "tsserver.js");
1266
- try {
1267
- await fs.access(localCandidate);
1268
- tsserverPath = localCandidate;
1269
- } catch {}
1270
- }
1271
- if (tsserverPath)
1272
- source = "managed";
1273
- const env = await getToolEnvironment();
1274
- const proc = await launchLSP(lspPath, ["--stdio"], {
1275
- cwd: root,
1276
- env: {
1277
- ...env,
1278
- TSSERVER_PATH: tsserverPath
1279
- }
1280
- });
1281
- return {
1282
- process: proc,
1283
- source,
1284
- initialization: tsserverPath ? { tsserver: { path: tsserverPath } } : undefined,
1285
- launchVariant: "classic"
1286
- };
1287
- }
1288
- };
1289
- export const DenoServer = {
1290
- id: "deno",
1291
- name: "Deno Language Server",
1292
- fallbackFor: "typescript",
1293
- extensions: JS_TS_LSP_EXTENSIONS,
1294
- autoPropagateDiagnostics: true,
1295
- root: createRootDetector(["deno.json", "deno.jsonc"]),
1296
- async spawn(root, options) {
1297
- return resolveAndLaunch({
1298
- candidates: ["deno"],
1299
- args: ["lsp"],
1300
- cwd: root,
1301
- managedToolId: "deno"
1302
- }, options?.allowInstall);
1303
- }
1304
- };
1305
- export const PythonServer = {
1306
- id: "python",
1307
- name: "Pyright Language Server",
1308
- extensions: KIND_EXTENSIONS["python"],
1309
- root: RootWithFallback(createRootDetector([
1310
- ".git",
1311
- "pyproject.toml",
1312
- "setup.py",
1313
- "setup.cfg",
1314
- "requirements.txt",
1315
- "Pipfile",
1316
- "poetry.lock"
1317
- ])),
1318
- async spawn(root, options) {
1319
- const pythonEnvironment = await detectPythonEnvironment(root);
1320
- const env = augmentPythonEnvironment(await getToolEnvironment(), pythonEnvironment);
1321
- let source = "direct";
1322
- const pyrightInit = (pythonPath) => ({
1323
- ...pythonPath ? { pythonPath } : {},
1324
- openFilesOnly: true
1325
- });
1326
- const projectPyright = await resolveAndLaunch({
1327
- candidates: [
1328
- ...pythonEnvironmentToolCandidates(pythonEnvironment, "pyright-langserver"),
1329
- ...nodeBinLocalCandidates(root, "pyright-langserver"),
1330
- ...pythonEnvironmentToolCandidates(pythonEnvironment, "basedpyright-langserver"),
1331
- ...nodeBinLocalCandidates(root, "basedpyright-langserver")
1332
- ],
1333
- args: ["--stdio"],
1334
- cwd: root,
1335
- env
1336
- }, false);
1337
- if (projectPyright) {
1338
- return {
1339
- process: projectPyright.process,
1340
- source: projectPyright.source,
1341
- initialization: pyrightInit(pythonEnvironment?.pythonPath)
1342
- };
1343
- }
1344
- const projectTy = await resolveAndLaunch({
1345
- candidates: pythonEnvironmentToolCandidates(pythonEnvironment, "ty"),
1346
- args: ["server"],
1347
- cwd: root,
1348
- env
1349
- }, false);
1350
- if (projectTy) {
1351
- return { process: projectTy.process, source: projectTy.source };
1352
- }
1353
- const pathPyright = await resolveAndLaunch({
1354
- candidates: ["pyright-langserver", "basedpyright-langserver"],
1355
- args: ["--stdio"],
1356
- cwd: root,
1357
- env
1358
- }, false);
1359
- if (pathPyright) {
1360
- return {
1361
- process: pathPyright.process,
1362
- source: pathPyright.source,
1363
- initialization: pyrightInit(pythonEnvironment?.pythonPath)
1364
- };
1365
- }
1366
- const pathTy = await resolveAndLaunch({
1367
- candidates: ["ty"],
1368
- args: ["server"],
1369
- cwd: root,
1370
- env
1371
- }, false);
1372
- if (pathTy) {
1373
- return { process: pathTy.process, source: pathTy.source };
1374
- }
1375
- const pyrightPath = await ensureTool("pyright", {
1376
- allowInstall: canInstall(options?.allowInstall)
1377
- });
1378
- if (!pyrightPath)
1379
- return;
1380
- source = "managed";
1381
- const binDir = path.dirname(pyrightPath);
1382
- const isWindows = process.platform === "win32";
1383
- const managedCandidates = isWindows ? [
1384
- path.join(binDir, "pyright-langserver.cmd"),
1385
- path.join(binDir, "pyright-langserver"),
1386
- "pyright-langserver"
1387
- ] : [path.join(binDir, "pyright-langserver"), "pyright-langserver"];
1388
- const resolved = await resolveAndLaunch({ candidates: managedCandidates, args: ["--stdio"], cwd: root, env }, false);
1389
- if (!resolved)
1390
- return;
1391
- return {
1392
- process: resolved.process,
1393
- source,
1394
- initialization: pyrightInit(pythonEnvironment?.pythonPath)
1395
- };
1396
- }
1397
- };
1398
- export const PythonJediServer = {
1399
- id: "python-jedi",
1400
- name: "Jedi Language Server",
1401
- fallbackFor: "python",
1402
- extensions: KIND_EXTENSIONS["python"],
1403
- root: RootWithFallback(createRootDetector([
1404
- ".git",
1405
- "pyproject.toml",
1406
- "setup.py",
1407
- "setup.cfg",
1408
- "requirements.txt",
1409
- "Pipfile",
1410
- "poetry.lock"
1411
- ])),
1412
- async spawn(root, options) {
1413
- const launched = await resolveAndLaunch({
1414
- candidates: ["jedi-language-server"],
1415
- args: [],
1416
- cwd: root,
1417
- managedToolId: "jedi-language-server"
1418
- }, options?.allowInstall);
1419
- if (!launched)
1420
- return;
1421
- const pythonPath = await detectPythonVenv(root);
1422
- return {
1423
- ...launched,
1424
- initialization: pythonPath ? { workspace: { environmentPath: pythonPath } } : {}
1425
- };
1426
- }
1427
- };
1428
- export const GoServer = {
1429
- id: "go",
1430
- name: "gopls",
1431
- extensions: KIND_EXTENSIONS["go"],
1432
- root: RootWithFallback(WorkspacePriorityRoot([["go.work"], ["go.mod", "go.sum"], [".git"]])),
1433
- async spawn(root, options) {
1434
- const result = await resolveAndLaunch({
1435
- candidates: goBinCandidates("gopls"),
1436
- args: [],
1437
- cwd: root,
1438
- runtimeInstall: {
1439
- runtimeCommand: "go",
1440
- install: tryGoInstallGopls
1441
- }
1442
- }, options?.allowInstall);
1443
- if (!result)
1444
- return;
1445
- return { ...result, initialization: { ui: { semanticTokens: true } } };
1446
- }
1447
- };
1448
- function cargoWorkspaceDeclaresMember(workspaceContent, parentDir, childDir) {
1449
- const relativePath = path.relative(parentDir, childDir).split(path.sep).join("/");
1450
- if (relativePath === "" || relativePath.startsWith(".."))
1451
- return false;
1452
- const matches = (pattern) => matchesWorkspaceMemberPattern(pattern, relativePath, CARGO_WORKSPACE_MEMBER_DIALECT);
1453
- const excluded = readCargoWorkspaceExclude(workspaceContent);
1454
- if (excluded.some(matches))
1455
- return false;
1456
- return readCargoWorkspaceMembers(workspaceContent).some(matches);
1457
- }
1458
- function sessionHoistCeiling(sessionCwd, file) {
1459
- return isSameOrWithin(path.resolve(sessionCwd), path.resolve(file)) ? path.resolve(sessionCwd) : undefined;
1460
- }
1461
- function RustWorkspaceRoot() {
1462
- const crateRoot = createRootDetector(["Cargo.toml", "Cargo.lock"]);
1463
- return withRootMarkers(async (file) => {
1464
- const root = await crateRoot(file);
1465
- if (!root)
1466
- return;
1467
- const sessionCwd = process.cwd();
1468
- const stop = sessionHoistCeiling(sessionCwd, file);
1469
- let current = root;
1470
- const fsRoot = path.parse(current).root;
1471
- while (true) {
1472
- if (stop !== undefined && current === stop)
1473
- break;
1474
- const parent = path.dirname(current);
1475
- if (parent === current || parent === fsRoot)
1476
- break;
1477
- const parentCargoPath = path.join(parent, "Cargo.toml");
1478
- const parentCargoContent = await readTextFileOrUndefined(parentCargoPath);
1479
- if (parentCargoContent !== undefined && hasCargoWorkspaceTable(parentCargoContent)) {
1480
- if (cargoWorkspaceDeclaresMember(parentCargoContent, parent, root)) {
1481
- return enforceLspRootCeiling(parent, sessionCwd, file);
1482
- }
1483
- break;
1484
- }
1485
- current = parent;
1486
- }
1487
- return root;
1488
- }, crateRoot.rootMarkers ?? []);
1489
- }
1490
- function stripXmlComments(content) {
1491
- let result = content;
1492
- let previous;
1493
- do {
1494
- previous = result;
1495
- result = result.replace(/<!--[\s\S]*?-->/g, "");
1496
- } while (result !== previous);
1497
- return result;
1498
- }
1499
- async function declaresMavenModule(parentDir, parentPomPath, childDir) {
1500
- try {
1501
- const content = stripXmlComments(await readFile(parentPomPath, "utf-8"));
1502
- const modulesBlock = content.match(/<modules>([\s\S]*?)<\/modules>/);
1503
- if (!modulesBlock)
1504
- return false;
1505
- const resolvedChild = path.resolve(childDir);
1506
- for (const match of modulesBlock[1].matchAll(/<module>\s*([^<]+?)\s*<\/module>/g)) {
1507
- if (pathsEqual(path.resolve(parentDir, match[1]), resolvedChild))
1508
- return true;
1509
- }
1510
- return false;
1511
- } catch {
1512
- return false;
1513
- }
1514
- }
1515
- function JavaWorkspaceRoot() {
1516
- const moduleRoot = createRootDetector([
1517
- "pom.xml",
1518
- "build.gradle",
1519
- ".classpath"
1520
- ]);
1521
- return withRootMarkers(async (file) => {
1522
- const root = await moduleRoot(file);
1523
- if (!root)
1524
- return;
1525
- if (!await markerExists(root, "pom.xml"))
1526
- return root;
1527
- const sessionCwd = process.cwd();
1528
- const stop = sessionHoistCeiling(sessionCwd, file);
1529
- let current = root;
1530
- let lastHop = root;
1531
- const fsRoot = path.parse(current).root;
1532
- while (true) {
1533
- if (stop !== undefined && current === stop)
1534
- break;
1535
- const parent = path.dirname(current);
1536
- if (parent === current || parent === fsRoot)
1537
- break;
1538
- if (await markerExists(parent, "pom.xml")) {
1539
- const parentPom = path.join(parent, "pom.xml");
1540
- if (!await declaresMavenModule(parent, parentPom, lastHop))
1541
- break;
1542
- current = parent;
1543
- lastHop = parent;
1544
- continue;
1545
- }
1546
- current = parent;
1547
- }
1548
- return enforceLspRootCeiling(lastHop, sessionCwd, file);
1549
- }, moduleRoot.rootMarkers ?? []);
1550
- }
1551
- export const RustServer = {
1552
- id: "rust",
1553
- name: "rust-analyzer",
1554
- extensions: KIND_EXTENSIONS["rust"],
1555
- root: RustWorkspaceRoot(),
1556
- async spawn(root, options) {
1557
- const result = await resolveAndLaunch({
1558
- candidates: cargoBinCandidates("rust-analyzer"),
1559
- args: [],
1560
- cwd: root,
1561
- managedToolId: "rust-analyzer"
1562
- }, options?.allowInstall);
1563
- if (!result)
1564
- return;
1565
- return {
1566
- ...result,
1567
- initialization: {
1568
- cargo: { buildScripts: { enable: true } },
1569
- procMacro: { enable: true },
1570
- diagnostics: { enable: true }
1571
- }
1572
- };
1573
- }
1574
- };
1575
- export const RubyServer = {
1576
- id: "ruby",
1577
- name: "Ruby LSP",
1578
- extensions: KIND_EXTENSIONS["ruby"],
1579
- root: RootWithFallback(PriorityRoot([["Gemfile", ".ruby-version"], [".git"]])),
1580
- initializeTimeoutMs: 30000,
1581
- clientWaitTimeoutMs: 30000,
1582
- async spawn(root, options) {
1583
- const rubylsp = await resolveAndLaunch({
1584
- candidates: ["ruby-lsp", ...rubyBinCandidates("ruby-lsp")],
1585
- args: [],
1586
- cwd: root,
1587
- runtimeInstall: {
1588
- runtimeCommand: "gem",
1589
- install: () => tryGemInstall("ruby-lsp"),
1590
- retryCandidates: ["ruby-lsp", ...rubyBinCandidates("ruby-lsp")]
1591
- }
1592
- }, options?.allowInstall);
1593
- if (rubylsp)
1594
- return rubylsp;
1595
- const solargraph = await resolveAndLaunch({
1596
- candidates: ["solargraph", ...rubyBinCandidates("solargraph")],
1597
- args: ["stdio"],
1598
- cwd: root
1599
- }, false);
1600
- if (solargraph)
1601
- return solargraph;
1602
- return resolveAndLaunch({
1603
- candidates: ["rubocop", ...rubyBinCandidates("rubocop")],
1604
- args: ["--lsp"],
1605
- cwd: root
1606
- }, false);
1607
- }
1608
- };
1609
- export const PHPServer = {
1610
- id: "php",
1611
- name: "Intelephense",
1612
- extensions: KIND_EXTENSIONS["php"],
1613
- root: RootWithFallback(createRootDetector(["composer.json", "composer.lock"])),
1614
- async spawn(root, options) {
1615
- const result = await resolveAndLaunch({
1616
- candidates: nodeBinCandidates(root, "intelephense"),
1617
- args: ["--stdio"],
1618
- cwd: root,
1619
- managedToolId: "intelephense"
1620
- }, options?.allowInstall);
1621
- if (!result)
1622
- return;
1623
- return {
1624
- ...result,
1625
- initialization: {
1626
- storagePath: path.join(getGlobalDmLensDir(), "intelephense")
1627
- }
1628
- };
1629
- }
1630
- };
1631
- function buildPsesArgs(bundleDir) {
1632
- const script = path.join(bundleDir, "PowerShellEditorServices", "Start-EditorServices.ps1");
1633
- const sessionDir = path.join(getGlobalDmLensDir(), "pses", `${process.pid}-${Date.now()}`);
1634
- mkdirSync(sessionDir, { recursive: true });
1635
- const logPath = path.join(sessionDir, "pses.log");
1636
- const sessionDetailsPath = path.join(sessionDir, "session.json");
1637
- return [
1638
- "-NoLogo",
1639
- "-NoProfile",
1640
- "-NonInteractive",
1641
- "-ExecutionPolicy",
1642
- "Bypass",
1643
- "-File",
1644
- script,
1645
- "-HostName",
1646
- "dm-lens",
1647
- "-HostProfileId",
1648
- "dm-lens",
1649
- "-HostVersion",
1650
- "1.0.0",
1651
- "-BundledModulesPath",
1652
- bundleDir,
1653
- "-LogPath",
1654
- logPath,
1655
- "-LogLevel",
1656
- "Warning",
1657
- "-SessionDetailsPath",
1658
- sessionDetailsPath,
1659
- "-Stdio",
1660
- "-LanguageServiceOnly"
1661
- ];
1662
- }
1663
- export const PowerShellServer = {
1664
- id: "powershell",
1665
- name: "PowerShell Editor Services",
1666
- extensions: KIND_EXTENSIONS["powershell"],
1667
- root: RootWithFallback(createRootDetector([".git"])),
1668
- spawn(root, options) {
1669
- return resolveAndLaunchBundle({
1670
- runtimeCandidates: ["pwsh", "powershell"],
1671
- bundleToolId: "powershell-editor-services",
1672
- cwd: root,
1673
- args: buildPsesArgs
1674
- }, options?.allowInstall);
1675
- }
1676
- };
1677
- export const CSharpServer = {
1678
- id: "csharp",
1679
- name: "csharp-ls",
1680
- extensions: KIND_EXTENSIONS["csharp"],
1681
- root: createRootDetector([...DOTNET_CSHARP_ROOT_MARKERS]),
1682
- async spawn(root, options) {
1683
- const candidates = dotnetToolCandidates("csharp-ls");
1684
- return resolveAndLaunch({
1685
- candidates,
1686
- args: [],
1687
- cwd: root,
1688
- runtimeInstall: {
1689
- runtimeCommand: "dotnet",
1690
- install: () => tryDotnetToolInstall("csharp-ls"),
1691
- retryCandidates: candidates
1692
- }
1693
- }, options?.allowInstall);
1694
- }
1695
- };
1696
- export const OmniSharpServer = createInteractiveServer({
1697
- id: "omnisharp",
1698
- name: "OmniSharp",
1699
- fallbackFor: "csharp",
1700
- extensions: KIND_EXTENSIONS["csharp"],
1701
- root: createRootDetector([...DOTNET_CSHARP_ROOT_MARKERS]),
1702
- language: "csharp",
1703
- command: "OmniSharp",
1704
- args: ["--languageserver"]
1705
- });
1706
- export const FSharpServer = {
1707
- id: "fsharp",
1708
- name: "FSAutocomplete",
1709
- extensions: KIND_EXTENSIONS["fsharp"],
1710
- root: createRootDetector([...DOTNET_FSHARP_ROOT_MARKERS]),
1711
- async spawn(root, options) {
1712
- const candidates = dotnetToolCandidates("fsautocomplete");
1713
- return resolveAndLaunch({
1714
- candidates,
1715
- args: [],
1716
- cwd: root,
1717
- runtimeInstall: {
1718
- runtimeCommand: "dotnet",
1719
- install: () => tryDotnetToolInstall("fsautocomplete"),
1720
- retryCandidates: candidates
1721
- }
1722
- }, options?.allowInstall);
1723
- }
1724
- };
1725
- export const JavaServer = createInteractiveServer({
1726
- id: "java",
1727
- name: "JDT Language Server",
1728
- extensions: KIND_EXTENSIONS["java"],
1729
- root: RootWithFallback(JavaWorkspaceRoot()),
1730
- language: "java",
1731
- command: () => process.env.JDTLS_PATH || "jdtls",
1732
- args: (root) => createLombokJdtlsArgs(root),
1733
- runtime: "java"
1734
- });
1735
- export const KotlinServer = {
1736
- id: "kotlin",
1737
- name: "Kotlin Language Server",
1738
- extensions: KIND_EXTENSIONS["kotlin"],
1739
- root: RootWithFallback(createRootDetector(["build.gradle.kts", "build.gradle", "pom.xml"])),
1740
- async spawn(root, options) {
1741
- return resolveAndLaunch({
1742
- candidates: ["kotlin-lsp", "kotlin-language-server"],
1743
- args: [],
1744
- cwd: root
1745
- }, options?.allowInstall);
1746
- }
1747
- };
1748
- export const SwiftServer = createInteractiveServer({
1749
- id: "swift",
1750
- name: "SourceKit-LSP",
1751
- extensions: KIND_EXTENSIONS["swift"],
1752
- root: createRootDetector(["Package.swift"]),
1753
- language: "swift",
1754
- command: "sourcekit-lsp"
1755
- });
1756
- export const DartServer = createInteractiveServer({
1757
- id: "dart",
1758
- name: "Dart Analysis Server",
1759
- extensions: KIND_EXTENSIONS["dart"],
1760
- root: RootWithFallback(createRootDetector(["pubspec.yaml"])),
1761
- language: "dart",
1762
- command: "dart",
1763
- args: ["language-server", "--protocol=lsp"]
1764
- });
1765
- function createTreeBinaryServer(spec) {
1766
- return {
1767
- id: spec.id,
1768
- name: spec.name,
1769
- extensions: spec.extensions,
1770
- root: spec.root,
1771
- spawn(root, options) {
1772
- return resolveAndLaunchTreeBinary({
1773
- candidates: [spec.binaryName],
1774
- bundleToolId: spec.binaryName,
1775
- binRelPath: spec.binRelPath,
1776
- cwd: root,
1777
- args: spec.args ?? []
1778
- }, options?.allowInstall);
1779
- }
1780
- };
1781
- }
1782
- export const LuaServer = createTreeBinaryServer({
1783
- id: "lua",
1784
- name: "Lua Language Server",
1785
- extensions: KIND_EXTENSIONS["lua"],
1786
- root: createRootDetector([".luarc.json", ".luacheckrc"]),
1787
- binaryName: "lua-language-server",
1788
- binRelPath: "bin/lua-language-server"
1789
- });
1790
- export const CppServer = createTreeBinaryServer({
1791
- id: "cpp",
1792
- name: "clangd",
1793
- extensions: KIND_EXTENSIONS["cxx"],
1794
- root: RootWithFallback(createRootDetector([
1795
- "compile_commands.json",
1796
- ".clangd",
1797
- "CMakeLists.txt",
1798
- "Makefile"
1799
- ])),
1800
- binaryName: "clangd",
1801
- binRelPath: "bin/clangd",
1802
- args: ["--background-index"]
1803
- });
1804
- export const ZigServer = {
1805
- id: "zig",
1806
- name: "ZLS",
1807
- extensions: KIND_EXTENSIONS["zig"],
1808
- root: RootWithFallback(createRootDetector(["build.zig"])),
1809
- spawn(root, options) {
1810
- return resolveAndLaunch({
1811
- candidates: ["zls"],
1812
- args: [],
1813
- cwd: root,
1814
- managedToolId: "zls"
1815
- }, options?.allowInstall);
1816
- }
1817
- };
1818
- export const HaskellServer = createInteractiveServer({
1819
- id: "haskell",
1820
- name: "Haskell Language Server",
1821
- extensions: KIND_EXTENSIONS["haskell"],
1822
- root: createRootDetector(["stack.yaml", "cabal.project", "*.cabal"]),
1823
- language: "haskell",
1824
- command: "haskell-language-server-wrapper",
1825
- args: ["--lsp"]
1826
- });
1827
- export const ElixirServer = createInteractiveServer({
1828
- id: "elixir",
1829
- name: "ElixirLS",
1830
- extensions: KIND_EXTENSIONS["elixir"],
1831
- root: RootWithFallback(createRootDetector(["mix.exs"])),
1832
- language: "elixir",
1833
- command: "elixir-ls"
1834
- });
1835
- export const ElixirExpertServer = {
1836
- id: "expert",
1837
- name: "Expert",
1838
- fallbackFor: "elixir",
1839
- extensions: KIND_EXTENSIONS["elixir"],
1840
- root: RootWithFallback(createRootDetector(["mix.exs"])),
1841
- availabilityKey: "expert",
1842
- async spawn(root, options) {
1843
- return resolveAndLaunch({
1844
- candidates: ["expert"],
1845
- args: ["--stdio"],
1846
- cwd: root,
1847
- managedToolId: "expert"
1848
- }, options?.allowInstall);
1849
- },
1850
- autoInstall: async () => Boolean(await ensureTool("expert"))
1851
- };
1852
- export const GleamServer = {
1853
- id: "gleam",
1854
- name: "Gleam LSP",
1855
- extensions: KIND_EXTENSIONS["gleam"],
1856
- root: RootWithFallback(createRootDetector(["gleam.toml"])),
1857
- async spawn(root, options) {
1858
- return resolveAndLaunch({
1859
- candidates: ["gleam"],
1860
- args: ["lsp"],
1861
- cwd: root,
1862
- managedToolId: "gleam"
1863
- }, options?.allowInstall);
1864
- }
1865
- };
1866
- export const TinymistServer = {
1867
- id: "tinymist",
1868
- name: "Tinymist",
1869
- extensions: extensionsForLanguage("typst"),
1870
- root: RootWithFallback(createRootDetector(["typst.toml", ".git"])),
1871
- availabilityKey: "tinymist",
1872
- async spawn(root, options) {
1873
- return resolveAndLaunch({
1874
- candidates: ["tinymist"],
1875
- args: ["lsp"],
1876
- cwd: root,
1877
- managedToolId: "tinymist"
1878
- }, options?.allowInstall);
1879
- }
1880
- };
1881
- export const MarksmanServer = {
1882
- id: "marksman",
1883
- name: "Marksman",
1884
- extensions: KIND_EXTENSIONS["markdown"],
1885
- root: RootWithFallback(createRootDetector([".marksman.toml", ".git"])),
1886
- spawn(root, options) {
1887
- return resolveAndLaunch({
1888
- candidates: ["marksman"],
1889
- args: ["server"],
1890
- cwd: root,
1891
- managedToolId: "marksman"
1892
- }, options?.allowInstall);
1893
- }
1894
- };
1895
- export const OCamlServer = createInteractiveServer({
1896
- id: "ocaml",
1897
- name: "ocamllsp",
1898
- extensions: KIND_EXTENSIONS["ocaml"],
1899
- root: createRootDetector(["dune-project", "opam"]),
1900
- language: "ocaml",
1901
- command: "ocamllsp"
1902
- });
1903
- export const ClojureServer = {
1904
- id: "clojure",
1905
- name: "Clojure LSP",
1906
- extensions: KIND_EXTENSIONS["clojure"],
1907
- root: createRootDetector(["deps.edn", "project.clj"]),
1908
- async spawn(root, options) {
1909
- return resolveAndLaunch({
1910
- candidates: ["clojure-lsp"],
1911
- args: [],
1912
- cwd: root,
1913
- managedToolId: "clojure-lsp"
1914
- }, options?.allowInstall);
1915
- }
1916
- };
1917
- export const CueServer = {
1918
- id: "cue",
1919
- name: "CUE Language Server",
1920
- extensions: KIND_EXTENSIONS["cue"],
1921
- root: RootWithFallback(createRootDetector(["cue.mod", ".git"])),
1922
- async spawn(root, options) {
1923
- return resolveAndLaunch({
1924
- candidates: ["cue"],
1925
- args: ["lsp", "serve"],
1926
- cwd: root,
1927
- managedToolId: "cue"
1928
- }, options?.allowInstall);
1929
- }
1930
- };
1931
- export const TerraformServer = {
1932
- id: "terraform",
1933
- name: "Terraform LSP",
1934
- extensions: KIND_EXTENSIONS["terraform"],
1935
- root: RootWithFallback(createRootDetector([".terraform.lock.hcl", ".terraform"])),
1936
- spawn(root, options) {
1937
- return resolveAndLaunch({
1938
- candidates: ["terraform-ls"],
1939
- args: ["serve"],
1940
- cwd: root,
1941
- managedToolId: "terraform-ls"
1942
- }, options?.allowInstall);
1943
- }
1944
- };
1945
- export const NixServer = createInteractiveServer({
1946
- id: "nix",
1947
- name: "nixd",
1948
- extensions: KIND_EXTENSIONS["nix"],
1949
- root: createRootDetector(["flake.nix"]),
1950
- language: "nix",
1951
- command: "nixd"
1952
- });
1953
- export const BashServer = {
1954
- id: "bash",
1955
- name: "Bash Language Server",
1956
- extensions: [".bash", ".sh", ".zsh"],
1957
- root: FileDirRoot,
1958
- clientWaitTimeoutMs: 20000,
1959
- initializeTimeoutMs: 20000,
1960
- spawn(root, options) {
1961
- return resolveAndLaunch({
1962
- candidates: nodeBinCandidates(root, "bash-language-server"),
1963
- args: ["start"],
1964
- cwd: root,
1965
- managedToolId: "bash-language-server"
1966
- }, options?.allowInstall);
1967
- }
1968
- };
1969
- export const FishServer = {
1970
- id: "fish",
1971
- name: "Fish Language Server",
1972
- extensions: KIND_EXTENSIONS["fish"],
1973
- root: RootWithFallback(createRootDetector([".git"])),
1974
- spawn(root, options) {
1975
- return resolveAndLaunch({
1976
- candidates: nodeBinCandidates(root, "fish-lsp"),
1977
- args: ["start", "--stdio"],
1978
- cwd: root,
1979
- managedToolId: "fish-lsp"
1980
- }, options?.allowInstall);
1981
- }
1982
- };
1983
- export const CMakeServer = {
1984
- id: "cmake",
1985
- name: "CMake Language Server",
1986
- extensions: [...KIND_EXTENSIONS["cmake"], "CMakeLists.txt"],
1987
- root: RootWithFallback(createRootDetector(["CMakeLists.txt", ".git"])),
1988
- spawn(root, options) {
1989
- return resolveAndLaunch({
1990
- candidates: ["cmake-language-server"],
1991
- args: [],
1992
- cwd: root,
1993
- managedToolId: "cmake-language-server"
1994
- }, options?.allowInstall);
1995
- }
1996
- };
1997
- export const DockerServer = {
1998
- id: "docker",
1999
- name: "Dockerfile Language Server",
2000
- extensions: [".dockerfile", "Dockerfile"],
2001
- root: RootWithFallback(PriorityRoot([
2002
- [
2003
- "docker-compose.yml",
2004
- "docker-compose.yaml",
2005
- "compose.yml",
2006
- "compose.yaml"
2007
- ],
2008
- [".git"]
2009
- ])),
2010
- spawn(root, options) {
2011
- return resolveAndLaunch({
2012
- candidates: nodeBinCandidates(root, "docker-langserver"),
2013
- args: ["--stdio"],
2014
- cwd: root,
2015
- managedToolId: "dockerfile-language-server-nodejs"
2016
- }, options?.allowInstall);
2017
- }
2018
- };
2019
- export const YamlServer = {
2020
- id: "yaml",
2021
- name: "YAML Language Server",
2022
- extensions: KIND_EXTENSIONS["yaml"],
2023
- root: RootWithFallback(PriorityRoot([
2024
- [".yamllint", "yamllint.yml", "yamllint.yaml", "pyproject.toml"],
2025
- [".git"]
2026
- ])),
2027
- spawn(root, options) {
2028
- return resolveAndLaunch({
2029
- candidates: nodeBinCandidates(root, "yaml-language-server"),
2030
- args: ["--stdio"],
2031
- cwd: root,
2032
- managedToolId: "yaml-language-server"
2033
- }, options?.allowInstall);
2034
- }
2035
- };
2036
- export const JsonServer = {
2037
- id: "json",
2038
- name: "VSCode JSON Language Server",
2039
- extensions: KIND_EXTENSIONS["json"],
2040
- root: RootWithFallback(WorkspacePriorityRoot([
2041
- ["package.json", "tsconfig.json", "jsconfig.json"],
2042
- [".git"]
2043
- ])),
2044
- clientWaitTimeoutMs: 20000,
2045
- initializeTimeoutMs: 20000,
2046
- spawn(root, options) {
2047
- return resolveAndLaunch({
2048
- candidates: ["vscode-json-language-server"],
2049
- args: ["--stdio"],
2050
- cwd: root,
2051
- managedToolId: "vscode-json-language-server"
2052
- }, options?.allowInstall);
2053
- }
2054
- };
2055
- export const HtmlServer = {
2056
- id: "html",
2057
- name: "VSCode HTML Language Server",
2058
- extensions: KIND_EXTENSIONS["html"],
2059
- root: RootWithFallback(IgnoreHomeRoot(PriorityRoot([["package.json", "index.html", "vite.config.ts"]]))),
2060
- spawn(root, options) {
2061
- return resolveAndLaunch({
2062
- candidates: nodeBinCandidates(root, "vscode-html-language-server"),
2063
- args: ["--stdio"],
2064
- cwd: root,
2065
- managedToolId: "vscode-html-languageserver-bin"
2066
- }, options?.allowInstall);
2067
- }
2068
- };
2069
- export const TomlServer = {
2070
- id: "toml",
2071
- name: "Taplo",
2072
- extensions: KIND_EXTENSIONS["toml"],
2073
- root: RootWithFallback(PriorityRoot([["pyproject.toml", "Cargo.toml", "taplo.toml"], [".git"]])),
2074
- spawn(root, options) {
2075
- return resolveAndLaunch({
2076
- candidates: ["taplo"],
2077
- args: ["lsp", "stdio"],
2078
- cwd: root,
2079
- managedToolId: "taplo"
2080
- }, options?.allowInstall);
2081
- }
2082
- };
2083
- export const PrismaServer = {
2084
- id: "prisma",
2085
- name: "Prisma Language Server",
2086
- extensions: KIND_EXTENSIONS["prisma"],
2087
- root: RootWithFallback(createRootDetector(["prisma/schema.prisma", "schema.prisma"])),
2088
- clientWaitTimeoutMs: 40000,
2089
- initializeTimeoutMs: 40000,
2090
- spawn(root, options) {
2091
- return resolveAndLaunch({
2092
- candidates: nodeBinCandidates(root, "prisma-language-server"),
2093
- args: ["--stdio"],
2094
- cwd: root,
2095
- managedToolId: "@prisma/language-server"
2096
- }, options?.allowInstall);
2097
- }
2098
- };
2099
- export const VueServer = {
2100
- id: "vue",
2101
- name: "Vue Language Server",
2102
- extensions: [".vue"],
2103
- root: RootWithFallback(IgnoreHomeRoot(createRootDetector([
2104
- "package.json",
2105
- "package-lock.json",
2106
- "bun.lockb",
2107
- "bun.lock",
2108
- "pnpm-lock.yaml",
2109
- "yarn.lock"
2110
- ]))),
2111
- clientWaitTimeoutMs: 30000,
2112
- initializeTimeoutMs: 30000,
2113
- async spawn(root, options) {
2114
- const tsserverPath = await findTsserverPath(root, options?.allowInstall);
2115
- const hasPackageJson = existsSync(path.join(root, "package.json"));
2116
- const hasNodeModules = existsSync(path.join(root, "node_modules"));
2117
- if (hasPackageJson && !hasNodeModules) {
2118
- logSessionStart(`lsp vue: node_modules missing in ${root} — Vue navigation may be limited. ` + `Run: npm install (or pnpm/yarn install) in this project.`);
2119
- }
2120
- const proc = await resolveAndLaunch({
2121
- candidates: nodeBinCandidates(root, "vue-language-server"),
2122
- args: ["--stdio"],
2123
- cwd: root,
2124
- managedToolId: "@vue/language-server"
2125
- }, options?.allowInstall);
2126
- if (!proc)
2127
- return;
2128
- return {
2129
- process: proc.process,
2130
- source: proc.source,
2131
- initialization: tsserverPath ? { typescript: { tsdk: path.dirname(tsserverPath) } } : undefined
2132
- };
2133
- }
2134
- };
2135
- export const SvelteServer = {
2136
- id: "svelte",
2137
- name: "Svelte Language Server",
2138
- extensions: [".svelte"],
2139
- root: RootWithFallback(IgnoreHomeRoot(createRootDetector([
2140
- "package.json",
2141
- "package-lock.json",
2142
- "bun.lockb",
2143
- "bun.lock",
2144
- "pnpm-lock.yaml",
2145
- "yarn.lock"
2146
- ]))),
2147
- clientWaitTimeoutMs: 20000,
2148
- initializeTimeoutMs: 20000,
2149
- async spawn(root, options) {
2150
- const tsserverPath = await findTsserverPath(root, options?.allowInstall);
2151
- const proc = await resolveAndLaunch({
2152
- candidates: [
2153
- ...nodeBinCandidates(root, "svelteserver"),
2154
- ...nodeBinCandidates(root, "svelte-language-server")
2155
- ],
2156
- args: ["--stdio"],
2157
- cwd: root,
2158
- managedToolId: "svelte-language-server"
2159
- }, options?.allowInstall);
2160
- if (!proc)
2161
- return;
2162
- return {
2163
- process: proc.process,
2164
- source: proc.source,
2165
- initialization: tsserverPath ? { typescript: { tsdk: path.dirname(tsserverPath) } } : undefined
2166
- };
2167
- }
2168
- };
2169
- export const CssServer = {
2170
- id: "css",
2171
- name: "CSS Language Server",
2172
- extensions: KIND_EXTENSIONS["css"],
2173
- root: RootWithFallback(IgnoreHomeRoot(PriorityRoot([
2174
- [
2175
- "package.json",
2176
- "postcss.config.js",
2177
- "tailwind.config.js",
2178
- "vite.config.ts"
2179
- ]
2180
- ]))),
2181
- spawn(root, options) {
2182
- return resolveAndLaunch({
2183
- candidates: nodeBinCandidates(root, "vscode-css-language-server"),
2184
- args: ["--stdio"],
2185
- cwd: root,
2186
- managedToolId: "vscode-css-languageserver"
2187
- }, options?.allowInstall);
2188
- }
2189
- };
2190
- const OPENGREP_KINDS = [
2191
- "csharp",
2192
- "css",
2193
- "cxx",
2194
- "dart",
2195
- "docker",
2196
- "go",
2197
- "html",
2198
- "java",
2199
- "json",
2200
- "jsts",
2201
- "kotlin",
2202
- "lua",
2203
- "php",
2204
- "python",
2205
- "ruby",
2206
- "rust",
2207
- "shell",
2208
- "swift",
2209
- "terraform",
2210
- "yaml"
2211
- ];
2212
- const OPENGREP_EXTENSIONS = Array.from(new Set(OPENGREP_KINDS.flatMap((k) => KIND_EXTENSIONS[k] ?? [])));
2213
- function opengrepInitialization(root) {
2214
- const resolved = resolveOpengrepConfig(root, { enabled: true });
2215
- return {
2216
- scan: {
2217
- configuration: [resolved.configArg ?? "auto"],
2218
- onlyGitDirty: false,
2219
- jobs: 16
2220
- },
2221
- metrics: { enabled: false },
2222
- doHover: false
2223
- };
2224
- }
2225
- export const OpengrepServer = {
2226
- id: "opengrep",
2227
- name: "Opengrep Security Scanner",
2228
- role: "auxiliary",
2229
- extensions: OPENGREP_EXTENSIONS,
2230
- root: RootWithFallback(NearestRoot([".git"]), async () => process.cwd()),
2231
- availabilityKey: "opengrep",
2232
- initializeTimeoutMs: 15000,
2233
- async spawn(root, options) {
2234
- const launched = await resolveAndLaunch({
2235
- candidates: ["opengrep"],
2236
- args: ["lsp", "--experimental"],
2237
- cwd: root,
2238
- managedToolId: "opengrep"
2239
- }, options?.allowInstall);
2240
- if (!launched)
2241
- return;
2242
- return { ...launched, initialization: opengrepInitialization(root) };
2243
- },
2244
- autoInstall: async () => Boolean(await ensureTool("opengrep"))
2245
- };
2246
- const AST_GREP_KINDS = [
2247
- "csharp",
2248
- "cxx",
2249
- "css",
2250
- "elixir",
2251
- "go",
2252
- "haskell",
2253
- "html",
2254
- "java",
2255
- "json",
2256
- "jsts",
2257
- "kotlin",
2258
- "lua",
2259
- "nix",
2260
- "php",
2261
- "python",
2262
- "ruby",
2263
- "rust",
2264
- "scala",
2265
- "shell",
2266
- "swift",
2267
- "yaml"
2268
- ];
2269
- const AST_GREP_EXTENSIONS = Array.from(new Set(AST_GREP_KINDS.flatMap((k) => KIND_EXTENSIONS[k] ?? [])));
2270
- export const AstGrepServer = {
2271
- id: "ast-grep",
2272
- name: "ast-grep structural linter",
2273
- role: "auxiliary",
2274
- extensions: AST_GREP_EXTENSIONS,
2275
- root: RootWithFallback(createRootDetector(["sgconfig.yml", "sgconfig.yaml"]), RootWithFallback(NearestRoot([".git"]), async () => process.cwd())),
2276
- availabilityKey: "ast-grep",
2277
- notifyInflightLimit: 4,
2278
- initializeTimeoutMs: 15000,
2279
- async spawn(root, options) {
2280
- const projectSgconfig = findLocalSgconfig(root);
2281
- let args = ["lsp"];
2282
- if (!projectSgconfig) {
2283
- const baseline = resolveBaselineSgconfig(root);
2284
- if (baseline)
2285
- args = ["lsp", "--config", baseline];
2286
- }
2287
- const nativeExe = resolveAstGrepNativeExe();
2288
- const candidates = nativeExe ? [nativeExe, "ast-grep"] : ["ast-grep"];
2289
- return resolveAndLaunch({
2290
- candidates,
2291
- args,
2292
- cwd: root,
2293
- managedToolId: "ast-grep"
2294
- }, options?.allowInstall);
2295
- },
2296
- autoInstall: async () => Boolean(await ensureTool("ast-grep"))
2297
- };
2298
- const ZIZMOR_EXTENSIONS = KIND_EXTENSIONS["yaml"];
2299
- export const ZizmorServer = {
2300
- id: "zizmor",
2301
- name: "zizmor Actions Security Scanner",
2302
- role: "auxiliary",
2303
- extensions: ZIZMOR_EXTENSIONS,
2304
- pathFilter: isZizmorAuditTarget,
2305
- root: RootWithFallback(NearestRoot([".git"]), async () => process.cwd()),
2306
- availabilityKey: "zizmor",
2307
- async spawn(root, options) {
2308
- const ghToken = await resolveZizmorGitHubToken();
2309
- return resolveAndLaunch({
2310
- candidates: ["zizmor"],
2311
- args: ["--lsp"],
2312
- cwd: root,
2313
- managedToolId: "zizmor",
2314
- ...ghToken ? { env: { GH_TOKEN: ghToken } } : {}
2315
- }, options?.allowInstall);
2316
- },
2317
- autoInstall: async () => Boolean(await ensureTool("zizmor"))
2318
- };
2319
- const TYPOS_EXTENSIONS = Array.from(new Set([...OPENGREP_EXTENSIONS, ...KIND_EXTENSIONS["markdown"]]));
2320
- function typosInitialization(root) {
2321
- const localConfig = findLocalTyposConfig(root);
2322
- if (localConfig) {
2323
- logLatency({
2324
- type: "phase",
2325
- phase: "typos_config_resolved",
2326
- filePath: root,
2327
- durationMs: 0,
2328
- metadata: { mode: "project_config", configPath: localConfig }
2329
- });
2330
- logSessionStart(`typos config resolved mode=project_config configPath=${localConfig}`);
2331
- return;
2332
- }
2333
- const configPath = resolvePackagePath(import.meta.url, "rules", "typos", "_typos.toml");
2334
- logLatency({
2335
- type: "phase",
2336
- phase: "typos_config_resolved",
2337
- filePath: root,
2338
- durationMs: 0,
2339
- metadata: { mode: "injected_default", configPath }
2340
- });
2341
- logSessionStart(`typos config resolved mode=injected_default configPath=${configPath}`);
2342
- return { config: configPath };
2343
- }
2344
- export const TyposServer = {
2345
- id: "typos",
2346
- name: "typos Spell Checker",
2347
- role: "auxiliary",
2348
- extensions: TYPOS_EXTENSIONS,
2349
- root: RootWithFallback(NearestRoot([".git"]), async () => process.cwd()),
2350
- availabilityKey: "typos-lsp",
2351
- async spawn(root, options) {
2352
- const launched = await resolveAndLaunch({
2353
- candidates: ["typos-lsp"],
2354
- args: [],
2355
- cwd: root,
2356
- managedToolId: "typos-lsp"
2357
- }, options?.allowInstall);
2358
- if (!launched)
2359
- return;
2360
- const initialization = typosInitialization(root);
2361
- return initialization ? { ...launched, initialization } : launched;
2362
- },
2363
- autoInstall: async () => Boolean(await ensureTool("typos-lsp"))
2364
- };
2365
- export const LSP_SERVERS = [
2366
- TypeScriptServer,
2367
- DenoServer,
2368
- PythonServer,
2369
- PythonJediServer,
2370
- GoServer,
2371
- RustServer,
2372
- RubyServer,
2373
- PHPServer,
2374
- PowerShellServer,
2375
- CSharpServer,
2376
- OmniSharpServer,
2377
- FSharpServer,
2378
- JavaServer,
2379
- KotlinServer,
2380
- SwiftServer,
2381
- DartServer,
2382
- LuaServer,
2383
- CppServer,
2384
- ZigServer,
2385
- HaskellServer,
2386
- ElixirServer,
2387
- ElixirExpertServer,
2388
- GleamServer,
2389
- TinymistServer,
2390
- MarksmanServer,
2391
- OCamlServer,
2392
- ClojureServer,
2393
- CueServer,
2394
- TerraformServer,
2395
- NixServer,
2396
- BashServer,
2397
- FishServer,
2398
- CMakeServer,
2399
- DockerServer,
2400
- YamlServer,
2401
- JsonServer,
2402
- HtmlServer,
2403
- TomlServer,
2404
- PrismaServer,
2405
- VueServer,
2406
- SvelteServer,
2407
- CssServer,
2408
- OpengrepServer,
2409
- AstGrepServer,
2410
- ZizmorServer,
2411
- TyposServer
2412
- ];
2413
- export function getServerForExtension(ext) {
2414
- return LSP_SERVERS.find((server) => server.extensions.includes(ext));
2415
- }
2416
- export function getServerById(id) {
2417
- return LSP_SERVERS.find((server) => server.id === id);
2418
- }
2419
- export function getServersForFile(filePath) {
2420
- const ext = path.extname(filePath).toLowerCase();
2421
- return LSP_SERVERS.filter((server) => server.extensions.includes(ext));
2422
- }