ralph-scaffold 1.0.0 → 1.0.1
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/package.json +3 -2
- package/public/ralph-scaffolder.jpg +0 -0
- package/readme.md +193 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ralph-scaffold",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "scripts to get you started using Ralph workflow",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ralph"
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"bin",
|
|
25
|
-
"scripts"
|
|
25
|
+
"scripts",
|
|
26
|
+
"public"
|
|
26
27
|
],
|
|
27
28
|
"scripts": {
|
|
28
29
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
Binary file
|
package/readme.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<img src="public/ralph-scaffolder.jpg" alt="Ralph Scaffolder" />
|
|
2
|
+
|
|
3
|
+
This ralph scaffolding script helps you quickly setup RALPH workflow
|
|
4
|
+
based on https://x.com/ryancarson/status/2008548371712135632
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
To scaffold ralph, just run this script within your project
|
|
8
|
+
```bin
|
|
9
|
+
npx ralph-scaffold
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
----
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### How It Works
|
|
16
|
+
A bash loop that:
|
|
17
|
+
Pipes a prompt into your AI agent
|
|
18
|
+
Agent picks the next story from prd.json
|
|
19
|
+
Agent implements it
|
|
20
|
+
Agent runs typecheck + tests
|
|
21
|
+
Agent commits if passing
|
|
22
|
+
Agent marks story done
|
|
23
|
+
Agent logs learnings
|
|
24
|
+
Loop repeats until done
|
|
25
|
+
|
|
26
|
+
### Memory persists only through:
|
|
27
|
+
Git commits
|
|
28
|
+
progress.txt (learnings)
|
|
29
|
+
prd.json (task status)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
scripts/ralph/
|
|
34
|
+
├── ralph.sh
|
|
35
|
+
├── prompt.md
|
|
36
|
+
├── prd.json
|
|
37
|
+
└── progress.txt
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## ralph.sh
|
|
41
|
+
|
|
42
|
+
The loop:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
#!/bin/bash
|
|
46
|
+
set -e
|
|
47
|
+
|
|
48
|
+
MAX_ITERATIONS=${1:-10}
|
|
49
|
+
SCRIPT_DIR="$(cd "$(dirname \
|
|
50
|
+
"${BASH_SOURCE[0]}")" && pwd)"
|
|
51
|
+
|
|
52
|
+
echo "🚀 Starting Ralph"
|
|
53
|
+
|
|
54
|
+
for i in $(seq 1 $MAX_ITERATIONS); do
|
|
55
|
+
echo "═══ Iteration $i ═══"
|
|
56
|
+
|
|
57
|
+
OUTPUT=$(cat "$SCRIPT_DIR/prompt.md" \
|
|
58
|
+
| claude --dangerously-skip-permissions 2>&1 \
|
|
59
|
+
| tee /dev/stderr) || true
|
|
60
|
+
|
|
61
|
+
if echo "$OUTPUT" | \
|
|
62
|
+
grep -q "<promise>COMPLETE</promise>"
|
|
63
|
+
then
|
|
64
|
+
echo "✅ Done!"
|
|
65
|
+
exit 0
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
sleep 2
|
|
69
|
+
done
|
|
70
|
+
|
|
71
|
+
echo "⚠️ Max iterations reached"
|
|
72
|
+
exit 1
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Make executable:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
chmod +x scripts/ralph/ralph.sh
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## prompt.md
|
|
83
|
+
Instructions for each iteration:
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
# Ralph Agent Instructions
|
|
87
|
+
|
|
88
|
+
## Your Task
|
|
89
|
+
|
|
90
|
+
1. Read `scripts/ralph/prd.json`
|
|
91
|
+
2. Read `scripts/ralph/progress.txt`
|
|
92
|
+
(check Codebase Patterns first)
|
|
93
|
+
3. Check you're on the correct branch
|
|
94
|
+
4. Pick highest priority story
|
|
95
|
+
where `passes: false`
|
|
96
|
+
5. Implement that ONE story
|
|
97
|
+
6. Run typecheck and tests
|
|
98
|
+
7. Update AGENTS.md files with learnings
|
|
99
|
+
8. Commit: `feat: [ID] - [Title]`
|
|
100
|
+
9. Update prd.json: `passes: true`
|
|
101
|
+
10. Append learnings to progress.txt
|
|
102
|
+
|
|
103
|
+
## Progress Format
|
|
104
|
+
|
|
105
|
+
APPEND to progress.txt:
|
|
106
|
+
|
|
107
|
+
## [Date] - [Story ID]
|
|
108
|
+
- What was implemented
|
|
109
|
+
- Files changed
|
|
110
|
+
- **Learnings:**
|
|
111
|
+
- Patterns discovered
|
|
112
|
+
- Gotchas encountered
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Codebase Patterns
|
|
116
|
+
|
|
117
|
+
Add reusable patterns to the TOP
|
|
118
|
+
of progress.txt:
|
|
119
|
+
|
|
120
|
+
## Codebase Patterns
|
|
121
|
+
- Migrations: Use IF NOT EXISTS
|
|
122
|
+
- React: useRef<Timeout | null>(null)
|
|
123
|
+
|
|
124
|
+
## Stop Condition
|
|
125
|
+
|
|
126
|
+
If ALL stories pass, reply:
|
|
127
|
+
<promise>COMPLETE</promise>
|
|
128
|
+
|
|
129
|
+
Otherwise end normally.
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## prd.json
|
|
133
|
+
Your task list:
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"branchName": "ralph/feature",
|
|
137
|
+
"userStories": [
|
|
138
|
+
{
|
|
139
|
+
"id": "US-001",
|
|
140
|
+
"title": "Add login form",
|
|
141
|
+
"acceptanceCriteria": [
|
|
142
|
+
"Email/password fields",
|
|
143
|
+
"Validates email format",
|
|
144
|
+
"typecheck passes"
|
|
145
|
+
],
|
|
146
|
+
"priority": 1,
|
|
147
|
+
"passes": false,
|
|
148
|
+
"notes": ""
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Key fields:
|
|
155
|
+
`branchName` — branch to use
|
|
156
|
+
`priority` — lower = first
|
|
157
|
+
`passes` — set true when done
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
## progress.txt
|
|
161
|
+
Start with context:
|
|
162
|
+
|
|
163
|
+
```markdown
|
|
164
|
+
# Ralph Progress Log
|
|
165
|
+
Started: 2024-01-15
|
|
166
|
+
|
|
167
|
+
## Codebase Patterns
|
|
168
|
+
- Migrations: IF NOT EXISTS
|
|
169
|
+
- Types: Export from actions.ts
|
|
170
|
+
|
|
171
|
+
## Key Files
|
|
172
|
+
- db/schema.ts
|
|
173
|
+
- app/auth/actions.ts
|
|
174
|
+
---
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
Ralph appends after each story.
|
|
179
|
+
Patterns accumulate across iterations.
|
|
180
|
+
|
|
181
|
+
## Running Ralph
|
|
182
|
+
|
|
183
|
+
run the ralph script with 25 iterations
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
./scripts/ralph/ralph.sh 25
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Ralph will:
|
|
190
|
+
- Create the feature branch
|
|
191
|
+
- Complete stories one by one
|
|
192
|
+
- Commit after each
|
|
193
|
+
- Stop when all pass
|