Adds .githooks/pre-commit that runs oxfmt --write on staged JS/TS/JSON and re-stages them, and wires git config core.hooksPath .githooks into bootstrap so every fresh checkout and worktree activates it. Commits now land already-formatted, so the CI format job (oxfmt --check) stops failing on contributions that skipped running format manually. The hook only touches staged files, matching the existing rule to stage just your own files. It honours .oxfmtrc.json ignorePatterns and no-ops when oxfmt is not yet installed.
Showing the changes to scripts (1 of 2 files). Show all
Unified · Split
| @@ -31,4 +31,10 @@ if (!existsSync(resolve(repoRoot, "node_modules/.bin/vitest"))) { · 30 unmodified lines | |||
| 31 | throw new Error("bootstrap: vitest missing after install — bun install likely failed"); | 31 | throw new Error("bootstrap: vitest missing after install — bun install likely failed"); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | // Point git at the tracked .githooks dir so the pre-commit hook auto-formats | ||
| 35 | // staged code with oxfmt. hooksPath is local config, never cloned or copied | ||
| 36 | // into worktrees, so every fresh checkout and agent worktree must re-set it; | ||
| 37 | // without it, unformatted commits slip through and CI's `format` job fails. | ||
| 38 | run("git hooks", "git", ["config", "core.hooksPath", ".githooks"]); | ||
| 39 | |||
| 34 | console.log("\n[bootstrap] done — `cd e2e && bun run test` runs the full suite."); | 40 | console.log("\n[bootstrap] done — `cd e2e && bun run test` runs the full suite."); |