rubydex 0.1.0.beta12-aarch64-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 (109) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +23 -0
  3. data/README.md +125 -0
  4. data/THIRD_PARTY_LICENSES.html +4562 -0
  5. data/exe/rdx +47 -0
  6. data/ext/rubydex/declaration.c +453 -0
  7. data/ext/rubydex/declaration.h +23 -0
  8. data/ext/rubydex/definition.c +284 -0
  9. data/ext/rubydex/definition.h +28 -0
  10. data/ext/rubydex/diagnostic.c +6 -0
  11. data/ext/rubydex/diagnostic.h +11 -0
  12. data/ext/rubydex/document.c +97 -0
  13. data/ext/rubydex/document.h +10 -0
  14. data/ext/rubydex/extconf.rb +138 -0
  15. data/ext/rubydex/graph.c +681 -0
  16. data/ext/rubydex/graph.h +10 -0
  17. data/ext/rubydex/handle.h +44 -0
  18. data/ext/rubydex/location.c +22 -0
  19. data/ext/rubydex/location.h +15 -0
  20. data/ext/rubydex/reference.c +123 -0
  21. data/ext/rubydex/reference.h +15 -0
  22. data/ext/rubydex/rubydex.c +22 -0
  23. data/ext/rubydex/utils.c +108 -0
  24. data/ext/rubydex/utils.h +34 -0
  25. data/lib/rubydex/3.2/rubydex.so +0 -0
  26. data/lib/rubydex/3.3/rubydex.so +0 -0
  27. data/lib/rubydex/3.4/rubydex.so +0 -0
  28. data/lib/rubydex/4.0/rubydex.so +0 -0
  29. data/lib/rubydex/comment.rb +17 -0
  30. data/lib/rubydex/diagnostic.rb +21 -0
  31. data/lib/rubydex/failures.rb +15 -0
  32. data/lib/rubydex/graph.rb +98 -0
  33. data/lib/rubydex/keyword.rb +17 -0
  34. data/lib/rubydex/keyword_parameter.rb +13 -0
  35. data/lib/rubydex/librubydex_sys.so +0 -0
  36. data/lib/rubydex/location.rb +90 -0
  37. data/lib/rubydex/mixin.rb +22 -0
  38. data/lib/rubydex/version.rb +5 -0
  39. data/lib/rubydex.rb +23 -0
  40. data/rbi/rubydex.rbi +422 -0
  41. data/rust/Cargo.lock +1851 -0
  42. data/rust/Cargo.toml +29 -0
  43. data/rust/about.hbs +78 -0
  44. data/rust/about.toml +10 -0
  45. data/rust/rubydex/Cargo.toml +42 -0
  46. data/rust/rubydex/src/compile_assertions.rs +13 -0
  47. data/rust/rubydex/src/diagnostic.rs +110 -0
  48. data/rust/rubydex/src/errors.rs +28 -0
  49. data/rust/rubydex/src/indexing/local_graph.rs +224 -0
  50. data/rust/rubydex/src/indexing/rbs_indexer.rs +1551 -0
  51. data/rust/rubydex/src/indexing/ruby_indexer.rs +2329 -0
  52. data/rust/rubydex/src/indexing/ruby_indexer_tests.rs +4962 -0
  53. data/rust/rubydex/src/indexing.rs +210 -0
  54. data/rust/rubydex/src/integrity.rs +279 -0
  55. data/rust/rubydex/src/job_queue.rs +205 -0
  56. data/rust/rubydex/src/lib.rs +17 -0
  57. data/rust/rubydex/src/listing.rs +371 -0
  58. data/rust/rubydex/src/main.rs +160 -0
  59. data/rust/rubydex/src/model/built_in.rs +83 -0
  60. data/rust/rubydex/src/model/comment.rs +24 -0
  61. data/rust/rubydex/src/model/declaration.rs +671 -0
  62. data/rust/rubydex/src/model/definitions.rs +1682 -0
  63. data/rust/rubydex/src/model/document.rs +222 -0
  64. data/rust/rubydex/src/model/encoding.rs +22 -0
  65. data/rust/rubydex/src/model/graph.rs +3754 -0
  66. data/rust/rubydex/src/model/id.rs +110 -0
  67. data/rust/rubydex/src/model/identity_maps.rs +58 -0
  68. data/rust/rubydex/src/model/ids.rs +60 -0
  69. data/rust/rubydex/src/model/keywords.rs +256 -0
  70. data/rust/rubydex/src/model/name.rs +298 -0
  71. data/rust/rubydex/src/model/references.rs +111 -0
  72. data/rust/rubydex/src/model/string_ref.rs +50 -0
  73. data/rust/rubydex/src/model/visibility.rs +41 -0
  74. data/rust/rubydex/src/model.rs +15 -0
  75. data/rust/rubydex/src/offset.rs +147 -0
  76. data/rust/rubydex/src/position.rs +6 -0
  77. data/rust/rubydex/src/query.rs +1841 -0
  78. data/rust/rubydex/src/resolution.rs +6517 -0
  79. data/rust/rubydex/src/stats/memory.rs +71 -0
  80. data/rust/rubydex/src/stats/orphan_report.rs +264 -0
  81. data/rust/rubydex/src/stats/timer.rs +127 -0
  82. data/rust/rubydex/src/stats.rs +11 -0
  83. data/rust/rubydex/src/test_utils/context.rs +226 -0
  84. data/rust/rubydex/src/test_utils/graph_test.rs +730 -0
  85. data/rust/rubydex/src/test_utils/local_graph_test.rs +602 -0
  86. data/rust/rubydex/src/test_utils.rs +52 -0
  87. data/rust/rubydex/src/visualization/dot.rs +192 -0
  88. data/rust/rubydex/src/visualization.rs +6 -0
  89. data/rust/rubydex/tests/cli.rs +185 -0
  90. data/rust/rubydex-mcp/Cargo.toml +28 -0
  91. data/rust/rubydex-mcp/src/main.rs +48 -0
  92. data/rust/rubydex-mcp/src/server.rs +1145 -0
  93. data/rust/rubydex-mcp/src/tools.rs +49 -0
  94. data/rust/rubydex-mcp/tests/mcp.rs +302 -0
  95. data/rust/rubydex-sys/Cargo.toml +20 -0
  96. data/rust/rubydex-sys/build.rs +14 -0
  97. data/rust/rubydex-sys/cbindgen.toml +12 -0
  98. data/rust/rubydex-sys/src/declaration_api.rs +485 -0
  99. data/rust/rubydex-sys/src/definition_api.rs +443 -0
  100. data/rust/rubydex-sys/src/diagnostic_api.rs +99 -0
  101. data/rust/rubydex-sys/src/document_api.rs +85 -0
  102. data/rust/rubydex-sys/src/graph_api.rs +948 -0
  103. data/rust/rubydex-sys/src/lib.rs +79 -0
  104. data/rust/rubydex-sys/src/location_api.rs +79 -0
  105. data/rust/rubydex-sys/src/name_api.rs +135 -0
  106. data/rust/rubydex-sys/src/reference_api.rs +267 -0
  107. data/rust/rubydex-sys/src/utils.rs +70 -0
  108. data/rust/rustfmt.toml +2 -0
  109. metadata +159 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7cac26cfbab4ecd0c141547cfda39af90b28fbb723274f6499fa3318963a8e60
4
+ data.tar.gz: 47d8325df6b6797ab0fd3a113f3b94386b9289c929f4d69620851bb98140d8e7
5
+ SHA512:
6
+ metadata.gz: 233caa506bfa762c33cc0d44ac4fe5c86e851790e5bf519fd1d4eafd57e6b6043e53d9c9f123ee86726a5560356a40e935fab57346b8399cf10e06ba86f808ec
7
+ data.tar.gz: fcc375aec9c47db0b92944330d47b8a5ebbff4d119c152c39d4cb75081a4e752c55a8d33ee00a3eee2e364d60f47fee3ff79123c192416846f9906bb208bff91
data/LICENSE.txt ADDED
@@ -0,0 +1,23 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025-present, Shopify Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+
23
+ See the generated THIRD_PARTY_LICENSES.html file for third party licenses.
data/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # Rubydex
2
+
3
+ This project is a high performance static analysis toolkit for the Ruby language. The goal is to be a solid
4
+ foundation to power a variety of tools, such as type checkers, linters, language servers and more.
5
+
6
+ ## Usage
7
+
8
+ Both Ruby and Rust APIs are made available through a gem and a crate, respectively. Here's a simple example
9
+ of using the Ruby API:
10
+
11
+ ```ruby
12
+ # Create a new graph representing the current workspace
13
+ graph = Rubydex::Graph.new
14
+ # Configuring graph LSP encoding
15
+ graph.encoding = "utf16"
16
+ # Index the entire workspace with all dependencies
17
+ graph.index_workspace
18
+ # Or index specific file paths
19
+ graph.index_all(["path/to/file.rb"])
20
+ # Transform the initially collected information into its semantic understanding by running resolution
21
+ graph.resolve
22
+ # Get all diagnostics acquired during the analysis
23
+ graph.diagnostics
24
+
25
+ # Iterating over graph nodes
26
+ graph.declarations
27
+ graph.documents
28
+ graph.constant_references
29
+ graph.method_references
30
+
31
+ # Analyzing require paths
32
+ graph.resolve_require_path("rails/engine", load_paths) # => document pointed by `rails/engine`
33
+ graph.require_paths(load_paths) # => array of all indexed require paths
34
+
35
+ # Querying
36
+ graph["Foo"] # Get declaration by fully qualified name
37
+ graph.search("Foo#b") # Name search
38
+ graph.resolve_constant("Bar", ["Foo", "Baz::Qux"]) # Resolve constant reference based on nesting
39
+
40
+ # Declarations
41
+ declaration = graph["Foo"]
42
+
43
+ # All declarations include
44
+ declaration.name
45
+ declaration.unqualified_name
46
+ declaration.definitions
47
+ declaration.owner
48
+
49
+ # Namespace declarations include
50
+ declaration.member("bar()")
51
+ declaration.member("@ivar")
52
+ declaration.singleton_class
53
+ declaration.ancestors
54
+ declaration.descendants
55
+
56
+ # Documents
57
+ document = graph.documents.first
58
+ document.uri
59
+ document.definitions # => list of definitions discovered in this document
60
+
61
+ # Definitions
62
+ definition = declaration.definitions.first
63
+ definition.location
64
+ definition.comments
65
+ definition.name
66
+ definition.deprecated?
67
+ definition.name_location
68
+
69
+ # Locations
70
+ location = definition.location
71
+ location.path
72
+
73
+ # Diagnostics
74
+ diagnostic = graph.diagnostics.first
75
+ diagnostic.rule
76
+ diagnostic.message
77
+ diagnostic.location
78
+ ```
79
+
80
+ ## MCP Server (Experimental)
81
+
82
+ Rubydex can run as an MCP (Model Context Protocol) server, enabling AI assistants
83
+ like Claude to semantically query your Ruby codebase.
84
+
85
+ ### Setup
86
+
87
+ 1. Install the binary:
88
+ ```bash
89
+ cargo install --path rust/rubydex-mcp
90
+ ```
91
+
92
+ 2. Add rubydex to the Ruby project you want to index:
93
+ ```bash
94
+ claude mcp add --scope project rubydex "\${HOME}/.cargo/bin/rubydex_mcp"
95
+ ```
96
+
97
+ Or manually create a `.mcp.json` in the project root:
98
+ ```json
99
+ {
100
+ "mcpServers": {
101
+ "rubydex": {
102
+ "command": "${HOME}/.cargo/bin/rubydex_mcp"
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ 3. Start Claude Code from that project directory. The MCP server indexes
109
+ the project at startup and provides semantic code intelligence tools.
110
+ Verify with `/mcp` in the session.
111
+
112
+ ### Available MCP Tools
113
+
114
+ | Tool | Description |
115
+ |------|-------------|
116
+ | `search_declarations` | Fuzzy search for classes, modules, methods, constants |
117
+ | `get_declaration` | Full details by fully qualified name with docs, ancestors, members |
118
+ | `get_descendants` | What classes/modules inherit from or include this one |
119
+ | `find_constant_references` | All precise, resolved constant references across the codebase |
120
+ | `get_file_declarations` | List declarations defined in a specific file |
121
+ | `codebase_stats` | High-level statistics about the indexed codebase |
122
+
123
+ ## Contributing
124
+
125
+ See [the contributing documentation](CONTRIBUTING.md).