Thank you for your interest in contributing to the Gemini Search Plugin! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Coding Standards
- Testing Guidelines
- Pull Request Process
- Issue Reporting
This project follows the Anthropic Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.
- Be respectful and inclusive
- Welcome newcomers and help them learn
- Focus on what is best for the community
- Show empathy towards other community members
Before contributing, ensure you have:
-
Gemini CLI installed:
npm install -g @google/gemini-cli
-
Development tools:
# ShellCheck for script linting brew install shellcheck # macOS # or apt-get install shellcheck # Linux
-
Git for version control
-
Basic understanding of:
- Bash scripting
- Claude Code plugin architecture
- Gemini CLI usage
-
Fork and clone the repository:
git clone https://github.com/d-oit/gemini-search-plugin.git cd gemini-search-plugin -
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes and test thoroughly
-
Run linting:
shellcheck scripts/*.sh -
Test your changes:
bash tests/run-integration-tests.sh
We welcome several types of contributions:
- Bug Fixes - Fix issues in existing functionality
- Features - Add new capabilities
- Documentation - Improve or add documentation
- Tests - Add or improve test coverage
- Performance - Optimize existing code
- Refactoring - Improve code quality without changing behavior
- Check existing issues - Look for related issues or create a new one
- Discuss your idea - Comment on the issue to discuss your approach
- Implement your changes - Write code following our standards
- Test thoroughly - Ensure all tests pass
- Submit a pull request - Reference the issue number
- Address feedback - Work with maintainers to refine your contribution
All bash scripts must:
-
Use strict error handling:
set -euo pipefail -
Follow ShellCheck recommendations:
- Separate variable declarations and assignments (SC2155)
- Check exit codes directly instead of using
$?(SC2181) - Use bash parameter expansion instead of
sedwhen possible (SC2001) - Quote array expansions properly (SC2206)
-
Include proper documentation:
# Function: Function name # Arguments: # $1 - description (type) # $2 - description (type) # Returns: description function_name() { # Implementation }
-
Use meaningful variable names:
# Good local query_string="$1" local cache_file="$CACHE_DIR/$cache_key.json" # Bad local q="$1" local f="$DIR/$k.json"
-
Handle errors gracefully:
if ! result=$(some_command); then log_error "Command failed: some_command" return 1 fi
- Indentation: 4 spaces (no tabs)
- Line length: Maximum 120 characters
- Function length: Keep functions focused and under 50 lines
- Comments: Explain "why" not "what"
- Logging: Use structured JSON logging
Always split variable declarations and assignments:
# Good
local timestamp
timestamp=$(date -Iseconds)
# Bad
local timestamp=$(date -Iseconds)Check exit codes directly:
# Good
if content=$(extract_content "$url"); then
echo "$content"
fi
# Bad
content=$(extract_content "$url")
if [[ $? -eq 0 ]]; then
echo "$content"
fiAll contributions should include:
- Unit tests for new functions
- Integration tests for new features
- Manual testing to verify behavior
# Run all integration tests
bash tests/run-integration-tests.sh
# Run specific script tests
bash scripts/search-wrapper.sh search "test query"
bash scripts/search-wrapper.sh validate-result "title" "url" "snippet" "query"
# Check syntax
bash -n scripts/*.sh
# Lint scripts
shellcheck scripts/*.shEnsure tests cover:
- ✅ Happy path (normal operation)
- ✅ Error cases (failures, invalid input)
- ✅ Edge cases (empty input, special characters)
- ✅ Performance (caching, timeouts)
Create test scripts in the tests/ directory:
#!/bin/bash
# tests/test-feature.sh
set -euo pipefail
echo "Testing feature X..."
# Setup
EXPECTED="expected result"
ACTUAL=$(your_function "input")
# Assert
if [[ "$ACTUAL" == "$EXPECTED" ]]; then
echo "✓ Test passed"
exit 0
else
echo "✗ Test failed: expected '$EXPECTED', got '$ACTUAL'"
exit 1
fi- ✅ All tests pass
- ✅ ShellCheck shows no errors
- ✅ Code follows style guidelines
- ✅ Documentation is updated
- ✅ CHANGELOG.md is updated
- ✅ Commit messages are clear
- Branch is up to date with
main - All commits are signed off
- Tests added/updated
- Documentation added/updated
- CHANGELOG.md updated
- ShellCheck passes
- Integration tests pass
Follow conventional commits format:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting)refactor: Code refactoringtest: Test additions/changeschore: Maintenance tasks
Example:
feat(search): add support for multi-engine search
Added ability to query multiple search engines simultaneously
with configurable priority and fallback logic.
Closes #123
## Description
Brief description of changes
## Motivation
Why is this change needed?
## Changes Made
- Change 1
- Change 2
- Change 3
## Testing
How was this tested?
## Screenshots (if applicable)
Include screenshots for UI changes
## Related Issues
Closes #issue_numberWhen reporting bugs, include:
-
Environment:
- OS and version
- Gemini CLI version
- Claude Code version
- Plugin version
-
Steps to reproduce:
- Detailed steps
- Expected behavior
- Actual behavior
-
Logs:
- Relevant error messages
- Log file contents
- Stack traces
Template:
### Environment
- OS: macOS 14.0
- Gemini CLI: 1.2.3
- Plugin Version: 0.1.1
### Steps to Reproduce
1. Run /search "query"
2. Observe error
### Expected Behavior
Search should return results
### Actual Behavior
Error: "Gemini CLI search failed"
### LogsFor feature requests, include:
- Use case: Why is this needed?
- Proposed solution: How should it work?
- Alternatives: Other approaches considered
- Benefits: Who benefits and how?
Enable debug logging:
# In search-wrapper.sh
log_message "DEBUG" "Variable value: $var"
# View logs
tail -f /tmp/gemini-search.logTest without installing the plugin:
# Run scripts directly
bash scripts/search-wrapper.sh search "test query"
# Test with different environments
CACHE_TTL=60 bash scripts/search-wrapper.sh search "query"Check script performance:
time bash scripts/search-wrapper.sh search "query"- Issues: Create a GitHub issue
- Discussions: Use GitHub Discussions
- Documentation: Check README.md and docs/
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to the Gemini Search Plugin! 🎉