refactor(mcp): trait-ize remaining inline crate:: calls in repo.rs#14
Merged
Conversation
- Add SearchClient trait (index_is_empty_at, search_repos_at) - Add RepoAnalyzer trait (compute_workspace_hash, analyze_repo) - Provide SearchClientImpl in search.rs and RepoAnalyzerImpl in health.rs - Remove nl_filter_repos (eliminated DefaultStorageBackend inline call) - Convert nl_filter_repos_at, apply_nl_filters, analyze_repo_for_repo to generic over traits - Update DevkitQueryReposTool and DevkitNaturalLanguageQueryTool to use trait impls - Sync mcp/tests.rs callers to new generic signatures - Result: repo.rs crate:: references reduced to 8 use-statements, 0 inline calls
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
完成 Phase A MCP trait 化收尾:将
repo.rs中剩余 4 个内联crate::调用全部抽象为 trait,消除模块间硬编码耦合。Changes
clients.rs)SearchClient:index_is_empty_at,search_repos_atRepoAnalyzer:compute_workspace_hash,analyze_reposearch.rs→SearchClientImplhealth.rs→RepoAnalyzerImplrepo.rs)DevkitQueryReposTool/DevkitNaturalLanguageQueryTool改用 traitnl_filter_repos,改为通过ctx.storage.index_path()获取路径nl_filter_repos_at/apply_nl_filters/analyze_repo_for_repo泛型化mcp/tests.rs)Verification
cargo check/cargo fmt/cargo clippy -W warnings✅