autopr-ai
v0.1.10
Published
CLI tool for automated PR review, smart commits, and PR creation
Downloads
822
Readme
autopr-ai⚡
Stop writing commit messages. Stop writing PR descriptions. Start shipping.
AI-powered CLI that watches your repo, generates conventional commits, creates pull requests, and reviews code — all from your terminal.
Install · Quick Start · Commands · Configuration · Contributing
What it does
┌──────────────────────────────────────────────────────────────┐
│ │
│ $ autopr-ai cm │
│ │
│ ⠹ Analyzing changes... │
│ ✔ feat(api): add JWT refresh token rotation │
│ │
│ Committed: feat(api): add JWT refresh token rotation │
│ │
├──────────────────────────────────────────────────────────────┤
│ │
│ $ autopr-ai cr │
│ │
│ ⠹ Generating PR content... │
│ Title: Implement token refresh with rotation strategy │
│ │
│ ✔ Created PR #47 → https://github.com/org/repo/pull/47 │
│ │
└──────────────────────────────────────────────────────────────┘One command to set up, then three commands to ship.
| Command | Alias | What happens |
| ---------------- | -------- | --------------------------------------------------------------------------------------- |
| autopr-ai onboard | — | First-time setup: GitHub auth + AI provider → ready to go |
| autopr-ai cm | commit | Reads your staged diff → generates a conventional commit → commits |
| autopr-ai cr | create | Reads your branch diff → generates PR title + description → pushes + creates PR |
| autopr-ai watch | — | Polls GitHub → notifies when you're assigned as reviewer → AI review or open in browser |
Plus autopr-ai auth to manage your GitHub token and autopr-ai review to AI-review any PR.
Install
npm (recommended)
npm install -g autopr-aiHomebrew
brew install @maxxoto/tap/autoprFrom source
git clone https://github.com/Maxxoto/autopr-ai.git
cd autopr-ai
npm install
npm link # makes `autopr` available globallynpx autopr-ai --helpOr use the dev script:
git clone https://github.com/Maxxoto/autopr-ai.git
cd autopr-ai
npm install
npm run autopr -- --help
npm run autopr -- cm # commit
npm run autopr -- cr # create PRRequirements: Node.js 18+
Quick Start
1. Onboard (one-time setup)
$ autopr-ai onboard Welcome to autopr! Let's get you set up.
════════════════════════════════════════
Step 1/2: GitHub Authentication
────────────────────────────────
You'll need a Personal Access Token with:
✓ repo (full control of repositories)
✓ read:org (read org membership)
? Open GitHub token page in browser? Yes
Opening browser...
? Paste your token: ****
✔ Authenticated as your-username
Step 2/2: AI Provider Setup
───────────────────────────
? Choose your AI provider:
❯ OpenAI (GPT-4o) — $$$ Pay-per-use
Anthropic (Claude Sonnet) — $$$ Pay-per-use
DeepSeek (DeepSeek Chat) — $ Very affordable
Groq (Llama 3.3 70B) — Free tier available
OpenRouter (Multi-model) — $$ Depends on model
OpenAI-Compatible (LiteLLM/Ollama/Custom) — Free Self-hosted
? Enter your OpenAI API key: ****
✔ API key saved
────────────────────────────────
✔ Setup complete!
Configuration summary:
GitHub: your-username @ github.com
AI: OpenAI — gpt-4o — sk-...7x3k
Try these commands:
autopr-ai cm — smart commits
autopr-ai cr — create PRs
autopr-ai review — AI code review
autopr-ai watch — watch for reviewsThat's it. One command and you're ready to go.
autopr-ai auth login # GitHub auth
autopr-ai auth status # Check auth stateSet your AI provider via environment variables or ~/.config/autopr/ config.
2. Smart Commit
git add .
autopr-ai cmThe CLI analyzes your staged diff, sends it to your configured LLM, and generates a conventional commit message:
feat(auth): implement refresh token rotation
- Add /auth/refresh endpoint
- Store hashed refresh tokens in database
- Auto-rotate on each use, revoke after 7 days
? Use this commit message? Yes
✔ Committed: feat(auth): implement refresh token rotationDon't like the generated message? Hit No and type your own.
3. Smart PR
autopr-ai cr ⠹ Generating PR content...
Title: Implement refresh token rotation with 7-day expiry
## Summary
Adds secure refresh token handling with automatic rotation
and a 7-day revocation window.
## Changes
- Add /auth/refresh endpoint with token validation
- Hash refresh tokens before storage
- Auto-rotate tokens on each refresh
- Add cleanup job for expired tokens
## Testing
- Unit tests for token generation and validation
- Integration test for refresh flow
? Create this PR? Yes
✔ Created PR #47
? Open in browser? Yes4. Watch for Reviews
autopr-ai watch Watching for review requests... (polling every 60s)
🔔 New review request: "Refactor payment gateway" (org/checkout-api)
? PR #52: Refactor payment gateway
❯ Open in browser
AI Review Assist
DismissSelect AI Review Assist and get an instant structured review:
## 🔴 Critical
- Possible hardcoded secrets detected — use environment variables instead
## 🟡 Suggestions
- Large diff (612 additions) — consider splitting into smaller PRs
- Found 3 TODO comments — consider addressing or creating issues
## 🟢 Good Practices
- Test coverage included
- No console.log statements left inCommands
autopr-ai onboard
Guided first-time setup for GitHub auth and AI provider.
autopr-ai onboard # interactive setup wizardRunning bare autopr with no subcommand will auto-launch onboard if not yet configured.
autopr-ai cm / autopr-ai commit
Generate a conventional commit from staged changes.
autopr-ai cm # analyze staged diff → commit
autopr-ai cm --no-verify # skip git hooksSupports all conventional commit types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert.
autopr-ai cr / autopr-ai create
Create a PR with AI-generated title and description.
autopr-ai cr # auto-detect base branch
autopr-ai cr --base develop # target specific branch
autopr-ai cr --draft # create as draft
autopr-ai cr --no-push # skip pushing to remoteautopr-ai review [PR number]
AI-powered code review for a pull request.
autopr-ai review # review PR for current branch
autopr-ai review 42 # review specific PR
autopr-ai review 42 --repo owner/repoautopr-ai watch
Watch for PR review assignments and get desktop notifications.
autopr-ai watch # poll every 60 seconds
autopr-ai watch --interval 30 # poll every 30 secondsPress Ctrl+C to stop watching.
autopr-ai auth
Manage GitHub authentication.
autopr-ai auth login # interactive login (opens browser)
autopr-ai auth login --token ghp_ # non-interactive
autopr-ai auth logout # remove credentials
autopr-ai auth status # show current auth stateConfiguration
AI Providers
autopr supports 6 AI providers through the Vercel AI SDK:
| Provider | Models | Cost | | --------------------- | -------------------------------- | ------------------- | | OpenAI | GPT-4o, o1, o3 | $$$ Pay-per-use | | Anthropic | Claude Sonnet 4, Claude Haiku | $$$ Pay-per-use | | DeepSeek | DeepSeek Chat, DeepSeek Reasoner | $ Very affordable | | Groq | GPT-OSS 20B | Free tier available | | OpenRouter | All providers via single key | $$ Depends on model | | OpenAI-Compatible | LiteLLM, Ollama, any OpenAI API | Free Self-hosted |
Configure via autopr-ai onboard (recommended) or environment variables:
# OpenAI
export OPENAI_API_KEY=sk-...
# Anthropic
export ANTHROPIC_API_KEY=sk-ant-...
# DeepSeek
export DEEPSEEK_API_KEY=dsk-...
# Groq
export GROQ_API_KEY=gsk_...
# OpenRouter
export OPENROUTER_API_KEY=sk-or-...
# OpenAI-Compatible (LiteLLM, Ollama, etc.)
export OPENAI_COMPAT_API_KEY=your-key
export OPENAI_BASE_URL=http://localhost:11434/v1
export OPENAI_MODEL=llama3Or set in .env:
ANTHROPIC_API_KEY=sk-ant-...
# or any other provider keyGitHub Token
Stored securely at ~/.config/autopr/ (via conf).
The token needs these scopes:
repo— full control of repositories (read code, create PRs, post reviews)read:org— read org membership (for team-based review requests)
Create one at: https://github.com/settings/tokens/new?description=autopr-cli&scopes=repo,read:org
Contributing
Interested in contributing? Check out the Contributing Guide for:
- 🛠️ Development setup
- 🏗️ Project architecture
- 📋 Contribution workflow
- 💡 Ideas for contributions
- 🧪 Running tests
License
MIT — use it however you want ❤️.
Built for developers who'd rather write code than write about code.
