Skip to main content

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

  1. Install Cursor if not already installed
  2. Open Cursor
  3. Press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Linux/Windows)
  4. Search for: "Install cursor command"
  5. 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

  1. Pre-push hook triggers deep-hook review
  2. Diff is extracted (comparing against base_branch)
  3. Cursor agent analyzes the diff
  4. Review is displayed with Rich formatting
  5. Critical issues block push (with option to continue)
  6. 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=1 to bypass reviews when needed
  • Review generated REVIEW_SUGGESTIONS.md before committing

Best Practices

  • Review generated artifacts before committing them
  • Use .gitignore to exclude REVIEW_SUGGESTIONS.md if 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

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

Changelog

See CHANGELOG.md for a detailed list of changes and version history.

Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deep_hook-0.1.1.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deep_hook-0.1.1-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

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

Hashes for deep_hook-0.1.1.tar.gz
Algorithm Hash digest
SHA256 19642c82fec0178feae78482f4389e1f8a0cdf33a24ea464e78ac97d441fe1f4
MD5 bdfcb417e7c6b5c86a8c9e6ec7bc5048
BLAKE2b-256 53d887c694dd936d1b5d7e01d7e60e75873133d3546f47078ff27b1edb0ee96c

See more details on using hashes here.

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

Hashes for deep_hook-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f06892b06a30736fb828e39378c880f46b8a4bc31c10ac711b6a7ca67080e54b
MD5 49b8e94b02a46758c4022fa9c0cbc194
BLAKE2b-256 7851d63d851761d00b9260fa9525167019efb8a906c5fd7ba3c5ac90a15d7258

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page