Skip to content

feat(core): rename grep_search include parameter to include_pattern#20328

Merged
SandyTao520 merged 2 commits intomainfrom
st/feat/rename-grep-include-to-include-pattern
Feb 26, 2026
Merged

feat(core): rename grep_search include parameter to include_pattern#20328
SandyTao520 merged 2 commits intomainfrom
st/feat/rename-grep-include-to-include-pattern

Conversation

@SandyTao520
Copy link
Contributor

Summary

Renamed the include parameter to include_pattern in the grep_search tool across all implementations and definitions to improve naming clarity and consistency.

Details

  • Updated GrepToolParams and RipGrepToolParams interfaces.
  • Modified GrepTool and RipGrepTool implementations to use include_pattern.
  • Updated tool definitions for legacy and Gemini 3 model sets.
  • Refactored formatGrepResults in grep-utils.ts to support the new parameter name.
  • Updated system prompt snippets to ensure the model uses the correct parameter name.
  • Updated snapshots and unit/integration tests to reflect the change.

Related Issues

Related to #17552

How to Validate

  1. Run unit tests for grep tools: npm test -w @google/gemini-cli-core -- grep.test.ts ripGrep.test.ts
  2. Run integration tests: npm test -- integration-tests/ripgrep-real.test.ts
  3. Verify that grep_search still functions correctly in the CLI with the new parameter name.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run

@SandyTao520 SandyTao520 requested a review from a team as a code owner February 25, 2026 19:32
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @SandyTao520, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the clarity and consistency of the grep_search tool by renaming its include parameter to include_pattern. This change involved a broad refactoring effort across various components, including core interfaces, tool implementations, model definitions, and utility functions. The primary goal was to make the parameter's intent more explicit, thereby improving code readability and maintainability without altering the tool's core functionality.

Highlights

  • Parameter Renaming: The include parameter in the grep_search tool has been renamed to include_pattern for improved clarity and consistency across the codebase.
  • Interface and Implementation Updates: The GrepToolParams and RipGrepToolParams interfaces, along with their respective GrepTool and RipGrepTool implementations, have been updated to reflect the new parameter name.
  • Tool Definition and Prompt Snippet Adjustments: Tool definitions for both legacy and Gemini 3 model sets, as well as system prompt snippets, have been modified to ensure models correctly utilize include_pattern.
  • Utility Function Refactoring: The formatGrepResults function in grep-utils.ts was refactored to properly handle and display the include_pattern parameter.
  • Comprehensive Test Coverage: All relevant unit tests, integration tests, and snapshot files have been updated to align with the parameter rename, ensuring continued functionality and stability.
Changelog
  • integration-tests/ripgrep-real.test.ts
    • Updated ripgrep-real-direct integration test to use the new include_pattern parameter.
  • packages/core/src/core/snapshots/prompts.test.ts.snap
    • Updated prompt snapshots to reflect the include_pattern parameter in search tool examples.
  • packages/core/src/prompts/snippets.ts
    • Updated prompt snippets to reference include_pattern instead of include for search tools.
  • packages/core/src/tools/definitions/snapshots/coreToolsModelSnapshots.test.ts.snap
    • Updated core tool model snapshots to reflect the include_pattern parameter in grep_search definitions.
  • packages/core/src/tools/definitions/model-family-sets/default-legacy.ts
    • Updated default-legacy tool definitions to use include_pattern for grep_search and ripgrep_search.
  • packages/core/src/tools/definitions/model-family-sets/gemini-3.ts
    • Updated gemini-3 tool definitions to use include_pattern for grep_search and ripgrep_search.
  • packages/core/src/tools/grep-utils.ts
    • Refactored formatGrepResults to accept and use the include_pattern parameter.
  • packages/core/src/tools/grep.test.ts
    • Updated GrepTool unit tests to use the new include_pattern parameter.
  • packages/core/src/tools/grep.ts
    • Renamed the include parameter to include_pattern in the GrepToolParams interface and its implementation.
  • packages/core/src/tools/ripGrep.test.ts
    • Updated RipGrepTool unit tests to use the new include_pattern parameter.
  • packages/core/src/tools/ripGrep.ts
    • Renamed the include parameter to include_pattern in the RipGrepToolParams interface and its implementation.
Activity
  • Unit tests for grep tools were run and passed.
  • Integration tests were run and passed.
  • The grep_search functionality was verified in the CLI with the new parameter name.
  • Relevant documentation and README were updated.
  • Tests were added/updated.
  • Validated on MacOS via npm run.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the grep_search tool by renaming the include parameter to include_pattern for improved clarity and consistency. The change has been applied thoroughly across all relevant files, including tool definitions, implementations in both grep.ts and ripGrep.ts, utility functions, and corresponding tests. The snapshots and prompt snippets have also been updated to reflect this change. The refactoring is well-executed and improves the codebase.

@gemini-cli gemini-cli bot added area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Feb 25, 2026
@gemini-cli
Copy link
Contributor

gemini-cli bot commented Feb 25, 2026

Hi @SandyTao520, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.

We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines.

Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.

Thank you for your understanding and for being a part of our community!

@github-actions
Copy link

github-actions bot commented Feb 25, 2026

Size Change: +262 B (0%)

Total Size: 25.7 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.2 MB +262 B (0%)
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action


<examples>
- **Searching:** utilize search tools like ${GREP_TOOL_NAME} and ${GLOB_TOOL_NAME} with a conservative result count (\`total_max_matches\`) and a narrow scope (\`include\` and \`exclude\` parameters).
- **Searching:** utilize search tools like ${GREP_TOOL_NAME} and ${GLOB_TOOL_NAME} with a conservative result count (\`total_max_matches\`) and a narrow scope (\`include_pattern\` and \`exclude_pattern\` parameters).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we had this issue before but it' probably be smart for us to move the parameters include/exclude patterns to variables so that if we change them in one location they change everywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do in a follow-up!

@SandyTao520 SandyTao520 added this pull request to the merge queue Feb 26, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 26, 2026
@SandyTao520 SandyTao520 added this pull request to the merge queue Feb 26, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 26, 2026
@SandyTao520 SandyTao520 added this pull request to the merge queue Feb 26, 2026
Merged via the queue into main with commit 3993800 Feb 26, 2026
27 checks passed
@SandyTao520 SandyTao520 deleted the st/feat/rename-grep-include-to-include-pattern branch February 26, 2026 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants