doccupine 0.0.133 → 0.0.135

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 (174) hide show
  1. package/README.md +50 -10
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +478 -45
  4. package/dist/lib/config-manager.d.ts +8 -1
  5. package/dist/lib/config-manager.js +98 -4
  6. package/dist/lib/metadata.d.ts +5 -0
  7. package/dist/lib/metadata.js +15 -4
  8. package/dist/lib/openapi-types.d.ts +120 -0
  9. package/dist/lib/openapi-types.js +14 -0
  10. package/dist/lib/openapi.d.ts +52 -0
  11. package/dist/lib/openapi.js +603 -0
  12. package/dist/lib/rss.d.ts +24 -0
  13. package/dist/lib/rss.js +137 -0
  14. package/dist/lib/structures.js +50 -4
  15. package/dist/lib/types.d.ts +22 -0
  16. package/dist/lib/utils.d.ts +8 -0
  17. package/dist/lib/utils.js +14 -0
  18. package/dist/templates/app/api/playground/route.d.ts +1 -0
  19. package/dist/templates/app/api/playground/route.js +199 -0
  20. package/dist/templates/app/rssRoute.d.ts +11 -0
  21. package/dist/templates/app/rssRoute.js +30 -0
  22. package/dist/templates/components/Docs.d.ts +1 -1
  23. package/dist/templates/components/Docs.js +15 -3
  24. package/dist/templates/components/MDXComponents.d.ts +1 -1
  25. package/dist/templates/components/MDXComponents.js +29 -0
  26. package/dist/templates/components/SideBar.d.ts +1 -1
  27. package/dist/templates/components/SideBar.js +13 -0
  28. package/dist/templates/components/layout/Accordion.d.ts +1 -1
  29. package/dist/templates/components/layout/Accordion.js +3 -2
  30. package/dist/templates/components/layout/ActionBar.d.ts +1 -1
  31. package/dist/templates/components/layout/ActionBar.js +65 -27
  32. package/dist/templates/components/layout/ApiPlayground.d.ts +1 -0
  33. package/dist/templates/components/layout/ApiPlayground.js +1075 -0
  34. package/dist/templates/components/layout/ApiPlaygroundDemo.d.ts +1 -0
  35. package/dist/templates/components/layout/ApiPlaygroundDemo.js +81 -0
  36. package/dist/templates/components/layout/Badge.d.ts +1 -0
  37. package/dist/templates/components/layout/Badge.js +455 -0
  38. package/dist/templates/components/layout/Code.d.ts +1 -1
  39. package/dist/templates/components/layout/Code.js +10 -22
  40. package/dist/templates/components/layout/CopyButton.d.ts +1 -0
  41. package/dist/templates/components/layout/CopyButton.js +68 -0
  42. package/dist/templates/components/layout/DocsComponents.d.ts +1 -1
  43. package/dist/templates/components/layout/DocsComponents.js +14 -0
  44. package/dist/templates/components/layout/Mermaid.d.ts +1 -1
  45. package/dist/templates/components/layout/Mermaid.js +21 -3
  46. package/dist/templates/components/layout/Prompt.d.ts +1 -0
  47. package/dist/templates/components/layout/Prompt.js +149 -0
  48. package/dist/templates/components/layout/SharedStyles.d.ts +1 -1
  49. package/dist/templates/components/layout/SharedStyles.js +0 -4
  50. package/dist/templates/components/layout/Steps.d.ts +1 -1
  51. package/dist/templates/components/layout/Steps.js +0 -1
  52. package/dist/templates/components/layout/Tooltip.d.ts +1 -0
  53. package/dist/templates/components/layout/Tooltip.js +222 -0
  54. package/dist/templates/components/layout/Tree.d.ts +1 -0
  55. package/dist/templates/components/layout/Tree.js +322 -0
  56. package/dist/templates/components/layout/TreeData.d.ts +1 -0
  57. package/dist/templates/components/layout/TreeData.js +131 -0
  58. package/dist/templates/components/layout/Update.d.ts +1 -1
  59. package/dist/templates/components/layout/Update.js +5 -1
  60. package/dist/templates/lib/rss.d.ts +1 -0
  61. package/dist/templates/lib/rss.js +78 -0
  62. package/dist/templates/mdx/accordion.mdx.d.ts +1 -1
  63. package/dist/templates/mdx/accordion.mdx.js +19 -1
  64. package/dist/templates/mdx/ai-assistant.mdx.d.ts +1 -1
  65. package/dist/templates/mdx/ai-assistant.mdx.js +3 -2
  66. package/dist/templates/mdx/analytics.mdx.d.ts +1 -1
  67. package/dist/templates/mdx/analytics.mdx.js +2 -2
  68. package/dist/templates/mdx/api-playground.mdx.d.ts +1 -0
  69. package/dist/templates/mdx/api-playground.mdx.js +158 -0
  70. package/dist/templates/mdx/authentication.mdx.d.ts +1 -1
  71. package/dist/templates/mdx/authentication.mdx.js +3 -3
  72. package/dist/templates/mdx/badges.mdx.d.ts +1 -0
  73. package/dist/templates/mdx/badges.mdx.js +237 -0
  74. package/dist/templates/mdx/buttons.mdx.d.ts +1 -1
  75. package/dist/templates/mdx/buttons.mdx.js +1 -1
  76. package/dist/templates/mdx/callouts.mdx.d.ts +1 -1
  77. package/dist/templates/mdx/callouts.mdx.js +1 -1
  78. package/dist/templates/mdx/cards.mdx.d.ts +1 -1
  79. package/dist/templates/mdx/cards.mdx.js +1 -1
  80. package/dist/templates/mdx/color-swatches.mdx.d.ts +1 -1
  81. package/dist/templates/mdx/color-swatches.mdx.js +1 -1
  82. package/dist/templates/mdx/columns.mdx.d.ts +1 -1
  83. package/dist/templates/mdx/columns.mdx.js +1 -1
  84. package/dist/templates/mdx/commands.mdx.d.ts +1 -1
  85. package/dist/templates/mdx/commands.mdx.js +3 -2
  86. package/dist/templates/mdx/components.mdx.d.ts +1 -1
  87. package/dist/templates/mdx/components.mdx.js +25 -10
  88. package/dist/templates/mdx/deployment-and-hosting.mdx.d.ts +1 -1
  89. package/dist/templates/mdx/deployment-and-hosting.mdx.js +4 -3
  90. package/dist/templates/mdx/fields.mdx.d.ts +1 -1
  91. package/dist/templates/mdx/fields.mdx.js +1 -1
  92. package/dist/templates/mdx/fonts.mdx.d.ts +1 -1
  93. package/dist/templates/mdx/fonts.mdx.js +2 -2
  94. package/dist/templates/mdx/footer-links.mdx.d.ts +1 -1
  95. package/dist/templates/mdx/footer-links.mdx.js +1 -1
  96. package/dist/templates/mdx/frames.mdx.d.ts +1 -1
  97. package/dist/templates/mdx/frames.mdx.js +1 -1
  98. package/dist/templates/mdx/globals.mdx.d.ts +1 -1
  99. package/dist/templates/mdx/globals.mdx.js +1 -1
  100. package/dist/templates/mdx/icons.mdx.d.ts +1 -1
  101. package/dist/templates/mdx/icons.mdx.js +1 -1
  102. package/dist/templates/mdx/image-and-embeds.mdx.d.ts +1 -1
  103. package/dist/templates/mdx/image-and-embeds.mdx.js +1 -1
  104. package/dist/templates/mdx/images-and-embeds.mdx.d.ts +1 -0
  105. package/dist/templates/mdx/images-and-embeds.mdx.js +118 -0
  106. package/dist/templates/mdx/media-and-assets.mdx.d.ts +1 -1
  107. package/dist/templates/mdx/media-and-assets.mdx.js +2 -2
  108. package/dist/templates/mdx/mermaid.mdx.d.ts +1 -1
  109. package/dist/templates/mdx/mermaid.mdx.js +1 -1
  110. package/dist/templates/mdx/model-context-protocol.mdx.d.ts +1 -1
  111. package/dist/templates/mdx/model-context-protocol.mdx.js +2 -2
  112. package/dist/templates/mdx/navigation.mdx.d.ts +1 -1
  113. package/dist/templates/mdx/navigation.mdx.js +27 -12
  114. package/dist/templates/mdx/platform/ai-assistant.mdx.d.ts +1 -1
  115. package/dist/templates/mdx/platform/ai-assistant.mdx.js +4 -3
  116. package/dist/templates/mdx/platform/analytics.mdx.d.ts +1 -1
  117. package/dist/templates/mdx/platform/analytics.mdx.js +2 -2
  118. package/dist/templates/mdx/platform/api-playground.mdx.d.ts +1 -0
  119. package/dist/templates/mdx/platform/api-playground.mdx.js +62 -0
  120. package/dist/templates/mdx/platform/billing.mdx.d.ts +1 -1
  121. package/dist/templates/mdx/platform/billing.mdx.js +1 -1
  122. package/dist/templates/mdx/platform/build-and-deploy.mdx.d.ts +1 -1
  123. package/dist/templates/mdx/platform/build-and-deploy.mdx.js +1 -1
  124. package/dist/templates/mdx/platform/creating-a-project.mdx.d.ts +1 -1
  125. package/dist/templates/mdx/platform/creating-a-project.mdx.js +12 -2
  126. package/dist/templates/mdx/platform/custom-domains.mdx.d.ts +1 -1
  127. package/dist/templates/mdx/platform/custom-domains.mdx.js +1 -1
  128. package/dist/templates/mdx/platform/fonts-settings.mdx.d.ts +1 -1
  129. package/dist/templates/mdx/platform/fonts-settings.mdx.js +1 -1
  130. package/dist/templates/mdx/platform/footer-links.mdx.d.ts +1 -0
  131. package/dist/templates/mdx/platform/{external-links.mdx.js → footer-links.mdx.js} +5 -5
  132. package/dist/templates/mdx/platform/import-from-github.mdx.d.ts +1 -0
  133. package/dist/templates/mdx/platform/import-from-github.mdx.js +91 -0
  134. package/dist/templates/mdx/platform/mcp.mdx.d.ts +1 -1
  135. package/dist/templates/mdx/platform/mcp.mdx.js +3 -3
  136. package/dist/templates/mdx/platform/project-settings.mdx.d.ts +1 -1
  137. package/dist/templates/mdx/platform/project-settings.mdx.js +1 -1
  138. package/dist/templates/mdx/platform/self-updating-docs.mdx.d.ts +1 -0
  139. package/dist/templates/mdx/platform/self-updating-docs.mdx.js +113 -0
  140. package/dist/templates/mdx/platform/team-members.mdx.d.ts +1 -1
  141. package/dist/templates/mdx/platform/team-members.mdx.js +1 -1
  142. package/dist/templates/mdx/prompt.mdx.d.ts +1 -0
  143. package/dist/templates/mdx/prompt.mdx.js +69 -0
  144. package/dist/templates/mdx/sections.mdx.d.ts +1 -1
  145. package/dist/templates/mdx/sections.mdx.js +1 -1
  146. package/dist/templates/mdx/steps.mdx.d.ts +1 -1
  147. package/dist/templates/mdx/steps.mdx.js +1 -1
  148. package/dist/templates/mdx/tabs.mdx.d.ts +1 -1
  149. package/dist/templates/mdx/tabs.mdx.js +1 -1
  150. package/dist/templates/mdx/theme.mdx.d.ts +1 -1
  151. package/dist/templates/mdx/theme.mdx.js +1 -1
  152. package/dist/templates/mdx/tooltips.mdx.d.ts +1 -0
  153. package/dist/templates/mdx/tooltips.mdx.js +57 -0
  154. package/dist/templates/mdx/tree.mdx.d.ts +1 -0
  155. package/dist/templates/mdx/tree.mdx.js +158 -0
  156. package/dist/templates/mdx/update.mdx.d.ts +1 -1
  157. package/dist/templates/mdx/update.mdx.js +42 -2
  158. package/dist/templates/mdx/what-is-doccupine.mdx.d.ts +1 -1
  159. package/dist/templates/mdx/what-is-doccupine.mdx.js +1 -1
  160. package/dist/templates/package.js +7 -7
  161. package/dist/templates/services/openapi/playgroundAllowlistStub.d.ts +1 -0
  162. package/dist/templates/services/openapi/playgroundAllowlistStub.js +4 -0
  163. package/dist/templates/types/openapi.d.ts +1 -0
  164. package/dist/templates/types/openapi.js +93 -0
  165. package/dist/templates/utils/apiSnippets.d.ts +1 -0
  166. package/dist/templates/utils/apiSnippets.js +94 -0
  167. package/dist/templates/utils/orderNavItems.d.ts +1 -1
  168. package/dist/templates/utils/orderNavItems.js +3 -0
  169. package/dist/templates/utils/playgroundAllowlist.d.ts +1 -0
  170. package/dist/templates/utils/playgroundAllowlist.js +70 -0
  171. package/dist/templates/utils/ssrfGuard.d.ts +1 -0
  172. package/dist/templates/utils/ssrfGuard.js +217 -0
  173. package/package.json +4 -3
  174. package/dist/templates/mdx/platform/external-links.mdx.d.ts +0 -1
@@ -0,0 +1,131 @@
1
+ export const treeDataTemplate = `import React from "react";
2
+
3
+ export interface TreeNode {
4
+ id: string;
5
+ name: string;
6
+ isFolder: boolean;
7
+ defaultOpen: boolean;
8
+ openable: boolean;
9
+ children: TreeNode[];
10
+ }
11
+
12
+ export interface TreeFolderProps {
13
+ name: string;
14
+ defaultOpen?: boolean;
15
+ openable?: boolean;
16
+ children?: React.ReactNode;
17
+ }
18
+
19
+ export interface TreeFileProps {
20
+ name: string;
21
+ }
22
+
23
+ // Tree.Folder and Tree.File are declarative markers: the Tree compound in
24
+ // MDXComponents parses them into TreeNode data before anything renders, so
25
+ // they never render on their own. This module must stay free of
26
+ // "use client" - parsing runs where MDX creates the elements (server
27
+ // components included), and only there is comparing an element's type
28
+ // against these markers guaranteed to work. Client modules would turn the
29
+ // markers into reference proxies whose identity does not survive the
30
+ // server boundary.
31
+ export function TreeFolder(_props: TreeFolderProps) {
32
+ return null;
33
+ }
34
+
35
+ export function TreeFile(_props: TreeFileProps) {
36
+ return null;
37
+ }
38
+
39
+ function extractText(children: React.ReactNode): string {
40
+ if (children == null || typeof children === "boolean") return "";
41
+ if (typeof children === "string" || typeof children === "number") {
42
+ return String(children);
43
+ }
44
+ if (Array.isArray(children)) return children.map(extractText).join("");
45
+ if (React.isValidElement(children)) {
46
+ const element = children as React.ReactElement<{
47
+ children?: React.ReactNode;
48
+ }>;
49
+ return extractText(element.props.children);
50
+ }
51
+ return "";
52
+ }
53
+
54
+ type ListElement = React.ReactElement<{ children?: React.ReactNode }>;
55
+
56
+ function isListElement(child: React.ReactNode): child is ListElement {
57
+ return (
58
+ React.isValidElement(child) && (child.type === "ul" || child.type === "ol")
59
+ );
60
+ }
61
+
62
+ // Markdown list syntax: a trailing slash or nested items mark a folder, and
63
+ // folders that contain items expand by default. Names strip inline
64
+ // formatting because only the text content is extracted. Ids derive from
65
+ // position and name so open state survives re-renders.
66
+ function parseListItems(list: ListElement, parentId: string): TreeNode[] {
67
+ const nodes: TreeNode[] = [];
68
+ React.Children.forEach(list.props.children, (item) => {
69
+ if (!React.isValidElement(item) || item.type !== "li") return;
70
+ const li = item as React.ReactElement<{ children?: React.ReactNode }>;
71
+ const labelParts: React.ReactNode[] = [];
72
+ const nestedLists: ListElement[] = [];
73
+ React.Children.forEach(li.props.children, (child) => {
74
+ if (isListElement(child)) nestedLists.push(child);
75
+ else labelParts.push(child);
76
+ });
77
+ const raw = extractText(labelParts).trim();
78
+ const name = raw.endsWith("/") ? raw.slice(0, -1) : raw;
79
+ if (!name) return;
80
+ const id = parentId + "/" + nodes.length + "-" + name;
81
+ nodes.push({
82
+ id,
83
+ name,
84
+ isFolder: raw.endsWith("/") || nestedLists.length > 0,
85
+ defaultOpen: nestedLists.length > 0,
86
+ openable: true,
87
+ children: nestedLists.flatMap((nested) => parseListItems(nested, id)),
88
+ });
89
+ });
90
+ return nodes;
91
+ }
92
+
93
+ // Both authoring syntaxes (Tree.Folder/Tree.File elements and markdown
94
+ // lists) normalize into the same node model, so they can be mixed freely.
95
+ export function parseTreeChildren(
96
+ children: React.ReactNode,
97
+ parentId: string,
98
+ ): TreeNode[] {
99
+ const nodes: TreeNode[] = [];
100
+ React.Children.forEach(children, (child) => {
101
+ if (!React.isValidElement(child)) return;
102
+ if (child.type === TreeFolder) {
103
+ const props = child.props as TreeFolderProps;
104
+ if (!props.name) return;
105
+ const id = parentId + "/" + nodes.length + "-" + props.name;
106
+ nodes.push({
107
+ id,
108
+ name: props.name,
109
+ isFolder: true,
110
+ defaultOpen: props.defaultOpen === true,
111
+ openable: props.openable !== false,
112
+ children: parseTreeChildren(props.children, id),
113
+ });
114
+ } else if (child.type === TreeFile) {
115
+ const props = child.props as TreeFileProps;
116
+ if (!props.name) return;
117
+ nodes.push({
118
+ id: parentId + "/" + nodes.length + "-" + props.name,
119
+ name: props.name,
120
+ isFolder: false,
121
+ defaultOpen: false,
122
+ openable: false,
123
+ children: [],
124
+ });
125
+ } else if (isListElement(child)) {
126
+ nodes.push(...parseListItems(child, parentId + "/" + nodes.length));
127
+ }
128
+ });
129
+ return nodes;
130
+ }
131
+ `;
@@ -1 +1 @@
1
- export declare const updateTemplate = "\"use client\";\nimport styled from \"styled-components\";\nimport { styledSmall } from \"cherry-styled-components\";\nimport { mq, Theme } from \"@/app/theme\";\nimport { slugify } from \"@/components/layout/Slug\";\n\nconst StyledUpdate = styled.div<{ theme: Theme; $columns?: number }>`\n position: relative;\n display: flex;\n gap: 20px;\n flex-direction: column;\n\n ${mq(\"lg\")} {\n margin: 20px 0;\n flex-direction: row;\n }\n`;\n\nconst StyledUpdateLabel = styled.a<{ theme: Theme }>`\n display: inline-block;\n width: fit-content;\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 20%, transparent)`};\n color: ${({ theme }) => theme.colors.primary};\n padding: 2px 4px;\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n font-weight: 600;\n text-decoration: none;\n ${({ theme }) => styledSmall(theme)};\n\n &:hover {\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 35%, transparent)`};\n }\n`;\n\nconst StyledUpdateDescription = styled.div<{ theme: Theme }>`\n ${({ theme }) => styledSmall(theme)};\n color: ${({ theme }) => theme.colors.gray};\n`;\n\nconst StyledUpdateSidebar = styled.div`\n display: flex;\n flex-direction: column;\n gap: 10px;\n\n ${mq(\"lg\")} {\n position: sticky;\n top: 80px;\n align-self: flex-start;\n min-width: 160px;\n }\n`;\n\nconst StyledUpdateChildren = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 20px;\n`;\n\ninterface UpdateProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n label: string;\n description?: string;\n}\n\nfunction Update({ children, label = \"Label\", description, id }: UpdateProps) {\n // MDXComponents injects a de-duplicated id from the shared slugger so the\n // index sidebar anchor resolves here; fall back to a plain slug when used\n // outside the MDX pipeline. The label doubles as an anchor so readers can\n // right-click to copy the deep link (native #anchor jump is offset by the\n // global scroll-padding-top).\n const anchor = id ?? slugify(label);\n return (\n <StyledUpdate id={anchor}>\n <StyledUpdateSidebar>\n <div>\n <StyledUpdateLabel href={`#${anchor}`}>{label}</StyledUpdateLabel>\n </div>\n {description && (\n <StyledUpdateDescription>{description}</StyledUpdateDescription>\n )}\n </StyledUpdateSidebar>\n <StyledUpdateChildren>{children}</StyledUpdateChildren>\n </StyledUpdate>\n );\n}\n\nexport { Update };\n";
1
+ export declare const updateTemplate = "\"use client\";\nimport styled from \"styled-components\";\nimport { styledSmall } from \"cherry-styled-components\";\nimport { mq, Theme } from \"@/app/theme\";\nimport { slugify } from \"@/components/layout/Slug\";\n\nconst StyledUpdate = styled.div<{ theme: Theme; $columns?: number }>`\n position: relative;\n display: flex;\n gap: 20px;\n flex-direction: column;\n\n ${mq(\"lg\")} {\n margin: 20px 0;\n flex-direction: row;\n }\n`;\n\nconst StyledUpdateLabel = styled.a<{ theme: Theme }>`\n display: inline-block;\n width: fit-content;\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 20%, transparent)`};\n color: ${({ theme }) => theme.colors.primary};\n padding: 2px 4px;\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n font-weight: 600;\n text-decoration: none;\n ${({ theme }) => styledSmall(theme)};\n\n &:hover {\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 35%, transparent)`};\n }\n`;\n\nconst StyledUpdateDescription = styled.div<{ theme: Theme }>`\n ${({ theme }) => styledSmall(theme)};\n color: ${({ theme }) => theme.colors.gray};\n`;\n\nconst StyledUpdateSidebar = styled.div`\n display: flex;\n flex-direction: column;\n gap: 10px;\n\n ${mq(\"lg\")} {\n position: sticky;\n top: 80px;\n align-self: flex-start;\n min-width: 160px;\n }\n`;\n\nconst StyledUpdateChildren = styled.div<{ theme: Theme }>`\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 20px;\n color: ${({ theme }) => theme.colors.gray};\n`;\n\ninterface UpdateProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n label: string;\n description?: string;\n // Alternative pure-Markdown text for this entry in the page's RSS feed.\n // Consumed at generation time; never rendered on the page.\n rss?: string;\n}\n\nfunction Update({ children, label = \"Label\", description, id }: UpdateProps) {\n // MDXComponents injects a de-duplicated id from the shared slugger so the\n // index sidebar anchor resolves here; fall back to a plain slug when used\n // outside the MDX pipeline. The label doubles as an anchor so readers can\n // right-click to copy the deep link (native #anchor jump is offset by the\n // global scroll-padding-top).\n const anchor = id ?? slugify(label);\n return (\n <StyledUpdate id={anchor}>\n <StyledUpdateSidebar>\n <div>\n <StyledUpdateLabel href={`#${anchor}`}>{label}</StyledUpdateLabel>\n </div>\n {description && (\n <StyledUpdateDescription>{description}</StyledUpdateDescription>\n )}\n </StyledUpdateSidebar>\n <StyledUpdateChildren>{children}</StyledUpdateChildren>\n </StyledUpdate>\n );\n}\n\nexport { Update };\n";
@@ -52,17 +52,21 @@ const StyledUpdateSidebar = styled.div\`
52
52
  }
53
53
  \`;
54
54
 
55
- const StyledUpdateChildren = styled.div\`
55
+ const StyledUpdateChildren = styled.div<{ theme: Theme }>\`
56
56
  flex: 1;
57
57
  display: flex;
58
58
  flex-direction: column;
59
59
  gap: 20px;
60
+ color: \${({ theme }) => theme.colors.gray};
60
61
  \`;
61
62
 
62
63
  interface UpdateProps extends React.HTMLAttributes<HTMLDivElement> {
63
64
  children: React.ReactNode;
64
65
  label: string;
65
66
  description?: string;
67
+ // Alternative pure-Markdown text for this entry in the page's RSS feed.
68
+ // Consumed at generation time; never rendered on the page.
69
+ rss?: string;
66
70
  }
67
71
 
68
72
  function Update({ children, label = "Label", description, id }: UpdateProps) {
@@ -0,0 +1 @@
1
+ export declare const rssLibTemplate = "import { config } from \"@/utils/config\";\n\nexport interface RssItem {\n title: string;\n anchor: string;\n description: string;\n}\n\nexport interface RssFeedData {\n // Page path relative to the site root, e.g. \"update\" or \"guides/setup\".\n pagePath: string;\n // Channel title; null falls back to the site name from config.json.\n title: string | null;\n // Channel description; null falls back to the config.json description.\n description: string | null;\n items: RssItem[];\n}\n\n// Same base-URL resolution as sitemap.ts/robots.ts: env override first, then\n// config.json. Without either, feed links degrade to root-relative paths.\nfunction resolveBaseUrl(): string | null {\n const raw = process.env.NEXT_PUBLIC_SITE_URL ?? config.url;\n if (!raw) return null;\n return raw.replace(/\\/$/, \"\");\n}\n\n// Ampersand first, or it would re-escape the other entities.\nfunction escapeXml(text: string): string {\n return text\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&apos;\");\n}\n\n// Builds the RSS 2.0 document for a page's subscribable changelog. Entry\n// descriptions arrive as pure Markdown (components, code, and HTML were\n// removed at generation time) and are entity-escaped here, so no CDATA\n// sections are needed. Entries carry no pubDate: the guid is the entry's\n// permalink, so feed readers surface new entries when new guids appear.\nexport function buildRssFeed(feed: RssFeedData): string {\n const base = resolveBaseUrl();\n const pageUrl = base ? `${base}/${feed.pagePath}` : `/${feed.pagePath}`;\n const feedUrl = `${pageUrl}/rss.xml`;\n const siteName = config.name || \"Documentation\";\n const title = feed.title ?? siteName;\n const description = feed.description ?? config.description ?? title;\n\n const items = feed.items.map((item) => {\n const link = `${pageUrl}#${item.anchor}`;\n return [\n \" <item>\",\n ` <title>${escapeXml(item.title)}</title>`,\n ` <link>${escapeXml(link)}</link>`,\n ` <guid isPermaLink=\"true\">${escapeXml(link)}</guid>`,\n ` <description>${escapeXml(item.description)}</description>`,\n \" </item>\",\n ].join(\"\\n\");\n });\n\n return [\n `<?xml version=\"1.0\" encoding=\"UTF-8\"?>`,\n `<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">`,\n \" <channel>\",\n ` <title>${escapeXml(title)}</title>`,\n ` <link>${escapeXml(pageUrl)}</link>`,\n ` <description>${escapeXml(description)}</description>`,\n ` <atom:link href=\"${escapeXml(feedUrl)}\" rel=\"self\" type=\"application/rss+xml\" />`,\n ` <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>`,\n ` <copyright>${escapeXml(siteName)}</copyright>`,\n ...items,\n \" </channel>\",\n \"</rss>\",\n \"\",\n ].join(\"\\n\");\n}\n";
@@ -0,0 +1,78 @@
1
+ export const rssLibTemplate = `import { config } from "@/utils/config";
2
+
3
+ export interface RssItem {
4
+ title: string;
5
+ anchor: string;
6
+ description: string;
7
+ }
8
+
9
+ export interface RssFeedData {
10
+ // Page path relative to the site root, e.g. "update" or "guides/setup".
11
+ pagePath: string;
12
+ // Channel title; null falls back to the site name from config.json.
13
+ title: string | null;
14
+ // Channel description; null falls back to the config.json description.
15
+ description: string | null;
16
+ items: RssItem[];
17
+ }
18
+
19
+ // Same base-URL resolution as sitemap.ts/robots.ts: env override first, then
20
+ // config.json. Without either, feed links degrade to root-relative paths.
21
+ function resolveBaseUrl(): string | null {
22
+ const raw = process.env.NEXT_PUBLIC_SITE_URL ?? config.url;
23
+ if (!raw) return null;
24
+ return raw.replace(/\\/$/, "");
25
+ }
26
+
27
+ // Ampersand first, or it would re-escape the other entities.
28
+ function escapeXml(text: string): string {
29
+ return text
30
+ .replace(/&/g, "&amp;")
31
+ .replace(/</g, "&lt;")
32
+ .replace(/>/g, "&gt;")
33
+ .replace(/"/g, "&quot;")
34
+ .replace(/'/g, "&apos;");
35
+ }
36
+
37
+ // Builds the RSS 2.0 document for a page's subscribable changelog. Entry
38
+ // descriptions arrive as pure Markdown (components, code, and HTML were
39
+ // removed at generation time) and are entity-escaped here, so no CDATA
40
+ // sections are needed. Entries carry no pubDate: the guid is the entry's
41
+ // permalink, so feed readers surface new entries when new guids appear.
42
+ export function buildRssFeed(feed: RssFeedData): string {
43
+ const base = resolveBaseUrl();
44
+ const pageUrl = base ? \`\${base}/\${feed.pagePath}\` : \`/\${feed.pagePath}\`;
45
+ const feedUrl = \`\${pageUrl}/rss.xml\`;
46
+ const siteName = config.name || "Documentation";
47
+ const title = feed.title ?? siteName;
48
+ const description = feed.description ?? config.description ?? title;
49
+
50
+ const items = feed.items.map((item) => {
51
+ const link = \`\${pageUrl}#\${item.anchor}\`;
52
+ return [
53
+ " <item>",
54
+ \` <title>\${escapeXml(item.title)}</title>\`,
55
+ \` <link>\${escapeXml(link)}</link>\`,
56
+ \` <guid isPermaLink="true">\${escapeXml(link)}</guid>\`,
57
+ \` <description>\${escapeXml(item.description)}</description>\`,
58
+ " </item>",
59
+ ].join("\\n");
60
+ });
61
+
62
+ return [
63
+ \`<?xml version="1.0" encoding="UTF-8"?>\`,
64
+ \`<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">\`,
65
+ " <channel>",
66
+ \` <title>\${escapeXml(title)}</title>\`,
67
+ \` <link>\${escapeXml(pageUrl)}</link>\`,
68
+ \` <description>\${escapeXml(description)}</description>\`,
69
+ \` <atom:link href="\${escapeXml(feedUrl)}" rel="self" type="application/rss+xml" />\`,
70
+ \` <lastBuildDate>\${new Date().toUTCString()}</lastBuildDate>\`,
71
+ \` <copyright>\${escapeXml(siteName)}</copyright>\`,
72
+ ...items,
73
+ " </channel>",
74
+ "</rss>",
75
+ "",
76
+ ].join("\\n");
77
+ }
78
+ `;
@@ -1 +1 @@
1
- export declare const accordionMdxTemplate = "---\ntitle: \"Accordion\"\ndescription: \"Interactive panels for toggling visibility of content.\"\ndate: \"2026-02-19\"\ncategory: \"Components\"\ncategoryOrder: 1\norder: 4\n---\n# Accordion\n\nInteractive panels for toggling visibility of content.\n\nAccordion elements help organize information by letting users show or hide sections as needed. They\u2019re an effective way to manage progressive disclosure and simplify navigation through dense or optional content.\n\n## Accordion Usage\n\nYou can use the Accordion component directly within your MDX files without any import. The following example shows a basic usage:\n\n````html\n<Accordion title=\"What is MDX?\">\n You can put any content in here, including other components, like code:\n\n ```java\n class HelloWorld {\n public static void main(String[] args) {\n System.out.println(\"Hello, World!\");\n }\n }\n ```\n</Accordion>\n````\n\n<Accordion title=\"What is MDX?\">\n You can put any content in here, including other components, like code:\n\n ```java\n class HelloWorld {\n public static void main(String[] args) {\n System.out.println(\"Hello, World!\");\n }\n }\n ```\n</Accordion>\n\n## Properties\n\n<Field value=\"title\" type=\"string\" required>\n The title of the accordion.\n</Field>\n\n<Field value=\"children\" type=\"node\" required>\n The content of the accordion.\n</Field>";
1
+ export declare const accordionMdxTemplate = "---\ntitle: \"Accordion\"\ndescription: \"Interactive panels for toggling visibility of content.\"\ndate: \"2026-02-19\"\ncategory: \"Components\"\ncategoryOrder: 1\norder: 6\n---\n# Accordion\n\nInteractive panels for toggling visibility of content.\n\nAccordion elements help organize information by letting users show or hide sections as needed. They\u2019re an effective way to manage progressive disclosure and simplify navigation through dense or optional content.\n\n## Accordion Usage\n\nYou can use the Accordion component directly within your MDX files without any import. The following example shows a basic usage:\n\n````html\n<Accordion title=\"What is MDX?\">\n You can put any content in here, including other components, like code:\n\n ```java\n class HelloWorld {\n public static void main(String[] args) {\n System.out.println(\"Hello, World!\");\n }\n }\n ```\n</Accordion>\n````\n\n<Accordion title=\"What is MDX?\">\n You can put any content in here, including other components, like code:\n\n ```java\n class HelloWorld {\n public static void main(String[] args) {\n System.out.println(\"Hello, World!\");\n }\n }\n ```\n</Accordion>\n\n## Open by default\n\nPass `defaultOpen` to have the panel expanded on first render instead of collapsed:\n\n````html\n<Accordion title=\"Read me first\" defaultOpen>\n This panel starts expanded.\n</Accordion>\n````\n\n<Accordion title=\"Read me first\" defaultOpen>\n This panel starts expanded.\n</Accordion>\n\n## Properties\n\n<Field value=\"title\" type=\"string\" required>\n The title of the accordion.\n</Field>\n\n<Field value=\"children\" type=\"node\" required>\n The content of the accordion.\n</Field>\n\n<Field value=\"defaultOpen\" type=\"boolean\">\n Whether the panel is expanded on first render. Defaults to `false`.\n</Field>";
@@ -4,7 +4,7 @@ description: "Interactive panels for toggling visibility of content."
4
4
  date: "2026-02-19"
5
5
  category: "Components"
6
6
  categoryOrder: 1
7
- order: 4
7
+ order: 6
8
8
  ---
9
9
  # Accordion
10
10
 
@@ -42,6 +42,20 @@ You can use the Accordion component directly within your MDX files without any i
42
42
  \`\`\`
43
43
  </Accordion>
44
44
 
45
+ ## Open by default
46
+
47
+ Pass \`defaultOpen\` to have the panel expanded on first render instead of collapsed:
48
+
49
+ \`\`\`\`html
50
+ <Accordion title="Read me first" defaultOpen>
51
+ This panel starts expanded.
52
+ </Accordion>
53
+ \`\`\`\`
54
+
55
+ <Accordion title="Read me first" defaultOpen>
56
+ This panel starts expanded.
57
+ </Accordion>
58
+
45
59
  ## Properties
46
60
 
47
61
  <Field value="title" type="string" required>
@@ -50,4 +64,8 @@ You can use the Accordion component directly within your MDX files without any i
50
64
 
51
65
  <Field value="children" type="node" required>
52
66
  The content of the accordion.
67
+ </Field>
68
+
69
+ <Field value="defaultOpen" type="boolean">
70
+ Whether the panel is expanded on first render. Defaults to \`false\`.
53
71
  </Field>`;
@@ -1 +1 @@
1
- export declare const aiAssistantMdxTemplate = "---\ntitle: \"AI Assistant\"\ndescription: \"Integrate AI capabilities into your Doccupine documentation using OpenAI, Anthropic, or Google Gemini.\"\ndate: \"2026-02-19\"\ncategory: \"Configuration\"\ncategoryOrder: 3\norder: 8\n---\n# AI Assistant\n\nDoccupine supports AI integration to enhance your documentation experience. You can use OpenAI, Anthropic, or Google Gemini to power AI features in your documentation site. The AI assistant uses your documentation content as context, allowing users to ask questions about your docs and receive accurate answers based on the documentation.\n\n## Opening the Assistant\n\nOnce a provider is configured, an assistant button appears in the header. You can open and close the assistant from anywhere on the site by pressing <kbd>Command</kbd> + <kbd>I</kbd> (<kbd>Ctrl</kbd> + <kbd>I</kbd> on Windows). Press the same shortcut again to dismiss it.\n\n<Callout type=\"note\">\n The keyboard shortcut is only active once you have configured an LLM provider, as described below.\n</Callout>\n\n## Setup\n\nTo enable AI features, create an `.env` file in the directory where your website is generated. By default, this is the `nextjs-app/` directory.\n\n## Configuration\n\nCreate an `.env` file with the following configuration options:\n\n```env\n# LLM Provider Configuration\n# Choose your preferred LLM provider: openai, anthropic, or google\nLLM_PROVIDER=openai\n\n# API Keys (set the one matching your provider)\nOPENAI_API_KEY=your_openai_api_key_here\nANTHROPIC_API_KEY=your_anthropic_api_key_here\nGOOGLE_API_KEY=your_google_api_key_here\n\n# Optional: Override default chat model (see your provider's docs for available models)\n# LLM_CHAT_MODEL=your-model-id\n\n# Optional: Override default embedding model (see your provider's docs for available models)\n# Note: Anthropic doesn't provide embeddings, will fallback to OpenAI\n# LLM_EMBEDDING_MODEL=your-embedding-model-id\n\n# Optional: Set temperature (0-1, default: 0)\n# LLM_TEMPERATURE=0\n\n# Optional: Embedding dimensions for the prebuilt search index (default: 512)\n# Doc vectors are truncated to this many dimensions and stored as int8 to keep\n# the search index small. Lower = smaller index, slightly lower recall.\n# Rebuild after changing this.\n# LLM_EMBEDDING_DIMS=512\n```\n\n## Provider Selection\n\nSet `LLM_PROVIDER` to one of the following values:\n\n- `openai` - Use OpenAI's models\n- `anthropic` - Use Anthropic's models\n- `google` - Use Google's models\n\n## API Keys\n\nYou need to set the API key that matches your chosen provider:\n\n- For OpenAI: Set `OPENAI_API_KEY`\n- For Anthropic: Set `ANTHROPIC_API_KEY`\n- For Google: Set `GOOGLE_API_KEY`\n\n<Callout type=\"warning\">\n Keep your API keys secure. Never commit your `.env` file to version control.\n</Callout>\n\n<Callout type=\"note\">\n Doccupine automatically adds `.env` to your `.gitignore` file.\n</Callout>\n\n## Using Anthropic with OpenAI\n\nIf you want to use Anthropic as your LLM provider, you must also have an OpenAI API key set. Here's why:\n\n### The Situation\n\nAnthropic (Claude) does not provide an embeddings API. They only offer chat/completion models, not text embeddings.\n\nYour RAG (Retrieval-Augmented Generation) system has two components:\n\n- **Chat/Completion** - Generates answers, works with Anthropic.\n- **Embeddings** - Creates vector representations of text for search, Anthropic doesn't provide this.\n\nWhen using Anthropic as your `LLM_PROVIDER`, Doccupine will use Anthropic for chat/completion tasks, but will automatically fallback to OpenAI for embeddings. This means you need both API keys configured:\n\n```env\nLLM_PROVIDER=anthropic\nANTHROPIC_API_KEY=your_anthropic_api_key_here\nOPENAI_API_KEY=your_openai_api_key_here\n```\n\nThis hybrid approach allows you to leverage Anthropic's powerful chat models while still having access to embeddings functionality through OpenAI.\n\n## Default models\n\n| Provider | Chat model | Embedding model |\n| --------- | ---------------------------- | ------------------------ |\n| OpenAI | `gpt-4.1-nano` | `text-embedding-3-small` |\n| Anthropic | `claude-sonnet-4-5-20250929` | OpenAI fallback |\n| Google | `gemini-2.5-flash-lite` | `gemini-embedding-001` |\n\n## Optional Settings\n\n### Chat Model\n\nOverride the default chat model by uncommenting and setting `LLM_CHAT_MODEL`. You can use any available model from your chosen provider. For a complete list of available models, refer to the official documentation:\n\n- [OpenAI Models](https://platform.openai.com/docs/models)\n- [Anthropic Models](https://docs.anthropic.com/claude/docs/models-overview)\n- [Google Gemini Models](https://ai.google.dev/models/gemini)\n\n### Embedding Model\n\nOverride the default embedding model by uncommenting and setting `LLM_EMBEDDING_MODEL`. For a complete list of available embedding models, refer to the official documentation:\n\n- [OpenAI Embeddings](https://platform.openai.com/docs/guides/embeddings)\n- [Google Gemini Embeddings](https://ai.google.dev/gemini-api/docs/embeddings)\n- **Anthropic**: Anthropic doesn't provide embeddings. If you use Anthropic as your provider, Doccupine will fallback to OpenAI for embeddings.\n\n### Temperature\n\nControl the randomness of AI responses by setting `LLM_TEMPERATURE` to a value between 0 and 1:\n\n- `0` - More deterministic and focused responses (default)\n- `1` - More creative and varied responses\n\n### Embedding Dimensions\n\nControl the size of the prebuilt search index by setting `LLM_EMBEDDING_DIMS` (default: 512). Doc vectors are truncated to this many dimensions and stored as int8, keeping `services/mcp/docs-index.json` small so large doc sets don't stall the AI chat on serverless cold starts.\n\n- Lower values produce a smaller index with slightly lower search recall.\n- Values greater than or equal to the model's native dimension keep full precision.\n\nThis value must match between build time and runtime. A mismatch forces Doccupine to re-embed your docs at runtime, so rebuild or redeploy your site after changing it.";
1
+ export declare const aiAssistantMdxTemplate = "---\ntitle: \"AI Assistant\"\ndescription: \"Integrate AI capabilities into your Doccupine documentation using OpenAI, Anthropic, or Google Gemini.\"\ndate: \"2026-02-19\"\ncategory: \"AI & Integrations\"\ncategoryOrder: 3\ncategoryIcon: \"sparkles\"\norder: 1\n---\n# AI Assistant\n\nDoccupine supports AI integration to enhance your documentation experience. You can use OpenAI, Anthropic, or Google Gemini to power AI features in your documentation site. The AI assistant uses your documentation content as context, allowing users to ask questions about your docs and receive accurate answers based on the documentation.\n\n## Opening the Assistant\n\nOnce a provider is configured, an assistant button appears in the header. You can open and close the assistant from anywhere on the site by pressing <kbd>Command</kbd> + <kbd>I</kbd> (<kbd>Ctrl</kbd> + <kbd>I</kbd> on Windows). Press the same shortcut again to dismiss it.\n\n<Callout type=\"note\">\n The keyboard shortcut is only active once you have configured an LLM provider, as described below.\n</Callout>\n\n## Setup\n\nTo enable AI features, create an `.env` file in the directory where your website is generated. By default, this is the `nextjs-app/` directory.\n\n## Configuration\n\nCreate an `.env` file with the following configuration options:\n\n```env\n# LLM Provider Configuration\n# Choose your preferred LLM provider: openai, anthropic, or google\nLLM_PROVIDER=openai\n\n# API Keys (set the one matching your provider)\nOPENAI_API_KEY=your_openai_api_key_here\nANTHROPIC_API_KEY=your_anthropic_api_key_here\nGOOGLE_API_KEY=your_google_api_key_here\n\n# Optional: Override default chat model (see your provider's docs for available models)\n# LLM_CHAT_MODEL=your-model-id\n\n# Optional: Override default embedding model (see your provider's docs for available models)\n# Note: Anthropic doesn't provide embeddings, will fallback to OpenAI\n# LLM_EMBEDDING_MODEL=your-embedding-model-id\n\n# Optional: Set temperature (0-1, default: 0)\n# LLM_TEMPERATURE=0\n\n# Optional: Embedding dimensions for the prebuilt search index (default: 512)\n# Doc vectors are truncated to this many dimensions and stored as int8 to keep\n# the search index small. Lower = smaller index, slightly lower recall.\n# Rebuild after changing this.\n# LLM_EMBEDDING_DIMS=512\n```\n\n## Provider Selection\n\nSet `LLM_PROVIDER` to one of the following values:\n\n- `openai` - Use OpenAI's models\n- `anthropic` - Use Anthropic's models\n- `google` - Use Google's models\n\n## API Keys\n\nYou need to set the API key that matches your chosen provider:\n\n- For OpenAI: Set `OPENAI_API_KEY`\n- For Anthropic: Set `ANTHROPIC_API_KEY`\n- For Google: Set `GOOGLE_API_KEY`\n\n<Callout type=\"warning\">\n Keep your API keys secure. Never commit your `.env` file to version control.\n</Callout>\n\n<Callout type=\"note\">\n Doccupine automatically adds `.env` to your `.gitignore` file.\n</Callout>\n\n## Using Anthropic with OpenAI\n\nIf you want to use Anthropic as your LLM provider, you must also have an OpenAI API key set. Here's why:\n\n### The Situation\n\nAnthropic (Claude) does not provide an embeddings API. They only offer chat/completion models, not text embeddings.\n\nYour RAG (Retrieval-Augmented Generation) system has two components:\n\n- **Chat/Completion** - Generates answers, works with Anthropic.\n- **Embeddings** - Creates vector representations of text for search, Anthropic doesn't provide this.\n\nWhen using Anthropic as your `LLM_PROVIDER`, Doccupine will use Anthropic for chat/completion tasks, but will automatically fallback to OpenAI for embeddings. This means you need both API keys configured:\n\n```env\nLLM_PROVIDER=anthropic\nANTHROPIC_API_KEY=your_anthropic_api_key_here\nOPENAI_API_KEY=your_openai_api_key_here\n```\n\nThis hybrid approach allows you to leverage Anthropic's powerful chat models while still having access to embeddings functionality through OpenAI.\n\n## Default models\n\n| Provider | Chat model | Embedding model |\n| --------- | ---------------------------- | ------------------------ |\n| OpenAI | `gpt-4.1-nano` | `text-embedding-3-small` |\n| Anthropic | `claude-sonnet-4-5-20250929` | OpenAI fallback |\n| Google | `gemini-2.5-flash-lite` | `gemini-embedding-001` |\n\n## Optional Settings\n\n### Chat Model\n\nOverride the default chat model by uncommenting and setting `LLM_CHAT_MODEL`. You can use any available model from your chosen provider. For a complete list of available models, refer to the official documentation:\n\n- [OpenAI Models](https://platform.openai.com/docs/models)\n- [Anthropic Models](https://docs.anthropic.com/claude/docs/models-overview)\n- [Google Gemini Models](https://ai.google.dev/models/gemini)\n\n### Embedding Model\n\nOverride the default embedding model by uncommenting and setting `LLM_EMBEDDING_MODEL`. For a complete list of available embedding models, refer to the official documentation:\n\n- [OpenAI Embeddings](https://platform.openai.com/docs/guides/embeddings)\n- [Google Gemini Embeddings](https://ai.google.dev/gemini-api/docs/embeddings)\n- **Anthropic**: Anthropic doesn't provide embeddings. If you use Anthropic as your provider, Doccupine will fallback to OpenAI for embeddings.\n\n### Temperature\n\nControl the randomness of AI responses by setting `LLM_TEMPERATURE` to a value between 0 and 1:\n\n- `0` - More deterministic and focused responses (default)\n- `1` - More creative and varied responses\n\n### Embedding Dimensions\n\nControl the size of the prebuilt search index by setting `LLM_EMBEDDING_DIMS` (default: 512). Doc vectors are truncated to this many dimensions and stored as int8, keeping `services/mcp/docs-index.json` small so large doc sets don't stall the AI chat on serverless cold starts.\n\n- Lower values produce a smaller index with slightly lower search recall.\n- Values greater than or equal to the model's native dimension keep full precision.\n\nThis value must match between build time and runtime. A mismatch forces Doccupine to re-embed your docs at runtime, so rebuild or redeploy your site after changing it.";
@@ -2,9 +2,10 @@ export const aiAssistantMdxTemplate = `---
2
2
  title: "AI Assistant"
3
3
  description: "Integrate AI capabilities into your Doccupine documentation using OpenAI, Anthropic, or Google Gemini."
4
4
  date: "2026-02-19"
5
- category: "Configuration"
5
+ category: "AI & Integrations"
6
6
  categoryOrder: 3
7
- order: 8
7
+ categoryIcon: "sparkles"
8
+ order: 1
8
9
  ---
9
10
  # AI Assistant
10
11
 
@@ -1 +1 @@
1
- export declare const analyticsMdxTemplate = "---\ntitle: \"Analytics\"\ndescription: \"Add PostHog analytics to your documentation site with an analytics.json file for both client-side and server-side tracking.\"\ndate: \"2026-02-24\"\ncategory: \"Configuration\"\ncategoryOrder: 3\norder: 10\n---\n# Analytics\n\nTrack how users interact with your documentation using PostHog. Doccupine captures page views in two layers out of the box - in the browser and on the server - so readers running ad blockers are still counted. Browser traffic is proxied through your own domain rather than going to PostHog directly.\n\n## analytics.json\n\nPlace an `analytics.json` at your project root (the same directory where you execute `npx doccupine`).\n\n```json\n{\n \"provider\": \"posthog\",\n \"posthog\": {\n \"key\": \"phc_your_project_api_key\",\n \"host\": \"https://us.i.posthog.com\"\n }\n}\n```\n\n## Fields\n\n- **provider**: The analytics provider to use. Currently only `\"posthog\"` is supported.\n- **posthog.key**: Your PostHog project API key. You can find this in your PostHog project settings under \"Project API Key\". This is a public identifier - it is safe to commit to version control.\n- **posthog.host**: The PostHog ingestion endpoint. Use `https://us.i.posthog.com` for US Cloud or `https://eu.i.posthog.com` for EU Cloud. If you self-host PostHog, use your instance URL.\n\n<Callout type=\"note\">\n The PostHog project API key is a public identifier used to send events. It is not a secret and is safe to include in your repository.\n</Callout>\n\n## What gets tracked\n\nWhen `analytics.json` is configured, Doccupine enables two layers of tracking:\n\n### Client-side\n\n- **Page views**: Captured on client-side (soft) navigations using Next.js router hooks. The initial page load is counted by the server instead, so one view is never counted twice.\n- **Page leave**: Automatically captured when a user navigates away from a page.\n\n### Server-side\n\n- **Page views**: Captured in middleware on document requests - the initial load of a page. Requests behind client-side navigations carry an `RSC` header and are skipped, because the browser already counts those.\n- **Request metadata**: URL, pathname, host, referrer, and user agent are sent with each event.\n- **Smart filtering**: API routes, internal Next.js routes, and prefetch requests are automatically excluded.\n- **Ad-blocked readers**: because this half runs on your server, readers who block PostHog in the browser are still counted.\n\n## Privacy proxy\n\nDoccupine routes **browser** analytics traffic through your documentation domain using Next.js rewrites. Instead of the browser talking to PostHog directly (which ad blockers intercept), requests go through `/ingest` on your own domain and are proxied on.\n\nThis means:\n\n- No third-party domains appear in the browser's network requests.\n- Ad blockers are less likely to interfere with tracking.\n- Your users' browsing data stays within your domain boundary before reaching PostHog.\n\nThe proxy destinations are derived automatically from the `host` field in your configuration.\n\n<Callout type=\"warning\">\n The proxy covers browser traffic only. Server-side page views are sent from\n your server straight to PostHog - that is exactly what lets them survive an\n ad blocker.\n</Callout>\n\n## Cookies\n\nAn analytics-enabled site sets two first-party cookies:\n\n- `ph_<key>_posthog` - set by posthog-js, holding its anonymous distinct id and session.\n- `dcp_anon_id` - httpOnly, one year, set by the server so an ad-blocked reader (who never receives the posthog-js cookie) counts as one person instead of a new person on every request.\n\nBoth hold nothing but a random identifier. Whether they require a consent notice\nunder GDPR/ePrivacy depends on your jurisdiction and what you do with the data;\nthat call is yours.\n\n## Getting a PostHog key\n\n1. Sign up at [posthog.com](https://posthog.com) (free tier available).\n2. Create a new project.\n3. Go to **Project Settings** and copy the **Project API Key**.\n4. Paste it into your `analytics.json` as the `posthog.key` value.\n\n## Behavior\n\n- **Placement**: Put `analytics.json` in the project root alongside `config.json` and `theme.json`.\n- **Hot reload**: Changes to `analytics.json` are picked up automatically in watch mode. The layout, middleware, and Next.js config are regenerated.\n- **Graceful degradation**: If `analytics.json` is missing, empty, or has an invalid configuration, no tracking code runs. Your site works exactly the same without it.\n- **Dev server restart**: After adding or removing `analytics.json` for the first time, you may need to restart the Next.js dev server for proxy rewrites to take effect.\n\n<Callout type=\"warning\">\n After adding `analytics.json` for the first time, restart the dev server so the proxy rewrites are picked up by Next.js.\n</Callout>\n\n## Regions\n\nPostHog offers two cloud regions. Set the `host` field accordingly:\n\n| Region | Host |\n| -------- | -------------------------- |\n| US Cloud | `https://us.i.posthog.com` |\n| EU Cloud | `https://eu.i.posthog.com` |\n\nIf you omit the `host` field, it defaults to the US Cloud endpoint.\n\n## Example\n\n### Minimal configuration (US Cloud)\n\n```json\n{\n \"provider\": \"posthog\",\n \"posthog\": {\n \"key\": \"phc_your_project_api_key\"\n }\n}\n```\n\n### EU Cloud\n\n```json\n{\n \"provider\": \"posthog\",\n \"posthog\": {\n \"key\": \"phc_your_project_api_key\",\n \"host\": \"https://eu.i.posthog.com\"\n }\n}\n```\n\n## Tips\n\n- **Start simple**: Add the config with just your key and verify events appear in your PostHog dashboard before customizing further.\n- **Check your dashboard**: After deploying, visit your PostHog project to confirm page view events are flowing in.\n- **Production only**: Consider adding `analytics.json` only in your production/deployment setup to avoid tracking local development traffic.";
1
+ export declare const analyticsMdxTemplate = "---\ntitle: \"Analytics\"\ndescription: \"Add PostHog analytics to your documentation site with an analytics.json file for both client-side and server-side tracking.\"\ndate: \"2026-02-24\"\ncategory: \"AI & Integrations\"\ncategoryOrder: 3\norder: 3\n---\n# Analytics\n\nTrack how users interact with your documentation using PostHog. Doccupine captures page views in two layers out of the box - in the browser and on the server - so readers running ad blockers are still counted. Browser traffic is proxied through your own domain rather than going to PostHog directly.\n\n## analytics.json\n\nPlace an `analytics.json` at your project root (the same directory where you execute `npx doccupine`).\n\n```json\n{\n \"provider\": \"posthog\",\n \"posthog\": {\n \"key\": \"phc_your_project_api_key\",\n \"host\": \"https://us.i.posthog.com\"\n }\n}\n```\n\n## Fields\n\n- **provider**: The analytics provider to use. Currently only `\"posthog\"` is supported.\n- **posthog.key**: Your PostHog project API key. You can find this in your PostHog project settings under \"Project API Key\". This is a public identifier - it is safe to commit to version control.\n- **posthog.host**: The PostHog ingestion endpoint. Use `https://us.i.posthog.com` for US Cloud or `https://eu.i.posthog.com` for EU Cloud. If you self-host PostHog, use your instance URL.\n\n<Callout type=\"note\">\n The PostHog project API key is a public identifier used to send events. It is not a secret and is safe to include in your repository.\n</Callout>\n\n## What gets tracked\n\nWhen `analytics.json` is configured, Doccupine enables two layers of tracking:\n\n### Client-side\n\n- **Page views**: Captured on client-side (soft) navigations using Next.js router hooks. The initial page load is counted by the server instead, so one view is never counted twice.\n- **Page leave**: Automatically captured when a user navigates away from a page.\n\n### Server-side\n\n- **Page views**: Captured in middleware on document requests - the initial load of a page. Requests behind client-side navigations carry an `RSC` header and are skipped, because the browser already counts those.\n- **Request metadata**: URL, pathname, host, referrer, and user agent are sent with each event.\n- **Smart filtering**: API routes, internal Next.js routes, and prefetch requests are automatically excluded.\n- **Ad-blocked readers**: because this half runs on your server, readers who block PostHog in the browser are still counted.\n\n## Privacy proxy\n\nDoccupine routes **browser** analytics traffic through your documentation domain using Next.js rewrites. Instead of the browser talking to PostHog directly (which ad blockers intercept), requests go through `/ingest` on your own domain and are proxied on.\n\nThis means:\n\n- No third-party domains appear in the browser's network requests.\n- Ad blockers are less likely to interfere with tracking.\n- Your users' browsing data stays within your domain boundary before reaching PostHog.\n\nThe proxy destinations are derived automatically from the `host` field in your configuration.\n\n<Callout type=\"warning\">\n The proxy covers browser traffic only. Server-side page views are sent from\n your server straight to PostHog - that is exactly what lets them survive an\n ad blocker.\n</Callout>\n\n## Cookies\n\nAn analytics-enabled site sets two first-party cookies:\n\n- `ph_<key>_posthog` - set by posthog-js, holding its anonymous distinct id and session.\n- `dcp_anon_id` - httpOnly, one year, set by the server so an ad-blocked reader (who never receives the posthog-js cookie) counts as one person instead of a new person on every request.\n\nBoth hold nothing but a random identifier. Whether they require a consent notice\nunder GDPR/ePrivacy depends on your jurisdiction and what you do with the data;\nthat call is yours.\n\n## Getting a PostHog key\n\n1. Sign up at [posthog.com](https://posthog.com) (free tier available).\n2. Create a new project.\n3. Go to **Project Settings** and copy the **Project API Key**.\n4. Paste it into your `analytics.json` as the `posthog.key` value.\n\n## Behavior\n\n- **Placement**: Put `analytics.json` in the project root alongside `config.json` and `theme.json`.\n- **Hot reload**: Changes to `analytics.json` are picked up automatically in watch mode. The layout, middleware, and Next.js config are regenerated.\n- **Graceful degradation**: If `analytics.json` is missing, empty, or has an invalid configuration, no tracking code runs. Your site works exactly the same without it.\n- **Dev server restart**: After adding or removing `analytics.json` for the first time, you may need to restart the Next.js dev server for proxy rewrites to take effect.\n\n<Callout type=\"warning\">\n After adding `analytics.json` for the first time, restart the dev server so the proxy rewrites are picked up by Next.js.\n</Callout>\n\n## Regions\n\nPostHog offers two cloud regions. Set the `host` field accordingly:\n\n| Region | Host |\n| -------- | -------------------------- |\n| US Cloud | `https://us.i.posthog.com` |\n| EU Cloud | `https://eu.i.posthog.com` |\n\nIf you omit the `host` field, it defaults to the US Cloud endpoint.\n\n## Example\n\n### Minimal configuration (US Cloud)\n\n```json\n{\n \"provider\": \"posthog\",\n \"posthog\": {\n \"key\": \"phc_your_project_api_key\"\n }\n}\n```\n\n### EU Cloud\n\n```json\n{\n \"provider\": \"posthog\",\n \"posthog\": {\n \"key\": \"phc_your_project_api_key\",\n \"host\": \"https://eu.i.posthog.com\"\n }\n}\n```\n\n## Tips\n\n- **Start simple**: Add the config with just your key and verify events appear in your PostHog dashboard before customizing further.\n- **Check your dashboard**: After deploying, visit your PostHog project to confirm page view events are flowing in.\n- **Production only**: Consider adding `analytics.json` only in your production/deployment setup to avoid tracking local development traffic.";
@@ -2,9 +2,9 @@ export const analyticsMdxTemplate = `---
2
2
  title: "Analytics"
3
3
  description: "Add PostHog analytics to your documentation site with an analytics.json file for both client-side and server-side tracking."
4
4
  date: "2026-02-24"
5
- category: "Configuration"
5
+ category: "AI & Integrations"
6
6
  categoryOrder: 3
7
- order: 10
7
+ order: 3
8
8
  ---
9
9
  # Analytics
10
10
 
@@ -0,0 +1 @@
1
+ export declare const apiPlaygroundMdxTemplate = "---\ntitle: \"API Playground\"\ndescription: \"Turn an OpenAPI document into an interactive API reference where readers send real requests and see live responses, right inside your docs.\"\ndate: \"2026-07-25\"\ncategory: \"Components\"\ncategoryOrder: 1\norder: 19\n---\n# API Playground\n\nPoint Doccupine at an OpenAPI document and it generates a complete, interactive API reference: one page per endpoint, grouped by tag in the sidebar, each with a \"Send request\" panel that makes real calls and shows the live response - plus copy-pasteable code snippets.\n\n<Callout type=\"note\">\nThe playground is driven entirely by your OpenAPI document. There is nothing to wire up by hand - add one line of config and every endpoint becomes a documented, runnable page.\n</Callout>\n\n## Try it\n\nPress **Try it** below to open the playground, tweak the request body, and send a real request to a live API - right from these docs.\n\n<ApiPlaygroundDemo />\n\n## Enabling the playground\n\n<Steps>\n <Step title=\"Add an openapi path to doccupine.json.\">\n Point at a local `.json`, `.yaml`, or `.yml` OpenAPI 3.0 or 3.1 document.\n\n```json\n{\n \"watchDir\": \"docs\",\n \"outputDir\": \"nextjs-app\",\n \"openapi\": \"openapi.yaml\"\n}\n```\n </Step>\n <Step title=\"Run Doccupine.\">\n On the next build (or live, while watching) Doccupine parses the document, resolves every `$ref`, and writes an endpoint page for each operation.\n </Step>\n <Step title=\"Open the API Reference section.\">\n Endpoints appear in the sidebar grouped by their OpenAPI tag. Editing the spec regenerates the pages automatically.\n </Step>\n</Steps>\n\n## Example spec\n\nDo not have a document yet? This `openapi.yaml` points at [JSONPlaceholder](https://jsonplaceholder.typicode.com), a free public test API, so it works end to end - save it, set `openapi` to it, and the generated pages can send real requests:\n\n```yaml\nopenapi: 3.1.0\ninfo:\n title: JSONPlaceholder\n version: 1.0.0\nservers:\n - url: https://jsonplaceholder.typicode.com\ntags:\n - name: Todos\n - name: Posts\npaths:\n /todos/{id}:\n get:\n summary: Get a to-do\n tags: [Todos]\n parameters:\n - name: id\n in: path\n required: true\n schema:\n type: integer\n responses:\n \"200\":\n description: Just a demo of a to-do item\n /posts:\n post:\n summary: Create a post\n tags: [Posts]\n requestBody:\n required: true\n content:\n application/json:\n example:\n title: Hello\n body: Sent from the docs\n userId: 1\n responses:\n \"201\":\n description: Just a demo of the created post\n```\n\nEach part maps to something in the playground: `servers` sets the request target - and the only host the proxy will call - `tags` group endpoints in the sidebar, and `parameters` and `requestBody` become the inputs (adding a `securitySchemes` entry would produce authentication fields). Doccupine reads OpenAPI 3.0 and 3.1; see the [OpenAPI specification](https://spec.openapis.org) for the full format.\n\n## What gets generated\n\nEvery operation becomes its own page under `/api-reference/{tag}/{operation}`, showing:\n\n<Field value=\"Parameters\" type=\"path, query, header, cookie\">\nEach parameter is rendered with its name, type, and whether it is required, grouped into a collapsible section with an input to fill in.\n</Field>\n\n<Field value=\"Request body\" type=\"editable\">\nA JSON editor prefilled from the schema's example, ready to tweak and send.\n</Field>\n\n<Field value=\"Authentication\" type=\"from securitySchemes\">\nInputs for the endpoint's security schemes - API keys, bearer tokens, or basic auth - generated from the document.\n</Field>\n\n<Field value=\"Response\" type=\"live\">\nThe real status, timing, and body from your API, rendered to match its content type.\n</Field>\n\n## Embedding a single endpoint\n\nTo mix prose and a live endpoint on a hand-written page, reference an operation from the page's frontmatter with `openapi`. Use `METHOD /path` or an `operationId`:\n\n```mdx\n---\ntitle: \"Create a post\"\nopenapi: \"POST /posts\"\n---\n\nPosts are created for a user. The playground above is fully live - fill in the\nbody and send a real request.\n```\n\nDoccupine renders that endpoint's playground above your prose. If the reference does not match any operation in your document, the page still renders its prose and a warning is logged.\n\n## Running requests\n\nRequests run one of two ways, and readers can switch between them:\n\n<Callout type=\"note\">\n**Proxy (default).** The request is forwarded server-side, so it works even when the target API blocks cross-origin browser calls. **Direct.** The browser calls the API itself - useful when the API allows CORS and you want requests to never leave the reader's machine.\n</Callout>\n\nThe proxy is deliberately locked down. It only forwards to the servers declared in your OpenAPI document, refuses to reach private or internal network addresses, and never logs request URLs, headers, or bodies - so API keys a reader enters are not written anywhere.\n\n<Callout type=\"warning\">\nKeys and tokens a reader types are used only to make the request. Turn on \"Show secrets\" to reveal them in the generated code snippets; they are redacted by default.\n</Callout>\n\n## Responses and snippets\n\nResponses render to match their type: images and video play inline, everything else is shown as a formatted, syntax-highlighted body. Alongside the response, the playground generates ready-to-run **cURL**, **JavaScript**, and **Python** snippets for the exact request you built.\n\n## Documenting more than one API\n\nPass an array to document several APIs at once. Each spec becomes its own namespaced section:\n\n```json\n{\n \"openapi\": [\n { \"name\": \"public\", \"file\": \"specs/public.yaml\" },\n { \"name\": \"admin\", \"file\": \"specs/admin.yaml\" }\n ]\n}\n```\n";
@@ -0,0 +1,158 @@
1
+ export const apiPlaygroundMdxTemplate = `---
2
+ title: "API Playground"
3
+ description: "Turn an OpenAPI document into an interactive API reference where readers send real requests and see live responses, right inside your docs."
4
+ date: "2026-07-25"
5
+ category: "Components"
6
+ categoryOrder: 1
7
+ order: 19
8
+ ---
9
+ # API Playground
10
+
11
+ Point Doccupine at an OpenAPI document and it generates a complete, interactive API reference: one page per endpoint, grouped by tag in the sidebar, each with a "Send request" panel that makes real calls and shows the live response - plus copy-pasteable code snippets.
12
+
13
+ <Callout type="note">
14
+ The playground is driven entirely by your OpenAPI document. There is nothing to wire up by hand - add one line of config and every endpoint becomes a documented, runnable page.
15
+ </Callout>
16
+
17
+ ## Try it
18
+
19
+ Press **Try it** below to open the playground, tweak the request body, and send a real request to a live API - right from these docs.
20
+
21
+ <ApiPlaygroundDemo />
22
+
23
+ ## Enabling the playground
24
+
25
+ <Steps>
26
+ <Step title="Add an openapi path to doccupine.json.">
27
+ Point at a local \`.json\`, \`.yaml\`, or \`.yml\` OpenAPI 3.0 or 3.1 document.
28
+
29
+ \`\`\`json
30
+ {
31
+ "watchDir": "docs",
32
+ "outputDir": "nextjs-app",
33
+ "openapi": "openapi.yaml"
34
+ }
35
+ \`\`\`
36
+ </Step>
37
+ <Step title="Run Doccupine.">
38
+ On the next build (or live, while watching) Doccupine parses the document, resolves every \`$ref\`, and writes an endpoint page for each operation.
39
+ </Step>
40
+ <Step title="Open the API Reference section.">
41
+ Endpoints appear in the sidebar grouped by their OpenAPI tag. Editing the spec regenerates the pages automatically.
42
+ </Step>
43
+ </Steps>
44
+
45
+ ## Example spec
46
+
47
+ Do not have a document yet? This \`openapi.yaml\` points at [JSONPlaceholder](https://jsonplaceholder.typicode.com), a free public test API, so it works end to end - save it, set \`openapi\` to it, and the generated pages can send real requests:
48
+
49
+ \`\`\`yaml
50
+ openapi: 3.1.0
51
+ info:
52
+ title: JSONPlaceholder
53
+ version: 1.0.0
54
+ servers:
55
+ - url: https://jsonplaceholder.typicode.com
56
+ tags:
57
+ - name: Todos
58
+ - name: Posts
59
+ paths:
60
+ /todos/{id}:
61
+ get:
62
+ summary: Get a to-do
63
+ tags: [Todos]
64
+ parameters:
65
+ - name: id
66
+ in: path
67
+ required: true
68
+ schema:
69
+ type: integer
70
+ responses:
71
+ "200":
72
+ description: Just a demo of a to-do item
73
+ /posts:
74
+ post:
75
+ summary: Create a post
76
+ tags: [Posts]
77
+ requestBody:
78
+ required: true
79
+ content:
80
+ application/json:
81
+ example:
82
+ title: Hello
83
+ body: Sent from the docs
84
+ userId: 1
85
+ responses:
86
+ "201":
87
+ description: Just a demo of the created post
88
+ \`\`\`
89
+
90
+ Each part maps to something in the playground: \`servers\` sets the request target - and the only host the proxy will call - \`tags\` group endpoints in the sidebar, and \`parameters\` and \`requestBody\` become the inputs (adding a \`securitySchemes\` entry would produce authentication fields). Doccupine reads OpenAPI 3.0 and 3.1; see the [OpenAPI specification](https://spec.openapis.org) for the full format.
91
+
92
+ ## What gets generated
93
+
94
+ Every operation becomes its own page under \`/api-reference/{tag}/{operation}\`, showing:
95
+
96
+ <Field value="Parameters" type="path, query, header, cookie">
97
+ Each parameter is rendered with its name, type, and whether it is required, grouped into a collapsible section with an input to fill in.
98
+ </Field>
99
+
100
+ <Field value="Request body" type="editable">
101
+ A JSON editor prefilled from the schema's example, ready to tweak and send.
102
+ </Field>
103
+
104
+ <Field value="Authentication" type="from securitySchemes">
105
+ Inputs for the endpoint's security schemes - API keys, bearer tokens, or basic auth - generated from the document.
106
+ </Field>
107
+
108
+ <Field value="Response" type="live">
109
+ The real status, timing, and body from your API, rendered to match its content type.
110
+ </Field>
111
+
112
+ ## Embedding a single endpoint
113
+
114
+ To mix prose and a live endpoint on a hand-written page, reference an operation from the page's frontmatter with \`openapi\`. Use \`METHOD /path\` or an \`operationId\`:
115
+
116
+ \`\`\`mdx
117
+ ---
118
+ title: "Create a post"
119
+ openapi: "POST /posts"
120
+ ---
121
+
122
+ Posts are created for a user. The playground above is fully live - fill in the
123
+ body and send a real request.
124
+ \`\`\`
125
+
126
+ Doccupine renders that endpoint's playground above your prose. If the reference does not match any operation in your document, the page still renders its prose and a warning is logged.
127
+
128
+ ## Running requests
129
+
130
+ Requests run one of two ways, and readers can switch between them:
131
+
132
+ <Callout type="note">
133
+ **Proxy (default).** The request is forwarded server-side, so it works even when the target API blocks cross-origin browser calls. **Direct.** The browser calls the API itself - useful when the API allows CORS and you want requests to never leave the reader's machine.
134
+ </Callout>
135
+
136
+ The proxy is deliberately locked down. It only forwards to the servers declared in your OpenAPI document, refuses to reach private or internal network addresses, and never logs request URLs, headers, or bodies - so API keys a reader enters are not written anywhere.
137
+
138
+ <Callout type="warning">
139
+ Keys and tokens a reader types are used only to make the request. Turn on "Show secrets" to reveal them in the generated code snippets; they are redacted by default.
140
+ </Callout>
141
+
142
+ ## Responses and snippets
143
+
144
+ Responses render to match their type: images and video play inline, everything else is shown as a formatted, syntax-highlighted body. Alongside the response, the playground generates ready-to-run **cURL**, **JavaScript**, and **Python** snippets for the exact request you built.
145
+
146
+ ## Documenting more than one API
147
+
148
+ Pass an array to document several APIs at once. Each spec becomes its own namespaced section:
149
+
150
+ \`\`\`json
151
+ {
152
+ "openapi": [
153
+ { "name": "public", "file": "specs/public.yaml" },
154
+ { "name": "admin", "file": "specs/admin.yaml" }
155
+ ]
156
+ }
157
+ \`\`\`
158
+ `;
@@ -1 +1 @@
1
- export declare const authenticationMdxTemplate = "---\ntitle: \"Authentication\"\ndescription: \"Password protect your documentation site with a single environment variable that gates pages, content APIs, and search crawlers behind a shared password.\"\ndate: \"2026-07-01\"\ncategory: \"Configuration\"\ncategoryOrder: 3\norder: 12\n---\n# Authentication\n\nKeep your documentation private by putting the whole site behind a shared password. Set one environment variable and Doccupine gates every page behind a login screen, blocks the content APIs, and hides the site from search engines - no accounts, no database, no extra services.\n\n## Enabling password protection\n\nSet `SITE_PASSWORD` in your environment (for local development, add it to `.env`):\n\n```bash\nSITE_PASSWORD=choose-a-strong-shared-password\n```\n\nThat is the only setting. Everyone who visits the site shares this single password.\n\n<Callout type=\"note\">\n When `SITE_PASSWORD` is unset or empty, the site is fully public and behaves exactly as before. Removing the variable turns protection off again.\n</Callout>\n\n## What gets protected\n\nWhile a password is set, protection is enforced across three layers:\n\n- **Pages**: Every page renders a login screen instead of your documentation until the visitor enters the correct password.\n- **Content APIs**: The AI chat (`/api/rag`) and search (`/api/search`) endpoints return `401 Unauthorized` without a valid session, so the docs cannot be scraped around the login screen.\n- **Search engines and crawlers**: `robots.txt` disallows all crawlers, every page ships a `noindex, nofollow` meta tag, and responses carry an `X-Robots-Tag: noindex, nofollow` header.\n\n<Callout type=\"note\">\n The [MCP server](/model-context-protocol) keeps its own authentication through the `DOCS_API_KEY` bearer token and is not affected by `SITE_PASSWORD`. Set both when you want the docs and the MCP endpoint locked down.\n</Callout>\n\n## How it works\n\nWhen a visitor submits the correct password, Doccupine sets a signed, `httpOnly` cookie that unlocks the site for 30 days. The cookie never stores the password itself - it holds an HMAC derived from it - and it is checked in constant time to avoid leaking information through timing.\n\nBecause the check reads `SITE_PASSWORD` at request time, you can turn protection on or off by changing the environment variable and redeploying. No rebuild of your content is required.\n\n## Security notes\n\n- **Use a strong password.** It is shared by everyone with access, so treat it like any other shared secret and rotate it when needed.\n- **Serve over HTTPS in production.** The session cookie is marked `secure` in production, so it is only sent over encrypted connections.\n- **Brute-force protection.** Password attempts are rate limited by IP address to slow down guessing.\n- **Rotating the password.** Changing `SITE_PASSWORD` invalidates every existing session immediately - visitors will need to enter the new password.\n\n<Callout type=\"warning\">\n A shared password is meant for lightweight gating - private previews, internal docs, or work-in-progress sites. For per-user access control or audit trails, put the site behind your own identity provider or a hosting platform's access controls.\n</Callout>\n\n## Behavior\n\n- **Runtime toggle**: Protection is controlled entirely by the `SITE_PASSWORD` environment variable, evaluated on each request.\n- **Graceful default**: With no password set, nothing changes - the site stays public and fully indexable.\n- **Session length**: A successful login lasts 30 days before the visitor is asked to sign in again.\n\n## Example\n\nProtect a staging deployment while it is being reviewed:\n\n```bash\nSITE_PASSWORD=preview-2026\nNEXT_PUBLIC_SITE_URL=https://staging.example.com\n```\n\nWhen you are ready to launch publicly, remove `SITE_PASSWORD` and redeploy. The login screen disappears, crawlers are welcomed back, and your [sitemap](/deployment-and-hosting) is advertised again.";
1
+ export declare const authenticationMdxTemplate = "---\ntitle: \"Authentication\"\ndescription: \"Password protect your documentation site with a single environment variable that gates pages, content APIs, and search crawlers behind a shared password.\"\ndate: \"2026-07-01\"\ncategory: \"Deployment\"\ncategoryOrder: 4\norder: 2\n---\n# Authentication\n\nKeep your documentation private by putting the whole site behind a shared password. Set one environment variable and Doccupine gates every page behind a login screen, blocks the content APIs, and hides the site from search engines - no accounts, no database, no extra services.\n\n## Enabling password protection\n\nSet `SITE_PASSWORD` in your environment (for local development, add it to `.env`):\n\n```bash\nSITE_PASSWORD=choose-a-strong-shared-password\n```\n\nThat is the only setting. Everyone who visits the site shares this single password.\n\n<Callout type=\"note\">\n When `SITE_PASSWORD` is unset or empty, the site is fully public and behaves exactly as before. Removing the variable turns protection off again.\n</Callout>\n\n## What gets protected\n\nWhile a password is set, protection is enforced across three layers:\n\n- **Pages**: Every page renders a login screen instead of your documentation until the visitor enters the correct password.\n- **Content APIs**: The AI chat (`/api/rag`) and search (`/api/search`) endpoints return `401 Unauthorized` without a valid session, so the docs cannot be scraped around the login screen.\n- **Search engines and crawlers**: `robots.txt` disallows all crawlers, every page ships a `noindex, nofollow` meta tag, and responses carry an `X-Robots-Tag: noindex, nofollow` header.\n\n<Callout type=\"note\">\n The [MCP server](/model-context-protocol) keeps its own authentication through the `DOCS_API_KEY` bearer token and is not affected by `SITE_PASSWORD`. Set both when you want the docs and the MCP endpoint locked down.\n</Callout>\n\n## How it works\n\nWhen a visitor submits the correct password, Doccupine sets a signed, `httpOnly` cookie that unlocks the site for 30 days. The cookie never stores the password itself - it holds an HMAC derived from it - and it is checked in constant time to avoid leaking information through timing.\n\nBecause the check reads `SITE_PASSWORD` at request time, you can turn protection on or off by changing the environment variable and redeploying. No rebuild of your content is required.\n\n## Security notes\n\n- **Use a strong password.** It is shared by everyone with access, so treat it like any other shared secret and rotate it when needed.\n- **Serve over HTTPS in production.** The session cookie is marked `secure` in production, so it is only sent over encrypted connections.\n- **Brute-force protection.** Password attempts are rate limited by IP address to slow down guessing.\n- **Rotating the password.** Changing `SITE_PASSWORD` invalidates every existing session immediately - visitors will need to enter the new password.\n\n<Callout type=\"warning\">\n A shared password is meant for lightweight gating - private previews, internal docs, or work-in-progress sites. For per-user access control or audit trails, put the site behind your own identity provider or a hosting platform's access controls.\n</Callout>\n\n## Behavior\n\n- **Runtime toggle**: Protection is controlled entirely by the `SITE_PASSWORD` environment variable, evaluated on each request.\n- **Graceful default**: With no password set, nothing changes - the site stays public and fully indexable.\n- **Session length**: A successful login lasts 30 days before the visitor is asked to sign in again.\n\n## Example\n\nProtect a staging deployment while it is being reviewed:\n\n```bash\nSITE_PASSWORD=preview-2026\nNEXT_PUBLIC_SITE_URL=https://staging.example.com\n```\n\nWhen you are ready to launch publicly, remove `SITE_PASSWORD` and redeploy. The login screen disappears, crawlers are welcomed back, and your [sitemap](/deployment-and-hosting) is advertised again.";
@@ -2,9 +2,9 @@ export const authenticationMdxTemplate = `---
2
2
  title: "Authentication"
3
3
  description: "Password protect your documentation site with a single environment variable that gates pages, content APIs, and search crawlers behind a shared password."
4
4
  date: "2026-07-01"
5
- category: "Configuration"
6
- categoryOrder: 3
7
- order: 12
5
+ category: "Deployment"
6
+ categoryOrder: 4
7
+ order: 2
8
8
  ---
9
9
  # Authentication
10
10
 
@@ -0,0 +1 @@
1
+ export declare const badgesMdxTemplate = "---\ntitle: \"Badges\"\ndescription: \"Highlight statuses, version labels, and metadata inline with colored badges.\"\ndate: \"2026-07-27\"\ncategory: \"Components\"\ncategoryOrder: 1\norder: 12\n---\n# Badges\n\nHighlight statuses, version labels, and metadata with small colored badges - inline within text or standing on their own.\n\n## Basic badge\n\nYou can use the Badge component directly within your MDX files without any import:\n\n```html\n<Badge>Badge</Badge>\n```\n\n<Badge>Badge</Badge>\n\n## Colors\n\nThe `color` property selects one of eleven variants to convey different meanings:\n\n```html\n<Badge color=\"gray\">Badge</Badge>\n<Badge color=\"blue\">Badge</Badge>\n<Badge color=\"green\">Badge</Badge>\n<Badge color=\"yellow\">Badge</Badge>\n<Badge color=\"orange\">Badge</Badge>\n<Badge color=\"red\">Badge</Badge>\n<Badge color=\"purple\">Badge</Badge>\n<Badge color=\"white\">Badge</Badge>\n<Badge color=\"surface\">Badge</Badge>\n<Badge color=\"white-destructive\">Badge</Badge>\n<Badge color=\"surface-destructive\">Badge</Badge>\n```\n\n<Badge color=\"gray\">Badge</Badge>\n<Badge color=\"blue\">Badge</Badge>\n<Badge color=\"green\">Badge</Badge>\n<Badge color=\"yellow\">Badge</Badge>\n<Badge color=\"orange\">Badge</Badge>\n<Badge color=\"red\">Badge</Badge>\n<Badge color=\"purple\">Badge</Badge>\n<Badge color=\"white\">Badge</Badge>\n<Badge color=\"surface\">Badge</Badge>\n<Badge color=\"white-destructive\">Badge</Badge>\n<Badge color=\"surface-destructive\">Badge</Badge>\n\n## Sizes\n\nFour sizes match different content hierarchies:\n\n```html\n<Badge size=\"xs\">Badge</Badge>\n<Badge size=\"sm\">Badge</Badge>\n<Badge size=\"md\">Badge</Badge>\n<Badge size=\"lg\">Badge</Badge>\n```\n\n<Badge size=\"xs\">Badge</Badge>\n<Badge size=\"sm\">Badge</Badge>\n<Badge size=\"md\">Badge</Badge>\n<Badge size=\"lg\">Badge</Badge>\n\n## Shapes\n\nChoose between rounded corners and a pill shape:\n\n```html\n<Badge shape=\"rounded\">Badge</Badge>\n<Badge shape=\"pill\">Badge</Badge>\n```\n\n<Badge shape=\"rounded\">Badge</Badge>\n<Badge shape=\"pill\">Badge</Badge>\n\n## Icons\n\nAdd a [Lucide](https://lucide.dev/icons) icon (kebab-case name) for extra context. Unknown names render nothing, so a typo never breaks the page:\n\n```html\n<Badge icon=\"circle-check\" color=\"green\">Passing</Badge>\n<Badge icon=\"clock\" color=\"orange\">Pending</Badge>\n<Badge icon=\"ban\" color=\"red\">Blocked</Badge>\n```\n\n<Badge icon=\"circle-check\" color=\"green\">Passing</Badge>\n<Badge icon=\"clock\" color=\"orange\">Pending</Badge>\n<Badge icon=\"ban\" color=\"red\">Blocked</Badge>\n\n## Stroke variant\n\nSet `stroke` for an outline instead of a filled background:\n\n```html\n<Badge stroke color=\"blue\">Badge</Badge>\n<Badge stroke color=\"green\">Badge</Badge>\n<Badge stroke color=\"orange\">Badge</Badge>\n<Badge stroke color=\"red\">Badge</Badge>\n```\n\n<Badge stroke color=\"blue\">Badge</Badge>\n<Badge stroke color=\"green\">Badge</Badge>\n<Badge stroke color=\"orange\">Badge</Badge>\n<Badge stroke color=\"red\">Badge</Badge>\n\n## Solid variant\n\nSet `solid` for a strong filled background with contrasting text:\n\n```html\n<Badge solid color=\"blue\">Badge</Badge>\n<Badge solid color=\"green\">Badge</Badge>\n<Badge solid color=\"red\">Badge</Badge>\n<Badge solid color=\"purple\">Badge</Badge>\n```\n\n<Badge solid color=\"blue\">Badge</Badge>\n<Badge solid color=\"green\">Badge</Badge>\n<Badge solid color=\"red\">Badge</Badge>\n<Badge solid color=\"purple\">Badge</Badge>\n\n## Semantic colors\n\nThe `info`, `success`, `warning`, and `error` colors come from your theme rather than the fixed palette, so they follow your `theme.json` and the light/dark toggle. They support the same `stroke` and `solid` variations:\n\n```html\n<Badge color=\"info\">Badge</Badge>\n<Badge color=\"success\">Badge</Badge>\n<Badge color=\"warning\">Badge</Badge>\n<Badge color=\"error\">Badge</Badge>\n<Badge solid color=\"info\">Badge</Badge>\n<Badge solid color=\"success\">Badge</Badge>\n```\n\n<Badge color=\"info\">Badge</Badge>\n<Badge color=\"success\">Badge</Badge>\n<Badge color=\"warning\">Badge</Badge>\n<Badge color=\"error\">Badge</Badge>\n<Badge solid color=\"info\">Badge</Badge>\n<Badge solid color=\"success\">Badge</Badge>\n\n## HTTP method badges\n\nSet `mono` for a monospace, uppercase label. Combining `mono`, `solid`, and the semantic colors gives the method chips Doccupine itself uses in the sidebar navigation and the API playground:\n\n```html\n<Badge mono solid color=\"info\" size=\"sm\">GET</Badge>\n<Badge mono solid color=\"success\" size=\"sm\">POST</Badge>\n<Badge mono solid color=\"warning\" size=\"sm\">PUT</Badge>\n<Badge mono solid color=\"error\" size=\"sm\">DELETE</Badge>\n```\n\n<Badge mono solid color=\"info\" size=\"sm\">GET</Badge>\n<Badge mono solid color=\"success\" size=\"sm\">POST</Badge>\n<Badge mono solid color=\"warning\" size=\"sm\">PUT</Badge>\n<Badge mono solid color=\"error\" size=\"sm\">DELETE</Badge>\n\n## Disabled state\n\nSet `disabled` to indicate inactive or unavailable states with reduced opacity:\n\n```html\n<Badge disabled icon=\"lock\" color=\"gray\">Badge</Badge>\n<Badge disabled icon=\"lock\" color=\"blue\">Badge</Badge>\n```\n\n<Badge disabled icon=\"lock\" color=\"gray\">Badge</Badge>\n<Badge disabled icon=\"lock\" color=\"blue\">Badge</Badge>\n\n## Inline usage\n\nBadges flow naturally with the surrounding text. For example, this feature requires a <Badge color=\"orange\" size=\"sm\">Premium</Badge> subscription, and this endpoint returns <Badge color=\"green\" size=\"sm\">JSON</Badge>.\n\n```html\nThis feature requires a <Badge color=\"orange\" size=\"sm\">Premium</Badge> subscription.\n```\n\n## Combined properties\n\nAll properties compose freely:\n\n```html\n<Badge icon=\"star\" color=\"purple\" size=\"lg\" shape=\"pill\">Pro</Badge>\n<Badge icon=\"check\" stroke color=\"green\" size=\"sm\">Verified</Badge>\n<Badge icon=\"flask-conical\" color=\"blue\" shape=\"rounded\">Beta</Badge>\n```\n\n<Badge icon=\"star\" color=\"purple\" size=\"lg\" shape=\"pill\">Pro</Badge>\n<Badge icon=\"check\" stroke color=\"green\" size=\"sm\">Verified</Badge>\n<Badge icon=\"flask-conical\" color=\"blue\" shape=\"rounded\">Beta</Badge>\n\n## Properties\n\n<Field value=\"color\" type=\"string\">\n Badge color variant. Defaults to `gray`. Options: `gray`, `blue`, `green`, `yellow`, `orange`, `red`, `purple`, `white`, `surface`, `white-destructive`, `surface-destructive`, plus the theme-driven `info`, `success`, `warning`, and `error`.\n</Field>\n\n<Field value=\"size\" type=\"string\">\n Badge size. Defaults to `md`. Options: `xs`, `sm`, `md`, `lg`.\n</Field>\n\n<Field value=\"shape\" type=\"string\">\n Badge shape. Defaults to `rounded`. Options: `rounded`, `pill`.\n</Field>\n\n<Field value=\"icon\" type=\"string\">\n A [Lucide](https://lucide.dev/icons) icon name in kebab-case, displayed before the badge text.\n</Field>\n\n<Field value=\"stroke\" type=\"boolean\">\n Display the badge with an outline instead of a filled background. Defaults to `false`.\n</Field>\n\n<Field value=\"solid\" type=\"boolean\">\n Display the badge with a strong filled background and contrasting text. Takes precedence over `stroke`. Defaults to `false`.\n</Field>\n\n<Field value=\"mono\" type=\"boolean\">\n Render the label in monospace uppercase, for code-like labels such as HTTP methods. Defaults to `false`.\n</Field>\n\n<Field value=\"disabled\" type=\"boolean\">\n Display the badge in a disabled state with reduced opacity. Defaults to `false`.\n</Field>\n\n<Field value=\"className\" type=\"string\">\n Additional CSS classes to apply to the badge.\n</Field>\n\n<Field value=\"children\" type=\"node\" required>\n The badge label.\n</Field>";