CopilotKit pre-commit hook reference. Load automatically when the user mentions git hooks failing, pre-commit errors, lefthook issues, commit blocked, or "hooks don't work", or when user wants to commit/push anything Contains the full hook topology so debugging skips discovery and goes straight to diagnosis.
The repo uses lefthook (not husky). The git hook at .git/hooks/pre-commit calls lefthook, which reads lefthook.yml at the repo root.
Config file: lefthook.yml
sync-lockfile lint-fix test-and-check-packages
sync-lockfile**/package.json files are stagedpnpm i --lockfile-onlystage_fixed: true: auto-stages the updated lockfilelint-fixpnpm run lint --fix && pnpm run formatnx run-many -t lint --projects=packages/** then prettier --write "**/*.{ts,tsx,md}"stage_fixed: true: auto-stages any files it fixes--fix can't auto-correcttest-and-check-packages ← most common failurepnpm run test && pnpm run check:packagesnx run-many -t test — runs all unit tests across all packagesnx run-many -t publint,attw --projects=packages/** — checks package exports and types are correctly declaredstage_fixed: false — does NOT auto-stage anythingNX_TUI: "false" (plain output, no interactive UI)publint finds malformed package.json exportsattw (Are the Types Wrong?) finds type declaration issuesThe summary shows a boxing glove 🥊 for the failing command. The error itself does not show directly. To see the actual error:
# Run only the failing command manually:
pnpm run test # if test-and-check-packages failed
pnpm run check:packages # isolate publint/attw from test failures
nx run-many -t test --projects=<pkg> # narrow to a specific package
# Re-run lefthook manually (without committing):
pnpm lefthook run pre-commit
| Script | Expands to |
|---|---|
pnpm run lint | nx run-many -t lint --projects=packages/** |
pnpm run format | prettier --write "**/*.{ts,tsx,md}" |
pnpm run test | nx run-many -t test |
pnpm run check:packages | nx run-many -t publint,attw --projects=packages/** |