Skip to main content

diffbro - AI Powered Peer Reviews

Your AI Peer Review Bro

Diffbro is a command line tool that gives you AI powered peer reviews on your codebase. Under the hood diffbro utilizes git diff and OpenAI's GPT-3.5-turbo and GPT-4 to review your code and provide feedback on your changes.

Diffbro is best used before you stage and commit your code to your codebase. Diffbro also supports full branch diff PR feedback as if it were an engineer reviewing your merge request (see --peer-review flag). Diffbro is designed to help you catch bugs, improve your code quality, and help you ship with confidence.

Diffbro Header

Features

  • View all commands, options and examples

    • diffbro --help
  • Run against local changes

    • diffbro
  • Run diffbro against a branch and create a PR review

    • diffbro --peer-review main
  • Different bro modes for chill, to chad engineer level peer reviews

    • chill: will review your code like a chill bro (default)
      • diffbro --chill
    • mid: will review your code like a mid level engineer bro
      • diffbro --mid
    • chad: will review your code like a chad, staff engineer bro
      • diffbro --chad
  • Choose which files to review

    • Only .py and .js files
      • diffbro --only .py .js
    • Everything except .py and .js files
      • diffbro --ignore .py .js
    • Defaults to [".py", ".c", ".cpp", ".java", ".cs", ".php", ".vb", ".html", ".css", ".js", ".ts", ".asp", ".aspx", ".cfm", ".cgi", ".pl", ".cer", ".htm", ".xhtml", ".shtml", ".jsp", ".jsx", ".tsx", ".vue", ".solid", ".toml", ".md", ".go", ".rs", ".swift"]
  • Choose your gpt model

    • diffbro --model gpt-3.5-turbo
    • diffbro --model gpt-4 (default) (recommended for production code)
  • Summarize the git diff for a commit message or PR description

    • diffbro --summarize
  • Override the default prompts with your own custom prompt

    • diffbro --prompt "Below is a git diff of code. Please review and notify only of critical issues. If there are no critical issues, respond with tons of checkbox emojis"
  • Example command combos

    • 'I want a chill review on my .py and .js files'
      • diffbro --chill --only .py .js
    • 'I'm about to ship production, mission critical UI code, I need a hardcore review on my FE code'
      • diffbro --chad --model gpt-4 --only .js .jsx .tsx .vue
    • 'I'm about to a fullstack app and need a comprehensive mid level review on all my code excluding .tsx files'
      • diffbro --mid --model gpt-4 --ignore .tsx
    • 'I want to run my own prompt against my git diff with a summary for the commit massage'
      • diffbro --prompt "Below is a git diff of code. Please review and notify only of critical issues." --summarize
    • 'I want a quick comparison of my changes against the staging branch with a summary'
      • diffbro --peer-review staging --model gpt-3.5-turbo --summarize
    • 'I want a mid level code review of all of my .ts files'
      • diffbro --mid --only .ts
    • 'I want top tier code reviews all the time'
      • Throw this line into your .bashrc or .bash_profile
        • alias dbro="diffbro --chad --model gpt-4 --summarize"
      • Then, whenever you want a review, just run
        • dbro

Install & Use

  • Install or switch to Python 3.11 or 3.10 or 3.9 or 3.8

    • Check your python version
      • python --version
  • Install 'stable' version from PyPI

    • pip install --upgrade diffbro
  • Export your openai api key

    • export OPENAI_API_KEY=<your-openai-api-key>
  • Make changes to your codebase

  • Run diffbro

    • diffbro

Compare local changes

  • Before you stage and commit, run diffbro

    • diffbro
  • Implement the feedback from diffbro

  • Commit your code with confidence

Compare branch changes

  • Before you merge, run diffbro

    • diffbro --peer-review main
  • Implement the feedback from diffbro

  • Merge your code with confidence

Development

Install bleeding edge version test version

  • Install BLEEDING EDGE version from TestPyPi
    • pip install --upgrade --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple diffbro

Local Dev Commands (excluded from dist)

  • run diffbro locally
    • poetry run diffbro
  • test versions
    • poetry run python scripts/run_tox.py
  • publish to test pypi
    • poetry run python scripts/publish_testpypi.py
  • publish to pypi
    • poetry run python scripts/publish_pypi.py

ROADMAP

[✅] POC

[✅] Add GPT model flag

[✅] Add diff exclusion of large files like poetry.lock from the diff

[✅] Add cli --only flag to diff only specific file types

[✅] Add cli --ignore flag to ignore specific file types

[✅] Deploy version 0.1.0 to TestPyPi

[✅] Test install version 0.1.0 from TestPyPi

[✅] Deploy version 0.1.2 to pypy

[✅] Add help docs

[✅] Support additional python versions

[✅] Improve openai_api_key check

[✅] Chad should always ask to use gpt-4 (simple yes/no prompt)

[✅] Add custom prompt flag to be run on the diff diffbro --prompt "Below is a git diff of code. Please review and notify only of critical issues."

[✅] Add summarybro flag that will create a git commit message using the diffbro summary diffbro --summarize -> "Added new feature to the app, fixed a bug, and refactored some code."

[✅] Add COMPLETE PR review flag which runs diffbro against a branch and creates a PR review diffbro --pr main

[✅] RELEASE VERSION 1.0.0!!!

[] Parallelize diffbro and commit summary GPT requests

[] Add unit tests

[] What feature would you like to see next? Submit a feature request

[?] Add token limit check to prevent overage charges

[?] Add 'AI Devlogs' section to readme w/links to ai devlogs

[?] Add ~/.diffbro config file support for custom defaults

  • if a cli param was specified in the .diffbro file, use that. Add default values to argparse to detect if a cli param was specified (dirty)

Metadata

Release files for diffbro 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for diffbro 1.0.2
File Size Uploaded Provenance
diffbro-1.0.2.tar.gz 9.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for diffbro 1.0.2
File Interpreter ABI Platform
diffbro-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / diffbro-1.0.2.tar.gz

Download URL diffbro-1.0.2.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a39147757c95ac9c5c5a44b452cc2d4dcc902fea0c848b5ebd609afe76d99c95
BLAKE2b-256 checksum
How to use checksums
4e89b1f1574a722ef31f62d5cdab664db960bbfa740de4639ee0196377729953
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.11 Darwin/22.4.0

Release files / diffbro-1.0.2-py3-none-any.whl

Download URL diffbro-1.0.2-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
198b3b834d1d08ea6f43f78efac2bdccc16af6aa5ed36ec30eea588a0931ae68
BLAKE2b-256 checksum
How to use checksums
77c5c5e195e5b8eef55cd16c8295304019971f95dbad402054d1a1dd120df891
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.11 Darwin/22.4.0

Security for diffbro 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page