Skip to content

jpdlr/prism-review

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฎ Prism Review

AI-powered code review assistant that analyzes GitHub pull requests and provides structured feedback with risk assessment, improvement suggestions, and test coverage analysis.

CI License: MIT


What It Does

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

Quick Start

Installation

# 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

Configuration

# 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_...

Usage

# 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

Example Output

Terminal Output

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  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

GitHub PR Comment

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>

Commands

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

PR Reference Formats

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

Configuration Options

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

Required GitHub Token Permissions

Your GitHub token needs these permissions:

  • repo โ€” Access private repositories
  • read:org โ€” Read organization data (for org repos)

Create a token here โ†’

How It Works

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   GitHub API     โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚   Prism Core     โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚   Claude AI      โ”‚
โ”‚   (PR + Diff)    โ”‚     โ”‚   (Analysis)     โ”‚     โ”‚   (Review)       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                  โ”‚
                                  โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚   Output         โ”‚
                         โ”‚ Terminal / GH    โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  1. Fetch โ€” Retrieves PR metadata and file diffs from GitHub
  2. Analyze โ€” Sends structured context to Claude for code review
  3. Format โ€” Transforms AI response into actionable feedback
  4. Output โ€” Displays in terminal or posts as PR comment

Development

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Watch mode for development
npm run dev

Project Structure

prism-review/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ cli/           # CLI commands
โ”‚   โ”œโ”€โ”€ core/          # GitHub, analyzer, formatter
โ”‚   โ”œโ”€โ”€ types/         # TypeScript definitions
โ”‚   โ””โ”€โ”€ utils/         # Config, logging, parsing
โ”œโ”€โ”€ tests/             # Vitest test suites
โ””โ”€โ”€ dist/              # Compiled output

Tech Stack

  • TypeScript โ€” Type-safe codebase
  • Commander.js โ€” CLI framework
  • Octokit โ€” GitHub API client
  • Anthropic SDK โ€” Claude AI integration
  • Vitest โ€” Testing framework
  • Chalk + Ora โ€” Terminal styling

License

MIT ยฉ jpdlr


Built with ๐Ÿ”ฎ by jpdlr

About

AI-powered code review assistant for GitHub PRs. Analyzes pull requests with Claude AI and provides structured feedback: risk assessment, improvement suggestions, and test coverage gaps.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors