import { ZodError } from 'zod'; import { type GeneracyConfig } from './schema.js'; /** * Error thrown when config file cannot be found */ export declare class ConfigNotFoundError extends Error { readonly startDir: string; readonly searchPath: string[]; constructor(startDir: string, searchPath: string[]); } /** * Error thrown when config file contains invalid YAML */ export declare class ConfigParseError extends Error { readonly filePath: string; readonly cause: Error; constructor(filePath: string, cause: Error); } /** * Error thrown when config file fails schema validation */ export declare class ConfigSchemaError extends Error { readonly filePath: string; readonly errors: ZodError; constructor(filePath: string, errors: ZodError); } /** * Find the config file by walking up the directory tree * * @param startDir - Directory to start searching from * @returns Absolute path to config file, or null if not found * * Discovery order: * 1. Check for .generacy/config.yaml in current directory * 2. Walk up parent directories until found * 3. Stop at repository root (detected via .git/ directory) * 4. Return null if not found */ export declare function findConfigFile(startDir?: string): string | null; /** * Parse and validate a YAML config string * * @param yamlContent - YAML content as string * @returns Validated configuration * @throws ConfigParseError if YAML parsing fails * @throws ConfigSchemaError if validation fails * @throws ConfigValidationError if semantic validation fails * * @example * ```typescript * const config = parseConfig(` * project: * id: "proj_abc123" * name: "My Project" * repos: * primary: "github.com/acme/main" * `); * ``` */ export declare function parseConfig(yamlContent: string): GeneracyConfig; /** * Options for loading configuration */ export interface LoadConfigOptions { /** * Directory to start searching from * Default: process.cwd() */ startDir?: string; /** * Explicit config file path (skips discovery) * Default: undefined (will search using findConfigFile) */ configPath?: string; } /** * Load and validate configuration from filesystem * * Discovery process: * 1. If GENERACY_CONFIG_PATH env var is set, use that path * 2. If options.configPath is provided, use that path * 3. Otherwise, search for .generacy/config.yaml using findConfigFile * * @param options - Loading options * @returns Validated configuration * @throws ConfigNotFoundError if config file not found * @throws ConfigParseError if YAML parsing fails * @throws ConfigSchemaError if validation fails * @throws ConfigValidationError if semantic validation fails * * @example * ```typescript * // Auto-discover config * const config = loadConfig(); * * // Explicit path * const config = loadConfig({ configPath: '/path/to/config.yaml' }); * * // Start search from specific directory * const config = loadConfig({ startDir: '/workspace/project' }); * ``` */ export declare function loadConfig(options?: LoadConfigOptions): GeneracyConfig; //# sourceMappingURL=loader.d.ts.map