chore: add pre-commit hook for cargo fmt check
A tracked .githooks/pre-commit runs 'cargo fmt --check' on staged Rust changes so formatting violations are caught locally instead of in CI. Enable per clone with: git config core.hooksPath .githooks Co-Authored-By: SplitFire v1.0.0-acp <noreply@splitfire.ai>
Seto committed
Oct 9, 2026 at 13:23 UTC
cb1f490c67a46d2f07231967c4d3a26c4c578ec0
2 files changed
+22
.githooks/pre-commit
new
+15
@@ -0,0 +1,15 @@
1
+#!/bin/sh
2
+# SplitFire pre-commit hook: catch the things CI fails on, before you push.
3
+# Enable with: git config core.hooksPath .githooks
4
+
5
+set -e
6
+
7
+# Only check staged Rust files; skip if none are staged.
8
+if git diff --cached --name-only --diff-filter=ACM | grep -q '\.rs$'; then
9
+ echo "pre-commit: cargo fmt --check"
10
+ if ! cargo fmt -- --check; then
11
+ echo
12
+ echo "Formatting check failed. Run 'cargo fmt' and re-stage your changes." >&2
13
+ exit 1
14
+ fi
15
+fi
README.md
+7
@@ -139,6 +139,13 @@ cargo clippy --all-targets -- -D warnings
139
cargo test --locked
140
```
141
142
+These are exactly what CI runs. To catch the formatting check before you push, enable the
143
+tracked pre-commit hook once per clone:
144
+
145
+```sh
146
+git config core.hooksPath .githooks
147
+```
148
+
149
SplitFire is built on the Onde Agent Platform crates in the
150
[`onde-ed`](https://github.com/ondeinference/ed) workspace, checked out next to this repository:
151
`ed-acp` (the ACP server: sessions, auth, the turn loop, approval, workspace tools),