Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local AI Reviewer

An automated code review tool that uses local Large Language Models to analyze Git branch changes. Reviews run entirely on your machine using Docker or Ollama, keeping your code private.

Features

  • Private & Local: All processing happens on your machine
  • Smart Analysis: Automatically detects and reviews changed files between branches
  • Handles Large Files: Splits large diffs into manageable chunks
  • Clean Interface: Progress bars and formatted terminal output
  • Markdown Reports: Saves findings to PR_REVIEW.md

Prerequisites

  • Python 3.8+
  • Git
  • Docker or Ollama with a local LLM model
  • Recommended: GPU or Apple Silicon for better performance

Installation

  1. Clone and navigate to the repository
   git clone git@github.com:jaygaha/local-ai-pr-reviewer.git
   cd local-ai-pr-reviewer
  1. Create a virtual environment
   python3 -m venv .venv
   source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install dependencies
   pip install -r requirements.txt
  1. Configure environment
   cp .env-example .env  # On Windows: copy .env-example .env
  1. Pull an LLM model
   docker model pull ai/qwen3-coder:latest
   # or
   ollama pull deepseek-coder:6.7b

Configuration

Edit .env to customize:

  • OLLAMA_URL: API endpoint (e.g., http://localhost:11434/api/chat)
  • AI_MODEL: Model name (e.g., ai/deepseek-coder:6.7b)
  • CHUNK_LIMIT: Max characters before splitting diffs (default: 3000)

Setup Git Alias

Create a convenient Git alias for easy access:

git config --global alias.ai-review '!f() { source /path/to/local-ai-pr-reviewer/.venv/bin/activate; python3 /path/to/local-ai-pr-reviewer/reviewer.py "$1" "$2"; }; f'

Replace /path/to/ with your actual installation path.

Usage

git fetch origin
git ai-review main feature-branch

The tool generates a PR_REVIEW.md report with findings, or displays "No issues found" if the code looks good.

Troubleshooting

Connection refused: Ensure Docker/Ollama is running and OLLAMA_URL is correct

Git errors: Verify you're in a Git repository and branch names exist

Model not found: Pull the model with docker model pull or ollama pull

Support

Open an issue in the repository for bugs or feature requests.

About

A privacy-first, automated code review tool powered by local LLMs. Analyse Git diffs using Docker or Ollama models — no cloud and no data sharing required, just intelligent code reviews on your machine.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Contributors

Languages