@jardo5/lgtm
v1.0.30
Published
CLI code review tool powered by OpenRouter
Maintainers
Readme
LGTM
Automated code review from your terminal. Point it at a git diff, pick your models, get comments with severity ratings.
██ ██████ ████████ ███ ███
██ ██ ██ ████ ████
██ ██ ███ ██ ██ ████ ██
██ ██ ██ ██ ██ ██ ██
███████ ██████ ██ ██ ██Install
npm
npm install -g lgtmFrom source
git clone <repo-url>
cd lgtm
npm install
npm run build
npm linkLinux dependencies
LGTM stores your API key using your system's secret service. On Linux, you need secret-tool (from libsecret):
# Arch/CachyOS
sudo pacman -S libsecret
# Debian/Ubuntu
sudo apt install libsecret-tools
# Fedora
sudo dnf install libsecretOn macOS, Keychain is used automatically. On Windows, a config file fallback is used.
Usage
lgtm [options]Run lgtm inside any git repository. On first run, you'll be prompted for an OpenRouter API key.
Flags
| Flag | Description |
| -------------- | ------------------ |
| --help | Show help |
| --version | Show version |
| --verbose | Debug logging |
| --base <ref> | Set base reference |
| --head <ref> | Set head reference |
| doctor | Check dependencies |
Examples
# Interactive — pick branches in the TUI
lgtm
# Diff two branches directly
lgtm --base main --head feature/auth
# Check system setup
lgtm doctorHow it works
- You select a base and head ref (branches, tags, commits, or staged changes)
- LGTM generates the diff and splits it into chunks
- Each configured agent sends the diff to its assigned model via OpenRouter
- Models stream back comments with file, line number, severity (1-5), and explanation
- A dedup agent consolidates overlapping comments across models
- Results are grouped by file with severity ratings: Info, Suggestion, Issue, Warning, Critical
Smart filtering
Binary files, lockfiles (package-lock.json, yarn.lock, etc.), and .env files are automatically excluded from the diff before it reaches the models. This reduces token usage and keeps reviews focused on meaningful changes.
Focus modes
Choose a review focus: Normal (default), Security, Performance, Best Practices, or Accessibility. Each mode tailors the AI's system prompt with domain-specific checklists. Set with r on the launch screen.
Framework detection
LGTM auto-detects your project's language and frameworks from manifest files (package.json, requirements.txt, Cargo.toml, go.mod). This context is injected into the review prompt for more relevant feedback.
Confidence scores
Each comment includes an optional confidence score (0-100%) indicating how certain the model is about the issue.
Time tracking
Review duration is tracked per agent and total. Displayed on the results screen and saved to history.
Multi-model review
Configure multiple agents, each with a different model. Run openrouter/auto alongside specific models to get varied perspectives on the same diff. The dedup pass removes duplicates so you don't read the same comment three times.
Cost tracking
Token usage and cost are tracked per session. Free models show $0.00. Cost is displayed on the results screen after review completes.
Keyboard shortcuts
Welcome screen
| Key | Action |
| ------- | -------- |
| h | Help |
| q | Quit |
| Any key | Continue |
Launch screen
| Key | Action |
| -------- | ----------------------- |
| Tab | Cycle sections |
| / | Search in branch picker |
| s | Start review |
| a | Add agent |
| f | Fetch remote |
| h | History |
| r | Cycle focus mode |
| m | Open model picker |
| x | Remove selected agent |
| Esc | Back / close |
| Ctrl+Q | Quit |
Results screen
| Key | Action |
| --------- | ---------------- |
| Up/Down | Navigate files |
| Tab | Switch panel |
| d | Toggle diff view |
| v | Open in VSCode |
| q/Esc | Back to launch |
History screen
| Key | Action |
| --------- | ----------------- |
| Up/Down | Navigate reviews |
| Enter | View details |
| / | Search/filter |
| c | Clear all history |
| Esc | Back to launch |
Configuration
API key
Stored securely — macOS Keychain, Linux secret-tool, or an encrypted config file fallback. Never stored in .env or plaintext config.
Models
Any model available on OpenRouter works. The model picker shows all available models with pricing info. Default for new agents: openrouter/auto.
Requirements
- Node.js 18+
- Git
- An OpenRouter API key
- A terminal with mouse support (most modern terminals)
Development
# Run in dev mode
bun run src/index.tsx
# Build
npm run build
# Type check
npm run typecheck
# Lint
npm run lint
# Format
npm run format
# Run tests
npm run test
# Full validation (typecheck + lint + test + format)
npm run checkProject structure
src/
components/ UI screens and widgets (OpenTUI/React)
services/ Business logic (git, review, storage, cost)
config/ Model configuration
state/ React context state management
theme/ Colors and styling (Dracula palette)
types/ TypeScript type definitionsLicense
ISC
