AI-powered code review assistant that analyzes GitHub pull requests and provides structured feedback with risk assessment, improvement suggestions, and test coverage analysis.
Prism Review uses Claude AI to analyze your pull requests and provides:
- ๐ Summary โ Concise overview of what the PR accomplishes
โ ๏ธ Risk Assessment โ Security vulnerabilities, bugs, and breaking changes with severity ratings- ๐ก Suggestions โ Performance, maintainability, and best practice improvements
- ๐งช Test Coverage Gaps โ Missing test scenarios and edge cases
# Clone and install globally
git clone https://github.com/jpdlr/prism-review.git
cd prism-review
npm install
npm link
# Or install directly from npm (coming soon)
# npm install -g prism-review# Set your API keys
prism config set anthropicApiKey sk-ant-...
prism config set githubToken ghp_...
# Or use environment variables
export ANTHROPIC_API_KEY=sk-ant-...
export GITHUB_TOKEN=ghp_...# Analyze a PR and output to terminal
prism analyze https://github.com/owner/repo/pull/123
# Short format works too
prism analyze owner/repo#123
# Output as JSON
prism analyze owner/repo#123 --json
# Post review as a PR comment
prism comment owner/repo#123
# Update existing Prism comment
prism comment owner/repo#123 --updateโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
PRISM REVIEW
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
PR #42: Add user authentication
feature/auth โ main
5 files โข +150 -30
๐ Summary
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
This PR implements JWT-based authentication with login and
logout endpoints, password hashing, and session management.
โ ๏ธ Risk Assessment
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ด CRITICAL src/auth.ts
Potential SQL injection in user lookup query
โ Use parameterized queries or an ORM
๐ HIGH src/middleware.ts:45
JWT secret loaded from environment without fallback
โ Add validation to fail fast if secret is missing
๐ก Suggestions
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โก src/auth.ts [performance]
Password hashing is synchronous and blocks the event loop
Consider using bcrypt's async methods
๐งช Test Coverage Gaps
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ src/auth.ts
Missing unit tests for edge cases
Suggested tests:
โข Test with expired tokens
โข Test with malformed JWT
โข Test rate limiting behavior
When you use prism comment, it posts a formatted review directly to the PR:
## ๐ Prism Review
### ๐ Summary
This PR implements JWT-based authentication with login/logout endpoints.
> **5** files changed โข **+150** additions โข **-30** deletions
### โ ๏ธ Risk Assessment
| Severity | File | Issue | Suggestion |
|:--------:|------|-------|------------|
| ๐ด Critical | `src/auth.ts` | SQL injection vulnerability | Use parameterized queries |
| ๐ High | `src/middleware.ts:45` | Missing secret validation | Add fail-fast check |
### ๐ก Suggestions
- โก **`src/auth.ts`** _(performance)_
Password hashing blocks event loop. Use async bcrypt methods.
### ๐งช Test Coverage Gaps
<details><summary>๐ด <b>src/auth.ts</b> - Missing edge case tests</summary>
**Suggested tests:**
- [ ] Test with expired tokens
- [ ] Test with malformed JWT
- [ ] Test rate limiting behavior
</details>| Command | Description |
|---|---|
prism analyze <pr> |
Analyze PR and output to terminal |
prism comment <pr> |
Analyze PR and post as GitHub comment |
prism config show |
Display current configuration |
prism config set <key> <value> |
Set a configuration value |
prism config clear |
Clear all configuration |
prism config path |
Show config file location |
Both URL and short formats are supported:
# Full GitHub URL
prism analyze https://github.com/facebook/react/pull/12345
# Short format
prism analyze facebook/react#12345| Key | Description | Default |
|---|---|---|
anthropicApiKey |
Anthropic API key for Claude | - |
githubToken |
GitHub personal access token | - |
defaultModel |
Claude model to use | claude-sonnet-4-20250514 |
maxFilesPerReview |
Maximum files to analyze | 50 |
Your GitHub token needs these permissions:
repoโ Access private repositoriesread:orgโ Read organization data (for org repos)
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ GitHub API โโโโโโถโ Prism Core โโโโโโถโ Claude AI โ
โ (PR + Diff) โ โ (Analysis) โ โ (Review) โ
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ Output โ
โ Terminal / GH โ
โโโโโโโโโโโโโโโโโโโโ
- Fetch โ Retrieves PR metadata and file diffs from GitHub
- Analyze โ Sends structured context to Claude for code review
- Format โ Transforms AI response into actionable feedback
- Output โ Displays in terminal or posts as PR comment
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Watch mode for development
npm run devprism-review/
โโโ src/
โ โโโ cli/ # CLI commands
โ โโโ core/ # GitHub, analyzer, formatter
โ โโโ types/ # TypeScript definitions
โ โโโ utils/ # Config, logging, parsing
โโโ tests/ # Vitest test suites
โโโ dist/ # Compiled output
- TypeScript โ Type-safe codebase
- Commander.js โ CLI framework
- Octokit โ GitHub API client
- Anthropic SDK โ Claude AI integration
- Vitest โ Testing framework
- Chalk + Ora โ Terminal styling
MIT ยฉ jpdlr
Built with ๐ฎ by jpdlr