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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f176c27c179091bd20b6eaceb011a6d209d3536600a1dd36d18c248c45ecd7d9
4
- data.tar.gz: f0be0c78e6cecad9839a919e61fce84fc1c3f8e2fdbe46b9381874eedb0c4c4b
3
+ metadata.gz: 47b4b2c7c8f1268a7f3645d8e0ac9501dcca2405491401b7584c3faddd20b8cb
4
+ data.tar.gz: 3c2b3cda6305e3abdd2f479067f979c4e60c2be89045e1653990fb688cb13d4f
5
5
  SHA512:
6
- metadata.gz: a84c43cdafd74397a9dacc74d6afd1604507aa29ee5d3af5d5184f360e8bf133c0ede0efa6c8a1025ca951fe7b5d626032095a5465029523dddbbbc1ec4f279a
7
- data.tar.gz: e22ff406bd363386a16a239d520e3c934cd56982d4d652ada7bf1fe3635ed8d711477288f1f81e0c18b270dcf3ce0643946978fb7b7fe84df50e354525f3e6d1
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 with persistence for MCP server
18
- scratchpad_path = File.join(Dir.pwd, ".swarm", "scratchpad.json")
19
- @scratchpad = SwarmSDK::Scratchpad.new(persist_to: scratchpad_path)
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 use SwarmSDK.build or
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 Swarm instance
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
- unless result.is_a?(SwarmSDK::Swarm)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SwarmCLI
4
- VERSION = "2.1.0"
4
+ VERSION = "2.1.1"
5
5
  end
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",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swarm_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Arruda