@clarify-labs/cli 0.6.4 → 0.6.5

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/output/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../source/core/log.ts","../source/core/vite-config.ts","../source/cli/commands/build.ts","../source/cli/commands/dev.ts","../package.json","../source/cli/package.ts","../source/cli/spawn.ts","../source/cli/commands/init.ts","../source/cli/options.ts","../source/cli/index.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { readFile, writeFile } from 'node:fs/promises'\nimport { dirname, join } from 'node:path'\n\nconst LOG_FILE_NAME = '.clarify.log'\nconst DEFAULT_LOG_ENTRIES = 50\nconst ENTRY_SEPARATOR = '\\n\\n---\\n\\n'\n\nfunction getMaxLogEntries(): number {\n const envValue = process.env.CLARIFY_LOG_MAX_ENTRIES\n if (!envValue) return DEFAULT_LOG_ENTRIES\n const parsed = Number(envValue)\n return Number.isInteger(parsed) && parsed > 0 ? parsed : DEFAULT_LOG_ENTRIES\n}\n\nfunction normalizeErrorMessage(error: unknown): string {\n if (error === undefined) return 'undefined'\n if (error === null) return 'null'\n if (error instanceof Error) return error.message\n if (typeof error === 'object') {\n if ('message' in error && typeof (error as { message?: unknown }).message === 'string') {\n return (error as { message: string }).message\n }\n try {\n return JSON.stringify(error)\n } catch {\n return String(error)\n }\n }\n return String(error)\n}\n\nfunction normalizeErrorStack(error: unknown): string | undefined {\n if (error instanceof Error) {\n return error.stack\n }\n return undefined\n}\n\nfunction formatLogEntry(root: string, error: unknown): string {\n const timestamp = new Date().toISOString()\n const message = normalizeErrorMessage(error)\n const stack = normalizeErrorStack(error)\n\n return [`=== Clarify build error ===`, `Timestamp: ${timestamp}`, `Project root: ${root}`, `Error: ${message}`, stack ? `Stack:\\n${stack}` : undefined]\n .filter(Boolean)\n .join('\\n')\n}\n\nexport async function logBuildError(root: string, error: unknown, maxEntries?: number): Promise<void> {\n const logPath = join(root, LOG_FILE_NAME)\n const entry = formatLogEntry(root, error)\n const max = maxEntries ?? getMaxLogEntries()\n\n let entries: string[] = []\n if (existsSync(logPath)) {\n try {\n const content = await readFile(logPath, 'utf8')\n entries = content\n .split(ENTRY_SEPARATOR)\n .map((item) => item.trim())\n .filter(Boolean)\n } catch {\n entries = []\n }\n }\n\n entries.push(entry)\n if (entries.length > max) {\n entries = entries.slice(-max)\n }\n\n mkdirSync(dirname(logPath), { recursive: true })\n await writeFile(logPath, entries.join(ENTRY_SEPARATOR) + '\\n', 'utf8')\n}\n\nexport function logBuildErrorSync(root: string, error: unknown, maxEntries?: number): void {\n const logPath = join(root, LOG_FILE_NAME)\n const entry = formatLogEntry(root, error)\n const max = maxEntries ?? getMaxLogEntries()\n\n let entries: string[] = []\n if (existsSync(logPath)) {\n try {\n const content = readFileSync(logPath, 'utf8')\n entries = content\n .split(ENTRY_SEPARATOR)\n .map((item) => item.trim())\n .filter(Boolean)\n } catch {\n entries = []\n }\n }\n\n entries.push(entry)\n if (entries.length > max) {\n entries = entries.slice(-max)\n }\n\n mkdirSync(dirname(logPath), { recursive: true })\n writeFileSync(logPath, entries.join(ENTRY_SEPARATOR) + '\\n', 'utf8')\n}\n","import { existsSync, mkdirSync, writeFileSync } from 'node:fs'\nimport { dirname, resolve } from 'node:path'\n\nimport { createLogger } from 'vite'\nimport type { ConfigEnv, InlineConfig, Plugin, LogLevel, Logger, LogOptions, LogErrorOptions, LogType } from 'vite'\n\nimport { logBuildErrorSync } from './log.js'\nimport type { ClarifyBuildOptions } from './options.js'\nimport { clarifyPlugin } from './plugin.js'\nimport { createClarifyRuntimeAliases } from './runtime-deps.js'\nimport { loadClarifyConfig } from './user-config.js'\n\nexport type ClarifyViteConfigOptions = {\n root: string\n content: string\n output: string\n host?: string | boolean\n port?: number\n open?: boolean | string\n}\n\nconst DEFAULT_HTML = '<!doctype html><html lang=\"en\"><head><meta charset=\"UTF-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /><title>Clarify</title></head><body><div id=\"root\"></div></body></html>'\n\nfunction ensureHtmlEntry(root: string): string {\n const projectHtmlPath = resolve(root, 'index.html')\n if (existsSync(projectHtmlPath)) return projectHtmlPath\n\n const generatedHtmlPath = resolve(root, '.clarify/index.html')\n mkdirSync(dirname(generatedHtmlPath), { recursive: true })\n writeFileSync(generatedHtmlPath, DEFAULT_HTML, 'utf-8')\n return generatedHtmlPath\n}\n\nfunction createClarifyLogger(root: string, env: ConfigEnv, level: LogLevel): Logger | undefined {\n if (env.command !== 'build') return undefined\n\n const baseLogger = createLogger(level, { allowClearScreen: true })\n\n return {\n info(msg: string, options?: LogOptions) {\n baseLogger.info(msg, options)\n },\n warn(msg: string, options?: LogOptions) {\n baseLogger.warn(msg, options)\n },\n warnOnce(msg: string, options?: LogOptions) {\n baseLogger.warnOnce(msg, options)\n },\n error(msg: string, options?: LogErrorOptions) {\n baseLogger.error(msg, options)\n if (options?.error) {\n logBuildErrorSync(root, options.error)\n } else {\n logBuildErrorSync(root, typeof msg === 'string' ? new Error(msg) : msg)\n }\n },\n clearScreen(type: LogType) {\n baseLogger.clearScreen(type)\n },\n hasErrorLogged(error: Error | unknown) {\n return baseLogger.hasErrorLogged(error as Error)\n },\n get hasWarned() {\n return baseLogger.hasWarned\n },\n }\n}\n\nfunction createHtmlFallbackPlugin(): Plugin {\n return {\n name: 'clarify:cli-html-fallback',\n configureServer(server) {\n server.middlewares.use(async (req, res, next) => {\n const requestPath = req.url?.split('?')[0] ?? '/'\n const acceptsHtml = req.headers.accept?.includes('text/html') ?? false\n const hasFileExtension = /\\.[^/]+$/.test(requestPath)\n if (!acceptsHtml || hasFileExtension) {\n next()\n return\n }\n\n try {\n const html = await server.transformIndexHtml(requestPath, DEFAULT_HTML)\n res.statusCode = 200\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n res.end(html)\n } catch (error) {\n next(error)\n }\n })\n },\n }\n}\n\nexport async function createViteConfig(options: ClarifyViteConfigOptions, env: ConfigEnv): Promise<InlineConfig> {\n const entryHtmlPath = ensureHtmlEntry(options.root)\n const userConfig = await loadClarifyConfig(options.root, env)\n const buildOptions: ClarifyBuildOptions = {\n ...userConfig,\n projectRoot: options.root,\n rootDirectory: options.content,\n outputDirectory: options.output,\n }\n\n return {\n root: options.root,\n configFile: false,\n appType: 'custom',\n resolve: {\n alias: createClarifyRuntimeAliases(),\n },\n customLogger: createClarifyLogger(options.root, env, 'info'),\n plugins: [\n clarifyPlugin(buildOptions),\n createHtmlFallbackPlugin(),\n ],\n server: {\n host: options.host,\n port: options.port,\n open: options.open,\n },\n build: {\n outDir: options.output,\n rolldownOptions: {\n input: {\n index: entryHtmlPath,\n },\n checks: {\n pluginTimings: false,\n },\n output: {\n codeSplitting: {\n groups: [\n {\n name: 'react-vendor',\n test: /node_modules[\\\\/](react|react-dom|react-router|react-router-dom)[\\\\/]/,\n priority: 40,\n },\n {\n name: 'icons-vendor',\n test: /node_modules[\\\\/]lucide-react[\\\\/]/,\n priority: 35,\n },\n {\n name: 'ui-vendor',\n test: /node_modules[\\\\/](@headlessui|framer-motion)[\\\\/]/,\n priority: 30,\n },\n {\n name: 'vendor',\n test: /node_modules[\\\\/]/,\n priority: 10\n },\n ],\n },\n },\n },\n },\n }\n}\n","import { build as viteBuild } from 'vite'\n\nimport { logBuildError } from '../../core/log.js'\nimport { createViteConfig } from '../../core/vite-config.js'\nimport type { ResolvedCliOptions } from '../options.js'\n\nexport async function runBuild(options: ResolvedCliOptions): Promise<void> {\n try {\n await viteBuild(await createViteConfig(options, { command: 'build', mode: 'production' }))\n } catch (error) {\n await logBuildError(options.root, error)\n throw error\n }\n}\n","import { createServer } from 'vite'\n\nimport { createViteConfig } from '../../core/vite-config.js'\nimport type { ResolvedCliOptions } from '../options.js'\n\nexport async function runDev(options: ResolvedCliOptions): Promise<void> {\n const server = await createServer(await createViteConfig(options, { command: 'serve', mode: 'development' }))\n await server.listen()\n server.printUrls()\n server.bindCLIShortcuts({ print: true })\n}\n","{\n \"name\": \"@clarify-labs/cli\",\n \"version\": \"0.6.4\",\n \"license\": \"AGPL-3.0-only\",\n \"type\": \"module\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/taicode-labs/clarify\",\n \"directory\": \"packages/cli\"\n },\n \"main\": \"output/index.cjs\",\n \"module\": \"output/index.js\",\n \"types\": \"output/index.d.ts\",\n \"bin\": {\n \"clarify\": \"bin/clarify.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./output/index.d.ts\",\n \"import\": \"./output/index.js\",\n \"require\": \"./output/index.cjs\",\n \"default\": \"./output/index.js\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"LICENSE\",\n \"bin\",\n \"output\"\n ],\n \"scripts\": {\n \"dev\": \"vite build --watch\",\n \"build\": \"vite build\",\n \"lint\": \"eslint source/\",\n \"lint:fix\": \"eslint source/ --fix\",\n \"typecheck\": \"tsc -p tsconfig.json --noEmit\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\"\n },\n \"dependencies\": {\n \"@apidevtools/swagger-parser\": \"^12.1.0\",\n \"@clarify-labs/renderer\": \"workspace:*\",\n \"@clarify-labs/templates\": \"workspace:*\",\n \"@mdx-js/rollup\": \"^3.1.1\",\n \"@tailwindcss/vite\": \"^4.1.11\",\n \"@vitejs/plugin-react\": \"^6.0.2\",\n \"cac\": \"^7.0.0\",\n \"github-slugger\": \"^2.0.0\",\n \"gray-matter\": \"^4.0.3\",\n \"mdast-util-to-string\": \"^4.0.0\",\n \"openapi-types\": \"^12.1.3\",\n \"react\": \"^19.1.0\",\n \"react-dom\": \"^19.1.0\",\n \"react-router\": \"^7.0.0\",\n \"react-router-dom\": \"^7.0.0\",\n \"remark\": \"^15.0.1\",\n \"remark-gfm\": \"^4.0.1\",\n \"shiki\": \"0.14.7\",\n \"unist-util-visit\": \"^5.1.0\",\n \"vite\": \"^8.0.15\",\n \"zod\": \"^4.4.3\"\n },\n \"devDependencies\": {\n \"@mdx-js/mdx\": \"^3.1.1\",\n \"typescript\": \"^5.8.3\",\n \"vite-plugin-dts\": \"^4.5.4\",\n \"vitest\": \"^4.1.9\"\n }\n}\n","import packageJson from '../../package.json' with { type: 'json' }\n\nexport const cliPackageJson = packageJson as { version?: string }\nexport const cliPackageVersion = cliPackageJson.version ?? '0.0.0'\nexport const cliPackageVersionWithCaret = `^${cliPackageVersion}`\n\nexport function readPackageVersion(): string {\n return cliPackageVersion\n}\n","import { spawnSync as nodeSpawnSync, SpawnSyncOptions } from 'node:child_process'\n\ntype SpawnOptions = { cwd?: string; stdio?: 'inherit' | 'ignore' | Array<string> }\n\nexport function spawnSync(command: string, args: string[], options: SpawnOptions) {\n return nodeSpawnSync(command, args, options as SpawnSyncOptions)\n}\n","import { existsSync, readFileSync, writeFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { dirname, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport { copyTemplateDirectory, getTemplateDirectory, resolveTemplate } from '@clarify-labs/templates'\n\nimport type { ResolvedCliOptions } from '../options.js'\nimport { cliPackageVersionWithCaret } from '../package.js'\nimport { spawnSync } from '../spawn.js'\n\nconst require = createRequire(import.meta.url)\n\nfunction findTemplatesPackagePath(): string {\n try {\n return require.resolve('@clarify-labs/templates/package.json')\n } catch {\n const currentDirectory = dirname(fileURLToPath(import.meta.url))\n const workspacePackagePath = resolve(currentDirectory, '../../../../templates/package.json')\n if (existsSync(workspacePackagePath)) return workspacePackagePath\n throw new Error('[clarify] Templates package not found.')\n }\n}\n\nconst templatesPackagePath = findTemplatesPackagePath()\nconst templatesDirectory = dirname(templatesPackagePath)\n\nfunction commandExists(program: string): boolean {\n const result = spawnSync(program, ['--version'], { stdio: 'ignore' })\n return result.status === 0 && result.error === undefined\n}\n\ntype InstallCommand = { command: string; args: string[] }\n\nfunction getInstallCommand(): InstallCommand {\n if (commandExists('pnpm')) return { command: 'pnpm', args: ['install'] }\n if (commandExists('npm')) return { command: 'npm', args: ['install'] }\n if (commandExists('yarn')) return { command: 'yarn', args: ['install'] }\n return { command: 'npm', args: ['install'] }\n}\n\nfunction installDependencies(root: string): void {\n const { command, args } = getInstallCommand()\n console.log(`[clarify] Installing dependencies with ${command}...`)\n const result = spawnSync(command, args, { cwd: root, stdio: 'inherit' })\n if (result.status !== 0) {\n throw new Error(`[clarify] Dependency install failed with ${command}`)\n }\n}\n\nfunction getSuggestedInstallCommand(): string {\n if (commandExists('pnpm')) return 'pnpm install'\n if (commandExists('npm')) return 'npm install'\n if (commandExists('yarn')) return 'yarn install'\n return 'npm install'\n}\n\nfunction updatePackageJson(root: string, force: boolean): boolean {\n const packageJsonPath = resolve(root, 'package.json')\n const packageJson = existsSync(packageJsonPath)\n ? JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as Record<string, unknown>\n : { type: 'module' }\n\n const scripts = typeof packageJson.scripts === 'object' && packageJson.scripts !== null\n ? packageJson.scripts as Record<string, string>\n : {}\n\n if (force || !scripts.dev) scripts.dev = 'clarify dev'\n if (force || !scripts.build) scripts.build = 'clarify build'\n packageJson.scripts = scripts\n\n const devDependencies = typeof packageJson.devDependencies === 'object' && packageJson.devDependencies !== null\n ? packageJson.devDependencies as Record<string, string>\n : {}\n if (!devDependencies['@clarify-labs/cli']) devDependencies['@clarify-labs/cli'] = cliPackageVersionWithCaret\n packageJson.devDependencies = devDependencies\n\n writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\\n`, 'utf-8')\n return true\n}\n\nexport function runInit(options: ResolvedCliOptions, force: boolean, template?: string, install = false): void {\n const selectedTemplate = resolveTemplate(template)\n const templateDirectory = getTemplateDirectory(templatesDirectory, selectedTemplate)\n const { created } = copyTemplateDirectory(templateDirectory, options.root, {\n contentDir: options.content,\n force,\n })\n\n const packageJsonUpdated = updatePackageJson(options.root, force)\n if (packageJsonUpdated) created.push('package.json')\n\n console.log(`[clarify] Project scaffold created using the ${selectedTemplate} template.`)\n if (created.length > 0) {\n console.log(`[clarify] Created or updated ${created.length} ${created.length === 1 ? 'file' : 'files'}: ${created.join(', ')}`)\n }\n\n if (install) {\n installDependencies(options.root)\n console.log('[clarify] Dependencies installed successfully.')\n console.log('[clarify] You can now run `clarify dev` to start the local documentation server.')\n return\n }\n\n const suggestedInstall = getSuggestedInstallCommand()\n console.log('[clarify] Next steps:')\n console.log(' 1. Change into your new project directory:')\n console.log(` cd ${options.root}`)\n console.log(' 2. Install dependencies:')\n console.log(` ${suggestedInstall}`)\n console.log(' 3. Start the local documentation server:')\n console.log(' clarify dev')\n}\n","import { resolve } from 'node:path'\n\nexport type CliOptions = {\n root?: string\n content?: string\n output?: string\n host?: string | boolean\n port?: string | number\n open?: boolean | string\n}\n\nexport type ResolvedCliOptions = {\n root: string\n content: string\n output: string\n host?: string | boolean\n port?: number\n open?: boolean | string\n}\n\nfunction resolvePort(port: CliOptions['port']): number | undefined {\n if (port === undefined) return undefined\n\n const parsedPort = typeof port === 'string' ? Number(port) : port\n if (!Number.isInteger(parsedPort) || parsedPort < 1 || parsedPort > 65535) {\n throw new Error('[clarify] --port must be an integer between 1 and 65535')\n }\n\n return parsedPort\n}\n\nexport function resolveCliOptions(options: CliOptions): ResolvedCliOptions {\n return {\n root: resolve(options.root ?? process.cwd()),\n content: options.content ?? 'source',\n output: options.output ?? 'output',\n host: options.host,\n port: resolvePort(options.port),\n open: options.open,\n }\n}\n","#!/usr/bin/env node\nimport { cac } from 'cac'\n\nimport { runBuild } from './commands/build.js'\nimport { runDev } from './commands/dev.js'\nimport { runInit } from './commands/init.js'\nimport { resolveCliOptions, type CliOptions, type ResolvedCliOptions } from './options.js'\nimport { cliPackageVersion } from './package.js'\n\ntype InitCommandOptions = CliOptions & {\n force?: boolean\n template?: string\n install?: boolean\n}\n\nfunction withSharedOptions(command: ReturnType<ReturnType<typeof cac>['command']>) {\n return command\n .option('--root <dir>', 'Project root directory')\n .option('--content <dir>', 'Content directory relative to root')\n .option('--output <dir>', 'Build output directory relative to root')\n}\n\nfunction resolveOptions(options: CliOptions): ResolvedCliOptions {\n return resolveCliOptions(options)\n}\n\nasync function main(): Promise<void> {\n const cli = cac('clarify')\n\n cli\n .version(cliPackageVersion)\n .help()\n\n withSharedOptions(cli.command('dev', 'Start the local documentation server'))\n .option('--host [host]', 'Dev server host')\n .option('--port <port>', 'Dev server port')\n .option('--open [path]', 'Open the dev server in a browser')\n .action(async (options: CliOptions) => {\n await runDev(resolveOptions(options))\n })\n\n withSharedOptions(cli.command('build', 'Build the static documentation site'))\n .action(async (options: CliOptions) => {\n await runBuild(resolveOptions(options))\n })\n\n withSharedOptions(cli.command('init', 'Create a Clarify project scaffold'))\n .option('--force', 'Overwrite files created by init')\n .option('--template <name>', 'Template to use: minimal, standard, or complete')\n .option('--install', 'Install dependencies after init')\n .action((options: InitCommandOptions) => {\n runInit(resolveOptions(options), options.force === true, options.template, options.install === true)\n })\n\n const args = process.argv.slice(2)\n cli.parse(process.argv, { run: false })\n\n if (args.length === 0) {\n cli.outputHelp()\n return\n }\n\n await cli.runMatchedCommand()\n}\n\nmain().catch(error => {\n console.error(error instanceof Error ? error.stack ?? error.message : String(error))\n process.exitCode = 1\n})\n"],"mappings":";;;;;;;;;;;;AAIA,IAAM,gBAAgB;AACtB,IAAM,sBAAsB;AAC5B,IAAM,kBAAkB;AAExB,SAAS,mBAA2B;CAClC,MAAM,WAAW,QAAQ,IAAI;CAC7B,IAAI,CAAC,UAAU,OAAO;CACtB,MAAM,SAAS,OAAO,QAAQ;CAC9B,OAAO,OAAO,UAAU,MAAM,KAAK,SAAS,IAAI,SAAS;AAC3D;AAEA,SAAS,sBAAsB,OAAwB;CACrD,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,IAAI,UAAU,MAAM,OAAO;CAC3B,IAAI,iBAAiB,OAAO,OAAO,MAAM;CACzC,IAAI,OAAO,UAAU,UAAU;EAC7B,IAAI,aAAa,SAAS,OAAQ,MAAgC,YAAY,UAC5E,OAAQ,MAA8B;EAEx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ACf;CACF;CAEA,MAAM,IAAI,kBAAkB;AAC9B;AAEA,KAAK,EAAE,OAAM,UAAS;CACpB,QAAQ,MAAM,iBAAiB,QAAQ,MAAM,SAAS,MAAM,UAAU,OAAO,KAAK,CAAC;CACnF,QAAQ,WAAW;AACrB,CAAC"}
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../source/core/log.ts","../source/core/vite-config.ts","../source/cli/commands/build.ts","../source/cli/commands/check.ts","../source/cli/commands/dev.ts","../package.json","../source/cli/package.ts","../source/cli/spawn.ts","../source/cli/commands/init.ts","../source/cli/options.ts","../source/cli/index.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { readFile, writeFile } from 'node:fs/promises'\nimport { dirname, join } from 'node:path'\n\nconst LOG_FILE_NAME = '.clarify.log'\nconst DEFAULT_LOG_ENTRIES = 50\nconst ENTRY_SEPARATOR = '\\n\\n---\\n\\n'\n\nfunction getMaxLogEntries(): number {\n const envValue = process.env.CLARIFY_LOG_MAX_ENTRIES\n if (!envValue) return DEFAULT_LOG_ENTRIES\n const parsed = Number(envValue)\n return Number.isInteger(parsed) && parsed > 0 ? parsed : DEFAULT_LOG_ENTRIES\n}\n\nfunction normalizeErrorMessage(error: unknown): string {\n if (error === undefined) return 'undefined'\n if (error === null) return 'null'\n if (error instanceof Error) return error.message\n if (typeof error === 'object') {\n if ('message' in error && typeof (error as { message?: unknown }).message === 'string') {\n return (error as { message: string }).message\n }\n try {\n return JSON.stringify(error)\n } catch {\n return String(error)\n }\n }\n return String(error)\n}\n\nfunction normalizeErrorStack(error: unknown): string | undefined {\n if (error instanceof Error) {\n return error.stack\n }\n return undefined\n}\n\nfunction formatLogEntry(root: string, error: unknown): string {\n const timestamp = new Date().toISOString()\n const message = normalizeErrorMessage(error)\n const stack = normalizeErrorStack(error)\n\n return [`=== Clarify build error ===`, `Timestamp: ${timestamp}`, `Project root: ${root}`, `Error: ${message}`, stack ? `Stack:\\n${stack}` : undefined]\n .filter(Boolean)\n .join('\\n')\n}\n\nexport async function logBuildError(root: string, error: unknown, maxEntries?: number): Promise<void> {\n const logPath = join(root, LOG_FILE_NAME)\n const entry = formatLogEntry(root, error)\n const max = maxEntries ?? getMaxLogEntries()\n\n let entries: string[] = []\n if (existsSync(logPath)) {\n try {\n const content = await readFile(logPath, 'utf8')\n entries = content\n .split(ENTRY_SEPARATOR)\n .map((item) => item.trim())\n .filter(Boolean)\n } catch {\n entries = []\n }\n }\n\n entries.push(entry)\n if (entries.length > max) {\n entries = entries.slice(-max)\n }\n\n mkdirSync(dirname(logPath), { recursive: true })\n await writeFile(logPath, entries.join(ENTRY_SEPARATOR) + '\\n', 'utf8')\n}\n\nexport function logBuildErrorSync(root: string, error: unknown, maxEntries?: number): void {\n const logPath = join(root, LOG_FILE_NAME)\n const entry = formatLogEntry(root, error)\n const max = maxEntries ?? getMaxLogEntries()\n\n let entries: string[] = []\n if (existsSync(logPath)) {\n try {\n const content = readFileSync(logPath, 'utf8')\n entries = content\n .split(ENTRY_SEPARATOR)\n .map((item) => item.trim())\n .filter(Boolean)\n } catch {\n entries = []\n }\n }\n\n entries.push(entry)\n if (entries.length > max) {\n entries = entries.slice(-max)\n }\n\n mkdirSync(dirname(logPath), { recursive: true })\n writeFileSync(logPath, entries.join(ENTRY_SEPARATOR) + '\\n', 'utf8')\n}\n","import { existsSync, mkdirSync, writeFileSync } from 'node:fs'\nimport { dirname, resolve } from 'node:path'\n\nimport { createLogger } from 'vite'\nimport type { ConfigEnv, InlineConfig, Plugin, LogLevel, Logger, LogOptions, LogErrorOptions, LogType } from 'vite'\n\nimport { logBuildErrorSync } from './log.js'\nimport type { ClarifyBuildOptions } from './options.js'\nimport { clarifyPlugin } from './plugin.js'\nimport { createClarifyRuntimeAliases } from './runtime-deps.js'\nimport { loadClarifyConfig } from './user-config.js'\n\nexport type ClarifyViteConfigOptions = {\n root: string\n content: string\n output: string\n host?: string | boolean\n port?: number\n open?: boolean | string\n}\n\nconst DEFAULT_HTML = '<!doctype html><html lang=\"en\"><head><meta charset=\"UTF-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /><title>Clarify</title></head><body><div id=\"root\"></div></body></html>'\n\nfunction ensureHtmlEntry(root: string): string {\n const projectHtmlPath = resolve(root, 'index.html')\n if (existsSync(projectHtmlPath)) return projectHtmlPath\n\n const generatedHtmlPath = resolve(root, '.clarify/index.html')\n mkdirSync(dirname(generatedHtmlPath), { recursive: true })\n writeFileSync(generatedHtmlPath, DEFAULT_HTML, 'utf-8')\n return generatedHtmlPath\n}\n\nfunction createClarifyLogger(root: string, env: ConfigEnv, level: LogLevel): Logger | undefined {\n if (env.command !== 'build') return undefined\n\n const baseLogger = createLogger(level, { allowClearScreen: true })\n\n return {\n info(msg: string, options?: LogOptions) {\n baseLogger.info(msg, options)\n },\n warn(msg: string, options?: LogOptions) {\n baseLogger.warn(msg, options)\n },\n warnOnce(msg: string, options?: LogOptions) {\n baseLogger.warnOnce(msg, options)\n },\n error(msg: string, options?: LogErrorOptions) {\n baseLogger.error(msg, options)\n if (options?.error) {\n logBuildErrorSync(root, options.error)\n } else {\n logBuildErrorSync(root, typeof msg === 'string' ? new Error(msg) : msg)\n }\n },\n clearScreen(type: LogType) {\n baseLogger.clearScreen(type)\n },\n hasErrorLogged(error: Error | unknown) {\n return baseLogger.hasErrorLogged(error as Error)\n },\n get hasWarned() {\n return baseLogger.hasWarned\n },\n }\n}\n\nfunction createHtmlFallbackPlugin(): Plugin {\n return {\n name: 'clarify:cli-html-fallback',\n configureServer(server) {\n server.middlewares.use(async (req, res, next) => {\n const requestPath = req.url?.split('?')[0] ?? '/'\n const acceptsHtml = req.headers.accept?.includes('text/html') ?? false\n const hasFileExtension = /\\.[^/]+$/.test(requestPath)\n if (!acceptsHtml || hasFileExtension) {\n next()\n return\n }\n\n try {\n const html = await server.transformIndexHtml(requestPath, DEFAULT_HTML)\n res.statusCode = 200\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n res.end(html)\n } catch (error) {\n next(error)\n }\n })\n },\n }\n}\n\nexport async function createViteConfig(options: ClarifyViteConfigOptions, env: ConfigEnv): Promise<InlineConfig> {\n const entryHtmlPath = ensureHtmlEntry(options.root)\n const userConfig = await loadClarifyConfig(options.root, env)\n const buildOptions: ClarifyBuildOptions = {\n ...userConfig,\n projectRoot: options.root,\n rootDirectory: options.content,\n outputDirectory: options.output,\n }\n\n return {\n root: options.root,\n configFile: false,\n appType: 'custom',\n resolve: {\n alias: createClarifyRuntimeAliases(),\n },\n customLogger: createClarifyLogger(options.root, env, 'info'),\n plugins: [\n clarifyPlugin(buildOptions),\n createHtmlFallbackPlugin(),\n ],\n server: {\n host: options.host,\n port: options.port,\n open: options.open,\n },\n build: {\n outDir: options.output,\n rolldownOptions: {\n input: {\n index: entryHtmlPath,\n },\n checks: {\n pluginTimings: false,\n },\n output: {\n codeSplitting: {\n groups: [\n {\n name: 'react-vendor',\n test: /node_modules[\\\\/](react|react-dom|react-router|react-router-dom)[\\\\/]/,\n priority: 40,\n },\n {\n name: 'icons-vendor',\n test: /node_modules[\\\\/]lucide-react[\\\\/]/,\n priority: 35,\n },\n {\n name: 'ui-vendor',\n test: /node_modules[\\\\/](@headlessui|framer-motion)[\\\\/]/,\n priority: 30,\n },\n {\n name: 'vendor',\n test: /node_modules[\\\\/]/,\n priority: 10\n },\n ],\n },\n },\n },\n },\n }\n}\n","import { build as viteBuild } from 'vite'\n\nimport { logBuildError } from '../../core/log.js'\nimport { createViteConfig } from '../../core/vite-config.js'\nimport type { ResolvedCliOptions } from '../options.js'\n\nexport async function runBuild(options: ResolvedCliOptions): Promise<void> {\n try {\n await viteBuild(await createViteConfig(options, { command: 'build', mode: 'production' }))\n } catch (error) {\n await logBuildError(options.root, error)\n throw error\n }\n}\n","import { existsSync } from 'node:fs'\nimport { lstat, stat } from 'node:fs/promises'\nimport { dirname, extname, isAbsolute, join, normalize, relative, resolve } from 'node:path'\n\nimport type { CliOptions } from '../options.js'\nimport { loadClarifyConfig } from '../../core/user-config.js'\nimport { resolveClarifySite } from '../../core/site.js'\nimport type { ContentRoute } from '../../types.js'\n\nexport type CheckCommandOptions = CliOptions & {\n strict?: boolean\n format?: 'text' | 'json' | string\n}\n\ntype CheckLevel = 'error' | 'warning'\n\ntype CheckDiagnostic = {\n level: CheckLevel\n code: string\n message: string\n filePath?: string\n routePath?: string\n}\n\ntype CheckResult = {\n errors: CheckDiagnostic[]\n warnings: CheckDiagnostic[]\n}\n\nconst LOCAL_LINK_PATTERN = /(?<!!)(?:\\[[^\\]]*\\]\\(([^)\\s]+)(?:\\s+\"[^\"]*\")?\\)|<a\\s+[^>]*href=[\"']([^\"']+)[\"'])/gi\nconst ROUTE_EXTENSIONS = new Set(['.md', '.mdx'])\nconst IGNORED_SCHEMES = /^[a-z][a-z0-9+.-]*:/i\n\nfunction addDiagnostic(result: CheckResult, diagnostic: CheckDiagnostic): void {\n if (diagnostic.level === 'error') result.errors.push(diagnostic)\n else result.warnings.push(diagnostic)\n}\n\nfunction normalizeRoutePath(path: string): string {\n const [withoutHash] = path.split('#')\n const clean = withoutHash.replace(/\\/index$/, '') || '/'\n return clean.startsWith('/') ? clean : `/${clean}`\n}\n\nfunction routePathCandidates(href: string, route: ContentRoute): string[] {\n const [withoutHashOrQuery] = href.split(/[?#]/)\n if (!withoutHashOrQuery || withoutHashOrQuery.startsWith('#')) return []\n if (withoutHashOrQuery.startsWith('/')) return [normalizeRoutePath(withoutHashOrQuery)]\n\n const routeDir = dirname(route.path)\n const joined = normalize(join(routeDir, withoutHashOrQuery)).replaceAll('\\\\', '/')\n const extension = extname(joined)\n const base = ROUTE_EXTENSIONS.has(extension) ? joined.slice(0, -extension.length) : joined\n return [normalizeRoutePath(base)]\n}\n\nasync function pathExists(filePath: string): Promise<boolean> {\n try {\n await stat(filePath)\n return true\n } catch {\n return false\n }\n}\n\nfunction isLocalHref(href: string): boolean {\n return Boolean(href) && !href.startsWith('#') && !href.startsWith('//') && !IGNORED_SCHEMES.test(href)\n}\n\nasync function resolveLocalFileLink(href: string, route: ContentRoute, contentRoot: string): Promise<boolean> {\n const [withoutHashOrQuery] = href.split(/[?#]/)\n if (!withoutHashOrQuery || withoutHashOrQuery.startsWith('/')) return false\n\n const target = resolve(dirname(route.filePath), withoutHashOrQuery)\n const relativeTarget = relative(contentRoot, target)\n if (relativeTarget.startsWith('..') || isAbsolute(relativeTarget)) return false\n if (await pathExists(target)) return true\n\n if (!extname(target)) {\n return pathExists(`${target}.md`) || pathExists(`${target}.mdx`) || pathExists(join(target, 'index.md')) || pathExists(join(target, 'index.mdx'))\n }\n return false\n}\n\nasync function checkContentDirectory(contentRoot: string, result: CheckResult): Promise<void> {\n try {\n const stats = await lstat(contentRoot)\n if (!stats.isDirectory()) {\n addDiagnostic(result, {\n level: 'error',\n code: 'content-not-directory',\n message: `Content path is not a directory: ${contentRoot}`,\n filePath: contentRoot,\n })\n }\n } catch {\n addDiagnostic(result, {\n level: 'error',\n code: 'content-missing',\n message: `Content directory does not exist: ${contentRoot}`,\n filePath: contentRoot,\n })\n }\n}\n\nfunction checkDuplicateRoutes(routes: ContentRoute[], result: CheckResult): void {\n const byPath = new Map<string, ContentRoute[]>()\n for (const route of routes) {\n const key = `${route.locale ?? ''}:${route.path}`\n byPath.set(key, [...(byPath.get(key) ?? []), route])\n }\n\n for (const duplicated of byPath.values()) {\n if (duplicated.length < 2) continue\n for (const route of duplicated) {\n addDiagnostic(result, {\n level: 'error',\n code: 'duplicate-route',\n message: `Route \"${route.path}\" is defined by multiple files: ${duplicated.map(route => relative(process.cwd(), route.filePath)).join(', ')}`,\n filePath: route.filePath,\n routePath: route.path,\n })\n }\n }\n}\n\nfunction checkFallbackRoutes(routes: ContentRoute[], result: CheckResult): void {\n for (const route of routes) {\n if (!route.isFallback) continue\n addDiagnostic(result, {\n level: 'warning',\n code: 'i18n-fallback-route',\n message: `Route \"${route.path}\" falls back to ${route.locale ?? 'default'} content from ${relative(process.cwd(), route.filePath)}`,\n filePath: route.filePath,\n routePath: route.path,\n })\n }\n}\n\nasync function checkLocalLinks(routes: ContentRoute[], contentRoot: string, result: CheckResult): Promise<void> {\n const routePaths = new Set(routes.map(route => route.path))\n\n for (const route of routes) {\n if (route.kind !== 'mdx' || !route.content) continue\n for (const match of route.content.matchAll(LOCAL_LINK_PATTERN)) {\n const href = match[1] ?? match[2]\n if (!href || !isLocalHref(href)) continue\n const candidates = routePathCandidates(href, route)\n if (candidates.some(candidate => routePaths.has(candidate))) continue\n if (await resolveLocalFileLink(href, route, contentRoot)) continue\n\n addDiagnostic(result, {\n level: 'error',\n code: 'broken-link',\n message: `Broken local link \"${href}\" in route \"${route.path}\"`,\n filePath: route.filePath,\n routePath: route.path,\n })\n }\n }\n}\n\nfunction printTextResult(result: CheckResult, strict: boolean): void {\n const diagnostics = [...result.errors, ...result.warnings]\n if (diagnostics.length === 0) {\n console.log('✓ Clarify check passed')\n return\n }\n\n for (const diagnostic of diagnostics) {\n const location = diagnostic.filePath ? ` ${relative(process.cwd(), diagnostic.filePath)}` : ''\n const route = diagnostic.routePath ? ` (${diagnostic.routePath})` : ''\n console.log(`${diagnostic.level.toUpperCase()} ${diagnostic.code}${location}${route}`)\n console.log(` ${diagnostic.message}`)\n }\n\n const warningExit = strict && result.warnings.length > 0\n console.log(`\\n${result.errors.length} error(s), ${result.warnings.length} warning(s)${warningExit ? ' (--strict treats warnings as failures)' : ''}`)\n}\n\nexport async function runCheck(options: CheckCommandOptions = {}): Promise<void> {\n const root = resolve(options.root ?? process.cwd())\n const userConfig = existsSync(root) ? await loadClarifyConfig(root, { command: 'build', mode: 'production' }) : {}\n const site = await resolveClarifySite({\n ...userConfig,\n projectRoot: root,\n rootDirectory: options.content,\n outputDirectory: options.output,\n }, { includeHtmlShellPlugin: false })\n\n const result: CheckResult = { errors: [], warnings: [] }\n await checkContentDirectory(site.contentRoot, result)\n checkDuplicateRoutes(site.routes, result)\n checkFallbackRoutes(site.routes, result)\n await checkLocalLinks(site.routes, site.contentRoot, result)\n\n if (options.format === 'json') {\n console.log(JSON.stringify(result, null, 2))\n } else {\n printTextResult(result, Boolean(options.strict))\n }\n\n if (result.errors.length > 0 || (options.strict && result.warnings.length > 0)) {\n process.exitCode = 1\n }\n}\n","import { createServer } from 'vite'\n\nimport { createViteConfig } from '../../core/vite-config.js'\nimport type { ResolvedCliOptions } from '../options.js'\n\nexport async function runDev(options: ResolvedCliOptions): Promise<void> {\n const server = await createServer(await createViteConfig(options, { command: 'serve', mode: 'development' }))\n await server.listen()\n server.printUrls()\n server.bindCLIShortcuts({ print: true })\n}\n","{\n \"name\": \"@clarify-labs/cli\",\n \"version\": \"0.6.5\",\n \"license\": \"AGPL-3.0-only\",\n \"type\": \"module\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/taicode-labs/clarify\",\n \"directory\": \"packages/cli\"\n },\n \"main\": \"output/index.cjs\",\n \"module\": \"output/index.js\",\n \"types\": \"output/index.d.ts\",\n \"bin\": {\n \"clarify\": \"bin/clarify.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./output/index.d.ts\",\n \"import\": \"./output/index.js\",\n \"require\": \"./output/index.cjs\",\n \"default\": \"./output/index.js\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"LICENSE\",\n \"bin\",\n \"output\"\n ],\n \"scripts\": {\n \"dev\": \"vite build --watch\",\n \"build\": \"vite build\",\n \"lint\": \"eslint source/\",\n \"lint:fix\": \"eslint source/ --fix\",\n \"typecheck\": \"tsc -p tsconfig.json --noEmit\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\"\n },\n \"dependencies\": {\n \"@apidevtools/swagger-parser\": \"^12.1.0\",\n \"@clarify-labs/renderer\": \"workspace:*\",\n \"@clarify-labs/templates\": \"workspace:*\",\n \"@mdx-js/rollup\": \"^3.1.1\",\n \"@tailwindcss/vite\": \"^4.1.11\",\n \"@vitejs/plugin-react\": \"^6.0.2\",\n \"cac\": \"^7.0.0\",\n \"github-slugger\": \"^2.0.0\",\n \"gray-matter\": \"^4.0.3\",\n \"mdast-util-to-string\": \"^4.0.0\",\n \"openapi-types\": \"^12.1.3\",\n \"react\": \"^19.1.0\",\n \"react-dom\": \"^19.1.0\",\n \"react-router\": \"^7.0.0\",\n \"react-router-dom\": \"^7.0.0\",\n \"remark\": \"^15.0.1\",\n \"remark-gfm\": \"^4.0.1\",\n \"shiki\": \"0.14.7\",\n \"unist-util-visit\": \"^5.1.0\",\n \"vite\": \"^8.0.15\",\n \"zod\": \"^4.4.3\"\n },\n \"devDependencies\": {\n \"@mdx-js/mdx\": \"^3.1.1\",\n \"typescript\": \"^5.8.3\",\n \"vite-plugin-dts\": \"^4.5.4\",\n \"vitest\": \"^4.1.9\"\n }\n}\n","import packageJson from '../../package.json' with { type: 'json' }\n\nexport const cliPackageJson = packageJson as { version?: string }\nexport const cliPackageVersion = cliPackageJson.version ?? '0.0.0'\nexport const cliPackageVersionWithCaret = `^${cliPackageVersion}`\n\nexport function readPackageVersion(): string {\n return cliPackageVersion\n}\n","import { spawnSync as nodeSpawnSync, SpawnSyncOptions } from 'node:child_process'\n\ntype SpawnOptions = { cwd?: string; stdio?: 'inherit' | 'ignore' | Array<string> }\n\nexport function spawnSync(command: string, args: string[], options: SpawnOptions) {\n return nodeSpawnSync(command, args, options as SpawnSyncOptions)\n}\n","import { existsSync, readFileSync, writeFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { dirname, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport { copyTemplateDirectory, getTemplateDirectory, resolveTemplate } from '@clarify-labs/templates'\n\nimport type { ResolvedCliOptions } from '../options.js'\nimport { cliPackageVersionWithCaret } from '../package.js'\nimport { spawnSync } from '../spawn.js'\n\nconst require = createRequire(import.meta.url)\n\nfunction findTemplatesPackagePath(): string {\n try {\n return require.resolve('@clarify-labs/templates/package.json')\n } catch {\n const currentDirectory = dirname(fileURLToPath(import.meta.url))\n const workspacePackagePath = resolve(currentDirectory, '../../../../templates/package.json')\n if (existsSync(workspacePackagePath)) return workspacePackagePath\n throw new Error('[clarify] Templates package not found.')\n }\n}\n\nconst templatesPackagePath = findTemplatesPackagePath()\nconst templatesDirectory = dirname(templatesPackagePath)\n\nfunction commandExists(program: string): boolean {\n const result = spawnSync(program, ['--version'], { stdio: 'ignore' })\n return result.status === 0 && result.error === undefined\n}\n\ntype InstallCommand = { command: string; args: string[] }\n\nfunction getInstallCommand(): InstallCommand {\n if (commandExists('pnpm')) return { command: 'pnpm', args: ['install'] }\n if (commandExists('npm')) return { command: 'npm', args: ['install'] }\n if (commandExists('yarn')) return { command: 'yarn', args: ['install'] }\n return { command: 'npm', args: ['install'] }\n}\n\nfunction installDependencies(root: string): void {\n const { command, args } = getInstallCommand()\n console.log(`[clarify] Installing dependencies with ${command}...`)\n const result = spawnSync(command, args, { cwd: root, stdio: 'inherit' })\n if (result.status !== 0) {\n throw new Error(`[clarify] Dependency install failed with ${command}`)\n }\n}\n\nfunction getSuggestedInstallCommand(): string {\n if (commandExists('pnpm')) return 'pnpm install'\n if (commandExists('npm')) return 'npm install'\n if (commandExists('yarn')) return 'yarn install'\n return 'npm install'\n}\n\nfunction updatePackageJson(root: string, force: boolean): boolean {\n const packageJsonPath = resolve(root, 'package.json')\n const packageJson = existsSync(packageJsonPath)\n ? JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as Record<string, unknown>\n : { type: 'module' }\n\n const scripts = typeof packageJson.scripts === 'object' && packageJson.scripts !== null\n ? packageJson.scripts as Record<string, string>\n : {}\n\n if (force || !scripts.dev) scripts.dev = 'clarify dev'\n if (force || !scripts.build) scripts.build = 'clarify build'\n packageJson.scripts = scripts\n\n const devDependencies = typeof packageJson.devDependencies === 'object' && packageJson.devDependencies !== null\n ? packageJson.devDependencies as Record<string, string>\n : {}\n if (!devDependencies['@clarify-labs/cli']) devDependencies['@clarify-labs/cli'] = cliPackageVersionWithCaret\n packageJson.devDependencies = devDependencies\n\n writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\\n`, 'utf-8')\n return true\n}\n\nexport function runInit(options: ResolvedCliOptions, force: boolean, template?: string, install = false): void {\n const selectedTemplate = resolveTemplate(template)\n const templateDirectory = getTemplateDirectory(templatesDirectory, selectedTemplate)\n const { created } = copyTemplateDirectory(templateDirectory, options.root, {\n contentDir: options.content,\n force,\n })\n\n const packageJsonUpdated = updatePackageJson(options.root, force)\n if (packageJsonUpdated) created.push('package.json')\n\n console.log(`[clarify] Project scaffold created using the ${selectedTemplate} template.`)\n if (created.length > 0) {\n console.log(`[clarify] Created or updated ${created.length} ${created.length === 1 ? 'file' : 'files'}: ${created.join(', ')}`)\n }\n\n if (install) {\n installDependencies(options.root)\n console.log('[clarify] Dependencies installed successfully.')\n console.log('[clarify] You can now run `clarify dev` to start the local documentation server.')\n return\n }\n\n const suggestedInstall = getSuggestedInstallCommand()\n console.log('[clarify] Next steps:')\n console.log(' 1. Change into your new project directory:')\n console.log(` cd ${options.root}`)\n console.log(' 2. Install dependencies:')\n console.log(` ${suggestedInstall}`)\n console.log(' 3. Start the local documentation server:')\n console.log(' clarify dev')\n}\n","import { resolve } from 'node:path'\n\nexport type CliOptions = {\n root?: string\n content?: string\n output?: string\n host?: string | boolean\n port?: string | number\n open?: boolean | string\n}\n\nexport type ResolvedCliOptions = {\n root: string\n content: string\n output: string\n host?: string | boolean\n port?: number\n open?: boolean | string\n}\n\nfunction resolvePort(port: CliOptions['port']): number | undefined {\n if (port === undefined) return undefined\n\n const parsedPort = typeof port === 'string' ? Number(port) : port\n if (!Number.isInteger(parsedPort) || parsedPort < 1 || parsedPort > 65535) {\n throw new Error('[clarify] --port must be an integer between 1 and 65535')\n }\n\n return parsedPort\n}\n\nexport function resolveCliOptions(options: CliOptions): ResolvedCliOptions {\n return {\n root: resolve(options.root ?? process.cwd()),\n content: options.content ?? 'source',\n output: options.output ?? 'output',\n host: options.host,\n port: resolvePort(options.port),\n open: options.open,\n }\n}\n","#!/usr/bin/env node\nimport { cac } from 'cac'\n\nimport { runBuild } from './commands/build.js'\nimport { runCheck, type CheckCommandOptions } from './commands/check.js'\nimport { runDev } from './commands/dev.js'\nimport { runInit } from './commands/init.js'\nimport { resolveCliOptions, type CliOptions, type ResolvedCliOptions } from './options.js'\nimport { cliPackageVersion } from './package.js'\n\ntype InitCommandOptions = CliOptions & {\n force?: boolean\n template?: string\n install?: boolean\n}\n\nfunction withSharedOptions(command: ReturnType<ReturnType<typeof cac>['command']>) {\n return command\n .option('--root <dir>', 'Project root directory')\n .option('--content <dir>', 'Content directory relative to root')\n .option('--output <dir>', 'Build output directory relative to root')\n}\n\nfunction resolveOptions(options: CliOptions): ResolvedCliOptions {\n return resolveCliOptions(options)\n}\n\nasync function main(): Promise<void> {\n const cli = cac('clarify')\n\n cli\n .version(cliPackageVersion)\n .help()\n\n withSharedOptions(cli.command('dev', 'Start the local documentation server'))\n .option('--host [host]', 'Dev server host')\n .option('--port <port>', 'Dev server port')\n .option('--open [path]', 'Open the dev server in a browser')\n .action(async (options: CliOptions) => {\n await runDev(resolveOptions(options))\n })\n\n withSharedOptions(cli.command('build', 'Build the static documentation site'))\n .action(async (options: CliOptions) => {\n await runBuild(resolveOptions(options))\n })\n\n withSharedOptions(cli.command('check', 'Validate the documentation project'))\n .option('--strict', 'Treat warnings as failures')\n .option('--format <format>', 'Output format: text or json')\n .action(async (options: CheckCommandOptions) => {\n await runCheck(options)\n })\n\n withSharedOptions(cli.command('init', 'Create a Clarify project scaffold'))\n .option('--force', 'Overwrite files created by init')\n .option('--template <name>', 'Template to use: minimal, standard, or complete')\n .option('--install', 'Install dependencies after init')\n .action((options: InitCommandOptions) => {\n runInit(resolveOptions(options), options.force === true, options.template, options.install === true)\n })\n\n const args = process.argv.slice(2)\n cli.parse(process.argv, { run: false })\n\n if (args.length === 0) {\n cli.outputHelp()\n return\n }\n\n await cli.runMatchedCommand()\n}\n\nmain().catch(error => {\n console.error(error instanceof Error ? error.stack ?? error.message : String(error))\n process.exitCode = 1\n})\n"],"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QAAQ,SAAS,oCAAoC,CAAC,EACzE,OAAO,YAAY,4BAA4B,EAC/C,OAAO,qBAAqB,6BAA6B,EACzD,OAAO,OAAO,YAAiC;EAC9C,MAAM,SAAS,OAAO;CACxB,CAAC;CAEH,kBAAkB,IAAI,QAAQ,QAAQ,mCAAmC,CAAC,EACvE,OAAO,WAAW,iCAAiC,EACnD,OAAO,qBAAqB,iDAAiD,EAC7E,OAAO,aAAa,iCAAiC,EACrD,QAAQ,YAAgC;EACvC,QAAQ,eAAe,OAAO,GAAG,QAAQ,UAAU,MAAM,QAAQ,UAAU,QAAQ,YAAY,IAAI;CACrG,CAAC;CAEH,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;CACjC,IAAI,MAAM,QAAQ,MAAM,EAAE,KAAK,MAAM,CAAC;CAEtC,IAAI,KAAK,WAAW,GAAG;EACrB,IAAI,WAAW;EACf;CACF;CAEA,MAAM,IAAI,kBAAkB;AAC9B;AAEA,KAAK,EAAE,OAAM,UAAS;CACpB,QAAQ,MAAM,iBAAiB,QAAQ,MAAM,SAAS,MAAM,UAAU,OAAO,KAAK,CAAC;CACnF,QAAQ,WAAW;AACrB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ClarifyPlugin } from '../types.js';
2
+ export type BuiltinPluginOptions = {
3
+ htmlShell?: boolean;
4
+ };
5
+ export declare function createBuiltinPlugins(options?: BuiltinPluginOptions): ClarifyPlugin[];
@@ -40,6 +40,11 @@ export declare const clarifyFooterConfigSchema: z.ZodObject<{
40
40
  socials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
41
41
  copyright: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
42
42
  }, z.core.$strip>;
43
+ export declare const clarifySourceConfigSchema: z.ZodObject<{
44
+ repository: z.ZodString;
45
+ branch: z.ZodOptional<z.ZodString>;
46
+ directory: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strip>;
43
48
  export declare const clarifyPagesItemSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
44
49
  page: z.ZodString;
45
50
  title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
@@ -49,6 +54,9 @@ export declare const clarifyPagesItemSchema: z.ZodUnion<readonly [z.ZodString, z
49
54
  openapi: z.ZodString;
50
55
  icon: z.ZodOptional<z.ZodString>;
51
56
  title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
57
+ filter: z.ZodOptional<z.ZodObject<{
58
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
59
+ }, z.core.$strip>>;
52
60
  }, z.core.$strip>]>;
53
61
  export declare const clarifyPagesGroupSchema: z.ZodObject<{
54
62
  group: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
@@ -62,6 +70,9 @@ export declare const clarifyPagesGroupSchema: z.ZodObject<{
62
70
  openapi: z.ZodString;
63
71
  icon: z.ZodOptional<z.ZodString>;
64
72
  title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
73
+ filter: z.ZodOptional<z.ZodObject<{
74
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
75
+ }, z.core.$strip>>;
65
76
  }, z.core.$strip>]>>;
66
77
  }, z.core.$strip>;
67
78
  export declare const clarifyPagesConfigSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
@@ -76,6 +87,9 @@ export declare const clarifyPagesConfigSchema: z.ZodUnion<readonly [z.ZodArray<z
76
87
  openapi: z.ZodString;
77
88
  icon: z.ZodOptional<z.ZodString>;
78
89
  title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
90
+ filter: z.ZodOptional<z.ZodObject<{
91
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
92
+ }, z.core.$strip>>;
79
93
  }, z.core.$strip>]>>;
80
94
  }, z.core.$strip>>, z.ZodLiteral<"FileTree">]>;
81
95
  export declare const clarifyTabItemSchema: z.ZodObject<{
@@ -93,6 +107,9 @@ export declare const clarifyTabItemSchema: z.ZodObject<{
93
107
  openapi: z.ZodString;
94
108
  icon: z.ZodOptional<z.ZodString>;
95
109
  title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
110
+ filter: z.ZodOptional<z.ZodObject<{
111
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
112
+ }, z.core.$strip>>;
96
113
  }, z.core.$strip>]>>;
97
114
  }, z.core.$strip>>, z.ZodLiteral<"FileTree">]>>;
98
115
  }, z.core.$strip>;
@@ -111,6 +128,9 @@ export declare const clarifyTabsConfigSchema: z.ZodArray<z.ZodObject<{
111
128
  openapi: z.ZodString;
112
129
  icon: z.ZodOptional<z.ZodString>;
113
130
  title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
131
+ filter: z.ZodOptional<z.ZodObject<{
132
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
133
+ }, z.core.$strip>>;
114
134
  }, z.core.$strip>]>>;
115
135
  }, z.core.$strip>>, z.ZodLiteral<"FileTree">]>>;
116
136
  }, z.core.$strip>>;
@@ -118,15 +138,47 @@ export declare const clarifyThemePresetSchema: z.ZodEnum<{
118
138
  default: "default";
119
139
  base: "base";
120
140
  }>;
141
+ export declare const clarifyThemeModeColorValueSchema: z.ZodObject<{
142
+ light: z.ZodOptional<z.ZodString>;
143
+ dark: z.ZodOptional<z.ZodString>;
144
+ }, z.core.$strip>;
145
+ export declare const clarifyThemeColorValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
146
+ light: z.ZodOptional<z.ZodString>;
147
+ dark: z.ZodOptional<z.ZodString>;
148
+ }, z.core.$strip>]>;
121
149
  export declare const clarifyThemeColorTokensConfigSchema: z.ZodObject<{
122
- primary: z.ZodOptional<z.ZodString>;
123
- accent: z.ZodOptional<z.ZodString>;
124
- background: z.ZodOptional<z.ZodString>;
125
- foreground: z.ZodOptional<z.ZodString>;
126
- surface: z.ZodOptional<z.ZodString>;
127
- muted: z.ZodOptional<z.ZodString>;
128
- border: z.ZodOptional<z.ZodString>;
129
- codeBackground: z.ZodOptional<z.ZodString>;
150
+ primary: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
151
+ light: z.ZodOptional<z.ZodString>;
152
+ dark: z.ZodOptional<z.ZodString>;
153
+ }, z.core.$strip>]>>;
154
+ accent: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
155
+ light: z.ZodOptional<z.ZodString>;
156
+ dark: z.ZodOptional<z.ZodString>;
157
+ }, z.core.$strip>]>>;
158
+ background: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
159
+ light: z.ZodOptional<z.ZodString>;
160
+ dark: z.ZodOptional<z.ZodString>;
161
+ }, z.core.$strip>]>>;
162
+ foreground: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
163
+ light: z.ZodOptional<z.ZodString>;
164
+ dark: z.ZodOptional<z.ZodString>;
165
+ }, z.core.$strip>]>>;
166
+ surface: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
167
+ light: z.ZodOptional<z.ZodString>;
168
+ dark: z.ZodOptional<z.ZodString>;
169
+ }, z.core.$strip>]>>;
170
+ muted: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
171
+ light: z.ZodOptional<z.ZodString>;
172
+ dark: z.ZodOptional<z.ZodString>;
173
+ }, z.core.$strip>]>>;
174
+ border: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
175
+ light: z.ZodOptional<z.ZodString>;
176
+ dark: z.ZodOptional<z.ZodString>;
177
+ }, z.core.$strip>]>>;
178
+ codeBackground: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
179
+ light: z.ZodOptional<z.ZodString>;
180
+ dark: z.ZodOptional<z.ZodString>;
181
+ }, z.core.$strip>]>>;
130
182
  }, z.core.$strip>;
131
183
  export declare const clarifyThemeRadiusTokensConfigSchema: z.ZodObject<{
132
184
  sm: z.ZodOptional<z.ZodString>;
@@ -136,14 +188,38 @@ export declare const clarifyThemeRadiusTokensConfigSchema: z.ZodObject<{
136
188
  }, z.core.$strip>;
137
189
  export declare const clarifyThemeTokensConfigSchema: z.ZodObject<{
138
190
  colors: z.ZodOptional<z.ZodObject<{
139
- primary: z.ZodOptional<z.ZodString>;
140
- accent: z.ZodOptional<z.ZodString>;
141
- background: z.ZodOptional<z.ZodString>;
142
- foreground: z.ZodOptional<z.ZodString>;
143
- surface: z.ZodOptional<z.ZodString>;
144
- muted: z.ZodOptional<z.ZodString>;
145
- border: z.ZodOptional<z.ZodString>;
146
- codeBackground: z.ZodOptional<z.ZodString>;
191
+ primary: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
192
+ light: z.ZodOptional<z.ZodString>;
193
+ dark: z.ZodOptional<z.ZodString>;
194
+ }, z.core.$strip>]>>;
195
+ accent: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
196
+ light: z.ZodOptional<z.ZodString>;
197
+ dark: z.ZodOptional<z.ZodString>;
198
+ }, z.core.$strip>]>>;
199
+ background: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
200
+ light: z.ZodOptional<z.ZodString>;
201
+ dark: z.ZodOptional<z.ZodString>;
202
+ }, z.core.$strip>]>>;
203
+ foreground: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
204
+ light: z.ZodOptional<z.ZodString>;
205
+ dark: z.ZodOptional<z.ZodString>;
206
+ }, z.core.$strip>]>>;
207
+ surface: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
208
+ light: z.ZodOptional<z.ZodString>;
209
+ dark: z.ZodOptional<z.ZodString>;
210
+ }, z.core.$strip>]>>;
211
+ muted: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
212
+ light: z.ZodOptional<z.ZodString>;
213
+ dark: z.ZodOptional<z.ZodString>;
214
+ }, z.core.$strip>]>>;
215
+ border: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
216
+ light: z.ZodOptional<z.ZodString>;
217
+ dark: z.ZodOptional<z.ZodString>;
218
+ }, z.core.$strip>]>>;
219
+ codeBackground: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
220
+ light: z.ZodOptional<z.ZodString>;
221
+ dark: z.ZodOptional<z.ZodString>;
222
+ }, z.core.$strip>]>>;
147
223
  }, z.core.$strip>>;
148
224
  radius: z.ZodOptional<z.ZodObject<{
149
225
  sm: z.ZodOptional<z.ZodString>;
@@ -162,14 +238,38 @@ export declare const clarifyThemeConfigSchema: z.ZodObject<{
162
238
  }>>;
163
239
  tokens: z.ZodOptional<z.ZodObject<{
164
240
  colors: z.ZodOptional<z.ZodObject<{
165
- primary: z.ZodOptional<z.ZodString>;
166
- accent: z.ZodOptional<z.ZodString>;
167
- background: z.ZodOptional<z.ZodString>;
168
- foreground: z.ZodOptional<z.ZodString>;
169
- surface: z.ZodOptional<z.ZodString>;
170
- muted: z.ZodOptional<z.ZodString>;
171
- border: z.ZodOptional<z.ZodString>;
172
- codeBackground: z.ZodOptional<z.ZodString>;
241
+ primary: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
242
+ light: z.ZodOptional<z.ZodString>;
243
+ dark: z.ZodOptional<z.ZodString>;
244
+ }, z.core.$strip>]>>;
245
+ accent: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
246
+ light: z.ZodOptional<z.ZodString>;
247
+ dark: z.ZodOptional<z.ZodString>;
248
+ }, z.core.$strip>]>>;
249
+ background: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
250
+ light: z.ZodOptional<z.ZodString>;
251
+ dark: z.ZodOptional<z.ZodString>;
252
+ }, z.core.$strip>]>>;
253
+ foreground: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
254
+ light: z.ZodOptional<z.ZodString>;
255
+ dark: z.ZodOptional<z.ZodString>;
256
+ }, z.core.$strip>]>>;
257
+ surface: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
258
+ light: z.ZodOptional<z.ZodString>;
259
+ dark: z.ZodOptional<z.ZodString>;
260
+ }, z.core.$strip>]>>;
261
+ muted: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
262
+ light: z.ZodOptional<z.ZodString>;
263
+ dark: z.ZodOptional<z.ZodString>;
264
+ }, z.core.$strip>]>>;
265
+ border: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
266
+ light: z.ZodOptional<z.ZodString>;
267
+ dark: z.ZodOptional<z.ZodString>;
268
+ }, z.core.$strip>]>>;
269
+ codeBackground: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
270
+ light: z.ZodOptional<z.ZodString>;
271
+ dark: z.ZodOptional<z.ZodString>;
272
+ }, z.core.$strip>]>>;
173
273
  }, z.core.$strip>>;
174
274
  radius: z.ZodOptional<z.ZodObject<{
175
275
  sm: z.ZodOptional<z.ZodString>;
@@ -181,10 +281,17 @@ export declare const clarifyThemeConfigSchema: z.ZodObject<{
181
281
  layout: z.ZodOptional<z.ZodObject<{
182
282
  maxWidth: z.ZodOptional<z.ZodString>;
183
283
  }, z.core.$strip>>;
284
+ editor: z.ZodOptional<z.ZodBoolean>;
184
285
  }, z.core.$strip>;
185
286
  export declare const clarifyProjectConfigSchema: z.ZodObject<{
186
287
  title: z.ZodOptional<z.ZodString>;
187
288
  description: z.ZodOptional<z.ZodString>;
289
+ siteUrl: z.ZodOptional<z.ZodString>;
290
+ source: z.ZodOptional<z.ZodObject<{
291
+ repository: z.ZodString;
292
+ branch: z.ZodOptional<z.ZodString>;
293
+ directory: z.ZodOptional<z.ZodString>;
294
+ }, z.core.$strip>>;
188
295
  logo: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
189
296
  light: z.ZodOptional<z.ZodString>;
190
297
  dark: z.ZodOptional<z.ZodString>;
@@ -200,14 +307,38 @@ export declare const clarifyProjectConfigSchema: z.ZodObject<{
200
307
  }>>;
201
308
  tokens: z.ZodOptional<z.ZodObject<{
202
309
  colors: z.ZodOptional<z.ZodObject<{
203
- primary: z.ZodOptional<z.ZodString>;
204
- accent: z.ZodOptional<z.ZodString>;
205
- background: z.ZodOptional<z.ZodString>;
206
- foreground: z.ZodOptional<z.ZodString>;
207
- surface: z.ZodOptional<z.ZodString>;
208
- muted: z.ZodOptional<z.ZodString>;
209
- border: z.ZodOptional<z.ZodString>;
210
- codeBackground: z.ZodOptional<z.ZodString>;
310
+ primary: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
311
+ light: z.ZodOptional<z.ZodString>;
312
+ dark: z.ZodOptional<z.ZodString>;
313
+ }, z.core.$strip>]>>;
314
+ accent: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
315
+ light: z.ZodOptional<z.ZodString>;
316
+ dark: z.ZodOptional<z.ZodString>;
317
+ }, z.core.$strip>]>>;
318
+ background: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
319
+ light: z.ZodOptional<z.ZodString>;
320
+ dark: z.ZodOptional<z.ZodString>;
321
+ }, z.core.$strip>]>>;
322
+ foreground: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
323
+ light: z.ZodOptional<z.ZodString>;
324
+ dark: z.ZodOptional<z.ZodString>;
325
+ }, z.core.$strip>]>>;
326
+ surface: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
327
+ light: z.ZodOptional<z.ZodString>;
328
+ dark: z.ZodOptional<z.ZodString>;
329
+ }, z.core.$strip>]>>;
330
+ muted: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
331
+ light: z.ZodOptional<z.ZodString>;
332
+ dark: z.ZodOptional<z.ZodString>;
333
+ }, z.core.$strip>]>>;
334
+ border: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
335
+ light: z.ZodOptional<z.ZodString>;
336
+ dark: z.ZodOptional<z.ZodString>;
337
+ }, z.core.$strip>]>>;
338
+ codeBackground: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
339
+ light: z.ZodOptional<z.ZodString>;
340
+ dark: z.ZodOptional<z.ZodString>;
341
+ }, z.core.$strip>]>>;
211
342
  }, z.core.$strip>>;
212
343
  radius: z.ZodOptional<z.ZodObject<{
213
344
  sm: z.ZodOptional<z.ZodString>;
@@ -219,6 +350,7 @@ export declare const clarifyProjectConfigSchema: z.ZodObject<{
219
350
  layout: z.ZodOptional<z.ZodObject<{
220
351
  maxWidth: z.ZodOptional<z.ZodString>;
221
352
  }, z.core.$strip>>;
353
+ editor: z.ZodOptional<z.ZodBoolean>;
222
354
  }, z.core.$strip>>;
223
355
  routePrefix: z.ZodOptional<z.ZodString>;
224
356
  navbar: z.ZodOptional<z.ZodObject<{
@@ -265,6 +397,9 @@ export declare const clarifyProjectConfigSchema: z.ZodObject<{
265
397
  openapi: z.ZodString;
266
398
  icon: z.ZodOptional<z.ZodString>;
267
399
  title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
400
+ filter: z.ZodOptional<z.ZodObject<{
401
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
402
+ }, z.core.$strip>>;
268
403
  }, z.core.$strip>]>>;
269
404
  }, z.core.$strip>>, z.ZodLiteral<"FileTree">]>>;
270
405
  }, z.core.$strip>>>;
@@ -15,6 +15,7 @@ export type ClarifyBuildOptions = ClarifyProjectConfig & {
15
15
  plugins?: ClarifyPlugin[];
16
16
  };
17
17
  export type ResolvedBuildOptions = {
18
+ projectRoot: string;
18
19
  rootDirectory: string;
19
20
  outputDirectory?: string;
20
21
  ssg: {
@@ -0,0 +1,17 @@
1
+ import { ClarifyHookContext, ClarifyPlugin, ContentRoute, NavigationTree } from '../types.js';
2
+ import { resolveProjectConfig } from './config.js';
3
+ import { ClarifyBuildOptions, ResolvedBuildOptions } from './options.js';
4
+ export type ResolvedClarifySite = {
5
+ root: string;
6
+ contentRoot: string;
7
+ projectConfig: ReturnType<typeof resolveProjectConfig>;
8
+ generateOptions: ResolvedBuildOptions;
9
+ plugins: ClarifyPlugin[];
10
+ ctx: ClarifyHookContext;
11
+ routes: ContentRoute[];
12
+ navigation: NavigationTree;
13
+ };
14
+ export type ResolveClarifySiteOptions = {
15
+ includeHtmlShellPlugin?: boolean;
16
+ };
17
+ export declare function resolveClarifySite(options?: ClarifyBuildOptions, resolveOptions?: ResolveClarifySiteOptions): Promise<ResolvedClarifySite>;
@@ -2,7 +2,9 @@ import { Plugin } from 'vite';
2
2
  import { ResolvedProjectConfig, ContentRoute } from '../types.js';
3
3
  export declare function readIndexHtml(outputDirectory: string): string | undefined;
4
4
  export declare function injectSSRIntoTemplate(template: string, appHtml: string, projectConfig: ResolvedProjectConfig, route?: ContentRoute): string;
5
- export declare const SSR_ENTRY_CODE = "import { renderToHTML } from '@clarify-labs/renderer/server';\nimport { routes, navigation } from 'virtual:clarify-routes/server';\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}";
5
+ export declare function isNotFoundRoute(route: ContentRoute): boolean;
6
+ export declare function routeOutputFiles(outputDirectory: string, route: ContentRoute): string[];
7
+ export declare const SSR_ENTRY_CODE = "import { renderToHTML } from '@clarify-labs/renderer/server';\nimport { routes, navigation } from 'virtual:clarify-routes/server';\nimport { config } from 'virtual:clarify-config';\nimport { openApis } from 'virtual:clarify-runtime';\n\nexport function render(url) {\n return renderToHTML({ config, routes, navigation, openApis, url, themeEditor: config.theme.editor });\n}";
6
8
  export declare function createTempEntryFile(content: string): string;
7
9
  export declare function buildSSRBundle(root: string, ssrEntry: string, ssrOutDir: string, plugins: Plugin[]): Promise<void>;
8
10
  export declare function renderSSGRoutes(routes: ContentRoute[], projectConfig: ResolvedProjectConfig, outputDirectory: string, ssrBundlePath: string, failOnError?: boolean): Promise<void>;
@@ -4,14 +4,14 @@ export declare const clarifyThemePresets: {
4
4
  readonly preset: "default";
5
5
  readonly tokens: {
6
6
  readonly colors: {
7
- readonly primary: "#00D492";
8
- readonly accent: "#00F6C9";
7
+ readonly primary: "#047857";
8
+ readonly accent: "#0D9488";
9
9
  readonly background: "#ffffff";
10
10
  readonly foreground: "#111827";
11
11
  readonly surface: "#ffffff";
12
12
  readonly muted: "#64748b";
13
13
  readonly border: "rgb(15 23 42 / 0.12)";
14
- readonly codeBackground: "#f7fefb";
14
+ readonly codeBackground: "#f6fbf8";
15
15
  };
16
16
  readonly radius: {
17
17
  readonly sm: "6px";
@@ -23,6 +23,7 @@ export declare const clarifyThemePresets: {
23
23
  readonly layout: {
24
24
  readonly maxWidth: "82rem";
25
25
  };
26
+ readonly editor: false;
26
27
  };
27
28
  readonly base: {
28
29
  readonly preset: "base";
@@ -47,6 +48,7 @@ export declare const clarifyThemePresets: {
47
48
  readonly layout: {
48
49
  readonly maxWidth: "80rem";
49
50
  };
51
+ readonly editor: false;
50
52
  };
51
53
  };
52
54
  export declare function resolveThemeConfig(theme?: ClarifyThemeConfig): ResolvedClarifyThemeConfig;
@@ -2,7 +2,7 @@ import { ContentRoute, NavigationTree, ResolvedBuildOptions, ResolvedProjectConf
2
2
  export declare const VIRTUAL_CONFIG = "virtual:clarify-config";
3
3
  export declare const VIRTUAL_ROUTES = "virtual:clarify-routes";
4
4
  export declare const VIRTUAL_SERVER_ROUTES = "virtual:clarify-routes/server";
5
- export declare const VIRTUAL_OPENAPI_REGISTRY = "virtual:clarify-openapi-registry";
5
+ export declare const VIRTUAL_RUNTIME = "virtual:clarify-runtime";
6
6
  export declare const VIRTUAL_CLIENT_ENTRY = "virtual:clarify-entry-client";
7
7
  export declare const RESOLVED_CLIENT_ENTRY: string;
8
8
  export type VirtualModules = Map<string, string>;
@@ -11,11 +11,16 @@ type BuildVirtualModulesArgs = {
11
11
  generateOptions: ResolvedBuildOptions;
12
12
  routes: ContentRoute[];
13
13
  navigation?: NavigationTree;
14
+ themeEditor?: boolean;
15
+ };
16
+ type CreateClientEntryModuleOptions = {
17
+ themeEditor?: boolean;
14
18
  };
15
19
  export declare function resolveVirtualId(id: string): string;
16
20
  export declare function stripVirtualPrefix(id: string): string;
17
21
  export declare function generateConfigModule(projectConfig: ResolvedProjectConfig, buildOptions: ResolvedBuildOptions): string;
18
22
  export declare function generateRoutesModule(routes: ContentRoute[], resolvedNavigation?: NavigationTree, projectConfig?: ResolvedProjectConfig, mode?: 'client' | 'server'): string;
19
- export declare function createClientEntryModule(): string;
23
+ export declare function createRuntimeModule(): string;
24
+ export declare function createClientEntryModule(options?: CreateClientEntryModuleOptions): string;
20
25
  export declare function buildVirtualModules(args: BuildVirtualModulesArgs): VirtualModules;
21
26
  export {};
package/output/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_plugin = require("./plugin--jQ6D6O4.cjs");
2
+ const require_plugin = require("./plugin-Dq1zHXan.cjs");
3
3
  exports.clarifyPlugin = require_plugin.clarifyPlugin;
4
4
  exports.defineConfig = require_plugin.defineConfig;
package/output/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as defineConfig, t as clarifyPlugin } from "./plugin-DChFdTyI.js";
1
+ import { n as defineConfig, t as clarifyPlugin } from "./plugin-BgE7WVoS.js";
2
2
  export { clarifyPlugin, defineConfig };
@@ -1,7 +1,9 @@
1
1
  import { ContentRoute, ContentSection, ClarifyNavigationNode, ClarifyPagesConfig, ClarifyPagesGroup, ClarifyLocalizedText, ClarifyTabsConfig, LocalizedNavigation, LocalizedTabbedNavigation, ResolvedClarifyI18nConfig, TabbedNavigation } from '../types.js';
2
2
  /** 从 MDX/Markdown 内容中提取 H2/H3 章节 */
3
3
  export declare function extractMdxSections(content: string): ContentSection[];
4
+ export declare function openAPITagsPathSegment(tags: string[]): string;
4
5
  export declare function basePathFromRef(ref: string): string;
6
+ export declare function openAPIPagePathFromRef(ref: string, tagFilter?: string[]): string;
5
7
  export declare function routePathFromRef(ref: string): string;
6
8
  export declare function virtualModuleIdFromRef(ref: string): string;
7
9
  export declare function localizedRoutePath(basePath: string, locale: string, i18n: ResolvedClarifyI18nConfig): string;