import type { IRNode, KernTarget, ParseDiagnostic, ResolvedKernConfig, SchemaViolation, ShadowAnalyzeOptions, ShadowDiagnostic } from '@kernlang/core'; export declare const GENERATED_HEADER = "// @generated by kern v4.5.0 \u2014 DO NOT EDIT. Source: "; export declare function parseCompilerVersion(version: string): [number, number, number] | null; /** * Check the existing output file's @generated stamp against the current compiler version. * Emits a warning when the stamp is newer (downgrade) or older by a minor/major (drift). * Stays silent on patch-level drift and on first compile. */ export declare function checkVersionDrift(outFilePath: string, sourceFile: string): void; export declare function writeSidecarInstallFiles(ast: IRNode, outDir: string): void; interface SidecarInstallFileOptions { sidecarIslandsOnly?: boolean; } export declare function writeSidecarInstallFilesForAsts(asts: Iterable, outDir: string, options?: SidecarInstallFileOptions): void; export declare function writeFastApiPythonInstallFilesForAsts(asts: Iterable, outDir: string): void; type TranspileAndWriteOptions = import('@kernlang/core').ParseOptions & { fastApiEntryModules?: string[]; fastApiModuleNameByFile?: Record; fastApiModulePathByFile?: Record; outputBaseName?: string; outputRelDir?: string; writeSidecarInstallFiles?: boolean; }; /** Get value of --flag=value */ export declare function parseFlag(args: string[], flag: string): string | undefined; /** Get value of --flag=value OR --flag (next positional arg) */ export declare function parseFlagOrNext(args: string[], flag: string): string | undefined; /** Check if any of the given flags are present */ export declare function hasFlag(args: string[], ...flags: string[]): boolean; export declare function surfaceParseDiagnostics(diagnostics: ParseDiagnostic[], file?: string): { errors: number; warnings: number; }; export declare function surfaceValidationDiagnostics(root: IRNode, file?: string): { errors: number; warnings: number; }; export declare function parseAndSurface(source: string, file?: string, options?: import('@kernlang/core').ParseOptions, surfaceValidation?: boolean): IRNode; export interface FileDiagnosticsJSON { file: string; success: boolean; diagnostics: ParseDiagnostic[]; schemaViolations: SchemaViolation[]; shadowDiagnostics?: ShadowDiagnostic[]; /** Islands are the owner view; externalBoundaries includes the same child imports with inherited island metadata. */ capabilityIslands: import('@kernlang/core').CapabilityIsland[]; sidecarManifests: import('@kernlang/core').SidecarManifest[]; externalBoundaries: import('@kernlang/core').ExternalBoundary[]; } /** Parse a .kern file and return structured diagnostics as JSON-serializable object. */ export declare function parseWithJSONDiagnostics(source: string, file: string, options?: import('@kernlang/core').ParseOptions): { root: IRNode; json: FileDiagnosticsJSON; }; /** Get the output file extension for a given target. Deduplicates the ternary chain. */ export declare function getOutputExtension(target: KernTarget): string; export declare function pythonModuleName(name: string): string; export declare function outputBaseNameForTarget(name: string, target: KernTarget): string; export declare function withFastApiEntryModules(cfg: ResolvedKernConfig, entryModules: string[]): ResolvedKernConfig; export declare function withFastApiModuleMap(cfg: ResolvedKernConfig, sourceFile: string, moduleNameByFile?: Record, modulePathByFile?: Record): ResolvedKernConfig; /** Extract exported symbol names from generated TypeScript lines, distinguishing type-only exports. */ export declare function extractExportsFromLines(lines: string[]): { name: string; typeOnly: boolean; }[]; export interface BarrelEntry { moduleName: string; exports: { name: string; typeOnly: boolean; }[]; } /** Scan output directory for .ts/.tsx files and build barrel entries from their exports. */ export declare function scanOutputForBarrelEntries(outDir: string): BarrelEntry[]; /** Generate a barrel index file that re-exports from all compiled modules. */ export declare function generateBarrelFile(outDir: string, entries: BarrelEntry[]): void; /** Generate facade re-export files and an index.ts that re-exports from facades. */ export declare function generateFacadeFiles(outDir: string, facadesDirOverride: string | undefined, entries: BarrelEntry[]): void; export declare function findNearestPackageJson(startDir: string): string | null; export declare function findKernFiles(dir: string, singleFile?: string): string[]; export declare function collectTsFilesFlat(dirPath: string, recursive: boolean): string[]; export declare function transpileForTarget(ast: IRNode, cfg: ResolvedKernConfig): import("@kernlang/core").TranspileResult; export declare function transpileAndWrite(file: string, cfg: ResolvedKernConfig, args: string[], outDirOverride?: string, inputBase?: string, options?: TranspileAndWriteOptions): void; export declare function loadConfig(): ResolvedKernConfig; export declare function loadTemplates(cfg: ResolvedKernConfig): void; /** * Run shadow semantic analysis on an already-parsed IR root. Wraps analyzeShadow() * and swallows errors from the optional `typescript` peer so a missing peer becomes * a single diagnostic rather than a crash. */ export declare function runShadowAnalysis(root: IRNode, options?: ShadowAnalyzeOptions): Promise; /** * Print shadow diagnostics to the console using the same shape as parse diagnostics. * Returns the error / warning / info counts so callers can update their totals. */ export declare function surfaceShadowDiagnostics(diagnostics: readonly ShadowDiagnostic[], file: string): { errors: number; warnings: number; }; export {};