@vercel/geistdocs 1.26.1 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/changelog.d.ts +36 -0
  2. package/dist/changelog.d.ts.map +1 -0
  3. package/dist/changelog.js +143 -0
  4. package/dist/cli/index.js +1 -1
  5. package/dist/config.d.ts +1 -0
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/internal/changelog-entries.d.ts +8 -0
  8. package/dist/internal/changelog-entries.d.ts.map +1 -0
  9. package/dist/internal/changelog-entries.js +25 -0
  10. package/dist/internal/changelog-feed.d.ts +10 -0
  11. package/dist/internal/changelog-feed.d.ts.map +1 -0
  12. package/dist/internal/changelog-feed.js +89 -0
  13. package/dist/internal/changelog.d.ts +36 -0
  14. package/dist/internal/changelog.d.ts.map +1 -0
  15. package/dist/internal/changelog.js +98 -0
  16. package/dist/internal/chat/prompt-input.js +1 -1
  17. package/dist/internal/chat/shell.d.ts.map +1 -1
  18. package/dist/internal/chat/shell.js +18 -7
  19. package/dist/internal/provider-client.d.ts.map +1 -1
  20. package/dist/internal/provider-client.js +2 -1
  21. package/dist/internal/webmcp-client.d.ts +6 -0
  22. package/dist/internal/webmcp-client.d.ts.map +1 -0
  23. package/dist/internal/webmcp-client.js +21 -0
  24. package/dist/internal/webmcp.d.ts +30 -0
  25. package/dist/internal/webmcp.d.ts.map +1 -0
  26. package/dist/internal/webmcp.js +102 -0
  27. package/dist/pages/changelog.d.ts +31 -0
  28. package/dist/pages/changelog.d.ts.map +1 -0
  29. package/dist/pages/changelog.js +86 -0
  30. package/dist/proxy.d.ts +3 -1
  31. package/dist/proxy.d.ts.map +1 -1
  32. package/dist/proxy.js +6 -3
  33. package/dist/routes/changelog.d.ts +43 -0
  34. package/dist/routes/changelog.d.ts.map +1 -0
  35. package/dist/routes/changelog.js +81 -0
  36. package/docs/agents.md +3 -1
  37. package/docs/llms.txt +470 -3
  38. package/docs/manifest.json +17 -1
  39. package/docs/pages/ask-ai.md +2 -1
  40. package/docs/pages/changelog.md +385 -0
  41. package/docs/pages/proxy.md +14 -1
  42. package/docs/pages/webmcp.md +58 -0
  43. package/docs/sitemap.md +2 -0
  44. package/package.json +14 -1
  45. package/template/content/docs/ask-ai.mdx +2 -1
  46. package/template/content/docs/changelog.mdx +382 -0
  47. package/template/content/docs/meta.json +2 -0
  48. package/template/content/docs/proxy.mdx +14 -1
  49. package/template/content/docs/webmcp.mdx +54 -0
  50. package/template/package.json +1 -1
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { useChat } from "@ai-sdk/react";
4
4
  import { DefaultChatTransport } from "ai";
5
5
  import { useLiveQuery } from "dexie-react-hooks";
6
- import { ChevronRightIcon, Trash } from "lucide-react";
6
+ import { ChevronRightIcon, Maximize2Icon, Minimize2Icon, Trash, } from "lucide-react";
7
7
  import { catchError } from "next/error";
8
8
  import { usePathname } from "next/navigation";
9
9
  import { Portal } from "radix-ui";
@@ -90,7 +90,7 @@ const useChatPersistence = (title) => {
90
90
  clearMessages,
91
91
  };
92
92
  };
93
- const GeistdocsChatInner = ({ isOpen }) => {
93
+ const GeistdocsChatInner = ({ isExpanded = false, isOpen, onExpandedChange, }) => {
94
94
  const id = useId();
95
95
  const pathname = usePathname();
96
96
  const textareaRef = useRef(null);
@@ -167,22 +167,33 @@ const GeistdocsChatInner = ({ isOpen }) => {
167
167
  if (isLoading) {
168
168
  return (_jsx("div", { className: "flex size-full w-full flex-col items-center justify-center overflow-hidden whitespace-nowrap rounded-xl xl:max-w-md xl:border xl:bg-background-100", children: _jsx(Spinner, {}) }));
169
169
  }
170
- return (_jsxs("aside", { "aria-label": "Ask AI chat", className: "flex size-full w-full flex-col overflow-hidden whitespace-nowrap bg-background-100", children: [_jsxs("div", { className: "flex items-center justify-between px-4 py-2.5", children: [_jsx("h2", { className: "font-semibold text-sm", children: "Chat" }), _jsx("div", { className: "flex items-center gap-3", children: _jsxs(ButtonGroup, { children: [_jsx(CopyChat, { messages: messages }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { "aria-label": "Clear chat", disabled: messages.length === 0, onClick: handleClearChat, size: "icon-sm", variant: "ghost", children: _jsx(Trash, { className: "size-3.5" }) }) }), _jsx(TooltipContent, { children: "Clear chat" })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { "aria-label": "Close chat", onClick: () => setIsOpen(false), size: "icon-sm", variant: "ghost", children: _jsx(ChevronRightIcon, { className: "size-3.5" }) }) }), _jsx(TooltipContent, { children: "Close chat" })] })] }) })] }), _jsxs(Conversation, { children: [_jsxs(ConversationContent, { children: [messages.map((message) => (_jsxs(Message, { className: "max-w-[90%]", from: message.role, children: [_jsx(MessageMetadata, { inProgress: status === "submitted" || status === "streaming", parts: message.parts }), message.parts
170
+ return (_jsxs("aside", { "aria-label": "Ask AI chat", className: "flex size-full w-full flex-col overflow-hidden whitespace-nowrap bg-background-100", children: [_jsxs("div", { className: cn("flex items-center justify-between px-4 py-2.5", isExpanded && "mx-auto w-full max-w-5xl px-6"), children: [_jsx("h2", { className: "font-semibold text-sm", children: "Chat" }), _jsx("div", { className: "flex items-center gap-3", children: _jsxs(ButtonGroup, { children: [_jsx(CopyChat, { messages: messages }), onExpandedChange ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { "aria-label": isExpanded ? "Collapse chat" : "Expand chat", "aria-pressed": isExpanded, onClick: () => onExpandedChange(!isExpanded), size: "icon-sm", variant: "ghost", children: isExpanded ? (_jsx(Minimize2Icon, { className: "size-3.5" })) : (_jsx(Maximize2Icon, { className: "size-3.5" })) }) }), _jsx(TooltipContent, { children: isExpanded ? "Collapse chat" : "Expand chat" })] })) : null, _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { "aria-label": "Clear chat", disabled: messages.length === 0, onClick: handleClearChat, size: "icon-sm", variant: "ghost", children: _jsx(Trash, { className: "size-3.5" }) }) }), _jsx(TooltipContent, { children: "Clear chat" })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { "aria-label": "Close chat", onClick: () => setIsOpen(false), size: "icon-sm", variant: "ghost", children: _jsx(ChevronRightIcon, { className: "size-3.5" }) }) }), _jsx(TooltipContent, { children: "Close chat" })] })] }) })] }), _jsxs(Conversation, { children: [_jsxs(ConversationContent, { className: cn(isExpanded && "mx-auto w-full max-w-5xl px-6"), children: [messages.map((message) => (_jsxs(Message, { className: cn(isExpanded ? "max-w-full" : "max-w-[90%]"), from: message.role, children: [_jsx(MessageMetadata, { inProgress: status === "submitted" || status === "streaming", parts: message.parts }), message.parts
171
171
  .filter((part) => part.type === "text")
172
- .map((part) => (_jsx(MessageContent, { children: _jsx(MessageResponse, { className: "text-wrap", children: part.text }) }, `${message.id}-${part.type}-${part.text}`)))] }, message.id))), status === "submitted" ? (_jsx("div", { className: "size-12 text-gray-800 text-sm", children: _jsx(Spinner, {}) })) : null] }), _jsx(ConversationScrollButton, {})] }), _jsxs("div", { className: "relative grid w-auto shrink-0 gap-4 p-4", children: [messages.length ? null : (_jsxs(_Fragment, { children: [_jsx(Suggestions, { className: "flex-col items-start gap-px", children: suggestions.map((text) => (_jsx(Suggestion, { className: "rounded-none p-0 text-copy-14", onClick: handleSuggestionClick, suggestion: text, variant: "link" }, text))) }), _jsxs("p", { className: "text-gray-800 text-sm", children: ["Tip: You can open and close chat with", " ", _jsxs(KbdGroup, { children: [_jsx(Kbd, { className: "border bg-transparent", children: "\u2318" }), _jsx(Kbd, { className: "border bg-transparent", children: "I" })] })] })] })), _jsx(ChatPromptInput, { onChange: setPrompt, onStop: stop, onSubmit: (event) => {
172
+ .map((part) => (_jsx(MessageContent, { children: _jsx(MessageResponse, { className: "text-wrap", children: part.text }) }, `${message.id}-${part.type}-${part.text}`)))] }, message.id))), status === "submitted" ? (_jsx("div", { className: "size-12 text-gray-800 text-sm", children: _jsx(Spinner, {}) })) : null] }), _jsx(ConversationScrollButton, {})] }), _jsxs("div", { className: cn("relative grid w-auto shrink-0 gap-4 p-4", isExpanded && "mx-auto w-full max-w-5xl px-6"), children: [messages.length ? null : (_jsxs(_Fragment, { children: [_jsx(Suggestions, { className: "flex-col items-start gap-px", children: suggestions.map((text) => (_jsx(Suggestion, { className: "rounded-none p-0 text-copy-14", onClick: handleSuggestionClick, suggestion: text, variant: "link" }, text))) }), _jsxs("p", { className: "text-gray-900 text-sm", children: ["Tip: You can open and close chat with", " ", _jsxs(KbdGroup, { children: [_jsx(Kbd, { className: "border bg-transparent", children: "\u2318" }), _jsx(Kbd, { className: "border bg-transparent", children: "I" })] })] })] })), _jsx(ChatPromptInput, { onChange: setPrompt, onStop: stop, onSubmit: (event) => {
173
173
  event.preventDefault();
174
174
  handleSubmit().catch((error) => {
175
175
  console.error("Failed to submit chat message:", error);
176
176
  });
177
- }, status: status, textareaRef: textareaRef, value: prompt }), footer ? _jsx("div", { className: "text-gray-800 text-sm", children: footer }) : null] })] }));
177
+ }, status: status, textareaRef: textareaRef, value: prompt }), footer ? _jsx("div", { className: "text-gray-900 text-sm", children: footer }) : null] })] }));
178
178
  };
179
179
  const GeistdocsChatErrorFallback = ({ onClose }, { retry }) => (_jsxs("div", { className: "flex size-full flex-col items-start justify-center gap-4 p-6", "data-geistdocs-chat-error": true, role: "alert", children: [_jsx("h2", { className: "font-semibold text-lg", children: "Ask AI couldn't load" }), _jsx("p", { className: "text-gray-900 text-sm", children: "Try loading Ask AI again or close the panel to continue reading." }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { onClick: () => retry(), type: "button", children: "Try again" }), _jsx(Button, { onClick: onClose, type: "button", variant: "outline", children: "Close" })] })] }));
180
180
  const GeistdocsChatErrorBoundary = catchError(GeistdocsChatErrorFallback);
181
181
  export const GeistdocsChatShell = () => {
182
182
  const { enabled, isOpen, setIsOpen } = useGeistdocsChat();
183
183
  const isMobile = useIsMobile();
184
+ const [isExpanded, setIsExpanded] = useState(false);
185
+ useEffect(() => {
186
+ if (!isOpen) {
187
+ setIsExpanded(false);
188
+ }
189
+ }, [isOpen]);
184
190
  useEffect(() => {
185
191
  const handleKeyDown = (event) => {
192
+ if (event.key === "Escape" && isExpanded) {
193
+ event.preventDefault();
194
+ setIsExpanded(false);
195
+ return;
196
+ }
186
197
  if ((event.metaKey || event.ctrlKey) &&
187
198
  !event.altKey &&
188
199
  !event.shiftKey &&
@@ -193,7 +204,7 @@ export const GeistdocsChatShell = () => {
193
204
  };
194
205
  window.addEventListener("keydown", handleKeyDown);
195
206
  return () => window.removeEventListener("keydown", handleKeyDown);
196
- }, [setIsOpen]);
207
+ }, [isExpanded, setIsOpen]);
197
208
  if (!enabled) {
198
209
  return null;
199
210
  }
@@ -202,5 +213,5 @@ export const GeistdocsChatShell = () => {
202
213
  // modal surfaces like the search command menu, dialogs, and
203
214
  // dropdowns (z-50), so opening the command menu paints over an
204
215
  // open chat panel.
205
- "fixed inset-y-0 right-0 z-45 flex h-full w-3/4 max-w-sm flex-col gap-4 border-l bg-background-100 transition-all", "translate-x-full data-[state=open]:translate-x-0"), "data-state": isOpen ? "open" : "closed", children: _jsx(GeistdocsChatErrorBoundary, { onClose: () => setIsOpen(false), children: _jsx(GeistdocsChatInner, { isOpen: isOpen }) }) }) }), _jsx("div", { className: "md:hidden", children: _jsx(Drawer, { onOpenChange: isMobile ? setIsOpen : undefined, open: isMobile ? isOpen : false, children: _jsxs(DrawerContent, { className: "h-[80dvh]", children: [_jsx(DrawerTitle, { className: "sr-only", children: "Ask AI" }), _jsx(DrawerDescription, { className: "sr-only", children: "Chat with the documentation." }), _jsx(GeistdocsChatErrorBoundary, { onClose: () => setIsOpen(false), children: _jsx(GeistdocsChatInner, { isOpen: isOpen }) })] }) }) })] }));
216
+ "fixed inset-y-0 right-0 z-45 flex h-full flex-col gap-4 border-l bg-background-100 transition-all", isExpanded ? "w-screen max-w-none border-l-0" : "w-3/4 max-w-sm", "translate-x-full data-[state=open]:translate-x-0"), "data-state": isOpen ? "open" : "closed", children: _jsx(GeistdocsChatErrorBoundary, { onClose: () => setIsOpen(false), children: _jsx(GeistdocsChatInner, { isExpanded: isExpanded, isOpen: isOpen, onExpandedChange: setIsExpanded }) }) }) }), _jsx("div", { className: "md:hidden", children: _jsx(Drawer, { onOpenChange: isMobile ? setIsOpen : undefined, open: isMobile ? isOpen : false, children: _jsxs(DrawerContent, { className: "h-[80dvh]", children: [_jsx(DrawerTitle, { className: "sr-only", children: "Ask AI" }), _jsx(DrawerDescription, { className: "sr-only", children: "Chat with the documentation." }), _jsx(GeistdocsChatErrorBoundary, { onClose: () => setIsOpen(false), children: _jsx(GeistdocsChatInner, { isOpen: isOpen }) })] }) }) })] }));
206
217
  };
@@ -1 +1 @@
1
- {"version":3,"file":"provider-client.d.ts","sourceRoot":"","sources":["../../src/internal/provider-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAWjD,MAAM,WAAW,sBACf,SAAQ,cAAc,CAAC,OAAO,YAAY,CAAC;IAC3C,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA2CD,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CAM9D,CAAC"}
1
+ {"version":3,"file":"provider-client.d.ts","sourceRoot":"","sources":["../../src/internal/provider-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAYjD,MAAM,WAAW,sBACf,SAAQ,cAAc,CAAC,OAAO,YAAY,CAAC;IAC3C,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA4CD,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CAM9D,CAAC"}
@@ -11,6 +11,7 @@ import { GeistdocsSearchDialog } from "./search";
11
11
  import { Toaster } from "./ui/sonner";
12
12
  import { TooltipProvider } from "./ui/tooltip";
13
13
  import { useIsMobile } from "./use-mobile";
14
+ import { GeistdocsWebMCP } from "./webmcp-client";
14
15
  const GeistdocsProviderInner = ({ config, search, lang, ...props }) => {
15
16
  const { i18n, i18nProvider } = createGeistdocsI18n(config);
16
17
  const { enabled, isOpen } = useGeistdocsChat();
@@ -19,6 +20,6 @@ const GeistdocsProviderInner = ({ config, search, lang, ...props }) => {
19
20
  return (_jsx("div", { className: cn("@container transition-[padding-right] duration-150 ease-[cubic-bezier(0.175,0.885,0.32,1.1)] motion-reduce:transition-none", enabled && isOpen && !isMobile ? "pr-96!" : null), "data-geistdocs-container": true, children: _jsxs(TooltipProvider, { children: [_jsx(RootProvider, { i18n: i18nProvider(lang ?? i18n.defaultLanguage), search: {
20
21
  SearchDialog: SearchDialogComponent,
21
22
  ...search,
22
- }, ...props }), _jsx(Toaster, {}), _jsx(GeistdocsChatShell, {})] }) }));
23
+ }, ...props }), _jsx(GeistdocsWebMCP, { config: config, lang: lang }), _jsx(Toaster, {}), _jsx(GeistdocsChatShell, {})] }) }));
23
24
  };
24
25
  export const GeistdocsProvider = (props) => (_jsx(GeistdocsConfigProvider, { config: props.config, children: _jsx(GeistdocsChatProvider, { config: props.config, children: _jsx(GeistdocsProviderInner, { ...props }) }) }));
@@ -0,0 +1,6 @@
1
+ import type { GeistdocsConfig } from "../config";
2
+ export declare const GeistdocsWebMCP: ({ config, lang, }: {
3
+ config: GeistdocsConfig;
4
+ lang?: string;
5
+ }) => null;
6
+ //# sourceMappingURL=webmcp-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webmcp-client.d.ts","sourceRoot":"","sources":["../../src/internal/webmcp-client.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAOjD,eAAO,MAAM,eAAe,GAAI,mBAG7B;IACD,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,SAiBA,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { useEffect } from "react";
3
+ import { createWebMCPTools, registerWebMCPTools, } from "./webmcp";
4
+ export const GeistdocsWebMCP = ({ config, lang, }) => {
5
+ useEffect(() => {
6
+ const context = document
7
+ .modelContext;
8
+ if (!(config.webmcp?.enabled && context?.registerTool)) {
9
+ return;
10
+ }
11
+ const tools = createWebMCPTools({
12
+ config,
13
+ lang,
14
+ location: window.location,
15
+ });
16
+ return registerWebMCPTools(context, tools, (error) => {
17
+ console.warn("Geistdocs WebMCP registration failed:", error);
18
+ });
19
+ }, [config, lang]);
20
+ return null;
21
+ };
@@ -0,0 +1,30 @@
1
+ import { type GeistdocsConfig } from "../config.js";
2
+ interface ToolExecutionContext {
3
+ signal?: AbortSignal;
4
+ }
5
+ interface WebMCPTool {
6
+ annotations: {
7
+ readOnlyHint: boolean;
8
+ untrustedContentHint: boolean;
9
+ };
10
+ description: string;
11
+ execute: (input: Record<string, unknown>, context?: ToolExecutionContext) => Promise<string>;
12
+ inputSchema: Record<string, unknown>;
13
+ name: string;
14
+ }
15
+ export interface WebMCPContext {
16
+ registerTool: (tool: WebMCPTool, options: {
17
+ signal: AbortSignal;
18
+ }) => Promise<void>;
19
+ }
20
+ interface WebMCPOptions {
21
+ config: GeistdocsConfig;
22
+ fetcher?: typeof fetch;
23
+ lang?: string;
24
+ location: Pick<Location, "href">;
25
+ requestTimeoutMs?: number;
26
+ }
27
+ export declare const createWebMCPTools: ({ config, fetcher, lang, location, requestTimeoutMs, }: WebMCPOptions) => WebMCPTool[];
28
+ export declare const registerWebMCPTools: (context: WebMCPContext, tools: WebMCPTool[], onError: (error: unknown) => void) => () => void;
29
+ export {};
30
+ //# sourceMappingURL=webmcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webmcp.d.ts","sourceRoot":"","sources":["../../src/internal/webmcp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,cAAc,CAAC;AAEtB,UAAU,oBAAoB;IAC5B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,UAAU,UAAU;IAClB,WAAW,EAAE;QAAE,YAAY,EAAE,OAAO,CAAC;QAAC,oBAAoB,EAAE,OAAO,CAAA;KAAE,CAAC;IACtE,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,CACP,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE,oBAAoB,KAC3B,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,CACZ,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE;QAAE,MAAM,EAAE,WAAW,CAAA;KAAE,KAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAED,UAAU,aAAa;IACrB,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,iBAAiB,GAAI,wDAM/B,aAAa,KAAG,UAAU,EA+F5B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,SAAS,aAAa,EACtB,OAAO,UAAU,EAAE,EACnB,SAAS,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,eAoBlC,CAAC"}
@@ -0,0 +1,102 @@
1
+ import { getPublicPath, withBasePath, } from "../config.js";
2
+ export const createWebMCPTools = ({ config, fetcher = fetch, lang, location, requestTimeoutMs = 15_000, }) => {
3
+ const getRequestSignal = (signal) => {
4
+ const deadline = AbortSignal.timeout(requestTimeoutMs);
5
+ return signal ? AbortSignal.any([signal, deadline]) : deadline;
6
+ };
7
+ const annotations = { readOnlyHint: true, untrustedContentHint: true };
8
+ return [
9
+ {
10
+ name: "search_docs",
11
+ description: `Search ${config.title} documentation in the current language. Returns matching titles, excerpts, and page URLs.`,
12
+ annotations,
13
+ inputSchema: {
14
+ type: "object",
15
+ properties: { query: { type: "string", minLength: 1, maxLength: 500 } },
16
+ required: ["query"],
17
+ additionalProperties: false,
18
+ },
19
+ execute: async (input, { signal } = {}) => {
20
+ if (typeof input.query !== "string" ||
21
+ !input.query.trim() ||
22
+ input.query.length > 500) {
23
+ throw new Error("query must contain between 1 and 500 characters.");
24
+ }
25
+ const url = new URL(getPublicPath("/api/search", config.basePath), location.href);
26
+ url.searchParams.set("query", input.query.trim());
27
+ url.searchParams.set("locale", lang ?? config.defaultLanguage ?? "en");
28
+ const response = await fetcher(url, {
29
+ signal: getRequestSignal(signal),
30
+ redirect: "error",
31
+ });
32
+ if (!response.ok) {
33
+ throw new Error(`Documentation search failed (${response.status}).`);
34
+ }
35
+ const results = await response.json();
36
+ if (!Array.isArray(results)) {
37
+ throw new Error("Documentation search returned an invalid response.");
38
+ }
39
+ return JSON.stringify(results.map((result) => {
40
+ if (typeof result !== "object" ||
41
+ result === null ||
42
+ !("url" in result) ||
43
+ typeof result.url !== "string") {
44
+ throw new Error("Documentation search returned an invalid result.");
45
+ }
46
+ return {
47
+ ...result,
48
+ url: withBasePath(result.url, config.basePath),
49
+ };
50
+ }));
51
+ },
52
+ },
53
+ {
54
+ name: "read_current_page",
55
+ description: "Read the current documentation page as Markdown. Navigate to a documentation page before calling this tool.",
56
+ annotations,
57
+ inputSchema: {
58
+ type: "object",
59
+ properties: {},
60
+ additionalProperties: false,
61
+ },
62
+ execute: async (_input, { signal } = {}) => {
63
+ const url = new URL(location.href);
64
+ url.hash = "";
65
+ url.search = "";
66
+ const response = await fetcher(url, {
67
+ headers: { Accept: "text/markdown" },
68
+ redirect: "error",
69
+ signal: getRequestSignal(signal),
70
+ });
71
+ if (!response.ok) {
72
+ throw new Error(`Documentation page could not be read (${response.status}).`);
73
+ }
74
+ if (!response.headers.get("content-type")?.includes("text/markdown")) {
75
+ throw new Error("The current page does not provide documentation Markdown.");
76
+ }
77
+ return response.text();
78
+ },
79
+ },
80
+ ];
81
+ };
82
+ export const registerWebMCPTools = (context, tools, onError) => {
83
+ const controller = new AbortController();
84
+ const register = async () => {
85
+ try {
86
+ for (const tool of tools) {
87
+ if (controller.signal.aborted) {
88
+ return;
89
+ }
90
+ await context.registerTool(tool, { signal: controller.signal });
91
+ }
92
+ }
93
+ catch (error) {
94
+ if (!controller.signal.aborted) {
95
+ controller.abort();
96
+ onError(error);
97
+ }
98
+ }
99
+ };
100
+ register();
101
+ return () => controller.abort();
102
+ };
@@ -0,0 +1,31 @@
1
+ import type { Metadata } from "next";
2
+ import { type ChangelogPageOptions } from "../internal/changelog";
3
+ export interface CreateChangelogPageOptions extends ChangelogPageOptions {
4
+ /** Use the app's next/root-params getter when Cache Components are enabled. */
5
+ getLang?: () => string | Promise<string>;
6
+ }
7
+ interface ChangelogPageProps {
8
+ params: Promise<{
9
+ lang: string;
10
+ page?: string;
11
+ }>;
12
+ }
13
+ export declare const createChangelogPage: (options: CreateChangelogPageOptions) => {
14
+ Page: (props: ChangelogPageProps) => Promise<import("react/jsx-runtime").JSX.Element>;
15
+ PaginatedPage: (props: ChangelogPageProps) => Promise<import("react/jsx-runtime").JSX.Element>;
16
+ generateMetadata: (props: ChangelogPageProps) => Promise<Metadata>;
17
+ generatePaginatedMetadata: (props: ChangelogPageProps) => Promise<Metadata>;
18
+ generateStaticParams: () => {
19
+ lang: string;
20
+ }[];
21
+ generatePageParams: ({ params, }?: {
22
+ params?: {
23
+ lang?: string;
24
+ };
25
+ }) => Promise<{
26
+ lang: string;
27
+ page: string;
28
+ }[]>;
29
+ };
30
+ export {};
31
+ //# sourceMappingURL=changelog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../src/pages/changelog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EACL,KAAK,oBAAoB,EAM1B,MAAM,uBAAuB,CAAC;AAK/B,MAAM,WAAW,0BAA2B,SAAQ,oBAAoB;IACtE,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1C;AAED,UAAU,kBAAkB;IAC1B,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAID,eAAO,MAAM,mBAAmB,GAAI,SAAS,0BAA0B;kBA4G1C,kBAAkB;2BAgBT,kBAAkB;8BAdf,kBAAkB;uCAkBT,kBAAkB;;;;uCAO/D;QACD,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5B;;;;CAUF,CAAC"}
@@ -0,0 +1,86 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { notFound, redirect } from "next/navigation";
3
+ import { getChangelogPage, getChangelogPageParams, getChangelogPagePath, getChangelogPath, parseChangelogPage, } from "../internal/changelog";
4
+ import { ChangelogFeed } from "../internal/changelog-feed";
5
+ import { getGeistdocsLanguageConfig } from "../internal/languages";
6
+ import { GeistdocsPageActions } from "../internal/page-actions-client";
7
+ const TRAILING_SLASH_PATTERN = /\/$/;
8
+ export const createChangelogPage = (options) => {
9
+ const { config, source, path = "/changelog", title = "Changelog", description = "The latest releases, improvements, and fixes.", getLang, markdownPath, dataPath, pageSize = 10, } = options;
10
+ const { languages } = getGeistdocsLanguageConfig(config);
11
+ const resolveLang = async ({ params }) => {
12
+ const lang = getLang ? await getLang() : (await params).lang;
13
+ if (!languages.includes(lang)) {
14
+ notFound();
15
+ }
16
+ return lang;
17
+ };
18
+ const markdownHref = (lang, page) => page === 1
19
+ ? getChangelogPath(config, markdownPath, lang)
20
+ : `${getChangelogPagePath(config, path, lang, page)}.md`;
21
+ const metadataForPage = (lang, page) => {
22
+ const canonicalPath = getChangelogPagePath(config, path, lang, page);
23
+ const canonical = config.siteUrl
24
+ ? new URL(canonicalPath, config.siteUrl).toString()
25
+ : canonicalPath;
26
+ const pageTitle = page === 1 ? title : `${title} - Page ${page}`;
27
+ return {
28
+ title: pageTitle,
29
+ description,
30
+ alternates: {
31
+ canonical,
32
+ ...(markdownPath
33
+ ? { types: { "text/markdown": markdownHref(lang, page) } }
34
+ : {}),
35
+ },
36
+ openGraph: {
37
+ title: pageTitle,
38
+ description,
39
+ type: "website",
40
+ url: canonical,
41
+ },
42
+ };
43
+ };
44
+ const renderPage = async (lang, page) => {
45
+ const data = await getChangelogPage({ source, lang, page, pageSize });
46
+ if (!data) {
47
+ notFound();
48
+ }
49
+ const actionPage = {
50
+ markdownUrl: markdownHref(lang, page),
51
+ url: getChangelogPagePath(config, path, lang, page),
52
+ };
53
+ return (_jsxs("main", { className: "mx-auto w-full max-w-[1080px] px-6 pt-16 pb-32 font-sans sm:px-10 lg:pt-24", id: "geistdocs-changelog", children: [_jsxs("header", { className: "border-gray-400 border-b pb-12 lg:pb-16", children: [_jsxs("div", { className: "flex flex-col-reverse gap-4 md:flex-row md:items-end md:justify-between", children: [_jsx("h1", { className: "text-gray-1000 text-heading-40 tracking-tighter", children: title }), markdownPath ? (_jsx(GeistdocsPageActions, { config: config, only: "desktop", page: actionPage })) : null] }), _jsx("p", { className: "mt-5 max-w-xl text-balance text-gray-900 text-lg leading-8", children: description }), markdownPath ? (_jsx("div", { className: "mt-5 @min-[961px]:hidden", children: _jsx(GeistdocsPageActions, { config: config, only: "mobile", page: actionPage }) })) : null, page > 1 ? (_jsxs("p", { className: "mt-5 text-gray-900 text-sm", children: ["Page ", page] })) : null] }), _jsx(ChangelogFeed, { dataPath: getChangelogPath(config, dataPath ?? `${path.replace(TRAILING_SLASH_PATTERN, "")}/data`, lang), initialPage: data, lang: lang, path: getChangelogPath(config, path, lang) }, `${lang}:${page}`)] }));
54
+ };
55
+ const Page = async (props) => renderPage(await resolveLang(props), 1);
56
+ const generateMetadata = async (props) => metadataForPage(await resolveLang(props), 1);
57
+ const resolveArchive = async (props) => {
58
+ const lang = await resolveLang(props);
59
+ const page = parseChangelogPage((await props.params).page);
60
+ if (page === null) {
61
+ notFound();
62
+ }
63
+ if (page === 1) {
64
+ redirect(getChangelogPath(config, path, lang));
65
+ }
66
+ return { lang, page };
67
+ };
68
+ const PaginatedPage = async (props) => {
69
+ const { lang, page } = await resolveArchive(props);
70
+ return renderPage(lang, page);
71
+ };
72
+ const generatePaginatedMetadata = async (props) => {
73
+ const { lang, page } = await resolveArchive(props);
74
+ return metadataForPage(lang, page);
75
+ };
76
+ const generateStaticParams = () => languages.map((lang) => ({ lang }));
77
+ const generatePageParams = ({ params, } = {}) => getChangelogPageParams(options, params?.lang);
78
+ return {
79
+ Page,
80
+ PaginatedPage,
81
+ generateMetadata,
82
+ generatePaginatedMetadata,
83
+ generateStaticParams,
84
+ generatePageParams,
85
+ };
86
+ };
package/dist/proxy.d.ts CHANGED
@@ -27,6 +27,8 @@ export interface GeistdocsMarkdownRoute {
27
27
  }) => `/${string}`);
28
28
  }
29
29
  export interface CreateProxyOptions {
30
+ /** Prepend standalone Markdown mappings without replacing docs mappings. */
31
+ additionalMarkdownRoutes?: GeistdocsMarkdownRoute[];
30
32
  after?: GeistdocsProxyHook | GeistdocsProxyHook[];
31
33
  before?: GeistdocsProxyHook | GeistdocsProxyHook[];
32
34
  config: Pick<GeistdocsConfig, "agent" | "basePath" | "content" | "defaultLanguage" | "translations">;
@@ -38,6 +40,6 @@ export interface CreateProxyOptions {
38
40
  markdownRoutes?: GeistdocsMarkdownRoute[];
39
41
  trackMarkdownRequest?: (event: TrackMarkdownRequestEvent) => Promise<void> | void;
40
42
  }
41
- export declare const createProxy: ({ after, before, config, markdownNotFound, markdownRoutes, trackMarkdownRequest, }: CreateProxyOptions) => (request: NextRequest, context: NextFetchEvent) => Promise<Response>;
43
+ export declare const createProxy: ({ additionalMarkdownRoutes, after, before, config, markdownNotFound, markdownRoutes, trackMarkdownRequest, }: CreateProxyOptions) => (request: NextRequest, context: NextFetchEvent) => Promise<Response>;
42
44
  export {};
43
45
  //# sourceMappingURL=proxy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAEjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,UAAU,CAAC;AAQlB,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,iBAAiB,GACjB,WAAW,GACX,IAAI,CAAC;AAET,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,QAAQ,GAAG,mBAAmB,GAAG,eAAe,CAAC;IAC/D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,cAAc,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,KAAK,eAAe,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,CAC/B,OAAO,EAAE,qBAAqB,KAC3B,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;AAEhD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC;IACnB,EAAE,EACE,IAAI,MAAM,EAAE,GACZ,CAAC,CAAC,OAAO,EAAE;QACT,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,MAAM,EAAE,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,kBAAkB,GAAG,kBAAkB,EAAE,CAAC;IAClD,MAAM,CAAC,EAAE,kBAAkB,GAAG,kBAAkB,EAAE,CAAC;IACnD,MAAM,EAAE,IAAI,CACV,eAAe,EACf,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,iBAAiB,GAAG,cAAc,CACtE,CAAC;IACF,sFAAsF;IACtF,gBAAgB,CAAC,EACb,OAAO,GACP,CAAC,CAAC,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,sBAAsB,EAAE,CAAC;IAC1C,oBAAoB,CAAC,EAAE,CACrB,KAAK,EAAE,yBAAyB,KAC7B,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC3B;AAoKD,eAAO,MAAM,WAAW,GAAI,oFAOzB,kBAAkB,MA6SL,SAAS,WAAW,EAAE,SAAS,cAAc,sBAoD5D,CAAC"}
1
+ {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAEjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,UAAU,CAAC;AAQlB,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,iBAAiB,GACjB,WAAW,GACX,IAAI,CAAC;AAET,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,QAAQ,GAAG,mBAAmB,GAAG,eAAe,CAAC;IAC/D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,cAAc,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,KAAK,eAAe,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,CAC/B,OAAO,EAAE,qBAAqB,KAC3B,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;AAEhD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC;IACnB,EAAE,EACE,IAAI,MAAM,EAAE,GACZ,CAAC,CAAC,OAAO,EAAE;QACT,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,MAAM,EAAE,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,4EAA4E;IAC5E,wBAAwB,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACpD,KAAK,CAAC,EAAE,kBAAkB,GAAG,kBAAkB,EAAE,CAAC;IAClD,MAAM,CAAC,EAAE,kBAAkB,GAAG,kBAAkB,EAAE,CAAC;IACnD,MAAM,EAAE,IAAI,CACV,eAAe,EACf,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,iBAAiB,GAAG,cAAc,CACtE,CAAC;IACF,sFAAsF;IACtF,gBAAgB,CAAC,EACb,OAAO,GACP,CAAC,CAAC,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,sBAAsB,EAAE,CAAC;IAC1C,oBAAoB,CAAC,EAAE,CACrB,KAAK,EAAE,yBAAyB,KAC7B,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC3B;AAoKD,eAAO,MAAM,WAAW,GAAI,8GAQzB,kBAAkB,MAgTL,SAAS,WAAW,EAAE,SAAS,cAAc,sBAoD5D,CAAC"}
package/dist/proxy.js CHANGED
@@ -121,10 +121,13 @@ const getLocalizedPathname = (pathname, languages, defaultLanguage) => {
121
121
  pathname: `/${segments.slice(1).join("/")}`,
122
122
  };
123
123
  };
124
- export const createProxy = ({ after, before, config, markdownNotFound, markdownRoutes, trackMarkdownRequest, }) => {
124
+ export const createProxy = ({ additionalMarkdownRoutes, after, before, config, markdownNotFound, markdownRoutes, trackMarkdownRequest, }) => {
125
125
  const agentEnabled = config.agent !== undefined && config.agent.enabled !== false;
126
- const contentRouteMappings = markdownRoutes ??
127
- inferMarkdownRoutes(config) ?? [DEFAULT_MARKDOWN_ROUTE];
126
+ const contentRouteMappings = [
127
+ ...(additionalMarkdownRoutes ?? []),
128
+ ...(markdownRoutes ??
129
+ inferMarkdownRoutes(config) ?? [DEFAULT_MARKDOWN_ROUTE]),
130
+ ];
128
131
  const routeMappings = agentEnabled
129
132
  ? [...contentRouteMappings, HOME_MARKDOWN_ROUTE]
130
133
  : contentRouteMappings;
@@ -0,0 +1,43 @@
1
+ import { type ChangelogPageOptions } from "../internal/changelog";
2
+ export type CreateChangelogMarkdownRouteOptions = ChangelogPageOptions;
3
+ export type CreateChangelogDataRouteOptions = ChangelogPageOptions;
4
+ export declare const createChangelogMarkdownRoute: ({ config, source, path, title, description, markdownPath, pageSize, }: CreateChangelogMarkdownRouteOptions) => {
5
+ GET: (_request: Request, { params }: {
6
+ params: Promise<{
7
+ lang?: string;
8
+ page?: string;
9
+ }>;
10
+ }) => Promise<Response>;
11
+ generateStaticParams: ({ params, }?: {
12
+ params?: {
13
+ lang?: string;
14
+ };
15
+ }) => {
16
+ lang: string;
17
+ }[];
18
+ generatePageParams: ({ params, }?: {
19
+ params?: {
20
+ lang?: string;
21
+ };
22
+ }) => Promise<{
23
+ lang: string;
24
+ page: string;
25
+ }[]>;
26
+ };
27
+ export declare const createChangelogDataRoute: (options: CreateChangelogDataRouteOptions) => {
28
+ GET: (_request: Request, { params }: {
29
+ params: Promise<{
30
+ lang?: string;
31
+ page?: string;
32
+ }>;
33
+ }) => Promise<Response>;
34
+ generateStaticParams: ({ params, }?: {
35
+ params?: {
36
+ lang?: string;
37
+ };
38
+ }) => Promise<{
39
+ lang: string;
40
+ page: string;
41
+ }[]>;
42
+ };
43
+ //# sourceMappingURL=changelog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../src/routes/changelog.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,oBAAoB,EAO1B,MAAM,uBAAuB,CAAC;AAG/B,MAAM,MAAM,mCAAmC,GAAG,oBAAoB,CAAC;AACvE,MAAM,MAAM,+BAA+B,GAAG,oBAAoB,CAAC;AAWnE,eAAO,MAAM,4BAA4B,GAAI,uEAQ1C,mCAAmC;oBAIxB,OAAO,cACL;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;yCAkDhE;QACD,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5B;;;uCAWE;QACD,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5B;;;;CAMF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,SAAS,+BAA+B;oBAM5B,OAAO,cACL;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;yCAgBhE;QACD,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5B;;;;CAYF,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { applyMarkdownHeaders } from "@vercel/agent-readability";
2
+ import { getChangelogEntryTitle, getChangelogPage, getChangelogPageParams, getChangelogPagePath, getChangelogPath, parseChangelogPage, } from "../internal/changelog";
3
+ import { getGeistdocsLanguageConfig } from "../internal/languages";
4
+ const LINE_BREAK_PATTERN = /[\r\n\u2028\u2029]+/g;
5
+ const HEADING_MARKDOWN_PATTERN = /([\\`*_{}[\]<>#|~])/g;
6
+ const TRAILING_SLASH_PATTERN = /\/+$/;
7
+ const escapeHeading = (value) => value
8
+ .replace(LINE_BREAK_PATTERN, " ")
9
+ .replace(HEADING_MARKDOWN_PATTERN, "\\$1");
10
+ export const createChangelogMarkdownRoute = ({ config, source, path = "/changelog", title = "Changelog", description, markdownPath, pageSize, }) => {
11
+ const { defaultLanguage, languages } = getGeistdocsLanguageConfig(config);
12
+ const GET = async (_request, { params }) => {
13
+ const { lang = defaultLanguage, page: pageParam } = await params;
14
+ const page = parseChangelogPage(pageParam);
15
+ if (!languages.includes(lang) || page === null) {
16
+ return new Response("Not Found", { status: 404 });
17
+ }
18
+ const data = await getChangelogPage({ source, lang, page, pageSize });
19
+ if (!data) {
20
+ return new Response("Not Found", { status: 404 });
21
+ }
22
+ const canonicalPath = getChangelogPagePath(config, path, lang, page);
23
+ const headers = applyMarkdownHeaders(new Headers({ "Content-Type": "text/markdown; charset=utf-8" }), {
24
+ canonicalUrl: config.siteUrl
25
+ ? new URL(canonicalPath, config.siteUrl)
26
+ : canonicalPath,
27
+ });
28
+ const releases = data.entries.map((entry) => `## ${escapeHeading(getChangelogEntryTitle(entry))} {#${entry.id}}\n\n${entry.publishedAt ? `${entry.publishedAt}\n\n` : ""}${entry.body}`);
29
+ const markdownPagePath = (number) => number === 1
30
+ ? getChangelogPath(config, markdownPath ??
31
+ `${path.replace(TRAILING_SLASH_PATTERN, "") || "/"}.md`, lang)
32
+ : `${getChangelogPagePath(config, path, lang, number)}.md`;
33
+ return new Response([
34
+ `# ${escapeHeading(page === 1 ? title : `${title} - Page ${page}`)}`,
35
+ ...(description ? [description] : []),
36
+ ...releases,
37
+ ...(page > 1 ? [`[Previous](${markdownPagePath(page - 1)})`] : []),
38
+ ...(data.nextPage
39
+ ? [`[Next](${markdownPagePath(data.nextPage)})`]
40
+ : []),
41
+ ].join("\n\n"), { headers });
42
+ };
43
+ const generateStaticParams = ({ params, } = {}) => {
44
+ const { lang } = params ?? {};
45
+ return (lang === undefined
46
+ ? languages
47
+ : languages.filter((language) => language === lang)).map((language) => ({ lang: language }));
48
+ };
49
+ const generatePageParams = ({ params, } = {}) => {
50
+ const { lang } = params ?? {};
51
+ return getChangelogPageParams({ config, source, pageSize }, lang);
52
+ };
53
+ return { GET, generateStaticParams, generatePageParams };
54
+ };
55
+ export const createChangelogDataRoute = (options) => {
56
+ const { config, source, pageSize } = options;
57
+ const { defaultLanguage, languages } = getGeistdocsLanguageConfig(config);
58
+ const GET = async (_request, { params }) => {
59
+ const { lang = defaultLanguage, page: pageParam } = await params;
60
+ const page = parseChangelogPage(pageParam);
61
+ if (!languages.includes(lang) || page === null) {
62
+ return new Response("Not Found", { status: 404 });
63
+ }
64
+ const data = await getChangelogPage({ source, lang, page, pageSize });
65
+ if (!data) {
66
+ return new Response("Not Found", { status: 404 });
67
+ }
68
+ return Response.json(data);
69
+ };
70
+ const generateStaticParams = async ({ params, } = {}) => {
71
+ const { lang } = params ?? {};
72
+ const archives = await getChangelogPageParams(options, lang);
73
+ return languages
74
+ .filter((language) => lang === undefined || language === lang)
75
+ .flatMap((language) => [
76
+ { lang: language, page: "1" },
77
+ ...archives.filter((archive) => archive.lang === language),
78
+ ]);
79
+ };
80
+ return { GET, generateStaticParams };
81
+ };
package/docs/agents.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Geistdocs Package Docs
2
2
 
3
- These docs are bundled with `@vercel/geistdocs` 1.26.1 so agents can understand the installed package without web access.
3
+ These docs are bundled with `@vercel/geistdocs` 1.28.0 so agents can understand the installed package without web access.
4
4
  They are generated from `apps/template/content/docs` during the package build.
5
5
 
6
6
  ## How to use these files
@@ -32,6 +32,7 @@ They are generated from `apps/template/content/docs` during the package build.
32
32
  - [Geistdocs Provider](pages/provider.md): The root provider component that wraps your application to handle toast notifications, search, and analytics.
33
33
  - [Versioned docs](pages/versioned-docs.md): Use createVersionedSources to configure stable, pre-release, or host-based documentation versions.
34
34
  - [Proxy and markdown routes](pages/proxy.md): Configure createProxy with generated route discovery, request hooks, markdown mappings, and a static Next.js matcher.
35
+ - [Add a changelog](pages/changelog.md): Connect collection or paged ChangelogSource data to five thin HTML, Markdown, and JSON adapters, preserving existing docs mappings.
35
36
  - [.md Extension](pages/md.md): Access any documentation page as raw Markdown by appending .md or .mdx to the URL for AI tool consumption.
36
37
  - [Agent readiness](pages/agent-readiness.md): Generate /agents.md and /.well-known/mcp.json from Geistdocs config so agents can find docs, Markdown surfaces, API specs, and MCP endpoints.
37
38
  - [Ask AI](pages/ask-ai.md): An AI-powered chat assistant with context-aware search, persistent history, and suggested prompts for your documentation.
@@ -45,3 +46,4 @@ They are generated from `apps/template/content/docs` during the package build.
45
46
  - [RSS](pages/rss.md): An automatically generated RSS 2.0 feed that keeps users informed when documentation is published or updated.
46
47
  - [Table of contents](pages/table-of-contents.md): Geistdocs builds the "On this page" outline from your headings, indents sub-headings under their parent, and tracks the active section along a straight vertical guide rail.
47
48
  - [Theme-Aware Image](pages/theme-aware-image.md): A component that swaps images based on the active theme, built on top of Next.js Image.
49
+ - [WebMCP](pages/webmcp.md): Expose documentation search and page reading to browser agents.