UNPKG

@elsikora/commitizen-plugin-commitlint-ai

Version:
67 lines (66 loc) 2.96 kB
import type { IConfigService } from '../../application/interface/config-service.interface'; import type { IConfig } from '../../application/interface/config.interface'; import type { IFileSystemService } from '../../application/interface/file-system-service.interface'; /** * Implementation of ConfigService that uses cosmiconfig for configuration management. * Cosmiconfig searches for configuration in standard locations and formats. */ export declare class CosmicConfigService implements IConfigService { /** File system service for file operations */ readonly FILE_SYSTEM_SERVICE: IFileSystemService; private cachedConfig; private readonly EXPLORER; /** * Initializes a new instance of the CosmicConfigService. * @param {IFileSystemService} fileSystemService - The file system service for file operations */ constructor(fileSystemService: IFileSystemService); /** * Clears all caches. */ clearCaches(): void; /** * Checks if the configuration exists. * @returns {Promise<boolean>} Promise resolving to true if the configuration exists, false otherwise */ exists(): Promise<boolean>; /** * Retrieves the current configuration. * @returns {Promise<IConfig>} Promise resolving to the configuration object */ get(): Promise<IConfig>; /** * Gets a specific property from the configuration. * @param {K} property - The property key to retrieve * @returns {Promise<IConfig[K]>} Promise resolving to the value of the specified property * @template K - The type of the property key */ getProperty<K extends keyof IConfig>(property: K): Promise<IConfig[K]>; /** * Merges partial configuration with the existing configuration. * @param {Partial<IConfig>} partial - Partial configuration to merge * @returns {Promise<void>} Promise that resolves when the merged configuration is saved */ merge(partial: Partial<IConfig>): Promise<void>; /** * Saves the entire configuration. * @param {IConfig} config - The complete configuration to save * @returns {Promise<void>} Promise that resolves when the configuration is saved */ set(config: IConfig): Promise<void>; /** * Sets a specific property in the configuration. * @param {K} property - The property key to set * @param {IConfig[K]} value - The value to assign to the property * @returns {Promise<void>} Promise that resolves when the updated configuration is saved * @template K - The type of the property key */ setProperty<K extends keyof IConfig>(property: K, value: IConfig[K]): Promise<void>; /** * Writes configuration to a file. * @param {string} filepath - Path to write the configuration to * @param {IConfig} config - Configuration to write * @returns {Promise<void>} Promise that resolves when the file is written */ private writeFile; }