/**
 * Worktree creation operation for @cleocode/worktree.
 *
 * Creates a git worktree at the canonical XDG path per D029:
 *   `~/.local/share/cleo/worktrees/<projectHash>/<taskId>/`
 *
 * Also:
 *   - Applies git worktree lock to prevent accidental pruning.
 *   - Runs declarative `post-create` hooks (D030 native lift).
 *   - Applies `.cleo/worktree-include` patterns (D030 native lift).
 *   - Constructs the agent env-var block and prompt preamble.
 *
 * @task T1161
 */
import type { CreateWorktreeOptions, CreateWorktreeResult, WorktreeHookResult } from '@cleocode/contracts';
/**
 * Extended result type including the bootstrap field.
 *
 * The contracts package will be updated separately to add this field to
 * {@link CreateWorktreeResult}; this local extension allows the implementation
 * to compile in the interim.
 */
interface CreateWorktreeResultWithBootstrap extends CreateWorktreeResult {
    bootstrap: {
        copiedPaths: string[];
        failedPaths: string[];
        hookResults: WorktreeHookResult[];
    };
    /** Glob patterns actually excluded via sparse-checkout (T9226). */
    appliedExcludePatterns: string[];
    /**
     * The sparse-checkout scope applied to the worktree (T9807), or `null` when
     * no scope was requested or the operation failed.
     */
    appliedScope: string | null;
}
/**
 * Create a git worktree for an agent task.
 *
 * Steps:
 * 1. Resolve paths and project hash from the project root.
 * 2. Remove stale worktree at the same path if it exists (dirty worktrees are preserved).
 * 3. If `task/<taskId>` branch already exists (leftover from a prior aborted
 *    spawn), attach to it via `git worktree add <path> <branch>` (no `-b`).
 *    Otherwise create a new branch via `git worktree add -b <branch> <path> <baseRef>`.
 * 4. Optionally apply `git worktree lock` to prevent pruning.
 * 5. Run declarative `post-create` hooks.
 * 6. Apply `.worktreeinclude` (or legacy `.cleo/worktree-include`) glob patterns —
 *    real ignore::gitignore matching is delegated to `@cleocode/worktree-napi`.
 * 7. NO hardcoded bootstrap copy (T9982). Projects that need node_modules /
 *    packages/* /dist mirrored into the worktree MUST declare them in
 *    `.worktreeinclude` — the multi-language native include file.
 * 8. Run declarative `post-start` hooks.
 * 9. Build and return the {@link CreateWorktreeResult}.
 *
 * Branch-reuse semantics: when a prior spawn aborted after creating the branch
 * but before the worker committed anything, the branch still points to
 * `baseRef`. Reattaching is safe — the worker continues from a clean state.
 * The returned result includes {@link CreateWorktreeResult.reused} so callers
 * can distinguish between a fresh branch and a reattached one if needed.
 *
 * @param projectRoot - Absolute path to the project root directory.
 * @param options - Options controlling the worktree creation.
 * @returns The created worktree result with env vars and preamble.
 * @throws Error if git worktree add fails.
 *
 * @task T1161
 * @task T1878
 */
export declare function createWorktree(projectRoot: string, options: CreateWorktreeOptions): Promise<CreateWorktreeResultWithBootstrap>;
export {};
//# sourceMappingURL=worktree-create.d.ts.map