/**
 * Settings Management Service
 *
 * Handles persistence and validation of Crewly application settings.
 * Settings are stored in ~/.crewly/settings.json.
 *
 * @module services/settings/settings.service
 */
import { CrewlySettings, UpdateSettingsInput, SettingsValidationResult, ApiKeyProvider, ApiKeyResolutionContext } from '../../types/settings.types.js';
/**
 * Error thrown when settings validation fails
 */
export declare class SettingsValidationError extends Error {
    readonly errors: string[];
    constructor(errors: string[]);
}
/**
 * Error thrown when settings file cannot be read or parsed
 */
export declare class SettingsFileError extends Error {
    readonly cause?: Error | undefined;
    constructor(message: string, cause?: Error | undefined);
}
/**
 * Service for managing Crewly application settings
 *
 * Settings are stored in ~/.crewly/settings.json by default.
 * Default values are used when no settings file exists.
 *
 * @example
 * ```typescript
 * const service = getSettingsService();
 *
 * // Get current settings
 * const settings = await service.getSettings();
 *
 * // Update settings
 * await service.updateSettings({
 *   general: { verboseLogging: true },
 * });
 *
 * // Reset to defaults
 * await service.resetSettings();
 * ```
 */
export declare class SettingsService {
    private readonly settingsDir;
    private readonly settingsFile;
    private settingsCache;
    /**
     * Create a new SettingsService instance
     *
     * @param options - Configuration options
     * @param options.settingsDir - Directory for settings file
     */
    constructor(options?: {
        settingsDir?: string;
    });
    /**
     * Get current settings, loading from file if not cached
     *
     * If settings file doesn't exist or is invalid, returns default settings.
     *
     * @returns Current settings
     */
    getSettings(): Promise<CrewlySettings>;
    /**
     * Update settings with partial input
     *
     * Merges the input with current settings and validates before saving.
     *
     * @param input - Partial settings to update
     * @returns Updated settings
     * @throws {SettingsValidationError} If validation fails
     */
    updateSettings(input: UpdateSettingsInput): Promise<CrewlySettings>;
    /**
     * Reset all settings to defaults
     *
     * @returns Default settings
     */
    resetSettings(): Promise<CrewlySettings>;
    /**
     * Reset a specific settings section to defaults
     *
     * @param section - The section to reset ('general', 'chat', or 'skills')
     * @returns Updated settings
     */
    resetSection(section: keyof CrewlySettings): Promise<CrewlySettings>;
    /**
     * Validate settings input without saving
     *
     * Useful for form validation before submission.
     *
     * @param input - Settings to validate
     * @returns Validation result
     */
    validateSettingsInput(input: UpdateSettingsInput): Promise<SettingsValidationResult>;
    /**
     * Export settings to a file
     *
     * @param exportPath - Path to export file
     */
    exportSettings(exportPath: string): Promise<void>;
    /**
     * Import settings from a file
     *
     * Validates imported settings before saving.
     *
     * @param importPath - Path to import file
     * @returns Imported settings
     * @throws {SettingsValidationError} If imported settings are invalid
     * @throws {SettingsFileError} If file cannot be read or parsed
     */
    importSettings(importPath: string): Promise<CrewlySettings>;
    /**
     * Resolve an API key through the override chain: skill → runtime → global → env var
     *
     * @param provider - The API key provider (gemini, anthropic, openai)
     * @param context - Optional context with runtime and/or skill for override resolution
     * @returns The resolved API key or undefined if not configured anywhere
     */
    getApiKey(provider: ApiKeyProvider, context?: ApiKeyResolutionContext): Promise<string | undefined>;
    /**
     * Clear the settings cache
     *
     * Forces the next getSettings call to reload from disk.
     */
    clearCache(): void;
    /**
     * Get the path to the settings file
     *
     * @returns Absolute path to settings.json
     */
    getSettingsFilePath(): string;
    /**
     * Check if a settings file exists
     *
     * @returns True if settings file exists
     */
    hasSettingsFile(): Promise<boolean>;
    /**
     * Migrate legacy settings format to current format
     *
     * Converts old claudeCodeCommand/claudeCodeInitScript fields
     * to the new runtimeCommands map.
     *
     * @param loaded - Partially loaded settings from disk
     */
    private migrateSettings;
    /**
     * Save settings to disk
     *
     * @param settings - Settings to save
     */
    private saveSettings;
}
/**
 * Get the singleton SettingsService instance
 *
 * @returns The SettingsService instance
 */
export declare function getSettingsService(): SettingsService;
/**
 * Reset the singleton instance (for testing)
 */
export declare function resetSettingsService(): void;
//# sourceMappingURL=settings.service.d.ts.map