Skip to content

fix(init): suggest stack base using same resolution as runtime - #74

Merged
hokwangchoi merged 1 commit into
hokwangchoi:masterfrom
simtel12:pgit/gregorios-leach/fix-init---suggest-stack-base-using-same-resolutio
May 1, 2026
Merged

fix(init): suggest stack base using same resolution as runtime#74
hokwangchoi merged 1 commit into
hokwangchoi:masterfrom
simtel12:pgit/gregorios-leach/fix-init---suggest-stack-base-using-same-resolutio

Conversation

@simtel12

@simtel12 simtel12 commented May 1, 2026

Copy link
Copy Markdown

Summary

Stack base resolution now has an optional forge-CLI step when [repo].base is unset. GitHub uses gh repo view (defaultBranchRef) and picks a ref that exists locally (origin/<branch> first, then the bare branch name). Order of precedence is unchanged: explicit repo.base → forge CLI hint (where implemented) → existing git heuristics (origin/main, origin/master, main, master).

open_resolved() passes the configured forge type into resolve_base, and pgit init / setup calls the same resolve_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. suggest git fetch origin).

Test plan

  • cargo fmt --check && cargo clippy -- -D warnings && cargo test
  • GitHub + gh: In a repo with no repo.base, run interactive setup, choose GitHub — suggested base should match the GitHub default branch when origin/<default> or the default branch exists locally.
  • Non-main default: Repo whose GitHub default is e.g. develop — suggestion should prefer origin/develop (or local develop) when present.
  • Fallback: With gh missing, failing, or no matching local ref — wizard should show the improved failure message and still allow typing repo.base manually; runtime should fall through to git heuristics or clear errors per existing behavior.
  • Explicit config: With repo.base set in .pilegit.toml, that value still wins (unchanged).

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
hokwangchoi merged commit 9606a10 into hokwangchoi:master May 1, 2026
1 check passed
@simtel12
simtel12 deleted the pgit/gregorios-leach/fix-init---suggest-stack-base-using-same-resolutio branch May 1, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants