Draft
Conversation
78806c4 to
9fc7b28
Compare
ab1dff0 to
ecd1dc0
Compare
9fc7b28 to
bba9f45
Compare
Find Ruby classes, modules, and constants with zero resolved references across the codebase. Uses rubydex's semantic resolution for high accuracy compared to string-matching approaches. - Params: kind filter, file_path prefix, limit/offset pagination - Response: name, kind, file, line, owner per dead constant - Excludes infrastructure declarations (Object, BasicObject, Module, Class) - Sorted by FQN for deterministic pagination
bba9f45 to
8e4a222
Compare
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
detect_dead_constantsMCP tool that finds Ruby constants with zero resolved references — dead code candidates.Supports
kindfilter,file_pathprefix filter, and pagination. Excludes infrastructure declarations and anonymous classes.Real-world validation
Tested against RDoc (411 declarations in
lib/). Instead of cross-referencing all 411 constants manually with grep,detect_dead_constantsnarrowed the list to 22 candidates instantly. After filtering false positives (dynamic access viaconst_get/const_defined?, type annotations), 5 confirmed dead constants were removed: ruby/rdoc#1642Also tested against Tapioca (48 candidates in
lib/), which surfaced 1 confirmed dead constant (ASSOCIATION_METHODS).