Thank you for your interest in contributing to DevStream! This document provides guidelines for contributing to the project.
- How to Contribute
- Development Workflow
- Code Standards
- Testing Requirements
- Commit Conventions
- Pull Request Process
- Documentation Requirements
- Getting Help
- Bug Reports: Submit detailed bug reports with reproducible steps
- Feature Requests: Propose new features with clear use cases
- Code Contributions: Submit pull requests for bug fixes or new features
- Documentation: Improve documentation, tutorials, or examples
- Testing: Add test coverage or improve existing tests
- Community: Help answer questions and review pull requests
- Check existing issues and pull requests to avoid duplicates
- Read the Architecture Guide
- Understand DevStream's 7-Step Workflow
- Review Code Standards
Follow the Development Setup Guide:
# Clone repository
git clone https://github.com/yourusername/devstream.git
cd devstream
# Create virtual environment
python3.11 -m venv .devstream
source .devstream/bin/activate
# Install dependencies
pip install -r requirements.txt
pip install -e ".[dev]"
# Build MCP server
cd mcp-devstream-server
npm install
npm run buildgit checkout -b feature/your-feature-nameBranch naming conventions:
feature/- New featuresfix/- Bug fixesdocs/- Documentation updatestest/- Test improvementsrefactor/- Code refactoring
DevStream uses a 7-Step Mandatory Workflow (see CLAUDE.md):
- DISCUSSION: Present problem, discuss trade-offs, identify constraints
- ANALYSIS: Analyze codebase patterns, identify files to modify
- RESEARCH: Use Context7 for best practices, document findings
- PLANNING: Create TodoWrite list, define micro-tasks (10-15 min each)
- APPROVAL: Present plan, get explicit approval
- IMPLEMENTATION: One micro-task at a time, mark progress
- VERIFICATION/TEST: Test every feature, 95%+ coverage
- One task at a time: Complete and test each micro-task before moving to next
- Incremental commits: Commit after each completed micro-task
- Test-driven development: Write tests first when possible
- Documentation first: Update docs before marking task complete
- Code review ready: Self-review code before submitting PR
Type Safety (MANDATORY):
from typing import Optional, List, Dict, Any
def hybrid_search(
self,
query: str,
limit: int = 10,
content_type: Optional[str] = None
) -> List[Dict[str, Any]]:
"""
Perform hybrid search combining semantic and keyword search.
Args:
query: Search query string
limit: Maximum results (default: 10)
content_type: Optional filter by content type
Returns:
List of memory records sorted by relevance score
Raises:
DatabaseError: If database query fails
"""
passCode Quality Requirements:
- ✅ Full type hints for all functions/methods
- ✅ Docstrings (Google style) for all public APIs
- ✅
mypy --strictcompliance (zero errors) - ✅ Max function length: 50 lines
- ✅ Max cyclomatic complexity: 10
- ✅ SOLID principles
- ❌ No
Anytype hints without justification - ❌ No bare
except:clauses - ❌ No print() statements (use structured logging)
Error Handling:
import structlog
logger = structlog.get_logger()
try:
result = await operation()
except SpecificError as e:
logger.error("operation_failed", error=str(e), context={"key": "value"})
raiseType Safety:
interface TaskCreateParams {
title: string;
description: string;
task_type: TaskType;
priority: number;
phase_name: string;
}
export async function createTask(params: TaskCreateParams): Promise<Task> {
// Implementation
}Code Quality:
- ✅ Strict TypeScript configuration
- ✅ ESLint + Prettier compliance
- ✅ Async/await for asynchronous operations
- ✅ Error handling with try/catch
- ❌ No
anytypes without justification
Python: Use black with default settings
black .TypeScript: Use prettier with project config
npm run formatMANDATORY Requirements:
- ✅ 95%+ coverage for NEW code
- ✅ 100% pass rate before PR submission
- ✅ Integration tests for E2E workflows
- ✅ Performance validation for critical paths
- ✅ Error handling tests
tests/
├── unit/ # Fast (<1s), isolated tests
│ ├── test_memory.py
│ └── test_hooks.py
├── integration/ # E2E tests (<10s)
│ ├── test_mcp_server.py
│ └── test_workflow.py
└── fixtures/ # Test data and mocks
└── sample_data.py
# Run all tests
.devstream/bin/python -m pytest tests/ -v
# Run with coverage
.devstream/bin/python -m pytest tests/ --cov=.claude/hooks/devstream --cov-report=html
# Run specific test file
.devstream/bin/python -m pytest tests/unit/test_memory.py -v
# Run specific test
.devstream/bin/python -m pytest tests/unit/test_memory.py::test_hybrid_search -vUnit Test:
import pytest
from devstream.memory import MemoryManager
def test_hybrid_search_returns_results():
"""Test hybrid search returns relevant results."""
manager = MemoryManager(db_path=":memory:")
# Insert test data
manager.store("Python async programming", content_type="documentation")
# Search
results = manager.hybrid_search("async Python", limit=5)
# Verify
assert len(results) > 0
assert "async" in results[0]["content"].lower()Integration Test:
@pytest.mark.asyncio
async def test_end_to_end_workflow():
"""Test complete task creation → execution → completion workflow."""
# Create task
task_id = await create_task(title="Test Task", ...)
# Execute
await update_task(task_id, status="active")
# Complete
await update_task(task_id, status="completed")
# Verify
task = await get_task(task_id)
assert task["status"] == "completed"<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation changestest: Test additions or modificationsrefactor: Code refactoringperf: Performance improvementschore: Build process, dependencies, etc.
Examples:
feat(memory): Add hybrid search with RRF algorithm
Implements Reciprocal Rank Fusion combining semantic and keyword search.
Improves search relevance by 35% based on benchmark tests.
Closes #123
fix(hooks): Graceful degradation when Ollama unavailable
Hook now continues execution when Ollama is not running,
logging warning instead of failing.
Fixes #456
- ✅ Atomic commits (one logical change per commit)
- ✅ Clear, descriptive commit messages
- ✅ Reference related issues
- ✅ Include co-author attribution when pair programming
- ❌ Don't commit broken code
- ❌ Don't mix unrelated changes
Checklist:
- All tests pass (
pytest tests/) - Code coverage ≥ 95% for new code
- Type checking passes (
mypy --strict) - Code formatting applied (
black .,npm run format) - Documentation updated
- CHANGELOG.md updated (if user-facing)
- Commit messages follow conventions
- No merge conflicts with
main
PR Title: Use commit message format
feat(memory): Add hybrid search with RRF algorithm
PR Description Template:
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix (non-breaking change fixing an issue)
- [ ] New feature (non-breaking change adding functionality)
- [ ] Breaking change (fix or feature causing existing functionality to change)
- [ ] Documentation update
## How Has This Been Tested?
Describe tests performed
## Checklist
- [ ] Tests pass locally
- [ ] Code coverage ≥ 95%
- [ ] Documentation updated
- [ ] CHANGELOG.md updated
## Related Issues
Closes #123What Reviewers Check:
- Code correctness and logic
- Test coverage and quality
- Performance implications
- Security considerations
- Documentation completeness
- Adherence to code standards
Response Time:
- Initial review: Within 3 business days
- Follow-up reviews: Within 2 business days
Addressing Feedback:
- Respond to all review comments
- Make requested changes in new commits (don't force push)
- Mark conversations as resolved when addressed
- Request re-review when ready
Before Merge:
- ✅ At least 1 approving review from maintainer
- ✅ All CI checks passing
- ✅ All conversations resolved
- ✅ Branch up to date with
main
Merge Strategy:
- Use "Squash and merge" for feature branches
- Preserve detailed commit history in PR description
MANDATORY Updates:
- New features → Update user guide + API reference
- API changes → Update API reference
- Workflow changes → Update developer guide
- Breaking changes → Update migration guide + CHANGELOG
User-Facing Documentation:
- Clear, concise language (international audience)
- Code examples for every feature
- Screenshots/diagrams where helpful
- Cross-references to related docs
API Documentation:
- Complete parameter documentation (types, required/optional, defaults)
- Return type specifications
- Error codes and handling
- Usage examples
Developer Documentation:
- Architecture diagrams (Mermaid)
- Design decisions and rationale
- Testing strategies
- Performance considerations
Follow Diátaxis Framework:
- Tutorials: Learning-oriented (
docs/tutorials/) - How-To Guides: Task-oriented (
docs/user-guide/) - Reference: Information-oriented (
docs/api/) - Explanation: Understanding-oriented (
docs/developer-guide/)
- Documentation: docs/
- User Guide: docs/user-guide/
- Developer Guide: docs/developer-guide/
- API Reference: docs/api/
- Tutorials: docs/tutorials/
- Questions: Open a GitHub Discussion
- Bug Reports: Open a GitHub Issue
- Feature Requests: Open a GitHub Issue
- Security Issues: See SECURITY.md
For questions about contributing:
- Open a GitHub Discussion in "Contributing" category
- Tag maintainers in relevant issues/PRs
By contributing to DevStream, you agree that your contributions will be licensed under the MIT License.
Your contributions make DevStream better for everyone. We appreciate your time and effort! 🙏