easc-cli 1.1.37 → 1.1.40

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 (412) hide show
  1. package/bin/{opencode → opencode.cjs} +4 -6
  2. package/package.json +15 -120
  3. package/AGENTS.md +0 -27
  4. package/Dockerfile +0 -18
  5. package/README.md +0 -15
  6. package/bunfig.toml +0 -7
  7. package/charity-website/README.md +0 -252
  8. package/charity-website/admin/index.html +0 -299
  9. package/charity-website/package.json +0 -40
  10. package/charity-website/public/index.html +0 -265
  11. package/charity-website/src/css/admin.css +0 -710
  12. package/charity-website/src/css/style.css +0 -741
  13. package/charity-website/src/js/admin.js +0 -743
  14. package/charity-website/src/js/app.js +0 -444
  15. package/parsers-config.ts +0 -253
  16. package/script/build.ts +0 -172
  17. package/script/deploy.ts +0 -96
  18. package/script/publish-registries.ts +0 -187
  19. package/script/publish.ts +0 -70
  20. package/script/schema.ts +0 -47
  21. package/script/seed-e2e.ts +0 -50
  22. package/src/acp/README.md +0 -164
  23. package/src/acp/agent.ts +0 -1285
  24. package/src/acp/session.ts +0 -105
  25. package/src/acp/types.ts +0 -22
  26. package/src/agent/agent.ts +0 -332
  27. package/src/agent/generate.txt +0 -75
  28. package/src/agent/prompt/compaction.txt +0 -12
  29. package/src/agent/prompt/explore.txt +0 -18
  30. package/src/agent/prompt/summary.txt +0 -11
  31. package/src/agent/prompt/title.txt +0 -43
  32. package/src/auth/eliseart.ts +0 -76
  33. package/src/auth/index.ts +0 -73
  34. package/src/bun/index.ts +0 -134
  35. package/src/bus/bus-event.ts +0 -43
  36. package/src/bus/global.ts +0 -10
  37. package/src/bus/index.ts +0 -105
  38. package/src/cli/bootstrap.ts +0 -17
  39. package/src/cli/cmd/account.ts +0 -81
  40. package/src/cli/cmd/acp.ts +0 -69
  41. package/src/cli/cmd/agent.ts +0 -257
  42. package/src/cli/cmd/auth.ts +0 -427
  43. package/src/cli/cmd/cmd.ts +0 -7
  44. package/src/cli/cmd/debug/agent.ts +0 -166
  45. package/src/cli/cmd/debug/config.ts +0 -16
  46. package/src/cli/cmd/debug/file.ts +0 -97
  47. package/src/cli/cmd/debug/index.ts +0 -48
  48. package/src/cli/cmd/debug/lsp.ts +0 -52
  49. package/src/cli/cmd/debug/ripgrep.ts +0 -87
  50. package/src/cli/cmd/debug/scrap.ts +0 -16
  51. package/src/cli/cmd/debug/skill.ts +0 -16
  52. package/src/cli/cmd/debug/snapshot.ts +0 -52
  53. package/src/cli/cmd/export.ts +0 -88
  54. package/src/cli/cmd/generate.ts +0 -38
  55. package/src/cli/cmd/github.ts +0 -1548
  56. package/src/cli/cmd/import.ts +0 -98
  57. package/src/cli/cmd/mcp.ts +0 -827
  58. package/src/cli/cmd/models.ts +0 -77
  59. package/src/cli/cmd/pr.ts +0 -112
  60. package/src/cli/cmd/run.ts +0 -407
  61. package/src/cli/cmd/serve.ts +0 -20
  62. package/src/cli/cmd/session.ts +0 -135
  63. package/src/cli/cmd/stats.ts +0 -402
  64. package/src/cli/cmd/tui/app.tsx +0 -774
  65. package/src/cli/cmd/tui/attach.ts +0 -31
  66. package/src/cli/cmd/tui/component/border.tsx +0 -21
  67. package/src/cli/cmd/tui/component/dialog-agent.tsx +0 -31
  68. package/src/cli/cmd/tui/component/dialog-command.tsx +0 -148
  69. package/src/cli/cmd/tui/component/dialog-mcp.tsx +0 -86
  70. package/src/cli/cmd/tui/component/dialog-model.tsx +0 -234
  71. package/src/cli/cmd/tui/component/dialog-provider.tsx +0 -256
  72. package/src/cli/cmd/tui/component/dialog-session-list.tsx +0 -114
  73. package/src/cli/cmd/tui/component/dialog-session-rename.tsx +0 -31
  74. package/src/cli/cmd/tui/component/dialog-stash.tsx +0 -87
  75. package/src/cli/cmd/tui/component/dialog-status.tsx +0 -164
  76. package/src/cli/cmd/tui/component/dialog-supabase.tsx +0 -102
  77. package/src/cli/cmd/tui/component/dialog-tag.tsx +0 -44
  78. package/src/cli/cmd/tui/component/dialog-theme-list.tsx +0 -50
  79. package/src/cli/cmd/tui/component/logo.tsx +0 -88
  80. package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +0 -653
  81. package/src/cli/cmd/tui/component/prompt/frecency.tsx +0 -89
  82. package/src/cli/cmd/tui/component/prompt/history.tsx +0 -108
  83. package/src/cli/cmd/tui/component/prompt/index.tsx +0 -1182
  84. package/src/cli/cmd/tui/component/prompt/stash.tsx +0 -101
  85. package/src/cli/cmd/tui/component/spinner.tsx +0 -16
  86. package/src/cli/cmd/tui/component/textarea-keybindings.ts +0 -73
  87. package/src/cli/cmd/tui/component/tips.tsx +0 -153
  88. package/src/cli/cmd/tui/component/todo-item.tsx +0 -32
  89. package/src/cli/cmd/tui/context/args.tsx +0 -14
  90. package/src/cli/cmd/tui/context/directory.ts +0 -13
  91. package/src/cli/cmd/tui/context/exit.tsx +0 -23
  92. package/src/cli/cmd/tui/context/helper.tsx +0 -25
  93. package/src/cli/cmd/tui/context/keybind.tsx +0 -101
  94. package/src/cli/cmd/tui/context/kv.tsx +0 -52
  95. package/src/cli/cmd/tui/context/local.tsx +0 -402
  96. package/src/cli/cmd/tui/context/prompt.tsx +0 -18
  97. package/src/cli/cmd/tui/context/route.tsx +0 -46
  98. package/src/cli/cmd/tui/context/sdk.tsx +0 -94
  99. package/src/cli/cmd/tui/context/sync.tsx +0 -445
  100. package/src/cli/cmd/tui/context/theme/aura.json +0 -69
  101. package/src/cli/cmd/tui/context/theme/ayu.json +0 -80
  102. package/src/cli/cmd/tui/context/theme/carbonfox.json +0 -248
  103. package/src/cli/cmd/tui/context/theme/catppuccin-frappe.json +0 -233
  104. package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +0 -233
  105. package/src/cli/cmd/tui/context/theme/catppuccin.json +0 -112
  106. package/src/cli/cmd/tui/context/theme/cobalt2.json +0 -228
  107. package/src/cli/cmd/tui/context/theme/cursor.json +0 -249
  108. package/src/cli/cmd/tui/context/theme/dracula.json +0 -219
  109. package/src/cli/cmd/tui/context/theme/everforest.json +0 -241
  110. package/src/cli/cmd/tui/context/theme/flexoki.json +0 -237
  111. package/src/cli/cmd/tui/context/theme/github.json +0 -233
  112. package/src/cli/cmd/tui/context/theme/gruvbox.json +0 -95
  113. package/src/cli/cmd/tui/context/theme/kanagawa.json +0 -77
  114. package/src/cli/cmd/tui/context/theme/lucent-orng.json +0 -237
  115. package/src/cli/cmd/tui/context/theme/material.json +0 -235
  116. package/src/cli/cmd/tui/context/theme/matrix.json +0 -77
  117. package/src/cli/cmd/tui/context/theme/mercury.json +0 -252
  118. package/src/cli/cmd/tui/context/theme/monokai.json +0 -221
  119. package/src/cli/cmd/tui/context/theme/nightowl.json +0 -221
  120. package/src/cli/cmd/tui/context/theme/nord.json +0 -223
  121. package/src/cli/cmd/tui/context/theme/one-dark.json +0 -84
  122. package/src/cli/cmd/tui/context/theme/orng.json +0 -249
  123. package/src/cli/cmd/tui/context/theme/osaka-jade.json +0 -93
  124. package/src/cli/cmd/tui/context/theme/palenight.json +0 -222
  125. package/src/cli/cmd/tui/context/theme/rosepine.json +0 -234
  126. package/src/cli/cmd/tui/context/theme/solarized.json +0 -223
  127. package/src/cli/cmd/tui/context/theme/synthwave84.json +0 -226
  128. package/src/cli/cmd/tui/context/theme/tokyonight.json +0 -243
  129. package/src/cli/cmd/tui/context/theme/vercel.json +0 -245
  130. package/src/cli/cmd/tui/context/theme/vesper.json +0 -218
  131. package/src/cli/cmd/tui/context/theme/zenburn.json +0 -223
  132. package/src/cli/cmd/tui/context/theme.tsx +0 -1152
  133. package/src/cli/cmd/tui/event.ts +0 -48
  134. package/src/cli/cmd/tui/routes/home.tsx +0 -140
  135. package/src/cli/cmd/tui/routes/session/dialog-fork-from-timeline.tsx +0 -64
  136. package/src/cli/cmd/tui/routes/session/dialog-message.tsx +0 -109
  137. package/src/cli/cmd/tui/routes/session/dialog-subagent.tsx +0 -26
  138. package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +0 -47
  139. package/src/cli/cmd/tui/routes/session/dialog-tool.tsx +0 -63
  140. package/src/cli/cmd/tui/routes/session/footer.tsx +0 -129
  141. package/src/cli/cmd/tui/routes/session/header.tsx +0 -136
  142. package/src/cli/cmd/tui/routes/session/index.tsx +0 -2132
  143. package/src/cli/cmd/tui/routes/session/permission.tsx +0 -495
  144. package/src/cli/cmd/tui/routes/session/question.tsx +0 -435
  145. package/src/cli/cmd/tui/routes/session/sidebar.tsx +0 -313
  146. package/src/cli/cmd/tui/thread.ts +0 -165
  147. package/src/cli/cmd/tui/ui/dialog-alert.tsx +0 -57
  148. package/src/cli/cmd/tui/ui/dialog-confirm.tsx +0 -83
  149. package/src/cli/cmd/tui/ui/dialog-export-options.tsx +0 -204
  150. package/src/cli/cmd/tui/ui/dialog-help.tsx +0 -38
  151. package/src/cli/cmd/tui/ui/dialog-prompt.tsx +0 -77
  152. package/src/cli/cmd/tui/ui/dialog-select.tsx +0 -376
  153. package/src/cli/cmd/tui/ui/dialog.tsx +0 -167
  154. package/src/cli/cmd/tui/ui/link.tsx +0 -28
  155. package/src/cli/cmd/tui/ui/spinner.ts +0 -368
  156. package/src/cli/cmd/tui/ui/toast.tsx +0 -100
  157. package/src/cli/cmd/tui/util/clipboard.ts +0 -160
  158. package/src/cli/cmd/tui/util/editor.ts +0 -32
  159. package/src/cli/cmd/tui/util/signal.ts +0 -7
  160. package/src/cli/cmd/tui/util/terminal.ts +0 -114
  161. package/src/cli/cmd/tui/util/transcript.ts +0 -98
  162. package/src/cli/cmd/tui/worker.ts +0 -152
  163. package/src/cli/cmd/uninstall.ts +0 -357
  164. package/src/cli/cmd/upgrade.ts +0 -73
  165. package/src/cli/cmd/web.ts +0 -81
  166. package/src/cli/error.ts +0 -57
  167. package/src/cli/network.ts +0 -53
  168. package/src/cli/ui.ts +0 -84
  169. package/src/cli/upgrade.ts +0 -25
  170. package/src/command/index.ts +0 -131
  171. package/src/command/template/initialize.txt +0 -10
  172. package/src/command/template/review.txt +0 -99
  173. package/src/config/config.ts +0 -1361
  174. package/src/config/markdown.ts +0 -93
  175. package/src/env/index.ts +0 -26
  176. package/src/file/ignore.ts +0 -83
  177. package/src/file/index.ts +0 -411
  178. package/src/file/ripgrep.ts +0 -407
  179. package/src/file/time.ts +0 -64
  180. package/src/file/watcher.ts +0 -127
  181. package/src/flag/flag.ts +0 -54
  182. package/src/format/formatter.ts +0 -342
  183. package/src/format/index.ts +0 -137
  184. package/src/global/index.ts +0 -55
  185. package/src/id/id.ts +0 -83
  186. package/src/ide/index.ts +0 -76
  187. package/src/index.ts +0 -162
  188. package/src/installation/index.ts +0 -246
  189. package/src/lsp/client.ts +0 -252
  190. package/src/lsp/index.ts +0 -485
  191. package/src/lsp/language.ts +0 -119
  192. package/src/lsp/server.ts +0 -2046
  193. package/src/mcp/auth.ts +0 -135
  194. package/src/mcp/index.ts +0 -931
  195. package/src/mcp/oauth-callback.ts +0 -200
  196. package/src/mcp/oauth-provider.ts +0 -154
  197. package/src/patch/index.ts +0 -680
  198. package/src/permission/arity.ts +0 -163
  199. package/src/permission/index.ts +0 -210
  200. package/src/permission/next.ts +0 -269
  201. package/src/plugin/codex.ts +0 -493
  202. package/src/plugin/copilot.ts +0 -269
  203. package/src/plugin/index.ts +0 -136
  204. package/src/project/bootstrap.ts +0 -35
  205. package/src/project/instance.ts +0 -91
  206. package/src/project/project.ts +0 -339
  207. package/src/project/state.ts +0 -66
  208. package/src/project/vcs.ts +0 -76
  209. package/src/provider/auth.ts +0 -147
  210. package/src/provider/models-macro.ts +0 -11
  211. package/src/provider/models.ts +0 -112
  212. package/src/provider/provider.ts +0 -1435
  213. package/src/provider/sdk/openai-compatible/src/README.md +0 -5
  214. package/src/provider/sdk/openai-compatible/src/index.ts +0 -2
  215. package/src/provider/sdk/openai-compatible/src/openai-compatible-provider.ts +0 -100
  216. package/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts +0 -303
  217. package/src/provider/sdk/openai-compatible/src/responses/map-openai-responses-finish-reason.ts +0 -22
  218. package/src/provider/sdk/openai-compatible/src/responses/openai-config.ts +0 -18
  219. package/src/provider/sdk/openai-compatible/src/responses/openai-error.ts +0 -22
  220. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-api-types.ts +0 -207
  221. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts +0 -1732
  222. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-prepare-tools.ts +0 -177
  223. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-settings.ts +0 -1
  224. package/src/provider/sdk/openai-compatible/src/responses/tool/code-interpreter.ts +0 -88
  225. package/src/provider/sdk/openai-compatible/src/responses/tool/file-search.ts +0 -128
  226. package/src/provider/sdk/openai-compatible/src/responses/tool/image-generation.ts +0 -115
  227. package/src/provider/sdk/openai-compatible/src/responses/tool/local-shell.ts +0 -65
  228. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search-preview.ts +0 -104
  229. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search.ts +0 -103
  230. package/src/provider/transform.ts +0 -733
  231. package/src/pty/index.ts +0 -232
  232. package/src/question/index.ts +0 -171
  233. package/src/scheduler/index.ts +0 -61
  234. package/src/server/error.ts +0 -36
  235. package/src/server/event.ts +0 -7
  236. package/src/server/mdns.ts +0 -59
  237. package/src/server/routes/config.ts +0 -92
  238. package/src/server/routes/experimental.ts +0 -208
  239. package/src/server/routes/file.ts +0 -197
  240. package/src/server/routes/global.ts +0 -135
  241. package/src/server/routes/mcp.ts +0 -361
  242. package/src/server/routes/permission.ts +0 -68
  243. package/src/server/routes/project.ts +0 -82
  244. package/src/server/routes/provider.ts +0 -165
  245. package/src/server/routes/pty.ts +0 -169
  246. package/src/server/routes/question.ts +0 -98
  247. package/src/server/routes/session.ts +0 -935
  248. package/src/server/routes/tui.ts +0 -379
  249. package/src/server/server.ts +0 -573
  250. package/src/session/compaction.ts +0 -225
  251. package/src/session/index.ts +0 -488
  252. package/src/session/llm.ts +0 -279
  253. package/src/session/message-v2.ts +0 -702
  254. package/src/session/message.ts +0 -189
  255. package/src/session/processor.ts +0 -406
  256. package/src/session/prompt/anthropic-20250930.txt +0 -166
  257. package/src/session/prompt/anthropic.txt +0 -105
  258. package/src/session/prompt/anthropic_spoof.txt +0 -1
  259. package/src/session/prompt/beast.txt +0 -147
  260. package/src/session/prompt/build-switch.txt +0 -5
  261. package/src/session/prompt/codex_header.txt +0 -79
  262. package/src/session/prompt/copilot-gpt-5.txt +0 -143
  263. package/src/session/prompt/gemini.txt +0 -155
  264. package/src/session/prompt/max-steps.txt +0 -16
  265. package/src/session/prompt/plan-reminder-anthropic.txt +0 -67
  266. package/src/session/prompt/plan.txt +0 -26
  267. package/src/session/prompt/qwen.txt +0 -109
  268. package/src/session/prompt.ts +0 -1820
  269. package/src/session/retry.ts +0 -90
  270. package/src/session/revert.ts +0 -108
  271. package/src/session/status.ts +0 -76
  272. package/src/session/summary.ts +0 -150
  273. package/src/session/system.ts +0 -152
  274. package/src/session/todo.ts +0 -37
  275. package/src/share/share-next.ts +0 -200
  276. package/src/share/share.ts +0 -92
  277. package/src/shell/shell.ts +0 -67
  278. package/src/skill/index.ts +0 -1
  279. package/src/skill/skill.ts +0 -136
  280. package/src/snapshot/index.ts +0 -236
  281. package/src/storage/storage.ts +0 -227
  282. package/src/tool/apply_patch.ts +0 -269
  283. package/src/tool/apply_patch.txt +0 -33
  284. package/src/tool/bash.ts +0 -259
  285. package/src/tool/bash.txt +0 -115
  286. package/src/tool/batch.ts +0 -175
  287. package/src/tool/batch.txt +0 -24
  288. package/src/tool/codesearch.ts +0 -132
  289. package/src/tool/codesearch.txt +0 -12
  290. package/src/tool/edit.ts +0 -645
  291. package/src/tool/edit.txt +0 -10
  292. package/src/tool/external-directory.ts +0 -32
  293. package/src/tool/glob.ts +0 -77
  294. package/src/tool/glob.txt +0 -6
  295. package/src/tool/grep.ts +0 -154
  296. package/src/tool/grep.txt +0 -8
  297. package/src/tool/invalid.ts +0 -17
  298. package/src/tool/ls.ts +0 -121
  299. package/src/tool/ls.txt +0 -1
  300. package/src/tool/lsp.ts +0 -96
  301. package/src/tool/lsp.txt +0 -19
  302. package/src/tool/multiedit.ts +0 -46
  303. package/src/tool/multiedit.txt +0 -41
  304. package/src/tool/plan-enter.txt +0 -14
  305. package/src/tool/plan-exit.txt +0 -13
  306. package/src/tool/plan.ts +0 -130
  307. package/src/tool/question.ts +0 -33
  308. package/src/tool/question.txt +0 -10
  309. package/src/tool/read.ts +0 -202
  310. package/src/tool/read.txt +0 -12
  311. package/src/tool/registry.ts +0 -164
  312. package/src/tool/skill.ts +0 -75
  313. package/src/tool/task.ts +0 -188
  314. package/src/tool/task.txt +0 -60
  315. package/src/tool/todo.ts +0 -53
  316. package/src/tool/todoread.txt +0 -14
  317. package/src/tool/todowrite.txt +0 -167
  318. package/src/tool/tool.ts +0 -88
  319. package/src/tool/truncation.ts +0 -106
  320. package/src/tool/webfetch.ts +0 -182
  321. package/src/tool/webfetch.txt +0 -13
  322. package/src/tool/websearch.ts +0 -150
  323. package/src/tool/websearch.txt +0 -14
  324. package/src/tool/write.ts +0 -80
  325. package/src/tool/write.txt +0 -8
  326. package/src/util/archive.ts +0 -16
  327. package/src/util/color.ts +0 -19
  328. package/src/util/context.ts +0 -25
  329. package/src/util/defer.ts +0 -12
  330. package/src/util/eventloop.ts +0 -20
  331. package/src/util/filesystem.ts +0 -93
  332. package/src/util/fn.ts +0 -11
  333. package/src/util/format.ts +0 -20
  334. package/src/util/iife.ts +0 -3
  335. package/src/util/keybind.ts +0 -103
  336. package/src/util/lazy.ts +0 -18
  337. package/src/util/locale.ts +0 -81
  338. package/src/util/lock.ts +0 -98
  339. package/src/util/log.ts +0 -180
  340. package/src/util/queue.ts +0 -32
  341. package/src/util/rpc.ts +0 -66
  342. package/src/util/scrap.ts +0 -10
  343. package/src/util/signal.ts +0 -12
  344. package/src/util/timeout.ts +0 -14
  345. package/src/util/token.ts +0 -7
  346. package/src/util/wildcard.ts +0 -56
  347. package/src/worktree/index.ts +0 -424
  348. package/sst-env.d.ts +0 -9
  349. package/test/acp/event-subscription.test.ts +0 -436
  350. package/test/agent/agent.test.ts +0 -638
  351. package/test/bun.test.ts +0 -53
  352. package/test/cli/github-action.test.ts +0 -129
  353. package/test/cli/github-remote.test.ts +0 -80
  354. package/test/cli/tui/transcript.test.ts +0 -297
  355. package/test/config/agent-color.test.ts +0 -66
  356. package/test/config/config.test.ts +0 -1414
  357. package/test/config/fixtures/empty-frontmatter.md +0 -4
  358. package/test/config/fixtures/frontmatter.md +0 -28
  359. package/test/config/fixtures/no-frontmatter.md +0 -1
  360. package/test/config/markdown.test.ts +0 -192
  361. package/test/file/ignore.test.ts +0 -10
  362. package/test/file/path-traversal.test.ts +0 -198
  363. package/test/fixture/fixture.ts +0 -45
  364. package/test/fixture/lsp/fake-lsp-server.js +0 -77
  365. package/test/ide/ide.test.ts +0 -82
  366. package/test/keybind.test.ts +0 -421
  367. package/test/lsp/client.test.ts +0 -95
  368. package/test/mcp/headers.test.ts +0 -153
  369. package/test/mcp/oauth-browser.test.ts +0 -261
  370. package/test/patch/patch.test.ts +0 -348
  371. package/test/permission/arity.test.ts +0 -33
  372. package/test/permission/next.test.ts +0 -652
  373. package/test/permission-task.test.ts +0 -319
  374. package/test/plugin/codex.test.ts +0 -123
  375. package/test/preload.ts +0 -65
  376. package/test/project/project.test.ts +0 -120
  377. package/test/provider/amazon-bedrock.test.ts +0 -268
  378. package/test/provider/gitlab-duo.test.ts +0 -286
  379. package/test/provider/provider.test.ts +0 -2149
  380. package/test/provider/transform.test.ts +0 -1596
  381. package/test/question/question.test.ts +0 -300
  382. package/test/scheduler.test.ts +0 -73
  383. package/test/server/session-list.test.ts +0 -39
  384. package/test/server/session-select.test.ts +0 -78
  385. package/test/session/compaction.test.ts +0 -293
  386. package/test/session/llm.test.ts +0 -90
  387. package/test/session/message-v2.test.ts +0 -662
  388. package/test/session/retry.test.ts +0 -131
  389. package/test/session/revert-compact.test.ts +0 -285
  390. package/test/session/session.test.ts +0 -71
  391. package/test/skill/skill.test.ts +0 -185
  392. package/test/snapshot/snapshot.test.ts +0 -939
  393. package/test/tool/__snapshots__/tool.test.ts.snap +0 -9
  394. package/test/tool/apply_patch.test.ts +0 -499
  395. package/test/tool/bash.test.ts +0 -320
  396. package/test/tool/external-directory.test.ts +0 -126
  397. package/test/tool/fixtures/large-image.png +0 -0
  398. package/test/tool/fixtures/models-api.json +0 -33453
  399. package/test/tool/grep.test.ts +0 -109
  400. package/test/tool/question.test.ts +0 -105
  401. package/test/tool/read.test.ts +0 -332
  402. package/test/tool/registry.test.ts +0 -76
  403. package/test/tool/truncation.test.ts +0 -159
  404. package/test/util/filesystem.test.ts +0 -39
  405. package/test/util/format.test.ts +0 -59
  406. package/test/util/iife.test.ts +0 -36
  407. package/test/util/lazy.test.ts +0 -50
  408. package/test/util/lock.test.ts +0 -72
  409. package/test/util/timeout.test.ts +0 -21
  410. package/test/util/wildcard.test.ts +0 -75
  411. package/tsconfig.json +0 -16
  412. /package/{script/postinstall.mjs → postinstall.mjs} +0 -0
package/src/lsp/server.ts DELETED
@@ -1,2046 +0,0 @@
1
- import { spawn, type ChildProcessWithoutNullStreams } from "child_process"
2
- import path from "path"
3
- import os from "os"
4
- import { Global } from "../global"
5
- import { Log } from "../util/log"
6
- import { BunProc } from "../bun"
7
- import { $, readableStreamToText } from "bun"
8
- import fs from "fs/promises"
9
- import { Filesystem } from "../util/filesystem"
10
- import { Instance } from "../project/instance"
11
- import { Flag } from "../flag/flag"
12
- import { Archive } from "../util/archive"
13
-
14
- export namespace LSPServer {
15
- const log = Log.create({ service: "lsp.server" })
16
- const pathExists = async (p: string) =>
17
- fs
18
- .stat(p)
19
- .then(() => true)
20
- .catch(() => false)
21
-
22
- export interface Handle {
23
- process: ChildProcessWithoutNullStreams
24
- initialization?: Record<string, any>
25
- }
26
-
27
- type RootFunction = (file: string) => Promise<string | undefined>
28
-
29
- const NearestRoot = (includePatterns: string[], excludePatterns?: string[]): RootFunction => {
30
- return async (file) => {
31
- if (excludePatterns) {
32
- const excludedFiles = Filesystem.up({
33
- targets: excludePatterns,
34
- start: path.dirname(file),
35
- stop: Instance.directory,
36
- })
37
- const excluded = await excludedFiles.next()
38
- await excludedFiles.return()
39
- if (excluded.value) return undefined
40
- }
41
- const files = Filesystem.up({
42
- targets: includePatterns,
43
- start: path.dirname(file),
44
- stop: Instance.directory,
45
- })
46
- const first = await files.next()
47
- await files.return()
48
- if (!first.value) return Instance.directory
49
- return path.dirname(first.value)
50
- }
51
- }
52
-
53
- export interface Info {
54
- id: string
55
- extensions: string[]
56
- global?: boolean
57
- root: RootFunction
58
- spawn(root: string): Promise<Handle | undefined>
59
- }
60
-
61
- export const Deno: Info = {
62
- id: "deno",
63
- root: async (file) => {
64
- const files = Filesystem.up({
65
- targets: ["deno.json", "deno.jsonc"],
66
- start: path.dirname(file),
67
- stop: Instance.directory,
68
- })
69
- const first = await files.next()
70
- await files.return()
71
- if (!first.value) return undefined
72
- return path.dirname(first.value)
73
- },
74
- extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs"],
75
- async spawn(root) {
76
- const deno = Bun.which("deno")
77
- if (!deno) {
78
- log.info("deno not found, please install deno first")
79
- return
80
- }
81
- return {
82
- process: spawn(deno, ["lsp"], {
83
- cwd: root,
84
- }),
85
- }
86
- },
87
- }
88
-
89
- export const Typescript: Info = {
90
- id: "typescript",
91
- root: NearestRoot(
92
- ["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"],
93
- ["deno.json", "deno.jsonc"],
94
- ),
95
- extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"],
96
- async spawn(root) {
97
- const tsserver = await Bun.resolve("typescript/lib/tsserver.js", Instance.directory).catch(() => {})
98
- log.info("typescript server", { tsserver })
99
- if (!tsserver) return
100
- const proc = spawn(BunProc.which(), ["x", "typescript-language-server", "--stdio"], {
101
- cwd: root,
102
- env: {
103
- ...process.env,
104
- BUN_BE_BUN: "1",
105
- },
106
- })
107
- return {
108
- process: proc,
109
- initialization: {
110
- tsserver: {
111
- path: tsserver,
112
- },
113
- },
114
- }
115
- },
116
- }
117
-
118
- export const Vue: Info = {
119
- id: "vue",
120
- extensions: [".vue"],
121
- root: NearestRoot(["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"]),
122
- async spawn(root) {
123
- let binary = Bun.which("vue-language-server")
124
- const args: string[] = []
125
- if (!binary) {
126
- const js = path.join(
127
- Global.Path.bin,
128
- "node_modules",
129
- "@vue",
130
- "language-server",
131
- "bin",
132
- "vue-language-server.js",
133
- )
134
- if (!(await Bun.file(js).exists())) {
135
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
136
- await Bun.spawn([BunProc.which(), "install", "@vue/language-server"], {
137
- cwd: Global.Path.bin,
138
- env: {
139
- ...process.env,
140
- BUN_BE_BUN: "1",
141
- },
142
- stdout: "pipe",
143
- stderr: "pipe",
144
- stdin: "pipe",
145
- }).exited
146
- }
147
- binary = BunProc.which()
148
- args.push("run", js)
149
- }
150
- args.push("--stdio")
151
- const proc = spawn(binary, args, {
152
- cwd: root,
153
- env: {
154
- ...process.env,
155
- BUN_BE_BUN: "1",
156
- },
157
- })
158
- return {
159
- process: proc,
160
- initialization: {
161
- // Leave empty; the server will auto-detect workspace TypeScript.
162
- },
163
- }
164
- },
165
- }
166
-
167
- export const ESLint: Info = {
168
- id: "eslint",
169
- root: NearestRoot(["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"]),
170
- extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts", ".vue"],
171
- async spawn(root) {
172
- const eslint = await Bun.resolve("eslint", Instance.directory).catch(() => {})
173
- if (!eslint) return
174
- log.info("spawning eslint server")
175
- const serverPath = path.join(Global.Path.bin, "vscode-eslint", "server", "out", "eslintServer.js")
176
- if (!(await Bun.file(serverPath).exists())) {
177
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
178
- log.info("downloading and building VS Code ESLint server")
179
- const response = await fetch("https://github.com/microsoft/vscode-eslint/archive/refs/heads/main.zip")
180
- if (!response.ok) return
181
-
182
- const zipPath = path.join(Global.Path.bin, "vscode-eslint.zip")
183
- await Bun.file(zipPath).write(response)
184
-
185
- const ok = await Archive.extractZip(zipPath, Global.Path.bin)
186
- .then(() => true)
187
- .catch((error) => {
188
- log.error("Failed to extract vscode-eslint archive", { error })
189
- return false
190
- })
191
- if (!ok) return
192
- await fs.rm(zipPath, { force: true })
193
-
194
- const extractedPath = path.join(Global.Path.bin, "vscode-eslint-main")
195
- const finalPath = path.join(Global.Path.bin, "vscode-eslint")
196
-
197
- const stats = await fs.stat(finalPath).catch(() => undefined)
198
- if (stats) {
199
- log.info("removing old eslint installation", { path: finalPath })
200
- await fs.rm(finalPath, { force: true, recursive: true })
201
- }
202
- await fs.rename(extractedPath, finalPath)
203
-
204
- const npmCmd = process.platform === "win32" ? "npm.cmd" : "npm"
205
- await $`${npmCmd} install`.cwd(finalPath).quiet()
206
- await $`${npmCmd} run compile`.cwd(finalPath).quiet()
207
-
208
- log.info("installed VS Code ESLint server", { serverPath })
209
- }
210
-
211
- const proc = spawn(BunProc.which(), [serverPath, "--stdio"], {
212
- cwd: root,
213
- env: {
214
- ...process.env,
215
- BUN_BE_BUN: "1",
216
- },
217
- })
218
-
219
- return {
220
- process: proc,
221
- }
222
- },
223
- }
224
-
225
- export const Oxlint: Info = {
226
- id: "oxlint",
227
- root: NearestRoot([
228
- ".oxlintrc.json",
229
- "package-lock.json",
230
- "bun.lockb",
231
- "bun.lock",
232
- "pnpm-lock.yaml",
233
- "yarn.lock",
234
- "package.json",
235
- ]),
236
- extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts", ".vue", ".astro", ".svelte"],
237
- async spawn(root) {
238
- const ext = process.platform === "win32" ? ".cmd" : ""
239
-
240
- const serverTarget = path.join("node_modules", ".bin", "oxc_language_server" + ext)
241
- const lintTarget = path.join("node_modules", ".bin", "oxlint" + ext)
242
-
243
- const resolveBin = async (target: string) => {
244
- const localBin = path.join(root, target)
245
- if (await Bun.file(localBin).exists()) return localBin
246
-
247
- const candidates = Filesystem.up({
248
- targets: [target],
249
- start: root,
250
- stop: Instance.worktree,
251
- })
252
- const first = await candidates.next()
253
- await candidates.return()
254
- if (first.value) return first.value
255
-
256
- return undefined
257
- }
258
-
259
- let lintBin = await resolveBin(lintTarget)
260
- if (!lintBin) {
261
- const found = Bun.which("oxlint")
262
- if (found) lintBin = found
263
- }
264
-
265
- if (lintBin) {
266
- const proc = Bun.spawn([lintBin, "--help"], { stdout: "pipe" })
267
- await proc.exited
268
- const help = await readableStreamToText(proc.stdout)
269
- if (help.includes("--lsp")) {
270
- return {
271
- process: spawn(lintBin, ["--lsp"], {
272
- cwd: root,
273
- }),
274
- }
275
- }
276
- }
277
-
278
- let serverBin = await resolveBin(serverTarget)
279
- if (!serverBin) {
280
- const found = Bun.which("oxc_language_server")
281
- if (found) serverBin = found
282
- }
283
- if (serverBin) {
284
- return {
285
- process: spawn(serverBin, [], {
286
- cwd: root,
287
- }),
288
- }
289
- }
290
-
291
- log.info("oxlint not found, please install oxlint")
292
- return
293
- },
294
- }
295
-
296
- export const Biome: Info = {
297
- id: "biome",
298
- root: NearestRoot([
299
- "biome.json",
300
- "biome.jsonc",
301
- "package-lock.json",
302
- "bun.lockb",
303
- "bun.lock",
304
- "pnpm-lock.yaml",
305
- "yarn.lock",
306
- ]),
307
- extensions: [
308
- ".ts",
309
- ".tsx",
310
- ".js",
311
- ".jsx",
312
- ".mjs",
313
- ".cjs",
314
- ".mts",
315
- ".cts",
316
- ".json",
317
- ".jsonc",
318
- ".vue",
319
- ".astro",
320
- ".svelte",
321
- ".css",
322
- ".graphql",
323
- ".gql",
324
- ".html",
325
- ],
326
- async spawn(root) {
327
- const localBin = path.join(root, "node_modules", ".bin", "biome")
328
- let bin: string | undefined
329
- if (await Bun.file(localBin).exists()) bin = localBin
330
- if (!bin) {
331
- const found = Bun.which("biome")
332
- if (found) bin = found
333
- }
334
-
335
- let args = ["lsp-proxy", "--stdio"]
336
-
337
- if (!bin) {
338
- const resolved = await Bun.resolve("biome", root).catch(() => undefined)
339
- if (!resolved) return
340
- bin = BunProc.which()
341
- args = ["x", "biome", "lsp-proxy", "--stdio"]
342
- }
343
-
344
- const proc = spawn(bin, args, {
345
- cwd: root,
346
- env: {
347
- ...process.env,
348
- BUN_BE_BUN: "1",
349
- },
350
- })
351
-
352
- return {
353
- process: proc,
354
- }
355
- },
356
- }
357
-
358
- export const Gopls: Info = {
359
- id: "gopls",
360
- root: async (file) => {
361
- const work = await NearestRoot(["go.work"])(file)
362
- if (work) return work
363
- return NearestRoot(["go.mod", "go.sum"])(file)
364
- },
365
- extensions: [".go"],
366
- async spawn(root) {
367
- let bin = Bun.which("gopls", {
368
- PATH: process.env["PATH"] + path.delimiter + Global.Path.bin,
369
- })
370
- if (!bin) {
371
- if (!Bun.which("go")) return
372
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
373
-
374
- log.info("installing gopls")
375
- const proc = Bun.spawn({
376
- cmd: ["go", "install", "golang.org/x/tools/gopls@latest"],
377
- env: { ...process.env, GOBIN: Global.Path.bin },
378
- stdout: "pipe",
379
- stderr: "pipe",
380
- stdin: "pipe",
381
- })
382
- const exit = await proc.exited
383
- if (exit !== 0) {
384
- log.error("Failed to install gopls")
385
- return
386
- }
387
- bin = path.join(Global.Path.bin, "gopls" + (process.platform === "win32" ? ".exe" : ""))
388
- log.info(`installed gopls`, {
389
- bin,
390
- })
391
- }
392
- return {
393
- process: spawn(bin!, {
394
- cwd: root,
395
- }),
396
- }
397
- },
398
- }
399
-
400
- export const Rubocop: Info = {
401
- id: "ruby-lsp",
402
- root: NearestRoot(["Gemfile"]),
403
- extensions: [".rb", ".rake", ".gemspec", ".ru"],
404
- async spawn(root) {
405
- let bin = Bun.which("rubocop", {
406
- PATH: process.env["PATH"] + path.delimiter + Global.Path.bin,
407
- })
408
- if (!bin) {
409
- const ruby = Bun.which("ruby")
410
- const gem = Bun.which("gem")
411
- if (!ruby || !gem) {
412
- log.info("Ruby not found, please install Ruby first")
413
- return
414
- }
415
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
416
- log.info("installing rubocop")
417
- const proc = Bun.spawn({
418
- cmd: ["gem", "install", "rubocop", "--bindir", Global.Path.bin],
419
- stdout: "pipe",
420
- stderr: "pipe",
421
- stdin: "pipe",
422
- })
423
- const exit = await proc.exited
424
- if (exit !== 0) {
425
- log.error("Failed to install rubocop")
426
- return
427
- }
428
- bin = path.join(Global.Path.bin, "rubocop" + (process.platform === "win32" ? ".exe" : ""))
429
- log.info(`installed rubocop`, {
430
- bin,
431
- })
432
- }
433
- return {
434
- process: spawn(bin!, ["--lsp"], {
435
- cwd: root,
436
- }),
437
- }
438
- },
439
- }
440
-
441
- export const Ty: Info = {
442
- id: "ty",
443
- extensions: [".py", ".pyi"],
444
- root: NearestRoot([
445
- "pyproject.toml",
446
- "ty.toml",
447
- "setup.py",
448
- "setup.cfg",
449
- "requirements.txt",
450
- "Pipfile",
451
- "pyrightconfig.json",
452
- ]),
453
- async spawn(root) {
454
- if (!Flag.OPENCODE_EXPERIMENTAL_LSP_TY) {
455
- return undefined
456
- }
457
-
458
- let binary = Bun.which("ty")
459
-
460
- const initialization: Record<string, string> = {}
461
-
462
- const potentialVenvPaths = [process.env["VIRTUAL_ENV"], path.join(root, ".venv"), path.join(root, "venv")].filter(
463
- (p): p is string => p !== undefined,
464
- )
465
- for (const venvPath of potentialVenvPaths) {
466
- const isWindows = process.platform === "win32"
467
- const potentialPythonPath = isWindows
468
- ? path.join(venvPath, "Scripts", "python.exe")
469
- : path.join(venvPath, "bin", "python")
470
- if (await Bun.file(potentialPythonPath).exists()) {
471
- initialization["pythonPath"] = potentialPythonPath
472
- break
473
- }
474
- }
475
-
476
- if (!binary) {
477
- for (const venvPath of potentialVenvPaths) {
478
- const isWindows = process.platform === "win32"
479
- const potentialTyPath = isWindows
480
- ? path.join(venvPath, "Scripts", "ty.exe")
481
- : path.join(venvPath, "bin", "ty")
482
- if (await Bun.file(potentialTyPath).exists()) {
483
- binary = potentialTyPath
484
- break
485
- }
486
- }
487
- }
488
-
489
- if (!binary) {
490
- log.error("ty not found, please install ty first")
491
- return
492
- }
493
-
494
- const proc = spawn(binary, ["server"], {
495
- cwd: root,
496
- })
497
-
498
- return {
499
- process: proc,
500
- initialization,
501
- }
502
- },
503
- }
504
-
505
- export const Pyright: Info = {
506
- id: "pyright",
507
- extensions: [".py", ".pyi"],
508
- root: NearestRoot(["pyproject.toml", "setup.py", "setup.cfg", "requirements.txt", "Pipfile", "pyrightconfig.json"]),
509
- async spawn(root) {
510
- let binary = Bun.which("pyright-langserver")
511
- const args = []
512
- if (!binary) {
513
- const js = path.join(Global.Path.bin, "node_modules", "pyright", "dist", "pyright-langserver.js")
514
- if (!(await Bun.file(js).exists())) {
515
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
516
- await Bun.spawn([BunProc.which(), "install", "pyright"], {
517
- cwd: Global.Path.bin,
518
- env: {
519
- ...process.env,
520
- BUN_BE_BUN: "1",
521
- },
522
- }).exited
523
- }
524
- binary = BunProc.which()
525
- args.push(...["run", js])
526
- }
527
- args.push("--stdio")
528
-
529
- const initialization: Record<string, string> = {}
530
-
531
- const potentialVenvPaths = [process.env["VIRTUAL_ENV"], path.join(root, ".venv"), path.join(root, "venv")].filter(
532
- (p): p is string => p !== undefined,
533
- )
534
- for (const venvPath of potentialVenvPaths) {
535
- const isWindows = process.platform === "win32"
536
- const potentialPythonPath = isWindows
537
- ? path.join(venvPath, "Scripts", "python.exe")
538
- : path.join(venvPath, "bin", "python")
539
- if (await Bun.file(potentialPythonPath).exists()) {
540
- initialization["pythonPath"] = potentialPythonPath
541
- break
542
- }
543
- }
544
-
545
- const proc = spawn(binary, args, {
546
- cwd: root,
547
- env: {
548
- ...process.env,
549
- BUN_BE_BUN: "1",
550
- },
551
- })
552
- return {
553
- process: proc,
554
- initialization,
555
- }
556
- },
557
- }
558
-
559
- export const ElixirLS: Info = {
560
- id: "elixir-ls",
561
- extensions: [".ex", ".exs"],
562
- root: NearestRoot(["mix.exs", "mix.lock"]),
563
- async spawn(root) {
564
- let binary = Bun.which("elixir-ls")
565
- if (!binary) {
566
- const elixirLsPath = path.join(Global.Path.bin, "elixir-ls")
567
- binary = path.join(
568
- Global.Path.bin,
569
- "elixir-ls-master",
570
- "release",
571
- process.platform === "win32" ? "language_server.bat" : "language_server.sh",
572
- )
573
-
574
- if (!(await Bun.file(binary).exists())) {
575
- const elixir = Bun.which("elixir")
576
- if (!elixir) {
577
- log.error("elixir is required to run elixir-ls")
578
- return
579
- }
580
-
581
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
582
- log.info("downloading elixir-ls from GitHub releases")
583
-
584
- const response = await fetch("https://github.com/elixir-lsp/elixir-ls/archive/refs/heads/master.zip")
585
- if (!response.ok) return
586
- const zipPath = path.join(Global.Path.bin, "elixir-ls.zip")
587
- await Bun.file(zipPath).write(response)
588
-
589
- const ok = await Archive.extractZip(zipPath, Global.Path.bin)
590
- .then(() => true)
591
- .catch((error) => {
592
- log.error("Failed to extract elixir-ls archive", { error })
593
- return false
594
- })
595
- if (!ok) return
596
-
597
- await fs.rm(zipPath, {
598
- force: true,
599
- recursive: true,
600
- })
601
-
602
- await $`mix deps.get && mix compile && mix elixir_ls.release2 -o release`
603
- .quiet()
604
- .cwd(path.join(Global.Path.bin, "elixir-ls-master"))
605
- .env({ MIX_ENV: "prod", ...process.env })
606
-
607
- log.info(`installed elixir-ls`, {
608
- path: elixirLsPath,
609
- })
610
- }
611
- }
612
-
613
- return {
614
- process: spawn(binary, {
615
- cwd: root,
616
- }),
617
- }
618
- },
619
- }
620
-
621
- export const Zls: Info = {
622
- id: "zls",
623
- extensions: [".zig", ".zon"],
624
- root: NearestRoot(["build.zig"]),
625
- async spawn(root) {
626
- let bin = Bun.which("zls", {
627
- PATH: process.env["PATH"] + path.delimiter + Global.Path.bin,
628
- })
629
-
630
- if (!bin) {
631
- const zig = Bun.which("zig")
632
- if (!zig) {
633
- log.error("Zig is required to use zls. Please install Zig first.")
634
- return
635
- }
636
-
637
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
638
- log.info("downloading zls from GitHub releases")
639
-
640
- const releaseResponse = await fetch("https://api.github.com/repos/zigtools/zls/releases/latest")
641
- if (!releaseResponse.ok) {
642
- log.error("Failed to fetch zls release info")
643
- return
644
- }
645
-
646
- const release = (await releaseResponse.json()) as any
647
-
648
- const platform = process.platform
649
- const arch = process.arch
650
- let assetName = ""
651
-
652
- let zlsArch: string = arch
653
- if (arch === "arm64") zlsArch = "aarch64"
654
- else if (arch === "x64") zlsArch = "x86_64"
655
- else if (arch === "ia32") zlsArch = "x86"
656
-
657
- let zlsPlatform: string = platform
658
- if (platform === "darwin") zlsPlatform = "macos"
659
- else if (platform === "win32") zlsPlatform = "windows"
660
-
661
- const ext = platform === "win32" ? "zip" : "tar.xz"
662
-
663
- assetName = `zls-${zlsArch}-${zlsPlatform}.${ext}`
664
-
665
- const supportedCombos = [
666
- "zls-x86_64-linux.tar.xz",
667
- "zls-x86_64-macos.tar.xz",
668
- "zls-x86_64-windows.zip",
669
- "zls-aarch64-linux.tar.xz",
670
- "zls-aarch64-macos.tar.xz",
671
- "zls-aarch64-windows.zip",
672
- "zls-x86-linux.tar.xz",
673
- "zls-x86-windows.zip",
674
- ]
675
-
676
- if (!supportedCombos.includes(assetName)) {
677
- log.error(`Platform ${platform} and architecture ${arch} is not supported by zls`)
678
- return
679
- }
680
-
681
- const asset = release.assets.find((a: any) => a.name === assetName)
682
- if (!asset) {
683
- log.error(`Could not find asset ${assetName} in latest zls release`)
684
- return
685
- }
686
-
687
- const downloadUrl = asset.browser_download_url
688
- const downloadResponse = await fetch(downloadUrl)
689
- if (!downloadResponse.ok) {
690
- log.error("Failed to download zls")
691
- return
692
- }
693
-
694
- const tempPath = path.join(Global.Path.bin, assetName)
695
- await Bun.file(tempPath).write(downloadResponse)
696
-
697
- if (ext === "zip") {
698
- const ok = await Archive.extractZip(tempPath, Global.Path.bin)
699
- .then(() => true)
700
- .catch((error) => {
701
- log.error("Failed to extract zls archive", { error })
702
- return false
703
- })
704
- if (!ok) return
705
- } else {
706
- await $`tar -xf ${tempPath}`.cwd(Global.Path.bin).quiet().nothrow()
707
- }
708
-
709
- await fs.rm(tempPath, { force: true })
710
-
711
- bin = path.join(Global.Path.bin, "zls" + (platform === "win32" ? ".exe" : ""))
712
-
713
- if (!(await Bun.file(bin).exists())) {
714
- log.error("Failed to extract zls binary")
715
- return
716
- }
717
-
718
- if (platform !== "win32") {
719
- await $`chmod +x ${bin}`.quiet().nothrow()
720
- }
721
-
722
- log.info(`installed zls`, { bin })
723
- }
724
-
725
- return {
726
- process: spawn(bin, {
727
- cwd: root,
728
- }),
729
- }
730
- },
731
- }
732
-
733
- export const CSharp: Info = {
734
- id: "csharp",
735
- root: NearestRoot([".sln", ".csproj", "global.json"]),
736
- extensions: [".cs"],
737
- async spawn(root) {
738
- let bin = Bun.which("csharp-ls", {
739
- PATH: process.env["PATH"] + path.delimiter + Global.Path.bin,
740
- })
741
- if (!bin) {
742
- if (!Bun.which("dotnet")) {
743
- log.error(".NET SDK is required to install csharp-ls")
744
- return
745
- }
746
-
747
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
748
- log.info("installing csharp-ls via dotnet tool")
749
- const proc = Bun.spawn({
750
- cmd: ["dotnet", "tool", "install", "csharp-ls", "--tool-path", Global.Path.bin],
751
- stdout: "pipe",
752
- stderr: "pipe",
753
- stdin: "pipe",
754
- })
755
- const exit = await proc.exited
756
- if (exit !== 0) {
757
- log.error("Failed to install csharp-ls")
758
- return
759
- }
760
-
761
- bin = path.join(Global.Path.bin, "csharp-ls" + (process.platform === "win32" ? ".exe" : ""))
762
- log.info(`installed csharp-ls`, { bin })
763
- }
764
-
765
- return {
766
- process: spawn(bin, {
767
- cwd: root,
768
- }),
769
- }
770
- },
771
- }
772
-
773
- export const FSharp: Info = {
774
- id: "fsharp",
775
- root: NearestRoot([".sln", ".fsproj", "global.json"]),
776
- extensions: [".fs", ".fsi", ".fsx", ".fsscript"],
777
- async spawn(root) {
778
- let bin = Bun.which("fsautocomplete", {
779
- PATH: process.env["PATH"] + path.delimiter + Global.Path.bin,
780
- })
781
- if (!bin) {
782
- if (!Bun.which("dotnet")) {
783
- log.error(".NET SDK is required to install fsautocomplete")
784
- return
785
- }
786
-
787
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
788
- log.info("installing fsautocomplete via dotnet tool")
789
- const proc = Bun.spawn({
790
- cmd: ["dotnet", "tool", "install", "fsautocomplete", "--tool-path", Global.Path.bin],
791
- stdout: "pipe",
792
- stderr: "pipe",
793
- stdin: "pipe",
794
- })
795
- const exit = await proc.exited
796
- if (exit !== 0) {
797
- log.error("Failed to install fsautocomplete")
798
- return
799
- }
800
-
801
- bin = path.join(Global.Path.bin, "fsautocomplete" + (process.platform === "win32" ? ".exe" : ""))
802
- log.info(`installed fsautocomplete`, { bin })
803
- }
804
-
805
- return {
806
- process: spawn(bin, {
807
- cwd: root,
808
- }),
809
- }
810
- },
811
- }
812
-
813
- export const SourceKit: Info = {
814
- id: "sourcekit-lsp",
815
- extensions: [".swift", ".objc", "objcpp"],
816
- root: NearestRoot(["Package.swift", "*.xcodeproj", "*.xcworkspace"]),
817
- async spawn(root) {
818
- // Check if sourcekit-lsp is available in the PATH
819
- // This is installed with the Swift toolchain
820
- const sourcekit = Bun.which("sourcekit-lsp")
821
- if (sourcekit) {
822
- return {
823
- process: spawn(sourcekit, {
824
- cwd: root,
825
- }),
826
- }
827
- }
828
-
829
- // If sourcekit-lsp not found, check if xcrun is available
830
- // This is specific to macOS where sourcekit-lsp is typically installed with Xcode
831
- if (!Bun.which("xcrun")) return
832
-
833
- const lspLoc = await $`xcrun --find sourcekit-lsp`.quiet().nothrow()
834
-
835
- if (lspLoc.exitCode !== 0) return
836
-
837
- const bin = lspLoc.text().trim()
838
-
839
- return {
840
- process: spawn(bin, {
841
- cwd: root,
842
- }),
843
- }
844
- },
845
- }
846
-
847
- export const RustAnalyzer: Info = {
848
- id: "rust",
849
- root: async (root) => {
850
- const crateRoot = await NearestRoot(["Cargo.toml", "Cargo.lock"])(root)
851
- if (crateRoot === undefined) {
852
- return undefined
853
- }
854
- let currentDir = crateRoot
855
-
856
- while (currentDir !== path.dirname(currentDir)) {
857
- // Stop at filesystem root
858
- const cargoTomlPath = path.join(currentDir, "Cargo.toml")
859
- try {
860
- const cargoTomlContent = await Bun.file(cargoTomlPath).text()
861
- if (cargoTomlContent.includes("[workspace]")) {
862
- return currentDir
863
- }
864
- } catch (err) {
865
- // File doesn't exist or can't be read, continue searching up
866
- }
867
-
868
- const parentDir = path.dirname(currentDir)
869
- if (parentDir === currentDir) break // Reached filesystem root
870
- currentDir = parentDir
871
-
872
- // Stop if we've gone above the app root
873
- if (!currentDir.startsWith(Instance.worktree)) break
874
- }
875
-
876
- return crateRoot
877
- },
878
- extensions: [".rs"],
879
- async spawn(root) {
880
- const bin = Bun.which("rust-analyzer")
881
- if (!bin) {
882
- log.info("rust-analyzer not found in path, please install it")
883
- return
884
- }
885
- return {
886
- process: spawn(bin, {
887
- cwd: root,
888
- }),
889
- }
890
- },
891
- }
892
-
893
- export const Clangd: Info = {
894
- id: "clangd",
895
- root: NearestRoot(["compile_commands.json", "compile_flags.txt", ".clangd", "CMakeLists.txt", "Makefile"]),
896
- extensions: [".c", ".cpp", ".cc", ".cxx", ".c++", ".h", ".hpp", ".hh", ".hxx", ".h++"],
897
- async spawn(root) {
898
- const args = ["--background-index", "--clang-tidy"]
899
- const fromPath = Bun.which("clangd")
900
- if (fromPath) {
901
- return {
902
- process: spawn(fromPath, args, {
903
- cwd: root,
904
- }),
905
- }
906
- }
907
-
908
- const ext = process.platform === "win32" ? ".exe" : ""
909
- const direct = path.join(Global.Path.bin, "clangd" + ext)
910
- if (await Bun.file(direct).exists()) {
911
- return {
912
- process: spawn(direct, args, {
913
- cwd: root,
914
- }),
915
- }
916
- }
917
-
918
- const entries = await fs.readdir(Global.Path.bin, { withFileTypes: true }).catch(() => [])
919
- for (const entry of entries) {
920
- if (!entry.isDirectory()) continue
921
- if (!entry.name.startsWith("clangd_")) continue
922
- const candidate = path.join(Global.Path.bin, entry.name, "bin", "clangd" + ext)
923
- if (await Bun.file(candidate).exists()) {
924
- return {
925
- process: spawn(candidate, args, {
926
- cwd: root,
927
- }),
928
- }
929
- }
930
- }
931
-
932
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
933
- log.info("downloading clangd from GitHub releases")
934
-
935
- const releaseResponse = await fetch("https://api.github.com/repos/clangd/clangd/releases/latest")
936
- if (!releaseResponse.ok) {
937
- log.error("Failed to fetch clangd release info")
938
- return
939
- }
940
-
941
- const release: {
942
- tag_name?: string
943
- assets?: { name?: string; browser_download_url?: string }[]
944
- } = await releaseResponse.json()
945
-
946
- const tag = release.tag_name
947
- if (!tag) {
948
- log.error("clangd release did not include a tag name")
949
- return
950
- }
951
- const platform = process.platform
952
- const tokens: Record<string, string> = {
953
- darwin: "mac",
954
- linux: "linux",
955
- win32: "windows",
956
- }
957
- const token = tokens[platform]
958
- if (!token) {
959
- log.error(`Platform ${platform} is not supported by clangd auto-download`)
960
- return
961
- }
962
-
963
- const assets = release.assets ?? []
964
- const valid = (item: { name?: string; browser_download_url?: string }) => {
965
- if (!item.name) return false
966
- if (!item.browser_download_url) return false
967
- if (!item.name.includes(token)) return false
968
- return item.name.includes(tag)
969
- }
970
-
971
- const asset =
972
- assets.find((item) => valid(item) && item.name?.endsWith(".zip")) ??
973
- assets.find((item) => valid(item) && item.name?.endsWith(".tar.xz")) ??
974
- assets.find((item) => valid(item))
975
- if (!asset?.name || !asset.browser_download_url) {
976
- log.error("clangd could not match release asset", { tag, platform })
977
- return
978
- }
979
-
980
- const name = asset.name
981
- const downloadResponse = await fetch(asset.browser_download_url)
982
- if (!downloadResponse.ok) {
983
- log.error("Failed to download clangd")
984
- return
985
- }
986
-
987
- const archive = path.join(Global.Path.bin, name)
988
- const buf = await downloadResponse.arrayBuffer()
989
- if (buf.byteLength === 0) {
990
- log.error("Failed to write clangd archive")
991
- return
992
- }
993
- await Bun.write(archive, buf)
994
-
995
- const zip = name.endsWith(".zip")
996
- const tar = name.endsWith(".tar.xz")
997
- if (!zip && !tar) {
998
- log.error("clangd encountered unsupported asset", { asset: name })
999
- return
1000
- }
1001
-
1002
- if (zip) {
1003
- const ok = await Archive.extractZip(archive, Global.Path.bin)
1004
- .then(() => true)
1005
- .catch((error) => {
1006
- log.error("Failed to extract clangd archive", { error })
1007
- return false
1008
- })
1009
- if (!ok) return
1010
- }
1011
- if (tar) {
1012
- await $`tar -xf ${archive}`.cwd(Global.Path.bin).quiet().nothrow()
1013
- }
1014
- await fs.rm(archive, { force: true })
1015
-
1016
- const bin = path.join(Global.Path.bin, "clangd_" + tag, "bin", "clangd" + ext)
1017
- if (!(await Bun.file(bin).exists())) {
1018
- log.error("Failed to extract clangd binary")
1019
- return
1020
- }
1021
-
1022
- if (platform !== "win32") {
1023
- await $`chmod +x ${bin}`.quiet().nothrow()
1024
- }
1025
-
1026
- await fs.unlink(path.join(Global.Path.bin, "clangd")).catch(() => {})
1027
- await fs.symlink(bin, path.join(Global.Path.bin, "clangd")).catch(() => {})
1028
-
1029
- log.info(`installed clangd`, { bin })
1030
-
1031
- return {
1032
- process: spawn(bin, args, {
1033
- cwd: root,
1034
- }),
1035
- }
1036
- },
1037
- }
1038
-
1039
- export const Svelte: Info = {
1040
- id: "svelte",
1041
- extensions: [".svelte"],
1042
- root: NearestRoot(["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"]),
1043
- async spawn(root) {
1044
- let binary = Bun.which("svelteserver")
1045
- const args: string[] = []
1046
- if (!binary) {
1047
- const js = path.join(Global.Path.bin, "node_modules", "svelte-language-server", "bin", "server.js")
1048
- if (!(await Bun.file(js).exists())) {
1049
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
1050
- await Bun.spawn([BunProc.which(), "install", "svelte-language-server"], {
1051
- cwd: Global.Path.bin,
1052
- env: {
1053
- ...process.env,
1054
- BUN_BE_BUN: "1",
1055
- },
1056
- stdout: "pipe",
1057
- stderr: "pipe",
1058
- stdin: "pipe",
1059
- }).exited
1060
- }
1061
- binary = BunProc.which()
1062
- args.push("run", js)
1063
- }
1064
- args.push("--stdio")
1065
- const proc = spawn(binary, args, {
1066
- cwd: root,
1067
- env: {
1068
- ...process.env,
1069
- BUN_BE_BUN: "1",
1070
- },
1071
- })
1072
- return {
1073
- process: proc,
1074
- initialization: {},
1075
- }
1076
- },
1077
- }
1078
-
1079
- export const Astro: Info = {
1080
- id: "astro",
1081
- extensions: [".astro"],
1082
- root: NearestRoot(["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"]),
1083
- async spawn(root) {
1084
- const tsserver = await Bun.resolve("typescript/lib/tsserver.js", Instance.directory).catch(() => {})
1085
- if (!tsserver) {
1086
- log.info("typescript not found, required for Astro language server")
1087
- return
1088
- }
1089
- const tsdk = path.dirname(tsserver)
1090
-
1091
- let binary = Bun.which("astro-ls")
1092
- const args: string[] = []
1093
- if (!binary) {
1094
- const js = path.join(Global.Path.bin, "node_modules", "@astrojs", "language-server", "bin", "nodeServer.js")
1095
- if (!(await Bun.file(js).exists())) {
1096
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
1097
- await Bun.spawn([BunProc.which(), "install", "@astrojs/language-server"], {
1098
- cwd: Global.Path.bin,
1099
- env: {
1100
- ...process.env,
1101
- BUN_BE_BUN: "1",
1102
- },
1103
- stdout: "pipe",
1104
- stderr: "pipe",
1105
- stdin: "pipe",
1106
- }).exited
1107
- }
1108
- binary = BunProc.which()
1109
- args.push("run", js)
1110
- }
1111
- args.push("--stdio")
1112
- const proc = spawn(binary, args, {
1113
- cwd: root,
1114
- env: {
1115
- ...process.env,
1116
- BUN_BE_BUN: "1",
1117
- },
1118
- })
1119
- return {
1120
- process: proc,
1121
- initialization: {
1122
- typescript: {
1123
- tsdk,
1124
- },
1125
- },
1126
- }
1127
- },
1128
- }
1129
-
1130
- export const JDTLS: Info = {
1131
- id: "jdtls",
1132
- root: NearestRoot(["pom.xml", "build.gradle", "build.gradle.kts", ".project", ".classpath"]),
1133
- extensions: [".java"],
1134
- async spawn(root) {
1135
- const java = Bun.which("java")
1136
- if (!java) {
1137
- log.error("Java 21 or newer is required to run the JDTLS. Please install it first.")
1138
- return
1139
- }
1140
- const javaMajorVersion = await $`java -version`
1141
- .quiet()
1142
- .nothrow()
1143
- .then(({ stderr }) => {
1144
- const m = /"(\d+)\.\d+\.\d+"/.exec(stderr.toString())
1145
- return !m ? undefined : parseInt(m[1])
1146
- })
1147
- if (javaMajorVersion == null || javaMajorVersion < 21) {
1148
- log.error("JDTLS requires at least Java 21.")
1149
- return
1150
- }
1151
- const distPath = path.join(Global.Path.bin, "jdtls")
1152
- const launcherDir = path.join(distPath, "plugins")
1153
- const installed = await pathExists(launcherDir)
1154
- if (!installed) {
1155
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
1156
- log.info("Downloading JDTLS LSP server.")
1157
- await fs.mkdir(distPath, { recursive: true })
1158
- const releaseURL =
1159
- "https://www.eclipse.org/downloads/download.php?file=/jdtls/snapshots/jdt-language-server-latest.tar.gz"
1160
- const archiveName = "release.tar.gz"
1161
-
1162
- log.info("Downloading JDTLS archive", { url: releaseURL, dest: distPath })
1163
- const curlResult = await $`curl -L -o ${archiveName} '${releaseURL}'`.cwd(distPath).quiet().nothrow()
1164
- if (curlResult.exitCode !== 0) {
1165
- log.error("Failed to download JDTLS", { exitCode: curlResult.exitCode, stderr: curlResult.stderr.toString() })
1166
- return
1167
- }
1168
-
1169
- log.info("Extracting JDTLS archive")
1170
- const tarResult = await $`tar -xzf ${archiveName}`.cwd(distPath).quiet().nothrow()
1171
- if (tarResult.exitCode !== 0) {
1172
- log.error("Failed to extract JDTLS", { exitCode: tarResult.exitCode, stderr: tarResult.stderr.toString() })
1173
- return
1174
- }
1175
-
1176
- await fs.rm(path.join(distPath, archiveName), { force: true })
1177
- log.info("JDTLS download and extraction completed")
1178
- }
1179
- const jarFileName = await $`ls org.eclipse.equinox.launcher_*.jar`
1180
- .cwd(launcherDir)
1181
- .quiet()
1182
- .nothrow()
1183
- .then(({ stdout }) => stdout.toString().trim())
1184
- const launcherJar = path.join(launcherDir, jarFileName)
1185
- if (!(await pathExists(launcherJar))) {
1186
- log.error(`Failed to locate the JDTLS launcher module in the installed directory: ${distPath}.`)
1187
- return
1188
- }
1189
- const configFile = path.join(
1190
- distPath,
1191
- (() => {
1192
- switch (process.platform) {
1193
- case "darwin":
1194
- return "config_mac"
1195
- case "linux":
1196
- return "config_linux"
1197
- case "win32":
1198
- return "config_win"
1199
- default:
1200
- return "config_linux"
1201
- }
1202
- })(),
1203
- )
1204
- const dataDir = await fs.mkdtemp(path.join(os.tmpdir(), "opencode-jdtls-data"))
1205
- return {
1206
- process: spawn(
1207
- java,
1208
- [
1209
- "-jar",
1210
- launcherJar,
1211
- "-configuration",
1212
- configFile,
1213
- "-data",
1214
- dataDir,
1215
- "-Declipse.application=org.eclipse.jdt.ls.core.id1",
1216
- "-Dosgi.bundles.defaultStartLevel=4",
1217
- "-Declipse.product=org.eclipse.jdt.ls.core.product",
1218
- "-Dlog.level=ALL",
1219
- "--add-modules=ALL-SYSTEM",
1220
- "--add-opens java.base/java.util=ALL-UNNAMED",
1221
- "--add-opens java.base/java.lang=ALL-UNNAMED",
1222
- ],
1223
- {
1224
- cwd: root,
1225
- },
1226
- ),
1227
- }
1228
- },
1229
- }
1230
-
1231
- export const KotlinLS: Info = {
1232
- id: "kotlin-ls",
1233
- extensions: [".kt", ".kts"],
1234
- root: async (file) => {
1235
- // 1) Nearest Gradle root (multi-project or included build)
1236
- const settingsRoot = await NearestRoot(["settings.gradle.kts", "settings.gradle"])(file)
1237
- if (settingsRoot) return settingsRoot
1238
- // 2) Gradle wrapper (strong root signal)
1239
- const wrapperRoot = await NearestRoot(["gradlew", "gradlew.bat"])(file)
1240
- if (wrapperRoot) return wrapperRoot
1241
- // 3) Single-project or module-level build
1242
- const buildRoot = await NearestRoot(["build.gradle.kts", "build.gradle"])(file)
1243
- if (buildRoot) return buildRoot
1244
- // 4) Maven fallback
1245
- return NearestRoot(["pom.xml"])(file)
1246
- },
1247
- async spawn(root) {
1248
- const distPath = path.join(Global.Path.bin, "kotlin-ls")
1249
- const launcherScript =
1250
- process.platform === "win32" ? path.join(distPath, "kotlin-lsp.cmd") : path.join(distPath, "kotlin-lsp.sh")
1251
- const installed = await Bun.file(launcherScript).exists()
1252
- if (!installed) {
1253
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
1254
- log.info("Downloading Kotlin Language Server from GitHub.")
1255
-
1256
- const releaseResponse = await fetch("https://api.github.com/repos/Kotlin/kotlin-lsp/releases/latest")
1257
- if (!releaseResponse.ok) {
1258
- log.error("Failed to fetch kotlin-lsp release info")
1259
- return
1260
- }
1261
-
1262
- const release = await releaseResponse.json()
1263
- const version = release.name?.replace(/^v/, "")
1264
-
1265
- if (!version) {
1266
- log.error("Could not determine Kotlin LSP version from release")
1267
- return
1268
- }
1269
-
1270
- const platform = process.platform
1271
- const arch = process.arch
1272
-
1273
- let kotlinArch: string = arch
1274
- if (arch === "arm64") kotlinArch = "aarch64"
1275
- else if (arch === "x64") kotlinArch = "x64"
1276
-
1277
- let kotlinPlatform: string = platform
1278
- if (platform === "darwin") kotlinPlatform = "mac"
1279
- else if (platform === "linux") kotlinPlatform = "linux"
1280
- else if (platform === "win32") kotlinPlatform = "win"
1281
-
1282
- const supportedCombos = ["mac-x64", "mac-aarch64", "linux-x64", "linux-aarch64", "win-x64", "win-aarch64"]
1283
-
1284
- const combo = `${kotlinPlatform}-${kotlinArch}`
1285
-
1286
- if (!supportedCombos.includes(combo)) {
1287
- log.error(`Platform ${platform}/${arch} is not supported by Kotlin LSP`)
1288
- return
1289
- }
1290
-
1291
- const assetName = `kotlin-lsp-${version}-${kotlinPlatform}-${kotlinArch}.zip`
1292
- const releaseURL = `https://download-cdn.jetbrains.com/kotlin-lsp/${version}/${assetName}`
1293
-
1294
- await fs.mkdir(distPath, { recursive: true })
1295
- const archivePath = path.join(distPath, "kotlin-ls.zip")
1296
- await $`curl -L -o '${archivePath}' '${releaseURL}'`.quiet().nothrow()
1297
- const ok = await Archive.extractZip(archivePath, distPath)
1298
- .then(() => true)
1299
- .catch((error) => {
1300
- log.error("Failed to extract Kotlin LS archive", { error })
1301
- return false
1302
- })
1303
- if (!ok) return
1304
- await fs.rm(archivePath, { force: true })
1305
- if (process.platform !== "win32") {
1306
- await $`chmod +x ${launcherScript}`.quiet().nothrow()
1307
- }
1308
- log.info("Installed Kotlin Language Server", { path: launcherScript })
1309
- }
1310
- if (!(await Bun.file(launcherScript).exists())) {
1311
- log.error(`Failed to locate the Kotlin LS launcher script in the installed directory: ${distPath}.`)
1312
- return
1313
- }
1314
- return {
1315
- process: spawn(launcherScript, ["--stdio"], {
1316
- cwd: root,
1317
- }),
1318
- }
1319
- },
1320
- }
1321
-
1322
- export const YamlLS: Info = {
1323
- id: "yaml-ls",
1324
- extensions: [".yaml", ".yml"],
1325
- root: NearestRoot(["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"]),
1326
- async spawn(root) {
1327
- let binary = Bun.which("yaml-language-server")
1328
- const args: string[] = []
1329
- if (!binary) {
1330
- const js = path.join(
1331
- Global.Path.bin,
1332
- "node_modules",
1333
- "yaml-language-server",
1334
- "out",
1335
- "server",
1336
- "src",
1337
- "server.js",
1338
- )
1339
- const exists = await Bun.file(js).exists()
1340
- if (!exists) {
1341
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
1342
- await Bun.spawn([BunProc.which(), "install", "yaml-language-server"], {
1343
- cwd: Global.Path.bin,
1344
- env: {
1345
- ...process.env,
1346
- BUN_BE_BUN: "1",
1347
- },
1348
- stdout: "pipe",
1349
- stderr: "pipe",
1350
- stdin: "pipe",
1351
- }).exited
1352
- }
1353
- binary = BunProc.which()
1354
- args.push("run", js)
1355
- }
1356
- args.push("--stdio")
1357
- const proc = spawn(binary, args, {
1358
- cwd: root,
1359
- env: {
1360
- ...process.env,
1361
- BUN_BE_BUN: "1",
1362
- },
1363
- })
1364
- return {
1365
- process: proc,
1366
- }
1367
- },
1368
- }
1369
-
1370
- export const LuaLS: Info = {
1371
- id: "lua-ls",
1372
- root: NearestRoot([
1373
- ".luarc.json",
1374
- ".luarc.jsonc",
1375
- ".luacheckrc",
1376
- ".stylua.toml",
1377
- "stylua.toml",
1378
- "selene.toml",
1379
- "selene.yml",
1380
- ]),
1381
- extensions: [".lua"],
1382
- async spawn(root) {
1383
- let bin = Bun.which("lua-language-server", {
1384
- PATH: process.env["PATH"] + path.delimiter + Global.Path.bin,
1385
- })
1386
-
1387
- if (!bin) {
1388
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
1389
- log.info("downloading lua-language-server from GitHub releases")
1390
-
1391
- const releaseResponse = await fetch("https://api.github.com/repos/LuaLS/lua-language-server/releases/latest")
1392
- if (!releaseResponse.ok) {
1393
- log.error("Failed to fetch lua-language-server release info")
1394
- return
1395
- }
1396
-
1397
- const release = await releaseResponse.json()
1398
-
1399
- const platform = process.platform
1400
- const arch = process.arch
1401
- let assetName = ""
1402
-
1403
- let lualsArch: string = arch
1404
- if (arch === "arm64") lualsArch = "arm64"
1405
- else if (arch === "x64") lualsArch = "x64"
1406
- else if (arch === "ia32") lualsArch = "ia32"
1407
-
1408
- let lualsPlatform: string = platform
1409
- if (platform === "darwin") lualsPlatform = "darwin"
1410
- else if (platform === "linux") lualsPlatform = "linux"
1411
- else if (platform === "win32") lualsPlatform = "win32"
1412
-
1413
- const ext = platform === "win32" ? "zip" : "tar.gz"
1414
-
1415
- assetName = `lua-language-server-${release.tag_name}-${lualsPlatform}-${lualsArch}.${ext}`
1416
-
1417
- const supportedCombos = [
1418
- "darwin-arm64.tar.gz",
1419
- "darwin-x64.tar.gz",
1420
- "linux-x64.tar.gz",
1421
- "linux-arm64.tar.gz",
1422
- "win32-x64.zip",
1423
- "win32-ia32.zip",
1424
- ]
1425
-
1426
- const assetSuffix = `${lualsPlatform}-${lualsArch}.${ext}`
1427
- if (!supportedCombos.includes(assetSuffix)) {
1428
- log.error(`Platform ${platform} and architecture ${arch} is not supported by lua-language-server`)
1429
- return
1430
- }
1431
-
1432
- const asset = release.assets.find((a: any) => a.name === assetName)
1433
- if (!asset) {
1434
- log.error(`Could not find asset ${assetName} in latest lua-language-server release`)
1435
- return
1436
- }
1437
-
1438
- const downloadUrl = asset.browser_download_url
1439
- const downloadResponse = await fetch(downloadUrl)
1440
- if (!downloadResponse.ok) {
1441
- log.error("Failed to download lua-language-server")
1442
- return
1443
- }
1444
-
1445
- const tempPath = path.join(Global.Path.bin, assetName)
1446
- await Bun.file(tempPath).write(downloadResponse)
1447
-
1448
- // Unlike zls which is a single self-contained binary,
1449
- // lua-language-server needs supporting files (meta/, locale/, etc.)
1450
- // Extract entire archive to dedicated directory to preserve all files
1451
- const installDir = path.join(Global.Path.bin, `lua-language-server-${lualsArch}-${lualsPlatform}`)
1452
-
1453
- // Remove old installation if exists
1454
- const stats = await fs.stat(installDir).catch(() => undefined)
1455
- if (stats) {
1456
- await fs.rm(installDir, { force: true, recursive: true })
1457
- }
1458
-
1459
- await fs.mkdir(installDir, { recursive: true })
1460
-
1461
- if (ext === "zip") {
1462
- const ok = await Archive.extractZip(tempPath, installDir)
1463
- .then(() => true)
1464
- .catch((error) => {
1465
- log.error("Failed to extract lua-language-server archive", { error })
1466
- return false
1467
- })
1468
- if (!ok) return
1469
- } else {
1470
- const ok = await $`tar -xzf ${tempPath} -C ${installDir}`
1471
- .quiet()
1472
- .then(() => true)
1473
- .catch((error) => {
1474
- log.error("Failed to extract lua-language-server archive", { error })
1475
- return false
1476
- })
1477
- if (!ok) return
1478
- }
1479
-
1480
- await fs.rm(tempPath, { force: true })
1481
-
1482
- // Binary is located in bin/ subdirectory within the extracted archive
1483
- bin = path.join(installDir, "bin", "lua-language-server" + (platform === "win32" ? ".exe" : ""))
1484
-
1485
- if (!(await Bun.file(bin).exists())) {
1486
- log.error("Failed to extract lua-language-server binary")
1487
- return
1488
- }
1489
-
1490
- if (platform !== "win32") {
1491
- const ok = await $`chmod +x ${bin}`.quiet().catch((error) => {
1492
- log.error("Failed to set executable permission for lua-language-server binary", {
1493
- error,
1494
- })
1495
- })
1496
- if (!ok) return
1497
- }
1498
-
1499
- log.info(`installed lua-language-server`, { bin })
1500
- }
1501
-
1502
- return {
1503
- process: spawn(bin, {
1504
- cwd: root,
1505
- }),
1506
- }
1507
- },
1508
- }
1509
-
1510
- export const PHPIntelephense: Info = {
1511
- id: "php intelephense",
1512
- extensions: [".php"],
1513
- root: NearestRoot(["composer.json", "composer.lock", ".php-version"]),
1514
- async spawn(root) {
1515
- let binary = Bun.which("intelephense")
1516
- const args: string[] = []
1517
- if (!binary) {
1518
- const js = path.join(Global.Path.bin, "node_modules", "intelephense", "lib", "intelephense.js")
1519
- if (!(await Bun.file(js).exists())) {
1520
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
1521
- await Bun.spawn([BunProc.which(), "install", "intelephense"], {
1522
- cwd: Global.Path.bin,
1523
- env: {
1524
- ...process.env,
1525
- BUN_BE_BUN: "1",
1526
- },
1527
- stdout: "pipe",
1528
- stderr: "pipe",
1529
- stdin: "pipe",
1530
- }).exited
1531
- }
1532
- binary = BunProc.which()
1533
- args.push("run", js)
1534
- }
1535
- args.push("--stdio")
1536
- const proc = spawn(binary, args, {
1537
- cwd: root,
1538
- env: {
1539
- ...process.env,
1540
- BUN_BE_BUN: "1",
1541
- },
1542
- })
1543
- return {
1544
- process: proc,
1545
- initialization: {
1546
- telemetry: {
1547
- enabled: false,
1548
- },
1549
- },
1550
- }
1551
- },
1552
- }
1553
-
1554
- export const Prisma: Info = {
1555
- id: "prisma",
1556
- extensions: [".prisma"],
1557
- root: NearestRoot(["schema.prisma", "prisma/schema.prisma", "prisma"], ["package.json"]),
1558
- async spawn(root) {
1559
- const prisma = Bun.which("prisma")
1560
- if (!prisma) {
1561
- log.info("prisma not found, please install prisma")
1562
- return
1563
- }
1564
- return {
1565
- process: spawn(prisma, ["language-server"], {
1566
- cwd: root,
1567
- }),
1568
- }
1569
- },
1570
- }
1571
-
1572
- export const Dart: Info = {
1573
- id: "dart",
1574
- extensions: [".dart"],
1575
- root: NearestRoot(["pubspec.yaml", "analysis_options.yaml"]),
1576
- async spawn(root) {
1577
- const dart = Bun.which("dart")
1578
- if (!dart) {
1579
- log.info("dart not found, please install dart first")
1580
- return
1581
- }
1582
- return {
1583
- process: spawn(dart, ["language-server", "--lsp"], {
1584
- cwd: root,
1585
- }),
1586
- }
1587
- },
1588
- }
1589
-
1590
- export const Ocaml: Info = {
1591
- id: "ocaml-lsp",
1592
- extensions: [".ml", ".mli"],
1593
- root: NearestRoot(["dune-project", "dune-workspace", ".merlin", "opam"]),
1594
- async spawn(root) {
1595
- const bin = Bun.which("ocamllsp")
1596
- if (!bin) {
1597
- log.info("ocamllsp not found, please install ocaml-lsp-server")
1598
- return
1599
- }
1600
- return {
1601
- process: spawn(bin, {
1602
- cwd: root,
1603
- }),
1604
- }
1605
- },
1606
- }
1607
- export const BashLS: Info = {
1608
- id: "bash",
1609
- extensions: [".sh", ".bash", ".zsh", ".ksh"],
1610
- root: async () => Instance.directory,
1611
- async spawn(root) {
1612
- let binary = Bun.which("bash-language-server")
1613
- const args: string[] = []
1614
- if (!binary) {
1615
- const js = path.join(Global.Path.bin, "node_modules", "bash-language-server", "out", "cli.js")
1616
- if (!(await Bun.file(js).exists())) {
1617
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
1618
- await Bun.spawn([BunProc.which(), "install", "bash-language-server"], {
1619
- cwd: Global.Path.bin,
1620
- env: {
1621
- ...process.env,
1622
- BUN_BE_BUN: "1",
1623
- },
1624
- stdout: "pipe",
1625
- stderr: "pipe",
1626
- stdin: "pipe",
1627
- }).exited
1628
- }
1629
- binary = BunProc.which()
1630
- args.push("run", js)
1631
- }
1632
- args.push("start")
1633
- const proc = spawn(binary, args, {
1634
- cwd: root,
1635
- env: {
1636
- ...process.env,
1637
- BUN_BE_BUN: "1",
1638
- },
1639
- })
1640
- return {
1641
- process: proc,
1642
- }
1643
- },
1644
- }
1645
-
1646
- export const TerraformLS: Info = {
1647
- id: "terraform",
1648
- extensions: [".tf", ".tfvars"],
1649
- root: NearestRoot([".terraform.lock.hcl", "terraform.tfstate", "*.tf"]),
1650
- async spawn(root) {
1651
- let bin = Bun.which("terraform-ls", {
1652
- PATH: process.env["PATH"] + path.delimiter + Global.Path.bin,
1653
- })
1654
-
1655
- if (!bin) {
1656
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
1657
- log.info("downloading terraform-ls from GitHub releases")
1658
-
1659
- const releaseResponse = await fetch("https://api.github.com/repos/hashicorp/terraform-ls/releases/latest")
1660
- if (!releaseResponse.ok) {
1661
- log.error("Failed to fetch terraform-ls release info")
1662
- return
1663
- }
1664
-
1665
- const release = (await releaseResponse.json()) as {
1666
- tag_name?: string
1667
- assets?: { name?: string; browser_download_url?: string }[]
1668
- }
1669
- const version = release.tag_name?.replace("v", "")
1670
- if (!version) {
1671
- log.error("terraform-ls release did not include a version tag")
1672
- return
1673
- }
1674
-
1675
- const platform = process.platform
1676
- const arch = process.arch
1677
-
1678
- const tfArch = arch === "arm64" ? "arm64" : "amd64"
1679
- const tfPlatform = platform === "win32" ? "windows" : platform
1680
-
1681
- const assetName = `terraform-ls_${version}_${tfPlatform}_${tfArch}.zip`
1682
-
1683
- const assets = release.assets ?? []
1684
- const asset = assets.find((a) => a.name === assetName)
1685
- if (!asset?.browser_download_url) {
1686
- log.error(`Could not find asset ${assetName} in terraform-ls release`)
1687
- return
1688
- }
1689
-
1690
- const downloadResponse = await fetch(asset.browser_download_url)
1691
- if (!downloadResponse.ok) {
1692
- log.error("Failed to download terraform-ls")
1693
- return
1694
- }
1695
-
1696
- const tempPath = path.join(Global.Path.bin, assetName)
1697
- await Bun.file(tempPath).write(downloadResponse)
1698
-
1699
- const ok = await Archive.extractZip(tempPath, Global.Path.bin)
1700
- .then(() => true)
1701
- .catch((error) => {
1702
- log.error("Failed to extract terraform-ls archive", { error })
1703
- return false
1704
- })
1705
- if (!ok) return
1706
- await fs.rm(tempPath, { force: true })
1707
-
1708
- bin = path.join(Global.Path.bin, "terraform-ls" + (platform === "win32" ? ".exe" : ""))
1709
-
1710
- if (!(await Bun.file(bin).exists())) {
1711
- log.error("Failed to extract terraform-ls binary")
1712
- return
1713
- }
1714
-
1715
- if (platform !== "win32") {
1716
- await $`chmod +x ${bin}`.quiet().nothrow()
1717
- }
1718
-
1719
- log.info(`installed terraform-ls`, { bin })
1720
- }
1721
-
1722
- return {
1723
- process: spawn(bin, ["serve"], {
1724
- cwd: root,
1725
- }),
1726
- initialization: {
1727
- experimentalFeatures: {
1728
- prefillRequiredFields: true,
1729
- validateOnSave: true,
1730
- },
1731
- },
1732
- }
1733
- },
1734
- }
1735
-
1736
- export const TexLab: Info = {
1737
- id: "texlab",
1738
- extensions: [".tex", ".bib"],
1739
- root: NearestRoot([".latexmkrc", "latexmkrc", ".texlabroot", "texlabroot"]),
1740
- async spawn(root) {
1741
- let bin = Bun.which("texlab", {
1742
- PATH: process.env["PATH"] + path.delimiter + Global.Path.bin,
1743
- })
1744
-
1745
- if (!bin) {
1746
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
1747
- log.info("downloading texlab from GitHub releases")
1748
-
1749
- const response = await fetch("https://api.github.com/repos/latex-lsp/texlab/releases/latest")
1750
- if (!response.ok) {
1751
- log.error("Failed to fetch texlab release info")
1752
- return
1753
- }
1754
-
1755
- const release = (await response.json()) as {
1756
- tag_name?: string
1757
- assets?: { name?: string; browser_download_url?: string }[]
1758
- }
1759
- const version = release.tag_name?.replace("v", "")
1760
- if (!version) {
1761
- log.error("texlab release did not include a version tag")
1762
- return
1763
- }
1764
-
1765
- const platform = process.platform
1766
- const arch = process.arch
1767
-
1768
- const texArch = arch === "arm64" ? "aarch64" : "x86_64"
1769
- const texPlatform = platform === "darwin" ? "macos" : platform === "win32" ? "windows" : "linux"
1770
- const ext = platform === "win32" ? "zip" : "tar.gz"
1771
- const assetName = `texlab-${texArch}-${texPlatform}.${ext}`
1772
-
1773
- const assets = release.assets ?? []
1774
- const asset = assets.find((a) => a.name === assetName)
1775
- if (!asset?.browser_download_url) {
1776
- log.error(`Could not find asset ${assetName} in texlab release`)
1777
- return
1778
- }
1779
-
1780
- const downloadResponse = await fetch(asset.browser_download_url)
1781
- if (!downloadResponse.ok) {
1782
- log.error("Failed to download texlab")
1783
- return
1784
- }
1785
-
1786
- const tempPath = path.join(Global.Path.bin, assetName)
1787
- await Bun.file(tempPath).write(downloadResponse)
1788
-
1789
- if (ext === "zip") {
1790
- const ok = await Archive.extractZip(tempPath, Global.Path.bin)
1791
- .then(() => true)
1792
- .catch((error) => {
1793
- log.error("Failed to extract texlab archive", { error })
1794
- return false
1795
- })
1796
- if (!ok) return
1797
- }
1798
- if (ext === "tar.gz") {
1799
- await $`tar -xzf ${tempPath}`.cwd(Global.Path.bin).quiet().nothrow()
1800
- }
1801
-
1802
- await fs.rm(tempPath, { force: true })
1803
-
1804
- bin = path.join(Global.Path.bin, "texlab" + (platform === "win32" ? ".exe" : ""))
1805
-
1806
- if (!(await Bun.file(bin).exists())) {
1807
- log.error("Failed to extract texlab binary")
1808
- return
1809
- }
1810
-
1811
- if (platform !== "win32") {
1812
- await $`chmod +x ${bin}`.quiet().nothrow()
1813
- }
1814
-
1815
- log.info("installed texlab", { bin })
1816
- }
1817
-
1818
- return {
1819
- process: spawn(bin, {
1820
- cwd: root,
1821
- }),
1822
- }
1823
- },
1824
- }
1825
-
1826
- export const DockerfileLS: Info = {
1827
- id: "dockerfile",
1828
- extensions: [".dockerfile", "Dockerfile"],
1829
- root: async () => Instance.directory,
1830
- async spawn(root) {
1831
- let binary = Bun.which("docker-langserver")
1832
- const args: string[] = []
1833
- if (!binary) {
1834
- const js = path.join(Global.Path.bin, "node_modules", "dockerfile-language-server-nodejs", "lib", "server.js")
1835
- if (!(await Bun.file(js).exists())) {
1836
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
1837
- await Bun.spawn([BunProc.which(), "install", "dockerfile-language-server-nodejs"], {
1838
- cwd: Global.Path.bin,
1839
- env: {
1840
- ...process.env,
1841
- BUN_BE_BUN: "1",
1842
- },
1843
- stdout: "pipe",
1844
- stderr: "pipe",
1845
- stdin: "pipe",
1846
- }).exited
1847
- }
1848
- binary = BunProc.which()
1849
- args.push("run", js)
1850
- }
1851
- args.push("--stdio")
1852
- const proc = spawn(binary, args, {
1853
- cwd: root,
1854
- env: {
1855
- ...process.env,
1856
- BUN_BE_BUN: "1",
1857
- },
1858
- })
1859
- return {
1860
- process: proc,
1861
- }
1862
- },
1863
- }
1864
-
1865
- export const Gleam: Info = {
1866
- id: "gleam",
1867
- extensions: [".gleam"],
1868
- root: NearestRoot(["gleam.toml"]),
1869
- async spawn(root) {
1870
- const gleam = Bun.which("gleam")
1871
- if (!gleam) {
1872
- log.info("gleam not found, please install gleam first")
1873
- return
1874
- }
1875
- return {
1876
- process: spawn(gleam, ["lsp"], {
1877
- cwd: root,
1878
- }),
1879
- }
1880
- },
1881
- }
1882
-
1883
- export const Clojure: Info = {
1884
- id: "clojure-lsp",
1885
- extensions: [".clj", ".cljs", ".cljc", ".edn"],
1886
- root: NearestRoot(["deps.edn", "project.clj", "shadow-cljs.edn", "bb.edn", "build.boot"]),
1887
- async spawn(root) {
1888
- let bin = Bun.which("clojure-lsp")
1889
- if (!bin && process.platform === "win32") {
1890
- bin = Bun.which("clojure-lsp.exe")
1891
- }
1892
- if (!bin) {
1893
- log.info("clojure-lsp not found, please install clojure-lsp first")
1894
- return
1895
- }
1896
- return {
1897
- process: spawn(bin, ["listen"], {
1898
- cwd: root,
1899
- }),
1900
- }
1901
- },
1902
- }
1903
-
1904
- export const Nixd: Info = {
1905
- id: "nixd",
1906
- extensions: [".nix"],
1907
- root: async (file) => {
1908
- // First, look for flake.nix - the most reliable Nix project root indicator
1909
- const flakeRoot = await NearestRoot(["flake.nix"])(file)
1910
- if (flakeRoot && flakeRoot !== Instance.directory) return flakeRoot
1911
-
1912
- // If no flake.nix, fall back to git repository root
1913
- if (Instance.worktree && Instance.worktree !== Instance.directory) return Instance.worktree
1914
-
1915
- // Finally, use the instance directory as fallback
1916
- return Instance.directory
1917
- },
1918
- async spawn(root) {
1919
- const nixd = Bun.which("nixd")
1920
- if (!nixd) {
1921
- log.info("nixd not found, please install nixd first")
1922
- return
1923
- }
1924
- return {
1925
- process: spawn(nixd, [], {
1926
- cwd: root,
1927
- env: {
1928
- ...process.env,
1929
- },
1930
- }),
1931
- }
1932
- },
1933
- }
1934
-
1935
- export const Tinymist: Info = {
1936
- id: "tinymist",
1937
- extensions: [".typ", ".typc"],
1938
- root: NearestRoot(["typst.toml"]),
1939
- async spawn(root) {
1940
- let bin = Bun.which("tinymist", {
1941
- PATH: process.env["PATH"] + path.delimiter + Global.Path.bin,
1942
- })
1943
-
1944
- if (!bin) {
1945
- if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
1946
- log.info("downloading tinymist from GitHub releases")
1947
-
1948
- const response = await fetch("https://api.github.com/repos/Myriad-Dreamin/tinymist/releases/latest")
1949
- if (!response.ok) {
1950
- log.error("Failed to fetch tinymist release info")
1951
- return
1952
- }
1953
-
1954
- const release = (await response.json()) as {
1955
- tag_name?: string
1956
- assets?: { name?: string; browser_download_url?: string }[]
1957
- }
1958
-
1959
- const platform = process.platform
1960
- const arch = process.arch
1961
-
1962
- const tinymistArch = arch === "arm64" ? "aarch64" : "x86_64"
1963
- let tinymistPlatform: string
1964
- let ext: string
1965
-
1966
- if (platform === "darwin") {
1967
- tinymistPlatform = "apple-darwin"
1968
- ext = "tar.gz"
1969
- } else if (platform === "win32") {
1970
- tinymistPlatform = "pc-windows-msvc"
1971
- ext = "zip"
1972
- } else {
1973
- tinymistPlatform = "unknown-linux-gnu"
1974
- ext = "tar.gz"
1975
- }
1976
-
1977
- const assetName = `tinymist-${tinymistArch}-${tinymistPlatform}.${ext}`
1978
-
1979
- const assets = release.assets ?? []
1980
- const asset = assets.find((a) => a.name === assetName)
1981
- if (!asset?.browser_download_url) {
1982
- log.error(`Could not find asset ${assetName} in tinymist release`)
1983
- return
1984
- }
1985
-
1986
- const downloadResponse = await fetch(asset.browser_download_url)
1987
- if (!downloadResponse.ok) {
1988
- log.error("Failed to download tinymist")
1989
- return
1990
- }
1991
-
1992
- const tempPath = path.join(Global.Path.bin, assetName)
1993
- await Bun.file(tempPath).write(downloadResponse)
1994
-
1995
- if (ext === "zip") {
1996
- const ok = await Archive.extractZip(tempPath, Global.Path.bin)
1997
- .then(() => true)
1998
- .catch((error) => {
1999
- log.error("Failed to extract tinymist archive", { error })
2000
- return false
2001
- })
2002
- if (!ok) return
2003
- } else {
2004
- await $`tar -xzf ${tempPath} --strip-components=1`.cwd(Global.Path.bin).quiet().nothrow()
2005
- }
2006
-
2007
- await fs.rm(tempPath, { force: true })
2008
-
2009
- bin = path.join(Global.Path.bin, "tinymist" + (platform === "win32" ? ".exe" : ""))
2010
-
2011
- if (!(await Bun.file(bin).exists())) {
2012
- log.error("Failed to extract tinymist binary")
2013
- return
2014
- }
2015
-
2016
- if (platform !== "win32") {
2017
- await $`chmod +x ${bin}`.quiet().nothrow()
2018
- }
2019
-
2020
- log.info("installed tinymist", { bin })
2021
- }
2022
-
2023
- return {
2024
- process: spawn(bin, { cwd: root }),
2025
- }
2026
- },
2027
- }
2028
-
2029
- export const HLS: Info = {
2030
- id: "haskell-language-server",
2031
- extensions: [".hs", ".lhs"],
2032
- root: NearestRoot(["stack.yaml", "cabal.project", "hie.yaml", "*.cabal"]),
2033
- async spawn(root) {
2034
- const bin = Bun.which("haskell-language-server-wrapper")
2035
- if (!bin) {
2036
- log.info("haskell-language-server-wrapper not found, please install haskell-language-server")
2037
- return
2038
- }
2039
- return {
2040
- process: spawn(bin, ["--lsp"], {
2041
- cwd: root,
2042
- }),
2043
- }
2044
- },
2045
- }
2046
- }