Thank you for your interest in contributing to Claude Code Mux! We appreciate all contributions, from bug reports to new features.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Coding Guidelines
- Commit Messages
- Pull Request Process
- Testing
By participating in this project, you agree to maintain a respectful and inclusive environment. Be kind, professional, and constructive in all interactions.
- Fork the repository on GitHub
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/claude-code-mux cd claude-code-mux - Add upstream remote:
git remote add upstream https://github.com/9j/claude-code-mux
- Create a branch:
git checkout -b feature/your-feature-name
- Rust 1.70 or later
- Cargo (comes with Rust)
# Build the project
cargo build
# Run tests
cargo test
# Run in development mode
cargo run
# Run with release optimizations
cargo run --release
# Format code
cargo fmt
# Check for linting issues
cargo clippyclaude-code-mux/
├── src/
│ ├── main.rs # Application entry point
│ ├── cli/ # CLI argument parsing
│ ├── server/ # HTTP server and admin UI
│ ├── router/ # Routing logic
│ ├── providers/ # Provider implementations
│ └── models/ # Data models
├── config/ # Configuration templates
├── docs/ # Documentation
└── benches/ # Benchmarks
Before creating a bug report:
- Check the existing issues
- Try the latest version from
mainbranch
When creating a bug report, include:
- Title: Clear, descriptive summary
- Description: Detailed explanation of the issue
- Steps to reproduce: Numbered list of exact steps
- Expected behavior: What should happen
- Actual behavior: What actually happens
- Environment:
- OS and version
- Rust version (
rustc --version) - Claude Code Mux version
- Logs: Relevant error messages or stack traces
- Screenshots: If applicable
Feature suggestions are welcome! Please:
- Check discussions first
- Clearly describe the use case
- Explain why this feature would be useful
- Consider backward compatibility
- Be open to discussion and feedback
We actively welcome pull requests for:
- Bug fixes
- New features
- Documentation improvements
- Performance optimizations
- Code refactoring
- Test coverage improvements
- Follow the official Rust Style Guide
- Use
cargo fmtbefore committing - Ensure
cargo clippypasses with no warnings - Write idiomatic Rust code
- Add documentation comments for public APIs
// Good: Clear, documented public API
/// Routes a request to the appropriate model based on routing rules.
///
/// # Arguments
/// * `request` - The incoming API request
///
/// # Returns
/// The model name to use for this request
pub fn route_request(request: &Request) -> String {
// Implementation
}
// Good: Descriptive variable names
let selected_provider = providers.iter()
.find(|p| p.enabled && p.priority == 1)
.unwrap_or(&default_provider);
// Good: Error handling
match config.load() {
Ok(cfg) => cfg,
Err(e) => {
error!("Failed to load config: {}", e);
return Err(AppError::ConfigError(e));
}
}When modifying the Admin UI (src/server/admin.html):
- Follow design principles: See docs/design-principles.md
- Use URL-based routing: See docs/url-state-management.md
- Update localStorage properly: See docs/localstorage-state-management.md
- Key rules:
- One purpose per page
- Show value before complexity
- Make questions easy to answer
- Always show save notifications
- Document all public APIs with
///comments - Include examples in documentation
- Update README.md for user-facing changes
- Add inline comments for complex logic
- Keep docs up to date with code changes
We follow the Conventional Commits specification:
<type>(<scope>): <subject>
<body>
<footer>
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringperf: Performance improvementstest: Adding or updating testschore: Maintenance tasks
feat(router): add support for custom routing rules
Allow users to define custom routing rules in the config file.
This enables more flexible routing strategies.
Closes #123
fix(server): resolve admin UI state sync issue
The admin UI was not properly syncing localStorage to server
on save. This commit ensures syncToServer() is called correctly.
Fixes #456
docs: update installation instructions for macOS
Add Homebrew installation method and clarify build steps.
-
Update your fork:
git fetch upstream git rebase upstream/main
-
Make your changes:
- Write clear, focused commits
- Add tests for new features
- Update documentation
-
Test thoroughly:
cargo test cargo fmt --check cargo clippy -
Push to your fork:
git push origin feature/your-feature-name
-
Create Pull Request:
- Use a clear, descriptive title
- Reference related issues
- Describe what changed and why
- Add screenshots for UI changes
- Check "Allow edits from maintainers"
-
Address review feedback:
- Be responsive to comments
- Make requested changes
- Push updates to the same branch
- Re-request review when ready
-
Merge requirements:
- All tests passing
- Code review approved
- No merge conflicts
- Follows style guidelines
# Run all tests
cargo test
# Run specific test
cargo test test_name
# Run tests with output
cargo test -- --nocapture
# Run benchmarks
cargo bench#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_routing_logic() {
let router = Router::new();
let request = create_test_request();
let result = router.route(request);
assert_eq!(result.model, "expected-model");
}
}- Aim for >80% coverage on new code
- Test edge cases and error conditions
- Include integration tests for major features
- General questions: GitHub Discussions
- Bug reports: GitHub Issues
- Security issues: See SECURITY.md (create if sensitive)
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to Claude Code Mux! 🎉