lefthook.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Git hooks (lefthook). Keep these local checkpoints fast; CI owns the full
  2. # repository-wide gate matrix.
  3. # Install: `node scripts/install-lefthook.mjs` (runs automatically via postinstall).
  4. pre-commit:
  5. jobs:
  6. - name: translation pairing (staged records)
  7. glob: '*.i18n.yaml'
  8. exclude:
  9. - '.agents/notes/archived/**'
  10. run: node_modules/.bin/tsx scripts/verify-translation-pairing.ts --cached {staged_files}
  11. - name: lint (staged)
  12. glob: '*.{ts,tsx,mts,cts,mjs}'
  13. exclude:
  14. - 'vendor/*/src/**'
  15. run: node_modules/.bin/tsx scripts/run-oxlint.ts --config .oxlintrc.staged.json --fix --no-error-on-unmatched-pattern {staged_files}
  16. stage_fixed: true
  17. # Regenerate rather than reject: a dependency edit that forgot the notices
  18. # would otherwise fail the test lane long after the commit. The glob matches
  19. # every input the generator reads, including the generator itself and the
  20. # build-time pin source. Deleting a manifest cannot trigger this job —
  21. # lefthook only inspects files present on disk — so that one case still
  22. # falls through to the freshness assertion in the test lane.
  23. - name: third-party notices (staged)
  24. glob: '{package.json,*/package.json,*/*/package.json,*/*/*/package.json,*/*/*/*/package.json,pnpm-workspace.yaml,*/*/pnpm-workspace.yaml,pnpm-lock.yaml,vendor/README.md,python/*/pyproject.toml,scripts/gen-third-party-notices.ts,scripts/build-exe-for-python-sdk.ts}'
  25. run: node_modules/.bin/tsx scripts/gen-third-party-notices.ts && git add THIRD_PARTY_NOTICES.md
  26. - name: whitespace (staged)
  27. run: git diff --cached --check
  28. - name: vendor manifest guard
  29. run: scripts/check-vendor-manifest.sh
  30. pre-merge-commit:
  31. jobs:
  32. - name: translation pairing (staged records)
  33. glob: '*.i18n.yaml'
  34. exclude:
  35. - '.agents/notes/archived/**'
  36. run: node_modules/.bin/tsx scripts/verify-translation-pairing.ts --cached {staged_files}
  37. pre-push:
  38. jobs:
  39. - name: typecheck
  40. run: pnpm run typecheck