Skip to content

MabudAlam/BugViper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

353 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BugViper

License: MIT Python Node Next.js FastAPI PRs Welcome DeepAgent LangChain E2B

AI PR Reviews with codebase-aware DeepAgents + ESLint, Ruff, golangci-lint and more. Install the GitHub App, open a PR, and BugViper clones the repo, builds a blast radius and call graph on the fly in an E2B sandbox, then posts a full review β€” inline comments, issue tracking, and a summary β€” with no friction.


Features

πŸ€– AI DeepAgents Codebase-aware agents that understand cross-file function interactions, not just isolated snippets
🫑 Normal Mode Single generalist agent β€” fast, efficient reviews for everyday PRs
πŸ”¬ Deep Mode Three specialized sub-agents (correctness, security, performance) run in parallel for thorough analysis
🏝️ E2B Sandboxes Secure isolated sandboxes to clone and review code β€” no access to your environment
πŸ” Blast Radius + Call Graph Builds call graph on the fly so agents see the real impact of every change
πŸ”§ Third Party Static Analysis ESLint, Ruff, golangci-lint β€” fast lint-only mode with support for Python, JS/TS, Go, and more
βœ… Verifier Pass Validates every finding against the actual diff β€” negates false positives and marks issues as: nitpick (low confidence), valid (high confidence), or outside_diff (not in the PR)
πŸ”€ Dedup Deduplicates findings across batches and agents β€” same issue reported twice gets merged once
🧠 Any LLM Model Use any model β€” open source or closed source β€” via OpenRouter, Gemini, or MiniMax
πŸ’¬ Inline Comments Posts high-confidence issues directly on the relevant lines in the PR
πŸ“Š Analytics Dashboard Tracks bugs caught, resolved, merge times, and PRs reviewed per day
πŸ” Resolve Detection Tracks whether previously reported issues were fixed in subsequent PRs β€” automatically marks issues as fixed when the same issue no longer appears
πŸ“ˆ Per-Repo Analytics Stacked bar charts per repo for reviews per day, PRs reviewed, avg merge time, and addressed rate
πŸ› Issue Lifecycle Full issue tracking β€” open, resolved, fixed β€” with per-issue GitHub comment linkage
☁️ Cloud Run + Cloud Tasks Production-ready deploy on GCP with async task dispatch

Coming Soon

🧠 Global Knowledgebase Agents learn from review feedback across all repos β€” common issues and patterns get smarter over time
🌍 Repo Knowledgebase Per-repo memory so agents remember past issues and don't re-report the same things
πŸ› οΈ More Static Analysis Adding more third-party tools: Hadolint, ShellCheck, Terraform (HCL), and more

Full Review

Comment @bugviper full review on any PR and get a complete AI-powered code review β€” inline comments, issue tracking, and a summary posted back to GitHub.

Full.Review.mp4

How it works

  1. Trigger β€” User comments @bugviper full review on a GitHub PR
  2. Clone + Blast Radius β€” BugViper clones the repo at the PR head SHA into an E2B sandbox and generates a full call graph via tree-sitter to understand which files call which functions
  3. Scoring + Batching β€” Every changed file is scored for its blast radius (how many downstream callers it affects). Files are then grouped into small batches using Louvain community detection so that tightly-connected files are reviewed together
  4. Agent Review β€” In Normal mode, batches of 4 run sequentially through a single generalist agent. In Deep mode, batches of 2 run through 3 specialized sub-agents in parallel (Bug, Security, Performance), each in their own isolated E2B container
  5. Verifier Pass β€” Every finding from the agents is validated against the actual diff by a verifier agent. It removes false positives and classifies each issue as valid, nitpick (low confidence), or outside_diff
  6. Dedup + Normalize β€” Duplicate findings across batches and agents are merged into a single entry
  7. Post to GitHub β€” High-confidence valid issues are posted as inline comments on the relevant lines; the full summary is posted as a PR review body

Real-world example: A large PR with 58 files was reviewed by splitting it into batches based on connected blast-radius components. In Deep mode, 3 agents (Bug, Security, Performance) ran in parallel across 2 batches at a time inside isolated E2B containers, with the verifier removing false positives before any comments were posted.


Run Lint

Comment @bugviper run lint on any PR for a fast static-analysis review using ESLint, Ruff, golangci-lint, and more β€” results posted back to GitHub in seconds.

How it works

  1. Trigger β€” User comments @bugviper lint on a GitHub PR
  2. Queue β€” The request is dispatched to the review service via Cloud Tasks (or direct HTTP in local dev with DEBUG=true)
  3. Lint Execution β€” The configured linters (ESLint, Ruff, golangci-lint) run against the changed files in an isolated E2B sandbox
  4. Parse + Filter β€” Lint results are parsed and filtered to only issues that fall within the actual PR diff
  5. Post to GitHub β€” Findings are posted as inline comments on the relevant lines, with a summary comment on the PR

Note: Run Lint is designed for speed β€” no call graph, no AI agents, no batching. It's the fastest way to catch style violations, unused imports, and standard lint errors before merging.


Analytics

Track your team's code review activity across all repos β€” bugs caught, resolved, merge times, and PRs reviewed per day.

What it shows

The analytics dashboard aggregates data from all repos into a single view:

  • Stat Cards β€” At a glance: total repos, PRs reviewed, reviews run, bugs caught, addressed rate, PRs per week, and average merge time
  • Total Reviews per Day β€” Stacked bar chart with each repo as a colored segment, so you can see which repo generated the most review activity on any given day
  • PRs Reviewed per Day β€” Stacked bar chart showing how many unique PRs were reviewed per day, broken down by repo
  • Repository Comparison β€” Side-by-side bar charts comparing average merge time and addressed rate across all your repos
  • Per-Repo Detail β€” Click into any repo to see its full analytics: daily bug trends, issue lifecycle, and individual PR history with full review run details

Every chart is interactive β€” hover for breakdowns and click to drill down.


View and Manage Reviews

Browse all your repos, inspect individual PR reviews, and track what issues the agents found β€” right from the dashboard.

Repo.mp4

How it works

  1. Repos list β€” The Repositories page shows every repo you've connected, with stats per repo: open issues, review count, fix rate percentage, and language badge
  2. Repo detail sheet β€” Click any repo to open a side panel with:
    • Stats bar β€” total issues raised, resolved, PR count, fix rate, addressed rate, avg merge time, PRs per week, total reviews
    • PR list β€” every reviewed PR with merge status, review count, open issues, and last review timestamp
  3. PR drill-down β€” Click a PR to expand its runs. Each run shows review type, duration, issue count, and a "View Details" button
  4. Run detail view β€” Opens a full breakdown of a single review run:
    • Walkthrough β€” which files were modified
    • Issues β€” each issue shows: severity (color-coded), category badge, issue type, confidence score, file location, description, impact, suggestion, and code snippet
    • Positive findings β€” what the agent liked about your code
    • Resolve tracking β€” if an issue was fixed in a later run, it shows as "Resolved" with a checkmark

Static Analysis Tools

Configure which linters run on your PRs β€” enable or disable tools, set config files, and manage supported file extensions.

Tools.mp4

Supported tools

Tool Languages Config file
Ruff Python (.py, .ipynb) pyproject.toml, ruff.toml, .ruff.toml
ESLint JS/TS (.js, .ts, .jsx, .tsx, and more) eslint.config.js, .eslintrc, .eslintrc.json
golangci-lint Go (.go, .go.mod) .golangci.yml, .golangci.yaml, .golangci.toml

How it works

From the Dashboard β†’ Tools page:

  • Toggle each tool on or off β€” disabled tools are skipped during lint and full review
  • Select config file β€” choose between auto-detected config files or a specific path
  • View extensions β€” see which file extensions each tool covers
  • Save β€” changes take effect on the next review immediately

More tools coming soon: Hadolint (Dockerfile), ShellCheck, Terraform (HCL).


What it does

  • Review any PR β€” Bot posts a structured review (inline comments + summary) on every pull request
  • Two review modes β€” lint (fast, static analysis via ESLint, Ruff, golangci-lint, and more) and full_review (deep AI analysis in an E2B sandbox)
  • Tracks progress β€” dashboards show bugs caught, resolved, merge times, and PRs reviewed per day across all repos
  • GitHub App + OAuth β€” App for webhook events, Firebase GitHub OAuth for the dashboard

Architecture

flowchart TD
    USER["πŸ‘€ User comments @bugviper<br/>on a GitHub PR"]
    GH["GitHub<br/>Webhook Event"]
    API["API Service (FastAPI)<br/>Port 8000"]
    DECIDE{"DEBUG?"}
    CT["Cloud Tasks<br/>codeReview Queue"]
    DIRECT["Direct HTTP"]
    RS["Review Service (Cloud Run)<br/>Port 8100"]
    SANDBOX["E2B Sandbox<br/>Secure isolated environment"]
    CLONE["Clone Repo<br/>at PR head SHA"]
    CALLGRAPH["Call Graph<br/>via tree-sitter"]
    SCORE["Score Files<br/>by blast radius"]
    BATCH["Batch Files<br/>Louvain community detection"]
    AGENTS{"Review Mode?"}
    NORMAL["Normal Mode<br/>4 batches Β· 1 generalist agent"]
    DEEP["Deep Mode<br/>2 batches Β· 3 agents (Bug Β· Security Β· Performance)<br/>running in parallel"]
    LINT["Lint<br/>ESLint Β· Ruff Β· golangci-lint"]
    VERIFIER["Verifier Pass<br/>Validates findings vs diff<br/>β†’ valid Β· nitpick Β· outside_diff"]
    DEDUP["Dedup + Normalize<br/>Merges duplicates across batches"]
    GITHUB["GitHub PR<br/>Inline comments + review body"]
    FIRESTORE["Firestore<br/>Users Β· PRs Β· Reviews Β· Analytics"]
    DASHBOARD["Frontend (Next.js)<br/>Port 3000"]

    USER --> GH
    GH --> API
    API --> DECIDE
    DECIDE -->|"DEBUG=false"| CT
    DECIDE -->|"DEBUG=true"| DIRECT
    CT --> RS
    DIRECT --> RS
    RS --> SANDBOX
    SANDBOX --> CLONE
    CLONE --> CALLGRAPH
    CALLGRAPH --> SCORE
    SCORE --> BATCH
    BATCH --> AGENTS
    AGENTS -->|normal| NORMAL
    AGENTS -->|deep| DEEP
    NORMAL --> LINT
    DEEP --> LINT
    LINT --> VERIFIER
    VERIFIER --> DEDUP
    DEDUP --> GITHUB
    DEDUP --> FIRESTORE
    FIRESTORE --> DASHBOARD
Loading

Tech Stack

Backend: Python 3.13 Β· FastAPI Β· firebase-admin Β· google-cloud-tasks Β· langchain Β· openai Β· e2b

Frontend: Next.js 16 (App Router) Β· React 19 Β· TypeScript Β· Tailwind CSS v4 Β· Recharts Β· Firebase Auth (GitHub OAuth) Β· shadcn/ui

AI: DeepAgent with 3 specialized sub-agents (correctness, security, performance) running in E2B sandboxes; verifier pass validates findings; Louvain community detection for batch sizing

Deploy: Docker Β· Cloud Build Β· Cloud Run Β· Cloud Tasks


Project Structure

BugViper/
β”œβ”€β”€ apps/frontend/               Next.js dashboard
β”‚   β”œβ”€β”€ app/(protected)/         Auth-gated pages (dashboard, repos, tools)
β”‚   β”œβ”€β”€ components/              Sidebar, Header, UI primitives
β”‚   └── lib/                    API client, Firebase auth, utils
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ api/                    FastAPI backend
β”‚   β”‚   β”œβ”€β”€ routers/           webhook, repos, analytics, auth, tools
β”‚   β”‚   └── services/          Cloud Tasks, review orchestration
β”‚   β”œβ”€β”€ ai_code_review/         Review worker service
β”‚   β”‚   β”œβ”€β”€ pipeline.py         Main review pipeline (normal mode)
β”‚   β”‚   β”œβ”€β”€ deep_pipeline.py    Deep mode (3 sub-agents)
β”‚   β”‚   β”œβ”€β”€ agent.py            Agent factory
β”‚   β”‚   β”œβ”€β”€ sandbox.py          E2B sandbox lifecycle
β”‚   β”‚   β”œβ”€β”€ batch.py            Louvain community batching
β”‚   β”‚   β”œβ”€β”€ prompts.py          All system/user prompts
β”‚   β”‚   β”œβ”€β”€ normalize.py        Finding validation
β”‚   β”‚   └── tracking.py         Firebase state updates
β”‚   β”œβ”€β”€ common/                 Shared across all services
β”‚   β”‚   β”œβ”€β”€ firebase_service.py Firestore operations
β”‚   β”‚   └── github_client.py    GitHub API wrapper
β”œβ”€β”€ infra/
β”‚   β”œβ”€β”€ docker/                 Dockerfiles (api, review, frontend)
β”‚   └── cloudbuild/             Cloud Build + Cloud Run deploy configs
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ seed_demo_data.py       Demo analytics data generator
β”‚   └── migrate_analytics.py    Schema migration
β”œβ”€β”€ tests/                      pytest unit tests
└── start.sh                    Local dev launcher

Quick Start

# Clone and install
git clone https://github.com/MabudAlam/BugViper.git
cd BugViper
uv sync
cd apps/frontend && npm install && cd ../..
cp .env.example .env

# Configure .env with your keys (see SETUP.md)
# Then launch everything:
./start.sh

This starts:

  • API on port 8000 (FastAPI β€” webhooks + REST)
  • Review Service on port 8100 (AI review pipeline)
  • Frontend on port 3000 (Next.js dashboard)
  • Ngrok tunnel (for local webhook testing)

Key API Endpoints

Endpoint Description
POST /api/v1/webhook GitHub webhook receiver (PR events, comments)
GET /api/v1/repos/overview List repos with aggregated stats
GET /api/v1/repos/{owner}/{repo}/analytics Per-repo analytics with daily breakdown
GET /api/v1/repos/{owner}/{repo}/prs List PRs for a repo
GET /api/v1/repos/{owner}/{repo}/prs/{pr}/reviews List review runs for a PR
GET /api/v1/repos/{owner}/{repo}/prs/{pr}/reviews/{run} Full review run detail with issues
PUT /api/v1/tools/config Save linter tool configuration
POST /api/v1/auth/login Authenticate with GitHub OAuth token
GET /api/v1/dashboard/analytics Aggregated dashboard analytics

About

Graph Based Code Indexing and Code Reviews 🐍

Topics

Resources

License

Stars

11 stars

Watchers

0 watching

Forks

Contributors