/** * Kern Configuration Types */ import type { IRNode } from './types.js'; export type KernTarget = 'auto' | 'lib' | 'nextjs' | 'tailwind' | 'web' | 'native' | 'express' | 'cli' | 'terminal' | 'ink' | 'vue' | 'nuxt' | 'fastapi' | 'mcp' | 'python' | 'go'; /** Concrete transpiler targets (displayed to users). */ export declare const VALID_TARGETS: KernTarget[]; /** All accepted target values including meta-targets like 'auto'. */ export declare const ALL_TARGETS: KernTarget[]; export type KernStructure = 'flat' | 'bulletproof' | 'atomic' | 'kern'; export declare const VALID_STRUCTURES: KernStructure[]; export interface FrameworkVersions { react?: string; tailwind?: string; nextjs?: string; } export type ExpressSecurityLevel = 'strict' | 'relaxed'; export interface KernConfig { target?: KernTarget; structure?: KernStructure; frameworkVersions?: FrameworkVersions; templates?: string[]; emit?: string; pythonModelBackend?: 'pydantic' | 'sqlmodel' | 'auto'; /** Severity for raw (unmarked) TS fences dropped by the python target. Default 'warning'. */ pythonFenceSeverity?: 'error' | 'warning' | 'info'; i18n?: { enabled?: boolean; hookName?: string; importPath?: string; }; components?: { uiLibrary?: string; componentRoot?: string; mappings?: Record; }; colors?: Record; output?: { outDir?: string; sourceMaps?: boolean; }; express?: { security?: ExpressSecurityLevel; helmet?: boolean; compression?: boolean; prisma?: { provider?: 'postgresql' | 'mysql' | 'sqlite' | 'sqlserver' | 'mongodb'; }; }; fastapi?: { security?: 'strict' | 'relaxed'; cors?: boolean; gzip?: boolean; uvicorn?: { host?: string; reload?: boolean; workers?: number; }; }; review?: { /** Show confidence scores in review output (default: false) */ showConfidence?: boolean; /** Cross-stack review precision mode: guard is high precision, audit is broader. */ crossStackMode?: 'guard' | 'audit'; /** Named review posture. `ci` tightens defaults when selected by the CLI. */ policy?: 'guard' | 'ci' | 'audit'; /** Minimum confidence for findings to count in enforcement (default: 0) */ minConfidence?: number; /** Maximum cognitive complexity allowed (default: 15) */ maxComplexity?: number; /** Rule IDs to disable project-wide */ disabledRules?: string[]; /** When true, the `missing-confidence` finding fires for .kern files without confidence annotations. Default: false (opt-in). */ requireConfidenceAnnotations?: boolean; /** Declare intentional public API so dead-export doesn't flag symbols consumed externally. */ publicApi?: { /** * Paths or POSIX-style globs (project-relative or absolute) whose * exports are all public. Supports `*`, `**`, `?`, and `[...]` — * e.g. `packages/*\/src/index.ts` or `src/registry/**\/*.handler.ts`. */ files?: string[]; /** Per-symbol overrides in `path#name` form. */ symbols?: string[]; }; /** Persist machine-readable review telemetry when enabled. */ telemetry?: { enabled?: boolean; outputPath?: string; append?: boolean; includeFindings?: boolean; }; }; } /** Fully resolved config — all fields required, no optionals */ export interface ResolvedKernConfig { target: KernTarget; structure: KernStructure; frameworkVersions: FrameworkVersions; templates: string[]; emit?: string; pythonModelBackend?: 'pydantic' | 'sqlmodel' | 'auto'; pythonFenceSeverity?: 'error' | 'warning' | 'info'; i18n: { enabled: boolean; hookName: string; importPath: string; }; components: { uiLibrary: string; componentRoot: string; mappings: Record; }; colors: Record; output: { outDir: string; sourceMaps: boolean; }; express: { security: ExpressSecurityLevel; helmet: boolean; compression: boolean; prisma: { provider: 'postgresql' | 'mysql' | 'sqlite' | 'sqlserver' | 'mongodb'; }; }; fastapi: { security: 'strict' | 'relaxed'; cors: boolean; gzip: boolean; uvicorn: { host: string; reload: boolean; workers?: number; }; }; review: { showConfidence: boolean; crossStackMode: 'guard' | 'audit'; policy?: 'guard' | 'ci' | 'audit'; minConfidence: number; maxComplexity: number; disabledRules: string[]; requireConfidenceAnnotations: boolean; publicApi: { files: string[]; symbols: string[]; }; telemetry: { enabled: boolean; outputPath?: string; append: boolean; includeFindings: boolean; }; }; } export declare const DEFAULT_CONFIG: ResolvedKernConfig; /** * Merge a partial user config with defaults to produce a fully resolved config. * * @param user - Partial config overrides. Omit for defaults. * @returns A deep-cloned {@link ResolvedKernConfig} with all fields populated. * @throws {KernConfigError} If `target` or `structure` values are not in the valid set. * * @example * ```ts * const cfg = resolveConfig({ target: 'express', express: { helmet: true } }); * // cfg.target === 'express', cfg.i18n.enabled === true (default) * ``` */ export declare function resolveConfig(user?: Partial): ResolvedKernConfig; /** * Auto-detect the appropriate transpiler target from AST content. * * Inspects top-level node types to determine the best target: * - screen nodes → 'ink' (terminal UI) * - server/route/middleware → 'express' * - mcp/tool/resource → 'mcp' * - cli/command → 'cli' * - Otherwise → 'nextjs' (default) * * Examines screen target= props for explicit overrides. */ export declare function detectTarget(ast: IRNode): KernTarget; /** @deprecated Use resolveConfig instead */ export declare function mergeConfig(user: Partial): KernConfig;