Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Extensible, AI-powered CLI and GitHub Action with plugin support, multi-language review & rich outputs.

Notifications You must be signed in to change notification settings

icelaterdc/AI-Code-Review-Pro

Repository files navigation

AI Code Review Pro

AI Code Review Pro is a powerful, extensible CLI tool and GitHub Action that automates code review using OpenAI’s language models. It helps teams maintain code quality, enforce style guidelines, and catch potential bugs before merging.


πŸ› οΈ Features

  • Modular Architecture: Core engine, CLI layer, plugin system and output handlers are decoupled.
  • Multi-Language Support: JavaScript, TypeScript, Python, Go, Rust, Java (easily extendable).
  • Plugin System: Write and share custom linting and style rules.
  • Flexible Outputs: Terminal, JSON, HTML, Markdown report formats.
  • Configurable Thresholds: Control sensitivity for style, security and best-practice suggestions.
  • GitHub Action: Automatically review pull requests on opened, synchronize, or reopened events.
  • Detailed Logs & Metrics: Structured logging via Winston, metrics for review duration and issue counts.
  • Built-In Testing: Jest-based test suite to validate parser and plugin behavior.

πŸ“‹ Prerequisites

  • Node.js v16 or later
  • npm v8 or later
  • An OpenAI API Key (GPT-4 capable)
  • GitHub repository with main branch

πŸ”§ Installation

  1. Clone the repository

    git clone https://github.com/icelaterdc/AI-Code-Review-Pro.git
    cd AI-Code-Review-Pro
  2. Install dependencies

    npm install
  3. Copy environment template

    cp .env.example .env
  4. Set your OpenAI key in .env

    OPENAI_API_KEY=sk-...
    

⚑ Quick Start

  1. Initialize default configuration

    npx AI-Code-Review-Pro init
  2. Run a review on your source folder

    npx AI-Code-Review-Pro review src/ --output html,json
  3. View report

    • Terminal output summarized
    • review-report.html autogenerated in project root

πŸ’» CLI Usage

Usage: ai-review-pro [options] [command]
Commands:
 review <path> Review code at specified file or directory
 init Generate default `aireview.config.js`
 plugin:install <plugin>
 Install a plugin from npm or local path
 help [command] Display help for command
Options:
 -V, --version output the version number
 -h, --help display help for command

Examples

  • Review single file

    npx AI-Code-Review-Pro review src/index.js
  • Review with JSON output

    npx AI-Code-Review-Pro review src/ -o json
  • Install community plugin

    npx AI-Code-Review-Pro plugin:install @my-org/review-plugin-security

βš™οΈ Configuration

Default config file: aireview.config.js in project root.

module.exports = {
 openaiModel: 'gpt-4o-mini', // Model name
 threshold: 0.75, // Confidence threshold (0.0 - 1.0)
 languages: ['js','ts','py'], // Extensions to review
 output: ['terminal','html'], // Output formats
 plugins: [ // Plugins to load
 './plugins/sample-plugin.js'
 ],
 rules: { // Built-in rule overrides
 'no-todo-comments': true,
 'max-line-length': 120
 }
};
  • openaiModel: Change to any supported OpenAI model.
  • threshold: Lower thresholds generate more suggestions.
  • languages: File extensions to include.
  • output: terminal, json, html, markdown.

🧩 Plugin Development

Create a plugin by extending the base Plugin class:

import { Plugin } from 'ai-review-pro/src/plugins/base.js';
export default class MyCustomPlugin extends Plugin {
 apply(review) {
 const { text, issues } = review;
 if (/eval\(/.test(text)) {
 review.addIssue({
 message: 'Avoid using eval(), it may introduce security risks.',
 severity: 'error',
 });
 }
 }
}
  • Place plugin file under plugins/
  • Reference in plugins array of config
  • Plugins can manipulate review.issues and metadata

πŸ“Š Outputs & Reports

  • Terminal: Colorized summary
  • JSON: Raw data for integrations
  • HTML: Styled report with sections per file
  • Markdown: For GitHub PR comments

All reports are saved in ./review-report.[ext] by default.


πŸ“ˆ Logging & Metrics

Using Winston for structured logs:

{
 level: 'info',
 transports: [new winston.transports.Console()]
}

Metrics collected:

  • Review start/end timestamps
  • Files processed count
  • Total issues found

πŸ§ͺ Testing

Run unit tests:

npm test

Includes parser and plugin behavior tests. Coverage reports generated under coverage/.


πŸ€— Contributing

  1. Fork the repo
  2. Create feature branch: git checkout -b feature/my-feature
  3. Commit changes: git commit -m 'Add new plugin support'
  4. Push: git push origin feature/my-feature
  5. Open a Pull Request

Please follow the Code of Conduct and Contributor Guidelines.


πŸ“œ License

MIT Β© 2025 IceLater


❓ FAQ

Q: How do I exclude files or directories? A: Add a .aireviewignore file with glob patterns to exclude.

Q: Can I review only staged changes? A: Yes, use --staged flag in review command (coming soon).

Q: Which OpenAI models are supported? A: Any model available through your API key; default is gpt-4o-mini.

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /