Skip to content

An Autonomous AI DevOps Agent that scans local Python codebases, builds interactive dependency graphs (AST), and performs multi-file refactoring using Gemini and React Flow.

Notifications You must be signed in to change notification settings

Dhy4n-117/CodeGraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

CodeGraph AI

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:

  1. Scans local Python codebases to build a Dependency Graph (AST Parsing).
  2. Visualizes architecture using React Flow.
  3. Refactors code autonomously with a Human-in-the-Loop approval pipeline.

๐Ÿš€ Key Features

1. ๐Ÿ” AST-Based Context Awareness

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.

2. ๐Ÿ›ก๏ธ Self-Healing AI Backend

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.

3. โšก Autonomous Refactoring Pipeline

  • 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 .bak backup before writing to disk.

๐Ÿ› ๏ธ Tech Stack

  • 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.

๐Ÿ“ฆ How to Run

  1. Clone the repo

    git clone [https://github.com/Dhy4n-117/CodeGraph.git](https://github.com/Dhy4n-117/CodeGraph.git)
    cd CodeGraph
  2. Backend Setup:

    cd backend
    pip install -r requirements.txt
    # Create a .env file with your GEMINI_API_KEY
    python main.py
  3. Frontend Setup:

    cd frontend
    npm install
    npm run dev
  4. Usage: * Open localhost:5173.

    • Enter the absolute path of any local Python project.
    • Click "Analyze Map".

About

An Autonomous AI DevOps Agent that scans local Python codebases, builds interactive dependency graphs (AST), and performs multi-file refactoring using Gemini and React Flow.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published