agentic-loop 3.14.1 → 3.14.2
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.
- package/.claude/skills/idea/SKILL.md +56 -0
- package/.claude/skills/prd/SKILL.md +2 -0
- package/package.json +1 -1
- package/ralph/prd-check.sh +35 -8
- package/ralph/setup/quick-setup.sh +25 -12
- package/ralph/setup.sh +2 -1
- package/templates/config/fastmcp.json +6 -1
- package/templates/config/fullstack.json +8 -0
- package/templates/config/node.json +8 -0
- package/templates/config/python.json +8 -0
|
@@ -64,6 +64,12 @@ Help the user flesh out the idea through conversation:
|
|
|
64
64
|
- Caching needed? How fresh must data be?
|
|
65
65
|
- Database indexes: What will be queried/sorted frequently?
|
|
66
66
|
|
|
67
|
+
**Migration/Refactoring (IMPORTANT - ask if moving or restructuring code):**
|
|
68
|
+
- Source paths: Where does the code currently live?
|
|
69
|
+
- Destination paths: Where should it end up? (be explicit, not vague)
|
|
70
|
+
- Phases: What's the logical order? (move files → update imports → verify)
|
|
71
|
+
- Verification: What commands prove each phase worked?
|
|
72
|
+
|
|
67
73
|
### Step 3: Summarize Before Writing
|
|
68
74
|
|
|
69
75
|
When you have enough information, summarize what you've learned:
|
|
@@ -132,6 +138,36 @@ Once the user confirms, write the idea file:
|
|
|
132
138
|
- **Caching**: What can be cached? For how long?
|
|
133
139
|
- **Database**: What indexes are needed?
|
|
134
140
|
|
|
141
|
+
## Migration Mapping (if moving/restructuring code)
|
|
142
|
+
For refactoring or migration tasks, explicitly map source to destination:
|
|
143
|
+
|
|
144
|
+
| Source | Destination |
|
|
145
|
+
|--------|-------------|
|
|
146
|
+
| `~/Sites/old-project/src/` | `apps/new-location/src/` |
|
|
147
|
+
| `~/Sites/old-project/tests/` | `apps/new-location/tests/` |
|
|
148
|
+
|
|
149
|
+
## Phases & Verification
|
|
150
|
+
Break complex work into phases with explicit verification commands:
|
|
151
|
+
|
|
152
|
+
### Phase 1: [Name]
|
|
153
|
+
**What:** Description of what this phase accomplishes
|
|
154
|
+
**Exit Criteria:**
|
|
155
|
+
```bash
|
|
156
|
+
# These commands must pass before phase is complete
|
|
157
|
+
test -d apps/new-location/src
|
|
158
|
+
cd apps/new-location && uv run pytest -x
|
|
159
|
+
cd apps/new-location && npm run build
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Phase 2: [Name]
|
|
163
|
+
**What:** Description
|
|
164
|
+
**Exit Criteria:**
|
|
165
|
+
```bash
|
|
166
|
+
# Verification commands for phase 2
|
|
167
|
+
docker-compose config | grep -q 'service-name:'
|
|
168
|
+
curl -s http://localhost:8000/health | jq -e '.status == "ok"'
|
|
169
|
+
```
|
|
170
|
+
|
|
135
171
|
## UI Mockup (if applicable)
|
|
136
172
|
```
|
|
137
173
|
┌─────────────────────────────────┐
|
|
@@ -190,6 +226,26 @@ A good idea file has:
|
|
|
190
226
|
- **Specific solution** - Not vague ("improve UX") but concrete ("add inline validation")
|
|
191
227
|
- **Scope boundaries** - What's explicitly out of scope?
|
|
192
228
|
- **Architecture hints** - Where do files go? What patterns to follow?
|
|
229
|
+
- **Verification commands** - How do we know it worked? (executable commands, not prose)
|
|
230
|
+
|
|
231
|
+
### Migration/Refactoring Ideas
|
|
232
|
+
|
|
233
|
+
For ideas that involve moving or restructuring code, MUST include:
|
|
234
|
+
|
|
235
|
+
1. **Explicit path mapping** - Source → Destination for every directory
|
|
236
|
+
```
|
|
237
|
+
❌ "Move GOPA to apps folder"
|
|
238
|
+
✅ "~/Sites/gopa/src/gopa/ → apps/gopa/src/gopa/"
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
2. **Phase-based verification** - Each phase has exit criteria with commands
|
|
242
|
+
```
|
|
243
|
+
❌ "Verify everything still works"
|
|
244
|
+
✅ "cd apps/gopa && uv run pytest -x && uv run python -c 'from gopa.server import mcp'"
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
3. **Order of operations** - What must happen before what?
|
|
248
|
+
- Move files → Update imports → Update configs → Verify
|
|
193
249
|
|
|
194
250
|
### ASCII Art for UI
|
|
195
251
|
|
|
@@ -156,6 +156,7 @@ Does acceptanceCriteria include:
|
|
|
156
156
|
- Does `contextFiles` include the idea file (has ASCII mockups)?
|
|
157
157
|
- Does `contextFiles` include styleguide (if exists)?
|
|
158
158
|
- Is `testUrl` set?
|
|
159
|
+
- Is `mcp` set to `["playwright", "devtools"]`?
|
|
159
160
|
|
|
160
161
|
**Fix any issues you find:**
|
|
161
162
|
|
|
@@ -168,6 +169,7 @@ Does acceptanceCriteria include:
|
|
|
168
169
|
| List endpoint missing pagination | Add pagination criteria to acceptanceCriteria |
|
|
169
170
|
| Frontend missing contextFiles | Add idea file + styleguide paths |
|
|
170
171
|
| Frontend missing testUrl | Add URL from config |
|
|
172
|
+
| Frontend missing mcp | Add `"mcp": ["playwright", "devtools"]` |
|
|
171
173
|
|
|
172
174
|
### Step 7: Reorder if Needed
|
|
173
175
|
|
package/package.json
CHANGED
package/ralph/prd-check.sh
CHANGED
|
@@ -282,7 +282,7 @@ _validate_and_fix_stories() {
|
|
|
282
282
|
|
|
283
283
|
# Issue counters (bash 3.2 compatible - no associative arrays)
|
|
284
284
|
local cnt_no_tests=0 cnt_backend_curl=0 cnt_backend_contract=0
|
|
285
|
-
local cnt_frontend_tsc=0 cnt_frontend_url=0 cnt_frontend_context=0
|
|
285
|
+
local cnt_frontend_tsc=0 cnt_frontend_url=0 cnt_frontend_context=0 cnt_frontend_mcp=0
|
|
286
286
|
local cnt_auth_security=0 cnt_list_pagination=0 cnt_prose_steps=0
|
|
287
287
|
local cnt_migration_prereq=0 cnt_naming_convention=0 cnt_bare_pytest=0
|
|
288
288
|
|
|
@@ -355,7 +355,7 @@ _validate_and_fix_stories() {
|
|
|
355
355
|
fi
|
|
356
356
|
fi
|
|
357
357
|
|
|
358
|
-
# Check 3: Frontend needs testUrl and
|
|
358
|
+
# Check 3: Frontend needs testUrl, contextFiles, and mcp
|
|
359
359
|
if [[ "$story_type" == "frontend" ]]; then
|
|
360
360
|
local has_url
|
|
361
361
|
has_url=$(jq -r --arg id "$story_id" '.stories[] | select(.id==$id) | .testUrl // empty' "$prd_file")
|
|
@@ -370,6 +370,14 @@ _validate_and_fix_stories() {
|
|
|
370
370
|
story_issues+="missing contextFiles, "
|
|
371
371
|
cnt_frontend_context=$((cnt_frontend_context + 1))
|
|
372
372
|
fi
|
|
373
|
+
|
|
374
|
+
# Frontend must have mcp tools for browser verification
|
|
375
|
+
local mcp_tools
|
|
376
|
+
mcp_tools=$(jq -r --arg id "$story_id" '.stories[] | select(.id==$id) | .mcp // [] | length' "$prd_file")
|
|
377
|
+
if [[ "$mcp_tools" == "0" ]]; then
|
|
378
|
+
story_issues+="missing mcp (browser tools), "
|
|
379
|
+
cnt_frontend_mcp=$((cnt_frontend_mcp + 1))
|
|
380
|
+
fi
|
|
373
381
|
fi
|
|
374
382
|
|
|
375
383
|
# Check 4: Auth stories need security criteria
|
|
@@ -442,6 +450,7 @@ _validate_and_fix_stories() {
|
|
|
442
450
|
[[ $cnt_frontend_tsc -gt 0 ]] && echo " ${cnt_frontend_tsc}x frontend: add tsc/playwright"
|
|
443
451
|
[[ $cnt_frontend_url -gt 0 ]] && echo " ${cnt_frontend_url}x frontend: add testUrl"
|
|
444
452
|
[[ $cnt_frontend_context -gt 0 ]] && echo " ${cnt_frontend_context}x frontend: add contextFiles"
|
|
453
|
+
[[ $cnt_frontend_mcp -gt 0 ]] && echo " ${cnt_frontend_mcp}x frontend: add mcp browser tools"
|
|
445
454
|
[[ $cnt_auth_security -gt 0 ]] && echo " ${cnt_auth_security}x auth: add security criteria"
|
|
446
455
|
[[ $cnt_list_pagination -gt 0 ]] && echo " ${cnt_list_pagination}x list: add pagination"
|
|
447
456
|
[[ $cnt_migration_prereq -gt 0 ]] && echo " ${cnt_migration_prereq}x migration: add prerequisites (DB reset)"
|
|
@@ -467,27 +476,41 @@ _fix_stories_with_claude() {
|
|
|
467
476
|
local prd_file="$1"
|
|
468
477
|
local issues="$2"
|
|
469
478
|
|
|
479
|
+
# Read config values for context
|
|
480
|
+
local config_file="$RALPH_DIR/config.json"
|
|
481
|
+
local backend_url="" frontend_url=""
|
|
482
|
+
if [[ -f "$config_file" ]]; then
|
|
483
|
+
backend_url=$(jq -r '.urls.backend // .api.baseUrl // "http://localhost:8000"' "$config_file" 2>/dev/null)
|
|
484
|
+
frontend_url=$(jq -r '.urls.frontend // .playwright.baseUrl // "http://localhost:3000"' "$config_file" 2>/dev/null)
|
|
485
|
+
fi
|
|
486
|
+
|
|
470
487
|
local fix_prompt="Enhance test coverage for these stories. Output the COMPLETE updated prd.json.
|
|
471
488
|
|
|
472
489
|
STORIES TO OPTIMIZE:
|
|
473
490
|
$issues
|
|
474
491
|
|
|
492
|
+
CONFIG VALUES (use these):
|
|
493
|
+
- Backend URL: $backend_url (use as {config.urls.backend} in testSteps)
|
|
494
|
+
- Frontend URL: $frontend_url (use as {config.urls.frontend} in testUrl)
|
|
495
|
+
|
|
475
496
|
RULES:
|
|
476
497
|
1. Backend stories MUST have testSteps with curl commands that hit real endpoints
|
|
477
498
|
Example: curl -s -X POST {config.urls.backend}/api/users -d '...' | jq -e '.id'
|
|
478
499
|
2. Backend stories MUST have apiContract with endpoint, request, response
|
|
479
|
-
3. Frontend stories MUST have testUrl set to {config.urls.frontend}/page
|
|
500
|
+
3. Frontend stories MUST have testUrl set to {config.urls.frontend}/[page-path]
|
|
501
|
+
- Derive page path from story title (e.g., 'login form' → '/login', 'dashboard' → '/dashboard')
|
|
480
502
|
4. Frontend stories MUST have contextFiles array (include idea file path from originalContext)
|
|
481
|
-
5.
|
|
503
|
+
5. Frontend stories MUST have mcp array with browser tools: [\"playwright\", \"devtools\"]
|
|
504
|
+
6. Auth stories MUST have security acceptanceCriteria:
|
|
482
505
|
- Passwords hashed with bcrypt (cost 10+)
|
|
483
506
|
- Passwords NEVER in API responses
|
|
484
507
|
- Rate limiting on login attempts
|
|
485
|
-
|
|
508
|
+
7. List endpoints MUST have pagination acceptanceCriteria:
|
|
486
509
|
- Returns paginated results (max 100 per page)
|
|
487
510
|
- Accepts ?page=N&limit=N query params
|
|
488
|
-
|
|
511
|
+
8. Migration stories (creating alembic/versions, migrations/, or modifying models) MUST have prerequisites:
|
|
489
512
|
Example: \"prerequisites\": [{\"name\": \"Reset test DB\", \"command\": \"npm run db:reset:test\", \"when\": \"schema changes\"}]
|
|
490
|
-
|
|
513
|
+
9. Frontend/general stories that consume APIs MUST have notes about naming conventions:
|
|
491
514
|
Example: \"notes\": \"Transform API responses from snake_case to camelCase. Create typed interfaces with camelCase properties and map: const user = { userName: data.user_name }\"
|
|
492
515
|
|
|
493
516
|
CURRENT PRD:
|
|
@@ -591,7 +614,7 @@ validate_stories_quick() {
|
|
|
591
614
|
fi
|
|
592
615
|
fi
|
|
593
616
|
|
|
594
|
-
# Check 3: Frontend needs testUrl and
|
|
617
|
+
# Check 3: Frontend needs testUrl, contextFiles, and mcp
|
|
595
618
|
if [[ "$story_type" == "frontend" ]]; then
|
|
596
619
|
local has_url
|
|
597
620
|
has_url=$(jq -r --arg id "$story_id" '.stories[] | select(.id==$id) | .testUrl // empty' "$prd_file")
|
|
@@ -600,6 +623,10 @@ validate_stories_quick() {
|
|
|
600
623
|
local context_files
|
|
601
624
|
context_files=$(jq -r --arg id "$story_id" '.stories[] | select(.id==$id) | .contextFiles // [] | length' "$prd_file")
|
|
602
625
|
[[ "$context_files" == "0" ]] && issues+="$story_id: missing contextFiles, "
|
|
626
|
+
|
|
627
|
+
local mcp_tools
|
|
628
|
+
mcp_tools=$(jq -r --arg id "$story_id" '.stories[] | select(.id==$id) | .mcp // [] | length' "$prd_file")
|
|
629
|
+
[[ "$mcp_tools" == "0" ]] && issues+="$story_id: missing mcp, "
|
|
603
630
|
fi
|
|
604
631
|
|
|
605
632
|
# Check 4: Auth stories need security criteria
|
|
@@ -202,20 +202,33 @@ configure_mcp() {
|
|
|
202
202
|
# Create claude.json if it doesn't exist
|
|
203
203
|
[[ ! -f "$claude_json" ]] && echo '{}' > "$claude_json"
|
|
204
204
|
|
|
205
|
-
|
|
206
|
-
if jq -e '.mcpServers["chrome-devtools"]' "$claude_json" > /dev/null 2>&1; then
|
|
207
|
-
echo -e " ${DIM}Skipped: Chrome DevTools MCP already configured${NC}"
|
|
208
|
-
return
|
|
209
|
-
fi
|
|
205
|
+
local added_any=false
|
|
210
206
|
|
|
211
|
-
# Add Chrome
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
"
|
|
215
|
-
|
|
216
|
-
|
|
207
|
+
# Add Playwright MCP if not configured (uses chromium + headless to avoid Chrome conflicts)
|
|
208
|
+
if ! jq -e '.mcpServers["playwright"]' "$claude_json" > /dev/null 2>&1; then
|
|
209
|
+
local tmp=$(mktemp)
|
|
210
|
+
jq '.mcpServers["playwright"] = {
|
|
211
|
+
"command": "npx",
|
|
212
|
+
"args": ["-y", "@playwright/mcp@latest", "--browser", "chromium", "--headless"]
|
|
213
|
+
}' "$claude_json" > "$tmp" && mv "$tmp" "$claude_json"
|
|
214
|
+
echo -e " ${GREEN}${EMOJI_CHECK}${NC} Playwright MCP configured"
|
|
215
|
+
added_any=true
|
|
216
|
+
else
|
|
217
|
+
echo -e " ${DIM}Skipped: Playwright MCP already configured${NC}"
|
|
218
|
+
fi
|
|
217
219
|
|
|
218
|
-
|
|
220
|
+
# Add Chrome DevTools MCP if not configured
|
|
221
|
+
if ! jq -e '.mcpServers["chrome-devtools"]' "$claude_json" > /dev/null 2>&1; then
|
|
222
|
+
local tmp=$(mktemp)
|
|
223
|
+
jq '.mcpServers["chrome-devtools"] = {
|
|
224
|
+
"command": "npx",
|
|
225
|
+
"args": ["-y", "@anthropic-ai/mcp-server-chrome-devtools@0.0.5"]
|
|
226
|
+
}' "$claude_json" > "$tmp" && mv "$tmp" "$claude_json"
|
|
227
|
+
echo -e " ${GREEN}${EMOJI_CHECK}${NC} Chrome DevTools MCP configured"
|
|
228
|
+
added_any=true
|
|
229
|
+
else
|
|
230
|
+
echo -e " ${DIM}Skipped: Chrome DevTools MCP already configured${NC}"
|
|
231
|
+
fi
|
|
219
232
|
}
|
|
220
233
|
|
|
221
234
|
show_completion() {
|
package/ralph/setup.sh
CHANGED
|
@@ -586,13 +586,14 @@ setup_mcp() {
|
|
|
586
586
|
local added_any=false
|
|
587
587
|
|
|
588
588
|
# Add Playwright MCP if not configured
|
|
589
|
+
# Uses chromium + headless to avoid conflicts with user's Chrome session
|
|
589
590
|
if ! jq -e '.mcpServers["playwright"]' "$claude_json" > /dev/null 2>&1; then
|
|
590
591
|
echo "Configuring MCP servers..."
|
|
591
592
|
local tmp
|
|
592
593
|
tmp=$(mktemp)
|
|
593
594
|
jq '.mcpServers["playwright"] = {
|
|
594
595
|
"command": "npx",
|
|
595
|
-
"args": ["-y", "@playwright/mcp@latest"]
|
|
596
|
+
"args": ["-y", "@playwright/mcp@latest", "--browser", "chromium", "--headless"]
|
|
596
597
|
}' "$claude_json" > "$tmp" && mv "$tmp" "$claude_json"
|
|
597
598
|
echo " Added playwright MCP server (browser automation & testing)"
|
|
598
599
|
added_any=true
|