Incremental engine for long horizon agents π Star if you like it!
Rust agentic-data-frameworkaiai-agentschange-data-capturecodebase-intelligencecontext-engineeringdata-engineeringdata-indexingdata-processingetlhelp-wantedindexingknowledge-graphllmlong-horizon-agentpythonragreal-timerustsemantic-search
// @ts-check
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import { unified } from '@astrojs/markdown-remark';
import bamlGrammar from './scripts/vendor/baml.tmLanguage.json' with { type: 'json' };
import remarkDirective from 'remark-directive';
import remarkAdmonitions from './scripts/remark-admonitions.mjs';
import remarkCodeTitles from './scripts/remark-code-titles.mjs';
import remarkExampleImages from './scripts/remark-example-images.mjs';
import remarkMermaid from '@cocoindex/brand/remark-mermaid';
import remarkLinkChecker from './scripts/remark-link-checker.mjs';
import rehypeLangHeadingIds from './scripts/rehype-lang-heading-ids.mjs';
import { redirects } from './src/data/redirects.ts';
// One shared Shiki theme (the readability-tuned --code-* palette) so docs and
// blog highlight code identically β single source of truth (GUIDELINE Β§5.5).
import { docsCodeTheme } from './scripts/code-theme.mjs';
// V1 docs are served from https://cocoindex.io/docs/, matching the
// Docusaurus URLs on the v1 branch (`baseUrl: '/docs/'` in
// docs/docusaurus.config.ts). `base` handles the prefix.
const BASE = '/docs';
// `remark-link-checker` both validates *and* rewrites relative links: under
// `build.format: 'directory'` (the default), source-relative `./foo` links
// resolve incorrectly in the browser (a page at `/programming_guide/x/`
// makes `./foo` mean `/programming_guide/x/foo`). The plugin emits absolute
// hrefs (`/docs/<slug>/`) so links work regardless of trailing-slash quirks.
// `[plugin, options]` tuples need an explicit type β TypeScript otherwise
// widens the array literal to `(Plugin | Options)[]` and Astro rejects it.
/** @type {any[]} */
const remarkPlugins = [
remarkDirective,
remarkAdmonitions,
remarkMermaid,
remarkCodeTitles,
remarkExampleImages,
[remarkLinkChecker, { base: BASE }],
];
export default defineConfig({
site: 'https://cocoindex.io',
base: BASE,
// `trailingSlash: 'always'` matches `build.format: 'directory'`: every
// page lives at `<slug>/index.html` and is canonical at `<slug>/`. In
// dev, requests without the trailing slash 404, so every href must carry
// it: the remark plugin rewrites relative markdown/MDX links that way,
// and scripts/check-agent-output.mjs fails the build on any root-relative
// link in the output that lacks it, from markdown or from `.astro`
// components (sidebar, breadcrumb, pager, future pieces). External /
// legacy links without the slash still resolve in production via GitHub
// Pages's own 301 redirect, so this doesn't break inbound traffic.
trailingSlash: 'always',
integrations: [
mdx(),
sitemap(),
],
markdown: {
// Astro 7 and MDX share this processor and its plugin pipeline.
// rehypeLangHeadingIds: heading ids per SDK language (see the plugin).
processor: unified({ remarkPlugins, rehypePlugins: [rehypeLangHeadingIds] }),
shikiConfig: { theme: docsCodeTheme, wrap: false, langs: [bamlGrammar] },
},
redirects,
// Vite's default envPrefix is `VITE_`; Astro adds `PUBLIC_`. We also
// want unprefixed `COCOINDEX_DOCS_ALGOLIA_*` names exposed to
// import.meta.env in `.astro` frontmatter β those come from the
// GitHub Actions vars (see .github/workflows/_docs_release.yml) and
// are matched by the same names in docs/.env locally. The Algolia
// search-only API key is public by design; it's safe to inline.
vite: {
envPrefix: ['VITE_', 'PUBLIC_', 'COCOINDEX_'],
},
});