feat: add /search command powered by WarpGrep AI code search#4883
Draft
bhaktatejas922 wants to merge 3 commits intoAider-AI:mainfrom
Draft
feat: add /search command powered by WarpGrep AI code search#4883bhaktatejas922 wants to merge 3 commits intoAider-AI:mainfrom
bhaktatejas922 wants to merge 3 commits intoAider-AI:mainfrom
Conversation
Adds a new /search command that uses the WarpGrep API to intelligently search the codebase. The integration follows the multi-turn protocol: builds repo structure, sends queries, executes tool calls (ripgrep, read, list_directory) locally, and returns relevant code spans. - aider/warpgrep.py: WarpGrepClient with multi-turn search protocol - aider/commands.py: /search command following cmd_web pattern - aider/args.py: --warpgrep-api-key CLI argument - tests/basic/test_warpgrep.py: 21 unit tests covering parsing, tool execution, and mock HTTP flows
|
|
- _exec_read now parses the 'lines' parameter (e.g. "1-50,75-80") instead of always reading the entire file - _build_repo_structure produces a proper tree hierarchy instead of a flat file list - _tree excludes common non-source dirs (node_modules, __pycache__, etc.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
/searchcommand that uses WarpGrep to perform AI-powered semantic code search. WarpGrep is an RL-trained search subagent that runs in an isolated context window, performing up to 8 parallel tool calls per turn across 4 turns, returning only relevant code spans.Instead of writing regex patterns, describe what you're looking for in natural language:
How it works
/search <query>(file, start_line, end_line)spans with only the relevant code/webpattern)Changes
aider/warpgrep.py(new) -WarpGrepClientimplementing the multi-turn WarpGrep protocol with local ripgrep execution (Python grep fallback)aider/commands.py- Addedcmd_searchmethod (auto-registers as/search)aider/args.py- Added--warpgrep-api-keyCLI argumenttests/basic/test_warpgrep.py(new) - 21 unit tests covering XML parsing, repo structure generation, finish parsing, and mock HTTPConfiguration
Set one of:
--warpgrep-api-key YOUR_KEYWARPGREP_API_KEY=...MORPH_API_KEY=...Get a free API key at morphllm.com ($10/month free compute included).
Test plan
/searchappears in/helpoutput