@entro314labs/ai-changelog-generator
Version:
AI-powered changelog generator with MCP server support - works with most providers, online and local models
228 lines (227 loc) • 9.03 kB
TypeScript
/**
* Unified Configuration Manager
* Consolidates config.js, model-config.js, and interactive-config.js logic
* Enhanced with YAML changelog configuration support
* Now supports automatic credential detection from various sources
*
* Responsibilities:
* - Environment configuration loading
* - Model configuration management
* - Provider configuration
* - Changelog configuration (YAML)
* - Automatic credential detection (Gemini CLI, Claude Code, GitHub Copilot)
* - OAuth token management
* - Validation and recommendations
*/
export declare class ConfigurationManager {
[key: string]: any;
constructor(configPath?: any, changelogConfigPath?: any, options?: Record<string, any>);
findConfigFile(): string;
/**
* Locate the `.ai-changelog.json` settings file. Searches the current working
* directory first, then walks up parent directories so the file is
* discoverable from anywhere inside a project. The walk is bounded to the
* project: it stops after inspecting the first directory that looks like a
* project/repository root (contains `.git` or `package.json`) so discovery
* never escapes into unrelated parent directories such as the user's home.
* @returns {string|null} Absolute path to the file, or null when not found.
*/
findJsonConfigFile(): string | null;
/**
* Load and parse the `.ai-changelog.json` settings file.
* @returns {Record<string, any>} Parsed JSON object, or an empty object when
* the file is absent or cannot be parsed.
*/
loadJsonConfig(): Record<string, any>;
findChangelogConfigFile(): string | null;
loadDefaultConfig(): Record<string, any>;
/**
* Read the `.env.local` (or alternate env) file into a flat key/value map.
* This file sits at the same precedence tier as `.ai-changelog.json` — below
* `process.env` and above the YAML config — so it must NOT override real
* environment variables.
* @returns {Record<string, any>} Parsed env-file variables (empty if absent).
*/
loadEnvFileOverlay(): Record<string, any>;
/**
* Compose the runtime configuration following the documented precedence:
* CLI/explicit options > process.env > .ai-changelog.json > .env.local
* > ai-changelog.config.yaml > literal defaults.
*
* Note: explicit/CLI options are applied by the caller (constructor) on top of
* this result so their explicit `undefined` values can clear lower layers.
* @returns {Record<string, any>} The fully composed runtime config.
*/
composeRuntimeConfig(): Record<string, any>;
loadConfig(): Record<string, any>;
/**
* Initialize credential detection (async operation)
* Call this after construction for automatic credential detection
* @returns {Promise<void>}
*/
initializeCredentialDetection(): Promise<any>;
_initializeCredentialDetection(): Promise<void>;
/**
* Lazily construct the single UnifiedCredentialManager instance. It is the source of
* truth for credential storage operations (keychain, encrypted config, env) and is also
* consumed by the VS Code extension adapter.
* @returns {UnifiedCredentialManager}
*/
getCredentialManager(): any;
/**
* Resolve credentials held in the unified storage backends (keychain + encrypted config)
* and inject any that are not already populated from env/.env. Applies the documented
* priority cascade (user preference > primary storage > discovered; OAuth > API key;
* newer > older) via UnifiedCredentialManager. Env-configured providers are skipped so
* process.env keeps its precedence.
* @returns {Promise<void>}
*/
resolveStoredCredentials(): Promise<void>;
/**
* Merge detected credentials into configuration
* Does not overwrite existing config values
*/
mergeDetectedCredentials(): void;
/**
* Log summary of detected credentials
*/
logDetectedCredentials(): void;
/**
* Get human-readable source name
* @param {string} source
* @returns {string}
*/
getSourceDisplayName(source: any): any;
/**
* Get credential source information for a provider
* @param {string} provider
* @returns {Object|null}
*/
getCredentialSource(provider: any): any;
/**
* Check if a credential is from auto-detection
* @param {string} provider
* @returns {boolean}
*/
isAutoDetectedCredential(provider: any): boolean;
/**
* Get all detected credentials
* @returns {Array}
*/
getDetectedCredentials(): any;
/**
* Refresh detected credentials
* @returns {Promise<void>}
*/
refreshCredentials(): Promise<void>;
loadChangelogConfig(): any;
deepMergeConfig(defaults: any, override: any): any;
parseEnvFile(content: any): Record<string, any>;
validate(): boolean;
hasOpenAI(): boolean;
hasAnthropic(): boolean;
hasGoogle(): boolean;
hasHuggingFace(): boolean;
hasOllama(): boolean;
hasAzureOpenAI(): boolean;
hasVertexAI(): boolean;
hasLMStudio(): boolean;
hasGitHubCopilot(): boolean;
hasBedrock(): boolean;
/**
* Resolve whether a real AI provider credential is available.
* Returns true only when at least one provider's credentials resolve, so
* callers can gate AI features without instantiating providers.
* @returns {boolean}
*/
isAIAvailable(): boolean;
/**
* Build the optimal model configuration for the active provider.
*
* This is the single source of model selection for the AI layer (matching
* the ConfigManager contract in types/index.d.ts). Returns the full tier map
* so callers can pick a model for any analysis mode, honoring any explicit
* `AI_MODEL` override from the runtime config.
* @returns {{provider: string, models: Record<string, string>, features: Record<string, any>} | null}
*/
getOptimalModelConfig(): {
provider: any;
models: Record<string, string>;
features: Record<string, any>;
} | null;
/**
* Recommend a model based on commit complexity. Single source consumed by the
* AI layer (matching the ConfigManager contract in types/index.d.ts).
* @param {{files?: number, lines?: number, breaking?: boolean, complex?: boolean}} [commitInfo]
* @returns {{model: string, reason: string, features: string[]} | null}
*/
getModelRecommendation(commitInfo?: Record<string, any>): {
model: string;
reason: string;
features: string[];
} | null;
getActiveProvider(): any;
get(key: any): any;
getAll(): any;
set(key: any, value: any): void;
getProviderConfig(providerName: any): any;
getRequiredEnvVars(provider: any): any;
validateProvider(providerName: any): {
valid: boolean;
missing: any;
configured: any;
};
updateConfig(updates: any): Promise<void>;
saveConfig(): Promise<void>;
getValidationResult(): any;
isValid(): boolean;
logConfiguration(): void;
getChangelogConfig(): any;
getConventionConfig(): any;
getCommitTypes(): any;
getChangelogCommitTypes(): any;
getHeadlines(): any;
getCommitUrl(): any;
getCommitRangeUrl(): any;
getIssueUrl(): any;
getIssueRegexPattern(): RegExp;
shouldIncludeInvalidCommits(): any;
getCommitIgnoreRegex(): RegExp;
getDefaultAnalysisMode(): any;
getDefaultOutputFormat(): any;
getIncludeAttribution(): boolean;
getRateLimitDelay(): number;
getMaxRetries(): number;
/**
* Get the complete configuration object
* @returns {Object} Configuration object
*/
getConfig(): any;
/**
* Resolve the path used to read/write the `.ai-changelog.json` settings file.
* Falls back to the current working directory when no file has been
* discovered yet (so writes create the file in the repo/cwd root).
* @returns {string}
*/
resolveJsonConfigPath(): string;
/**
* Persist the `.ai-changelog.json` settings file with pretty-printed JSON,
* merging the provided patch onto any existing on-disk settings.
* @param {Record<string, any>} patch - Keys to merge into the file.
* @returns {Record<string, any>} The merged object written to disk.
*/
persistJsonConfig(patch: Record<string, any>): Record<string, any>;
/**
* Persist the active provider selection to `.ai-changelog.json` and apply it
* to the live runtime config. Consumed by the providers switch flow.
* @param {string} name - Provider identifier (e.g. "openai", "azure").
* @returns {void}
*/
setActiveProvider(name: string): void;
/**
* Write a sample `.ai-changelog.json` to the current working directory so
* users have a documented starting point. Never overwrites an existing file.
* @returns {void}
*/
createSampleConfig(): void;
}