CodeOracle AI is a Visual Studio Code extension that delivers AI-powered insights into your source code. The tool performs detailed static analysis—extracting Abstract Syntax Trees (AST), Control Flow Graphs (CFG), and Data Flow Graphs (DFG)—and leverages GPT-4 to produce clear, tutor-style feedback. By integrating with a Flask-based backend, it provides both a comprehensive textual report and intuitive flow diagrams, allowing you to quickly identify potential issues, optimisations, and best practices.
Key Features
Prompt, Tutor-Style Feedback
Provides clear, actionable insights into your code’s structure and potential issues.
On-Demand Analysis
Analyse the currently open file with a single click for an extensive report.
Visual Diagrams
Automatically generates CFG diagrams using Mermaid for quick comprehension.
Multi-Language Support
Uses Tree-sitter to parse Python, JavaScript, and TypeScript.
AI-Driven Summaries
Employs GPT-4 to refine outputs and deliver concise, educational commentary.
Secure & Efficient Caching
Utilises MongoDB with TTL to automatically delete analysis data and avoid storing source code.
Asynchronous Processing
A Flask backend handles requests in real-time, supporting multiple analyses concurrently.
Requirements
Visual Studio Code
Version 1.97.0 or later.
Backend Analysis Server
A Flask-based server exposing an /analyse endpoint. (Repository link will be updated soon; see below for temporary usage instructions.)
Node.js & npm
Required for building and packaging this extension if installing from source.
Installation
1. Installing via the VS Code Marketplace
Open VS Code.
Go to the Extensions panel.
Search for CodeOracle AI.
Click Install.
2. Setup & Usage of the Backend
Note: The official backend repository link will be updated soon to encourage community collaboration. Meanwhile, you can follow these steps:
Clone or Download the Flask Backend
git clone <temporary-backend-repo-url>
cd flask-analysis-backend
Install Python Dependencies
pip install -r requirements.txt
Configure Environment Variables
MONGODB_URI for connecting to your MongoDB instance
OPENAI_API_KEY for AI-driven summarisation
Run the Flask Server
python app.py
Ensure the server is accessible at http://localhost:5000/analyse for the extension to function along with the backend analysis server.
Connect with the VS Code Extension
Once the server is running, open any source file in VS Code, trigger the "Analyse Current File" command, and the extension will send your code to the /analyse endpoint for processing.
Caching & Privacy
The backend uses MongoDB caching with TTL to ensure analysis data is automatically deleted over time without storing source code content.
This setup allows the extension to leverage both static analysis (AST, CFG, DFG) and AI-driven insights. Detailed reports and visual diagrams will appear in the extension’s panel once the analysis completes.