cloudaxe-opencode/packages/web/astro.config.mjs

325 lines
8.1 KiB
JavaScript
Raw Permalink Normal View History

2025-05-21 18:24:53 +00:00
// @ts-check
2025-05-31 18:41:00 +00:00
import { defineConfig } from "astro/config"
import starlight from "@astrojs/starlight"
import solidJs from "@astrojs/solid-js"
2025-06-08 03:46:53 +00:00
import cloudflare from "@astrojs/cloudflare"
2025-05-31 18:41:00 +00:00
import theme from "toolbeam-docs-theme"
2025-06-20 17:12:35 +00:00
import config from "./config.mjs"
2025-05-31 18:41:00 +00:00
import { rehypeHeadingIds } from "@astrojs/markdown-remark"
import rehypeAutolinkHeadings from "rehype-autolink-headings"
import { spawnSync } from "child_process"
2025-05-21 18:24:53 +00:00
// https://astro.build/config
export default defineConfig({
2025-07-07 20:36:52 +00:00
site: config.url,
2025-09-03 03:30:26 +00:00
base: "/docs",
2025-06-05 19:37:17 +00:00
output: "server",
2025-06-08 03:46:53 +00:00
adapter: cloudflare({
imageService: "passthrough",
}),
2025-05-31 18:41:00 +00:00
devToolbar: {
enabled: false,
},
server: {
host: "0.0.0.0",
},
2025-05-31 18:41:00 +00:00
markdown: {
rehypePlugins: [rehypeHeadingIds, [rehypeAutolinkHeadings, { behavior: "wrap" }]],
2025-05-31 18:41:00 +00:00
},
build: {},
2025-05-31 18:41:00 +00:00
integrations: [
configSchema(),
2025-05-31 18:41:00 +00:00
solidJs(),
starlight({
title: "OpenCode",
2026-02-09 17:34:35 +00:00
defaultLocale: "root",
locales: {
root: {
label: "English",
lang: "en",
dir: "ltr",
},
ar: {
label: "العربية",
lang: "ar",
dir: "rtl",
},
bs: {
label: "Bosanski",
lang: "bs-BA",
dir: "ltr",
},
da: {
label: "Dansk",
lang: "da-DK",
dir: "ltr",
},
de: {
label: "Deutsch",
lang: "de-DE",
dir: "ltr",
},
es: {
label: "Espa\u00f1ol",
lang: "es-ES",
dir: "ltr",
},
fr: {
label: "Fran\u00e7ais",
lang: "fr-FR",
dir: "ltr",
},
it: {
label: "Italiano",
lang: "it-IT",
dir: "ltr",
},
ja: {
label: "日本語",
lang: "ja-JP",
dir: "ltr",
},
ko: {
label: "한국어",
lang: "ko-KR",
dir: "ltr",
},
nb: {
label: "Norsk Bokm\u00e5l",
lang: "nb-NO",
dir: "ltr",
},
pl: {
label: "Polski",
lang: "pl-PL",
dir: "ltr",
},
"pt-br": {
label: "Portugu\u00eas (Brasil)",
lang: "pt-BR",
dir: "ltr",
},
ru: {
label: "Русский",
lang: "ru-RU",
dir: "ltr",
},
th: {
label: "ไทย",
lang: "th-TH",
dir: "ltr",
},
tr: {
label: "T\u00fcrk\u00e7e",
lang: "tr-TR",
dir: "ltr",
},
"zh-cn": {
label: "简体中文",
lang: "zh-CN",
dir: "ltr",
},
"zh-tw": {
label: "繁體中文",
lang: "zh-TW",
dir: "ltr",
},
},
2026-01-21 20:36:21 +00:00
favicon: "/favicon-v3.svg",
head: [
{
tag: "link",
attrs: {
rel: "icon",
2026-01-21 20:36:21 +00:00
href: "/favicon-v3.ico",
sizes: "32x32",
},
},
{
tag: "link",
attrs: {
rel: "icon",
type: "image/png",
2026-01-21 20:36:21 +00:00
href: "/favicon-96x96-v3.png",
sizes: "96x96",
},
},
{
tag: "link",
attrs: {
rel: "apple-touch-icon",
2026-01-21 20:36:21 +00:00
href: "/apple-touch-icon-v3.png",
sizes: "180x180",
},
},
],
2025-07-15 23:54:51 +00:00
lastUpdated: true,
2025-05-31 18:41:00 +00:00
expressiveCode: { themes: ["github-light", "github-dark"] },
2025-07-07 18:44:37 +00:00
social: [
{ icon: "github", label: "GitHub", href: config.github },
{ icon: "discord", label: "Discord", href: config.discord },
2025-07-07 18:44:37 +00:00
],
2025-05-31 18:41:00 +00:00
editLink: {
2025-08-19 21:21:43 +00:00
baseUrl: `${config.github}/edit/dev/packages/web/`,
2025-05-31 18:41:00 +00: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: [
2025-09-03 03:30:26 +00:00
"",
"config",
"providers",
2025-12-14 00:20:44 +00:00
"network",
2025-09-03 03:30:26 +00:00
"enterprise",
"troubleshooting",
{
label: "Windows",
translations: {
en: "Windows",
ar: "Windows",
"bs-BA": "Windows",
"da-DK": "Windows",
"de-DE": "Windows",
"es-ES": "Windows",
"fr-FR": "Windows",
"it-IT": "Windows",
"ja-JP": "Windows",
"ko-KR": "Windows",
"nb-NO": "Windows",
"pl-PL": "Windows",
"pt-BR": "Windows",
"ru-RU": "Windows",
"th-TH": "Windows",
"tr-TR": "Windows",
"zh-CN": "Windows",
"zh-TW": "Windows",
},
link: "windows-wsl",
},
{
label: "Usage",
2026-02-09 17:34:35 +00:00
translations: {
en: "Usage",
ar: "الاستخدام",
"bs-BA": "Korištenje",
"da-DK": "Brug",
"de-DE": "Nutzung",
"es-ES": "Uso",
"fr-FR": "Utilisation",
"it-IT": "Utilizzo",
"ja-JP": "使い方",
"ko-KR": "사용",
"nb-NO": "Bruk",
"pl-PL": "Użycie",
"pt-BR": "Uso",
"ru-RU": "Использование",
"th-TH": "การใช้งาน",
"tr-TR": "Kullanım",
"zh-CN": "使用",
"zh-TW": "使用",
},
2026-02-27 22:38:28 +00:00
items: ["go", "tui", "cli", "web", "ide", "zen", "share", "github", "gitlab"],
},
{
label: "Configure",
2026-02-09 17:34:35 +00:00
translations: {
en: "Configure",
ar: "الإعداد",
"bs-BA": "Podešavanje",
"da-DK": "Konfiguration",
"de-DE": "Konfiguration",
"es-ES": "Configuración",
"fr-FR": "Configuration",
"it-IT": "Configurazione",
"ja-JP": "設定",
"ko-KR": "구성",
"nb-NO": "Konfigurasjon",
"pl-PL": "Konfiguracja",
"pt-BR": "Configuração",
"ru-RU": "Настройка",
"th-TH": "การกำหนดค่า",
"tr-TR": "Yapılandırma",
"zh-CN": "配置",
"zh-TW": "設定",
},
items: [
2025-10-08 19:58:57 +00:00
"tools",
2025-09-03 03:30:26 +00:00
"rules",
"agents",
"models",
"themes",
"keybinds",
"commands",
"formatters",
"permissions",
"policies",
2025-09-03 03:30:26 +00:00
"lsp",
"mcp-servers",
2025-10-27 05:56:00 +00:00
"acp",
"skills",
"references",
2025-10-27 21:48:17 +00:00
"custom-tools",
2025-07-31 21:38:48 +00:00
],
},
2025-08-19 21:21:43 +00:00
{
label: "Develop",
2026-02-09 17:34:35 +00:00
translations: {
en: "Develop",
ar: "التطوير",
"bs-BA": "Razvoj",
"da-DK": "Udvikling",
"de-DE": "Entwicklung",
"es-ES": "Desarrollo",
"fr-FR": "Développement",
"it-IT": "Sviluppo",
"ja-JP": "開発",
"ko-KR": "개발",
"nb-NO": "Utvikling",
"pl-PL": "Rozwój",
"pt-BR": "Desenvolvimento",
"ru-RU": "Разработка",
"th-TH": "การพัฒนา",
"tr-TR": "Geliştirme",
"zh-CN": "开发",
"zh-TW": "開發",
},
items: ["sdk", "server", "plugins", "ecosystem"],
2025-08-19 21:21:43 +00:00
},
2025-05-31 18:41:00 +00:00
],
components: {
Hero: "./src/components/Hero.astro",
2025-06-28 00:03:17 +00:00
Head: "./src/components/Head.astro",
2025-05-31 18:41:00 +00:00
Header: "./src/components/Header.astro",
2026-02-09 17:34:35 +00:00
Footer: "./src/components/Footer.astro",
LanguageSelect: "./src/components/LanguageSelect.astro",
2025-09-04 00:12:51 +00:00
SiteTitle: "./src/components/SiteTitle.astro",
2025-05-31 18:41:00 +00:00
},
plugins: [
theme({
2025-06-20 17:12:35 +00:00
headerLinks: config.headerLinks,
2025-05-31 18:41:00 +00:00
}),
],
}),
],
})
function configSchema() {
return {
name: "configSchema",
hooks: {
"astro:build:done": async () => {
console.log("generating config schema")
2026-02-25 22:53:09 +00:00
spawnSync("../opencode/script/schema.ts", ["./dist/config.json", "./dist/tui.json"])
},
},
}
}