UNPKG

sfcoe-ailabs

Version:

AI-powered code review tool with static analysis integration for comprehensive code quality assessment.

33 lines (32 loc) 1.49 kB
export default class GitHelper { /** * Create a temporary directory containing only the changed files between two Git references * * @param repoDir - The path to the Git repository directory * @param from - The source commit/branch reference for diff comparison * @param to - The target commit/branch reference for diff comparison * @returns Promise resolving to the path of the temporary directory containing changed files * @throws Error if Git operations fail or file copying encounters issues */ static createDirectoryWithDiff(repoDir: string, from: string, to: string): Promise<string>; /** * Verify and resolve a commit SHA to its full form * * @param repoDir - The path to the Git repository directory * @param commitSha - The commit SHA or reference to verify (can be short SHA, HEAD, branch name, etc.) * @returns Promise resolving to the full commit SHA * @throws Error if the commit SHA cannot be verified or resolved */ static verifyCommitSha(repoDir: string, commitSha: string): Promise<string>; /** * Gets changed line ranges for each file between two commits */ static getChangedLineRanges(repoDir: string, from: string, to: string): Promise<Map<string, Array<{ start: number; end: number; }>>>; /** * Finds the git root directory by traversing up the directory tree */ static findGitRoot(startDir?: string): Promise<string>; }