git-aiflow
Version:
🚀 An AI-powered workflow automation tool for effortless Git-based development, combining smart GitLab/GitHub merge & pull request creation with Conan package management.
157 lines • 4.51 kB
TypeScript
/**
* Load environment variables with ESM/CommonJS compatibility.
* Searches for .env file in current directory, parent directory, and working directory.
* This function should be called early in the application lifecycle.
*/
export declare function loadEnvironmentVariables(): void;
export interface AiflowConfig {
openai?: {
key?: string;
baseUrl?: string;
model?: string;
reasoning?: boolean | {
enabled?: boolean;
effort?: 'high' | 'medium' | 'low';
max_tokens?: number;
exclude?: boolean;
};
};
git_access_tokens?: {
[hostname: string]: string;
};
conan?: {
remoteBaseUrl?: string;
remoteRepo?: string;
};
wecom?: {
webhook?: string;
enable?: boolean;
};
git?: {
squashCommits?: boolean;
removeSourceBranch?: boolean;
generation_lang?: string;
};
merge_request?: {
assignee_id?: number;
assignee_ids?: number[];
reviewer_ids?: number[];
};
}
export interface ConfigSource {
source: 'cli' | 'local' | 'global' | 'env';
path?: string;
}
export interface LoadedConfig extends AiflowConfig {
_sources: Map<string, ConfigSource>;
}
/**
* Configuration loader with priority-based merging
* Priority order: CLI args > Local config > Global config > Environment variables
*/
export declare class ConfigLoader {
private static readonly LOCAL_CONFIG_PATH;
private static readonly GLOBAL_CONFIG_DIR;
private static readonly GLOBAL_CONFIG_FILE;
private readonly warnings;
/**
* Load configuration with priority merging
*/
loadConfig(cliArgs?: Partial<AiflowConfig>): Promise<LoadedConfig>;
/**
* Get configuration warnings
*/
getWarnings(): string[];
/**
* Clear warnings
*/
clearWarnings(): void;
/**
* Get user data directory path
*/
private getUserDataDir;
/**
* Merge environment variables into config
*/
private mergeEnvConfig;
/**
* Parse environment variable value
*/
private parseEnvValue;
/**
* Merge global config file into config
*/
private mergeGlobalConfig;
/**
* Merge local config file into config
*/
private mergeLocalConfig;
/**
* Merge YAML config file into config
*/
private mergeYamlConfig;
/**
* Merge CLI arguments into config
*/
private mergeCliConfig;
/**
* Recursively merge config objects
*/
private mergeConfigRecursively;
/**
* Set nested value in object using dot notation
*/
private setNestedValue;
/**
* Validate configuration and generate warnings
*/
private validateConfig;
/**
* Get nested value from object using dot notation
*/
private getNestedValue;
/**
* Print configuration sources for debugging
*/
printConfigSources(config: LoadedConfig): void;
/**
* Create example configuration files
*/
createExampleConfigs(): Promise<void>;
}
export declare const configLoader: ConfigLoader;
/**
* Get configuration value with fallback
*/
export declare function getConfigValue<T>(config: LoadedConfig, path: string, fallback?: T): T | undefined;
/**
* Get Git access token for a specific hostname
* @param config Loaded configuration
* @param hostname Git hostname (e.g., 'github.com', 'gitlab.example.com')
* @returns Access token for the hostname or undefined if not found
*/
export declare function getGitAccessToken(config: LoadedConfig, hostname: string): string | undefined;
/**
* Get all configured Git access tokens
* @param config Loaded configuration
* @returns Object with hostname -> token mappings
*/
export declare function getAllGitAccessTokens(config: LoadedConfig): Record<string, string>;
/**
* Parse CLI arguments to config format
* Supports both long (--key) and short (-k) argument formats
*/
export declare function parseCliArgs(args: string[]): Partial<AiflowConfig>;
/**
* Get help text for CLI arguments
*/
export declare function getCliHelp(): string;
/**
* Interactive configuration initialization
*/
export declare function initConfig(isGlobal?: boolean): Promise<void>;
/**
* Create configuration file
*/
export declare function createConfigFile(configData: any, isGlobal: boolean, configModules?: string[], isIncrementalMode?: boolean): Promise<void>;
//# sourceMappingURL=config.d.ts.map