-
Notifications
You must be signed in to change notification settings - Fork 3.8k
fix(cli): add ignore patterns to search tool #8613
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 2 files
Prompt for AI agents (all 2 issues)
Understand the root cause of the following 2 issues and fix them.
<file name="extensions/cli/src/tools/searchCode.ts">
<violation number="1" location="extensions/cli/src/tools/searchCode.ts:88">
Sanitize the .gitignore-derived glob before interpolating it into the shell command (or switch to a non-shell exec routine) to prevent command injection.</violation>
<violation number="2" location="extensions/cli/src/tools/searchCode.ts:93">
Rule violated: **Don't use console.log**
Do not introduce console.log calls; use the project's logger or remove the debug output to comply with the "Don't use console.log" guideline.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| } | ||
|
|
||
| for (const ignorePattern of await getGitignorePatterns()) { | ||
| command += ` -g "!${ignorePattern}"`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sanitize the .gitignore-derived glob before interpolating it into the shell command (or switch to a non-shell exec routine) to prevent command injection.
Prompt for AI agents
Address the following comment on extensions/cli/src/tools/searchCode.ts at line 88:
<comment>Sanitize the .gitignore-derived glob before interpolating it into the shell command (or switch to a non-shell exec routine) to prevent command injection.</comment>
<file context>
@@ -69,8 +84,13 @@ export const searchCodeTool: Tool = {
}
+ for (const ignorePattern of await getGitignorePatterns()) {
+ command += ` -g "!${ignorePattern}"`;
+ }
+
</file context>
Description
Ripgrep searches in gitignore directories such as node_modules. This results in stdout maxbuffer length exceededing. This PR fixes that.
AI Code Review
@continue-reviewChecklist
Screen recording or screenshot
[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]
Tests
[ What tests were added or updated to ensure the changes work as expected? ]
Summary by cubic
Respect .gitignore in the CLI search tool to exclude ignored paths during ripgrep runs. This prevents scanning node_modules and similar folders, avoids stdout maxBuffer errors, and speeds up searches.
Bug Fixes
Dependencies
Written for commit f0217d2. Summary will update automatically on new commits.