cr-ai
v1.0.43
Published
A terminal AI tool for code review with AI assistance using Gemini API
Maintainers
Readme
CR - Code Review Tool
A terminal-based code review tool from git changes (before commit) with AI assistance using Google's Gemini API.
Features
- Index code: Index current code in your project directory
- Initialize configuration: Set up the CR tool with a configuration file (CR.json)
- Review code changes: Automatically review git changes with AI assistance
- Git integration: Set up git hooks to run code review automatically on commit
- Customizable rules: Define your own code review rules
- AI-powered: Uses Google's Gemini API for intelligent code review

Installation
npm install -g cr-aiConfiguration
The tool uses a CR.json file for configuration with the following structure:
{
"index_source_path": "path to index source code",
"rules": [
"Check for security vulnerabilities",
"Ensure proper error handling",
"Verify code follows best practices"
],
"gemini_api_key": "your gemini api key",
"model_name": "gemini-2.0-flash",
"instruction": "Review this code for bugs, security issues, and best practices.",
"use_colors": true,
"light_review": false
}The model_name field specifies which Gemini model to use for code review. Supported models:
gemini-2.0-flash(default): Faster, more efficient modelgemini-1.5-flash: Balanced performance modelgemini-2.5-flash-preview-04-17: Latest preview model with advanced capabilities
The use_colors field controls whether the code review output uses colored formatting:
true(default): Display code reviews with colorful headers and syntax highlightingfalse: Display code reviews in plain text without colors
The light_review field controls the level of detail in code reviews:
false(default): Full review with all sections (SUMMARY, ISSUES, SUGGESTIONS, BEST PRACTICES, etc.)true: Light review with only ISSUES and BEST PRACTICES sections
Usage
Initialize the tool
cr initThis will guide you through creating a CR.json configuration file.
Index your code
cr indexThis will scan and index your codebase for better context during reviews.
Review code changes
cr changesThis will analyze your git changes and provide AI-powered code review feedback.
Set up git hooks
cr integrateThis will set up git hooks to automatically run code review on commit using Husky. The command preserves any existing pre-commit hooks, so it's safe to use in projects that already have other hooks configured (like ESLint).
Manage AI models
List available models
cr model listThis will display all available AI models for code review.
Show current model
cr model showThis will display the currently configured AI model.
Change the model
cr model changeThis will allow you to select a different AI model for code review.
Requirements
- Node.js >= 18 (required, the tool will warn you if using an older version)
- Git repository (for the
changesandintegratecommands) - Gemini API key (optional, but recommended for AI features)
- Husky (automatically installed by the
integratecommand)
License
MIT
