Product · CLI

Review code before you push.
From the terminal.

The lgtm CLI runs the same 6-agent pipeline your PRs get — against your local diff, in 30 seconds, before anyone else sees the code.

npm i -g @tarin/lgtm-cli
lgtm login
lgtm review

Three workflows the CLI is built for

Same review pipeline, three integration points.

Pre-push review

Catch it before the team sees it

Run lgtm review against your working-tree diff before you git push. Findings stream live in the terminal; you get the verdict before your colleagues even see the PR open.

CI integration

Block bad merges before review

Add lgtm review --pr $PR_NUMBER --json to your CI pipeline. Pipe to jq for custom logic, or just check the exit code — non-zero on critical findings.

Solo dev flow

Your own AI pair, on demand

No team, no PRs, no CI? Just lgtm review your local changes any time. The CLI hits the same agents the dashboard uses — including security scanning and your repo's context.

Command reference

Run lgtm --help for the full list. Every command has --help too. --json is available on every read command for scripting.

Code review

lgtm review

Review working-tree diff vs detected default branch

lgtm review --staged

Review staged diff only

lgtm review --pr 42

Trigger a review on PR #42

lgtm review --base develop

Override base branch

lgtm review --provider openai --model gpt-4o

Override AI provider + model

lgtm pr list

List recent reviewed PRs

lgtm pr view 42

Show PR #42 review verdict + findings

Repository

lgtm repo connect

Connect current repo to LGTM

lgtm repo status

Show connection + index state

lgtm repo index

Build/refresh tree-sitter context index

lgtm repo settings

View/update per-repo settings

LGTM Security

lgtm security enroll

Enroll repo for CI/CD security scanning

lgtm security list

List enrolled repos with posture counts

lgtm security scan

Trigger a manual scan

lgtm security audit

View immutable audit log

lgtm security tokens create

Mint a runtime watchdog token

Configuration

lgtm config set-key

Add a provider API key (validates against provider)

lgtm config set-model

Set default model

lgtm config show

Show config (table or --json)

lgtm config remove-key

Remove a provider key

Billing

lgtm billing status

Plan + quota + grace/cancel state

lgtm billing cancel

Schedule cancel-at-period-end

lgtm billing portal

Open Dodo customer portal

Auth + account

lgtm login

Authenticate via GitHub OAuth (opens browser)

lgtm whoami

Show user, plan, AI config

lgtm doctor

Diagnose setup issues (auth, network, key, consent)

lgtm consent accept

Accept current Terms + Privacy versions

lgtm account delete

Delete account (type-DELETE confirm)

--json for scripting

Every read command emits structured JSON when --json is passed. Pipe it into jq, yq, or anything else.

# Fail CI if any critical finding lands
lgtm review --pr 42 --json | jq -e '.findings | map(select(.severity == "critical")) | length == 0'

# Get reviews-remaining for monitoring
lgtm whoami --json | jq -r '.billing.reviewsRemaining'

# List active security tokens, expire any older than 30 days
lgtm security tokens list --json | jq '.tokens[] | select(.createdAt | fromdate < (now - 30*86400))'

Errors that tell you what to do

Every error has a stable code and a one-line hint. Script around them; don't parse error messages.

not_logged_in

Run lgtm login

pro_required

Feature behind paywall · lgtm open pricing

billing_limit

Free quota exhausted (20/mo)

consent_required

Accept current Terms + Privacy · lgtm consent accept

rate_limited

Slow down, retry in a few seconds

network_error

Check internet, status page

auth_expired

Re-login

server_error

Server 5xx; usually transient

What gets installed

Pure TypeScript CLI, ~3 MB unpacked. Single binary entry point. No native dependencies; runs anywhere Node 20+ does (Linux, macOS, Windows, WSL, CI runners).

Package@tarin/lgtm-cli
Latestv2.1.1
Node requirement≥ 18 (recommended 20+)
Install size~3 MB unpacked, ~54 KB compressed
Update notifierBuilt-in (once per 24h)
Shell completionbash · zsh · fish (via lgtm completion)
Config location~/.lgtm/config.json
Env override~/.lgtm/.env
LicenseMIT

FAQ

Does the CLI use my Pro quota?

Yes — running lgtm review counts the same as triggering a review from the dashboard. On Free that's 20/mo; on Pro it's unlimited. The CLI doesn't bypass billing.

Can I use the CLI without a GitHub App install?

For lgtm review on a local diff, no GitHub App needed — the CLI sends the diff directly. For lgtm review --pr against a real PR, the repo must be connected to LGTM (which needs the GitHub App).

Does the CLI store my AI provider key?

Your key lives in your dashboard config — encrypted at rest on the server. The CLI fetches it via your authed session at review time. It never lives in plain text on your machine.

Will the CLI work offline?

No. Every review runs against your AI provider (cloud call) and our review pipeline (cloud call). Tree-sitter indexing happens server-side too. Offline-first isn't on the roadmap.

How do I script around CLI errors?

Every error exits non-zero AND emits a stable code in --json mode. Branch on the code, not the message. See the table above for the full list.

npm i -g @tarin/lgtm-cli

Two seconds to install. One lgtm login to authenticate. Then lgtm review.