feat: Add Morph codebase search integration#699
Draft
DhruvBhatia0 wants to merge 2 commits intostitionai:mainfrom
Draft
feat: Add Morph codebase search integration#699DhruvBhatia0 wants to merge 2 commits intostitionai:mainfrom
DhruvBhatia0 wants to merge 2 commits intostitionai:mainfrom
Conversation
Replace naive full-project-read with targeted Morph search for the answer, feature, and bug actions in subsequent_execute(). Falls back to full code read when the API key is unset or the search returns empty results. Made-with: Cursor
Use typing.List[Dict] instead of Python 3.9+ lowercase generics, rename file handles to match repo convention, fix import grouping. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Changes
src/services/morph.pysrc/services/morph_prompt.txtsrc/config.pyget_morph_api_key()/set_morph_api_key()sample.config.tomlMORPHkey under[API_KEYS]src/services/__init__.pyMorphsrc/filesystem/read_code.pysearch_code()method with fallbacksrc/agents/agent.pyui/src/routes/settings/+page.svelteHow it works
answer/feature/bugactions:ReadCode.search_code(prompt)calls the Morph WarpGrep APIrun/reportactions: falls back to full code read (these need broader context)Notes
requests(already in requirements.txt) and stdlib (xml.etree.ElementTree,subprocess)rg(ripgrep) on the host for search tool execution; returns a clear message if unavailableTest plan
ast.parsesyntax validation_file_treeexcludes.git,node_modules,__pycache__, binary files_validate_pathrejects../../etc/passwdand absolute paths outside project root_run_ripgrepfinds matches withrg, returns clear message when unavailable_read_filehandles full reads, line ranges, single lines, and errors_parse_tool_callshandles valid XML, malformed XML (regex fallback), and empty input_read_full_filesreads valid files and rejects path traversal attemptssearch()returns[]when no API key is setcode_set_to_markdown()on empty results or exceptions🤖 Generated with Claude Code