/** * PR Impact Score (v1.1.0) * * Scores PRs by risk using multiple factors: * - Diff size (lines added/removed) * - File churn (files changed frequently in past PRs) * - Author experience (familiarity with touched files) * - Blast radius (number of files + cross-module changes) * - Historical failures (files that were reverted/had follow-up fixes) */ export type RiskLevel = 'low' | 'medium' | 'high' | 'critical'; export interface ImpactFactor { name: string; score: number; weight: number; description: string; } export interface ImpactResult { /** Overall impact score 1-10 */ score: number; /** Risk classification */ riskLevel: RiskLevel; /** Individual factor breakdowns */ factors: ImpactFactor[]; /** Human-readable summary */ summary: string; } export interface ImpactPRInput { title: string; description: string; files: string[]; diff?: string; linesAdded?: number; linesRemoved?: number; author?: string; } export declare class HistoricalTracker { /** File → number of times it appeared in PRs */ private fileChurn; /** File → number of times PRs touching it were reverted or had fixes */ private fileFailures; /** Author → Set of files they've touched */ private authorFiles; /** Total PRs recorded */ private totalPRs; /** * Record a PR for historical tracking */ recordPR(author: string, files: string[], wasReverted?: boolean): void; /** * Record that a file had a follow-up fix (indicates original PR was risky) */ recordFailure(files: string[]): void; /** * Get churn count for a file (how often it's been changed) */ getFileChurn(file: string): number; /** * Get failure count for a file */ getFileFailures(file: string): number; /** * Check how many of the given files an author has previously touched */ getAuthorFamiliarity(author: string, files: string[]): number; /** * Get average churn across all tracked files */ getAverageChurn(): number; getTotalPRs(): number; /** * Export for persistence */ exportState(): { fileChurn: Record; fileFailures: Record; authorFiles: Record; totalPRs: number; }; /** * Import from persistence */ importState(state: { fileChurn: Record; fileFailures: Record; authorFiles: Record; totalPRs: number; }): void; } export declare class ImpactScorer { private history; constructor(history?: HistoricalTracker); /** * Score the impact/risk of a PR */ score(pr: ImpactPRInput): ImpactResult; /** * Record a PR for building historical data */ recordPR(author: string, files: string[], wasReverted?: boolean): void; /** * Record a file failure (revert or follow-up fix) */ recordFailure(files: string[]): void; /** * Get the history tracker for export/import */ getHistory(): HistoricalTracker; private scoreDiffSize; private scoreBlastRadius; private scoreFileChurn; private scoreAuthorExperience; private scoreHistoricalFailures; private classifyRisk; private generateSummary; } //# sourceMappingURL=impactScore.d.ts.map