enhance_swarm 1.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 +7 -0
- data/.enhance_swarm/agent_scripts/frontend_agent.md +39 -0
- data/.enhance_swarm/user_patterns.json +37 -0
- data/CHANGELOG.md +184 -0
- data/LICENSE +21 -0
- data/PRODUCTION_TEST_LOG.md +502 -0
- data/README.md +905 -0
- data/Rakefile +28 -0
- data/USAGE_EXAMPLES.md +477 -0
- data/examples/enhance_workflow.md +346 -0
- data/examples/rails_project.md +253 -0
- data/exe/enhance-swarm +30 -0
- data/lib/enhance_swarm/additional_commands.rb +299 -0
- data/lib/enhance_swarm/agent_communicator.rb +460 -0
- data/lib/enhance_swarm/agent_reviewer.rb +283 -0
- data/lib/enhance_swarm/agent_spawner.rb +462 -0
- data/lib/enhance_swarm/cleanup_manager.rb +245 -0
- data/lib/enhance_swarm/cli.rb +1592 -0
- data/lib/enhance_swarm/command_executor.rb +78 -0
- data/lib/enhance_swarm/configuration.rb +324 -0
- data/lib/enhance_swarm/control_agent.rb +307 -0
- data/lib/enhance_swarm/dependency_validator.rb +195 -0
- data/lib/enhance_swarm/error_recovery.rb +785 -0
- data/lib/enhance_swarm/generator.rb +194 -0
- data/lib/enhance_swarm/interrupt_handler.rb +512 -0
- data/lib/enhance_swarm/logger.rb +106 -0
- data/lib/enhance_swarm/mcp_integration.rb +85 -0
- data/lib/enhance_swarm/monitor.rb +28 -0
- data/lib/enhance_swarm/notification_manager.rb +444 -0
- data/lib/enhance_swarm/orchestrator.rb +313 -0
- data/lib/enhance_swarm/output_streamer.rb +281 -0
- data/lib/enhance_swarm/process_monitor.rb +266 -0
- data/lib/enhance_swarm/progress_tracker.rb +215 -0
- data/lib/enhance_swarm/project_analyzer.rb +612 -0
- data/lib/enhance_swarm/resource_manager.rb +177 -0
- data/lib/enhance_swarm/retry_handler.rb +40 -0
- data/lib/enhance_swarm/session_manager.rb +247 -0
- data/lib/enhance_swarm/signal_handler.rb +95 -0
- data/lib/enhance_swarm/smart_defaults.rb +708 -0
- data/lib/enhance_swarm/task_integration.rb +150 -0
- data/lib/enhance_swarm/task_manager.rb +174 -0
- data/lib/enhance_swarm/version.rb +5 -0
- data/lib/enhance_swarm/visual_dashboard.rb +555 -0
- data/lib/enhance_swarm/web_ui.rb +211 -0
- data/lib/enhance_swarm.rb +69 -0
- data/setup.sh +86 -0
- data/sig/enhance_swarm.rbs +4 -0
- data/templates/claude/CLAUDE.md +160 -0
- data/templates/claude/MCP.md +117 -0
- data/templates/claude/PERSONAS.md +114 -0
- data/templates/claude/RULES.md +221 -0
- data/test_builtin_functionality.rb +121 -0
- data/test_core_components.rb +156 -0
- data/test_real_claude_integration.rb +285 -0
- data/test_security.rb +150 -0
- data/test_smart_defaults.rb +155 -0
- data/test_task_integration.rb +173 -0
- data/test_web_ui.rb +245 -0
- data/web/assets/css/main.css +645 -0
- data/web/assets/js/kanban.js +499 -0
- data/web/assets/js/main.js +525 -0
- data/web/templates/dashboard.html.erb +226 -0
- data/web/templates/kanban.html.erb +193 -0
- metadata +293 -0
@@ -0,0 +1,346 @@
|
|
1
|
+
# The ENHANCE Workflow
|
2
|
+
|
3
|
+
This document explains the ENHANCE protocol workflow in detail with practical examples.
|
4
|
+
|
5
|
+
## What is ENHANCE?
|
6
|
+
|
7
|
+
ENHANCE is a keyword that triggers automatic multi-agent orchestration. When you say "enhance" to Claude (with EnhanceSwarm installed), it:
|
8
|
+
|
9
|
+
1. Finds the next priority task
|
10
|
+
2. Breaks it down by specialty
|
11
|
+
3. Spawns parallel AI agents
|
12
|
+
4. Monitors briefly (2 min)
|
13
|
+
5. Returns control to you
|
14
|
+
6. Completes work in background
|
15
|
+
|
16
|
+
## Basic Usage
|
17
|
+
|
18
|
+
### In Claude Chat
|
19
|
+
Simply type:
|
20
|
+
```
|
21
|
+
enhance
|
22
|
+
```
|
23
|
+
|
24
|
+
Claude will respond with something like:
|
25
|
+
```
|
26
|
+
šÆ ENHANCE Protocol Activated!
|
27
|
+
š Task: 2024-06-28-user-authentication - Add user authentication system
|
28
|
+
ā
Task moved to active
|
29
|
+
š¤ Spawning 4 agents...
|
30
|
+
ā
All agents spawned
|
31
|
+
|
32
|
+
š Monitoring for 120 seconds...
|
33
|
+
[Check 1/4] 14:30:22
|
34
|
+
Active agents: 4
|
35
|
+
- ux_agent (PID: 12345)
|
36
|
+
- backend_agent (PID: 12346)
|
37
|
+
- frontend_agent (PID: 12347)
|
38
|
+
- qa_agent (PID: 12348)
|
39
|
+
|
40
|
+
[Check 2/4] 14:30:52
|
41
|
+
Active agents: 3
|
42
|
+
Completed: 1
|
43
|
+
|
44
|
+
š” Agents working in background. Check back later with:
|
45
|
+
enhance-swarm monitor
|
46
|
+
enhance-swarm status
|
47
|
+
```
|
48
|
+
|
49
|
+
### From Command Line
|
50
|
+
```bash
|
51
|
+
# Enhance next priority task
|
52
|
+
enhance-swarm enhance
|
53
|
+
|
54
|
+
# Enhance specific task
|
55
|
+
enhance-swarm enhance --task 2024-06-28-payment-integration
|
56
|
+
|
57
|
+
# Dry run to see what would happen
|
58
|
+
enhance-swarm enhance --dry-run
|
59
|
+
```
|
60
|
+
|
61
|
+
## Task Breakdown Examples
|
62
|
+
|
63
|
+
### Example 1: E-commerce Cart Feature
|
64
|
+
|
65
|
+
Given task: "Implement shopping cart with real-time updates"
|
66
|
+
|
67
|
+
ENHANCE breaks it down to:
|
68
|
+
- **UX Agent**: Design cart UI, empty states, quantity controls
|
69
|
+
- **Backend Agent**: Cart and CartItem models, pricing service
|
70
|
+
- **Frontend Agent**: Turbo frames, Stimulus controllers
|
71
|
+
- **QA Agent**: Unit tests, system tests, edge cases
|
72
|
+
|
73
|
+
### Example 2: API Endpoint
|
74
|
+
|
75
|
+
Given task: "Add REST API for user profiles"
|
76
|
+
|
77
|
+
ENHANCE breaks it down to:
|
78
|
+
- **Backend Agent**: API controller, serializers, authentication
|
79
|
+
- **QA Agent**: API tests, documentation
|
80
|
+
|
81
|
+
(No UX or Frontend agents needed for pure API work)
|
82
|
+
|
83
|
+
### Example 3: Bug Fix
|
84
|
+
|
85
|
+
Given task: "Fix N+1 query in dashboard"
|
86
|
+
|
87
|
+
ENHANCE recognizes this as a single-agent task and runs directly without orchestration.
|
88
|
+
|
89
|
+
## Monitoring Patterns
|
90
|
+
|
91
|
+
### The 2-Minute Rule
|
92
|
+
|
93
|
+
ENHANCE monitors for exactly 2 minutes, then returns control:
|
94
|
+
|
95
|
+
```
|
96
|
+
Minute 0-2: Active monitoring
|
97
|
+
- Shows live status
|
98
|
+
- Updates every 30 seconds
|
99
|
+
- Displays completed agents
|
100
|
+
|
101
|
+
After 2 minutes: Background execution
|
102
|
+
- Agents continue working
|
103
|
+
- You work on other tasks
|
104
|
+
- Check back periodically
|
105
|
+
```
|
106
|
+
|
107
|
+
### Checking Status
|
108
|
+
|
109
|
+
While agents work in background:
|
110
|
+
|
111
|
+
```bash
|
112
|
+
# Quick status check
|
113
|
+
enhance-swarm status
|
114
|
+
|
115
|
+
# Output:
|
116
|
+
š Swarm Status:
|
117
|
+
Active agents: 2
|
118
|
+
Completed tasks: 2
|
119
|
+
Worktrees: 4
|
120
|
+
|
121
|
+
š Recent branches:
|
122
|
+
- swarm/ux-20240628-143022
|
123
|
+
- swarm/backend-20240628-143025
|
124
|
+
```
|
125
|
+
|
126
|
+
### Detailed Monitoring
|
127
|
+
|
128
|
+
When you want to watch agents work:
|
129
|
+
|
130
|
+
```bash
|
131
|
+
# Watch with default settings (30s interval, 120s timeout)
|
132
|
+
enhance-swarm monitor
|
133
|
+
|
134
|
+
# Custom monitoring
|
135
|
+
enhance-swarm monitor --interval 10 --timeout 300
|
136
|
+
```
|
137
|
+
|
138
|
+
## Agent Communication
|
139
|
+
|
140
|
+
Each agent receives:
|
141
|
+
|
142
|
+
```
|
143
|
+
AUTONOMOUS EXECUTION REQUIRED - [ROLE] SPECIALIST
|
144
|
+
|
145
|
+
[Task Description]
|
146
|
+
|
147
|
+
CRITICAL INSTRUCTIONS:
|
148
|
+
1. You have FULL PERMISSION to read, write, edit files and run commands
|
149
|
+
2. DO NOT wait for any permissions - proceed immediately
|
150
|
+
3. Complete the task fully and thoroughly
|
151
|
+
4. Test your implementation using: [test command]
|
152
|
+
5. When complete:
|
153
|
+
- Run: git add -A
|
154
|
+
- Run: git commit -m '[role]: [description]'
|
155
|
+
- Run: git checkout -b 'swarm/[role]-[timestamp]'
|
156
|
+
- Run: git push origin HEAD
|
157
|
+
6. Document what was implemented in your final message
|
158
|
+
```
|
159
|
+
|
160
|
+
## Parallel Execution
|
161
|
+
|
162
|
+
Agents work simultaneously in separate git worktrees:
|
163
|
+
|
164
|
+
```
|
165
|
+
main branch
|
166
|
+
āāā .worktree_ux_1234 (UX agent workspace)
|
167
|
+
āāā .worktree_backend_5678 (Backend agent workspace)
|
168
|
+
āāā .worktree_frontend_9012 (Frontend agent workspace)
|
169
|
+
āāā .worktree_qa_3456 (QA agent workspace)
|
170
|
+
```
|
171
|
+
|
172
|
+
Benefits:
|
173
|
+
- No conflicts between agents
|
174
|
+
- Parallel file editing
|
175
|
+
- Independent testing
|
176
|
+
- Clean merging
|
177
|
+
|
178
|
+
## Reviewing Completed Work
|
179
|
+
|
180
|
+
### Step 1: Check Branches
|
181
|
+
```bash
|
182
|
+
# See what agents created
|
183
|
+
git fetch
|
184
|
+
git branch -r | grep swarm/
|
185
|
+
|
186
|
+
# Output:
|
187
|
+
origin/swarm/backend-20240628-143025
|
188
|
+
origin/swarm/frontend-20240628-143030
|
189
|
+
origin/swarm/qa-20240628-143035
|
190
|
+
origin/swarm/ux-20240628-143022
|
191
|
+
```
|
192
|
+
|
193
|
+
### Step 2: Review Changes
|
194
|
+
```bash
|
195
|
+
# Check each branch
|
196
|
+
git checkout swarm/backend-20240628-143025
|
197
|
+
git diff main
|
198
|
+
bundle exec rails test
|
199
|
+
|
200
|
+
# If good, merge
|
201
|
+
git checkout main
|
202
|
+
git merge swarm/backend-20240628-143025
|
203
|
+
```
|
204
|
+
|
205
|
+
### Step 3: Clean Up
|
206
|
+
```bash
|
207
|
+
# Remove worktrees
|
208
|
+
git worktree remove .worktree_ux_1234
|
209
|
+
git worktree remove .worktree_backend_5678
|
210
|
+
|
211
|
+
# Delete merged branches
|
212
|
+
git branch -d swarm/backend-20240628-143025
|
213
|
+
git push origin --delete swarm/backend-20240628-143025
|
214
|
+
```
|
215
|
+
|
216
|
+
## Advanced Patterns
|
217
|
+
|
218
|
+
### Continuous Enhancement
|
219
|
+
|
220
|
+
Keep enhancing while agents work:
|
221
|
+
|
222
|
+
```
|
223
|
+
# Terminal 1
|
224
|
+
enhance-swarm enhance # Starts first task
|
225
|
+
|
226
|
+
# Terminal 2 (2 minutes later)
|
227
|
+
enhance-swarm enhance # Starts second task
|
228
|
+
|
229
|
+
# Terminal 3 (2 minutes later)
|
230
|
+
enhance-swarm enhance # Starts third task
|
231
|
+
|
232
|
+
# Check all progress
|
233
|
+
enhance-swarm status
|
234
|
+
```
|
235
|
+
|
236
|
+
### Task Chains
|
237
|
+
|
238
|
+
For dependent tasks:
|
239
|
+
|
240
|
+
```yaml
|
241
|
+
# tasks/backlog/2024-06-28-auth-chain.yml
|
242
|
+
title: Authentication System
|
243
|
+
subtasks:
|
244
|
+
- id: auth-models
|
245
|
+
description: Create User and Session models
|
246
|
+
dependencies: []
|
247
|
+
- id: auth-controllers
|
248
|
+
description: Create login/logout controllers
|
249
|
+
dependencies: [auth-models]
|
250
|
+
- id: auth-ui
|
251
|
+
description: Create login forms and UI
|
252
|
+
dependencies: [auth-controllers]
|
253
|
+
```
|
254
|
+
|
255
|
+
### Custom Workflows
|
256
|
+
|
257
|
+
Override default behavior in `.enhance_swarm.yml`:
|
258
|
+
|
259
|
+
```yaml
|
260
|
+
workflows:
|
261
|
+
feature:
|
262
|
+
agents: [ux, backend, frontend, qa]
|
263
|
+
monitor_timeout: 120
|
264
|
+
|
265
|
+
bugfix:
|
266
|
+
agents: [general]
|
267
|
+
monitor_timeout: 60
|
268
|
+
|
269
|
+
refactor:
|
270
|
+
agents: [backend, qa]
|
271
|
+
monitor_timeout: 180
|
272
|
+
```
|
273
|
+
|
274
|
+
## Tips and Tricks
|
275
|
+
|
276
|
+
1. **Batch Processing**: Run enhance multiple times for parallel task execution
|
277
|
+
2. **Night Runs**: Start enhance before leaving, review completed work next day
|
278
|
+
3. **CI Integration**: Trigger enhance from GitHub Actions for automated development
|
279
|
+
4. **Task Sizing**: Break large epics into 4-8 hour tasks for best results
|
280
|
+
5. **Review Rhythm**: Check swarm status every 15-30 minutes during active development
|
281
|
+
|
282
|
+
## Common Patterns
|
283
|
+
|
284
|
+
### Morning Workflow
|
285
|
+
```bash
|
286
|
+
# Start the day
|
287
|
+
enhance-swarm enhance # Start first task
|
288
|
+
enhance-swarm status # Check overnight work
|
289
|
+
git pull # Get completed work
|
290
|
+
bundle exec rails test # Verify everything works
|
291
|
+
```
|
292
|
+
|
293
|
+
### Continuous Development
|
294
|
+
```bash
|
295
|
+
# In a loop
|
296
|
+
while true; do
|
297
|
+
enhance-swarm enhance
|
298
|
+
sleep 120 # Wait 2 minutes
|
299
|
+
|
300
|
+
# Do other work while agents run
|
301
|
+
# Review PRs, write docs, etc.
|
302
|
+
|
303
|
+
enhance-swarm status
|
304
|
+
done
|
305
|
+
```
|
306
|
+
|
307
|
+
### End of Day
|
308
|
+
```bash
|
309
|
+
# Before leaving
|
310
|
+
enhance-swarm enhance --task tomorrow-priority-1
|
311
|
+
enhance-swarm enhance --task tomorrow-priority-2
|
312
|
+
enhance-swarm monitor --timeout 300
|
313
|
+
|
314
|
+
# Next morning
|
315
|
+
enhance-swarm status
|
316
|
+
# Review all completed work
|
317
|
+
```
|
318
|
+
|
319
|
+
## Troubleshooting
|
320
|
+
|
321
|
+
### Agents Not Completing
|
322
|
+
```bash
|
323
|
+
# Check agent logs
|
324
|
+
enhance-swarm status
|
325
|
+
claude-swarm ps
|
326
|
+
claude-swarm show [session-id]
|
327
|
+
```
|
328
|
+
|
329
|
+
### Merge Conflicts
|
330
|
+
```bash
|
331
|
+
# Agents work in isolation, but if conflicts arise:
|
332
|
+
git checkout main
|
333
|
+
git merge --no-ff swarm/backend-branch
|
334
|
+
# Resolve conflicts
|
335
|
+
git add .
|
336
|
+
git commit
|
337
|
+
```
|
338
|
+
|
339
|
+
### Resource Limits
|
340
|
+
```yaml
|
341
|
+
# Adjust in .enhance_swarm.yml
|
342
|
+
orchestration:
|
343
|
+
max_concurrent_agents: 2 # Reduce if system is slow
|
344
|
+
monitor_interval: 60 # Check less frequently
|
345
|
+
monitor_timeout: 60 # Shorter monitoring
|
346
|
+
```
|
@@ -0,0 +1,253 @@
|
|
1
|
+
# EnhanceSwarm with Rails Projects
|
2
|
+
|
3
|
+
This example shows how to use EnhanceSwarm with a Rails 8 application.
|
4
|
+
|
5
|
+
## Initial Setup
|
6
|
+
|
7
|
+
```bash
|
8
|
+
cd your-rails-app
|
9
|
+
enhance-swarm init
|
10
|
+
```
|
11
|
+
|
12
|
+
## Customize Configuration
|
13
|
+
|
14
|
+
Edit `.enhance_swarm.yml`:
|
15
|
+
|
16
|
+
```yaml
|
17
|
+
project:
|
18
|
+
name: "My Rails App"
|
19
|
+
description: "E-commerce platform built with Rails 8"
|
20
|
+
technology_stack: "Rails 8.0.2, PostgreSQL, Hotwire, ViewComponent"
|
21
|
+
|
22
|
+
commands:
|
23
|
+
test: "bundle exec rails test"
|
24
|
+
task: "bundle exec rails swarm:tasks"
|
25
|
+
task_move: "bundle exec rails swarm:tasks:move"
|
26
|
+
|
27
|
+
orchestration:
|
28
|
+
max_concurrent_agents: 4
|
29
|
+
monitor_interval: 30
|
30
|
+
monitor_timeout: 120
|
31
|
+
worktree_enabled: true
|
32
|
+
|
33
|
+
mcp:
|
34
|
+
tools:
|
35
|
+
context7: true
|
36
|
+
sequential: true
|
37
|
+
magic_ui: true
|
38
|
+
puppeteer: true
|
39
|
+
gemini_enabled: true
|
40
|
+
desktop_commander_enabled: true
|
41
|
+
|
42
|
+
standards:
|
43
|
+
code:
|
44
|
+
- "Follow Rails conventions"
|
45
|
+
- "Use service objects in app/services/"
|
46
|
+
- "Use form objects for complex forms"
|
47
|
+
- "Keep controllers thin"
|
48
|
+
- "Write system tests for features"
|
49
|
+
- "Use strong parameters"
|
50
|
+
- "Validate all user inputs"
|
51
|
+
notes:
|
52
|
+
- "Multi-tenant application using acts_as_tenant"
|
53
|
+
- "Stripe integration via Pay gem"
|
54
|
+
- "ActionMailer with Postmark"
|
55
|
+
```
|
56
|
+
|
57
|
+
## Example Tasks
|
58
|
+
|
59
|
+
### Task 1: Add Shopping Cart Feature
|
60
|
+
|
61
|
+
Create `tasks/backlog/add-shopping-cart.md`:
|
62
|
+
|
63
|
+
```markdown
|
64
|
+
# Add Shopping Cart Feature
|
65
|
+
|
66
|
+
## Description
|
67
|
+
Implement a shopping cart system that allows users to add products, update quantities, and proceed to checkout.
|
68
|
+
|
69
|
+
## Acceptance Criteria
|
70
|
+
- Users can add products to cart
|
71
|
+
- Cart persists across sessions
|
72
|
+
- Users can update quantities
|
73
|
+
- Users can remove items
|
74
|
+
- Cart shows total price
|
75
|
+
- Integration with existing checkout flow
|
76
|
+
|
77
|
+
## Technical Requirements
|
78
|
+
- Cart model with cart_items
|
79
|
+
- Session-based for guests
|
80
|
+
- Database-backed for logged-in users
|
81
|
+
- Hotwire for dynamic updates
|
82
|
+
- Full test coverage
|
83
|
+
|
84
|
+
## Estimated Hours: 8
|
85
|
+
```
|
86
|
+
|
87
|
+
### Running ENHANCE Protocol
|
88
|
+
|
89
|
+
In Claude, simply say:
|
90
|
+
```
|
91
|
+
enhance
|
92
|
+
```
|
93
|
+
|
94
|
+
Or from command line:
|
95
|
+
```bash
|
96
|
+
enhance-swarm enhance
|
97
|
+
```
|
98
|
+
|
99
|
+
This will:
|
100
|
+
1. Pick up the shopping cart task
|
101
|
+
2. Spawn 4 specialized agents:
|
102
|
+
- **UX Agent**: Designs cart UI components and email templates
|
103
|
+
- **Backend Agent**: Creates Cart and CartItem models, services
|
104
|
+
- **Frontend Agent**: Implements controllers, views, and Stimulus
|
105
|
+
- **QA Agent**: Writes comprehensive system and unit tests
|
106
|
+
|
107
|
+
### Monitoring Progress
|
108
|
+
|
109
|
+
```bash
|
110
|
+
# Quick status check
|
111
|
+
enhance-swarm status
|
112
|
+
|
113
|
+
# Watch agents work (2 min max)
|
114
|
+
enhance-swarm monitor
|
115
|
+
|
116
|
+
# See all worktrees
|
117
|
+
git worktree list
|
118
|
+
```
|
119
|
+
|
120
|
+
### Review and Merge
|
121
|
+
|
122
|
+
After agents complete:
|
123
|
+
|
124
|
+
```bash
|
125
|
+
# Check each worktree
|
126
|
+
cd .worktree_ux_1234
|
127
|
+
rails test
|
128
|
+
git log --oneline
|
129
|
+
|
130
|
+
cd .worktree_backend_5678
|
131
|
+
rails test
|
132
|
+
git diff main
|
133
|
+
|
134
|
+
# Merge approved changes
|
135
|
+
git checkout main
|
136
|
+
git merge swarm/backend-20240628-143022
|
137
|
+
git merge swarm/frontend-20240628-143025
|
138
|
+
|
139
|
+
# Clean up
|
140
|
+
git worktree remove .worktree_ux_1234
|
141
|
+
```
|
142
|
+
|
143
|
+
## Advanced Patterns
|
144
|
+
|
145
|
+
### Custom Agent for Rails
|
146
|
+
|
147
|
+
Add to `.enhance_swarm.yml`:
|
148
|
+
|
149
|
+
```yaml
|
150
|
+
agents:
|
151
|
+
rails_migration_expert:
|
152
|
+
focus: "Database migrations and schema design"
|
153
|
+
trigger_keywords: ["migration", "schema", "index", "foreign key"]
|
154
|
+
|
155
|
+
hotwire_specialist:
|
156
|
+
focus: "Turbo frames, streams, and Stimulus controllers"
|
157
|
+
trigger_keywords: ["turbo", "stimulus", "hotwire", "real-time"]
|
158
|
+
```
|
159
|
+
|
160
|
+
### Pre-flight Checks
|
161
|
+
|
162
|
+
Create `.claude/hooks/pre-enhance.rb`:
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
#!/usr/bin/env ruby
|
166
|
+
|
167
|
+
# Check database is migrated
|
168
|
+
unless system("bundle exec rails db:migrate:status | grep -q down")
|
169
|
+
puts "ā
Database is up to date"
|
170
|
+
else
|
171
|
+
puts "ā Pending migrations detected!"
|
172
|
+
exit 1
|
173
|
+
end
|
174
|
+
|
175
|
+
# Check tests are passing
|
176
|
+
unless system("bundle exec rails test")
|
177
|
+
puts "ā Tests must pass before enhancement!"
|
178
|
+
exit 1
|
179
|
+
end
|
180
|
+
|
181
|
+
puts "ā
Pre-flight checks passed!"
|
182
|
+
```
|
183
|
+
|
184
|
+
### Task Templates
|
185
|
+
|
186
|
+
Create reusable task templates in `tasks/templates/`:
|
187
|
+
|
188
|
+
```markdown
|
189
|
+
# Feature: <%= feature_name %>
|
190
|
+
|
191
|
+
## Description
|
192
|
+
<%= feature_description %>
|
193
|
+
|
194
|
+
## User Story
|
195
|
+
As a <%= user_type %>
|
196
|
+
I want to <%= user_goal %>
|
197
|
+
So that <%= user_benefit %>
|
198
|
+
|
199
|
+
## Acceptance Criteria
|
200
|
+
- [ ] <%= criterion_1 %>
|
201
|
+
- [ ] <%= criterion_2 %>
|
202
|
+
- [ ] <%= criterion_3 %>
|
203
|
+
|
204
|
+
## Technical Requirements
|
205
|
+
- Models: <%= required_models %>
|
206
|
+
- Controllers: <%= required_controllers %>
|
207
|
+
- Services: <%= required_services %>
|
208
|
+
- Jobs: <%= background_jobs %>
|
209
|
+
|
210
|
+
## Testing Requirements
|
211
|
+
- Unit tests for all models and services
|
212
|
+
- System tests for user flows
|
213
|
+
- API tests if applicable
|
214
|
+
|
215
|
+
## Estimated Hours: <%= estimate %>
|
216
|
+
```
|
217
|
+
|
218
|
+
## Tips for Rails Projects
|
219
|
+
|
220
|
+
1. **Database Migrations**: Agents will create migrations - review them before running
|
221
|
+
2. **Background Jobs**: Ensure Redis is running if using Sidekiq
|
222
|
+
3. **Asset Pipeline**: Agents understand Propshaft/Sprockets
|
223
|
+
4. **Testing**: Agents use Rails testing conventions by default
|
224
|
+
5. **Multi-tenancy**: Configure tenant switching in test setup
|
225
|
+
|
226
|
+
## Troubleshooting
|
227
|
+
|
228
|
+
### Gemfile Conflicts
|
229
|
+
If agents modify Gemfile:
|
230
|
+
```bash
|
231
|
+
cd .worktree_backend_1234
|
232
|
+
bundle install
|
233
|
+
# Resolve conflicts
|
234
|
+
git add Gemfile.lock
|
235
|
+
git commit --amend
|
236
|
+
```
|
237
|
+
|
238
|
+
### Database Issues
|
239
|
+
Agents create migrations but don't run them:
|
240
|
+
```bash
|
241
|
+
# In main branch after merging
|
242
|
+
bundle exec rails db:migrate
|
243
|
+
bundle exec rails db:test:prepare
|
244
|
+
```
|
245
|
+
|
246
|
+
### Test Failures
|
247
|
+
Each agent runs tests in isolation:
|
248
|
+
```bash
|
249
|
+
# Check test results in worktree
|
250
|
+
cd .worktree_qa_5678
|
251
|
+
bundle exec rails test
|
252
|
+
# Fix any issues before merging
|
253
|
+
```
|
data/exe/enhance-swarm
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'enhance_swarm'
|
5
|
+
|
6
|
+
# Setup signal handling for graceful shutdown
|
7
|
+
EnhanceSwarm::SignalHandler.setup
|
8
|
+
|
9
|
+
# Initialize structured logging
|
10
|
+
if ENV['ENHANCE_SWARM_JSON_LOGS'] == 'true'
|
11
|
+
EnhanceSwarm::Logger.info("Starting EnhanceSwarm v#{EnhanceSwarm::VERSION} with JSON logging")
|
12
|
+
end
|
13
|
+
|
14
|
+
begin
|
15
|
+
EnhanceSwarm::CLI.start(ARGV)
|
16
|
+
rescue Interrupt
|
17
|
+
# Handle Ctrl+C gracefully
|
18
|
+
puts "\nš Operation cancelled by user"
|
19
|
+
exit(1)
|
20
|
+
rescue StandardError => e
|
21
|
+
EnhanceSwarm::Logger.error("Unhandled error: #{e.message}")
|
22
|
+
EnhanceSwarm::Logger.error("Backtrace: #{e.backtrace.join("\n")}")
|
23
|
+
|
24
|
+
if ENV['ENHANCE_SWARM_DEBUG'] == 'true'
|
25
|
+
raise
|
26
|
+
else
|
27
|
+
puts "ā An error occurred. Run with ENHANCE_SWARM_DEBUG=true for details.".colorize(:red)
|
28
|
+
exit(1)
|
29
|
+
end
|
30
|
+
end
|