astro.config.mjs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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: "Discord", 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. "network",
  57. "enterprise",
  58. "troubleshooting",
  59. "1-0",
  60. {
  61. label: "Usage",
  62. items: ["tui", "cli", "ide", "zen", "share", "github", "gitlab"],
  63. },
  64. {
  65. label: "Configure",
  66. items: [
  67. "tools",
  68. "rules",
  69. "agents",
  70. "models",
  71. "themes",
  72. "keybinds",
  73. "commands",
  74. "formatters",
  75. "permissions",
  76. "lsp",
  77. "mcp-servers",
  78. "acp",
  79. "skills",
  80. "custom-tools",
  81. ],
  82. },
  83. {
  84. label: "Develop",
  85. items: ["sdk", "server", "plugins", "ecosystem"],
  86. },
  87. ],
  88. components: {
  89. Hero: "./src/components/Hero.astro",
  90. Head: "./src/components/Head.astro",
  91. Header: "./src/components/Header.astro",
  92. SiteTitle: "./src/components/SiteTitle.astro",
  93. },
  94. plugins: [
  95. theme({
  96. headerLinks: config.headerLinks,
  97. }),
  98. ],
  99. }),
  100. ],
  101. })
  102. function configSchema() {
  103. return {
  104. name: "configSchema",
  105. hooks: {
  106. "astro:build:done": async () => {
  107. console.log("generating config schema")
  108. spawnSync("../opencode/script/schema.ts", ["./dist/config.json"])
  109. },
  110. },
  111. }
  112. }