chore: add repo-managed pre-commit and pre-push hooks
Summary
This MR adds repo-managed Git hooks for local quality enforcement.
What Changed
- Added committed hook entrypoints in
.githooks/ - Added automatic hook installation through
npm run prepare - Added staged-file validation for
pre-commit - Added full validation for
pre-push - Extended ESLint coverage to helper scripts
- Excluded
.githooks/from repo-wide Prettier checks - Updated
CONTRIBUTING.mdandCHANGELOG.md
Hook Behavior
pre-commit
- Runs staged-file Prettier formatting
- Runs ESLint autofix on staged JS/TS files
- Re-stages hook-modified files
- Aborts on partially staged files to avoid pulling unstaged edits into the commit
pre-push
- Runs
npm run validate - Includes format check, lint, type-check, and tests
Validation
npm ci.githooks/pre-commit.githooks/pre-push
Result
-
npm run format:checkpassed -
npm run lintpassed -
npm run typecheckpassed -
npm testpassed - 32/32 tests passed