Jasper CLI Tool
Get AI-powered code reviews directly in your terminal before pushing to GitHub.
Overview
The Jasper CLI brings the power of AI code reviews to your local development workflow. Review staged changes, get feedback on uncommitted work, and catch issues before they reach your pull request.
Quick Start
npm install -g @jasper/cli
jasper auth login
jasper review
Installation
Install the Jasper CLI globally using npm:
npm install -g @jasper/cli
Verify the installation:
jasper --version
Authentication
Before using the CLI, you need to authenticate with your Jasper account:
Browser-Based Login (Recommended)
jasper auth login
This opens your browser for secure OAuth authentication.
Token-Based Login
For CI/CD environments or when browser login isn't available:
jasper auth login --token YOUR_API_TOKEN
Generate an API token from Settings → API Tokens in the Jasper dashboard.
Check Auth Status
jasper auth status
Code Review Commands
jasper review
Review staged changes (git add). The default and most common use case.
git add .
jasper review
jasper review --all
Review all uncommitted changes (staged and unstaged).
jasper review --all
jasper review --base <branch>
Compare against a specific base branch or commit.
jasper review --base main
jasper review --base origin/develop
jasper review --base abc1234
Output Formats
The CLI supports multiple output formats for different use cases:
# Table format (default - human readable)
jasper review
# JSON format (for parsing/integration)
jasper review --format json
# Markdown format (for documentation)
jasper review --format markdown
# GitHub Actions annotations
jasper review --format github
# SARIF for GitHub Code Scanning
jasper review --format sarif
Excluding Files
Skip certain files or directories from the review:
jasper review --exclude "*.test.js" --exclude "docs/**"
Auto-Fix Mode
Automatically apply suggested code fixes:
# Apply fixes with confirmation
jasper review --fix
# Apply fixes without prompting
jasper review --fix --force
Configuration
Create a .reviorc configuration file for project-specific settings:
jasper config init
Example .reviorc file:
{
"repository": "your-org/your-repo",
"output_format": "table",
"exclude_patterns": ["*.min.js", "vendor/**", "node_modules/**"],
"auto_fix": false
}
Configuration Commands
# Show current configuration
jasper config show
# Set a configuration value
jasper config set output_format json
Git Hooks Integration
Install automatic code review as a pre-push hook:
# Install pre-push hook
jasper hooks install
# Check hook status
jasper hooks status
# Remove hook
jasper hooks uninstall
With the hook installed, Jasper will automatically review your code before each push.
Skip Hook When Needed
Set REVIO_SKIP_HOOK=1 to bypass the pre-push review when needed.
PR Description Generator
Automatically generate professional PR descriptions from your feature branch:
jasper describe
Generate a PR description based on your commits and changes.
jasper describe
jasper describe --base <branch>
Compare against a specific base branch.
jasper describe --base develop
jasper describe --copy
Copy the generated description to your clipboard.
jasper describe --copy
What It Analyzes
- Commit messages and bodies since the base branch
- Files changed between branches
- Number of additions and deletions
- Code diff (when using
--include-diff)
Generated Output
The generated description includes:
- A clear, imperative PR title
- Summary of changes
- Key changes (bulleted list)
- Technical details
- Testing notes
- Breaking changes (if any)
- Suggested labels (feature, bug, refactor, etc.)
# Include code diff for more accurate descriptions
jasper describe --include-diff
# Add custom context for the AI
jasper describe --context "This fixes the login timeout bug"
# Output as JSON for integration
jasper describe --format json
Agent Mode
Start an interactive AI coding session for complex tasks like refactoring, debugging, or implementing features:
# Start a new agent session
jasper agent start
# Start in a specific directory
jasper agent start -d ./my-project
# Resume a previous session
jasper agent start --resume SESSION_ID
# Skip tool approval prompts
jasper agent start --auto-approve
# List your sessions
jasper agent sessions
# List only active sessions
jasper agent sessions -s active
# View usage statistics
jasper agent stats
# Stats for last 7 days
jasper agent stats -d 7
# Show agent configuration
jasper agent config
Available Tools
The agent can execute these tools on your local machine:
| Tool | Description |
|---|---|
Read | Read files with optional line range |
Write | Create or overwrite files |
Edit | Replace text in files |
Bash | Execute shell commands |
Glob | Find files matching patterns |
Grep | Search code with ripgrep |
Interactive Commands
While in a session, use these slash commands:
| Command | Description |
|---|---|
/help | Show available commands |
/status | Display session info and token usage |
/clear | Clear the screen |
/cancel | Cancel ongoing operation |
/exit | End the session |
Tool Approval
Some tools may require approval before execution. Use --auto-approve to skip prompts in trusted environments.
CI/CD Integration
GitHub Actions
name: Code Review
on: pull_request
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Jasper CLI
run: npm install -g @jasper/cli
- name: Run Review
env:
REVIO_API_TOKEN: {{ secrets.REVIO_API_TOKEN }}
run: jasper review --base origin/{{ github.base_ref }} --format github
Environment Variables
| Variable | Description |
|---|---|
REVIO_API_TOKEN |
API token for authentication (alternative to jasper auth login) |
REVIO_SKIP_HOOK |
Set to 1 to skip the pre-push hook |
Exit Codes
| Code | Meaning |
|---|---|
0 | Success - no issues found |
1 | Issues found in review |
2 | Error occurred |
3 | Authentication required |
4 | Configuration error |
Troubleshooting
Authentication Issues
# Clear credentials and re-authenticate
jasper auth logout
jasper auth login
Network Errors
The CLI includes automatic retry logic with exponential backoff. If you're behind a proxy,
ensure your HTTP_PROXY and HTTPS_PROXY environment variables are set.
Cache Issues
Review results are cached for 24 hours. To force a fresh review:
jasper review --no-cache
# Clear all cached results
jasper cache clear
# View cache statistics
jasper cache stats