cerebras-cli 1.0.0

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 (314) hide show
  1. package/AGENTS.md +27 -0
  2. package/Dockerfile +10 -0
  3. package/README.md +15 -0
  4. package/bin/opencode +84 -0
  5. package/bunfig.toml +4 -0
  6. package/package.json +128 -0
  7. package/parsers-config.ts +239 -0
  8. package/script/build.ts +151 -0
  9. package/script/postinstall.mjs +122 -0
  10. package/script/publish.ts +256 -0
  11. package/script/schema.ts +47 -0
  12. package/src/acp/README.md +164 -0
  13. package/src/acp/agent.ts +812 -0
  14. package/src/acp/session.ts +70 -0
  15. package/src/acp/types.ts +22 -0
  16. package/src/agent/agent.ts +310 -0
  17. package/src/agent/generate.txt +75 -0
  18. package/src/auth/index.ts +70 -0
  19. package/src/bun/index.ts +152 -0
  20. package/src/bus/global.ts +10 -0
  21. package/src/bus/index.ts +142 -0
  22. package/src/cli/bootstrap.ts +17 -0
  23. package/src/cli/cmd/acp.ts +88 -0
  24. package/src/cli/cmd/agent.ts +165 -0
  25. package/src/cli/cmd/auth.ts +369 -0
  26. package/src/cli/cmd/cmd.ts +7 -0
  27. package/src/cli/cmd/debug/config.ts +15 -0
  28. package/src/cli/cmd/debug/file.ts +91 -0
  29. package/src/cli/cmd/debug/index.ts +41 -0
  30. package/src/cli/cmd/debug/lsp.ts +47 -0
  31. package/src/cli/cmd/debug/ripgrep.ts +83 -0
  32. package/src/cli/cmd/debug/scrap.ts +15 -0
  33. package/src/cli/cmd/debug/snapshot.ts +48 -0
  34. package/src/cli/cmd/export.ts +88 -0
  35. package/src/cli/cmd/generate.ts +38 -0
  36. package/src/cli/cmd/github.ts +1200 -0
  37. package/src/cli/cmd/import.ts +98 -0
  38. package/src/cli/cmd/mcp.ts +400 -0
  39. package/src/cli/cmd/models.ts +77 -0
  40. package/src/cli/cmd/pr.ts +112 -0
  41. package/src/cli/cmd/run.ts +342 -0
  42. package/src/cli/cmd/serve.ts +31 -0
  43. package/src/cli/cmd/session.ts +106 -0
  44. package/src/cli/cmd/stats.ts +298 -0
  45. package/src/cli/cmd/tui/app.tsx +732 -0
  46. package/src/cli/cmd/tui/attach.ts +25 -0
  47. package/src/cli/cmd/tui/component/border.tsx +21 -0
  48. package/src/cli/cmd/tui/component/dialog-agent.tsx +31 -0
  49. package/src/cli/cmd/tui/component/dialog-command.tsx +124 -0
  50. package/src/cli/cmd/tui/component/dialog-feedback.tsx +160 -0
  51. package/src/cli/cmd/tui/component/dialog-mcp.tsx +86 -0
  52. package/src/cli/cmd/tui/component/dialog-model.tsx +223 -0
  53. package/src/cli/cmd/tui/component/dialog-notification.tsx +78 -0
  54. package/src/cli/cmd/tui/component/dialog-provider.tsx +222 -0
  55. package/src/cli/cmd/tui/component/dialog-session-list.tsx +97 -0
  56. package/src/cli/cmd/tui/component/dialog-session-rename.tsx +31 -0
  57. package/src/cli/cmd/tui/component/dialog-status.tsx +114 -0
  58. package/src/cli/cmd/tui/component/dialog-tag.tsx +44 -0
  59. package/src/cli/cmd/tui/component/dialog-theme-list.tsx +50 -0
  60. package/src/cli/cmd/tui/component/logo.tsx +37 -0
  61. package/src/cli/cmd/tui/component/notification-banner.tsx +58 -0
  62. package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +530 -0
  63. package/src/cli/cmd/tui/component/prompt/history.tsx +107 -0
  64. package/src/cli/cmd/tui/component/prompt/index.tsx +931 -0
  65. package/src/cli/cmd/tui/context/args.tsx +14 -0
  66. package/src/cli/cmd/tui/context/directory.ts +12 -0
  67. package/src/cli/cmd/tui/context/exit.tsx +23 -0
  68. package/src/cli/cmd/tui/context/helper.tsx +25 -0
  69. package/src/cli/cmd/tui/context/keybind.tsx +111 -0
  70. package/src/cli/cmd/tui/context/kv.tsx +49 -0
  71. package/src/cli/cmd/tui/context/local.tsx +339 -0
  72. package/src/cli/cmd/tui/context/prompt.tsx +18 -0
  73. package/src/cli/cmd/tui/context/route.tsx +45 -0
  74. package/src/cli/cmd/tui/context/sdk.tsx +75 -0
  75. package/src/cli/cmd/tui/context/sync.tsx +374 -0
  76. package/src/cli/cmd/tui/context/theme/aura.json +69 -0
  77. package/src/cli/cmd/tui/context/theme/ayu.json +80 -0
  78. package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +233 -0
  79. package/src/cli/cmd/tui/context/theme/catppuccin.json +112 -0
  80. package/src/cli/cmd/tui/context/theme/cobalt2.json +228 -0
  81. package/src/cli/cmd/tui/context/theme/dracula.json +219 -0
  82. package/src/cli/cmd/tui/context/theme/everforest.json +241 -0
  83. package/src/cli/cmd/tui/context/theme/flexoki.json +237 -0
  84. package/src/cli/cmd/tui/context/theme/github.json +233 -0
  85. package/src/cli/cmd/tui/context/theme/gruvbox.json +95 -0
  86. package/src/cli/cmd/tui/context/theme/kanagawa.json +77 -0
  87. package/src/cli/cmd/tui/context/theme/material.json +235 -0
  88. package/src/cli/cmd/tui/context/theme/matrix.json +77 -0
  89. package/src/cli/cmd/tui/context/theme/mercury.json +252 -0
  90. package/src/cli/cmd/tui/context/theme/monokai.json +221 -0
  91. package/src/cli/cmd/tui/context/theme/nightowl.json +221 -0
  92. package/src/cli/cmd/tui/context/theme/nord.json +223 -0
  93. package/src/cli/cmd/tui/context/theme/one-dark.json +84 -0
  94. package/src/cli/cmd/tui/context/theme/orng.json +245 -0
  95. package/src/cli/cmd/tui/context/theme/palenight.json +222 -0
  96. package/src/cli/cmd/tui/context/theme/rosepine.json +234 -0
  97. package/src/cli/cmd/tui/context/theme/solarized.json +223 -0
  98. package/src/cli/cmd/tui/context/theme/synthwave84.json +226 -0
  99. package/src/cli/cmd/tui/context/theme/tokyonight.json +243 -0
  100. package/src/cli/cmd/tui/context/theme/vercel.json +245 -0
  101. package/src/cli/cmd/tui/context/theme/vesper.json +218 -0
  102. package/src/cli/cmd/tui/context/theme/zenburn.json +223 -0
  103. package/src/cli/cmd/tui/context/theme.tsx +1077 -0
  104. package/src/cli/cmd/tui/event.ts +39 -0
  105. package/src/cli/cmd/tui/routes/home.tsx +104 -0
  106. package/src/cli/cmd/tui/routes/session/dialog-message.tsx +93 -0
  107. package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +37 -0
  108. package/src/cli/cmd/tui/routes/session/footer.tsx +76 -0
  109. package/src/cli/cmd/tui/routes/session/header.tsx +183 -0
  110. package/src/cli/cmd/tui/routes/session/index.tsx +1703 -0
  111. package/src/cli/cmd/tui/routes/session/sidebar.tsx +586 -0
  112. package/src/cli/cmd/tui/spawn.ts +60 -0
  113. package/src/cli/cmd/tui/thread.ts +120 -0
  114. package/src/cli/cmd/tui/ui/dialog-alert.tsx +55 -0
  115. package/src/cli/cmd/tui/ui/dialog-confirm.tsx +81 -0
  116. package/src/cli/cmd/tui/ui/dialog-help.tsx +36 -0
  117. package/src/cli/cmd/tui/ui/dialog-prompt.tsx +75 -0
  118. package/src/cli/cmd/tui/ui/dialog-select.tsx +317 -0
  119. package/src/cli/cmd/tui/ui/dialog.tsx +170 -0
  120. package/src/cli/cmd/tui/ui/spinner.ts +368 -0
  121. package/src/cli/cmd/tui/ui/toast.tsx +100 -0
  122. package/src/cli/cmd/tui/util/clipboard.ts +127 -0
  123. package/src/cli/cmd/tui/util/editor.ts +32 -0
  124. package/src/cli/cmd/tui/util/terminal.ts +114 -0
  125. package/src/cli/cmd/tui/worker.ts +63 -0
  126. package/src/cli/cmd/uninstall.ts +344 -0
  127. package/src/cli/cmd/upgrade.ts +67 -0
  128. package/src/cli/cmd/web.ts +84 -0
  129. package/src/cli/error.ts +55 -0
  130. package/src/cli/ui.ts +84 -0
  131. package/src/cli/upgrade.ts +25 -0
  132. package/src/command/index.ts +79 -0
  133. package/src/command/template/initialize.txt +10 -0
  134. package/src/command/template/review.txt +73 -0
  135. package/src/config/config.ts +886 -0
  136. package/src/config/markdown.ts +41 -0
  137. package/src/env/index.ts +26 -0
  138. package/src/file/fzf.ts +124 -0
  139. package/src/file/ignore.ts +83 -0
  140. package/src/file/index.ts +326 -0
  141. package/src/file/ripgrep.ts +391 -0
  142. package/src/file/time.ts +38 -0
  143. package/src/file/watcher.ts +89 -0
  144. package/src/flag/flag.ts +28 -0
  145. package/src/format/formatter.ts +277 -0
  146. package/src/format/index.ts +137 -0
  147. package/src/global/index.ts +52 -0
  148. package/src/id/id.ts +73 -0
  149. package/src/ide/index.ts +75 -0
  150. package/src/index.ts +158 -0
  151. package/src/installation/index.ts +194 -0
  152. package/src/lsp/client.ts +215 -0
  153. package/src/lsp/index.ts +370 -0
  154. package/src/lsp/language.ts +111 -0
  155. package/src/lsp/server.ts +1327 -0
  156. package/src/mcp/auth.ts +82 -0
  157. package/src/mcp/index.ts +576 -0
  158. package/src/mcp/oauth-callback.ts +203 -0
  159. package/src/mcp/oauth-provider.ts +132 -0
  160. package/src/notification/index.ts +101 -0
  161. package/src/patch/index.ts +622 -0
  162. package/src/permission/index.ts +198 -0
  163. package/src/plugin/index.ts +95 -0
  164. package/src/project/bootstrap.ts +31 -0
  165. package/src/project/instance.ts +68 -0
  166. package/src/project/project.ts +133 -0
  167. package/src/project/state.ts +65 -0
  168. package/src/project/vcs.ts +77 -0
  169. package/src/provider/auth.ts +143 -0
  170. package/src/provider/models-macro.ts +11 -0
  171. package/src/provider/models.ts +93 -0
  172. package/src/provider/provider.ts +996 -0
  173. package/src/provider/sdk/openai-compatible/src/README.md +5 -0
  174. package/src/provider/sdk/openai-compatible/src/index.ts +2 -0
  175. package/src/provider/sdk/openai-compatible/src/openai-compatible-provider.ts +100 -0
  176. package/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts +303 -0
  177. package/src/provider/sdk/openai-compatible/src/responses/map-openai-responses-finish-reason.ts +27 -0
  178. package/src/provider/sdk/openai-compatible/src/responses/openai-config.ts +18 -0
  179. package/src/provider/sdk/openai-compatible/src/responses/openai-error.ts +22 -0
  180. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-api-types.ts +207 -0
  181. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts +1713 -0
  182. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-prepare-tools.ts +177 -0
  183. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-settings.ts +1 -0
  184. package/src/provider/sdk/openai-compatible/src/responses/tool/code-interpreter.ts +88 -0
  185. package/src/provider/sdk/openai-compatible/src/responses/tool/file-search.ts +128 -0
  186. package/src/provider/sdk/openai-compatible/src/responses/tool/image-generation.ts +115 -0
  187. package/src/provider/sdk/openai-compatible/src/responses/tool/local-shell.ts +65 -0
  188. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search-preview.ts +104 -0
  189. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search.ts +103 -0
  190. package/src/provider/transform.ts +406 -0
  191. package/src/pty/index.ts +226 -0
  192. package/src/ratelimit/index.ts +185 -0
  193. package/src/server/error.ts +36 -0
  194. package/src/server/project.ts +50 -0
  195. package/src/server/server.ts +2463 -0
  196. package/src/server/tui.ts +71 -0
  197. package/src/session/compaction.ts +257 -0
  198. package/src/session/index.ts +470 -0
  199. package/src/session/message-v2.ts +641 -0
  200. package/src/session/message.ts +189 -0
  201. package/src/session/processor.ts +443 -0
  202. package/src/session/prompt/anthropic-20250930.txt +166 -0
  203. package/src/session/prompt/anthropic.txt +105 -0
  204. package/src/session/prompt/anthropic_spoof.txt +1 -0
  205. package/src/session/prompt/beast.txt +147 -0
  206. package/src/session/prompt/build-switch.txt +5 -0
  207. package/src/session/prompt/codex.txt +318 -0
  208. package/src/session/prompt/compaction.txt +12 -0
  209. package/src/session/prompt/copilot-gpt-5.txt +143 -0
  210. package/src/session/prompt/gemini.txt +155 -0
  211. package/src/session/prompt/max-steps.txt +16 -0
  212. package/src/session/prompt/plan-reminder-anthropic.txt +67 -0
  213. package/src/session/prompt/plan.txt +26 -0
  214. package/src/session/prompt/polaris.txt +107 -0
  215. package/src/session/prompt/qwen.txt +109 -0
  216. package/src/session/prompt/summarize.txt +4 -0
  217. package/src/session/prompt/title.txt +36 -0
  218. package/src/session/prompt.ts +1541 -0
  219. package/src/session/retry.ts +82 -0
  220. package/src/session/revert.ts +108 -0
  221. package/src/session/status.ts +75 -0
  222. package/src/session/summary.ts +203 -0
  223. package/src/session/system.ts +148 -0
  224. package/src/session/todo.ts +36 -0
  225. package/src/share/share-next.ts +195 -0
  226. package/src/share/share.ts +87 -0
  227. package/src/snapshot/index.ts +197 -0
  228. package/src/storage/storage.ts +226 -0
  229. package/src/telemetry/index.ts +232 -0
  230. package/src/tool/bash.ts +365 -0
  231. package/src/tool/bash.txt +128 -0
  232. package/src/tool/batch.ts +173 -0
  233. package/src/tool/batch.txt +28 -0
  234. package/src/tool/codesearch.ts +138 -0
  235. package/src/tool/codesearch.txt +12 -0
  236. package/src/tool/edit.ts +674 -0
  237. package/src/tool/edit.txt +10 -0
  238. package/src/tool/glob.ts +65 -0
  239. package/src/tool/glob.txt +6 -0
  240. package/src/tool/grep.ts +120 -0
  241. package/src/tool/grep.txt +8 -0
  242. package/src/tool/invalid.ts +17 -0
  243. package/src/tool/ls.ts +110 -0
  244. package/src/tool/ls.txt +1 -0
  245. package/src/tool/lsp-diagnostics.ts +26 -0
  246. package/src/tool/lsp-diagnostics.txt +1 -0
  247. package/src/tool/lsp-hover.ts +31 -0
  248. package/src/tool/lsp-hover.txt +1 -0
  249. package/src/tool/multiedit.ts +46 -0
  250. package/src/tool/multiedit.txt +41 -0
  251. package/src/tool/patch.ts +233 -0
  252. package/src/tool/patch.txt +1 -0
  253. package/src/tool/read.ts +217 -0
  254. package/src/tool/read.txt +12 -0
  255. package/src/tool/registry.ts +148 -0
  256. package/src/tool/task.ts +135 -0
  257. package/src/tool/task.txt +60 -0
  258. package/src/tool/todo.ts +39 -0
  259. package/src/tool/todoread.txt +14 -0
  260. package/src/tool/todowrite.txt +167 -0
  261. package/src/tool/tool.ts +66 -0
  262. package/src/tool/webfetch.ts +187 -0
  263. package/src/tool/webfetch.txt +14 -0
  264. package/src/tool/websearch.ts +150 -0
  265. package/src/tool/websearch.txt +11 -0
  266. package/src/tool/write.ts +99 -0
  267. package/src/tool/write.txt +8 -0
  268. package/src/types/shims.d.ts +3 -0
  269. package/src/util/color.ts +19 -0
  270. package/src/util/context.ts +25 -0
  271. package/src/util/defer.ts +12 -0
  272. package/src/util/eventloop.ts +20 -0
  273. package/src/util/filesystem.ts +69 -0
  274. package/src/util/fn.ts +11 -0
  275. package/src/util/iife.ts +3 -0
  276. package/src/util/keybind.ts +79 -0
  277. package/src/util/lazy.ts +11 -0
  278. package/src/util/locale.ts +81 -0
  279. package/src/util/lock.ts +98 -0
  280. package/src/util/log.ts +177 -0
  281. package/src/util/queue.ts +32 -0
  282. package/src/util/rpc.ts +42 -0
  283. package/src/util/scrap.ts +10 -0
  284. package/src/util/signal.ts +12 -0
  285. package/src/util/timeout.ts +14 -0
  286. package/src/util/token.ts +7 -0
  287. package/src/util/wildcard.ts +54 -0
  288. package/sst-env.d.ts +9 -0
  289. package/test/bun.test.ts +53 -0
  290. package/test/config/agent-color.test.ts +66 -0
  291. package/test/config/config.test.ts +503 -0
  292. package/test/config/markdown.test.ts +89 -0
  293. package/test/file/ignore.test.ts +10 -0
  294. package/test/fixture/fixture.ts +28 -0
  295. package/test/fixture/lsp/fake-lsp-server.js +77 -0
  296. package/test/ide/ide.test.ts +82 -0
  297. package/test/keybind.test.ts +317 -0
  298. package/test/lsp/client.test.ts +95 -0
  299. package/test/patch/patch.test.ts +348 -0
  300. package/test/preload.ts +38 -0
  301. package/test/project/project.test.ts +42 -0
  302. package/test/provider/provider.test.ts +1809 -0
  303. package/test/provider/transform.test.ts +305 -0
  304. package/test/session/retry.test.ts +61 -0
  305. package/test/session/session.test.ts +71 -0
  306. package/test/snapshot/snapshot.test.ts +939 -0
  307. package/test/tool/__snapshots__/tool.test.ts.snap +9 -0
  308. package/test/tool/bash.test.ts +55 -0
  309. package/test/tool/patch.test.ts +259 -0
  310. package/test/util/iife.test.ts +36 -0
  311. package/test/util/lazy.test.ts +50 -0
  312. package/test/util/timeout.test.ts +21 -0
  313. package/test/util/wildcard.test.ts +55 -0
  314. package/tsconfig.json +17 -0
@@ -0,0 +1,1077 @@
1
+ import { SyntaxStyle, RGBA, type TerminalColors } from "@opentui/core"
2
+ import path from "path"
3
+ import { createEffect, createMemo, onMount } from "solid-js"
4
+ import { useSync } from "@tui/context/sync"
5
+ import { createSimpleContext } from "./helper"
6
+ import aura from "./theme/aura.json" with { type: "json" }
7
+ import ayu from "./theme/ayu.json" with { type: "json" }
8
+ import catppuccin from "./theme/catppuccin.json" with { type: "json" }
9
+ import catppuccinMacchiato from "./theme/catppuccin-macchiato.json" with { type: "json" }
10
+ import cobalt2 from "./theme/cobalt2.json" with { type: "json" }
11
+ import dracula from "./theme/dracula.json" with { type: "json" }
12
+ import everforest from "./theme/everforest.json" with { type: "json" }
13
+ import flexoki from "./theme/flexoki.json" with { type: "json" }
14
+ import github from "./theme/github.json" with { type: "json" }
15
+ import gruvbox from "./theme/gruvbox.json" with { type: "json" }
16
+ import kanagawa from "./theme/kanagawa.json" with { type: "json" }
17
+ import material from "./theme/material.json" with { type: "json" }
18
+ import matrix from "./theme/matrix.json" with { type: "json" }
19
+ import mercury from "./theme/mercury.json" with { type: "json" }
20
+ import monokai from "./theme/monokai.json" with { type: "json" }
21
+ import nightowl from "./theme/nightowl.json" with { type: "json" }
22
+ import nord from "./theme/nord.json" with { type: "json" }
23
+ import onedark from "./theme/one-dark.json" with { type: "json" }
24
+ import opencode from "./theme/opencode.json" with { type: "json" }
25
+ import orng from "./theme/orng.json" with { type: "json" }
26
+ import palenight from "./theme/palenight.json" with { type: "json" }
27
+ import rosepine from "./theme/rosepine.json" with { type: "json" }
28
+ import solarized from "./theme/solarized.json" with { type: "json" }
29
+ import synthwave84 from "./theme/synthwave84.json" with { type: "json" }
30
+ import tokyonight from "./theme/tokyonight.json" with { type: "json" }
31
+ import vercel from "./theme/vercel.json" with { type: "json" }
32
+ import vesper from "./theme/vesper.json" with { type: "json" }
33
+ import zenburn from "./theme/zenburn.json" with { type: "json" }
34
+ import { useKV } from "./kv"
35
+ import { useRenderer } from "@opentui/solid"
36
+ import { createStore, produce } from "solid-js/store"
37
+ import { Global } from "@/global"
38
+ import { Filesystem } from "@/util/filesystem"
39
+
40
+ type ThemeColors = {
41
+ primary: RGBA
42
+ secondary: RGBA
43
+ accent: RGBA
44
+ error: RGBA
45
+ warning: RGBA
46
+ success: RGBA
47
+ info: RGBA
48
+ text: RGBA
49
+ textMuted: RGBA
50
+ selectedListItemText: RGBA
51
+ background: RGBA
52
+ backgroundPanel: RGBA
53
+ backgroundElement: RGBA
54
+ backgroundMenu: RGBA
55
+ border: RGBA
56
+ borderActive: RGBA
57
+ borderSubtle: RGBA
58
+ diffAdded: RGBA
59
+ diffRemoved: RGBA
60
+ diffContext: RGBA
61
+ diffHunkHeader: RGBA
62
+ diffHighlightAdded: RGBA
63
+ diffHighlightRemoved: RGBA
64
+ diffAddedBg: RGBA
65
+ diffRemovedBg: RGBA
66
+ diffContextBg: RGBA
67
+ diffLineNumber: RGBA
68
+ diffAddedLineNumberBg: RGBA
69
+ diffRemovedLineNumberBg: RGBA
70
+ markdownText: RGBA
71
+ markdownHeading: RGBA
72
+ markdownLink: RGBA
73
+ markdownLinkText: RGBA
74
+ markdownCode: RGBA
75
+ markdownBlockQuote: RGBA
76
+ markdownEmph: RGBA
77
+ markdownStrong: RGBA
78
+ markdownHorizontalRule: RGBA
79
+ markdownListItem: RGBA
80
+ markdownListEnumeration: RGBA
81
+ markdownImage: RGBA
82
+ markdownImageText: RGBA
83
+ markdownCodeBlock: RGBA
84
+ syntaxComment: RGBA
85
+ syntaxKeyword: RGBA
86
+ syntaxFunction: RGBA
87
+ syntaxVariable: RGBA
88
+ syntaxString: RGBA
89
+ syntaxNumber: RGBA
90
+ syntaxType: RGBA
91
+ syntaxOperator: RGBA
92
+ syntaxPunctuation: RGBA
93
+ }
94
+
95
+ type Theme = ThemeColors & {
96
+ _hasSelectedListItemText: boolean
97
+ thinkingOpacity: number
98
+ }
99
+
100
+ export function selectedForeground(theme: Theme): RGBA {
101
+ // If theme explicitly defines selectedListItemText, use it
102
+ if (theme._hasSelectedListItemText) {
103
+ return theme.selectedListItemText
104
+ }
105
+
106
+ // For transparent backgrounds, calculate contrast based on primary color
107
+ if (theme.background.a === 0) {
108
+ const { r, g, b } = theme.primary
109
+ const luminance = 0.299 * r + 0.587 * g + 0.114 * b
110
+ return luminance > 0.5 ? RGBA.fromInts(0, 0, 0) : RGBA.fromInts(255, 255, 255)
111
+ }
112
+
113
+ // Fall back to background color
114
+ return theme.background
115
+ }
116
+
117
+ type HexColor = `#${string}`
118
+ type RefName = string
119
+ type Variant = {
120
+ dark: HexColor | RefName
121
+ light: HexColor | RefName
122
+ }
123
+ type ColorValue = HexColor | RefName | Variant | RGBA
124
+ type ThemeJson = {
125
+ $schema?: string
126
+ defs?: Record<string, HexColor | RefName>
127
+ theme: Omit<Record<keyof ThemeColors, ColorValue>, "selectedListItemText" | "backgroundMenu"> & {
128
+ selectedListItemText?: ColorValue
129
+ backgroundMenu?: ColorValue
130
+ thinkingOpacity?: number
131
+ }
132
+ }
133
+
134
+ export const DEFAULT_THEMES: Record<string, ThemeJson> = {
135
+ aura,
136
+ ayu,
137
+ catppuccin,
138
+ ["catppuccin-macchiato"]: catppuccinMacchiato,
139
+ cobalt2,
140
+ dracula,
141
+ everforest,
142
+ flexoki,
143
+ github,
144
+ gruvbox,
145
+ kanagawa,
146
+ material,
147
+ matrix,
148
+ mercury,
149
+ monokai,
150
+ nightowl,
151
+ nord,
152
+ ["one-dark"]: onedark,
153
+ opencode,
154
+ orng,
155
+ palenight,
156
+ rosepine,
157
+ solarized,
158
+ synthwave84,
159
+ tokyonight,
160
+ vesper,
161
+ vercel,
162
+ zenburn,
163
+ }
164
+
165
+ function resolveTheme(theme: ThemeJson, mode: "dark" | "light") {
166
+ const defs = theme.defs ?? {}
167
+ function resolveColor(c: ColorValue): RGBA {
168
+ if (c instanceof RGBA) return c
169
+ if (typeof c === "string") {
170
+ if (c === "transparent" || c === "none") return RGBA.fromInts(0, 0, 0, 0)
171
+
172
+ if (c.startsWith("#")) return RGBA.fromHex(c)
173
+
174
+ if (defs[c] != null) {
175
+ return resolveColor(defs[c])
176
+ } else if (theme.theme[c as keyof ThemeColors] !== undefined) {
177
+ return resolveColor(theme.theme[c as keyof ThemeColors]!)
178
+ } else {
179
+ throw new Error(`Color reference "${c}" not found in defs or theme`)
180
+ }
181
+ }
182
+ if (typeof c === "number") {
183
+ return ansiToRgba(c)
184
+ }
185
+ return resolveColor(c[mode])
186
+ }
187
+
188
+ const resolved = Object.fromEntries(
189
+ Object.entries(theme.theme)
190
+ .filter(([key]) => key !== "selectedListItemText" && key !== "backgroundMenu" && key !== "thinkingOpacity")
191
+ .map(([key, value]) => {
192
+ return [key, resolveColor(value as ColorValue)]
193
+ }),
194
+ ) as Partial<ThemeColors>
195
+
196
+ // Handle selectedListItemText separately since it's optional
197
+ const hasSelectedListItemText = theme.theme.selectedListItemText !== undefined
198
+ if (hasSelectedListItemText) {
199
+ resolved.selectedListItemText = resolveColor(theme.theme.selectedListItemText!)
200
+ } else {
201
+ // Backward compatibility: if selectedListItemText is not defined, use background color
202
+ // This preserves the current behavior for all existing themes
203
+ resolved.selectedListItemText = resolved.background
204
+ }
205
+
206
+ // Handle backgroundMenu - optional with fallback to backgroundElement
207
+ if (theme.theme.backgroundMenu !== undefined) {
208
+ resolved.backgroundMenu = resolveColor(theme.theme.backgroundMenu)
209
+ } else {
210
+ resolved.backgroundMenu = resolved.backgroundElement
211
+ }
212
+
213
+ // Handle thinkingOpacity - optional with default of 0.6
214
+ const thinkingOpacity = theme.theme.thinkingOpacity ?? 0.6
215
+
216
+ return {
217
+ ...resolved,
218
+ _hasSelectedListItemText: hasSelectedListItemText,
219
+ thinkingOpacity,
220
+ } as Theme
221
+ }
222
+
223
+ function ansiToRgba(code: number): RGBA {
224
+ // Standard ANSI colors (0-15)
225
+ if (code < 16) {
226
+ const ansiColors = [
227
+ "#000000", // Black
228
+ "#800000", // Red
229
+ "#008000", // Green
230
+ "#808000", // Yellow
231
+ "#000080", // Blue
232
+ "#800080", // Magenta
233
+ "#008080", // Cyan
234
+ "#c0c0c0", // White
235
+ "#808080", // Bright Black
236
+ "#ff0000", // Bright Red
237
+ "#00ff00", // Bright Green
238
+ "#ffff00", // Bright Yellow
239
+ "#0000ff", // Bright Blue
240
+ "#ff00ff", // Bright Magenta
241
+ "#00ffff", // Bright Cyan
242
+ "#ffffff", // Bright White
243
+ ]
244
+ return RGBA.fromHex(ansiColors[code] ?? "#000000")
245
+ }
246
+
247
+ // 6x6x6 Color Cube (16-231)
248
+ if (code < 232) {
249
+ const index = code - 16
250
+ const b = index % 6
251
+ const g = Math.floor(index / 6) % 6
252
+ const r = Math.floor(index / 36)
253
+
254
+ const val = (x: number) => (x === 0 ? 0 : x * 40 + 55)
255
+ return RGBA.fromInts(val(r), val(g), val(b))
256
+ }
257
+
258
+ // Grayscale Ramp (232-255)
259
+ if (code < 256) {
260
+ const gray = (code - 232) * 10 + 8
261
+ return RGBA.fromInts(gray, gray, gray)
262
+ }
263
+
264
+ // Fallback for invalid codes
265
+ return RGBA.fromInts(0, 0, 0)
266
+ }
267
+
268
+ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
269
+ name: "Theme",
270
+ init: (props: { mode: "dark" | "light" }) => {
271
+ const sync = useSync()
272
+ const kv = useKV()
273
+ const [store, setStore] = createStore({
274
+ themes: DEFAULT_THEMES,
275
+ mode: kv.get("theme_mode", props.mode),
276
+ active: (sync.data.config.theme ?? kv.get("theme", "opencode")) as string,
277
+ ready: false,
278
+ })
279
+
280
+ createEffect(async () => {
281
+ const custom = await getCustomThemes()
282
+ setStore(
283
+ produce((draft) => {
284
+ Object.assign(draft.themes, custom)
285
+ draft.ready = true
286
+ }),
287
+ )
288
+ })
289
+
290
+ const renderer = useRenderer()
291
+ renderer
292
+ .getPalette({
293
+ size: 16,
294
+ })
295
+ .then((colors) => {
296
+ if (!colors.palette[0]) return
297
+ setStore("themes", "system", generateSystem(colors, store.mode))
298
+ })
299
+
300
+ const values = createMemo(() => {
301
+ return resolveTheme(store.themes[store.active] ?? store.themes.opencode, store.mode)
302
+ })
303
+
304
+ const syntax = createMemo(() => generateSyntax(values()))
305
+ const subtleSyntax = createMemo(() => generateSubtleSyntax(values()))
306
+
307
+ return {
308
+ theme: new Proxy(values(), {
309
+ get(_target, prop) {
310
+ // @ts-expect-error
311
+ return values()[prop]
312
+ },
313
+ }),
314
+ get selected() {
315
+ return store.active
316
+ },
317
+ all() {
318
+ return store.themes
319
+ },
320
+ syntax,
321
+ subtleSyntax,
322
+ mode() {
323
+ return store.mode
324
+ },
325
+ setMode(mode: "dark" | "light") {
326
+ setStore("mode", mode)
327
+ kv.set("theme_mode", mode)
328
+ },
329
+ set(theme: string) {
330
+ setStore("active", theme)
331
+ kv.set("theme", theme)
332
+ },
333
+ get ready() {
334
+ return store.ready
335
+ },
336
+ }
337
+ },
338
+ })
339
+
340
+ const CUSTOM_THEME_GLOB = new Bun.Glob("themes/*.json")
341
+ async function getCustomThemes() {
342
+ const directories = [
343
+ Global.Path.config,
344
+ ...(await Array.fromAsync(
345
+ Filesystem.up({
346
+ targets: [".opencode"],
347
+ start: process.cwd(),
348
+ }),
349
+ )),
350
+ ]
351
+
352
+ const result: Record<string, ThemeJson> = {}
353
+ for (const dir of directories) {
354
+ for await (const item of CUSTOM_THEME_GLOB.scan({
355
+ absolute: true,
356
+ followSymlinks: true,
357
+ dot: true,
358
+ cwd: dir,
359
+ })) {
360
+ const name = path.basename(item, ".json")
361
+ result[name] = await Bun.file(item).json()
362
+ }
363
+ }
364
+ return result
365
+ }
366
+
367
+ function generateSystem(colors: TerminalColors, mode: "dark" | "light"): ThemeJson {
368
+ const bg = RGBA.fromHex(colors.defaultBackground ?? colors.palette[0]!)
369
+ const fg = RGBA.fromHex(colors.defaultForeground ?? colors.palette[7]!)
370
+ const palette = colors.palette.filter((x) => x !== null).map((x) => RGBA.fromHex(x))
371
+ const isDark = mode == "dark"
372
+
373
+ // Generate gray scale based on terminal background
374
+ const grays = generateGrayScale(bg, isDark)
375
+ const textMuted = generateMutedTextColor(bg, isDark)
376
+
377
+ // ANSI color references
378
+ const ansiColors = {
379
+ black: palette[0],
380
+ red: palette[1],
381
+ green: palette[2],
382
+ yellow: palette[3],
383
+ blue: palette[4],
384
+ magenta: palette[5],
385
+ cyan: palette[6],
386
+ white: palette[7],
387
+ }
388
+
389
+ return {
390
+ theme: {
391
+ // Primary colors using ANSI
392
+ primary: ansiColors.cyan,
393
+ secondary: ansiColors.magenta,
394
+ accent: ansiColors.cyan,
395
+
396
+ // Status colors using ANSI
397
+ error: ansiColors.red,
398
+ warning: ansiColors.yellow,
399
+ success: ansiColors.green,
400
+ info: ansiColors.cyan,
401
+
402
+ // Text colors
403
+ text: fg,
404
+ textMuted,
405
+ selectedListItemText: bg,
406
+
407
+ // Background colors
408
+ background: bg,
409
+ backgroundPanel: grays[2],
410
+ backgroundElement: grays[3],
411
+ backgroundMenu: grays[3],
412
+
413
+ // Border colors
414
+ borderSubtle: grays[6],
415
+ border: grays[7],
416
+ borderActive: grays[8],
417
+
418
+ // Diff colors
419
+ diffAdded: ansiColors.green,
420
+ diffRemoved: ansiColors.red,
421
+ diffContext: grays[7],
422
+ diffHunkHeader: grays[7],
423
+ diffHighlightAdded: ansiColors.green,
424
+ diffHighlightRemoved: ansiColors.red,
425
+ diffAddedBg: grays[2],
426
+ diffRemovedBg: grays[2],
427
+ diffContextBg: grays[1],
428
+ diffLineNumber: grays[6],
429
+ diffAddedLineNumberBg: grays[3],
430
+ diffRemovedLineNumberBg: grays[3],
431
+
432
+ // Markdown colors
433
+ markdownText: fg,
434
+ markdownHeading: fg,
435
+ markdownLink: ansiColors.blue,
436
+ markdownLinkText: ansiColors.cyan,
437
+ markdownCode: ansiColors.green,
438
+ markdownBlockQuote: ansiColors.yellow,
439
+ markdownEmph: ansiColors.yellow,
440
+ markdownStrong: fg,
441
+ markdownHorizontalRule: grays[7],
442
+ markdownListItem: ansiColors.blue,
443
+ markdownListEnumeration: ansiColors.cyan,
444
+ markdownImage: ansiColors.blue,
445
+ markdownImageText: ansiColors.cyan,
446
+ markdownCodeBlock: fg,
447
+
448
+ // Syntax colors
449
+ syntaxComment: textMuted,
450
+ syntaxKeyword: ansiColors.magenta,
451
+ syntaxFunction: ansiColors.blue,
452
+ syntaxVariable: fg,
453
+ syntaxString: ansiColors.green,
454
+ syntaxNumber: ansiColors.yellow,
455
+ syntaxType: ansiColors.cyan,
456
+ syntaxOperator: ansiColors.cyan,
457
+ syntaxPunctuation: fg,
458
+ },
459
+ }
460
+ }
461
+
462
+ function generateGrayScale(bg: RGBA, isDark: boolean): Record<number, RGBA> {
463
+ const grays: Record<number, RGBA> = {}
464
+
465
+ // RGBA stores floats in range 0-1, convert to 0-255
466
+ const bgR = bg.r * 255
467
+ const bgG = bg.g * 255
468
+ const bgB = bg.b * 255
469
+
470
+ const luminance = 0.299 * bgR + 0.587 * bgG + 0.114 * bgB
471
+
472
+ for (let i = 1; i <= 12; i++) {
473
+ const factor = i / 12.0
474
+
475
+ let grayValue: number
476
+ let newR: number
477
+ let newG: number
478
+ let newB: number
479
+
480
+ if (isDark) {
481
+ if (luminance < 10) {
482
+ grayValue = Math.floor(factor * 0.4 * 255)
483
+ newR = grayValue
484
+ newG = grayValue
485
+ newB = grayValue
486
+ } else {
487
+ const newLum = luminance + (255 - luminance) * factor * 0.4
488
+
489
+ const ratio = newLum / luminance
490
+ newR = Math.min(bgR * ratio, 255)
491
+ newG = Math.min(bgG * ratio, 255)
492
+ newB = Math.min(bgB * ratio, 255)
493
+ }
494
+ } else {
495
+ if (luminance > 245) {
496
+ grayValue = Math.floor(255 - factor * 0.4 * 255)
497
+ newR = grayValue
498
+ newG = grayValue
499
+ newB = grayValue
500
+ } else {
501
+ const newLum = luminance * (1 - factor * 0.4)
502
+
503
+ const ratio = newLum / luminance
504
+ newR = Math.max(bgR * ratio, 0)
505
+ newG = Math.max(bgG * ratio, 0)
506
+ newB = Math.max(bgB * ratio, 0)
507
+ }
508
+ }
509
+
510
+ grays[i] = RGBA.fromInts(Math.floor(newR), Math.floor(newG), Math.floor(newB))
511
+ }
512
+
513
+ return grays
514
+ }
515
+
516
+ function generateMutedTextColor(bg: RGBA, isDark: boolean): RGBA {
517
+ // RGBA stores floats in range 0-1, convert to 0-255
518
+ const bgR = bg.r * 255
519
+ const bgG = bg.g * 255
520
+ const bgB = bg.b * 255
521
+
522
+ const bgLum = 0.299 * bgR + 0.587 * bgG + 0.114 * bgB
523
+
524
+ let grayValue: number
525
+
526
+ if (isDark) {
527
+ if (bgLum < 10) {
528
+ // Very dark/black background
529
+ grayValue = 180 // #b4b4b4
530
+ } else {
531
+ // Scale up for lighter dark backgrounds
532
+ grayValue = Math.min(Math.floor(160 + bgLum * 0.3), 200)
533
+ }
534
+ } else {
535
+ if (bgLum > 245) {
536
+ // Very light/white background
537
+ grayValue = 75 // #4b4b4b
538
+ } else {
539
+ // Scale down for darker light backgrounds
540
+ grayValue = Math.max(Math.floor(100 - (255 - bgLum) * 0.2), 60)
541
+ }
542
+ }
543
+
544
+ return RGBA.fromInts(grayValue, grayValue, grayValue)
545
+ }
546
+
547
+ function generateSyntax(theme: Theme) {
548
+ return SyntaxStyle.fromTheme(getSyntaxRules(theme))
549
+ }
550
+
551
+ function generateSubtleSyntax(theme: Theme) {
552
+ const rules = getSyntaxRules(theme)
553
+ return SyntaxStyle.fromTheme(
554
+ rules.map((rule) => {
555
+ if (rule.style.foreground) {
556
+ const fg = rule.style.foreground
557
+ return {
558
+ ...rule,
559
+ style: {
560
+ ...rule.style,
561
+ foreground: RGBA.fromInts(
562
+ Math.round(fg.r * 255),
563
+ Math.round(fg.g * 255),
564
+ Math.round(fg.b * 255),
565
+ Math.round(theme.thinkingOpacity * 255),
566
+ ),
567
+ },
568
+ }
569
+ }
570
+ return rule
571
+ }),
572
+ )
573
+ }
574
+
575
+ function getSyntaxRules(theme: Theme) {
576
+ return [
577
+ {
578
+ scope: ["default"],
579
+ style: {
580
+ foreground: theme.text,
581
+ },
582
+ },
583
+ {
584
+ scope: ["prompt"],
585
+ style: {
586
+ foreground: theme.accent,
587
+ },
588
+ },
589
+ {
590
+ scope: ["extmark.file"],
591
+ style: {
592
+ foreground: theme.warning,
593
+ bold: true,
594
+ },
595
+ },
596
+ {
597
+ scope: ["extmark.agent"],
598
+ style: {
599
+ foreground: theme.secondary,
600
+ bold: true,
601
+ },
602
+ },
603
+ {
604
+ scope: ["extmark.paste"],
605
+ style: {
606
+ foreground: theme.background,
607
+ background: theme.warning,
608
+ bold: true,
609
+ },
610
+ },
611
+ {
612
+ scope: ["comment"],
613
+ style: {
614
+ foreground: theme.syntaxComment,
615
+ italic: true,
616
+ },
617
+ },
618
+ {
619
+ scope: ["comment.documentation"],
620
+ style: {
621
+ foreground: theme.syntaxComment,
622
+ italic: true,
623
+ },
624
+ },
625
+ {
626
+ scope: ["string", "symbol"],
627
+ style: {
628
+ foreground: theme.syntaxString,
629
+ },
630
+ },
631
+ {
632
+ scope: ["number", "boolean"],
633
+ style: {
634
+ foreground: theme.syntaxNumber,
635
+ },
636
+ },
637
+ {
638
+ scope: ["character.special"],
639
+ style: {
640
+ foreground: theme.syntaxString,
641
+ },
642
+ },
643
+ {
644
+ scope: ["keyword.return", "keyword.conditional", "keyword.repeat", "keyword.coroutine"],
645
+ style: {
646
+ foreground: theme.syntaxKeyword,
647
+ italic: true,
648
+ },
649
+ },
650
+ {
651
+ scope: ["keyword.type"],
652
+ style: {
653
+ foreground: theme.syntaxType,
654
+ bold: true,
655
+ italic: true,
656
+ },
657
+ },
658
+ {
659
+ scope: ["keyword.function", "function.method"],
660
+ style: {
661
+ foreground: theme.syntaxFunction,
662
+ },
663
+ },
664
+ {
665
+ scope: ["keyword"],
666
+ style: {
667
+ foreground: theme.syntaxKeyword,
668
+ italic: true,
669
+ },
670
+ },
671
+ {
672
+ scope: ["keyword.import"],
673
+ style: {
674
+ foreground: theme.syntaxKeyword,
675
+ },
676
+ },
677
+ {
678
+ scope: ["operator", "keyword.operator", "punctuation.delimiter"],
679
+ style: {
680
+ foreground: theme.syntaxOperator,
681
+ },
682
+ },
683
+ {
684
+ scope: ["keyword.conditional.ternary"],
685
+ style: {
686
+ foreground: theme.syntaxOperator,
687
+ },
688
+ },
689
+ {
690
+ scope: ["variable", "variable.parameter", "function.method.call", "function.call"],
691
+ style: {
692
+ foreground: theme.syntaxVariable,
693
+ },
694
+ },
695
+ {
696
+ scope: ["variable.member", "function", "constructor"],
697
+ style: {
698
+ foreground: theme.syntaxFunction,
699
+ },
700
+ },
701
+ {
702
+ scope: ["type", "module"],
703
+ style: {
704
+ foreground: theme.syntaxType,
705
+ },
706
+ },
707
+ {
708
+ scope: ["constant"],
709
+ style: {
710
+ foreground: theme.syntaxNumber,
711
+ },
712
+ },
713
+ {
714
+ scope: ["property"],
715
+ style: {
716
+ foreground: theme.syntaxVariable,
717
+ },
718
+ },
719
+ {
720
+ scope: ["class"],
721
+ style: {
722
+ foreground: theme.syntaxType,
723
+ },
724
+ },
725
+ {
726
+ scope: ["parameter"],
727
+ style: {
728
+ foreground: theme.syntaxVariable,
729
+ },
730
+ },
731
+ {
732
+ scope: ["punctuation", "punctuation.bracket"],
733
+ style: {
734
+ foreground: theme.syntaxPunctuation,
735
+ },
736
+ },
737
+ {
738
+ scope: ["variable.builtin", "type.builtin", "function.builtin", "module.builtin", "constant.builtin"],
739
+ style: {
740
+ foreground: theme.error,
741
+ },
742
+ },
743
+ {
744
+ scope: ["variable.super"],
745
+ style: {
746
+ foreground: theme.error,
747
+ },
748
+ },
749
+ {
750
+ scope: ["string.escape", "string.regexp"],
751
+ style: {
752
+ foreground: theme.syntaxKeyword,
753
+ },
754
+ },
755
+ {
756
+ scope: ["keyword.directive"],
757
+ style: {
758
+ foreground: theme.syntaxKeyword,
759
+ italic: true,
760
+ },
761
+ },
762
+ {
763
+ scope: ["punctuation.special"],
764
+ style: {
765
+ foreground: theme.syntaxOperator,
766
+ },
767
+ },
768
+ {
769
+ scope: ["keyword.modifier"],
770
+ style: {
771
+ foreground: theme.syntaxKeyword,
772
+ italic: true,
773
+ },
774
+ },
775
+ {
776
+ scope: ["keyword.exception"],
777
+ style: {
778
+ foreground: theme.syntaxKeyword,
779
+ italic: true,
780
+ },
781
+ },
782
+ // Markdown specific styles
783
+ {
784
+ scope: ["markup.heading"],
785
+ style: {
786
+ foreground: theme.markdownHeading,
787
+ bold: true,
788
+ },
789
+ },
790
+ {
791
+ scope: ["markup.heading.1"],
792
+ style: {
793
+ foreground: theme.markdownHeading,
794
+ bold: true,
795
+ },
796
+ },
797
+ {
798
+ scope: ["markup.heading.2"],
799
+ style: {
800
+ foreground: theme.markdownHeading,
801
+ bold: true,
802
+ },
803
+ },
804
+ {
805
+ scope: ["markup.heading.3"],
806
+ style: {
807
+ foreground: theme.markdownHeading,
808
+ bold: true,
809
+ },
810
+ },
811
+ {
812
+ scope: ["markup.heading.4"],
813
+ style: {
814
+ foreground: theme.markdownHeading,
815
+ bold: true,
816
+ },
817
+ },
818
+ {
819
+ scope: ["markup.heading.5"],
820
+ style: {
821
+ foreground: theme.markdownHeading,
822
+ bold: true,
823
+ },
824
+ },
825
+ {
826
+ scope: ["markup.heading.6"],
827
+ style: {
828
+ foreground: theme.markdownHeading,
829
+ bold: true,
830
+ },
831
+ },
832
+ {
833
+ scope: ["markup.bold", "markup.strong"],
834
+ style: {
835
+ foreground: theme.markdownStrong,
836
+ bold: true,
837
+ },
838
+ },
839
+ {
840
+ scope: ["markup.italic"],
841
+ style: {
842
+ foreground: theme.markdownEmph,
843
+ italic: true,
844
+ },
845
+ },
846
+ {
847
+ scope: ["markup.list"],
848
+ style: {
849
+ foreground: theme.markdownListItem,
850
+ },
851
+ },
852
+ {
853
+ scope: ["markup.quote"],
854
+ style: {
855
+ foreground: theme.markdownBlockQuote,
856
+ italic: true,
857
+ },
858
+ },
859
+ {
860
+ scope: ["markup.raw", "markup.raw.block"],
861
+ style: {
862
+ foreground: theme.markdownCode,
863
+ },
864
+ },
865
+ {
866
+ scope: ["markup.raw.inline"],
867
+ style: {
868
+ foreground: theme.markdownCode,
869
+ background: theme.background,
870
+ },
871
+ },
872
+ {
873
+ scope: ["markup.link"],
874
+ style: {
875
+ foreground: theme.markdownLink,
876
+ underline: true,
877
+ },
878
+ },
879
+ {
880
+ scope: ["markup.link.label"],
881
+ style: {
882
+ foreground: theme.markdownLinkText,
883
+ underline: true,
884
+ },
885
+ },
886
+ {
887
+ scope: ["markup.link.url"],
888
+ style: {
889
+ foreground: theme.markdownLink,
890
+ underline: true,
891
+ },
892
+ },
893
+ {
894
+ scope: ["label"],
895
+ style: {
896
+ foreground: theme.markdownLinkText,
897
+ },
898
+ },
899
+ {
900
+ scope: ["spell", "nospell"],
901
+ style: {
902
+ foreground: theme.text,
903
+ },
904
+ },
905
+ {
906
+ scope: ["conceal"],
907
+ style: {
908
+ foreground: theme.textMuted,
909
+ },
910
+ },
911
+ // Additional common highlight groups
912
+ {
913
+ scope: ["string.special", "string.special.url"],
914
+ style: {
915
+ foreground: theme.markdownLink,
916
+ underline: true,
917
+ },
918
+ },
919
+ {
920
+ scope: ["character"],
921
+ style: {
922
+ foreground: theme.syntaxString,
923
+ },
924
+ },
925
+ {
926
+ scope: ["float"],
927
+ style: {
928
+ foreground: theme.syntaxNumber,
929
+ },
930
+ },
931
+ {
932
+ scope: ["comment.error"],
933
+ style: {
934
+ foreground: theme.error,
935
+ italic: true,
936
+ bold: true,
937
+ },
938
+ },
939
+ {
940
+ scope: ["comment.warning"],
941
+ style: {
942
+ foreground: theme.warning,
943
+ italic: true,
944
+ bold: true,
945
+ },
946
+ },
947
+ {
948
+ scope: ["comment.todo", "comment.note"],
949
+ style: {
950
+ foreground: theme.info,
951
+ italic: true,
952
+ bold: true,
953
+ },
954
+ },
955
+ {
956
+ scope: ["namespace"],
957
+ style: {
958
+ foreground: theme.syntaxType,
959
+ },
960
+ },
961
+ {
962
+ scope: ["field"],
963
+ style: {
964
+ foreground: theme.syntaxVariable,
965
+ },
966
+ },
967
+ {
968
+ scope: ["type.definition"],
969
+ style: {
970
+ foreground: theme.syntaxType,
971
+ bold: true,
972
+ },
973
+ },
974
+ {
975
+ scope: ["keyword.export"],
976
+ style: {
977
+ foreground: theme.syntaxKeyword,
978
+ },
979
+ },
980
+ {
981
+ scope: ["attribute", "annotation"],
982
+ style: {
983
+ foreground: theme.warning,
984
+ },
985
+ },
986
+ {
987
+ scope: ["tag"],
988
+ style: {
989
+ foreground: theme.error,
990
+ },
991
+ },
992
+ {
993
+ scope: ["tag.attribute"],
994
+ style: {
995
+ foreground: theme.syntaxKeyword,
996
+ },
997
+ },
998
+ {
999
+ scope: ["tag.delimiter"],
1000
+ style: {
1001
+ foreground: theme.syntaxOperator,
1002
+ },
1003
+ },
1004
+ {
1005
+ scope: ["markup.strikethrough"],
1006
+ style: {
1007
+ foreground: theme.textMuted,
1008
+ },
1009
+ },
1010
+ {
1011
+ scope: ["markup.underline"],
1012
+ style: {
1013
+ foreground: theme.text,
1014
+ underline: true,
1015
+ },
1016
+ },
1017
+ {
1018
+ scope: ["markup.list.checked"],
1019
+ style: {
1020
+ foreground: theme.success,
1021
+ },
1022
+ },
1023
+ {
1024
+ scope: ["markup.list.unchecked"],
1025
+ style: {
1026
+ foreground: theme.textMuted,
1027
+ },
1028
+ },
1029
+ {
1030
+ scope: ["diff.plus"],
1031
+ style: {
1032
+ foreground: theme.diffAdded,
1033
+ background: theme.diffAddedBg,
1034
+ },
1035
+ },
1036
+ {
1037
+ scope: ["diff.minus"],
1038
+ style: {
1039
+ foreground: theme.diffRemoved,
1040
+ background: theme.diffRemovedBg,
1041
+ },
1042
+ },
1043
+ {
1044
+ scope: ["diff.delta"],
1045
+ style: {
1046
+ foreground: theme.diffContext,
1047
+ background: theme.diffContextBg,
1048
+ },
1049
+ },
1050
+ {
1051
+ scope: ["error"],
1052
+ style: {
1053
+ foreground: theme.error,
1054
+ bold: true,
1055
+ },
1056
+ },
1057
+ {
1058
+ scope: ["warning"],
1059
+ style: {
1060
+ foreground: theme.warning,
1061
+ bold: true,
1062
+ },
1063
+ },
1064
+ {
1065
+ scope: ["info"],
1066
+ style: {
1067
+ foreground: theme.info,
1068
+ },
1069
+ },
1070
+ {
1071
+ scope: ["debug"],
1072
+ style: {
1073
+ foreground: theme.textMuted,
1074
+ },
1075
+ },
1076
+ ]
1077
+ }