@elsikora/commitizen-plugin-commitlint-ai
Version:
AI-powered Commitizen adapter with Commitlint integration
27 lines (26 loc) • 1.48 kB
TypeScript
import type { CommitMessage } from '../../domain/entity/commit-message.entity';
import type { ICommitValidationResult, ICommitValidator } from '../interface/commit-validator.interface';
import type { ILlmPromptContext } from '../interface/llm-service.interface';
/**
* Use case for validating and fixing commit messages
*/
export declare class ValidateCommitMessageUseCase {
private readonly DEFAULT_MAX_RETRIES;
private readonly VALIDATOR;
constructor(validator: ICommitValidator, defaultMaxRetries?: number);
/**
* Execute the validation use case
* @param {CommitMessage} message - The commit message to validate
* @param {boolean} shouldAttemptFix - Whether to attempt fixing validation errors
* @param {number | undefined} maxRetries - Maximum number of retry attempts (optional, defaults to DEFAULT_MAX_RETRIES)
* @param {ILlmPromptContext} context - The LLM prompt context
* @returns {Promise<CommitMessage | null>} Promise resolving to the validated message or null if validation fails
*/
execute(message: CommitMessage, shouldAttemptFix?: boolean, maxRetries?: number, context?: ILlmPromptContext): Promise<CommitMessage | null>;
/**
* Validate a commit message
* @param {CommitMessage} message - The commit message to validate
* @returns {Promise<ICommitValidationResult>} Promise resolving to the validation result
*/
validate(message: CommitMessage): Promise<ICommitValidationResult>;
}