Skip to content

Implement Ruby SDK#1

Open
bettercallsaulj wants to merge 11 commits intomainfrom
dev_ruby_sdk
Open

Implement Ruby SDK#1
bettercallsaulj wants to merge 11 commits intomainfrom
dev_ruby_sdk

Conversation

@bettercallsaulj
Copy link
Collaborator

No description provided.

RahulHere added 11 commits January 23, 2026 12:49
- Remove C++ files: .clang-format, cmake/, CMakeLists.txt, Makefile,
  src/, include/, examples/, tests/, build.sh
- Remove C++ CI workflow (pr-format-check.yml)
- Update submodule from gopher-mcp to gopher-orch (commit 6b45ffbb)
- Update .gitignore for Ruby development
Build script that:
- Updates git submodules (handles 'update = none' in gopher-orch)
- Builds gopher-orch native library with CMake
- Fixes macOS dylib install names for Ruby FFI compatibility
- Handles multiple libfmt versions (10, 11, 12)
- Optionally checks Ruby environment and runs tests
Features:
- FFI bindings using the ffi gem
- Builder pattern for configuration
- Support for both API key and JSON server config
- Automatic resource cleanup with dispose/close
- Detailed result information with AgentResult
Examples:
- client_example_json.rb: Demonstrates agent creation and query execution
  using JSON server configuration with local MCP servers
- client_example_json_run.sh: Helper script to start MCP servers and run
  the Ruby client example

MCP Servers (TypeScript/Express):
- server3001: Weather tools MCP server (port 3001)
- server3002: Calculator tools MCP server (port 3002)
RSpec tests for verifying FFI bindings work correctly:
- spec/gopher_orch_spec.rb: Tests for main GopherOrch module
- spec/native_spec.rb: Tests for Native FFI bindings
- spec/config_builder_spec.rb: Unit tests for ConfigBuilder
- spec/agent_result_spec.rb: Unit tests for AgentResult
- spec/agent_result_status_spec.rb: Unit tests for AgentResultStatus

Test features:
- :requires_native tag to skip tests when native library unavailable
- Tests FFI function calls work without crashes
- Tests builder pattern and data structures
- Tests error handling
Comprehensive documentation including:
- Feature overview and architecture diagram
- Installation options (RubyGems, Gemfile, source)
- Building from source guide with prerequisites
- Native library details and search paths
- API documentation with code examples
- Example usage with local MCP servers
- Project structure and development guide
- Troubleshooting common issues
- Contributing guidelines
Add comprehensive Ruby environment checks:
- Verify Ruby version is >= 2.7 (minimum required)
- Check gem command is available
- Auto-install Bundler if missing
- Verify bundle install succeeds
- Check FFI gem can be loaded with version info
- Verify SDK can be loaded without errors
- Check if native library is accessible
- Summary status of Ruby environment readiness

The build now provides clear feedback on what's missing and
how to fix Ruby environment issues.
Changes:
- Check if gopher-orch submodule directory exists with CMakeLists.txt
  before attempting git submodule update (avoids clone failures)
- Check if nested gopher-mcp submodule already exists before updating
- Improves build reliability when submodules are manually copied
Homebrew Ruby is "keg-only" and not symlinked into /usr/local by default,
so the build script was falling back to the older system Ruby. This change
adds detection for Homebrew Ruby paths (both Intel and Apple Silicon) and
adds them to PATH before checking the Ruby version.

Changes:
- Add detection for /usr/local/opt/ruby/bin (Intel Mac)
- Add detection for /opt/homebrew/opt/ruby/bin (Apple Silicon)
- Include gem bin directory in PATH for bundler access
- Print confirmation when Homebrew Ruby is detected
Same fix as build.sh - add detection for Homebrew Ruby paths
so the example script uses Ruby 4.0 instead of system Ruby 2.6.
Adds RuboCop configuration for consistent code style across the project.

Changes:
- Add .rubocop.yml with project-specific rules
- Add rubocop-rspec gem to Gemfile for RSpec-specific cops
- Update Rakefile with rubocop and rubocop:fix tasks
- Update README.md with RuboCop commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant