# Contributing to Coderlib
Thank you for your interest in contributing to Coderlib! This document provides guidelines and information for contributors.
## Getting Started
### Prerequisites
- Rust 1.75 or later
- Git
- Docker (for containerized testing)
### Development Setup
1. Clone the repository:
```bash
git clone https://github.com/mexyusef/coderlib.git
cd coderlib
```
2. Install dependencies:
```bash
make setup
```
3. Build the project:
```bash
make build
```
4. Run tests:
```bash
make test
```
## Development Workflow
### Code Style
- Use `cargo fmt` to format code
- Use `cargo clippy` to lint code
- Follow Rust naming conventions
- Add documentation for public APIs
### Testing
- Write unit tests for new functionality
- Add integration tests for server endpoints
- Test Docker builds locally
- Ensure all tests pass before submitting
### Commit Messages
Use conventional commit format:
```
type(scope): description
[optional body]
[optional footer]
```
Types:
- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation changes
- `style`: Code style changes
- `refactor`: Code refactoring
- `test`: Test additions/changes
- `chore`: Maintenance tasks
Examples:
```
feat(git): add branch comparison tool
fix(web): handle timeout errors gracefully
docs(readme): update installation instructions
```
## Contributing Guidelines
### Pull Requests
1. Fork the repository
2. Create a feature branch: `git checkout -b feature/your-feature`
3. Make your changes
4. Add tests for new functionality
5. Ensure all tests pass: `make test`
6. Format code: `make format`
7. Lint code: `make lint`
8. Commit your changes
9. Push to your fork
10. Create a pull request
### Pull Request Requirements
- [ ] Tests pass
- [ ] Code is formatted (`cargo fmt`)
- [ ] Code passes linting (`cargo clippy`)
- [ ] Documentation is updated
- [ ] CHANGELOG.md is updated (for significant changes)
- [ ] Commit messages follow conventional format
### Code Review Process
1. Maintainers will review your PR
2. Address any feedback
3. Once approved, your PR will be merged
## Architecture Guidelines
### Adding New Servers
1. Create server module in `src/servers/`
2. Implement `McpServerBase` trait
3. Add comprehensive tool definitions
4. Include proper error handling
5. Add security considerations
6. Create corresponding binary in `src/bin/`
7. Add Docker configuration
8. Update documentation
### Adding New Tools
1. Define tool schema in server capabilities
2. Implement tool logic in server
3. Add comprehensive error handling
4. Include input validation
5. Add tests for tool functionality
6. Update documentation
### Security Considerations
- Validate all inputs
- Implement permission checks
- Use safe command execution
- Avoid exposing sensitive information
- Follow principle of least privilege
## Testing
### Unit Tests
```bash
cargo test
```
### Integration Tests
```bash
cargo test --test integration
```
### Docker Tests
```bash
make docker-build
make docker-run
make health
```
## Documentation
### Code Documentation
- Add rustdoc comments for public APIs
- Include examples in documentation
- Document error conditions
- Explain complex algorithms
### User Documentation
- Update README.md for new features
- Add examples to documentation
- Update deployment guides
- Include troubleshooting information
## Release Process
1. Update version in Cargo.toml
2. Update CHANGELOG.md
3. Create release PR
4. Tag release after merge
5. Publish to crates.io
6. Create GitHub release
7. Update Docker images
## Community
### Code of Conduct
Please follow our [Code of Conduct](CODE_OF_CONDUCT.md) in all interactions.
### Getting Help
- Open an issue for bugs or feature requests
- Join discussions in GitHub Discussions
- Ask questions in issues with the "question" label
### Reporting Security Issues
Please report security vulnerabilities privately to [yusef314159@gmail.com](mailto:yusef314159@gmail.com).
## License
By contributing to Coderlib, you agree that your contributions will be licensed under the same terms as the project (MIT).
## Recognition
Contributors will be recognized in:
- CONTRIBUTORS.md file
- Release notes
- GitHub contributors page
Thank you for contributing to Coderlib!