Branching and Merge Rules
Overview
Use this file when creating branches, opening pull requests, or deciding how dev and main should move.
Branch Roles
devis the integration branch for active development.mainis the stable release branch.- Feature, fix, refactor, test, and docs work must start from
dev. - Ordinary development work should not open pull requests directly into
main.
Development Flow
- Sync local
devfromorigin/dev. - Create a topic branch from
dev. - Use a project-scoped branch name such as
feat/...,fix/...,refactor/...,docs/...,test/...,chore/..., orsync/.... - Implement and validate the change on the topic branch.
- Open a pull request back into
dev. - Confirm the
Dev Version Linecheck passes; it verifies the PR result uses the same<manual>.<main>version line asorigin/main. - Merge into
devonly after the expected checks and review pass.
Promoting Dev to Main
When dev is stable, promote it through a pull request into main.
Default flow:
- Sync
origin/devandorigin/main. - Open a pull request from
devintomain. - Confirm GitHub reports the pull request as mergeable.
- Run or wait for the required checks.
- Merge the pull request into
main.
Use this direct dev -> main pull request whenever it is clean and mergeable.
Conflict Flow
Use a temporary sync branch only when dev -> main cannot be merged cleanly or needs manual conflict resolution.
- Sync
origin/mainandorigin/dev. - Create a sync branch from
origin/main, for examplesync/dev-to-main. - Merge
origin/devinto the sync branch. - Resolve conflicts intentionally.
- Run required validation.
- Open a pull request from the sync branch into
main.
This is an exception path for conflicts, not the default release path.
After Main Changes
If main receives changes that are not already in dev, bring them back to dev.
Common examples:
- version bumps
CHANGELOG.mdupdates- release workflow outputs
- stable-branch hotfixes
- conflict-resolution fixes made during a
dev -> mainpromotion
Use a small sync branch from dev and open a pull request back into dev when needed.
If a pull request into dev fails the Dev Version Line check, sync the main release version metadata back into dev before merging new feature work.
Conflict Resolution Policy
- Preserve
mainrelease metadata when promoting tomain, including version bumps,CHANGELOG.md, and release workflow outputs. - Preserve ESM/CJS package-entry fixes unless the replacement is a verified superset.
- Preserve
devfeature implementation when promoting stable work, including CLI, framework, route, and test improvements. - Do not downgrade
package.jsonorpackage-lock.jsonversions during promotion. - Do not commit regenerated
docs/public/version.jsonunless the task is explicitly a version or release update. - For package-entry changes, verify both ESM import and CJS require behavior with package-entry tests.
Hotfixes
Emergency fixes may branch from main only when the user explicitly asks for a stable-branch hotfix. After merging a hotfix into main, backport or merge it into dev so future development does not lose the fix.
Validation
Before opening a release or sync pull request, run:
npm run buildnpm run testnpm run lintnpm run docs:buildwhen docs changed