🧠 DevPal is an intelligent command-line assistant that helps developers understand, refactor, document, and test codebases using Retrieval-Augmented Generation (RAG) and Large Language Models.
- Semantic Search: Ask questions about your codebase using natural language
- Error Explanation: Get detailed explanations of error messages and stack traces
- Code Analysis: Understand complex functions and their relationships
- Unit Test Generation: Automatically generate tests for your functions
- Code Refactoring: Get AI-powered suggestions for code improvements
- Documentation: Auto-generate docstrings and documentation
- CLI Interface: Fast, efficient command-line operations
- TUI Mode: Optional Textual-based user interface for interactive exploration
- Project Initialization: One-command setup for new projects
-
Clone the repository
git clone <repository-url> cd devpal
-
Set up virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Configure environment
cp .env.example .env # Edit .env with your API keys
-
Initialize a project
devpal init /path/to/your/project
-
Ask questions about your code
devpal ask "What does the main function do?" -
Generate tests
devpal test src/main.py -
Get error explanations
devpal explain "TypeError: 'int' object is not callable" -
Refactor code
devpal patch src/main.py --function process_data
-
Generate documentation
devpal docs src/main.py
-
Launch interactive TUI
devpal tui
Walks through the project directory, extracts code, and builds a ChromaDB vector store for semantic search.
Options:
--skip-dirs: Comma-separated list of directories to skip--file-types: Comma-separated list of file extensions to include
Performs semantic search over your codebase and answers questions using RAG.
Options:
--file: Limit search to specific file--function: Limit search to specific function--model: Choose LLM model (gemini, claude, deepseek, openai, ollama, huggingface)
Analyzes error messages and provides detailed explanations with potential solutions.
Generates unit tests for functions in the specified file.
Options:
--function: Generate tests for specific function only--framework: Test framework (pytest, unittest, jest)--output: Output file path
Suggests improvements and refactoring for code in the specified file.
Options:
--function: Refactor specific function only--dry-run: Show changes without applying them--backup: Create backup before applying changes
Generates documentation for the specified file.
Options:
--format: Output format (markdown, jsdoc, python)--output: Output file path
Launches an interactive Textual-based user interface for exploring your codebase.
Create a .env file in your project root:
# LLM Configuration
GOOGLE_API_KEY=your_gemini_api_key
CLAUDE_API_KEY=your_claude_api_key
DEEPSEEK_API_KEY=your_deepseek_api_key
OPENAI_API_KEY=your_openai_api_key
HUGGINGFACE_API_KEY=your_huggingface_api_key
# Model Settings
DEFAULT_MODEL=claude
EMBEDDING_MODEL=all-MiniLM-L6-v2
# ChromaDB Settings
CHROMA_PERSIST_DIRECTORY=./chroma_store
# Development Settings
DEBUG=false
LOG_LEVEL=INFOdevpal/
├── src/
│ ├── core/ # Core functionality
│ ├── cli/ # CLI commands
│ ├── tui/ # Textual UI components
│ ├── models/ # LLM and embedding models
│ ├── vectorstore/ # ChromaDB integration
│ └── utils/ # Utility functions
├── tests/ # Test suite
├── examples/ # Example projects
└── docs/ # Documentation
Run the test suite:
pytest tests/Run with coverage:
pytest --cov=src tests/- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
MIT License - see LICENSE file for details.
- Issues: Report bugs and feature requests on GitHub
- Discussions: Join community discussions
- Documentation: Check the docs folder for detailed guides
- LLM Guide: See LLM_GUIDE.md for detailed LLM configuration and usage
DevPal - Making code understanding and development easier with AI! 🚀