fix(init): suggest stack base using same resolution as runtime - #74
Merged
Conversation
run_setup now calls resolve_base(None, forge_type) after platform selection so pgit init offers gh default branch for GitHub and matches open_resolved heuristics. Improve prompts when auto-detect fails. Made-with: Cursor
hokwangchoi
approved these changes
May 1, 2026
simtel12
deleted the
pgit/gregorios-leach/fix-init---suggest-stack-base-using-same-resolutio
branch
May 1, 2026 19:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stack base resolution now has an optional forge-CLI step when
[repo].baseis unset. GitHub usesgh repo view(defaultBranchRef) and picks a ref that exists locally (origin/<branch>first, then the bare branch name). Order of precedence is unchanged: explicitrepo.base→ forge CLI hint (where implemented) → existing git heuristics (origin/main,origin/master,main,master).open_resolved()passes the configured forge type intoresolve_base, andpgit init/ setup calls the sameresolve_base(None, forge_kind)after the user picks a platform, so the suggested default branch matches what runtime stack operations use. Prompts were tightened when auto-detection fails (e.g. suggestgit fetch origin).Test plan
cargo fmt --check && cargo clippy -- -D warnings && cargo testgh: In a repo with norepo.base, run interactive setup, choose GitHub — suggested base should match the GitHub default branch whenorigin/<default>or the default branch exists locally.maindefault: Repo whose GitHub default is e.g.develop— suggestion should preferorigin/develop(or localdevelop) when present.ghmissing, failing, or no matching local ref — wizard should show the improved failure message and still allow typingrepo.basemanually; runtime should fall through to git heuristics or clear errors per existing behavior.repo.baseset in.pilegit.toml, that value still wins (unchanged).