import { GitCommit, GitTag, GitRef } from './models'; export { CreateAnnotatedTagOptions, CreateGitCommitOptions, CreateGitRefOptions, CreateLightweightTagOptions, GitCommit, GitRef, GitRefType, GitTag, GitTagType, buildRefName, buildTagName, compareRefsByName, compareTagsByVersion, createAnnotatedTag, createGitCommit, createGitRef, createLightweightTag, extractPackageFromTag, extractScope, extractType, extractVersionFromTag, filterRefsByRemote, filterRefsByType, getRemote, getShortHash, isAnnotatedTag, isBranchRef, isHeadRef, isLightweightTag, isMergeCommit, isRemoteRef, isRootCommit, isSameCommit, isTagRef } from './models'; import { GitLogOptions, FileChange, GitCommitWithFiles, ListTagsOptions, CreateTagOptions, CreateCommitOptions, StageOptions, DiscardChangesOptions, RepositoryStatus, GitOperationState } from './operations'; export { CreateCommitOptions, CreateTagOptions, DEFAULT_COMMIT_OPTIONS, DEFAULT_DIFF_OPTIONS, DEFAULT_LOG_OPTIONS, DEFAULT_OPERATION_STATE_OPTIONS, DEFAULT_STATUS_OPTIONS, DEFAULT_TAG_OPTIONS, DiffOptions, DiscardChangesOptions, FileChange, FileChangeStatus, FileStatus, FileStatusEntry, GitCommitOptions, GitCommitWithFiles, GitLogOptions, GitOperationState, GitOperationStateOptions, GitOperationStateReason, GitStatusOptions, GitTagOptions, ListTagsOptions, RepositoryStatus, StageOptions, amendCommit, amendCommitNoEdit, commit, commitExists, commitReachableFromHead, createEmptyCommit, createTag, deleteTag, discardAllChanges, discardChanges, escapeAuthor, escapeFilePath, escapeGitArg, escapeGitMessage, escapeGitPath, escapeGitRef, escapeGitTagPattern, getAheadCount, getBehindCount, getChangedFilesBetween, getChangedFilesBetweenWithStatus, getCommit, getCommitLog, getCommitWithFiles, getCommitsBetween, getCommitsSince, getCurrentBranch, getHead, getHeadHash, getHeadShortHash, getLatestTag, getModifiedFiles, getOperationState, getRepositoryRoot, getStagedFiles, getStatus, getTag, getTags, getTagsForPackage, getUntrackedFiles, hasConflicts, hasStagedChanges, hasUnstagedChanges, hasUntrackedFiles, isClean, isGitRepository, isOperationInProgress, needsPull, needsPush, pushTag, stage, stageAll, tagExists, unstage } from './operations'; /** * Options for git fetch operations. */ interface GitFetchOptions { /** Whether to prune deleted remote branches */ prune?: boolean; /** Whether to fetch tags */ tags?: boolean; } /** * Options for git push operations. */ interface GitPushOptions { /** Whether to force push */ force?: boolean; /** Whether to set upstream tracking */ setUpstream?: boolean; } /** * Options for git command execution, shared by the remote helpers and the git client factory. */ interface GitCommandOptions { /** Working directory for the git command */ cwd: string; /** Command timeout in milliseconds */ timeout: number; } /** * Git client configuration. */ interface GitClientConfig { /** Working directory */ readonly cwd?: string; /** Default timeout in milliseconds */ readonly timeout?: number; /** Whether to throw on errors */ readonly throwOnError?: boolean; } /** * Git client interface. * * Provides a unified interface for all git operations * within a specific working directory. */ interface GitClient { /** Working directory */ readonly cwd: string; /** Default timeout */ readonly timeout: number; /** * Gets the commit log. */ getCommitLog(options?: Omit): readonly GitCommit[]; /** * Gets commits between two references. */ getCommitsBetween(from: string, to?: string, options?: Omit): readonly GitCommit[]; /** * Gets commits since a reference. */ getCommitsSince(since: string, options?: Omit): readonly GitCommit[]; /** * Gets a single commit by hash. */ getCommit(hash: string): GitCommit | null; /** * Checks if a commit exists. */ commitExists(hash: string): boolean; /** * Checks if a commit is reachable from HEAD (i.e., is an ancestor of HEAD). * * Use this to verify an external commit reference before using it for * range queries. Detects if history was rewritten after the reference was recorded. */ commitReachableFromHead(hash: string): boolean; /** * Gets files changed between two refs. */ getChangedFilesBetween(base: string, head?: string): readonly string[]; /** * Gets files changed between two refs with status. */ getChangedFilesBetweenWithStatus(base: string, head?: string): readonly FileChange[]; /** * Gets a commit with its changed files. */ getCommitWithFiles(hash: string): GitCommitWithFiles | null; /** * Gets all tags. */ getTags(options?: Omit): readonly GitTag[]; /** * Gets a specific tag. */ getTag(name: string): GitTag | null; /** * Creates a tag. */ createTag(name: string, options?: Omit): GitTag; /** * Deletes a tag. */ deleteTag(name: string): boolean; /** * Checks if a tag exists. */ tagExists(name: string): boolean; /** * Gets the latest tag. */ getLatestTag(options?: Omit): GitTag | null; /** * Gets tags for a specific package. */ getTagsForPackage(packageName: string, options?: Omit): readonly GitTag[]; /** * Pushes a tag to remote. */ pushTag(name: string, remote?: string): boolean; /** * Creates a commit. */ createCommit(message: string, options?: Omit): GitCommit; /** * Stages files for commit. */ stage(files: readonly string[], options?: Omit): boolean; /** * Unstages files. */ unstage(files: readonly string[]): boolean; /** * Stages all changes. */ stageAll(): boolean; /** * Amends the last commit. */ amendCommit(message: string, options?: Omit): GitCommit; /** * Creates an empty commit. */ createEmptyCommit(message: string, options?: Omit): GitCommit; /** * Gets the HEAD commit hash. */ getHead(): string | null; /** * Gets the current branch name. */ getCurrentBranch(): string | null; /** * Checks if there are staged changes. */ hasStagedChanges(): boolean; /** * Checks if there are unstaged changes. */ hasUnstagedChanges(): boolean; /** * Discards uncommitted changes to tracked files. * * **Warning:** Destructive operation: discarded changes cannot be recovered. */ discardChanges(options?: Omit): boolean; /** * Discards all changes and unstages all files. * * **Warning:** Destructive operation: discarded changes cannot be recovered. */ discardAllChanges(): boolean; /** * Checks if there are untracked files. */ hasUntrackedFiles(): boolean; /** * Gets the full repository status. */ getStatus(): RepositoryStatus; /** * Checks if the working tree is clean. */ isClean(): boolean; /** * Checks if this is a git repository. */ isGitRepository(): boolean; /** * Gets the repository root. */ getRepositoryRoot(): string | null; /** * Gets the HEAD hash. */ getHeadHash(): string | null; /** * Gets the short HEAD hash. */ getHeadShortHash(): string | null; /** * Checks if there are merge conflicts. */ hasConflicts(): boolean; /** * Gets the number of commits ahead of upstream. */ getAheadCount(): number; /** * Gets the number of commits behind upstream. */ getBehindCount(): number; /** * Checks if push is needed. */ needsPush(): boolean; /** * Checks if pull is needed. */ needsPull(): boolean; /** * Gets staged file paths. */ getStagedFiles(): readonly string[]; /** * Gets modified file paths. */ getModifiedFiles(): readonly string[]; /** * Gets untracked file paths. */ getUntrackedFiles(): readonly string[]; /** * Gets the current git operation state. * * Detects if git is in the middle of an incomplete operation such as * a rebase or merge. */ getOperationState(): GitOperationState; /** * Checks if an operation (rebase, merge) is in progress. */ isOperationInProgress(): boolean; /** * Gets all refs (branches, tags, remotes). */ getRefs(): readonly GitRef[]; /** * Gets local branches. */ getBranches(): readonly GitRef[]; /** * Gets remote tracking branches. */ getRemoteBranches(remote?: string): readonly GitRef[]; /** * Fetches from remote. */ fetch(remote?: string, options?: GitFetchOptions): boolean; /** * Pulls from remote. */ pull(remote?: string, branch?: string): boolean; /** * Pushes to remote. */ push(remote?: string, branch?: string, options?: GitPushOptions): boolean; /** * Gets the URL of a remote. * * @param remoteName - Name of the remote (defaults to 'origin') * @returns The remote URL, or null if not found */ getRemoteUrl(remoteName?: string): string | null; } /** * Default git client configuration. */ declare const DEFAULT_GIT_CLIENT_CONFIG: Required> & Pick; /** * Creates a git client for a specific working directory. * * @param config - Client configuration * @returns GitClient instance * * @example Create a git client for a repository * const git = createGitClient({ cwd: '/path/to/repo' }) * const status = git.getStatus() * const commits = git.getCommitsSince('v1.0.0') */ declare function createGitClient(config?: GitClientConfig): GitClient; export { DEFAULT_GIT_CLIENT_CONFIG, createGitClient }; export type { GitClient, GitClientConfig };