title: pre-pr: env var override for default-branch fallback chain
created: 2026-05-14
Plugin: apps/claude-code/pr-review
Depends on: orchestrator-split PR merged
Problem Statement
detect-default-branch.mjs uses a Gitflow-aware fallback chain (remote-show → develop → main → master → none) when the remote is unreachable. Repos that intentionally use main as their integration branch but have a stale origin/develop ref will silently diff against develop with no escape hatch — the user has no way to override the choice.
Solution
Add an environment variable override (e.g. PR_REVIEW_DEFAULT_BRANCH) that, when set, short-circuits the fallback chain and uses the specified branch directly. A Notice should still be emitted if the override bypasses a remote-show that would have returned a different result.
Acceptance criteria
PR_REVIEW_DEFAULT_BRANCH=main forces the pre-PR diff to use main regardless of what remote-show or the fallback chain would have returned
- When the env var is set, the fallback chain is not consulted
- An info-level Notice is emitted when the env var is used, so the invoker knows the override is active
- Existing behavior (no env var set) is unchanged
- Unit tests cover the override path
PRD: docs/issues/pr-review-pre-pr-default-branch-override/PRD.md
Migrated from: docs/issues/pr-review-pre-pr-default-branch-override/01-env-var-override.md (source removed after migration)
Touched by PRs: #31
title: pre-pr: env var override for default-branch fallback chain
created: 2026-05-14
Plugin:
apps/claude-code/pr-reviewDepends on: orchestrator-split PR merged
Problem Statement
detect-default-branch.mjsuses a Gitflow-aware fallback chain (remote-show → develop → main → master → none) when the remote is unreachable. Repos that intentionally usemainas their integration branch but have a staleorigin/developref will silently diff againstdevelopwith no escape hatch — the user has no way to override the choice.Solution
Add an environment variable override (e.g.
PR_REVIEW_DEFAULT_BRANCH) that, when set, short-circuits the fallback chain and uses the specified branch directly. A Notice should still be emitted if the override bypasses aremote-showthat would have returned a different result.Acceptance criteria
PR_REVIEW_DEFAULT_BRANCH=mainforces the pre-PR diff to usemainregardless of whatremote-showor the fallback chain would have returnedPRD:
docs/issues/pr-review-pre-pr-default-branch-override/PRD.mdMigrated from:
docs/issues/pr-review-pre-pr-default-branch-override/01-env-var-override.md(source removed after migration)Touched by PRs: #31