doccupine 0.0.158 → 0.0.160
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.
- package/README.md +56 -4
- package/dist/generator/app-scaffolder.js +11 -3
- package/dist/generator/generated-page-publisher.d.ts +6 -6
- package/dist/generator/generated-page-publisher.js +7 -5
- package/dist/generator/mdx-pass-builder.d.ts +4 -4
- package/dist/generator/mdx-pass-builder.js +8 -1
- package/dist/generator/mdx-reconciliation-coordinator.d.ts +23 -9
- package/dist/generator/mdx-reconciliation-coordinator.js +63 -9
- package/dist/generator/page-catalog.d.ts +2 -4
- package/dist/generator/page-catalog.js +7 -2
- package/dist/generator/page-renderer.d.ts +15 -5
- package/dist/generator/page-renderer.js +38 -11
- package/dist/generator/project-config-repository.d.ts +4 -1
- package/dist/generator/project-config-repository.js +26 -0
- package/dist/generator/public-asset-manager.d.ts +10 -0
- package/dist/generator/public-asset-manager.js +63 -3
- package/dist/generator/section-index-generator.d.ts +10 -1
- package/dist/generator/section-index-generator.js +43 -15
- package/dist/generator/section-resolver.d.ts +8 -0
- package/dist/generator/site-artifacts.d.ts +4 -3
- package/dist/generator/site-artifacts.js +94 -9
- package/dist/generator/watch-coordinator.js +6 -1
- package/dist/lib/generated-artifacts.d.ts +3 -0
- package/dist/lib/generated-artifacts.js +36 -0
- package/dist/lib/layout.d.ts +6 -3
- package/dist/lib/layout.js +107 -4
- package/dist/lib/metadata.d.ts +7 -0
- package/dist/lib/metadata.js +33 -10
- package/dist/lib/structures.js +20 -0
- package/dist/lib/types.d.ts +28 -0
- package/dist/lib/ui-strings.d.ts +44 -0
- package/dist/lib/ui-strings.js +48 -0
- package/dist/lib/variants.d.ts +91 -0
- package/dist/lib/variants.js +411 -0
- package/dist/mdx-to-nextjs-generator.d.ts +22 -5
- package/dist/mdx-to-nextjs-generator.js +89 -10
- package/dist/templates/app/api/mcp/route.d.ts +1 -1
- package/dist/templates/app/api/mcp/route.js +14 -1
- package/dist/templates/app/api/rag/route.d.ts +1 -1
- package/dist/templates/app/api/rag/route.js +13 -2
- package/dist/templates/app/api/search/route.d.ts +1 -1
- package/dist/templates/app/api/search/route.js +16 -1
- package/dist/templates/app/sitemap.d.ts +2 -0
- package/dist/templates/app/sitemap.js +48 -3
- package/dist/templates/components/Chat.d.ts +1 -1
- package/dist/templates/components/Chat.js +40 -12
- package/dist/templates/components/Docs.d.ts +1 -1
- package/dist/templates/components/Docs.js +5 -2
- package/dist/templates/components/DocsSideBar.d.ts +1 -1
- package/dist/templates/components/DocsSideBar.js +3 -1
- package/dist/templates/components/SearchDocs.d.ts +1 -1
- package/dist/templates/components/SearchDocs.js +17 -3
- package/dist/templates/components/SearchModalContent.d.ts +1 -1
- package/dist/templates/components/SearchModalContent.js +22 -14
- package/dist/templates/components/SectionNavProvider.d.ts +1 -1
- package/dist/templates/components/SectionNavProvider.js +32 -20
- package/dist/templates/components/SideBar.d.ts +1 -1
- package/dist/templates/components/SideBar.js +26 -12
- package/dist/templates/components/layout/ActionBar.d.ts +1 -1
- package/dist/templates/components/layout/ActionBar.js +9 -7
- package/dist/templates/components/layout/Code.d.ts +1 -1
- package/dist/templates/components/layout/Code.js +6 -3
- package/dist/templates/components/layout/DocsComponents.d.ts +1 -1
- package/dist/templates/components/layout/DocsComponents.js +38 -5
- package/dist/templates/components/layout/DocsNavigation.d.ts +1 -1
- package/dist/templates/components/layout/DocsNavigation.js +4 -2
- package/dist/templates/components/layout/Dropdown.d.ts +1 -0
- package/dist/templates/components/layout/Dropdown.js +308 -0
- package/dist/templates/components/layout/FocusModeToggle.d.ts +1 -1
- package/dist/templates/components/layout/FocusModeToggle.js +7 -4
- package/dist/templates/components/layout/Footer.d.ts +1 -1
- package/dist/templates/components/layout/Footer.js +4 -2
- package/dist/templates/components/layout/Header.d.ts +1 -1
- package/dist/templates/components/layout/Header.js +18 -8
- package/dist/templates/components/layout/SectionBar.d.ts +1 -1
- package/dist/templates/components/layout/SectionBar.js +16 -10
- package/dist/templates/components/layout/VariantSwitchers.d.ts +1 -0
- package/dist/templates/components/layout/VariantSwitchers.js +313 -0
- package/dist/templates/components/useStrings.d.ts +1 -0
- package/dist/templates/components/useStrings.js +10 -0
- package/dist/templates/components/useVariant.d.ts +1 -0
- package/dist/templates/components/useVariant.js +13 -0
- package/dist/templates/env.example.d.ts +1 -1
- package/dist/templates/env.example.js +2 -1
- package/dist/templates/llms/llmsIndex.d.ts +13 -0
- package/dist/templates/llms/llmsIndex.js +18 -3
- package/dist/templates/mdx/ai-assistant.mdx.d.ts +1 -1
- package/dist/templates/mdx/ai-assistant.mdx.js +9 -3
- package/dist/templates/mdx/api-playground.mdx.d.ts +1 -1
- package/dist/templates/mdx/api-playground.mdx.js +2 -0
- package/dist/templates/mdx/commands.mdx.d.ts +1 -1
- package/dist/templates/mdx/commands.mdx.js +1 -1
- package/dist/templates/mdx/fonts.mdx.d.ts +1 -1
- package/dist/templates/mdx/fonts.mdx.js +1 -1
- package/dist/templates/mdx/footer-links.mdx.d.ts +1 -1
- package/dist/templates/mdx/footer-links.mdx.js +1 -1
- package/dist/templates/mdx/index.mdx.d.ts +1 -1
- package/dist/templates/mdx/index.mdx.js +2 -0
- package/dist/templates/mdx/languages.mdx.d.ts +1 -0
- package/dist/templates/mdx/languages.mdx.js +94 -0
- package/dist/templates/mdx/media-and-assets.mdx.d.ts +1 -1
- package/dist/templates/mdx/media-and-assets.mdx.js +1 -1
- package/dist/templates/mdx/model-context-protocol.mdx.d.ts +1 -1
- package/dist/templates/mdx/model-context-protocol.mdx.js +6 -0
- package/dist/templates/mdx/navigation.mdx.d.ts +1 -1
- package/dist/templates/mdx/navigation.mdx.js +2 -0
- package/dist/templates/mdx/platform/ai-assistant.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/ai-assistant.mdx.js +2 -0
- package/dist/templates/mdx/platform/api-playground.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/api-playground.mdx.js +2 -0
- package/dist/templates/mdx/platform/file-editor.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/file-editor.mdx.js +2 -0
- package/dist/templates/mdx/platform/index.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/index.mdx.js +1 -1
- package/dist/templates/mdx/platform/languages.mdx.d.ts +1 -0
- package/dist/templates/mdx/platform/languages.mdx.js +50 -0
- package/dist/templates/mdx/platform/mcp.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/mcp.mdx.js +2 -0
- package/dist/templates/mdx/platform/navigation-settings.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/navigation-settings.mdx.js +2 -0
- package/dist/templates/mdx/platform/publishing.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/publishing.mdx.js +4 -0
- package/dist/templates/mdx/platform/self-updating-docs.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/self-updating-docs.mdx.js +2 -0
- package/dist/templates/mdx/platform/versions.mdx.d.ts +1 -0
- package/dist/templates/mdx/platform/versions.mdx.js +33 -0
- package/dist/templates/mdx/sections.mdx.d.ts +1 -1
- package/dist/templates/mdx/sections.mdx.js +1 -1
- package/dist/templates/mdx/theme.mdx.d.ts +1 -1
- package/dist/templates/mdx/theme.mdx.js +1 -1
- package/dist/templates/mdx/versions.mdx.d.ts +1 -0
- package/dist/templates/mdx/versions.mdx.js +78 -0
- package/dist/templates/mdx/what-is-doccupine.mdx.d.ts +1 -1
- package/dist/templates/mdx/what-is-doccupine.mdx.js +1 -1
- package/dist/templates/package.js +20 -20
- package/dist/templates/prettierignore.d.ts +1 -1
- package/dist/templates/prettierignore.js +2 -0
- package/dist/templates/services/llm/config.d.ts +1 -1
- package/dist/templates/services/llm/config.js +50 -3
- package/dist/templates/services/llm/factory.d.ts +1 -1
- package/dist/templates/services/llm/factory.js +6 -3
- package/dist/templates/services/llm/types.d.ts +1 -1
- package/dist/templates/services/llm/types.js +2 -1
- package/dist/templates/services/mcp/server.d.ts +1 -1
- package/dist/templates/services/mcp/server.js +54 -10
- package/dist/templates/services/mcp/tools.d.ts +1 -1
- package/dist/templates/services/mcp/tools.js +81 -6
- package/dist/templates/services/mcp/types.d.ts +1 -1
- package/dist/templates/services/mcp/types.js +10 -0
- package/dist/templates/services/search.d.ts +1 -1
- package/dist/templates/services/search.js +34 -4
- package/dist/templates/utils/orderNavItems.d.ts +1 -1
- package/dist/templates/utils/orderNavItems.js +2 -0
- package/dist/templates/utils/strings.d.ts +1 -0
- package/dist/templates/utils/strings.js +27 -0
- package/dist/templates/utils/variants.d.ts +1 -0
- package/dist/templates/utils/variants.js +170 -0
- package/package.json +11 -11
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
export const variantSwitchersTemplate = `"use client";
|
|
2
|
+
import { useRouter } from "next/navigation";
|
|
3
|
+
import styled, { css } from "styled-components";
|
|
4
|
+
import { Check, ChevronDown, Languages, Tag } from "lucide-react";
|
|
5
|
+
import { mq, Theme } from "@/app/theme";
|
|
6
|
+
import { Dropdown, DropdownItem } from "@/components/layout/Dropdown";
|
|
7
|
+
import { useStrings } from "@/components/useStrings";
|
|
8
|
+
import { useVariant } from "@/components/useVariant";
|
|
9
|
+
import type { PagesProps } from "@/utils/orderNavItems";
|
|
10
|
+
import {
|
|
11
|
+
defaultLanguage,
|
|
12
|
+
joinVariantSlug,
|
|
13
|
+
languages,
|
|
14
|
+
pageVariantPrefix,
|
|
15
|
+
stripLanguagePrefix,
|
|
16
|
+
stripVariantPrefix,
|
|
17
|
+
variantPrefix,
|
|
18
|
+
versions,
|
|
19
|
+
} from "@/utils/variants";
|
|
20
|
+
|
|
21
|
+
// The switchers share the footer row with the focus-mode toggle at its left
|
|
22
|
+
// end and the theme toggle at its right. A lone pill claims only the width
|
|
23
|
+
// its label needs; a pair grows from its labels' widths into the rail's free
|
|
24
|
+
// width and gives up characters, never height, when that is not enough.
|
|
25
|
+
const StyledSwitchers = styled.div<{ $dense: boolean }>\`
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: 8px;
|
|
29
|
+
min-width: 0;
|
|
30
|
+
|
|
31
|
+
\${({ $dense }) =>
|
|
32
|
+
$dense &&
|
|
33
|
+
css\`
|
|
34
|
+
\${mq("lg")} {
|
|
35
|
+
flex: 1;
|
|
36
|
+
}
|
|
37
|
+
\`}
|
|
38
|
+
\`;
|
|
39
|
+
|
|
40
|
+
// One pill: its trigger carries the Lucide glyph, the current label, and a
|
|
41
|
+
// chevron that turns while open.
|
|
42
|
+
const StyledSwitcher = styled.div<{ $dense: boolean }>\`
|
|
43
|
+
display: flex;
|
|
44
|
+
min-width: 0;
|
|
45
|
+
|
|
46
|
+
\${({ $dense }) =>
|
|
47
|
+
$dense &&
|
|
48
|
+
css\`
|
|
49
|
+
\${mq("lg")} {
|
|
50
|
+
flex: 1 1 auto;
|
|
51
|
+
}
|
|
52
|
+
\`}
|
|
53
|
+
\`;
|
|
54
|
+
|
|
55
|
+
const truncatedLabel = css\`
|
|
56
|
+
flex: 1;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
text-align: left;
|
|
59
|
+
text-overflow: ellipsis;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
\`;
|
|
62
|
+
|
|
63
|
+
// Fills the trigger so the label takes the width and the chevron keeps the
|
|
64
|
+
// right edge when the pill is stretched across the rail.
|
|
65
|
+
const StyledTriggerContent = styled.span<{ theme: Theme }>\`
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
gap: 6px;
|
|
69
|
+
width: 100%;
|
|
70
|
+
min-width: 0;
|
|
71
|
+
font-size: \${({ theme }) => theme.fontSizes.small.xs};
|
|
72
|
+
font-weight: 600;
|
|
73
|
+
line-height: 1;
|
|
74
|
+
color: \${({ theme }) => theme.colors.accentStrong};
|
|
75
|
+
|
|
76
|
+
/* The glyphs sit at the toggles' own resting color and pick up the accent
|
|
77
|
+
on hover, so all four controls of the row light up the same way. */
|
|
78
|
+
& svg {
|
|
79
|
+
flex-shrink: 0;
|
|
80
|
+
color: \${({ theme }) => theme.colors.primary};
|
|
81
|
+
transition: color 0.3s ease;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
& > svg:last-child {
|
|
85
|
+
transition:
|
|
86
|
+
color 0.3s ease,
|
|
87
|
+
transform 0.3s ease;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
button:hover > & svg {
|
|
91
|
+
color: \${({ theme }) => theme.colors.accent};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
[aria-expanded="true"] > & > svg:last-child {
|
|
95
|
+
transform: rotate(180deg);
|
|
96
|
+
}
|
|
97
|
+
\`;
|
|
98
|
+
|
|
99
|
+
// Below "lg" the sidebar is the full-width mobile menu, so every trigger shows
|
|
100
|
+
// its glyph and full label there. On the rail the two of them share about
|
|
101
|
+
// 130px beside the toggles: a lone switcher still spells its label out, while
|
|
102
|
+
// a pair drops to the glyphless short form (a language's code, a version's
|
|
103
|
+
// own label) rather than truncating both.
|
|
104
|
+
const StyledTriggerIcon = styled.span<{ $dense: boolean }>\`
|
|
105
|
+
display: flex;
|
|
106
|
+
|
|
107
|
+
\${({ $dense }) =>
|
|
108
|
+
$dense &&
|
|
109
|
+
css\`
|
|
110
|
+
\${mq("lg")} {
|
|
111
|
+
display: none;
|
|
112
|
+
}
|
|
113
|
+
\`}
|
|
114
|
+
\`;
|
|
115
|
+
|
|
116
|
+
const StyledTriggerLabel = styled.span<{ $dense: boolean }>\`
|
|
117
|
+
\${truncatedLabel};
|
|
118
|
+
|
|
119
|
+
\${({ $dense }) =>
|
|
120
|
+
$dense &&
|
|
121
|
+
css\`
|
|
122
|
+
\${mq("lg")} {
|
|
123
|
+
display: none;
|
|
124
|
+
}
|
|
125
|
+
\`}
|
|
126
|
+
\`;
|
|
127
|
+
|
|
128
|
+
const StyledTriggerShortLabel = styled.span\`
|
|
129
|
+
\${truncatedLabel};
|
|
130
|
+
display: none;
|
|
131
|
+
|
|
132
|
+
\${mq("lg")} {
|
|
133
|
+
display: block;
|
|
134
|
+
}
|
|
135
|
+
\`;
|
|
136
|
+
|
|
137
|
+
// Keeps every label aligned whether or not the entry carries the check mark.
|
|
138
|
+
const StyledItemMark = styled.span\`
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-shrink: 0;
|
|
141
|
+
width: 14px;
|
|
142
|
+
\`;
|
|
143
|
+
|
|
144
|
+
interface SwitcherOption {
|
|
145
|
+
value: string;
|
|
146
|
+
label: string;
|
|
147
|
+
/** Rail-sized form of the label; falls back to the label itself. */
|
|
148
|
+
short?: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
interface VariantSwitcherProps {
|
|
152
|
+
label: string;
|
|
153
|
+
icon: React.ReactNode;
|
|
154
|
+
options: SwitcherOption[];
|
|
155
|
+
value: string;
|
|
156
|
+
/** Which edge of the trigger the menu hangs from, so it opens into the
|
|
157
|
+
sidebar rather than past one of its edges. */
|
|
158
|
+
align: "left" | "right";
|
|
159
|
+
/** Both switchers are on the row, so the rail shows the short labels. */
|
|
160
|
+
dense: boolean;
|
|
161
|
+
onSelect: (value: string) => void;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// One dropdown of radio items above its trigger: the platform's Dropdown, so
|
|
165
|
+
// the language and version pickers look like every other menu on Doccupine.
|
|
166
|
+
function VariantSwitcher({
|
|
167
|
+
label,
|
|
168
|
+
icon,
|
|
169
|
+
options,
|
|
170
|
+
value,
|
|
171
|
+
align,
|
|
172
|
+
dense,
|
|
173
|
+
onSelect,
|
|
174
|
+
}: VariantSwitcherProps) {
|
|
175
|
+
const current = options.find((option) => option.value === value);
|
|
176
|
+
const currentLabel = current?.label ?? label;
|
|
177
|
+
return (
|
|
178
|
+
<StyledSwitcher $dense={dense}>
|
|
179
|
+
<Dropdown
|
|
180
|
+
role="menu"
|
|
181
|
+
label={label}
|
|
182
|
+
triggerLabel={\`\${label}: \${currentLabel}\`}
|
|
183
|
+
align={align}
|
|
184
|
+
placement="top"
|
|
185
|
+
compact
|
|
186
|
+
fullWidth={dense}
|
|
187
|
+
trigger={
|
|
188
|
+
<StyledTriggerContent>
|
|
189
|
+
<StyledTriggerIcon $dense={dense}>{icon}</StyledTriggerIcon>
|
|
190
|
+
<StyledTriggerLabel $dense={dense}>
|
|
191
|
+
{currentLabel}
|
|
192
|
+
</StyledTriggerLabel>
|
|
193
|
+
{dense && (
|
|
194
|
+
<StyledTriggerShortLabel>
|
|
195
|
+
{current?.short ?? currentLabel}
|
|
196
|
+
</StyledTriggerShortLabel>
|
|
197
|
+
)}
|
|
198
|
+
<ChevronDown size={12} aria-hidden="true" />
|
|
199
|
+
</StyledTriggerContent>
|
|
200
|
+
}
|
|
201
|
+
>
|
|
202
|
+
{options.map((option) => (
|
|
203
|
+
<DropdownItem
|
|
204
|
+
key={option.value}
|
|
205
|
+
type="button"
|
|
206
|
+
role="menuitemradio"
|
|
207
|
+
aria-checked={option.value === value}
|
|
208
|
+
$checked={option.value === value}
|
|
209
|
+
onClick={() => onSelect(option.value)}
|
|
210
|
+
>
|
|
211
|
+
<StyledItemMark aria-hidden="true">
|
|
212
|
+
{option.value === value && <Check size={14} />}
|
|
213
|
+
</StyledItemMark>
|
|
214
|
+
{option.label}
|
|
215
|
+
</DropdownItem>
|
|
216
|
+
))}
|
|
217
|
+
</Dropdown>
|
|
218
|
+
</StyledSwitcher>
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
interface VariantSwitchersProps {
|
|
223
|
+
pages: PagesProps[];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// The language and version switchers on the sidebar footer row, between the
|
|
227
|
+
// focus-mode and theme toggles. Each is rendered only when its file declares
|
|
228
|
+
// at least two entries, so a site without languages.json or versions.json
|
|
229
|
+
// renders nothing here and the row keeps just its two toggles.
|
|
230
|
+
function VariantSwitchers({ pages }: VariantSwitchersProps) {
|
|
231
|
+
const router = useRouter();
|
|
232
|
+
const current = useVariant();
|
|
233
|
+
const t = useStrings();
|
|
234
|
+
const showLanguages = (languages?.length ?? 0) >= 2;
|
|
235
|
+
const showVersions = (versions?.length ?? 0) >= 2;
|
|
236
|
+
if (!showLanguages && !showVersions) return null;
|
|
237
|
+
|
|
238
|
+
const currentSlug = joinVariantSlug(current.prefix, current.rest);
|
|
239
|
+
const currentLocale = current.locale ?? defaultLanguage()?.code;
|
|
240
|
+
const currentVersion = current.version ?? "";
|
|
241
|
+
const go = (slug: string) => router.push(slug === "" ? "/" : "/" + slug);
|
|
242
|
+
const hasPagesIn = (prefix: string) =>
|
|
243
|
+
pages.some((page) => pageVariantPrefix(page) === prefix);
|
|
244
|
+
|
|
245
|
+
// The same page in the target language when it exists, otherwise that
|
|
246
|
+
// language's home for the current version, otherwise its default home.
|
|
247
|
+
const switchLanguage = (code: string) => {
|
|
248
|
+
const key = stripLanguagePrefix(currentSlug, currentLocale);
|
|
249
|
+
const match = pages.find(
|
|
250
|
+
(page) =>
|
|
251
|
+
page.locale === code &&
|
|
252
|
+
stripLanguagePrefix(page.slug, page.locale) === key,
|
|
253
|
+
);
|
|
254
|
+
if (match) return go(match.slug);
|
|
255
|
+
const withVersion = variantPrefix(code, currentVersion);
|
|
256
|
+
go(hasPagesIn(withVersion) ? withVersion : variantPrefix(code, ""));
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
// The same page in the target version for the current language when it
|
|
260
|
+
// exists, otherwise that version's home for the current language.
|
|
261
|
+
const switchVersion = (slug: string) => {
|
|
262
|
+
const key = stripVariantPrefix(currentSlug, currentLocale, currentVersion);
|
|
263
|
+
const match = pages.find(
|
|
264
|
+
(page) =>
|
|
265
|
+
(page.locale ?? currentLocale) === currentLocale &&
|
|
266
|
+
(page.version ?? "") === slug &&
|
|
267
|
+
stripVariantPrefix(page.slug, page.locale, page.version) === key,
|
|
268
|
+
);
|
|
269
|
+
go(match ? match.slug : variantPrefix(currentLocale, slug));
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
// A pair spreads across the rail, so the first menu hangs from its
|
|
273
|
+
// trigger's left edge and the second from its right edge: either way the
|
|
274
|
+
// menu opens over the sidebar instead of past one of its sides.
|
|
275
|
+
const dense = showLanguages && showVersions;
|
|
276
|
+
|
|
277
|
+
return (
|
|
278
|
+
<StyledSwitchers $dense={dense}>
|
|
279
|
+
{showLanguages && languages && (
|
|
280
|
+
<VariantSwitcher
|
|
281
|
+
label={t.language}
|
|
282
|
+
icon={<Languages size={16} aria-hidden="true" />}
|
|
283
|
+
value={currentLocale ?? ""}
|
|
284
|
+
align="left"
|
|
285
|
+
dense={dense}
|
|
286
|
+
onSelect={switchLanguage}
|
|
287
|
+
options={languages.map((language) => ({
|
|
288
|
+
value: language.code,
|
|
289
|
+
label: language.label,
|
|
290
|
+
short: language.code.toUpperCase(),
|
|
291
|
+
}))}
|
|
292
|
+
/>
|
|
293
|
+
)}
|
|
294
|
+
{showVersions && versions && (
|
|
295
|
+
<VariantSwitcher
|
|
296
|
+
label={t.version}
|
|
297
|
+
icon={<Tag size={16} aria-hidden="true" />}
|
|
298
|
+
value={currentVersion}
|
|
299
|
+
align={dense ? "right" : "left"}
|
|
300
|
+
dense={dense}
|
|
301
|
+
onSelect={switchVersion}
|
|
302
|
+
options={versions.map((version) => ({
|
|
303
|
+
value: version.slug,
|
|
304
|
+
label: version.label,
|
|
305
|
+
}))}
|
|
306
|
+
/>
|
|
307
|
+
)}
|
|
308
|
+
</StyledSwitchers>
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export { VariantSwitchers };
|
|
313
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStringsTemplate = "\"use client\";\nimport { useVariant } from \"@/components/useVariant\";\nimport { getStrings, type UiStrings } from \"@/utils/strings\";\n\n/** The chrome strings of the current route's language. */\nexport function useStrings(): UiStrings {\n const { locale } = useVariant();\n return getStrings(locale);\n}\n";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const useStringsTemplate = `"use client";
|
|
2
|
+
import { useVariant } from "@/components/useVariant";
|
|
3
|
+
import { getStrings, type UiStrings } from "@/utils/strings";
|
|
4
|
+
|
|
5
|
+
/** The chrome strings of the current route's language. */
|
|
6
|
+
export function useStrings(): UiStrings {
|
|
7
|
+
const { locale } = useVariant();
|
|
8
|
+
return getStrings(locale);
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useVariantTemplate = "\"use client\";\nimport { usePathname } from \"next/navigation\";\nimport {\n resolveVariantFromSlug,\n type VariantResolution,\n} from \"@/utils/variants\";\n\n/** The language and version of the current route, read from its URL prefix. */\nexport function useVariant(): VariantResolution {\n const pathname = usePathname();\n return resolveVariantFromSlug(pathname);\n}\n";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const useVariantTemplate = `"use client";
|
|
2
|
+
import { usePathname } from "next/navigation";
|
|
3
|
+
import {
|
|
4
|
+
resolveVariantFromSlug,
|
|
5
|
+
type VariantResolution,
|
|
6
|
+
} from "@/utils/variants";
|
|
7
|
+
|
|
8
|
+
/** The language and version of the current route, read from its URL prefix. */
|
|
9
|
+
export function useVariant(): VariantResolution {
|
|
10
|
+
const pathname = usePathname();
|
|
11
|
+
return resolveVariantFromSlug(pathname);
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const envExampleTemplate = "# Public Site URL\n# Used by sitemap.xml and robots.txt. Overrides `url` in config.json when set.\n# NEXT_PUBLIC_SITE_URL=https://docs.example.com\n\n# Password Protection (optional)\n# Set a shared password to gate the whole site behind a login screen. When set,\n# pages require the password, the content APIs (chat + search) return 401\n# without it, and the site is hidden from search engines and crawlers. Leave\n# unset (or remove) to keep the site public.\n# SITE_PASSWORD=choose-a-strong-shared-password\n\n# Paid API Access (recommended for public deployments with AI enabled)\n# Public documentation remains intentionally public by default. Set RAG_API_KEY\n# to require Authorization: Bearer <key> for /api/rag and prevent anonymous LLM\n# spend. The browser chat cannot safely hold this server secret; use\n# SITE_PASSWORD instead when authenticated browser chat is required.\n# RAG_API_KEY=generate-a-long-random-secret\n# Set DOCS_API_KEY to require bearer authentication for /api/mcp. If omitted,\n# MCP follows the site access mode and remains public on an intentionally public\n# documentation site.\n# DOCS_API_KEY=generate-another-long-random-secret\n\n# Remote Dev Access (optional, dev server only)\n# Hostnames (besides localhost) allowed to load the Next.js dev server's\n# resources, for when you browse the dev server over a LAN IP or a\n# Tailscale/VPN hostname. Without this, Next blocks the dev HMR socket for\n# such hosts and the page renders but never becomes interactive. Ignored by\n# production builds. Comma-separate multiple hostnames.\n# ALLOWED_DEV_ORIGINS=my-machine.tailnet-name.ts.net\n\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\n# See available models at your provider's docs:\n# OpenAI: https://platform.openai.com/docs/models\n# Anthropic: https://docs.anthropic.com/claude/docs/models-overview\n# Google: https://ai.google.dev/models/gemini\n# LLM_CHAT_MODEL=\n\n# Optional: Override default embedding model\n# See available embedding models at your provider's docs:\n# OpenAI: https://platform.openai.com/docs/guides/embeddings\n# Google: https://ai.google.dev/gemini-api/docs/embeddings\n# Note: Anthropic doesn't provide embeddings, will fallback to OpenAI\n# LLM_EMBEDDING_MODEL=\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 Matryoshka-truncated to this many dimensions and stored as\n# int8, which keeps services/mcp/docs-index.json small (~20x smaller than raw\n# floats) so large doc sets don't stall the AI chat on serverless cold starts.\n# Lower = smaller index, slightly lower recall. Values >= the model's native\n# dimension keep full precision. Rebuild after changing this.\n# LLM_EMBEDDING_DIMS=512\n";
|
|
1
|
+
export declare const envExampleTemplate = "# Public Site URL\n# Used by sitemap.xml and robots.txt. Overrides `url` in config.json when set.\n# NEXT_PUBLIC_SITE_URL=https://docs.example.com\n\n# Password Protection (optional)\n# Set a shared password to gate the whole site behind a login screen. When set,\n# pages require the password, the content APIs (chat + search) return 401\n# without it, and the site is hidden from search engines and crawlers. Leave\n# unset (or remove) to keep the site public.\n# SITE_PASSWORD=choose-a-strong-shared-password\n\n# Paid API Access (recommended for public deployments with AI enabled)\n# Public documentation remains intentionally public by default. Set RAG_API_KEY\n# to require Authorization: Bearer <key> for /api/rag and prevent anonymous LLM\n# spend. The browser chat cannot safely hold this server secret; use\n# SITE_PASSWORD instead when authenticated browser chat is required.\n# RAG_API_KEY=generate-a-long-random-secret\n# Set DOCS_API_KEY to require bearer authentication for /api/mcp. If omitted,\n# MCP follows the site access mode and remains public on an intentionally public\n# documentation site.\n# DOCS_API_KEY=generate-another-long-random-secret\n\n# Remote Dev Access (optional, dev server only)\n# Hostnames (besides localhost) allowed to load the Next.js dev server's\n# resources, for when you browse the dev server over a LAN IP or a\n# Tailscale/VPN hostname. Without this, Next blocks the dev HMR socket for\n# such hosts and the page renders but never becomes interactive. Ignored by\n# production builds. Comma-separate multiple hostnames.\n# ALLOWED_DEV_ORIGINS=my-machine.tailnet-name.ts.net\n\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\n# See available models at your provider's docs:\n# OpenAI: https://platform.openai.com/docs/models\n# Anthropic: https://docs.anthropic.com/claude/docs/models-overview\n# Google: https://ai.google.dev/models/gemini\n# LLM_CHAT_MODEL=\n\n# Optional: Override default embedding model\n# See available embedding models at your provider's docs:\n# OpenAI: https://platform.openai.com/docs/guides/embeddings\n# Google: https://ai.google.dev/gemini-api/docs/embeddings\n# Note: Anthropic doesn't provide embeddings, will fallback to OpenAI\n# LLM_EMBEDDING_MODEL=\n\n# Optional: Set temperature (0-1 for Anthropic, 0-2 for OpenAI and Google, default: 0)\n# Use \"default\" to send none and keep the model's own default\n# LLM_TEMPERATURE=0\n\n# Optional: Embedding dimensions for the prebuilt search index (default: 512)\n# Doc vectors are Matryoshka-truncated to this many dimensions and stored as\n# int8, which keeps services/mcp/docs-index.json small (~20x smaller than raw\n# floats) so large doc sets don't stall the AI chat on serverless cold starts.\n# Lower = smaller index, slightly lower recall. Values >= the model's native\n# dimension keep full precision. Rebuild after changing this.\n# LLM_EMBEDDING_DIMS=512\n";
|
|
@@ -51,7 +51,8 @@ GOOGLE_API_KEY=your_google_api_key_here
|
|
|
51
51
|
# Note: Anthropic doesn't provide embeddings, will fallback to OpenAI
|
|
52
52
|
# LLM_EMBEDDING_MODEL=
|
|
53
53
|
|
|
54
|
-
# Optional: Set temperature (0-1, default: 0)
|
|
54
|
+
# Optional: Set temperature (0-1 for Anthropic, 0-2 for OpenAI and Google, default: 0)
|
|
55
|
+
# Use "default" to send none and keep the model's own default
|
|
55
56
|
# LLM_TEMPERATURE=0
|
|
56
57
|
|
|
57
58
|
# Optional: Embedding dimensions for the prebuilt search index (default: 512)
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import type { PageMeta, SectionConfig } from "../../lib/types.js";
|
|
2
|
+
export interface LlmsVariantLink {
|
|
3
|
+
label: string;
|
|
4
|
+
url: string;
|
|
5
|
+
}
|
|
2
6
|
export interface LlmsIndexArgs {
|
|
3
7
|
siteName: string;
|
|
4
8
|
siteDescription?: string;
|
|
5
9
|
baseUrl: string | null;
|
|
6
10
|
pages: PageMeta[];
|
|
7
11
|
sectionsConfig: SectionConfig[] | null;
|
|
12
|
+
/** The `llms.txt` of every other language/version of the site, appended as
|
|
13
|
+
* a final section so an agent can find the variant it needs. */
|
|
14
|
+
variantLinks?: {
|
|
15
|
+
heading: string;
|
|
16
|
+
links: LlmsVariantLink[];
|
|
17
|
+
};
|
|
18
|
+
/** URL prefix of the language/version this index describes ("" at the
|
|
19
|
+
* root); its full-corpus file lives under the same prefix. */
|
|
20
|
+
variantPrefix?: string;
|
|
8
21
|
}
|
|
9
22
|
export interface CategoryGroup {
|
|
10
23
|
category: string;
|
|
@@ -69,10 +69,23 @@ export function buildSectionGroups(pages, sectionsConfig) {
|
|
|
69
69
|
groups.sort((a, b) => a.sectionOrder - b.sectionOrder);
|
|
70
70
|
return groups;
|
|
71
71
|
}
|
|
72
|
+
function variantLinkLines(variantLinks) {
|
|
73
|
+
if (!variantLinks || variantLinks.links.length === 0)
|
|
74
|
+
return [];
|
|
75
|
+
return [
|
|
76
|
+
`## ${variantLinks.heading}`,
|
|
77
|
+
"",
|
|
78
|
+
...variantLinks.links.map((link) => `- [${link.label}](${link.url})`),
|
|
79
|
+
"",
|
|
80
|
+
];
|
|
81
|
+
}
|
|
72
82
|
export function llmsIndexTemplate(args) {
|
|
73
|
-
const { siteName, siteDescription, baseUrl, pages, sectionsConfig } = args;
|
|
83
|
+
const { siteName, siteDescription, baseUrl, pages, sectionsConfig, variantLinks, variantPrefix = "", } = args;
|
|
74
84
|
const lines = [];
|
|
75
85
|
const prefix = baseUrl ?? "";
|
|
86
|
+
const fullCorpusPath = variantPrefix
|
|
87
|
+
? `/${variantPrefix}/llms-full.txt`
|
|
88
|
+
: "/llms-full.txt";
|
|
76
89
|
lines.push(`# ${siteName}`);
|
|
77
90
|
lines.push("");
|
|
78
91
|
const summary = siteDescription && siteDescription.trim() !== ""
|
|
@@ -81,12 +94,13 @@ export function llmsIndexTemplate(args) {
|
|
|
81
94
|
lines.push(`> ${summary}`);
|
|
82
95
|
lines.push("");
|
|
83
96
|
lines.push("Every page link below points to a markdown mirror; drop the .md suffix for the HTML version.");
|
|
84
|
-
lines.push(`Full corpus in one file: ${prefix}
|
|
97
|
+
lines.push(`Full corpus in one file: ${prefix}${fullCorpusPath}`);
|
|
85
98
|
lines.push(`Agent skill: ${prefix}/skill.md`);
|
|
86
99
|
lines.push(`MCP server (streamable HTTP; tools: search_docs, get_doc, list_docs): ${prefix}/api/mcp`);
|
|
87
100
|
lines.push("");
|
|
88
101
|
if (pages.length === 0) {
|
|
89
|
-
|
|
102
|
+
lines.push(...variantLinkLines(variantLinks));
|
|
103
|
+
return lines.join("\n").replace(/\n+$/, "\n");
|
|
90
104
|
}
|
|
91
105
|
const groups = buildSectionGroups(pages, sectionsConfig);
|
|
92
106
|
for (const group of groups) {
|
|
@@ -109,5 +123,6 @@ export function llmsIndexTemplate(args) {
|
|
|
109
123
|
lines.push("");
|
|
110
124
|
}
|
|
111
125
|
}
|
|
126
|
+
lines.push(...variantLinkLines(variantLinks));
|
|
112
127
|
return lines.join("\n").replace(/\n+$/, "\n");
|
|
113
128
|
}
|
|
@@ -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: \"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: Require a bearer token for direct /api/rag requests on a public site\n# RAG_API_KEY=generate-a-long-random-secret\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 ignores every `.env*` variant except the non-secret\n `.env.example`, helping prevent development, test, and production credentials\n from being committed accidentally.\n</Callout>\n\n## Protecting model spend\n\nPublic documentation intentionally leaves the browser assistant available by default. For a public deployment where only server-to-server clients should call the paid RAG endpoint, set `RAG_API_KEY` and require `Authorization: Bearer <key>` on `/api/rag`.\n\n<Callout type=\"warning\">\n The built-in browser assistant cannot safely store a server API key. Setting\n `RAG_API_KEY` on an otherwise public site disables anonymous browser chat. Use\n `SITE_PASSWORD` instead when signed-in browser visitors should keep using the\n assistant, or leave `RAG_API_KEY` unset when public chat is intentional.\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-
|
|
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\nOn a site with [languages](/languages) or [versions](/versions), the assistant answers from the pages of the language and version the reader is on.\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: Require a bearer token for direct /api/rag requests on a public site\n# RAG_API_KEY=generate-a-long-random-secret\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 for Anthropic, 0-2 for OpenAI and Google, default: 0)\n# Use \"default\" to send none and keep the model's own default\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 ignores every `.env*` variant except the non-secret\n `.env.example`, helping prevent development, test, and production credentials\n from being committed accidentally.\n</Callout>\n\n## Protecting model spend\n\nPublic documentation intentionally leaves the browser assistant available by default. For a public deployment where only server-to-server clients should call the paid RAG endpoint, set `RAG_API_KEY` and require `Authorization: Bearer <key>` on `/api/rag`.\n\n<Callout type=\"warning\">\n The built-in browser assistant cannot safely store a server API key. Setting\n `RAG_API_KEY` on an otherwise public site disables anonymous browser chat. Use\n `SITE_PASSWORD` instead when signed-in browser visitors should keep using the\n assistant, or leave `RAG_API_KEY` unset when public chat is intentional.\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-mini` | `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`. Anthropic accepts a value from 0 to 1, OpenAI and Google from 0 to 2:\n\n- `0` - More deterministic and focused responses (default)\n- `1` - More creative and varied responses\n- `default` - Send no temperature and keep the model's own default\n\nSome models do not accept a custom temperature: OpenAI's reasoning models (such as `o3` and `o4-mini`) and its GPT-5 models onwards. For those, Doccupine sends no temperature and ignores `LLM_TEMPERATURE` with a warning in the server logs. A value outside the provider's range is ignored the same way, and the default is used instead.\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.";
|
|
@@ -19,6 +19,8 @@ Once a provider is configured, an assistant button appears in the header. You ca
|
|
|
19
19
|
The keyboard shortcut is only active once you have configured an LLM provider, as described below.
|
|
20
20
|
</Callout>
|
|
21
21
|
|
|
22
|
+
On a site with [languages](/languages) or [versions](/versions), the assistant answers from the pages of the language and version the reader is on.
|
|
23
|
+
|
|
22
24
|
## Setup
|
|
23
25
|
|
|
24
26
|
To enable AI features, create an \`.env\` file in the directory where your website is generated. By default, this is the \`nextjs-app/\` directory.
|
|
@@ -47,7 +49,8 @@ GOOGLE_API_KEY=your_google_api_key_here
|
|
|
47
49
|
# Note: Anthropic doesn't provide embeddings, will fallback to OpenAI
|
|
48
50
|
# LLM_EMBEDDING_MODEL=your-embedding-model-id
|
|
49
51
|
|
|
50
|
-
# Optional: Set temperature (0-1, default: 0)
|
|
52
|
+
# Optional: Set temperature (0-1 for Anthropic, 0-2 for OpenAI and Google, default: 0)
|
|
53
|
+
# Use "default" to send none and keep the model's own default
|
|
51
54
|
# LLM_TEMPERATURE=0
|
|
52
55
|
|
|
53
56
|
# Optional: Embedding dimensions for the prebuilt search index (default: 512)
|
|
@@ -121,7 +124,7 @@ This hybrid approach allows you to leverage Anthropic's powerful chat models whi
|
|
|
121
124
|
|
|
122
125
|
| Provider | Chat model | Embedding model |
|
|
123
126
|
| --------- | ---------------------------- | ------------------------ |
|
|
124
|
-
| OpenAI | \`gpt-4.1-
|
|
127
|
+
| OpenAI | \`gpt-4.1-mini\` | \`text-embedding-3-small\` |
|
|
125
128
|
| Anthropic | \`claude-sonnet-4-5-20250929\` | OpenAI fallback |
|
|
126
129
|
| Google | \`gemini-2.5-flash-lite\` | \`gemini-embedding-001\` |
|
|
127
130
|
|
|
@@ -145,10 +148,13 @@ Override the default embedding model by uncommenting and setting \`LLM_EMBEDDING
|
|
|
145
148
|
|
|
146
149
|
### Temperature
|
|
147
150
|
|
|
148
|
-
Control the randomness of AI responses by setting \`LLM_TEMPERATURE
|
|
151
|
+
Control the randomness of AI responses by setting \`LLM_TEMPERATURE\`. Anthropic accepts a value from 0 to 1, OpenAI and Google from 0 to 2:
|
|
149
152
|
|
|
150
153
|
- \`0\` - More deterministic and focused responses (default)
|
|
151
154
|
- \`1\` - More creative and varied responses
|
|
155
|
+
- \`default\` - Send no temperature and keep the model's own default
|
|
156
|
+
|
|
157
|
+
Some models do not accept a custom temperature: OpenAI's reasoning models (such as \`o3\` and \`o4-mini\`) and its GPT-5 models onwards. For those, Doccupine sends no temperature and ignores \`LLM_TEMPERATURE\` with a warning in the server logs. A value outside the provider's range is ignored the same way, and the default is used instead.
|
|
152
158
|
|
|
153
159
|
### Embedding Dimensions
|
|
154
160
|
|
|
@@ -1 +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\"\nupdated: \"2026-07-31\"\ncategory: \"Components\"\ncategoryOrder: 1\norder: 20\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 Doccupine reads the root document and its recursive local `$ref` dependencies as one stable snapshot, then writes an endpoint page for each operation. The root must resolve inside the project, while referenced files must stay beneath the root spec's directory, use `.json`, `.yaml`, or `.yml`, and cannot be dotfiles or live inside dot-directories. Remote references and symlink escapes are rejected.\n </Step>\n <Step title=\"Open the API Reference section.\">\n Endpoints appear in the sidebar grouped by their OpenAPI tag. In watch mode, editing the root spec or any discovered local `$ref` file regenerates the reference automatically. Adding or retargeting a reference updates the watched dependency set after the refresh succeeds.\n </Step>\n</Steps>\n\n<Callout type=\"info\">\n OpenAPI refreshes preserve the last successful reference. A malformed or partially saved spec, a missing reference, or a generation failure does not replace the active pages, request allowlist, navigation, MCP content, or watcher.\n</Callout>\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\nThe generated `/api-reference` index lists every operation with a direct link, grouped by API and tag. Each operation also gets its own page under `/api-reference/{tag}/{operation}`, showing:\n\n<Callout type=\"note\">\n A hand-written MDX page takes precedence when it resolves to the same route as a generated OpenAPI page. Moving or deleting that MDX source returns the route to OpenAPI on the next successful refresh.\n</Callout>\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 servers declared in your OpenAPI document and refuses private, internal, metadata, and reserved network addresses, including IPv4 destinations represented through IPv6 translation ranges. An explicitly declared loopback server such as `http://localhost:4000` is available only outside production for local development and tests; production always blocks loopback and every other private target even when the spec declares one. Request URLs, headers, and bodies are never logged, so API keys a reader enters are not written anywhere. On a [password-protected site](/authentication), the proxy also requires the visitor's unlocked session, so it cannot be called anonymously.\n\nProxy requests are rate limited per trusted client address on recognized hosting platforms. Unknown and self-hosted proxy setups share one fallback bucket rather than trusting spoofable forwarding headers; use your trusted edge or a shared rate-limit store when those deployments need accurate per-client limits.\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";
|
|
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\"\nupdated: \"2026-07-31\"\ncategory: \"Components\"\ncategoryOrder: 1\norder: 20\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 Doccupine reads the root document and its recursive local `$ref` dependencies as one stable snapshot, then writes an endpoint page for each operation. The root must resolve inside the project, while referenced files must stay beneath the root spec's directory, use `.json`, `.yaml`, or `.yml`, and cannot be dotfiles or live inside dot-directories. Remote references and symlink escapes are rejected.\n </Step>\n <Step title=\"Open the API Reference section.\">\n Endpoints appear in the sidebar grouped by their OpenAPI tag. In watch mode, editing the root spec or any discovered local `$ref` file regenerates the reference automatically. Adding or retargeting a reference updates the watched dependency set after the refresh succeeds.\n </Step>\n</Steps>\n\n<Callout type=\"info\">\n OpenAPI refreshes preserve the last successful reference. A malformed or partially saved spec, a missing reference, or a generation failure does not replace the active pages, request allowlist, navigation, MCP content, or watcher.\n</Callout>\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\nThe generated `/api-reference` index lists every operation with a direct link, grouped by API and tag. Each operation also gets its own page under `/api-reference/{tag}/{operation}`, showing:\n\nOn a site with [languages](/languages) or [versions](/versions), the API reference is generated for the default language and version only, and its section tab is hidden under every other prefix. Hand-written pages inside a language or version folder are unaffected.\n\n<Callout type=\"note\">\n A hand-written MDX page takes precedence when it resolves to the same route as a generated OpenAPI page. Moving or deleting that MDX source returns the route to OpenAPI on the next successful refresh.\n</Callout>\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 servers declared in your OpenAPI document and refuses private, internal, metadata, and reserved network addresses, including IPv4 destinations represented through IPv6 translation ranges. An explicitly declared loopback server such as `http://localhost:4000` is available only outside production for local development and tests; production always blocks loopback and every other private target even when the spec declares one. Request URLs, headers, and bodies are never logged, so API keys a reader enters are not written anywhere. On a [password-protected site](/authentication), the proxy also requires the visitor's unlocked session, so it cannot be called anonymously.\n\nProxy requests are rate limited per trusted client address on recognized hosting platforms. Unknown and self-hosted proxy setups share one fallback bucket rather than trusting spoofable forwarding headers; use your trusted edge or a shared rate-limit store when those deployments need accurate per-client limits.\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";
|
|
@@ -98,6 +98,8 @@ Each part maps to something in the playground: \`servers\` sets the request targ
|
|
|
98
98
|
|
|
99
99
|
The generated \`/api-reference\` index lists every operation with a direct link, grouped by API and tag. Each operation also gets its own page under \`/api-reference/{tag}/{operation}\`, showing:
|
|
100
100
|
|
|
101
|
+
On a site with [languages](/languages) or [versions](/versions), the API reference is generated for the default language and version only, and its section tab is hidden under every other prefix. Hand-written pages inside a language or version folder are unaffected.
|
|
102
|
+
|
|
101
103
|
<Callout type="note">
|
|
102
104
|
A hand-written MDX page takes precedence when it resolves to the same route as a generated OpenAPI page. Moving or deleting that MDX source returns the route to OpenAPI on the next successful refresh.
|
|
103
105
|
</Callout>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const commandsMdxTemplate = "---\ntitle: \"Commands\"\ndescription: \"In this page, you can find all the commands available in Doccupine CLI.\"\ndate: \"2026-02-19\"\nupdated: \"2026-08-04\"\ncategory: \"Getting Started\"\ncategoryOrder: 0\norder: 2\n---\n# Commands\n\nIn this page, you can find all the commands available in Doccupine CLI.\n\n## Run Doccupine CLI\n\nCreate a new directory for your project and navigate to it in your terminal. Run the following command to create a new Doccupine project:\n\n```bash\nnpx doccupine\n```\n\nOnce you run the command, Doccupine will ask you to select a directory to store your MDX files. Choose the directory where you want to create your documentation files.\nAfter selecting the directory, Doccupine will ask you to enter the name of the directory for the generated website. Enter the name of the directory where you want to create your website.\nFinally, Doccupine will ask for an optional path to an OpenAPI document. Leave it blank to skip, or point it at a `.yaml`, `.yml`, or `.json` spec to generate an interactive [API Playground](/api-playground) from your API.\n\nThis will start the development server on port 3000. Open your browser and navigate to http://localhost:3000 to view your documentation.\n\n## Options\n\n| Flag | Description |\n| -------------------------- | --------------------------------------------------------------------------- |\n| `--port <port>` | Port for the dev server (default: `3000`). Auto-increments if taken. |\n| `--verbose` | Show all Next.js output including compilation details. |\n| `--reset` | Re-prompt for watch/output directories and the OpenAPI spec path. |\n| `--skip-install` | Always skip dependency installation before starting the development server. |\n| `--package-manager <name>` | Use `pnpm` or `npm` for the generated app instead of auto-detection. |\n\n<Callout type=\"warning\">\n The watch and output directories must not overlap. The output directory must be empty, contain only local metadata such as `.DS_Store` or `.env.local`, or already be owned by Doccupine. This prevents the generator from overwriting another project. If an older `doccupine.json` no longer validates, run `doccupine config --reset`. Generation also reports a validation error, instead of letting one page overwrite another, when two source files resolve to the same route.\n</Callout>\n\nStarter documentation is created only when the selected source directory contains no MDX files. Existing pages are never replaced just because `index.mdx` is missing. Frontmatter must use the normal YAML `---` delimiter; language-tagged executable frontmatter is rejected.\n\nDoccupine marks its output directory with `.doccupine-generated.json` and records generated route, Markdown-mirror, and copied public-file ownership in `.doccupine-artifacts.json`. Treat both files as internal generator state. A fresh run recreates `app`, and later refreshes may rewrite other registered template paths, so keep durable changes in source MDX, project-root JSON files, and `public`.\n\n## Watch mode\n\nThe default command watches MDX files, supported project-root JSON configuration, `fonts.json`, `analytics.json`, `doccupine.json`, public assets, and configured OpenAPI documents with their discovered local `$ref` files. Changes are processed serially. Once every watcher is ready, Doccupine compares the current sources with the versions used during initial generation and reconciles edits made while startup was still running.\n\n## Route collisions and recovery\n\nTwo MDX sources cannot generate the same route. For example, `guide.mdx` and `guide/index.mdx` both resolve to `/guide`. A one-time build stops before either source can overwrite the other.\n\nDuring watch mode, a collision keeps the last successfully generated page and site metadata in place. After you move, rename, or delete one of the colliding sources, Doccupine retries the blocked sources and any other MDX changes that could not be applied while the collision existed. A restart or manual resave is not required.\n\n<Callout type=\"info\">\n Failed watch refreshes keep or restore the last successful pages, route ownership, inferred sections, sitemap, and LLMS/MCP content. A new page with no successful version stays absent until it can be generated safely.\n</Callout>\n\n## Reloading doccupine.json\n\nChanging the `openapi` field is applied live after the complete candidate reference validates and generates successfully. Invalid JSON, invalid configuration, a missing spec, or a failed generation keeps the current OpenAPI reference and watcher active. Changes to `watchDir`, `outputDir`, `port`, or `packageManager` require restarting Doccupine.\n\n## File-system safety\n\nDoccupine does not follow symlinked MDX files or nested directories beneath `watchDir`. Project-root configuration and public assets must also use real files and directories, and the `public` root cannot be a symlink. A stable symlink used as the `watchDir` root is supported, but links inside it are rejected.\n\nThe output directory must be a real directory, and generated paths cannot contain symlinks. OpenAPI root specs must resolve inside the project, while local references must remain inside the root spec's directory. These checks prevent generated reads, writes, and removals from being redirected elsewhere.\n\n## Dependency installation\n\nThe first run installs the generated app's dependencies. After that, Doccupine records a fingerprint of the generated `package.json` and the package manager in `.doccupine-install` and reinstalls only when that fingerprint changes or `node_modules` is missing - later runs start the dev server straight away. Pass `--skip-install` to skip the check entirely, for example when you manage dependencies yourself.\n\n## Browsing from another device\n\nThe dev server is reachable from other devices on your network, but Next.js only serves development resources such as the hot-reload socket to hosts it recognizes. Opened over a LAN IP or a Tailscale/VPN hostname, the page renders but never becomes interactive.\n\nTo allow additional hostnames, set `ALLOWED_DEV_ORIGINS` in the generated app's `.env` file and restart the dev server. Comma-separate multiple hostnames:\n\n```env\nALLOWED_DEV_ORIGINS=my-machine.tailnet-name.ts.net\n```\n\n<Callout type=\"note\">\n This only affects the development server. Production builds ignore the\n variable, and leaving it unset keeps Next's DNS-rebinding protection fully\n enabled.\n</Callout>\n\n## Verbose mode\n\n```bash\nnpx doccupine --verbose\n```\n\n<Callout type=\"note\">\n This will show Next.js output in the terminal, providing detailed logs useful for debugging during development.\n</Callout>\n\n## Generate the website\n\n```bash\nnpx doccupine build\n```\n\nYou can also use the equivalent `npx doccupine generate` command. These commands scaffold the Next.js app from your MDX files without installing dependencies or starting the development server. To produce a production build, install dependencies and run the generated app's `build` script.\n\n## Show current configuration\n\n```bash\nnpx doccupine config --show\n```\n\nThis will show the current configuration for Doccupine.\n\n## Reset configuration\n\n```bash\nnpx doccupine config --reset\n```\n\nThis will reset the current configuration for Doccupine.";
|
|
1
|
+
export declare const commandsMdxTemplate = "---\ntitle: \"Commands\"\ndescription: \"In this page, you can find all the commands available in Doccupine CLI.\"\ndate: \"2026-02-19\"\nupdated: \"2026-08-04\"\ncategory: \"Getting Started\"\ncategoryOrder: 0\norder: 2\n---\n# Commands\n\nIn this page, you can find all the commands available in Doccupine CLI.\n\n## Run Doccupine CLI\n\nCreate a new directory for your project and navigate to it in your terminal. Run the following command to create a new Doccupine project:\n\n```bash\nnpx doccupine\n```\n\nOnce you run the command, Doccupine will ask you to select a directory to store your MDX files. Choose the directory where you want to create your documentation files.\nAfter selecting the directory, Doccupine will ask you to enter the name of the directory for the generated website. Enter the name of the directory where you want to create your website.\nFinally, Doccupine will ask for an optional path to an OpenAPI document. Leave it blank to skip, or point it at a `.yaml`, `.yml`, or `.json` spec to generate an interactive [API Playground](/api-playground) from your API.\n\nThis will start the development server on port 3000. Open your browser and navigate to http://localhost:3000 to view your documentation.\n\n## Options\n\n| Flag | Description |\n| -------------------------- | --------------------------------------------------------------------------- |\n| `--port <port>` | Port for the dev server (default: `3000`). Auto-increments if taken. |\n| `--verbose` | Show all Next.js output including compilation details. |\n| `--reset` | Re-prompt for watch/output directories and the OpenAPI spec path. |\n| `--skip-install` | Always skip dependency installation before starting the development server. |\n| `--package-manager <name>` | Use `pnpm` or `npm` for the generated app instead of auto-detection. |\n\n<Callout type=\"warning\">\n The watch and output directories must not overlap. The output directory must be empty, contain only local metadata such as `.DS_Store` or `.env.local`, or already be owned by Doccupine. This prevents the generator from overwriting another project. If an older `doccupine.json` no longer validates, run `doccupine config --reset`. Generation also reports a validation error, instead of letting one page overwrite another, when two source files resolve to the same route.\n</Callout>\n\nStarter documentation is created only when the selected source directory contains no MDX files. Existing pages are never replaced just because `index.mdx` is missing. Frontmatter must use the normal YAML `---` delimiter; language-tagged executable frontmatter is rejected.\n\nDoccupine marks its output directory with `.doccupine-generated.json` and records generated route, Markdown-mirror, and copied public-file ownership in `.doccupine-artifacts.json`. Treat both files as internal generator state. A fresh run recreates `app`, and later refreshes may rewrite other registered template paths, so keep durable changes in source MDX, project-root JSON files, and `public`.\n\n## Watch mode\n\nThe default command watches MDX files, supported project-root JSON configuration (including `languages.json` and `versions.json`, which regenerate the whole site when they change and keep the previous configuration while the file is invalid), `fonts.json`, `analytics.json`, `doccupine.json`, public assets, and configured OpenAPI documents with their discovered local `$ref` files. Changes are processed serially. Once every watcher is ready, Doccupine compares the current sources with the versions used during initial generation and reconciles edits made while startup was still running.\n\n## Route collisions and recovery\n\nTwo MDX sources cannot generate the same route. For example, `guide.mdx` and `guide/index.mdx` both resolve to `/guide`. A one-time build stops before either source can overwrite the other.\n\nDuring watch mode, a collision keeps the last successfully generated page and site metadata in place. After you move, rename, or delete one of the colliding sources, Doccupine retries the blocked sources and any other MDX changes that could not be applied while the collision existed. A restart or manual resave is not required.\n\n<Callout type=\"info\">\n Failed watch refreshes keep or restore the last successful pages, route ownership, inferred sections, sitemap, and LLMS/MCP content. A new page with no successful version stays absent until it can be generated safely.\n</Callout>\n\n## Reloading doccupine.json\n\nChanging the `openapi` field is applied live after the complete candidate reference validates and generates successfully. Invalid JSON, invalid configuration, a missing spec, or a failed generation keeps the current OpenAPI reference and watcher active. Changes to `watchDir`, `outputDir`, `port`, or `packageManager` require restarting Doccupine.\n\n## File-system safety\n\nDoccupine does not follow symlinked MDX files or nested directories beneath `watchDir`. Project-root configuration and public assets must also use real files and directories, and the `public` root cannot be a symlink. A stable symlink used as the `watchDir` root is supported, but links inside it are rejected.\n\nThe output directory must be a real directory, and generated paths cannot contain symlinks. OpenAPI root specs must resolve inside the project, while local references must remain inside the root spec's directory. These checks prevent generated reads, writes, and removals from being redirected elsewhere.\n\n## Dependency installation\n\nThe first run installs the generated app's dependencies. After that, Doccupine records a fingerprint of the generated `package.json` and the package manager in `.doccupine-install` and reinstalls only when that fingerprint changes or `node_modules` is missing - later runs start the dev server straight away. Pass `--skip-install` to skip the check entirely, for example when you manage dependencies yourself.\n\n## Browsing from another device\n\nThe dev server is reachable from other devices on your network, but Next.js only serves development resources such as the hot-reload socket to hosts it recognizes. Opened over a LAN IP or a Tailscale/VPN hostname, the page renders but never becomes interactive.\n\nTo allow additional hostnames, set `ALLOWED_DEV_ORIGINS` in the generated app's `.env` file and restart the dev server. Comma-separate multiple hostnames:\n\n```env\nALLOWED_DEV_ORIGINS=my-machine.tailnet-name.ts.net\n```\n\n<Callout type=\"note\">\n This only affects the development server. Production builds ignore the\n variable, and leaving it unset keeps Next's DNS-rebinding protection fully\n enabled.\n</Callout>\n\n## Verbose mode\n\n```bash\nnpx doccupine --verbose\n```\n\n<Callout type=\"note\">\n This will show Next.js output in the terminal, providing detailed logs useful for debugging during development.\n</Callout>\n\n## Generate the website\n\n```bash\nnpx doccupine build\n```\n\nYou can also use the equivalent `npx doccupine generate` command. These commands scaffold the Next.js app from your MDX files without installing dependencies or starting the development server. To produce a production build, install dependencies and run the generated app's `build` script.\n\n## Show current configuration\n\n```bash\nnpx doccupine config --show\n```\n\nThis will show the current configuration for Doccupine.\n\n## Reset configuration\n\n```bash\nnpx doccupine config --reset\n```\n\nThis will reset the current configuration for Doccupine.";
|
|
@@ -45,7 +45,7 @@ Doccupine marks its output directory with \`.doccupine-generated.json\` and reco
|
|
|
45
45
|
|
|
46
46
|
## Watch mode
|
|
47
47
|
|
|
48
|
-
The default command watches MDX files, supported project-root JSON configuration, \`fonts.json\`, \`analytics.json\`, \`doccupine.json\`, public assets, and configured OpenAPI documents with their discovered local \`$ref\` files. Changes are processed serially. Once every watcher is ready, Doccupine compares the current sources with the versions used during initial generation and reconciles edits made while startup was still running.
|
|
48
|
+
The default command watches MDX files, supported project-root JSON configuration (including \`languages.json\` and \`versions.json\`, which regenerate the whole site when they change and keep the previous configuration while the file is invalid), \`fonts.json\`, \`analytics.json\`, \`doccupine.json\`, public assets, and configured OpenAPI documents with their discovered local \`$ref\` files. Changes are processed serially. Once every watcher is ready, Doccupine compares the current sources with the versions used during initial generation and reconciles edits made while startup was still running.
|
|
49
49
|
|
|
50
50
|
## Route collisions and recovery
|
|
51
51
|
|