Thank you for your interest in contributing to ClawTeam! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Setup
- Development Workflow
- Code Style Guidelines
- Testing
- Pull Request Process
- Issue Reporting
- Community
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/your-username/ClawTeam.git cd ClawTeam - Add upstream remote:
git remote add upstream https://github.com/original-org/ClawTeam.git
- Create a branch for your changes:
git checkout -b feature/your-feature-name
- Node.js 22+ and npm
- Docker and Docker Compose
- PostgreSQL 16+
- Redis 7+
- Git
# Install dependencies
npm install
# Start infrastructure
docker compose up postgres redis -d
# Run database migrations
npm run migrate:up
# Start development servers
npm run devCopy .env.example to .env and configure your local environment:
cp .env.example .envEdit .env with your local settings (database credentials, API keys, etc.).
feature/- New features (e.g.,feature/add-bot-discovery)fix/- Bug fixes (e.g.,fix/session-recovery-bug)docs/- Documentation updates (e.g.,docs/update-api-reference)refactor/- Code refactoring (e.g.,refactor/task-coordinator)test/- Test additions or updates (e.g.,test/add-integration-tests)
We follow the Conventional Commits specification:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, missing semicolons, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Examples:
feat(api): add bot capability search endpoint
Implement semantic search for bot capabilities using vector similarity.
Includes caching layer for improved performance.
Closes #123
fix(gateway): resolve session recovery race condition
Fix race condition in session tracker that caused duplicate task routing.
Add mutex lock to prevent concurrent session updates.
Fixes #456
# Fetch upstream changes
git fetch upstream
# Merge upstream main into your branch
git checkout main
git merge upstream/main
# Rebase your feature branch
git checkout feature/your-feature-name
git rebase main- Use TypeScript for all new code
- Enable strict mode in
tsconfig.json - Prefer interfaces over type aliases for object shapes
- Use explicit return types for functions
- Avoid
anytype - useunknownif type is truly unknown
Example:
// Good
interface BotCapability {
name: string;
description: string;
async: boolean;
estimatedTime: string;
}
function searchCapabilities(query: string): Promise<BotCapability[]> {
// implementation
}
// Avoid
function searchCapabilities(query: any): any {
// implementation
}- Files: kebab-case (e.g.,
task-coordinator.ts) - Classes: PascalCase (e.g.,
TaskCoordinator) - Functions/Variables: camelCase (e.g.,
searchCapabilities) - Constants: UPPER_SNAKE_CASE (e.g.,
MAX_RETRY_ATTEMPTS) - Interfaces: PascalCase with
Iprefix optional (e.g.,BotCapabilityorIBotCapability)
- Keep files focused and under 300 lines when possible
- Group related functionality into modules
- Use barrel exports (
index.ts) for public APIs - Separate concerns: routes, services, repositories, types
- Write self-documenting code with clear variable/function names
- Add JSDoc comments for public APIs
- Explain "why" not "what" in comments
- Keep comments up-to-date with code changes
Example:
/**
* Searches for bots with matching capabilities using semantic similarity.
*
* @param query - Natural language capability description
* @param threshold - Minimum similarity score (0-1)
* @returns Array of matching bots sorted by relevance
*/
export async function searchBots(
query: string,
threshold: number = 0.7
): Promise<Bot[]> {
// Use cached results if available to reduce API calls
const cached = await cache.get(query);
if (cached) return cached;
// implementation
}# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run specific test file
npm test -- task-coordinator.test.ts
# Run tests in watch mode
npm test -- --watch- Write tests for all new features
- Maintain or improve code coverage (target: 80%+)
- Use descriptive test names
- Follow AAA pattern: Arrange, Act, Assert
- Mock external dependencies
Example:
describe('TaskCoordinator', () => {
describe('delegateTask', () => {
it('should delegate task to bot with matching capability', async () => {
// Arrange
const coordinator = new TaskCoordinator(mockDb, mockRedis);
const task = createMockTask({ capability: 'code_review' });
const bot = createMockBot({ capabilities: ['code_review'] });
// Act
const result = await coordinator.delegateTask(task, bot.id);
// Assert
expect(result.status).toBe('delegated');
expect(result.assignedTo).toBe(bot.id);
});
});
});Integration tests are located in tests/multibot/. To run them:
cd tests/multibot
python -m pytest-
Update your branch with the latest main:
git fetch upstream git rebase upstream/main
-
Run tests and ensure they pass:
npm test npm run lint -
Update documentation if needed:
- Update README if adding new features
- Update API docs if changing endpoints
- Add/update code comments
-
Update CHANGELOG.md with your changes
-
Push your branch to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub
-
Fill out the PR template with:
- Description of changes
- Related issue numbers
- Testing performed
- Screenshots (if UI changes)
-
Request review from maintainers
- Maintainers will review your PR within 3-5 business days
- Address review comments by pushing new commits
- Once approved, a maintainer will merge your PR
- Your contribution will be included in the next release
- Code follows project style guidelines
- Tests added/updated and passing
- Documentation updated
- CHANGELOG.md updated
- Commit messages follow convention
- No merge conflicts with main
- PR description is clear and complete
Use the Bug Report template and include:
- Clear description of the bug
- Steps to reproduce
- Expected vs actual behavior
- Environment details (OS, Node version, etc.)
- Error messages and stack traces
- Screenshots if applicable
Use the Feature Request template and include:
- Clear description of the feature
- Use case and motivation
- Proposed implementation (optional)
- Alternatives considered
Use the Question template or start a GitHub Discussion.
- GitHub Issues: Bug reports and feature requests
- GitHub Discussions: Questions, ideas, and general discussion
- Pull Requests: Code contributions
- Check existing documentation
- Search existing issues
- Ask in GitHub Discussions
Thank you for contributing to ClawTeam! 🎉