Repository navigation
Description
Description
An installer/init-workspace.sh preflight check that detects a repo whose default branch is not main (legacy master being the common case) and fails loudly with rename instructions before writing anything.
Problem Statement
The scaffolded branch-name enforcer (no-commit-to-branch regex in .pre-commit-config.yaml) permits only main, dev, and convention-named branches. On a legacy master repo the scaffold succeeds silently — and then every subsequent commit is blocked by a confusing hook error, because master matches none of the allowed patterns. ci.yml's TRUNK retarget sed and the workflow triggers likewise assume main. The failure is invisible at scaffold time and lands at the worst moment (first commit after adoption).
Proposed Solution
- Preflight in
init-workspace.sh(and mirrored ininstall.sh): resolve the default branch (git symbolic-ref refs/remotes/origin/HEAD/gh api ... --jq .default_branch, with a local-only fallback); if it is notmain(ordev+mainfor gitflow), abort with explicit guidance:git branch -m master main && git push -u origin maingh repo edit --default-branch main
- A short
docs/MIGRATION.mdsection for legacy-masterconsumers. --previewshould surface the same finding without aborting.
Acceptance criteria
- Scaffold on a
master-default repo aborts pre-copy with actionable instructions - Conforming repos see no behavior change
- bats coverage for the abort path
Alternatives Considered
- Full
{{TRUNK_BRANCH}}tokenization of the regex, theci.ymlsed, and workflow triggers, so any trunk name works. Deliberately out of scope here — renaming tomainis a two-command fix for consumers, and tokenizing every branch reference is a much larger, riskier change. Noted as a possible follow-up if a consumer genuinely cannot rename.
Additional Context
Surfaced while dry-running devkit adoption on a legacy repo still on master. Related: #1205 (workflow-model knob — same "consumer repo shape" preflight territory).
Impact
- Prevents a silent-lockout footgun for every legacy adopter.
- No change for conforming repos;
semver:patch.
Activity
test(init): cover preflight abort on non-main default branches
feat(init): preflight abort on non-main default branches
fix(workspace): guard undotted typos.toml against dual configs (#1289)
feat(workspace): manifest-driven scaffold feature opt-outs (DEVKIT_FE…
test(init): cover preflight abort on non-main default branches
feat(init): preflight abort on non-main default branches
test(init): give the install-script dry-run fixture a main branch
fix(workspace): treat pytest no-tests-collected exit as a green no-op (…
feat(init): preflight abort on non-main default branches (#1291)
feat(workspace): scaffold-time Refs policy knob (DEVKIT_REFS_POLICY) (#…
docs(workspace): add solo/private-repo adoption profile (#1294)
c-vigo commentedon Jul 29, 2026
Merged to dev via #1291 (dev-targeted PRs do not auto-close). Ships with the next release.
chore: release 1.5.0 (#308)
chore: release 1.5.1 (#330)
chore: release 1.5.1 (#1311)
fix(workspace): survive a mid-scaffold abort without wiping .vig-os (#…