/** * Configuration Loader * * Handles loading, saving, and merging configuration files */ import { type FeaturesConfig, type PluginatorConfig } from '../core/types/config.js'; import type { Plugin } from '../core/types/plugin.js'; import type { SourceConfig } from '../core/types/source.js'; import { type ThemeColorsInput } from './defaults.js'; /** * Configuration loading result */ export interface ConfigLoadResult { success: boolean; data: T; errors?: string[]; source: 'file' | 'default' | 'merged'; } /** * Load the main app config */ export declare function loadConfig(configPath?: string): Promise>; /** * Save the main app config with proper formatting and section headers */ export declare function saveConfig(config: PluginatorConfig, configPath?: string): Promise; /** * Load plugins config */ export declare function loadPlugins(pluginsPath?: string): Promise>; /** * Load all plugins from both prod and test files */ export declare function loadAllPlugins(): Promise>; /** * Ensure the data directory exists */ export declare function ensureDataDirectory(): Promise; /** * Save plugins config */ export declare function savePlugins(plugins: Plugin[], pluginsPath?: string): Promise; /** * Update the enabled state of plugins across ALL plugin files. * Only modifies the `enabled` field — preserves each file's source types and other data. */ export declare function updatePluginEnabledStates(updates: Map): Promise; /** * Load sources config */ export declare function loadSources(sourcesPath?: string): Promise>; /** * Save sources config */ export declare function saveSources(sources: SourceConfig[], sourcesPath?: string): Promise; /** * Load theme configuration * * Note: Custom theme files are no longer supported as of v1.15.0. * This function now always returns the default theme colors. * Use bundled theme presets via ThemeProvider instead. */ export declare function loadTheme(): ConfigLoadResult; /** * Load features configuration (v2.0.1 - Plan 12) * Loads from ~/.pluginator/features.json, merges with defaults */ export declare function loadFeatures(featuresPath?: string): Promise>; /** * Save features configuration (v2.0.1 - Plan 12) */ export declare function saveFeatures(features: FeaturesConfig, featuresPath?: string): Promise; /** * Clean leftover .tmp.* files from a directory. * Handles crash-mid-write scenarios where atomic writes left temp files behind. */ export declare function cleanStaleTempFiles(configDir: string): Promise; /** * Initialize config files with defaults * Creates config and sources in ~/.pluginator/ if they don't exist */ export declare function initializeConfig(): Promise; /** * Initialize all required data files after setup wizard completion */ export declare function initializeDataFiles(options: { prodPlugins?: Plugin[]; testPlugins?: Plugin[]; config?: PluginatorConfig; }): Promise; /** * Configuration manager class for centralized access */ export declare class ConfigManager { private config; private plugins; private sources; private theme; private features; private loaded; /** * Load all config files */ load(): Promise; /** * Get the main config */ getConfig(): PluginatorConfig; /** * Get plugins list */ getPlugins(): Plugin[]; /** * Get sources list */ getSources(): SourceConfig[]; /** * Get theme colors */ getTheme(): ThemeColorsInput; /** * Get features config (v2.0.1 - Plan 12) */ getFeatures(): FeaturesConfig; /** * Check if loaded */ isLoaded(): boolean; /** * Update config value */ setConfigValue(key: K, value: PluginatorConfig[K]): void; /** * Update features config (v2.0.1 - Plan 12) */ setFeatures(features: Partial): void; /** * Save all config files */ save(): Promise; } /** * Get or create the global config manager */ export declare function getConfigManager(): ConfigManager; //# sourceMappingURL=loader.d.ts.map