AI-powered Git pre-push code review using Cursor
Project description
๐ Deep Hook
AI-powered Git pre-push code review using Cursor agent.
What it does
Runs a thorough code review before every push, catching bugs and issues while you still have context.
โญโ ๐ Deep Hook โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ AI-Powered Code Review โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Comparing against: origin/main
โญโ ๐ Diff Stats โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ 3 files | +45 | -12 โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ ๐ง TL;DR โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โข Added user authentication โ
โ โข Refactored API client โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ โ Critical โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โข `auth.dart:45` โ Token stored without encryption โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
๐ซ Push Blocked โ Critical issues found.
Continue with push? (y/N)
Install
pip install deep-hook
cd your-project
deep-hook install
deep-hook init
Commands
deep-hook review # Run by pre-push hook
deep-hook check # Manual review (dry run)
deep-hook install # Install hook
deep-hook uninstall # Remove hook
deep-hook init # Create config
Configuration
Create deep.yml in your project root:
# Branch to compare against
base_branch: main
# Project language
language: flutter # flutter, python, typescript, go, rust, other
# Cursor agent timeout (seconds)
timeout: 120
# Max diff lines
max_diff_lines: 3000
# Cursor agent model
model: gpt-5.2-codex-fast
# Guidelines for the AI
guidelines:
- "Use BLoC pattern"
- "No print() in production"
Bypass
git push --no-verify
# or
DEEP_SKIP=1 git push
Requirements
System Requirements
- Python: 3.9 or higher
- Git: 2.x or higher (for repository operations)
- Cursor: Latest version with CLI enabled
Cursor Setup
- Install Cursor if not already installed
- Open Cursor
- Press
Cmd+Shift+P(macOS) orCtrl+Shift+P(Linux/Windows) - Search for: "Install cursor command"
- Verify installation:
cursor --version cursor agent --help
Git Setup
Deep Hook requires a Git repository. Ensure Git is installed and configured:
git --version # Should be 2.x or higher
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
How it works
- Pre-push hook triggers
deep-hook review - Diff is extracted (comparing against
base_branch) - Cursor agent analyzes the diff
- Review is displayed with Rich formatting
- Critical issues block push (with option to continue)
- Optionally saves
REVIEW_SUGGESTIONS.md
Security & Privacy
Data Handling
- Local Processing: All code review happens locally on your machine
- No Telemetry: Deep Hook does not collect or transmit any data
- Cursor Agent: Code diffs are sent to Cursor agent running locally
- No External Services: No data is sent to external servers (except Cursor's agent)
Important Notes
โ ๏ธ Code Visibility: When using Cursor agent, your code diff is processed by Cursor's AI models. Review Cursor's privacy policy for details.
๐ Sensitive Projects: For highly sensitive codebases:
- Consider reviewing Cursor's data handling policies
- Use
DEEP_SKIP=1to bypass reviews when needed - Review generated
REVIEW_SUGGESTIONS.mdbefore committing
Best Practices
- Review generated artifacts before committing them
- Use
.gitignoreto excludeREVIEW_SUGGESTIONS.mdif it contains sensitive information - Never commit API keys, tokens, or credentials (even in diffs)
License
This project is licensed under the MIT License.
Project Structure
deep_hook/
โโโ cli.py # Commands
โโโ config.py # YAML loading
โโโ git.py # Diff extraction
โโโ reviewer.py # Cursor integration
โโโ prompts.py # AI prompts
โโโ formatter.py # Terminal output
โโโ artifacts.py # Markdown generation
โโโ models.py # Data models
Configuration Options
deep.yml Fields
| Field | Type | Default | Description |
|---|---|---|---|
base_branch |
string | main |
Branch to compare against for diff |
language |
string | python |
Project language (flutter, python, typescript, go, rust, other) |
timeout |
integer | 120 |
Cursor agent timeout in seconds (10-600) |
max_diff_lines |
integer | 3000 |
Maximum diff lines to review (100-10000) |
model |
string | gpt-5.2-codex-fast |
Cursor agent model to use |
guidelines |
list | [] |
Project-specific coding guidelines |
Example Configuration
base_branch: develop
language: flutter
timeout: 180
max_diff_lines: 5000
model: gpt-5.2-codex-fast
guidelines:
- "Use BLoC pattern for state management"
- "Prefer const constructors"
- "No print() in production code"
Documentation
- README.md: User guide and quick start
- TECHNICAL.md: Technical reference with imports and architecture
- CHANGELOG.md: Version history and changes
- LICENSE: MIT License
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Changelog
See CHANGELOG.md for a detailed list of changes and version history.
Support
- Issues: GitHub Issues
- Documentation:
- README.md - User guide
- TECHNICAL.md - Developer documentation
- CHANGELOG.md - Version history
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deep_hook-0.1.1.tar.gz.
File metadata
- Download URL: deep_hook-0.1.1.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19642c82fec0178feae78482f4389e1f8a0cdf33a24ea464e78ac97d441fe1f4
|
|
| MD5 |
bdfcb417e7c6b5c86a8c9e6ec7bc5048
|
|
| BLAKE2b-256 |
53d887c694dd936d1b5d7e01d7e60e75873133d3546f47078ff27b1edb0ee96c
|
File details
Details for the file deep_hook-0.1.1-py3-none-any.whl.
File metadata
- Download URL: deep_hook-0.1.1-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f06892b06a30736fb828e39378c880f46b8a4bc31c10ac711b6a7ca67080e54b
|
|
| MD5 |
49b8e94b02a46758c4022fa9c0cbc194
|
|
| BLAKE2b-256 |
7851d63d851761d00b9260fa9525167019efb8a906c5fd7ba3c5ac90a15d7258
|