ralph-cli-sandboxed 0.4.2 → 0.5.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.
- package/dist/commands/chat.js +45 -15
- package/dist/commands/fix-prd.js +48 -24
- package/dist/commands/help.js +11 -3
- package/dist/commands/init.js +8 -7
- package/dist/commands/prd-convert.d.ts +9 -0
- package/dist/commands/prd-convert.js +108 -0
- package/dist/commands/prd.d.ts +2 -1
- package/dist/commands/prd.js +206 -37
- package/dist/commands/prompt.js +1 -1
- package/dist/commands/run.js +42 -43
- package/dist/index.js +6 -2
- package/dist/templates/prompts.d.ts +1 -0
- package/dist/templates/prompts.js +8 -1
- package/dist/utils/config.d.ts +19 -0
- package/dist/utils/config.js +85 -5
- package/dist/utils/prd-validator.d.ts +21 -2
- package/dist/utils/prd-validator.js +61 -8
- package/docs/HOW-TO-WRITE-PRDs.md +90 -108
- package/docs/PRD-GENERATOR.md +166 -96
- package/docs/RALPH-SETUP-TEMPLATE.md +1 -1
- package/package.json +3 -2
package/docs/PRD-GENERATOR.md
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
# PRD Generator Guide
|
|
2
2
|
|
|
3
|
-
This guide explains how to convert any document (specs, user stories, detailed PRDs) into a `prd.
|
|
3
|
+
This guide explains how to convert any document (specs, user stories, detailed PRDs) into a `prd.yaml` file that Ralph can execute.
|
|
4
|
+
|
|
5
|
+
> **Note:** Ralph now supports YAML format (recommended) and JSON format (legacy). New projects should use `prd.yaml`. Existing projects can migrate using `ralph prd convert`.
|
|
4
6
|
|
|
5
7
|
## Overview
|
|
6
8
|
|
|
7
9
|
Ralph's PRD format is intentionally simple - each item should be completable in a single AI iteration. The challenge is converting complex, multi-level documents into this flat, actionable format.
|
|
8
10
|
|
|
11
|
+
```yaml
|
|
12
|
+
- category: feature
|
|
13
|
+
description: Imperative description of what to implement
|
|
14
|
+
steps:
|
|
15
|
+
- Concrete action 1
|
|
16
|
+
- Concrete action 2
|
|
17
|
+
- Verification step
|
|
18
|
+
passes: false
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
<details>
|
|
22
|
+
<summary>JSON format (legacy)</summary>
|
|
23
|
+
|
|
9
24
|
```json
|
|
10
25
|
{
|
|
11
26
|
"category": "feature",
|
|
@@ -18,6 +33,7 @@ Ralph's PRD format is intentionally simple - each item should be completable in
|
|
|
18
33
|
"passes": false
|
|
19
34
|
}
|
|
20
35
|
```
|
|
36
|
+
</details>
|
|
21
37
|
|
|
22
38
|
## Input Document Types
|
|
23
39
|
|
|
@@ -148,30 +164,27 @@ Steps tell the AI **how** to implement and **how** to verify.
|
|
|
148
164
|
### Step Patterns by Category
|
|
149
165
|
|
|
150
166
|
**Feature:**
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
]
|
|
167
|
+
```yaml
|
|
168
|
+
steps:
|
|
169
|
+
- Create [file/component] with [functionality]
|
|
170
|
+
- Implement [specific behavior]
|
|
171
|
+
- Run [test/build command] and verify success
|
|
157
172
|
```
|
|
158
173
|
|
|
159
174
|
**Bugfix:**
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
]
|
|
175
|
+
```yaml
|
|
176
|
+
steps:
|
|
177
|
+
- Identify root cause of [bug] in [location]
|
|
178
|
+
- Fix by [specific change]
|
|
179
|
+
- Add test case for regression, run tests
|
|
166
180
|
```
|
|
167
181
|
|
|
168
182
|
**Setup:**
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
]
|
|
183
|
+
```yaml
|
|
184
|
+
steps:
|
|
185
|
+
- Run [init/install command]
|
|
186
|
+
- Configure [settings] in [file]
|
|
187
|
+
- Verify with [check command]
|
|
175
188
|
```
|
|
176
189
|
|
|
177
190
|
## Referencing External Documents
|
|
@@ -179,15 +192,12 @@ Steps tell the AI **how** to implement and **how** to verify.
|
|
|
179
192
|
When your source document has code examples or detailed specs, reference them instead of copying:
|
|
180
193
|
|
|
181
194
|
### Good
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
"Run `go build ./...` and verify compilation"
|
|
189
|
-
]
|
|
190
|
-
}
|
|
195
|
+
```yaml
|
|
196
|
+
- description: Implement WebSocket transport (Task 4.4.1)
|
|
197
|
+
steps:
|
|
198
|
+
- Create internal/mcp/transport/websocket.go with WebSocketTransport struct
|
|
199
|
+
- Follow implementation pattern in lazymcp-prd.md section 4.4.1
|
|
200
|
+
- Run `go build ./...` and verify compilation
|
|
191
201
|
```
|
|
192
202
|
|
|
193
203
|
### Why Reference?
|
|
@@ -214,17 +224,14 @@ When your source document has code examples or detailed specs, reference them in
|
|
|
214
224
|
```
|
|
215
225
|
|
|
216
226
|
**Converted:**
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
],
|
|
226
|
-
"passes": false
|
|
227
|
-
}
|
|
227
|
+
```yaml
|
|
228
|
+
- category: feature
|
|
229
|
+
description: Implement stdio transport process management (Task 4.2.1)
|
|
230
|
+
steps:
|
|
231
|
+
- Create internal/mcp/transport/stdio.go with StdioTransport struct
|
|
232
|
+
- Manage subprocess with exec.Command, setup stdin/stdout/stderr pipes
|
|
233
|
+
- See lazymcp-prd.md section 4.2.1 for implementation details
|
|
234
|
+
passes: false
|
|
228
235
|
```
|
|
229
236
|
|
|
230
237
|
### Example 2: User Story
|
|
@@ -240,37 +247,30 @@ Acceptance criteria:
|
|
|
240
247
|
```
|
|
241
248
|
|
|
242
249
|
**Converted (3 items):**
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
"steps": [
|
|
268
|
-
"Validate token exists and not expired",
|
|
269
|
-
"Update user password with new value",
|
|
270
|
-
"Invalidate token, return success response"
|
|
271
|
-
],
|
|
272
|
-
"passes": false
|
|
273
|
-
}
|
|
250
|
+
```yaml
|
|
251
|
+
- category: feature
|
|
252
|
+
description: Add password reset request endpoint POST /api/auth/reset-request
|
|
253
|
+
steps:
|
|
254
|
+
- Create endpoint that accepts email address
|
|
255
|
+
- Generate secure token, store with expiry (1 hour)
|
|
256
|
+
- Queue email with reset link containing token
|
|
257
|
+
passes: false
|
|
258
|
+
|
|
259
|
+
- category: feature
|
|
260
|
+
description: Implement password reset email sending
|
|
261
|
+
steps:
|
|
262
|
+
- Create email template with reset link
|
|
263
|
+
- Integrate with email service (SendGrid/SES)
|
|
264
|
+
- Test email delivery in development
|
|
265
|
+
passes: false
|
|
266
|
+
|
|
267
|
+
- category: feature
|
|
268
|
+
description: Add password reset completion endpoint POST /api/auth/reset-complete
|
|
269
|
+
steps:
|
|
270
|
+
- Validate token exists and not expired
|
|
271
|
+
- Update user password with new value
|
|
272
|
+
- Invalidate token, return success response
|
|
273
|
+
passes: false
|
|
274
274
|
```
|
|
275
275
|
|
|
276
276
|
### Example 3: Bug Report
|
|
@@ -286,22 +286,49 @@ Steps to reproduce:
|
|
|
286
286
|
```
|
|
287
287
|
|
|
288
288
|
**Converted:**
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
],
|
|
298
|
-
"passes": false
|
|
299
|
-
}
|
|
289
|
+
```yaml
|
|
290
|
+
- category: bugfix
|
|
291
|
+
description: Fix crash when uploading files larger than 10MB
|
|
292
|
+
steps:
|
|
293
|
+
- Add file size validation before upload (max 10MB with clear error)
|
|
294
|
+
- Implement streaming upload for large files to avoid memory issues
|
|
295
|
+
- Test with 15MB file - should show error or stream successfully
|
|
296
|
+
passes: false
|
|
300
297
|
```
|
|
301
298
|
|
|
302
299
|
## AI Conversion Prompt
|
|
303
300
|
|
|
304
|
-
Use this prompt to have an AI convert documents to prd.
|
|
301
|
+
Use this prompt to have an AI convert documents to prd.yaml:
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
Convert the following document into a Ralph prd.yaml file.
|
|
305
|
+
|
|
306
|
+
Rules:
|
|
307
|
+
1. Each sub-task or atomic feature = one PRD item
|
|
308
|
+
2. Use categories: setup, feature, bugfix, refactor, docs, test, release, config, ui, integration
|
|
309
|
+
3. Descriptions: imperative verb + specific what + context
|
|
310
|
+
4. Steps: 2-4 concrete actions + verification step
|
|
311
|
+
5. Reference source document sections instead of copying code
|
|
312
|
+
6. Order items by logical execution sequence
|
|
313
|
+
7. Set all "passes: false"
|
|
314
|
+
|
|
315
|
+
Output format (YAML):
|
|
316
|
+
- category: ...
|
|
317
|
+
description: ...
|
|
318
|
+
steps:
|
|
319
|
+
- ...
|
|
320
|
+
- ...
|
|
321
|
+
- ...
|
|
322
|
+
passes: false
|
|
323
|
+
|
|
324
|
+
Document to convert:
|
|
325
|
+
---
|
|
326
|
+
[paste document here]
|
|
327
|
+
---
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
<details>
|
|
331
|
+
<summary>AI Prompt for JSON format (legacy)</summary>
|
|
305
332
|
|
|
306
333
|
```
|
|
307
334
|
Convert the following document into a Ralph prd.json file.
|
|
@@ -330,10 +357,11 @@ Document to convert:
|
|
|
330
357
|
[paste document here]
|
|
331
358
|
---
|
|
332
359
|
```
|
|
360
|
+
</details>
|
|
333
361
|
|
|
334
362
|
## Validation Checklist
|
|
335
363
|
|
|
336
|
-
After generating prd.
|
|
364
|
+
After generating prd.yaml, verify:
|
|
337
365
|
|
|
338
366
|
- [ ] Each item is completable in one AI iteration
|
|
339
367
|
- [ ] Descriptions start with imperative verbs
|
|
@@ -355,7 +383,7 @@ After generating prd.json, verify:
|
|
|
355
383
|
|
|
356
384
|
| Mistake | Problem | Fix |
|
|
357
385
|
|---------|---------|-----|
|
|
358
|
-
| Copy-pasting code into steps |
|
|
386
|
+
| Copy-pasting code into steps | PRD file too large, hard to read | Reference source document |
|
|
359
387
|
| Vague descriptions | AI doesn't know what to do | Be specific about what and where |
|
|
360
388
|
| Missing verification | No way to confirm completion | Add test/build/check step |
|
|
361
389
|
| Too many steps | Overwhelming, hard to track | Max 4-5 steps per item |
|
|
@@ -374,21 +402,19 @@ When running in Docker/Podman sandboxes, certain operations can cause the iterat
|
|
|
374
402
|
- Telemetry/update checks may timeout on restricted networks
|
|
375
403
|
|
|
376
404
|
**Bad:**
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
]
|
|
405
|
+
```yaml
|
|
406
|
+
steps:
|
|
407
|
+
- Create the component
|
|
408
|
+
- Run `npm run dev` and verify server starts on port 3000
|
|
409
|
+
- Open browser and check the page renders
|
|
383
410
|
```
|
|
384
411
|
|
|
385
412
|
**Good:**
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
]
|
|
413
|
+
```yaml
|
|
414
|
+
steps:
|
|
415
|
+
- Create the component
|
|
416
|
+
- Run `npm run build` and verify compilation succeeds
|
|
417
|
+
- Run `npm run lint` to check for errors
|
|
392
418
|
```
|
|
393
419
|
|
|
394
420
|
### Verification Alternatives
|
|
@@ -420,3 +446,47 @@ Be aware that sandboxed environments may have restricted network access:
|
|
|
420
446
|
}
|
|
421
447
|
}
|
|
422
448
|
```
|
|
449
|
+
|
|
450
|
+
## Migrating from JSON to YAML
|
|
451
|
+
|
|
452
|
+
If you have an existing `prd.json` file, you can migrate to YAML format using the convert command:
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
ralph prd convert
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
This will:
|
|
459
|
+
1. Read your `.ralph/prd.json` file
|
|
460
|
+
2. Convert it to YAML format
|
|
461
|
+
3. Write the result to `.ralph/prd.yaml`
|
|
462
|
+
4. Rename the original to `prd.json.pre-yaml` as a backup
|
|
463
|
+
|
|
464
|
+
### Migration Options
|
|
465
|
+
|
|
466
|
+
```bash
|
|
467
|
+
# Preview conversion without making changes
|
|
468
|
+
ralph prd convert --dry-run
|
|
469
|
+
|
|
470
|
+
# Overwrite existing prd.yaml if it exists
|
|
471
|
+
ralph prd convert --force
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### Reverting to JSON
|
|
475
|
+
|
|
476
|
+
If you need to revert to JSON format:
|
|
477
|
+
|
|
478
|
+
```bash
|
|
479
|
+
# Remove YAML file and restore JSON backup
|
|
480
|
+
rm .ralph/prd.yaml
|
|
481
|
+
mv .ralph/prd.json.pre-yaml .ralph/prd.json
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
### Why YAML?
|
|
485
|
+
|
|
486
|
+
YAML is now the recommended format for PRD files because:
|
|
487
|
+
- **More readable** - No quotes around strings, cleaner syntax
|
|
488
|
+
- **Easier to edit** - Simpler structure for manual edits
|
|
489
|
+
- **Better diffs** - Changes are easier to review in version control
|
|
490
|
+
- **Comments allowed** - You can add notes to your PRD items
|
|
491
|
+
|
|
492
|
+
Both formats work identically with Ralph. If both `prd.yaml` and `prd.json` exist, YAML takes precedence.
|
|
@@ -76,7 +76,7 @@ Set up a Ralph CLI project based on the configuration above.
|
|
|
76
76
|
- Configure notifications if selected (see Reference below)
|
|
77
77
|
- Configure daemon events if selected (see Reference below)
|
|
78
78
|
3. Regenerate Docker files: `ralph docker init <language>`
|
|
79
|
-
4. Create `.ralph/prd.
|
|
79
|
+
4. Create `.ralph/prd.yaml` with tasks based on the concept
|
|
80
80
|
5. Verify with `ralph list` and `ralph status`
|
|
81
81
|
6. Start daemon on host (if using notifications): `ralph daemon start`
|
|
82
82
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ralph-cli-sandboxed",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "AI-driven development automation CLI for Claude Code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"ink-text-input": "^6.0.0",
|
|
34
34
|
"openai": "^4.77.0",
|
|
35
35
|
"react": "^18.3.1",
|
|
36
|
-
"readline": "^1.3.0"
|
|
36
|
+
"readline": "^1.3.0",
|
|
37
|
+
"yaml": "^2.8.2"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@types/node": "^20.0.0",
|