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.
- 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_KEYis 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
- Python 3.9+
- Node.js 18+
- A GitHub OAuth App (see setup below)
- An Anthropic or OpenAI API key
- Go to GitHub Settings -> Developer settings -> OAuth Apps
- Click "New OAuth App"
- Fill in the details:
- Application name: CodeSheriff
- Homepage URL: http://localhost:5173
- Authorization callback URL: http://localhost:8000/auth/callback
- Save the
Client IDand generate aClient Secret
git clone https://github.com/rizanc/codesheriff.git && cd codesheriffCreate 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-keyThe backend reads variables from the process environment; export them or load the file with your shell (for example set -a; source .env; set +a).
cd backend
pip install -r requirements.txtcd frontend
npm installTerminal 1 - Backend:
cd backend
python main.py
# Or: uvicorn main:app --reload --port 8000Terminal 2 - Frontend:
cd frontend
npm run dev- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
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
- Login: Click "Continue with GitHub" to authenticate
- Add Repositories: Go to Repositories and add your
owner/repo - View PRs: Click "View PRs" on any repository
- Review: Click "Review" to analyze a PR, or "Post Comment" to add the analysis to the PR
- Dashboard: Check statistics and review history
| 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) |
- The database is a SQLite file,
codesheriff.db, created next to thebackend/directory on first run. - CORS is limited to
http://localhost:5173andhttp://localhost:3000. - Set a real
SECRET_KEYandFRONTEND_URLif you run it anywhere other than localhost.
MIT License - see LICENSE.