1
0

lefthook.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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: archived agent notes
  12. glob: '.agents/notes/archived/**'
  13. run: node_modules/.bin/tsx scripts/verify-archived-agent-notes.ts
  14. - name: lint (staged)
  15. glob: '*.{ts,tsx,mts,cts,mjs}'
  16. exclude:
  17. - 'vendor/*/src/**'
  18. run: node_modules/.bin/tsx scripts/run-oxlint.ts --config .oxlintrc.staged.json --fix --no-error-on-unmatched-pattern {staged_files}
  19. stage_fixed: true
  20. # Regenerate rather than reject: a dependency edit that forgot the notices
  21. # would otherwise fail the test lane long after the commit. The glob matches
  22. # every input the generator reads, including the generator itself and the
  23. # build-time pin source. Deleting a manifest cannot trigger this job —
  24. # lefthook only inspects files present on disk — so that one case still
  25. # falls through to the freshness assertion in the test lane.
  26. - name: third-party notices (staged)
  27. 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}'
  28. run: node_modules/.bin/tsx scripts/gen-third-party-notices.ts && git add THIRD_PARTY_NOTICES.md
  29. - name: whitespace (staged)
  30. run: git diff --cached --check
  31. - name: vendor manifest guard
  32. run: scripts/check-vendor-manifest.sh
  33. pre-merge-commit:
  34. jobs:
  35. - name: translation pairing (staged records)
  36. glob: '*.i18n.yaml'
  37. exclude:
  38. - '.agents/notes/archived/**'
  39. run: node_modules/.bin/tsx scripts/verify-translation-pairing.ts --cached {staged_files}
  40. - name: archived agent notes
  41. glob: '.agents/notes/archived/**'
  42. run: node_modules/.bin/tsx scripts/verify-archived-agent-notes.ts
  43. pre-push:
  44. jobs:
  45. - name: typecheck
  46. run: pnpm run typecheck