/** * Git Diff Parser * * Parse git diffs to extract added/deleted content for attribution matching. * Includes line-level hashing and move detection. */ import type { DiffHunk, DeletedBlock, MoveMapping } from "../types"; export interface DiffFile { path: string; status: "added" | "modified" | "deleted"; } export interface CommitDiff { files: DiffFile[]; raw: string; } /** * Get the diff for a specific commit (compared to its parent) */ export declare function getCommitDiff(repoRoot: string, sha: string): Promise; /** * Get raw diff string (legacy compatibility) */ export declare function getCommitDiffRaw(repoRoot: string, sha: string): Promise; /** * Get full diff including both additions and deletions (for move detection) */ export declare function getFullCommitDiff(repoRoot: string, sha: string): Promise; /** * Parse a unified diff to extract added hunks with line-level data */ export declare function parseDiff(diffOutput: string): DiffHunk[]; /** * Parse deleted blocks from a diff (for move detection) */ export declare function parseDeletedBlocks(diffOutput: string): DeletedBlock[]; /** * Detect moved code blocks between deletions and additions */ export declare function detectMoves(deletedBlocks: DeletedBlock[], addedHunks: DiffHunk[]): MoveMapping[]; /** * Build a line-level move index for quick lookup */ export declare function buildMoveIndex(moves: MoveMapping[]): Map; /** * Get parsed diff hunks for a commit with line-level data */ export declare function getCommitHunks(repoRoot: string, sha: string): Promise; /** * Get move mappings for a commit */ export declare function getCommitMoves(repoRoot: string, sha: string): Promise;