tarlatan
    Preparing search index...

    Interface WorktreeProgram

    The worktree entry points over one git runner, as worktreeProgramWith builds them.

    interface WorktreeProgram {
        createWorktree: (
            ...args: [request: WorktreeRequest],
        ) => Effect<
            WorktreeCreated,
            | WorktreeBranchExists
            | WorktreePathExists
            | WorktreePathNotAbsolute
            | WorktreeNotAsCreated
            | PathUnreadable
            | GitCommandFailed
            | GitOutputUndecodable
            | AttributeSourcesRefused
            | AttributeSourcesUnread,
            never,
        >;
        identifyWorktree: (
            ...args: [worktree: WorktreeCreated],
        ) => Effect<
            {
                bare: boolean;
                branch: Option<string>;
                detached: boolean;
                head: Option<string & Brand<"Revision">>;
                lock: Option<{ reason: Option<string> }>;
                path: string;
            },
            | WorktreeCheckFailed
            | WorktreeRecordInvalid
            | PathUnreadable
            | GitCommandFailed
            | GitOutputUndecodable
            | AttributeSourcesRefused
            | AttributeSourcesUnread,
            never,
        >;
    }
    Index
    createWorktree: (
        ...args: [request: WorktreeRequest],
    ) => Effect<
        WorktreeCreated,
        | WorktreeBranchExists
        | WorktreePathExists
        | WorktreePathNotAbsolute
        | WorktreeNotAsCreated
        | PathUnreadable
        | GitCommandFailed
        | GitOutputUndecodable
        | AttributeSourcesRefused
        | AttributeSourcesUnread,
        never,
    >

    Creates the supervisor worktree (design "Creation") and returns the fields of WorktreeCreated. Fails with WorktreePathNotAbsolute before any git command when the path is not absolute; with AttributeSourcesRefused when the base revision or the repository has an attribute source that option A refuses, or the config holds any conditional include (option R; plan B11c), and with AttributeSourcesUnread when a source could not be read and none that was read is refused, both checked in the owner's checkout before the branch and path prechecks; with WorktreeBranchExists or WorktreePathExists before running worktree add; with PathUnreadable when stat cannot inspect the path; with WorktreeNotAsCreated when the new worktree is not at the requested path on its branch; and with GitCommandFailed (args, exit code and stderr) when a git command fails. The path is refused only if it exists when the precheck runs: an empty directory that appears between the precheck and the add may be accepted by git, and no lock prevents that. A branch created in that window makes the add fail. Nothing is cleaned up on any failure.

    identifyWorktree: (
        ...args: [worktree: WorktreeCreated],
    ) => Effect<
        {
            bare: boolean;
            branch: Option<string>;
            detached: boolean;
            head: Option<string & Brand<"Revision">>;
            lock: Option<{ reason: Option<string> }>;
            path: string;
        },
        | WorktreeCheckFailed
        | WorktreeRecordInvalid
        | PathUnreadable
        | GitCommandFailed
        | GitOutputUndecodable
        | AttributeSourcesRefused
        | AttributeSourcesUnread,
        never,
    >

    The startup check: succeeds with the recorded worktree's entry when git worktree list --porcelain -z lists its path on refs/heads/<branch>, locked, and the directory there is present with the recorded git identity; otherwise fails with WorktreeCheckFailed naming each failed condition, and run stops and reports. When those hold, the attribute check runs inside the supervisor worktree, so its config.worktree applies, with git pinned to the recorded gitDir, path and commonDir (plan B11d), against the recorded base (plan B11c) and fails with AttributeSourcesRefused, including for any conditional include (option R), or with AttributeSourcesUnread when only a read failed; no working tree's .gitattributes is read. Fails with PathUnreadable when the recorded path cannot be inspected, with GitCommandFailed when git could not complete a command, an identity read included (any exit but its no-repository report), and with WorktreeRecordInvalid when a recorded field is empty. It never prunes, unlocks or removes anything.