Compliance improvements with Git Hooks. #23
Unanswered
thorwolpert
asked this question in
RFCs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Select Release Product
General Architecture / Framework
Summary
Adopt Lefthook as the standard git hook manager across our monorepos to enforce automated pre-commit checks (such as secret scanning with Gitleaks, code linting, and type checking) uniformly across all local development environments.
Basic Example
Install dependencies at the root of the workspace and register the hooks automatically via prepare:
Motivation
As our codebase grows into multi-language monorepos (encompassing Nuxt/Vue/TypeScript frontends alongside Python and Golang services), maintaining local code quality and security standards has become fragmented:
By adopting Lefthook, we solve these constraints with a lightweight, fast, and language-agnostic runner that operates consistently across macOS, Linux, and Windows without forcing heavy tooling onto the team.
Detailed Design
Lefthook is a Go-based, compiled binary wrapper for Git hooks. It will be installed as a root devDependency via pnpm (or native binary where applicable) and initialized automatically when a developer runs pnpm install via the prepare lifecycle script.
Key Mechanics:
Requirements List
Must Have:
Should Have:
Could Have:
Won't Have:
Drawbacks
Bypass Risk: Developers can still technically bypass local hooks using git commit --no-verify. (This is a fundamental trait of Git hooks; secondary CI scans must remain in place as a safety net).
Dependency on Node Ecosystem for Bootstrap: While Lefthook itself is a Go binary, bootstrapping it via pnpm assumes a Node-capable environment at the root of the repository.
Alternatives
Husky + lint-staged:
Over-Engineered Monorepo Task Runners (e.g., Nx / Turborepo / Heavy CLI Task Managers):
Manual OS-Level Binaries (Homebrew / System gitleaks):
Adoption Strategy
lefthook.ymlandgitleaks-secret-scannerin a single monorepo (e.g., General Architecture / Framework or Developer Site)."prepare": "lefthook install"to rootpackage.json. Existing team members will automatically receive the hook setup on their nextpnpm installorgit pull.lefthook.ymlandgitleaks.tomlin repository templates so new services adopt the pattern out of the box.Unresolved Questions
All reactions