@brainfish-ai/devdoc 0.1.21
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/LICENSE +33 -0
- package/README.md +415 -0
- package/bin/devdoc.js +13 -0
- package/dist/cli/commands/build.d.ts +5 -0
- package/dist/cli/commands/build.js +87 -0
- package/dist/cli/commands/check.d.ts +1 -0
- package/dist/cli/commands/check.js +143 -0
- package/dist/cli/commands/create.d.ts +24 -0
- package/dist/cli/commands/create.js +387 -0
- package/dist/cli/commands/deploy.d.ts +9 -0
- package/dist/cli/commands/deploy.js +433 -0
- package/dist/cli/commands/dev.d.ts +6 -0
- package/dist/cli/commands/dev.js +139 -0
- package/dist/cli/commands/init.d.ts +11 -0
- package/dist/cli/commands/init.js +238 -0
- package/dist/cli/commands/keys.d.ts +12 -0
- package/dist/cli/commands/keys.js +165 -0
- package/dist/cli/commands/start.d.ts +5 -0
- package/dist/cli/commands/start.js +56 -0
- package/dist/cli/commands/upload.d.ts +13 -0
- package/dist/cli/commands/upload.js +238 -0
- package/dist/cli/commands/whoami.d.ts +8 -0
- package/dist/cli/commands/whoami.js +91 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +106 -0
- package/dist/config/index.d.ts +80 -0
- package/dist/config/index.js +133 -0
- package/dist/constants.d.ts +9 -0
- package/dist/constants.js +13 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +12 -0
- package/dist/utils/logger.d.ts +16 -0
- package/dist/utils/logger.js +61 -0
- package/dist/utils/paths.d.ts +16 -0
- package/dist/utils/paths.js +50 -0
- package/package.json +51 -0
- package/renderer/app/api/assets/[...path]/route.ts +123 -0
- package/renderer/app/api/assets/route.ts +124 -0
- package/renderer/app/api/assets/upload/route.ts +177 -0
- package/renderer/app/api/auth-schemes/route.ts +77 -0
- package/renderer/app/api/chat/route.ts +858 -0
- package/renderer/app/api/codegen/route.ts +72 -0
- package/renderer/app/api/collections/route.ts +1016 -0
- package/renderer/app/api/debug/route.ts +53 -0
- package/renderer/app/api/deploy/route.ts +234 -0
- package/renderer/app/api/device/route.ts +42 -0
- package/renderer/app/api/docs/route.ts +187 -0
- package/renderer/app/api/keys/regenerate/route.ts +80 -0
- package/renderer/app/api/openapi-spec/route.ts +151 -0
- package/renderer/app/api/projects/[slug]/route.ts +153 -0
- package/renderer/app/api/projects/[slug]/stats/route.ts +96 -0
- package/renderer/app/api/projects/register/route.ts +152 -0
- package/renderer/app/api/proxy/route.ts +149 -0
- package/renderer/app/api/proxy-stream/route.ts +168 -0
- package/renderer/app/api/redirects/route.ts +47 -0
- package/renderer/app/api/schema/route.ts +65 -0
- package/renderer/app/api/subdomains/check/route.ts +172 -0
- package/renderer/app/api/suggestions/route.ts +144 -0
- package/renderer/app/favicon.ico +0 -0
- package/renderer/app/globals.css +1103 -0
- package/renderer/app/layout.tsx +47 -0
- package/renderer/app/llms-full.txt/route.ts +346 -0
- package/renderer/app/llms.txt/route.ts +279 -0
- package/renderer/app/page.tsx +14 -0
- package/renderer/app/robots.txt/route.ts +84 -0
- package/renderer/app/sitemap.xml/route.ts +199 -0
- package/renderer/components/docs/index.ts +12 -0
- package/renderer/components/docs/mdx/accordion.tsx +169 -0
- package/renderer/components/docs/mdx/badge.tsx +132 -0
- package/renderer/components/docs/mdx/callouts.tsx +154 -0
- package/renderer/components/docs/mdx/cards.tsx +213 -0
- package/renderer/components/docs/mdx/changelog.tsx +120 -0
- package/renderer/components/docs/mdx/code-block.tsx +186 -0
- package/renderer/components/docs/mdx/code-group.tsx +421 -0
- package/renderer/components/docs/mdx/file-embeds.tsx +105 -0
- package/renderer/components/docs/mdx/frame.tsx +112 -0
- package/renderer/components/docs/mdx/highlight.tsx +151 -0
- package/renderer/components/docs/mdx/iframe.tsx +134 -0
- package/renderer/components/docs/mdx/image.tsx +235 -0
- package/renderer/components/docs/mdx/index.ts +204 -0
- package/renderer/components/docs/mdx/mermaid.tsx +240 -0
- package/renderer/components/docs/mdx/param-field.tsx +200 -0
- package/renderer/components/docs/mdx/steps.tsx +113 -0
- package/renderer/components/docs/mdx/tabs.tsx +86 -0
- package/renderer/components/docs/mdx-renderer.tsx +100 -0
- package/renderer/components/docs/navigation/breadcrumbs.tsx +76 -0
- package/renderer/components/docs/navigation/index.ts +8 -0
- package/renderer/components/docs/navigation/page-nav.tsx +64 -0
- package/renderer/components/docs/navigation/sidebar.tsx +515 -0
- package/renderer/components/docs/navigation/toc.tsx +113 -0
- package/renderer/components/docs/notice.tsx +105 -0
- package/renderer/components/docs-header.tsx +274 -0
- package/renderer/components/docs-viewer/agent/agent-chat.tsx +2076 -0
- package/renderer/components/docs-viewer/agent/cards/debug-context-card.tsx +90 -0
- package/renderer/components/docs-viewer/agent/cards/endpoint-context-card.tsx +49 -0
- package/renderer/components/docs-viewer/agent/cards/index.tsx +50 -0
- package/renderer/components/docs-viewer/agent/cards/response-options-card.tsx +212 -0
- package/renderer/components/docs-viewer/agent/cards/types.ts +84 -0
- package/renderer/components/docs-viewer/agent/chat-message.tsx +17 -0
- package/renderer/components/docs-viewer/agent/index.tsx +6 -0
- package/renderer/components/docs-viewer/agent/messages/assistant-message.tsx +119 -0
- package/renderer/components/docs-viewer/agent/messages/chat-message.tsx +46 -0
- package/renderer/components/docs-viewer/agent/messages/index.ts +17 -0
- package/renderer/components/docs-viewer/agent/messages/tool-call-display.tsx +721 -0
- package/renderer/components/docs-viewer/agent/messages/types.ts +61 -0
- package/renderer/components/docs-viewer/agent/messages/typing-indicator.tsx +24 -0
- package/renderer/components/docs-viewer/agent/messages/user-message.tsx +51 -0
- package/renderer/components/docs-viewer/code-editor/index.tsx +2 -0
- package/renderer/components/docs-viewer/code-editor/notes-mode.tsx +1283 -0
- package/renderer/components/docs-viewer/content/changelog-page.tsx +331 -0
- package/renderer/components/docs-viewer/content/doc-page.tsx +285 -0
- package/renderer/components/docs-viewer/content/documentation-viewer.tsx +17 -0
- package/renderer/components/docs-viewer/content/index.tsx +29 -0
- package/renderer/components/docs-viewer/content/introduction.tsx +21 -0
- package/renderer/components/docs-viewer/content/request-details.tsx +330 -0
- package/renderer/components/docs-viewer/content/sections/auth.tsx +69 -0
- package/renderer/components/docs-viewer/content/sections/body.tsx +66 -0
- package/renderer/components/docs-viewer/content/sections/headers.tsx +43 -0
- package/renderer/components/docs-viewer/content/sections/overview.tsx +40 -0
- package/renderer/components/docs-viewer/content/sections/parameters.tsx +43 -0
- package/renderer/components/docs-viewer/content/sections/responses.tsx +87 -0
- package/renderer/components/docs-viewer/global-auth-modal.tsx +352 -0
- package/renderer/components/docs-viewer/index.tsx +1466 -0
- package/renderer/components/docs-viewer/playground/auth-editor.tsx +280 -0
- package/renderer/components/docs-viewer/playground/body-editor.tsx +221 -0
- package/renderer/components/docs-viewer/playground/code-editor.tsx +224 -0
- package/renderer/components/docs-viewer/playground/code-snippet.tsx +387 -0
- package/renderer/components/docs-viewer/playground/graphql-playground.tsx +745 -0
- package/renderer/components/docs-viewer/playground/index.tsx +671 -0
- package/renderer/components/docs-viewer/playground/key-value-editor.tsx +261 -0
- package/renderer/components/docs-viewer/playground/method-selector.tsx +60 -0
- package/renderer/components/docs-viewer/playground/request-builder.tsx +179 -0
- package/renderer/components/docs-viewer/playground/request-tabs.tsx +237 -0
- package/renderer/components/docs-viewer/playground/response-cards/idle-card.tsx +21 -0
- package/renderer/components/docs-viewer/playground/response-cards/index.tsx +93 -0
- package/renderer/components/docs-viewer/playground/response-cards/loading-card.tsx +16 -0
- package/renderer/components/docs-viewer/playground/response-cards/network-error-card.tsx +23 -0
- package/renderer/components/docs-viewer/playground/response-cards/response-body-card.tsx +268 -0
- package/renderer/components/docs-viewer/playground/response-cards/types.ts +82 -0
- package/renderer/components/docs-viewer/playground/response-viewer.tsx +43 -0
- package/renderer/components/docs-viewer/search/index.ts +2 -0
- package/renderer/components/docs-viewer/search/search-dialog.tsx +331 -0
- package/renderer/components/docs-viewer/search/use-search.ts +117 -0
- package/renderer/components/docs-viewer/shared/markdown-renderer.tsx +431 -0
- package/renderer/components/docs-viewer/shared/method-badge.tsx +41 -0
- package/renderer/components/docs-viewer/shared/schema-viewer.tsx +349 -0
- package/renderer/components/docs-viewer/sidebar/collection-tree.tsx +239 -0
- package/renderer/components/docs-viewer/sidebar/endpoint-options.tsx +316 -0
- package/renderer/components/docs-viewer/sidebar/index.tsx +343 -0
- package/renderer/components/docs-viewer/sidebar/right-sidebar.tsx +202 -0
- package/renderer/components/docs-viewer/sidebar/sidebar-group.tsx +118 -0
- package/renderer/components/docs-viewer/sidebar/sidebar-item.tsx +226 -0
- package/renderer/components/docs-viewer/sidebar/sidebar-section.tsx +52 -0
- package/renderer/components/theme-provider.tsx +11 -0
- package/renderer/components/theme-toggle.tsx +76 -0
- package/renderer/components/ui/badge.tsx +46 -0
- package/renderer/components/ui/button.tsx +59 -0
- package/renderer/components/ui/dialog.tsx +118 -0
- package/renderer/components/ui/dropdown-menu.tsx +257 -0
- package/renderer/components/ui/input.tsx +21 -0
- package/renderer/components/ui/label.tsx +24 -0
- package/renderer/components/ui/navigation-menu.tsx +168 -0
- package/renderer/components/ui/select.tsx +190 -0
- package/renderer/components/ui/spinner.tsx +114 -0
- package/renderer/components/ui/tabs.tsx +66 -0
- package/renderer/components/ui/tooltip.tsx +61 -0
- package/renderer/hooks/use-code-copy.ts +88 -0
- package/renderer/hooks/use-openapi-title.ts +44 -0
- package/renderer/lib/api-docs/agent/index.ts +6 -0
- package/renderer/lib/api-docs/agent/indexer.ts +323 -0
- package/renderer/lib/api-docs/agent/spec-summary.ts +335 -0
- package/renderer/lib/api-docs/agent/types.ts +116 -0
- package/renderer/lib/api-docs/auth/auth-context.tsx +225 -0
- package/renderer/lib/api-docs/auth/auth-storage.ts +87 -0
- package/renderer/lib/api-docs/auth/crypto.ts +89 -0
- package/renderer/lib/api-docs/auth/index.ts +4 -0
- package/renderer/lib/api-docs/code-editor/db.ts +164 -0
- package/renderer/lib/api-docs/code-editor/hooks.ts +266 -0
- package/renderer/lib/api-docs/code-editor/index.ts +6 -0
- package/renderer/lib/api-docs/code-editor/mode-context.tsx +207 -0
- package/renderer/lib/api-docs/code-editor/types.ts +105 -0
- package/renderer/lib/api-docs/codegen/definitions.ts +297 -0
- package/renderer/lib/api-docs/codegen/har.ts +251 -0
- package/renderer/lib/api-docs/codegen/index.ts +159 -0
- package/renderer/lib/api-docs/factories.ts +151 -0
- package/renderer/lib/api-docs/index.ts +17 -0
- package/renderer/lib/api-docs/mobile-context.tsx +112 -0
- package/renderer/lib/api-docs/navigation-context.tsx +88 -0
- package/renderer/lib/api-docs/parsers/graphql/README.md +129 -0
- package/renderer/lib/api-docs/parsers/graphql/index.ts +91 -0
- package/renderer/lib/api-docs/parsers/graphql/parser.ts +491 -0
- package/renderer/lib/api-docs/parsers/graphql/transformer.ts +246 -0
- package/renderer/lib/api-docs/parsers/graphql/types.ts +283 -0
- package/renderer/lib/api-docs/parsers/openapi/README.md +32 -0
- package/renderer/lib/api-docs/parsers/openapi/dereferencer.ts +60 -0
- package/renderer/lib/api-docs/parsers/openapi/extractors/auth.ts +574 -0
- package/renderer/lib/api-docs/parsers/openapi/extractors/body.ts +403 -0
- package/renderer/lib/api-docs/parsers/openapi/extractors/index.ts +232 -0
- package/renderer/lib/api-docs/parsers/openapi/index.ts +171 -0
- package/renderer/lib/api-docs/parsers/openapi/transformer.ts +277 -0
- package/renderer/lib/api-docs/parsers/openapi/validator.ts +31 -0
- package/renderer/lib/api-docs/playground/context.tsx +107 -0
- package/renderer/lib/api-docs/playground/navigation-context.tsx +124 -0
- package/renderer/lib/api-docs/playground/request-builder.ts +223 -0
- package/renderer/lib/api-docs/playground/request-runner.ts +282 -0
- package/renderer/lib/api-docs/playground/types.ts +35 -0
- package/renderer/lib/api-docs/types.ts +269 -0
- package/renderer/lib/api-docs/utils.ts +311 -0
- package/renderer/lib/cache.ts +193 -0
- package/renderer/lib/docs/config/index.ts +29 -0
- package/renderer/lib/docs/config/loader.ts +142 -0
- package/renderer/lib/docs/config/schema.ts +298 -0
- package/renderer/lib/docs/index.ts +12 -0
- package/renderer/lib/docs/mdx/compiler.ts +176 -0
- package/renderer/lib/docs/mdx/frontmatter.ts +80 -0
- package/renderer/lib/docs/mdx/index.ts +26 -0
- package/renderer/lib/docs/navigation/generator.ts +348 -0
- package/renderer/lib/docs/navigation/index.ts +12 -0
- package/renderer/lib/docs/navigation/types.ts +123 -0
- package/renderer/lib/docs-navigation-context.tsx +80 -0
- package/renderer/lib/multi-tenant/context.ts +105 -0
- package/renderer/lib/storage/blob.ts +845 -0
- package/renderer/lib/utils.ts +6 -0
- package/renderer/next.config.ts +76 -0
- package/renderer/package.json +66 -0
- package/renderer/postcss.config.mjs +5 -0
- package/renderer/public/assets/images/screenshot.png +0 -0
- package/renderer/public/assets/logo/dark.svg +9 -0
- package/renderer/public/assets/logo/light.svg +9 -0
- package/renderer/public/assets/logo.svg +9 -0
- package/renderer/public/file.svg +1 -0
- package/renderer/public/globe.svg +1 -0
- package/renderer/public/icon.png +0 -0
- package/renderer/public/logo.svg +9 -0
- package/renderer/public/window.svg +1 -0
- package/renderer/tsconfig.json +28 -0
- package/templates/basic/README.md +139 -0
- package/templates/basic/assets/favicon.svg +4 -0
- package/templates/basic/assets/logo.svg +9 -0
- package/templates/basic/docs.json +47 -0
- package/templates/basic/guides/configuration.mdx +149 -0
- package/templates/basic/guides/overview.mdx +96 -0
- package/templates/basic/index.mdx +39 -0
- package/templates/basic/package.json +14 -0
- package/templates/basic/quickstart.mdx +92 -0
- package/templates/basic/vercel.json +6 -0
- package/templates/graphql/README.md +139 -0
- package/templates/graphql/api-reference/schema.graphql +305 -0
- package/templates/graphql/assets/favicon.svg +4 -0
- package/templates/graphql/assets/logo.svg +9 -0
- package/templates/graphql/docs.json +54 -0
- package/templates/graphql/guides/configuration.mdx +149 -0
- package/templates/graphql/guides/overview.mdx +96 -0
- package/templates/graphql/index.mdx +39 -0
- package/templates/graphql/package.json +14 -0
- package/templates/graphql/quickstart.mdx +92 -0
- package/templates/graphql/vercel.json +6 -0
- package/templates/openapi/README.md +139 -0
- package/templates/openapi/api-reference/openapi.json +419 -0
- package/templates/openapi/assets/favicon.svg +4 -0
- package/templates/openapi/assets/logo.svg +9 -0
- package/templates/openapi/docs.json +61 -0
- package/templates/openapi/guides/configuration.mdx +149 -0
- package/templates/openapi/guides/overview.mdx +96 -0
- package/templates/openapi/index.mdx +39 -0
- package/templates/openapi/package.json +14 -0
- package/templates/openapi/quickstart.mdx +92 -0
- package/templates/openapi/vercel.json +6 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
import { Geist, Geist_Mono } from "next/font/google";
|
|
3
|
+
import { ThemeProvider } from "@/components/theme-provider";
|
|
4
|
+
import "./globals.css";
|
|
5
|
+
|
|
6
|
+
const geistSans = Geist({
|
|
7
|
+
variable: "--font-geist-sans",
|
|
8
|
+
subsets: ["latin"],
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const geistMono = Geist_Mono({
|
|
12
|
+
variable: "--font-geist-mono",
|
|
13
|
+
subsets: ["latin"],
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const metadata: Metadata = {
|
|
17
|
+
title: "Documentation",
|
|
18
|
+
description: "API Documentation and Reference",
|
|
19
|
+
icons: {
|
|
20
|
+
icon: '/icon.png',
|
|
21
|
+
shortcut: '/icon.png',
|
|
22
|
+
apple: '/icon.png',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default function RootLayout({
|
|
27
|
+
children,
|
|
28
|
+
}: Readonly<{
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
}>) {
|
|
31
|
+
return (
|
|
32
|
+
<html lang="en" suppressHydrationWarning>
|
|
33
|
+
<body
|
|
34
|
+
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
|
35
|
+
>
|
|
36
|
+
<ThemeProvider
|
|
37
|
+
attribute="class"
|
|
38
|
+
defaultTheme="system"
|
|
39
|
+
enableSystem
|
|
40
|
+
disableTransitionOnChange
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</ThemeProvider>
|
|
44
|
+
</body>
|
|
45
|
+
</html>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { NextResponse } from 'next/server'
|
|
2
|
+
import { join } from 'path'
|
|
3
|
+
import { readFileSync, existsSync, readdirSync } from 'fs'
|
|
4
|
+
import matter from 'gray-matter'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* llms-full.txt - Full documentation content for LLMs
|
|
8
|
+
*
|
|
9
|
+
* Generated from docs.json configuration.
|
|
10
|
+
* Combines all documentation into a single file for LLM consumption.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const DOCS_DIR = join(process.cwd(), 'templates', 'starter')
|
|
14
|
+
const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3000'
|
|
15
|
+
|
|
16
|
+
interface NavigationTab {
|
|
17
|
+
tab: string
|
|
18
|
+
type: 'docs' | 'openapi' | 'changelog'
|
|
19
|
+
path?: string
|
|
20
|
+
groups?: Array<{
|
|
21
|
+
group: string
|
|
22
|
+
pages: string[]
|
|
23
|
+
}>
|
|
24
|
+
versions?: Array<{
|
|
25
|
+
version: string
|
|
26
|
+
spec: string
|
|
27
|
+
default?: boolean
|
|
28
|
+
}>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface DocsConfig {
|
|
32
|
+
name?: string
|
|
33
|
+
navigation?: {
|
|
34
|
+
tabs?: NavigationTab[]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface OpenAPISpec {
|
|
39
|
+
info?: {
|
|
40
|
+
title?: string
|
|
41
|
+
description?: string
|
|
42
|
+
version?: string
|
|
43
|
+
}
|
|
44
|
+
paths?: Record<string, Record<string, {
|
|
45
|
+
summary?: string
|
|
46
|
+
description?: string
|
|
47
|
+
operationId?: string
|
|
48
|
+
parameters?: Array<{
|
|
49
|
+
name: string
|
|
50
|
+
in: string
|
|
51
|
+
description?: string
|
|
52
|
+
required?: boolean
|
|
53
|
+
schema?: { type?: string }
|
|
54
|
+
}>
|
|
55
|
+
requestBody?: {
|
|
56
|
+
description?: string
|
|
57
|
+
content?: Record<string, { schema?: object }>
|
|
58
|
+
}
|
|
59
|
+
responses?: Record<string, {
|
|
60
|
+
description?: string
|
|
61
|
+
}>
|
|
62
|
+
}>>
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function loadDocsConfig(): DocsConfig | null {
|
|
66
|
+
const configPath = join(DOCS_DIR, 'docs.json')
|
|
67
|
+
if (!existsSync(configPath)) return null
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
const content = readFileSync(configPath, 'utf-8')
|
|
71
|
+
return JSON.parse(content)
|
|
72
|
+
} catch {
|
|
73
|
+
return null
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function loadOpenAPISpec(specPath: string): OpenAPISpec | null {
|
|
78
|
+
const fullPath = join(DOCS_DIR, specPath)
|
|
79
|
+
if (!existsSync(fullPath)) return null
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
const content = readFileSync(fullPath, 'utf-8')
|
|
83
|
+
return JSON.parse(content)
|
|
84
|
+
} catch {
|
|
85
|
+
return null
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function getPageContent(slug: string): { title?: string; description?: string; content: string } | null {
|
|
90
|
+
const extensions = ['.mdx', '.md']
|
|
91
|
+
|
|
92
|
+
for (const ext of extensions) {
|
|
93
|
+
const filePath = join(DOCS_DIR, `${slug}${ext}`)
|
|
94
|
+
if (existsSync(filePath)) {
|
|
95
|
+
try {
|
|
96
|
+
const fileContent = readFileSync(filePath, 'utf-8')
|
|
97
|
+
const { data, content } = matter(fileContent)
|
|
98
|
+
|
|
99
|
+
// Clean MDX content - remove JSX components
|
|
100
|
+
const cleanedContent = content
|
|
101
|
+
.replace(/<[A-Z][a-zA-Z]*[^>]*\/>/g, '') // Self-closing JSX
|
|
102
|
+
.replace(/<[A-Z][a-zA-Z]*[^>]*>[\s\S]*?<\/[A-Z][a-zA-Z]*>/g, '') // JSX with children
|
|
103
|
+
.replace(/<!--[\s\S]*?-->/g, '') // HTML comments
|
|
104
|
+
.replace(/\n{3,}/g, '\n\n') // Extra blank lines
|
|
105
|
+
.trim()
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
title: data.title as string | undefined,
|
|
109
|
+
description: data.description as string | undefined,
|
|
110
|
+
content: cleanedContent,
|
|
111
|
+
}
|
|
112
|
+
} catch {
|
|
113
|
+
return null
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return null
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function getChangelogFiles(): string[] {
|
|
121
|
+
const changelogDir = join(DOCS_DIR, 'changelog')
|
|
122
|
+
if (!existsSync(changelogDir)) return []
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
return readdirSync(changelogDir)
|
|
126
|
+
.filter(f => (f.endsWith('.mdx') || f.endsWith('.md')) && f !== 'latest.mdx')
|
|
127
|
+
.map(f => f.replace(/\.(mdx?|md)$/, ''))
|
|
128
|
+
.sort()
|
|
129
|
+
.reverse()
|
|
130
|
+
} catch {
|
|
131
|
+
return []
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function generateDocsContent(tab: NavigationTab, lines: string[]) {
|
|
136
|
+
lines.push(`# ${tab.tab}`)
|
|
137
|
+
lines.push('')
|
|
138
|
+
|
|
139
|
+
if (tab.groups) {
|
|
140
|
+
for (const group of tab.groups) {
|
|
141
|
+
lines.push(`## ${group.group}`)
|
|
142
|
+
lines.push('')
|
|
143
|
+
|
|
144
|
+
for (const page of group.pages) {
|
|
145
|
+
const pageData = getPageContent(page)
|
|
146
|
+
if (pageData) {
|
|
147
|
+
lines.push(`### ${pageData.title || page}`)
|
|
148
|
+
lines.push('')
|
|
149
|
+
|
|
150
|
+
if (pageData.description) {
|
|
151
|
+
lines.push(`> ${pageData.description}`)
|
|
152
|
+
lines.push('')
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const urlPath = page === 'index' ? '' : page
|
|
156
|
+
lines.push(`URL: ${BASE_URL}/#${tab.tab.toLowerCase()}/page/${urlPath}`)
|
|
157
|
+
lines.push('')
|
|
158
|
+
|
|
159
|
+
if (pageData.content) {
|
|
160
|
+
lines.push(pageData.content)
|
|
161
|
+
lines.push('')
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
lines.push('---')
|
|
165
|
+
lines.push('')
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function generateOpenAPIContent(tab: NavigationTab, lines: string[]) {
|
|
173
|
+
lines.push(`# ${tab.tab}`)
|
|
174
|
+
lines.push('')
|
|
175
|
+
|
|
176
|
+
if (tab.versions && tab.versions.length > 0) {
|
|
177
|
+
for (const version of tab.versions) {
|
|
178
|
+
const spec = loadOpenAPISpec(version.spec)
|
|
179
|
+
if (!spec) continue
|
|
180
|
+
|
|
181
|
+
const versionLabel = version.default ? `${version.version} (current)` : version.version
|
|
182
|
+
lines.push(`## ${versionLabel}`)
|
|
183
|
+
lines.push('')
|
|
184
|
+
|
|
185
|
+
if (spec.info?.title) {
|
|
186
|
+
lines.push(`**${spec.info.title}**`)
|
|
187
|
+
lines.push('')
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (spec.info?.description) {
|
|
191
|
+
lines.push(spec.info.description)
|
|
192
|
+
lines.push('')
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// List all endpoints with details
|
|
196
|
+
if (spec.paths) {
|
|
197
|
+
lines.push('### Endpoints')
|
|
198
|
+
lines.push('')
|
|
199
|
+
|
|
200
|
+
for (const [path, methods] of Object.entries(spec.paths)) {
|
|
201
|
+
for (const [method, details] of Object.entries(methods)) {
|
|
202
|
+
if (!['get', 'post', 'put', 'patch', 'delete'].includes(method.toLowerCase())) continue
|
|
203
|
+
|
|
204
|
+
lines.push(`#### ${method.toUpperCase()} ${path}`)
|
|
205
|
+
lines.push('')
|
|
206
|
+
|
|
207
|
+
if (details.summary) {
|
|
208
|
+
lines.push(`**${details.summary}**`)
|
|
209
|
+
lines.push('')
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (details.description) {
|
|
213
|
+
lines.push(details.description)
|
|
214
|
+
lines.push('')
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Parameters
|
|
218
|
+
if (details.parameters && details.parameters.length > 0) {
|
|
219
|
+
lines.push('**Parameters:**')
|
|
220
|
+
for (const param of details.parameters) {
|
|
221
|
+
const required = param.required ? ' (required)' : ''
|
|
222
|
+
const desc = param.description ? `: ${param.description}` : ''
|
|
223
|
+
lines.push(`- \`${param.name}\` (${param.in})${required}${desc}`)
|
|
224
|
+
}
|
|
225
|
+
lines.push('')
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Request body
|
|
229
|
+
if (details.requestBody?.description) {
|
|
230
|
+
lines.push(`**Request Body:** ${details.requestBody.description}`)
|
|
231
|
+
lines.push('')
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Responses
|
|
235
|
+
if (details.responses) {
|
|
236
|
+
lines.push('**Responses:**')
|
|
237
|
+
for (const [code, response] of Object.entries(details.responses)) {
|
|
238
|
+
lines.push(`- ${code}: ${response.description || 'No description'}`)
|
|
239
|
+
}
|
|
240
|
+
lines.push('')
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
lines.push('---')
|
|
244
|
+
lines.push('')
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function generateChangelogContent(tab: NavigationTab, lines: string[]) {
|
|
253
|
+
lines.push(`# ${tab.tab}`)
|
|
254
|
+
lines.push('')
|
|
255
|
+
|
|
256
|
+
const versions = getChangelogFiles()
|
|
257
|
+
|
|
258
|
+
for (const version of versions) {
|
|
259
|
+
const pageData = getPageContent(`changelog/${version}`)
|
|
260
|
+
if (pageData) {
|
|
261
|
+
lines.push(`## ${pageData.title || `Version ${version}`}`)
|
|
262
|
+
lines.push('')
|
|
263
|
+
|
|
264
|
+
if (pageData.description) {
|
|
265
|
+
lines.push(`> ${pageData.description}`)
|
|
266
|
+
lines.push('')
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (pageData.content) {
|
|
270
|
+
lines.push(pageData.content)
|
|
271
|
+
lines.push('')
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
lines.push('---')
|
|
275
|
+
lines.push('')
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function generateLlmsFullTxt(config: DocsConfig): string {
|
|
281
|
+
const lines: string[] = []
|
|
282
|
+
|
|
283
|
+
// Header
|
|
284
|
+
const siteName = config.name || 'Documentation'
|
|
285
|
+
lines.push(`# ${siteName} - Full Documentation`)
|
|
286
|
+
lines.push('')
|
|
287
|
+
lines.push('> Complete documentation content for LLM consumption.')
|
|
288
|
+
lines.push('')
|
|
289
|
+
lines.push('---')
|
|
290
|
+
lines.push('')
|
|
291
|
+
|
|
292
|
+
// Process each tab from config
|
|
293
|
+
if (config.navigation?.tabs) {
|
|
294
|
+
for (const tab of config.navigation.tabs) {
|
|
295
|
+
switch (tab.type) {
|
|
296
|
+
case 'docs':
|
|
297
|
+
generateDocsContent(tab, lines)
|
|
298
|
+
break
|
|
299
|
+
case 'openapi':
|
|
300
|
+
generateOpenAPIContent(tab, lines)
|
|
301
|
+
break
|
|
302
|
+
case 'changelog':
|
|
303
|
+
generateChangelogContent(tab, lines)
|
|
304
|
+
break
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return lines.join('\n')
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export async function GET() {
|
|
313
|
+
try {
|
|
314
|
+
// Check for custom llms-full.txt first
|
|
315
|
+
const customPath = join(DOCS_DIR, 'llms-full.txt')
|
|
316
|
+
if (existsSync(customPath)) {
|
|
317
|
+
const customContent = readFileSync(customPath, 'utf-8')
|
|
318
|
+
return new NextResponse(customContent, {
|
|
319
|
+
headers: {
|
|
320
|
+
'Content-Type': 'text/plain; charset=utf-8',
|
|
321
|
+
'Cache-Control': 'public, max-age=3600',
|
|
322
|
+
},
|
|
323
|
+
})
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Generate from docs.json config
|
|
327
|
+
const config = loadDocsConfig()
|
|
328
|
+
if (!config) {
|
|
329
|
+
return new NextResponse('# Documentation\n\nNo docs.json configuration found.', {
|
|
330
|
+
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
|
|
331
|
+
})
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const content = generateLlmsFullTxt(config)
|
|
335
|
+
|
|
336
|
+
return new NextResponse(content, {
|
|
337
|
+
headers: {
|
|
338
|
+
'Content-Type': 'text/plain; charset=utf-8',
|
|
339
|
+
'Cache-Control': 'public, max-age=3600',
|
|
340
|
+
},
|
|
341
|
+
})
|
|
342
|
+
} catch (error) {
|
|
343
|
+
console.error('Error generating llms-full.txt:', error)
|
|
344
|
+
return new NextResponse('Error generating llms-full.txt', { status: 500 })
|
|
345
|
+
}
|
|
346
|
+
}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { NextResponse } from 'next/server'
|
|
2
|
+
import { join } from 'path'
|
|
3
|
+
import { readFileSync, existsSync, readdirSync } from 'fs'
|
|
4
|
+
import matter from 'gray-matter'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* llms.txt - Documentation index for LLMs
|
|
8
|
+
*
|
|
9
|
+
* Generated from docs.json configuration.
|
|
10
|
+
* Helps LLMs understand and index your documentation structure.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const DOCS_DIR = join(process.cwd(), 'templates', 'starter')
|
|
14
|
+
const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3000'
|
|
15
|
+
|
|
16
|
+
interface NavigationTab {
|
|
17
|
+
tab: string
|
|
18
|
+
type: 'docs' | 'openapi' | 'changelog'
|
|
19
|
+
path?: string
|
|
20
|
+
groups?: Array<{
|
|
21
|
+
group: string
|
|
22
|
+
pages: string[]
|
|
23
|
+
}>
|
|
24
|
+
versions?: Array<{
|
|
25
|
+
version: string
|
|
26
|
+
spec: string
|
|
27
|
+
default?: boolean
|
|
28
|
+
}>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface DocsConfig {
|
|
32
|
+
name?: string
|
|
33
|
+
navigation?: {
|
|
34
|
+
tabs?: NavigationTab[]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface OpenAPISpec {
|
|
39
|
+
info?: {
|
|
40
|
+
title?: string
|
|
41
|
+
description?: string
|
|
42
|
+
version?: string
|
|
43
|
+
}
|
|
44
|
+
paths?: Record<string, Record<string, {
|
|
45
|
+
summary?: string
|
|
46
|
+
description?: string
|
|
47
|
+
operationId?: string
|
|
48
|
+
tags?: string[]
|
|
49
|
+
}>>
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function loadDocsConfig(): DocsConfig | null {
|
|
53
|
+
const configPath = join(DOCS_DIR, 'docs.json')
|
|
54
|
+
if (!existsSync(configPath)) return null
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
const content = readFileSync(configPath, 'utf-8')
|
|
58
|
+
return JSON.parse(content)
|
|
59
|
+
} catch {
|
|
60
|
+
return null
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function loadOpenAPISpec(specPath: string): OpenAPISpec | null {
|
|
65
|
+
const fullPath = join(DOCS_DIR, specPath)
|
|
66
|
+
if (!existsSync(fullPath)) return null
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
const content = readFileSync(fullPath, 'utf-8')
|
|
70
|
+
return JSON.parse(content)
|
|
71
|
+
} catch {
|
|
72
|
+
return null
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function getPageFrontmatter(slug: string): { title?: string; description?: string } {
|
|
77
|
+
const extensions = ['.mdx', '.md']
|
|
78
|
+
|
|
79
|
+
for (const ext of extensions) {
|
|
80
|
+
const filePath = join(DOCS_DIR, `${slug}${ext}`)
|
|
81
|
+
if (existsSync(filePath)) {
|
|
82
|
+
try {
|
|
83
|
+
const content = readFileSync(filePath, 'utf-8')
|
|
84
|
+
const { data } = matter(content)
|
|
85
|
+
return {
|
|
86
|
+
title: data.title as string | undefined,
|
|
87
|
+
description: data.description as string | undefined,
|
|
88
|
+
}
|
|
89
|
+
} catch {
|
|
90
|
+
return {}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return {}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function getChangelogFiles(): Array<{ version: string; title?: string; description?: string }> {
|
|
98
|
+
const changelogDir = join(DOCS_DIR, 'changelog')
|
|
99
|
+
if (!existsSync(changelogDir)) return []
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
return readdirSync(changelogDir)
|
|
103
|
+
.filter(f => (f.endsWith('.mdx') || f.endsWith('.md')) && f !== 'latest.mdx')
|
|
104
|
+
.map(f => {
|
|
105
|
+
const version = f.replace(/\.(mdx?|md)$/, '')
|
|
106
|
+
const frontmatter = getPageFrontmatter(`changelog/${version}`)
|
|
107
|
+
return {
|
|
108
|
+
version,
|
|
109
|
+
title: frontmatter.title,
|
|
110
|
+
description: frontmatter.description,
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
.sort((a, b) => b.version.localeCompare(a.version))
|
|
114
|
+
} catch {
|
|
115
|
+
return []
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function generateDocsSection(tab: NavigationTab, lines: string[]) {
|
|
120
|
+
lines.push(`## ${tab.tab}`)
|
|
121
|
+
lines.push('')
|
|
122
|
+
|
|
123
|
+
if (tab.groups) {
|
|
124
|
+
for (const group of tab.groups) {
|
|
125
|
+
lines.push(`### ${group.group}`)
|
|
126
|
+
lines.push('')
|
|
127
|
+
|
|
128
|
+
for (const page of group.pages) {
|
|
129
|
+
const frontmatter = getPageFrontmatter(page)
|
|
130
|
+
const title = frontmatter.title || page.split('/').pop() || page
|
|
131
|
+
const urlPath = page === 'index' ? '' : page
|
|
132
|
+
const url = `${BASE_URL}/#${tab.tab.toLowerCase()}/page/${urlPath}`.replace(/\/+$/, '')
|
|
133
|
+
|
|
134
|
+
if (frontmatter.description) {
|
|
135
|
+
lines.push(`- [${title}](${url}): ${frontmatter.description}`)
|
|
136
|
+
} else {
|
|
137
|
+
lines.push(`- [${title}](${url})`)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
lines.push('')
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function generateOpenAPISection(tab: NavigationTab, lines: string[]) {
|
|
146
|
+
lines.push(`## ${tab.tab}`)
|
|
147
|
+
lines.push('')
|
|
148
|
+
|
|
149
|
+
if (tab.versions && tab.versions.length > 0) {
|
|
150
|
+
for (const version of tab.versions) {
|
|
151
|
+
const spec = loadOpenAPISpec(version.spec)
|
|
152
|
+
if (!spec) continue
|
|
153
|
+
|
|
154
|
+
const versionLabel = version.default ? `${version.version} (current)` : version.version
|
|
155
|
+
lines.push(`### ${versionLabel}`)
|
|
156
|
+
lines.push('')
|
|
157
|
+
|
|
158
|
+
if (spec.info?.description) {
|
|
159
|
+
lines.push(`> ${spec.info.description}`)
|
|
160
|
+
lines.push('')
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Group endpoints by tag or list all
|
|
164
|
+
if (spec.paths) {
|
|
165
|
+
const endpoints: Array<{ method: string; path: string; summary?: string }> = []
|
|
166
|
+
|
|
167
|
+
for (const [path, methods] of Object.entries(spec.paths)) {
|
|
168
|
+
for (const [method, details] of Object.entries(methods)) {
|
|
169
|
+
if (['get', 'post', 'put', 'patch', 'delete'].includes(method.toLowerCase())) {
|
|
170
|
+
endpoints.push({
|
|
171
|
+
method: method.toUpperCase(),
|
|
172
|
+
path,
|
|
173
|
+
summary: details.summary || details.description,
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
for (const endpoint of endpoints) {
|
|
180
|
+
if (endpoint.summary) {
|
|
181
|
+
lines.push(`- **${endpoint.method}** \`${endpoint.path}\`: ${endpoint.summary}`)
|
|
182
|
+
} else {
|
|
183
|
+
lines.push(`- **${endpoint.method}** \`${endpoint.path}\``)
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
lines.push('')
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function generateChangelogSection(tab: NavigationTab, lines: string[]) {
|
|
193
|
+
lines.push(`## ${tab.tab}`)
|
|
194
|
+
lines.push('')
|
|
195
|
+
|
|
196
|
+
const releases = getChangelogFiles()
|
|
197
|
+
|
|
198
|
+
if (releases.length > 0) {
|
|
199
|
+
for (const release of releases) {
|
|
200
|
+
const title = release.title || `Version ${release.version}`
|
|
201
|
+
const url = `${BASE_URL}/#changelog/page/changelog/${release.version}`
|
|
202
|
+
|
|
203
|
+
if (release.description) {
|
|
204
|
+
lines.push(`- [${title}](${url}): ${release.description}`)
|
|
205
|
+
} else {
|
|
206
|
+
lines.push(`- [${title}](${url})`)
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
} else {
|
|
210
|
+
lines.push('- No releases found')
|
|
211
|
+
}
|
|
212
|
+
lines.push('')
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function generateLlmsTxt(config: DocsConfig): string {
|
|
216
|
+
const lines: string[] = []
|
|
217
|
+
|
|
218
|
+
// Header
|
|
219
|
+
const siteName = config.name || 'Documentation'
|
|
220
|
+
lines.push(`# ${siteName}`)
|
|
221
|
+
lines.push('')
|
|
222
|
+
lines.push('> Documentation index for LLMs. For full content, see /llms-full.txt')
|
|
223
|
+
lines.push('')
|
|
224
|
+
|
|
225
|
+
// Process each tab from config
|
|
226
|
+
if (config.navigation?.tabs) {
|
|
227
|
+
for (const tab of config.navigation.tabs) {
|
|
228
|
+
switch (tab.type) {
|
|
229
|
+
case 'docs':
|
|
230
|
+
generateDocsSection(tab, lines)
|
|
231
|
+
break
|
|
232
|
+
case 'openapi':
|
|
233
|
+
generateOpenAPISection(tab, lines)
|
|
234
|
+
break
|
|
235
|
+
case 'changelog':
|
|
236
|
+
generateChangelogSection(tab, lines)
|
|
237
|
+
break
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return lines.join('\n')
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export async function GET() {
|
|
246
|
+
try {
|
|
247
|
+
// Check for custom llms.txt first
|
|
248
|
+
const customPath = join(DOCS_DIR, 'llms.txt')
|
|
249
|
+
if (existsSync(customPath)) {
|
|
250
|
+
const customContent = readFileSync(customPath, 'utf-8')
|
|
251
|
+
return new NextResponse(customContent, {
|
|
252
|
+
headers: {
|
|
253
|
+
'Content-Type': 'text/plain; charset=utf-8',
|
|
254
|
+
'Cache-Control': 'public, max-age=3600',
|
|
255
|
+
},
|
|
256
|
+
})
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Generate from docs.json config
|
|
260
|
+
const config = loadDocsConfig()
|
|
261
|
+
if (!config) {
|
|
262
|
+
return new NextResponse('# Documentation\n\nNo docs.json configuration found.', {
|
|
263
|
+
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
|
|
264
|
+
})
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const content = generateLlmsTxt(config)
|
|
268
|
+
|
|
269
|
+
return new NextResponse(content, {
|
|
270
|
+
headers: {
|
|
271
|
+
'Content-Type': 'text/plain; charset=utf-8',
|
|
272
|
+
'Cache-Control': 'public, max-age=3600',
|
|
273
|
+
},
|
|
274
|
+
})
|
|
275
|
+
} catch (error) {
|
|
276
|
+
console.error('Error generating llms.txt:', error)
|
|
277
|
+
return new NextResponse('Error generating llms.txt', { status: 500 })
|
|
278
|
+
}
|
|
279
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { Docs } from "@/components/docs-viewer"
|
|
4
|
+
import { MobileProvider } from "@/lib/api-docs/mobile-context"
|
|
5
|
+
|
|
6
|
+
export default function Home() {
|
|
7
|
+
return (
|
|
8
|
+
<MobileProvider>
|
|
9
|
+
<div className="min-h-screen bg-background">
|
|
10
|
+
<Docs />
|
|
11
|
+
</div>
|
|
12
|
+
</MobileProvider>
|
|
13
|
+
)
|
|
14
|
+
}
|