/** * YAML load/save helpers with deterministic serialization and schema validation. * * - `loadYaml()` loads and optionally validates a YAML file. * - `saveYaml()` serializes data deterministically (stable key order, block style) * so that single-field changes produce minimal git diffs (≤ 3 lines). * * Requirements: 4.2 (minimal diffs), 4.7 (validation errors name the file). */ /** * A lightweight schema validator function. * Returns null/undefined when valid, or an error message string on failure. */ export type SchemaValidator = (data: unknown) => string | null | undefined; /** * Error thrown when YAML loading or validation fails. * Always includes the file path and a description of the failure. */ export declare class YamlLoadError extends Error { readonly filePath: string; readonly reason: string; constructor(filePath: string, reason: string); } /** * Load a YAML file, parse it, and optionally validate the result. * * @param filePath - Absolute or relative path to the YAML file. * @param validate - Optional validator; receives parsed data, returns error string on failure. * @returns The parsed (and validated) data cast to `T`. * @throws {YamlLoadError} If the file is missing, unparseable, or fails validation. */ export declare function loadYaml(filePath: string, validate?: SchemaValidator): T; /** * Serialize `data` to YAML with deterministic output and write it to `filePath`. * * Deterministic properties: * - Stable key order (sorted alphabetically). * - Block style for readability. * - No line wrapping — one scalar per line. * - Repeated calls with the same data produce byte-identical output. * * Creates parent directories if they don't exist. * * @param filePath - Absolute or relative path for the output file. * @param data - The data to serialize. */ export declare function saveYaml(filePath: string, data: unknown): void; /** * Serialize data to a YAML string with deterministic formatting. * Exported for testing without filesystem side effects. */ export declare function serializeYaml(data: unknown): string; //# sourceMappingURL=yaml-helpers.d.ts.map