-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathralph-spawn.js
More file actions
152 lines (121 loc) · 4.23 KB
/
ralph-spawn.js
File metadata and controls
152 lines (121 loc) · 4.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/usr/bin/env node
/**
* Ralph Spawn - Launch sub-agent for Liquid Memory development
* Usage: node ralph-spawn.js [US-NUMBER]
*/
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
const PROJECT_DIR = '/home/admin/clawd/projects/aigc-creative-studio';
// Read current progress
function getNextTask() {
const progressPath = path.join(PROJECT_DIR, 'PROGRESS.md');
const content = fs.readFileSync(progressPath, 'utf8');
// Find first incomplete US (🔄 or ⏳)
const match = content.match(/#### (🔄|⏳) (US-\d+): (.+)/);
if (!match) return null;
return {
id: match[2],
status: match[1] === '🔄' ? 'in_progress' : 'pending',
title: match[3].trim()
};
}
// Generate task prompt for specific US
function generatePrompt(usId) {
const prompts = {
'US-003': `You are working on Liquid Memory project at ${PROJECT_DIR}
**Current Task**: US-003 - Local File Storage and Thumbnail Generation
**Read First**:
1. agents/prd.json - Find US-003 acceptance criteria
2. IMPLEMENTATION_PLAN.md - Check current status
3. AGENTS.md - Build instructions
**US-003 Acceptance Criteria**:
- Implement drag-and-drop file upload component
- Generate thumbnails (max 300px) using canvas
- Store original images in local filesystem
- Store thumbnail paths in metadata
- Handle jpg/png/webp formats
- Show upload progress and preview
- Typecheck passes
**Implementation Steps**:
1. Create components/upload/ directory
2. Create DragDropUpload.tsx component
3. Create thumbnail generation utility (lib/thumbnail.ts)
4. Create file storage utility (lib/storage.ts)
5. Add to main page for testing
6. Run typecheck
**After completion**:
1. Update PROGRESS.md - mark US-003 complete
2. Update IMPLEMENTATION_PLAN.md
3. Commit: git add . && git commit -m "feat: US-003 implement file upload and thumbnail generation"
4. Push: git push origin master
Start now!`,
'US-004': `You are working on Liquid Memory project at ${PROJECT_DIR}
**Current Task**: US-004 - VL API Integration for Image Analysis
**Read First**:
1. agents/prd.json - Find US-004 acceptance criteria
2. IMPLEMENTATION_PLAN.md - Check current status
3. AGENTS.md - Build instructions
4. app/api/analyze/route.ts - Existing API route
**US-004 Acceptance Criteria**:
- Send image to /api/analyze endpoint
- Parse response into structured format
- Extract 8 dimensions from PRD
- Error handling with user-friendly messages
- Loading state during analysis
- Cache results
- Typecheck passes
**Implementation Steps**:
1. Create lib/api.ts for frontend API client
2. Create hooks/useAnalyze.ts for analysis logic
3. Create components/analyze/AnalysisResult.tsx to display results
4. Integrate with upload component
5. Run typecheck
**After completion**:
1. Update PROGRESS.md - mark US-004 complete
2. Update IMPLEMENTATION_PLAN.md
3. Commit: git add . && git commit -m "feat: US-004 integrate VL API for image analysis"
4. Push: git push origin master
Start now!`,
'default': `You are working on Liquid Memory project at ${PROJECT_DIR}
**Current Task**: ${usId}
**Read First**:
1. agents/prd.json - Find ${usId} acceptance criteria
2. IMPLEMENTATION_PLAN.md - Check current status
3. AGENTS.md - Build instructions
4. PROGRESS.md - Current progress
**Implementation**:
1. Implement the feature according to acceptance criteria
2. Run typecheck
3. Test the functionality
**After completion**:
1. Update PROGRESS.md - mark ${usId} complete
2. Update IMPLEMENTATION_PLAN.md
3. Commit with clear message
4. Push: git push origin master
Start now!`
};
return prompts[usId] || prompts['default'];
}
// Main
function main() {
const usId = process.argv[2];
if (!usId) {
const nextTask = getNextTask();
if (!nextTask) {
console.log('✅ All tasks completed!');
process.exit(0);
}
console.log(`Next task: ${nextTask.id} - ${nextTask.title}`);
console.log('\nRun: node ralph-spawn.js ' + nextTask.id);
process.exit(0);
}
const prompt = generatePrompt(usId);
console.log(`🚀 Spawning sub-agent for ${usId}...`);
console.log('\n=== TASK PROMPT ===\n');
console.log(prompt);
console.log('\n==================\n');
console.log('Copy the above prompt and run:');
console.log(' sessions_spawn with this task');
}
main();