export interface WorktreeCreation { /** Absolute path of the new worktree. */ path: string; /** Local branch checked out in the worktree. */ branch: string; /** Ref the branch was created from (e.g. `origin/master`); equals `branch` * when an existing local branch was checked out instead. */ baseRef: string; } export interface CreateRepoWorktreeOptions { /** Explicit branch to check out/create. Takes precedence over `slug`. */ branch?: string; /** Semantic auto-name seed; creates `wt/` and dir `-wt-`. */ slug?: string; /** Explicit target directory. Used by multi-repo worktree groups. */ worktreePath?: string; } /** Cheap, network-free check that `dir` is inside a git work tree. Used to * decide BEFORE posting a "creating worktree…" notice whether creation can even * be attempted — a non-git default dir fails instantly and silently rather than * spamming a creating→failed message pair on every new session. */ export declare function isGitWorkTree(dir: string): Promise; /** Branch names may contain `/` etc. — flatten to a filesystem-safe suffix. */ export declare function dirSuffixForBranch(branch: string): string; /** * Build a git/filesystem-safe semantic slug from a session title or the first * prompt. Keep it ASCII so branch and directory names are portable. When the * source text has no latin/digit tokens (for example, all-CJK text), return * `undefined` so the caller falls back to the sequential `wt/N` naming rather * than an opaque hash. */ export declare function slugFromWorktreeText(text: string | undefined | null): string | undefined; /** * Create a linked worktree for `repoPath`, as a sibling of the repo's MAIN * checkout (a linked-worktree input is resolved back to the main one first). * * - No `branch` given, `slug` yields a latin slug → auto-pick `wt/` * (or `-2` etc.), dir `-wt-`. * - No `branch`/`slug` (or a `slug` with no latin/digit tokens, e.g. all-CJK) * → auto-pick `wt/N` (first free N), dir `-wt-N`. * - `branch` given and exists locally → check it out into the worktree. * - `branch` given and exists remotely → create a local tracking branch from it. * - `branch` given and new → create it from the remote default branch. * * The base ref is fetched first so the worktree starts from the remote's * latest state; fetch failure degrades to the local (possibly stale) ref. */ export declare function createRepoWorktree(repoPath: string, opts?: CreateRepoWorktreeOptions): Promise; /** * Push a freshly created worktree branch to origin (`push -u`). Used by the * riff flow: the remote sandbox clones from origin, so a local-only worktree * branch is invisible to it — pushing the branch pointer (no new objects, * seconds) lets the riff task pin the new branch. Throws on failure; callers * degrade to the default-branch fallback with a warning. */ export declare function pushWorktreeBranch(worktreePath: string, branch: string): Promise; /** Remove a worktree created by {@link createRepoWorktree}. Used to roll back the * worktrees already built when a later repo in a multi-repo batch fails — leaves * the branch in place (it may be a pre-existing branch we only checked out, and a * dangling auto-named branch is harmless) and only detaches/deletes the worktree * dir so a retry doesn't trip over "worktree target already exists". */ export declare function removeRepoWorktree(repo: string, worktreePath: string): Promise; //# sourceMappingURL=git-worktree.d.ts.map