rubydex 0.2.3-aarch64-linux → 0.2.5-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.
- checksums.yaml +4 -4
- data/THIRD_PARTY_LICENSES.html +2 -2
- data/exe/rubydex_mcp +17 -0
- data/ext/rubydex/definition.c +56 -0
- data/ext/rubydex/extconf.rb +8 -0
- data/lib/rubydex/3.2/rubydex.so +0 -0
- data/lib/rubydex/3.3/rubydex.so +0 -0
- data/lib/rubydex/3.4/rubydex.so +0 -0
- data/lib/rubydex/4.0/rubydex.so +0 -0
- data/lib/rubydex/bin/rubydex_mcp +0 -0
- data/lib/rubydex/declaration.rb +12 -0
- data/lib/rubydex/graph.rb +3 -1
- data/lib/rubydex/librubydex_sys.so +0 -0
- data/lib/rubydex/version.rb +1 -1
- data/rbi/rubydex.rbi +14 -1
- data/rust/Cargo.lock +4 -4
- data/rust/rubydex/src/indexing/local_graph.rs +38 -0
- data/rust/rubydex/src/indexing/ruby_indexer.rs +6 -0
- data/rust/rubydex/src/indexing/ruby_indexer_tests.rs +5 -1
- data/rust/rubydex/src/indexing.rs +38 -12
- data/rust/rubydex/src/lib.rs +1 -0
- data/rust/rubydex/src/listing.rs +14 -3
- data/rust/rubydex/src/main.rs +27 -2
- data/rust/rubydex/src/model/definitions.rs +7 -18
- data/rust/rubydex/src/model/graph.rs +21 -4
- data/rust/rubydex/src/model/ids.rs +27 -1
- data/rust/rubydex/src/operation/applier.rs +519 -0
- data/rust/rubydex/src/operation/mod.rs +284 -0
- data/rust/rubydex/src/operation/printer.rs +260 -0
- data/rust/rubydex/src/operation/ruby_builder.rs +2915 -0
- data/rust/rubydex/src/resolution.rs +6 -1
- data/rust/rubydex/src/resolution_tests.rs +217 -209
- data/rust/rubydex/src/test_utils/graph_test.rs +19 -4
- data/rust/rubydex/src/test_utils/local_graph_test.rs +7 -6
- data/rust/rubydex-mcp/Cargo.toml +1 -1
- data/rust/rubydex-mcp/src/server.rs +10 -7
- data/rust/rubydex-sys/src/definition_api.rs +24 -0
- data/rust/rubydex-sys/src/graph_api.rs +1 -1
- metadata +9 -2
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
use super::normalize_indentation;
|
|
2
2
|
#[cfg(test)]
|
|
3
3
|
use crate::diagnostic::Rule;
|
|
4
|
-
use crate::indexing::{self, LanguageId};
|
|
4
|
+
use crate::indexing::{self, IndexerBackend, LanguageId};
|
|
5
5
|
use crate::model::graph::{Graph, NameDependent};
|
|
6
6
|
use crate::model::ids::{NameId, StringId};
|
|
7
7
|
use crate::resolution::Resolver;
|
|
8
8
|
|
|
9
|
-
#[derive(Default)]
|
|
10
9
|
pub struct GraphTest {
|
|
11
10
|
graph: Graph,
|
|
11
|
+
backend: IndexerBackend,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
impl Default for GraphTest {
|
|
15
|
+
fn default() -> Self {
|
|
16
|
+
Self::new()
|
|
17
|
+
}
|
|
12
18
|
}
|
|
13
19
|
|
|
14
20
|
impl GraphTest {
|
|
15
21
|
#[must_use]
|
|
16
22
|
pub fn new() -> Self {
|
|
17
|
-
Self
|
|
23
|
+
Self::new_with_backend(IndexerBackend::RubyIndexer)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#[must_use]
|
|
27
|
+
pub fn new_with_backend(backend: IndexerBackend) -> Self {
|
|
28
|
+
Self {
|
|
29
|
+
graph: Graph::new(),
|
|
30
|
+
backend,
|
|
31
|
+
}
|
|
18
32
|
}
|
|
19
33
|
|
|
20
34
|
#[must_use]
|
|
@@ -30,7 +44,8 @@ impl GraphTest {
|
|
|
30
44
|
/// Indexes a Ruby source
|
|
31
45
|
pub fn index_uri(&mut self, uri: &str, source: &str) {
|
|
32
46
|
let source = normalize_indentation(source);
|
|
33
|
-
indexing::
|
|
47
|
+
let local_graph = indexing::build_local_graph(uri.to_string(), &source, &LanguageId::Ruby, self.backend);
|
|
48
|
+
self.graph.consume_document_changes(local_graph);
|
|
34
49
|
}
|
|
35
50
|
|
|
36
51
|
/// Indexes an RBS source
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
use super::normalize_indentation;
|
|
2
2
|
use crate::indexing::local_graph::LocalGraph;
|
|
3
3
|
use crate::indexing::rbs_indexer::RBSIndexer;
|
|
4
|
-
use crate::indexing::
|
|
4
|
+
use crate::indexing::{IndexerBackend, LanguageId, build_local_graph};
|
|
5
5
|
use crate::model::definitions::Definition;
|
|
6
6
|
use crate::model::graph::NameDependent;
|
|
7
7
|
use crate::model::ids::{NameId, StringId, UriId};
|
|
@@ -19,13 +19,14 @@ pub struct LocalGraphTest {
|
|
|
19
19
|
impl LocalGraphTest {
|
|
20
20
|
#[must_use]
|
|
21
21
|
pub fn new(uri: &str, source: &str) -> Self {
|
|
22
|
+
Self::new_with_backend(uri, source, IndexerBackend::RubyIndexer)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#[must_use]
|
|
26
|
+
pub fn new_with_backend(uri: &str, source: &str, backend: IndexerBackend) -> Self {
|
|
22
27
|
let uri = uri.to_string();
|
|
23
28
|
let source = normalize_indentation(source);
|
|
24
|
-
|
|
25
|
-
let mut indexer = RubyIndexer::new(uri.clone(), &source);
|
|
26
|
-
indexer.index();
|
|
27
|
-
let graph = indexer.local_graph();
|
|
28
|
-
|
|
29
|
+
let graph = build_local_graph(uri.clone(), &source, &LanguageId::Ruby, backend);
|
|
29
30
|
Self { uri, source, graph }
|
|
30
31
|
}
|
|
31
32
|
|
data/rust/rubydex-mcp/Cargo.toml
CHANGED
|
@@ -12,7 +12,7 @@ path = "src/main.rs"
|
|
|
12
12
|
[dependencies]
|
|
13
13
|
rubydex = { path = "../rubydex" }
|
|
14
14
|
clap = { version = "4.5.16", features = ["derive"] }
|
|
15
|
-
rmcp = { version = "
|
|
15
|
+
rmcp = { version = "1.4", features = ["server", "macros", "transport-io", "schemars"] }
|
|
16
16
|
tokio = { version = "1", features = ["macros", "rt", "io-std"] }
|
|
17
17
|
serde = { version = "1", features = ["derive"] }
|
|
18
18
|
serde_json = "1"
|
|
@@ -54,7 +54,11 @@ impl RubydexServer {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
let mut graph = Graph::new();
|
|
57
|
-
let errors = rubydex::indexing::index_files(
|
|
57
|
+
let errors = rubydex::indexing::index_files(
|
|
58
|
+
&mut graph,
|
|
59
|
+
file_paths,
|
|
60
|
+
rubydex::indexing::IndexerBackend::RubyIndexer,
|
|
61
|
+
);
|
|
58
62
|
for error in &errors {
|
|
59
63
|
eprintln!("Indexing error: {error}");
|
|
60
64
|
}
|
|
@@ -565,14 +569,13 @@ Pagination: tools that may return a high number of results include `total` for p
|
|
|
565
569
|
|
|
566
570
|
Use Grep instead for: literal string search, log messages, comments, non-Ruby files, or content search rather than structural queries."#;
|
|
567
571
|
|
|
568
|
-
#[tool_handler]
|
|
572
|
+
#[tool_handler(router = self.tool_router)]
|
|
569
573
|
impl ServerHandler for RubydexServer {
|
|
570
574
|
fn get_info(&self) -> ServerInfo {
|
|
571
|
-
ServerInfo
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}
|
|
575
|
+
let mut info = ServerInfo::default();
|
|
576
|
+
info.instructions = Some(SERVER_INSTRUCTIONS.into());
|
|
577
|
+
info.capabilities = ServerCapabilities::builder().enable_tools().build();
|
|
578
|
+
info
|
|
576
579
|
}
|
|
577
580
|
}
|
|
578
581
|
|
|
@@ -276,6 +276,30 @@ pub unsafe extern "C" fn rdx_definition_declaration(pointer: GraphPointer, defin
|
|
|
276
276
|
})
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
/// Returns the lexical nesting definition id for the given definition, or NULL if there is no lexical nesting.
|
|
280
|
+
/// Caller must free the returned pointer with `free_u64`.
|
|
281
|
+
///
|
|
282
|
+
/// # Safety
|
|
283
|
+
/// - `pointer` must be a valid pointer previously returned by `rdx_graph_new`.
|
|
284
|
+
/// - `definition_id` must be a valid definition id.
|
|
285
|
+
///
|
|
286
|
+
/// # Panics
|
|
287
|
+
/// This function will panic if the definition cannot be found.
|
|
288
|
+
#[unsafe(no_mangle)]
|
|
289
|
+
pub unsafe extern "C" fn rdx_definition_lexical_nesting_id(pointer: GraphPointer, definition_id: u64) -> *const u64 {
|
|
290
|
+
with_graph(pointer, |graph| {
|
|
291
|
+
let def_id = DefinitionId::new(definition_id);
|
|
292
|
+
let Some(defn) = graph.definitions().get(&def_id) else {
|
|
293
|
+
panic!("Definition not found: {definition_id:?}");
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
match defn.lexical_nesting_id() {
|
|
297
|
+
Some(lexical_nesting_id) => Box::into_raw(Box::new(**lexical_nesting_id)).cast_const(),
|
|
298
|
+
None => ptr::null(),
|
|
299
|
+
}
|
|
300
|
+
})
|
|
301
|
+
}
|
|
302
|
+
|
|
279
303
|
/// Creates a new iterator over definition IDs for a given declaration by snapshotting the current set of IDs.
|
|
280
304
|
///
|
|
281
305
|
/// # Panics
|
|
@@ -233,7 +233,7 @@ pub unsafe extern "C" fn rdx_index_all(
|
|
|
233
233
|
|
|
234
234
|
with_mut_graph(pointer, |graph| {
|
|
235
235
|
let (file_paths, listing_errors) = listing::collect_file_paths(file_paths, graph.excluded_paths());
|
|
236
|
-
let indexing_errors = indexing::index_files(graph, file_paths);
|
|
236
|
+
let indexing_errors = indexing::index_files(graph, file_paths, indexing::IndexerBackend::RubyIndexer);
|
|
237
237
|
|
|
238
238
|
let all_errors: Vec<String> = listing_errors
|
|
239
239
|
.into_iter()
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubydex
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.5
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Shopify
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-05-
|
|
11
|
+
date: 2026-05-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A high-performance static analysis suite for Ruby, built in Rust with
|
|
14
14
|
Ruby APIs
|
|
@@ -16,6 +16,7 @@ email:
|
|
|
16
16
|
- ruby@shopify.com
|
|
17
17
|
executables:
|
|
18
18
|
- rdx
|
|
19
|
+
- rubydex_mcp
|
|
19
20
|
extensions: []
|
|
20
21
|
extra_rdoc_files: []
|
|
21
22
|
files:
|
|
@@ -23,6 +24,7 @@ files:
|
|
|
23
24
|
- README.md
|
|
24
25
|
- THIRD_PARTY_LICENSES.html
|
|
25
26
|
- exe/rdx
|
|
27
|
+
- exe/rubydex_mcp
|
|
26
28
|
- ext/rubydex/declaration.c
|
|
27
29
|
- ext/rubydex/declaration.h
|
|
28
30
|
- ext/rubydex/definition.c
|
|
@@ -49,6 +51,7 @@ files:
|
|
|
49
51
|
- lib/rubydex/3.3/rubydex.so
|
|
50
52
|
- lib/rubydex/3.4/rubydex.so
|
|
51
53
|
- lib/rubydex/4.0/rubydex.so
|
|
54
|
+
- lib/rubydex/bin/rubydex_mcp
|
|
52
55
|
- lib/rubydex/comment.rb
|
|
53
56
|
- lib/rubydex/declaration.rb
|
|
54
57
|
- lib/rubydex/diagnostic.rb
|
|
@@ -118,6 +121,10 @@ files:
|
|
|
118
121
|
- rust/rubydex/src/model/string_ref.rs
|
|
119
122
|
- rust/rubydex/src/model/visibility.rs
|
|
120
123
|
- rust/rubydex/src/offset.rs
|
|
124
|
+
- rust/rubydex/src/operation/applier.rs
|
|
125
|
+
- rust/rubydex/src/operation/mod.rs
|
|
126
|
+
- rust/rubydex/src/operation/printer.rs
|
|
127
|
+
- rust/rubydex/src/operation/ruby_builder.rs
|
|
121
128
|
- rust/rubydex/src/position.rs
|
|
122
129
|
- rust/rubydex/src/query.rs
|
|
123
130
|
- rust/rubydex/src/resolution.rs
|