@entro314labs/ai-changelog-generator
Version:
AI-powered changelog generator with MCP server support - works with most providers, online and local models
136 lines (135 loc) • 4.26 kB
TypeScript
/**
* Credential Detection Service
* Detects existing AI provider credentials from various sources on the machine
*
* Supported sources:
* - Environment variables
* - Gemini CLI (~/.gemini/oauth_creds.json, ~/.gemini/settings.json)
* - Claude Code (macOS Keychain, ~/.claude/.credentials.json)
* - GitHub Copilot (~/.config/github-copilot/hosts.json)
* - .env files (workspace and global)
*/
/**
* Credential source types
*/
export declare const CredentialSource: {
ENV_VAR: string;
ENV_FILE: string;
GEMINI_CLI: string;
CLAUDE_CODE: string;
GITHUB_COPILOT: string;
MACOS_KEYCHAIN: string;
};
/**
* Authentication types
*/
export declare const AuthType: {
API_KEY: string;
OAUTH_TOKEN: string;
SERVICE_ACCOUNT: string;
};
/**
* Detected credential structure
* @typedef {Object} DetectedCredential
* @property {string} provider - Provider name (openai, anthropic, google, etc.)
* @property {string} source - Source of the credential (env_var, gemini_cli, etc.)
* @property {string} authType - Type of authentication (api_key, oauth_token, etc.)
* @property {string} value - The credential value (may be redacted for display)
* @property {string} [rawValue] - The actual credential value (only in secure contexts)
* @property {string} [path] - Path to the credential file if applicable
* @property {Date} [expiresAt] - Expiration time for OAuth tokens
* @property {boolean} [isValid] - Whether the credential appears valid
* @property {Object} [metadata] - Additional metadata
*/
export declare class CredentialDetectionService {
[key: string]: any;
constructor(options?: Record<string, any>);
/**
* Detect all available credentials from all sources
* @returns {Promise<DetectedCredential[]>}
*/
detectAll(): Promise<any[]>;
/**
* Detect credentials for a specific provider
* @param {string} provider - Provider name
* @returns {Promise<DetectedCredential[]>}
*/
detectForProvider(provider: any): Promise<any[]>;
/**
* Detect credentials from environment variables
* @returns {DetectedCredential[]}
*/
detectFromEnvironmentVariables(): any[];
/**
* Detect credentials from .env files
* @returns {DetectedCredential[]}
*/
detectFromEnvFiles(): any[];
/**
* Detect credentials from Gemini CLI
* @returns {Promise<DetectedCredential[]>}
*/
detectFromGeminiCli(): Promise<any[]>;
/**
* Detect credentials from Claude Code
* @returns {Promise<DetectedCredential[]>}
*/
detectFromClaudeCode(): Promise<any[]>;
/**
* Detect credentials from GitHub Copilot
* @returns {Promise<DetectedCredential[]>}
*/
detectFromGitHubCopilot(): Promise<any[]>;
/**
* Parse .env file content
* @param {string} content
* @returns {Object<string, string>}
*/
parseEnvFile(content: any): Record<string, any>;
/**
* Redact a credential value for display
* @param {string} value
* @returns {string}
*/
redactValue(value: any): string;
/**
* Validate API key format
* @param {string} value
* @param {string} provider
* @returns {boolean}
*/
validateApiKeyFormat(value: any, provider: any): any;
/**
* Deduplicate credentials, preferring OAuth over API keys and newer sources
* @param {DetectedCredential[]} credentials
* @returns {DetectedCredential[]}
*/
deduplicateCredentials(credentials: any): any[];
/**
* Get a summary of detected credentials
* @returns {Promise<Object>}
*/
getSummary(): Promise<{
total: number;
byProvider: any;
bySource: any;
providers: any[];
sources: any[];
}>;
/**
* Get the best credential for a provider
* @param {string} provider
* @returns {Promise<DetectedCredential|null>}
*/
getBestCredential(provider: any): Promise<any>;
/**
* Convert detected credential to config format
* @param {DetectedCredential} credential
* @returns {Object}
*/
toConfigFormat(credential: any): {
[x: string]: any;
[x: number]: any;
};
}
export default CredentialDetectionService;