astro.config.mjs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. "1-0",
  88. {
  89. label: "Usage",
  90. items: ["tui", "cli", "web", "ide", "zen", "share", "github", "gitlab"],
  91. },
  92. {
  93. label: "Configure",
  94. items: [
  95. "tools",
  96. "rules",
  97. "agents",
  98. "models",
  99. "themes",
  100. "keybinds",
  101. "commands",
  102. "formatters",
  103. "permissions",
  104. "lsp",
  105. "mcp-servers",
  106. "acp",
  107. "skills",
  108. "custom-tools",
  109. ],
  110. },
  111. {
  112. label: "Develop",
  113. items: ["sdk", "server", "plugins", "ecosystem"],
  114. },
  115. ],
  116. components: {
  117. Hero: "./src/components/Hero.astro",
  118. Head: "./src/components/Head.astro",
  119. Header: "./src/components/Header.astro",
  120. SiteTitle: "./src/components/SiteTitle.astro",
  121. },
  122. plugins: [
  123. theme({
  124. headerLinks: config.headerLinks,
  125. }),
  126. ],
  127. }),
  128. ],
  129. })
  130. function configSchema() {
  131. return {
  132. name: "configSchema",
  133. hooks: {
  134. "astro:build:done": async () => {
  135. console.log("generating config schema")
  136. spawnSync("../opencode/script/schema.ts", ["./dist/config.json"])
  137. },
  138. },
  139. }
  140. }