Thank you for your interest in contributing to code-assistant-manager! This document provides guidelines and instructions for contributing to the project.
- Getting Started
- Development Setup
- Code Quality Standards
- Testing
- Pull Request Process
- AI-Assisted Development
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/your-username/code-assistant-manager.git cd code-assistant-manager - Add the upstream repository:
git remote add upstream https://github.com/yourorg/code-assistant-manager.git
- Python 3.9 or higher
- pip and virtualenv
- Git
- Node.js and npm (for some AI coding assistants)
-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the package in development mode with all dependencies:
make dev-install
Or manually:
pip install -e ".[dev]" pre-commit install -
Verify the installation:
code-assistant-manager --version pytest tests/ -v
We use automated code quality tools to maintain consistent, high-quality code. These tools are enforced via pre-commit hooks.
- Black: Code formatting (line length: 88)
- isort: Import sorting (compatible with Black)
- Flake8: Linting with plugins (bugbear, comprehensions, simplify)
- mypy: Type checking
- Bandit: Security vulnerability scanning
- interrogate: Docstring coverage checking
Use the Makefile for convenience:
# Format code automatically
make format
# Check formatting without changes
make format-check
# Run linting
make lint
# Run type checking
make type-check
# Run security checks
make security
# Run all checks (format-check, lint, type-check, test)
make checkPre-commit hooks automatically run before each commit. To run them manually:
# Run on all files
make pre-commit-run
# Update hook versions
make pre-commit-updateIf you need to bypass hooks temporarily (not recommended):
git commit --no-verify -m "message"# Run all tests
make test
# Run with coverage report
make test-cov
# Run specific test file
pytest tests/test_config.py -v
# Run tests matching a pattern
pytest tests/ -k "test_endpoint" -vtests/unit/- Unit tests for individual componentstests/integration/- Integration tests for multiple componentstests/interactive/- Interactive tests requiring manual verification
- Use pytest fixtures for setup/teardown
- Use appropriate markers:
@pytest.mark.unit,@pytest.mark.integration, etc. - Aim for >80% code coverage
- Mock external dependencies (API calls, file system, etc.)
Example:
import pytest
from code_assistant_manager.config import ConfigManager
def test_config_loading(tmp_path):
"""Test configuration file loading."""
config_file = tmp_path / "providers.json"
config_file.write_text('{"endpoints": {}}')
config = ConfigManager(str(config_file))
assert config.config_data == {"endpoints": {}}-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes following code quality standards
-
Write/update tests for your changes
-
Run all quality checks:
make check
-
Update documentation if needed (README, docstrings, etc.)
-
Commit your changes:
git add . git commit -m "feat: add your feature description"
Use conventional commit messages:
feat:- New featurefix:- Bug fixdocs:- Documentation changestest:- Test additions/changesrefactor:- Code refactoringstyle:- Formatting changeschore:- Maintenance tasks
-
Push to your fork:
git push origin feature/your-feature-name
-
Open a Pull Request on GitHub with:
- Clear title and description
- Reference to related issues (if any)
- Screenshots/examples (if applicable)
- Test results confirmation
-
Address review feedback promptly
-
Ensure CI passes (when available)
- ✅ All tests pass
- ✅ Code quality checks pass (lint, type-check, format)
- ✅ New code has tests
- ✅ Documentation updated
- ✅ Commit messages are clear and conventional
- ✅ No merge conflicts with main branch
This project welcomes AI-assisted contributions. Please follow these additional guidelines when using AI coding assistants:
- Always seek approval before git commit and push
- Always run tests before completing development of new changes
- Always test CLI usages to ensure functionality
- After any changes, reinstall the project:
rm -rf dist/* ./install.sh uninstall ./install.sh cp ~/.config/code-assistant-manager/providers.json.bak ~/.config/code-assistant-manager/providers.json
When using AI assistance for significant contributions, add attribution in your commit message:
feat: implement new feature
Co-Authored-By: Claude <noreply@anthropic.com>
or for other AI assistants:
feat: implement new feature
AI-Assisted: [Tool Name]
- Follow PEP 8 (enforced by Flake8)
- Use type hints where appropriate
- Maximum line length: 88 characters (Black default)
- Prefer descriptive variable names over comments
- Use docstrings for all public functions, classes, and modules
- Use Google-style docstrings
- Include parameter types and return types
- Provide usage examples for complex functions
Example:
def get_endpoint_config(self, endpoint_name: str) -> Dict[str, str]:
"""
Get full configuration for an endpoint.
Args:
endpoint_name: Name of the endpoint
Returns:
Dictionary with endpoint configuration
Example:
>>> config.get_endpoint_config("anthropic")
{'endpoint': 'https://api.anthropic.com', 'api_key_env': 'ANTHROPIC_API_KEY'}
"""
# implementationThis project uses industry-standard design patterns. When adding new code:
- Use Value Objects for validated primitives (see
value_objects.py) - Use Factory Pattern for creating tools (see
factory.py) - Use Strategy Pattern for pluggable algorithms (see
strategies.py) - Use Repository Pattern for data access (see
repositories.py) - Use Service Layer for business logic (see
services.py)
See docs/DESIGN_PATTERNS_README.md for detailed guidance.
- Open an issue for bugs or feature requests
- Start a discussion for questions or ideas
- Check existing issues and PRs before creating new ones
Thank you for contributing! 🎉