enhance_swarm 1.0.0 → 2.1.0

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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/CLAUDE.md +164 -0
  3. data/.claude/MCP.md +117 -0
  4. data/.claude/PERSONAS.md +114 -0
  5. data/.claude/RULES.md +221 -0
  6. data/.enhance_swarm/archives/session_1751182876_06ee7e0e_20250629_094116.json +16 -0
  7. data/.enhance_swarm/archives/session_1751187567_9d1227c8_20250629_105927.json +16 -0
  8. data/.enhance_swarm/archives/session_1751190454_6faf48a2_20250629_114734.json +16 -0
  9. data/.enhance_swarm/archives/session_1751190516_3e4f9437_20250629_114836.json +16 -0
  10. data/.enhance_swarm/archives/session_1751192354_79568f0f_20250629_121914.json +16 -0
  11. data/.enhance_swarm/archives/session_1751195070_99653548_20250629_130433.json +16 -0
  12. data/.enhance_swarm/archives/session_1751196542_a292e40c_20250629_132902.json +7 -0
  13. data/.enhance_swarm/archives/session_1751196824_9b65d28e_20250629_133344.json +24 -0
  14. data/.enhance_swarm/archives/session_1751197867_d16edbc5_20250629_135109.json +24 -0
  15. data/.enhance_swarm/archives/session_1751208541_f9531ce5_20250629_164901.json +16 -0
  16. data/.enhance_swarm/logs/backend_error.log +0 -0
  17. data/.enhance_swarm/logs/backend_output.log +0 -0
  18. data/.enhance_swarm/logs/debug_manual_error.log +0 -0
  19. data/.enhance_swarm/logs/debug_manual_output.log +18 -0
  20. data/.enhance_swarm/logs/frontend_error.log +0 -0
  21. data/.enhance_swarm/logs/frontend_output.log +45 -0
  22. data/.enhance_swarm/logs/general_error.log +0 -0
  23. data/.enhance_swarm/logs/general_output.log +0 -0
  24. data/.enhance_swarm/user_patterns.json +5 -5
  25. data/.enhance_swarm.yml +33 -0
  26. data/CHANGELOG.md +71 -0
  27. data/DEPLOYMENT.md +344 -0
  28. data/README.md +277 -789
  29. data/lib/enhance_swarm/agent_spawner.rb +210 -13
  30. data/lib/enhance_swarm/cli.rb +169 -8
  31. data/lib/enhance_swarm/control_agent.rb +28 -27
  32. data/lib/enhance_swarm/smart_orchestration.rb +60 -0
  33. data/lib/enhance_swarm/task_coordinator.rb +1327 -0
  34. data/lib/enhance_swarm/version.rb +1 -1
  35. data/lib/enhance_swarm/visual_dashboard.rb +2 -1
  36. metadata +34 -20
  37. data/PRODUCTION_TEST_LOG.md +0 -502
  38. data/setup.sh +0 -86
  39. data/test_builtin_functionality.rb +0 -121
  40. data/test_core_components.rb +0 -156
  41. data/test_real_claude_integration.rb +0 -285
  42. data/test_security.rb +0 -150
  43. data/test_smart_defaults.rb +0 -155
  44. data/test_task_integration.rb +0 -173
  45. data/test_web_ui.rb +0 -245
  46. data/web/assets/css/main.css +0 -645
  47. data/web/assets/js/kanban.js +0 -499
  48. data/web/assets/js/main.js +0 -525
  49. data/web/templates/dashboard.html.erb +0 -226
  50. data/web/templates/kanban.html.erb +0 -193
data/setup.sh DELETED
@@ -1,86 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- # EnhanceSwarm Auto-Setup Script
5
- # This script can be run directly from GitHub to set up EnhanceSwarm in any project
6
-
7
- echo "šŸš€ EnhanceSwarm Auto-Setup"
8
- echo "========================="
9
-
10
- # Colors
11
- GREEN='\033[0;32m'
12
- YELLOW='\033[1;33m'
13
- RED='\033[0;31m'
14
- NC='\033[0m' # No Color
15
-
16
- # Check dependencies
17
- echo -e "\n${YELLOW}Checking dependencies...${NC}"
18
-
19
- check_dependency() {
20
- if command -v $1 &> /dev/null; then
21
- echo -e " āœ… $1 found"
22
- return 0
23
- else
24
- echo -e " āŒ $1 not found"
25
- return 1
26
- fi
27
- }
28
-
29
- MISSING_DEPS=0
30
- check_dependency "ruby" || MISSING_DEPS=1
31
- check_dependency "git" || MISSING_DEPS=1
32
- check_dependency "bundle" || MISSING_DEPS=1
33
-
34
- if [ $MISSING_DEPS -eq 1 ]; then
35
- echo -e "\n${RED}Missing required dependencies. Please install them first.${NC}"
36
- exit 1
37
- fi
38
-
39
- # Clone or update enhance_swarm
40
- ENHANCE_DIR="$HOME/.enhance_swarm"
41
-
42
- if [ -d "$ENHANCE_DIR" ]; then
43
- echo -e "\n${YELLOW}Updating EnhanceSwarm...${NC}"
44
- cd "$ENHANCE_DIR"
45
- git pull origin main
46
- else
47
- echo -e "\n${YELLOW}Installing EnhanceSwarm...${NC}"
48
- git clone https://github.com/todddickerson/enhance_swarm.git "$ENHANCE_DIR"
49
- cd "$ENHANCE_DIR"
50
- fi
51
-
52
- # Install gem dependencies
53
- echo -e "\n${YELLOW}Installing dependencies...${NC}"
54
- bundle install
55
-
56
- # Build and install the gem
57
- echo -e "\n${YELLOW}Building and installing gem...${NC}"
58
- rake build
59
- gem install pkg/enhance_swarm-*.gem
60
-
61
- # Check optional dependencies
62
- echo -e "\n${YELLOW}Checking optional dependencies...${NC}"
63
- check_dependency "claude" || echo " āš ļø Install Claude CLI for enhanced agent spawning"
64
- check_dependency "gemini" || echo " āš ļø Install Gemini CLI for large context analysis"
65
-
66
- # Initialize in current project if we're in a project directory
67
- if [ -f "Gemfile" ] || [ -f "package.json" ] || [ -f ".git/config" ]; then
68
- echo -e "\n${YELLOW}Detected project directory. Initialize EnhanceSwarm here?${NC}"
69
- read -p "Initialize EnhanceSwarm in current directory? (y/n) " -n 1 -r
70
- echo
71
- if [[ $REPLY =~ ^[Yy]$ ]]; then
72
- enhance-swarm init
73
- fi
74
- else
75
- echo -e "\n${GREEN}āœ… EnhanceSwarm installed successfully!${NC}"
76
- echo -e "\nTo initialize in a project, run:"
77
- echo -e " ${YELLOW}cd your-project${NC}"
78
- echo -e " ${YELLOW}enhance-swarm init${NC}"
79
- fi
80
-
81
- echo -e "\n${GREEN}šŸŽ‰ Setup complete!${NC}"
82
- echo -e "\nAvailable commands:"
83
- echo " enhance-swarm init - Initialize in a project"
84
- echo " enhance-swarm enhance - Run ENHANCE protocol"
85
- echo " enhance-swarm doctor - Check system setup"
86
- echo " enhance-swarm --help - See all commands"
@@ -1,121 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # Test script for built-in enhance-swarm functionality
5
- # This verifies that our self-contained agent management works correctly
6
-
7
- require_relative 'lib/enhance_swarm'
8
- require_relative 'lib/enhance_swarm/session_manager'
9
- require_relative 'lib/enhance_swarm/agent_spawner'
10
- require_relative 'lib/enhance_swarm/process_monitor'
11
- require_relative 'lib/enhance_swarm/dependency_validator'
12
-
13
- puts "🧪 Testing EnhanceSwarm Built-in Functionality"
14
- puts "=" * 50
15
-
16
- # Test 1: Dependency Validation
17
- puts "\n1ļøāƒ£ Testing Dependency Validation..."
18
- validation_result = EnhanceSwarm::DependencyValidator.validate_all
19
- puts " Required dependencies: #{validation_result[:passed] ? 'āœ… PASS' : 'āŒ FAIL'}"
20
- puts " #{validation_result[:summary]}"
21
- puts " #{validation_result[:optional_summary]}"
22
-
23
- # Test 2: Session Manager
24
- puts "\n2ļøāƒ£ Testing Session Manager..."
25
- begin
26
- session_manager = EnhanceSwarm::SessionManager.new
27
-
28
- # Test session status (should work even without session)
29
- status = session_manager.session_status
30
- puts " Session status check: āœ… PASS"
31
-
32
- # Test creating a session
33
- session = session_manager.create_session("Test task")
34
- puts " Session creation: āœ… PASS"
35
-
36
- # Test adding an agent
37
- result = session_manager.add_agent('test', 12345, '/tmp/test', 'Test task')
38
- puts " Agent registration: #{result ? 'āœ… PASS' : 'āŒ FAIL'}"
39
-
40
- # Test cleanup
41
- session_manager.cleanup_session
42
- puts " Session cleanup: āœ… PASS"
43
-
44
- rescue StandardError => e
45
- puts " Session Manager: āŒ FAIL - #{e.message}"
46
- end
47
-
48
- # Test 3: Agent Spawner
49
- puts "\n3ļøāƒ£ Testing Agent Spawner..."
50
- begin
51
- spawner = EnhanceSwarm::AgentSpawner.new
52
- puts " Agent spawner initialization: āœ… PASS"
53
-
54
- # Note: We won't actually spawn agents in test mode
55
- puts " Agent spawning: āœ… PASS (test mode - no actual spawning)"
56
-
57
- rescue StandardError => e
58
- puts " Agent Spawner: āŒ FAIL - #{e.message}"
59
- end
60
-
61
- # Test 4: Process Monitor
62
- puts "\n4ļøāƒ£ Testing Process Monitor..."
63
- begin
64
- monitor = EnhanceSwarm::ProcessMonitor.new
65
- status = monitor.status
66
- puts " Process monitoring: āœ… PASS"
67
- puts " Session exists: #{status[:session_exists]}"
68
- puts " Active agents: #{status[:active_agents]}"
69
-
70
- rescue StandardError => e
71
- puts " Process Monitor: āŒ FAIL - #{e.message}"
72
- end
73
-
74
- # Test 5: Orchestrator
75
- puts "\n5ļøāƒ£ Testing Orchestrator..."
76
- begin
77
- # Initialize configuration first
78
- EnhanceSwarm.configure do |config|
79
- config.project_name = 'test_project'
80
- config.technology_stack = ['Ruby', 'Test']
81
- config.test_command = 'echo test'
82
- end
83
-
84
- orchestrator = EnhanceSwarm::Orchestrator.new
85
- puts " Orchestrator initialization: āœ… PASS"
86
-
87
- rescue StandardError => e
88
- puts " Orchestrator: āŒ FAIL - #{e.message}"
89
- end
90
-
91
- # Test 6: Integration Test
92
- puts "\n6ļøāƒ£ Testing Integration..."
93
- begin
94
- # Test that all components can work together
95
- session_manager = EnhanceSwarm::SessionManager.new
96
- spawner = EnhanceSwarm::AgentSpawner.new
97
- monitor = EnhanceSwarm::ProcessMonitor.new
98
-
99
- # Create a session
100
- session = session_manager.create_session("Integration test")
101
-
102
- # Check status
103
- status = monitor.status
104
-
105
- # Cleanup
106
- session_manager.cleanup_session
107
-
108
- puts " Integration test: āœ… PASS"
109
-
110
- rescue StandardError => e
111
- puts " Integration: āŒ FAIL - #{e.message}"
112
- end
113
-
114
- puts "\nšŸŽ‰ Built-in functionality test completed!"
115
- puts "\nKey improvements:"
116
- puts " āœ… No external claude-swarm dependency required"
117
- puts " āœ… Self-contained agent management"
118
- puts " āœ… Built-in process monitoring"
119
- puts " āœ… Session-based coordination"
120
- puts " āœ… Git worktree integration"
121
- puts "\nEnhanceSwarm is now fully self-contained! šŸš€"
@@ -1,156 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Simple test runner for core components
3
-
4
- $LOAD_PATH.unshift File.expand_path('lib', __dir__)
5
- require 'enhance_swarm'
6
-
7
- def test_core_functionality
8
- puts "🧪 Testing Core Components"
9
- puts "=" * 50
10
-
11
- results = []
12
-
13
- # Test 1: Configuration initialization
14
- puts "\n1ļøāƒ£ Testing Configuration..."
15
- begin
16
- config = EnhanceSwarm::Configuration.new
17
- if config.respond_to?(:project_name) && config.respond_to?(:max_concurrent_agents)
18
- puts " āœ… Configuration initialized successfully"
19
- results << { test: "Configuration", status: "āœ… PASS" }
20
- else
21
- puts " āŒ Configuration missing required attributes"
22
- results << { test: "Configuration", status: "āŒ FAIL" }
23
- end
24
- rescue => e
25
- puts " āŒ Configuration failed: #{e.message}"
26
- results << { test: "Configuration", status: "āŒ ERROR" }
27
- end
28
-
29
- # Test 2: ResourceManager functionality
30
- puts "\n2ļøāƒ£ Testing ResourceManager..."
31
- begin
32
- resource_manager = EnhanceSwarm::ResourceManager.new
33
- result = resource_manager.can_spawn_agent?
34
-
35
- if result.is_a?(Hash) && result.key?(:allowed) && result.key?(:reasons)
36
- puts " āœ… ResourceManager can_spawn_agent? working"
37
-
38
- stats = resource_manager.get_resource_stats
39
- if stats.is_a?(Hash) && stats.key?(:active_agents)
40
- puts " āœ… ResourceManager get_resource_stats working"
41
- results << { test: "ResourceManager", status: "āœ… PASS" }
42
- else
43
- puts " āŒ ResourceManager stats malformed"
44
- results << { test: "ResourceManager", status: "āŒ FAIL" }
45
- end
46
- else
47
- puts " āŒ ResourceManager can_spawn_agent? malformed response"
48
- results << { test: "ResourceManager", status: "āŒ FAIL" }
49
- end
50
- rescue => e
51
- puts " āŒ ResourceManager failed: #{e.message}"
52
- results << { test: "ResourceManager", status: "āŒ ERROR" }
53
- end
54
-
55
- # Test 3: SessionManager functionality
56
- puts "\n3ļøāƒ£ Testing SessionManager..."
57
- begin
58
- session_manager = EnhanceSwarm::SessionManager.new
59
-
60
- # Test session creation
61
- session = session_manager.create_session("Test session")
62
- if session.is_a?(Hash) && session[:session_id]
63
- puts " āœ… SessionManager create_session working"
64
-
65
- # Test agent addition
66
- result = session_manager.add_agent('backend', 12345, '/tmp/test', 'Test task')
67
- if result == true
68
- puts " āœ… SessionManager add_agent working"
69
-
70
- # Test agent retrieval
71
- agents = session_manager.get_all_agents
72
- if agents.is_a?(Array) && agents.length == 1
73
- puts " āœ… SessionManager get_all_agents working"
74
- results << { test: "SessionManager", status: "āœ… PASS" }
75
- else
76
- puts " āŒ SessionManager get_all_agents failed"
77
- results << { test: "SessionManager", status: "āŒ FAIL" }
78
- end
79
- else
80
- puts " āŒ SessionManager add_agent failed"
81
- results << { test: "SessionManager", status: "āŒ FAIL" }
82
- end
83
- else
84
- puts " āŒ SessionManager create_session failed"
85
- results << { test: "SessionManager", status: "āŒ FAIL" }
86
- end
87
-
88
- # Cleanup
89
- session_manager.cleanup_session if session_manager.session_exists?
90
- rescue => e
91
- puts " āŒ SessionManager failed: #{e.message}"
92
- results << { test: "SessionManager", status: "āŒ ERROR" }
93
- end
94
-
95
- # Test 4: AgentSpawner input sanitization
96
- puts "\n4ļøāƒ£ Testing AgentSpawner Security..."
97
- begin
98
- spawner = EnhanceSwarm::AgentSpawner.new
99
-
100
- # Test task sanitization
101
- dangerous_task = 'test`rm -rf /`; echo $PATH'
102
- safe_task = spawner.send(:sanitize_task_description, dangerous_task)
103
-
104
- if !safe_task.include?('`') && !safe_task.include?(';') && !safe_task.include?('$')
105
- puts " āœ… Task sanitization working"
106
-
107
- # Test role sanitization
108
- safe_role = spawner.send(:sanitize_role, 'unknown_role')
109
- if safe_role == 'general'
110
- puts " āœ… Role sanitization working"
111
- results << { test: "AgentSpawner Security", status: "āœ… PASS" }
112
- else
113
- puts " āŒ Role sanitization failed"
114
- results << { test: "AgentSpawner Security", status: "āŒ FAIL" }
115
- end
116
- else
117
- puts " āŒ Task sanitization failed"
118
- results << { test: "AgentSpawner Security", status: "āŒ FAIL" }
119
- end
120
- rescue => e
121
- puts " āŒ AgentSpawner Security failed: #{e.message}"
122
- results << { test: "AgentSpawner Security", status: "āŒ ERROR" }
123
- end
124
-
125
- # Results summary
126
- puts "\n" + "=" * 50
127
- puts "🧪 CORE COMPONENT TEST RESULTS"
128
- puts "=" * 50
129
-
130
- passed = results.count { |r| r[:status].include?("āœ…") }
131
- total = results.length
132
-
133
- results.each do |result|
134
- puts " #{result[:status]} #{result[:test]}"
135
- end
136
-
137
- puts "\nšŸ“Š Test Success Rate: #{passed}/#{total} (#{total > 0 ? (passed.to_f / total * 100).round(1) : 0}%)"
138
-
139
- if passed == total && total > 0
140
- puts "\nšŸŽ‰ ALL CORE COMPONENT TESTS PASSED!"
141
- puts " āœ… Configuration system working"
142
- puts " āœ… Resource management working"
143
- puts " āœ… Session management working"
144
- puts " āœ… Security features working"
145
- else
146
- puts "\nāš ļø SOME TESTS FAILED!"
147
- puts " Review failed tests and address issues"
148
- end
149
-
150
- passed == total && total > 0
151
- end
152
-
153
- if __FILE__ == $0
154
- success = test_core_functionality
155
- exit(success ? 0 : 1)
156
- end
@@ -1,285 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # Test real Claude CLI integration
5
-
6
- $LOAD_PATH.unshift File.expand_path('lib', __dir__)
7
- require 'enhance_swarm'
8
-
9
- def test_claude_cli_integration
10
- puts "šŸ¤– Testing Real Claude CLI Integration"
11
- puts "=" * 60
12
-
13
- test_results = []
14
-
15
- # Test 1: Claude CLI Availability
16
- begin
17
- puts "\n1ļøāƒ£ Testing Claude CLI Availability..."
18
-
19
- spawner = EnhanceSwarm::AgentSpawner.new
20
- available = spawner.claude_cli_available?
21
-
22
- puts " šŸ“Š Claude CLI Available: #{available}"
23
-
24
- if available
25
- # Test version
26
- version = `claude --version 2>/dev/null`.strip
27
- puts " šŸ“Š Claude Version: #{version}"
28
-
29
- # Test basic functionality
30
- test_response = `echo "Say hello in one word" | claude --print 2>/dev/null`.strip
31
- puts " šŸ“Š Basic Test Response: #{test_response.length > 0 ? 'Success' : 'Failed'}"
32
-
33
- test_results << { test: "Claude CLI Availability", status: "āœ… PASS" }
34
- else
35
- puts " āŒ Claude CLI not available"
36
- test_results << { test: "Claude CLI Availability", status: "āŒ FAIL" }
37
- end
38
- rescue => e
39
- puts " āŒ Error testing Claude CLI: #{e.message}"
40
- test_results << { test: "Claude CLI Availability", status: "āŒ FAIL", error: e.message }
41
- end
42
-
43
- # Test 2: Agent Prompt Building
44
- begin
45
- puts "\n2ļøāƒ£ Testing Agent Prompt Building..."
46
-
47
- spawner = EnhanceSwarm::AgentSpawner.new
48
- config = EnhanceSwarm::Configuration.new
49
-
50
- # Test enhanced prompt building
51
- base_task = "Create a simple Ruby class for a blog post"
52
- role = "backend"
53
- worktree_path = "/tmp/test_worktree"
54
-
55
- enhanced_prompt = spawner.send(:build_enhanced_agent_prompt, base_task, role, worktree_path)
56
-
57
- puts " šŸ“Š Enhanced Prompt Length: #{enhanced_prompt.length} characters"
58
- puts " šŸ“Š Contains Role Info: #{enhanced_prompt.include?('BACKEND')}"
59
- puts " šŸ“Š Contains Task: #{enhanced_prompt.include?(base_task)}"
60
- puts " šŸ“Š Contains Project Info: #{enhanced_prompt.include?(config.project_name)}"
61
-
62
- if enhanced_prompt.length > 500 && enhanced_prompt.include?(base_task)
63
- test_results << { test: "Agent Prompt Building", status: "āœ… PASS" }
64
- else
65
- test_results << { test: "Agent Prompt Building", status: "āŒ FAIL" }
66
- end
67
- rescue => e
68
- puts " āŒ Error testing prompt building: #{e.message}"
69
- test_results << { test: "Agent Prompt Building", status: "āŒ FAIL", error: e.message }
70
- end
71
-
72
- # Test 3: Agent Script Creation
73
- begin
74
- puts "\n3ļøāƒ£ Testing Agent Script Creation..."
75
-
76
- spawner = EnhanceSwarm::AgentSpawner.new
77
- prompt = "Test prompt for agent script creation"
78
- role = "frontend"
79
- working_dir = Dir.pwd
80
-
81
- # Create script and test immediately since Tempfile auto-deletes
82
- script_tempfile = nil
83
- script_content = ""
84
- script_exists = false
85
- script_executable = false
86
-
87
- begin
88
- # Call the method and capture the tempfile path
89
- script_path = spawner.send(:create_agent_script, prompt, role, working_dir)
90
-
91
- if script_path && File.exist?(script_path)
92
- script_exists = true
93
- script_executable = File.executable?(script_path)
94
- script_content = File.read(script_path)
95
-
96
- puts " šŸ“Š Script Created: #{script_exists}"
97
- puts " šŸ“Š Script Executable: #{script_executable}"
98
- puts " šŸ“Š Script Length: #{script_content.length} characters"
99
- puts " šŸ“Š Contains Role: #{script_content.include?(role)}"
100
- puts " šŸ“Š Contains Claude Command: #{script_content.include?('claude')}"
101
-
102
- test_results << { test: "Agent Script Creation", status: "āœ… PASS" }
103
- else
104
- puts " šŸ“Š Script Created: false"
105
- test_results << { test: "Agent Script Creation", status: "āŒ FAIL" }
106
- end
107
- rescue => script_error
108
- puts " šŸ“Š Script Creation Error: #{script_error.message}"
109
- test_results << { test: "Agent Script Creation", status: "āŒ FAIL" }
110
- end
111
- rescue => e
112
- puts " āŒ Error testing script creation: #{e.message}"
113
- test_results << { test: "Agent Script Creation", status: "āŒ FAIL", error: e.message }
114
- end
115
-
116
- # Test 4: Real Agent Spawning (if Claude CLI available)
117
- if spawner.claude_cli_available?
118
- begin
119
- puts "\n4ļøāƒ£ Testing Real Agent Spawning..."
120
-
121
- # Create a simple test task
122
- test_task = "Create a simple 'Hello World' Ruby file and output it"
123
- role = "backend"
124
-
125
- # Spawn a real agent
126
- pid = spawner.spawn_agent(role: role, task: test_task, worktree: false)
127
-
128
- if pid
129
- puts " šŸ“Š Agent Spawned: PID #{pid}"
130
- puts " šŸ“Š Process Running: #{Process.getpgid(pid) ? true : false}"
131
-
132
- # Give the agent a moment to start
133
- sleep(2)
134
-
135
- # Check if logs are being created
136
- log_file = File.join('.enhance_swarm', 'logs', "#{role}_output.log")
137
- puts " šŸ“Š Log File Created: #{File.exist?(log_file)}"
138
-
139
- if File.exist?(log_file)
140
- # Wait a bit more and check log content
141
- sleep(5)
142
- log_content = File.read(log_file) rescue ""
143
- puts " šŸ“Š Log Content Length: #{log_content.length} characters"
144
- puts " šŸ“Š Agent Active: #{log_content.length > 0}"
145
- end
146
-
147
- # Try to stop the agent gracefully
148
- begin
149
- Process.kill('TERM', pid)
150
- puts " šŸ“Š Agent Termination: Sent"
151
- rescue => e
152
- puts " šŸ“Š Agent Termination: #{e.message}"
153
- end
154
-
155
- test_results << { test: "Real Agent Spawning", status: "āœ… PASS" }
156
- else
157
- puts " āŒ Failed to spawn agent"
158
- test_results << { test: "Real Agent Spawning", status: "āŒ FAIL" }
159
- end
160
- rescue => e
161
- puts " āŒ Error testing real spawning: #{e.message}"
162
- test_results << { test: "Real Agent Spawning", status: "āŒ FAIL", error: e.message }
163
- end
164
- else
165
- puts "\n4ļøāƒ£ Skipping Real Agent Spawning (Claude CLI not available)"
166
- test_results << { test: "Real Agent Spawning", status: "ā­ļø SKIP" }
167
- end
168
-
169
- # Test 5: Session Integration
170
- begin
171
- puts "\n5ļøāƒ£ Testing Session Integration..."
172
-
173
- session_manager = EnhanceSwarm::SessionManager.new
174
- orchestrator = EnhanceSwarm::Orchestrator.new
175
-
176
- # Create a session
177
- session = session_manager.create_session("Claude CLI integration test")
178
- puts " šŸ“Š Session Created: #{session[:session_id]}"
179
-
180
- # Test spawning through orchestrator
181
- spawn_result = orchestrator.spawn_single(
182
- task: "Simple test task for integration",
183
- role: "general",
184
- worktree: false
185
- )
186
-
187
- if spawn_result
188
- puts " šŸ“Š Orchestrator Spawn: Success (PID: #{spawn_result})"
189
-
190
- # Check session status
191
- status = session_manager.session_status
192
- puts " šŸ“Š Session Agents: #{status[:total_agents]}"
193
-
194
- # Cleanup
195
- session_manager.cleanup_session
196
-
197
- test_results << { test: "Session Integration", status: "āœ… PASS" }
198
- else
199
- puts " āŒ Orchestrator spawn failed"
200
- test_results << { test: "Session Integration", status: "āŒ FAIL" }
201
- end
202
- rescue => e
203
- puts " āŒ Error testing session integration: #{e.message}"
204
- test_results << { test: "Session Integration", status: "āŒ FAIL", error: e.message }
205
- end
206
-
207
- # Results Summary
208
- puts "\n" + "=" * 60
209
- puts "šŸ“Š CLAUDE CLI INTEGRATION TEST RESULTS"
210
- puts "=" * 60
211
-
212
- passed = test_results.count { |r| r[:status].include?("āœ…") }
213
- total = test_results.count { |r| !r[:status].include?("ā­ļø") }
214
-
215
- test_results.each do |result|
216
- puts " #{result[:status]} #{result[:test]}"
217
- if result[:error]
218
- puts " Error: #{result[:error]}"
219
- end
220
- end
221
-
222
- puts "\nšŸ“ˆ Success Rate: #{passed}/#{total} (#{total > 0 ? (passed.to_f / total * 100).round(1) : 0}%)"
223
-
224
- if passed == total && total > 0
225
- puts "\nšŸŽ‰ CLAUDE CLI INTEGRATION COMPLETE!"
226
- puts " āœ… Real Claude agents can be spawned and managed"
227
- puts " āœ… Enhanced prompts with role specialization working"
228
- puts " āœ… Agent scripts generated correctly"
229
- puts " āœ… Session management integrated"
230
- puts " āœ… Ready for production multi-agent workflows"
231
- else
232
- puts "\nāš ļø Some integration tests failed"
233
- puts " šŸ”§ Address issues above for full Claude CLI integration"
234
- end
235
-
236
- passed == total && total > 0
237
- end
238
-
239
- def demonstrate_production_usage
240
- puts "\nšŸš€ Production Claude CLI Usage Examples"
241
- puts "=" * 60
242
-
243
- puts "\nšŸ’» Enhanced Agent Spawning:"
244
- puts " enhance-swarm enhance # Start full orchestration"
245
- puts " enhance-swarm spawn 'Create API model' # Spawn single agent"
246
- puts " enhance-swarm status # Check agent status"
247
- puts " enhance-swarm ui # Web interface"
248
-
249
- puts "\nšŸ¤– Agent Role Specializations:"
250
- puts " Backend Agent: Models, APIs, database logic, business rules"
251
- puts " Frontend Agent: UI components, styling, client-side logic"
252
- puts " QA Agent: Tests, validation, edge cases, quality checks"
253
- puts " UX Agent: User flows, accessibility, design improvements"
254
-
255
- puts "\n⚔ Claude CLI Integration Features:"
256
- puts " • Real Claude agents with specialized prompts"
257
- puts " • Automatic role-based task assignment"
258
- puts " • Project-aware context and standards"
259
- puts " • Independent agent execution with monitoring"
260
- puts " • Graceful fallback to simulation mode"
261
- puts " • Comprehensive logging and error handling"
262
-
263
- puts "\nšŸ”§ Integration Benefits:"
264
- puts " • Authentic multi-agent development workflows"
265
- puts " • Specialized agents for different development phases"
266
- puts " • Real-time progress monitoring and coordination"
267
- puts " • Production-ready code generation and testing"
268
- puts " • Seamless integration with existing development tools"
269
- end
270
-
271
- # Run the test
272
- if __FILE__ == $0
273
- success = test_claude_cli_integration
274
- demonstrate_production_usage
275
-
276
- puts "\nšŸŽÆ FINAL ASSESSMENT:"
277
- if success
278
- puts " šŸš€ Claude CLI integration is PRODUCTION-READY!"
279
- puts " šŸ† Real multi-agent workflows confirmed working"
280
- puts " šŸ› ļø Enhanced EnhanceSwarm ready for v1.0 release"
281
- else
282
- puts " šŸ”§ Claude CLI integration needs refinement"
283
- puts " šŸ’” Some features may fall back to simulation mode"
284
- end
285
- end