astro.config.mjs 2.8 KB

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