Skip to content
This repository was archived by the owner on Oct 25, 2025. It is now read-only.

Commit 998a269

Browse files
authored
Add files via upload
1 parent 4698846 commit 998a269

20 files changed

+1954
-16
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [0.1.1] - 2025-10-21
99

1010
### Changed
11+
1112
- **BREAKING**: Updated Gemini CLI command format to use explicit `googleSearch` tool invocation
1213
- Changed from: `gemini -p "query" --yolo --output-format json`
1314
- Changed to: `gemini -p "/tool:googleSearch query:\"search_text\" raw:true" --yolo --output-format json -m "gemini-2.5-flash"`
@@ -17,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1718
- `scripts/extract-content.sh`
1819

1920
### Fixed
21+
2022
- Fixed validation function arithmetic operation that could cause script exit with `set -e`
2123
- Improved ShellCheck compliance:
2224
- Split variable declarations and assignments (SC2155)
@@ -26,13 +28,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2628
- Fixed false positive validation to properly detect and filter invalid domains
2729

2830
### Improved
31+
2932
- Enhanced code quality and reliability with ShellCheck best practices
3033
- Better error handling in validation and search functions
3134
- More robust script execution with proper return value handling
3235

3336
## [0.1.0] - 2025-10-20
3437

3538
### Added
39+
3640
- Initial release of Gemini Search Plugin
3741
- Core search functionality using Gemini CLI with `google_web_search` tool
3842
- Smart caching system with 1-hour TTL and MD5 keying
@@ -57,6 +61,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5761
- `scripts/prepare-release.sh` - Release preparation
5862

5963
### Features
64+
6065
- **Gemini CLI Integration**: Uses Gemini CLI in headless mode with `--yolo` flag
6166
- **Tool Restriction**: Limits Gemini to only `google_web_search` tool via `.gemini/settings.json`
6267
- **Grounded Results**: All results from Google's web search via Gemini
@@ -66,13 +71,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6671
- **Security**: URL validation, content size limits, timeout handling
6772

6873
### Documentation
74+
6975
- Comprehensive README.md with features, usage, and configuration
7076
- GEMINI.md explaining Gemini CLI integration
7177
- Detailed agent documentation
7278
- Command documentation with examples
7379
- Validation methodology documentation
7480

7581
### Configuration
82+
7683
- Environment variable support for all settings
7784
- Configurable cache TTL, retry logic, and timeouts
7885
- Adjustable content extraction limits
@@ -81,6 +88,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8188
## [Unreleased]
8289

8390
### Planned
91+
8492
- Enhanced content extraction with better parsing
8593
- Additional search engine fallbacks
8694
- Improved relevance scoring algorithms
@@ -101,11 +109,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
101109
The 0.1.1 update includes a breaking change to how the Gemini CLI is invoked. No user action is required as the change is internal to the plugin scripts. However, if you have customized any scripts, you'll need to update them to use the new format.
102110

103111
**What Changed:**
112+
104113
- Gemini CLI now explicitly invokes the `googleSearch` tool
105114
- Added `-m "gemini-2.5-flash"` flag for model specification
106115
- Added `raw:true` parameter for unprocessed results
107116

108117
**Benefits:**
118+
109119
- More reliable search results
110120
- Explicit tool usage prevents ambiguity
111121
- Better control over response format

CONTRIBUTING.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ This project follows the Anthropic Code of Conduct. By participating, you are ex
3131
Before contributing, ensure you have:
3232

3333
1. **Gemini CLI** installed:
34+
3435
```bash
35-
npm install -g @google/genai-cli
36+
npm install -g @google/gemini-cli
3637
```
3738

3839
2. **Development tools**:
40+
3941
```bash
4042
# ShellCheck for script linting
4143
brew install shellcheck # macOS
@@ -53,24 +55,28 @@ Before contributing, ensure you have:
5355
## Development Setup
5456

5557
1. **Fork and clone** the repository:
58+
5659
```bash
5760
git clone https://github.com/YOUR-USERNAME/gemini-search.git
5861
cd gemini-search
5962
```
6063

6164
2. **Create a feature branch**:
65+
6266
```bash
6367
git checkout -b feature/your-feature-name
6468
```
6569

6670
3. **Make your changes** and test thoroughly
6771

6872
4. **Run linting**:
73+
6974
```bash
7075
shellcheck scripts/*.sh
7176
```
7277

7378
5. **Test your changes**:
79+
7480
```bash
7581
bash tests/run-integration-tests.sh
7682
```
@@ -104,6 +110,7 @@ We welcome several types of contributions:
104110
All bash scripts must:
105111

106112
1. **Use strict error handling**:
113+
107114
```bash
108115
set -euo pipefail
109116
```
@@ -115,6 +122,7 @@ All bash scripts must:
115122
- Quote array expansions properly (SC2206)
116123

117124
3. **Include proper documentation**:
125+
118126
```bash
119127
# Function: Function name
120128
# Arguments:
@@ -127,6 +135,7 @@ All bash scripts must:
127135
```
128136

129137
4. **Use meaningful variable names**:
138+
130139
```bash
131140
# Good
132141
local query_string="$1"
@@ -138,6 +147,7 @@ All bash scripts must:
138147
```
139148

140149
5. **Handle errors gracefully**:
150+
141151
```bash
142152
if ! result=$(some_command); then
143153
log_error "Command failed: some_command"
@@ -279,6 +289,7 @@ Follow conventional commits format:
279289
```
280290

281291
**Types:**
292+
282293
- `feat`: New feature
283294
- `fix`: Bug fix
284295
- `docs`: Documentation changes
@@ -288,6 +299,7 @@ Follow conventional commits format:
288299
- `chore`: Maintenance tasks
289300

290301
**Example:**
302+
291303
```
292304
feat(search): add support for multi-engine search
293305
@@ -344,6 +356,7 @@ When reporting bugs, include:
344356
- Stack traces
345357

346358
**Template:**
359+
347360
```markdown
348361
### Environment
349362
- OS: macOS 14.0
@@ -362,6 +375,7 @@ Error: "Gemini CLI search failed"
362375

363376
### Logs
364377
```
378+
365379
<error logs here>
366380
```
367381
```

GEMINI.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ gemini -p "/tool:googleSearch query:\"search query\" raw:true" --yolo --output-f
3737
### 3. Grounded Web Search Behavior
3838

3939
When the user asks for a search:
40+
4041
- The Gemini CLI agent receives the search query
4142
- It recognizes the need for external information
4243
- Since `google_web_search` is the only available tool, it uses that for grounding
@@ -48,10 +49,11 @@ When the user asks for a search:
4849
This plugin requires the Gemini CLI to be installed:
4950

5051
```bash
51-
npm install -g @google/genai-cli
52+
npm install -g @google/gemini-cli
5253
```
5354

5455
Verify installation:
56+
5557
```bash
5658
gemini --version
5759
```
@@ -61,4 +63,4 @@ gemini --version
6163
- **Direct Results**: The plugin provides search results directly from the `google_web_search` tool
6264
- **No Hallucination**: Results are grounded in actual web content retrieved by Gemini
6365
- **Transparent Sources**: Search results include source URLs and attributions
64-
- **No Summarization Override**: The plugin respects the raw search data provided by the tool
66+
- **No Summarization Override**: The plugin respects the raw search data provided by the tool

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The plugin restricts the Gemini CLI to only use the `google_web_search` tool thr
1212

1313
## Features
1414

15-
### 💎 Key Features:
15+
### 💎 Key Features
1616

1717
- **Gemini CLI Headless Mode** - Uses `gemini -p` with `--yolo` flag for automated web search
1818
- **Tool Restriction** - `.gemini/settings.json` limits Gemini to only `google_web_search` tool
@@ -108,7 +108,9 @@ Clear the search result cache and reset analytics data.
108108
1. **Install Gemini CLI**:
109109

110110
```bash
111-
npm install -g @google/genai-cli
111+
112+
npm install -g @google/gemini-cli
113+
112114
```
113115

114116
2. **Verify Installation**:
@@ -118,6 +120,7 @@ Clear the search result cache and reset analytics data.
118120
```
119121

120122
3. **Configure API Key** (optional):
123+
121124
```bash
122125
gemini config set apiKey YOUR_GOOGLE_AI_API_KEY
123126
```
@@ -154,6 +157,23 @@ The plugin can be configured through environment variables:
154157
- Content extraction is optimized to focus on relevant information
155158
- Relevance validation prevents false positive results
156159

160+
**Performance Metrics:**
161+
162+
- Cached searches: <1 second (97% faster)
163+
- First searches: 8-20 seconds
164+
- Cache hit rate: 60-85% (typical usage)
165+
- Memory usage: <50MB
166+
- Token savings: 39% via context isolation
167+
168+
For detailed benchmarks and optimization strategies, see [docs/PERFORMANCE.md](docs/PERFORMANCE.md)
169+
170+
**Examples:**
171+
172+
- Basic usage examples: [examples/01-basic-searches.md](examples/01-basic-searches.md)
173+
- Technical queries: [examples/02-technical-queries.md](examples/02-technical-queries.md)
174+
- Validation examples: [examples/03-validation-examples.md](examples/03-validation-examples.md)
175+
- Advanced usage: [examples/04-advanced-usage.md](examples/04-advanced-usage.md)
176+
157177
## Troubleshooting
158178

159179
- If searches fail, check the error logs at the configured LOG_FILE location

agents/gemini-search.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ The agent uses `gemini -p` (headless mode) with `--yolo` (auto-approval) and res
7878
This plugin uses the Gemini CLI in headless mode (`gemini -p`) with the `--yolo` flag for automated tool approval. The `.gemini/settings.json` file restricts the Gemini CLI to exclusively use the `google_web_search` tool.
7979

8080
**What this means:**
81+
8182
- All web searches go through Google's web search via Gemini's API
8283
- No Claude internal search functionality is triggered
8384
- No direct web scraping or HTTP requests are made

commands/clear-cache.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ You are the clear-cache command handler for the gemini-search plugin. When this
1414
## Execution Instructions
1515

1616
Run the following commands:
17+
1718
```bash
1819
# Clear the cache directory
1920
rm -rf /tmp/gemini-search-cache/*
@@ -30,6 +31,7 @@ fi
3031
## Response Format
3132

3233
After clearing the cache, inform the user:
34+
3335
- Confirmation that the cache has been cleared
3436
- Number of entries removed (if applicable)
3537
- Path to the cache directory (`/tmp/gemini-search-cache/`)
@@ -38,6 +40,7 @@ After clearing the cache, inform the user:
3840
## When to Use
3941

4042
Suggest clearing cache when:
43+
4144
- Search results seem stale or outdated
4245
- Troubleshooting search issues
4346
- Testing new search queries
@@ -48,4 +51,4 @@ Suggest clearing cache when:
4851
- Cache will rebuild automatically on new searches
4952
- Analytics data in `/tmp/gemini-analytics/` is NOT affected
5053
- Plugin configuration remains intact
51-
- All future searches will query fresh results until cache rebuilds
54+
- All future searches will query fresh results until cache rebuilds

commands/search-stats.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ You are the search-stats command handler for the gemini-search plugin. When this
1414
## Execution Instructions
1515

1616
Run the following command:
17+
1718
```bash
1819
bash "${CLAUDE_PLUGIN_ROOT}/scripts/analytics.sh" report
1920
```
@@ -23,17 +24,20 @@ bash "${CLAUDE_PLUGIN_ROOT}/scripts/analytics.sh" report
2324
After receiving the statistics from the script, present them to the user with:
2425

2526
### Overall Statistics
27+
2628
- Total searches performed
2729
- Cache hit/miss ratio
2830
- Token savings from caching
2931
- Time period covered
3032

3133
### Performance Metrics
34+
3235
- Average response time
3336
- Cache efficiency percentage
3437
- Search success rate
3538

3639
### Usage Patterns (if available)
40+
3741
- Most frequent search queries
3842
- Cache statistics
3943
- Error rates
@@ -43,6 +47,7 @@ Format the output in a clear, readable table or structured format.
4347
## Error Handling
4448

4549
If the script fails or no analytics are available:
50+
4651
- Display a friendly message indicating no statistics are available yet
4752
- Suggest performing some searches first
4853
- Show the error message if applicable
@@ -51,4 +56,4 @@ If the script fails or no analytics are available:
5156

5257
- Analytics are stored locally in `/tmp/gemini-analytics/`
5358
- All data is privacy-preserving (no personal information)
54-
- Statistics are calculated on-demand with minimal overhead
59+
- Statistics are calculated on-demand with minimal overhead

commands/search.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ You are the search command handler for the gemini-search plugin. When this comma
1717
## Execution Instructions
1818

1919
Run the following command:
20+
2021
```bash
2122
bash "${CLAUDE_PLUGIN_ROOT}/scripts/search-wrapper.sh" search "{{QUERY}}"
2223
```
@@ -26,6 +27,7 @@ Where `{{QUERY}}` is the search query provided by the user.
2627
## Response Format
2728

2829
After receiving the results from the script, present them to the user with:
30+
2931
- A summary of the search query
3032
- Top relevant results with titles and URLs
3133
- Brief snippets from each result
@@ -35,6 +37,7 @@ After receiving the results from the script, present them to the user with:
3537
## Error Handling
3638

3739
If the script fails:
40+
3841
- Display the error message from the script
3942
- Suggest the user check their Gemini CLI installation
4043
- Recommend clearing cache if appropriate (`/clear-cache`)
@@ -44,4 +47,4 @@ If the script fails:
4447
- This uses the Gemini CLI in headless mode with `google_web_search` tool
4548
- Results are cached for 1 hour for efficiency
4649
- Analytics are tracked automatically
47-
- Context is isolated for token savings
50+
- Context is isolated for token savings

0 commit comments

Comments
 (0)