prd-parser 0.2.1 → 0.3.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.
Files changed (2) hide show
  1. package/README.md +274 -10
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -117,6 +117,8 @@ task operations without context-switching to a GUI.
117
117
  prd-parser parse docs/prd.md
118
118
  ```
119
119
 
120
+ Full context mode is enabled by default - every generation stage has access to your original PRD, producing the most coherent results.
121
+
120
122
  That's it. Your PRD is now a structured beads project with **readable hierarchical IDs**:
121
123
 
122
124
  ```bash
@@ -230,6 +232,9 @@ Issues are linked with proper blocking relationships:
230
232
  ### Parse Options
231
233
 
232
234
  ```bash
235
+ # Basic parse (full context mode is on by default)
236
+ prd-parser parse ./prd.md
237
+
233
238
  # Control structure size
234
239
  prd-parser parse ./prd.md --epics 5 --tasks 8 --subtasks 4
235
240
 
@@ -242,8 +247,12 @@ prd-parser parse ./prd.md --testing comprehensive # or minimal, standard
242
247
  # Preview without creating (dry run)
243
248
  prd-parser parse ./prd.md --dry-run
244
249
 
245
- # Include/exclude sections in issue descriptions
246
- prd-parser parse ./prd.md --include-context --include-testing
250
+ # Save/resume from checkpoint (useful for large PRDs)
251
+ prd-parser parse ./prd.md --save-json checkpoint.json
252
+ prd-parser parse --from-json checkpoint.json
253
+
254
+ # Disable full context mode (not recommended)
255
+ prd-parser parse ./prd.md --full-context=false
247
256
  ```
248
257
 
249
258
  ### Full Options
@@ -257,17 +266,20 @@ prd-parser parse ./prd.md --include-context --include-testing
257
266
  | `--testing` | | comprehensive | Testing level (minimal/standard/comprehensive) |
258
267
  | `--llm` | `-l` | auto | LLM provider (auto/claude-cli/codex-cli/anthropic-api) |
259
268
  | `--model` | `-m` | | Model to use (provider-specific) |
260
- | `--multi-stage` | | | Force multi-stage parsing |
261
- | `--single-shot` | | | Force single-shot parsing |
269
+ | `--multi-stage` | | false | Force multi-stage parsing |
270
+ | `--single-shot` | | false | Force single-shot parsing |
262
271
  | `--smart-threshold` | | 300 | Line count for auto multi-stage (0 to disable) |
272
+ | `--full-context` | | **true** | Pass PRD to all stages (use `=false` to disable) |
263
273
  | `--validate` | | false | Run validation pass to check for gaps |
274
+ | `--no-review` | | false | Disable automatic LLM review pass (review ON by default) |
275
+ | `--interactive` | | false | Human-in-the-loop mode (review epics before task generation) |
264
276
  | `--subtask-model` | | | Model for subtasks in multi-stage (can be faster/cheaper) |
265
277
  | `--output` | `-o` | beads | Output adapter (beads/json) |
266
278
  | `--output-path` | | | Output path for JSON adapter |
267
- | `--working-dir` | `-w` | . | Working directory for beads |
268
279
  | `--dry-run` | | false | Preview without creating items |
269
- | `--include-context` | | true | Include context in descriptions |
270
- | `--include-testing` | | true | Include testing requirements |
280
+ | `--from-json` | | | Resume from saved JSON checkpoint (skip LLM) |
281
+ | `--save-json` | | | Save generated JSON to file (for resume) |
282
+ | `--config` | | | Config file path (default: .prd-parser.yaml) |
271
283
 
272
284
  ### Smart Parsing (Default Behavior)
273
285
 
@@ -278,6 +290,96 @@ prd-parser automatically chooses the best parsing strategy based on PRD size:
278
290
 
279
291
  Override with `--single-shot` or `--multi-stage` flags, or adjust threshold with `--smart-threshold`.
280
292
 
293
+ ### Full Context Mode (Default)
294
+
295
+ Full context mode is **enabled by default**. Every stage gets the original PRD as their "north star":
296
+
297
+ ```bash
298
+ prd-parser parse docs/prd.md # full context is on by default
299
+ ```
300
+
301
+ To disable (not recommended):
302
+ ```bash
303
+ prd-parser parse docs/prd.md --full-context=false
304
+ ```
305
+
306
+ **Why this matters:**
307
+
308
+ | Mode | Stage 1 (Epics) | Stage 2 (Tasks) | Stage 3 (Subtasks) |
309
+ |------|----------------|-----------------|-------------------|
310
+ | Default | Full PRD | Epic summary only | Task summary only |
311
+ | `--full-context` | Full PRD | Epic + **PRD** | Task + **PRD** |
312
+
313
+ With `--full-context`, each agent:
314
+ - Stays grounded in original requirements
315
+ - Doesn't invent features not in the PRD
316
+ - Doesn't miss requirements that ARE in the PRD
317
+ - Produces more focused, coherent output
318
+
319
+ **Results comparison** (same PRD):
320
+
321
+ | Metric | Default | Full Context |
322
+ |--------|---------|--------------|
323
+ | Epics | 11 | 8 |
324
+ | Tasks | 65 | 49 |
325
+ | Subtasks | 264 | 202 |
326
+
327
+ Fewer items with full context = less redundancy, more focused on actual requirements.
328
+
329
+ ### Common Flag Combinations
330
+
331
+ **Standard parse (full context on by default):**
332
+ ```bash
333
+ prd-parser parse docs/prd.md
334
+ ```
335
+ Every stage sees the PRD. Best for accuracy and coherence.
336
+
337
+ **Preview before committing:**
338
+ ```bash
339
+ prd-parser parse docs/prd.md --dry-run
340
+ ```
341
+ See what would be created without actually creating issues.
342
+
343
+ **Save checkpoint for manual review:**
344
+ ```bash
345
+ prd-parser parse docs/prd.md --save-json draft.json --dry-run
346
+ # Edit draft.json manually
347
+ prd-parser parse --from-json draft.json
348
+ ```
349
+
350
+ **Human-in-the-loop for large/complex PRDs:**
351
+ ```bash
352
+ prd-parser parse docs/prd.md --interactive
353
+ ```
354
+ Review and edit epics before task generation.
355
+
356
+ **Quick parse for small PRDs:**
357
+ ```bash
358
+ prd-parser parse docs/prd.md --single-shot
359
+ ```
360
+ Faster single LLM call. Works well for PRDs under 300 lines.
361
+
362
+ **Cost-optimized for large PRDs:**
363
+ ```bash
364
+ prd-parser parse docs/prd.md --subtask-model claude-sonnet-4-20250514
365
+ ```
366
+ Use Opus for epics/tasks, Sonnet for subtasks (cheaper, still good quality).
367
+
368
+ **Maximum validation:**
369
+ ```bash
370
+ prd-parser parse docs/prd.md --validate
371
+ ```
372
+ Full context + validation pass to catch gaps.
373
+
374
+ **Debug/iterate on structure:**
375
+ ```bash
376
+ prd-parser parse docs/prd.md --save-json iter1.json --dry-run
377
+ # Review iter1.json, note issues
378
+ prd-parser parse docs/prd.md --save-json iter2.json --dry-run
379
+ # Compare, pick the better one
380
+ prd-parser parse --from-json iter2.json
381
+ ```
382
+
281
383
  ### Validation Pass
282
384
 
283
385
  Use `--validate` to run a final review that checks for gaps in the generated plan:
@@ -304,6 +406,164 @@ or
304
406
  • Auth API built but no login page to test it
305
407
  ```
306
408
 
409
+ ### Review Pass (Default)
410
+
411
+ By default, prd-parser runs an automatic review pass after generation that checks for and fixes structural issues:
412
+
413
+ - **Missing "Project Foundation" epic** as Epic 1 (setup should come first)
414
+ - **Feature epics not depending on Epic 1** (all work depends on setup)
415
+ - **Missing setup tasks** in foundation epic
416
+ - **Incorrect dependency chains** (setup → backend → frontend)
417
+
418
+ ```bash
419
+ # Review is on by default
420
+ prd-parser parse ./prd.md
421
+
422
+ # See: "Reviewing structure..."
423
+ # See: "✓ Review fixed issues: Added Project Foundation epic..."
424
+ # Or: "✓ Review passed - no changes needed"
425
+
426
+ # Disable if you want raw output
427
+ prd-parser parse ./prd.md --no-review
428
+ ```
429
+
430
+ ### Interactive Mode
431
+
432
+ For human-in-the-loop review during generation:
433
+
434
+ ```bash
435
+ prd-parser parse docs/prd.md --interactive
436
+ ```
437
+
438
+ In interactive mode, you'll review epics after Stage 1 before task generation continues:
439
+
440
+ ```
441
+ === Stage 1 Complete: 4 Epics Generated ===
442
+
443
+ Proposed Epics:
444
+ 1. Project Foundation (depends on: none)
445
+ Initialize Next.js, Convex, Clerk setup
446
+ 2. Voice Infrastructure (depends on: 1)
447
+ Telnyx phone system integration
448
+ 3. AI Conversations (depends on: 1)
449
+ LFM 2.5 integration for call handling
450
+ 4. CRM Integration (depends on: 1)
451
+ Follow Up Boss sync
452
+
453
+ [Enter] continue, [e] edit in $EDITOR, [r] regenerate, [a] add epic:
454
+ ```
455
+
456
+ **Options:**
457
+ - **Enter** - Accept epics and continue to task generation
458
+ - **e** - Open epics in your `$EDITOR` for manual editing
459
+ - **r** - Regenerate epics from scratch
460
+ - **a** - Add a new epic
461
+
462
+ Interactive mode skips the automatic review pass since you are the reviewer.
463
+
464
+ ### Checkpoint Workflow (Manual Review)
465
+
466
+ For full manual control over the generated structure:
467
+
468
+ **Step 1: Generate Draft**
469
+ ```bash
470
+ prd-parser parse docs/prd.md --save-json draft.json --dry-run
471
+ ```
472
+
473
+ **Step 2: Review and Edit**
474
+
475
+ Open `draft.json` in your editor. You can:
476
+ - Reorder epics (change array order)
477
+ - Add/remove epics, tasks, or subtasks
478
+ - Fix dependencies
479
+ - Adjust priorities and estimates
480
+
481
+ **Step 3: Create from Edited Draft**
482
+ ```bash
483
+ prd-parser parse --from-json draft.json
484
+ ```
485
+
486
+ The PRD file argument is optional when using `--from-json`.
487
+
488
+ **Auto-Recovery**: If creation fails mid-way, prd-parser saves a checkpoint to `/tmp/prd-parser-checkpoint.json`. Retry with:
489
+ ```bash
490
+ prd-parser parse --from-json /tmp/prd-parser-checkpoint.json
491
+ ```
492
+
493
+ ## Refining Issues After Generation
494
+
495
+ After parsing, you may find issues that are misaligned with your product vision. The `refine` command lets you correct an issue and automatically propagate fixes to related issues.
496
+
497
+ ### Basic Usage
498
+
499
+ ```bash
500
+ # Correct an epic that went off-track
501
+ prd-parser refine test-e6 --feedback "RealHerd is voice-first lead intelligence, not a CRM with pipeline management"
502
+
503
+ # Preview changes without applying
504
+ prd-parser refine test-e3t2 --feedback "Should use OpenRouter, not direct OpenAI" --dry-run
505
+
506
+ # Include PRD for better context
507
+ prd-parser refine test-e6 --feedback "Focus on conversation insights" --prd docs/prd.md
508
+ ```
509
+
510
+ ### How It Works
511
+
512
+ 1. **Analyze**: LLM identifies wrong concepts in the target issue (e.g., "pipeline tracking", "deal stages")
513
+ 2. **Correct**: Generates corrected version with right concepts ("conversation insights", "activity visibility")
514
+ 3. **Scan**: Searches ALL issues (across all epics) for the same wrong concepts
515
+ 4. **Propagate**: Regenerates affected issues with correction context
516
+ 5. **Update**: Applies changes via `bd update`
517
+
518
+ ### Options
519
+
520
+ | Flag | Default | Description |
521
+ |------|---------|-------------|
522
+ | `--feedback`, `-f` | required | What's wrong and how to fix it |
523
+ | `--cascade` | true | Also update children of target issue |
524
+ | `--scan-all` | true | Scan all issues for same misalignment |
525
+ | `--dry-run` | false | Preview changes without applying |
526
+ | `--prd` | | Path to PRD file for context |
527
+
528
+ ### Example Output
529
+
530
+ ```
531
+ $ prd-parser refine test-e6 --feedback "RealHerd is voice-first, not CRM"
532
+
533
+ Loading issue test-e6...
534
+ Found: Brokerage Dashboard & Reporting
535
+
536
+ Analyzing misalignment...
537
+
538
+ Identified misalignment:
539
+ - pipeline tracking
540
+ - deal management
541
+ - contract stages
542
+
543
+ Corrected version:
544
+ Title: Agent Activity Dashboard & Conversation Insights
545
+ Description: Real-time visibility into agent conversations...
546
+
547
+ Scanning for affected issues...
548
+ Found 3 children
549
+ Found 2 issues with similar misalignment
550
+
551
+ --- Changes to apply ---
552
+ Target: test-e6
553
+ + test-e6t3: Pipeline Overview Component
554
+ + test-e6t4: Deal Tracking Interface
555
+ + test-e3t5: CRM Pipeline Sync
556
+
557
+ Applying corrections...
558
+ ✓ Updated test-e6
559
+ ✓ Updated test-e6t3
560
+ ✓ Updated test-e6t4
561
+ ✓ Updated test-e3t5
562
+
563
+ --- Summary ---
564
+ Updated: 1 target + 4 related issues
565
+ ```
566
+
307
567
  ## LLM Providers
308
568
 
309
569
  ### Zero-Config (Recommended)
@@ -396,14 +656,18 @@ prd-parser/
396
656
  ├── internal/
397
657
  │ ├── core/ # Core types and orchestration
398
658
  │ │ ├── types.go # Hierarchical structs (guardrails)
399
- │ │ ├── prompts.go # Embedded system/user prompts
400
- │ │ └── parser.go # LLM Output orchestration
659
+ │ │ ├── prompts.go # Single-shot system/user prompts
660
+ │ │ ├── stage_prompts.go # Multi-stage prompts (Stages 1-3)
661
+ │ │ ├── parser.go # Single-shot LLM → Output orchestration
662
+ │ │ ├── multistage.go # Multi-stage parallel parser
663
+ │ │ └── validate.go # Validation pass logic
401
664
  │ ├── llm/ # LLM adapters
402
665
  │ │ ├── adapter.go # Interface definition
403
666
  │ │ ├── claude_cli.go # Claude Code CLI adapter
404
667
  │ │ ├── codex_cli.go # Codex CLI adapter
405
668
  │ │ ├── anthropic_api.go # API fallback
406
- │ │ └── detector.go # Auto-detection logic
669
+ │ │ ├── detector.go # Auto-detection logic
670
+ │ │ └── multistage_generator.go # Multi-stage LLM calls
407
671
  │ └── output/ # Output adapters
408
672
  │ ├── adapter.go # Interface definition
409
673
  │ ├── beads.go # beads issue tracker
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prd-parser",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "Turn your PRD into a ready-to-work beads project in one command",
5
5
  "keywords": [
6
6
  "prd",