/** * Git operations wrapper — all local git interactions go through here. */ export declare function isInsideRepo(cwd?: string): Promise; export declare function getRepoRoot(cwd?: string): Promise; export interface RemoteInfo { name: string; url: string; owner: string; repo: string; } export interface RemoteBranchHead { remoteRef: string; branch: string; hash: string; } export declare function getGitHubRemote(cwd?: string): Promise; /** * List remote branch heads and their commit hashes. */ export declare function listRemoteBranchHeads(remote?: string, cwd?: string): Promise; export declare function getCurrentBranch(cwd?: string): Promise; /** Current branch's upstream (e.g. origin/feature-x), or null if none. */ export declare function getUpstreamRef(cwd?: string): Promise; export declare function branchExists(branch: string, cwd?: string): Promise; export declare function createBranch(name: string, startPoint: string, cwd?: string): Promise; export declare function deleteBranch(name: string, force?: boolean, cwd?: string): Promise; export declare function deleteRemoteBranch(remote: string, branch: string, cwd?: string): Promise; export declare function checkout(branch: string, cwd?: string): Promise; export interface CommitInfo { hash: string; shortHash: string; subject: string; body: string; trailers: Record; author: string; date: string; } /** * List commits in range (oldest first). Default range: baseBranch..HEAD */ export declare function listCommits(range: string, cwd?: string): Promise; /** * Get diff stats for a commit range: files changed, insertions, deletions. */ export interface DiffStats { filesChanged: number; insertions: number; deletions: number; totalLines: number; files: FileStats[]; } export interface FileStats { file: string; insertions: number; deletions: number; } export declare function getDiffStats(range: string, cwd?: string): Promise; /** * Get diff stats for a single commit. */ export declare function getCommitDiffStats(commitHash: string, cwd?: string): Promise; export interface RebaseResult { success: boolean; conflictFiles?: string[]; noRebaseInProgress?: boolean; } export declare function rebase(onto: string, cwd?: string): Promise; /** * Rebase --onto: replay commits from `upstream..HEAD` onto `newBase`. * Essential for squash merge handling where the original commits * aren't ancestors of the new base. */ export declare function rebaseOnto(newBase: string, upstream: string, cwd?: string): Promise; /** * Get the tree hash for a commit (content identity without commit metadata). * Two commits with the same tree hash have identical file contents. */ /** * Get the tree hash for a commit (content identity without commit metadata). * Two commits with the same tree hash have identical file contents. */ export declare function getTreeHash(ref: string, cwd?: string): Promise; /** * Check if a local commit and a remote branch point to the same tree. * When true, force-pushing would change the SHA but not the content — * a "cosmetic" push that unnecessarily triggers stale review dismissal. */ export declare function hasSameTree(localRef: string, remoteRef: string, cwd?: string): Promise; /** * Check if a local commit's diff vs base is identical to the remote branch's diff vs base. * More robust than tree comparison for stacked PRs where the base changed. * Returns true if the PR's actual code contribution is unchanged. */ export declare function hasSameDiff(localRef: string, remoteRef: string, baseBranch: string, cwd?: string): Promise; /** * Merge a branch into the current branch (forward merge, no force-push needed). * This is the review-safe alternative to rebase: it preserves PR approvals * because GitHub only dismisses reviews on force-push or diff-changing pushes. * * When the base branch is merged into a PR branch and the PR's own changes * haven't changed, the PR diff remains identical → approvals survive. */ export declare function mergeInto(branch: string, cwd?: string): Promise; /** * Abort a merge in progress. */ export declare function mergeAbort(cwd?: string): Promise; export declare function rebaseAbort(cwd?: string): Promise; export declare function rebaseContinue(cwd?: string): Promise; export declare function hasUncommittedChanges(cwd?: string): Promise; export declare function stash(message?: string, cwd?: string): Promise; export declare function stashPop(cwd?: string): Promise; export declare function pushBranch(remote: string, localBranch: string, remoteBranch: string, force?: boolean | 'lease', cwd?: string): Promise; export declare function fetch(remote: string, branch?: string, cwd?: string): Promise; /** True if remote branch has commits we don't have (would be overwritten by force-push). */ export declare function isRemoteBranchAhead(remote: string, remoteBranch: string, localCommit: string, cwd?: string): Promise; export declare function getUsername(cwd?: string): Promise; export declare function getHeadHash(cwd?: string): Promise; export declare function getMergeBase(branch1: string, branch2: string, cwd?: string): Promise; //# sourceMappingURL=git.d.ts.map