Contributing Guide
July 20, 2026 ยท View on GitHub
Welcome to contribute to the Wegent project! Wegent is an AI agent-based intelligent code generation and automated execution platform with a cloud-native microservices architecture. We warmly welcome all forms of contributions, including but not limited to code submissions, documentation improvements, bug reports, and feature suggestions.
๐ Table of Contents
- Project Overview
- Development Environment Setup
- Project Architecture
- Development Workflow
- Code Standards
- Commit Conventions
- Testing Requirements
- Documentation Requirements
- Bug Reports
- Feature Requests
- Code Review
- Release Process
๐ฏ Project Overview
Wegent is an AI agent management platform based on Kubernetes-style CRD design, with key features including:
- Cloud-Native Architecture: Microservices architecture supporting horizontal scaling
- Declarative API: Kubernetes-style CRD resource management
- AI Agent Ecosystem: Supporting core concepts like Ghost, Model, Shell, Bot
- Task Collaboration: Team and Task mechanisms for multi-agent collaboration
- Containerized Execution: Isolated execution environments ensuring security
Core Components
- Frontend: Next.js + TypeScript + Tailwind CSS
- Backend: FastAPI + SQLAlchemy + MySQL
- Executor: Python + Docker containers
- Executor Manager: Task scheduling and management
- AI Services: Claude Code (supporting more model extensions)
๐ ๏ธ Development Environment Setup
Prerequisites
- Docker >= 20.10
- Docker Compose >= 2.0
- Node.js >= 18.0 (for frontend development)
- Python >= 3.10 (for backend development)
- Git
Quick Start
-
Clone the repository
git clone https://github.com/your-org/Wegent.git cd Wegent -
Start all services
docker compose up -d -
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
Local Development Environment
Frontend Development
cd frontend
npm install
npm run dev
Backend Development
cd backend
./start.sh
# Or manually: uv sync && source .venv/bin/activate
# Configure environment variables
export DATABASE_URL="mysql://user:password@localhost/wegent"
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
Executor Development
cd executor
./start.sh
# Or manually: uv sync && source .venv/bin/activate && python main.py
๐๏ธ Project Architecture
Directory Structure
Wegent/
โโโ frontend/ # Next.js frontend application
โ โโโ src/
โ โ โโโ app/ # App Router pages
โ โ โโโ apis/ # API clients
โ โ โโโ features/ # Feature modules
โ โ โโโ types/ # TypeScript type definitions
โ โโโ package.json
โโโ backend/ # FastAPI backend service
โ โโโ app/
โ โ โโโ api/ # API routes
โ โ โโโ core/ # Core configuration
โ โ โโโ models/ # Data models
โ โ โโโ schemas/ # Pydantic schemas
โ โ โโโ services/ # Business logic
โ โโโ pyproject.toml # Dependencies
โโโ executor/ # Task executor
โโโ executor_manager/ # Executor manager
โโโ shared/ # Shared utilities and models
โโโ docker/ # Docker configuration files
CRD Resource Model
The project adopts Kubernetes-style CRD design with core resources including:
- Ghost ๐ป: AI agent's soul and behavior definition
- Model ๐ง : AI model configuration
- Shell ๐: Runtime environment configuration
- Bot ๐ค: Specific agent instances
- Team ๐ฅ: Agent collaboration teams
- Workspace ๐ผ: Work environments
- Task ๐ฏ: Executable tasks
๐ Development Workflow
1. Create Branch
# Create feature branch from main
git checkout main
git pull origin main
git checkout -b feature/your-feature-name
2. Development Work
- Follow code standards
- Write unit tests
- Update related documentation
- Ensure code passes all checks
3. Commit Code
git add .
git commit -m "feat: add new feature description"
4. Push Code (Quality Checks Run Here)
Pre-push Setup (Required)
Wegent uses pre-commit hooks to ensure code quality before pushing. This is especially important for AI coding agents (Claude Code, Cursor, etc.).
# Install pre-commit
pip install pre-commit
# Install pre-push hooks
pre-commit install --hook-type pre-push
Pre-push Quality Checks
When pushing code, pre-commit automatically runs quality checks:
- Lint & Format (Black, isort, ESLint)
- Type Check (TypeScript, mypy)
- Unit Tests (only for changed modules)
- Build Check (syntax validation)
- Documentation update reminders
# First push: inspect documentation reminders without running quality checks
git push origin feature/your-feature-name
# Ask the AI to complete documentation, then run quality checks and push
AI_VERIFIED=1 git push origin feature/your-feature-name
# Skip checks if needed (not recommended)
git push --no-verify origin feature/your-feature-name
Manual Quality Checks
# Run all pre-push checks manually
pre-commit run --all-files --hook-stage pre-push
# Run specific checks
pre-commit run black --all-files
pre-commit run eslint-frontend --all-files
5. Create Pull Request
- Fill out complete PR description
- Link related issues
- Request code review
- Respond to review feedback
๐ Code Standards
Python Code Standards (Backend/Executor)
- Follow PEP 8 standards
- Use Black for code formatting
- Use isort for import organization
- Use pylint for code checking
# Code formatting
black .
isort .
# Code checking
pylint app/
TypeScript Code Standards (Frontend)
- Use ESLint + Prettier
- Follow TypeScript best practices
- Use strict type checking
# Code checking and formatting
npm run lint
npm run format
General Standards
- Use descriptive naming for functions and variables
- Add necessary comments and docstrings
- Keep code clean and readable
- Avoid duplicate code, extract common logic
๐จ Commit Conventions
Use Conventional Commits specification:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Commit Types
feat: New featuresfix: Bug fixesdocs: Documentation updatesstyle: Code formattingrefactor: Code refactoringtest: Test-relatedchore: Build and tooling-related
Examples
feat(backend): add user authentication API
fix(frontend): resolve task status display issue
docs: update contributing guide
refactor(executor): improve error handling
๐งช Testing Requirements
Wegent uses comprehensive testing frameworks across all modules. All code changes should include appropriate tests.
Backend Testing
- Use pytest with pytest-asyncio, pytest-cov, and pytest-mock
- Write unit tests for all business logic
- Add integration tests for API endpoints and database operations
- Target: Maintain or improve code coverage (minimum 40-60%, target 70-80%)
- Use test markers:
@pytest.mark.unit,@pytest.mark.integration,@pytest.mark.slow
cd backend
# Run all tests
pytest
# Run with coverage
pytest --cov=app --cov-report=html
# Run only unit tests
pytest -m unit
Frontend Testing
- Use Jest + React Testing Library
- Write component unit tests
- Mock API calls and external dependencies
- Add E2E tests for critical user flows (Playwright)
cd frontend
npm test
npm run test:coverage
Executor and Shared Module Testing
- Mock external services (Anthropic, OpenAI, Docker, etc.)
- Test error handling and edge cases
- Use fixtures for common test setup
# Executor tests
cd executor
pytest tests/ --cov=agents
# Executor Manager tests
cd executor_manager
pytest tests/ --cov=executors
# Shared utilities tests
cd shared
pytest tests/ --cov=utils
Test Organization Best Practices
- Follow AAA Pattern: Arrange, Act, Assert
- One assertion per test: Each test should verify one specific behavior
- Descriptive test names: Use clear names that explain what is being tested
- Mock external dependencies: Never call real external services in tests
- Use fixtures: Share common setup via pytest fixtures
- Test edge cases: Include tests for error conditions and boundary values
- Keep tests independent: Each test should run independently
CI/CD Testing
All tests run automatically via GitHub Actions on:
- Push to
main,master, ordevelopbranches - All pull requests
The test suite includes:
- Backend tests (Python 3.10, 3.11, 3.12)
- Executor tests
- Executor Manager tests
- Shared utilities tests
- Frontend tests (Node.js 18.x)
Coverage reports are uploaded to Codecov.
For detailed testing documentation, see:
- ๐ Complete Testing Guide (English) - Comprehensive test framework documentation
- ๐ ๅฎๆดๆต่ฏๆๅ๏ผไธญๆ๏ผ - ็ปผๅๆต่ฏๆกๆถๆๆกฃ
- ๐ Developer Setup Guide - Testing section
๐ Documentation Requirements
API Documentation
- Use FastAPI auto-generated Swagger documentation
- Add detailed descriptions for all endpoints
- Provide request/response examples
Code Documentation
- Python: Use docstring format
- TypeScript: Use JSDoc comments
- Add inline comments for complex logic
User Documentation
- Keep README.md up to date
- Feature usage guides
- Troubleshooting documentation
๐ Bug Reports
When reporting bugs using GitHub Issues, please include:
-
Environment Information
- Operating system
- Docker version
- Browser version (for frontend issues)
-
Reproduction Steps
- Detailed operation steps
- Expected behavior
- Actual behavior
-
Related Logs
- Error messages
- Console output
- Service logs
-
Screenshots or Screen Recording (if applicable)
๐ก Feature Requests
When submitting feature requests, please describe:
- Feature description and use cases
- Expected user experience
- Possible implementation approaches
- Impact on existing features
๐ Code Review
Review Checklist
- Code follows standards
- Features correctly implemented
- Sufficient test coverage
- Documentation updated completely
- Performance impact assessed
- Security considerations
- Backward compatibility
Review Principles
- Constructive feedback
- Focus on code quality
- Consider maintainability
- Respect different viewpoints
๐ Release Process
Version Management
Use Semantic Versioning (SemVer):
MAJOR.MINOR.PATCH- Major version: Incompatible API changes
- Minor version: Backward-compatible feature additions
- Patch version: Backward-compatible bug fixes
Release Steps
- Update version number
- Update CHANGELOG.md
- Create release branch
- Code review and testing
- Merge to main branch
- Create Git tag
- Build and publish Docker images
๐ค Community Code of Conduct
We are committed to providing a friendly, safe, and welcoming environment for everyone. Please follow these principles:
- Use friendly and inclusive language
- Respect different viewpoints and experiences
- Gracefully accept constructive criticism
- Focus on what is best for the community
- Show empathy towards other community members
๐ Contact
If you have any questions, feel free to contact us through:
- GitHub Issues: Report bugs and feature requests
- GitHub Discussions: Community discussions and Q&A
- Email: [maintainer email]
๐ License
This project is licensed under the Apache 2.0 License. By contributing code, you agree that your contributions will be licensed under the same license.
Thank you for contributing to the Wegent project! ๐