Skip to content

crastatelvin/inspector-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” INSPECTOR

AI Code Review Agent β€” Multi-Dimensional Audit With Live Scan UI

Python FastAPI React NVIDIA CI License: MIT


INSPECTOR is a production-grade AI Code Review Agent. Paste any code snippet, run one intelligent scan, and get structured extraction for security vulnerabilities, performance bottlenecks, code quality issues, best practice violations, and improvement suggestions β€” all rendered in a premium "Dark Hacker" dashboard with real-time progress and actionable fixes.


Audit Realtime Hardened Performance


πŸ“‹ Table of Contents


🧠 Overview

INSPECTOR focuses on a critical engineering workflow: high-fidelity code reviews. The backend leverages NVIDIA NIM (Llama-3.1-405B) to run five simultaneous analysis passes, identifying risks and suggesting modern refactors with surgical precision.

Users can:

  • Paste code into a professional Monaco Editor and watch live scan stages
  • Extract structured findings (security, performance, quality, best_practices, suggestions)
  • Review a dynamic Quality Score Gauge and grading system (A-F)
  • Copy exact code fixes directly for downstream implementation
  • Experience a "Dark Hacker" aesthetic with Matrix rain and scan beam animations

πŸ–ΌοΈ Application Preview

Demo Reel (Live Flow)

Demo


1) Editor & Landing Page

Dashboard


2) Live Scan Progress

Scanning


3) Multi-Dimensional Findings

Issues


4) Actionable Fixes

Fixes


✨ Features

Feature Description
πŸ” Multi-Dimensional Audit Simultaneous scans for Security, Performance, Quality, and Best Practices
πŸš€ NVIDIA NIM Powered Leverages Llama-3.1-405B for senior-engineer level reasoning and fixes
πŸ”΄ Live Progress Stream WebSocket-driven progress events showing exactly what the AI is analyzing
πŸ› οΈ Monaco Editor Integration Full VSCode-grade editing experience with syntax highlighting and line numbers
πŸ“Š Dynamic Score Gauge Real-time quality scoring and grading based on cumulative issue severity
πŸ’‘ Actionable Code Fixes Every issue includes a detailed explanation and a ready-to-copy fixed code snippet
🎨 Premium Hacker UI High-end dark theme with Matrix rain and animated scan beam overlays
⏱️ Parallel Execution All review dimensions are scanned in parallel via asyncio.gather for max speed

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        React Inspector UI                         β”‚
β”‚                                                                   β”‚
β”‚  Monaco Editor ──► Scan Controls ──► Issue Dashboard (Cards)      β”‚
β”‚      β”‚              β”‚                    β”‚                        β”‚
β”‚      └────── POST /review + WS /ws β—„β”€β”€β”€β”€β”€β”˜                        β”‚
β”‚                                                                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                          FastAPI Backend                          β”‚
β”‚                                                                   β”‚
β”‚  Middleware: CORS + Request-ID Logging + Scoped WS Management     β”‚
β”‚                                                                   β”‚
β”‚  /review ─► review_agent.py  ─► asyncio.gather()                  β”‚
β”‚                                  β”œβ–Ί security_scan                 β”‚
β”‚                                  β”œβ–Ί performance_scan              β”‚
β”‚                                  β”œβ–Ί quality_scan                  β”‚
β”‚                                  β””β–Ί nvidia_service.py             β”‚
β”‚                                                                   β”‚
β”‚  /ws     ─► client-scoped progress events (UUID routed)           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Tech Stack

Layer Technology
Backend FastAPI, Pydantic, Uvicorn, Python 3.11+
AI Provider NVIDIA NIM (Llama-3.1-405B)
Editor Engine Monaco Editor (@monaco-editor/react)
Frontend React 18, Vite, Framer Motion, Axios
Transport REST + WebSocket
Styling Vanilla CSS (JetBrains Mono)

πŸ“ Project Structure

inspector-agent/
β”‚
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py                    # FastAPI routes + scoped WS + middleware
β”‚   β”œβ”€β”€ review_agent.py            # Parallelized AI scan orchestration
β”‚   β”œβ”€β”€ nvidia_service.py          # NVIDIA NIM (OpenAI-compatible) integration
β”‚   β”œβ”€β”€ code_analyzer.py           # Language detection + metrics logic
β”‚   β”œβ”€β”€ requirements.txt
β”‚   └── .env.example
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/            # Monaco Editor, Gauge, Cards, Matrix Rain
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   └── ReviewPage.jsx     # Main Split Dashboard Layout
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”‚   └── useReview.js       # UUID-scoped WS + API state management
β”‚   β”‚   β”œβ”€β”€ styles/
β”‚   β”‚   β”‚   └── globals.css        # Premium Hacker styling tokens
β”‚   β”‚   └── App.jsx
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”‚
β”œβ”€β”€ .github/workflows/deploy.yml   # GitHub Pages deployment automation
β”œβ”€β”€ LICENSE
└── README.md

πŸš€ Installation

1) Clone

git clone https://github.com/crastatelvin/inspector-agent.git
cd inspector-agent

2) Backend

cd backend
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
copy .env.example .env
# Configure NVIDIA_API_KEY in .env
python main.py

3) Frontend

cd frontend
npm install
npm run dev

πŸ’» Usage

  1. Open the dashboard and paste your target code into the Monaco Editor
  2. Watch the scan progress in real time via the status console
  3. Review extracted findings across tabs:
    • SUMMARY
    • CRITICAL / HIGH / MEDIUM
    • SECURITY / PERF / QUALITY
  4. Expand any issue card to view the PROPOSED FIX
  5. Click the copy icon to apply the fix to your source code

Quick health check:

curl -X GET http://localhost:8000/

πŸ“‘ API Reference

Method Endpoint Description
GET / Service health and version info
POST /review/{client_id} Initiate parallelized code audit
WS /ws/{client_id} Client-scoped progress event stream

βš™οΈ Configuration

backend/.env:

NVIDIA_API_KEY=nvapi-...

frontend/src/hooks/useReview.js:

const BASE_URL = 'http://localhost:8000';
const WS_BASE_URL = 'ws://localhost:8000/ws';

πŸ§ͺ Testing & CI

Backend:

cd backend
# Run functional tests for the parser and AI logic
python -m pytest

Frontend:

cd frontend
# Verify build integrity
npm run build

πŸ”’ Security Notes

  • Scoped WebSockets: Progress updates are isolated per UUID client_id to prevent cross-session log leaking.
  • Environment Isolation: API keys are restricted to the backend and never exposed to the client.
  • Input Validation: Backend enforces code size limits and validates language patterns before AI submission.

🧭 Design Decisions

  • Parallelised Scans: Using asyncio.gather for five simultaneous passes ensures deep-surgical detail without the latency of sequential calls.
  • Monaco Engine: Professional syntax highlighting and line numbers are essential for the "Senior Engineer" UX.
  • UUID Routing: Ensures real-time logs are accurately delivered to the initiating user in a multi-user environment.

License

This project is licensed under the MIT License.

Built by Telvin Crasta Β· Powered by NVIDIA NIM Β· Production Ready

⭐ If INSPECTOR helped you ship cleaner code, star the repo.

About

πŸ” INSPECTOR: Production-grade AI Code Review Agent with multi-dimensional audit and live scan UI. Powered by NVIDIA NIM.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors