rubydex 0.4.1-x86_64-linux → 0.4.3-x86_64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -0
  3. data/THIRD_PARTY_LICENSES.html +14 -427
  4. data/ext/rubydex/extconf.rb +1 -0
  5. data/lib/rubydex/cli/command/dead_code.rb +59 -0
  6. data/lib/rubydex/librubydex_sys.so +0 -0
  7. data/lib/rubydex/mcp_server/tools/codebase_stats_tool.rb +1 -1
  8. data/lib/rubydex/mcp_server/tools/find_constant_references_tool.rb +4 -4
  9. data/lib/rubydex/mcp_server/tools/find_dead_code_candidates_tool.rb +33 -0
  10. data/lib/rubydex/mcp_server/tools/get_declaration_tool.rb +2 -2
  11. data/lib/rubydex/mcp_server/tools/get_descendants_tool.rb +4 -4
  12. data/lib/rubydex/mcp_server/tools/get_file_declarations_tool.rb +2 -2
  13. data/lib/rubydex/mcp_server/tools/search_declarations_tool.rb +6 -6
  14. data/lib/rubydex/mcp_server.rb +24 -12
  15. data/lib/rubydex/version.rb +1 -1
  16. data/rust/Cargo.lock +17 -11
  17. data/rust/Cargo.toml +3 -0
  18. data/rust/rubydex/Cargo.toml +2 -2
  19. data/rust/rubydex/src/compile_assertions.rs +2 -0
  20. data/rust/rubydex/src/config.rs +1 -1
  21. data/rust/rubydex/src/indexing/rbs_indexer.rs +4 -4
  22. data/rust/rubydex/src/indexing/ruby_indexer.rs +26 -18
  23. data/rust/rubydex/src/indexing/ruby_indexer_tests.rs +42 -2
  24. data/rust/rubydex/src/indexing.rs +6 -6
  25. data/rust/rubydex/src/listing.rs +12 -12
  26. data/rust/rubydex/src/model/built_in.rs +1 -1
  27. data/rust/rubydex/src/model/comment.rs +4 -4
  28. data/rust/rubydex/src/model/declaration.rs +25 -17
  29. data/rust/rubydex/src/model/document.rs +11 -11
  30. data/rust/rubydex/src/model/graph.rs +3 -3
  31. data/rust/rubydex/src/offset.rs +1 -13
  32. data/rust/rubydex/src/operation/ruby_builder.rs +29 -19
  33. data/rust/rubydex/src/query.rs +3 -2
  34. data/rust/rubydex/src/test_utils/graph_test.rs +2 -2
  35. data/rust/rubydex/src/test_utils/local_graph_test.rs +13 -6
  36. data/rust/rubydex-sys/Cargo.toml +6 -3
  37. data/rust/rubydex-sys/build.rs +1 -2
  38. data/rust/rubydex-sys/src/definition_api.rs +1 -1
  39. data/rust/rubydex-sys/src/graph_api.rs +96 -49
  40. data/rust/rubydex-sys/src/name_api.rs +193 -58
  41. metadata +199 -198
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8b55f326fa4eaeb5aa1f7cca84c9fbff80418806efd91e85cf0aceed3102569
4
- data.tar.gz: 0fe3d29c164c86e7b9017f5317c192a776d28a00846a83c1aa56401e2460b933
3
+ metadata.gz: c5cebf9131e1774e193c60a99699b00bbd85226d745eb2ef26255c5ce01c78ff
4
+ data.tar.gz: 3446775b030da7622536a4302c9b63f8c592ace9c1fc1c50843fcc6279207201
5
5
  SHA512:
6
- metadata.gz: dfece03395944c9050994a45414be5473e4c7f04aa4ca42d41181ad79179a415e4b8d2cd6c31b6f3a6ee951f340528b6bff96909914b24383246000e1bd3b3e9
7
- data.tar.gz: 80c5e13ed241c8164e835f8bed4ebdedcdbab374f1b0438f0866e6504d6685df43e2b78c10d116dd35ea311493a006ecbdebd4ac7cc8703377d6b6b5bc323dbd
6
+ metadata.gz: 78bd00ed2657c524d9532e6d4d74cd2687269635119729cc8b9744f13c3e2ba6085be20d1b497cbf983587c3194695fdfc3cb88d4060cef6c9d20b4ffc8388d1
7
+ data.tar.gz: eaa2320c3ebae82feca926885ebdcab9b2dcbe4cecf89c497105e6c8f357e886b1173a1c58dff175d555574a9b597257526e7ad43df34a52616dad1650fb4203
data/README.md CHANGED
@@ -157,6 +157,16 @@ puts Rubydex::Query.schema("table")
157
157
 
158
158
  See the [linter docs](docs/linter.md).
159
159
 
160
+ ### Dead code candidates
161
+
162
+ ```bash
163
+ bundle exec rdx dead_code
164
+ ```
165
+
166
+ Prints a list of potentially dead code candidates. The list is composed of all declarations for which the analysis found no references for in the codebase.
167
+
168
+ Since some declarations may be used through meta-programming or otherwise untyped code, there may be false positives and the removal of candidates must be done carefully with context about the codebase.
169
+
160
170
  ### MCP server
161
171
 
162
172
  Rubydex can run as an MCP (Model Context Protocol) server, enabling AI assistants
@@ -198,6 +208,7 @@ like Claude to semantically query your Ruby codebase.
198
208
  | `get_declaration` | Full details by fully qualified name with docs, ancestors, members |
199
209
  | `get_descendants` | What classes/modules inherit from or include this one |
200
210
  | `find_constant_references` | All precise, resolved constant references across the codebase |
211
+ | `find_dead_code_candidates` | List of potentially unused code |
201
212
  | `get_file_declarations` | List declarations defined in a specific file |
202
213
  | `codebase_stats` | High-level statistics about the indexed codebase |
203
214
 
@@ -50,14 +50,13 @@
50
50
 
51
51
  <h2>Overview of licenses:</h2>
52
52
  <ul class="licenses-overview">
53
- <li><a href="#Apache-2.0">Apache License 2.0</a> (119)</li>
53
+ <li><a href="#Apache-2.0">Apache License 2.0</a> (115)</li>
54
54
  <li><a href="#Unicode-3.0">Unicode License v3</a> (19)</li>
55
- <li><a href="#MIT">MIT License</a> (17)</li>
55
+ <li><a href="#MIT">MIT License</a> (16)</li>
56
56
  <li><a href="#BSD-2-Clause">BSD 2-Clause &quot;Simplified&quot; License</a> (2)</li>
57
57
  <li><a href="#BSD-3-Clause">BSD 3-Clause &quot;New&quot; or &quot;Revised&quot; License</a> (1)</li>
58
58
  <li><a href="#BSL-1.0">Boost Software License 1.0</a> (1)</li>
59
59
  <li><a href="#ISC">ISC License</a> (1)</li>
60
- <li><a href="#MPL-2.0">Mozilla Public License 2.0</a> (1)</li>
61
60
  <li><a href="#mingw-w64-toolchain">MinGW-w64 toolchain and related libraries for Windows precompiled
62
61
  builds</a></li>
63
62
  </ul>
@@ -1264,36 +1263,21 @@ Software.
1264
1263
  <li><a
1265
1264
  href=" https://github.com/polyfill-rs/once_cell_polyfill ">once_cell_polyfill
1266
1265
  1.70.1</a></li>
1267
- <li><a
1268
- href=" https://github.com/toml-rs/toml ">serde_spanned
1269
- 0.6.9</a></li>
1270
1266
  <li><a
1271
1267
  href=" https://github.com/toml-rs/toml ">serde_spanned
1272
1268
  1.1.1</a></li>
1273
1269
  <li><a
1274
1270
  href=" https://github.com/tikv/jemallocator ">tikv-jemalloc-ctl
1275
1271
  0.7.0</a></li>
1276
- <li><a
1277
- href=" https://github.com/toml-rs/toml ">toml
1278
- 0.8.23</a></li>
1279
1272
  <li><a
1280
1273
  href=" https://github.com/toml-rs/toml ">toml
1281
1274
  1.1.2+spec-1.1.0</a></li>
1282
- <li><a
1283
- href=" https://github.com/toml-rs/toml ">toml_datetime
1284
- 0.6.11</a></li>
1285
1275
  <li><a
1286
1276
  href=" https://github.com/toml-rs/toml ">toml_datetime
1287
1277
  1.1.1+spec-1.1.0</a></li>
1288
- <li><a
1289
- href=" https://github.com/toml-rs/toml ">toml_edit
1290
- 0.22.27</a></li>
1291
1278
  <li><a
1292
1279
  href=" https://github.com/toml-rs/toml ">toml_parser
1293
1280
  1.1.2+spec-1.1.0</a></li>
1294
- <li><a
1295
- href=" https://github.com/toml-rs/toml ">toml_write
1296
- 0.1.2</a></li>
1297
1281
  <li><a
1298
1282
  href=" https://github.com/toml-rs/toml ">toml_writer
1299
1283
  1.1.1+spec-1.1.0</a></li>
@@ -2515,6 +2499,9 @@ limitations under the License.
2515
2499
  <li><a
2516
2500
  href=" https://github.com/comex/rust-shlex ">shlex
2517
2501
  1.3.0</a></li>
2502
+ <li><a
2503
+ href=" https://github.com/comex/rust-shlex ">shlex
2504
+ 2.0.1</a></li>
2518
2505
  <li><a
2519
2506
  href=" https://github.com/dtolnay/syn ">syn
2520
2507
  2.0.104</a></li>
@@ -2670,7 +2657,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2670
2657
  <ul class="license-used-by">
2671
2658
  <li><a
2672
2659
  href=" https://github.com/DoumanAsh/xxhash-rust ">xxhash-rust
2673
- 0.8.15</a></li>
2660
+ 0.8.16</a></li>
2674
2661
  </ul>
2675
2662
  <pre class="license-text">Boost Software License - Version 1.0 - August 17th, 2003
2676
2663
 
@@ -2821,26 +2808,6 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
2821
2808
 
2822
2809
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
2823
2810
 
2824
- THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2825
- </pre>
2826
- </li>
2827
- <li class="license">
2828
- <h3 id="MIT">MIT License</h3>
2829
- <h4>Used by:</h4>
2830
- <ul class="license-used-by">
2831
- <li><a
2832
- href=" https://github.com/ruby/prism ">ruby-prism-sys
2833
- 1.9.0</a></li>
2834
- <li><a
2835
- href=" https://github.com/ruby/prism ">ruby-prism
2836
- 1.9.0</a></li>
2837
- </ul>
2838
- <pre class="license-text">Copyright 2022-present, Shopify Inc.
2839
-
2840
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2841
-
2842
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
2843
-
2844
2811
  THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2845
2812
  </pre>
2846
2813
  </li>
@@ -2881,13 +2848,19 @@ SOFTWARE.
2881
2848
  <ul class="license-used-by">
2882
2849
  <li><a
2883
2850
  href=" https://github.com/Shopify/rubydex ">rubydex
2884
- 0.2.6</a></li>
2851
+ 0.4.3</a></li>
2885
2852
  <li><a
2886
2853
  href=" https://github.com/Shopify/rubydex ">rubydex-sys
2887
- 0.2.6</a></li>
2854
+ 0.4.3</a></li>
2888
2855
  <li><a
2889
2856
  href=" https://github.com/DimaKudosh/difflib ">difflib
2890
2857
  0.4.0</a></li>
2858
+ <li><a
2859
+ href=" https://github.com/ruby/prism ">ruby-prism-sys
2860
+ 2.0.0</a></li>
2861
+ <li><a
2862
+ href=" https://github.com/ruby/prism ">ruby-prism
2863
+ 2.0.0</a></li>
2891
2864
  </ul>
2892
2865
  <pre class="license-text">MIT License
2893
2866
 
@@ -2946,9 +2919,6 @@ DEALINGS IN THE SOFTWARE.
2946
2919
  <h3 id="MIT">MIT License</h3>
2947
2920
  <h4>Used by:</h4>
2948
2921
  <ul class="license-used-by">
2949
- <li><a
2950
- href=" https://github.com/winnow-rs/winnow ">winnow
2951
- 0.7.12</a></li>
2952
2922
  <li><a
2953
2923
  href=" https://github.com/winnow-rs/winnow ">winnow
2954
2924
  1.0.3</a></li>
@@ -3071,389 +3041,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3071
3041
  THE SOFTWARE.
3072
3042
 
3073
3043
  See the generated THIRD_PARTY_LICENSES.html file for third party licenses.
3074
- </pre>
3075
- </li>
3076
- <li class="license">
3077
- <h3 id="MPL-2.0">Mozilla Public License 2.0</h3>
3078
- <h4>Used by:</h4>
3079
- <ul class="license-used-by">
3080
- <li><a
3081
- href=" https://github.com/mozilla/cbindgen ">cbindgen
3082
- 0.29.0</a></li>
3083
- </ul>
3084
- <pre class="license-text">Mozilla Public License Version 2.0
3085
- &#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;
3086
-
3087
- 1. Definitions
3088
- --------------
3089
-
3090
- 1.1. &quot;Contributor&quot;
3091
- means each individual or legal entity that creates, contributes to
3092
- the creation of, or owns Covered Software.
3093
-
3094
- 1.2. &quot;Contributor Version&quot;
3095
- means the combination of the Contributions of others (if any) used
3096
- by a Contributor and that particular Contributor&#x27;s Contribution.
3097
-
3098
- 1.3. &quot;Contribution&quot;
3099
- means Covered Software of a particular Contributor.
3100
-
3101
- 1.4. &quot;Covered Software&quot;
3102
- means Source Code Form to which the initial Contributor has attached
3103
- the notice in Exhibit A, the Executable Form of such Source Code
3104
- Form, and Modifications of such Source Code Form, in each case
3105
- including portions thereof.
3106
-
3107
- 1.5. &quot;Incompatible With Secondary Licenses&quot;
3108
- means
3109
-
3110
- (a) that the initial Contributor has attached the notice described
3111
- in Exhibit B to the Covered Software; or
3112
-
3113
- (b) that the Covered Software was made available under the terms of
3114
- version 1.1 or earlier of the License, but not also under the
3115
- terms of a Secondary License.
3116
-
3117
- 1.6. &quot;Executable Form&quot;
3118
- means any form of the work other than Source Code Form.
3119
-
3120
- 1.7. &quot;Larger Work&quot;
3121
- means a work that combines Covered Software with other material, in
3122
- a separate file or files, that is not Covered Software.
3123
-
3124
- 1.8. &quot;License&quot;
3125
- means this document.
3126
-
3127
- 1.9. &quot;Licensable&quot;
3128
- means having the right to grant, to the maximum extent possible,
3129
- whether at the time of the initial grant or subsequently, any and
3130
- all of the rights conveyed by this License.
3131
-
3132
- 1.10. &quot;Modifications&quot;
3133
- means any of the following:
3134
-
3135
- (a) any file in Source Code Form that results from an addition to,
3136
- deletion from, or modification of the contents of Covered
3137
- Software; or
3138
-
3139
- (b) any new file in Source Code Form that contains any Covered
3140
- Software.
3141
-
3142
- 1.11. &quot;Patent Claims&quot; of a Contributor
3143
- means any patent claim(s), including without limitation, method,
3144
- process, and apparatus claims, in any patent Licensable by such
3145
- Contributor that would be infringed, but for the grant of the
3146
- License, by the making, using, selling, offering for sale, having
3147
- made, import, or transfer of either its Contributions or its
3148
- Contributor Version.
3149
-
3150
- 1.12. &quot;Secondary License&quot;
3151
- means either the GNU General Public License, Version 2.0, the GNU
3152
- Lesser General Public License, Version 2.1, the GNU Affero General
3153
- Public License, Version 3.0, or any later versions of those
3154
- licenses.
3155
-
3156
- 1.13. &quot;Source Code Form&quot;
3157
- means the form of the work preferred for making modifications.
3158
-
3159
- 1.14. &quot;You&quot; (or &quot;Your&quot;)
3160
- means an individual or a legal entity exercising rights under this
3161
- License. For legal entities, &quot;You&quot; includes any entity that
3162
- controls, is controlled by, or is under common control with You. For
3163
- purposes of this definition, &quot;control&quot; means (a) the power, direct
3164
- or indirect, to cause the direction or management of such entity,
3165
- whether by contract or otherwise, or (b) ownership of more than
3166
- fifty percent (50%) of the outstanding shares or beneficial
3167
- ownership of such entity.
3168
-
3169
- 2. License Grants and Conditions
3170
- --------------------------------
3171
-
3172
- 2.1. Grants
3173
-
3174
- Each Contributor hereby grants You a world-wide, royalty-free,
3175
- non-exclusive license:
3176
-
3177
- (a) under intellectual property rights (other than patent or trademark)
3178
- Licensable by such Contributor to use, reproduce, make available,
3179
- modify, display, perform, distribute, and otherwise exploit its
3180
- Contributions, either on an unmodified basis, with Modifications, or
3181
- as part of a Larger Work; and
3182
-
3183
- (b) under Patent Claims of such Contributor to make, use, sell, offer
3184
- for sale, have made, import, and otherwise transfer either its
3185
- Contributions or its Contributor Version.
3186
-
3187
- 2.2. Effective Date
3188
-
3189
- The licenses granted in Section 2.1 with respect to any Contribution
3190
- become effective for each Contribution on the date the Contributor first
3191
- distributes such Contribution.
3192
-
3193
- 2.3. Limitations on Grant Scope
3194
-
3195
- The licenses granted in this Section 2 are the only rights granted under
3196
- this License. No additional rights or licenses will be implied from the
3197
- distribution or licensing of Covered Software under this License.
3198
- Notwithstanding Section 2.1(b) above, no patent license is granted by a
3199
- Contributor:
3200
-
3201
- (a) for any code that a Contributor has removed from Covered Software;
3202
- or
3203
-
3204
- (b) for infringements caused by: (i) Your and any other third party&#x27;s
3205
- modifications of Covered Software, or (ii) the combination of its
3206
- Contributions with other software (except as part of its Contributor
3207
- Version); or
3208
-
3209
- (c) under Patent Claims infringed by Covered Software in the absence of
3210
- its Contributions.
3211
-
3212
- This License does not grant any rights in the trademarks, service marks,
3213
- or logos of any Contributor (except as may be necessary to comply with
3214
- the notice requirements in Section 3.4).
3215
-
3216
- 2.4. Subsequent Licenses
3217
-
3218
- No Contributor makes additional grants as a result of Your choice to
3219
- distribute the Covered Software under a subsequent version of this
3220
- License (see Section 10.2) or under the terms of a Secondary License (if
3221
- permitted under the terms of Section 3.3).
3222
-
3223
- 2.5. Representation
3224
-
3225
- Each Contributor represents that the Contributor believes its
3226
- Contributions are its original creation(s) or it has sufficient rights
3227
- to grant the rights to its Contributions conveyed by this License.
3228
-
3229
- 2.6. Fair Use
3230
-
3231
- This License is not intended to limit any rights You have under
3232
- applicable copyright doctrines of fair use, fair dealing, or other
3233
- equivalents.
3234
-
3235
- 2.7. Conditions
3236
-
3237
- Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
3238
- in Section 2.1.
3239
-
3240
- 3. Responsibilities
3241
- -------------------
3242
-
3243
- 3.1. Distribution of Source Form
3244
-
3245
- All distribution of Covered Software in Source Code Form, including any
3246
- Modifications that You create or to which You contribute, must be under
3247
- the terms of this License. You must inform recipients that the Source
3248
- Code Form of the Covered Software is governed by the terms of this
3249
- License, and how they can obtain a copy of this License. You may not
3250
- attempt to alter or restrict the recipients&#x27; rights in the Source Code
3251
- Form.
3252
-
3253
- 3.2. Distribution of Executable Form
3254
-
3255
- If You distribute Covered Software in Executable Form then:
3256
-
3257
- (a) such Covered Software must also be made available in Source Code
3258
- Form, as described in Section 3.1, and You must inform recipients of
3259
- the Executable Form how they can obtain a copy of such Source Code
3260
- Form by reasonable means in a timely manner, at a charge no more
3261
- than the cost of distribution to the recipient; and
3262
-
3263
- (b) You may distribute such Executable Form under the terms of this
3264
- License, or sublicense it under different terms, provided that the
3265
- license for the Executable Form does not attempt to limit or alter
3266
- the recipients&#x27; rights in the Source Code Form under this License.
3267
-
3268
- 3.3. Distribution of a Larger Work
3269
-
3270
- You may create and distribute a Larger Work under terms of Your choice,
3271
- provided that You also comply with the requirements of this License for
3272
- the Covered Software. If the Larger Work is a combination of Covered
3273
- Software with a work governed by one or more Secondary Licenses, and the
3274
- Covered Software is not Incompatible With Secondary Licenses, this
3275
- License permits You to additionally distribute such Covered Software
3276
- under the terms of such Secondary License(s), so that the recipient of
3277
- the Larger Work may, at their option, further distribute the Covered
3278
- Software under the terms of either this License or such Secondary
3279
- License(s).
3280
-
3281
- 3.4. Notices
3282
-
3283
- You may not remove or alter the substance of any license notices
3284
- (including copyright notices, patent notices, disclaimers of warranty,
3285
- or limitations of liability) contained within the Source Code Form of
3286
- the Covered Software, except that You may alter any license notices to
3287
- the extent required to remedy known factual inaccuracies.
3288
-
3289
- 3.5. Application of Additional Terms
3290
-
3291
- You may choose to offer, and to charge a fee for, warranty, support,
3292
- indemnity or liability obligations to one or more recipients of Covered
3293
- Software. However, You may do so only on Your own behalf, and not on
3294
- behalf of any Contributor. You must make it absolutely clear that any
3295
- such warranty, support, indemnity, or liability obligation is offered by
3296
- You alone, and You hereby agree to indemnify every Contributor for any
3297
- liability incurred by such Contributor as a result of warranty, support,
3298
- indemnity or liability terms You offer. You may include additional
3299
- disclaimers of warranty and limitations of liability specific to any
3300
- jurisdiction.
3301
-
3302
- 4. Inability to Comply Due to Statute or Regulation
3303
- ---------------------------------------------------
3304
-
3305
- If it is impossible for You to comply with any of the terms of this
3306
- License with respect to some or all of the Covered Software due to
3307
- statute, judicial order, or regulation then You must: (a) comply with
3308
- the terms of this License to the maximum extent possible; and (b)
3309
- describe the limitations and the code they affect. Such description must
3310
- be placed in a text file included with all distributions of the Covered
3311
- Software under this License. Except to the extent prohibited by statute
3312
- or regulation, such description must be sufficiently detailed for a
3313
- recipient of ordinary skill to be able to understand it.
3314
-
3315
- 5. Termination
3316
- --------------
3317
-
3318
- 5.1. The rights granted under this License will terminate automatically
3319
- if You fail to comply with any of its terms. However, if You become
3320
- compliant, then the rights granted under this License from a particular
3321
- Contributor are reinstated (a) provisionally, unless and until such
3322
- Contributor explicitly and finally terminates Your grants, and (b) on an
3323
- ongoing basis, if such Contributor fails to notify You of the
3324
- non-compliance by some reasonable means prior to 60 days after You have
3325
- come back into compliance. Moreover, Your grants from a particular
3326
- Contributor are reinstated on an ongoing basis if such Contributor
3327
- notifies You of the non-compliance by some reasonable means, this is the
3328
- first time You have received notice of non-compliance with this License
3329
- from such Contributor, and You become compliant prior to 30 days after
3330
- Your receipt of the notice.
3331
-
3332
- 5.2. If You initiate litigation against any entity by asserting a patent
3333
- infringement claim (excluding declaratory judgment actions,
3334
- counter-claims, and cross-claims) alleging that a Contributor Version
3335
- directly or indirectly infringes any patent, then the rights granted to
3336
- You by any and all Contributors for the Covered Software under Section
3337
- 2.1 of this License shall terminate.
3338
-
3339
- 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
3340
- end user license agreements (excluding distributors and resellers) which
3341
- have been validly granted by You or Your distributors under this License
3342
- prior to termination shall survive termination.
3343
-
3344
- ************************************************************************
3345
- * *
3346
- * 6. Disclaimer of Warranty *
3347
- * ------------------------- *
3348
- * *
3349
- * Covered Software is provided under this License on an &quot;as is&quot; *
3350
- * basis, without warranty of any kind, either expressed, implied, or *
3351
- * statutory, including, without limitation, warranties that the *
3352
- * Covered Software is free of defects, merchantable, fit for a *
3353
- * particular purpose or non-infringing. The entire risk as to the *
3354
- * quality and performance of the Covered Software is with You. *
3355
- * Should any Covered Software prove defective in any respect, You *
3356
- * (not any Contributor) assume the cost of any necessary servicing, *
3357
- * repair, or correction. This disclaimer of warranty constitutes an *
3358
- * essential part of this License. No use of any Covered Software is *
3359
- * authorized under this License except under this disclaimer. *
3360
- * *
3361
- ************************************************************************
3362
-
3363
- ************************************************************************
3364
- * *
3365
- * 7. Limitation of Liability *
3366
- * -------------------------- *
3367
- * *
3368
- * Under no circumstances and under no legal theory, whether tort *
3369
- * (including negligence), contract, or otherwise, shall any *
3370
- * Contributor, or anyone who distributes Covered Software as *
3371
- * permitted above, be liable to You for any direct, indirect, *
3372
- * special, incidental, or consequential damages of any character *
3373
- * including, without limitation, damages for lost profits, loss of *
3374
- * goodwill, work stoppage, computer failure or malfunction, or any *
3375
- * and all other commercial damages or losses, even if such party *
3376
- * shall have been informed of the possibility of such damages. This *
3377
- * limitation of liability shall not apply to liability for death or *
3378
- * personal injury resulting from such party&#x27;s negligence to the *
3379
- * extent applicable law prohibits such limitation. Some *
3380
- * jurisdictions do not allow the exclusion or limitation of *
3381
- * incidental or consequential damages, so this exclusion and *
3382
- * limitation may not apply to You. *
3383
- * *
3384
- ************************************************************************
3385
-
3386
- 8. Litigation
3387
- -------------
3388
-
3389
- Any litigation relating to this License may be brought only in the
3390
- courts of a jurisdiction where the defendant maintains its principal
3391
- place of business and such litigation shall be governed by laws of that
3392
- jurisdiction, without reference to its conflict-of-law provisions.
3393
- Nothing in this Section shall prevent a party&#x27;s ability to bring
3394
- cross-claims or counter-claims.
3395
-
3396
- 9. Miscellaneous
3397
- ----------------
3398
-
3399
- This License represents the complete agreement concerning the subject
3400
- matter hereof. If any provision of this License is held to be
3401
- unenforceable, such provision shall be reformed only to the extent
3402
- necessary to make it enforceable. Any law or regulation which provides
3403
- that the language of a contract shall be construed against the drafter
3404
- shall not be used to construe this License against a Contributor.
3405
-
3406
- 10. Versions of the License
3407
- ---------------------------
3408
-
3409
- 10.1. New Versions
3410
-
3411
- Mozilla Foundation is the license steward. Except as provided in Section
3412
- 10.3, no one other than the license steward has the right to modify or
3413
- publish new versions of this License. Each version will be given a
3414
- distinguishing version number.
3415
-
3416
- 10.2. Effect of New Versions
3417
-
3418
- You may distribute the Covered Software under the terms of the version
3419
- of the License under which You originally received the Covered Software,
3420
- or under the terms of any subsequent version published by the license
3421
- steward.
3422
-
3423
- 10.3. Modified Versions
3424
-
3425
- If you create software not governed by this License, and you want to
3426
- create a new license for such software, you may create and use a
3427
- modified version of this License if you rename the license and remove
3428
- any references to the name of the license steward (except to note that
3429
- such modified license differs from this License).
3430
-
3431
- 10.4. Distributing Source Code Form that is Incompatible With Secondary
3432
- Licenses
3433
-
3434
- If You choose to distribute Source Code Form that is Incompatible With
3435
- Secondary Licenses under the terms of this version of the License, the
3436
- notice described in Exhibit B of this License must be attached.
3437
-
3438
- Exhibit A - Source Code Form License Notice
3439
- -------------------------------------------
3440
-
3441
- This Source Code Form is subject to the terms of the Mozilla Public
3442
- License, v. 2.0. If a copy of the MPL was not distributed with this
3443
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
3444
-
3445
- If it is not possible or desirable to put the notice in a particular
3446
- file, then You may include the notice in a location (such as a LICENSE
3447
- file in a relevant directory) where a recipient would be likely to look
3448
- for such a notice.
3449
-
3450
- You may add additional accurate notices of copyright ownership.
3451
-
3452
- Exhibit B - &quot;Incompatible With Secondary Licenses&quot; Notice
3453
- ---------------------------------------------------------
3454
-
3455
- This Source Code Form is &quot;Incompatible With Secondary Licenses&quot;, as
3456
- defined by the Mozilla Public License, v. 2.0.
3457
3044
  </pre>
3458
3045
  </li>
3459
3046
  <li class="license">
@@ -29,6 +29,7 @@ bindings_path = root_dir.join("rubydex-sys").join("rustbindings.h")
29
29
 
30
30
  cargo_args = ["--manifest-path #{root_dir.join("Cargo.toml")}"]
31
31
  cargo_args << "$(CARGO_PROFILE_FLAG)"
32
+ cargo_args << "--features rubydex-sys/generate_bindings"
32
33
 
33
34
  if Gem.win_platform?
34
35
  cargo_args << "--target x86_64-pc-windows-gnu"
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rubydex/cli/command"
4
+
5
+ module Rubydex
6
+ module CLI
7
+ # `rdx dead_code` — lists dead code candidates in the current workspace.
8
+ class Command
9
+ class DeadCode < Command
10
+ command "dead_code"
11
+ summary "List dead code candidates in the current workspace"
12
+
13
+ #: -> void
14
+ def run
15
+ parse_options!
16
+ abort_with_usage("unexpected argument: #{argv.first}") unless argv.empty?
17
+
18
+ require "rubydex/linter/helpers/path_helpers"
19
+
20
+ $stderr.puts("Looking for potentially dead code...")
21
+ graph = build_graph($stderr, workspace_path: current_workspace_path)
22
+ candidates = graph.dead_code_candidates.sort_by(&:name)
23
+
24
+ candidates.each do |candidate|
25
+ puts(candidate.name)
26
+ candidate.definitions.map(&:location).sort.each do |location|
27
+ display = location.to_display
28
+ path = Rubydex::Linter::Helpers::PathHelpers.display_path(display, workspace: graph.workspace_path)
29
+ puts(" #{path}:#{display.start_line},#{display.start_column}-#{display.end_line},#{display.end_column}")
30
+ end
31
+ puts
32
+ end
33
+
34
+ print_summary(graph.documents.count, candidates.length)
35
+ end
36
+
37
+ private
38
+
39
+ #: (Integer file_count, Integer candidate_count) -> void
40
+ def print_summary(file_count, candidate_count)
41
+ if candidate_count.zero?
42
+ puts("#{file_count} #{pluralize("file", file_count)} inspected, no dead code candidates found")
43
+ return
44
+ end
45
+
46
+ puts(
47
+ "#{file_count} #{pluralize("file", file_count)} inspected, " \
48
+ "#{candidate_count} dead code #{pluralize("candidate", candidate_count)} found",
49
+ )
50
+ end
51
+
52
+ #: (String word, Integer count) -> String
53
+ def pluralize(word, count)
54
+ count == 1 ? word : "#{word}s"
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
Binary file
@@ -4,7 +4,7 @@ module Rubydex
4
4
  module MCPServer
5
5
  class CodebaseStatsTool < BaseTool
6
6
  tool_name "codebase_stats"
7
- description "Get an overview of the indexed Ruby codebase: total file count, declaration counts, and breakdown by kind (classes, modules, methods, constants). Use this to understand codebase size and composition, or to verify that indexing completed successfully."
7
+ description "Count indexed files, declarations, definitions, and references, with declarations grouped by kind."
8
8
  input_schema(properties: {})
9
9
 
10
10
  #: -> Tool::Response
@@ -4,12 +4,12 @@ module Rubydex
4
4
  module MCPServer
5
5
  class FindConstantReferencesTool < BaseTool
6
6
  tool_name "find_constant_references"
7
- description "Find all resolved references to a Ruby class, module, or constant across the codebase. Returns file paths, line numbers, and columns for each usage. Results are paginated: the response includes `total`. If `total` exceeds the number of returned results, use `offset` to fetch subsequent pages."
7
+ description "Locate resolved references to a Ruby class, module, or constant."
8
8
  input_schema(
9
9
  properties: {
10
- name: { type: "string", description: "Fully qualified name of the class, module, or constant to find references for" },
11
- limit: { type: "integer", description: "Maximum number of references to return (default 50, max 200)" },
12
- offset: { type: "integer", description: "Number of references to skip for pagination (default 0)" },
10
+ name: { type: "string", description: "Fully qualified class, module, or constant name" },
11
+ limit: { type: "integer", description: "Page size (default 50, capped at 200)" },
12
+ offset: { type: "integer", description: "Number of results to skip (default 0)" },
13
13
  },
14
14
  required: ["name"],
15
15
  )