/** * Configuration loader. * * Precedence: environment variables → TOML config file → defaults. */ import type { AppConfig } from '../types/index.js'; import type { RawAppConfig } from './schema.js'; import { CONFIG_FILE, xdg } from './xdg.js'; /** * Load raw (snake_case) config from TOML file without normalization. * Useful for read-modify-write operations in CLI commands. * Throws if no config file exists or validation fails. */ export declare function loadRawConfig(configPath?: string): Promise; export declare function loadConfig(configPath?: string): Promise; /** * Save configuration to a TOML file. */ /** * Write the commented starter config. * * Not expressible through saveConfig: that serialises a config object, which * would drop every explanatory comment the template exists for. The * permissions matter as much as the content — the command's own next * instruction is to edit this file and add an account password, so it must not * be born world-readable. */ export declare function writeConfigTemplate(filePath?: string): Promise; export declare function saveConfig(config: RawAppConfig, filePath?: string): Promise; export interface SaveResult { /** Set when a previous file existed and was backed up. */ backupPath?: string; /** * True when this save overwrote a file that still carried `#` comments and * no `.bak` existed yet — callers should surface a one-time notice, since * smol-toml stringify cannot preserve comments. */ commentsLost: boolean; } /** * Validate, back up, then save. * * Zod-parses BEFORE any disk write (an invalid object never clobbers a valid * file), then best-effort copies the previous file bytes to `.bak` so a * bad save (or the inevitable comment loss) is recoverable. * * Note: raw configs are fully materialized by the schema defaults, so every * save writes every key explicitly — future default changes will not reach a * file once it has been saved. That has always been true of every save path. */ export declare function saveConfigValidated(config: RawAppConfig, filePath?: string): Promise; /** * Generate a template TOML config string. */ export declare function generateTemplate(): string; /** * Check if a config file exists at the default XDG path. */ export declare function configExists(filePath?: string): Promise; /** Re-export for convenience */ export { CONFIG_FILE, xdg }; //# sourceMappingURL=loader.d.ts.map