Contributing to LEGIONHERCULES¶
Thank you for your interest in contributing to LEGIONHERCULES!
Development Setup¶
1. Fork and Clone¶
2. Create Virtual Environment¶
3. Install Dependencies¶
4. Install Pre-commit Hooks¶
Development Workflow¶
Running Tests¶
# Run all tests
pytest
# Run with coverage
pytest --cov=legionhercules
# Run specific test
pytest tests/test_agent.py
Code Style¶
We use Black and Ruff for code formatting:
# Format code
black src/ tests/
# Lint code
ruff check src/ tests/
# Fix auto-fixable issues
ruff check --fix src/ tests/
Type Checking¶
Project Structure¶
legionhercules/
├── src/legionhercules/ # Main source code
│ ├── core/ # Core agent and task management
│ ├── tools/ # Tool implementations
│ ├── llm/ # LLM providers
│ ├── cli/ # Command-line interface
│ ├── config/ # Configuration management
│ └── utils/ # Utilities
├── tests/ # Test files
├── docs/ # Documentation
└── pyproject.toml # Project configuration
Adding New Features¶
Adding a New Tool¶
- Create tool class in
src/legionhercules/tools/ - Inherit from
Toolbase class - Implement
execute()andget_schema()methods - Register in
ToolRegistry.create_default_registry() - Add tests in
tests/tools/
Example:
from legionhercules.tools.base import Tool, ToolResult
class MyTool(Tool):
def __init__(self):
super().__init__(name="my_tool", description="...")
async def execute(self, **kwargs) -> ToolResult:
# Implementation
pass
def get_schema(self) -> dict:
return {...}
Adding a New LLM Provider¶
- Create provider in
src/legionhercules/llm/ - Inherit from
LLMProviderbase class - Implement required methods
- Add configuration options
Adding CLI Commands¶
- Add command function in
src/legionhercules/cli/main.py - Use Typer decorators
- Add help text and examples
Submitting Changes¶
1. Create a Branch¶
2. Make Changes¶
- Write clear, documented code
- Add tests for new functionality
- Update documentation
3. Commit¶
Follow conventional commits:
- feat: New feature
- fix: Bug fix
- docs: Documentation
- test: Tests
- refactor: Code refactoring
4. Push and Create PR¶
Create a pull request with: - Clear description - Link to related issues - Test results
Code Review¶
All submissions require review. We check for:
- Code quality and style
- Test coverage
- Documentation
- Performance impact
Questions?¶
- Open an issue for bugs
- Start a discussion for features
- Join our community chat
License¶
By contributing, you agree that your contributions will be licensed under the MIT License.