lefthook.yml 1.9 KB

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