import { GitCommit, GitTag } from '../models'; /** * Options for commit operations. */ interface GitCommitOptions { /** Working directory (defaults to cwd) */ readonly cwd?: string; /** Timeout in milliseconds */ readonly timeout?: number; } /** * Options for creating a commit. */ interface CreateCommitOptions extends GitCommitOptions { /** Commit message body (separate from subject) */ readonly body?: string; /** Allow empty commit (no changes) */ readonly allowEmpty?: boolean; /** Amend the last commit */ readonly amend?: boolean; /** Keep the existing commit message when amending (requires amend: true) */ readonly noEdit?: boolean; /** Sign the commit with GPG */ readonly sign?: boolean; /** Don't run pre-commit hooks */ readonly noVerify?: boolean; /** Author (format: "Name ") */ readonly author?: string; /** Specific files to commit (instead of all staged) */ readonly files?: readonly string[]; } /** * Default commit options. */ declare const DEFAULT_COMMIT_OPTIONS: Required>; /** * Creates a new commit. * * @param message - Commit message (subject line) * @param options - Create options * @returns Created GitCommit * * @example Create a new commit * const commit = createCommit('feat: add new feature') * const commit = createCommit('fix: resolve bug', { body: 'Detailed description' }) */ declare function commit(message: string, options?: CreateCommitOptions): GitCommit; /** * Amends the last commit with new message. * * @param message - The new commit message to use * @param options - Configuration for the commit operation * @returns GitCommit object representing the amended commit * * @example Amend the last commit with a new message * const commit = amendCommit('feat: improved feature') */ declare function amendCommit(message: string, options?: Omit): GitCommit; /** * Amends the last commit without changing the message. * Useful for adding staged changes to the previous commit. * * @param options - Configuration for the commit operation * @returns GitCommit object representing the amended commit * * @example Add staged changes to last commit without changing message * stage(['extra-file.ts']) * amendCommitNoEdit() // adds staged files to last commit */ declare function amendCommitNoEdit(options?: Omit): GitCommit; /** * Creates an empty commit (useful for CI triggers). * * @param message - Text for the empty commit * @param options - Configuration for the commit operation * @returns GitCommit object representing the new empty commit * * @example Create an empty commit for CI triggers * const commit = createEmptyCommit('chore: trigger CI') */ declare function createEmptyCommit(message: string, options?: Omit): GitCommit; /** * Escapes a file path for safe use in git commands. * * @param path - Path to escape * @returns Safe path string * * @example Escape a file path for git commands * ```typescript * const safePath = escapeFilePath('src/utils/helper.ts') * // => 'src/utils/helper.ts' * escapeFilePath('file$name.ts') // throws - '$' is invalid * ``` */ declare function escapeFilePath(path: string): string; /** * Escapes an author string for safe use in git commands. * Format: "Name " * * @param author - Author to escape * @returns Safe author string * * @example Escape an author string for git commit * ```typescript * const safeAuthor = escapeAuthor('John Doe ') * // => 'John Doe ' * ``` */ declare function escapeAuthor(author: string): string; /** * File change status codes matching git conventions. */ type FileChangeStatus = 'added' | 'modified' | 'deleted' | 'renamed' | 'copied'; /** * A file changed in a commit or between refs. */ interface FileChange { /** File path relative to repository root */ readonly path: string; /** Type of change */ readonly status: FileChangeStatus; /** Original path for renames/copies */ readonly oldPath?: string; } /** * Options for diff-based queries. */ interface DiffOptions { /** Working directory (defaults to cwd) */ readonly cwd?: string; /** Timeout in milliseconds */ readonly timeout?: number; } /** * A git commit with file change information. */ interface GitCommitWithFiles extends GitCommit { /** Files changed in this commit */ readonly files: readonly FileChange[]; } /** * Default diff options. */ declare const DEFAULT_DIFF_OPTIONS: Required>; /** * Gets files changed between two git refs. * * Uses `git diff --name-only base...head` which computes the merge-base * internally, giving files changed in `head` since diverging from `base`. * * @param base - Base reference (e.g., 'origin/main', 'v1.0.0') * @param head - Head reference (defaults to 'HEAD') * @param options - Additional options * @returns Deduplicated list of changed file paths (relative to repo root) * * @example Get changed files between refs * // Files changed since diverging from main * const files = getChangedFilesBetween('origin/main') * * // Files changed between two tags * const files = getChangedFilesBetween('v1.0.0', 'v2.0.0') */ declare function getChangedFilesBetween(base: string, head?: string, options?: DiffOptions): readonly string[]; /** * Gets files changed between two refs with status information. * * @param base - Base reference * @param head - Head reference (defaults to 'HEAD') * @param options - Additional options * @returns Array of file changes with status * * @example Get file changes with status information * const changes = getChangedFilesBetweenWithStatus('v1.0.0', 'v2.0.0') * const added = changes.filter(c => c.status === 'added') */ declare function getChangedFilesBetweenWithStatus(base: string, head?: string, options?: DiffOptions): readonly FileChange[]; /** * Gets a commit with its changed files. * * Uses `git diff-tree` to retrieve file changes for a single commit. * More efficient than fetching files for all commits when only * specific commits need file attribution. * * @param hash - Commit hash (full or abbreviated) * @param options - Additional options * @returns Commit with files, or null if not found * * @example Get commit with its changed files * const commit = getCommitWithFiles('abc123') * if (commit) { * console.log(`${commit.subject} touched ${commit.files.length} files`) * } */ declare function getCommitWithFiles(hash: string, options?: DiffOptions): GitCommitWithFiles | null; /** * Options for git log operations. */ interface GitLogOptions { /** Maximum number of commits to retrieve. Zero retrieves every matching commit. */ readonly maxCount?: number; /** Starting commit reference (inclusive) */ readonly from?: string; /** Ending commit reference (exclusive) */ readonly to?: string; /** File path to filter commits by */ readonly path?: string; /** Author to filter by */ readonly author?: string; /** Include merge commits */ readonly includeMerges?: boolean; /** Working directory (defaults to cwd) */ readonly cwd?: string; /** Timeout in milliseconds */ readonly timeout?: number; } /** * Default log options. */ declare const DEFAULT_LOG_OPTIONS: Required>; /** * Gets the commit log from a git repository. * * @param options - Configuration for retrieving the commit log * @returns Array of GitCommit objects * * @example Get commit log with options * const commits = getCommitLog({ maxCount: 10 }) * const recentChanges = getCommitLog({ from: 'v1.0.0', to: 'HEAD' }) */ declare function getCommitLog(options?: GitLogOptions): readonly GitCommit[]; /** * Gets commits between two references. * * @param from - Starting reference (exclusive) * @param to - Ending reference (inclusive, default: HEAD) * @param options - Additional options * @returns Array of GitCommit objects * * @example Get commits between two references * const commits = getCommitsBetween('v1.0.0', 'v1.1.0') */ declare function getCommitsBetween(from: string, to?: string, options?: Omit): readonly GitCommit[]; /** * Gets commits since a specific tag or reference. * * @param since - Reference to start from (exclusive) * @param options - Additional options * @returns Array of GitCommit objects * * @example Get commits since a tag * const commits = getCommitsSince('v1.0.0') */ declare function getCommitsSince(since: string, options?: Omit): readonly GitCommit[]; /** * Gets a single commit by its hash. * * @param hash - Commit hash (full or short) * @param options - Additional options * @returns GitCommit or null if not found * * @example Get a single commit by hash * const commit = getCommit('abc1234') */ declare function getCommit(hash: string, options?: Pick): GitCommit | null; /** * Checks if a commit exists in the repository. * * @param hash - Commit hash to check * @param options - Additional options * @returns True if commit exists * * @example Check if a commit exists in the repository * ```typescript * if (commitExists('abc123def')) { * console.log('Commit found in repository') * } * ``` */ declare function commitExists(hash: string, options?: Pick): boolean; /** * Checks if a commit is reachable from HEAD (i.e., is an ancestor of HEAD). * * A commit may exist in the repository but be orphaned (not in current branch history). * This function verifies that the commit is actually in the history of the current HEAD. * * Common use cases: * - Verify an external commit reference before using it for range queries * - Detect if history was rewritten (rebase/force push) after a reference was recorded * * @param hash - Commit hash to check * @param options - Additional options * @returns True if the commit is an ancestor of HEAD * * @example Check if commit is reachable from HEAD * if (commitReachableFromHead(baseCommit)) { * // Safe to use for commit range queries * const commits = getCommitsSince(baseCommit) * } else { * // Commit not in current history, need fallback strategy * } */ declare function commitReachableFromHead(hash: string, options?: Pick): boolean; /** * Escapes a git reference for safe use in shell commands. * * @param ref - Reference to escape * @returns Safe reference string * @throws {Error} If reference contains invalid characters * * @example Escape a git reference for shell commands * ```typescript * escapeGitRef('refs/heads/main') // => 'refs/heads/main' * escapeGitRef('feature/test') // => 'feature/test' * escapeGitRef('ref$invalid') // throws - '$' is invalid * ``` */ declare function escapeGitRef(ref: string): string; /** * Escapes a file path for safe use in git commands. * * @param path - Path to escape * @returns Safe path string * @throws {Error} If path contains invalid characters * * @example Escape a file path for git commands * ```typescript * escapeGitPath('src/utils/helper.ts') // => 'src/utils/helper.ts' * escapeGitPath('path with spaces/file.ts') // => 'path with spaces/file.ts' * ``` */ declare function escapeGitPath(path: string): string; /** * Escapes a general git argument for safe use in shell commands. * * @param arg - Argument to escape * @returns Safe argument string * @throws {Error} If argument contains invalid characters * * @example Escape a git argument for shell commands * ```typescript * escapeGitArg('John Doe ') // => 'John Doe ' * ``` */ declare function escapeGitArg(arg: string): string; /** * Options for tag operations. */ interface GitTagOptions { /** Working directory (defaults to cwd) */ readonly cwd?: string; /** Timeout in milliseconds */ readonly timeout?: number; } /** * Options for listing tags. */ interface ListTagsOptions extends GitTagOptions { /** Pattern to filter tags by (prefix match) */ readonly pattern?: string; /** Sort by version (descending) */ readonly sortByVersion?: boolean; /** Maximum number of tags to return */ readonly maxCount?: number; } /** * Default tag options. */ declare const DEFAULT_TAG_OPTIONS: Required>; /** * Gets all tags from the repository. * * @param options - Tag listing options * @returns Array of GitTag objects * * @example Get all tags from the repository * const tags = getTags() * const versionTags = getTags({ pattern: 'v' }) */ declare function getTags(options?: ListTagsOptions): readonly GitTag[]; /** * Gets detailed information about a specific tag. * * @param name - The tag name to look up * @param options - Configuration for the tag operation * @returns GitTag or null if not found * * @example Get detailed information about a specific tag * const tag = getTag('v1.0.0') */ declare function getTag(name: string, options?: GitTagOptions): GitTag | null; /** * Checks if a tag exists. * * @param name - The tag name to verify * @param options - Configuration for the tag operation * @returns True if tag exists * * @example Check if a tag exists * if (tagExists('v1.0.0')) { ... } */ declare function tagExists(name: string, options?: GitTagOptions): boolean; /** * Gets the latest tag (by creation date). * * @param options - Tag options with optional pattern * @returns Latest GitTag or null * * @example Get the latest tag by creation date * const latest = getLatestTag() * const latestVersion = getLatestTag({ pattern: 'v' }) */ declare function getLatestTag(options?: ListTagsOptions): GitTag | null; /** * Gets tags that match a package name. * * @param packageName - Package name to match * @param options - Tag options * @returns Array of matching tags * * @example Get tags matching a package name * const tags = getTagsForPackage('@scope/pkg') */ declare function getTagsForPackage(packageName: string, options?: ListTagsOptions): readonly GitTag[]; /** * Escapes a tag pattern for safe use in git commands. * * @param pattern - Pattern to escape * @returns Safe pattern string * * @example Escape a tag pattern for git commands * ```typescript * const safePattern = escapeGitTagPattern('@scope/package@') * // => '@scope/package@' * escapeGitTagPattern('v1.0.*') // throws - '*' is invalid * ``` */ declare function escapeGitTagPattern(pattern: string): string; /** * Options for creating a tag. */ interface CreateTagOptions extends GitTagOptions { /** Tag message (creates annotated tag if provided) */ readonly message?: string; /** Target commit (defaults to HEAD) */ readonly target?: string; /** Force overwrite if tag exists */ readonly force?: boolean; } /** * Creates a new tag. * * @param name - The name for the new tag * @param options - Configuration including optional message for annotated tags * @returns Created GitTag * * @example Create lightweight and annotated tags * // Create lightweight tag * const tag = createTag('v1.0.0') * * // Create annotated tag * const tag = createTag('v1.0.0', { message: 'Release v1.0.0' }) */ declare function createTag(name: string, options?: CreateTagOptions): GitTag; /** * Deletes a tag. * * @param name - The tag name to delete * @param options - Configuration for the tag operation * @returns True if deleted * * @example Delete a tag by name * const deleted = deleteTag('v1.0.0') */ declare function deleteTag(name: string, options?: GitTagOptions): boolean; /** * Pushes a tag to a remote. * * @param name - The tag to push to the remote * @param remote - Remote name (defaults to 'origin') * @param options - Configuration for the tag operation * @returns True if pushed successfully * * @example Push a tag to remote * pushTag('v1.0.0') * pushTag('v1.0.0', 'upstream') */ declare function pushTag(name: string, remote?: string, options?: GitTagOptions): boolean; /** * Escapes a message for safe use in git commands. * * @param message - Message to escape * @returns Safe message string * * @example Escape a git commit message * ```typescript * const safeMessage = escapeGitMessage('Release v1.0.0 "stable"') * // => 'Release v1.0.0 \"stable\"' * ``` */ declare function escapeGitMessage(message: string): string; /** * Reasons why git may be in an unstable operation state. * * These correspond to state files that git creates during multi-step operations: * * - `'rebase-interactive'`: `.git/rebase-merge` exists (interactive rebase paused) * - `'rebase-apply'`: `.git/rebase-apply` exists (mailbox-based rebase or `git am`) * - `'merge-in-progress'`: `.git/MERGE_HEAD` exists (merge awaiting conflict resolution) */ type GitOperationStateReason = 'rebase-interactive' | 'rebase-apply' | 'merge-in-progress'; /** * Per-check details captured while inspecting git's operation state. * * Each flag corresponds to one of the `.git/` state files probed by * {@link getOperationState}; useful for diagnostics or when multiple * states could theoretically overlap. */ interface GitOperationStateDetails { /** True if an interactive/merge rebase is in progress */ readonly rebaseMerge: boolean; /** True if a non-interactive rebase is in progress */ readonly rebaseApply: boolean; /** True if a merge is in progress */ readonly mergeHead: boolean; } /** * Result of checking git's operation state. */ interface GitOperationState { /** True if git is mid-operation (rebase, merge, etc.) */ readonly inProgress: boolean; /** * Which operation is in progress, if any. * Returns the first detected state (exit-early pattern). */ readonly reason: GitOperationStateReason | null; /** * Detailed state for each check performed. * Useful for diagnostics or when multiple states could theoretically overlap. */ readonly details: GitOperationStateDetails; } /** * Options for operation state check. */ type GitOperationStateOptions = GitCommitOptions; /** * Default options for operation state checks. */ declare const DEFAULT_OPERATION_STATE_OPTIONS: Required>; /** * Detects if git is mid-operation (rebase, merge, patch apply). * * Uses filesystem checks on `.git/` state files rather than git commands. * This is more reliable because file existence checks are atomic OS syscalls * that work even when the git index is corrupted or git commands would hang. * * Handles worktrees, submodules, and `$GIT_DIR` overrides via `git rev-parse --git-dir`. * * @param options - Configuration for the state check * @returns Operation state with reason if in progress * * @example Detect if git is mid-operation * const state = getOperationState() * if (state.inProgress) { * console.warn(`Cannot proceed: git ${state.reason} in progress`) * } */ declare function getOperationState(options?: GitOperationStateOptions): GitOperationState; /** * Checks if git is in the middle of an incomplete operation. * * Convenience wrapper around `getOperationState()` for simple checks. * Use `getOperationState()` directly when you need to know *which* * operation is in progress. * * @param options - Configuration for the state check * @returns True if rebase, merge, or other operation is incomplete * * @example Check for incomplete operations * if (isOperationInProgress()) { * throw new Error('Complete or abort the current git operation first') * } */ declare function isOperationInProgress(options?: GitOperationStateOptions): boolean; /** * Options for discarding changes. */ interface DiscardChangesOptions extends GitCommitOptions { /** * Files or directories to discard. If empty/undefined, discards ALL changes. * Paths are relative to the working directory. */ readonly files?: readonly string[]; } /** * Options for staging files. */ interface StageOptions extends GitCommitOptions { /** Stage all changes (including untracked) */ readonly all?: boolean; /** Update tracked files only */ readonly update?: boolean; /** Force add (ignore gitignore) */ readonly force?: boolean; } /** * Stages files for commit. * * @param files - Array of file paths relative to working directory * @param options - Configuration for the staging operation * @returns True if staging succeeded * * @example Stage files for commit * stage(['package.json', 'CHANGELOG.md']) * stage(['.'], { all: true }) */ declare function stage(files: readonly string[], options?: StageOptions): boolean; /** * Unstages files. * * @param files - Array of file paths to remove from staging area * @param options - Configuration for the unstage operation * @returns True if unstaging succeeded * * @example Unstage files from the index * unstage(['package.json']) */ declare function unstage(files: readonly string[], options?: GitCommitOptions): boolean; /** * Stages all changes (tracked and untracked). * * @param options - Configuration for the staging operation * @returns True if all changes were successfully added to the index * * @example Stage all tracked and untracked changes * stageAll() // stages all tracked and untracked changes */ declare function stageAll(options?: GitCommitOptions): boolean; /** * Checks if there are staged changes. * * @param options - Configuration for the operation * @returns True if there are staged changes ready to commit * * @example Check for staged changes before committing * if (hasStagedChanges()) { createCommit('...') } */ declare function hasStagedChanges(options?: GitCommitOptions): boolean; /** * Checks if there are unstaged changes (working tree dirty). * * @param options - Configuration for the operation * @returns True if there are unstaged changes in the working tree * * @example Check for unstaged changes before staging * if (hasUnstagedChanges()) { stage(['.']) } */ declare function hasUnstagedChanges(options?: GitCommitOptions): boolean; /** * Discards uncommitted changes to tracked files. * * Uses `git checkout -- ` to restore files from HEAD. * Returns true if successful, false otherwise (silent failure pattern). * * **Warning:** Destructive operation: discarded changes cannot be recovered. * * @param options - Configuration including optional file list * @returns True if discard succeeded * * @example Discard changes in tracked files * // Discard all changes * discardChanges() * * // Discard specific files * discardChanges({ files: ['package.json', 'CHANGELOG.md'] }) * * @example Typical rollback pattern * // Typical rollback pattern * if (hasUnstagedChanges()) { * discardChanges() * } * if (hasStagedChanges()) { * unstage(['.']) * } */ declare function discardChanges(options?: DiscardChangesOptions): boolean; /** * Discards all uncommitted changes and unstages all files. * * Combines `discardChanges()` + `unstage(['.'])` for complete working tree reset. * * **Warning:** Destructive operation: discarded changes cannot be recovered. * * @param options - Configuration for the operation * @returns True if both operations succeeded * * @example Reset working directory to match HEAD * ```typescript * // Reset working directory to match HEAD * if (discardAllChanges()) { * console.log('Working tree reset to HEAD') * } * ``` */ declare function discardAllChanges(options?: GitCommitOptions): boolean; /** * Options for status operations. */ interface GitStatusOptions { /** Working directory (defaults to cwd) */ readonly cwd?: string; /** Timeout in milliseconds */ readonly timeout?: number; } /** * File status in a git repository. */ type FileStatus = 'modified' | 'added' | 'deleted' | 'renamed' | 'copied' | 'untracked' | 'ignored' | 'unmerged'; /** * Detailed file status. */ interface FileStatusEntry { /** File path */ readonly path: string; /** Index (staging area) status */ readonly indexStatus: FileStatus | null; /** Working tree status */ readonly workTreeStatus: FileStatus | null; /** Original path for renamed/copied files */ readonly origPath?: string; } /** * Repository status summary. */ interface RepositoryStatus { /** Current branch name */ readonly branch: string | null; /** Whether HEAD is detached */ readonly detached: boolean; /** Upstream branch (if tracking) */ readonly upstream?: string; /** Commits ahead of upstream */ readonly ahead: number; /** Commits behind upstream */ readonly behind: number; /** Staged files */ readonly staged: readonly FileStatusEntry[]; /** Modified files (unstaged) */ readonly modified: readonly FileStatusEntry[]; /** Untracked files */ readonly untracked: readonly string[]; /** Whether working tree is clean */ readonly clean: boolean; /** Whether there are merge conflicts */ readonly hasConflicts: boolean; } /** * Default status options. */ declare const DEFAULT_STATUS_OPTIONS: Required>; /** * Gets the full repository status. * * @param options - Configuration for the status query * @returns Comprehensive repository status information * * @example Get the full repository status * const status = getStatus() * if (!status.clean) { * console.log('Working tree has changes') * } */ declare function getStatus(options?: GitStatusOptions): RepositoryStatus; /** * Checks if the working tree is clean (no changes). * * @param options - Configuration for the status check * @returns True if working tree is clean with no uncommitted changes * * @example Check if working tree is clean * if (!isClean()) { * throw new Error('Working tree has changes') * } */ declare function isClean(options?: GitStatusOptions): boolean; /** * Checks if the directory is a git repository. * * @param options - Status options * @returns True if in a git repository * * @example Check if directory is a git repository * if (!isGitRepository()) { * throw new Error('Not a git repository') * } */ declare function isGitRepository(options?: GitStatusOptions): boolean; /** * Gets the repository root directory. * * @param options - Status options * @returns Root directory path or null * * @example Get the repository root directory * const root = getRepositoryRoot() */ declare function getRepositoryRoot(options?: GitStatusOptions): string | null; /** * Gets the current commit hash (HEAD). * * @param options - Status options * @returns Commit hash or null * * @example Get the current HEAD commit hash * ```typescript * const hash = getHeadHash() * // => 'abc123def456789012345678901234567890abcd' * ``` */ declare function getHeadHash(options?: GitStatusOptions): string | null; /** * Gets the short current commit hash. * * @param options - Status options * @returns Short hash or null * * @example Get the short HEAD commit hash * ```typescript * const shortHash = getHeadShortHash() * // => 'abc123d' * ``` */ declare function getHeadShortHash(options?: GitStatusOptions): string | null; /** * Checks if there are merge conflicts. * * @param options - Status options * @returns True if there are conflicts * * @example Check for merge conflicts * ```typescript * if (hasConflicts()) { * console.log('Resolve merge conflicts before continuing') * } * ``` */ declare function hasConflicts(options?: GitStatusOptions): boolean; /** * Gets the number of commits ahead of upstream. * * @param options - Status options * @returns Number of commits ahead * * @example Get commits ahead of upstream * ```typescript * const ahead = getAheadCount() * console.log(`${ahead} commits to push`) * ``` */ declare function getAheadCount(options?: GitStatusOptions): number; /** * Gets the number of commits behind upstream. * * @param options - Status options * @returns Number of commits behind * * @example Get commits behind upstream * ```typescript * const behind = getBehindCount() * console.log(`${behind} commits to pull`) * ``` */ declare function getBehindCount(options?: GitStatusOptions): number; /** * Checks if the repository needs to be pushed. * * @param options - Status options * @returns True if there are unpushed commits * * @example Check if repository needs to be pushed * ```typescript * if (needsPush()) { * console.log('Local commits need to be pushed') * } * ``` */ declare function needsPush(options?: GitStatusOptions): boolean; /** * Checks if the repository needs to be pulled. * * @param options - Status options * @returns True if there are commits to pull * * @example Check if repository needs to be pulled * ```typescript * if (needsPull()) { * console.log('Remote commits need to be pulled') * } * ``` */ declare function needsPull(options?: GitStatusOptions): boolean; /** * Gets list of staged file paths. * * @param options - Status options * @returns Array of staged file paths * * @example Get list of staged files * ```typescript * const staged = getStagedFiles() * // => ['src/index.ts', 'package.json'] * ``` */ declare function getStagedFiles(options?: GitStatusOptions): readonly string[]; /** * Gets list of modified file paths (unstaged). * * @param options - Status options * @returns Array of modified file paths * * @example Get list of modified files * ```typescript * const modified = getModifiedFiles() * // => ['src/utils.ts', 'README.md'] * ``` */ declare function getModifiedFiles(options?: GitStatusOptions): readonly string[]; /** * Gets list of untracked file paths. * * @param options - Status options * @returns Array of untracked file paths * * @example Get list of untracked files * ```typescript * const untracked = getUntrackedFiles() * // => ['new-file.ts', 'temp.log'] * ``` */ declare function getUntrackedFiles(options?: GitStatusOptions): readonly string[]; /** * Gets the current HEAD commit hash. * * @param options - Git operation configuration * @returns HEAD commit hash or null * * @example Get the current HEAD commit * const head = getHead() */ declare function getHead(options?: GitCommitOptions): string | null; /** * Gets the current branch name. * * @param options - Configuration for the operation * @returns Branch name or null if detached * * @example Get the current branch name * const branch = getCurrentBranch() */ declare function getCurrentBranch(options?: GitCommitOptions): string | null; /** * Checks if there are untracked files. * * @param options - Configuration for the operation * @returns True if there are untracked files in the working directory * * @example Check for untracked files * ```typescript * if (hasUntrackedFiles()) { * console.log('New files detected that are not tracked by git') * } * ``` */ declare function hasUntrackedFiles(options?: GitCommitOptions): boolean; export { DEFAULT_COMMIT_OPTIONS, DEFAULT_DIFF_OPTIONS, DEFAULT_LOG_OPTIONS, DEFAULT_OPERATION_STATE_OPTIONS, DEFAULT_STATUS_OPTIONS, DEFAULT_TAG_OPTIONS, 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 }; export type { CreateCommitOptions, CreateTagOptions, DiffOptions, DiscardChangesOptions, FileChange, FileChangeStatus, FileStatus, FileStatusEntry, GitCommitOptions, GitCommitWithFiles, GitLogOptions, GitOperationState, GitOperationStateOptions, GitOperationStateReason, GitStatusOptions, GitTagOptions, ListTagsOptions, RepositoryStatus, StageOptions };