swarm_cli 2.1.13 → 3.0.0.alpha2

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -0
  3. data/exe/swarm3 +11 -0
  4. data/lib/swarm_cli/v3/activity_indicator.rb +168 -0
  5. data/lib/swarm_cli/v3/ansi_colors.rb +70 -0
  6. data/lib/swarm_cli/v3/cli.rb +721 -0
  7. data/lib/swarm_cli/v3/command_completer.rb +112 -0
  8. data/lib/swarm_cli/v3/display.rb +607 -0
  9. data/lib/swarm_cli/v3/dropdown.rb +130 -0
  10. data/lib/swarm_cli/v3/event_renderer.rb +161 -0
  11. data/lib/swarm_cli/v3/file_completer.rb +143 -0
  12. data/lib/swarm_cli/v3/raw_input_reader.rb +304 -0
  13. data/lib/swarm_cli/v3/reboot_tool.rb +123 -0
  14. data/lib/swarm_cli/v3/text_input.rb +235 -0
  15. data/lib/swarm_cli/v3.rb +52 -0
  16. metadata +30 -245
  17. data/exe/swarm +0 -6
  18. data/lib/swarm_cli/cli.rb +0 -201
  19. data/lib/swarm_cli/command_registry.rb +0 -61
  20. data/lib/swarm_cli/commands/mcp_serve.rb +0 -130
  21. data/lib/swarm_cli/commands/mcp_tools.rb +0 -148
  22. data/lib/swarm_cli/commands/migrate.rb +0 -55
  23. data/lib/swarm_cli/commands/run.rb +0 -173
  24. data/lib/swarm_cli/config_loader.rb +0 -98
  25. data/lib/swarm_cli/formatters/human_formatter.rb +0 -811
  26. data/lib/swarm_cli/formatters/json_formatter.rb +0 -62
  27. data/lib/swarm_cli/interactive_repl.rb +0 -895
  28. data/lib/swarm_cli/mcp_serve_options.rb +0 -44
  29. data/lib/swarm_cli/mcp_tools_options.rb +0 -59
  30. data/lib/swarm_cli/migrate_options.rb +0 -54
  31. data/lib/swarm_cli/migrator.rb +0 -132
  32. data/lib/swarm_cli/options.rb +0 -151
  33. data/lib/swarm_cli/ui/components/agent_badge.rb +0 -33
  34. data/lib/swarm_cli/ui/components/content_block.rb +0 -120
  35. data/lib/swarm_cli/ui/components/divider.rb +0 -57
  36. data/lib/swarm_cli/ui/components/panel.rb +0 -62
  37. data/lib/swarm_cli/ui/components/usage_stats.rb +0 -70
  38. data/lib/swarm_cli/ui/formatters/cost.rb +0 -49
  39. data/lib/swarm_cli/ui/formatters/number.rb +0 -58
  40. data/lib/swarm_cli/ui/formatters/text.rb +0 -77
  41. data/lib/swarm_cli/ui/formatters/time.rb +0 -73
  42. data/lib/swarm_cli/ui/icons.rb +0 -36
  43. data/lib/swarm_cli/ui/renderers/event_renderer.rb +0 -188
  44. data/lib/swarm_cli/ui/state/agent_color_cache.rb +0 -45
  45. data/lib/swarm_cli/ui/state/depth_tracker.rb +0 -40
  46. data/lib/swarm_cli/ui/state/spinner_manager.rb +0 -170
  47. data/lib/swarm_cli/ui/state/usage_tracker.rb +0 -62
  48. data/lib/swarm_cli/version.rb +0 -5
  49. data/lib/swarm_cli.rb +0 -46
@@ -1,62 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SwarmCLI
4
- module Formatters
5
- # JsonFormatter streams JSON log entries in real-time for consumption by scripts.
6
- # Each log entry is output as a single line of JSON (newline-delimited JSON).
7
- #
8
- # No colors, no spinners, no animations - just pure structured data.
9
- class JsonFormatter
10
- def initialize(output: $stdout)
11
- @output = output
12
- end
13
-
14
- # Called when swarm execution starts
15
- #
16
- # Note: SwarmSDK now automatically emits swarm_start as a log event,
17
- # so we don't emit it here to avoid duplicates. The swarm_start event
18
- # will flow through on_log() from the SwarmSDK event stream.
19
- def on_start(config_path:, swarm_name:, lead_agent:, prompt:)
20
- # SwarmSDK emits swarm_start automatically - no need to emit here
21
- end
22
-
23
- # Called for each log entry from SwarmSDK
24
- def on_log(entry)
25
- emit(entry)
26
- end
27
-
28
- # Called when swarm execution completes successfully
29
- #
30
- # No action needed - SwarmSDK's swarm_stop event already contains all necessary
31
- # information (content, last_agent, duration, metrics, etc.)
32
- def on_success(result:)
33
- # SwarmSDK emits swarm_stop automatically with complete information
34
- end
35
-
36
- # Called when swarm execution fails
37
- #
38
- # Emits error information as JSON. If error occurs during execution,
39
- # SwarmSDK's swarm_stop event will also contain error details.
40
- # This handles errors that occur before or outside swarm execution.
41
- def on_error(error:, duration: nil)
42
- error_data = {
43
- type: "error",
44
- error_class: error.class.name,
45
- error_message: error.message,
46
- timestamp: Time.now.utc.iso8601(6),
47
- }
48
- error_data[:duration] = duration if duration
49
- error_data[:backtrace] = error.backtrace if error.respond_to?(:backtrace) && error.backtrace
50
-
51
- emit(error_data)
52
- end
53
-
54
- private
55
-
56
- def emit(data)
57
- @output.puts(data.to_json)
58
- @output.flush
59
- end
60
- end
61
- end
62
- end