# Git hooks. Install once with: cd web && bun run lefthook # # These mirror the cheap half of CI so a formatting or lint slip is caught # before it costs a full pipeline round trip. Anything slow (tests, race, # builds) is left to CI. pre-commit: parallel: true jobs: - name: gofmt glob: "*.go" run: gofmt -s -w {staged_files} && git add {staged_files} - name: go vet glob: "api/**/*.go" run: cd api && go vet ./... # In a linked worktree git exports GIT_DIR to hooks; with cwd moved to # root:web/ and no GIT_WORK_TREE, `git add src/...` would treat web/ as # the work tree and stage phantom root-level src/ copies. Unset the # exported vars so git rediscovers the repo from the job's cwd. - name: web lint root: "web/" glob: "*.{ts,tsx}" run: bun run lint --fix {staged_files} && env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE git add {staged_files} - name: web format root: "web/" glob: "*.{ts,tsx,json,css,md}" run: bun run format {staged_files} && env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE git add {staged_files} commit-msg: jobs: - name: commitlint root: "web/" run: bunx commitlint --edit {1}