nikcli 0.0.6

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 (602) hide show
  1. package/.turbo/turbo-typecheck.log +1 -0
  2. package/AGENTS.md +27 -0
  3. package/Dockerfile +18 -0
  4. package/README.md +15 -0
  5. package/bin/nikcli +84 -0
  6. package/config.json +13 -0
  7. package/docs/tailscale-mobile/01-tailscale-setup.md +94 -0
  8. package/docs/tailscale-mobile/02-host-setup.md +115 -0
  9. package/docs/tailscale-mobile/03-phone-and-serve.md +134 -0
  10. package/docs/tailscale-mobile/README.md +59 -0
  11. package/examples/README.md +54 -0
  12. package/package.json +147 -0
  13. package/parsers-config.ts +253 -0
  14. package/script/build.ts +179 -0
  15. package/script/postinstall.mjs +125 -0
  16. package/script/publish-registries.ts +187 -0
  17. package/script/publish.ts +100 -0
  18. package/script/schema.ts +47 -0
  19. package/script/seed-e2e.ts +50 -0
  20. package/sequential-prancing-forest.md +373 -0
  21. package/src/acp/README.md +164 -0
  22. package/src/acp/agent.ts +1303 -0
  23. package/src/acp/session.ts +105 -0
  24. package/src/acp/types.ts +22 -0
  25. package/src/agent/agent.ts +528 -0
  26. package/src/agent/generate.txt +32 -0
  27. package/src/agent/prompt/compaction.txt +14 -0
  28. package/src/agent/prompt/explore.txt +18 -0
  29. package/src/agent/prompt/summary.txt +11 -0
  30. package/src/agent/prompt/title.txt +44 -0
  31. package/src/auth/index.ts +73 -0
  32. package/src/bun/index.ts +119 -0
  33. package/src/bun/registry.ts +54 -0
  34. package/src/bus/bus-event.ts +43 -0
  35. package/src/bus/global.ts +10 -0
  36. package/src/bus/index.ts +105 -0
  37. package/src/chatbot/handlers.ts +150 -0
  38. package/src/chatbot/index.ts +132 -0
  39. package/src/cli/bootstrap.ts +17 -0
  40. package/src/cli/cmd/acp.ts +69 -0
  41. package/src/cli/cmd/ads.ts +377 -0
  42. package/src/cli/cmd/agent.ts +259 -0
  43. package/src/cli/cmd/auth.ts +400 -0
  44. package/src/cli/cmd/chatbot.ts +420 -0
  45. package/src/cli/cmd/cmd.ts +7 -0
  46. package/src/cli/cmd/companion.ts +81 -0
  47. package/src/cli/cmd/connectors.ts +593 -0
  48. package/src/cli/cmd/debug/agent.ts +166 -0
  49. package/src/cli/cmd/debug/config.ts +16 -0
  50. package/src/cli/cmd/debug/file.ts +97 -0
  51. package/src/cli/cmd/debug/index.ts +48 -0
  52. package/src/cli/cmd/debug/lsp.ts +52 -0
  53. package/src/cli/cmd/debug/ripgrep.ts +87 -0
  54. package/src/cli/cmd/debug/scrap.ts +16 -0
  55. package/src/cli/cmd/debug/skill.ts +16 -0
  56. package/src/cli/cmd/debug/snapshot.ts +52 -0
  57. package/src/cli/cmd/export.ts +88 -0
  58. package/src/cli/cmd/generate.ts +38 -0
  59. package/src/cli/cmd/github.ts +412 -0
  60. package/src/cli/cmd/image-model.ts +128 -0
  61. package/src/cli/cmd/import.ts +201 -0
  62. package/src/cli/cmd/lovable.ts +128 -0
  63. package/src/cli/cmd/mcp.ts +738 -0
  64. package/src/cli/cmd/mobile.ts +223 -0
  65. package/src/cli/cmd/models.ts +77 -0
  66. package/src/cli/cmd/plug.ts +231 -0
  67. package/src/cli/cmd/pr.ts +104 -0
  68. package/src/cli/cmd/rag-model.ts +167 -0
  69. package/src/cli/cmd/remote.ts +416 -0
  70. package/src/cli/cmd/run.ts +589 -0
  71. package/src/cli/cmd/serve.ts +51 -0
  72. package/src/cli/cmd/session.ts +133 -0
  73. package/src/cli/cmd/speak-model.ts +204 -0
  74. package/src/cli/cmd/stats.ts +402 -0
  75. package/src/cli/cmd/tui/app.tsx +841 -0
  76. package/src/cli/cmd/tui/attach.ts +31 -0
  77. package/src/cli/cmd/tui/component/border.tsx +75 -0
  78. package/src/cli/cmd/tui/component/dialog-agent.tsx +31 -0
  79. package/src/cli/cmd/tui/component/dialog-command.tsx +172 -0
  80. package/src/cli/cmd/tui/component/dialog-config.tsx +291 -0
  81. package/src/cli/cmd/tui/component/dialog-connectors.tsx +440 -0
  82. package/src/cli/cmd/tui/component/dialog-image-model.tsx +97 -0
  83. package/src/cli/cmd/tui/component/dialog-mcp.tsx +86 -0
  84. package/src/cli/cmd/tui/component/dialog-model.tsx +234 -0
  85. package/src/cli/cmd/tui/component/dialog-provider.tsx +260 -0
  86. package/src/cli/cmd/tui/component/dialog-rag-model.tsx +217 -0
  87. package/src/cli/cmd/tui/component/dialog-remote.tsx +489 -0
  88. package/src/cli/cmd/tui/component/dialog-session-list.tsx +170 -0
  89. package/src/cli/cmd/tui/component/dialog-session-rename.tsx +31 -0
  90. package/src/cli/cmd/tui/component/dialog-settings/index.tsx +59 -0
  91. package/src/cli/cmd/tui/component/dialog-settings/prompt.tsx +40 -0
  92. package/src/cli/cmd/tui/component/dialog-settings/sidebar.tsx +39 -0
  93. package/src/cli/cmd/tui/component/dialog-settings/spinner.tsx +62 -0
  94. package/src/cli/cmd/tui/component/dialog-settings/ui.tsx +58 -0
  95. package/src/cli/cmd/tui/component/dialog-skills.tsx +117 -0
  96. package/src/cli/cmd/tui/component/dialog-speak-model.tsx +304 -0
  97. package/src/cli/cmd/tui/component/dialog-stash.tsx +87 -0
  98. package/src/cli/cmd/tui/component/dialog-status.tsx +165 -0
  99. package/src/cli/cmd/tui/component/dialog-tag.tsx +44 -0
  100. package/src/cli/cmd/tui/component/dialog-theme-create.tsx +717 -0
  101. package/src/cli/cmd/tui/component/dialog-theme-list.tsx +52 -0
  102. package/src/cli/cmd/tui/component/dialog-workspace-list.tsx +350 -0
  103. package/src/cli/cmd/tui/component/error-component.tsx +91 -0
  104. package/src/cli/cmd/tui/component/logo.tsx +103 -0
  105. package/src/cli/cmd/tui/component/plugin-route-missing.tsx +14 -0
  106. package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +669 -0
  107. package/src/cli/cmd/tui/component/prompt/frecency.tsx +89 -0
  108. package/src/cli/cmd/tui/component/prompt/history.tsx +108 -0
  109. package/src/cli/cmd/tui/component/prompt/index.tsx +2165 -0
  110. package/src/cli/cmd/tui/component/prompt/stash.tsx +63 -0
  111. package/src/cli/cmd/tui/component/spinner.tsx +24 -0
  112. package/src/cli/cmd/tui/component/startup-loading.tsx +63 -0
  113. package/src/cli/cmd/tui/component/table/markdown-table.tsx +267 -0
  114. package/src/cli/cmd/tui/component/table-db/db/connections.ts +75 -0
  115. package/src/cli/cmd/tui/component/table-db/db/db-connection.ts +223 -0
  116. package/src/cli/cmd/tui/component/table-db/db/db-preview.ts +202 -0
  117. package/src/cli/cmd/tui/component/table-db/db/factory.ts +77 -0
  118. package/src/cli/cmd/tui/component/table-db/db/index.ts +9 -0
  119. package/src/cli/cmd/tui/component/table-db/db/mysql-connection.ts +330 -0
  120. package/src/cli/cmd/tui/component/table-db/db/postgres-connection.ts +338 -0
  121. package/src/cli/cmd/tui/component/table-db/db/sqlite-connection.ts +302 -0
  122. package/src/cli/cmd/tui/component/table-db/db/types.ts +108 -0
  123. package/src/cli/cmd/tui/component/table-db/table/dbedit-hooks.ts +74 -0
  124. package/src/cli/cmd/tui/component/table-db/table/index.ts +15 -0
  125. package/src/cli/cmd/tui/component/table-db/table/table-events.ts +54 -0
  126. package/src/cli/cmd/tui/component/table-db/table/table-formatters.ts +191 -0
  127. package/src/cli/cmd/tui/component/table-db/table/table-hooks.ts +105 -0
  128. package/src/cli/cmd/tui/component/table-db/table/table-keyboard-handler.ts +255 -0
  129. package/src/cli/cmd/tui/component/table-db/table/table-layout-engine.ts +208 -0
  130. package/src/cli/cmd/tui/component/table-db/table/table-renderable.ts +486 -0
  131. package/src/cli/cmd/tui/component/table-db/table/table-selection-manager.ts +136 -0
  132. package/src/cli/cmd/tui/component/table-db/table/table-state.ts +198 -0
  133. package/src/cli/cmd/tui/component/table-db/table/types.ts +69 -0
  134. package/src/cli/cmd/tui/component/table-db/ui/db-visualizer.tsx +71 -0
  135. package/src/cli/cmd/tui/component/table-db/ui/index.ts +2 -0
  136. package/src/cli/cmd/tui/component/table-db/ui/table-renderer.ts +607 -0
  137. package/src/cli/cmd/tui/component/textarea-keybindings.ts +73 -0
  138. package/src/cli/cmd/tui/component/tips.tsx +195 -0
  139. package/src/cli/cmd/tui/component/todo-item.tsx +32 -0
  140. package/src/cli/cmd/tui/context/args.tsx +14 -0
  141. package/src/cli/cmd/tui/context/directory.ts +13 -0
  142. package/src/cli/cmd/tui/context/exit.tsx +24 -0
  143. package/src/cli/cmd/tui/context/helper.tsx +25 -0
  144. package/src/cli/cmd/tui/context/keybind.tsx +102 -0
  145. package/src/cli/cmd/tui/context/kv.tsx +52 -0
  146. package/src/cli/cmd/tui/context/local.tsx +458 -0
  147. package/src/cli/cmd/tui/context/plugin-keybinds.ts +41 -0
  148. package/src/cli/cmd/tui/context/prompt.tsx +18 -0
  149. package/src/cli/cmd/tui/context/route.tsx +54 -0
  150. package/src/cli/cmd/tui/context/sdk.tsx +128 -0
  151. package/src/cli/cmd/tui/context/server.tsx +8 -0
  152. package/src/cli/cmd/tui/context/sync.tsx +510 -0
  153. package/src/cli/cmd/tui/context/theme/abyss.json +233 -0
  154. package/src/cli/cmd/tui/context/theme/apple.json +235 -0
  155. package/src/cli/cmd/tui/context/theme/arctic.json +232 -0
  156. package/src/cli/cmd/tui/context/theme/aura.json +69 -0
  157. package/src/cli/cmd/tui/context/theme/ayu.json +80 -0
  158. package/src/cli/cmd/tui/context/theme/ayuai.json +229 -0
  159. package/src/cli/cmd/tui/context/theme/blood.json +229 -0
  160. package/src/cli/cmd/tui/context/theme/carbonfox.json +248 -0
  161. package/src/cli/cmd/tui/context/theme/catmoe.json +235 -0
  162. package/src/cli/cmd/tui/context/theme/catppuccin-frappe.json +233 -0
  163. package/src/cli/cmd/tui/context/theme/catppuccin-latte.json +233 -0
  164. package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +233 -0
  165. package/src/cli/cmd/tui/context/theme/catppuccin.json +259 -0
  166. package/src/cli/cmd/tui/context/theme/charcoal.json +230 -0
  167. package/src/cli/cmd/tui/context/theme/chromatic.json +235 -0
  168. package/src/cli/cmd/tui/context/theme/cobalt2.json +228 -0
  169. package/src/cli/cmd/tui/context/theme/cosmic.json +234 -0
  170. package/src/cli/cmd/tui/context/theme/cursor.json +249 -0
  171. package/src/cli/cmd/tui/context/theme/cyber.json +235 -0
  172. package/src/cli/cmd/tui/context/theme/dawnfox.json +229 -0
  173. package/src/cli/cmd/tui/context/theme/dimension.json +235 -0
  174. package/src/cli/cmd/tui/context/theme/dracula-official.json +222 -0
  175. package/src/cli/cmd/tui/context/theme/dracula.json +219 -0
  176. package/src/cli/cmd/tui/context/theme/dream.json +235 -0
  177. package/src/cli/cmd/tui/context/theme/duo.json +235 -0
  178. package/src/cli/cmd/tui/context/theme/dusk.json +235 -0
  179. package/src/cli/cmd/tui/context/theme/ebony.json +232 -0
  180. package/src/cli/cmd/tui/context/theme/equilibrium.json +232 -0
  181. package/src/cli/cmd/tui/context/theme/ethereal.json +235 -0
  182. package/src/cli/cmd/tui/context/theme/everforest.json +241 -0
  183. package/src/cli/cmd/tui/context/theme/flexoki.json +237 -0
  184. package/src/cli/cmd/tui/context/theme/fusion.json +235 -0
  185. package/src/cli/cmd/tui/context/theme/ghost.json +235 -0
  186. package/src/cli/cmd/tui/context/theme/github-dark.json +229 -0
  187. package/src/cli/cmd/tui/context/theme/github-dimmed.json +231 -0
  188. package/src/cli/cmd/tui/context/theme/github-light.json +229 -0
  189. package/src/cli/cmd/tui/context/theme/github.json +233 -0
  190. package/src/cli/cmd/tui/context/theme/glass.json +235 -0
  191. package/src/cli/cmd/tui/context/theme/gold.json +235 -0
  192. package/src/cli/cmd/tui/context/theme/gone.json +234 -0
  193. package/src/cli/cmd/tui/context/theme/greyscale.json +229 -0
  194. package/src/cli/cmd/tui/context/theme/gruvbox.json +242 -0
  195. package/src/cli/cmd/tui/context/theme/hacker.json +229 -0
  196. package/src/cli/cmd/tui/context/theme/holo.json +235 -0
  197. package/src/cli/cmd/tui/context/theme/ink.json +235 -0
  198. package/src/cli/cmd/tui/context/theme/jet.json +233 -0
  199. package/src/cli/cmd/tui/context/theme/kanagawa.json +227 -0
  200. package/src/cli/cmd/tui/context/theme/lavender.json +236 -0
  201. package/src/cli/cmd/tui/context/theme/lightph.json +235 -0
  202. package/src/cli/cmd/tui/context/theme/lucent-orng.json +237 -0
  203. package/src/cli/cmd/tui/context/theme/material-ocean.json +230 -0
  204. package/src/cli/cmd/tui/context/theme/material.json +235 -0
  205. package/src/cli/cmd/tui/context/theme/matrix.json +227 -0
  206. package/src/cli/cmd/tui/context/theme/mercury.json +245 -0
  207. package/src/cli/cmd/tui/context/theme/midnight.json +235 -0
  208. package/src/cli/cmd/tui/context/theme/modern.json +235 -0
  209. package/src/cli/cmd/tui/context/theme/monokai.json +221 -0
  210. package/src/cli/cmd/tui/context/theme/muted.json +229 -0
  211. package/src/cli/cmd/tui/context/theme/neon.json +229 -0
  212. package/src/cli/cmd/tui/context/theme/neonfusion.json +235 -0
  213. package/src/cli/cmd/tui/context/theme/neutral.json +235 -0
  214. package/src/cli/cmd/tui/context/theme/nightowl.json +221 -0
  215. package/src/cli/cmd/tui/context/theme/nikcli.json +245 -0
  216. package/src/cli/cmd/tui/context/theme/nord.json +223 -0
  217. package/src/cli/cmd/tui/context/theme/nordic.json +235 -0
  218. package/src/cli/cmd/tui/context/theme/nova.json +235 -0
  219. package/src/cli/cmd/tui/context/theme/obsidian.json +234 -0
  220. package/src/cli/cmd/tui/context/theme/one-dark.json +231 -0
  221. package/src/cli/cmd/tui/context/theme/one-pro.json +229 -0
  222. package/src/cli/cmd/tui/context/theme/onyx.json +233 -0
  223. package/src/cli/cmd/tui/context/theme/orng.json +249 -0
  224. package/src/cli/cmd/tui/context/theme/osaka-jade.json +240 -0
  225. package/src/cli/cmd/tui/context/theme/oxocarbon.json +229 -0
  226. package/src/cli/cmd/tui/context/theme/palenight.json +222 -0
  227. package/src/cli/cmd/tui/context/theme/poimandres.json +230 -0
  228. package/src/cli/cmd/tui/context/theme/prism.json +235 -0
  229. package/src/cli/cmd/tui/context/theme/radiant.json +235 -0
  230. package/src/cli/cmd/tui/context/theme/rosepine.json +234 -0
  231. package/src/cli/cmd/tui/context/theme/shadow.json +235 -0
  232. package/src/cli/cmd/tui/context/theme/silicon.json +235 -0
  233. package/src/cli/cmd/tui/context/theme/slate.json +233 -0
  234. package/src/cli/cmd/tui/context/theme/soft.json +235 -0
  235. package/src/cli/cmd/tui/context/theme/solarized.json +223 -0
  236. package/src/cli/cmd/tui/context/theme/spectrum.json +235 -0
  237. package/src/cli/cmd/tui/context/theme/starlight.json +233 -0
  238. package/src/cli/cmd/tui/context/theme/sunrise.json +235 -0
  239. package/src/cli/cmd/tui/context/theme/synthwave84.json +226 -0
  240. package/src/cli/cmd/tui/context/theme/tech.json +235 -0
  241. package/src/cli/cmd/tui/context/theme/tokyonight-storm.json +245 -0
  242. package/src/cli/cmd/tui/context/theme/tokyonight.json +243 -0
  243. package/src/cli/cmd/tui/context/theme/vapor.json +235 -0
  244. package/src/cli/cmd/tui/context/theme/vercel.json +245 -0
  245. package/src/cli/cmd/tui/context/theme/vesper.json +218 -0
  246. package/src/cli/cmd/tui/context/theme/vivid.json +232 -0
  247. package/src/cli/cmd/tui/context/theme/void.json +235 -0
  248. package/src/cli/cmd/tui/context/theme/vscode.json +235 -0
  249. package/src/cli/cmd/tui/context/theme/zenburn.json +223 -0
  250. package/src/cli/cmd/tui/context/theme/zinc.json +236 -0
  251. package/src/cli/cmd/tui/context/theme.tsx +1303 -0
  252. package/src/cli/cmd/tui/event.ts +48 -0
  253. package/src/cli/cmd/tui/feature-plugins/home/tips-view.tsx +152 -0
  254. package/src/cli/cmd/tui/feature-plugins/home/tips.tsx +50 -0
  255. package/src/cli/cmd/tui/feature-plugins/sidebar/context.tsx +63 -0
  256. package/src/cli/cmd/tui/feature-plugins/sidebar/files.tsx +62 -0
  257. package/src/cli/cmd/tui/feature-plugins/sidebar/footer.tsx +93 -0
  258. package/src/cli/cmd/tui/feature-plugins/sidebar/lsp.tsx +66 -0
  259. package/src/cli/cmd/tui/feature-plugins/sidebar/mcp.tsx +96 -0
  260. package/src/cli/cmd/tui/feature-plugins/sidebar/todo.tsx +48 -0
  261. package/src/cli/cmd/tui/feature-plugins/system/plugins.tsx +288 -0
  262. package/src/cli/cmd/tui/plugin/api.tsx +407 -0
  263. package/src/cli/cmd/tui/plugin/index.ts +3 -0
  264. package/src/cli/cmd/tui/plugin/internal.ts +25 -0
  265. package/src/cli/cmd/tui/plugin/runtime.ts +1048 -0
  266. package/src/cli/cmd/tui/plugin/slots.tsx +61 -0
  267. package/src/cli/cmd/tui/routes/home.tsx +153 -0
  268. package/src/cli/cmd/tui/routes/session/dbedit.tsx +474 -0
  269. package/src/cli/cmd/tui/routes/session/dialog-fork-from-timeline.tsx +65 -0
  270. package/src/cli/cmd/tui/routes/session/dialog-message.tsx +110 -0
  271. package/src/cli/cmd/tui/routes/session/dialog-subagent.tsx +105 -0
  272. package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +47 -0
  273. package/src/cli/cmd/tui/routes/session/footer.tsx +75 -0
  274. package/src/cli/cmd/tui/routes/session/header.tsx +177 -0
  275. package/src/cli/cmd/tui/routes/session/index.tsx +2280 -0
  276. package/src/cli/cmd/tui/routes/session/permission.tsx +540 -0
  277. package/src/cli/cmd/tui/routes/session/question.tsx +435 -0
  278. package/src/cli/cmd/tui/routes/session/sidebar.tsx +313 -0
  279. package/src/cli/cmd/tui/thread.ts +174 -0
  280. package/src/cli/cmd/tui/ui/dialog-alert.tsx +57 -0
  281. package/src/cli/cmd/tui/ui/dialog-confirm.tsx +83 -0
  282. package/src/cli/cmd/tui/ui/dialog-export-options.tsx +204 -0
  283. package/src/cli/cmd/tui/ui/dialog-help.tsx +38 -0
  284. package/src/cli/cmd/tui/ui/dialog-prompt.tsx +102 -0
  285. package/src/cli/cmd/tui/ui/dialog-select.tsx +389 -0
  286. package/src/cli/cmd/tui/ui/dialog.tsx +180 -0
  287. package/src/cli/cmd/tui/ui/link.tsx +34 -0
  288. package/src/cli/cmd/tui/ui/spinner.ts +368 -0
  289. package/src/cli/cmd/tui/ui/toast.tsx +138 -0
  290. package/src/cli/cmd/tui/util/clipboard.ts +154 -0
  291. package/src/cli/cmd/tui/util/editor.ts +32 -0
  292. package/src/cli/cmd/tui/util/signal.ts +7 -0
  293. package/src/cli/cmd/tui/util/terminal.ts +114 -0
  294. package/src/cli/cmd/tui/util/transcript.ts +98 -0
  295. package/src/cli/cmd/tui/win32.ts +110 -0
  296. package/src/cli/cmd/tui/worker.ts +156 -0
  297. package/src/cli/cmd/uninstall.ts +357 -0
  298. package/src/cli/cmd/upgrade.ts +72 -0
  299. package/src/cli/cmd/web.ts +87 -0
  300. package/src/cli/cmd/workspace-serve.ts +16 -0
  301. package/src/cli/error.ts +57 -0
  302. package/src/cli/network.ts +55 -0
  303. package/src/cli/remote/index.ts +36 -0
  304. package/src/cli/remote/notifications.ts +104 -0
  305. package/src/cli/remote/qr-renderer.ts +86 -0
  306. package/src/cli/remote/remote-service.ts +757 -0
  307. package/src/cli/remote/session-manager.ts +284 -0
  308. package/src/cli/remote/subagent-hooks.ts +151 -0
  309. package/src/cli/remote/types.ts +121 -0
  310. package/src/cli/ui.ts +96 -0
  311. package/src/cli/upgrade.ts +25 -0
  312. package/src/command/index.ts +174 -0
  313. package/src/command/template/initialize.txt +10 -0
  314. package/src/command/template/review.txt +99 -0
  315. package/src/config/config.ts +1760 -0
  316. package/src/config/markdown.ts +88 -0
  317. package/src/config/migrate-tui-config.ts +155 -0
  318. package/src/config/paths.ts +174 -0
  319. package/src/config/tui-schema.ts +36 -0
  320. package/src/config/tui.ts +209 -0
  321. package/src/connectors/api/base.ts +75 -0
  322. package/src/connectors/api/figma.ts +103 -0
  323. package/src/connectors/api/github.ts +247 -0
  324. package/src/connectors/api/lovable.ts +126 -0
  325. package/src/connectors/api/slack.ts +137 -0
  326. package/src/connectors/auth.ts +68 -0
  327. package/src/connectors/cache.ts +119 -0
  328. package/src/connectors/credentials.ts +81 -0
  329. package/src/connectors/index.ts +202 -0
  330. package/src/connectors/registry.ts +358 -0
  331. package/src/docs/context.ts +120 -0
  332. package/src/docs/library.ts +189 -0
  333. package/src/env/index.ts +26 -0
  334. package/src/file/ignore.ts +83 -0
  335. package/src/file/index.ts +411 -0
  336. package/src/file/ripgrep.ts +402 -0
  337. package/src/file/time.ts +65 -0
  338. package/src/file/watcher.ts +127 -0
  339. package/src/flag/flag.ts +128 -0
  340. package/src/format/formatter.ts +356 -0
  341. package/src/format/index.ts +137 -0
  342. package/src/global/index.ts +57 -0
  343. package/src/id/id.ts +83 -0
  344. package/src/ide/index.ts +76 -0
  345. package/src/index.ts +184 -0
  346. package/src/installation/index.ts +246 -0
  347. package/src/lsp/client.ts +250 -0
  348. package/src/lsp/index.ts +483 -0
  349. package/src/lsp/language.ts +119 -0
  350. package/src/lsp/server.ts +2046 -0
  351. package/src/mcp/auth.ts +121 -0
  352. package/src/mcp/index.ts +860 -0
  353. package/src/mcp/oauth-callback.ts +198 -0
  354. package/src/mcp/oauth-provider.ts +148 -0
  355. package/src/mobile/auth.ts +97 -0
  356. package/src/mobile/github-repo.ts +185 -0
  357. package/src/patch/index.ts +631 -0
  358. package/src/permission/arity.ts +150 -0
  359. package/src/permission/dbedit.ts +236 -0
  360. package/src/permission/index.ts +210 -0
  361. package/src/permission/next.ts +287 -0
  362. package/src/plugin/codex.ts +493 -0
  363. package/src/plugin/copilot.ts +261 -0
  364. package/src/plugin/index.ts +714 -0
  365. package/src/plugin/install.ts +379 -0
  366. package/src/plugin/meta.ts +165 -0
  367. package/src/plugin/shared.ts +188 -0
  368. package/src/project/bootstrap.ts +35 -0
  369. package/src/project/instance.ts +84 -0
  370. package/src/project/project.ts +373 -0
  371. package/src/project/state.ts +66 -0
  372. package/src/project/vcs.ts +76 -0
  373. package/src/prompt/stash-store.ts +93 -0
  374. package/src/provider/auth.ts +147 -0
  375. package/src/provider/models-macro.ts +22 -0
  376. package/src/provider/models.ts +216 -0
  377. package/src/provider/provider.ts +1483 -0
  378. package/src/provider/sdk/openai-compatible/src/README.md +5 -0
  379. package/src/provider/sdk/openai-compatible/src/index.ts +2 -0
  380. package/src/provider/sdk/openai-compatible/src/openai-compatible-provider.ts +100 -0
  381. package/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts +303 -0
  382. package/src/provider/sdk/openai-compatible/src/responses/map-openai-responses-finish-reason.ts +22 -0
  383. package/src/provider/sdk/openai-compatible/src/responses/openai-config.ts +18 -0
  384. package/src/provider/sdk/openai-compatible/src/responses/openai-error.ts +22 -0
  385. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-api-types.ts +207 -0
  386. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts +1732 -0
  387. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-prepare-tools.ts +177 -0
  388. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-settings.ts +1 -0
  389. package/src/provider/sdk/openai-compatible/src/responses/tool/code-interpreter.ts +88 -0
  390. package/src/provider/sdk/openai-compatible/src/responses/tool/file-search.ts +128 -0
  391. package/src/provider/sdk/openai-compatible/src/responses/tool/image-generation.ts +115 -0
  392. package/src/provider/sdk/openai-compatible/src/responses/tool/local-shell.ts +65 -0
  393. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search-preview.ts +104 -0
  394. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search.ts +103 -0
  395. package/src/provider/transform.ts +828 -0
  396. package/src/pty/index.ts +241 -0
  397. package/src/question/index.ts +171 -0
  398. package/src/rag/chunk.ts +43 -0
  399. package/src/rag/embed.ts +179 -0
  400. package/src/rag/index.ts +376 -0
  401. package/src/rag/storage.ts +76 -0
  402. package/src/scheduler/index.ts +61 -0
  403. package/src/server/error.ts +36 -0
  404. package/src/server/event.ts +7 -0
  405. package/src/server/mdns.ts +59 -0
  406. package/src/server/routes/chatbot.ts +205 -0
  407. package/src/server/routes/companion.ts +729 -0
  408. package/src/server/routes/config.ts +92 -0
  409. package/src/server/routes/connectors.ts +121 -0
  410. package/src/server/routes/dbedit.ts +76 -0
  411. package/src/server/routes/experimental.ts +210 -0
  412. package/src/server/routes/file.ts +197 -0
  413. package/src/server/routes/global.ts +135 -0
  414. package/src/server/routes/mcp.ts +225 -0
  415. package/src/server/routes/mobile.ts +2044 -0
  416. package/src/server/routes/permission.ts +68 -0
  417. package/src/server/routes/project.ts +82 -0
  418. package/src/server/routes/provider.ts +235 -0
  419. package/src/server/routes/pty.ts +169 -0
  420. package/src/server/routes/question.ts +98 -0
  421. package/src/server/routes/session.ts +968 -0
  422. package/src/server/routes/tui.ts +379 -0
  423. package/src/server/routes/workspace.ts +104 -0
  424. package/src/server/server.ts +761 -0
  425. package/src/server/ssh.ts +207 -0
  426. package/src/session/auth.ts +402 -0
  427. package/src/session/compaction.ts +253 -0
  428. package/src/session/generate.ts +38 -0
  429. package/src/session/index.ts +598 -0
  430. package/src/session/llm.ts +273 -0
  431. package/src/session/message-v2.ts +836 -0
  432. package/src/session/message.ts +189 -0
  433. package/src/session/processor.ts +408 -0
  434. package/src/session/prompt/anthropic-20250930.txt +165 -0
  435. package/src/session/prompt/anthropic.txt +105 -0
  436. package/src/session/prompt/anthropic_spoof.txt +1 -0
  437. package/src/session/prompt/beast.txt +147 -0
  438. package/src/session/prompt/build-switch.txt +5 -0
  439. package/src/session/prompt/codex_header.txt +79 -0
  440. package/src/session/prompt/copilot-gpt-5.txt +143 -0
  441. package/src/session/prompt/gemini.txt +155 -0
  442. package/src/session/prompt/max-steps.txt +16 -0
  443. package/src/session/prompt/plan-reminder-anthropic.txt +67 -0
  444. package/src/session/prompt/plan.txt +25 -0
  445. package/src/session/prompt/qwen.txt +108 -0
  446. package/src/session/prompt.ts +1942 -0
  447. package/src/session/retry.ts +90 -0
  448. package/src/session/revert.ts +120 -0
  449. package/src/session/stats.ts +404 -0
  450. package/src/session/status.ts +84 -0
  451. package/src/session/summary.ts +184 -0
  452. package/src/session/system.ts +195 -0
  453. package/src/session/toast.tsx +105 -0
  454. package/src/session/todo.ts +258 -0
  455. package/src/session/uninstall.ts +357 -0
  456. package/src/share/share-next.ts +421 -0
  457. package/src/share/share.ts +92 -0
  458. package/src/shell/shell.ts +65 -0
  459. package/src/skill/index.ts +1 -0
  460. package/src/skill/skill.ts +232 -0
  461. package/src/snapshot/index.ts +297 -0
  462. package/src/storage/storage.ts +227 -0
  463. package/src/tool/apply_patch.ts +288 -0
  464. package/src/tool/apply_patch.txt +33 -0
  465. package/src/tool/bash.ts +252 -0
  466. package/src/tool/bash.txt +115 -0
  467. package/src/tool/batch.ts +175 -0
  468. package/src/tool/batch.txt +24 -0
  469. package/src/tool/codesearch.ts +132 -0
  470. package/src/tool/codesearch.txt +12 -0
  471. package/src/tool/context_collect.ts +152 -0
  472. package/src/tool/context_collect.txt +9 -0
  473. package/src/tool/context_diagnostics.ts +81 -0
  474. package/src/tool/context_diagnostics.txt +5 -0
  475. package/src/tool/context_related.ts +117 -0
  476. package/src/tool/context_related.txt +5 -0
  477. package/src/tool/context_search.ts +108 -0
  478. package/src/tool/context_search.txt +8 -0
  479. package/src/tool/db-diff.ts +434 -0
  480. package/src/tool/db-table.txt +15 -0
  481. package/src/tool/docs_add.ts +50 -0
  482. package/src/tool/docs_add.txt +5 -0
  483. package/src/tool/docs_context.ts +56 -0
  484. package/src/tool/docs_context.txt +4 -0
  485. package/src/tool/docs_gap_report.ts +79 -0
  486. package/src/tool/docs_gap_report.txt +7 -0
  487. package/src/tool/docs_load.ts +41 -0
  488. package/src/tool/docs_load.txt +4 -0
  489. package/src/tool/docs_request.ts +129 -0
  490. package/src/tool/docs_request.txt +7 -0
  491. package/src/tool/docs_search.ts +51 -0
  492. package/src/tool/docs_search.txt +6 -0
  493. package/src/tool/docs_unload.ts +38 -0
  494. package/src/tool/docs_unload.txt +5 -0
  495. package/src/tool/edit.ts +614 -0
  496. package/src/tool/edit.txt +10 -0
  497. package/src/tool/external-directory.ts +32 -0
  498. package/src/tool/generate_image.ts +174 -0
  499. package/src/tool/generate_image.txt +12 -0
  500. package/src/tool/glob.ts +79 -0
  501. package/src/tool/glob.txt +6 -0
  502. package/src/tool/grep.ts +153 -0
  503. package/src/tool/grep.txt +8 -0
  504. package/src/tool/invalid.ts +17 -0
  505. package/src/tool/ls.ts +116 -0
  506. package/src/tool/ls.txt +1 -0
  507. package/src/tool/lsp.ts +96 -0
  508. package/src/tool/lsp.txt +19 -0
  509. package/src/tool/memory_search.ts +141 -0
  510. package/src/tool/memory_search.txt +8 -0
  511. package/src/tool/multiedit.ts +46 -0
  512. package/src/tool/multiedit.txt +41 -0
  513. package/src/tool/plan-enter.txt +14 -0
  514. package/src/tool/plan-exit.txt +13 -0
  515. package/src/tool/plan.ts +130 -0
  516. package/src/tool/question.ts +33 -0
  517. package/src/tool/question.txt +10 -0
  518. package/src/tool/rag_index.ts +77 -0
  519. package/src/tool/rag_index.txt +10 -0
  520. package/src/tool/rag_reset.ts +26 -0
  521. package/src/tool/rag_reset.txt +4 -0
  522. package/src/tool/rag_search.ts +62 -0
  523. package/src/tool/rag_search.txt +6 -0
  524. package/src/tool/rag_status.ts +45 -0
  525. package/src/tool/rag_status.txt +4 -0
  526. package/src/tool/read.ts +203 -0
  527. package/src/tool/read.txt +12 -0
  528. package/src/tool/registry.ts +214 -0
  529. package/src/tool/skill.ts +169 -0
  530. package/src/tool/skill.txt +3 -0
  531. package/src/tool/smart_docs.ts +74 -0
  532. package/src/tool/smart_docs.txt +7 -0
  533. package/src/tool/speak/elevenlabs.ts +201 -0
  534. package/src/tool/speak/openrouter.ts +240 -0
  535. package/src/tool/speak/provider.ts +83 -0
  536. package/src/tool/speak.ts +440 -0
  537. package/src/tool/task.ts +194 -0
  538. package/src/tool/task.txt +60 -0
  539. package/src/tool/todo.ts +53 -0
  540. package/src/tool/todoread.txt +14 -0
  541. package/src/tool/todowrite.txt +167 -0
  542. package/src/tool/tool.ts +87 -0
  543. package/src/tool/tree.ts +218 -0
  544. package/src/tool/tree.txt +8 -0
  545. package/src/tool/truncation.ts +106 -0
  546. package/src/tool/use-connector.ts +47 -0
  547. package/src/tool/voice.ts +188 -0
  548. package/src/tool/webfetch.ts +205 -0
  549. package/src/tool/webfetch.txt +13 -0
  550. package/src/tool/websearch.ts +150 -0
  551. package/src/tool/websearch.txt +14 -0
  552. package/src/tool/write.ts +80 -0
  553. package/src/tool/write.txt +8 -0
  554. package/src/util/archive.ts +16 -0
  555. package/src/util/color.ts +19 -0
  556. package/src/util/context.ts +25 -0
  557. package/src/util/defer.ts +12 -0
  558. package/src/util/error.ts +77 -0
  559. package/src/util/eventloop.ts +20 -0
  560. package/src/util/filesystem.ts +125 -0
  561. package/src/util/flock.ts +329 -0
  562. package/src/util/fn.ts +11 -0
  563. package/src/util/format.ts +20 -0
  564. package/src/util/hash.ts +7 -0
  565. package/src/util/iife.ts +3 -0
  566. package/src/util/keybind.ts +103 -0
  567. package/src/util/lazy.ts +18 -0
  568. package/src/util/locale.ts +81 -0
  569. package/src/util/lock.ts +98 -0
  570. package/src/util/log.ts +180 -0
  571. package/src/util/network.ts +9 -0
  572. package/src/util/process.ts +15 -0
  573. package/src/util/queue.ts +32 -0
  574. package/src/util/record.ts +3 -0
  575. package/src/util/rpc.ts +66 -0
  576. package/src/util/scrap.ts +10 -0
  577. package/src/util/signal.ts +12 -0
  578. package/src/util/timeout.ts +14 -0
  579. package/src/util/token.ts +7 -0
  580. package/src/util/wildcard.ts +56 -0
  581. package/src/workspace/adaptors/index.ts +271 -0
  582. package/src/workspace/adaptors/types.ts +14 -0
  583. package/src/workspace/adaptors/worktree.ts +31 -0
  584. package/src/workspace/config.ts +19 -0
  585. package/src/workspace/index.ts +223 -0
  586. package/src/workspace/session-proxy-middleware.ts +97 -0
  587. package/src/workspace/sse.ts +66 -0
  588. package/src/workspace/workspace-context.ts +23 -0
  589. package/src/workspace/workspace-server/routes.ts +33 -0
  590. package/src/workspace/workspace-server/server.ts +47 -0
  591. package/src/worktree/index.ts +487 -0
  592. package/sst-env.d.ts +10 -0
  593. package/test/benchmark.test.ts +121 -0
  594. package/test/build-optimizations.test.ts +124 -0
  595. package/test/id-benchmark.test.ts +132 -0
  596. package/test/optimizations.test.ts +302 -0
  597. package/test/preload.ts +1 -0
  598. package/test/solidjs-benchmark.test.ts +262 -0
  599. package/test/solidjs-optimizations.test.ts +259 -0
  600. package/test/tui-benchmark.test.ts +230 -0
  601. package/test/wildcard-benchmark.test.ts +180 -0
  602. package/tsconfig.json +26 -0
@@ -0,0 +1,1303 @@
1
+ import { SyntaxStyle, RGBA, type TerminalColors } from "@opentui/core"
2
+ import path from "path"
3
+ import { createEffect, createMemo, on, 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 catppuccinFrappe from "./theme/catppuccin-frappe.json" with { type: "json" }
10
+ import catppuccinMacchiato from "./theme/catppuccin-macchiato.json" with { type: "json" }
11
+ import cobalt2 from "./theme/cobalt2.json" with { type: "json" }
12
+ import cursor from "./theme/cursor.json" with { type: "json" }
13
+ import dracula from "./theme/dracula.json" with { type: "json" }
14
+ import everforest from "./theme/everforest.json" with { type: "json" }
15
+ import flexoki from "./theme/flexoki.json" with { type: "json" }
16
+ import github from "./theme/github.json" with { type: "json" }
17
+ import gruvbox from "./theme/gruvbox.json" with { type: "json" }
18
+ import kanagawa from "./theme/kanagawa.json" with { type: "json" }
19
+ import material from "./theme/material.json" with { type: "json" }
20
+ import matrix from "./theme/matrix.json" with { type: "json" }
21
+ import mercury from "./theme/mercury.json" with { type: "json" }
22
+ import monokai from "./theme/monokai.json" with { type: "json" }
23
+ import nightowl from "./theme/nightowl.json" with { type: "json" }
24
+ import nord from "./theme/nord.json" with { type: "json" }
25
+ import osakaJade from "./theme/osaka-jade.json" with { type: "json" }
26
+ import onedark from "./theme/one-dark.json" with { type: "json" }
27
+ import nikcli from "./theme/nikcli.json" with { type: "json" }
28
+ import orng from "./theme/orng.json" with { type: "json" }
29
+ import lucentOrng from "./theme/lucent-orng.json" with { type: "json" }
30
+ import palenight from "./theme/palenight.json" with { type: "json" }
31
+ import rosepine from "./theme/rosepine.json" with { type: "json" }
32
+ import solarized from "./theme/solarized.json" with { type: "json" }
33
+ import synthwave84 from "./theme/synthwave84.json" with { type: "json" }
34
+ import tokyonight from "./theme/tokyonight.json" with { type: "json" }
35
+ import vercel from "./theme/vercel.json" with { type: "json" }
36
+ import vesper from "./theme/vesper.json" with { type: "json" }
37
+ import zenburn from "./theme/zenburn.json" with { type: "json" }
38
+ import carbonfox from "./theme/carbonfox.json" with { type: "json" }
39
+ import tokyonightStorm from "./theme/tokyonight-storm.json" with { type: "json" }
40
+ import catppuccinLatte from "./theme/catppuccin-latte.json" with { type: "json" }
41
+ import poimandres from "./theme/poimandres.json" with { type: "json" }
42
+ import draculaOfficial from "./theme/dracula-official.json" with { type: "json" }
43
+ import onepro from "./theme/one-pro.json" with { type: "json" }
44
+ import materialOcean from "./theme/material-ocean.json" with { type: "json" }
45
+ import githubDimmed from "./theme/github-dimmed.json" with { type: "json" }
46
+ import arctic from "./theme/arctic.json" with { type: "json" }
47
+ import vivid from "./theme/vivid.json" with { type: "json" }
48
+ import equilibrium from "./theme/equilibrium.json" with { type: "json" }
49
+ import ayuai from "./theme/ayuai.json" with { type: "json" }
50
+ import dawnfox from "./theme/dawnfox.json" with { type: "json" }
51
+ import neon from "./theme/neon.json" with { type: "json" }
52
+ import githubDark from "./theme/github-dark.json" with { type: "json" }
53
+ import githubLight from "./theme/github-light.json" with { type: "json" }
54
+ import blood from "./theme/blood.json" with { type: "json" }
55
+ import greyscale from "./theme/greyscale.json" with { type: "json" }
56
+ import hacker from "./theme/hacker.json" with { type: "json" }
57
+ import abyss from "./theme/abyss.json" with { type: "json" }
58
+ import obsidian from "./theme/obsidian.json" with { type: "json" }
59
+ import charcoal from "./theme/charcoal.json" with { type: "json" }
60
+ import ebony from "./theme/ebony.json" with { type: "json" }
61
+ import slate from "./theme/slate.json" with { type: "json" }
62
+ import voidTheme from "./theme/void.json" with { type: "json" }
63
+ import onyx from "./theme/onyx.json" with { type: "json" }
64
+ import cosmic from "./theme/cosmic.json" with { type: "json" }
65
+ import jet from "./theme/jet.json" with { type: "json" }
66
+ import starlight from "./theme/starlight.json" with { type: "json" }
67
+ import zinc from "./theme/zinc.json" with { type: "json" }
68
+ import lavender from "./theme/lavender.json" with { type: "json" }
69
+ import gone from "./theme/gone.json" with { type: "json" }
70
+ import duo from "./theme/duo.json" with { type: "json" }
71
+ import ink from "./theme/ink.json" with { type: "json" }
72
+ import apple from "./theme/apple.json" with { type: "json" }
73
+ import silicon from "./theme/silicon.json" with { type: "json" }
74
+ import neutral from "./theme/neutral.json" with { type: "json" }
75
+ import modern from "./theme/modern.json" with { type: "json" }
76
+ import radiant from "./theme/radiant.json" with { type: "json" }
77
+ import tech from "./theme/tech.json" with { type: "json" }
78
+ import nordic from "./theme/nordic.json" with { type: "json" }
79
+ import lightph from "./theme/lightph.json" with { type: "json" }
80
+ import ghost from "./theme/ghost.json" with { type: "json" }
81
+ import fusion from "./theme/fusion.json" with { type: "json" }
82
+ import ethereal from "./theme/ethereal.json" with { type: "json" }
83
+ import dimension from "./theme/dimension.json" with { type: "json" }
84
+ import vapor from "./theme/vapor.json" with { type: "json" }
85
+ import soft from "./theme/soft.json" with { type: "json" }
86
+ import vscode from "./theme/vscode.json" with { type: "json" }
87
+ import catmoe from "./theme/catmoe.json" with { type: "json" }
88
+ import sunrise from "./theme/sunrise.json" with { type: "json" }
89
+ import dusk from "./theme/dusk.json" with { type: "json" }
90
+ import neonfusion from "./theme/neonfusion.json" with { type: "json" }
91
+ import midnight from "./theme/midnight.json" with { type: "json" }
92
+ import holo from "./theme/holo.json" with { type: "json" }
93
+ import glass from "./theme/glass.json" with { type: "json" }
94
+ import shadow from "./theme/shadow.json" with { type: "json" }
95
+ import gold from "./theme/gold.json" with { type: "json" }
96
+ import prism from "./theme/prism.json" with { type: "json" }
97
+ import cyber from "./theme/cyber.json" with { type: "json" }
98
+ import dream from "./theme/dream.json" with { type: "json" }
99
+ import nova from "./theme/nova.json" with { type: "json" }
100
+ import spectrum from "./theme/spectrum.json" with { type: "json" }
101
+ import chromatic from "./theme/chromatic.json" with { type: "json" }
102
+ import { useKV } from "./kv"
103
+ import { useRenderer } from "@opentui/solid"
104
+ import { createStore, produce } from "solid-js/store"
105
+ import { Global } from "@/global"
106
+ import { Filesystem } from "@/util/filesystem"
107
+ import { useSDK } from "./sdk"
108
+
109
+ type ThemeColors = {
110
+ primary: RGBA
111
+ secondary: RGBA
112
+ accent: RGBA
113
+ error: RGBA
114
+ warning: RGBA
115
+ success: RGBA
116
+ info: RGBA
117
+ text: RGBA
118
+ textMuted: RGBA
119
+ selectedListItemText: RGBA
120
+ background: RGBA
121
+ backgroundPanel: RGBA
122
+ backgroundElement: RGBA
123
+ backgroundMenu: RGBA
124
+ border: RGBA
125
+ borderActive: RGBA
126
+ borderSubtle: RGBA
127
+ diffAdded: RGBA
128
+ diffRemoved: RGBA
129
+ diffContext: RGBA
130
+ diffHunkHeader: RGBA
131
+ diffHighlightAdded: RGBA
132
+ diffHighlightRemoved: RGBA
133
+ diffAddedBg: RGBA
134
+ diffRemovedBg: RGBA
135
+ diffContextBg: RGBA
136
+ diffLineNumber: RGBA
137
+ diffAddedLineNumberBg: RGBA
138
+ diffRemovedLineNumberBg: RGBA
139
+ markdownText: RGBA
140
+ markdownHeading: RGBA
141
+ markdownLink: RGBA
142
+ markdownLinkText: RGBA
143
+ markdownCode: RGBA
144
+ markdownBlockQuote: RGBA
145
+ markdownEmph: RGBA
146
+ markdownStrong: RGBA
147
+ markdownHorizontalRule: RGBA
148
+ markdownListItem: RGBA
149
+ markdownListEnumeration: RGBA
150
+ markdownImage: RGBA
151
+ markdownImageText: RGBA
152
+ markdownCodeBlock: RGBA
153
+ syntaxComment: RGBA
154
+ syntaxKeyword: RGBA
155
+ syntaxFunction: RGBA
156
+ syntaxVariable: RGBA
157
+ syntaxString: RGBA
158
+ syntaxNumber: RGBA
159
+ syntaxType: RGBA
160
+ syntaxOperator: RGBA
161
+ syntaxPunctuation: RGBA
162
+ }
163
+
164
+ type Theme = ThemeColors & {
165
+ _hasSelectedListItemText: boolean
166
+ thinkingOpacity: number
167
+ }
168
+
169
+ export function selectedForeground(theme: Theme, bg?: RGBA): RGBA {
170
+ // If theme explicitly defines selectedListItemText, use it
171
+ if (theme._hasSelectedListItemText) {
172
+ return theme.selectedListItemText
173
+ }
174
+
175
+ // For transparent backgrounds, calculate contrast based on the actual bg (or fallback to primary)
176
+ if (theme.background.a === 0) {
177
+ const targetColor = bg ?? theme.primary
178
+ const { r, g, b } = targetColor
179
+ const luminance = 0.299 * r + 0.587 * g + 0.114 * b
180
+ return luminance > 0.5 ? RGBA.fromInts(0, 0, 0) : RGBA.fromInts(255, 255, 255)
181
+ }
182
+
183
+ // Fall back to background color
184
+ return theme.background
185
+ }
186
+
187
+ type HexColor = `#${string}`
188
+ type RefName = string
189
+ type Variant = {
190
+ dark: HexColor | RefName
191
+ light: HexColor | RefName
192
+ }
193
+ type ColorValue = HexColor | RefName | Variant | RGBA
194
+ type ThemeJson = {
195
+ $schema?: string
196
+ defs?: Record<string, HexColor | RefName>
197
+ theme: Omit<Record<keyof ThemeColors, ColorValue>, "selectedListItemText" | "backgroundMenu"> & {
198
+ selectedListItemText?: ColorValue
199
+ backgroundMenu?: ColorValue
200
+ thinkingOpacity?: number
201
+ }
202
+ }
203
+
204
+ const extraThemes: Record<string, ThemeJson> = {}
205
+
206
+ export function addTheme(name: string, data: unknown): void {
207
+ if (!data || typeof data !== "object" || !("theme" in data)) return
208
+ extraThemes[name] = data as ThemeJson
209
+ DEFAULT_THEMES[name] = data as ThemeJson
210
+ }
211
+
212
+ export function hasTheme(name: string): boolean {
213
+ return name in DEFAULT_THEMES
214
+ }
215
+
216
+ export const DEFAULT_THEMES: Record<string, ThemeJson> = {
217
+ abyss,
218
+ aura,
219
+ ayu,
220
+ ayuai,
221
+ blood,
222
+ carbonfox,
223
+ catppuccin,
224
+ ["catppuccin-frappe"]: catppuccinFrappe,
225
+ ["catppuccin-macchiato"]: catppuccinMacchiato,
226
+ ["catppuccin-latte"]: catppuccinLatte,
227
+ charcoal,
228
+ cobalt2,
229
+ cosmic,
230
+ cursor,
231
+ dawnfox,
232
+ dracula,
233
+ ["dracula-official"]: draculaOfficial,
234
+ ebony,
235
+ equilibrium,
236
+ everforest,
237
+ flexoki,
238
+ github,
239
+ ["github-dark"]: githubDark,
240
+ ["github-dimmed"]: githubDimmed,
241
+ ["github-light"]: githubLight,
242
+ greyscale,
243
+ gruvbox,
244
+ hacker,
245
+ jet,
246
+ kanagawa,
247
+ material,
248
+ ["material-ocean"]: materialOcean,
249
+ matrix,
250
+ mercury,
251
+ monokai,
252
+
253
+ neon,
254
+ nightowl,
255
+ nikcli,
256
+ nord,
257
+ ["one-dark"]: onedark,
258
+ ["one-pro"]: onepro,
259
+ onyx,
260
+ obsidian,
261
+ orng,
262
+ ["lucent-orng"]: lucentOrng,
263
+
264
+ palenight,
265
+ poimandres,
266
+ rosepine,
267
+ slate,
268
+ solarized,
269
+ starlight,
270
+ synthwave84,
271
+ tokyonight,
272
+ ["tokyonight-storm"]: tokyonightStorm,
273
+ vesper,
274
+ vercel,
275
+ void: voidTheme,
276
+ zenburn,
277
+
278
+ // New themes
279
+ apple,
280
+ chromatic,
281
+ cyber,
282
+ dim: shadow,
283
+ dream,
284
+ duo,
285
+ ethereal,
286
+ fusion,
287
+ ghost,
288
+ glass,
289
+ gold,
290
+ gone,
291
+ holo,
292
+ ink,
293
+ lavender,
294
+ lightph,
295
+ midnight,
296
+ modern,
297
+ neonfusion,
298
+ neutral,
299
+ nordic,
300
+ nova,
301
+ prism,
302
+ radiant,
303
+ shadow,
304
+ silicon,
305
+ soft,
306
+ spectrum,
307
+ sunrise,
308
+ tech,
309
+ vapor,
310
+ vscode,
311
+ catmoe,
312
+ dusk,
313
+ dimension,
314
+ }
315
+
316
+ function resolveTheme(theme: ThemeJson, mode: "dark" | "light") {
317
+ const defs = theme.defs ?? {}
318
+ function resolveColor(c: ColorValue): RGBA {
319
+ if (c instanceof RGBA) return c
320
+ if (typeof c === "string") {
321
+ if (c === "transparent" || c === "none") return RGBA.fromInts(0, 0, 0, 0)
322
+
323
+ if (c.startsWith("#")) return RGBA.fromHex(c)
324
+
325
+ if (defs[c] != null) {
326
+ return resolveColor(defs[c])
327
+ } else if (theme.theme[c as keyof ThemeColors] !== undefined) {
328
+ return resolveColor(theme.theme[c as keyof ThemeColors]!)
329
+ } else {
330
+ throw new Error(`Color reference "${c}" not found in defs or theme`)
331
+ }
332
+ }
333
+ if (typeof c === "number") {
334
+ return ansiToRgba(c)
335
+ }
336
+ return resolveColor(c[mode])
337
+ }
338
+
339
+ const resolved = Object.fromEntries(
340
+ Object.entries(theme.theme)
341
+ .filter(([key]) => key !== "selectedListItemText" && key !== "backgroundMenu" && key !== "thinkingOpacity")
342
+ .map(([key, value]) => {
343
+ return [key, resolveColor(value as ColorValue)]
344
+ }),
345
+ ) as Partial<ThemeColors>
346
+
347
+ // Handle selectedListItemText separately since it's optional
348
+ const hasSelectedListItemText = theme.theme.selectedListItemText !== undefined
349
+ if (hasSelectedListItemText) {
350
+ resolved.selectedListItemText = resolveColor(theme.theme.selectedListItemText!)
351
+ } else {
352
+ // Backward compatibility: if selectedListItemText is not defined, use background color
353
+ // This preserves the current behavior for all existing themes
354
+ resolved.selectedListItemText = resolved.background
355
+ }
356
+
357
+ // Handle backgroundMenu - optional with fallback to backgroundElement
358
+ if (theme.theme.backgroundMenu !== undefined) {
359
+ resolved.backgroundMenu = resolveColor(theme.theme.backgroundMenu)
360
+ } else {
361
+ resolved.backgroundMenu = resolved.backgroundElement
362
+ }
363
+
364
+ // Handle thinkingOpacity - optional with default of 0.6
365
+ const thinkingOpacity = theme.theme.thinkingOpacity ?? 0.6
366
+
367
+ return {
368
+ ...resolved,
369
+ _hasSelectedListItemText: hasSelectedListItemText,
370
+ thinkingOpacity,
371
+ } as Theme
372
+ }
373
+
374
+ function ansiToRgba(code: number): RGBA {
375
+ // Standard ANSI colors (0-15)
376
+ if (code < 16) {
377
+ const ansiColors = [
378
+ "#000000", // Black
379
+ "#800000", // Red
380
+ "#008000", // Green
381
+ "#808000", // Yellow
382
+ "#000080", // Blue
383
+ "#800080", // Magenta
384
+ "#008080", // Cyan
385
+ "#c0c0c0", // White
386
+ "#808080", // Bright Black
387
+ "#ff0000", // Bright Red
388
+ "#00ff00", // Bright Green
389
+ "#ffff00", // Bright Yellow
390
+ "#0000ff", // Bright Blue
391
+ "#ff00ff", // Bright Magenta
392
+ "#00ffff", // Bright Cyan
393
+ "#ffffff", // Bright White
394
+ ]
395
+ return RGBA.fromHex(ansiColors[code] ?? "#000000")
396
+ }
397
+
398
+ // 6x6x6 Color Cube (16-231)
399
+ if (code < 232) {
400
+ const index = code - 16
401
+ const b = index % 6
402
+ const g = Math.floor(index / 6) % 6
403
+ const r = Math.floor(index / 36)
404
+
405
+ const val = (x: number) => (x === 0 ? 0 : x * 40 + 55)
406
+ return RGBA.fromInts(val(r), val(g), val(b))
407
+ }
408
+
409
+ // Grayscale Ramp (232-255)
410
+ if (code < 256) {
411
+ const gray = (code - 232) * 10 + 8
412
+ return RGBA.fromInts(gray, gray, gray)
413
+ }
414
+
415
+ // Fallback for invalid codes
416
+ return RGBA.fromInts(0, 0, 0)
417
+ }
418
+
419
+ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
420
+ name: "Theme",
421
+ init: (props: { mode: "dark" | "light" }) => {
422
+ const sync = useSync()
423
+ const kv = useKV()
424
+ const [store, setStore] = createStore({
425
+ themes: DEFAULT_THEMES,
426
+ mode: kv.get("theme_mode", props.mode),
427
+ active: (sync.data.config.theme ?? kv.get("theme", "nikcli")) as string,
428
+ ready: false,
429
+ })
430
+
431
+ createEffect(
432
+ on(
433
+ () => sync.data.config.theme,
434
+ (theme) => {
435
+ if (theme) setStore("active", theme)
436
+ },
437
+ { defer: true },
438
+ ),
439
+ )
440
+
441
+ async function reload() {
442
+ resolveSystemTheme()
443
+ const custom = await getCustomThemes().catch(() => ({}) as Record<string, ThemeJson>)
444
+ setStore(
445
+ produce((draft) => {
446
+ const systemTheme = draft.themes.system
447
+ // Rebuild themes so deleted custom themes disappear.
448
+ draft.themes = { ...DEFAULT_THEMES } as any
449
+ if (systemTheme) {
450
+ draft.themes.system = systemTheme
451
+ }
452
+ Object.assign(draft.themes, custom)
453
+ if (draft.themes[draft.active] === undefined) {
454
+ draft.active = "nikcli"
455
+ }
456
+ }),
457
+ )
458
+
459
+ if (store.active !== "system") {
460
+ setStore("ready", true)
461
+ }
462
+ }
463
+
464
+ onMount(() => {
465
+ reload().catch(() => {
466
+ setStore("active", "nikcli")
467
+ setStore("ready", true)
468
+ })
469
+ })
470
+
471
+ function resolveSystemTheme() {
472
+ renderer
473
+ .getPalette({
474
+ size: 16,
475
+ })
476
+ .then((colors) => {
477
+ if (!colors.palette[0]) {
478
+ if (store.active === "system") {
479
+ setStore(
480
+ produce((draft) => {
481
+ draft.active = "nikcli"
482
+ draft.ready = true
483
+ }),
484
+ )
485
+ }
486
+ return
487
+ }
488
+ setStore(
489
+ produce((draft) => {
490
+ draft.themes.system = generateSystem(colors, store.mode)
491
+ if (store.active === "system") {
492
+ draft.ready = true
493
+ }
494
+ }),
495
+ )
496
+ })
497
+ }
498
+
499
+ const renderer = useRenderer()
500
+ process.on("SIGUSR2", async () => {
501
+ renderer.clearPaletteCache()
502
+ await reload()
503
+ })
504
+
505
+ const values = createMemo(() => {
506
+ return resolveTheme(store.themes[store.active] ?? store.themes.nikcli, store.mode)
507
+ })
508
+
509
+ const syntax = createMemo(() => generateSyntax(values()))
510
+ const subtleSyntax = createMemo(() => generateSubtleSyntax(values()))
511
+
512
+ return {
513
+ theme: new Proxy(values(), {
514
+ get(_target, prop) {
515
+ // @ts-expect-error
516
+ return values()[prop]
517
+ },
518
+ }),
519
+ get selected() {
520
+ return store.active
521
+ },
522
+ all() {
523
+ return store.themes
524
+ },
525
+ syntax,
526
+ subtleSyntax,
527
+ mode() {
528
+ return store.mode
529
+ },
530
+ setMode(mode: "dark" | "light") {
531
+ setStore("mode", mode)
532
+ kv.set("theme_mode", mode)
533
+ },
534
+ set(theme: string) {
535
+ setStore("active", theme)
536
+ kv.set("theme", theme)
537
+ },
538
+ reload,
539
+ get ready() {
540
+ return store.ready
541
+ },
542
+ }
543
+ },
544
+ })
545
+
546
+ const CUSTOM_THEME_GLOB = new Bun.Glob("themes/*.json")
547
+ async function getCustomThemes() {
548
+ const directories = [
549
+ Global.Path.config,
550
+ ...(await Array.fromAsync(
551
+ Filesystem.up({
552
+ targets: [".nikcli"],
553
+ start: process.cwd(),
554
+ }),
555
+ )),
556
+ ]
557
+
558
+ const result: Record<string, ThemeJson> = {}
559
+ for (const dir of directories) {
560
+ for await (const item of CUSTOM_THEME_GLOB.scan({
561
+ absolute: true,
562
+ followSymlinks: true,
563
+ dot: true,
564
+ cwd: dir,
565
+ })) {
566
+ const name = path.basename(item, ".json")
567
+ result[name] = await Bun.file(item).json()
568
+ }
569
+ }
570
+ return result
571
+ }
572
+
573
+ export function tint(base: RGBA, overlay: RGBA, alpha: number): RGBA {
574
+ const r = base.r + (overlay.r - base.r) * alpha
575
+ const g = base.g + (overlay.g - base.g) * alpha
576
+ const b = base.b + (overlay.b - base.b) * alpha
577
+ return RGBA.fromInts(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255))
578
+ }
579
+
580
+ function generateSystem(colors: TerminalColors, mode: "dark" | "light"): ThemeJson {
581
+ const bg = RGBA.fromHex(colors.defaultBackground ?? colors.palette[0]!)
582
+ const fg = RGBA.fromHex(colors.defaultForeground ?? colors.palette[7]!)
583
+ const isDark = mode == "dark"
584
+
585
+ const col = (i: number) => {
586
+ const value = colors.palette[i]
587
+ if (value) return RGBA.fromHex(value)
588
+ return ansiToRgba(i)
589
+ }
590
+
591
+ // Generate gray scale based on terminal background
592
+ const grays = generateGrayScale(bg, isDark)
593
+ const textMuted = generateMutedTextColor(bg, isDark)
594
+
595
+ // ANSI color references
596
+ const ansiColors = {
597
+ black: col(0),
598
+ red: col(1),
599
+ green: col(2),
600
+ yellow: col(3),
601
+ blue: col(4),
602
+ magenta: col(5),
603
+ cyan: col(6),
604
+ white: col(7),
605
+ redBright: col(9),
606
+ greenBright: col(10),
607
+ }
608
+
609
+ const diffAlpha = isDark ? 0.22 : 0.14
610
+ const diffAddedBg = tint(bg, ansiColors.green, diffAlpha)
611
+ const diffRemovedBg = tint(bg, ansiColors.red, diffAlpha)
612
+ const diffAddedLineNumberBg = tint(grays[3], ansiColors.green, diffAlpha)
613
+ const diffRemovedLineNumberBg = tint(grays[3], ansiColors.red, diffAlpha)
614
+
615
+ return {
616
+ theme: {
617
+ // Primary colors using ANSI
618
+ primary: ansiColors.cyan,
619
+ secondary: ansiColors.magenta,
620
+ accent: ansiColors.cyan,
621
+
622
+ // Status colors using ANSI
623
+ error: ansiColors.red,
624
+ warning: ansiColors.yellow,
625
+ success: ansiColors.green,
626
+ info: ansiColors.cyan,
627
+
628
+ // Text colors
629
+ text: fg,
630
+ textMuted,
631
+ selectedListItemText: bg,
632
+
633
+ // Background colors
634
+ background: bg,
635
+ backgroundPanel: grays[2],
636
+ backgroundElement: grays[3],
637
+ backgroundMenu: grays[3],
638
+
639
+ // Border colors
640
+ borderSubtle: grays[6],
641
+ border: grays[7],
642
+ borderActive: grays[8],
643
+
644
+ // Diff colors
645
+ diffAdded: ansiColors.green,
646
+ diffRemoved: ansiColors.red,
647
+ diffContext: grays[7],
648
+ diffHunkHeader: grays[7],
649
+ diffHighlightAdded: ansiColors.greenBright,
650
+ diffHighlightRemoved: ansiColors.redBright,
651
+ diffAddedBg,
652
+ diffRemovedBg,
653
+ diffContextBg: grays[1],
654
+ diffLineNumber: grays[6],
655
+ diffAddedLineNumberBg,
656
+ diffRemovedLineNumberBg,
657
+
658
+ // Markdown colors
659
+ markdownText: fg,
660
+ markdownHeading: fg,
661
+ markdownLink: ansiColors.blue,
662
+ markdownLinkText: ansiColors.cyan,
663
+ markdownCode: ansiColors.green,
664
+ markdownBlockQuote: ansiColors.yellow,
665
+ markdownEmph: ansiColors.yellow,
666
+ markdownStrong: fg,
667
+ markdownHorizontalRule: grays[7],
668
+ markdownListItem: ansiColors.blue,
669
+ markdownListEnumeration: ansiColors.cyan,
670
+ markdownImage: ansiColors.blue,
671
+ markdownImageText: ansiColors.cyan,
672
+ markdownCodeBlock: fg,
673
+
674
+ // Syntax colors
675
+ syntaxComment: textMuted,
676
+ syntaxKeyword: ansiColors.magenta,
677
+ syntaxFunction: ansiColors.blue,
678
+ syntaxVariable: fg,
679
+ syntaxString: ansiColors.green,
680
+ syntaxNumber: ansiColors.yellow,
681
+ syntaxType: ansiColors.cyan,
682
+ syntaxOperator: ansiColors.cyan,
683
+ syntaxPunctuation: fg,
684
+ },
685
+ }
686
+ }
687
+
688
+ function generateGrayScale(bg: RGBA, isDark: boolean): Record<number, RGBA> {
689
+ const grays: Record<number, RGBA> = {}
690
+
691
+ // RGBA stores floats in range 0-1, convert to 0-255
692
+ const bgR = bg.r * 255
693
+ const bgG = bg.g * 255
694
+ const bgB = bg.b * 255
695
+
696
+ const luminance = 0.299 * bgR + 0.587 * bgG + 0.114 * bgB
697
+
698
+ for (let i = 1; i <= 12; i++) {
699
+ const factor = i / 12.0
700
+
701
+ let grayValue: number
702
+ let newR: number
703
+ let newG: number
704
+ let newB: number
705
+
706
+ if (isDark) {
707
+ if (luminance < 10) {
708
+ grayValue = Math.floor(factor * 0.4 * 255)
709
+ newR = grayValue
710
+ newG = grayValue
711
+ newB = grayValue
712
+ } else {
713
+ const newLum = luminance + (255 - luminance) * factor * 0.4
714
+
715
+ const ratio = newLum / luminance
716
+ newR = Math.min(bgR * ratio, 255)
717
+ newG = Math.min(bgG * ratio, 255)
718
+ newB = Math.min(bgB * ratio, 255)
719
+ }
720
+ } else {
721
+ if (luminance > 245) {
722
+ grayValue = Math.floor(255 - factor * 0.4 * 255)
723
+ newR = grayValue
724
+ newG = grayValue
725
+ newB = grayValue
726
+ } else {
727
+ const newLum = luminance * (1 - factor * 0.4)
728
+
729
+ const ratio = newLum / luminance
730
+ newR = Math.max(bgR * ratio, 0)
731
+ newG = Math.max(bgG * ratio, 0)
732
+ newB = Math.max(bgB * ratio, 0)
733
+ }
734
+ }
735
+
736
+ grays[i] = RGBA.fromInts(Math.floor(newR), Math.floor(newG), Math.floor(newB))
737
+ }
738
+
739
+ return grays
740
+ }
741
+
742
+ function generateMutedTextColor(bg: RGBA, isDark: boolean): RGBA {
743
+ // RGBA stores floats in range 0-1, convert to 0-255
744
+ const bgR = bg.r * 255
745
+ const bgG = bg.g * 255
746
+ const bgB = bg.b * 255
747
+
748
+ const bgLum = 0.299 * bgR + 0.587 * bgG + 0.114 * bgB
749
+
750
+ let grayValue: number
751
+
752
+ if (isDark) {
753
+ if (bgLum < 10) {
754
+ // Very dark/black background
755
+ grayValue = 180 // #b4b4b4
756
+ } else {
757
+ // Scale up for lighter dark backgrounds
758
+ grayValue = Math.min(Math.floor(160 + bgLum * 0.3), 200)
759
+ }
760
+ } else {
761
+ if (bgLum > 245) {
762
+ // Very light/white background
763
+ grayValue = 75 // #4b4b4b
764
+ } else {
765
+ // Scale down for darker light backgrounds
766
+ grayValue = Math.max(Math.floor(100 - (255 - bgLum) * 0.2), 60)
767
+ }
768
+ }
769
+
770
+ return RGBA.fromInts(grayValue, grayValue, grayValue)
771
+ }
772
+
773
+ function generateSyntax(theme: Theme) {
774
+ return SyntaxStyle.fromTheme(getSyntaxRules(theme))
775
+ }
776
+
777
+ function generateSubtleSyntax(theme: Theme) {
778
+ const rules = getSyntaxRules(theme)
779
+ return SyntaxStyle.fromTheme(
780
+ rules.map((rule) => {
781
+ if (rule.style.foreground) {
782
+ const fg = rule.style.foreground
783
+ return {
784
+ ...rule,
785
+ style: {
786
+ ...rule.style,
787
+ foreground: RGBA.fromInts(
788
+ Math.round(fg.r * 255),
789
+ Math.round(fg.g * 255),
790
+ Math.round(fg.b * 255),
791
+ Math.round(theme.thinkingOpacity * 255),
792
+ ),
793
+ },
794
+ }
795
+ }
796
+ return rule
797
+ }),
798
+ )
799
+ }
800
+
801
+ function getSyntaxRules(theme: Theme) {
802
+ return [
803
+ {
804
+ scope: ["default"],
805
+ style: {
806
+ foreground: theme.text,
807
+ },
808
+ },
809
+ {
810
+ scope: ["prompt"],
811
+ style: {
812
+ foreground: theme.accent,
813
+ },
814
+ },
815
+ {
816
+ scope: ["extmark.file"],
817
+ style: {
818
+ foreground: theme.warning,
819
+ bold: true,
820
+ },
821
+ },
822
+ {
823
+ scope: ["extmark.agent"],
824
+ style: {
825
+ foreground: theme.secondary,
826
+ bold: true,
827
+ },
828
+ },
829
+ {
830
+ scope: ["extmark.paste"],
831
+ style: {
832
+ foreground: theme.background,
833
+ background: theme.warning,
834
+ bold: true,
835
+ },
836
+ },
837
+ {
838
+ scope: ["comment"],
839
+ style: {
840
+ foreground: theme.syntaxComment,
841
+ italic: true,
842
+ },
843
+ },
844
+ {
845
+ scope: ["comment.documentation"],
846
+ style: {
847
+ foreground: theme.syntaxComment,
848
+ italic: true,
849
+ },
850
+ },
851
+ {
852
+ scope: ["string", "symbol"],
853
+ style: {
854
+ foreground: theme.syntaxString,
855
+ },
856
+ },
857
+ {
858
+ scope: ["number", "boolean"],
859
+ style: {
860
+ foreground: theme.syntaxNumber,
861
+ },
862
+ },
863
+ {
864
+ scope: ["character.special"],
865
+ style: {
866
+ foreground: theme.syntaxString,
867
+ },
868
+ },
869
+ {
870
+ scope: ["keyword.return", "keyword.conditional", "keyword.repeat", "keyword.coroutine"],
871
+ style: {
872
+ foreground: theme.syntaxKeyword,
873
+ italic: true,
874
+ },
875
+ },
876
+ {
877
+ scope: ["keyword.type"],
878
+ style: {
879
+ foreground: theme.syntaxType,
880
+ bold: true,
881
+ italic: true,
882
+ },
883
+ },
884
+ {
885
+ scope: ["keyword.function", "function.method"],
886
+ style: {
887
+ foreground: theme.syntaxFunction,
888
+ },
889
+ },
890
+ {
891
+ scope: ["keyword"],
892
+ style: {
893
+ foreground: theme.syntaxKeyword,
894
+ italic: true,
895
+ },
896
+ },
897
+ {
898
+ scope: ["keyword.import"],
899
+ style: {
900
+ foreground: theme.syntaxKeyword,
901
+ },
902
+ },
903
+ {
904
+ scope: ["operator", "keyword.operator", "punctuation.delimiter"],
905
+ style: {
906
+ foreground: theme.syntaxOperator,
907
+ },
908
+ },
909
+ {
910
+ scope: ["keyword.conditional.ternary"],
911
+ style: {
912
+ foreground: theme.syntaxOperator,
913
+ },
914
+ },
915
+ {
916
+ scope: ["variable", "variable.parameter", "function.method.call", "function.call"],
917
+ style: {
918
+ foreground: theme.syntaxVariable,
919
+ },
920
+ },
921
+ {
922
+ scope: ["variable.member", "function", "constructor"],
923
+ style: {
924
+ foreground: theme.syntaxFunction,
925
+ },
926
+ },
927
+ {
928
+ scope: ["type", "module"],
929
+ style: {
930
+ foreground: theme.syntaxType,
931
+ },
932
+ },
933
+ {
934
+ scope: ["constant"],
935
+ style: {
936
+ foreground: theme.syntaxNumber,
937
+ },
938
+ },
939
+ {
940
+ scope: ["property"],
941
+ style: {
942
+ foreground: theme.syntaxVariable,
943
+ },
944
+ },
945
+ {
946
+ scope: ["class"],
947
+ style: {
948
+ foreground: theme.syntaxType,
949
+ },
950
+ },
951
+ {
952
+ scope: ["parameter"],
953
+ style: {
954
+ foreground: theme.syntaxVariable,
955
+ },
956
+ },
957
+ {
958
+ scope: ["punctuation", "punctuation.bracket"],
959
+ style: {
960
+ foreground: theme.syntaxPunctuation,
961
+ },
962
+ },
963
+ {
964
+ scope: ["variable.builtin", "type.builtin", "function.builtin", "module.builtin", "constant.builtin"],
965
+ style: {
966
+ foreground: theme.error,
967
+ },
968
+ },
969
+ {
970
+ scope: ["variable.super"],
971
+ style: {
972
+ foreground: theme.error,
973
+ },
974
+ },
975
+ {
976
+ scope: ["string.escape", "string.regexp"],
977
+ style: {
978
+ foreground: theme.syntaxKeyword,
979
+ },
980
+ },
981
+ {
982
+ scope: ["keyword.directive"],
983
+ style: {
984
+ foreground: theme.syntaxKeyword,
985
+ italic: true,
986
+ },
987
+ },
988
+ {
989
+ scope: ["punctuation.special"],
990
+ style: {
991
+ foreground: theme.syntaxOperator,
992
+ },
993
+ },
994
+ {
995
+ scope: ["keyword.modifier"],
996
+ style: {
997
+ foreground: theme.syntaxKeyword,
998
+ italic: true,
999
+ },
1000
+ },
1001
+ {
1002
+ scope: ["keyword.exception"],
1003
+ style: {
1004
+ foreground: theme.syntaxKeyword,
1005
+ italic: true,
1006
+ },
1007
+ },
1008
+ // Markdown specific styles
1009
+ {
1010
+ scope: ["markup.heading"],
1011
+ style: {
1012
+ foreground: theme.markdownHeading,
1013
+ bold: true,
1014
+ },
1015
+ },
1016
+ {
1017
+ scope: ["markup.heading.1"],
1018
+ style: {
1019
+ foreground: theme.markdownHeading,
1020
+ bold: true,
1021
+ },
1022
+ },
1023
+ {
1024
+ scope: ["markup.heading.2"],
1025
+ style: {
1026
+ foreground: theme.markdownHeading,
1027
+ bold: true,
1028
+ },
1029
+ },
1030
+ {
1031
+ scope: ["markup.heading.3"],
1032
+ style: {
1033
+ foreground: theme.markdownHeading,
1034
+ bold: true,
1035
+ },
1036
+ },
1037
+ {
1038
+ scope: ["markup.heading.4"],
1039
+ style: {
1040
+ foreground: theme.markdownHeading,
1041
+ bold: true,
1042
+ },
1043
+ },
1044
+ {
1045
+ scope: ["markup.heading.5"],
1046
+ style: {
1047
+ foreground: theme.markdownHeading,
1048
+ bold: true,
1049
+ },
1050
+ },
1051
+ {
1052
+ scope: ["markup.heading.6"],
1053
+ style: {
1054
+ foreground: theme.markdownHeading,
1055
+ bold: true,
1056
+ },
1057
+ },
1058
+ {
1059
+ scope: ["markup.bold", "markup.strong"],
1060
+ style: {
1061
+ foreground: theme.markdownStrong,
1062
+ bold: true,
1063
+ },
1064
+ },
1065
+ {
1066
+ scope: ["markup.italic"],
1067
+ style: {
1068
+ foreground: theme.markdownEmph,
1069
+ italic: true,
1070
+ },
1071
+ },
1072
+ {
1073
+ scope: ["markup.list"],
1074
+ style: {
1075
+ foreground: theme.markdownListItem,
1076
+ },
1077
+ },
1078
+ {
1079
+ scope: ["markup.quote"],
1080
+ style: {
1081
+ foreground: theme.markdownBlockQuote,
1082
+ italic: true,
1083
+ },
1084
+ },
1085
+ {
1086
+ scope: ["markup.raw", "markup.raw.block"],
1087
+ style: {
1088
+ foreground: theme.markdownCode,
1089
+ },
1090
+ },
1091
+ {
1092
+ scope: ["markup.raw.inline"],
1093
+ style: {
1094
+ foreground: theme.markdownCode,
1095
+ background: theme.background,
1096
+ },
1097
+ },
1098
+ {
1099
+ scope: ["markup.link"],
1100
+ style: {
1101
+ foreground: theme.markdownLink,
1102
+ underline: true,
1103
+ },
1104
+ },
1105
+ {
1106
+ scope: ["markup.link.label"],
1107
+ style: {
1108
+ foreground: theme.markdownLinkText,
1109
+ underline: true,
1110
+ },
1111
+ },
1112
+ {
1113
+ scope: ["markup.link.url"],
1114
+ style: {
1115
+ foreground: theme.markdownLink,
1116
+ underline: true,
1117
+ },
1118
+ },
1119
+ {
1120
+ scope: ["label"],
1121
+ style: {
1122
+ foreground: theme.markdownLinkText,
1123
+ },
1124
+ },
1125
+ {
1126
+ scope: ["spell", "nospell"],
1127
+ style: {
1128
+ foreground: theme.text,
1129
+ },
1130
+ },
1131
+ {
1132
+ scope: ["conceal"],
1133
+ style: {
1134
+ foreground: theme.textMuted,
1135
+ },
1136
+ },
1137
+ // Additional common highlight groups
1138
+ {
1139
+ scope: ["string.special", "string.special.url"],
1140
+ style: {
1141
+ foreground: theme.markdownLink,
1142
+ underline: true,
1143
+ },
1144
+ },
1145
+ {
1146
+ scope: ["character"],
1147
+ style: {
1148
+ foreground: theme.syntaxString,
1149
+ },
1150
+ },
1151
+ {
1152
+ scope: ["float"],
1153
+ style: {
1154
+ foreground: theme.syntaxNumber,
1155
+ },
1156
+ },
1157
+ {
1158
+ scope: ["comment.error"],
1159
+ style: {
1160
+ foreground: theme.error,
1161
+ italic: true,
1162
+ bold: true,
1163
+ },
1164
+ },
1165
+ {
1166
+ scope: ["comment.warning"],
1167
+ style: {
1168
+ foreground: theme.warning,
1169
+ italic: true,
1170
+ bold: true,
1171
+ },
1172
+ },
1173
+ {
1174
+ scope: ["comment.todo", "comment.note"],
1175
+ style: {
1176
+ foreground: theme.info,
1177
+ italic: true,
1178
+ bold: true,
1179
+ },
1180
+ },
1181
+ {
1182
+ scope: ["namespace"],
1183
+ style: {
1184
+ foreground: theme.syntaxType,
1185
+ },
1186
+ },
1187
+ {
1188
+ scope: ["field"],
1189
+ style: {
1190
+ foreground: theme.syntaxVariable,
1191
+ },
1192
+ },
1193
+ {
1194
+ scope: ["type.definition"],
1195
+ style: {
1196
+ foreground: theme.syntaxType,
1197
+ bold: true,
1198
+ },
1199
+ },
1200
+ {
1201
+ scope: ["keyword.export"],
1202
+ style: {
1203
+ foreground: theme.syntaxKeyword,
1204
+ },
1205
+ },
1206
+ {
1207
+ scope: ["attribute", "annotation"],
1208
+ style: {
1209
+ foreground: theme.warning,
1210
+ },
1211
+ },
1212
+ {
1213
+ scope: ["tag"],
1214
+ style: {
1215
+ foreground: theme.error,
1216
+ },
1217
+ },
1218
+ {
1219
+ scope: ["tag.attribute"],
1220
+ style: {
1221
+ foreground: theme.syntaxKeyword,
1222
+ },
1223
+ },
1224
+ {
1225
+ scope: ["tag.delimiter"],
1226
+ style: {
1227
+ foreground: theme.syntaxOperator,
1228
+ },
1229
+ },
1230
+ {
1231
+ scope: ["markup.strikethrough"],
1232
+ style: {
1233
+ foreground: theme.textMuted,
1234
+ },
1235
+ },
1236
+ {
1237
+ scope: ["markup.underline"],
1238
+ style: {
1239
+ foreground: theme.text,
1240
+ underline: true,
1241
+ },
1242
+ },
1243
+ {
1244
+ scope: ["markup.list.checked"],
1245
+ style: {
1246
+ foreground: theme.success,
1247
+ },
1248
+ },
1249
+ {
1250
+ scope: ["markup.list.unchecked"],
1251
+ style: {
1252
+ foreground: theme.textMuted,
1253
+ },
1254
+ },
1255
+ {
1256
+ scope: ["diff.plus"],
1257
+ style: {
1258
+ foreground: theme.diffAdded,
1259
+ background: theme.diffAddedBg,
1260
+ },
1261
+ },
1262
+ {
1263
+ scope: ["diff.minus"],
1264
+ style: {
1265
+ foreground: theme.diffRemoved,
1266
+ background: theme.diffRemovedBg,
1267
+ },
1268
+ },
1269
+ {
1270
+ scope: ["diff.delta"],
1271
+ style: {
1272
+ foreground: theme.diffContext,
1273
+ background: theme.diffContextBg,
1274
+ },
1275
+ },
1276
+ {
1277
+ scope: ["error"],
1278
+ style: {
1279
+ foreground: theme.error,
1280
+ bold: true,
1281
+ },
1282
+ },
1283
+ {
1284
+ scope: ["warning"],
1285
+ style: {
1286
+ foreground: theme.warning,
1287
+ bold: true,
1288
+ },
1289
+ },
1290
+ {
1291
+ scope: ["info"],
1292
+ style: {
1293
+ foreground: theme.info,
1294
+ },
1295
+ },
1296
+ {
1297
+ scope: ["debug"],
1298
+ style: {
1299
+ foreground: theme.textMuted,
1300
+ },
1301
+ },
1302
+ ]
1303
+ }