Phoenix is a comprehensive AI-powered toolkit for automated C++ code documentation, analysis, and maintenance.
It combines the power of tree-sitter parsing, Ollama AI models, and a modern GUI interface to revolutionize how developers document and maintain their C++ codebases.
Phoenix tackles the toughest challenges developers face when working with legacy C++ code base:
- Understand legacy code faster โ make even decades-old codebases easier to read and maintain.
- Keep your code secure โ all documentation is generated locally on your system, never leaving your machine.
- Onboard new developers instantly โ newcomers can quickly grasp project structure and flow.
- From zero to full documentation โ transform undocumented projects into fully documented codebases.
- Seamless Doxygen integration โ generate complete Doxygen documentation directly from AI-powered docs.
- Continuous Documentation Updates โ once full documentation is generated, Phoenix also keeps your docs up to date by tracking Git changes since the last documentation date.
- Catch hidden issues โ AI powered function-by-function analysis of entire code based, detects potential glitches and bugs, producing a structured JSON report.
- The C++ codebase must be a Git repository.
- Computer with GPU having 24GB memory and 7k CUDA cores for faster processing.
- Doxygen-style Comments: Automatically generates comprehensive function documentation
- Inline Code Comments: Smart contextual comments for complex logic blocks
- Multi-line Statement Handling: Correctly handles complex C++ constructs
- Smart Change Detection: Identifies modified, added, and deleted functions
- Historical Analysis: Compare functions across commits and time ranges
- Automated Processing: Process only changed functions for efficiency
- Intuitive Design: Clean, modern interface built with Streamlit
- Real-time Progress: Live logging and status updates with advanced logging mechanism
- Customizable Settings: Flexible configuration options
- Critical Glitch Detection: Identifies memory leaks, null pointer dereferences
- Performance Analysis: Spots potential bottlenecks and issues
- Security Assessment: Detects buffer overflows and injection vulnerabilities
- Python 3.8 or higher
- Git (for repository analysis)
- Ollama server (local or remote)
# Clone the repository
git clone https://github.com/pranaycv/phoenix.git
cd phoenix
# Install dependencies
pip install -r requirements.txt
# For development setup
pip install -e .# Install and start Ollama
curl -fsSL https://ollama.ai/install.sh | sh
ollama pull gpt-oss:20b # or your preferred model
ollama servestreamlit run phoenix.pyDefault Login Credentials:
- Username:
phoenix - Password:
phoenix
Configuration Options:
- Directory Path: Your C++ project directory
- Last Document Date: Process changes since this date
- Ollama Host: AI model server URL
- Branch: Git branch to analyze (optional)
Extract Single Function:
python extract_function_code_2.py
# Edit the file_path and line_number variablesAnalyze Git Changes:
python get_git_changes.py --start-date 2024-01-01 --branch mainBatch Process Files:
python generate_docs_ollama.py
# Configure source_directory in the scriptphoenix/
โโโ ๐ฏ phoenix.py # Main Streamlit GUI application
โโโ ๐ extract_function_code_2.py # Function extraction utility
โโโ ๐ generate_docs_ollama.py # Batch documentation generator
โโโ ๐ get_git_changes.py # Git change analyzer
โโโ ๐ requirements.txt # Dependencies
โโโ ๐๏ธ setup.py # Package setup
โโโ ๐ docs/ # Documentation
โโโ ๐งช examples/ # Usage examples
โโโ โ๏ธ config/ # Configuration files
# Set your project path
repo_path = "D:/YourProject"
# Process changes from last week
last_date = "2024-01-15"
# Run with GUI
streamlit run phoenix.pyfrom extract_function_code_2 import FunctionExtractor
extractor = FunctionExtractor("src/main.cpp", 42)
extractor.ExtractAndSave()from get_git_changes import ChangeProcessor, GitRepoHandler, CppParser, FunctionExtractor
parser = CppParser()
extractor = FunctionExtractor(parser)
git_handler = GitRepoHandler("./")
processor = ChangeProcessor(git_handler, extractor, ('.cpp', '.hpp'))
processor.ProcessChanges('HEAD~10')export OLLAMA_HOST="http://localhost:11434"
export PHOENIX_MODEL="gpt-oss:20b"
export PHOENIX_TEMP_DIR="/tmp/phoenix"{
"ollama": {
"host": "http://127.0.0.1:11434",
"model": "gpt-oss:20b",
"temperature": 0.0
},
"git": {
"extensions": [".cpp", ".hpp", ".cc", ".h"],
"ignore_patterns": ["**/build/**", "**/test/**"]
},
"documentation": {
"include_doxygen": true,
"inline_comments": true,
"code_review": true
}
}- Direct HTTP API integration with Ollama
- Robust error handling and retry logic
- Optimized prompts for C++ documentation
- Tree-sitter based C++ parsing
- Accurate function extraction
- Multi-file support with encoding detection
- Smart encoding detection
- Batch processing capabilities
- Status tracking and resumable operations
- Git integration for change detection
- Support for branches and commit ranges
- Staged and unstaged change handling
C++ Source Files โ Tree-sitter Parser โ Function Extraction
โ
Git Change Analysis โ AI Documentation โ Code Integration
โ
Quality Review โ Updated Source Files โ Status Tracking
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
# Fork and clone the repository
git clone https://github.com/pranaycv/phoenix.git
cd phoenix
# Create virtual environment
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
# Install development dependencies
pip install -r requirements.txt
pip install -e .
# Run tests
pytest tests/- Black for code formatting
- flake8 for linting
- mypy for type checking
- pytest for testing
This project is licensed under the MIT License - see the LICENSE file for details.
- Tree-sitter team for the excellent parsing library
- Ollama team for making AI models accessible
- Streamlit for the modern GUI framework
- Open Source Community for continuous inspiration
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Wiki: Project Wiki
- VS Code Extension integration
- Multiple AI Model support (OpenAI, Claude, etc.)
- Java/Python language support
- Team Collaboration features
- CI/CD Pipeline integration
- Cloud-based processing options
Made with โค๏ธ by developers, for developers
