/** * Lex YAML Configuration Loader * * Finds and loads lex.yaml configuration with precedence chain and auto-detection. */ import { LexYaml } from "./lex-yaml-schema.js"; /** * Result of loading lex.yaml configuration */ export interface LoadResult { /** Whether configuration was successfully loaded */ success: boolean; /** The loaded and validated configuration, or null if not found/invalid */ config: LexYaml | null; /** Path where the config was found, or null if auto-detected defaults used */ path: string | null; /** Source of the configuration */ source: "file" | "auto-detect"; /** Error message if loading failed */ error?: string; } /** * Load lex.yaml configuration from a repository * * Precedence chain: * 1. `lex.yaml` in repo root * 2. `.smartergpt/lex.yaml` * 3. Auto-detect defaults if neither exists * * @param repoRoot - Absolute path to the repository root * @returns Load result with config or error details * * @example * ```ts * const result = loadLexYaml('/path/to/repo'); * if (result.success && result.config) { * console.log("Config loaded from:", result.path ?? "auto-detect"); * console.log("Canonical path:", result.config.instructions?.canonical); * } * ``` */ export declare function loadLexYaml(repoRoot: string): LoadResult; /** * Load lex.yaml configuration, throwing AXError if workspace is initialized but config missing. * * This is the "strict" version of loadLexYaml for use in CLI commands after `lex init`. * If `.smartergpt/` directory exists but no lex.yaml is found, it throws an AXErrorException * to guide the user to create the config file. * * @param repoRoot - Absolute path to the repository root * @returns Load result with config (never null) * @throws {AXErrorException} if workspace initialized but lex.yaml missing * * @example * ```ts * try { * const result = loadLexYamlStrict('/path/to/repo'); * console.log("Config loaded from:", result.path ?? "auto-detect"); * } catch (err) { * if (err instanceof AXErrorException) { * console.log("Follow:", err.error.nextActions); * } * } * ``` */ export declare function loadLexYamlStrict(repoRoot: string): LoadResult; /** * Get the default configuration (for testing/reference) */ export declare function getDefaultConfig(): LexYaml;