@clarify-labs/cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/LICENSE +661 -0
  2. package/bin/clarify.js +2 -0
  3. package/output/cli/commands/build.d.ts +2 -0
  4. package/output/cli/commands/dev.d.ts +2 -0
  5. package/output/cli/commands/init.d.ts +2 -0
  6. package/output/cli/index.d.ts +2 -0
  7. package/output/cli/options.d.ts +17 -0
  8. package/output/cli/package.d.ts +1 -0
  9. package/output/cli.cjs +187 -0
  10. package/output/cli.cjs.map +1 -0
  11. package/output/cli.js +187 -0
  12. package/output/cli.js.map +1 -0
  13. package/output/core/config-schema.d.ts +140 -0
  14. package/output/core/config.d.ts +3 -0
  15. package/output/core/hooks.d.ts +5 -0
  16. package/output/core/options.d.ts +24 -0
  17. package/output/core/plugin.d.ts +4 -0
  18. package/output/core/runtime-deps.d.ts +7 -0
  19. package/output/core/ssg.d.ts +8 -0
  20. package/output/core/user-config.d.ts +7 -0
  21. package/output/core/utils.d.ts +1 -0
  22. package/output/core/virtual-modules.d.ts +18 -0
  23. package/output/core/vite-config.d.ts +10 -0
  24. package/output/index.cjs +4 -0
  25. package/output/index.d.ts +5 -0
  26. package/output/index.js +2 -0
  27. package/output/parsers/frontmatter.d.ts +5 -0
  28. package/output/parsers/mdx.d.ts +14 -0
  29. package/output/parsers/routes.d.ts +13 -0
  30. package/output/plugin-BUWojlPv.js +1277 -0
  31. package/output/plugin-BUWojlPv.js.map +1 -0
  32. package/output/plugin-CEyCiD5r.cjs +1330 -0
  33. package/output/plugin-CEyCiD5r.cjs.map +1 -0
  34. package/output/plugins/content-artifacts/index.d.ts +2 -0
  35. package/output/plugins/content-artifacts/raw-content.d.ts +8 -0
  36. package/output/plugins/content-artifacts/server.d.ts +5 -0
  37. package/output/plugins/html-shell/index.d.ts +2 -0
  38. package/output/plugins/openapi/index.d.ts +2 -0
  39. package/output/plugins/openapi/parser.d.ts +5 -0
  40. package/output/plugins/openapi/virtual-modules.d.ts +4 -0
  41. package/output/types.d.ts +191 -0
  42. package/package.json +63 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-CEyCiD5r.cjs","names":[],"sources":["../source/core/utils.ts","../source/parsers/mdx.ts","../source/parsers/frontmatter.ts","../source/parsers/routes.ts","../source/plugins/content-artifacts/raw-content.ts","../source/plugins/content-artifacts/server.ts","../source/plugins/content-artifacts/index.ts","../source/plugins/html-shell/index.ts","../source/plugins/openapi/parser.ts","../source/plugins/openapi/virtual-modules.ts","../source/plugins/openapi/index.ts","../source/core/config-schema.ts","../source/core/config.ts","../source/core/hooks.ts","../source/core/options.ts","../source/core/runtime-deps.ts","../source/core/ssg.ts","../source/core/user-config.ts","../source/core/virtual-modules.ts","../source/core/plugin.ts"],"sourcesContent":["export function escapeHtml(text: string): string {\n return text\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;')\n}\n","import GithubSlugger from 'github-slugger'\nimport { toString } from 'mdast-util-to-string'\nimport remarkGfm from 'remark-gfm'\nimport shiki, { type Highlighter } from 'shiki'\nimport { visit } from 'unist-util-visit'\n\nimport { escapeHtml } from '../core/utils.js'\n\ntype HastNode = {\n type: string\n tagName?: string\n value?: string\n properties?: Record<string, unknown>\n children?: HastNode[]\n}\n\ntype HastParent = HastNode & {\n children: HastNode[]\n}\n\nfunction getLanguage(className: unknown): string {\n const classes = Array.isArray(className) ? className : typeof className === 'string' ? className.split(/\\s+/) : []\n const languageClass = classes.find((item): item is string => typeof item === 'string' && item.startsWith('language-'))\n return languageClass?.replace(/^language-/, '') || 'txt'\n}\n\nfunction getTextContent(node: HastNode | undefined): string {\n if (!node) return ''\n if (typeof node.value === 'string') return node.value\n return node.children?.map(getTextContent).join('') ?? ''\n}\n\nfunction renderPlainCode(code: string): string {\n return code\n .split('\\n')\n .map(line => `<span>${escapeHtml(line)}</span>`)\n .join('\\n')\n}\n\nlet highlighter: Highlighter | undefined\n\nasync function getHighlighter(): Promise<Highlighter> {\n highlighter = highlighter ?? await shiki.getHighlighter({ theme: 'css-variables' })\n return highlighter\n}\n\nexport function rehypeParseCodeBlocks() {\n return (tree: HastNode) => {\n visit(tree, 'element', (node: HastNode, _nodeIndex: number | undefined, parentNode: HastParent | undefined) => {\n if (node.tagName !== 'code' || !parentNode) return\n parentNode.properties = parentNode.properties ?? {}\n node.properties = node.properties ?? {}\n const language = getLanguage(node.properties.className)\n parentNode.properties.language = language\n node.properties.language = language\n })\n }\n}\n\nexport function rehypeShiki() {\n return async (tree: HastNode) => {\n const shikiHighlighter = await getHighlighter()\n\n visit(tree, 'element', (node: HastNode) => {\n if (node.tagName !== 'pre') return\n const codeNode = node.children?.[0]\n if (codeNode?.tagName !== 'code') return\n\n node.properties = node.properties ?? {}\n codeNode.properties = codeNode.properties ?? {}\n\n const code = getTextContent(codeNode)\n const language = typeof node.properties.language === 'string' ? node.properties.language : getLanguage(codeNode.properties.className)\n node.properties.code = code\n codeNode.properties.code = code\n codeNode.properties.language = language\n\n let highlighted = renderPlainCode(code)\n\n if (language && language !== 'txt') {\n try {\n const tokens = shikiHighlighter.codeToThemedTokens(code, language)\n highlighted = shiki.renderToHtml(tokens, {\n elements: {\n pre: ({ children }: { children: string }) => children,\n code: ({ children }: { children: string }) => children,\n line: ({ children }: { children: string }) => `<span>${children}</span>`,\n },\n })\n } catch {\n highlighted = renderPlainCode(code)\n }\n }\n\n codeNode.children = [{ type: 'text', value: highlighted }]\n })\n }\n}\n\nexport function rehypeSlugSections() {\n return (tree: HastNode) => {\n const slugger = new GithubSlugger()\n\n visit(tree, 'element', (node: HastNode) => {\n if (node.tagName !== 'h2' && node.tagName !== 'h3') return\n\n node.properties = node.properties ?? {}\n if (node.properties.id) return\n\n node.properties.id = slugger.slug(toString(node))\n })\n }\n}\n\nexport const remarkPlugins = [remarkGfm]\nexport const rehypePlugins = [rehypeSlugSections, rehypeParseCodeBlocks, rehypeShiki]\n","import matter from 'gray-matter'\n\n/**\n * 从 MDX 文件内容中提取 frontmatter。\n * 使用 gray-matter 支持 YAML frontmatter 的标准语法和类型解析。\n */\nexport function extractFrontmatter(content: string): Record<string, unknown> {\n return matter(content).data\n}\n","import { existsSync, readdirSync, readFileSync } from 'node:fs'\nimport { join, relative } from 'node:path'\n\nimport GithubSlugger from 'github-slugger'\nimport { toString } from 'mdast-util-to-string'\nimport { remark } from 'remark'\nimport { visit } from 'unist-util-visit'\n\nimport type { ContentRoute, ContentSection, ClarifyNavigationNode, ClarifyPagesGroup, ClarifyPagesItem, ClarifyLocalizedText, LocalizedNavigation, ResolvedClarifyI18nConfig } from '../types.js'\n\nimport { extractFrontmatter } from './frontmatter.js'\n\nfunction kebabToTitle(str: string): string {\n return str\n .split('-')\n .map(w => w.charAt(0).toUpperCase() + w.slice(1))\n .join(' ')\n}\n\nfunction parseMdxTree(content: string) {\n return remark.parse(content)\n}\n\n/** 从内容中提取第一个 H1 标题 */\nfunction extractH1(content: string): string {\n const tree = parseMdxTree(content)\n let title = ''\n visit(tree, 'heading', (node) => {\n if (!title && node.depth === 1) {\n title = toString(node)\n }\n })\n return title\n}\n\n/** 从 MDX/Markdown 内容中提取 H2/H3 章节 */\nexport function extractMdxSections(content: string): ContentSection[] {\n const sections: ContentSection[] = []\n const slugger = new GithubSlugger()\n const tree = parseMdxTree(content)\n visit(tree, 'heading', (node) => {\n if (node.depth !== 2 && node.depth !== 3) return\n const title = toString(node)\n sections.push({ id: slugger.slug(title), title, level: node.depth })\n })\n return sections\n}\n\nfunction navigationSections(sections: ContentSection[]) {\n return sections.map(s => ({ id: s.id, title: s.title, badge: s.badge, tags: s.tags }))\n}\n\nfunction normalizePath(path: string): string {\n const clean = '/' + path.replace(/^\\/+|\\/+$/g, '')\n return clean === '/' ? '/' : clean.replace(/\\/+/g, '/')\n}\n\nexport function basePathFromRef(ref: string): string {\n const withoutExtension = ref.replace(/\\.mdx?$/, '').replace(/\\.openapi\\.(json|yaml|yml)$/, '')\n return normalizePath(withoutExtension === 'index' ? '/' : withoutExtension.replace(/\\/index$/, ''))\n}\n\nexport function routePathFromRef(ref: string): string {\n return basePathFromRef(ref)\n}\n\nexport function virtualModuleIdFromRef(ref: string): string {\n return 'virtual:clarify-page/' + ref\n .replace(/\\.mdx?$/, '')\n .replace(/\\.openapi\\.(json|yaml|yml)$/, '')\n .replace(/\\/+/g, '/')\n}\n\nexport function localizedRoutePath(basePath: string, locale: string, i18n: ResolvedClarifyI18nConfig): string {\n const normalizedBasePath = normalizePath(basePath)\n if (locale === i18n.defaultLocale) return normalizedBasePath\n const prefix = normalizePath(locale)\n return normalizedBasePath === '/' ? prefix : normalizePath(`${prefix}${normalizedBasePath}`)\n}\n\nexport function resolveLocalizedText(text: ClarifyLocalizedText | undefined, locale: string, fallbackLocale?: string): string | undefined {\n if (typeof text === 'string' || text === undefined) return text\n return text[locale] ?? (fallbackLocale ? text[fallbackLocale] : undefined) ?? Object.values(text)[0]\n}\n\nexport function findContentRoutes(dir: string, base: string = dir): ContentRoute[] {\n const routes: ContentRoute[] = []\n if (!existsSync(dir)) return routes\n\n const entries = readdirSync(dir, { withFileTypes: true })\n for (const entry of entries) {\n const fullPath = join(dir, entry.name)\n if (entry.isDirectory()) {\n routes.push(...findContentRoutes(fullPath, base))\n } else if (entry.isFile() && /\\.mdx?$/.test(entry.name)) {\n const relativePath = relative(base, fullPath)\n const pathParts = relativePath.replace(/\\.mdx?$/, '').split('/')\n const path = '/' + pathParts.map(p => p === 'index' ? '' : p).filter(Boolean).join('/')\n const cleanPath = path.replace(/\\/+/g, '/').replace(/\\/$/, '') || '/'\n\n const content = readFileSync(fullPath, 'utf-8')\n const frontmatter = extractFrontmatter(content)\n\n let title = typeof frontmatter.title === 'string' ? frontmatter.title : ''\n if (!title) {\n const lastPart = pathParts[pathParts.length - 1] ?? ''\n const stem = lastPart === 'index'\n ? (pathParts.length >= 2 ? pathParts[pathParts.length - 2]! : extractH1(content))\n : lastPart\n title = kebabToTitle(stem) || 'Untitled'\n }\n\n routes.push({\n path: cleanPath,\n basePath: cleanPath,\n filePath: fullPath,\n virtualModuleId: 'virtual:clarify-page/' + relativePath.replace(/\\.mdx?$/, '').replace(/\\/+/g, '/'),\n title,\n kind: 'mdx',\n sections: extractMdxSections(content),\n })\n }\n }\n return routes\n}\n\nfunction virtualModuleIdForLocalizedRoute(contentRoot: string, filePath: string): string {\n return 'virtual:clarify-page/' + relative(contentRoot, filePath)\n .replace(/\\.mdx?$/, '')\n .replace(/\\.openapi\\.(json|yaml|yml)$/, '')\n .replace(/\\/+/g, '/')\n}\n\nfunction withAlternates(route: ContentRoute, routes: ContentRoute[], i18n: ResolvedClarifyI18nConfig): ContentRoute {\n const basePath = route.basePath ?? route.path\n const routeByLocaleAndBase = new Map(routes.map(route => [`${route.locale ?? ''}:${route.basePath ?? route.path}`, route]))\n const alternates = Object.fromEntries(\n i18n.locales.flatMap((locale) => {\n const alternate = routeByLocaleAndBase.get(`${locale.code}:${basePath}`)\n return alternate ? [[locale.code, alternate.path]] : []\n })\n )\n return { ...route, alternates }\n}\n\nexport function findLocalizedContentRoutes(contentRoot: string, i18n?: ResolvedClarifyI18nConfig): ContentRoute[] {\n if (!i18n) return findContentRoutes(contentRoot)\n\n const localizedRoutes: ContentRoute[] = []\n for (const locale of i18n.locales) {\n const localeRoot = join(contentRoot, locale.code)\n const discovered = findContentRoutes(localeRoot)\n for (const route of discovered) {\n const basePath = route.basePath ?? route.path\n localizedRoutes.push({\n ...route,\n path: localizedRoutePath(basePath, locale.code, i18n),\n basePath,\n locale: locale.code,\n virtualModuleId: virtualModuleIdForLocalizedRoute(contentRoot, route.filePath),\n })\n }\n }\n\n if (i18n.missing === 'fallback') {\n const routeByLocaleAndBase = new Map(localizedRoutes.map(route => [`${route.locale ?? ''}:${route.basePath ?? route.path}`, route]))\n const defaultRoutes = localizedRoutes.filter(route => route.locale === i18n.defaultLocale)\n for (const sourceRoute of defaultRoutes) {\n const basePath = sourceRoute.basePath ?? sourceRoute.path\n for (const locale of i18n.locales) {\n const key = `${locale.code}:${basePath}`\n if (routeByLocaleAndBase.has(key)) continue\n localizedRoutes.push({\n ...sourceRoute,\n path: localizedRoutePath(basePath, locale.code, i18n),\n locale: locale.code,\n isFallback: true,\n })\n }\n }\n }\n\n return localizedRoutes.map(route => withAlternates(route, localizedRoutes, i18n))\n}\n\nexport function buildNavigation(routes: ContentRoute[]): ClarifyNavigationNode[] {\n const root: ClarifyNavigationNode[] = []\n\n for (const route of routes) {\n if (route.path === '/') continue // 首页不放入侧边栏\n\n const parts = route.path.replace(/^\\//, '').split('/')\n let current = root\n\n for (let i = 0; i < parts.length; i++) {\n const pathSoFar = '/' + parts.slice(0, i + 1).join('/')\n let node = current.find(n => n.path === pathSoFar)\n if (!node) {\n node = { path: pathSoFar, title: i === parts.length - 1 ? route.title : kebabToTitle(parts[i]), children: [] }\n current.push(node)\n }\n if (i === parts.length - 1 && route.sections) {\n node.sections = navigationSections(route.sections)\n }\n if (i < parts.length - 1) {\n node.children = node.children ?? []\n current = node.children\n }\n }\n }\n\n return root\n}\n\nfunction resolvePageItem(\n item: ClarifyPagesItem\n): { pageRef?: string; openapiRef?: string; redirect?: string; title?: ClarifyLocalizedText; icon?: string } {\n if (typeof item === 'string') return { pageRef: item }\n if ('openapi' in item) return { openapiRef: item.openapi, title: item.title, icon: item.icon }\n return { pageRef: item.page, redirect: item.redirect, title: item.title, icon: item.icon }\n}\n\nexport function buildNavigationFromConfig(routes: ContentRoute[], config: ClarifyPagesGroup[]): ClarifyNavigationNode[] {\n const routeMap = new Map(routes.map(r => [r.path, r]))\n\n return config.map(group => {\n const children = group.pages.map(item => {\n const { pageRef, openapiRef, redirect, title, icon } = resolvePageItem(item)\n\n if (openapiRef) {\n const path = '/' + openapiRef.replace(/\\.openapi\\.(json|yaml|yml)$/, '')\n const route = routeMap.get(path)\n return {\n path,\n title: resolveLocalizedText(title, '', '') ?? route?.title ?? kebabToTitle(path.split('/').pop() ?? openapiRef),\n icon,\n sections: route?.sections ? navigationSections(route.sections) : undefined,\n }\n }\n\n const ref = pageRef ?? ''\n const path = ref === 'index' ? '/' : '/' + ref\n const route = routeMap.get(path)\n return {\n path: redirect ? redirect : path,\n title: resolveLocalizedText(title, '', '') ?? route?.title ?? kebabToTitle(path.split('/').pop() ?? ref),\n icon,\n sections: route?.sections ? navigationSections(route.sections) : undefined,\n }\n })\n\n return {\n path: children[0]?.path ?? '/',\n title: resolveLocalizedText(group.group, '', '') ?? '',\n icon: group.icon,\n children,\n }\n })\n}\n\nfunction localizeNavigationPaths(nodes: ClarifyNavigationNode[], locale: string, i18n: ResolvedClarifyI18nConfig): ClarifyNavigationNode[] {\n return nodes.map(node => ({\n ...node,\n path: localizedRoutePath(node.path, locale, i18n),\n children: node.children ? localizeNavigationPaths(node.children, locale, i18n) : undefined,\n }))\n}\n\nexport function buildLocalizedNavigation(routes: ContentRoute[], config: ClarifyPagesGroup[] | 'FileTree' | undefined, i18n?: ResolvedClarifyI18nConfig): LocalizedNavigation | undefined {\n if (!i18n) return undefined\n\n const result: LocalizedNavigation = {}\n for (const locale of i18n.locales) {\n const localeRoutes = routes.filter(route => route.locale === locale.code)\n if (!config || config === 'FileTree') {\n const baseNavigation = buildNavigation(localeRoutes.map(route => ({ ...route, path: route.basePath ?? route.path })))\n result[locale.code] = localizeNavigationPaths(baseNavigation, locale.code, i18n)\n continue\n }\n\n const routeMap = new Map(localeRoutes.map(route => [route.basePath ?? route.path, route]))\n result[locale.code] = config.map(group => {\n const children = group.pages.map(item => {\n const { pageRef, openapiRef, redirect, title, icon } = resolvePageItem(item)\n const ref = openapiRef ?? pageRef ?? ''\n const basePath = basePathFromRef(ref)\n const route = routeMap.get(basePath)\n const path = route?.path ?? localizedRoutePath(basePath, locale.code, i18n)\n const redirectPath = redirect ? localizedRoutePath(basePathFromRef(redirect), locale.code, i18n) : undefined\n\n return {\n path: redirectPath ?? path,\n title: resolveLocalizedText(title, locale.code, i18n.defaultLocale) ?? route?.title ?? kebabToTitle(basePath.split('/').pop() ?? ref),\n icon,\n sections: route?.sections ? navigationSections(route.sections) : undefined,\n }\n })\n\n return {\n path: children[0]?.path ?? localizedRoutePath('/', locale.code, i18n),\n title: resolveLocalizedText(group.group, locale.code, i18n.defaultLocale) ?? '',\n icon: group.icon,\n children,\n }\n })\n }\n\n return result\n}\n","import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { dirname, extname, join } from 'node:path'\n\nimport type { ContentRoute, ResolvedProjectConfig } from '../../types.js'\n\nfunction normalizeBasePath(basePath: string): string {\n if (!basePath || basePath === '/') return ''\n return '/' + basePath.replace(/^\\/+|\\/+$/g, '')\n}\n\nexport function routeToMarkdownUrl(routePath: string): string {\n const normalizedPath = routePath === '/' ? '/index' : routePath.replace(/\\/$/, '')\n return `${normalizedPath}.md`\n}\n\nexport function routeToOpenAPIUrl(routePath: string, filePath: string): string {\n const extension = extname(filePath).toLowerCase() || '.json'\n const normalizedPath = routePath === '/' ? '/index' : routePath.replace(/\\/$/, '')\n return `${normalizedPath}.openapi${extension}`\n}\n\nexport function enrichRoutesWithRawContent(routes: ContentRoute[]): void {\n for (const route of routes) {\n route.rawContentUrl = route.kind === 'openapi'\n ? routeToOpenAPIUrl(route.path, route.filePath)\n : routeToMarkdownUrl(route.path)\n }\n}\n\nexport function readRawContent(route: ContentRoute): string {\n return readFileSync(route.filePath, 'utf-8')\n}\n\nexport function writeRawContentFiles(routes: ContentRoute[], outputDirectory: string): void {\n for (const route of routes) {\n if (!route.rawContentUrl) continue\n\n const outFile = join(outputDirectory, route.rawContentUrl.replace(/^\\//, ''))\n mkdirSync(dirname(outFile), { recursive: true })\n writeFileSync(outFile, readRawContent(route), 'utf-8')\n }\n}\n\nexport function createLlmsTxt(routes: ContentRoute[], projectConfig: ResolvedProjectConfig): string {\n const basePath = normalizeBasePath(projectConfig.routePrefix)\n const lines = [\n `# ${projectConfig.title}`,\n '',\n ]\n\n if (projectConfig.description) {\n lines.push(`> ${projectConfig.description}`, '')\n }\n\n lines.push('## Docs')\n for (const route of routes.filter(route => route.kind === 'mdx')) {\n if (!route.rawContentUrl) continue\n lines.push(`- [${route.title}](${basePath}${route.rawContentUrl})`)\n }\n\n const openApiRoutes = routes.filter(route => route.kind === 'openapi')\n if (openApiRoutes.length > 0) {\n lines.push('', '## OpenAPI')\n for (const route of openApiRoutes) {\n if (!route.rawContentUrl) continue\n lines.push(`- [${route.title}](${basePath}${route.rawContentUrl})`)\n }\n }\n\n return `${lines.join('\\n')}\\n`\n}\n\nexport function writeLlmsTxt(routes: ContentRoute[], projectConfig: ResolvedProjectConfig, outputDirectory: string): void {\n mkdirSync(outputDirectory, { recursive: true })\n writeFileSync(join(outputDirectory, 'llms.txt'), createLlmsTxt(routes, projectConfig), 'utf-8')\n}\n","import type { IncomingMessage, ServerResponse } from 'node:http'\n\nimport type { ContentRoute, ResolvedProjectConfig } from '../../types.js'\n\nimport { createLlmsTxt, readRawContent } from './raw-content.js'\n\nfunction normalizeRoutePrefix(routePrefix: string): string {\n if (!routePrefix || routePrefix === '/') return ''\n return `/${routePrefix.replace(/^\\/+|\\/+$/g, '')}`\n}\n\nexport function resolveContentArtifactPath(url: string | undefined, projectConfig: ResolvedProjectConfig): string {\n const requestPath = url?.split('?')[0] ?? ''\n const basePath = normalizeRoutePrefix(projectConfig.routePrefix)\n return basePath && requestPath.startsWith(basePath)\n ? requestPath.slice(basePath.length) || '/'\n : requestPath\n}\n\nexport function resolveRawContentType(route: ContentRoute): string {\n if (route.kind === 'openapi' && /\\.ya?ml$/i.test(route.rawContentUrl ?? '')) {\n return 'text/yaml; charset=utf-8'\n }\n\n return route.kind === 'openapi'\n ? 'application/json; charset=utf-8'\n : 'text/markdown; charset=utf-8'\n}\n\nexport function serveContentArtifacts(req: IncomingMessage, res: ServerResponse, projectConfig: ResolvedProjectConfig, routes: ContentRoute[]): boolean {\n const contentPath = resolveContentArtifactPath(req.url, projectConfig)\n\n if (contentPath === '/llms.txt') {\n res.statusCode = 200\n res.setHeader('Content-Type', 'text/plain; charset=utf-8')\n res.end(createLlmsTxt(routes, projectConfig))\n return true\n }\n\n const route = routes.find(route => route.rawContentUrl === contentPath)\n if (!route) return false\n\n res.statusCode = 200\n res.setHeader('Content-Type', resolveRawContentType(route))\n res.end(readRawContent(route))\n return true\n}\n","import type { ViteDevServer } from 'vite'\n\nimport type { ClarifyPlugin } from '../../types.js'\n\nimport { enrichRoutesWithRawContent, writeLlmsTxt, writeRawContentFiles } from './raw-content.js'\nimport { serveContentArtifacts } from './server.js'\n\nexport function createContentArtifactsPlugin(): ClarifyPlugin {\n return {\n name: 'clarify:content-artifacts',\n hooks: {\n 'routes:resolved': (input) => {\n enrichRoutesWithRawContent(input.routes)\n return input\n },\n 'dev:configureServer': (server: ViteDevServer, ctx) => {\n server.middlewares.use((req, res, next) => {\n if (serveContentArtifacts(req, res, ctx.projectConfig, ctx.routes)) return\n next()\n })\n },\n 'build:done': (ctx) => {\n const outputDirectory = ctx.generateOptions.outputDirectory\n if (!outputDirectory) return\n writeRawContentFiles(ctx.routes, outputDirectory)\n writeLlmsTxt(ctx.routes, ctx.projectConfig, outputDirectory)\n },\n },\n }\n}\n","import type { HtmlTagDescriptor } from 'vite'\n\nimport type { ClarifyFaviconConfig, ClarifyPlugin } from '../../types.js'\n\nconst THEME_BOOTSTRAP_SCRIPT = `(function(){try{var e=localStorage.getItem('clarify:theme');var t=e==='dark'||e==='light'||e==='system'?e:'system';var r=t==='system'?window.matchMedia('(prefers-color-scheme: dark)').matches:t==='dark';document.documentElement.classList.toggle('dark',r);document.documentElement.style.colorScheme=r?'dark':'light'}catch(e){}})();`\n\nconst REL_ICON_RE = /<link\\s+[^>]*rel=[\"'][^\"']*\\bicon\\b[^\"']*[\"'][^>]*>/i\n\nfunction inferIconType(href: string): string | undefined {\n const path = href.split(/[?#]/, 1)[0]?.toLowerCase() ?? href.toLowerCase()\n\n if (path.endsWith('.svg')) return 'image/svg+xml'\n if (path.endsWith('.png')) return 'image/png'\n if (path.endsWith('.ico')) return 'image/x-icon'\n if (path.endsWith('.webp')) return 'image/webp'\n\n return undefined\n}\n\nfunction createIconTag(href: string, media?: string): HtmlTagDescriptor {\n return {\n tag: 'link',\n attrs: {\n rel: 'icon',\n ...(inferIconType(href) ? { type: inferIconType(href) } : {}),\n href,\n ...(media ? { media } : {}),\n },\n injectTo: 'head',\n }\n}\n\nfunction createIconTags(icon?: ClarifyFaviconConfig): HtmlTagDescriptor[] {\n if (!icon) return []\n\n if (typeof icon === 'string') return [createIconTag(icon)]\n\n const lightIcon = icon.light ?? icon.dark\n const darkIcon = icon.dark ?? icon.light\n\n if (!lightIcon || !darkIcon) return []\n if (lightIcon === darkIcon) return [createIconTag(lightIcon)]\n\n return [\n createIconTag(lightIcon, '(prefers-color-scheme: light)'),\n createIconTag(darkIcon, '(prefers-color-scheme: dark)'),\n ]\n}\n\nexport function createHtmlShellPlugin(): ClarifyPlugin {\n return {\n name: 'clarify:html-shell',\n hooks: {\n 'html:transform': (input, ctx) => ({\n html: input.html,\n tags: [\n ...input.tags,\n ...(REL_ICON_RE.test(input.html) ? [] : createIconTags(ctx.projectConfig.favicon ?? ctx.projectConfig.logo)),\n {\n tag: 'script',\n children: THEME_BOOTSTRAP_SCRIPT,\n injectTo: 'head-prepend',\n },\n {\n tag: 'script',\n attrs: { type: 'module', src: input.clientEntryId },\n injectTo: 'body',\n },\n ],\n clientEntryId: input.clientEntryId,\n dev: input.dev,\n }),\n },\n }\n}\n","import { existsSync, readdirSync } from 'node:fs'\nimport { join, relative } from 'node:path'\n\nimport SwaggerParser from '@apidevtools/swagger-parser'\nimport { slug } from 'github-slugger'\n\nimport { routePathFromRef, virtualModuleIdFromRef } from '../../parsers/routes.js'\nimport type { ContentRoute, ContentSection, OpenAPISpec } from '../../types.js'\n\nconst OPENAPI_HTTP_METHODS = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace'] as const\n\nfunction kebabToTitle(str: string): string {\n return str\n .split('-')\n .map(w => w.charAt(0).toUpperCase() + w.slice(1))\n .join(' ')\n}\n\nexport function findOpenAPIRoutes(dir: string, base: string = dir): ContentRoute[] {\n const routes: ContentRoute[] = []\n if (!existsSync(dir)) return routes\n\n const entries = readdirSync(dir, { withFileTypes: true })\n for (const entry of entries) {\n const fullPath = join(dir, entry.name)\n if (entry.isDirectory()) {\n routes.push(...findOpenAPIRoutes(fullPath, base))\n continue\n }\n if (!entry.isFile() || !/\\.openapi\\.(json|yaml|yml)$/.test(entry.name)) continue\n\n const ref = relative(base, fullPath)\n const cleanPath = routePathFromRef(ref)\n routes.push({\n path: cleanPath,\n basePath: cleanPath,\n filePath: fullPath,\n virtualModuleId: virtualModuleIdFromRef(ref),\n title: kebabToTitle(cleanPath.split('/').pop() ?? 'API'),\n kind: 'openapi',\n })\n }\n\n return routes\n}\n\n/** Extract endpoint operations from an OpenAPI spec as page sections. */\nexport function extractOpenAPISections(spec: OpenAPISpec): ContentSection[] {\n const sections: ContentSection[] = []\n const paths = spec.paths ?? {}\n for (const [path, pathItem] of Object.entries(paths)) {\n if (!pathItem) continue\n for (const method of OPENAPI_HTTP_METHODS) {\n const op = pathItem[method]\n if (!op) continue\n const title = op.summary ?? `${method.toUpperCase()} ${path}`\n sections.push({ id: slug(`${method} ${path}`), title, level: 2, badge: method.toUpperCase() })\n }\n }\n return sections\n}\n\nexport async function readOpenAPISpec(filePath: string): Promise<OpenAPISpec | null> {\n try {\n return await SwaggerParser.dereference(filePath) as OpenAPISpec\n } catch {\n return null\n }\n}\n","import type { OpenAPISpec } from '../../types.js'\n\nexport const openApiRegistryModuleId = 'virtual:clarify-openapi-registry'\n\nexport function generateOpenAPIRegistryModule(openApis: Record<string, OpenAPISpec>): string {\n return `export const openApis = ${JSON.stringify(openApis)};`\n}\n\nexport function generateOpenAPIModule(spec: OpenAPISpec): string {\n return `import { createElement } from 'react';\nimport { OpenApiPage } from '@clarify-labs/renderer';\nconst spec = ${JSON.stringify(spec)};\nexport default function OpenApiRoutePage() {\n return createElement(OpenApiPage, { spec });\n}`\n}\n","import type { ClarifyPlugin, OpenAPISpec } from '../../types.js'\n\nimport { extractOpenAPISections, findOpenAPIRoutes, readOpenAPISpec } from './parser.js'\nimport { generateOpenAPIModule, generateOpenAPIRegistryModule, openApiRegistryModuleId } from './virtual-modules.js'\n\nexport function createOpenAPIPlugin(): ClarifyPlugin {\n const specs: Record<string, OpenAPISpec> = {}\n\n return {\n name: 'clarify:openapi',\n hooks: {\n 'routes:discover': (input) => ({\n ...input,\n routes: [...input.routes, ...findOpenAPIRoutes(input.contentRoot)],\n }),\n 'routes:discovered': async (routes) => {\n for (const key of Object.keys(specs)) delete specs[key]\n\n for (const route of routes.filter(route => route.kind === 'openapi')) {\n const spec = await readOpenAPISpec(route.filePath)\n if (!spec) {\n throw new Error(`Failed to parse OpenAPI spec: ${route.filePath}`)\n }\n\n specs[route.virtualModuleId] = spec\n specs[`virtual:clarify-page/${route.path.replace(/^\\//, '')}`] = spec\n route.title = spec.info?.title ?? route.title\n route.sections = extractOpenAPISections(spec)\n }\n\n return routes\n },\n 'modules:before': (modules) => {\n modules.set(openApiRegistryModuleId, generateOpenAPIRegistryModule(specs))\n\n for (const [moduleId, spec] of Object.entries(specs)) {\n modules.set(moduleId, generateOpenAPIModule(spec))\n }\n\n return modules\n },\n },\n }\n}\n","import { z } from 'zod'\n\nimport type { ClarifyProjectConfig } from '../types.js'\n\nexport const clarifyLogoConfigSchema = z.union([\n z.string(),\n z.object({\n light: z.string().optional(),\n dark: z.string().optional(),\n }),\n])\n\nexport const clarifyFaviconConfigSchema = z.union([\n z.string(),\n z.object({\n light: z.string().optional(),\n dark: z.string().optional(),\n }),\n])\n\nexport const clarifyLocalizedTextSchema = z.union([\n z.string(),\n z.record(z.string(), z.string()),\n])\n\nexport const clarifyLocaleConfigSchema = z.object({\n code: z.string(),\n label: z.string(),\n dir: z.union([z.literal('ltr'), z.literal('rtl')]).optional(),\n})\n\nexport const clarifyI18nConfigSchema = z.object({\n defaultLocale: z.string().optional(),\n missing: z.union([z.literal('fallback'), z.literal('404'), z.literal('hide')]).optional(),\n locales: z.array(clarifyLocaleConfigSchema).min(1),\n}).superRefine((config, ctx) => {\n const localeCodes = new Set<string>()\n for (const [index, locale] of config.locales.entries()) {\n if (localeCodes.has(locale.code)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Duplicate locale code \"${locale.code}\"`,\n path: ['locales', index, 'code'],\n })\n }\n localeCodes.add(locale.code)\n }\n\n if (config.defaultLocale && !localeCodes.has(config.defaultLocale)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'defaultLocale must be one of i18n.locales',\n path: ['defaultLocale'],\n })\n }\n})\n\nexport const clarifyNavbarLinkSchema = z.object({\n label: clarifyLocalizedTextSchema,\n href: z.string(),\n external: z.boolean().optional(),\n})\n\nexport const clarifyBannerConfigSchema = z.object({\n content: clarifyLocalizedTextSchema,\n dismissible: z.boolean().optional(),\n})\n\nexport const clarifyFooterConfigSchema = z.object({\n links: z.array(clarifyNavbarLinkSchema).optional(),\n socials: z.record(z.string(), z.string()).optional(),\n copyright: clarifyLocalizedTextSchema.optional(),\n})\n\nexport const clarifyPagesItemSchema = z.union([\n z.string(),\n z.object({\n page: z.string(),\n title: clarifyLocalizedTextSchema.optional(),\n icon: z.string().optional(),\n redirect: z.string().optional(),\n }),\n z.object({\n openapi: z.string(),\n icon: z.string().optional(),\n title: clarifyLocalizedTextSchema.optional(),\n }),\n])\n\nexport const clarifyPagesGroupSchema = z.object({\n group: clarifyLocalizedTextSchema,\n icon: z.string().optional(),\n pages: z.array(clarifyPagesItemSchema),\n})\n\nexport const clarifyPagesConfigSchema = z.union([\n z.array(clarifyPagesGroupSchema),\n z.literal('FileTree'),\n])\n\nexport const clarifyProjectConfigSchema = z.object({\n title: z.string().optional(),\n description: z.string().optional(),\n logo: clarifyLogoConfigSchema.optional(),\n favicon: clarifyFaviconConfigSchema.optional(),\n theme: z.object({\n primary: z.string().optional(),\n }).optional(),\n routePrefix: z.string().optional(),\n navbar: z.object({\n links: z.array(clarifyNavbarLinkSchema).optional(),\n }).optional(),\n banner: clarifyBannerConfigSchema.optional(),\n footer: clarifyFooterConfigSchema.optional(),\n i18n: clarifyI18nConfigSchema.optional(),\n pages: clarifyPagesConfigSchema.optional(),\n}) satisfies z.ZodType<ClarifyProjectConfig>\n\nexport type ClarifyProjectConfigInput = z.input<typeof clarifyProjectConfigSchema>\n","import type { ZodError } from 'zod'\n\nimport type { ClarifyI18nConfig, ClarifyProjectConfig, ResolvedClarifyI18nConfig, ResolvedProjectConfig } from '../types.js'\n\nimport { clarifyProjectConfigSchema } from './config-schema.js'\n\nfunction formatIssuePath(path: PropertyKey[]): string {\n return path.reduce<string>((result, segment) => {\n if (typeof segment === 'number') return `${result}[${segment}]`\n const key = String(segment)\n return result ? `${result}.${key}` : key\n }, '')\n}\n\nfunction formatProjectConfigError(error: ZodError): string {\n const issue = error.issues[0]\n if (!issue) return '[clarify] config is invalid'\n\n const path = formatIssuePath(issue.path)\n if (!path) return `[clarify] config must contain an object: ${issue.message}`\n\n return `[clarify] config field \"${path}\" is invalid: ${issue.message}`\n}\n\nexport function validateProjectConfig(value: unknown): ClarifyProjectConfig {\n const result = clarifyProjectConfigSchema.safeParse(value)\n if (!result.success) {\n throw new Error(formatProjectConfigError(result.error))\n }\n return result.data\n}\n\nfunction resolveI18nConfig(i18n?: ClarifyI18nConfig): ResolvedClarifyI18nConfig | undefined {\n if (!i18n) return undefined\n\n const firstLocale = i18n.locales[0]?.code\n const defaultLocale = i18n.defaultLocale ?? firstLocale\n if (!defaultLocale) return undefined\n\n return {\n defaultLocale,\n missing: i18n.missing ?? 'fallback',\n locales: i18n.locales,\n }\n}\n\nexport function resolveProjectConfig(config: ClarifyProjectConfig = {}): ResolvedProjectConfig {\n return {\n title: config.title ?? 'Clarify Docs',\n description: config.description ?? '',\n logo: config.logo,\n favicon: config.favicon,\n routePrefix: config.routePrefix ?? '/',\n theme: config.theme ?? {},\n navbar: config.navbar,\n banner: config.banner,\n footer: config.footer,\n i18n: resolveI18nConfig(config.i18n),\n pages: config.pages,\n }\n}\n","import type { ViteDevServer } from 'vite'\n\nimport type { ClarifyHookContext, ClarifyHooks, ClarifyPlugin } from '../types.js'\n\nexport async function runHooks<K extends Exclude<keyof ClarifyHooks, 'build:done' | 'dev:configureServer'>>(plugins: ClarifyPlugin[], hookName: K, input: Parameters<NonNullable<ClarifyHooks[K]>>[0], ctx: ClarifyHookContext): Promise<Parameters<NonNullable<ClarifyHooks[K]>>[0]> {\n let result = input\n for (const plugin of plugins) {\n const hook = plugin.hooks[hookName]\n if (!hook) continue\n try {\n result = await hook(result as never, ctx) as Parameters<NonNullable<ClarifyHooks[K]>>[0]\n } catch (err) {\n throw new Error(`[clarify] plugin \"${plugin.name}\" hook \"${hookName}\" failed: ${err}`, { cause: err })\n }\n }\n return result\n}\n\nexport async function runDevConfigureServerHooks(plugins: ClarifyPlugin[], server: ViteDevServer, ctx: ClarifyHookContext): Promise<void> {\n for (const plugin of plugins) {\n const hook = plugin.hooks['dev:configureServer']\n if (!hook) continue\n try {\n await hook(server, ctx)\n } catch (err) {\n throw new Error(`[clarify] plugin \"${plugin.name}\" hook \"dev:configureServer\" failed: ${err}`, { cause: err })\n }\n }\n}\n\nexport async function runBuildDoneHooks(plugins: ClarifyPlugin[], ctx: ClarifyHookContext): Promise<void> {\n for (const plugin of plugins) {\n const hook = plugin.hooks['build:done']\n if (!hook) continue\n try {\n await hook(ctx)\n } catch (err) {\n throw new Error(`[clarify] plugin \"${plugin.name}\" hook \"build:done\" failed: ${err}`, { cause: err })\n }\n }\n}\n","import type { ClarifyPlugin, ClarifyProjectConfig } from '../types.js'\n\nexport type ClarifyBuildOptions = ClarifyProjectConfig & {\n /** Project root directory. Defaults to the current working directory. */\n projectRoot?: string\n /** Root directory for MDX content. Default: 'source' */\n rootDirectory?: string\n /** Output directory for the built docs site. When omitted, Vite's build.outDir is used. */\n outputDirectory?: string\n /** Static generation behavior. */\n ssg?: {\n /** Fail the build when SSG fails. Default: true. */\n failOnError?: boolean\n }\n\n /** Clarify plugin extensions for translation, search, and other build-time features. */\n plugins?: ClarifyPlugin[]\n}\n\nexport type ResolvedBuildOptions = {\n rootDirectory: string\n outputDirectory?: string\n ssg: {\n failOnError: boolean\n }\n}\n\nexport function resolveBuildOptions(options: ClarifyBuildOptions = {}): ResolvedBuildOptions {\n return {\n rootDirectory: options.rootDirectory ?? 'source',\n outputDirectory: options.outputDirectory,\n ssg: {\n failOnError: options.ssg?.failOnError ?? true,\n },\n }\n}\n","import { readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { dirname, join } from 'node:path'\n\nimport type { AliasOptions } from 'vite'\n\nconst requireFromCli = createRequire(import.meta.url)\n\nfunction resolveCliDependency(id: string): string {\n return requireFromCli.resolve(id)\n}\n\nfunction resolvePackageExport(packageName: string, subpath: string, condition: 'import' | 'require' = 'import'): string {\n const packageJsonPath = requireFromCli.resolve(`${packageName}/package.json`)\n const packageRoot = dirname(packageJsonPath)\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as {\n exports?: Record<string, string | Record<string, string>>\n }\n const exportKey = subpath ? `./${subpath}` : '.'\n const exportEntry = packageJson.exports?.[exportKey]\n const target = typeof exportEntry === 'string'\n ? exportEntry\n : exportEntry?.[condition] ?? exportEntry?.default\n\n if (!target) {\n throw new Error(`[clarify] Unable to resolve ${packageName}/${subpath}`)\n }\n\n return join(packageRoot, target)\n}\n\n/**\n * Resolve Clarify's framework/runtime dependencies from the CLI package instead\n * of from the user's documentation project. This keeps content-only projects\n * free from React, renderer, and tsconfig requirements.\n */\nexport function createClarifyRuntimeAliases(): AliasOptions {\n return [\n { find: /^@clarify-labs\\/renderer\\/style\\.css$/, replacement: resolvePackageExport('@clarify-labs/renderer', 'style.css') },\n { find: /^@clarify-labs\\/renderer\\/client$/, replacement: resolvePackageExport('@clarify-labs/renderer', 'client') },\n { find: /^@clarify-labs\\/renderer\\/server$/, replacement: resolvePackageExport('@clarify-labs/renderer', 'server') },\n { find: /^@clarify-labs\\/renderer$/, replacement: resolvePackageExport('@clarify-labs/renderer', '') },\n { find: /^react\\/jsx-runtime$/, replacement: resolveCliDependency('react/jsx-runtime') },\n { find: /^react\\/jsx-dev-runtime$/, replacement: resolveCliDependency('react/jsx-dev-runtime') },\n { find: /^react-dom\\/client$/, replacement: resolveCliDependency('react-dom/client') },\n { find: /^react-dom\\/server$/, replacement: resolveCliDependency('react-dom/server') },\n { find: /^react-dom$/, replacement: resolveCliDependency('react-dom') },\n { find: /^react-router-dom$/, replacement: resolveCliDependency('react-router-dom') },\n { find: /^react$/, replacement: resolveCliDependency('react') },\n ]\n}\n","import { existsSync, readFileSync, mkdirSync, writeFileSync, mkdtempSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { join, dirname } from 'node:path'\nimport { pathToFileURL } from 'node:url'\n\nimport { build } from 'vite'\nimport type { Plugin } from 'vite'\n\nimport type { ResolvedProjectConfig, ContentRoute } from '../types.js'\n\nimport { createClarifyRuntimeAliases } from './runtime-deps.js'\nimport { escapeHtml } from './utils.js'\n\nexport function readIndexHtml(outputDirectory: string): string | undefined {\n const indexPath = join(outputDirectory, 'index.html')\n if (!existsSync(indexPath)) return undefined\n try {\n return readFileSync(indexPath, 'utf-8')\n } catch {\n return undefined\n }\n}\n\nfunction injectHtmlLocaleAttributes(html: string, projectConfig: ResolvedProjectConfig, route?: ContentRoute): string {\n const localeCode = route?.locale ?? projectConfig.i18n?.defaultLocale\n if (!localeCode) return html\n\n const localeConfig = projectConfig.i18n?.locales.find(locale => locale.code === localeCode)\n const dir = localeConfig?.dir\n\n return html.replace(/<html\\b([^>]*)>/i, (_match, attributes: string) => {\n let nextAttributes = attributes\n .replace(/\\s+lang=(\"[^\"]*\"|'[^']*'|[^\\s>]*)/i, '')\n .replace(/\\s+dir=(\"[^\"]*\"|'[^']*'|[^\\s>]*)/i, '')\n\n nextAttributes = `${nextAttributes} lang=\"${escapeHtml(localeCode)}\"`\n if (dir) nextAttributes = `${nextAttributes} dir=\"${escapeHtml(dir)}\"`\n return `<html${nextAttributes}>`\n })\n}\n\nexport function injectSSRIntoTemplate(template: string, appHtml: string, projectConfig: ResolvedProjectConfig, route?: ContentRoute): string {\n let html = injectHtmlLocaleAttributes(template, projectConfig, route)\n\n // Replace <title>...</title>\n html = html.replace(/<title>.*?<\\/title>/, `<title>${escapeHtml(projectConfig.title)}</title>`)\n\n // Inject description meta if not present and description is set\n if (projectConfig.description && !html.includes('name=\"description\"')) {\n const descriptionMeta = `<meta name=\"description\" content=\"${escapeHtml(projectConfig.description)}\" />`\n html = html.replace('</head>', ` ${descriptionMeta}\\n </head>`)\n }\n\n // Replace <div id=\"root\">...</div> with SSR rendered content\n html = html.replace(/<div id=\"root\">[\\s\\S]*?<\\/div>/, `<div id=\"root\">${appHtml}</div>`)\n\n return html\n}\n\nexport const SSR_ENTRY_CODE = `import { renderToHTML } from '@clarify-labs/renderer/server';\nimport { routes, navigation } from 'virtual:clarify-routes';\nimport { config } from 'virtual:clarify-config';\nimport { openApis } from 'virtual:clarify-openapi-registry';\n\nexport function render(url) {\n return renderToHTML({ config, routes, navigation, openApis, url });\n}`\n\nexport function createTempEntryFile(content: string): string {\n const tempDir = mkdtempSync(join(tmpdir(), 'clarify-ssr-'))\n const entryPath = join(tempDir, 'entry-server.ts')\n writeFileSync(entryPath, content, 'utf-8')\n return entryPath\n}\n\nexport async function buildSSRBundle(root: string, ssrEntry: string, ssrOutDir: string, plugins: Plugin[]): Promise<void> {\n await build({\n root,\n configFile: false,\n resolve: {\n alias: createClarifyRuntimeAliases(),\n },\n plugins,\n build: {\n ssr: ssrEntry,\n outDir: ssrOutDir,\n emptyOutDir: true,\n rollupOptions: {\n input: ssrEntry,\n },\n },\n })\n}\n\nexport async function renderSSGRoutes(routes: ContentRoute[], projectConfig: ResolvedProjectConfig, outputDirectory: string, ssrBundlePath: string, failOnError: boolean = true): Promise<void> {\n const { render } = await import(pathToFileURL(ssrBundlePath).href)\n\n const template = readIndexHtml(outputDirectory)\n if (!template) {\n throw new Error(\n `[clarify] index.html not found in outputDirectory \"${outputDirectory}\". Make sure Vite build produces it.`\n )\n }\n\n for (const route of routes) {\n try {\n const appHtml = render(route.path)\n const finalHtml = injectSSRIntoTemplate(template, appHtml, projectConfig, route)\n\n const outFile = join(outputDirectory, route.path, 'index.html')\n mkdirSync(dirname(outFile), { recursive: true })\n writeFileSync(outFile, finalHtml, 'utf-8')\n } catch (err) {\n console.error(`[clarify] Failed to render route \"${route.path}\":`, err)\n if (failOnError) {\n throw err\n }\n }\n }\n}\n","import { existsSync, readFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nimport { loadConfigFromFile } from 'vite'\nimport type { ConfigEnv } from 'vite'\n\nimport type { ClarifyProjectConfig } from '../types.js'\n\nimport { validateProjectConfig } from './config.js'\nimport type { ClarifyBuildOptions } from './options.js'\n\nexport type ClarifyConfig = ClarifyProjectConfig & Pick<ClarifyBuildOptions, 'plugins' | 'ssg'>\n\nexport function defineConfig(config: ClarifyConfig): ClarifyConfig {\n return config\n}\n\nconst CONFIG_FILENAMES = [\n 'clarify.ts',\n 'clarify.js',\n 'clarify.json',\n]\n\nexport function findClarifyConfigFile(root: string): string | undefined {\n for (const filename of CONFIG_FILENAMES) {\n const filePath = resolve(root, filename)\n if (existsSync(filePath)) return filePath\n }\n return undefined\n}\n\nfunction assertConfigObject(config: unknown, configFile: string): Record<string, unknown> {\n if (!config || typeof config !== 'object' || Array.isArray(config)) {\n throw new Error(`[clarify] ${configFile} must export a configuration object`)\n }\n return config as Record<string, unknown>\n}\n\nfunction loadJsonConfig(configFile: string): ClarifyConfig {\n const config = assertConfigObject(JSON.parse(readFileSync(configFile, 'utf-8')), configFile)\n const projectConfig = validateProjectConfig(config)\n const ssg = config.ssg && typeof config.ssg === 'object' && !Array.isArray(config.ssg)\n ? config.ssg as ClarifyConfig['ssg']\n : undefined\n return {\n ...projectConfig,\n ...(ssg ? { ssg } : {}),\n }\n}\n\nexport async function loadClarifyConfig(root: string, env: ConfigEnv): Promise<ClarifyConfig> {\n const configFile = findClarifyConfigFile(root)\n if (!configFile) return {}\n\n if (configFile.endsWith('.json')) {\n return loadJsonConfig(configFile)\n }\n\n const loaded = await loadConfigFromFile(env, configFile, root, 'silent')\n const config = assertConfigObject(loaded?.config, configFile)\n return config as ClarifyConfig\n}\n","import { buildLocalizedNavigation, buildNavigation, buildNavigationFromConfig } from '../parsers/routes.js'\nimport { openApiRegistryModuleId } from '../plugins/openapi/virtual-modules.js'\nimport type { ClarifyPagesConfig, ContentRoute, NavigationTree, ResolvedBuildOptions, ResolvedProjectConfig } from '../types.js'\n\nexport const VIRTUAL_CONFIG = 'virtual:clarify-config'\nexport const VIRTUAL_ROUTES = 'virtual:clarify-routes'\nexport const VIRTUAL_OPENAPI_REGISTRY = openApiRegistryModuleId\nexport const VIRTUAL_CLIENT_ENTRY = 'virtual:clarify-entry-client'\nexport const RESOLVED_CLIENT_ENTRY = '\\0' + VIRTUAL_CLIENT_ENTRY\n\nexport type VirtualModules = Map<string, string>\n\nexport function resolveVirtualId(id: string): string {\n return '\\0' + id\n}\n\nexport function stripVirtualPrefix(id: string): string {\n return id.startsWith('\\0') ? id.slice(1) : id\n}\n\nexport function generateConfigModule(projectConfig: ResolvedProjectConfig, buildOptions: ResolvedBuildOptions): string {\n return `export const config = ${JSON.stringify({ ...projectConfig, ...buildOptions })};`\n}\n\nexport function generateRoutesModule(routes: ContentRoute[], pagesConfig?: ClarifyPagesConfig, resolvedNavigation?: NavigationTree, projectConfig?: ResolvedProjectConfig,): string {\n const imports = routes.map((r, i) => `import Page${i} from '${r.virtualModuleId}';`).join('\\n')\n const routesArray = routes.map((r, i) => {\n const sections = r.sections && r.sections.length > 0\n ? `, sections: ${JSON.stringify(r.sections.map(s => ({ id: s.id, title: s.title, badge: s.badge, tags: s.tags })))}`\n : ''\n const rawContentUrl = r.rawContentUrl ? `, rawContentUrl: ${JSON.stringify(r.rawContentUrl)}` : ''\n const basePath = r.basePath ? `, basePath: ${JSON.stringify(r.basePath)}` : ''\n const locale = r.locale ? `, locale: ${JSON.stringify(r.locale)}` : ''\n const isFallback = r.isFallback ? ', isFallback: true' : ''\n const alternates = r.alternates ? `, alternates: ${JSON.stringify(r.alternates)}` : ''\n return ` { path: ${JSON.stringify(r.path)}, title: ${JSON.stringify(r.title)}, component: Page${i}, kind: '${r.kind}'${basePath}${locale}${isFallback}${alternates}${sections}${rawContentUrl} }`\n }).join(',\\n')\n\n const navigation = resolvedNavigation ?? (projectConfig?.i18n\n ? (buildLocalizedNavigation(routes, pagesConfig, projectConfig.i18n) ?? {})\n : pagesConfig && pagesConfig !== 'FileTree'\n ? buildNavigationFromConfig(routes, pagesConfig)\n : buildNavigation(routes))\n\n return `${imports}\\n\\nexport const routes = [\\n${routesArray}\\n];\\n\\nexport const navigation = ${JSON.stringify(navigation, null, 2)};\\n`\n}\n\nexport function createClientEntryModule(): string {\n return `\nimport '@clarify-labs/renderer/style.css';\nimport { render } from '@clarify-labs/renderer/client';\nimport { routes, navigation } from '${VIRTUAL_ROUTES}';\nimport { config } from '${VIRTUAL_CONFIG}';\nimport { openApis } from '${VIRTUAL_OPENAPI_REGISTRY}';\nrender({ config, routes, navigation, openApis });`\n}\n\nexport function buildVirtualModules(args: {\n projectConfig: ResolvedProjectConfig\n generateOptions: ResolvedBuildOptions\n routes: ContentRoute[]\n navigation?: NavigationTree\n}): VirtualModules {\n const modules: VirtualModules = new Map()\n modules.set(VIRTUAL_CONFIG, generateConfigModule(args.projectConfig, args.generateOptions))\n modules.set(VIRTUAL_ROUTES, generateRoutesModule(args.routes, args.projectConfig.pages, args.navigation, args.projectConfig))\n modules.set(VIRTUAL_OPENAPI_REGISTRY, 'export const openApis = {};')\n modules.set(VIRTUAL_CLIENT_ENTRY, createClientEntryModule())\n modules.set(RESOLVED_CLIENT_ENTRY, createClientEntryModule())\n\n for (const route of args.routes) {\n if (route.kind === 'openapi') continue\n modules.set(route.virtualModuleId, `export { default } from '${route.filePath}';`)\n }\n\n return modules\n}\n","import { rmSync } from 'node:fs'\nimport { isAbsolute, join, relative, resolve } from 'node:path'\n\nimport mdxPlugin from '@mdx-js/rollup'\nimport tailwindcss from '@tailwindcss/vite'\nimport react from '@vitejs/plugin-react'\nimport type { Plugin, ResolvedConfig, ViteDevServer } from 'vite'\n\nimport { rehypePlugins, remarkPlugins } from '../parsers/mdx.js'\nimport { buildLocalizedNavigation, buildNavigation, buildNavigationFromConfig, findContentRoutes, localizedRoutePath, virtualModuleIdFromRef } from '../parsers/routes.js'\nimport { createContentArtifactsPlugin } from '../plugins/content-artifacts/index.js'\nimport { createHtmlShellPlugin } from '../plugins/html-shell/index.js'\nimport { createOpenAPIPlugin } from '../plugins/openapi/index.js'\nimport type { ClarifyHookContext, ClarifyPlugin, ContentRoute, NavigationTree, ResolvedClarifyI18nConfig } from '../types.js'\n\nimport { resolveProjectConfig } from './config.js'\nimport { runBuildDoneHooks, runDevConfigureServerHooks, runHooks } from './hooks.js'\nimport { resolveBuildOptions, type ClarifyBuildOptions } from './options.js'\nimport {\n SSR_ENTRY_CODE,\n createTempEntryFile,\n buildSSRBundle,\n renderSSGRoutes,\n} from './ssg.js'\nimport { findClarifyConfigFile, loadClarifyConfig } from './user-config.js'\nimport {\n RESOLVED_CLIENT_ENTRY,\n VIRTUAL_CLIENT_ENTRY,\n VIRTUAL_CONFIG,\n VIRTUAL_OPENAPI_REGISTRY,\n VIRTUAL_ROUTES,\n buildVirtualModules,\n resolveVirtualId,\n stripVirtualPrefix,\n type VirtualModules,\n} from './virtual-modules.js'\n\nfunction loadVirtualModule(id: string, modules: VirtualModules): string | null {\n const bareId = stripVirtualPrefix(id)\n return modules.get(bareId) ?? modules.get(id) ?? null\n}\n\nexport function clarifyPlugin(options: ClarifyBuildOptions = {}): Plugin[] {\n const root = resolve(options.projectRoot ?? process.cwd())\n let projectConfig = resolveProjectConfig(options)\n let generateOptions = resolveBuildOptions(options)\n const contentRoot = join(root, generateOptions.rootDirectory)\n const configFilePath = findClarifyConfigFile(root)\n let routes: ContentRoute[] = []\n\n const clarifyPlugins: ClarifyPlugin[] = [createOpenAPIPlugin(), createContentArtifactsPlugin(), createHtmlShellPlugin(), ...(options.plugins ?? [])]\n const ctx: ClarifyHookContext = { projectConfig, generateOptions, routes, navigation: [] }\n let viteConfig: ResolvedConfig\n let resolvedNavigation: NavigationTree = []\n let virtualModules: VirtualModules = new Map()\n\n async function reloadProjectConfig() {\n const userConfig = await loadClarifyConfig(root, { command: 'serve', mode: viteConfig.mode })\n const buildOptions: ClarifyBuildOptions = {\n ...userConfig,\n projectRoot: options.projectRoot,\n rootDirectory: options.rootDirectory,\n outputDirectory: options.outputDirectory,\n }\n projectConfig = resolveProjectConfig(buildOptions)\n generateOptions = resolveBuildOptions(buildOptions)\n ctx.projectConfig = projectConfig\n ctx.generateOptions = generateOptions\n }\n\n function withAlternates(route: ContentRoute, routeList: ContentRoute[], i18n: ResolvedClarifyI18nConfig): ContentRoute {\n const basePath = route.basePath ?? route.path\n const routeByLocaleAndBase = new Map(routeList.map(route => [`${route.locale ?? ''}:${route.basePath ?? route.path}`, route]))\n const alternates = Object.fromEntries(\n i18n.locales.flatMap((locale) => {\n const alternate = routeByLocaleAndBase.get(`${locale.code}:${basePath}`)\n return alternate ? [[locale.code, alternate.path]] : []\n })\n )\n return { ...route, alternates }\n }\n\n async function discoverRoutesForRoot(routeRoot: string, locale?: string): Promise<ContentRoute[]> {\n const discovered = await runHooks(clarifyPlugins, 'routes:discover', {\n contentRoot: routeRoot,\n locale,\n routes: findContentRoutes(routeRoot),\n }, ctx)\n return discovered.routes\n }\n\n async function discoverRoutes(): Promise<ContentRoute[]> {\n const i18n = projectConfig.i18n\n if (!i18n) return discoverRoutesForRoot(contentRoot)\n\n const localizedRoutes: ContentRoute[] = []\n for (const locale of i18n.locales) {\n const localeRoot = join(contentRoot, locale.code)\n const discovered = await discoverRoutesForRoot(localeRoot, locale.code)\n for (const route of discovered) {\n const basePath = route.basePath ?? route.path\n localizedRoutes.push({\n ...route,\n path: localizedRoutePath(basePath, locale.code, i18n),\n basePath,\n locale: locale.code,\n virtualModuleId: virtualModuleIdFromRef(relative(contentRoot, route.filePath)),\n })\n }\n }\n\n if (i18n.missing === 'fallback') {\n const routeByLocaleAndBase = new Map(localizedRoutes.map(route => [`${route.locale ?? ''}:${route.basePath ?? route.path}`, route]))\n const defaultRoutes = localizedRoutes.filter(route => route.locale === i18n.defaultLocale)\n for (const sourceRoute of defaultRoutes) {\n const basePath = sourceRoute.basePath ?? sourceRoute.path\n for (const locale of i18n.locales) {\n const key = `${locale.code}:${basePath}`\n if (routeByLocaleAndBase.has(key)) continue\n localizedRoutes.push({\n ...sourceRoute,\n path: localizedRoutePath(basePath, locale.code, i18n),\n locale: locale.code,\n isFallback: true,\n })\n }\n }\n }\n\n return localizedRoutes.map(route => withAlternates(route, localizedRoutes, i18n))\n }\n\n async function resolveRoutesAndSpecs() {\n routes = await discoverRoutes()\n routes = await runHooks(clarifyPlugins, 'routes:discovered', routes, ctx)\n\n const defaultNavigation = projectConfig.i18n\n ? (buildLocalizedNavigation(routes, projectConfig.pages, projectConfig.i18n) ?? {})\n : projectConfig.pages && projectConfig.pages !== 'FileTree'\n ? buildNavigationFromConfig(routes, projectConfig.pages)\n : buildNavigation(routes)\n const resolved = await runHooks(clarifyPlugins, 'routes:resolved', { routes, navigation: defaultNavigation }, ctx)\n routes = resolved.routes\n resolvedNavigation = resolved.navigation\n ctx.routes = routes\n ctx.navigation = resolvedNavigation\n }\n\n async function rebuildVirtualModules() {\n virtualModules = buildVirtualModules({\n projectConfig,\n generateOptions,\n routes,\n navigation: resolvedNavigation,\n })\n virtualModules = await runHooks(clarifyPlugins, 'modules:before', virtualModules, ctx)\n }\n\n function invalidateVirtualModules(server: ViteDevServer) {\n for (const id of virtualModules.keys()) {\n const moduleNode = server.moduleGraph.getModuleById(resolveVirtualId(id))\n if (moduleNode) server.moduleGraph.invalidateModule(moduleNode)\n }\n }\n\n async function refreshDevServer(server: ViteDevServer) {\n await resolveRoutesAndSpecs()\n await rebuildVirtualModules()\n invalidateVirtualModules(server)\n server.ws.send({ type: 'full-reload' })\n }\n\n function hasContentRouteForFile(filePath: string): boolean {\n return routes.some(route => route.filePath === filePath)\n }\n\n const mdx = mdxPlugin({\n include: ['**/*.{md,mdx}'],\n jsxImportSource: 'react',\n providerImportSource: '@clarify-labs/renderer',\n remarkPlugins,\n rehypePlugins,\n })\n\n const clarifyCorePlugin: Plugin = {\n name: 'clarify:core',\n async config() {\n await resolveRoutesAndSpecs()\n\n return {\n base: projectConfig.routePrefix,\n build: {\n ...(generateOptions.outputDirectory ? { outDir: generateOptions.outputDirectory } : {}),\n manifest: true,\n },\n }\n },\n configResolved(config) {\n viteConfig = config\n // If user didn't specify outputDirectory, read it from Vite's resolved config\n if (!generateOptions.outputDirectory) {\n generateOptions.outputDirectory = config.build.outDir\n }\n },\n async buildStart() {\n await rebuildVirtualModules()\n },\n async handleHotUpdate(ctx) {\n const changedFile = isAbsolute(ctx.file) ? ctx.file : join(root, ctx.file)\n if (configFilePath && changedFile === configFilePath) {\n await reloadProjectConfig()\n await refreshDevServer(ctx.server)\n return []\n }\n\n const relativeContentFile = relative(contentRoot, changedFile)\n const isContentFile = relativeContentFile && !relativeContentFile.startsWith('..') && !isAbsolute(relativeContentFile)\n if (!isContentFile || !hasContentRouteForFile(changedFile)) return\n\n await refreshDevServer(ctx.server)\n return []\n },\n resolveId(id) {\n if (id === VIRTUAL_CLIENT_ENTRY || id === RESOLVED_CLIENT_ENTRY) return RESOLVED_CLIENT_ENTRY\n if (id === VIRTUAL_CONFIG || id === resolveVirtualId(VIRTUAL_CONFIG)) return resolveVirtualId(VIRTUAL_CONFIG)\n if (id === VIRTUAL_ROUTES || id === resolveVirtualId(VIRTUAL_ROUTES)) return resolveVirtualId(VIRTUAL_ROUTES)\n if (id === VIRTUAL_OPENAPI_REGISTRY || id === resolveVirtualId(VIRTUAL_OPENAPI_REGISTRY)) return resolveVirtualId(VIRTUAL_OPENAPI_REGISTRY)\n const route = routes.find(r => r.virtualModuleId === id || r.virtualModuleId === stripVirtualPrefix(id))\n if (route) return resolveVirtualId(route.virtualModuleId)\n return null\n },\n load(id) {\n return loadVirtualModule(id, virtualModules)\n },\n async configureServer(server) {\n server.watcher.add(contentRoot)\n if (configFilePath) {\n server.watcher.add(configFilePath)\n }\n\n const handleContentTreeChange = async (filePath: string) => {\n const changedFile = isAbsolute(filePath) ? filePath : join(root, filePath)\n const relativeContentFile = relative(contentRoot, changedFile)\n const isContentFile = relativeContentFile && !relativeContentFile.startsWith('..') && !isAbsolute(relativeContentFile)\n if (!isContentFile) return\n await refreshDevServer(server)\n }\n\n server.watcher.on('add', handleContentTreeChange)\n server.watcher.on('unlink', handleContentTreeChange)\n await runDevConfigureServerHooks(clarifyPlugins, server, ctx)\n },\n transformIndexHtml: {\n order: 'pre',\n async handler(html, transformCtx) {\n // In dev mode, use /@id/ prefix so Vite dev server can resolve the virtual module.\n // In build mode, use the bare virtual: ID so Vite's HTML build pipeline resolves it via resolveId.\n const clientEntryId = transformCtx.server\n ? `/@id/${VIRTUAL_CLIENT_ENTRY}`\n : VIRTUAL_CLIENT_ENTRY\n const result = await runHooks(clarifyPlugins, 'html:transform', {\n html,\n tags: [],\n clientEntryId,\n dev: Boolean(transformCtx.server),\n }, ctx)\n return {\n html: result.html,\n tags: result.tags,\n }\n }\n },\n async closeBundle() {\n // ── Phase 1: Static HTML Generation ──\n if (process.env.SKIP_CLARIFY_SSG) {\n await runBuildDoneHooks(clarifyPlugins, ctx)\n return\n }\n\n const outputDir = viteConfig.build.outDir\n const ssrOutputDir = join(outputDir, '.ssr')\n let tempEntryPath: string | undefined\n\n try {\n tempEntryPath = createTempEntryFile(SSR_ENTRY_CODE)\n\n await buildSSRBundle(root, tempEntryPath, ssrOutputDir, [\n {\n name: 'clarify:virtual-ssg',\n resolveId(id) {\n if (id === VIRTUAL_CLIENT_ENTRY) return RESOLVED_CLIENT_ENTRY\n if (id === RESOLVED_CLIENT_ENTRY) return RESOLVED_CLIENT_ENTRY\n if (id === VIRTUAL_CONFIG) return id\n if (id === VIRTUAL_ROUTES) return id\n if (id === VIRTUAL_OPENAPI_REGISTRY) return id\n const route = routes.find(r => r.virtualModuleId === id)\n if (route) return id\n return null\n },\n load: id => loadVirtualModule(id, virtualModules),\n },\n mdx,\n ])\n\n const ssrBundlePath = join(ssrOutputDir, 'entry-server.js')\n await renderSSGRoutes(routes, projectConfig, outputDir, ssrBundlePath, generateOptions.ssg.failOnError)\n } catch (err) {\n console.error('[clarify] SSG failed:', err)\n if (generateOptions.ssg.failOnError) {\n throw err\n }\n } finally {\n if (tempEntryPath) {\n try {\n rmSync(tempEntryPath, { force: true })\n } catch {\n // ignore cleanup errors\n }\n }\n }\n\n await runBuildDoneHooks(clarifyPlugins, ctx)\n },\n }\n\n return [react(), tailwindcss(), clarifyCorePlugin, mdx].flat().filter(Boolean) as Plugin[]\n}\n\nexport type { Plugin } from 'vite'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAgB,WAAW,MAAsB;CAC/C,OAAO,KACJ,QAAQ,MAAM,OAAO,EACrB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,QAAQ,EACtB,QAAQ,MAAM,OAAO;AAC1B;;;ACaA,SAAS,YAAY,WAA4B;CAG/C,QAFgB,MAAM,QAAQ,SAAS,IAAI,YAAY,OAAO,cAAc,WAAW,UAAU,MAAM,KAAK,IAAI,CAAC,GACnF,MAAM,SAAyB,OAAO,SAAS,YAAY,KAAK,WAAW,WAAW,CAC7G,GAAe,QAAQ,cAAc,EAAE,KAAK;AACrD;AAEA,SAAS,eAAe,MAAoC;CAC1D,IAAI,CAAC,MAAM,OAAO;CAClB,IAAI,OAAO,KAAK,UAAU,UAA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,CAAC;KAED,MAAM,iBAAA,GAAA,UAAA,MAAqB,cAAc,iBAAiB;KAC1D,MAAM,gBAAgB,QAAQ,eAAe,WAAW,eAAe,gBAAgB,IAAI,WAAW;IACxG,SAAS,KAAK;KACZ,QAAQ,MAAM,yBAAyB,GAAG;KAC1C,IAAI,gBAAgB,IAAI,aACtB,MAAM;IAEV,UAAU;KACR,IAAI,eACF,IAAI;MACF,CAAA,GAAA,QAAA,QAAO,eAAe,EAAE,OAAO,KAAK,CAAC;KACvC,QAAQ,CAER;IAEJ;IAEA,MAAM,kBAAkB,gBAAgB,GAAG;GAC7C;EAG8B;EAAmB;CAAG,EAAE,KAAK,EAAE,OAAO,OAAO;AAC/E"}
@@ -0,0 +1,2 @@
1
+ import { ClarifyPlugin } from '../../types.js';
2
+ export declare function createContentArtifactsPlugin(): ClarifyPlugin;
@@ -0,0 +1,8 @@
1
+ import { ContentRoute, ResolvedProjectConfig } from '../../types.js';
2
+ export declare function routeToMarkdownUrl(routePath: string): string;
3
+ export declare function routeToOpenAPIUrl(routePath: string, filePath: string): string;
4
+ export declare function enrichRoutesWithRawContent(routes: ContentRoute[]): void;
5
+ export declare function readRawContent(route: ContentRoute): string;
6
+ export declare function writeRawContentFiles(routes: ContentRoute[], outputDirectory: string): void;
7
+ export declare function createLlmsTxt(routes: ContentRoute[], projectConfig: ResolvedProjectConfig): string;
8
+ export declare function writeLlmsTxt(routes: ContentRoute[], projectConfig: ResolvedProjectConfig, outputDirectory: string): void;
@@ -0,0 +1,5 @@
1
+ import { IncomingMessage, ServerResponse } from 'node:http';
2
+ import { ContentRoute, ResolvedProjectConfig } from '../../types.js';
3
+ export declare function resolveContentArtifactPath(url: string | undefined, projectConfig: ResolvedProjectConfig): string;
4
+ export declare function resolveRawContentType(route: ContentRoute): string;
5
+ export declare function serveContentArtifacts(req: IncomingMessage, res: ServerResponse, projectConfig: ResolvedProjectConfig, routes: ContentRoute[]): boolean;
@@ -0,0 +1,2 @@
1
+ import { ClarifyPlugin } from '../../types.js';
2
+ export declare function createHtmlShellPlugin(): ClarifyPlugin;
@@ -0,0 +1,2 @@
1
+ import { ClarifyPlugin } from '../../types.js';
2
+ export declare function createOpenAPIPlugin(): ClarifyPlugin;
@@ -0,0 +1,5 @@
1
+ import { ContentRoute, ContentSection, OpenAPISpec } from '../../types.js';
2
+ export declare function findOpenAPIRoutes(dir: string, base?: string): ContentRoute[];
3
+ /** Extract endpoint operations from an OpenAPI spec as page sections. */
4
+ export declare function extractOpenAPISections(spec: OpenAPISpec): ContentSection[];
5
+ export declare function readOpenAPISpec(filePath: string): Promise<OpenAPISpec | null>;
@@ -0,0 +1,4 @@
1
+ import { OpenAPISpec } from '../../types.js';
2
+ export declare const openApiRegistryModuleId = "virtual:clarify-openapi-registry";
3
+ export declare function generateOpenAPIRegistryModule(openApis: Record<string, OpenAPISpec>): string;
4
+ export declare function generateOpenAPIModule(spec: OpenAPISpec): string;
@@ -0,0 +1,191 @@
1
+ import { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
2
+ import { HtmlTagDescriptor, ViteDevServer } from 'vite';
3
+ import { ResolvedBuildOptions } from './core/options.js';
4
+ export type { ClarifyBuildOptions, ResolvedBuildOptions, } from './core/options.js';
5
+ export type OpenAPISpec = OpenAPIV3.Document | OpenAPIV3_1.Document;
6
+ export type ClarifyLogoConfig = string | {
7
+ light?: string;
8
+ dark?: string;
9
+ };
10
+ export type ClarifyFaviconConfig = string | {
11
+ light?: string;
12
+ dark?: string;
13
+ };
14
+ export type ClarifyLocalizedText = string | Record<string, string>;
15
+ export type ClarifyLocaleConfig = {
16
+ code: string;
17
+ label: string;
18
+ dir?: 'ltr' | 'rtl';
19
+ };
20
+ export type ClarifyI18nConfig = {
21
+ /** Default visible locale. Content is read from rootDirectory/defaultLocale. */
22
+ defaultLocale?: string;
23
+ /** Missing translation behavior. Fallback uses default locale content. */
24
+ missing?: 'fallback' | '404' | 'hide';
25
+ locales: ClarifyLocaleConfig[];
26
+ };
27
+ export type ResolvedClarifyI18nConfig = Required<Pick<ClarifyI18nConfig, 'defaultLocale' | 'missing'>> & {
28
+ locales: ClarifyLocaleConfig[];
29
+ };
30
+ export type ClarifyNavbarLink = {
31
+ label: ClarifyLocalizedText;
32
+ href: string;
33
+ external?: boolean;
34
+ };
35
+ export type ClarifyBannerConfig = {
36
+ content: ClarifyLocalizedText;
37
+ dismissible?: boolean;
38
+ };
39
+ export type ClarifyFooterConfig = {
40
+ links?: ClarifyNavbarLink[];
41
+ socials?: Record<string, string>;
42
+ copyright?: ClarifyLocalizedText;
43
+ };
44
+ export type ClarifyPagesItem = string | {
45
+ page: string;
46
+ /** Override the page title. Defaults to localized route title. */
47
+ title?: ClarifyLocalizedText;
48
+ /** Icon name from lucide-react, e.g. "BookOpen". */
49
+ icon?: string;
50
+ /** If set, this navigation item is a redirect entry.
51
+ * The value is treated as a locale-independent page path for internal links. */
52
+ redirect?: string;
53
+ } | {
54
+ openapi: string;
55
+ /** Icon name from lucide-react, e.g. "Webhook". */
56
+ icon?: string;
57
+ /** Override the page title. Defaults to spec.info.title. */
58
+ title?: ClarifyLocalizedText;
59
+ };
60
+ export type ClarifyPagesGroup = {
61
+ group: ClarifyLocalizedText;
62
+ /** Icon name from lucide-react, e.g. "BookOpen". */
63
+ icon?: string;
64
+ pages: ClarifyPagesItem[];
65
+ };
66
+ /** Use the string "FileTree" to auto-generate pages from the file system. */
67
+ export type ClarifyPagesConfig = ClarifyPagesGroup[] | 'FileTree';
68
+ export type ClarifyProjectConfig = {
69
+ /** Site title. Used in Header and SEO meta tags. */
70
+ title?: string;
71
+ /** Site description. Used in SEO meta tags. */
72
+ description?: string;
73
+ /** Path to site logo image (relative to rootDirectory or absolute). Supports light/dark mode. */
74
+ logo?: ClarifyLogoConfig;
75
+ /** Favicon path or light/dark variants. */
76
+ favicon?: ClarifyFaviconConfig;
77
+ /** Theme token overrides. */
78
+ theme?: {
79
+ primary?: string;
80
+ };
81
+ /** Base path for the docs site. Default: '/' */
82
+ routePrefix?: string;
83
+ /** Top navigation links. */
84
+ navbar?: {
85
+ links?: ClarifyNavbarLink[];
86
+ };
87
+ /** Announcement banner displayed at the top of the page. */
88
+ banner?: ClarifyBannerConfig;
89
+ /** Footer configuration. */
90
+ footer?: ClarifyFooterConfig;
91
+ /** Native multi-language support. Locale content lives under rootDirectory/{locale}. */
92
+ i18n?: ClarifyI18nConfig;
93
+ /** Sidebar pages. Array of groups with ordered page references, or "FileTree" for auto-generation.
94
+ * If omitted, pages are auto-generated from the file system (same as "FileTree").
95
+ * Page references are locale-independent paths without .mdx extension, e.g. "index", "advanced/ssg".
96
+ */
97
+ pages?: ClarifyPagesConfig;
98
+ };
99
+ export type ResolvedProjectConfig = {
100
+ title: string;
101
+ logo?: ClarifyLogoConfig;
102
+ favicon?: ClarifyFaviconConfig;
103
+ theme: {
104
+ primary?: string;
105
+ };
106
+ description: string;
107
+ routePrefix: string;
108
+ navbar?: {
109
+ links?: ClarifyNavbarLink[];
110
+ };
111
+ banner?: ClarifyBannerConfig;
112
+ footer?: ClarifyFooterConfig;
113
+ i18n?: ResolvedClarifyI18nConfig;
114
+ pages?: ClarifyPagesConfig;
115
+ };
116
+ export type ContentSection = {
117
+ id: string;
118
+ title: string;
119
+ level: number;
120
+ badge?: string;
121
+ tags?: string[];
122
+ };
123
+ export type ContentRoute = {
124
+ path: string;
125
+ basePath?: string;
126
+ locale?: string;
127
+ isFallback?: boolean;
128
+ alternates?: Record<string, string>;
129
+ title: string;
130
+ filePath: string;
131
+ virtualModuleId: string;
132
+ kind: 'mdx' | 'openapi';
133
+ sections?: ContentSection[];
134
+ rawContentUrl?: string;
135
+ };
136
+ export type LocalizedNavigation = Record<string, ClarifyNavigationNode[]>;
137
+ export type NavigationTree = ClarifyNavigationNode[] | LocalizedNavigation;
138
+ export type ClarifyPage = {
139
+ path: string;
140
+ filePath: string;
141
+ frontmatter: Record<string, unknown>;
142
+ content: string;
143
+ };
144
+ export type ClarifyNavigationNode = {
145
+ path: string;
146
+ title: string;
147
+ icon?: string;
148
+ children?: ClarifyNavigationNode[];
149
+ sections?: Pick<ContentSection, 'id' | 'title' | 'badge' | 'tags'>[];
150
+ };
151
+ export type ClarifyHookContext = {
152
+ projectConfig: ResolvedProjectConfig;
153
+ generateOptions: ResolvedBuildOptions;
154
+ routes: ContentRoute[];
155
+ navigation: NavigationTree;
156
+ };
157
+ export type ClarifyRouteDiscoveryInput = {
158
+ contentRoot: string;
159
+ locale?: string;
160
+ routes: ContentRoute[];
161
+ };
162
+ export type ClarifyHtmlTransformInput = {
163
+ html: string;
164
+ tags: HtmlTagDescriptor[];
165
+ clientEntryId: string;
166
+ dev: boolean;
167
+ };
168
+ export type ClarifyHooks = {
169
+ 'pages:resolved'?: (pages: ClarifyPage[], ctx: ClarifyHookContext) => Promise<ClarifyPage[]> | ClarifyPage[];
170
+ 'page:transform'?: (page: ClarifyPage, ctx: ClarifyHookContext) => Promise<ClarifyPage> | ClarifyPage;
171
+ 'routes:discover'?: (input: ClarifyRouteDiscoveryInput, ctx: ClarifyHookContext) => Promise<ClarifyRouteDiscoveryInput> | ClarifyRouteDiscoveryInput;
172
+ 'routes:discovered'?: (routes: ContentRoute[], ctx: ClarifyHookContext) => Promise<ContentRoute[]> | ContentRoute[];
173
+ 'routes:resolved'?: (input: {
174
+ routes: ContentRoute[];
175
+ navigation: NavigationTree;
176
+ }, ctx: ClarifyHookContext) => Promise<{
177
+ routes: ContentRoute[];
178
+ navigation: NavigationTree;
179
+ }> | {
180
+ routes: ContentRoute[];
181
+ navigation: NavigationTree;
182
+ };
183
+ 'modules:before'?: (modules: Map<string, string>, ctx: ClarifyHookContext) => Promise<Map<string, string>> | Map<string, string>;
184
+ 'html:transform'?: (input: ClarifyHtmlTransformInput, ctx: ClarifyHookContext) => Promise<ClarifyHtmlTransformInput> | ClarifyHtmlTransformInput;
185
+ 'dev:configureServer'?: (server: ViteDevServer, ctx: ClarifyHookContext) => Promise<void> | void;
186
+ 'build:done'?: (ctx: ClarifyHookContext) => Promise<void> | void;
187
+ };
188
+ export type ClarifyPlugin = {
189
+ name: string;
190
+ hooks: Partial<ClarifyHooks>;
191
+ };
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@clarify-labs/cli",
3
+ "version": "0.1.0",
4
+ "license": "AGPL-3.0-only",
5
+ "type": "module",
6
+ "main": "output/index.cjs",
7
+ "module": "output/index.js",
8
+ "types": "output/index.d.ts",
9
+ "bin": {
10
+ "clarify": "bin/clarify.js"
11
+ },
12
+ "exports": {
13
+ ".": {
14
+ "types": "./output/index.d.ts",
15
+ "import": "./output/index.js",
16
+ "require": "./output/index.cjs",
17
+ "default": "./output/index.js"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "files": [
22
+ "LICENSE",
23
+ "bin",
24
+ "output"
25
+ ],
26
+ "scripts": {
27
+ "dev": "vite build --watch",
28
+ "build": "vite build",
29
+ "lint": "eslint source/",
30
+ "lint:fix": "eslint source/ --fix",
31
+ "typecheck": "tsc -p tsconfig.json --noEmit",
32
+ "test": "vitest run",
33
+ "test:watch": "vitest"
34
+ },
35
+ "dependencies": {
36
+ "@apidevtools/swagger-parser": "^12.1.0",
37
+ "@clarify-labs/renderer": "workspace:*",
38
+ "@mdx-js/rollup": "^3.1.1",
39
+ "@tailwindcss/vite": "^4.1.11",
40
+ "@vitejs/plugin-react": "^6.0.2",
41
+ "cac": "^7.0.0",
42
+ "github-slugger": "^2.0.0",
43
+ "gray-matter": "^4.0.3",
44
+ "mdast-util-to-string": "^4.0.0",
45
+ "openapi-types": "^12.1.3",
46
+ "react": "^19.1.0",
47
+ "react-dom": "^19.1.0",
48
+ "react-router-dom": "^7.0.0",
49
+ "remark": "^15.0.1",
50
+ "remark-gfm": "^4.0.1",
51
+ "shiki": "0.14.7",
52
+ "unist-util-visit": "^5.1.0",
53
+ "vite": "^8.0.15",
54
+ "zod": "^4.4.3"
55
+ },
56
+ "devDependencies": {
57
+ "@mdx-js/mdx": "^3.1.1",
58
+ "@types/github-slugger": "^2.0.0",
59
+ "typescript": "^5.8.3",
60
+ "vite-plugin-dts": "^4.5.4",
61
+ "vitest": "^4.1.9"
62
+ }
63
+ }