# Contributing to VibeDB

Thank you for your interest in contributing to VibeDB!

## Development Setup

1. **Clone the repository**
   ```bash
   git clone https://github.com/yourusername/vibedb.git
   cd vibedb
   ```

2. **Create virtual environment**
   ```bash
   python -m venv venv
   source venv/bin/activate  # On Windows: venv\Scripts\activate
   ```

3. **Install in development mode**
   ```bash
   pip install -e ".[all,dev]"
   ```

4. **Run tests**
   ```bash
   pytest tests/
   ```

## Code Style

- Follow PEP 8 conventions
- Use type hints where appropriate
- Write docstrings for all public APIs
- Keep functions focused and small

**Formatting:**
```bash
# Format code with Black
black src/ tests/

# Lint with Ruff
ruff check src/ tests/

# Type check with mypy
mypy src/
```

## Testing

- Write tests for all new features
- Maintain >80% test coverage
- Run full test suite before submitting PR

```bash
# Run all tests
pytest tests/

# Run with coverage
pytest --cov=vibedb tests/

# Run specific test file
pytest tests/test_collection.py
```

## Pull Request Process

1. **Fork the repository** and create your branch from `main`
   ```bash
   git checkout -b feature/amazing-feature
   ```

2. **Make your changes** with clear, focused commits
   ```bash
   git commit -m "Add amazing feature"
   ```

3. **Add tests** for your changes

4. **Update documentation** if needed:
   - Update README.md if API changes
   - Update skills/ if new features
   - Add docstrings to new functions

5. **Run tests and linting**
   ```bash
   pytest tests/
   black src/ tests/
   ruff check src/ tests/
   ```

6. **Push to your fork**
   ```bash
   git push origin feature/amazing-feature
   ```

7. **Open a Pull Request** with:
   - Clear description of changes
   - Link to related issues
   - Screenshots/examples if applicable

## Commit Message Guidelines

Use clear, descriptive commit messages:

```
Add feature: Brief description

- Detailed point 1
- Detailed point 2
- Fixes #123
```

**Good examples:**
- `Add support for nested field indexing`
- `Fix: Handle null values in schema validation`
- `Docs: Update quickstart examples`

**Bad examples:**
- `fix bug`
- `updates`
- `wip`

## Areas for Contribution

We welcome contributions in these areas:

### Features
- Full-text search (FTS5 integration)
- Aggregation pipeline
- Query result streaming
- Watch/observe API for reactive queries
- Additional query operators

### Documentation
- More examples
- Tutorial videos
- Translation to other languages
- Improve API documentation

### Testing
- Edge cases
- Performance benchmarks
- Integration tests
- Load testing

### Studio UI
- Query history
- CSV/JSON export/import
- Visual query builder
- Dark mode
- Keyboard shortcuts

## Bug Reports

When filing a bug report, include:

1. **Python version**: `python --version`
2. **VibeDB version**: `pip show vibedb`
3. **Minimal reproduction**: Code that reproduces the bug
4. **Expected behavior**: What you expected to happen
5. **Actual behavior**: What actually happened
6. **Error messages**: Full traceback if applicable

## Feature Requests

Feature requests are welcome! Please include:

1. **Use case**: Why you need this feature
2. **Proposed API**: Example of how it would be used
3. **Alternatives**: Other ways you've tried to solve this
4. **Impact**: Who else would benefit from this feature

## Code Review Process

All PRs require:
- At least one maintainer approval
- All tests passing
- No merge conflicts
- Code style checks passing

We'll review PRs within 1-3 business days.

## Community Guidelines

- Be respectful and constructive
- Help others in issues and discussions
- Follow the [Code of Conduct](CODE_OF_CONDUCT.md)

## Questions?

- **Documentation**: Check `skills/` and `examples/`
- **Discussions**: Use [GitHub Discussions](https://github.com/yourusername/vibedb/discussions)
- **Issues**: For bugs and feature requests

Thank you for contributing to VibeDB! 🚀
