astro.config.mjs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. // @ts-check
  2. import { defineConfig } from "astro/config"
  3. import starlight from "@astrojs/starlight"
  4. import solidJs from "@astrojs/solid-js"
  5. import cloudflare from "@astrojs/cloudflare"
  6. import theme from "toolbeam-docs-theme"
  7. import config from "./config.mjs"
  8. import { rehypeHeadingIds } from "@astrojs/markdown-remark"
  9. import rehypeAutolinkHeadings from "rehype-autolink-headings"
  10. import { spawnSync } from "child_process"
  11. // https://astro.build/config
  12. export default defineConfig({
  13. site: config.url,
  14. base: "/docs",
  15. output: "server",
  16. adapter: cloudflare({
  17. imageService: "passthrough",
  18. }),
  19. devToolbar: {
  20. enabled: false,
  21. },
  22. server: {
  23. host: "0.0.0.0",
  24. },
  25. markdown: {
  26. rehypePlugins: [rehypeHeadingIds, [rehypeAutolinkHeadings, { behavior: "wrap" }]],
  27. },
  28. build: {},
  29. integrations: [
  30. configSchema(),
  31. solidJs(),
  32. starlight({
  33. title: "OpenCode",
  34. favicon: "/favicon-v3.svg",
  35. head: [
  36. {
  37. tag: "link",
  38. attrs: {
  39. rel: "icon",
  40. href: "/favicon-v3.ico",
  41. sizes: "32x32",
  42. },
  43. },
  44. {
  45. tag: "link",
  46. attrs: {
  47. rel: "icon",
  48. type: "image/png",
  49. href: "/favicon-96x96-v3.png",
  50. sizes: "96x96",
  51. },
  52. },
  53. {
  54. tag: "link",
  55. attrs: {
  56. rel: "apple-touch-icon",
  57. href: "/apple-touch-icon-v3.png",
  58. sizes: "180x180",
  59. },
  60. },
  61. ],
  62. lastUpdated: true,
  63. expressiveCode: { themes: ["github-light", "github-dark"] },
  64. social: [
  65. { icon: "github", label: "GitHub", href: config.github },
  66. { icon: "discord", label: "Discord", href: config.discord },
  67. ],
  68. editLink: {
  69. baseUrl: `${config.github}/edit/dev/packages/web/`,
  70. },
  71. markdown: {
  72. headingLinks: false,
  73. },
  74. customCss: ["./src/styles/custom.css"],
  75. logo: {
  76. light: "./src/assets/logo-light.svg",
  77. dark: "./src/assets/logo-dark.svg",
  78. replacesTitle: true,
  79. },
  80. sidebar: [
  81. "",
  82. "config",
  83. "providers",
  84. "network",
  85. "enterprise",
  86. "troubleshooting",
  87. "windows-wsl",
  88. "1-0",
  89. {
  90. label: "Usage",
  91. items: ["tui", "cli", "web", "ide", "zen", "share", "github", "gitlab"],
  92. },
  93. {
  94. label: "Configure",
  95. items: [
  96. "tools",
  97. "rules",
  98. "agents",
  99. "models",
  100. "themes",
  101. "keybinds",
  102. "commands",
  103. "formatters",
  104. "permissions",
  105. "lsp",
  106. "mcp-servers",
  107. "acp",
  108. "skills",
  109. "custom-tools",
  110. ],
  111. },
  112. {
  113. label: "Develop",
  114. items: ["sdk", "server", "plugins", "ecosystem"],
  115. },
  116. ],
  117. components: {
  118. Hero: "./src/components/Hero.astro",
  119. Head: "./src/components/Head.astro",
  120. Header: "./src/components/Header.astro",
  121. SiteTitle: "./src/components/SiteTitle.astro",
  122. },
  123. plugins: [
  124. theme({
  125. headerLinks: config.headerLinks,
  126. }),
  127. ],
  128. }),
  129. ],
  130. })
  131. function configSchema() {
  132. return {
  133. name: "configSchema",
  134. hooks: {
  135. "astro:build:done": async () => {
  136. console.log("generating config schema")
  137. spawnSync("../opencode/script/schema.ts", ["./dist/config.json"])
  138. },
  139. },
  140. }
  141. }