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

# 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

For detailed technical documentation, see TECHNICAL.md.

Contributing

Contributions are welcome! Please:

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

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.0.tar.gz (17.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.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file deep_hook-0.1.0.tar.gz.

File metadata

  • Download URL: deep_hook-0.1.0.tar.gz
  • Upload date:
  • Size: 17.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.0.tar.gz
Algorithm Hash digest
SHA256 27c5bfeb355b2341070de90150a6e499deab6d3acf11f91af6d8bad50e197a97
MD5 98189e5427bba257780bf91725750413
BLAKE2b-256 782f1dae40c2257ed4f1a54427a766d15dffcfbbf4264d1f04d97aeffba078c6

See more details on using hashes here.

File details

Details for the file deep_hook-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: deep_hook-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c087c6a38712587dd29ef0753e7db084c4543e531a121106f071442b3ba0448
MD5 c8e21796ed3dc9cd9f3269158e0a0953
BLAKE2b-256 50358005f563fd7f12e80ce1f448195c90d9722d07c35974613a1e6af869e9fd

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