š Building an AI-Powered Code Reviewer for Bitbucket Using Groq & Pipelines
Source: Dev.to
Overview
Modern development teams rely heavily on pull requests for code quality, but manual reviews are slow, inconsistent, and expensive. Bitbucketās RovoāÆDev and GitHubās AskāÆCopilot offer AIāassisted PR reviews, yet their pricing models (e.g., $20āÆ/āÆdeveloperāÆ/āÆmonth) didnāt fit my needs.
I already had a Groq API key and wanted a fully automated, pipelineādriven solution, so I built an AIāpowered PR reviewer for Bitbucket using:
- Bitbucket Pipelines
- Groq LLM (llamaā3.3ā70bāversatile)
- Gitābased diff extraction (no REST API auth headaches)
The system reviews every PR automatically, outputs a structured checklistādriven AI review, and incurs zero perādeveloper licensing cost.
Comparison with Existing Solutions
| Feature | RovoāÆDev (Bitbucket) | AskāÆCopilot (GitHub) | GroqāBased System |
|---|---|---|---|
| AI PR Reviews | ā | ā | ā |
| Fully Automated in CI | ā (mostly UIābased) | ā (manual prompts) | ā |
| PerāDeveloper Cost | ā $20āÆ/āÆmonthāÆ/āÆdev | ā Bundled with Copilot | ā $0āÆ/āÆdev |
| Works in Pipelines | ā | ā | ā |
| Custom Review Rules | ā Limited | ā Limited | ā Full control |
| Vendor Lockāin | ā | ā | ā None (GroqāÆ+āÆGit) |
Motivation and Goals
I didnāt want:
- Another perāseat SaaS subscription
- A manual āAskāÆAIā workflow
- A system that breaks when pricing changes
I wanted:
- CIālevel enforcement
- Custom review rules
- The lowest possible cost
Thatās why I chose GroqāÆ+āÆPipelines.
Initial Approach (Bitbucket REST API)
The first attempt followed the typical pattern:
- Fetch PR diffs via the Bitbucket REST API
- Post PR comments using one of the following tokens:
- Atlassian API tokens
- Workspace tokens
- Repository access tokens
Even with correct scopes, posting comments repeatedly failed with 401āÆUnauthorized due to:
- Inconsistent token behaviours
- Bitbucketās evolving security model
- Poor documentation around 2025 token behaviour
After extensive debugging, I concluded that the smartest move was to eliminate Bitbucketās REST API entirely for diff collection.
Production Architecture
Pull Request Creation
- No REST API calls for diffs
- No authentication failures
- No permission issues
- Fully deterministic and flakeāfree
Diff Extraction
Instead of calling Bitbucketās endpoints, the pipeline simply runs Git commands:
# Get the diff for the current PR
git fetch origin main
git diff origin/main...HEAD
- Provides the exact PR diff
- Requires no API authentication
- Works in any CI environment
This single decision removed āāÆ90āÆ% of the systemās complexity.
AI Review Checklist (TypeScriptāÆ+āÆAngular)
| Checklist Item | Status |
|---|---|
No any types | ā |
| Strong typing with interfaces & generics | ā |
Modern Angular syntax (@if, @for, standalone components) | ā |
| Authentication guards | ā |
| No hardācoded secrets | ā |
| Error handling | ā |
| Tests present | ā |
| Performance checks | ā |
| Accessibility (WCAG) | ā |
Final verdict (MERGE READY / NEEDS WORK) | ā |
The checklist guarantees consistent reviews, enforced standards, and zero reviewer bias.
Groq LLM Integration
Why Groq?
- Excellent reasoning on large diffs
- Much cheaper than many alternatives
- OpenAIācompatible API
- More ecoāfriendly (lower compute time per request)
The AI responds with categorized feedback:
- šØ Critical Issues
- š Security Analysis
- ā” Performance Review
- šļø Architecture Feedback
- š Maintainability
- ā
Final Verdict (
MERGE READY/NEEDSāÆWORK)
Where the AI Review Appears
- The full AI review is printed in the Pipelines logs
- Optionally saved as a downloadable
ai-review.mdartifact - No PR write permissions required ā no security risks
This approach proved far more enterpriseācompliant than autoācommenting on PRs.
Production Impact
- Every PR is reviewed automatically within minutes
- Review standards are enforced consistently
- Human reviewers can focus on business logic
- No failed pipelines due to auth issues
- No wasted build minutes on retries
- Zero perādeveloper licensing cost
Key Engineering Lessons
- AI reviewers should assist, not block developers
- PR comments are optional; reviews must be reliable
- PipelinesāÆ+āÆGitāÆ+āÆLLM is an extremely powerful combination
- Groq is ideal for CI/CD AI workloads
- You donāt need a $20āÆ/āÆdeveloperāÆ/āÆmonth license to get good AI reviews
Whatās Next?
- Autoāblock merge when verdict =
NEEDSāÆWORK - Languageāspecific reviewers (e.g., .NET, SQL)
- Securityāonly review mode
- Architectural drift detection
Final Thoughts
Use Git for diff extraction + Groq for AI analysis + Pipelines for automation. Avoid REST API auth wherever possible.