/** * A pre-attempt snapshot of the git worktree. Rejected replanner attempts * were "rolled back" by restoring exactly two files, but the replanner is a * full agentic CLI that can touch anything — out-of-scope edits and stray * temp scripts survived the rollback while the progress line claimed a clean * transaction. This guard makes the claim true: capture the whole tracked * tree via `git stash create` (which snapshots without touching the * worktree) and record which paths were untracked, so a restore can revert * every tracked change and delete files the agent created. * * Limits, stated rather than hidden: modifications to files that were * already untracked at capture time cannot be restored (git has no snapshot * of them), and gitignored files are invisible to the status listing. In a * non-git directory `available` is false and callers fall back to the * legacy two-file restore with a warning. */ export interface WorktreeCapture { available: boolean; /** Git repository toplevel; all recorded paths are relative to it. */ toplevel?: string; /** Commit whose tree is the captured tracked state. */ source?: string; /** Paths untracked at capture; never deleted by a restore. */ untracked?: Set; } export declare function captureWorktree(root: string): Promise; export interface WorktreeRestoreResult { restored: boolean; /** Tracked paths whose state drifted from the capture (before restoring). */ drifted: string[]; /** Newly created untracked files that were deleted. */ removed: string[]; } /** * Revert the worktree to `capture`, except `preservePaths` (absolute or * root-relative), which keep their current content. Newly created untracked * files outside the preserve list are deleted. */ export declare function restoreWorktree(root: string, capture: WorktreeCapture, preservePaths?: string[]): Promise; //# sourceMappingURL=worktree-guard.d.ts.map