Enforce protected-branch guardrails for safe PR lifecycle, conflict resolution, and merge safety. Use when working on feature branches against protected main: before merging feature PRs, resolving merge conflicts, syncing with main, or managing work-item updates on protected branches.
Protect merge integrity and prevent accidental deletions or regressions when working with protected main branches.
Before opening or updating a PR:
git statusgit fetch origin maingh pr view <pr-number> --json mergeableCONFLICTING, run merge conflict resolution (step 3).Fail if: PR is marked UNMERGEABLE or branch protection rules are violated. Do not bypass with or flags.
--admin--forceWhen main diverges and PR shows conflicts:
git merge origin/main --no-editgit add <resolved-file>git commit -m "chore: merge main into <branch-name>"git diff origin/main...HEAD --name-status | grep '^D' — if deletions appear, restore from known-good commitgit pushFail if: Merge introduces unintended file deletions. Restore and add regression tests.
When merging providers (diagnostic, intellisense, etc.):
src/packages/volar/src/index.ts (or equivalent) for duplicate exports: rg "export \* from" <file>TemplateDelimiters), rename one to disambiguate (e.g., IntellisenseDelimiters)pnpm run type:check — must pass with no errorspnpm test:affected:ci — must passFail if: Type conflicts remain after rename or tests fail.
After merge, verify no unexpected deletions or mutations:
git diff origin/main...HEAD --name-statusD (deleted) files — should only be intentional deletionsM (modified) files — should only touch intended source filesgit restore <backlog-file>Fail if: Unintended deletions or cross-branch contamination detected.
When updating work items or documentation on protected main:
docs(backlog): mark WI-XXX ready-for-review)pnpm run lint:frontmatterFail if: Attempting to bypass protection rules. Request an exception through branch-admin interface if truly necessary.
Merge conflicts not resolved?
git status --porcelainType conflicts after merge?
rg "export.*<typename>" <file>Unintended deletions detected?
git diff origin/main...HEAD --name-status | grep '^D'git show origin/main:<file> > <file>git add <file> && git commit -m "chore: restore deleted file"