Files
SpacetimeDB/docs/docusaurus.config.ts
clockwork-labs-bot dc20faa611 docs: improve docs and agent discovery metadata (#5243)
## Summary

- Fix TypeScript view examples to use `ctx.sender` as a property,
matching the server SDK `ViewCtx` API.
- Update the architecture overview TypeScript view snippet to use
`players.rowType` and `undefined` for optional view returns.
- Clarify shared `ViewContext` prose so it does not imply every language
uses a callable `ctx.sender()` API.
- Improve docs agent-readiness metadata:
- publish `/docs/robots.txt` with a docs sitemap directive and
Content-Signal policy
- add Markdown alternate links for the existing `/docs/llms.txt` and
`/docs/llms-full.txt` outputs
- generate `/.well-known/agent-skills`-style discovery metadata under
`/docs/.well-known/agent-skills/` from the repo's existing `skills/`
source files during docs builds

## Validation

- `pnpm --dir docs build`
- `pnpm --dir docs typecheck`
- Verified the docs build emits `robots.txt` and
`.well-known/agent-skills/index.json`.
- Verified generated Agent Skills SHA-256 digests match the emitted
`SKILL.md` artifacts.

## Notes

The Cloudflare agent-readiness scan for `spacetimedb.com` still depends
on the root/marketing host exposing root-level files such as
`/robots.txt`, `/sitemap.xml`, and
`/.well-known/agent-skills/index.json`. This PR makes the docs origin
produce the corresponding docs-scoped artifacts at `/docs/...`; the root
host can route or mirror these if we want the exact `spacetimedb.com`
scan to pick them up.

---------

Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
Co-authored-by: rain <rain@rain.local>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2026-06-13 20:37:38 +00:00

265 lines
6.7 KiB
TypeScript

import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import rehypeShiki, { RehypeShikiOptions } from '@shikijs/rehype';
import bash from 'shiki/langs/bash.mjs';
import c from 'shiki/langs/c.mjs';
import csharp from 'shiki/langs/csharp.mjs';
import fsharp from 'shiki/langs/fsharp.mjs';
import json from 'shiki/langs/json.mjs';
import markdown from 'shiki/langs/markdown.mjs';
import protobuf from 'shiki/langs/proto.mjs';
import python from 'shiki/langs/python.mjs';
import rust from 'shiki/langs/rust.mjs';
import sql from 'shiki/langs/sql.mjs';
import toml from 'shiki/langs/toml.mjs';
import typescript from 'shiki/langs/typescript.mjs';
import tsx from 'shiki/langs/tsx.mjs';
import css from 'shiki/langs/css.mjs';
import nginx from 'shiki/langs/nginx.mjs';
import systemd from 'shiki/langs/systemd.mjs';
import ogTheme from 'shiki/themes/dracula.mjs';
import cpp from 'shiki/langs/cpp.mjs';
import { InkeepConfig } from '@inkeep/cxkit-docusaurus';
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
const shikiTheme = {
...ogTheme,
name: 'spacetime-dark',
};
shikiTheme.colors!['editor.background'] =
'var(--clockworklabs-code-background-color)';
const inkeepConfig: Partial<InkeepConfig> = {
baseSettings: {
// This API key is public, it's okay to have it in client code, https://docs.inkeep.com/cloud/ui-components/public-api-keys#public-clients
apiKey: '13504c49fb56b7c09a5ea0bcd68c2b55857661be4d6d311b',
organizationDisplayName: 'SpacetimeDB',
primaryBrandColor: '#4cf490',
colorMode: {
forcedColorMode: 'dark',
},
},
};
const config: Config = {
title: 'SpacetimeDB docs',
tagline: 'SpacetimeDB',
favicon: 'https://spacetimedb.com/favicon-32x32.png',
url: 'https://spacetimedb.com',
// this means the site is served at https://spacetimedb.com/docs/
baseUrl: '/docs/',
onBrokenLinks: 'throw',
onBrokenAnchors: 'throw',
markdown: {
hooks: {
onBrokenMarkdownImages: 'throw',
onBrokenMarkdownLinks: 'throw',
},
},
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
clientModules: [
require.resolve('./src/client-modules/fonts'),
require.resolve('./src/client-modules/inkeep-font-override'),
],
headTags: [
{
tagName: 'link',
attributes: {
rel: 'alternate',
type: 'text/markdown',
title: 'SpacetimeDB docs for agents',
href: '/docs/llms.txt',
},
},
{
tagName: 'link',
attributes: {
rel: 'alternate',
type: 'text/markdown',
title: 'Full SpacetimeDB docs for agents',
href: '/docs/llms-full.txt',
},
},
{
tagName: 'link',
attributes: {
rel: 'sitemap',
type: 'application/xml',
href: '/docs/sitemap.xml',
},
},
{
tagName: 'link',
attributes: {
rel: 'preload',
as: 'font',
type: 'font/woff2',
href: '/docs/fonts/inter-latin-wght-normal.woff2',
crossorigin: 'anonymous',
},
},
{
tagName: 'link',
attributes: {
rel: 'preload',
as: 'font',
type: 'font/woff2',
href: '/docs/fonts/source-code-pro-latin-wght-normal.woff2',
crossorigin: 'anonymous',
},
},
],
presets: [
[
'classic',
{
docs: {
editUrl:
'https://github.com/clockworklabs/SpacetimeDB/edit/master/docs/',
routeBasePath: '/',
sidebarPath: './sidebars.ts',
sidebarCollapsed: false,
includeCurrentVersion: true,
lastVersion: 'current',
versions: {
current: {
label: '2.0.0',
path: '',
banner: 'none',
},
'1.12.0': {
label: '1.12.0',
banner: 'none',
},
},
beforeDefaultRehypePlugins: [
[
rehypeShiki,
{
theme: shikiTheme,
langs: [
sql,
rust,
csharp,
markdown,
typescript,
bash,
json,
toml,
python,
c,
cpp,
protobuf,
fsharp,
systemd,
tsx,
css,
nginx,
],
} satisfies RehypeShikiOptions,
],
],
},
blog: false,
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
],
themeConfig: {
navbar: {
logo: {
alt: 'SpacetimeDB Logo',
src: '/images/brand.svg',
href: 'https://spacetimedb.com',
target: '_self',
width: 152,
height: 32,
},
hideOnScroll: false,
items: [
{ type: 'search', position: 'left' },
{ type: 'docsVersionDropdown', position: 'left' },
{
href: 'https://spacetimedb.com/install',
label: 'Install',
position: 'right',
},
{
href: 'https://spacetimedb.com/pricing',
label: 'Pricing',
position: 'right',
},
{
href: 'https://spacetimedb.com/blog',
label: 'Blog',
position: 'right',
},
{
href: 'https://spacetimedb.com/community',
label: 'Community',
position: 'right',
},
{
href: 'https://spacetimedb.com/space-race',
label: 'Referrals',
position: 'right',
},
{
href: 'https://spacetimedb.com/login',
label: 'Login',
position: 'right',
className: 'navbar__button',
},
],
},
prism: {},
colorMode: {
disableSwitch: true,
defaultMode: 'light',
},
} satisfies Preset.ThemeConfig,
plugins: [
[
'@inkeep/cxkit-docusaurus',
{
SearchBar: {
...inkeepConfig,
},
ChatButton: {
...inkeepConfig,
},
},
],
[
'@signalwire/docusaurus-plugin-llms-txt',
{
siteTitle: 'SpacetimeDB',
siteDescription:
'SpacetimeDB is a database that lets you write your entire application as a database module. Server logic runs inside the database as WebAssembly. Clients subscribe to queries and get real-time updates over WebSocket. No separate server needed.',
depth: 2,
content: {
enableLlmsFullTxt: true,
enableMarkdownFiles: false,
includeVersionedDocs: false,
},
},
],
],
};
export default config;