Skip to content

An AI-powered VS Code extension that generates one-liner reviews above function definitions using Gemini 2.0 Flash API.

License

Notifications You must be signed in to change notification settings

master-wayne7/reviewer-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ReviewerBot ๐Ÿค–

An AI-powered VS Code extension that generates one-liner reviews above function definitions using Gemini 2.0 Flash API. Reviews are generated in different styles: funny, roast, motivational, technical, and hilarious!

โœจ Features

  • Multi-language Support: Go, Python, JavaScript/TypeScript, C, C++, Dart, Java
  • Multiple Review Styles:
    • ๐Ÿ˜„ Funny: Light-hearted and humorous
    • ๐Ÿ”ฅ Roast: Sarcastic and critical
    • ๐Ÿ’ช Motivational: Encouraging and uplifting
    • ๐Ÿ”ง Technical: Professional and constructive
    • ๐Ÿคช Hilarious: Over-the-top and entertaining
  • Star Ratings: Automatic star ratings (โญ to โญโญโญโญโญ)
  • Auto-generation: Generate reviews on file save (optional)
  • CodeLens Integration: Reviews appear as clickable CodeLens above functions
  • Mock Mode: Test without API calls

๐Ÿ“ธ Screenshots & Demo

๐ŸŽฌ Demo

ReviewerBot Demo

๐Ÿ“ฑ Screenshots by Language

๐Ÿ Python

Python Support

๐ŸŸข Go

Go Support

๐ŸŸก JavaScript

JavaScript Support

๐ŸŽฏ Dart

Dart Support

๐Ÿ—๏ธ Architecture

ReviewerBot consists of two main components:

1. Go Backend (/backend)

  • Function Parser: Detects function definitions using regex patterns
  • Gemini Integration: Connects to Gemini 2.0 Flash API
  • Review Generator: Formats reviews with star ratings
  • Direct Communication: Called directly by VS Code extension via stdin/stdout
  • Mock Mode: Fallback reviews when API is unavailable

2. VS Code Extension (/extension)

  • Backend Client: Calls Go executable directly via stdin/stdout
  • CodeLens Provider: Displays reviews as clickable CodeLens above functions
  • Configuration UI: Settings for API key, review style, etc.
  • Command Palette: Manual review generation, clearing, and review history

๐Ÿš€ Quick Start

Prerequisites

  • Go 1.21+
  • Node.js 16+
  • VS Code
  • Gemini API Key

1. Setup Go Backend

# Install dependencies
go mod tidy

# Build the executable
go build -o reviewer-bot.exe main.go

# Set your Gemini API key (optional - will use mock mode if not set)
export GEMINI_API_KEY="your-api-key-here"

The Go executable will be called directly by the extension via stdin/stdout communication.

2. Setup VS Code Extension

# Navigate to extension directory
cd extension

# Install dependencies
npm install

# Compile TypeScript
npm run compile

# Package extension (optional)
npm run package

3. Install Extension

  1. Open VS Code
  2. Press Ctrl+Shift+P (or Cmd+Shift+P on Mac)
  3. Type "Extensions: Install from VSIX"
  4. Select the packaged .vsix file

4. Configure Extension

  1. Open VS Code Settings (Ctrl+,)
  2. Search for "ReviewerBot"
  3. Configure:
    • API Key: Your Gemini API key (optional - will use mock mode if not set)
    • Review Style: Choose your preferred style
    • Auto-generate on Save: Enable/disable

๐Ÿ“– Usage

Manual Review Generation

  1. Open a supported file (.go, .js, .ts, .py)
  2. Press Ctrl+Shift+P (or Cmd+Shift+P)
  3. Type "ReviewerBot: Generate Reviews"
  4. Reviews will appear above function definitions

API Key Management

  1. Set API Key: Press Ctrl+Shift+P โ†’ "ReviewerBot: Set Gemini API Key"
  2. Clear API Key: Press Ctrl+Shift+P โ†’ "ReviewerBot: Clear Gemini API Key"
  3. Show Configuration: Press Ctrl+Shift+P โ†’ "ReviewerBot: Show Current Configuration"
  4. Mock Mode: If no API key is set, mock reviews will be generated

Review Persistence

  • Reviews are automatically saved to .reviewer-bot-reviews.json in your workspace
  • Reviews persist across file sessions and VS Code restarts
  • Review history is maintained for each function

AI-Powered Star Ratings

  • Star ratings (โญ to โญโญโญโญโญ) are now generated by the AI based on code quality
  • Ratings consider: code structure, readability, naming, error handling, performance, and best practices
  • No more random ratings - each review gets a quality-based star rating

Clear Reviews

  1. Press Ctrl+Shift+P (or Cmd+Shift+P)
  2. Type "ReviewerBot: Clear Reviews"
  3. All reviews will be removed

Review History

  1. Click on any CodeLens review above a function
  2. View the review history for that function
  3. Select from previous reviews

Auto-generation on Save

Enable in settings to automatically generate reviews when saving files.

๐ŸŽจ Review Styles

Funny ๐Ÿ˜„

โญโญโญโญ Well-structured and funnyโ€”this function actually made me smile ๐Ÿ˜‚
function calculateTip(amount) {
  ...
}

Roast ๐Ÿ”ฅ

โญโญ This function has more ifs than your life plan. Stillโ€ฆ functional. ๐Ÿคท
function validateEmail(email) {
  ...
}

Motivational ๐Ÿ’ช

โญโญโญโญโญ You're doing great! This function rocks! ๐Ÿš€
function processData(data) {
  ...
}

Technical ๐Ÿ”ง

โญโญโญโญ Well-structured and efficient code ๐Ÿ“Š
function calculateAverage(numbers) {
  ...
}

Hilarious ๐Ÿคช

โญโญโญ This function is so wild, it needs a leash! ๐Ÿฆฎ
function complexAlgorithm(a, b, c) {
  ...
}

Note: Reviews appear as clickable CodeLens above function definitions, not as comments in the code.

๐Ÿ”ง Configuration

Backend Configuration

Environment Variables:

  • GEMINI_API_KEY: Your Gemini API key (optional - will use mock mode if not set)
  • MOCK_MODE: Set to "true" for testing without API

Extension Configuration

VS Code Settings:

{
  "reviewerBot.apiKey": "your-gemini-api-key",
  "reviewerBot.reviewStyle": "funny",
  "reviewerBot.autoGenerateOnSave": false,
  "reviewerBot.enabledLanguages": ["go", "javascript", "typescript", "python"]
}

๐Ÿงช Testing

Test Backend

# Test with mock mode
MOCK_MODE=true go run main.go

# Test with sample data
echo '{"file_path": "test.go", "file_content": "func test() {}", "style": "funny"}' | go run main.go

Test Extension

  1. Open a sample file from /examples
  2. Run "ReviewerBot: Generate Reviews"
  3. Verify reviews appear above functions

๐Ÿ“ Project Structure

reviewer-bot/
โ”œโ”€โ”€ backend/                 # Go backend
โ”‚   โ”œโ”€โ”€ main.go             # Entry point
โ”‚   โ”œโ”€โ”€ parser/             # Function parsing
โ”‚   โ”œโ”€โ”€ gemini/             # Gemini API client
โ”‚   โ”œโ”€โ”€ review/             # Review generation
โ”‚   โ”œโ”€โ”€ types/              # Data structures
โ”‚   โ””โ”€โ”€ go.mod              # Go dependencies
โ”œโ”€โ”€ extension/              # VS Code extension
โ”‚   โ”œโ”€โ”€ src/                # TypeScript source
โ”‚   โ”œโ”€โ”€ package.json        # Extension manifest
โ”‚   โ””โ”€โ”€ tsconfig.json       # TypeScript config
โ”œโ”€โ”€ examples/               # Sample files
โ”‚   โ”œโ”€โ”€ sample.go
โ”‚   โ”œโ”€โ”€ sample.js
โ”‚   โ””โ”€โ”€ sample.py
โ””โ”€โ”€ README.md

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

๐Ÿ“ License

MIT License - see LICENSE file for details

๐Ÿ™ Acknowledgments

  • Google Gemini 2.0 Flash API for AI-powered reviews
  • VS Code Extension API for the development platform
  • Go community for the excellent standard library

๐Ÿ› Troubleshooting

Backend Issues

  • Executable not found: Ensure reviewer-bot.exe is in workspace root
  • API key invalid: Verify your Gemini API key
  • Permission errors: Check file permissions for executable

Extension Issues

  • Backend not found: Ensure Go executable is in workspace root
  • No reviews generated: Check file type support
  • Configuration errors: Verify settings in VS Code

Common Solutions

  1. Restart VS Code after configuration changes
  2. Check Developer Tools console for error messages
  3. Verify Go executable is in workspace root
  4. Test with mock mode first

Happy coding with ReviewerBot! ๐ŸŽ‰

About

An AI-powered VS Code extension that generates one-liner reviews above function definitions using Gemini 2.0 Flash API.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published