/** * @nahisaho/musubix-codegraph - Git Operations * * Git operations wrapper using simple-git * * @packageDocumentation * @module @nahisaho/musubix-codegraph/pr * * @see REQ-CG-PR-003 - Git Branch Creation * @see REQ-CG-PR-004 - Auto Commit * @see DES-CG-PR-004 - Class Design */ import type { BranchInfo, CommitInfo, GitOperationOptions, CodeChange } from './types.js'; /** * Git operations wrapper * * Provides a safe interface for Git operations needed for PR creation. * Uses child_process to interact with Git directly. * * @see DES-CG-PR-004 * @example * ```typescript * const git = new GitOperations('/path/to/repo'); * await git.createBranch('refactor/extract-interface'); * await git.commit('refactor(auth): extract IAuthService interface'); * await git.push(); * ``` */ export declare class GitOperations { private readonly repoPath; private readonly remote; /** * Create a new GitOperations instance * @param options - Git operation options */ constructor(options: GitOperationOptions); /** * Check if path is a Git repository */ isGitRepository(): boolean; /** * Get repository root path */ getRepoRoot(): string; /** * Get current branch name * @see REQ-CG-PR-003 */ getCurrentBranch(): string; /** * Get default branch name (main or master) */ getDefaultBranch(): string; /** * List all branches */ listBranches(): BranchInfo[]; /** * Check if branch exists */ branchExists(branchName: string): boolean; /** * Create a new branch * @see REQ-CG-PR-003 */ createBranch(branchName: string, baseBranch?: string): void; /** * Checkout an existing branch */ checkout(branchName: string): void; /** * Delete a branch */ deleteBranch(branchName: string, force?: boolean): void; /** * Check for uncommitted changes */ hasUncommittedChanges(): boolean; /** * Get list of modified files */ getModifiedFiles(): string[]; /** * Stage files for commit */ stageFiles(files: string[]): void; /** * Stage all changes */ stageAll(): void; /** * Unstage files */ unstageFiles(files: string[]): void; /** * Discard changes in working tree */ discardChanges(files: string[]): void; /** * Stash changes */ stash(message?: string): void; /** * Pop stash */ stashPop(): void; /** * Create a commit * @see REQ-CG-PR-004 */ commit(message: string, options?: { allowEmpty?: boolean; }): CommitInfo; /** * Get last commit info */ getLastCommit(): CommitInfo; /** * Get commit history */ getCommitHistory(count?: number): CommitInfo[]; /** * Push branch to remote */ push(options?: { setUpstream?: boolean; force?: boolean; }): void; /** * Fetch from remote */ fetch(prune?: boolean): void; /** * Pull from remote */ pull(rebase?: boolean): void; /** * Get remote URL */ getRemoteUrl(): string; /** * Parse GitHub owner/repo from remote URL */ parseRemoteUrl(): { owner: string; repo: string; } | null; /** * Get diff for staged changes */ getStagedDiff(): string; /** * Get diff for unstaged changes */ getUnstagedDiff(): string; /** * Get diff between branches */ getDiffBetweenBranches(baseBranch: string, headBranch?: string): string; /** * Get diff stats */ getDiffStats(baseBranch?: string): { additions: number; deletions: number; files: number; }; /** * Apply code changes to files * @see REQ-CG-PR-002 */ applyCodeChanges(changes: CodeChange[]): string[]; /** * Revert changes to a file */ revertFile(filePath: string): void; /** * Execute a git command synchronously */ private git; } /** * Create a GitOperations instance */ export declare function createGitOperations(repoPath: string, remote?: string): GitOperations; //# sourceMappingURL=git-operations.d.ts.map