A CLI tool that helps you explore and understand GitHub repositories using AI-powered code analysis.
- Clone and analyze GitHub repositories
- Extract and chunk code files for efficient processing
- Interactive Q&A interface with AI-powered responses
- Supports multiple programming languages
- Colorful terminal output with rich formatting
- Python (
.py) - JavaScript (
.js) - TypeScript (
.ts) - Java (
.java) - Go (
.go) - C++ (
.cpp) - C (
.c) - Ruby (
.rb)
- Clone this repository:
git clone https://github.com/yourusername/github-codebase-agent.git cd github-codebase-agent
2 Install the required dependencies:
pip install -r requirements.txt
3 Create a config.py file (see Configuration section below)
Configuration
Create a config.py file in the root directory with your API credentials:
DEEPSEEK_API_KEY = "your_api_key_here" DEEPSEEK_ENDPOINT = "https://api.deepseek.com/v1/chat/completions"
Important: Never commit this file to version control. Add it to your .gitignore:
config.py
Usage
Run the tool with a GitHub repository URL:
python main.py --repo https://github.com/username/repository.git
Once the repository is cloned and processed, you can ask questions about the codebase in the interactive prompt.
Example questions:
• "Explain the main architecture of this project" • "How does the authentication system work?" • "Show me all the API endpoints"
Type exit or quit to end the session.
Requirements
• Python 3.7+ • Git installed on your system • A DeepSeek API key
Dependencies
• requests - For API communication • rich - For beautiful terminal output • argparse - For command-line argument parsing
Install all dependencies with:
pip install -r requirements.txt
Project Structure
github-codebase-agent/ ├── cli.py # Command-line interface ├── file_reader.py # File reading and chunking logic ├── github_handler.py # Repository cloning ├── main.py # Main entry point ├── summarizer.py # AI interaction logic ├── utils.py # Utility functions and pretty printing └── config.py # API configuration (not included in repo)
Contributing
Contributions are welcome! Please open an issue or pull request for any improvements.
License
MIT License
This README includes:
- Clear project description
- Installation instructions
- Configuration requirements (with security warning)
- Usage examples
- Project structure overview
- Contribution guidelines
- License information
You might want to customize:
- The repository URL in the Installation section
- The license information if you're using something other than MIT
- Any additional features or supported languages
- More specific usage examples relevant to your typical use case