An Autonomous AI DevOps Agent that visualizes, analyzes, and refactors legacy codebases.
CodeGraph is not just a chat wrapper. It is a RAG-powered Architect that:
- Scans local Python codebases to build a Dependency Graph (AST Parsing).
- Visualizes architecture using React Flow.
- Refactors code autonomously with a Human-in-the-Loop approval pipeline.
Unlike standard chatbots that guess file relationships, CodeGraph uses Python's ast module to statically analyze imports and build a NetworkX directed graph. The AI understands exactly which files depend on main.py before suggesting changes.
The backend implements a Fault-Tolerant Model Router. It autonomously detects available Google Gemini models (Pro, Flash, Experimental) and dynamically switches to the highest-performance model available, ensuring 99.9% uptime even during API version deprecations.
- Multi-File Editing: The agent can split large classes into separate files (
schemas.py,utils.py) in a single pass. - Safety First: Implements an automatic Rollback System. Every file edit creates a timestamped
.bakbackup before writing to disk.
- Frontend: React, React Flow, Glassmorphism UI (CSS Variables).
- Backend: FastAPI, Python NetworkX, Google Gemini 2.5 Flash.
- Analysis: Abstract Syntax Trees (AST) for static analysis.
-
Clone the repo
git clone [https://github.com/Dhy4n-117/CodeGraph.git](https://github.com/Dhy4n-117/CodeGraph.git) cd CodeGraph -
Backend Setup:
cd backend pip install -r requirements.txt # Create a .env file with your GEMINI_API_KEY python main.py
-
Frontend Setup:
cd frontend npm install npm run dev -
Usage: * Open
localhost:5173.- Enter the absolute path of any local Python project.
- Click "Analyze Map".