A sophisticated Python-based tool that analyzes codebases and generates comprehensive evaluation reports using AI-powered analysis. The tool helps development teams understand complex codebases by providing detailed insights about code structure, architecture, and adherence to best practices.
- Automated Codebase Analysis: Analyzes any Git repository by URL
- AI-Powered Insights: Utilizes OpenAI embeddings for intelligent code analysis
- Comprehensive Reports: Generates two detailed markdown reports:
- High-level overview for quick understanding
- Detailed assessment of code quality and architecture
- Best Practices Evaluation: Assesses adherence to:
- SOLID principles
- Hexagonal architecture
- TDD best practices
- Code maintainability principles
- Acceptance testing patterns
The tool is built using a modular architecture with the following key components:
analyze_repo.py: CLI entry point for running analysesrepo_indexer.py: Handles repository scanning and indexingworkflow.py: Orchestrates the analysis process using LangGraphreport_generator.py: Generates analysis reportsreport_writer.py: Handles report output and formattingtypes.py: Core type definitions
The analysis workflow is implemented using LangGraph for orchestration and LangChain with OpenAI embeddings for intelligent code analysis.
- Clone the repository
- Install dependencies:
pip install -r requirements.txt- Copy
.env.exampleto.envand configure your OpenAI API key
Run the analysis on any Git repository:
python analyze_repo.py https://github.com/username/repositoryThe tool will:
- Clone and index the repository
- Analyze the codebase structure and patterns
- Generate comprehensive reports in the
reports/directory
- Project purpose and functionality
- Key components and architecture
- Main workflows and usage patterns
- Visual diagrams using Mermaid
- Code quality evaluation
- Adherence to best practices
- Top 3 improvement opportunities
- Impact analysis on:
- Maintainability
- Performance
- Security
- Scalability
The project uses:
- Python 3.x
- LangGraph for workflow orchestration
- LangChain for AI-powered analysis
- ChromaDB for vector storage
- OpenAI embeddings for code understanding
Tests can be run using pytest:
pytest tests/├── analyze_repo.py # Main CLI entry point
├── src/
│ ├── repo_indexer.py # Repository analysis
│ ├── workflow.py # LangGraph workflow
│ ├── report_generator.py # Report generation
│ ├── report_writer.py # Report output
│ └── types.py # Type definitions
├── tests/ # Test suite
├── docs/ # Documentation
└── reports/ # Generated reports
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests
- Submit a pull request
[Add appropriate license information]