/** * Thrown when a `git revert` leaves the working tree in a conflicted state. * Carries the list of conflicting (unmerged) files so the caller can report * them (e.g. the `hula revert` JSON `status:"conflict"` contract) and the * skill's AI can resolve them in the worktree before `--continue`. */ export declare class RevertConflictError extends Error { readonly conflictingFiles: string[]; constructor(conflictingFiles: string[]); } /** * Service for Git operations * Single Responsibility: Local git repository operations * * An optional `cwd` may be supplied to the constructor to run every git command * in a specific repository directory (used by multi-repo `--folder` fan-out). * When omitted (the default for every existing caller) commands run in the * process working directory exactly as before. */ export declare class GitService { private readonly cwd?; /** * @param cwd - Optional working directory for all git commands. Undefined * preserves the historical process-cwd behavior. */ constructor(cwd?: string | undefined); /** * Run a git command in this service's configured working directory. */ private run; /** * Run a git command (returning the full result) in this service's cwd. */ private runDetailed; /** * Get current git branch */ getCurrentBranch(): Promise; /** * Checkout a branch */ checkout(branch: string): Promise; /** * Create a new branch */ createBranch(name: string, startPoint?: string): Promise; /** * Delete a local branch */ deleteBranch(branch: string, force?: boolean): Promise; /** * Check if working directory is clean (no uncommitted changes) */ isClean(): Promise; /** * Merge a branch into current branch */ merge(source: string, options?: { noFf?: boolean; squash?: boolean; }): Promise; /** * Fetch from remote */ fetch(remote?: string, branch?: string): Promise; /** * Pull from remote */ pull(remote?: string, branch?: string): Promise; /** * Push to remote */ push(branch?: string, remote?: string, force?: boolean): Promise; /** * Check if a branch exists locally */ branchExists(branch: string): Promise; /** * Check if a remote branch exists */ remoteBranchExists(branch: string, remote?: string): Promise; /** * Get list of changed files */ getChangedFiles(): Promise; /** * Check if we're in a git repository */ isGitRepo(): Promise; /** * Get repository root directory */ getRepoRoot(): Promise; /** * Whether `filePath` is gitignored (e.g. the repo gitignores `.hublaunch/`). * `git check-ignore -q` exits 0 when the path is ignored, 1 when it is not; * any other status (e.g. check-ignore unavailable) is treated as "not * ignored" so callers fall back to the normal commit path. */ checkIgnore(filePath: string): Promise; /** * Remove a file from the git index only (keeps file on disk) */ rmCached(filePath: string): Promise; /** * Reset a file in the index to match HEAD (unstages changes for that file) */ resetFile(filePath: string): Promise; /** * Stash current changes with a message */ stash(message?: string): Promise; /** * Stash current changes including untracked files */ stashIncludingUntracked(message?: string): Promise; /** * Count the number of stash entries */ stashCount(): Promise; /** * Pop the most recent stash */ stashPop(): Promise; /** * Checkout a file from another branch/ref into the working tree */ checkoutFileFromRef(ref: string, filePath: string): Promise; /** * Stage a specific file */ addFile(filePath: string): Promise; /** * Create a commit with the given message */ commit(message: string): Promise; /** * Push to remote with --no-verify flag (skips git push hooks) */ pushNoVerify(branch: string, remote?: string): Promise; /** * Check if a file exists on a given git ref (branch, tag, or commit) */ fileExistsOnRef(ref: string, relativePath: string): Promise; /** * Read the content of a file from a given git ref. * Returns the raw file content as a string (git appends a trailing newline, * matching what is committed on the ref). * Throws if the ref or path is invalid, or if the file does not exist on the ref. */ showFile(ref: string, relativePath: string): Promise; /** * Check if local branch is behind remote */ isBehindRemote(branch: string, remote?: string): Promise; /** * Get remote repository information (owner and repo name) * Parses the git remote URL to extract GitHub owner/repo * @param remote - The remote name (default: "origin") * @returns Object with owner and repo, or null if not a valid GitHub remote */ getRemoteRepository(remote?: string): Promise<{ owner: string; repo: string; } | null>; /** * Validate a git ref / SHA before interpolating it into a shell command. * Mirrors the blocklist guard used by `fileExistsOnRef`/`showFile`. */ private assertSafeRef; /** * List the files currently in a conflicted (unmerged) state. * Used both to report revert conflicts and to validate `--continue`. */ getConflictedFiles(): Promise; /** * Revert a single commit. Creates the inverse commit on the current branch. * * @param sha - The commit to revert. * @param opts.mainline - Parent number for reverting a merge commit (`-m N`). * @param opts.noEdit - Use `--no-edit` to accept the default message (default true). * @throws {RevertConflictError} if the revert leaves unmerged files. */ revertCommit(sha: string, opts?: { mainline?: number; noEdit?: boolean; }): Promise; /** * Revert a list of commits in a single `git revert` invocation (used for the * rebase-merge shape). Pass the SHAs newest-first; git reverts them in order * and stops on the first conflict, leaving a resumable sequencer that * {@link revertContinue} completes. * * @throws {RevertConflictError} if any revert in the sequence conflicts. */ revertCommits(shas: string[], opts?: { noEdit?: boolean; }): Promise; /** * Whether a `git revert` is currently in progress (REVERT_HEAD exists). */ revertInProgress(): Promise; /** * Resume an in-progress revert after conflicts have been resolved and staged. * Completes the current revert commit (and any remaining commits in a * multi-commit sequence) without opening an editor. * * @throws {RevertConflictError} if a subsequent commit in the sequence conflicts. */ revertContinue(): Promise; /** * Number of parents of a commit. 1 = normal/squash commit, 2+ = merge commit. * Requires the commit object to be present locally (e.g. inside a worktree * cut from the base branch). Returns null if it cannot be determined. */ getParentCount(sha: string): Promise; } //# sourceMappingURL=GitService.d.ts.map