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.
- package/README.md +50 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +478 -45
- package/dist/lib/config-manager.d.ts +8 -1
- package/dist/lib/config-manager.js +98 -4
- package/dist/lib/metadata.d.ts +5 -0
- package/dist/lib/metadata.js +15 -4
- package/dist/lib/openapi-types.d.ts +120 -0
- package/dist/lib/openapi-types.js +14 -0
- package/dist/lib/openapi.d.ts +52 -0
- package/dist/lib/openapi.js +603 -0
- package/dist/lib/rss.d.ts +24 -0
- package/dist/lib/rss.js +137 -0
- package/dist/lib/structures.js +50 -4
- package/dist/lib/types.d.ts +22 -0
- package/dist/lib/utils.d.ts +8 -0
- package/dist/lib/utils.js +14 -0
- package/dist/templates/app/api/playground/route.d.ts +1 -0
- package/dist/templates/app/api/playground/route.js +199 -0
- package/dist/templates/app/rssRoute.d.ts +11 -0
- package/dist/templates/app/rssRoute.js +30 -0
- package/dist/templates/components/Docs.d.ts +1 -1
- package/dist/templates/components/Docs.js +15 -3
- package/dist/templates/components/MDXComponents.d.ts +1 -1
- package/dist/templates/components/MDXComponents.js +29 -0
- package/dist/templates/components/SideBar.d.ts +1 -1
- package/dist/templates/components/SideBar.js +13 -0
- package/dist/templates/components/layout/Accordion.d.ts +1 -1
- package/dist/templates/components/layout/Accordion.js +3 -2
- package/dist/templates/components/layout/ActionBar.d.ts +1 -1
- package/dist/templates/components/layout/ActionBar.js +65 -27
- package/dist/templates/components/layout/ApiPlayground.d.ts +1 -0
- package/dist/templates/components/layout/ApiPlayground.js +1075 -0
- package/dist/templates/components/layout/ApiPlaygroundDemo.d.ts +1 -0
- package/dist/templates/components/layout/ApiPlaygroundDemo.js +81 -0
- package/dist/templates/components/layout/Badge.d.ts +1 -0
- package/dist/templates/components/layout/Badge.js +455 -0
- package/dist/templates/components/layout/Code.d.ts +1 -1
- package/dist/templates/components/layout/Code.js +10 -22
- package/dist/templates/components/layout/CopyButton.d.ts +1 -0
- package/dist/templates/components/layout/CopyButton.js +68 -0
- package/dist/templates/components/layout/DocsComponents.d.ts +1 -1
- package/dist/templates/components/layout/DocsComponents.js +14 -0
- package/dist/templates/components/layout/Mermaid.d.ts +1 -1
- package/dist/templates/components/layout/Mermaid.js +21 -3
- package/dist/templates/components/layout/Prompt.d.ts +1 -0
- package/dist/templates/components/layout/Prompt.js +149 -0
- package/dist/templates/components/layout/SharedStyles.d.ts +1 -1
- package/dist/templates/components/layout/SharedStyles.js +0 -4
- package/dist/templates/components/layout/Steps.d.ts +1 -1
- package/dist/templates/components/layout/Steps.js +0 -1
- package/dist/templates/components/layout/Tooltip.d.ts +1 -0
- package/dist/templates/components/layout/Tooltip.js +222 -0
- package/dist/templates/components/layout/Tree.d.ts +1 -0
- package/dist/templates/components/layout/Tree.js +322 -0
- package/dist/templates/components/layout/TreeData.d.ts +1 -0
- package/dist/templates/components/layout/TreeData.js +131 -0
- package/dist/templates/components/layout/Update.d.ts +1 -1
- package/dist/templates/components/layout/Update.js +5 -1
- package/dist/templates/lib/rss.d.ts +1 -0
- package/dist/templates/lib/rss.js +78 -0
- package/dist/templates/mdx/accordion.mdx.d.ts +1 -1
- package/dist/templates/mdx/accordion.mdx.js +19 -1
- package/dist/templates/mdx/ai-assistant.mdx.d.ts +1 -1
- package/dist/templates/mdx/ai-assistant.mdx.js +3 -2
- package/dist/templates/mdx/analytics.mdx.d.ts +1 -1
- package/dist/templates/mdx/analytics.mdx.js +2 -2
- package/dist/templates/mdx/api-playground.mdx.d.ts +1 -0
- package/dist/templates/mdx/api-playground.mdx.js +158 -0
- package/dist/templates/mdx/authentication.mdx.d.ts +1 -1
- package/dist/templates/mdx/authentication.mdx.js +3 -3
- package/dist/templates/mdx/badges.mdx.d.ts +1 -0
- package/dist/templates/mdx/badges.mdx.js +237 -0
- package/dist/templates/mdx/buttons.mdx.d.ts +1 -1
- package/dist/templates/mdx/buttons.mdx.js +1 -1
- package/dist/templates/mdx/callouts.mdx.d.ts +1 -1
- package/dist/templates/mdx/callouts.mdx.js +1 -1
- package/dist/templates/mdx/cards.mdx.d.ts +1 -1
- package/dist/templates/mdx/cards.mdx.js +1 -1
- package/dist/templates/mdx/color-swatches.mdx.d.ts +1 -1
- package/dist/templates/mdx/color-swatches.mdx.js +1 -1
- package/dist/templates/mdx/columns.mdx.d.ts +1 -1
- package/dist/templates/mdx/columns.mdx.js +1 -1
- package/dist/templates/mdx/commands.mdx.d.ts +1 -1
- package/dist/templates/mdx/commands.mdx.js +3 -2
- package/dist/templates/mdx/components.mdx.d.ts +1 -1
- package/dist/templates/mdx/components.mdx.js +25 -10
- package/dist/templates/mdx/deployment-and-hosting.mdx.d.ts +1 -1
- package/dist/templates/mdx/deployment-and-hosting.mdx.js +4 -3
- package/dist/templates/mdx/fields.mdx.d.ts +1 -1
- package/dist/templates/mdx/fields.mdx.js +1 -1
- package/dist/templates/mdx/fonts.mdx.d.ts +1 -1
- package/dist/templates/mdx/fonts.mdx.js +2 -2
- 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/frames.mdx.d.ts +1 -1
- package/dist/templates/mdx/frames.mdx.js +1 -1
- package/dist/templates/mdx/globals.mdx.d.ts +1 -1
- package/dist/templates/mdx/globals.mdx.js +1 -1
- package/dist/templates/mdx/icons.mdx.d.ts +1 -1
- package/dist/templates/mdx/icons.mdx.js +1 -1
- package/dist/templates/mdx/image-and-embeds.mdx.d.ts +1 -1
- package/dist/templates/mdx/image-and-embeds.mdx.js +1 -1
- package/dist/templates/mdx/images-and-embeds.mdx.d.ts +1 -0
- package/dist/templates/mdx/images-and-embeds.mdx.js +118 -0
- package/dist/templates/mdx/media-and-assets.mdx.d.ts +1 -1
- package/dist/templates/mdx/media-and-assets.mdx.js +2 -2
- package/dist/templates/mdx/mermaid.mdx.d.ts +1 -1
- package/dist/templates/mdx/mermaid.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 +2 -2
- package/dist/templates/mdx/navigation.mdx.d.ts +1 -1
- package/dist/templates/mdx/navigation.mdx.js +27 -12
- package/dist/templates/mdx/platform/ai-assistant.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/ai-assistant.mdx.js +4 -3
- package/dist/templates/mdx/platform/analytics.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/analytics.mdx.js +2 -2
- package/dist/templates/mdx/platform/api-playground.mdx.d.ts +1 -0
- package/dist/templates/mdx/platform/api-playground.mdx.js +62 -0
- package/dist/templates/mdx/platform/billing.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/billing.mdx.js +1 -1
- package/dist/templates/mdx/platform/build-and-deploy.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/build-and-deploy.mdx.js +1 -1
- package/dist/templates/mdx/platform/creating-a-project.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/creating-a-project.mdx.js +12 -2
- package/dist/templates/mdx/platform/custom-domains.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/custom-domains.mdx.js +1 -1
- package/dist/templates/mdx/platform/fonts-settings.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/fonts-settings.mdx.js +1 -1
- package/dist/templates/mdx/platform/footer-links.mdx.d.ts +1 -0
- package/dist/templates/mdx/platform/{external-links.mdx.js → footer-links.mdx.js} +5 -5
- package/dist/templates/mdx/platform/import-from-github.mdx.d.ts +1 -0
- package/dist/templates/mdx/platform/import-from-github.mdx.js +91 -0
- package/dist/templates/mdx/platform/mcp.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/mcp.mdx.js +3 -3
- package/dist/templates/mdx/platform/project-settings.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/project-settings.mdx.js +1 -1
- package/dist/templates/mdx/platform/self-updating-docs.mdx.d.ts +1 -0
- package/dist/templates/mdx/platform/self-updating-docs.mdx.js +113 -0
- package/dist/templates/mdx/platform/team-members.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/team-members.mdx.js +1 -1
- package/dist/templates/mdx/prompt.mdx.d.ts +1 -0
- package/dist/templates/mdx/prompt.mdx.js +69 -0
- package/dist/templates/mdx/sections.mdx.d.ts +1 -1
- package/dist/templates/mdx/sections.mdx.js +1 -1
- package/dist/templates/mdx/steps.mdx.d.ts +1 -1
- package/dist/templates/mdx/steps.mdx.js +1 -1
- package/dist/templates/mdx/tabs.mdx.d.ts +1 -1
- package/dist/templates/mdx/tabs.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/tooltips.mdx.d.ts +1 -0
- package/dist/templates/mdx/tooltips.mdx.js +57 -0
- package/dist/templates/mdx/tree.mdx.d.ts +1 -0
- package/dist/templates/mdx/tree.mdx.js +158 -0
- package/dist/templates/mdx/update.mdx.d.ts +1 -1
- package/dist/templates/mdx/update.mdx.js +42 -2
- 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 +7 -7
- package/dist/templates/services/openapi/playgroundAllowlistStub.d.ts +1 -0
- package/dist/templates/services/openapi/playgroundAllowlistStub.js +4 -0
- package/dist/templates/types/openapi.d.ts +1 -0
- package/dist/templates/types/openapi.js +93 -0
- package/dist/templates/utils/apiSnippets.d.ts +1 -0
- package/dist/templates/utils/apiSnippets.js +94 -0
- package/dist/templates/utils/orderNavItems.d.ts +1 -1
- package/dist/templates/utils/orderNavItems.js +3 -0
- package/dist/templates/utils/playgroundAllowlist.d.ts +1 -0
- package/dist/templates/utils/playgroundAllowlist.js +70 -0
- package/dist/templates/utils/ssrfGuard.d.ts +1 -0
- package/dist/templates/utils/ssrfGuard.js +217 -0
- package/package.json +4 -3
- package/dist/templates/mdx/platform/external-links.mdx.d.ts +0 -1
package/README.md
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
- **Live preview** - watches your MDX files and regenerates pages on every save
|
|
10
10
|
- **Auto-generated navigation** - sidebar built from frontmatter (`category`, `order`)
|
|
11
11
|
- **Sections** - organize docs into tabbed sections via frontmatter or `sections.json`
|
|
12
|
+
- **API reference** - point at an OpenAPI spec to generate interactive endpoint pages with a live playground
|
|
13
|
+
- **Subscribable changelogs** - pages using the `Update` component publish an RSS feed at `{page-url}/rss.xml`
|
|
12
14
|
- **Theming** - dark/light mode with customizable theme via `theme.json`
|
|
13
15
|
- **AI chat assistant** - built-in RAG-powered chat (OpenAI, Anthropic, or Google)
|
|
14
16
|
- **MCP server** - exposes `search_docs`, `get_doc`, and `list_docs` tools for AI agents
|
|
@@ -29,6 +31,7 @@ Doccupine will prompt you for:
|
|
|
29
31
|
|
|
30
32
|
1. A directory to store your MDX files (default: `docs`)
|
|
31
33
|
2. An output directory for the generated Next.js app (default: `nextjs-app`)
|
|
34
|
+
3. An optional path to an OpenAPI spec for an API reference (blank to skip)
|
|
32
35
|
|
|
33
36
|
It then scaffolds the app, installs dependencies, and starts the dev server. Open http://localhost:3000 to view your docs.
|
|
34
37
|
|
|
@@ -85,6 +88,7 @@ date: "2025-01-01" # Page date metadata
|
|
|
85
88
|
updated: "2025-02-01" # Last-modified date (JSON-LD dateModified)
|
|
86
89
|
section: "API Reference" # Section this page belongs to
|
|
87
90
|
sectionOrder: 1 # Sort order for the section in the tab bar
|
|
91
|
+
openapi: "GET /users/{id}" # Embed an API playground for this endpoint (see API Reference)
|
|
88
92
|
---
|
|
89
93
|
```
|
|
90
94
|
|
|
@@ -142,20 +146,52 @@ Each entry has:
|
|
|
142
146
|
]
|
|
143
147
|
```
|
|
144
148
|
|
|
149
|
+
## API Reference
|
|
150
|
+
|
|
151
|
+
Point Doccupine at an OpenAPI document (`.json`, `.yaml`, or `.yml`, OpenAPI 3.0/3.1) and it generates an interactive API reference: one page per operation, each with a live playground for sending requests. Set the `openapi` field in `doccupine.json`:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"openapi": "openapi.json"
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
The endpoint pages are grouped into their own "API Reference" tab, and your hand-written docs move under a "Documentation" tab. The spec file is watched, so edits regenerate the reference live.
|
|
160
|
+
|
|
161
|
+
You can pass multiple specs as an array of paths, or name them explicitly:
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"openapi": [
|
|
166
|
+
{ "name": "Public API", "file": "openapi.json" },
|
|
167
|
+
{ "name": "Admin API", "file": "admin-openapi.yaml" }
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
To embed a single endpoint's playground inline within a hand-written page, add an `openapi` frontmatter field set to `"METHOD /path"` (or the operation's `operationId`):
|
|
173
|
+
|
|
174
|
+
```yaml
|
|
175
|
+
---
|
|
176
|
+
title: "Fetch a User"
|
|
177
|
+
openapi: "GET /users/{id}"
|
|
178
|
+
---
|
|
179
|
+
```
|
|
180
|
+
|
|
145
181
|
## Configuration Files
|
|
146
182
|
|
|
147
183
|
Place these JSON files in your project root (where you run `doccupine`). They are auto-copied to the generated app and watched for changes.
|
|
148
184
|
|
|
149
|
-
| File | Purpose
|
|
150
|
-
| ----------------- |
|
|
151
|
-
| `doccupine.json` | CLI config (watchDir
|
|
152
|
-
| `config.json` | Site metadata: `name`, `description`, `icon`, `image`, `url` (public site URL for sitemap/robots)
|
|
153
|
-
| `theme.json` | Theme overrides for [cherry-styled-components](https://github.com/cherry-design-system/styled-components)
|
|
154
|
-
| `navigation.json` | Manual navigation structure (overrides auto-generated)
|
|
155
|
-
| `links.json` | Static header/footer links
|
|
156
|
-
| `fonts.json` | Font configuration (Google Fonts or local)
|
|
157
|
-
| `sections.json` | Section definitions for tabbed doc groups (see [Sections](#sections))
|
|
158
|
-
| `analytics.json` | Analytics provider configuration (PostHog supported)
|
|
185
|
+
| File | Purpose |
|
|
186
|
+
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
187
|
+
| `doccupine.json` | CLI config (`watchDir`, `outputDir`, `port`, `packageManager`, `openapi`). Auto-generated on first run. Paths are stored relative to the project root, so the file is safe to commit. |
|
|
188
|
+
| `config.json` | Site metadata: `name`, `description`, `icon`, `image`, `url` (public site URL for sitemap/robots) |
|
|
189
|
+
| `theme.json` | Theme overrides for [cherry-styled-components](https://github.com/cherry-design-system/styled-components) |
|
|
190
|
+
| `navigation.json` | Manual navigation structure (overrides auto-generated) |
|
|
191
|
+
| `links.json` | Static header/footer links |
|
|
192
|
+
| `fonts.json` | Font configuration (Google Fonts or local) |
|
|
193
|
+
| `sections.json` | Section definitions for tabbed doc groups (see [Sections](#sections)) |
|
|
194
|
+
| `analytics.json` | Analytics provider configuration (PostHog supported) |
|
|
159
195
|
|
|
160
196
|
## Public Directory
|
|
161
197
|
|
|
@@ -211,8 +247,12 @@ If `LLM_PROVIDER` is not set, the chat component is hidden automatically.
|
|
|
211
247
|
LLM_CHAT_MODEL=gpt-4.1-nano # Override the default chat model
|
|
212
248
|
LLM_EMBEDDING_MODEL=text-embedding-3-small # Override the default embedding model
|
|
213
249
|
LLM_TEMPERATURE=0 # Set temperature (0-1, default: 0)
|
|
250
|
+
LLM_EMBEDDING_DIMS=512 # Dimensions for the prebuilt search index (default: 512)
|
|
251
|
+
RAG_RUNTIME_EMBED_MAX_CHUNKS=400 # Max chunks embedded on demand in production (default: 400; 0 requires a prebuilt index)
|
|
214
252
|
```
|
|
215
253
|
|
|
254
|
+
`LLM_EMBEDDING_DIMS` Matryoshka-truncates document vectors so the prebuilt search index stays small; lower values shrink the index at a slight cost to recall. `RAG_RUNTIME_EMBED_MAX_CHUNKS` caps how many chunks the chat will embed on demand in production before requiring a prebuilt index (it's unlimited under `next dev`).
|
|
255
|
+
|
|
216
256
|
Default models per provider:
|
|
217
257
|
|
|
218
258
|
| Provider | Chat model | Embedding model |
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { generateSlug, getFullSlug, escapeTemplateContent, } from "./lib/utils.js";
|
|
2
|
+
export { generateSlug, getFullSlug, escapeTemplateContent, toJsStringLiteral, } from "./lib/utils.js";
|
|
3
3
|
/**
|
|
4
4
|
* True when this file is what node was asked to run, rather than a module some
|
|
5
5
|
* other process imported. The test suite imports this file for its exported
|