PRism / README.md
pranav8tripathi@gmail.com
added GEMINI
a4feaf2
metadata
title: PRism AI Code Reviewer
emoji: πŸ€–
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false

PRism AI Code Reviewer

Automated AI-powered code review bot for GitHub Pull Requests using Google Gemini AI.

Setup Instructions

1. Configure Secrets in HuggingFace Space Settings

Go to your Space Settings β†’ Variables and secrets, and add:

  • GITHUB_TOKEN - Your GitHub personal access token with repo scope
  • GEMINI_API_KEY - Your Google Gemini API key (get from https://aistudio.google.com/apikey)
  • GITHUB_WEBHOOK_SECRET - Random secret string (generate with openssl rand -hex 32)

2. Configure GitHub Webhook

  1. Go to your GitHub repo β†’ Settings β†’ Webhooks β†’ Add webhook (or edit existing)
  2. Payload URL: https://YOUR-SPACE-NAME.hf.space/webhook/github
  3. Content type: application/json
  4. Secret: Same value as GITHUB_WEBHOOK_SECRET above
  5. Events: Select "Let me select individual events" β†’ Check ONLY "Pull requests" (uncheck everything else)
  6. Active: βœ“ Check this box

Important: Make sure ONLY "Pull requests" is checked to avoid unnecessary webhook calls

3. Test It

Open a Pull Request in your repo and watch PRism automatically review it!

How It Works

  1. PR opened/updated β†’ GitHub sends webhook
  2. PRism fetches the code changes (diff)
  3. Google Gemini AI analyzes the code
  4. PRism posts review comments back to the PR

Features

  • πŸš€ Fast: Uses Gemini 2.0 Flash for quick responses
  • πŸ’¬ Real-time: Comments appear as each file is analyzed
  • 🎯 Accurate: Line-specific feedback with severity levels
  • πŸ”’ Secure: Webhook signature verification

Local Development

pip install -r requirements.txt
uvicorn app.main:app --reload

Visit: http://localhost:8000