2025-05-22 02:24:53 +08:00
|
|
|
// @ts-check
|
2025-06-01 02:41:00 +08:00
|
|
|
import { defineConfig } from "astro/config"
|
|
|
|
|
import starlight from "@astrojs/starlight"
|
|
|
|
|
import solidJs from "@astrojs/solid-js"
|
2025-06-08 11:46:53 +08:00
|
|
|
import cloudflare from "@astrojs/cloudflare"
|
2025-06-01 02:41:00 +08:00
|
|
|
import theme from "toolbeam-docs-theme"
|
2025-06-21 01:12:35 +08:00
|
|
|
import config from "./config.mjs"
|
2025-06-01 02:41:00 +08:00
|
|
|
import { rehypeHeadingIds } from "@astrojs/markdown-remark"
|
|
|
|
|
import rehypeAutolinkHeadings from "rehype-autolink-headings"
|
2025-07-09 23:25:58 +08:00
|
|
|
import { spawnSync } from "child_process"
|
2025-05-22 02:24:53 +08:00
|
|
|
|
2025-06-01 02:41:00 +08:00
|
|
|
const github = "https://github.com/sst/opencode"
|
2025-07-08 04:13:24 +08:00
|
|
|
|
2025-05-22 02:24:53 +08:00
|
|
|
// https://astro.build/config
|
|
|
|
|
export default defineConfig({
|
2025-07-08 04:36:52 +08:00
|
|
|
site: config.url,
|
2025-06-06 03:37:17 +08:00
|
|
|
output: "server",
|
2025-06-08 11:46:53 +08:00
|
|
|
adapter: cloudflare({
|
|
|
|
|
imageService: "passthrough",
|
|
|
|
|
}),
|
2025-06-01 02:41:00 +08:00
|
|
|
devToolbar: {
|
|
|
|
|
enabled: false,
|
|
|
|
|
},
|
2025-07-08 03:53:43 +08:00
|
|
|
server: {
|
|
|
|
|
host: "0.0.0.0",
|
|
|
|
|
},
|
2025-06-01 02:41:00 +08:00
|
|
|
markdown: {
|
2025-07-08 03:53:43 +08:00
|
|
|
rehypePlugins: [rehypeHeadingIds, [rehypeAutolinkHeadings, { behavior: "wrap" }]],
|
2025-06-01 02:41:00 +08:00
|
|
|
},
|
2025-07-09 23:25:58 +08:00
|
|
|
build: {},
|
2025-06-01 02:41:00 +08:00
|
|
|
integrations: [
|
2025-07-09 23:25:58 +08:00
|
|
|
configSchema(),
|
2025-06-01 02:41:00 +08:00
|
|
|
solidJs(),
|
|
|
|
|
starlight({
|
2025-06-20 04:26:58 +08:00
|
|
|
title: "opencode",
|
2025-07-16 07:54:51 +08:00
|
|
|
lastUpdated: true,
|
2025-06-01 02:41:00 +08:00
|
|
|
expressiveCode: { themes: ["github-light", "github-dark"] },
|
2025-07-08 02:44:37 +08:00
|
|
|
social: [
|
|
|
|
|
{ icon: "github", label: "GitHub", href: config.github },
|
2025-07-08 03:53:43 +08:00
|
|
|
{ icon: "discord", label: "Dscord", href: config.discord },
|
2025-07-08 02:44:37 +08:00
|
|
|
],
|
2025-06-27 05:22:17 +08:00
|
|
|
head: [
|
|
|
|
|
{
|
|
|
|
|
tag: "link",
|
|
|
|
|
attrs: {
|
|
|
|
|
rel: "icon",
|
|
|
|
|
href: "/favicon.svg",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
2025-06-01 02:41:00 +08:00
|
|
|
editLink: {
|
2025-07-01 18:31:18 +08:00
|
|
|
baseUrl: `${github}/edit/dev/packages/web/`,
|
2025-06-01 02:41:00 +08:00
|
|
|
},
|
|
|
|
|
markdown: {
|
|
|
|
|
headingLinks: false,
|
|
|
|
|
},
|
|
|
|
|
customCss: ["./src/styles/custom.css"],
|
|
|
|
|
logo: {
|
|
|
|
|
light: "./src/assets/logo-light.svg",
|
|
|
|
|
dark: "./src/assets/logo-dark.svg",
|
|
|
|
|
replacesTitle: true,
|
|
|
|
|
},
|
|
|
|
|
sidebar: [
|
|
|
|
|
"docs",
|
|
|
|
|
"docs/config",
|
2025-07-31 06:16:11 +08:00
|
|
|
"docs/providers",
|
2025-07-10 03:46:53 +08:00
|
|
|
"docs/enterprise",
|
2025-07-09 23:12:28 +08:00
|
|
|
"docs/troubleshooting",
|
2025-07-31 06:16:11 +08:00
|
|
|
|
|
|
|
|
{
|
|
|
|
|
label: "Usage",
|
2025-08-01 05:38:48 +08:00
|
|
|
items: ["docs/cli", "docs/ide", "docs/share", "docs/github"],
|
2025-07-31 06:16:11 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
label: "Configure",
|
|
|
|
|
items: [
|
|
|
|
|
"docs/rules",
|
|
|
|
|
"docs/agents",
|
|
|
|
|
"docs/models",
|
|
|
|
|
"docs/themes",
|
2025-08-05 07:52:03 +08:00
|
|
|
"docs/plugins",
|
2025-07-31 06:16:11 +08:00
|
|
|
"docs/keybinds",
|
2025-08-01 07:50:31 +08:00
|
|
|
"docs/formatters",
|
2025-08-05 07:52:03 +08:00
|
|
|
"docs/permissions",
|
2025-08-02 05:03:33 +08:00
|
|
|
"docs/lsp",
|
2025-08-05 07:52:03 +08:00
|
|
|
"docs/mcp-servers",
|
2025-08-01 05:38:48 +08:00
|
|
|
],
|
|
|
|
|
},
|
2025-06-01 02:41:00 +08:00
|
|
|
],
|
|
|
|
|
components: {
|
|
|
|
|
Hero: "./src/components/Hero.astro",
|
2025-06-28 08:03:17 +08:00
|
|
|
Head: "./src/components/Head.astro",
|
2025-06-01 02:41:00 +08:00
|
|
|
Header: "./src/components/Header.astro",
|
|
|
|
|
},
|
|
|
|
|
plugins: [
|
|
|
|
|
theme({
|
2025-06-21 01:12:35 +08:00
|
|
|
headerLinks: config.headerLinks,
|
2025-06-01 02:41:00 +08:00
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
}),
|
|
|
|
|
],
|
2025-07-09 23:01:42 +08:00
|
|
|
redirects: {
|
2025-07-10 07:55:06 +08:00
|
|
|
"/discord": "https://discord.gg/opencode",
|
2025-07-09 23:01:42 +08:00
|
|
|
},
|
2025-06-01 02:41:00 +08:00
|
|
|
})
|
2025-07-09 23:25:58 +08:00
|
|
|
|
|
|
|
|
function configSchema() {
|
|
|
|
|
return {
|
|
|
|
|
name: "configSchema",
|
|
|
|
|
hooks: {
|
|
|
|
|
"astro:build:done": async () => {
|
|
|
|
|
console.log("generating config schema")
|
|
|
|
|
spawnSync("../opencode/script/schema.ts", ["./dist/config.json"])
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|