astro.config.mjs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. output: "server",
  15. adapter: cloudflare({
  16. imageService: "passthrough",
  17. }),
  18. devToolbar: {
  19. enabled: false,
  20. },
  21. server: {
  22. host: "0.0.0.0",
  23. },
  24. markdown: {
  25. rehypePlugins: [rehypeHeadingIds, [rehypeAutolinkHeadings, { behavior: "wrap" }]],
  26. },
  27. build: {},
  28. integrations: [
  29. configSchema(),
  30. solidJs(),
  31. starlight({
  32. title: "opencode",
  33. lastUpdated: true,
  34. expressiveCode: { themes: ["github-light", "github-dark"] },
  35. social: [
  36. { icon: "github", label: "GitHub", href: config.github },
  37. { icon: "discord", label: "Dscord", href: config.discord },
  38. ],
  39. head: [
  40. {
  41. tag: "link",
  42. attrs: {
  43. rel: "icon",
  44. href: "/favicon.svg",
  45. },
  46. },
  47. ],
  48. editLink: {
  49. baseUrl: `${config.github}/edit/dev/packages/web/`,
  50. },
  51. markdown: {
  52. headingLinks: false,
  53. },
  54. customCss: ["./src/styles/custom.css"],
  55. logo: {
  56. light: "./src/assets/logo-light.svg",
  57. dark: "./src/assets/logo-dark.svg",
  58. replacesTitle: true,
  59. },
  60. sidebar: [
  61. "docs",
  62. "docs/config",
  63. "docs/providers",
  64. "docs/enterprise",
  65. "docs/troubleshooting",
  66. {
  67. label: "Usage",
  68. items: [
  69. "docs/tui",
  70. "docs/cli",
  71. "docs/ide",
  72. "docs/share",
  73. "docs/github",
  74. "docs/gitlab"
  75. ],
  76. },
  77. {
  78. label: "Configure",
  79. items: [
  80. "docs/rules",
  81. "docs/agents",
  82. "docs/models",
  83. "docs/themes",
  84. "docs/keybinds",
  85. "docs/formatters",
  86. "docs/permissions",
  87. "docs/lsp",
  88. "docs/mcp-servers",
  89. ],
  90. },
  91. {
  92. label: "Develop",
  93. items: ["docs/sdk", "docs/server", "docs/plugins"],
  94. },
  95. ],
  96. components: {
  97. Hero: "./src/components/Hero.astro",
  98. Head: "./src/components/Head.astro",
  99. Header: "./src/components/Header.astro",
  100. },
  101. plugins: [
  102. theme({
  103. headerLinks: config.headerLinks,
  104. }),
  105. ],
  106. }),
  107. ],
  108. redirects: {
  109. "/discord": "https://discord.gg/opencode",
  110. },
  111. })
  112. function configSchema() {
  113. return {
  114. name: "configSchema",
  115. hooks: {
  116. "astro:build:done": async () => {
  117. console.log("generating config schema")
  118. spawnSync("../opencode/script/schema.ts", ["./dist/config.json"])
  119. },
  120. },
  121. }
  122. }