Skip to content

Git Hooks With Lefthook

Lefthook orchestrates the repository Git hooks so local checks stay fast and consistent across contributors.

  • pre-commit: runs npx ultracite fix {staged_files} and re-stages modified files
  • commit-msg: runs pnpm exec commitlint --edit {1}
  • pre-push: runs pnpm pre-push, which invokes the pre-push validation script from @repo/scripts
  • prepare: runs lefthook install to refresh the delegated hook shims committed under .githooks/

This repository uses core.hooksPath=.githooks, so contributors execute the checked-in .githooks/* entrypoints and those shims delegate into Lefthook. lefthook install updates that delegated hook layer instead of writing a separate set of hooks under .git/hooks.

  • Change detection for workspaces based on recent diffs
  • Runs repo-wide pnpm lint and pnpm format:check
  • Runs package-scoped typecheck, build, knip, and coverage tests for changed workspaces
  • Blocks the push on failures, prints actionable output
  • Enforces Conventional Commits; supports scopes for apps/packages and multi-line messages
  • Examples:
    • feat(server): add rate limiter
    • fix(ui): correct button focus state
    • chore: update dependencies