@blockdeepanshu/ai-pr-review-cli 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -0
- package/LICENSE +21 -0
- package/README.md +470 -0
- package/batch-review.js +409 -0
- package/bin/cli.js +113 -0
- package/package.json +72 -0
- package/src/ai.js +38 -0
- package/src/config.js +52 -0
- package/src/git.js +190 -0
- package/src/prompt.js +22 -0
- package/src/reviewer.js +207 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to AI PR Review CLI will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.2.0] - 2026-03-22
|
|
6
|
+
|
|
7
|
+
### 🚀 Revolutionary File Processing
|
|
8
|
+
- **Unlimited File Support**: No more 10-file limits - review unlimited files
|
|
9
|
+
- **Intelligent Auto-Batching**: Built-in batching system processes files in groups of 5
|
|
10
|
+
- **Smart Rate Limiting**: 3-second delays between batches prevent API rate limit errors
|
|
11
|
+
- **Progress Tracking**: Real-time batch progress with detailed status updates
|
|
12
|
+
- **Error Recovery**: If one batch fails, others continue processing
|
|
13
|
+
|
|
14
|
+
### 🔧 Enhanced User Experience
|
|
15
|
+
- **Verbose Mode**: `--verbose` flag shows detailed processing information
|
|
16
|
+
- **File Content Debugging**: See exactly what files are being processed
|
|
17
|
+
- **Batch Status Updates**: Track progress through multiple batches
|
|
18
|
+
- **Consolidated Results**: All batch results combined into final comprehensive report
|
|
19
|
+
- **No Data Loss**: Every file gets reviewed, no truncation or skipping
|
|
20
|
+
|
|
21
|
+
### 🛠️ Technical Improvements
|
|
22
|
+
- **Improved Error Handling**: Better error messages and graceful failure recovery
|
|
23
|
+
- **Memory Efficient**: Processes files in manageable chunks
|
|
24
|
+
- **Scope Bug Fixes**: Fixed variable scope issues in batch processing
|
|
25
|
+
- **Performance Optimization**: Reduced memory usage and improved processing speed
|
|
26
|
+
|
|
27
|
+
### 📊 Better Output Format
|
|
28
|
+
- **Batch-by-Batch Results**: See results from each batch as it completes
|
|
29
|
+
- **Combined Final Results**: All findings consolidated into comprehensive summary
|
|
30
|
+
- **Processing Statistics**: Shows total batches and processing time
|
|
31
|
+
- **Enhanced Debugging**: Verbose mode shows file content previews and prompt sizes
|
|
32
|
+
|
|
33
|
+
## [1.1.0] - 2026-03-22
|
|
34
|
+
|
|
35
|
+
### 🚀 Major Features Added
|
|
36
|
+
- **Batch Processing**: Added intelligent batch review for large repositories
|
|
37
|
+
- **Universal Project Support**: Enhanced support for all project types (backend, frontend, mobile, DevOps)
|
|
38
|
+
- **Smart File Filtering**: Automatically skips generated files, node_modules, build artifacts
|
|
39
|
+
- **Rate Limit Handling**: Graceful handling of OpenAI API rate limits with retry logic
|
|
40
|
+
- **Frontend Optimization**: Special batching mode for React, Vue, Angular projects
|
|
41
|
+
|
|
42
|
+
### ✨ New Commands
|
|
43
|
+
- `ai-pr-review batch` - Intelligent batch processing for large repos
|
|
44
|
+
- `ai-pr-review batch --frontend` - Frontend-optimized batching
|
|
45
|
+
- `ai-pr-review batch --dry-run` - Preview batching without API calls
|
|
46
|
+
- `ai-pr-review config` - Global configuration management
|
|
47
|
+
|
|
48
|
+
### 🔧 Improvements
|
|
49
|
+
- **Better Error Handling**: Clear error messages for common issues (API key, rate limits, git errors)
|
|
50
|
+
- **Auto Branch Detection**: Automatically detects common base branches (main, master, develop)
|
|
51
|
+
- **Enhanced Prompt**: More effective prompts for finding bugs, security issues, and improvements
|
|
52
|
+
- **File Content Limits**: Smart truncation to prevent huge requests
|
|
53
|
+
- **Priority-Based Batching**: Reviews critical files first (API, services, components)
|
|
54
|
+
|
|
55
|
+
### 🛠️ Technical Enhancements
|
|
56
|
+
- **Universal File Grouping**: Intelligent grouping for any project type
|
|
57
|
+
- **Dynamic Batch Sizes**: Adjusts batch size based on file type and complexity
|
|
58
|
+
- **Package Lock Handling**: Special handling for large dependency files
|
|
59
|
+
- **JSON Extraction**: Robust parsing of AI responses even with formatting issues
|
|
60
|
+
|
|
61
|
+
### 📚 Documentation
|
|
62
|
+
- **Comprehensive README**: Complete rewrite with practical examples
|
|
63
|
+
- **Usage Examples**: Real-world workflows for different project types
|
|
64
|
+
- **Troubleshooting Guide**: Solutions for common problems
|
|
65
|
+
- **Platform Support**: Clear documentation for Windows, Mac, Linux
|
|
66
|
+
|
|
67
|
+
## [1.0.1] - 2026-03-21
|
|
68
|
+
|
|
69
|
+
### 🔧 Bug Fixes
|
|
70
|
+
- Fixed ES module compatibility issues with `ora` and `chalk`
|
|
71
|
+
- Improved Git operations error handling
|
|
72
|
+
- Updated GitHub repository links
|
|
73
|
+
|
|
74
|
+
## [1.0.0] - 2026-03-21
|
|
75
|
+
|
|
76
|
+
### 🎉 Initial Release
|
|
77
|
+
- **Basic PR Review**: Single-file and small repository review
|
|
78
|
+
- **OpenAI Integration**: GPT-powered code analysis
|
|
79
|
+
- **Git Integration**: Automatic diff detection and file analysis
|
|
80
|
+
- **Configurable**: Support for different AI models and base branches
|
|
81
|
+
- **Beautiful CLI**: Colorful output with clear categorization
|
|
82
|
+
|
|
83
|
+
### 📦 Core Features
|
|
84
|
+
- Issues detection (bugs, security, performance)
|
|
85
|
+
- Typo detection (spelling, grammar)
|
|
86
|
+
- Improvement suggestions (best practices, refactoring)
|
|
87
|
+
- Multiple configuration methods (CLI, file, environment)
|
|
88
|
+
- Cross-platform support (Windows, Mac, Linux)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AI PR Review CLI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
# 🤖 AI PR Review CLI
|
|
2
|
+
|
|
3
|
+
An intelligent command-line tool that uses AI to review your code changes and provide instant feedback on issues, typos, and improvements. Perfect for any programming language and project type.
|
|
4
|
+
|
|
5
|
+
## ✨ Key Features
|
|
6
|
+
|
|
7
|
+
- 🔍 **Smart Code Analysis** - Uses GPT to find bugs, security issues, and improvements
|
|
8
|
+
- 🎯 **Auto Branch Detection** - Automatically detects your base branch (main/master/develop)
|
|
9
|
+
- 🔄 **Intelligent Batching** - Processes ALL files in manageable batches (5 files per batch)
|
|
10
|
+
- 📊 **No File Limits** - Reviews unlimited files without losing any data
|
|
11
|
+
- ⚡ **Rate Limit Protection** - Smart delays between batches prevent API errors
|
|
12
|
+
- 🎨 **Beautiful Output** - Clean, colorful results with progress tracking
|
|
13
|
+
- 🌍 **Universal Support** - Works with any language, framework, or project type
|
|
14
|
+
- ⚙️ **Flexible Config** - Multiple ways to customize behavior
|
|
15
|
+
- 🛡️ **Error Recovery** - Continues processing even if one batch fails
|
|
16
|
+
|
|
17
|
+
## 🚀 Quick Start
|
|
18
|
+
|
|
19
|
+
### 1. Install
|
|
20
|
+
```bash
|
|
21
|
+
# Install globally
|
|
22
|
+
npm install -g @blockdeepanshu/ai-pr-review-cli
|
|
23
|
+
|
|
24
|
+
# Or use without installing
|
|
25
|
+
npx @blockdeepanshu/ai-pr-review-cli review
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 2. Get OpenAI API Key
|
|
29
|
+
Get your API key from [OpenAI](https://platform.openai.com/api-keys)
|
|
30
|
+
|
|
31
|
+
### 3. Set API Key
|
|
32
|
+
|
|
33
|
+
**Windows:**
|
|
34
|
+
```powershell
|
|
35
|
+
# PowerShell - current session
|
|
36
|
+
$env:OPENAI_API_KEY="your-api-key-here"
|
|
37
|
+
|
|
38
|
+
# Permanent (via System Properties > Environment Variables)
|
|
39
|
+
# Variable name: OPENAI_API_KEY
|
|
40
|
+
# Variable value: your-api-key-here
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Mac/Linux:**
|
|
44
|
+
```bash
|
|
45
|
+
# Current session
|
|
46
|
+
export OPENAI_API_KEY="your-api-key-here"
|
|
47
|
+
|
|
48
|
+
# Permanent (add to ~/.bashrc or ~/.zshrc)
|
|
49
|
+
echo 'export OPENAI_API_KEY="your-api-key-here"' >> ~/.bashrc
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 4. Use in Any Git Repository
|
|
53
|
+
```bash
|
|
54
|
+
# Navigate to your project
|
|
55
|
+
cd my-project
|
|
56
|
+
|
|
57
|
+
# Review your changes
|
|
58
|
+
ai-pr-review review
|
|
59
|
+
|
|
60
|
+
# Short alias also works
|
|
61
|
+
aipr review
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## 💻 Usage Examples
|
|
65
|
+
|
|
66
|
+
### Small Projects
|
|
67
|
+
```bash
|
|
68
|
+
# Simple review - auto-detects base branch
|
|
69
|
+
ai-pr-review review
|
|
70
|
+
|
|
71
|
+
# Review against specific branch
|
|
72
|
+
ai-pr-review review --base main
|
|
73
|
+
|
|
74
|
+
# Use GPT-4 for higher quality
|
|
75
|
+
ai-pr-review review --model gpt-4o
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Large Projects (Multiple Approaches)
|
|
79
|
+
|
|
80
|
+
**Method 1: Automatic Batching (Built-in)**
|
|
81
|
+
```bash
|
|
82
|
+
# The standard review now automatically batches files
|
|
83
|
+
ai-pr-review review # Processes ALL files in batches of 5
|
|
84
|
+
|
|
85
|
+
# With verbose output to see batching progress
|
|
86
|
+
ai-pr-review review --verbose
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Method 2: Advanced Batch Mode**
|
|
90
|
+
```bash
|
|
91
|
+
# Smart batching by file type (React, Vue, Angular, etc.)
|
|
92
|
+
ai-pr-review batch --frontend
|
|
93
|
+
|
|
94
|
+
# Custom batch size for different project needs
|
|
95
|
+
ai-pr-review batch --batch-size 6
|
|
96
|
+
|
|
97
|
+
# Preview what would be reviewed (no API calls)
|
|
98
|
+
ai-pr-review batch --dry-run
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Method 3: Selective Review**
|
|
102
|
+
```bash
|
|
103
|
+
# Review only specific files
|
|
104
|
+
git add src/important-file.js src/critical-component.js
|
|
105
|
+
ai-pr-review review # Only reviews staged files
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 📋 Common Workflows
|
|
109
|
+
|
|
110
|
+
### Feature Development
|
|
111
|
+
```bash
|
|
112
|
+
# Create feature branch
|
|
113
|
+
git checkout -b feature/new-feature
|
|
114
|
+
|
|
115
|
+
# Make changes, then review before committing
|
|
116
|
+
ai-pr-review review
|
|
117
|
+
|
|
118
|
+
# Address feedback, then commit
|
|
119
|
+
git add .
|
|
120
|
+
git commit -m "Implement new feature"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Large Codebase Updates
|
|
124
|
+
```bash
|
|
125
|
+
# Stage all changes
|
|
126
|
+
git add .
|
|
127
|
+
|
|
128
|
+
# Smart automatic batching handles everything
|
|
129
|
+
ai-pr-review review --verbose
|
|
130
|
+
|
|
131
|
+
# Example output for 23 files:
|
|
132
|
+
# 🔄 Processing 5 batches of files (5 files per batch)...
|
|
133
|
+
# --- Batch 1/5 ---
|
|
134
|
+
# Files: auth.js, login.js, middleware.js, routes.js, config.js
|
|
135
|
+
# ✅ Batch 1 completed: 3 issues, 1 typo, 4 improvements
|
|
136
|
+
# ⏳ Waiting 3 seconds before next batch...
|
|
137
|
+
# [continues for all batches...]
|
|
138
|
+
|
|
139
|
+
# Final consolidated results:
|
|
140
|
+
# 🚨 Issues: bugs, security, performance
|
|
141
|
+
# ✏️ Typos: spelling, grammar
|
|
142
|
+
# 💡 Improvements: best practices, refactoring
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Different Project Types
|
|
146
|
+
```bash
|
|
147
|
+
# Works automatically for any project:
|
|
148
|
+
cd react-frontend && ai-pr-review batch --frontend
|
|
149
|
+
cd node-api && ai-pr-review batch
|
|
150
|
+
cd python-ml && ai-pr-review batch
|
|
151
|
+
cd java-enterprise && ai-pr-review batch
|
|
152
|
+
cd devops-terraform && ai-pr-review batch
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## ⚙️ Configuration Options
|
|
156
|
+
|
|
157
|
+
### Global Config (One-time Setup)
|
|
158
|
+
```bash
|
|
159
|
+
# Set default preferences
|
|
160
|
+
ai-pr-review config --model gpt-4o-mini --base main
|
|
161
|
+
|
|
162
|
+
# Creates ~/.aiprconfig.json with your defaults
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Project Config (.aiprconfig.json)
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"provider": "openai",
|
|
169
|
+
"model": "gpt-4o-mini",
|
|
170
|
+
"baseBranch": "develop"
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Command Line Options
|
|
175
|
+
| Option | Description | Example |
|
|
176
|
+
|--------|-------------|---------|
|
|
177
|
+
| `--base <branch>` | Compare against specific branch | `--base origin/develop` |
|
|
178
|
+
| `--model <model>` | Use specific AI model | `--model gpt-4o` |
|
|
179
|
+
| `--verbose` | Show detailed analysis info | `--verbose` |
|
|
180
|
+
| `--batch-size <n>` | Files per batch (default: 8) | `--batch-size 4` |
|
|
181
|
+
| `--frontend` | Optimize for frontend projects | `--frontend` |
|
|
182
|
+
| `--dry-run` | Preview without API calls | `--dry-run` |
|
|
183
|
+
|
|
184
|
+
## 🎯 What Gets Analyzed
|
|
185
|
+
|
|
186
|
+
### Code Changes
|
|
187
|
+
- ✅ **Committed changes** (between branches)
|
|
188
|
+
- ✅ **Staged changes** (`git add`)
|
|
189
|
+
- ✅ **Working directory changes** (uncommitted)
|
|
190
|
+
|
|
191
|
+
### File Types Supported
|
|
192
|
+
- **Web**: JavaScript, TypeScript, HTML, CSS, SCSS
|
|
193
|
+
- **Backend**: Python, Java, Go, Ruby, PHP, C#
|
|
194
|
+
- **Mobile**: React Native, Flutter, Swift, Kotlin
|
|
195
|
+
- **DevOps**: Terraform, Docker, Kubernetes, YAML
|
|
196
|
+
- **Data**: SQL, R, Jupyter notebooks
|
|
197
|
+
- **Config**: JSON, YAML, TOML, XML
|
|
198
|
+
- **Documentation**: Markdown, reStructuredText
|
|
199
|
+
|
|
200
|
+
## 🔄 How Batching Works
|
|
201
|
+
|
|
202
|
+
### Automatic Batching (Default)
|
|
203
|
+
The tool automatically processes files in batches to handle any number of files efficiently:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
ai-pr-review review # Automatically batches files
|
|
207
|
+
|
|
208
|
+
# Example with 23 files:
|
|
209
|
+
📁 Found 23 changed files: auth.js, login.js, config.js...
|
|
210
|
+
|
|
211
|
+
🔄 Processing 5 batches of files (5 files per batch)...
|
|
212
|
+
|
|
213
|
+
--- Batch 1/5 ---
|
|
214
|
+
Files: auth.js, login.js, middleware.js, routes.js, config.js
|
|
215
|
+
✅ Batch 1 completed: 3 issues, 1 typo, 4 improvements
|
|
216
|
+
⏳ Waiting 3 seconds before next batch...
|
|
217
|
+
|
|
218
|
+
--- Batch 2/5 ---
|
|
219
|
+
Files: utils.js, helpers.js, constants.js, api.js, db.js
|
|
220
|
+
✅ Batch 2 completed: 2 issues, 0 typos, 3 improvements
|
|
221
|
+
⏳ Waiting 3 seconds before next batch...
|
|
222
|
+
|
|
223
|
+
[... continues for all files ...]
|
|
224
|
+
|
|
225
|
+
📋 Final Summary: 12 issues, 4 typos, 18 improvements
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Benefits
|
|
229
|
+
- ✅ **No File Limits** - Reviews unlimited files
|
|
230
|
+
- ✅ **Rate Limit Safe** - 3-second delays prevent API errors
|
|
231
|
+
- ✅ **Progress Tracking** - See which batch is processing
|
|
232
|
+
- ✅ **Error Recovery** - If one batch fails, others continue
|
|
233
|
+
- ✅ **Memory Efficient** - Processes files in manageable chunks
|
|
234
|
+
|
|
235
|
+
## 🔧 Troubleshooting
|
|
236
|
+
|
|
237
|
+
### Rate Limit Errors (429)
|
|
238
|
+
```bash
|
|
239
|
+
# The tool now automatically handles rate limits with batching
|
|
240
|
+
ai-pr-review review # Built-in 3-second delays between batches
|
|
241
|
+
|
|
242
|
+
# For very large projects, use advanced batch mode
|
|
243
|
+
ai-pr-review batch --batch-size 3 # Smaller batches
|
|
244
|
+
|
|
245
|
+
# Or wait 1-2 minutes and retry
|
|
246
|
+
ai-pr-review review
|
|
247
|
+
|
|
248
|
+
# Consider upgrading OpenAI plan for higher limits
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### No Changes Found
|
|
252
|
+
```bash
|
|
253
|
+
# Check git status
|
|
254
|
+
git status
|
|
255
|
+
|
|
256
|
+
# Make sure you're not on the main branch
|
|
257
|
+
git checkout -b feature/my-changes
|
|
258
|
+
|
|
259
|
+
# Or specify different base branch
|
|
260
|
+
ai-pr-review review --base origin/master
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### API Key Issues
|
|
264
|
+
```bash
|
|
265
|
+
# Verify key is set
|
|
266
|
+
echo $OPENAI_API_KEY # Mac/Linux
|
|
267
|
+
echo $env:OPENAI_API_KEY # Windows PowerShell
|
|
268
|
+
|
|
269
|
+
# Test with simple review
|
|
270
|
+
ai-pr-review review --verbose
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## 💡 Pro Tips
|
|
274
|
+
|
|
275
|
+
### Efficient Workflows
|
|
276
|
+
```bash
|
|
277
|
+
# Review before committing
|
|
278
|
+
git add changed-files/
|
|
279
|
+
ai-pr-review review
|
|
280
|
+
# Fix issues, then commit
|
|
281
|
+
|
|
282
|
+
# Review large changes in batches
|
|
283
|
+
ai-pr-review batch --dry-run # Preview
|
|
284
|
+
ai-pr-review batch # Execute
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Cost Optimization
|
|
288
|
+
```bash
|
|
289
|
+
# Use mini model for regular reviews (cheaper)
|
|
290
|
+
ai-pr-review review --model gpt-4o-mini
|
|
291
|
+
|
|
292
|
+
# Use GPT-4 for critical reviews (more thorough)
|
|
293
|
+
ai-pr-review review --model gpt-4o
|
|
294
|
+
|
|
295
|
+
# Set as default
|
|
296
|
+
ai-pr-review config --model gpt-4o-mini
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Shell Aliases
|
|
300
|
+
```bash
|
|
301
|
+
# Add to ~/.bashrc or ~/.zshrc
|
|
302
|
+
alias review="ai-pr-review review"
|
|
303
|
+
alias batch-review="ai-pr-review batch"
|
|
304
|
+
alias quick-review="ai-pr-review review --model gpt-4o-mini"
|
|
305
|
+
|
|
306
|
+
# Usage
|
|
307
|
+
review --base develop
|
|
308
|
+
batch-review --frontend
|
|
309
|
+
quick-review
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## 🌍 Platform Support
|
|
313
|
+
|
|
314
|
+
| Platform | Status | Notes |
|
|
315
|
+
|----------|--------|-------|
|
|
316
|
+
| **GitHub** | ✅ | Full support |
|
|
317
|
+
| **GitLab** | ✅ | Full support |
|
|
318
|
+
| **Bitbucket** | ✅ | Full support |
|
|
319
|
+
| **Azure DevOps** | ✅ | Full support |
|
|
320
|
+
| **Local Git** | ✅ | Works without remote |
|
|
321
|
+
|
|
322
|
+
## 📊 Sample Output
|
|
323
|
+
|
|
324
|
+
### Single File Review
|
|
325
|
+
```bash
|
|
326
|
+
git add problematic-file.js
|
|
327
|
+
ai-pr-review review
|
|
328
|
+
|
|
329
|
+
🤖 AI PR Review
|
|
330
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
331
|
+
|
|
332
|
+
📊 Analyzing changes on branch: feature/auth-fixes
|
|
333
|
+
📁 Found 1 changed file: problematic-file.js
|
|
334
|
+
|
|
335
|
+
🔄 Processing 1 batch of files (5 files per batch)...
|
|
336
|
+
|
|
337
|
+
--- Batch 1/1 ---
|
|
338
|
+
Files: problematic-file.js
|
|
339
|
+
✅ Batch 1 completed: 3 issues, 1 typo, 2 improvements
|
|
340
|
+
✔ Review completed!
|
|
341
|
+
|
|
342
|
+
🚨 Issues
|
|
343
|
+
1. Invalid JavaScript syntax: unexpected semicolon and commas
|
|
344
|
+
2. Missing input validation for user input
|
|
345
|
+
3. Use const instead of var for better scoping
|
|
346
|
+
|
|
347
|
+
✏️ Typos
|
|
348
|
+
1. "recieve" should be "receive" in comment
|
|
349
|
+
|
|
350
|
+
💡 Improvements
|
|
351
|
+
1. Add proper error handling
|
|
352
|
+
2. Remove unused variables
|
|
353
|
+
|
|
354
|
+
📋 Review Summary: 3 issues, 1 typo, 2 improvements
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Large Project Review
|
|
358
|
+
```bash
|
|
359
|
+
git add . # 23 files
|
|
360
|
+
ai-pr-review review --verbose
|
|
361
|
+
|
|
362
|
+
🤖 AI PR Review
|
|
363
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
364
|
+
|
|
365
|
+
📊 Analyzing changes on branch: feature/auth-system
|
|
366
|
+
📁 Found 23 changed files: auth.js, login.js, middleware.js, routes.js...
|
|
367
|
+
|
|
368
|
+
🔄 Processing 5 batches of files (5 files per batch)...
|
|
369
|
+
|
|
370
|
+
--- Batch 1/5 ---
|
|
371
|
+
Files: auth.js, login.js, middleware.js, routes.js, config.js
|
|
372
|
+
🔍 Debug - Files with content:
|
|
373
|
+
1. auth.js (1,240 chars): "const jwt = require('jsonwebtoken'); const bcrypt..."
|
|
374
|
+
2. login.js (856 chars): "// Login component with validation..."
|
|
375
|
+
✅ Batch 1 completed: 4 issues, 1 typo, 3 improvements
|
|
376
|
+
⏳ Waiting 3 seconds before next batch...
|
|
377
|
+
|
|
378
|
+
--- Batch 2/5 ---
|
|
379
|
+
Files: utils.js, helpers.js, constants.js, api.js, db.js
|
|
380
|
+
✅ Batch 2 completed: 2 issues, 0 typos, 4 improvements
|
|
381
|
+
⏳ Waiting 3 seconds before next batch...
|
|
382
|
+
|
|
383
|
+
[... continues for all 5 batches ...]
|
|
384
|
+
|
|
385
|
+
✔ Review completed!
|
|
386
|
+
|
|
387
|
+
🚨 Issues
|
|
388
|
+
1. Missing input validation in auth.js:15
|
|
389
|
+
2. Potential SQL injection in routes.js:42
|
|
390
|
+
3. Password stored in plain text - use bcrypt
|
|
391
|
+
[... 9 more issues ...]
|
|
392
|
+
|
|
393
|
+
✏️ Typos
|
|
394
|
+
1. "recieve" should be "receive" in comment (auth.js:8)
|
|
395
|
+
[... 2 more typos ...]
|
|
396
|
+
|
|
397
|
+
💡 Improvements
|
|
398
|
+
1. Add rate limiting to login endpoint
|
|
399
|
+
2. Use environment variables for JWT secret
|
|
400
|
+
[... 16 more improvements ...]
|
|
401
|
+
|
|
402
|
+
📋 Review Summary: 12 issues, 3 typos, 19 improvements
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
## 🔐 Security & Privacy
|
|
406
|
+
|
|
407
|
+
- Code is sent to OpenAI's API for analysis
|
|
408
|
+
- No permanent storage of your code
|
|
409
|
+
- Use `.gitignore` to exclude sensitive files
|
|
410
|
+
- Review OpenAI's [data usage policies](https://openai.com/policies/api-data-usage-policies)
|
|
411
|
+
- Consider using on non-production codebases first
|
|
412
|
+
|
|
413
|
+
## 📊 Performance for Any Repository Size
|
|
414
|
+
|
|
415
|
+
### Smart Handling of Large Codebases
|
|
416
|
+
| Repository Size | Processing Method | Time | Success Rate |
|
|
417
|
+
|----------------|------------------|------|--------------|
|
|
418
|
+
| **1-5 files** | Single batch | ~10 seconds | ✅ 100% |
|
|
419
|
+
| **6-25 files** | 2-5 batches | ~30-60 seconds | ✅ 100% |
|
|
420
|
+
| **26-100 files** | 5-20 batches | 2-5 minutes | ✅ 100% |
|
|
421
|
+
| **100+ files** | Smart batching | 5-15 minutes | ✅ 100% |
|
|
422
|
+
|
|
423
|
+
### Before vs After
|
|
424
|
+
- **Old Approach**: Limited to 10 files = Many files ignored ❌
|
|
425
|
+
- **New Approach**: Unlimited files in smart batches = All files reviewed ✅
|
|
426
|
+
|
|
427
|
+
### Real-World Examples
|
|
428
|
+
```bash
|
|
429
|
+
# Small project (5 files)
|
|
430
|
+
📁 Found 5 files → 🔄 1 batch → ✅ ~15 seconds
|
|
431
|
+
|
|
432
|
+
# Medium project (23 files)
|
|
433
|
+
📁 Found 23 files → 🔄 5 batches → ✅ ~90 seconds
|
|
434
|
+
|
|
435
|
+
# Large project (87 files)
|
|
436
|
+
📁 Found 87 files → 🔄 18 batches → ✅ ~8 minutes
|
|
437
|
+
|
|
438
|
+
# Enterprise project (200+ files)
|
|
439
|
+
📁 Found 234 files → 🔄 47 batches → ✅ ~15 minutes
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### Efficiency Features
|
|
443
|
+
- ✅ **No File Limits** - Review unlimited files
|
|
444
|
+
- ✅ **Smart Rate Limiting** (3-second delays between batches)
|
|
445
|
+
- ✅ **Progress Tracking** for long reviews
|
|
446
|
+
- ✅ **Error Recovery** - continues even if one batch fails
|
|
447
|
+
- ✅ **Memory Efficient** - processes in manageable chunks
|
|
448
|
+
|
|
449
|
+
## 📄 License
|
|
450
|
+
|
|
451
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
452
|
+
|
|
453
|
+
## 🤝 Contributing
|
|
454
|
+
|
|
455
|
+
Contributions welcome! Feel free to:
|
|
456
|
+
- Report bugs or request features
|
|
457
|
+
- Submit pull requests
|
|
458
|
+
- Improve documentation
|
|
459
|
+
- Share usage examples
|
|
460
|
+
|
|
461
|
+
## 📞 Support
|
|
462
|
+
|
|
463
|
+
- **Issues**: [GitHub Issues](https://github.com/blockDeepanshu/ai-pr-review/issues)
|
|
464
|
+
- **Discussions**: [GitHub Discussions](https://github.com/blockDeepanshu/ai-pr-review/discussions)
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
**Made with ❤️ for developers who want smarter code reviews**
|
|
469
|
+
|
|
470
|
+
*Save time, catch bugs, and improve code quality with AI-powered reviews* 🚀
|