AI-Assisted Software Repository Knowledge Graph & Visualizer
CodeAtlas is a high-performance desktop application designed to help developers instantly understand, navigate, and document complex codebases. Written in modern C++20 and powered by Qt, CodeAtlas transforms static source code into interactive, AI-aware architectural graphs.
By combining deterministic AST (Abstract Syntax Tree) parsing with local Large Language Models (LLMs), CodeAtlas acts as a pair programmer that can not only show you how your code connects but can also explain it to you mathematically and semantically.
CodeAtlas parses your repository and visualizes it in multiple dimensions:
- Repository Mind Map: A bird's-eye view of your folders, files, and classes.
- File Dependency Graph: See exactly how headers and modules include one another.
- Class Diagram: Visualize inheritance (
Extends) and composition (Owns). - Function Call Graph: Track execution paths and see who calls whom.
- Inferred Architecture Graph: A condensed, high-level map of the major subsystems.
libclangAST Parsing: CodeAtlas doesn't just use regex; it uses LLVM'slibclangto parse C++ code exactly as a compiler would, perfectly resolving classes, methods, relations, and docstrings.- Cyclomatic Complexity: Functions and methods are scored based on their branching paths (if/for/while). High-complexity nodes are drawn larger in the graph to highlight potential refactoring targets.
- Circular Dependency Detection: Implements Tarjan's Strongly Connected Components (SCC) algorithm to flag architectural loops.
- Heatmaps: CodeAtlas integrates with Git to analyze file modification history. Nodes in the graph turn Crimson Red based on their "churn" (how frequently they are modified), immediately highlighting the most active and volatile parts of the codebase.
Powered entirely by local, privacy-first LLMs (via Ollama):
- Semantic Code Chunking: When you click a function, the AST parser extracts its exact start and end lines. The AI receives pristine, noise-free code chunks rather than truncated files.
- Auto-Generated Docstrings: Select an undocumented function and click
[ 📝 ] Generate AI Docstring. The AI will read the implementation and stream back a professional Doxygen-style comment. - Whole-Graph RAG (Vector Database): Ask a codebase-wide question without selecting a node (e.g., "How is the parser engineered?"). CodeAtlas features a custom C++ Vector Database that generates high-dimensional embeddings for your entire repository, performs a cosine-similarity search, and injects the top results into the LLM context to answer global architectural questions instantly.
- Qt6 Desktop Interface: Smooth, native performance.
- Command Palette: Press
Ctrl+P(orCmd+P) to fuzzy-search and jump to any node in the graph. - Minimap HUD: A dynamic minimap in the bottom-right corner helps you navigate massive graphs.
- High-Resolution Export: One-click 8K PNG export of your architectural diagrams.
- Dark & Light Themes: Aesthetic, modern styling.
The CodeAtlas architecture is heavily decoupled and purely data-driven:
ParserEngine: Ingests files and uses language-specific parsers (likeCppParserusinglibclang) to extract entities.RepositoryModel: The Source of Truth. It stores a normalized representation of all extractedEntityobjects (classes, functions) and their relationships.GraphBuilder: Transforms the rawRepositoryModelinto a specializedKnowledgeGraphbased on the requested view (e.g., Call Graph vs. Class Diagram).AtlasCanvas: A custom Qt Widget that calculates physics-based layouts (Force-Directed) and renders theKnowledgeGraphusing high-performanceQPainter.AIPanel&EmbeddingClient: Interfaces asynchronously via HTTP with a local Ollama server for LLM inference and Vector Embeddings.
- macOS (Linux/Windows supported with CMake adjustments)
- CMake (v3.16+)
- LLVM / Clang (Installed via Homebrew:
brew install llvm) - Qt5 or Qt6 (Installed via Homebrew:
brew install qt) - Ollama (For AI features. Download from ollama.com and run
ollama run llama3.1andollama pull nomic-embed-text)
CodeAtlas uses CMake. A helper script test.sh automates the build and runs benchmarks.
# Ensure LLVM is in your path (macOS Homebrew example)
export CMAKE_PREFIX_PATH="/opt/homebrew/opt/llvm"
export PATH="/opt/homebrew/bin:$PATH"
# Build the project
./test.sh./build/qt_app/codeatlas_qt_app- Index a Repository: Enter the path to your codebase in the top bar and click
Index & Parse Repository. - Explore: Use the dropdown to switch between Graph Views. Use the mouse wheel to zoom, and click-and-drag to pan.
- Inspect: Click on any node. The right panel will display its physical file location, line numbers, relationships, and complexity.
- Ask the AI:
- Local Context: With a node selected, type in the AI Chat Panel (e.g., "Refactor this to be thread-safe").
- Global Context: Deselect nodes (or start with
@repo) and ask "Where is the vector math handled?" to trigger the Vector RAG search.
- C++20: Core language.
- Qt6: GUI Framework, 2D Rendering, Networking.
- libclang: C/C++ AST Parsing.
- GoogleTest & Google Benchmark: Unit testing and micro-benchmarking.
- Ollama API: Local LLM and Embedding inference.