/**
 * review-diff-tools.ts
 *
 * Types, tier assignment, scoring, verdict, and orchestrator for the review_diff MCP tool.
 * Pure functions + one async orchestrator that fans out sub-checks.
 */
import type { CodeIndex } from "../types.js";
export interface ReviewDiffOptions {
    repo: string;
    since?: string;
    /** End ref — defaults to "HEAD". Use "WORKING" for uncommitted changes. */
    until?: string;
    /** Comma-separated check names to run (defaults to all) */
    checks?: string;
    /** Token budget for responses (default 8000) */
    token_budget?: number;
    /** Glob patterns of files to exclude from review */
    exclude_patterns?: string[];
    /** Maximum files to review before capping (default 50) */
    max_files?: number;
    /** Per-check timeout in milliseconds (default 30000) */
    check_timeout_ms?: number;
}
export interface ReviewFinding {
    /** Which check produced this finding */
    check: string;
    severity: "error" | "warn" | "info";
    message: string;
    file?: string;
    line?: number;
    symbol?: string;
}
export interface CheckResult {
    check: string;
    status: "pass" | "warn" | "fail" | "error" | "timeout";
    findings: ReviewFinding[];
    duration_ms: number;
    /** Human-readable summary line (optional) */
    summary?: string;
}
export interface DiffStats {
    files_changed: number;
    files_reviewed: number;
}
export interface ReviewMetadata {
    files_capped?: boolean;
    index_warning?: string;
}
export interface ReviewDiffResult {
    repo: string;
    since: string;
    checks: CheckResult[];
    findings: ReviewFinding[];
    /** 0-100 quality score */
    score: number;
    verdict: "pass" | "warn" | "fail";
    duration_ms: number;
    diff_stats: DiffStats;
    metadata: ReviewMetadata;
    /** Structured error (present instead of throwing) */
    error?: string;
}
/**
 * Returns the tier (1 | 2 | 3) for a given check name.
 *
 * Tier 1 — critical (−20 per finding): secrets, breaking
 * Tier 2 — important (−5 per finding): coupling, complexity, dead-code,
 *           blast-radius, bug-patterns
 * Tier 3 — advisory (−1 per finding, only if no T1/T2): test-gaps, hotspots
 */
export declare function findingTier(check: string): 1 | 2 | 3;
/**
 * Calculates a 0-100 quality score from findings and check results.
 *
 * Deductions:
 *   - T1 findings: −20 each, floor at 0
 *   - T2 findings: −5 each, floor at 20 (overridden by T1 floor)
 *   - T3 findings: −1 each, floor at 50 (only applied when there are no T1/T2 findings)
 *   - Errored checks: −3 each
 *   - Final floor: 0
 */
export declare function calculateScore(findings: ReviewFinding[], checks: CheckResult[]): number;
/**
 * Determines the overall verdict from check statuses.
 *
 * - Any "fail" → "fail"
 * - Any "warn" (and no "fail") → "warn"
 * - Otherwise → "pass"
 * - "timeout" and "error" do not affect verdict direction
 */
export declare function determineVerdict(checks: CheckResult[]): "pass" | "warn" | "fail";
/**
 * Blast-radius check: run impactAnalysis and map affected_symbols to T2 findings.
 */
export declare function checkBlastRadius(index: CodeIndex, since: string, until: string): Promise<CheckResult>;
/**
 * Secrets check: run scanSecrets scoped to changedFiles and map findings to T1.
 */
export declare function checkSecrets(index: CodeIndex, changedFiles: string[]): Promise<CheckResult>;
/**
 * Dead-code check: run findDeadCode scoped to changedFiles and map candidates to T2 findings.
 */
export declare function checkDeadCode(index: CodeIndex, changedFiles: string[]): Promise<CheckResult>;
/**
 * Astro hydration check: run hydrationAuditFromIndex scoped to Astro files in diff.
 * Returns skipped when diff has zero .astro files.
 */
export declare function checkAstroHydration(index: CodeIndex, changedFiles: string[]): Promise<CheckResult>;
export declare function checkBugPatterns(index: CodeIndex, changedFiles: string[]): Promise<CheckResult>;
/**
 * Hotspots check: run analyzeHotspots and filter to files in changedFiles.
 * Maps high-churn files to T3 advisory findings.
 */
export declare function checkHotspots(index: CodeIndex, changedFiles: string[]): Promise<CheckResult>;
/**
 * Complexity delta check: run analyzeComplexity and filter to functions in
 * changedFiles with cyclomatic complexity > 10. Maps to T2 findings.
 */
export declare function checkComplexityDelta(index: CodeIndex, changedFiles: string[]): Promise<CheckResult>;
/**
 * Coupling gaps check: uses shared computeCoChangePairs from coupling-tools.ts,
 * then flags coupled files that are missing from the diff.
 */
export declare function checkCouplingGaps(repoRoot: string, changedFiles: string[]): Promise<CheckResult>;
/**
 * Breaking changes check: detect exported symbols removed between `since` and
 * current index.  For each changed .ts/.js file, `git show` retrieves the old
 * source and a regex extracts export names.  These are compared against the
 * current index symbols.  Missing exports → T1 "breaking" findings.
 *
 * File-level renames (detected via `git diff --find-renames`) are suppressed
 * because renames naturally lose old export names.
 */
export declare function checkBreakingChanges(index: CodeIndex, repoRoot: string, changedFiles: string[], since: string, until: string): Promise<CheckResult>;
/**
 * Test-gaps check: for each changed non-test source file, verify that at least
 * one test file covers it — either by naming convention or by import reference.
 *
 * Naming convention candidates:
 *   foo.ts → foo.test.ts, foo.spec.ts, __tests__/foo.ts, __tests__/foo.test.ts
 *
 * Import graph: search index symbols from test files whose source imports the
 * source file's base name (without extension).
 *
 * If BOTH pathways find 0 tests → T3 advisory finding.
 */
export declare function checkTestGaps(index: CodeIndex, changedFiles: string[]): Promise<CheckResult>;
export declare function reviewDiff(repo: string, opts: ReviewDiffOptions): Promise<ReviewDiffResult>;
//# sourceMappingURL=review-diff-tools.d.ts.map