swarm_cli 2.1.0 → 2.1.1
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/lib/swarm_cli/commands/mcp_tools.rb +3 -3
- data/lib/swarm_cli/config_loader.rb +11 -10
- data/lib/swarm_cli/version.rb +1 -1
- data/lib/swarm_cli.rb +2 -0
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 47b4b2c7c8f1268a7f3645d8e0ac9501dcca2405491401b7584c3faddd20b8cb
         | 
| 4 | 
            +
              data.tar.gz: 3c2b3cda6305e3abdd2f479067f979c4e60c2be89045e1653990fb688cb13d4f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7775a511e5b7b2bed6ebecffa021b73ad88b18406c938e2fc8b4bef9b5628b824930470b43c91c380a69721a6a462519da69c0f8c6d9bdc0073212df8b553a4f
         | 
| 7 | 
            +
              data.tar.gz: 82a754e96cf3aafff0b956fb144f1f1631960fbb2de72fe1db765d0eefee6743efa5af25bf76d63687431b549cb3d3b04c727559bea6755d798626ec23113f73
         | 
| @@ -14,9 +14,9 @@ module SwarmCLI | |
| 14 14 |  | 
| 15 15 | 
             
                  def initialize(options)
         | 
| 16 16 | 
             
                    @options = options
         | 
| 17 | 
            -
                    # Create scratchpad  | 
| 18 | 
            -
                     | 
| 19 | 
            -
                    @scratchpad = SwarmSDK:: | 
| 17 | 
            +
                    # Create volatile scratchpad for MCP server
         | 
| 18 | 
            +
                    # Note: Scratchpad is always volatile - data is not persisted between sessions
         | 
| 19 | 
            +
                    @scratchpad = SwarmSDK::Tools::Stores::ScratchpadStorage.new
         | 
| 20 20 | 
             
                  end
         | 
| 21 21 |  | 
| 22 22 | 
             
                  def execute
         | 
| @@ -5,7 +5,7 @@ module SwarmCLI | |
| 5 5 | 
             
              #
         | 
| 6 6 | 
             
              # Supports:
         | 
| 7 7 | 
             
              # - YAML files (.yml, .yaml) - loaded via SwarmSDK::Swarm.load
         | 
| 8 | 
            -
              # - Ruby DSL files (.rb) - executed and expected to return a SwarmSDK::Swarm instance
         | 
| 8 | 
            +
              # - Ruby DSL files (.rb) - executed and expected to return a SwarmSDK::Swarm or SwarmSDK::NodeOrchestrator instance
         | 
| 9 9 | 
             
              #
         | 
| 10 10 | 
             
              # @example Load YAML config
         | 
| 11 11 | 
             
              #   swarm = ConfigLoader.load("config.yml")
         | 
| @@ -19,10 +19,10 @@ module SwarmCLI | |
| 19 19 | 
             
                  #
         | 
| 20 20 | 
             
                  # Detects file type by extension:
         | 
| 21 21 | 
             
                  # - .yml, .yaml -> Load as YAML using SwarmSDK::Swarm.load
         | 
| 22 | 
            -
                  # - .rb -> Execute as Ruby DSL and expect SwarmSDK::Swarm instance
         | 
| 22 | 
            +
                  # - .rb -> Execute as Ruby DSL and expect SwarmSDK::Swarm or SwarmSDK::NodeOrchestrator instance
         | 
| 23 23 | 
             
                  #
         | 
| 24 24 | 
             
                  # @param path [String, Pathname] Path to configuration file
         | 
| 25 | 
            -
                  # @return [SwarmSDK::Swarm] Configured swarm instance
         | 
| 25 | 
            +
                  # @return [SwarmSDK::Swarm, SwarmSDK::NodeOrchestrator] Configured swarm or orchestrator instance
         | 
| 26 26 | 
             
                  # @raise [SwarmCLI::ConfigurationError] If file not found or invalid format
         | 
| 27 27 | 
             
                  def load(path)
         | 
| 28 28 | 
             
                    path = Pathname.new(path).expand_path
         | 
| @@ -59,12 +59,12 @@ module SwarmCLI | |
| 59 59 | 
             
                  # Load Ruby DSL configuration file
         | 
| 60 60 | 
             
                  #
         | 
| 61 61 | 
             
                  # Executes the Ruby file in a clean binding and expects it to return
         | 
| 62 | 
            -
                  # a SwarmSDK::Swarm instance. The file should | 
| 63 | 
            -
                  # create a Swarm instance directly.
         | 
| 62 | 
            +
                  # a SwarmSDK::Swarm or SwarmSDK::NodeOrchestrator instance. The file should
         | 
| 63 | 
            +
                  # use SwarmSDK.build or create a Swarm/NodeOrchestrator instance directly.
         | 
| 64 64 | 
             
                  #
         | 
| 65 65 | 
             
                  # @param path [Pathname] Path to Ruby DSL file
         | 
| 66 | 
            -
                  # @return [SwarmSDK::Swarm] Configured swarm instance
         | 
| 67 | 
            -
                  # @raise [ConfigurationError] If file doesn't return a  | 
| 66 | 
            +
                  # @return [SwarmSDK::Swarm, SwarmSDK::NodeOrchestrator] Configured swarm or orchestrator instance
         | 
| 67 | 
            +
                  # @raise [ConfigurationError] If file doesn't return a valid instance
         | 
| 68 68 | 
             
                  def load_ruby_dsl(path)
         | 
| 69 69 | 
             
                    # Read the file content
         | 
| 70 70 | 
             
                    content = path.read
         | 
| @@ -73,10 +73,11 @@ module SwarmCLI | |
| 73 73 | 
             
                    # This allows the DSL file to use SwarmSDK.build directly
         | 
| 74 74 | 
             
                    result = eval(content, binding, path.to_s, 1) # rubocop:disable Security/Eval
         | 
| 75 75 |  | 
| 76 | 
            -
                    # Validate result is a Swarm instance
         | 
| 77 | 
            -
                     | 
| 76 | 
            +
                    # Validate result is a Swarm or NodeOrchestrator instance
         | 
| 77 | 
            +
                    # Both have the same execute(prompt) interface
         | 
| 78 | 
            +
                    unless result.is_a?(SwarmSDK::Swarm) || result.is_a?(SwarmSDK::NodeOrchestrator)
         | 
| 78 79 | 
             
                      raise ConfigurationError,
         | 
| 79 | 
            -
                        "Ruby DSL file must return a SwarmSDK::Swarm instance. " \
         | 
| 80 | 
            +
                        "Ruby DSL file must return a SwarmSDK::Swarm or SwarmSDK::NodeOrchestrator instance. " \
         | 
| 80 81 | 
             
                          "Got: #{result.class}. " \
         | 
| 81 82 | 
             
                          "Use: SwarmSDK.build { ... } or Swarm.new(...)"
         | 
| 82 83 | 
             
                    end
         | 
    
        data/lib/swarm_cli/version.rb
    CHANGED
    
    
    
        data/lib/swarm_cli.rb
    CHANGED
    
    | @@ -22,7 +22,9 @@ require_relative "swarm_cli/version" | |
| 22 22 |  | 
| 23 23 | 
             
            require "zeitwerk"
         | 
| 24 24 | 
             
            loader = Zeitwerk::Loader.new
         | 
| 25 | 
            +
            loader.tag = File.basename(__FILE__, ".rb")
         | 
| 25 26 | 
             
            loader.push_dir("#{__dir__}/swarm_cli", namespace: SwarmCLI)
         | 
| 27 | 
            +
            loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
         | 
| 26 28 | 
             
            loader.inflector.inflect(
         | 
| 27 29 | 
             
              "cli" => "CLI",
         | 
| 28 30 | 
             
              "ui" => "UI",
         |