Add exact filesystem search and MCP server installation tools#52
Merged
Conversation
…tall` Hermes-inspired filesystem-search improvements to CodeRAG's MCP surface: - search_files: exact regex/glob search (ripgrep-backed, pure-Python fallback) as the literal-match complement to semantic search_code. Supports target content/files, output_mode content/files_only/count, context lines, pagination, and conservative secret redaction. Honours the same ignore rules as the indexer via a shared coderag/_ignore.py helper. - Agent ergonomics on the MCP tools: offset pagination on search_code, a loop guard that blocks repeated identical searches, and get_file line numbers + "did you mean?" filename suggestions. - coderag install: one-command registration of the MCP server into Claude Code (.mcp.json), Hermes (~/.hermes/config.yaml), and Codex (~/.codex/config.toml), with a sensible auto-detect default and an interactive wizard. Idempotent, with .bak backups and a --print dry-run. - Docs (README, AGENTS.md) and tests (test_fs_search, test_install, test_mcp). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011tgKDQJ8p7YLEzoMz32moC
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
The redaction test wrote a fake `token = "..."` literal that gitleaks' generic-api-key rule flagged as a leak, failing the secret-scan check on PR #52. Use a low-entropy placeholder and a `# gitleaks:allow` marker; the redaction assertion is unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011tgKDQJ8p7YLEzoMz32moC
The redaction test feeds a dummy `token = "..."` line to verify masking; gitleaks' generic-api-key rule flagged it and failed the secret-scan on PR #52. Because gitleaks scans per-commit diffs, the literal lives in the PR's first commit even after the test was tidied — so suppress it with a narrow repo .gitleaks.toml allowlist (default rules kept) rather than rewriting history. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011tgKDQJ8p7YLEzoMz32moC
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
This PR adds two major features to CodeRAG:
search_files) — a regex/glob complement to semantic search that agents can use instead of shelling out togrep/rg/findcoderag install) — automatically registers CodeRAG with Claude Code, Hermes, or Codex without hand-editing config filesKey Changes
New Modules
coderag/fs_search.py(351 lines): Exact regex/glob search over the workspaceignore_globsso search sees exactly the same files as the indexercontent(with context lines),files_only,countcoderag/install.py(298 lines): Interactive and CLI-driven MCP server installation.mcp.json), Hermes (~/.hermes/config.yaml), Codex (~/.codex/config.toml)coderag/_ignore.py(35 lines): Shared ignore-glob matchingignore_dir_names()for efficient directory pruning during walksis_ignored()for path matching against glob patternsModified Modules
coderag/surfaces/mcp_server.py:search_filestool to the MCP server_LOOP_LIMIT = 4) to prevent agents from repeatedly issuing identical searchessearch_codewithoffsetparametercoderag/surfaces/cli.py:cmd_installcommand with--wizard,--print,--yes, and--scopeflagscoderag/api.py:search_files()method as a thin pass-through tofs_search.search_fileswatched_dirandignore_globscoderag/indexer.py:_ignoremodule instead of local ignore logicREADME.mdandAGENTS.md:search_filestool andinstallcommandTests
tests/test_fs_search.py(114 lines): Comprehensive tests for exact filesystem searchtests/test_install.py(123 lines): Tests for MCP server installationtests/test_mcp.py: Updated to test newsearch_filestool and loop detectionNotable Implementation Details
_ignorehttps://claude.ai/code/session_011tgKDQJ8p7YLEzoMz32moC