chore(config): enforce zdiff3 conflict style via postinstall

Add a new setup script to configure `merge.conflictStyle=zdiff3` locally
within the repository. This ensures that the common ancestor is visible
during merge conflicts, which is required for structural resolution by
`mergiraf` and simplifies manual conflict resolution.

The configuration is applied during `bun install` via the `postinstall`
hook and remains as a fallback for the upstream merge utilities.
This commit is contained in:
kiloconnect[bot]
2026-05-05 14:49:50 +00:00
parent 6cff7212b3
commit c239a6bb22
4 changed files with 31 additions and 6 deletions
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bun
/**
* Configures repo-local git settings for all contributors.
*
* `merge.conflictStyle=zdiff3` makes conflict markers include the common
* ancestor (|||||||) alongside ours/theirs. That base section is what
* mergiraf's syntax-aware resolution feeds on during upstream opencode
* merges (see script/upstream/merge.ts) and it makes manual resolution
* dramatically easier than the default 2-way `merge` markers.
*
* Runs from `postinstall`. Safe to re-run — `git config` is idempotent.
* Guarded so tarball / docker installs without a `.git` don't fail.
*/
import { $ } from "bun"
const inside = await $`git rev-parse --is-inside-work-tree`.nothrow().quiet()
if (inside.exitCode !== 0) process.exit(0)
await $`git config --local merge.conflictStyle zdiff3`.quiet()