PRIX / CLI.md
Rachit-Tw's picture
Upload 169 files
9284ad7 verified
|
Raw
History Blame Contribute Delete
3.44 kB

PRIX CLI - Local AI Code Review

Run AI-powered code reviews locally before pushing to GitHub.

Installation

npm install
npm run build
npm link

Quick Start

# Review staged files
prix-cli --staged

# Review changes since last commit
prix-cli --diff HEAD~1

# Review specific files
prix-cli --files src/app.ts,lib/util.ts

Pre-commit Hook

Install the pre-commit hook for automatic reviews:

npm run install-hooks

Or manually:

./scripts/install-hooks.sh

Configuration

Environment variables:

Variable Default Description
GROQ_API_KEY - Required. Groq API key
AI_API_KEY - Alternative API key
API_BASE_URL https://api.groq.com/openai/v1 API base URL
PRIX_MIN_SEVERITY minor Minimum severity (critical/major/minor/info)
PRIX_MIN_CONFIDENCE 60 Minimum confidence 0-100
PRIX_DISABLE false Set to true to skip reviews

Options

--staged              Review staged files (git diff --cached)
--diff <ref>         Review files changed since given git ref
--files <paths>      Review specific files (comma-separated)
--model <name>       LLM model to use (default: llama-3.1-8b-instant)
--min-confidence <n> Minimum confidence threshold (0-100)
--min-severity <lvl> Minimum severity to report (critical|major|minor|info)
--disable-review     Skip code review, only generate summary
--disable-notes      Skip release notes generation
--max-files <n>      Maximum files to review (0 = unlimited)
--path-filters <p>   Path filters (comma-separated, e.g., "src/**,lib/**")
--system-message <m> Additional system message
--language <lang>    Output language (default: en-US)
--output <fmt>       Output format: console (default) or json
--help, -h           Show help message

Exit Codes

Code Meaning
0 Success, no critical issues
1 Critical issues found (blocked in CI)

Examples

Basic Pre-commit Review

prix-cli --staged

Only Critical Issues

prix-cli --staged --min-severity critical --min-confidence 80

JSON Output for CI

prix-cli --staged --output json

Review Specific Paths

prix-cli --diff HEAD --path-filters "src/**,tests/**"

Workflow

  1. Write code and stage files with git add
  2. Run review with prix-cli --staged
  3. Fix issues or override with git commit --no-verify
  4. Push when satisfied with the review

GitHub Integration

The CLI works alongside the GitHub App:

  • Pre-commit (local): Catch obvious issues early, fast feedback
  • PR Review (GitHub App): Full context, semantic search, detailed analysis

Both use the same underlying AI models and confidence calibration.