@five-vm/cli
Version:
High-performance CLI for Five VM development with WebAssembly integration
121 lines • 3.69 kB
TypeScript
/**
* Five CLI Configuration Manager
*
* Handles configuration file loading, saving, and management with XDG directory support.
* Implements singleton pattern for global config access throughout the CLI.
*/
import type { FiveConfig, ConfigTarget } from './types.js';
/**
* Configuration management errors
*/
export declare class ConfigError extends Error {
cause?: Error | undefined;
constructor(message: string, cause?: Error | undefined);
}
/**
* Five CLI Configuration Manager
*
* Manages configuration file operations with XDG Base Directory support.
* Provides a singleton interface for configuration access across the CLI.
*/
export declare class ConfigManager {
private static instance;
private config;
private configPath;
private initialized;
/**
* Private constructor for singleton pattern
*/
private constructor();
/**
* Get the singleton ConfigManager instance
*/
static getInstance(): ConfigManager;
/**
* Get the XDG-compliant config file path
* Follows XDG Base Directory specification:
* - Uses $XDG_CONFIG_HOME if set
* - Falls back to ~/.config/five/config.json
*/
getConfigPath(): string;
/**
* Initialize the configuration system
* Creates config directory and default config file if they don't exist
*/
init(): Promise<void>;
/**
* Load configuration from file
* @throws ConfigError if file doesn't exist or is invalid
*/
load(): Promise<FiveConfig>;
/**
* Save current configuration to file
* @throws ConfigError if save operation fails
*/
save(): Promise<void>;
/**
* Get the current configuration
* Ensures the config manager is initialized
*/
get(): Promise<FiveConfig>;
/**
* Update configuration with partial values
* @param updates Partial configuration updates
*/
set(updates: Partial<FiveConfig>): Promise<void>;
/**
* Set the target network
* @param target The target network to set
*/
setTarget(target: ConfigTarget): Promise<void>;
/**
* Set the keypair file path
* @param keypairPath Path to the keypair file
*/
setKeypair(keypairPath: string): Promise<void>;
/**
* Toggle config display in command output
* @param show Whether to show config details
*/
setShowConfig(show: boolean): Promise<void>;
/**
* Get the current target network
*/
getTarget(): Promise<ConfigTarget>;
/**
* Get the current network endpoint configuration
*/
getCurrentNetworkEndpoint(): Promise<import("./types.js").NetworkEndpoint>;
/**
* Reset configuration to defaults
*/
reset(): Promise<void>;
/**
* Check if the configuration is properly initialized
*/
isInitialized(): boolean;
/**
* Apply configuration overrides and return merged config
* @param overrides CLI option overrides
* @returns Merged configuration with overrides applied
*/
applyOverrides(overrides: import('./types.js').ConfigOverrides): Promise<FiveConfig & {
networks: any;
keypairPath: string;
}>;
/**
* Get target context prefix for display
* @param target The target network
* @returns Formatted target prefix like '[devnet]'
*/
static getTargetPrefix(target: import('./types.js').ConfigTarget): string;
/**
* Get default keypair path following Solana CLI conventions
*/
private getDefaultKeypairPath;
}
/**
* Singleton instance export for convenient access
*/
export declare const configManager: ConfigManager;
//# sourceMappingURL=ConfigManager.d.ts.map