CLI Reference
Complete guide to Codecora CLI. AI-powered code review before you commit.
What is Codecora CLI?
Codecora CLI is a command-line tool that brings AI code review to your local development workflow. Get instant feedback on your code changes before committing.
- Pre-commit review: Review code changes before they leave your machine
- Instant feedback: Get AI analysis in under 5 minutes
- Privacy-first: Only commit diffs are analyzed, then discarded immediately
- Flexible: Block commits on critical issues, or just get warnings
Installation
Prerequisites
- Node.js 20+ or Bun 1.0+
- A Codecora account (sign up at codecora.dev)
- An OpenAI-compatible API key configured in your workspace
Install via npm
npm install -g @codecora/cli Install via bun
bun install -g @codecora/cli Verify Installation
cora --version
# Output: 1.0.0Authentication
Login
cora auth login This will open your browser for authentication.
After successful login, your session token is stored securely in ~/.codecora/auth.json.
Check Status
cora auth status Shows your authentication status, email, and workspace information.
Logout
cora auth logout Clears your stored session token.
Basic Usage
Review Staged Changes
cora review Reviews all staged changes (files added with git add).
This is the default behavior and what you'll use most often.
Review Unstaged Changes
cora review --unstaged Reviews all unstaged changes (files modified but not added to staging).
Review Specific Files
cora review --files src/app.ts src/utils.ts Review Committed Changes
CORA CLI can also review changes that have already been committed. This is useful for reviewing feature branches before creating PRs, or reviewing work done by others.
Review Branch vs Main
cora review --base main Reviews all changes between the current branch and the main branch.
Review Last N Commits
cora review --commits 3 Reviews the last 3 commits.
Review Specific Commit Range
cora review --revision-range HEAD~5..HEAD Reviews changes between two specific commits.
Review Unpushed Commits
cora review --unpushed Reviews all commits that haven't been pushed to the remote yet.
Pre-commit Hooks
Automate code review by installing a git hook that runs before every commit.
Install Hook
cora hook install This installs a pre-commit hook in your repository. Now every time you run git commit,
CORA will review your changes first.
Quick Enable/Disable
# Enable auto review
cora enable
# Disable auto review
cora disable Block on Issues
cora hook install --type pre-commit By default, the hook will warn you but won't block commits. To block commits with critical issues, configure your workspace settings.
Skip Hook Temporarily
git commit -m "fix: something" --no-verify
# Or use environment variable:
CORA_SKIP=1 git commit -m "fix: something"Configuration
View Configuration
cora auth config Set Configuration
cora auth config serverUrl https://codecora.dev
cora auth config workspaceId abc123 Environment Variables
CORA_SKIP- Skip pre-commit hook when set to 1CORA_SERVER- Override server URLCORA_WORKSPACE- Override workspace ID
Output Formats
Pretty (Default)
cora review --format pretty Human-readable output with colors and formatting.
JSON
cora review --format json Machine-readable JSON output for CI/CD integration.
Compact
cora review --format compact Minimal output, just the essentials.
SARIF (for GitHub Advanced Security)
cora review --format sarif --output-file results.sarif Static Analysis Results Interchange Format for integration with GitHub Code Scanning and other security tools.
Review Focus Modes
Focus the AI review on specific aspects of your code for more targeted analysis.
Security-Focused Review
# Shorthand for security mode
cora review --security
# Or use the full flag
cora review --mode security Deep security vulnerability scanning including SQL injection, XSS, authentication flaws, and data exposure risks.
Other Focus Modes
# Performance-focused review
cora review --mode performance
# Architecture review
cora review --mode architecture
# Testing review
cora review --mode testing
# Logic review
cora review --mode logicAdvanced Options
Specify Workspace
cora review --workspace abc123 Specify Repository
cora review --repository owner/repo Specify Branch
cora review --branch feature/new-feature Include Full Walkthrough
cora review --include-walkthrough Include the complete AI walkthrough in the output (useful for understanding the analysis).
Limit Tokens
cora review --max-tokens 10000 Limit the maximum tokens to use for this review (helps control costs).
Output to File
cora review --format sarif --output-file results.sarif Write output to a file instead of stdout. Useful for CI/CD pipelines and SARIF uploads.
Configuration & Status
Initialize CORA
cora init Run a guided setup wizard for first-time configuration. Helps you choose between local development (OAuth) or CI/CD (API key) mode.
Check Configuration Status
cora config:status Shows your current authentication status, AI provider configuration, environment variables, and git hook status.
Check Token Usage
cora usage View your token quota and usage. Shows remaining tokens and quota reset date.
# JSON output for scripting
cora usage --json
# Check specific workspace
cora usage --workspace abc123Troubleshooting
Authentication Errors
- Make sure you've run
cora auth login - Check your session hasn't expired:
cora auth status - Re-authenticate if needed:
cora auth login
No AI Provider Configured
- Configure an AI provider in your workspace at codecora.dev
- Make sure you have API credits available
- Test your API key in the dashboard
Hook Not Running
- Verify the hook is installed:
cora hook list - Check hook permissions:
ls -la .git/hooks/pre-commit - Reinstall the hook:
cora hook uninstall && cora hook install
Permission Denied
- Make sure the hook file is executable:
chmod +x .git/hooks/pre-commit - Check that you have write permissions to the
.git/hooksdirectory
CI/CD Integration
Coming soon! Use Codecora CLI in your CI/CD pipeline for automated code review.
This will allow you to review committed changes, branches, or PRs in GitHub Actions, GitLab CI, Jenkins, and more.
Examples
Typical Workflow
# 1. Make changes to your code
vim src/app.ts
# 2. Stage changes
git add src/app.ts
# 3. Review before committing
cora review
# 4. If satisfied, commit
git commit -m "feat: add new feature" With Pre-commit Hook
# 1. Install hook once
cora enable
# 2. Make changes and stage
vim src/app.ts
git add src/app.ts
# 3. Commit - review runs automatically!
git commit -m "feat: add new feature"
# CORA CLI reviews your changes before commit completes Review Multiple Files
cora review --files src/*.ts tests/*.test.tsPlatform Support
Codecora CLI is cross-platform and works on:
- ✅ macOS (Apple Silicon + Intel)
- ✅ Linux (x64 + ARM64)
- ✅ Windows (x64 + ARM64)