/**
 * Worktree Backend — git command implementation for WorktreeToolDeps.
 *
 * CC reference: claude-code-haha/src/utils/worktree.ts
 *
 * Implements the host-provided git worktree backend:
 *   - enterWorktree(): git worktree add -B <branch> <path> HEAD
 *   - exitWorktree(): git worktree remove / keep
 *   - listWorktrees(): git worktree listporcelain
 *   - isInWorktree(): check if cwd is inside a worktree
 *   - currentWorktree(): get current worktree info
 *
 * State management:
 *   - Tracks current worktree session in memory
 *   - CWD switching via process.chdir()
 *   - Safety checks: uncommitted changes, unpushed commits
 *
 * Security: validateWorktreeSlug() prevents path traversal.
 */
import type { WorktreeBackend } from "../ports/worktree-contracts.js";
interface WorktreeSession {
    originalCwd: string;
    worktreePath: string;
    worktreeName: string;
    worktreeBranch: string;
    /** tmux session name (CC parity). */
    tmuxSessionName?: string;
    /** Whether worktree was created via a user hook (CC hookBased). */
    hookBased?: boolean;
    /** Creation duration in ms (unset on resume). */
    creationDurationMs?: number;
    /** True if sparse-checkout was applied. */
    usedSparsePaths?: boolean;
}
/** Get the current worktree session (CC getCurrentWorktreeSession parity). */
export declare function getCurrentWorktreeSession(): WorktreeSession | null;
/** Restore session on resume (CC restoreWorktreeSession parity). */
export declare function restoreWorktreeSession(session: WorktreeSession | null): void;
export declare function findGitRoot(cwd?: string): Promise<string | null>;
/** Check whether tmux is available on the system. */
export declare function isTmuxAvailable(): Promise<boolean>;
/** Generate a tmux session name from repo path and branch (CC parity). */
export declare function generateTmuxSessionName(repoPath: string, branch: string): string;
/**
 * Create a tmux session for a worktree (CC createTmuxSessionForWorktree parity).
 * Returns the session name, or null if tmux is not available.
 */
export declare function createTmuxSession(worktreePath: string, sessionName: string): Promise<string | null>;
/** Kill a tmux session (CC killTmuxSession parity). */
export declare function killTmuxSession(sessionName: string): Promise<boolean>;
/**
 * Create a lightweight worktree for a sub-agent without modifying the
 * global session. CC reference: createAgentWorktree().
 */
export declare function createAgentWorktree(gitRoot: string, slug: string, log?: {
    info(msg: string): void;
    warn(msg: string): void;
}): Promise<{
    worktreePath: string;
    branch: string;
} | null>;
/** Remove an agent worktree (CC removeAgentWorktree parity). */
export declare function removeAgentWorktree(gitRoot: string, worktreePath: string, branch: string, log?: {
    info(msg: string): void;
    warn(msg: string): void;
}): Promise<boolean>;
/**
 * Clean up stale agent worktrees older than maxAgeDays (CC cleanupStaleAgentWorktrees parity).
 */
export declare function cleanupStaleAgentWorktrees(gitRoot: string, maxAgeDays?: number, log?: {
    info(msg: string): void;
    warn(msg: string): void;
}): Promise<number>;
export interface WorktreeBackendOptions {
    /** Logger for worktree operations */
    log: {
        info(msg: string): void;
        warn(msg: string): void;
    };
    /** Directories to symlink from main repo (CC parity: node_modules, etc.) */
    symlinkDirs?: string[];
    /** Sparse-checkout paths (CC settings.worktree.sparsePaths parity). */
    sparsePaths?: string[];
}
export declare function createWorktreeBackend(opts: WorktreeBackendOptions): WorktreeBackend;
export {};
