rubydex 0.2.8 → 0.2.9

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.
@@ -169,37 +169,41 @@ pub unsafe extern "C" fn rdx_graph_resolve_constant(
169
169
  })
170
170
  }
171
171
 
172
- /// Adds paths to exclude from file discovery during indexing.
172
+ /// Adds glob patterns to exclude from file discovery during indexing.
173
173
  ///
174
174
  /// # Panics
175
175
  ///
176
- /// Will panic if the given array of C string paths cannot be converted to a `Vec<String>`.
176
+ /// Will panic if the given array of C string patterns cannot be converted to a `Vec<String>`.
177
177
  ///
178
178
  /// # Safety
179
179
  ///
180
180
  /// - `pointer` must be a valid `GraphPointer` previously returned by this crate.
181
- /// - `paths` must be an array of `count` valid, null-terminated UTF-8 strings.
181
+ /// - `patterns` must be an array of `count` valid, null-terminated UTF-8 strings.
182
182
  #[unsafe(no_mangle)]
183
- pub unsafe extern "C" fn rdx_graph_exclude_paths(pointer: GraphPointer, paths: *const *const c_char, count: usize) {
184
- let paths: Vec<String> = unsafe { utils::convert_double_pointer_to_vec(paths, count).unwrap() };
185
- let path_bufs: Vec<PathBuf> = paths.into_iter().map(PathBuf::from).collect();
186
- with_mut_graph(pointer, |graph| graph.exclude_paths(path_bufs));
183
+ pub unsafe extern "C" fn rdx_graph_exclude_patterns(
184
+ pointer: GraphPointer,
185
+ patterns: *const *const c_char,
186
+ count: usize,
187
+ ) {
188
+ let patterns: Vec<String> = unsafe { utils::convert_double_pointer_to_vec(patterns, count).unwrap() };
189
+ let entries: Vec<Box<str>> = patterns.into_iter().map(String::into_boxed_str).collect();
190
+ with_mut_graph(pointer, |graph| graph.exclude_patterns(entries));
187
191
  }
188
192
 
189
- /// Returns the currently excluded paths as an array of C strings. Writes the count to `out_count`. Returns NULL if no
190
- /// paths are excluded. Caller must free with `free_c_string_array`.
193
+ /// Returns the currently excluded glob patterns as an array of C strings. Writes the count to `out_count`. Returns NULL
194
+ /// if no patterns are excluded. Caller must free with `free_c_string_array`.
191
195
  ///
192
196
  /// # Safety
193
197
  ///
194
198
  /// - `pointer` must be a valid `GraphPointer` previously returned by this crate.
195
199
  /// - `out_count` must be a valid, writable pointer.
196
200
  #[unsafe(no_mangle)]
197
- pub unsafe extern "C" fn rdx_graph_excluded_paths(
201
+ pub unsafe extern "C" fn rdx_graph_excluded_patterns(
198
202
  pointer: GraphPointer,
199
203
  out_count: *mut usize,
200
204
  ) -> *const *const c_char {
201
205
  with_graph(pointer, |graph| {
202
- let excluded = graph.excluded_paths();
206
+ let excluded = graph.excluded_patterns();
203
207
 
204
208
  if excluded.is_empty() {
205
209
  unsafe { *out_count = 0 };
@@ -213,7 +217,7 @@ pub unsafe extern "C" fn rdx_graph_excluded_paths(
213
217
  // on Windows if a configuration file is using forward slashes. For example:
214
218
  //
215
219
  // C:\project/vendor/bundle
216
- let normalized = path.to_string_lossy().replace(std::path::MAIN_SEPARATOR, "/");
220
+ let normalized = path.replace(std::path::MAIN_SEPARATOR, "/");
217
221
 
218
222
  CString::new(normalized)
219
223
  .ok()
@@ -313,7 +317,7 @@ pub unsafe extern "C" fn rdx_index_all(
313
317
  let file_paths: Vec<String> = unsafe { utils::convert_double_pointer_to_vec(file_paths, count).unwrap() };
314
318
 
315
319
  with_mut_graph(pointer, |graph| {
316
- let (file_paths, listing_errors) = listing::collect_file_paths(file_paths, &graph.excluded_paths());
320
+ let (file_paths, listing_errors) = listing::collect_file_paths(file_paths, &graph.excluded_patterns());
317
321
  let indexing_errors = indexing::index_files(graph, file_paths, indexing::IndexerBackend::RubyIndexer);
318
322
 
319
323
  let all_errors: Vec<String> = listing_errors
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.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-07-08 00:00:00.000000000 Z
11
+ date: 2026-07-09 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,7 +16,6 @@ email:
16
16
  - ruby@shopify.com
17
17
  executables:
18
18
  - rdx
19
- - rubydex_mcp
20
19
  extensions:
21
20
  - ext/rubydex/extconf.rb
22
21
  extra_rdoc_files: []
@@ -25,7 +24,6 @@ files:
25
24
  - README.md
26
25
  - THIRD_PARTY_LICENSES.html
27
26
  - exe/rdx
28
- - exe/rubydex_mcp
29
27
  - ext/rubydex/declaration.c
30
28
  - ext/rubydex/declaration.h
31
29
  - ext/rubydex/definition.c
@@ -48,7 +46,6 @@ files:
48
46
  - ext/rubydex/utils.c
49
47
  - ext/rubydex/utils.h
50
48
  - lib/rubydex.rb
51
- - lib/rubydex/bin/rubydex_mcp.exe
52
49
  - lib/rubydex/comment.rb
53
50
  - lib/rubydex/declaration.rb
54
51
  - lib/rubydex/diagnostic.rb
@@ -58,6 +55,15 @@ files:
58
55
  - lib/rubydex/keyword.rb
59
56
  - lib/rubydex/keyword_parameter.rb
60
57
  - lib/rubydex/location.rb
58
+ - lib/rubydex/mcp_server.rb
59
+ - lib/rubydex/mcp_server/protocol.rb
60
+ - lib/rubydex/mcp_server/tools/base_tool.rb
61
+ - lib/rubydex/mcp_server/tools/codebase_stats_tool.rb
62
+ - lib/rubydex/mcp_server/tools/find_constant_references_tool.rb
63
+ - lib/rubydex/mcp_server/tools/get_declaration_tool.rb
64
+ - lib/rubydex/mcp_server/tools/get_descendants_tool.rb
65
+ - lib/rubydex/mcp_server/tools/get_file_declarations_tool.rb
66
+ - lib/rubydex/mcp_server/tools/search_declarations_tool.rb
61
67
  - lib/rubydex/mixin.rb
62
68
  - lib/rubydex/reference.rb
63
69
  - lib/rubydex/signature.rb
@@ -68,11 +74,6 @@ files:
68
74
  - rust/about.toml
69
75
  - rust/about_templates/about.hbs
70
76
  - rust/about_templates/mingw_licenses.hbs
71
- - rust/rubydex-mcp/Cargo.toml
72
- - rust/rubydex-mcp/src/main.rs
73
- - rust/rubydex-mcp/src/server.rs
74
- - rust/rubydex-mcp/src/tools.rs
75
- - rust/rubydex-mcp/tests/mcp.rs
76
77
  - rust/rubydex-sys/Cargo.toml
77
78
  - rust/rubydex-sys/build.rs
78
79
  - rust/rubydex-sys/cbindgen.toml
data/exe/rubydex_mcp DELETED
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "rbconfig"
5
-
6
- host_os = RbConfig::CONFIG.fetch("host_os")
7
- executable = host_os.match?(/mswin|mingw|cygwin/) ? "rubydex_mcp.exe" : "rubydex_mcp"
8
- binary = File.expand_path("../lib/rubydex/bin/#{executable}", __dir__)
9
-
10
- unless File.executable?(binary)
11
- abort(<<~MESSAGE.chomp)
12
- rubydex_mcp is not available at #{binary}.
13
- Install a precompiled rubydex gem, or reinstall rubydex with Cargo available so the MCP executable can be built locally.
14
- MESSAGE
15
- end
16
-
17
- exec(binary, *ARGV)
Binary file
@@ -1,34 +0,0 @@
1
- [package]
2
- name = "rubydex-mcp"
3
- version = "0.2.6"
4
- edition = "2024"
5
- rust-version = "1.89.0"
6
- license = "MIT"
7
- description = "MCP server exposing Rubydex semantic Ruby code intelligence tools."
8
- homepage = "https://github.com/Shopify/rubydex"
9
- repository = "https://github.com/Shopify/rubydex"
10
- readme = "README.md"
11
- keywords = ["ruby", "mcp", "static-analysis"]
12
- categories = ["development-tools"]
13
-
14
- [[bin]]
15
- name = "rubydex_mcp"
16
- path = "src/main.rs"
17
-
18
- [dependencies]
19
- rubydex = { version = "0.2.6", path = "../rubydex" }
20
- clap = { version = "4.5.16", features = ["derive"] }
21
- rmcp = { version = "1.4", features = ["server", "macros", "transport-io", "schemars"] }
22
- tokio = { version = "1", features = ["macros", "rt", "io-std"] }
23
- serde = { version = "1", features = ["derive"] }
24
- serde_json = "1"
25
- schemars = "1"
26
- url = "2"
27
-
28
- [dev-dependencies]
29
- rubydex = { version = "0.2.6", path = "../rubydex", features = ["test_utils"] }
30
- assert_cmd = "2.0"
31
- serde_json = "1"
32
-
33
- [lints]
34
- workspace = true
@@ -1,48 +0,0 @@
1
- use clap::Parser;
2
-
3
- mod server;
4
- mod tools;
5
-
6
- #[derive(Parser, Debug)]
7
- #[command(
8
- name = "rubydex_mcp",
9
- about = "Rubydex MCP server for AI-assisted Ruby code intelligence",
10
- version
11
- )]
12
- struct Args {
13
- #[arg(value_name = "PATH", default_value = ".")]
14
- path: String,
15
- }
16
-
17
- fn main() {
18
- let args = Args::parse();
19
-
20
- let root = match std::fs::canonicalize(&args.path) {
21
- Ok(p) => p
22
- .into_os_string()
23
- .into_string()
24
- .expect("Project path is not valid UTF-8"),
25
- Err(e) => {
26
- eprintln!("Warning: failed to canonicalize '{}': {e}", args.path);
27
- args.path
28
- }
29
- };
30
-
31
- // Create the server and start indexing in the background.
32
- let server = server::RubydexServer::new(root.clone());
33
- server.spawn_indexer(root);
34
-
35
- // Serve MCP over stdio immediately while indexing runs.
36
- // We need to do this because Claude Code's default MCP server timeout is 30 seconds,
37
- // And in big codebases it's possible to exceed that and Claude Code would just consider
38
- // the server fail to connect.
39
- let rt = tokio::runtime::Builder::new_current_thread()
40
- .enable_all()
41
- .build()
42
- .expect("Failed to build tokio runtime");
43
-
44
- if let Err(e) = rt.block_on(server.serve()) {
45
- eprintln!("MCP server error: {e}");
46
- std::process::exit(1);
47
- }
48
- }