diff --git a/lefthook.yml b/lefthook.yml index 438c957..bd60d3a 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -1,9 +1,8 @@ -# Canonical lefthook config for hawk-eco Go repos. -# Source of truth: .shared-templates/lefthook.yml.tmpl +# lefthook config for hawk-sdk-typescript (TypeScript / npm). +# Source of truth for Go repos: .shared-templates/lefthook.yml.tmpl # # Install lefthook: # brew install lefthook (macOS) -# go install github.com/evilmartians/lefthook@latest # npm install -g lefthook (cross-platform) # # Activate hooks in this repo (one time): @@ -19,34 +18,6 @@ pre-commit: parallel: true commands: - fmt: - glob: "*.go" - run: | - if ! command -v gofumpt >/dev/null 2>&1; then - echo "lefthook: gofumpt not installed (go install mvdan.cc/gofumpt@latest)"; exit 1 - fi - gofumpt -w {staged_files} - stage_fixed: true - - imports: - glob: "*.go" - run: | - if ! command -v goimports >/dev/null 2>&1; then - echo "lefthook: goimports not installed (go install golang.org/x/tools/cmd/goimports@latest)"; exit 1 - fi - goimports -w {staged_files} - stage_fixed: true - - lint: - glob: "*.go" - run: | - if ! command -v golangci-lint >/dev/null 2>&1; then - echo "lefthook: golangci-lint not installed — skipping (install: https://golangci-lint.run/usage/install/)" - exit 0 - fi - golangci-lint run --new-from-rev=HEAD~1 --fix {staged_files} - stage_fixed: true - yaml-lint: glob: "*.{yml,yaml}" run: | @@ -69,32 +40,11 @@ pre-commit: exit 1 fi -# --------------------------------------------------------------------------- -# pre-push — heavier checks, runs only on push (not every commit). -# --------------------------------------------------------------------------- -pre-push: - commands: - - test: - run: go test ./... -count=1 -timeout=60s - - vet: - run: go vet ./... - - govulncheck: - run: | - if ! command -v govulncheck >/dev/null 2>&1; then - echo "lefthook: govulncheck not installed — skipping" - exit 0 - fi - govulncheck ./... - # --------------------------------------------------------------------------- # commit-msg — validate Conventional Commits and strip AI co-author trailers. # --------------------------------------------------------------------------- commit-msg: commands: - conventional-commit: run: | msg=$(head -n1 "{1}")