Thank you for your interest in contributing to the Cache Augmentation Generation (CAG) system!
- Fork the repository
- Clone your fork:
git clone <your-fork-url> - Create a feature branch:
git checkout -b feature/your-feature-name - Set up the development environment (see docs/SETUP.md)
We follow PEP 8 and use automated tools:
# Format code
black src/ tests/
# Sort imports
isort src/ tests/
# Lint
flake8 src/ tests/
# Type check
mypy src/Write tests for all new features:
# Run tests
pytest
# With coverage
pytest --cov=src --cov-report=html
# Watch mode (requires pytest-watch)
ptwTest Guidelines:
- Place tests in the
tests/directory - Mirror the source structure
- Use descriptive test names
- Aim for >80% code coverage
Follow conventional commits:
type(scope): subject
body (optional)
footer (optional)
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting)refactor: Code refactoringtest: Test additions or changeschore: Build process or auxiliary tool changes
Examples:
feat(cache): add Redis support for distributed caching
fix(api): handle empty file uploads correctly
docs(readme): update installation instructions
- Update documentation if needed
- Add tests for new functionality
- Ensure all tests pass
- Update CHANGELOG.md
- Create a pull request with a clear description
PR Title Format:
[Type] Brief description
PR Description Should Include:
- What changes were made
- Why the changes were necessary
- Any breaking changes
- Related issues (if applicable)
src/cag/
├── api/ # API endpoints and routes
├── core/ # Core configuration and models
├── services/ # Business logic services
└── ui/ # User interfaces
- Create file in
src/cag/services/ - Add tests in
tests/test_<service_name>.py - Update
src/cag/services/__init__.pyif needed - Document the service
- Add endpoint in
src/cag/api/main.pyor create route module - Add request/response models in
src/cag/core/models.py - Add tests in
tests/test_main.py - Update API documentation in
docs/API.md
- Add setting in
src/cag/core/config.py - Update
.env.example - Document in README.md
Test individual components in isolation:
def test_cache_manager_get():
cache = CacheManager()
cache.set("query", "response")
result = cache.get("query")
assert result is not NoneTest component interactions:
@pytest.mark.integration
def test_document_upload_flow():
# Test full upload → process → store flow
passUse pytest fixtures for common setup:
@pytest.fixture
def cag_service():
return CAGService()Update documentation for:
- New features
- API changes
- Configuration options
- Breaking changes
Documentation Files:
README.md: Overview and quick startdocs/ARCHITECTURE.md: System designdocs/API.md: API referencedocs/SETUP.md: Setup instructions
- Profile code for performance bottlenecks
- Use caching appropriately
- Optimize database queries
- Consider async operations for I/O
- Never commit secrets or API keys
- Validate all user inputs
- Use parameterized queries
- Follow OWASP guidelines
- Report security issues privately
- Open an issue for bugs or feature requests
- Start a discussion for questions
- Check existing issues before creating new ones
- Be respectful and inclusive
- Provide constructive feedback
- Focus on the code, not the person
- Help others learn and grow
By contributing, you agree that your contributions will be licensed under the same license as the project (MIT).