DEV Community

Cover image for 🤖 GitPulse — AI-Powered GitLab Code Review Agent (Gemini + Ollama)
Pandi Selvam P
Pandi Selvam P

Posted on

🤖 GitPulse — AI-Powered GitLab Code Review Agent (Gemini + Ollama)

🤖 GitPulse — AI-Powered GitLab Code Review Agent (Gemini + Ollama)

Code reviews are one of the most important parts of maintaining code quality.

But in real projects they often suffer from problems like:

reviewers missing security issues

inconsistent review standards

slow feedback cycles

lack of performance checks

repetitive comments on common issues

So I built GitPulse, an AI-powered GitLab code review agent that automatically analyzes merge requests and posts feedback directly on the MR.

🔗 GitHub Repo
https://github.com/Pandi2352/GitPulse-AIAgent

🚀 What GitPulse Does

GitPulse automatically reviews GitLab merge requests using a dual analysis pipeline:

1️⃣ Static code analysis
2️⃣ AI-powered code review

The system then posts structured comments directly on the MR with severity levels and suggestions.

It also generates a quality score for each review.

🧠 Key Features
🔍 Automated Merge Request Reviews

GitPulse listens to GitLab webhooks and triggers reviews automatically when a merge request event occurs.

⚙️ Dual Analysis Pipeline

Before sending code to the AI model, GitPulse runs pattern-based static checks to catch common issues.

Examples:

security vulnerabilities

performance problems

reliability issues

custom rule violations

After that, AI performs deeper analysis.

🤖 AI Provider Support

GitPulse supports multiple AI providers:

Google Gemini

Ollama (local LLMs)

Default model:

gemini-2.0-flash

This makes it possible to run cloud AI or local AI depending on your setup.

📊 Code Review Scoring

Every review gets a quality score from 0 to 100 and a letter grade:

Score Grade
90+ A
80–89 B
70–79 C
60–69 D
<60 F

This makes it easy to quickly evaluate the overall quality of a merge request.

🔔 Real-Time Review Notifications

The system uses WebSockets to stream updates as the review progresses.

You can see phases like:

fetching diffs

running static analysis

AI review

posting comments

in real time.

💬 AI Chat Assistant

GitPulse includes an AI chat interface that understands project context.

You can ask things like:

explain this code

suggest improvements

detect bugs

review architecture

Chat conversations are persisted for later reference.

🧩 Custom Rule Engine

Developers can create custom regex-based rules.

Rules can be:

global

project-specific

Example rule:

Detect usage of console.log in production code
📈 Token Usage Tracking

GitPulse tracks AI usage including:

token consumption

estimated cost

usage trends

This helps teams monitor AI expenses.

📊 Performance Timeline

Every review records the time spent in each phase.

Example phases:

Fetch diffs

Clone repository

Static analysis

AI review

Post comments

This helps identify performance bottlenecks.

📄 Export Review Reports

Reviews can be exported as:

Markdown

JSON

CSV

This is useful for documentation and auditing.

🏗 Architecture

The system uses a React frontend and NestJS backend.

React Client (Vite)

│ REST + WebSocket

NestJS Server

├── GitLab API Integration
├── AI Providers (Gemini / Ollama)
├── Static Analysis Engine
└── MongoDB
🧰 Tech Stack
Backend

NestJS

TypeScript

Mongoose

Socket.IO

Google Generative AI SDK

Ollama API

Frontend

React

TypeScript

Vite

Tailwind CSS

Database

MongoDB

⚙️ Review Pipeline

When a merge request webhook is received, GitPulse runs an 8-phase review pipeline.

1️⃣ Fetch MR diffs
2️⃣ Clone repository and extract context
3️⃣ Run static analysis and custom rules
4️⃣ Create review record
5️⃣ Send code to AI for analysis
6️⃣ Save comments to database
7️⃣ Post comments to GitLab MR
8️⃣ Compute final score and grade

Each phase is recorded and visualized in the UI.

🚀 Quick Start

Clone the repository:

git clone https://github.com/Pandi2352/GitPulse-AIAgent

Start the backend:

cd server
npm install
npm run start:dev

Start the frontend:

cd client
npm install
npm run dev

Open:

http://localhost:5173
🔐 Security

GitPulse includes multiple security protections:

GitLab tokens encrypted using AES-256-GCM

Webhook validation using secret token verification

Request validation via NestJS ValidationPipe

Traceable requests using x-request-id

💡 Why I Built This

Code reviews are essential but often inconsistent.

I wanted to build a system that:

automatically reviews merge requests

combines static analysis with AI reasoning

provides structured feedback

integrates directly with GitLab workflows

GitPulse is an attempt to bring AI-assisted code review into everyday developer workflows.

🔗 GitHub

If you're interested, check out the project here:

https://github.com/Pandi2352/GitPulse-AIAgent

Feedback and suggestions are welcome.

Top comments (0)