CLI Reference

CLI Reference

All commands are available via npx @giolabsuy/ai-code-reviewer or via the global binary ai-code-reviewer.

review-pr

Reviews a GitHub pull request. Must run inside a GitHub Actions environment.

npx @giolabsuy/ai-code-reviewer review-pr [options]
OptionDescription
--dry-runPrint what would be posted without writing to GitHub
--min-severity <level>Override minSeverity from config
--save <path>Save a Markdown report to file
--config <path>Path to config file (default: .ai-review.yml)

Required environment variables:

VariableDescription
OPENAI_API_KEY(or ANTHROPIC_API_KEY, GEMINI_API_KEY)
GITHUB_TOKENProvided automatically by GitHub Actions
GITHUB_REPOSITORYProvided automatically by GitHub Actions
GITHUB_EVENT_PATHProvided automatically by GitHub Actions

Exit codes:

CodeMeaning
0Review completed, no request_changes recommendation
1Review posted with request_changes, or error

review-file

Reviews a single file.

npx @giolabsuy/ai-code-reviewer review-file <path> [options]
OptionDescription
--min-severity <level>Filter findings by severity
--save <path>Save a Markdown report to file
--config <path>Path to config file

Example:

npx @giolabsuy/ai-code-reviewer review-file src/users/users.service.ts

review-diff

Reviews a local git diff.

npx @giolabsuy/ai-code-reviewer review-diff [options]

Exactly one of --staged or --base is required.

OptionDescription
--stagedReview git diff --cached (staged changes)
--base <branch>Review git diff <branch>...HEAD
--min-severity <level>Filter findings by severity
--save <path>Save a Markdown report to file
--config <path>Path to config file

Examples:

# Review staged changes before committing
npx @giolabsuy/ai-code-reviewer review-diff --staged
 
# Review full feature branch against main
npx @giolabsuy/ai-code-reviewer review-diff --base main
 
# Review staged and only show major/critical
npx @giolabsuy/ai-code-reviewer review-diff --staged --min-severity major

handle-feedback

Handles developer @botai commands, both in inline PR comment thread replies and in general PR comments. Must run inside a GitHub Actions environment triggered by pull_request_review_comment or issue_comment. Supported commands: @botai approved (inline or general), @botai review """text""" (inline: evaluates one finding), @botai review (general comment: re-runs the full PR review with the conversation's feedback as context), @botai resolved, @botai dismiss, @botai explain (inline only). See Inline Feedback for details.

npx @giolabsuy/ai-code-reviewer handle-feedback [options]
OptionDescription
--config <path>Path to config file

Required environment variables:

VariableDescription
OPENAI_API_KEY(or ANTHROPIC_API_KEY, GEMINI_API_KEY)
GITHUB_TOKENProvided automatically by GitHub Actions
GITHUB_REPOSITORYProvided automatically by GitHub Actions
GITHUB_EVENT_PATHProvided automatically by GitHub Actions
GITHUB_ACTORProvided automatically by GitHub Actions

See Inline Feedback for the full workflow.

init

Creates a .ai-review.yml config file with all options documented.

npx @giolabsuy/ai-code-reviewer init

Writes .ai-review.yml to the current directory. Safe to run in any repo — it won't overwrite an existing file.

Severity levels

From highest to lowest:

LevelWhen used
criticalSecurity vulnerabilities, data loss risks
majorBugs, broken logic, serious performance issues
minorCode quality, potential improvements
infoInformational, best practices
nitpickStyle preferences, cosmetic

The --min-severity flag filters out everything below the specified level. For example, --min-severity major shows only major and critical findings.