UNPKG

@elsikora/commitizen-plugin-commitlint-ai

Version:
40 lines (39 loc) 1.75 kB
import type { ILlmPromptContext, ILlmService } from '../../application/interface/llm-service.interface'; import type { LLMConfiguration } from '../../domain/entity/llm-configuration.entity'; import { CommitMessage } from '../../domain/entity/commit-message.entity'; /** * Anthropic implementation of the LLM service */ export declare class AnthropicLlmService implements ILlmService { /** * Generate a commit message using Anthropic Claude * @param {ILlmPromptContext} context - The context for generating the commit message * @param {LLMConfiguration} configuration - The LLM configuration * @returns {Promise<CommitMessage>} Promise resolving to the generated commit message */ generateCommitMessage(context: ILlmPromptContext, configuration: LLMConfiguration): Promise<CommitMessage>; /** * Check if the service supports the given configuration * @param {LLMConfiguration} configuration - The LLM configuration to check * @returns {boolean} True if the service supports the configuration */ supports(configuration: LLMConfiguration): boolean; /** * Build the prompt for Anthropic * @param {ILlmPromptContext} context - The prompt context * @returns {string} The prompt */ private buildPrompt; /** * Format commitlint rules into human-readable instructions * @param {Record<string, unknown>} rules - The commitlint rules object * @returns {string} Formatted rules as string */ private formatCommitlintRules; /** * Parse the commit message from the LLM response * @param {string} content - The response content * @returns {CommitMessage} The parsed commit message */ private parseCommitMessage; }