Skip to content

Ishtiyaque-Alam/DevPal

Repository files navigation

DevPal - AI CLI Tool for Developers

🧠 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.

✨ Features

🔍 Code Understanding

  • 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

🛠️ Development Tools

  • Unit Test Generation: Automatically generate tests for your functions
  • Code Refactoring: Get AI-powered suggestions for code improvements
  • Documentation: Auto-generate docstrings and documentation

🎯 Interactive Experience

  • 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

🚀 Quick Start

Installation

  1. Clone the repository

    git clone <repository-url>
    cd devpal
  2. Set up virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure environment

    cp .env.example .env
    # Edit .env with your API keys

Basic Usage

  1. Initialize a project

    devpal init /path/to/your/project
  2. Ask questions about your code

    devpal ask "What does the main function do?"
  3. Generate tests

    devpal test src/main.py
  4. Get error explanations

    devpal explain "TypeError: 'int' object is not callable"
  5. Refactor code

    devpal patch src/main.py --function process_data
  6. Generate documentation

    devpal docs src/main.py
  7. Launch interactive TUI

    devpal tui

📋 Commands

devpal init <project_path>

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

devpal ask <question>

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)

devpal explain <error_message>

Analyzes error messages and provides detailed explanations with potential solutions.

devpal test <file_path>

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

devpal patch <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

devpal docs <file_path>

Generates documentation for the specified file.

Options:

  • --format: Output format (markdown, jsdoc, python)
  • --output: Output file path

devpal tui

Launches an interactive Textual-based user interface for exploring your codebase.

🔧 Configuration

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=INFO

🏗️ Architecture

devpal/
├── 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

🧪 Testing

Run the test suite:

pytest tests/

Run with coverage:

pytest --cov=src tests/

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

📄 License

MIT License - see LICENSE file for details.

🆘 Support

  • 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! 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages