Implement the 006-pre-commit-gate feature that enforces a pre-commit quality gate using Lefthook to run pnpm check before every commit
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
34
specs/006-pre-commit-gate/quickstart.md
Normal file
34
specs/006-pre-commit-gate/quickstart.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# Quickstart: Pre-Commit Gate
|
||||
|
||||
## What This Feature Does
|
||||
|
||||
Adds a Git pre-commit hook (managed by Lefthook) that runs `pnpm check` before every commit. If any check fails, the commit is blocked.
|
||||
|
||||
## Files to Create/Modify
|
||||
|
||||
| File | Action | Purpose |
|
||||
|------|--------|---------|
|
||||
| `lefthook.yml` | Create | Lefthook configuration with pre-commit hook |
|
||||
| `package.json` | Modify | Add `lefthook` devDependency + `prepare` script |
|
||||
|
||||
## Setup After Implementation
|
||||
|
||||
After the feature is implemented, hooks activate automatically:
|
||||
|
||||
```bash
|
||||
pnpm install # installs lefthook + runs `prepare` which calls `lefthook install`
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
1. Developer runs `git commit`
|
||||
2. Lefthook intercepts via the Git pre-commit hook
|
||||
3. Lefthook runs `pnpm check` (format + lint + typecheck + test)
|
||||
4. If `pnpm check` exits 0 → commit proceeds
|
||||
5. If `pnpm check` exits non-zero → commit is blocked, output shown
|
||||
|
||||
## Bypass
|
||||
|
||||
```bash
|
||||
git commit --no-verify # skips the pre-commit hook
|
||||
```
|
||||
Reference in New Issue
Block a user