Intelligent PR review automation powered by Claude AI & Google Gemini, seamlessly integrated with GitHub and Jira.
Code-Tanuki is an AI-powered code review tool designed for development teams. It leverages Claude AI or Google Gemini to provide intelligent, context-aware code reviews on your GitHub pull requests, with optional Jira integration for requirement validation.
- 🤖 Multi-AI Support - Choose between Claude AI (Opus, Sonnet, Haiku) or Google Gemini (3 Pro, 3 Flash)
- 🔗 GitHub Integration - Automatic PR fetching and inline comment posting
- 📋 Jira Integration - Validate code against acceptance criteria (optional)
- ✨ Beautiful UI - Modern, colorful interface with smooth animations
- 📊 Review History - Track all reviews with filtering and search capabilities
- 🐳 Docker Ready - Easy deployment with Docker Compose
- 🔄 Smart Retry Logic - Automatic retry with exponential backoff
- 📝 Production Logging - Winston-based structured logging
- 🎯 Type Safe - Full TypeScript with Zod validation
- Next.js 16 with App Router
- React 19 with TypeScript
- Material-UI (MUI) for component library
- Tailwind CSS for utility styling
- Emotion for styled components
- Next.js API Routes for serverless functions
- Anthropic SDK for Claude AI integration
- Google Generative AI SDK for Gemini integration
- Octokit for GitHub API
- Axios for Jira REST API
- Winston for logging
- Zod for runtime validation
- Docker for containerization
- Docker Compose for orchestration
- JSON Storage with abstraction for future DB migration
Before you begin, you'll need:
- Node.js 20+ and npm
- AI Provider API Key (at least one required):
- Anthropic API Key for Claude models
- Get from: https://console.anthropic.com/settings/keys
- See Setup Guide
- Google Gemini API Key for Gemini models (optional alternative)
- Get from: https://aistudio.google.com/app/apikey
- Free tier available
- Anthropic API Key for Claude models
- GitHub Personal Access Token (required)
- Fine-grained token with "Pull requests: Read and write"
- See Setup Guide
- Jira API Token (optional)
- See Setup Guide
git clone https://github.com/hongjs/code-tanuki.git
cd code-tanuki
npm installcp .env.example .envEdit .env and add your credentials:
# AI Provider - At least one required
ANTHROPIC_API_KEY=sk-ant-your_api_key_here # For Claude models
GEMINI_API_KEY=your_gemini_api_key_here # For Gemini models (optional)
# Required - GitHub
GITHUB_TOKEN=ghp_your_github_token_here
# Optional - Jira (leave blank to skip Jira integration)
JIRA_BASE_URL=https://yourcompany.atlassian.net
JIRA_EMAIL=your-email@company.com
JIRA_API_TOKEN=your_jira_token_heremkdir -p data/reviews logs
echo "[]" > data/reviews/all-reviews.jsonnpm run devOpen http://localhost:3000 and you're ready to go!
# Build and start
docker-compose up -d
# View logs
docker-compose logs -f
# Stop
docker-compose down# Build image
docker build -t code-tanuki:latest .
# Run container
docker run -p 3000:3000 \
--env-file .env \
-v ./data:/app/data \
-v ./logs:/app/logs \
code-tanuki:latest- Navigate to the Review page
- Enter a GitHub PR URL:
https://github.com/owner/repo/pull/123 - (Optional) Enter a Jira ticket ID or leave blank for auto-extraction
- (Optional) Add custom instructions for the AI reviewer
- Select your preferred AI model (Claude or Gemini)
- Click Start Review
Code-Tanuki will:
- Fetch PR Data - Download diff, files, and metadata from GitHub
- Extract Jira Context - Get ticket details and acceptance criteria (if configured)
- AI Analysis - Your chosen AI model (Claude or Gemini) analyzes the code for:
- Bugs and potential issues
- Security vulnerabilities
- Code quality and best practices
- Requirement compliance
- Preview - Review AI comments before posting
- Post Comments - Inline comments added to GitHub PR
- Update Jira - Post review summary to Jira ticket (if configured)
Code-Tanuki automatically extracts Jira ticket IDs from PR titles:
feat(BYD-1234): Add user authentication → Extracts BYD-1234
fix(PROJ-567): Fix login bug → Extracts PROJ-567
Supported prefixes: feat, fix, chore, docs, style, refactor, test, build, ci, perf
Navigate to the History page to:
- View all completed reviews
- Filter by status, model, or date
- Search by PR number or repository
- Click any review for full details
code-tanuki/
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── review/ # Review page
│ │ ├── history/ # History page
│ │ ├── layout.tsx # Root layout with sidebar
│ │ └── api/ # API Routes
│ │ ├── review/ # Main orchestrator
│ │ ├── github/ # GitHub endpoints
│ │ ├── jira/ # Jira endpoints
│ │ └── health/ # Health check
│ ├── components/ # React Components
│ │ ├── review/ # Review form & progress
│ │ ├── history/ # History table & filters
│ │ └── layout/ # Sidebar navigation
│ ├── lib/ # Business Logic
│ │ ├── api/ # API clients (GitHub, Jira, Claude)
│ │ ├── storage/ # Storage abstraction
│ │ ├── utils/ # Utilities & helpers
│ │ ├── logger/ # Winston logger
│ │ └── constants/ # Constants, prompts, models
│ └── types/ # TypeScript Types
├── data/ # Review data (JSON files)
├── logs/ # Application logs
├── docs/ # Documentation
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose setup
└── .env # Environment variables
GITHUB_TOKEN- GitHub Personal Access Token
Claude AI:
ANTHROPIC_API_KEY- Your Claude API key (starts withsk-ant-)CLAUDE_MODEL_DEFAULT- Default Claude model (default:claude-haiku-4-5-20251001)CLAUDE_MAX_TOKENS- Max output tokens (default:8192)CLAUDE_TEMPERATURE- AI temperature 0-1 (default:0.3)
Google Gemini (Optional):
GEMINI_API_KEY- Your Gemini API key (optional)GEMINI_MODEL_DEFAULT- Default Gemini model (default:gemini-2.0-flash)GEMINI_MAX_TOKENS- Max output tokens (default:2048, recommended for free tier)GEMINI_TEMPERATURE- AI temperature 0-2 (default:0.3)
Note for Free Tier Users: The free tier works best with
GEMINI_MAX_TOKENS=2048or lower to avoid response truncation. For larger PRs, consider using Claude or upgrading to Gemini paid tier.
JIRA_BASE_URL- Your Jira instance URLJIRA_EMAIL- Your Jira account emailJIRA_API_TOKEN- Jira API token
DATA_DIR- Review storage directory (default:./data/reviews)LOG_DIR- Log directory (default:./logs)LOG_LEVEL- Logging level:debug|info|warn|error(default:info)
RETRY_MAX_ATTEMPTS- Max retry attempts (default:3)RETRY_BASE_DELAY_MS- Base delay between retries (default:1000)RETRY_MAX_DELAY_MS- Max delay between retries (default:10000)
| Model | ID | Best For | Speed | Max Tokens |
|---|---|---|---|---|
| Claude Opus 4.5 | claude-opus-4-5-20251101 |
Complex reviews, highest accuracy | Slower | 8192 |
| Claude Sonnet 4.5 | claude-sonnet-4-5-20250929 |
Balanced performance | Medium | 8192 |
| Claude Haiku 4.5 | claude-haiku-4-5-20251001 |
Quick reviews, simple PRs | Fastest | 8192 |
| Model | ID | Best For | Speed | Max Tokens* |
|---|---|---|---|---|
| Gemini 3 Pro Preview | gemini-3-pro-preview |
Complex reasoning, thorough reviews | Medium | 2048** |
| Gemini 3 Flash Preview | gemini-3-flash-preview |
Fast reviews, efficient | Fast | 2048** |
Note: You can use either Claude or Gemini models. Configure the appropriate API key in your .env file.
* Max output tokens (configurable) ** Recommended setting for free tier to avoid response truncation. Paid tier supports higher limits.
Google Gemini offers a free tier that's perfect for trying out Code-Tanuki:
- Visit Google AI Studio: https://aistudio.google.com/app/apikey
- Sign in with your Google account
- Click "Create API Key"
- Copy your API key and add it to
.env:GEMINI_API_KEY=your_gemini_api_key_here
Free Tier Limits:
- 15 requests per minute
- 1 million tokens per minute
- 1,500 requests per day
- Recommended max output tokens: 2048
Important: To avoid response truncation on the free tier, make sure to set:
GEMINI_MAX_TOKENS=2048For larger PRs (>500 lines), you may get partial reviews. Consider:
- Using Claude AI instead
- Breaking PRs into smaller chunks
- Upgrading to Gemini's paid tier
| Feature | Claude | Gemini |
|---|---|---|
| Cost | Paid (usage-based) | Free tier available |
| Best Models | Opus 4.5, Sonnet 4.5 | Gemini 3 Pro Preview |
| Speed | Very fast (Haiku) | Very fast (Flash) |
| Code Understanding | Excellent | Excellent |
| Context Window | 200K tokens | 2M tokens (Gemini 3) |
| Best For | Production workloads | Testing, small teams |
Recommendation:
- Start with Gemini (free tier) to test Code-Tanuki
- Upgrade to Claude for production use or larger teams
Code-Tanuki uses JSON file storage by default with an abstraction layer for easy database migration:
- Individual Reviews:
data/reviews/{timestamp}-{prNumber}.json - Aggregated Index:
data/reviews/all-reviews.json
- Implement
IStorageAdapterinterface for your database - Update
STORAGE_TYPEenvironment variable - No application code changes needed!
Logs are written to:
logs/combined.log- All logslogs/error.log- Error logs only- Console (development mode only)
Log levels: debug | info | warn | error
npm run dev # Start dev server with hot reload
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
npm run type-check # TypeScript type checking
npm run format # Format code with Prettier
npm run format:check # Check code formattingnpm run docker:build # Build Docker image
npm run docker:run # Run Docker container
npm run docker:compose:up # Start with Docker Compose
npm run docker:compose:down # Stop Docker Compose
npm run docker:compose:logs # View Docker logsGET /api/healthPOST /api/review
Content-Type: application/json
{
"prUrl": "https://github.com/owner/repo/pull/123",
"jiraTicketId": "BYD-1234", // optional
"additionalPrompt": "...", // optional
"modelId": "claude-opus-4-20250514",
"previewOnly": true
}POST /api/review/submit
Content-Type: application/json
{
"prUrl": "https://github.com/owner/repo/pull/123",
"jiraTicketId": "BYD-1234", // optional
"modelId": "claude-opus-4-20250514",
"comments": [...]
}GET /api/historyrm -rf node_modules package-lock.json .next
npm install
npm run buildMake sure .env exists and contains all required variables:
cp .env.example .env
# Edit .env and fill in your API keysError: Failed to parse Gemini response as JSON. Response may be truncated.
Solution: The free tier has token limits. Update your .env:
# Reduce max tokens for free tier
GEMINI_MAX_TOKENS=2048
# Or use an even lower value for very large PRs
GEMINI_MAX_TOKENS=1024Alternative: Switch to Claude AI for larger PRs:
ANTHROPIC_API_KEY=sk-ant-your_key_hereThen select a Claude model in the UI instead of Gemini.
Ensure directories exist:
mkdir -p data/reviews logs
echo "[]" > data/reviews/all-reviews.json# Clean and rebuild
docker-compose down -v
docker-compose build --no-cache
docker-compose up -d- Getting Started Guide
- UI Improvements
- Claude API Setup (if available)
- GitHub API Setup (if available)
- Jira API Setup (if available)
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
ISC
For issues and questions:
- GitHub Issues: https://github.com/hongjs/code-tanuki/issues
- Documentation: See
/docsfolder
Made with ❤️ by the Code-Tanuki team