2026-07-23 14:02:58 +08:00
|
|
|
# Git hooks (lefthook). Keep these local checkpoints fast; CI owns the full
|
|
|
|
|
# repository-wide gate matrix.
|
2026-07-27 20:02:29 +08:00
|
|
|
# Install: `node scripts/install-lefthook.mjs` (runs automatically via postinstall).
|
2026-06-11 15:07:55 +08:00
|
|
|
|
|
|
|
|
pre-commit:
|
|
|
|
|
jobs:
|
2026-07-29 22:38:20 +08:00
|
|
|
- name: format (staged)
|
|
|
|
|
glob: '*.{ts,tsx,mts,cts,mjs}'
|
|
|
|
|
exclude:
|
|
|
|
|
- 'vendor/*/src/**'
|
|
|
|
|
run: node_modules/.bin/eslint --config eslint.format.config.mjs --fix --no-warn-ignored {staged_files}
|
|
|
|
|
stage_fixed: true
|
|
|
|
|
|
2026-06-11 15:07:55 +08:00
|
|
|
- name: lint (staged)
|
2026-07-27 21:36:15 +08:00
|
|
|
glob: '*.{ts,tsx,mts,cts,mjs}'
|
2026-06-11 15:07:55 +08:00
|
|
|
exclude:
|
|
|
|
|
- 'vendor/*/src/**'
|
2026-07-29 23:39:49 +08:00
|
|
|
run: node_modules/.bin/tsx scripts/run-oxlint.ts --fix --no-error-on-unmatched-pattern {staged_files}
|
2026-06-11 15:07:55 +08:00
|
|
|
stage_fixed: true
|
|
|
|
|
|
2026-07-30 07:56:13 -07:00
|
|
|
# Regenerate rather than reject: a dependency edit that forgot the notices
|
2026-07-30 09:23:00 -07:00
|
|
|
# would otherwise fail the test lane long after the commit. The glob matches
|
|
|
|
|
# every input the generator reads, including the generator itself and the
|
|
|
|
|
# build-time pin source. Deleting a manifest cannot trigger this job —
|
|
|
|
|
# lefthook only inspects files present on disk — so that one case still
|
|
|
|
|
# falls through to the freshness assertion in the test lane.
|
2026-07-30 07:56:13 -07:00
|
|
|
- name: third-party notices (staged)
|
2026-07-30 10:28:16 -07:00
|
|
|
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}'
|
2026-07-30 07:56:13 -07:00
|
|
|
run: node_modules/.bin/tsx scripts/gen-third-party-notices.ts && git add THIRD_PARTY_NOTICES.md
|
|
|
|
|
|
2026-07-22 16:37:20 +08:00
|
|
|
- name: whitespace (staged)
|
|
|
|
|
run: git diff --cached --check
|
2026-06-11 15:07:55 +08:00
|
|
|
|
|
|
|
|
- name: vendor manifest guard
|
|
|
|
|
run: scripts/check-vendor-manifest.sh
|
|
|
|
|
|
|
|
|
|
pre-push:
|
|
|
|
|
jobs:
|
2026-07-23 14:02:58 +08:00
|
|
|
- name: typecheck
|
|
|
|
|
run: node_modules/.bin/tsc -b --pretty false
|