Skip to content

detectForge

detectForge(repoDir, map): GitForge | null

Defined in: src/forge/index.ts:71

Resolve the forge for a repo directory.

Default: the forge targets the origin remote’s slug.

Fork mode: when an upstream remote exists whose slug differs from origin, and both resolve to GitHub, the forge targets the upstream slug (so issues, PRs, checks, backlog and the PR base all point at the original repo a contributor works against) while carrying the origin slug as forkSlug (the write target — pushes, the pr create --head qualifier, and the canPush probe). This is exactly the topology gh repo fork --clone produces.

The trigger leans on the git convention that a remote literally named upstream is the repo origin was forked from — the dominant (and gh’s own) meaning. A repo that keeps a differing-slug upstream for some OTHER purpose while actually working within origin will read upstream’s issues/PRs and target PRs there; that is intentional (we follow the convention rather than a network fork-check, which detectForge — sync and hot-path cached — must avoid). Rename the remote to opt out.

string

ForgeMap

GitForge | null