local-ai-reviewer
v1.0.1
Published
π Privacy-first AI code reviewer using local LLM models. Zero data transmission, 100% offline code analysis for security, performance, and bugs. Works with Ollama!
Maintainers
Readme
Local AI Reviewer π
π Privacy-first AI code reviewer that never sends your code anywhere!
Analyze your code for security vulnerabilities, performance issues, and bugs using powerful local AI models. 100% offline, 100% private.
Automatically review your code for security vulnerabilities, performance issues, bugs, and maintainability problems using local AI models. No data leaves your machine!
Features
β
Local AI Models - Uses Ollama for complete privacy
β
Multi-language Support - JavaScript, TypeScript, Python, Java, C++, Go, Rust, PHP
β
Comprehensive Analysis - Security, performance, bugs, style, maintainability
β
Multiple Output Formats - Console, JSON, Markdown
β
Configurable - Customize patterns, severity levels, and review types
β
CLI & Programmatic - Use as command-line tool or library
Installation
npm install -g local-ai-reviewerPrerequisites
Install Ollama for local AI models:
# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh
# Start Ollama service
ollama serve
# Pull a code model (recommended)
ollama pull codellama:7bQuick Start
1. Initialize configuration:
ai-review init2. Review your code:
ai-review review3. Review specific directory:
ai-review review ./srcConfiguration
The ai-review.json file created by init:
{
"model": "codellama:7b",
"temperature": 0.1,
"maxTokens": 2000,
"includePatterns": ["**/*.{js,ts,jsx,tsx,py,java}"],
"excludePatterns": ["**/node_modules/**", "**/dist/**"],
"reviewTypes": ["security", "performance", "bugs", "maintainability"],
"outputFormat": "console",
"severity": "medium"
}CLI Commands
# Initialize config file
ai-review init
# Review current directory
ai-review review
# Review with custom options
ai-review review ./src --model codellama:13b --output markdown
# Save report to file
ai-review review --save report.md
# List recommended models
ai-review modelsReview Types
- Security - SQL injection, XSS, insecure patterns
- Performance - Inefficient algorithms, memory leaks
- Bugs - Logic errors, null pointer exceptions
- Style - Code formatting, naming conventions
- Maintainability - Complex functions, code smells
- Complexity - Cyclomatic complexity, nested loops
Output Formats
Console (Default)
ai-review reviewJSON
ai-review review --output jsonMarkdown
ai-review review --output markdown --save report.mdRecommended Models
| Model | Size | Description |
|-------|------|-------------|
| codellama:7b | 3.8GB | Fast, good for basic review |
| codellama:13b | 7.3GB | Better accuracy, slower |
| deepseek-coder:6.7b | 3.8GB | Excellent for code analysis |
| starcoder:7b | 4.1GB | Good for multiple languages |
Programmatic Usage
import { AICodeReviewer, ReviewConfig } from 'local-ai-reviewer';
const config: ReviewConfig = {
model: 'codellama:7b',
temperature: 0.1,
maxTokens: 2000,
includePatterns: ['**/*.ts'],
excludePatterns: ['**/*.test.ts'],
reviewTypes: ['security', 'bugs'],
outputFormat: 'json',
severity: 'medium'
};
const reviewer = new AICodeReviewer(config);
const result = await reviewer.review('./src');
const report = await reviewer.generateReport(result);
console.log(report);Example Output
π€ AI Code Review Report
==================================================
π Summary:
Files Reviewed: 15
Total Issues: 8
Execution Time: 45.2s
π― Issues by Severity:
HIGH: 2
MEDIUM: 4
LOW: 2
π Detailed Issues:
--------------------------------------------------
1. Potential SQL Injection Vulnerability
File: src/database.ts (Line 23)
Type: security | Severity: HIGH
Description:
Direct string concatenation in SQL query without parameterization
π‘ Suggestion:
Use parameterized queries or prepared statementsPrivacy & Security
- β 100% Local - All processing happens on your machine
- β No Data Transmission - Code never leaves your environment
- β Open Source - Full transparency
- β Offline Capable - Works without internet connection
Supported Languages
- JavaScript/TypeScript
- Python
- Java
- C/C++
- Go
- Rust
- PHP
- Ruby
- C#
- Swift
- Kotlin
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
MIT
Support
- π Documentation
- π Issues
- π¬ Discussions
Made with β€οΈ for developers who value privacy
