Thank you for considering contributing to Mindwave! This document provides guidelines for contributing.
- PHP 8.2+ with coverage driver (Xdebug or PCOV)
- Composer 2.x
- OpenAI API key (for integration tests)
-
Clone the repository:
git clone https://github.com/helgesverre/mindwave.git cd mindwave -
Install dependencies:
composer install
-
Copy environment file (if needed):
cp .env.example .env
-
Run tests to verify setup:
composer test
macOS (Homebrew):
pecl install pcov
# Or
pecl install xdebugUbuntu/Debian:
sudo apt-get install php-pcov
# Or
sudo apt-get install php-xdebug# Run all checks
composer check
# Individual checks
composer test # Unit/feature tests
composer test-coverage # With coverage report
composer analyse # PHPStan static analysis
composer format # Auto-fix code style
composer format:check # Check style without fixingAll code must:
- ✅ Pass all tests (
composer test) - ✅ Pass PHPStan level 4+ (
composer analyse) - ✅ Follow Laravel Pint style (
composer format) - ✅ Include tests for new features
- ✅ Update documentation
Note: Pre-commit hooks (GrumPHP) will run automatically if installed.
-
Fork the repository and create a feature branch
git checkout -b feature/my-new-feature
-
Write tests for new functionality
-
Update documentation if adding features
-
Run quality checks:
composer check
-
Commit with conventional commit format:
feat: add support for Google Gemini fix: resolve token counting issue in Mistral docs: update installation instructions test: add tests for streaming responses chore: update dependencies -
Push and create PR against
mainbranch -
Respond to review feedback
- Follow PSR-12 coding style (enforced by Pint)
- Use strict types (
declare(strict_types=1)) - Write PHPDoc comments for public methods
- Prefer named parameters for clarity
- Use type hints everywhere
- Write tests in Pest PHP
- Aim for 80%+ code coverage
- Use descriptive test names:
it('embeds question and searches vectorstore'); it('returns I dont know message when no documents found');
- Mock external API calls (OpenAI, Mistral, etc.)
- Use factories for test data
Mindwave follows these patterns:
- Driver-based: LLM, Embeddings, Vectorstore drivers
- Fluent interfaces: Prompt composer, Brain, QA
- Facades:
Mindwave::prompt(),Mindwave::llm() - Laravel conventions: Service providers, config, Artisan commands
- Open an issue for bugs or feature requests
- Start a discussion for questions
- Email helge.sverre@gmail.com for security issues
By contributing, you agree that your contributions will be licensed under the MIT License.