Thank you for your interest in contributing to Repomix! This document provides guidelines and information to help you contribute effectively to the project.
- Getting Started
- Development Setup
- Development Workflow
- Code Guidelines
- Testing
- Documentation
- Submitting Contributions
- Project Structure
- Release Process
- Python 3.10 or higher
- PDM (Python Dependency Manager) - Recommended
- Git
-
Fork the repository on GitHub
-
Clone your fork locally:
git clone https://github.com/AndersonBY/python-repomix.git cd python-repomix -
Add the upstream remote:
git remote add upstream https://github.com/AndersonBY/python-repomix.git
# Install PDM if you haven't already
pip install pdm
# Install project dependencies
pdm install --dev# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e .
pip install pytest pytest-asyncio ruff pyright# Test the CLI
pdm run python -m repomix --help
# Run tests
pdm run python -m pytest
# Run code quality checks
pdm run ruff check .
pdm run pyright-
Create a feature branch from
main:git checkout main git pull upstream main git checkout -b feature/your-feature-name
-
Work on your changes with regular commits:
git add . git commit -m "feat: add new feature description"
-
Keep your branch updated:
git fetch upstream git rebase upstream/main
We follow the Conventional Commits specification:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changestest:- Adding or modifying testsrefactor:- Code refactoringperf:- Performance improvementschore:- Maintenance tasks
Examples:
feat: add remote repository support with branch selection
fix: handle edge case in file encoding detection
docs: update installation instructions
test: add comprehensive MCP server tests
We use Ruff for linting and Pyright for type checking:
# Run linter (with auto-fix)
pdm run ruff check --fix .
# Run type checker
pdm run pyright- Type Annotations: All new code must include type annotations
- Documentation: Public functions and classes must have docstrings
- Error Handling: Use appropriate exception handling and validation
- Security: Never commit secrets or sensitive information
- Performance: Consider performance implications for large repositories
- Modular Design: Keep components loosely coupled
- Single Responsibility: Each class/function should have one clear purpose
- Configuration-Driven: Use the configuration system for customizable behavior
- Error Recovery: Handle edge cases gracefully
- Testability: Write code that's easy to test
# Run all tests
pdm run python -m pytest
# Run specific test file
pdm run python -m pytest tests/test_core_functionality.py
# Run tests with coverage
pdm run python -m pytest --cov=src/repomix --cov-report=html
# Run MCP-specific tests
pdm run python -m pytest tests/test_mcp*.py- Write Tests First: Consider TDD for new features
- Test Coverage: Aim for high test coverage, especially for core functionality
- Unit Tests: Test individual components in isolation
- Integration Tests: Test component interactions
- Edge Cases: Test error conditions and boundary cases
class TestFeatureName:
"""Test suite for FeatureName functionality"""
def setup_method(self):
"""Setup before each test method"""
pass
def test_basic_functionality(self):
"""Test basic feature behavior"""
# Arrange
# Act
# Assert
pass
def test_edge_cases(self):
"""Test edge cases and error conditions"""
pass- Docstrings: Use Google-style docstrings for all public functions
- Type Hints: Include comprehensive type annotations
- Comments: Explain complex logic, not obvious code
Example:
def process_repository(
config: RepomixConfig,
directory: Path
) -> ProcessResult:
"""Process a repository and generate output.
Args:
config: Configuration object with processing options
directory: Path to the repository directory
Returns:
ProcessResult containing output and metadata
Raises:
RepositoryError: If repository cannot be processed
ConfigurationError: If configuration is invalid
"""- Update README.md for user-facing changes
- Add examples for new features
- Update CLI help text when adding options
-
Run all quality checks:
pdm run ruff check . pdm run pyright pdm run python -m pytest -
Update documentation if needed
-
Add tests for new functionality
-
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:
- Use a descriptive title
- Fill out the PR template
- Link related issues
- Add screenshots for UI changes
-
Address review feedback:
- Make requested changes
- Push updates to the same branch
- Respond to comments
-
Merge requirements:
- All CI checks must pass
- At least one maintainer approval
- No conflicts with main branch
python-repomix/
├── src/repomix/ # Main source code
│ ├── cli/ # Command-line interface
│ ├── config/ # Configuration management
│ ├── core/ # Core processing logic
│ │ ├── file/ # File processing pipeline
│ │ ├── output/ # Output generation
│ │ └── security/ # Security scanning
│ ├── mcp/ # MCP (Model Context Protocol) server
│ └── shared/ # Shared utilities
├── tests/ # Test suite
├── docs/ # Documentation (if any)
├── CLAUDE.md # Claude Code instructions
├── pyproject.toml # Project configuration
└── README.md # Project documentation
- RepoProcessor: Main orchestrator for repository processing
- Configuration System: Hierarchical config loading and validation
- File Pipeline: Modular file collection, filtering, and processing
- Output Generators: Multiple output formats (markdown, XML, plain text)
- MCP Server: Model Context Protocol integration for AI tools
- Security Layer: Integration with detect-secrets for sensitive data detection
We use semantic versioning (SemVer):
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
- Update version in
pyproject.toml - Update
CHANGELOG.md - Create release branch
- Run full test suite
- Create GitHub release
- Publish to PyPI (maintainers only)
- GitHub Issues: Bug reports and feature requests
- GitHub Discussions: General questions and community discussion
- Code Reviews: PR discussions and feedback
- Python Documentation: docs.python.org
- PDM Documentation: pdm.fming.dev
- Type Hints: PEP 484
- Testing with pytest: pytest.org
Import Errors: Make sure you've installed in development mode
pdm install --devType Check Failures: Install and run pyright
pdm install --dev
pdm run pyrightTest Failures: Run tests individually to debug
pdm run python -m pytest tests/test_specific.py -vThis project adheres to a code of conduct that ensures a welcoming environment for all contributors. Please be respectful, inclusive, and constructive in all interactions.
- Use welcoming and inclusive language
- Be respectful of differing viewpoints and experiences
- Gracefully accept constructive criticism
- Focus on what is best for the community
- Show empathy towards other community members
Contributors are recognized in several ways:
- Listed in project documentation
- Mentioned in release notes
- GitHub contributor statistics
- Community appreciation
Thank you for contributing to Repomix! Your efforts help make this tool better for everyone in the AI and development community.