56 lines
1.6 KiB
TypeScript
56 lines
1.6 KiB
TypeScript
export interface DiffStats {
|
|
filesChanged: number;
|
|
linesAdded: number;
|
|
linesDeleted: number;
|
|
fileStats: Record<string, {
|
|
added: number;
|
|
deleted: number;
|
|
changeType: 'added' | 'modified' | 'deleted';
|
|
}>;
|
|
}
|
|
export declare class GitIntegration {
|
|
private git;
|
|
private rootDir;
|
|
constructor(rootDir?: string);
|
|
isGitRepo(): Promise<boolean>;
|
|
getCurrentCommit(): Promise<string | undefined>;
|
|
getUnstagedDiff(filePath?: string): Promise<string>;
|
|
getStagedDiff(filePath?: string): Promise<string>;
|
|
/**
|
|
* Get stats for a specific file based on its current state on disk vs HEAD
|
|
* This includes both staged and unstaged changes.
|
|
*/
|
|
getFileStats(filePath: string): Promise<{
|
|
added: number;
|
|
deleted: number;
|
|
changeType: 'added' | 'modified' | 'deleted';
|
|
}>;
|
|
/**
|
|
* Parse a unified diff string to count lines (fallback if numstat isn't enough)
|
|
*/
|
|
parseDiff(diff: string): {
|
|
added: number;
|
|
deleted: number;
|
|
};
|
|
/**
|
|
* Get current branch name
|
|
*/
|
|
getCurrentBranch(): Promise<string | null>;
|
|
/**
|
|
* Create and checkout a new branch
|
|
*/
|
|
createAndCheckoutBranch(branchName: string): Promise<boolean>;
|
|
/**
|
|
* Checkout an existing branch
|
|
*/
|
|
checkoutBranch(branchName: string): Promise<boolean>;
|
|
/**
|
|
* Check if branch exists
|
|
*/
|
|
branchExists(branchName: string): Promise<boolean>;
|
|
/**
|
|
* Delete a branch
|
|
*/
|
|
deleteBranch(branchName: string, force?: boolean): Promise<boolean>;
|
|
}
|