UNPKG

@entro314labs/ai-changelog-generator

Version:

AI-powered changelog generator with MCP server support - works with most providers, online and local models

145 lines (144 loc) 3.84 kB
/** * GitHub Copilot Provider for AI Changelog Generator * * Uses GitHub Copilot authentication to access AI models. * Supports users with GitHub Copilot Pro, Pro+, Business, or Enterprise subscriptions. * * Authentication sources: * - ~/.config/github-copilot/hosts.json (Copilot CLI) * - VS Code GitHub authentication (via extension) * - Manual token configuration * * API Compatibility: OpenAI-compatible endpoint */ import { BaseProvider } from '../core/base-provider.js'; interface CopilotRequestMessage { role: string; content: any; } interface CopilotToolCall { id?: string; type?: string; function?: { name?: string; arguments?: string; }; } interface CopilotChatCompletionRequest { model: string; messages: CopilotRequestMessage[]; max_tokens: number; temperature: number; top_p: number; stream: false; response_format?: { type: 'json_object'; }; tools?: any[]; tool_choice?: string; } interface CopilotChatCompletionResponse { choices?: Array<{ message?: { content?: string; tool_calls?: CopilotToolCall[]; }; finish_reason?: string; }>; usage?: { total_tokens?: number; }; } declare class GitHubCopilotProvider extends BaseProvider { [key: string]: any; constructor(config: any); getName(): string; isAvailable(): boolean; initializeCredentials(): void; /** * Get a Copilot API token using the GitHub OAuth token * @returns {Promise<string>} */ getCopilotToken(): Promise<any>; generateCompletion(messages: any, options?: Record<string, any>): any; /** * Make a request to the Copilot API * @param {string} token - Copilot API token * @param {Object} body - Request body * @returns {Promise<Object>} */ makeRequest(token: string, body: CopilotChatCompletionRequest): Promise<CopilotChatCompletionResponse>; getModelRecommendation(commitDetails: any): { model: string; reason: string; }; validateModelAvailability(modelName: any): Promise<{ available: boolean; model: any; reason: string; }>; testConnection(): Promise<{ error?: undefined; success: boolean; responseTime: number; tokenFetchTime: number; message: string; } | { responseTime?: undefined; tokenFetchTime?: undefined; message?: undefined; success: boolean; error: any; }>; getAvailableModels(): Promise<({ id: string; name: string; contextWindow: number; maxOutput: number; features: string[]; } | { id: string; name: string; contextWindow: number; maxOutput: number; features: string[]; } | { id: string; name: string; contextWindow: number; maxOutput: number; features: string[]; } | { id: string; name: string; contextWindow: number; maxOutput: number; features: string[]; } | { id: string; name: string; contextWindow: number; maxOutput: number; features: string[]; } | { id: string; name: string; contextWindow: number; maxOutput: number; features: string[]; })[]>; getRequiredEnvVars(): string[]; /** * Check if user has active Copilot subscription * @returns {Promise<Object>} */ checkSubscription(): Promise<unknown>; /** * Set GitHub token manually (for VS Code extension integration) * @param {string} token */ setGitHubToken(token: any): void; } declare const _default: any; export default _default; export { GitHubCopilotProvider };