Skip to main content
Thank you for your interest in contributing to Humancheck! This guide will help you get started with contributing to the project.

Getting Started

Development Setup

  1. Clone the repository:
    git clone https://github.com/shashisp/humancheck.git
    cd humancheck
    
  2. Install dependencies:
    poetry install
    
  3. Set up pre-commit hooks (optional but recommended):
    poetry run pre-commit install
    
  4. Initialize configuration:
    poetry run humancheck init
    
  5. Run tests:
    poetry run pytest
    

Project Structure

humancheck/
β”œβ”€β”€ src/humancheck/          # Main package
β”‚   β”œβ”€β”€ adapters/            # Framework adapters
β”‚   β”œβ”€β”€ routing/             # Routing engine
β”‚   β”œβ”€β”€ tools/               # MCP tools
β”‚   β”œβ”€β”€ api.py               # REST API
β”‚   β”œβ”€β”€ mcp_server.py        # MCP server
β”‚   β”œβ”€β”€ config.py            # Configuration
β”‚   β”œβ”€β”€ database.py          # Database layer
β”‚   β”œβ”€β”€ models.py            # Core data models
β”‚   β”œβ”€β”€ platform_models.py   # Multi-tenancy models
β”‚   └── schemas.py           # Pydantic schemas
β”œβ”€β”€ frontend/                # Streamlit dashboard
β”œβ”€β”€ examples/                # Example integrations
β”œβ”€β”€ tests/                   # Test suite
└── docs/                    # Documentation

Development Workflow

Creating a New Feature

  1. Create a new branch:
    git checkout -b feature/your-feature-name
    
  2. Make your changes:
    • Write code
    • Add tests
    • Update documentation
  3. Run tests and linting:
    poetry run pytest
    poetry run black .
    poetry run ruff check .
    
  4. Commit your changes:
    git add .
    git commit -m "feat: your feature description"
    
  5. Push and create PR:
    git push origin feature/your-feature-name
    

Commit Message Guidelines

Follow conventional commits format:
  • feat: New feature
  • fix: Bug fix
  • docs: Documentation changes
  • test: Test additions or changes
  • refactor: Code refactoring
  • style: Code style changes (formatting, etc.)
  • chore: Build process or auxiliary tool changes
Example:
feat: add Slack notification support for review decisions

Code Standards

Python Style

  • Follow PEP 8
  • Use Black for formatting (line length: 100)
  • Use type hints wherever possible
  • Write docstrings for all public functions and classes

Example Code Style

async def create_review(
    task_type: str,
    proposed_action: str,
    confidence_score: Optional[float] = None,
) -> Review:
    """Create a new review request.

    Args:
        task_type: Type of task being reviewed
        proposed_action: The action to be reviewed
        confidence_score: Optional confidence score (0-1)

    Returns:
        Created Review instance

    Raises:
        ValueError: If task_type is invalid
    """
    # Implementation
    pass

Adding New Framework Adapters

To add support for a new AI framework:
  1. Create adapter file:
    # src/humancheck/adapters/your_framework_adapter.py
    from .base import ReviewAdapter, UniversalReview
    
    class YourFrameworkAdapter(ReviewAdapter):
        def to_universal(self, framework_request):
            # Convert to UniversalReview
            pass
    
        def from_universal(self, universal_review, decision):
            # Convert back to framework format
            pass
    
        def get_framework_name(self):
            return "your_framework"
    
        async def handle_blocking(self, review_id, timeout):
            # Handle blocking requests
            pass
    
  2. Register in __init__.py:
    from .your_framework_adapter import YourFrameworkAdapter
    
    __all__ = [..., "YourFrameworkAdapter"]
    
  3. Add tests:
    # tests/test_your_framework_adapter.py
    def test_your_framework_adapter():
        # Test adapter functionality
        pass
    
  4. Update documentation:
    • Add example in examples/
    • Update README.md
    • Add to adapter documentation

Testing

Running Tests

# Run all tests
poetry run pytest

# Run with coverage
poetry run pytest --cov=humancheck

# Run specific test file
poetry run pytest tests/test_api.py

# Run specific test
poetry run pytest tests/test_api.py::test_create_review

Writing Tests

  • Write tests for all new features
  • Aim for >80% code coverage
  • Use pytest fixtures for common setup
  • Test both success and error cases
Example:
@pytest.mark.asyncio
async def test_create_review(client):
    """Test creating a review request."""
    response = await client.post("/reviews", json={
        "task_type": "test",
        "proposed_action": "Test action",
    })
    assert response.status_code == 201
    assert response.json()["status"] == "pending"

Documentation

Updating Documentation

  • Keep README.md up to date
  • Add docstrings to all public APIs
  • Update examples when adding features
  • Add inline comments for complex logic

Documentation Structure

The documentation is in the humancheck-docs repository:
  • Main docs: /docs directory
  • API reference: Auto-generated from OpenAPI spec
  • Examples: /examples directory

Pull Request Process

  1. Ensure tests pass:
    poetry run pytest
    
  2. Update documentation if needed
  3. Create pull request:
    • Clear title and description
    • Reference any related issues
    • Include screenshots for UI changes
  4. Code review:
    • Address reviewer feedback
    • Keep discussions professional and constructive
  5. Merge:
    • Squash commits if requested
    • Delete branch after merge

Reporting Issues

Bug Reports

Include:
  • Description of the bug
  • Steps to reproduce
  • Expected vs actual behavior
  • Environment (OS, Python version, etc.)
  • Relevant logs or error messages
Use the GitHub issue template when creating a bug report to ensure all necessary information is included.

Feature Requests

Include:
  • Clear description of the feature
  • Use case and motivation
  • Example API or usage
  • Any alternatives considered

Code of Conduct

Our Standards

  • Be respectful and inclusive
  • Welcome newcomers
  • Focus on constructive feedback
  • Respect different viewpoints
  • Prioritize community well-being

Unacceptable Behavior

  • Harassment or discrimination
  • Trolling or insulting comments
  • Publishing private information
  • Unprofessional conduct

Areas Where We Need Help

Framework Adapters

Add adapters for new AI frameworks (OpenAI Assistants, CrewAI, etc.)

Connectors

Build connectors for new notification channels (Email, Discord, Teams)

Documentation

Improve docs, add examples, write tutorials

Testing

Increase test coverage, add integration tests

Dashboard

Enhance the Streamlit dashboard UI/UX

Routing

Add advanced routing rules and ML-powered routing

Questions?

Need help? We’re here to assist:

License

By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to Humancheck! πŸŽ‰