GuidesCLIGetting started

This guide gets you from zero to a reviewed diff in under five minutes.

  1. 1

    Install

    Installs the CLI and deploys Mesrai skills to all detected AI agents (Claude Code, Cursor, Codex, Windsurf):

    curl -fsSL https://review-skill.com/install | bash
    Requires Node.js >= 20.0.0.

    Verify the install:

    mesrai --version
    mesrai status
  2. 2

    Authenticate

    Pick the path that matches your situation. You can also skip auth and run mesrai review directly — it works in trial mode with daily limits.

    Sign in with a personal account:

    mesrai auth login

    Tokens are stored in ~/.mesrai/credentials.json and auto-refreshed.

    Self-hosting Mesrai? Point the CLI to your API before authenticating:

    export MESRAI_API_URL=https://mesrai-api.yourcompany.com

    HTTPS is required except for localhost.

    Confirm the auth state:

    mesrai auth status
  3. 3

    Run your first review

    Inside any git repository with uncommitted changes:

    mesrai review

    The CLI analyzes your working tree diff, prints a summary, and (in interactive mode) lets you browse file-by-file, preview suggested fixes, and apply them.

    Common variations:

    mesrai review --staged             # Only staged files
    mesrai review --branch main        # Compare current branch against main
    mesrai review --commit abc123      # Analyze a single commit
    mesrai review --fix                # Auto-apply every fixable issue
    mesrai review --prompt-only        # Compact output for AI agents
    mesrai review --fail-on error      # Exit non-zero on error-or-worse (CI-friendly)

    Working-tree reviews (default) and --staged inline file contents so the backend sees your uncommitted changes. --branch and --commit modes skip inlining since the backend can fetch those commits itself — this is why those modes work well on huge branches.

  4. 4

Environment Variables

These env vars configure the CLI across all commands.

VariableDescription
MESRAI_API_URLAPI endpoint (default: https://api.mesrai.com)
MESRAI_TEAM_KEYTeam key for shared access and AI agents
MESRAI_TOKENCI/CD token generated via mesrai auth token
MESRAI_VERBOSESet to true for verbose output
MESRAI_SKIP_HOOKSet to 1 to skip the pre-push hook for a single git push
MESRAI_REQUEST_TIMEOUT_MINPer-request timeout in minutes (default: 60)
CF_ACCESS_CLIENT_IDCloudflare Access client ID (APIs behind Zero Trust)
CF_ACCESS_CLIENT_SECRETCloudflare Access client secret

For self-hosted setups, tokens, and Cloudflare Access, see Self-Hosted Setup.

Troubleshooting

Ran into an error? Check the Troubleshooting guide for common symptoms and fixes.