An open API service indexing awesome lists of open source software.

https://github.com/icelaterdc/ai-code-review-pro

Extensible, AI-powered CLI and GitHub Action with plugin support, multi-language review & rich outputs.
https://github.com/icelaterdc/ai-code-review-pro

ai-code-review ai-powered ai-powered-tools ai-review automated-code-review cicd code-quality extensible github-actions gpt-4 jest-test jest-tests lint multi-language-code-snippets openai-cli plugin-based review-climate terminal-code winston-logger winston-logging

Last synced: 1 day ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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**

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

```bash
npm install
```
3. **Copy environment template**

```bash
cp .env.example .env
```
4. **Set your OpenAI key** in `.env`

```text
OPENAI_API_KEY=sk-...
```

---

## ⚑ Quick Start

1. **Initialize default configuration**

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

```bash
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

```bash
Usage: ai-review-pro [options] [command]

Commands:
review Review code at specified file or directory
init Generate default `aireview.config.js`
plugin:install
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**

```bash
npx AI-Code-Review-Pro review src/index.js
```
* **Review with JSON output**

```bash
npx AI-Code-Review-Pro review src/ -o json
```
* **Install community plugin**

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

---

## βš™οΈ Configuration

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

```js
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:

```js
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:

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

Metrics collected:

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

---

## πŸ§ͺ Testing

Run unit tests:

```bash
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](CODE_OF_CONDUCT.md) and [Contributor Guidelines](CONTRIBUTING.md).

---

## πŸ“œ 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`.