When origin/HEAD is unavailable (no remote, ref unset), fall back to
gh repo view to query the GitHub default branch before hard-coding
main. Covers repos using develop/trunk as their default.
Addresses PR review feedback (#386)
Piping into sed returns exit 0 even when the upstream git command
fails, so the "fall back to main" path never triggers. The agent
reads stdout/stderr directly and can strip the origin/ prefix and
detect failures itself.
Addresses PR review feedback (#386)
- Add rev-parse command to Step 1 so the branch guard in Step 4 can
check the actual default branch, not just hard-coded main
- Update Step 4 to reference the resolved default branch
- Inline sed pipe in Step 6 symbolic-ref fallback instead of prose
instruction to strip the origin/ prefix