Skip to content

Vipeen-Kumar/pr-review-agent

Repository files navigation

🚀 PR Review Agent

AI-powered pull request reviewer built with Gemini
that analyzes code against issue context and company standards.

🔥 Features

  • AI-powered PR analysis
  • Bug detection and suggestions
  • Code quality scoring
  • Web UI plus CLI support
  • Company guideline enforcement
  • GitHub PR fetch and auto-review
  • Optional PR comment posting back to GitHub
  • Saved review history per user

💡 Why this project?

Code reviews are time-consuming and inconsistent.
This project uses AI to standardize and accelerate PR reviews
while ensuring alignment with company guidelines.

📸 Demo

UI Screenshot

🧠 What This Project Does

The agent evaluates PRs by:

  • ⭐ Rating the PR out of 10
  • 📝 Summarizing changes
  • 🐞 Detecting bugs
  • ⚠️ Checking edge cases
  • 🔧 Suggesting fixes
  • 🔒 Flagging security issues
  • 🧭 Comparing the PR against issue scope
  • 🏢 Enforcing company review standards

🧩 Core Capabilities

  • Review using issue URLs, issue text, PR URLs, PR descriptions, and code blocks
  • Compare previous code and current code side by side
  • Fetch live PR title, body, and file patches from GitHub
  • Post generated feedback back to GitHub as a PR comment
  • Support email login, Google login, and per-user review history

🗂️ Project Structure

pr-review-agent/
├── agent.yaml
├── SOUL.md
├── RULES.md
├── README.md
├── assets/
│   └── ui.png
├── skills/
│   └── pr-review/
│       └── SKILL.md
├── public/
├── data/
│   └── store.json
├── gemini.js
├── server.js
├── run-agent.js
├── .env
└── package.json

⚙️ How It Works

1. Input

You can provide:

  • issue URL
  • issue text
  • PR URL
  • PR title or PR description
  • previous code and current code
  • optional company rules

2. GitHub Enrichment

If a GitHub PR URL is provided, the app can:

  • fetch PR title and body
  • fetch changed files and patches
  • use real GitHub data for review generation

3. AI Review

The backend sends the combined context to Gemini, which returns a structured review.

4. Output

The UI displays the review in a scannable format and can optionally post it back to GitHub.

🧪 Example Output

## Rating
8/10

## Summary
Fixes multiplication bug

## Issues
- Incorrect operator used earlier

## Corrections
- Replace + with *

## Verdict
APPROVE

🛠️ Requirements

  • Node.js 18 or newer
  • npm
  • git
  • a valid Gemini API key

📦 Installation

npm install

🔐 Environment Setup

Create or update .env like this:

GEMINI_API_KEY=your_gemini_api_key
GOOGLE_API_KEY=your_gemini_api_key
GEMINI_MODEL=gemini-2.5-flash
SESSION_SECRET=change_me
AUTH0_DOMAIN=your_auth0_domain
AUTH0_CLIENT_ID=your_auth0_client_id
AUTH0_CLIENT_SECRET=your_auth0_client_secret
AUTH0_CALLBACK_URL=http://localhost:3000/auth/auth0/callback
GITHUB_TOKEN=your_github_token

What each value is used for

  • GEMINI_API_KEY: Gemini review generation
  • GOOGLE_API_KEY: gitclaw compatibility
  • SESSION_SECRET: signed login sessions
  • AUTH0_*: Google login via Auth0
  • GITHUB_TOKEN: GitHub PR fetch and comment posting

▶️ Run The Project

Web App

npm start

Open:

http://localhost:3000

CLI Mode

npm run cli

Sample CLI Review

node run-agent.js --sample

🌐 GitHub Integration

The app can:

  • fetch PRs using the GitHub API
  • auto-review fetched PRs
  • post generated comments back to GitHub

To use it:

  1. Paste a GitHub PR URL
  2. Click Fetch PR
  3. Keep Auto-fetch PR details from GitHub before review enabled
  4. Optionally enable posting review comments back to GitHub
  5. Run the review

👤 Authentication

The app supports:

  • email sign-up and login
  • Google login through Auth0
  • per-user saved review history

📁 Main Files

  • agent.yaml defines the agent metadata
  • SOUL.md defines the agent identity
  • RULES.md defines review rules and constraints
  • gemini.js builds and sends the review prompt
  • server.js serves the app and APIs
  • public/ contains the UI
  • data/store.json stores users and reviews
  • run-agent.js provides CLI support

🚀 Future Improvements

  • inline GitHub review comments on changed lines
  • richer scoring breakdown
  • downloadable markdown and JSON reports
  • team dashboards for shared review history
  • better diff visualizations inside the UI

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors