astro.config.mjs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. lastUpdated: true,
  35. expressiveCode: { themes: ["github-light", "github-dark"] },
  36. social: [
  37. { icon: "github", label: "GitHub", href: config.github },
  38. { icon: "discord", label: "Dscord", href: config.discord },
  39. ],
  40. head: [
  41. {
  42. tag: "link",
  43. attrs: {
  44. rel: "icon",
  45. href: "/docs/favicon.svg",
  46. },
  47. },
  48. ],
  49. editLink: {
  50. baseUrl: `${config.github}/edit/dev/packages/web/`,
  51. },
  52. markdown: {
  53. headingLinks: false,
  54. },
  55. customCss: ["./src/styles/custom.css"],
  56. logo: {
  57. light: "./src/assets/logo-light.svg",
  58. dark: "./src/assets/logo-dark.svg",
  59. replacesTitle: true,
  60. },
  61. sidebar: [
  62. "",
  63. "config",
  64. "providers",
  65. "enterprise",
  66. "troubleshooting",
  67. "1-0",
  68. {
  69. label: "Usage",
  70. items: ["tui", "cli", "ide", "zen", "share", "github", "gitlab"],
  71. },
  72. {
  73. label: "Configure",
  74. items: [
  75. "tools",
  76. "rules",
  77. "agents",
  78. "models",
  79. "themes",
  80. "keybinds",
  81. "commands",
  82. "formatters",
  83. "permissions",
  84. "lsp",
  85. "mcp-servers",
  86. "acp",
  87. "custom-tools",
  88. ],
  89. },
  90. {
  91. label: "Develop",
  92. items: ["sdk", "server", "plugins"],
  93. },
  94. ],
  95. components: {
  96. Hero: "./src/components/Hero.astro",
  97. Head: "./src/components/Head.astro",
  98. Header: "./src/components/Header.astro",
  99. SiteTitle: "./src/components/SiteTitle.astro",
  100. },
  101. plugins: [
  102. theme({
  103. headerLinks: config.headerLinks,
  104. }),
  105. ],
  106. }),
  107. ],
  108. })
  109. function configSchema() {
  110. return {
  111. name: "configSchema",
  112. hooks: {
  113. "astro:build:done": async () => {
  114. console.log("generating config schema")
  115. spawnSync("../opencode/script/schema.ts", ["./dist/config.json"])
  116. },
  117. },
  118. }
  119. }