# Contributing to Dynamic Grounding for GitHub Copilot
Thank you for your interest in contributing! This document provides guidelines and instructions for contributing to the project.
## Code of Conduct
- Be respectful and constructive
- Welcome newcomers and help them learn
- Focus on what is best for the community
- Show empathy towards other community members
## Getting Started
### Prerequisites
- **Rust 1.70+**: Install from [rustup.rs](https://rustup.rs/)
- **Node.js 18+**: Required for VS Code extension development
- **VS Code**: For testing the extension
- **Git**: For version control
### Setting Up Development Environment
1. **Clone the repository:**
```bash
git clone https://github.com/ciresnave/dynamic_grounding_for_github_copilot.git
cd dynamic_grounding_for_github_copilot
```
2. **Build the Rust MCP server:**
```bash
cargo build
cargo test
```
3. **Set up the VS Code extension:**
```bash
cd vscode-extension
npm install
npm run compile
```
4. **Get a Google Gemini API key:**
- Visit [Google AI Studio](https://aistudio.google.com/app/apikey)
- Create a free API key
- Run: `cargo run -- --setup` to configure it
## Development Workflow
### Working on the Rust Server
1. **Create a feature branch:**
```bash
git checkout -b feature/your-feature-name
```
2. **Make your changes**
3. **Run tests:**
```bash
cargo test
cargo clippy -- -D warnings
cargo fmt --check
```
4. **Test manually:**
```bash
cargo run
```
### Working on the VS Code Extension
1. **Make your changes in `vscode-extension/src/`**
2. **Compile TypeScript:**
```bash
npm run compile
```
3. **Test the extension:**
- Press F5 in VS Code to launch Extension Development Host
- Test your changes in the new VS Code window
4. **Run linter:**
```bash
npm run lint
```
## Testing
### Unit Tests (Rust)
```bash
# Run all tests
cargo test
# Run tests with output
cargo test -- --nocapture
# Run specific test
cargo test test_name
```
### Integration Tests
Integration tests are located in `tests/`. They test the full MCP protocol flow with mock Gemini API responses.
### Manual Testing
1. Install the extension from .vsix: `code --install-extension *.vsix`
2. Run the setup wizard
3. Test each command in the Command Palette
4. Verify MCP tools work with GitHub Copilot
## Code Style
### Rust
- Follow the [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/)
- Use `cargo fmt` for formatting
- Use `cargo clippy` for linting
- Add documentation comments (`///`) for public items
- Keep functions focused and under 50 lines when possible
### TypeScript
- Follow the [VS Code Extension Guidelines](https://code.visualstudio.com/api/references/extension-guidelines)
- Use 4 spaces for indentation
- Add JSDoc comments for public functions
- Use async/await instead of promises
- Handle errors gracefully
### Documentation
- Add doc comments for all public APIs
- Include examples in doc comments
- Update README.md when adding features
- Update CHANGELOG.md following [Keep a Changelog](https://keepachangelog.com/)
## Pull Request Process
1. **Update documentation:**
- Update README.md if adding features
- Add entry to CHANGELOG.md under `[Unreleased]`
- Update API docs if needed
2. **Ensure all tests pass:**
```bash
cargo test
cd vscode-extension && npm test
```
3. **Create pull request:**
- Use a clear, descriptive title
- Reference any related issues
- Describe what changed and why
- Include screenshots for UI changes
4. **Review process:**
- Maintainer will review within 7 days
- Address any feedback
- Once approved, maintainer will merge
## Commit Messages
Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
```
<type>(<scope>): <description>
[optional body]
[optional footer]
```
**Types:**
- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation changes
- `style`: Code style changes (formatting, etc.)
- `refactor`: Code refactoring
- `test`: Adding or updating tests
- `chore`: Maintenance tasks
**Examples:**
```
feat(gemini): add support for gemini-pro model
fix(quota): correct RPM calculation in rolling window
docs(readme): update installation instructions
```
## Project Structure
```
.
├── src/ # Rust MCP server source
│ ├── main.rs # Binary entry point
│ ├── lib.rs # Library root
│ ├── gemini.rs # Gemini API client
│ ├── quota.rs # Quota tracking
│ ├── api_key.rs # API key management
│ ├── mcp_server.rs # MCP server implementation
│ ├── tools.rs # MCP tool handlers
│ └── setup_wizard.rs # CLI setup wizard
├── vscode-extension/ # VS Code extension
│ ├── src/ # TypeScript source
│ ├── package.json # Extension manifest
│ └── README.md # Extension documentation
├── tests/ # Integration tests
├── .github/ # GitHub Actions workflows
└── README.md # Project documentation
```
## Adding New Features
### Adding a New MCP Tool
1. Add the tool struct in `src/tools.rs`
2. Implement the `Tool` trait using `#[derive(Tool)]`
3. Add tool handler logic
4. Write unit tests
5. Update README.md with tool documentation
6. Add example usage
### Adding VS Code Commands
1. Add command to `package.json` under `contributes.commands`
2. Register command handler in `src/extension.ts`
3. Add tests if applicable
4. Update README.md
## Questions?
- **Issues**: [GitHub Issues](https://github.com/ciresnave/dynamic_grounding_for_github_copilot/issues)
- **Discussions**: [GitHub Discussions](https://github.com/ciresnave/dynamic_grounding_for_github_copilot/discussions)
- **Email**: ciresnave@gmail.com
Thank you for contributing! 🎉