lucai-cli
v1.1.2
Published
A powerful, AI-driven code review CLI that provides deep, contextual feedback using GPT-4o and Gemini 1.5 Pro.
Maintainers
Readme
lucai
⚠️ Under Construction
This bot is still in active development. Features may be incomplete or subject to change. We're working hard to make it production-ready!
A powerful, AI-driven code review CLI that goes beyond static analysis to provide deep, contextual feedback.
Overview
lucai is a command-line tool designed for developers, consultants, and teams who want to elevate their code quality. It uses AI to analyze code for architectural soundness, developer ergonomics, and strategic design flaws, providing insights that traditional linters and static analysis tools often miss.
Features
- AI-Powered Reviews: Get human-readable feedback on your code.
- Flexible Analysis: Review entire directories, single files, or git diffs.
- Multiple Output Formats: Choose from markdown, JSON, or inline comments.
- Customizable: Use different AI models and custom prompts.
- Project-Level Configuration: Define project-specific settings in a
.lucai.jsonfile for consistent reviews.
Handling Large Files
When lucai encounters a file that is too large for the selected AI model's context window, it automatically splits the file into smaller chunks. This allows lucai to review even very large files without running into context length issues. The chunks are processed individually and the feedback is then combined, giving you a complete picture of your code's quality.
Getting Started
Prerequisites
- Node.js (v14 or higher)
Installation
Clone or install the package:
- From Source:
git clone https://github.com/allglenn/lucai.git cd lucai npm install npm link - Via npm (once published):
npm install -g lucai
- From Source:
Configure your API Key: Run the
configurecommand. You will be prompted to select an AI provider (OpenAI or Google) and enter the corresponding API key.lucai configureThis will securely store your key for future use.
Generating API Keys
OpenAI:
- Go to the OpenAI API keys page.
- Click on "Create new secret key".
- Copy the key and paste it into the
lucai configureprompt when you selectopenai.
Google Gemini:
- Go to the Google AI Studio.
- Click on "Create API key".
- Copy the key and paste it into the
lucai configureprompt when you selectgoogle.
Usage
Review a directory:
lucai review --path ./srcReview a single file:
lucai review --file ./src/main.jsReview changed files in the last commit:
lucai review --diffReview with a specific model:
lucai review --path ./src --model gemini-1.5-pro-latestReview with a specific profile:
lucai review --profile securityProject-Level Configuration
You can configure lucai on a per-project basis by creating a .lucai.json file in your project's root directory. This file allows you to define default options and create custom review profiles.
Example .lucai.json:
{
"model": "gemini-1.5-pro-latest",
"output": "markdown",
"ignore": [
"dist/",
"**/*.test.js"
],
"reviewProfiles": {
"default": "Analyze this code for architectural soundness, developer ergonomics, and strategic design flaws.",
"security": "Analyze this code strictly for potential security vulnerabilities, such as injection flaws, broken authentication, and sensitive data exposure. Do not comment on style.",
"performance": "Review this code for performance bottlenecks and suggest optimizations."
}
}When you run lucai review, the options in this file will be used as defaults. You can override them with command-line flags.
To use a specific review profile, use the --profile option:
lucai review --profile security --path ./srcTo output the result to a markdown file:
bin/lucai.js review --profile security --path ./bin --output markdown --output-file security_review.mdCommands
| Command | Description |
|-------------|-----------------------------------------------------------|
| review | Perform an AI-enhanced code review on a directory or file. |
| configure | Configure your AI provider (OpenAI or Google) and API key. |
| help | Display the help guide. |
Review Command Options:
--path <path>: Path to a directory to scan.--file <file>: Path to a single file to scan.--diff: Review files changed in the last commit.--profile <name>: Run a review with a specific profile from your.lucai.json.
For a full list of options for the review command, run:
lucai review --helpAuthor
Created by Glenn Allogho
- Email:
[email protected] - LinkedIn: glenn-allogho
- Medium: @glennlenormand
- Twitter: @glenn_all
- GitHub: @allglenn
- GitLab: @glennlenormand
