resolve-conflicts.md
860 tokens · o200k_base · 3,195 bytes
Resolve Merge Conflicts
Resolve all merge conflicts from a git merge origin/main into next. The working tree has conflict markers in all affected files. Your job is to resolve every conflict so that pnpm install and pnpm build can succeed.
SCOPE: Do not spawn tasks/sub-agents.
Prerequisites
branch— The branch name (e.g.,ci/merge-main-to-next).hasConflicts— Whether the merge had conflicts.- The working directory is the repo root, checked out on the merge branch.
git merge origin/mainhas been run but NOT committed — conflict markers are present in the working tree.- Dependencies are NOT installed yet. Do not run
pnpm install— the orchestrator will do that after you finish.
Steps
Step 1: Find all conflicted files
# List all files with conflict markers
grep -rl "<<<<<<< " . --include="*.ts" --include="*.js" --include="*.mjs" --include="*.cjs" --include="*.md" --include="*.astro" --include="*.json" --include="*.yaml" --include="*.yml" | grep -v node_modules | sort
Step 2: Resolve conflicts by file type
For each conflicted file, resolve using these rules:
package.json files
versionfields — Always keepnext's pre-release version (e.g.,5.0.0-beta.1). NEVER usemain's stable version.- Dependencies — Keep
next's versions for shared deps. Ifmainadded a NEW dependency that doesn't exist onnext, include it. Ifmainswapped a dependency for a different one (e.g.,get-tsconfig→tsconfck), keep whichever the source code onnextactually imports. - Scripts — Merge both sides: keep
next's scripts and add any new scripts frommain. - Other fields — Prefer
nextunlessmainhas an obvious bug fix.
pnpm-lock.yaml
- Do NOT try to manually resolve the lockfile. Just delete it — the orchestrator will regenerate it via
pnpm install --no-frozen-lockfileafter you're done.
git checkout --theirs pnpm-lock.yaml 2>/dev/null || true
Source code (.ts, .js, .mjs, .cjs, .astro)
- Bug fixes from
main— Ifmainfixed a bug, that fix should carry over tonext. Adapt the fix tonext's API if needed. - API changes on
next— Ifnextchanged an API, keep thenextversion and adapt themaincode if needed. - When in doubt, prefer
next— it's the forward-looking branch.
Markdown and config files
- Changesets (
.changeset/*.md) — will be handled by the clean-changesets skill. For now just accept both sides. - Other
.mdfiles — prefernext.
Step 3: Stage resolved files
After resolving each file, stage it:
git add <resolved-file>
Step 4: Verify no conflict markers remain
grep -r "<<<<<<< \|=======$\|>>>>>>> " . --include="*.ts" --include="*.js" --include="*.mjs" --include="*.cjs" --include="*.md" --include="*.astro" --include="*.json" --include="*.yaml" --include="*.yml" | grep -v node_modules
If any remain, resolve them.
Step 5: Do NOT commit or install
The orchestrator handles committing, installing, and building.
Output
Return the list of files where conflicts were resolved.