/**
 * PR Review Service
 *
 * Core service for automated pull request code review. Analyzes PR diffs
 * for code quality, security issues, and test coverage gaps, then posts
 * review comments back to GitHub via the gh CLI.
 *
 * @module services/pr-review/pr-review.service
 */
/** Supported PR webhook event actions */
export declare const PR_REVIEW_ACTIONS: readonly ["opened", "synchronize", "reopened"];
/** GitHub PR webhook payload (subset of fields used) */
export interface PullRequestPayload {
    /** Webhook action type */
    action: string;
    /** Pull request data */
    pull_request: {
        /** PR number */
        number: number;
        /** PR title */
        title: string;
        /** PR author */
        user: {
            login: string;
        };
        /** Head branch info */
        head: {
            sha: string;
            ref: string;
        };
        /** Base branch info */
        base: {
            sha: string;
            ref: string;
        };
        /** URL to raw diff */
        diff_url: string;
        /** HTML URL for the PR */
        html_url: string;
        /** Changed file count */
        changed_files?: number;
    };
    /** Repository info */
    repository: {
        /** Full repo name (owner/repo) */
        full_name: string;
    };
}
/** A single review finding */
export interface ReviewFinding {
    /** File path relative to repo root */
    file: string;
    /** Line number in the diff (if applicable) */
    line?: number;
    /** Severity level */
    severity: 'critical' | 'warning' | 'info';
    /** Category of the finding */
    category: 'security' | 'quality' | 'testing' | 'style';
    /** Human-readable description of the issue */
    message: string;
}
/** Result of a full PR review */
export interface ReviewResult {
    /** PR number reviewed */
    prNumber: number;
    /** Repository full name */
    repository: string;
    /** Overall verdict */
    verdict: 'approve' | 'request_changes' | 'comment';
    /** Summary text */
    summary: string;
    /** Individual findings */
    findings: ReviewFinding[];
    /** Timestamp of review */
    reviewedAt: string;
}
/** Status of a review job */
export interface ReviewStatus {
    /** Whether a review is currently running */
    isRunning: boolean;
    /** Number of reviews completed */
    reviewCount: number;
    /** Last review timestamp */
    lastReviewAt: string | null;
}
/**
 * Verify the GitHub webhook signature using HMAC-SHA256.
 *
 * Compares the X-Hub-Signature-256 header against a computed HMAC
 * of the raw request body using the configured webhook secret.
 *
 * @param payload - Raw request body as string
 * @param signature - Value of the X-Hub-Signature-256 header
 * @param secret - Webhook secret configured in GitHub
 * @returns True if the signature is valid
 */
export declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
/**
 * Fetch the diff for a pull request using the gh CLI.
 *
 * @param repo - Repository full name (owner/repo)
 * @param prNumber - Pull request number
 * @returns The unified diff as a string
 * @throws Error if gh CLI fails or diff exceeds size limit
 */
export declare function fetchPrDiff(repo: string, prNumber: number): string;
/**
 * Parse a unified diff into per-file changed sections.
 *
 * Extracts file paths and their changed lines from a unified diff string.
 *
 * @param diff - Unified diff string
 * @returns Array of objects with file path and changed content
 */
export declare function parseDiff(diff: string): {
    file: string;
    content: string;
}[];
/**
 * Analyze a PR diff for code quality, security, and testing issues.
 *
 * Performs static analysis checks on the diff content:
 * - Security: hardcoded secrets, SQL injection patterns, eval usage
 * - Quality: console.log in production, TODO comments, large functions
 * - Testing: new source files without corresponding test files
 * - Style: any types in TypeScript files
 *
 * @param diff - Unified diff string
 * @returns Array of review findings
 */
export declare function analyzeDiff(diff: string): ReviewFinding[];
/**
 * Determine the review verdict based on findings.
 *
 * @param findings - Array of review findings
 * @returns 'request_changes' if critical issues, 'comment' if warnings, 'approve' if clean
 */
export declare function determineVerdict(findings: ReviewFinding[]): 'approve' | 'request_changes' | 'comment';
/**
 * Format review findings into a markdown comment body.
 *
 * @param result - The review result to format
 * @returns Markdown-formatted review comment
 */
export declare function formatReviewComment(result: ReviewResult): string;
/**
 * Post a review comment on a GitHub PR using the gh CLI.
 *
 * @param repo - Repository full name (owner/repo)
 * @param prNumber - Pull request number
 * @param body - Comment body in markdown
 * @returns The URL of the posted comment
 * @throws Error if the gh CLI command fails
 */
export declare function postReviewComment(repo: string, prNumber: number, body: string): string;
/**
 * Execute a full PR review: fetch diff, analyze, post comment.
 *
 * This is the main entry point called by the webhook controller.
 * It orchestrates the full review pipeline:
 * 1. Fetch the PR diff via gh CLI
 * 2. Analyze the diff for issues
 * 3. Determine the verdict
 * 4. Format and post the review comment
 *
 * @param payload - The GitHub PR webhook payload
 * @returns The review result with findings and verdict
 * @throws Error if the review pipeline fails
 */
export declare function executePrReview(payload: PullRequestPayload): Promise<ReviewResult>;
/**
 * Get the current review service status.
 *
 * @returns Status object with running state and review count
 */
export declare function getReviewStatus(): ReviewStatus;
/**
 * Reset review service state (for testing).
 */
export declare function resetReviewState(): void;
//# sourceMappingURL=pr-review.service.d.ts.map