/** * Git worktree creation and removal utilities for the SDK. * Used by EnterWorktree and ExitWorktree tools. */ export interface WorktreeInfo { name: string; path: string; branch: string; repoRoot: string; isNew: boolean; /** HEAD commit of the original branch at creation time, for dirty-check on exit */ originalHeadCommit?: string; } /** * Validate a worktree name to prevent path traversal and invalid characters. */ export declare function validateWorktreeName(name: string): void; /** * Generate a random worktree name. */ export declare function generateWorktreeName(): string; /** * Get the current HEAD commit SHA. */ export declare function getHeadCommit(cwd: string): string; /** * Create a git worktree for use during a session. */ export declare function createWorktree(name: string, cwd: string): WorktreeInfo; /** * Remove a git worktree and its branch. */ export declare function removeWorktree(info: WorktreeInfo): void; /** * Count uncommitted files and new commits in a worktree. * Returns null if git commands fail (fail-closed). */ export declare function countWorktreeChanges(worktreePath: string, originalHeadCommit: string | undefined): { changedFiles: number; commits: number; } | null;