feat: phase 3 for git integration
This commit is contained in:
@@ -36,6 +36,11 @@ export interface GitStatusDto {
|
||||
counts: GitStatusCounts;
|
||||
}
|
||||
|
||||
export interface GitDiffDto {
|
||||
filePath: string;
|
||||
patch: string;
|
||||
}
|
||||
|
||||
export type GitInitPhase =
|
||||
| 'checking-git'
|
||||
| 'initializing-repo'
|
||||
@@ -217,6 +222,16 @@ export class GitEngine {
|
||||
};
|
||||
}
|
||||
|
||||
async getDiff(projectPath: string, filePath: string): Promise<GitDiffDto> {
|
||||
const git = simpleGit(projectPath);
|
||||
const patch = await git.diff(['--', filePath]);
|
||||
|
||||
return {
|
||||
filePath,
|
||||
patch,
|
||||
};
|
||||
}
|
||||
|
||||
async ensureGitignore(projectPath: string): Promise<GitIgnoreEnsureResult> {
|
||||
const gitignorePath = path.join(projectPath, '.gitignore');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user