enhance_swarm 1.0.0 → 2.0.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.
- checksums.yaml +4 -4
- data/.enhance_swarm/archives/session_1751182876_06ee7e0e_20250629_094116.json +16 -0
- data/.enhance_swarm/archives/session_1751187567_9d1227c8_20250629_105927.json +16 -0
- data/.enhance_swarm/archives/session_1751190454_6faf48a2_20250629_114734.json +16 -0
- data/.enhance_swarm/archives/session_1751190516_3e4f9437_20250629_114836.json +16 -0
- data/.enhance_swarm/archives/session_1751192354_79568f0f_20250629_121914.json +16 -0
- data/.enhance_swarm/archives/session_1751195070_99653548_20250629_130433.json +16 -0
- data/.enhance_swarm/archives/session_1751196542_a292e40c_20250629_132902.json +7 -0
- data/.enhance_swarm/archives/session_1751196824_9b65d28e_20250629_133344.json +24 -0
- data/.enhance_swarm/archives/session_1751197867_d16edbc5_20250629_135109.json +24 -0
- data/.enhance_swarm/archives/session_1751208541_f9531ce5_20250629_164901.json +16 -0
- data/.enhance_swarm/logs/backend_error.log +0 -0
- data/.enhance_swarm/logs/backend_output.log +0 -0
- data/.enhance_swarm/logs/debug_manual_error.log +0 -0
- data/.enhance_swarm/logs/debug_manual_output.log +18 -0
- data/.enhance_swarm/logs/frontend_error.log +0 -0
- data/.enhance_swarm/logs/frontend_output.log +45 -0
- data/.enhance_swarm/logs/general_error.log +0 -0
- data/.enhance_swarm/logs/general_output.log +404 -0
- data/.enhance_swarm/user_patterns.json +5 -5
- data/DEPLOYMENT.md +344 -0
- data/README.md +183 -820
- data/debug_agent_spawner.rb +99 -0
- data/debug_cli_spawn.rb +95 -0
- data/debug_fixes.rb +209 -0
- data/debug_script_execution.rb +124 -0
- data/debug_session_issue.rb +87 -0
- data/debug_spawn.rb +113 -0
- data/debug_spawn_step_by_step.rb +190 -0
- data/debug_worktree.rb +77 -0
- data/enhance_swarm-0.1.1.gem +0 -0
- data/enhance_swarm-1.0.0.gem +0 -0
- data/final_validation_test.rb +199 -0
- data/lib/enhance_swarm/agent_spawner.rb +5 -1
- data/lib/enhance_swarm/cli.rb +42 -9
- data/lib/enhance_swarm/control_agent.rb +28 -27
- data/lib/enhance_swarm/smart_orchestration.rb +60 -0
- data/lib/enhance_swarm/task_coordinator.rb +1050 -0
- data/lib/enhance_swarm/version.rb +1 -1
- data/lib/enhance_swarm/visual_dashboard.rb +2 -1
- data/test_blog_app/.enhance_swarm/archives/session_1751187575_e119ea73_20250629_105935.json +16 -0
- data/test_blog_app/.enhance_swarm/archives/session_1751187637_7fda97dd_20250629_110037.json +32 -0
- data/test_blog_app/.enhance_swarm/archives/session_1751190527_4c99147e_20250629_114847.json +32 -0
- data/test_blog_app/.enhance_swarm/archives/session_1751190541_8dc83406_20250629_114901.json +16 -0
- data/test_blog_app/.ruby-version +1 -0
- data/test_blog_app/Gemfile +18 -0
- data/test_blog_app/Gemfile.lock +206 -0
- data/test_blog_app/README.md +24 -0
- data/test_blog_app/Rakefile +6 -0
- data/test_blog_app/app/assets/images/.keep +0 -0
- data/test_blog_app/app/assets/stylesheets/application.css +10 -0
- data/test_blog_app/app/controllers/application_controller.rb +4 -0
- data/test_blog_app/app/controllers/concerns/.keep +0 -0
- data/test_blog_app/app/helpers/application_helper.rb +2 -0
- data/test_blog_app/app/models/application_record.rb +3 -0
- data/test_blog_app/app/models/concerns/.keep +0 -0
- data/test_blog_app/app/views/layouts/application.html.erb +27 -0
- data/test_blog_app/app/views/pwa/manifest.json.erb +22 -0
- data/test_blog_app/app/views/pwa/service-worker.js +26 -0
- data/test_blog_app/bin/dev +2 -0
- data/test_blog_app/bin/rails +4 -0
- data/test_blog_app/bin/rake +4 -0
- data/test_blog_app/bin/setup +34 -0
- data/test_blog_app/config/application.rb +42 -0
- data/test_blog_app/config/boot.rb +3 -0
- data/test_blog_app/config/credentials.yml.enc +1 -0
- data/test_blog_app/config/database.yml +32 -0
- data/test_blog_app/config/environment.rb +5 -0
- data/test_blog_app/config/environments/development.rb +51 -0
- data/test_blog_app/config/environments/production.rb +67 -0
- data/test_blog_app/config/environments/test.rb +42 -0
- data/test_blog_app/config/initializers/assets.rb +7 -0
- data/test_blog_app/config/initializers/content_security_policy.rb +25 -0
- data/test_blog_app/config/initializers/filter_parameter_logging.rb +8 -0
- data/test_blog_app/config/initializers/inflections.rb +16 -0
- data/test_blog_app/config/locales/en.yml +31 -0
- data/test_blog_app/config/master.key +1 -0
- data/test_blog_app/config/puma.rb +38 -0
- data/test_blog_app/config/routes.rb +14 -0
- data/test_blog_app/config.ru +6 -0
- data/test_blog_app/db/seeds.rb +9 -0
- data/test_blog_app/lib/tasks/.keep +0 -0
- data/test_blog_app/log/.keep +0 -0
- data/test_blog_app/public/400.html +114 -0
- data/test_blog_app/public/404.html +114 -0
- data/test_blog_app/public/406-unsupported-browser.html +114 -0
- data/test_blog_app/public/422.html +114 -0
- data/test_blog_app/public/500.html +114 -0
- data/test_blog_app/public/icon.png +0 -0
- data/test_blog_app/public/icon.svg +3 -0
- data/test_blog_app/public/robots.txt +1 -0
- data/test_blog_app/script/.keep +0 -0
- data/test_blog_app/storage/.keep +0 -0
- data/test_blog_app/test/controllers/.keep +0 -0
- data/test_blog_app/test/fixtures/files/.keep +0 -0
- data/test_blog_app/test/helpers/.keep +0 -0
- data/test_blog_app/test/integration/.keep +0 -0
- data/test_blog_app/test/models/.keep +0 -0
- data/test_blog_app/test/test_helper.rb +15 -0
- data/test_blog_app/test_enhance_swarm_e2e.rb +244 -0
- data/test_blog_app/test_realistic_workflow.rb +292 -0
- data/test_blog_app/tmp/.keep +0 -0
- data/test_blog_app/tmp/pids/.keep +0 -0
- data/test_blog_app/tmp/storage/.keep +0 -0
- data/test_blog_app/vendor/.keep +0 -0
- data/test_complete_system.rb +267 -0
- metadata +99 -1
data/debug_spawn.rb
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Debug script to test agent spawning
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
|
5
|
+
require 'enhance_swarm'
|
6
|
+
|
7
|
+
def test_agent_spawning
|
8
|
+
puts "🔍 Testing Agent Spawning Debug"
|
9
|
+
puts "=" * 50
|
10
|
+
|
11
|
+
begin
|
12
|
+
spawner = EnhanceSwarm::AgentSpawner.new
|
13
|
+
|
14
|
+
# Test Claude CLI availability
|
15
|
+
puts "\n1️⃣ Testing Claude CLI..."
|
16
|
+
available = spawner.claude_cli_available?
|
17
|
+
puts " 📊 Claude CLI available: #{available}"
|
18
|
+
|
19
|
+
if available
|
20
|
+
version = `claude --version 2>/dev/null`.strip
|
21
|
+
puts " 📊 Claude version: #{version}"
|
22
|
+
end
|
23
|
+
|
24
|
+
# Test session manager
|
25
|
+
puts "\n2️⃣ Testing Session Manager..."
|
26
|
+
session_manager = EnhanceSwarm::SessionManager.new
|
27
|
+
session = session_manager.create_session("Debug test session")
|
28
|
+
puts " 📊 Session created: #{session[:session_id]}"
|
29
|
+
|
30
|
+
# Test enhanced prompt building
|
31
|
+
puts "\n3️⃣ Testing Enhanced Prompt Building..."
|
32
|
+
prompt = spawner.send(:build_enhanced_agent_prompt,
|
33
|
+
"Test task for debugging",
|
34
|
+
"backend",
|
35
|
+
Dir.pwd)
|
36
|
+
puts " 📊 Prompt length: #{prompt.length} characters"
|
37
|
+
puts " 📊 Contains role: #{prompt.include?('BACKEND')}"
|
38
|
+
|
39
|
+
# Test script creation
|
40
|
+
puts "\n4️⃣ Testing Agent Script Creation..."
|
41
|
+
script_path = spawner.send(:create_agent_script,
|
42
|
+
"Test prompt for script creation",
|
43
|
+
"backend",
|
44
|
+
Dir.pwd)
|
45
|
+
puts " 📊 Script created: #{File.exist?(script_path)}"
|
46
|
+
puts " 📊 Script executable: #{File.executable?(script_path)}"
|
47
|
+
|
48
|
+
if File.exist?(script_path)
|
49
|
+
script_content = File.read(script_path)
|
50
|
+
puts " 📊 Script length: #{script_content.length} characters"
|
51
|
+
puts " 📊 Contains claude command: #{script_content.include?('claude')}"
|
52
|
+
end
|
53
|
+
|
54
|
+
# Test the full spawn_agent method
|
55
|
+
puts "\n5️⃣ Testing Full Agent Spawn..."
|
56
|
+
puts " 🚀 Attempting to spawn agent..."
|
57
|
+
|
58
|
+
result = spawner.spawn_agent(
|
59
|
+
role: "backend",
|
60
|
+
task: "Create a simple test file with hello world",
|
61
|
+
worktree: true
|
62
|
+
)
|
63
|
+
|
64
|
+
if result
|
65
|
+
puts " ✅ Agent spawned successfully!"
|
66
|
+
puts " 📊 PID: #{result[:pid]}"
|
67
|
+
puts " 📊 Role: #{result[:role]}"
|
68
|
+
puts " 📊 Worktree: #{result[:worktree_path]}"
|
69
|
+
|
70
|
+
# Check if the process is actually running
|
71
|
+
begin
|
72
|
+
if result[:pid]
|
73
|
+
running = Process.getpgid(result[:pid])
|
74
|
+
puts " 📊 Process running: #{running ? 'Yes' : 'No'}"
|
75
|
+
end
|
76
|
+
rescue Errno::ESRCH
|
77
|
+
puts " 📊 Process running: No (not found)"
|
78
|
+
end
|
79
|
+
|
80
|
+
# Wait a moment and check logs
|
81
|
+
sleep(3)
|
82
|
+
|
83
|
+
# Check log files
|
84
|
+
puts "\n6️⃣ Checking Log Files..."
|
85
|
+
log_dir = '.enhance_swarm/logs'
|
86
|
+
if Dir.exist?(log_dir)
|
87
|
+
log_files = Dir.entries(log_dir).reject { |f| f.start_with?('.') }
|
88
|
+
log_files.each do |log_file|
|
89
|
+
log_path = File.join(log_dir, log_file)
|
90
|
+
content = File.read(log_path) rescue ""
|
91
|
+
puts " 📊 #{log_file}: #{content.length} characters"
|
92
|
+
if content.length > 0
|
93
|
+
puts " Preview: #{content[0..100]}..."
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
else
|
98
|
+
puts " ❌ Agent spawn failed"
|
99
|
+
end
|
100
|
+
|
101
|
+
rescue => e
|
102
|
+
puts " ❌ Error: #{e.class}: #{e.message}"
|
103
|
+
puts " 📊 Backtrace:"
|
104
|
+
e.backtrace.first(5).each { |line| puts " #{line}" }
|
105
|
+
ensure
|
106
|
+
# Cleanup
|
107
|
+
session_manager&.cleanup_session
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
if __FILE__ == $0
|
112
|
+
test_agent_spawning
|
113
|
+
end
|
@@ -0,0 +1,190 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Debug spawn process step by step
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
|
5
|
+
require 'enhance_swarm'
|
6
|
+
|
7
|
+
def debug_spawn_process
|
8
|
+
puts "🔧 Debugging Spawn Process Step by Step"
|
9
|
+
puts "=" * 50
|
10
|
+
|
11
|
+
begin
|
12
|
+
ENV['ENHANCE_SWARM_DEBUG'] = 'true'
|
13
|
+
|
14
|
+
# Step 1: Test AgentSpawner initialization
|
15
|
+
puts "\n1️⃣ Initializing AgentSpawner..."
|
16
|
+
spawner = EnhanceSwarm::AgentSpawner.new
|
17
|
+
puts " ✅ AgentSpawner initialized"
|
18
|
+
|
19
|
+
# Step 2: Test Claude CLI availability
|
20
|
+
puts "\n2️⃣ Testing Claude CLI..."
|
21
|
+
claude_available = spawner.claude_cli_available?
|
22
|
+
puts " 📊 Claude CLI available: #{claude_available}"
|
23
|
+
|
24
|
+
if claude_available
|
25
|
+
claude_version = `claude --version 2>/dev/null`.strip
|
26
|
+
puts " 📊 Claude version: #{claude_version}"
|
27
|
+
end
|
28
|
+
|
29
|
+
# Step 3: Test worktree creation
|
30
|
+
puts "\n3️⃣ Testing Worktree Creation..."
|
31
|
+
role = "frontend"
|
32
|
+
|
33
|
+
# Call the private method using send
|
34
|
+
worktree_path = spawner.send(:create_agent_worktree, role)
|
35
|
+
puts " 📊 Worktree created: #{worktree_path}"
|
36
|
+
|
37
|
+
if worktree_path
|
38
|
+
puts " 📊 Worktree exists: #{Dir.exist?(worktree_path)}"
|
39
|
+
puts " 📊 Worktree files: #{Dir.entries(worktree_path).reject { |f| f.start_with?('.') }}"
|
40
|
+
end
|
41
|
+
|
42
|
+
# Step 4: Test prompt building
|
43
|
+
puts "\n4️⃣ Testing Prompt Building..."
|
44
|
+
task = "Create a simple test component"
|
45
|
+
prompt = spawner.send(:build_agent_prompt, task, role, worktree_path)
|
46
|
+
puts " 📊 Prompt length: #{prompt.length} characters"
|
47
|
+
puts " 📊 First 100 chars: #{prompt[0..100]}..."
|
48
|
+
|
49
|
+
# Step 5: Test script creation
|
50
|
+
puts "\n5️⃣ Testing Script Creation..."
|
51
|
+
script_path = spawner.send(:create_agent_script, prompt, role, worktree_path || Dir.pwd)
|
52
|
+
puts " 📊 Script created: #{script_path}"
|
53
|
+
puts " 📊 Script exists: #{File.exist?(script_path)}"
|
54
|
+
puts " 📊 Script executable: #{File.executable?(script_path)}"
|
55
|
+
|
56
|
+
if File.exist?(script_path)
|
57
|
+
script_content = File.read(script_path)
|
58
|
+
puts " 📊 Script length: #{script_content.length} characters"
|
59
|
+
puts " 📊 First few lines:"
|
60
|
+
script_content.lines.first(5).each_with_index do |line, i|
|
61
|
+
puts " #{i+1}: #{line.strip}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Step 6: Test environment building
|
66
|
+
puts "\n6️⃣ Testing Environment..."
|
67
|
+
env = spawner.send(:build_agent_environment, role, worktree_path)
|
68
|
+
puts " 📊 Environment variables set:"
|
69
|
+
env.select { |k, v| k.start_with?('ENHANCE_SWARM') }.each do |k, v|
|
70
|
+
puts " #{k}=#{v}"
|
71
|
+
end
|
72
|
+
|
73
|
+
# Step 7: Try manual script execution
|
74
|
+
puts "\n7️⃣ Testing Manual Script Execution..."
|
75
|
+
if File.exist?(script_path)
|
76
|
+
puts " 🚀 Attempting to run script manually..."
|
77
|
+
|
78
|
+
# Change to the working directory
|
79
|
+
original_dir = Dir.pwd
|
80
|
+
working_dir = worktree_path || Dir.pwd
|
81
|
+
|
82
|
+
begin
|
83
|
+
Dir.chdir(working_dir)
|
84
|
+
puts " 📊 Changed to directory: #{Dir.pwd}"
|
85
|
+
|
86
|
+
# Try to execute the script with timeout
|
87
|
+
require 'timeout'
|
88
|
+
|
89
|
+
output = ""
|
90
|
+
error = ""
|
91
|
+
|
92
|
+
begin
|
93
|
+
Timeout::timeout(10) do
|
94
|
+
output = `bash #{script_path} 2>&1`
|
95
|
+
end
|
96
|
+
exit_status = $?.exitstatus
|
97
|
+
|
98
|
+
puts " 📊 Script exit status: #{exit_status}"
|
99
|
+
puts " 📊 Output length: #{output.length}"
|
100
|
+
puts " 📊 Output preview: #{output[0..300]}..." if output.length > 0
|
101
|
+
|
102
|
+
rescue Timeout::Error
|
103
|
+
puts " ⚠️ Script execution timed out (>10s)"
|
104
|
+
end
|
105
|
+
|
106
|
+
ensure
|
107
|
+
Dir.chdir(original_dir)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# Step 8: Test Process.spawn approach
|
112
|
+
puts "\n8️⃣ Testing Process.spawn..."
|
113
|
+
if File.exist?(script_path)
|
114
|
+
working_dir = worktree_path || Dir.pwd
|
115
|
+
log_dir = '.enhance_swarm/logs'
|
116
|
+
|
117
|
+
puts " 🚀 Spawning process..."
|
118
|
+
puts " 📊 Working dir: #{working_dir}"
|
119
|
+
puts " 📊 Log dir: #{log_dir}"
|
120
|
+
|
121
|
+
begin
|
122
|
+
FileUtils.mkdir_p(log_dir)
|
123
|
+
|
124
|
+
pid = Process.spawn(
|
125
|
+
'/bin/bash', script_path,
|
126
|
+
chdir: working_dir,
|
127
|
+
out: File.join(log_dir, 'debug_manual_output.log'),
|
128
|
+
err: File.join(log_dir, 'debug_manual_error.log')
|
129
|
+
)
|
130
|
+
|
131
|
+
puts " 📊 Process spawned: PID #{pid}"
|
132
|
+
Process.detach(pid)
|
133
|
+
|
134
|
+
# Wait a moment and check status
|
135
|
+
sleep(3)
|
136
|
+
|
137
|
+
begin
|
138
|
+
Process.getpgid(pid)
|
139
|
+
puts " 📊 Process still running"
|
140
|
+
rescue Errno::ESRCH
|
141
|
+
puts " 📊 Process completed"
|
142
|
+
end
|
143
|
+
|
144
|
+
# Check output files
|
145
|
+
output_file = File.join(log_dir, 'debug_manual_output.log')
|
146
|
+
error_file = File.join(log_dir, 'debug_manual_error.log')
|
147
|
+
|
148
|
+
if File.exist?(output_file)
|
149
|
+
output = File.read(output_file)
|
150
|
+
puts " 📊 Manual output: #{output.length} chars"
|
151
|
+
puts " 📊 Output preview: #{output[0..200]}..." if output.length > 0
|
152
|
+
end
|
153
|
+
|
154
|
+
if File.exist?(error_file)
|
155
|
+
error = File.read(error_file)
|
156
|
+
puts " 📊 Manual error: #{error.length} chars"
|
157
|
+
puts " 📊 Error preview: #{error[0..200]}..." if error.length > 0
|
158
|
+
end
|
159
|
+
|
160
|
+
rescue => e
|
161
|
+
puts " ❌ Process spawn failed: #{e.message}"
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
# Cleanup
|
166
|
+
puts "\n9️⃣ Cleanup..."
|
167
|
+
if worktree_path && Dir.exist?(worktree_path)
|
168
|
+
puts " 🧹 Cleaning up worktree..."
|
169
|
+
begin
|
170
|
+
system("git worktree remove #{worktree_path}")
|
171
|
+
branch_name = File.basename(worktree_path)
|
172
|
+
system("git branch -d #{branch_name}")
|
173
|
+
puts " ✅ Worktree cleaned up"
|
174
|
+
rescue => e
|
175
|
+
puts " ⚠️ Cleanup warning: #{e.message}"
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
rescue => e
|
180
|
+
puts " ❌ Error: #{e.class}: #{e.message}"
|
181
|
+
puts " 📊 Backtrace:"
|
182
|
+
e.backtrace.first(10).each { |line| puts " #{line}" }
|
183
|
+
ensure
|
184
|
+
ENV.delete('ENHANCE_SWARM_DEBUG')
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
if __FILE__ == $0
|
189
|
+
debug_spawn_process
|
190
|
+
end
|
data/debug_worktree.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Debug script to test worktree creation
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
|
5
|
+
require 'enhance_swarm'
|
6
|
+
|
7
|
+
def test_worktree_creation
|
8
|
+
puts "🔍 Testing Git Worktree Creation Debug"
|
9
|
+
puts "=" * 50
|
10
|
+
|
11
|
+
spawner = EnhanceSwarm::AgentSpawner.new
|
12
|
+
|
13
|
+
# Test the private create_agent_worktree method
|
14
|
+
begin
|
15
|
+
puts "\n1️⃣ Testing worktree creation..."
|
16
|
+
|
17
|
+
# Check current git status
|
18
|
+
git_status = `git status --porcelain 2>&1`
|
19
|
+
puts " 📊 Git status: #{git_status.strip}"
|
20
|
+
|
21
|
+
# Check if we're in a git repository
|
22
|
+
in_git_repo = system('git rev-parse --git-dir > /dev/null 2>&1')
|
23
|
+
puts " 📊 In git repo: #{in_git_repo}"
|
24
|
+
|
25
|
+
# Check current branch
|
26
|
+
current_branch = `git branch --show-current 2>&1`.strip
|
27
|
+
puts " 📊 Current branch: #{current_branch}"
|
28
|
+
|
29
|
+
# Check if we have commits
|
30
|
+
has_commits = system('git log --oneline -1 > /dev/null 2>&1')
|
31
|
+
puts " 📊 Has commits: #{has_commits}"
|
32
|
+
|
33
|
+
# Test directory creation
|
34
|
+
worktree_dir = '.enhance_swarm/worktrees'
|
35
|
+
puts " 📊 Creating directory: #{worktree_dir}"
|
36
|
+
FileUtils.mkdir_p(worktree_dir) unless Dir.exist?(worktree_dir)
|
37
|
+
puts " 📊 Directory exists: #{Dir.exist?(worktree_dir)}"
|
38
|
+
|
39
|
+
# Try to call the create_agent_worktree method
|
40
|
+
puts "\n2️⃣ Calling create_agent_worktree..."
|
41
|
+
worktree_path = spawner.send(:create_agent_worktree, 'debug_test')
|
42
|
+
|
43
|
+
if worktree_path
|
44
|
+
puts " ✅ Success! Worktree created at: #{worktree_path}"
|
45
|
+
puts " 📊 Directory exists: #{Dir.exist?(worktree_path)}"
|
46
|
+
|
47
|
+
# List contents
|
48
|
+
if Dir.exist?(worktree_path)
|
49
|
+
contents = Dir.entries(worktree_path).reject { |f| f.start_with?('.') }
|
50
|
+
puts " 📊 Contents: #{contents.join(', ')}"
|
51
|
+
end
|
52
|
+
else
|
53
|
+
puts " ❌ Failed to create worktree"
|
54
|
+
end
|
55
|
+
|
56
|
+
rescue => e
|
57
|
+
puts " ❌ Error: #{e.class}: #{e.message}"
|
58
|
+
puts " 📊 Backtrace: #{e.backtrace.first(3).join(', ')}"
|
59
|
+
end
|
60
|
+
|
61
|
+
puts "\n3️⃣ Checking existing worktrees..."
|
62
|
+
existing_worktrees = `git worktree list 2>&1`
|
63
|
+
puts " 📊 Existing worktrees:"
|
64
|
+
existing_worktrees.each_line { |line| puts " #{line.strip}" }
|
65
|
+
|
66
|
+
puts "\n4️⃣ Testing CommandExecutor directly..."
|
67
|
+
begin
|
68
|
+
result = EnhanceSwarm::CommandExecutor.execute('git', 'worktree', 'list')
|
69
|
+
puts " ✅ CommandExecutor works: #{result}"
|
70
|
+
rescue => e
|
71
|
+
puts " ❌ CommandExecutor error: #{e.message}"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
if __FILE__ == $0
|
76
|
+
test_worktree_creation
|
77
|
+
end
|
Binary file
|
Binary file
|
@@ -0,0 +1,199 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Final comprehensive validation test for EnhanceSwarm v1.0
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
|
5
|
+
require 'enhance_swarm'
|
6
|
+
|
7
|
+
def run_final_validation
|
8
|
+
puts "🔍 EnhanceSwarm v1.0 Final Validation Test"
|
9
|
+
puts "=" * 60
|
10
|
+
|
11
|
+
results = {
|
12
|
+
core_functionality: {},
|
13
|
+
reliability: {},
|
14
|
+
user_experience: {},
|
15
|
+
production_readiness: {}
|
16
|
+
}
|
17
|
+
|
18
|
+
begin
|
19
|
+
# 1. Core Functionality Tests
|
20
|
+
puts "\n1️⃣ CORE FUNCTIONALITY VALIDATION"
|
21
|
+
puts "-" * 40
|
22
|
+
|
23
|
+
# Test AgentSpawner
|
24
|
+
puts " Testing AgentSpawner..."
|
25
|
+
spawner = EnhanceSwarm::AgentSpawner.new
|
26
|
+
claude_available = spawner.claude_cli_available?
|
27
|
+
results[:core_functionality][:claude_cli] = claude_available
|
28
|
+
puts " 📊 Claude CLI: #{claude_available ? '✅' : '❌'}"
|
29
|
+
|
30
|
+
# Test SessionManager
|
31
|
+
puts " Testing SessionManager..."
|
32
|
+
session_manager = EnhanceSwarm::SessionManager.new
|
33
|
+
session = session_manager.create_session("Validation test")
|
34
|
+
session_works = session && session[:session_id]
|
35
|
+
results[:core_functionality][:session_management] = session_works
|
36
|
+
puts " 📊 Session Management: #{session_works ? '✅' : '❌'}"
|
37
|
+
|
38
|
+
# Test Configuration
|
39
|
+
puts " Testing Configuration..."
|
40
|
+
config = EnhanceSwarm.configuration
|
41
|
+
config_works = config && config.project_name
|
42
|
+
results[:core_functionality][:configuration] = config_works
|
43
|
+
puts " 📊 Configuration: #{config_works ? '✅' : '❌'}"
|
44
|
+
|
45
|
+
# Test Orchestrator
|
46
|
+
puts " Testing Orchestrator..."
|
47
|
+
orchestrator = EnhanceSwarm::Orchestrator.new
|
48
|
+
orchestrator_works = orchestrator.respond_to?(:spawn_single)
|
49
|
+
results[:core_functionality][:orchestrator] = orchestrator_works
|
50
|
+
puts " 📊 Orchestrator: #{orchestrator_works ? '✅' : '❌'}"
|
51
|
+
|
52
|
+
# 2. Reliability Tests
|
53
|
+
puts "\n2️⃣ RELIABILITY VALIDATION"
|
54
|
+
puts "-" * 40
|
55
|
+
|
56
|
+
# Test Error Handling
|
57
|
+
puts " Testing Error Handling..."
|
58
|
+
begin
|
59
|
+
# Test with invalid input
|
60
|
+
spawner.spawn_agent(role: nil, task: nil, worktree: false)
|
61
|
+
error_handling = false
|
62
|
+
rescue => e
|
63
|
+
error_handling = true
|
64
|
+
puts " 📊 Error properly caught: #{e.class}"
|
65
|
+
end
|
66
|
+
results[:reliability][:error_handling] = error_handling
|
67
|
+
puts " 📊 Error Handling: #{error_handling ? '✅' : '❌'}"
|
68
|
+
|
69
|
+
# Test Logger
|
70
|
+
puts " Testing Logger..."
|
71
|
+
logger_works = EnhanceSwarm::Logger.respond_to?(:info)
|
72
|
+
results[:reliability][:logging] = logger_works
|
73
|
+
puts " 📊 Logging System: #{logger_works ? '✅' : '❌'}"
|
74
|
+
|
75
|
+
# Test Cleanup
|
76
|
+
puts " Testing Cleanup..."
|
77
|
+
cleanup_works = EnhanceSwarm::CleanupManager.respond_to?(:cleanup_stale_worktrees)
|
78
|
+
results[:reliability][:cleanup] = cleanup_works
|
79
|
+
puts " 📊 Cleanup Manager: #{cleanup_works ? '✅' : '❌'}"
|
80
|
+
|
81
|
+
# 3. User Experience Tests
|
82
|
+
puts "\n3️⃣ USER EXPERIENCE VALIDATION"
|
83
|
+
puts "-" * 40
|
84
|
+
|
85
|
+
# Test CLI Components
|
86
|
+
puts " Testing CLI Components..."
|
87
|
+
cli_works = EnhanceSwarm::CLI.respond_to?(:new)
|
88
|
+
results[:user_experience][:cli] = cli_works
|
89
|
+
puts " 📊 CLI Interface: #{cli_works ? '✅' : '❌'}"
|
90
|
+
|
91
|
+
# Test Dashboard
|
92
|
+
puts " Testing Dashboard..."
|
93
|
+
dashboard_works = EnhanceSwarm::VisualDashboard.respond_to?(:instance)
|
94
|
+
results[:user_experience][:dashboard] = dashboard_works
|
95
|
+
puts " 📊 Visual Dashboard: #{dashboard_works ? '✅' : '❌'}"
|
96
|
+
|
97
|
+
# Test Smart Defaults
|
98
|
+
puts " Testing Smart Defaults..."
|
99
|
+
smart_defaults_works = EnhanceSwarm::SmartDefaults.respond_to?(:suggest_role_for_task)
|
100
|
+
results[:user_experience][:smart_defaults] = smart_defaults_works
|
101
|
+
puts " 📊 Smart Defaults: #{smart_defaults_works ? '✅' : '❌'}"
|
102
|
+
|
103
|
+
# 4. Production Readiness Tests
|
104
|
+
puts "\n4️⃣ PRODUCTION READINESS VALIDATION"
|
105
|
+
puts "-" * 40
|
106
|
+
|
107
|
+
# Test actual spawn (non-blocking)
|
108
|
+
puts " Testing Real Agent Spawn..."
|
109
|
+
spawn_result = spawner.spawn_agent(
|
110
|
+
role: "general",
|
111
|
+
task: "Quick validation test - just echo 'validation successful'",
|
112
|
+
worktree: false
|
113
|
+
)
|
114
|
+
spawn_works = spawn_result && spawn_result[:pid]
|
115
|
+
results[:production_readiness][:real_spawn] = spawn_works
|
116
|
+
puts " 📊 Real Agent Spawn: #{spawn_works ? '✅' : '❌'}"
|
117
|
+
|
118
|
+
if spawn_works
|
119
|
+
puts " 📊 Spawned PID: #{spawn_result[:pid]}"
|
120
|
+
|
121
|
+
# Brief wait to check process
|
122
|
+
sleep(2)
|
123
|
+
begin
|
124
|
+
Process.getpgid(spawn_result[:pid])
|
125
|
+
puts " 📊 Process Status: Running ✅"
|
126
|
+
rescue Errno::ESRCH
|
127
|
+
puts " 📊 Process Status: Completed ✅"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# Test Dependencies
|
132
|
+
puts " Testing Dependencies..."
|
133
|
+
deps_works = EnhanceSwarm::DependencyValidator.respond_to?(:validate_all)
|
134
|
+
results[:production_readiness][:dependencies] = deps_works
|
135
|
+
puts " 📊 Dependency Validation: #{deps_works ? '✅' : '❌'}"
|
136
|
+
|
137
|
+
# Test Process Monitoring
|
138
|
+
puts " Testing Process Monitoring..."
|
139
|
+
monitor_works = EnhanceSwarm::ProcessMonitor.respond_to?(:new)
|
140
|
+
results[:production_readiness][:monitoring] = monitor_works
|
141
|
+
puts " 📊 Process Monitoring: #{monitor_works ? '✅' : '❌'}"
|
142
|
+
|
143
|
+
# 5. Calculate Final Score
|
144
|
+
puts "\n5️⃣ FINAL SCORING"
|
145
|
+
puts "-" * 40
|
146
|
+
|
147
|
+
total_tests = 0
|
148
|
+
passed_tests = 0
|
149
|
+
|
150
|
+
results.each do |category, tests|
|
151
|
+
category_passed = tests.values.count(true)
|
152
|
+
category_total = tests.count
|
153
|
+
total_tests += category_total
|
154
|
+
passed_tests += category_passed
|
155
|
+
|
156
|
+
percentage = category_total > 0 ? (category_passed.to_f / category_total * 100).round(1) : 0
|
157
|
+
puts " #{category.to_s.gsub('_', ' ').capitalize}: #{category_passed}/#{category_total} (#{percentage}%)"
|
158
|
+
end
|
159
|
+
|
160
|
+
overall_percentage = total_tests > 0 ? (passed_tests.to_f / total_tests * 100).round(1) : 0
|
161
|
+
|
162
|
+
puts "\n" + "=" * 60
|
163
|
+
puts "🎯 FINAL VALIDATION RESULTS"
|
164
|
+
puts "=" * 60
|
165
|
+
puts "Total Tests: #{total_tests}"
|
166
|
+
puts "Tests Passed: #{passed_tests}"
|
167
|
+
puts "Success Rate: #{overall_percentage}%"
|
168
|
+
|
169
|
+
if overall_percentage >= 95
|
170
|
+
puts "\n🚀 PRODUCTION READY - EXCELLENT"
|
171
|
+
puts " All critical systems operational"
|
172
|
+
elsif overall_percentage >= 85
|
173
|
+
puts "\n✅ PRODUCTION READY - GOOD"
|
174
|
+
puts " Minor issues, but deployable"
|
175
|
+
elsif overall_percentage >= 70
|
176
|
+
puts "\n⚠️ PRODUCTION READY - WITH CAVEATS"
|
177
|
+
puts " Some issues need attention"
|
178
|
+
else
|
179
|
+
puts "\n❌ NOT PRODUCTION READY"
|
180
|
+
puts " Significant issues require resolution"
|
181
|
+
end
|
182
|
+
|
183
|
+
return overall_percentage
|
184
|
+
|
185
|
+
rescue => e
|
186
|
+
puts " ❌ Validation Error: #{e.class}: #{e.message}"
|
187
|
+
puts " 📊 Backtrace:"
|
188
|
+
e.backtrace.first(3).each { |line| puts " #{line}" }
|
189
|
+
return 0
|
190
|
+
ensure
|
191
|
+
# Cleanup
|
192
|
+
session_manager&.cleanup_session
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
if __FILE__ == $0
|
197
|
+
score = run_final_validation
|
198
|
+
puts "\n🎖️ EnhanceSwarm v1.0 Production Score: #{score}/100"
|
199
|
+
end
|
@@ -286,6 +286,8 @@ module EnhanceSwarm
|
|
286
286
|
'You specialize in user experience design, interaction flows, accessibility, and user-centric improvements.'
|
287
287
|
when 'general'
|
288
288
|
'You are a general-purpose agent capable of handling various development tasks across the full stack.'
|
289
|
+
when 'scaffolding'
|
290
|
+
'You specialize in Bullet Train Super Scaffolding, following Andrew Culver\'s conventions for team-scoped architecture, model relationships, and framework configuration.'
|
289
291
|
else
|
290
292
|
"You are a #{role} specialist agent focusing on your area of expertise."
|
291
293
|
end
|
@@ -417,6 +419,8 @@ module EnhanceSwarm
|
|
417
419
|
base_prompt += "\n\nFOCUS: Controllers, views, JavaScript, forms, user interactions, and integration."
|
418
420
|
when 'qa'
|
419
421
|
base_prompt += "\n\nFOCUS: Comprehensive testing, edge cases, quality assurance, and validation."
|
422
|
+
when 'scaffolding'
|
423
|
+
base_prompt += "\n\nFOCUS: Bullet Train Super Scaffolding, Andrew Culver's best practices, team-scoped architecture, and framework setup."
|
420
424
|
end
|
421
425
|
|
422
426
|
base_prompt
|
@@ -449,7 +453,7 @@ module EnhanceSwarm
|
|
449
453
|
|
450
454
|
def sanitize_role(role)
|
451
455
|
# Only allow known safe roles
|
452
|
-
allowed_roles = %w[ux backend frontend qa general]
|
456
|
+
allowed_roles = %w[ux backend frontend qa general scaffolding]
|
453
457
|
role = role.to_s.downcase.strip
|
454
458
|
allowed_roles.include?(role) ? role : 'general'
|
455
459
|
end
|
data/lib/enhance_swarm/cli.rb
CHANGED
@@ -4,6 +4,8 @@ require 'thor'
|
|
4
4
|
require 'colorize'
|
5
5
|
require_relative 'web_ui'
|
6
6
|
require_relative 'session_manager'
|
7
|
+
require_relative 'task_coordinator'
|
8
|
+
require_relative 'smart_orchestration'
|
7
9
|
|
8
10
|
module EnhanceSwarm
|
9
11
|
class CLI < Thor
|
@@ -54,15 +56,46 @@ module EnhanceSwarm
|
|
54
56
|
notifications: options[:notifications]
|
55
57
|
})
|
56
58
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
59
|
+
# Get task description from user
|
60
|
+
print "Enter task description: "
|
61
|
+
task_description = $stdin.gets.chomp
|
62
|
+
|
63
|
+
# Use smart orchestration by default
|
64
|
+
begin
|
65
|
+
SmartOrchestration.enhance_with_coordination(task_description)
|
66
|
+
say "✅ Smart orchestration completed successfully!", :green
|
67
|
+
rescue StandardError => e
|
68
|
+
say "❌ Smart orchestration failed, falling back to control agent", :yellow
|
69
|
+
Logger.error("Smart orchestration error: #{e.message}")
|
70
|
+
|
71
|
+
if options[:control_agent] && !options[:dry_run]
|
72
|
+
enhance_with_control_agent_manual(task_description)
|
73
|
+
else
|
74
|
+
orchestrator = Orchestrator.new
|
75
|
+
orchestrator.enhance(
|
76
|
+
task_id: options[:task],
|
77
|
+
dry_run: options[:dry_run],
|
78
|
+
follow: options[:follow]
|
79
|
+
)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
desc 'orchestrate TASK_DESC', 'Intelligent multi-agent orchestration with smart coordination'
|
85
|
+
option :coordination, type: :boolean, default: true, desc: 'Enable intelligent task coordination'
|
86
|
+
option :follow, type: :boolean, default: false, desc: 'Stream live output from all agents'
|
87
|
+
def orchestrate(task_desc)
|
88
|
+
say "🎯 Starting intelligent multi-agent orchestration", :blue
|
89
|
+
say "Task: #{task_desc}", :white
|
90
|
+
|
91
|
+
begin
|
92
|
+
coordinator = TaskCoordinator.new
|
93
|
+
coordinator.coordinate_task(task_desc)
|
94
|
+
|
95
|
+
say "✅ Multi-agent orchestration completed successfully!", :green
|
96
|
+
rescue StandardError => e
|
97
|
+
say "❌ Orchestration failed: #{e.message}", :red
|
98
|
+
say "Debug info: #{e.backtrace.first(3).join("\n")}", :yellow
|
66
99
|
end
|
67
100
|
end
|
68
101
|
|