Skip to content

About

AI pull-request review assistant: FastAPI + React, GitHub OAuth, LLM summary/risk/issues per PR, optional auto-comment

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeSheriff

CodeSheriff is a small, self-contained pull-request review assistant. It is a FastAPI backend plus a React (Vite + Tailwind) frontend. You sign in with GitHub OAuth, register the repositories you want to watch, and run an LLM review on any open pull request. The review returns a short summary, a risk level, the key files to look at, and a list of potential issues, and it can optionally be posted back to the PR as a comment. Reviews are stored in a local SQLite database. This is a personal tool for trying out LLM-assisted review, not a production review pipeline.

Features

  • GitHub OAuth Login - Authenticate with your GitHub account
  • Repository Management - Register and remove repositories to monitor
  • LLM-Powered Reviews - Analyzes PRs using Anthropic (if ANTHROPIC_API_KEY is set) or OpenAI
  • Review Summary - Summary, risk level, key files, issues, and suggested reviewers
  • Auto-Post Comments - Optionally post the review directly to the PR
  • Dashboard - Statistics and review history

Prerequisites

  • Python 3.9+
  • Node.js 18+
  • A GitHub OAuth App (see setup below)
  • An Anthropic or OpenAI API key

Quick Start

1. Create a GitHub OAuth App

  1. Go to GitHub Settings -> Developer settings -> OAuth Apps
  2. Click "New OAuth App"
  3. Fill in the details:
  4. Save the Client ID and generate a Client Secret

2. Clone

git clone https://github.com/rizanc/codesheriff.git && cd codesheriff

3. Configure Environment Variables

Create a .env file in backend/ (see backend/.env.example):

# Required - GitHub OAuth
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
GITHUB_REDIRECT_URI=http://localhost:8000/auth/callback

# Required - LLM provider (choose one; Anthropic is used when its key is set)
ANTHROPIC_API_KEY=sk-ant-...
# OR
OPENAI_API_KEY=sk-...

# Optional - override the model ids
ANTHROPIC_MODEL=claude-haiku-4-5
OPENAI_MODEL=gpt-4o-mini

# Optional
FRONTEND_URL=http://localhost:5173
SECRET_KEY=your-random-secret-key

The backend reads variables from the process environment; export them or load the file with your shell (for example set -a; source .env; set +a).

4. Install Backend Dependencies

cd backend
pip install -r requirements.txt

5. Install Frontend Dependencies

cd frontend
npm install

6. Start the Application

Terminal 1 - Backend:

cd backend
python main.py
# Or: uvicorn main:app --reload --port 8000

Terminal 2 - Frontend:

cd frontend
npm run dev

7. Open the App

Project Structure

codesheriff/
├── backend/
│   ├── main.py          # FastAPI app & routes
│   ├── auth.py          # GitHub OAuth handlers
│   ├── github.py        # GitHub API client
│   ├── pr_review.py     # LLM-powered PR analysis
│   ├── database.py      # SQLite database
│   ├── .env.example
│   └── requirements.txt
├── frontend/
│   ├── src/
│   │   ├── App.jsx      # Main React app
│   │   ├── components/
│   │   │   ├── Login.jsx
│   │   │   ├── Dashboard.jsx
│   │   │   ├── Repos.jsx
│   │   │   ├── Reviews.jsx
│   │   │   ├── Settings.jsx
│   │   │   └── Navbar.jsx
│   │   └── index.css
│   ├── package.json
│   └── vite.config.js
└── README.md

Usage

  1. Login: Click "Continue with GitHub" to authenticate
  2. Add Repositories: Go to Repositories and add your owner/repo
  3. View PRs: Click "View PRs" on any repository
  4. Review: Click "Review" to analyze a PR, or "Post Comment" to add the analysis to the PR
  5. Dashboard: Check statistics and review history

API Endpoints

Method Endpoint Description
GET /auth/login Start OAuth flow
GET /auth/callback OAuth callback
GET /auth/me Current user
POST /auth/logout Clear session
GET /auth/status Check auth status
GET /api/repos List registered repos
POST /api/repos Add a repository
DELETE /api/repos/{id} Remove a repository
GET /api/github/repos List the user's GitHub repos
GET /api/repos/{id}/pulls Get PRs for a repo
POST /api/review Analyze a PR
GET /api/reviews Get review history
GET /api/dashboard Get dashboard stats
GET/POST /api/settings User settings
POST /api/webhook GitHub webhook receiver (stub, does not verify signatures)

Notes

  • The database is a SQLite file, codesheriff.db, created next to the backend/ directory on first run.
  • CORS is limited to http://localhost:5173 and http://localhost:3000.
  • Set a real SECRET_KEY and FRONTEND_URL if you run it anywhere other than localhost.

License

MIT License - see LICENSE.

About

AI pull-request review assistant: FastAPI + React, GitHub OAuth, LLM summary/risk/issues per PR, optional auto-comment

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages