Skip to content

forkRepo

forkRepo(input, repoRoot, ghRunner?): Promise<{ entry: RepoEntry; ok: true; } | { error: string; ok: false; }>

Defined in: src/repos.ts:668

Fork a GitHub repo under the authenticated user’s account and clone it into <repoRoot>/<input.name>. Uses gh repo fork <repo> --clone, which sets origin = the fork and upstream = the original (default remote), so PRs from the worktrees target upstream automatically. Idempotent: an existing fork is synced and still cloned.

Returns { ok: true, entry } on success, or { ok: false, error } with a forkrepo_failed_* code. Forking always requires gh auth, so a not-logged-in state is reported as forkrepo_failed_auth (not a generic failure).

string

string

string

GhRunner

Injectable async runner for gh CLI calls (default: 120s timeout).

Promise<{ entry: RepoEntry; ok: true; } | { error: string; ok: false; }>