Files
vercel__chat/apps/docs/geistdocs.tsx
Rich Haines 1dff4515e2 refactor(docs): migrate chat-sdk.dev to @vercel/geistdocs (#686)
## Summary

Migrates `apps/docs` from locally-copied geistdocs runtime code to the
published
[`@vercel/geistdocs`](https://www.npmjs.com/package/@vercel/geistdocs)
package (1.8.2), following the official [migration
guide](https://preview.geistdocs.com/docs/migration). Net **−8,400
lines**.

### Package-backed now

- Docs page + layouts: `createDocsPage`, `GeistdocsDocsLayout`,
`GeistdocsHomeLayout` (JSON-LD + sr-only markdown hints preserved via
`renderTop`)
- Navbar (OSS product switcher via `navbarOssProducts`), footer,
provider, search dialog, page actions (edit source, feedback, copy page,
Ask AI, open-in-chat, scroll top)
- `/api/search` → `createSearchRoute`, `/api/chat` → `createChatRoute`
(AI SDK v6; AI Gateway default, optional `GEISTDOCS_CHAT_PROXY_URL`)
- `llms.mdx` → `createDocsMarkdownRoute`, `sitemap.md` →
`createSitemapMarkdownRoute` (now includes an **Adapters** section)
- **New**: `/agents.md` via `createAgentsRoute`, backed by a new `agent`
readiness config
- `proxy.ts` → `createProxy` with explicit `markdownRoutes` for `/docs`
→ `llms.mdx` and `/adapters` → `adapters.mdx` (adds AI-agent UA
rewrites)
- CSS: `@vercel/geistdocs/styles.css` + slim local overrides (shadcn
tokens for remaining `components/ui`, body tint, prose inline code,
`#nd-*` tweaks); code blocks now use the geist Shiki theme
- Icons/logos from `@vercel/geistdocs/assets/*`; feedback via the
package action (same geistdocs.com endpoint + `siteId`)

### Kept local by design

- Curated `/llms.txt` index + `/llms-full.txt` corpus — the published
`AGENTS.md`/SKILL.md artifacts and integration tests reference this
exact contract
- The adapters section (README fetching, OG images, JSON-LD, feature
matrices, `adapters.mdx` markdown route) — now rendered inside the
package docs layout
- RSS and OG image routes (app-owned per the migration guide)
- Skipped `/.well-known/mcp.json`: no MCP servers configured, and the
proxy matcher must keep excluding `.well-known` for the served
agent-skills files

### Cleanup

- Deleted local copies: `components/geistdocs/*` chrome,
`components/ai-elements/*`, chat hooks/persistence, feedback server
actions, unused shadcn primitives, geistcn logo/icon fallbacks covered
by package assets
- Removed 13 now-unused deps (`ai@5`, `@ai-sdk/react@2`, `dexie`,
`jotai`, `cmdk`, `vaul`, `mermaid`, `nanoid`, `react-player`,
`use-stick-to-bottom`, `@orama/tokenizers`, `dexie-react-hooks`,
`next-themes`)
- Updated `docs-llms.test.ts` proxy assertions to the `createProxy`
markdown-route shape

### Behavior changes to be aware of

- Code blocks use the geist Shiki theme instead of GitHub light/dark
- Ask AI history is no longer persisted in IndexedDB (package owns the
panel)
- Adapters sidebar uses the standard geistdocs tree rendering instead of
the bespoke grouped sidebar
- Per-page markdown output appends the standard geistdocs footer links
(`/sitemap.md`, `/llms.txt`, `/agents.md`)

## Test plan

- `pnpm validate` green (knip + check + typecheck + test + build)
- Smoke-tested against `next build && next start`: `/`, `/docs`,
`/adapters`, `/agents.md`, `/llms.txt`, `/llms-full.txt`, `/sitemap.md`,
page-level `.md` URLs for both docs and adapters, `Accept:
text/markdown` negotiation, search API, JSON-LD, sr-only markdown hints,
edit-source URLs (`apps/docs/content/docs/{path}`), OSS navbar, page
actions
- Verified compiled CSS chunks contain the home grid, Shiki palette, and
geist utilities (note: stale turbopack dev caches from before this
change can serve incomplete CSS — `rm -rf apps/docs/.next` fixes it)

## Checklist

- [x] All commits are signed and verified
- [x] All commits are signed off for the DCO (`git commit -s`)
- [x] `pnpm validate` passes
- [x] Changeset added (or N/A — docs app + tests only, no package
behavior change)
- [x] Documentation updated (or N/A)

---------

Signed-off-by: molebox <rich@vercel.com>
2026-07-09 15:29:47 +02:00

99 lines
3.1 KiB
TypeScript

import type {
GeistdocsAgentReadinessConfig,
GeistdocsGithubConfig,
} from "@vercel/geistdocs/config";
import { LogoChatSdk } from "@vercel/geistdocs/assets/logos/logo-chat-sdk";
export const Logo = () => <LogoChatSdk height={22} />;
export const github: GeistdocsGithubConfig = {
branch: "main",
editPath: "apps/docs/content/docs/{path}",
owner: "vercel",
repo: "chat",
};
export const nav = [
{
label: "Docs",
href: "/docs",
},
{
label: "Adapters",
href: "/adapters",
},
{
label: "Resources",
href: "/resources",
},
{
label: "API",
href: "/docs/api",
},
{
label: "GitHub",
href: `https://github.com/${github.owner}/${github.repo}/`,
},
];
export const suggestions = [
"What platforms does Chat SDK support?",
"How do I set up a Slack bot with Next.js?",
"How do I send cards and interactive messages?",
"How do I stream AI responses in real-time?",
];
export const title = "Chat SDK Documentation";
export const prompt =
"You are a helpful assistant specializing in answering questions about Chat SDK, a unified SDK for building chat bots across Slack, Microsoft Teams, Google Chat, Discord, and more.";
export const agent: GeistdocsAgentReadinessConfig = {
product: {
name: "Chat SDK",
description:
"A unified TypeScript SDK for building chat bots and agents across Slack, Microsoft Teams, Google Chat, Discord, Telegram, WhatsApp, and more — with type-safe handlers, JSX cards, and AI streaming.",
category: "Chat bot SDK",
audience: ["developers building chat bots and agents", "Vercel users"],
useCases: [
"Build a bot once and run it on every major chat platform",
"Send rich interactive cards with JSX",
"Stream AI responses into chat threads in real time",
],
},
instructions: [
"See /adapters for the catalog of official, vendor-official, and community platform and state adapters; each adapter page is available as Markdown with a .md extension.",
"Use /sitemap.md to identify the most relevant documentation pages before answering broad questions.",
"Use /llms.txt for an index of every documentation page, or /llms-full.txt for the complete documentation corpus as Markdown context.",
"Fetch individual documentation pages with a .md or .mdx extension for focused page-level context.",
"Do not assume API, authentication, OpenAPI, or MCP support unless it is listed in this file.",
],
links: [
{
label: "Chat SDK source",
href: `https://github.com/${github.owner}/${github.repo}`,
description: "Source repository for Chat SDK and its adapters",
},
{
label: "Chat SDK agent skill",
href: "https://chat-sdk.dev/AGENTS.md",
description:
"Agent skill with instructions for building Chat SDK bots",
},
],
};
export const translations = {
en: {
displayName: "English",
},
};
export const basePath: string | undefined = undefined;
/**
* Unique identifier for this site, used in markdown request tracking analytics.
* Each site using geistdocs should set this to a unique value (e.g. "ai-sdk-docs", "next-docs").
*/
export const siteId: string | undefined = "chat-sdk";