diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-18 01:39:39 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-18 05:06:41 +0300 |
| commit | f74602b8813c4937dad505c60ca2f44b3e9b21a1 (patch) | |
| tree | 84d8e27a91a6c4198c59405e6a24848e21ed227b /website/astro.config.mjs | |
| parent | a3d465687b4f5cd16ce5ecc554c163dd45f15a94 (diff) | |
docs: redesign website and add starlight docs
Diffstat (limited to 'website/astro.config.mjs')
| -rw-r--r-- | website/astro.config.mjs | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/website/astro.config.mjs b/website/astro.config.mjs new file mode 100644 index 00000000..82fd4ee6 --- /dev/null +++ b/website/astro.config.mjs @@ -0,0 +1,107 @@ +import { defineConfig } from 'astro/config'; +import starlight from '@astrojs/starlight'; + +const repoBlob = 'https://github.com/ogulcancelik/herdr/blob/master/'; + +function rewriteHerdrLinks() { + const docsLinks = new Map([ + ['README.md', '/docs/'], + ['./README.md', '/docs/'], + ['CONFIGURATION.md', '/docs/configuration/'], + ['./CONFIGURATION.md', '/docs/configuration/'], + ['INTEGRATIONS.md', '/docs/integrations/'], + ['./INTEGRATIONS.md', '/docs/integrations/'], + ['SOCKET_API.md', '/docs/socket-api/'], + ['./SOCKET_API.md', '/docs/socket-api/'], + ['SKILL.md', '/docs/agent-skill/'], + ['./SKILL.md', '/docs/agent-skill/'], + ]); + + return function transform(tree) { + walk(tree, (node) => { + if (!node || (node.type !== 'link' && node.type !== 'definition')) return; + if (typeof node.url !== 'string') return; + + const [path, suffix = ''] = node.url.split(/(?=[#?])/); + const mapped = docsLinks.get(path); + if (mapped) { + node.url = `${mapped}${suffix}`; + return; + } + + const sourcePath = path.startsWith('./') ? path.slice(2) : path; + if ( + sourcePath.startsWith('src/') || + sourcePath.startsWith('scripts/') || + sourcePath.startsWith('assets/') + ) { + node.url = `${repoBlob}${sourcePath}${suffix}`; + } + }); + }; +} + +function walk(node, visitor) { + visitor(node); + if (!node || !Array.isArray(node.children)) return; + for (const child of node.children) walk(child, visitor); +} + +export default defineConfig({ + site: 'https://herdr.dev', + integrations: [ + starlight({ + title: 'herdr', + description: 'Terminal multiplexer for AI coding agents.', + favicon: '/assets/logo.png', + logo: { + src: './public/assets/logo.png', + alt: 'herdr', + }, + social: [ + { + icon: 'github', + label: 'GitHub', + href: 'https://github.com/ogulcancelik/herdr', + }, + ], + customCss: ['./src/styles/starlight.css'], + editLink: { + baseUrl: 'https://github.com/ogulcancelik/herdr/edit/master/', + }, + lastUpdated: true, + disable404Route: true, + sidebar: [ + { + label: 'Start here', + items: [ + { label: 'Overview', slug: 'docs' }, + { label: 'Install', slug: 'docs/install' }, + { label: 'Quick start', slug: 'docs/quick-start' }, + { label: 'Concepts', slug: 'docs/concepts' }, + ], + }, + { + label: 'Core guides', + items: [ + { label: 'Persistence and remote access', slug: 'docs/persistence-remote' }, + { label: 'Agents', slug: 'docs/agents' }, + { label: 'Configuration', slug: 'docs/configuration' }, + { label: 'Integrations', slug: 'docs/integrations' }, + ], + }, + { + label: 'Reference', + items: [ + { label: 'CLI reference', slug: 'docs/cli-reference' }, + { label: 'Socket API', slug: 'docs/socket-api' }, + { label: 'Agent skill', slug: 'docs/agent-skill' }, + ], + }, + ], + }), + ], + markdown: { + remarkPlugins: [rewriteHerdrLinks], + }, +}); |
