CodeReview — AI-Powered Code Review Assistant
Combines fast local regex pattern matching with deep AI-powered analysis to deliver thorough, actionable code reviews. Runs a local static analysis pre-pass first, then sends code and initial findings to an AI model for comprehensive review including bug detection, security analysis, performance suggestions, and style feedback.
How It Works
- Local Pre-Pass — Regex-based pattern matching runs instantly, catching hardcoded secrets, eval usage, SQL injection patterns, empty catch blocks, long functions, and more.
- AI Deep Review — The full source code and local findings are sent to your chosen AI model (Anthropic, OpenAI, or Ollama) for deep reasoning about bugs, logic errors, performance, and architecture.
- Graceful Fallback — If no API key is set or the AI call fails, you still get local static analysis results. Never blocks your workflow.
Usage
const { CodeReview } = require('./src/code-review');
// AI-powered review (default: anthropic/claude-haiku-4-5)
const reviewer = new CodeReview({ model: 'anthropic/claude-haiku-4-5' });
const result = await reviewer.review('./src/auth.js');
console.log(result.score); // 1-10
console.log(result.issues); // Array of issues with severity, line, type, message
console.log(result.suggestions); // Actionable improvement suggestions
console.log(result.summary); // Concise quality summary
console.log(result.aiPowered); // true
// Review an entire directory
const dirResult = await reviewer.reviewDir('./src', {
include: ['*.js', '*.ts'],
exclude: ['node_modules', '.git', 'dist'],
concurrency: 3
});
console.log(dirResult.averageScore);
console.log(dirResult.totalIssues);
Model Options
| Provider |
Example |
API Key Env Var |
| Anthropic |
anthropic/claude-haiku-4-5 |
ANTHROPIC_API_KEY |
| OpenAI |
openai/gpt-4o-mini |
OPENAI_API_KEY |
| Ollama (local) |
ollama/llama3 |
None required |
// OpenAI
const reviewer = new CodeReview({ model: 'openai/gpt-4o-mini' });
// Local Ollama
const reviewer = new CodeReview({ model: 'ollama/codellama' });
// Local-only (no AI, regex patterns only)
const reviewer = new CodeReview();
const result = await reviewer.review('./src/app.js');
// result.aiPowered === false
What It Catches
| Category |
Examples |
| Bugs |
Null references, off-by-one errors, race conditions, empty catch blocks |
| Security |
SQL injection, XSS, hardcoded secrets, eval usage |
| Performance |
N+1 queries, unnecessary loops, memory leaks |
| Style |
Inconsistent naming, long functions, dead code, console.log in production |
| Logic |
Unreachable code, redundant conditions |
| Maintainability |
Deeply nested callbacks, magic numbers, TODO/FIXME markers |
Output Format
{
"file": "./src/auth.js",
"score": 5,
"issues": [
{
"severity": "high",
"line": 42,
"type": "security",
"message": "User input passed directly to SQL query without parameterization"
},
{
"severity": "medium",
"line": 87,
"type": "bugs",
"message": "Empty catch block silently swallows database connection errors"
}
],
"suggestions": [
"Use parameterized queries or an ORM to prevent SQL injection on line 42",
"Add error logging in the catch block on line 87",
"Extract the authentication logic into a separate middleware module"
],
"summary": "The auth module has a critical SQL injection vulnerability and several error handling gaps. Core logic is sound but needs security hardening.",
"totalIssues": 2,
"lines": 142,
"aiPowered": true,
"model": "anthropic/claude-haiku-4-5"
}
Language Support
Works with any language your AI model understands. The local pre-pass targets common patterns across languages. AI review tested with:
JavaScript, TypeScript, Python, Go, Rust, Java, C#, Ruby, PHP, Swift, Kotlin
Technical Details
- Zero npm dependencies — Pure Node.js using only built-in
https, http, fs, and path modules
- File truncation — Files are truncated at 8,000 characters before sending to AI to stay within token limits
- Concurrency control — Directory reviews process files in configurable parallel batches (default: 3)
- Graceful degradation — AI failures never crash; local results are always available
⚠️ Disclaimer
This software is provided "AS IS", without warranty of any kind, express or implied.
USE AT YOUR OWN RISK.
- The author(s) are NOT liable for any damages, losses, or consequences arising from
the use or misuse of this software — including but not limited to financial loss,
data loss, security breaches, business interruption, or any indirect/consequential damages.
- This software does NOT constitute financial, legal, trading, or professional advice.
- Users are solely responsible for evaluating whether this software is suitable for
their use case, environment, and risk tolerance.
- No guarantee is made regarding accuracy, reliability, completeness, or fitness
for any particular purpose.
- The author(s) are not responsible for how third parties use, modify, or distribute
this software after purchase.
By downloading, installing, or using this software, you acknowledge that you have read
this disclaimer and agree to use the software entirely at your own risk.
DATA DISCLAIMER: When an AI model is configured, this software sends your source code and static analysis findings to the configured provider (Anthropic, OpenAI, or a local Ollama instance). Do not run it over code containing secrets or sensitive data unless you understand where data is sent. Without an API key, all analysis is local-only.
The author(s) are not responsible for data loss, corruption, or unauthorized access
resulting from software bugs, system failures, or user error. Always maintain
independent backups of important data. When AI models are configured, file contents
are sent to the respective AI provider's API (Anthropic, OpenAI, or your local Ollama
instance). No data is transmitted externally when running in local-only mode (no model configured).
Support & Links
Built with OpenClaw — thank you for making this possible.
🛠️ Need something custom? Custom OpenClaw agents & skills starting at $500. If you can describe it, I can build it. → Hire me on Fiverr
1---2name: codereview-automated-code-review-assistant-43description: AI-powered code review that combines fast local static analysis with deep AI reasoning. Catches bugs, security vulnerabilities, performance issues, and style problems. Supports Anthropic, OpenAI, and Ollama models. Falls back to local regex analysis when offline.4license: MIT5---67# CodeReview — AI-Powered Code Review Assistant89Combines **fast local regex pattern matching** with **deep AI-powered analysis** to deliver thorough, actionable code reviews. Runs a local static analysis pre-pass first, then sends code and initial findings to an AI model for comprehensive review including bug detection, security analysis, performance suggestions, and style feedback.1011---1213## How It Works14151. **Local Pre-Pass** — Regex-based pattern matching runs instantly, catching hardcoded secrets, eval usage, SQL injection patterns, empty catch blocks, long functions, and more.162. **AI Deep Review** — The full source code and local findings are sent to your chosen AI model (Anthropic, OpenAI, or Ollama) for deep reasoning about bugs, logic errors, performance, and architecture.173. **Graceful Fallback** — If no API key is set or the AI call fails, you still get local static analysis results. Never blocks your workflow.1819## Usage2021```javascript22const { CodeReview } = require('./src/code-review');2324// AI-powered review (default: anthropic/claude-haiku-4-5)25const reviewer = new CodeReview({ model: 'anthropic/claude-haiku-4-5' });26const result = await reviewer.review('./src/auth.js');2728console.log(result.score); // 1-1029console.log(result.issues); // Array of issues with severity, line, type, message30console.log(result.suggestions); // Actionable improvement suggestions31console.log(result.summary); // Concise quality summary32console.log(result.aiPowered); // true3334// Review an entire directory35const dirResult = await reviewer.reviewDir('./src', {36 include: ['*.js', '*.ts'],37 exclude: ['node_modules', '.git', 'dist'],38 concurrency: 339});40console.log(dirResult.averageScore);41console.log(dirResult.totalIssues);42```4344### Model Options4546| Provider | Example | API Key Env Var |47|----------|---------|-----------------|48| **Anthropic** | `anthropic/claude-haiku-4-5` | `ANTHROPIC_API_KEY` |49| **OpenAI** | `openai/gpt-4o-mini` | `OPENAI_API_KEY` |50| **Ollama** (local) | `ollama/llama3` | None required |5152```javascript53// OpenAI54const reviewer = new CodeReview({ model: 'openai/gpt-4o-mini' });5556// Local Ollama57const reviewer = new CodeReview({ model: 'ollama/codellama' });5859// Local-only (no AI, regex patterns only)60const reviewer = new CodeReview();61const result = await reviewer.review('./src/app.js');62// result.aiPowered === false63```6465## What It Catches6667| Category | Examples |68|----------|---------|69| **Bugs** | Null references, off-by-one errors, race conditions, empty catch blocks |70| **Security** | SQL injection, XSS, hardcoded secrets, eval usage |71| **Performance** | N+1 queries, unnecessary loops, memory leaks |72| **Style** | Inconsistent naming, long functions, dead code, console.log in production |73| **Logic** | Unreachable code, redundant conditions |74| **Maintainability** | Deeply nested callbacks, magic numbers, TODO/FIXME markers |7576## Output Format7778```json79{80 "file": "./src/auth.js",81 "score": 5,82 "issues": [83 {84 "severity": "high",85 "line": 42,86 "type": "security",87 "message": "User input passed directly to SQL query without parameterization"88 },89 {90 "severity": "medium",91 "line": 87,92 "type": "bugs",93 "message": "Empty catch block silently swallows database connection errors"94 }95 ],96 "suggestions": [97 "Use parameterized queries or an ORM to prevent SQL injection on line 42",98 "Add error logging in the catch block on line 87",99 "Extract the authentication logic into a separate middleware module"100 ],101 "summary": "The auth module has a critical SQL injection vulnerability and several error handling gaps. Core logic is sound but needs security hardening.",102 "totalIssues": 2,103 "lines": 142,104 "aiPowered": true,105 "model": "anthropic/claude-haiku-4-5"106}107```108109## Language Support110111Works with any language your AI model understands. The local pre-pass targets common patterns across languages. AI review tested with:112113JavaScript, TypeScript, Python, Go, Rust, Java, C#, Ruby, PHP, Swift, Kotlin114115## Technical Details116117- **Zero npm dependencies** — Pure Node.js using only built-in `https`, `http`, `fs`, and `path` modules118- **File truncation** — Files are truncated at 8,000 characters before sending to AI to stay within token limits119- **Concurrency control** — Directory reviews process files in configurable parallel batches (default: 3)120- **Graceful degradation** — AI failures never crash; local results are always available121122---123124## ⚠️ Disclaimer125126This software is provided "AS IS", without warranty of any kind, express or implied.127128**USE AT YOUR OWN RISK.**129130- The author(s) are NOT liable for any damages, losses, or consequences arising from131 the use or misuse of this software — including but not limited to financial loss,132 data loss, security breaches, business interruption, or any indirect/consequential damages.133- This software does NOT constitute financial, legal, trading, or professional advice.134- Users are solely responsible for evaluating whether this software is suitable for135 their use case, environment, and risk tolerance.136- No guarantee is made regarding accuracy, reliability, completeness, or fitness137 for any particular purpose.138- The author(s) are not responsible for how third parties use, modify, or distribute139 this software after purchase.140141By downloading, installing, or using this software, you acknowledge that you have read142this disclaimer and agree to use the software entirely at your own risk.143144145**DATA DISCLAIMER:** When an AI model is configured, this software sends your source code and static analysis findings to the configured provider (Anthropic, OpenAI, or a local Ollama instance). Do not run it over code containing secrets or sensitive data unless you understand where data is sent. Without an API key, all analysis is local-only.146The author(s) are not responsible for data loss, corruption, or unauthorized access147resulting from software bugs, system failures, or user error. Always maintain148independent backups of important data. When AI models are configured, file contents149are sent to the respective AI provider's API (Anthropic, OpenAI, or your local Ollama150instance). No data is transmitted externally when running in local-only mode (no model configured).151152---153154## Support & Links155156| | |157|---|---|158| 🐛 **Bug Reports** | TheShadowyRose@proton.me |159| ☕ **Ko-fi** | [ko-fi.com/theshadowrose](https://ko-fi.com/theshadowrose) |160| 🛒 **Gumroad** | [shadowyrose.gumroad.com](https://shadowyrose.gumroad.com) |161| 🐦 **Twitter** | [@TheShadowyRose](https://twitter.com/TheShadowyRose) |162| 🐙 **GitHub** | [github.com/TheShadowRose](https://github.com/TheShadowRose) |163| 🧠 **PromptBase** | [promptbase.com/profile/shadowrose](https://promptbase.com/profile/shadowrose) |164165*Built with [OpenClaw](https://github.com/openclaw/openclaw) — thank you for making this possible.*166167---168169🛠️ **Need something custom?** Custom OpenClaw agents & skills starting at $500. If you can describe it, I can build it. → [Hire me on Fiverr](https://www.fiverr.com/s/jjmlZ0v)