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 reviewThree 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 reviewReview working-tree diff vs detected default branch
lgtm review --stagedReview staged diff only
lgtm review --pr 42Trigger a review on PR #42
lgtm review --base developOverride base branch
lgtm review --provider openai --model gpt-4oOverride AI provider + model
lgtm pr listList recent reviewed PRs
lgtm pr view 42Show PR #42 review verdict + findings
Repository
lgtm repo connectConnect current repo to LGTM
lgtm repo statusShow connection + index state
lgtm repo indexBuild/refresh tree-sitter context index
lgtm repo settingsView/update per-repo settings
LGTM Security
lgtm security enrollEnroll repo for CI/CD security scanning
lgtm security listList enrolled repos with posture counts
lgtm security scanTrigger a manual scan
lgtm security auditView immutable audit log
lgtm security tokens createMint a runtime watchdog token
Configuration
lgtm config set-keyAdd a provider API key (validates against provider)
lgtm config set-modelSet default model
lgtm config showShow config (table or --json)
lgtm config remove-keyRemove a provider key
Billing
lgtm billing statusPlan + quota + grace/cancel state
lgtm billing cancelSchedule cancel-at-period-end
lgtm billing portalOpen Dodo customer portal
Auth + account
lgtm loginAuthenticate via GitHub OAuth (opens browser)
lgtm whoamiShow user, plan, AI config
lgtm doctorDiagnose setup issues (auth, network, key, consent)
lgtm consent acceptAccept current Terms + Privacy versions
lgtm account deleteDelete 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_inRun lgtm login
pro_requiredFeature behind paywall · lgtm open pricing
billing_limitFree quota exhausted (20/mo)
consent_requiredAccept current Terms + Privacy · lgtm consent accept
rate_limitedSlow down, retry in a few seconds
network_errorCheck internet, status page
auth_expiredRe-login
server_errorServer 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).
@tarin/lgtm-cli~/.lgtm/config.json~/.lgtm/.envFAQ
Does the CLI use my Pro quota?
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?
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?
Will the CLI work offline?
How do I script around CLI errors?
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.