Skip to content

feat(chat): Adding the grep search tool and file search tool #7083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: feature/agentic-chat
Choose a base branch
from

Conversation

grl-wang
Copy link

Problem

adding the grep search and file search tool for testing

Solution

1. Implemented the grep search tool using https://github.com/microsoft/vscode-ripgrep.
2. The grepped result show as clickable file path.
3. Implemented the file search tool.
3. The tool currently is disable in current pr, once grepSearch tool tested, will update the tool_index.json to enable this tool.

  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

    1. Implemented the grep search tool using https://github.com/microsoft/vscode-ripgrep.
    2. The grepped result show as clickable file path.
    3. Implemented the file search tool.
    3. The tool currently is disable in current pr, once grepSearch tool tested,
       will update the tool_index.json to enable this tool.
Copy link

  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

@grl-wang grl-wang marked this pull request as ready for review April 17, 2025 17:31
@grl-wang grl-wang requested review from a team as code owners April 17, 2025 17:31
@@ -132,6 +132,7 @@ jobs:
NODE_OPTIONS: '--max-old-space-size=8192'
AWS_TOOLKIT_TEST_CACHE_DIR: '/tmp/.vscode-test/'
AWS_TOOLKIT_TEST_USER_DIR: '/tmp/.vscode-test/user-data/'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy link

Choose a reason for hiding this comment

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

why do we need this?

Copy link
Author

Choose a reason for hiding this comment

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

we are setting this up to increase GitHub API Limit while download the ripgrep binary.
ref: https://github.com/microsoft/vscode-ripgrep

You can produce an API key, set the GITHUB_TOKEN environment var to it, and vscode-ripgrep will use it when downloading from GitHub. This increases your API limit.
  1. Without this the most CI test will fail during download ripegrep binary.

@@ -75,6 +75,7 @@
"dependencies": {
"@types/node": "^22.7.5",
"vscode-nls": "^5.2.0",
"vscode-nls-dev": "^4.0.4"
"vscode-nls-dev": "^4.0.4",
"@vscode/ripgrep": "1.15.11"
Copy link

Choose a reason for hiding this comment

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

is this the right place to add it?

Copy link
Author

Choose a reason for hiding this comment

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

yes, based on the vscode ripgrep, it asked to add in the dependencies, not dev dependencies: https://github.com/microsoft/vscode-ripgrep.

private createOutput(content: string): InvokeOutput {
return {
output: {
kind: OutputKind.Text,
Copy link

Choose a reason for hiding this comment

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

use JSON format seems like a better fit for this tool

public async invoke(updates?: Writable): Promise<InvokeOutput> {
try {
const fileUri = vscode.Uri.file(this.fsPath)
const allFiles = await readDirectoryRecursively(fileUri, this.maxDepth)
Copy link

Choose a reason for hiding this comment

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

filter to only keep [F] prefix?

@@ -20,6 +21,9 @@ phases:
pre_build:
commands:
- export HOME=/home/codebuild-user
# Set up VSCODE_RIPGREP_TOKEN for GitHub API access
- export VSCODE_RIPGREP_TOKEN=${GITHUB_READONLY_TOKEN}
- echo "Setting up VSCODE_RIPGREP_TOKEN for GitHub API access"
Copy link

Choose a reason for hiding this comment

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

why do we need this?

Copy link
Author

Choose a reason for hiding this comment

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

similar as the GITHUB TOKEN env, set it setting this up to increase GitHub API Limit while download the ripgrep binary. otherwise, the ripgrep download failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants