AI-powered code review assistant for GitHub and GitLab pull requests using Chrome's built-in AI APIs. Get instant, comprehensive code reviews with interactive Q&Aβall processed locally in your browser with zero configuration.
-
π€ Comprehensive AI Code Review: 9-section structured analysis covering:
- Overall assessment and readiness
- Critical issues (blockers)
- Potential bugs and logic errors
- Security vulnerabilities
- Performance and scalability concerns
- Code quality and maintainability
- Architecture and design patterns
- Style suggestions and nitpicks
- Positive observations
-
π¬ Interactive Q&A: Ask follow-up questions about the review
- Context-aware answers that reference specific PR code
- Conversation history maintained across questions
- Get code examples and actionable solutions
-
π Smart Summaries: Generates concise PR overviews using Chrome's Summarizer API
-
π¨ Beautiful UI:
- Side panel with markdown formatting
- Syntax highlighting for code blocks
- Collapsible Q&A section
- Smooth animations and loading states
-
π Privacy First: All AI processing happens locally using Chrome's Gemini Nano
- No API keys required
- No data sent to cloud servers
- Review proprietary code with confidence
-
π Multi-Platform: Works with both GitHub and GitLab pull requests
- Chrome Version: Chrome 128+ (Canary/Dev) or Chrome 138+ (Stable)
- Operating System: Windows 10/11, macOS 13+, or Linux
- Internet Connection: Required for initial AI model download (~3GB, one-time)
- Storage: At least 22GB free space
- GPU: 4GB+ VRAM recommended
-
Clone or download this repository:
git clone https://github.com/yourusername/code-review-ai.git
-
Open Chrome and navigate to
chrome://extensions/ -
Enable Developer mode (toggle in top right corner)
-
Click "Load unpacked"
-
Select the
code-reviewdirectory -
The extension icon should appear in your toolbar
This is critical! The extension won't work without this step.
-
Navigate to
chrome://flagsin a new tab -
Search for and enable these two flags:
Flag 1: Optimization Guide
- Search for:
Enables optimization guide on device - Set to: Enabled BypassPerfRequirement
Flag 2: Prompt API
- Search for:
Prompt API for Gemini Nano with Multimodal Input - Set to: Enabled
- Search for:
-
Click the "Relaunch" button that appears at the bottom
-
Chrome will restart with AI features enabled
The first time you use the extension, Chrome needs to download the Gemini Nano model (~3GB). This is a one-time process.
What to expect:
- Navigate to any GitHub or GitLab PR
- Click the "AI Review" button
- The extension will show: "AI model is downloading (5-10 minutes)"
- The download happens in the backgroundβyou can close the tab
- The extension auto-checks status every 30 seconds
- Once complete, click "AI Review" again to analyze the PR
To manually check download status:
Open Chrome DevTools Console (F12) and run:
await LanguageModel.availability()
// Returns: "downloadable", "downloading", or "available"-
Navigate to a Pull Request
- Open any GitHub PR (e.g.,
https://github.com/microsoft/vscode/pulls) - Or any GitLab merge request
- Open any GitHub PR (e.g.,
-
Start Review
- Look for the "AI Review" button in the PR header
- Click it to start analysis
- The side panel will open automatically
-
View Results
- Review appears in structured sections
- Color-coded tags highlight bugs, security issues, performance concerns
- Code blocks are syntax highlighted
- Markdown formatting makes it easy to read
After the review completes, you can ask follow-up questions:
-
Open Q&A Section
- Scroll down in the side panel
- Click "π¬ Ask Questions About This Review"
-
Ask Questions
- Type your question (up to 500 characters)
- Examples:
- "How do I fix the security vulnerability in section 4?"
- "Can you explain the N+1 query issue with code examples?"
- "What's the best way to refactor this for better performance?"
- Press Ctrl+Enter or click "Ask"
-
Get Contextual Answers
- AI remembers the PR context and previous review
- Answers reference specific sections
- Includes code examples when applicable
- Conversation history is preserved
-
Continue the Conversation
- Ask follow-up questions
- Last 3 Q&As are maintained for context
- Each new PR review starts a fresh Q&A session
Cause: Chrome AI features not enabled or Chrome version too old
Solution:
- Check Chrome version:
chrome://version/(need Chrome 128+) - Enable both flags in
chrome://flags:Enables optimization guide on deviceβ Enabled BypassPerfRequirementPrompt API for Gemini Nano with Multimodal Inputβ Enabled
- Relaunch Chrome completely
- Reload the extension in
chrome://extensions/
Cause: Download is still in progress or failed
Solution:
- Wait 10-15 minutes (download can be slow on slower connections)
- Check download status in DevTools console:
await LanguageModel.availability()
- If stuck, restart Chrome and try again
- Ensure you have 3GB+ free disk space
Cause: Extension context was invalidated or service worker terminated
Solution:
- Reload the extension: Go to
chrome://extensions/β Click reload icon - Refresh the PR page
- Try clicking "AI Review" again
Cause: Page not fully loaded or content script failed to inject
Solution:
- Refresh the PR page
- Check if you're on the PR "Conversation" or "Files changed" tab
- Check browser console for errors (F12)
- Ensure extension is enabled in
chrome://extensions/
Cause: PR data not stored or AI API unavailable
Solution:
- Run a fresh code review first
- Ensure the review completed successfully
- Check that the Q&A section appeared after review
- Verify AI model is available (not downloading)
code-review/
βββ manifest.json # Extension configuration (Manifest V3)
βββ background.js # Service worker for AI API calls
βββ content.js # Content script for PR page injection
βββ sidebar.html # Side panel UI with Q&A interface
βββ sidebar.js # Side panel logic and Q&A handlers
βββ styles.css # Injected styles for PR button
βββ icons/ # Extension icons (16, 48, 128px)
βββ ABOUT.md # Project story and journey
background.js
- Handles AI API calls (LanguageModel, Summarizer)
- Dual API pattern support (global & namespaced)
- Service worker keep-alive mechanism
- Q&A context management
content.js
- Injects "AI Review" button into PR pages
- Extracts PR data (title, description, diff)
- Handles GitHub and GitLab DOM differences
- Opens side panel for results
sidebar.js
- Displays review results with markdown formatting
- Manages Q&A conversation state
- Handles user interactions (questions, toggle)
- Auto-saves Q&A history to chrome.storage
- Load the extension in Chrome (
chrome://extensions/) - Open any public GitHub PR:
- Example: https://github.com/microsoft/vscode/pulls
- Or search for PRs with substantial code changes
- Click "AI Review" button
- Open DevTools Console (F12) to see API interactions
- Test Q&A by asking follow-up questions
The extension supports both Chrome AI API patterns:
// Global pattern (newer)
await LanguageModel.create()
await Summarizer.create()
// Namespaced pattern (older)
await ai.languageModel.create()
await ai.summarizer.create()Automatic detection ensures compatibility across Chrome versions.
- Chrome Extension Manifest V3: Modern extension architecture
- Chrome Prompt API: Gemini Nano for code analysis and Q&A
- Chrome Summarizer API: PR summary generation
- Vanilla JavaScript: No frameworksβlightweight and fast
- Chrome Storage API: Persistent Q&A history
- Chrome Side Panel API: Dedicated review UI
- Custom review focus (quick scan vs. deep dive)
- Code suggestions with diffs
- Export review reports (PDF, Markdown)
- Keyboard shortcuts (Ctrl+Shift+R for review)
- Support for Bitbucket and Azure DevOps
- Custom rules engine for team-specific patterns
- Review templates for different project types
- PR health score (0-100 quality rating)
- VS Code integration (catch issues pre-commit)
- CI/CD integration (auto-review on PR creation)
- Team learning (improve AI from historical decisions)
- Multi-language expansion (specialized frameworks)
MIT License - See LICENSE for details
Contributions are welcome! Here's how you can help:
- Report Bugs: Open an issue with detailed reproduction steps
- Suggest Features: Share your ideas in the issues tab
- Submit PRs: Fork, create a feature branch, and submit a PR
- Improve Docs: Help make setup clearer for new users
- Test: Try the extension on various PR types and report findings
Development Setup:
git clone
cd code-review
# Load extension in chrome://extensions/
# Make changes and reload extension to testπ€ Powered by Chrome's Built-in AI (Gemini Nano)
β If you find CodeReview AI helpful, please star the repo and share it with your team!