First off, thanks for considering contributing to Cloq! π Every contribution helps make LLM development safer for everyone.
# 1. Fork and clone
git clone https://github.com/YOUR_USERNAME/cloq.git
cd cloq
# 2. Create a virtual environment
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
# 3. Install in development mode
pip install -e ".[all]"
# 4. Install pre-commit hooks
pre-commit install
# 5. Run tests to make sure everything works
pytest tests/ -v- Create a branch:
git checkout -b feature/my-awesome-feature - Make your changes
- Run checks:
make check(lint + type-check + test) - Commit with a clear message
- Push and open a PR
We use Ruff for linting and formatting:
# Check for issues
ruff check src/ tests/
# Auto-fix issues
ruff check --fix src/ tests/
# Format code
ruff format src/ tests/# Run all tests with coverage
make test
# Run specific tests
pytest tests/test_detection/test_secrets.py -v
# Run without coverage (faster)
make test-fastmypy src/cloq/We follow Conventional Commits:
feat:β New featurefix:β Bug fixdocs:β Documentation onlytest:β Adding or updating testsrefactor:β Code change that neither fixes a bug nor adds a featureperf:β Performance improvementci:β CI/CD changes
Cloq uses a plugin architecture for detectors. To add a new one:
- Create a new file in
src/cloq/detection/ - Subclass
BaseDetector - Implement the
detect()method - Add tests in
tests/test_detection/ - Register it in the pipeline
from cloq.detection.base import BaseDetector, DetectionResult
class MyDetector(BaseDetector):
name = "my_detector"
def detect(self, text: str) -> list[DetectionResult]:
# Your detection logic here
...Use the Bug Report template and include:
- Cloq version (
cloq --version) - Python version
- Operating system
- Steps to reproduce
- Expected vs. actual behavior
Use the Feature Request template and describe:
- The problem you're trying to solve
- Your proposed solution
- Any alternatives you've considered
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.