Files
initiative/specs/006-pre-commit-gate/quickstart.md

35 lines
983 B
Markdown

# 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
```