pre-commit Integration
drep can install native Git hooks itself, or it can run as a published hook inside an existing pre-commit configuration.
Choose one hook owner
| Approach | Best when | Install |
|---|---|---|
| Native Git hooks | The repository does not already use pre-commit | drep init |
| pre-commit framework | The repository already centralizes hooks in .pre-commit-config.yaml | Add the drep repository and hook IDs |
Do not install both versions of the same stage: that makes one commit or push run the same review twice.
Published hooks
repos:
- repo: https://github.com/slb350/drep
rev: v3.1.0
hooks:
- id: drep-check-push # pre-push: what the push touches
# - id: drep-check # pre-commit: staged files
# - id: drep-lint-docs # staged Markdown, rule-based| Hook ID | Stage | Command |
|---|---|---|
drep-check | pre-commit | drep check --staged |
drep-check-push | pre-push | drep check --push-gate --pre-commit-push |
drep-check-all | manual/default | drep check |
drep-lint-docs | pre-commit | drep lint-docs --fail-on error |
Automatic trigger coverage
Install hook stages
pre-commit install
pre-commit install --hook-type pre-pushWhy the pre-push adapter matters
pre-commit normally passes changed filenames to hooks. For drep that would select whole-file mode, so a one-line follow-up fix could re-review all surrounding code. --pre-commit-push instead reads PRE_COMMIT_FROM_REF and PRE_COMMIT_TO_REF, preserving diff-hunk review of the actual push.
--push-gate also performs the cache-warming reconnect handshake. A successful cold review exits 3 and asks for a new git push; the retry opens a fresh remote connection and uses the cached review.
Isolated Rust environment
The published hooks use language: rust. pre-commit builds drep from the pinned release into its own environment, so consumers do not need a separately installed binary for the hook itself.
Run hooks manually
pre-commit run drep-check --all-files
pre-commit run drep-lint-docs --all-files