UNPKG

review-copilot

Version:

ReviewCopilot - AI-powered code review assistant with customizable prompts

43 lines (42 loc) 1.54 kB
import { IAIProvider } from '../types/review.types'; import { PullRequestFile } from '../utils/git-service.interface'; import { IGitPlatformService } from './services.types'; import { CodeReviewSuggestion, LineSpecificSuggestion, ParsedDiff } from '../providers/provider.types'; export interface FileReviewContext { filePath: string; diffContent: string; parsedDiff: ParsedDiff; commitId: string; owner: string; repo: string; pullNumber: number; } export declare class LineSpecificReviewService { private aiProvider; private gitPlatformService; constructor(aiProvider: IAIProvider, gitPlatformService: IGitPlatformService); /** * Perform line-specific code review and post comments directly to the PR */ performLineSpecificReview(files: PullRequestFile[], commitId: string, owner: string, repo: string, pullNumber: number, reviewPrompt: string): Promise<{ generalSuggestions: CodeReviewSuggestion[]; lineSpecificSuggestions: LineSpecificSuggestion[]; commentsPosted: number; }>; /** * Enhance the prompt to encourage line-specific suggestions */ private enhancePromptWithLineContext; /** * Prepare enhanced content for AI review with line numbers and context */ private prepareEnhancedReviewContent; /** * Parse AI response to extract line-specific suggestions */ private parseAISuggestionsWithLineInfo; /** * Format a review comment for posting */ private formatReviewComment; }