Skip to content

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

ci: guard against committed merge-conflict markers (#1505)

Rick van Hattemdb0356b0e7a1
diff --git a/.github/workflows/merge-conflicts.yml b/.github/workflows/merge-conflicts.yml
new file mode 100644
index 000000000..272d11eb6
--- /dev/null
+++ b/.github/workflows/merge-conflicts.yml
@@ -0,0 +1,30 @@
+name: Merge Conflicts
+
+# Reject unresolved Git merge-conflict markers committed into tracked files.
+#
+# This lives in its own workflow ON PURPOSE: ci.yml sets
+# `on.pull_request.paths-ignore: ['**/*.md', ...]`, so a Markdown/CHANGELOG-only
+# PR skips that workflow entirely. The conflict markers this guard exists to
+# catch landed in CHANGELOG.md, so the check must run with no `paths-ignore`.
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+
+permissions:
+ contents: read
+
+jobs:
+ merge-conflicts:
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ steps:
+ - uses: actions/checkout@v6
+ - name: Reject unresolved merge-conflict markers
+ run: |
+ if git grep -nI -E '^(<{7}|>{7}|\|{7})( |$)' -- .; then
+ echo "::error::Unresolved Git merge-conflict markers found in tracked files (see matches above)."
+ exit 1
+ fi
+ echo "No merge-conflict markers found."
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 533063f1e..b0f83e083 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -12,6 +12,14 @@ repos:
entry: bash -lc 'npx --yes --package=@commitlint/cli --package=@commitlint/config-conventional -- commitlint --edit "$1" --config .commitlintrc.json' --
language: system
stages: [commit-msg]
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v5.0.0
+ hooks:
+ - id: check-merge-conflict
+ # Catch markers even outside an in-progress merge (e.g. committing a
+ # botched conflict resolution from a rebase). CI re-checks this
+ # unconditionally, so installing hooks is not required for enforcement.
+ args: [--assume-in-merge]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.4
hooks: