/** Never `--no-verify`: the repo's hooks are part of the checks. */ export declare const COMMIT_ARGS: readonly string[]; /** A guard refused: nothing was changed. `message` is safe to show the user. */ export declare class FixAllGuardError extends Error { name: string; } export declare function currentBranch(dir: string): Promise; export declare function headCommit(dir: string): Promise; /** Whether `commit` is behind (or at) HEAD. */ export declare function isAncestorOfHead(dir: string, commit: string): Promise; /** Repo-relative paths `git status` lists (tracked changes and untracked files; not ignored ones). */ export declare function changedPaths(dir: string): Promise; export interface Preflight { readonly root: string; readonly branch: string; readonly head: string; } /** * The checkout is safe to run in (clean, on a branch, no merge or rebase under way, and on * `opts.branch` when given), or a FixAllGuardError saying why not. */ export declare function preflightTree(dir: string, opts?: { branch?: string; }): Promise; /** What a run is keyed by: the repository's main folder, the same from any worktree of it. */ export declare function repoKey(dir: string): Promise; /** `gg/fix-all-20261202-1615`, with `-2`, `-3`… when taken. */ export declare function fixAllBranchName(now: Date, taken: ReadonlySet): string; /** A free branch name for a run started now. */ export declare function proposeRunBranch(dir: string, now: Date): Promise; export interface RunWorktree { readonly branch: string; /** The commit the branch starts from (the folder's HEAD), before the map commit if any. */ readonly base: string; /** The worktree's folder, symlinks resolved. */ readonly path: string; /** Ignored local files copied in (`.env`, `.worktreeinclude`). */ readonly copied: readonly string[]; /** The folder's uncommitted feature map was committed on the run's branch. */ readonly mapCommitted: boolean; } /** * The run's branch, at the folder's HEAD, checked out in a new worktree under `worktreesRoot` * with the user's git (hooks run). The folder itself is only read. A map file that's new or * changed there is carried over as a commit on the run's branch. Any failure removes what it made. */ export declare function createRunWorktree(from: string, worktreesRoot: string, now: Date): Promise; /** * Remove an ended run's worktree and branch when they hold nothing to review: a GG worktree (under * `worktreesRoot`, never the main folder), still on the run's branch at the commit it started from, * with no uncommitted changes (ignored files such as `node_modules` and `.env` don't count). False, * changing nothing, when any of that doesn't hold. */ export declare function removeEmptyRunWorktree(run: { readonly root: string; readonly branch: string; readonly head: string; }, worktreesRoot: string): Promise; /** Remove a run's worktree and its branch (best effort): a launch that failed after making them. */ export declare function discardRunWorktree(root: string, target: string, branch: string): Promise; /** Commit everything the fix changed on the run's branch; null when it changed nothing. */ export declare function commitStep(dir: string, branch: string, message: string): Promise; export interface RollbackRequest { readonly dir: string; readonly branch: string; /** The commit to go back to. */ readonly checkpoint: string; /** Commits a rollback may go back to: the branch base and the run's own commits. */ readonly allowed: ReadonlySet; /** How many other windows have this checkout open. */ readonly othersOnCheckout: () => Promise; /** Called with what will be discarded, before anything is. */ readonly onDiscard?: (files: readonly string[]) => void | Promise; } /** What a rollback to `checkpoint` would discard: uncommitted changes plus commits since it. */ export declare function filesToDiscard(dir: string, checkpoint: string): Promise; /** * Undo an unfinished fix: `reset --hard` to the run's checkpoint, then `clean -fd` (never `-x`, * so ignored files such as `.env` and `node_modules` stay). Returns the files it discarded. */ export declare function rollbackTo(req: RollbackRequest): Promise;