vralphy 0.1.2 → 0.3.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.
@@ -0,0 +1,808 @@
1
+ # Common Workflows
2
+
3
+ Practical workflows and patterns for using vralphy effectively.
4
+
5
+ ## Workflow Overview
6
+
7
+ | Workflow | Use Case | Commands |
8
+ |----------|----------|----------|
9
+ | New Feature | Build new functionality | spec → plan → build |
10
+ | Bug Fix | Fix reported bugs | Edit plan → build |
11
+ | Refactoring | Improve code quality | spec → plan → build |
12
+ | Existing Project | Add vralphy to project | init → spec → plan → build |
13
+ | Fresh Start | Re-initialize clean | cleanup → init |
14
+ | Quick Fix | Small changes | Edit plan → build 1-2 |
15
+
16
+ ---
17
+
18
+ ## Workflow 1: New Feature Development
19
+
20
+ **Scenario**: Adding a new feature from scratch
21
+
22
+ ### Steps
23
+
24
+ **1. Initialize (if needed)**
25
+ ```bash
26
+ vralphy init
27
+ # Creates .vralphy/, specs/, IMPLEMENTATION_PLAN.md
28
+ ```
29
+
30
+ **2. Create specification**
31
+ ```bash
32
+ vralphy spec user-authentication
33
+
34
+ # AI asks clarifying questions:
35
+ # - Authentication method?
36
+ # - Password requirements?
37
+ # - Session management?
38
+ # - Two-factor auth?
39
+
40
+ # You provide answers
41
+ # Output: specs/user-authentication.md
42
+ ```
43
+
44
+ **3. Review specification**
45
+ ```bash
46
+ cat specs/user-authentication.md
47
+ # Verify requirements are correct
48
+ # Edit if needed
49
+ ```
50
+
51
+ **4. Plan implementation**
52
+ ```bash
53
+ vralphy plan 3
54
+
55
+ # AI analyzes:
56
+ # - Specification requirements
57
+ # - Existing codebase
58
+ # - Dependencies
59
+ # - Test coverage
60
+
61
+ # Updates: IMPLEMENTATION_PLAN.md
62
+ ```
63
+
64
+ **5. Review plan**
65
+ ```bash
66
+ cat IMPLEMENTATION_PLAN.md
67
+ # Check task priorities
68
+ # Verify approach makes sense
69
+ ```
70
+
71
+ **6. Implement**
72
+ ```bash
73
+ vralphy build 20
74
+
75
+ # AI autonomously:
76
+ # - Implements tasks
77
+ # - Writes tests
78
+ # - Runs tests
79
+ # - Commits changes
80
+ # - Updates plan
81
+ ```
82
+
83
+ **7. Verify progress**
84
+ ```bash
85
+ # Check remaining tasks
86
+ cat IMPLEMENTATION_PLAN.md
87
+
88
+ # Check git commits
89
+ git log --oneline -10
90
+
91
+ # Run tests manually
92
+ npm test
93
+ ```
94
+
95
+ **8. Iterate if needed**
96
+ ```bash
97
+ # If more work needed
98
+ vralphy plan 2
99
+ vralphy build 10
100
+
101
+ # Repeat until complete
102
+ ```
103
+
104
+ ### Expected Timeline
105
+
106
+ - Spec creation: 5-10 minutes
107
+ - Planning: 2-5 minutes (3 iterations)
108
+ - Building: Varies (10-30 minutes for medium feature)
109
+ - Total: 20-45 minutes for a medium-sized feature
110
+
111
+ ---
112
+
113
+ ## Workflow 2: Bug Fix
114
+
115
+ **Scenario**: Fixing a reported bug
116
+
117
+ ### Steps
118
+
119
+ **1. Document the bug**
120
+
121
+ Edit `IMPLEMENTATION_PLAN.md` directly:
122
+ ```markdown
123
+ # Implementation Plan
124
+
125
+ ## High Priority
126
+ - [ ] Fix: Login fails when email contains + character
127
+ - [ ] Fix: Password reset email not sending
128
+
129
+ ## Existing tasks...
130
+ ```
131
+
132
+ **2. Let AI fix it**
133
+ ```bash
134
+ vralphy build 5
135
+
136
+ # AI will:
137
+ # - Read the bug description
138
+ # - Search for relevant code
139
+ # - Identify root cause
140
+ # - Implement fix
141
+ # - Add test to prevent regression
142
+ # - Commit
143
+ ```
144
+
145
+ **3. Verify fix**
146
+ ```bash
147
+ # Check fix was implemented
148
+ git log -1 --stat
149
+
150
+ # Run tests
151
+ npm test
152
+
153
+ # Manual verification
154
+ npm run dev
155
+ ```
156
+
157
+ ### When to Use This Workflow
158
+
159
+ - Quick fixes
160
+ - Clear bug descriptions
161
+ - Regression fixes
162
+ - Edge case handling
163
+
164
+ ### Alternative: Spec-Based Bug Fix
165
+
166
+ For complex bugs:
167
+ ```bash
168
+ # Create a spec describing expected behavior
169
+ vralphy spec login-edge-cases
170
+
171
+ # Plan the fix
172
+ vralphy plan 2
173
+
174
+ # Implement
175
+ vralphy build 5
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Workflow 3: Refactoring
181
+
182
+ **Scenario**: Improving code quality without changing behavior
183
+
184
+ ### Steps
185
+
186
+ **1. Create refactoring spec**
187
+ ```bash
188
+ vralphy spec refactor-auth-module
189
+
190
+ # Describe:
191
+ # - Current problems (duplication, complexity)
192
+ # - Desired outcome (cleaner, testable)
193
+ # - Constraints (maintain API compatibility)
194
+ ```
195
+
196
+ **2. Plan the refactoring**
197
+ ```bash
198
+ vralphy plan 5
199
+
200
+ # AI analyzes:
201
+ # - Current implementation
202
+ # - Code smells
203
+ # - Refactoring opportunities
204
+ # - Test coverage gaps
205
+ ```
206
+
207
+ **3. Review plan carefully**
208
+ ```bash
209
+ cat IMPLEMENTATION_PLAN.md
210
+
211
+ # Verify:
212
+ # - Refactoring is safe
213
+ # - Tests will catch regressions
214
+ # - Approach is sound
215
+ ```
216
+
217
+ **4. Implement incrementally**
218
+ ```bash
219
+ # Small iterations to maintain working state
220
+ vralphy build 3
221
+
222
+ # Verify tests pass
223
+ npm test
224
+
225
+ # Continue
226
+ vralphy build 3
227
+ npm test
228
+
229
+ # Repeat until done
230
+ ```
231
+
232
+ **5. Verify no behavior changes**
233
+ ```bash
234
+ # Run full test suite
235
+ npm test
236
+
237
+ # Check code coverage
238
+ npm run coverage
239
+
240
+ # Manual smoke testing
241
+ npm run dev
242
+ ```
243
+
244
+ ### Best Practices
245
+
246
+ - Small, focused refactorings
247
+ - Test coverage first
248
+ - One pattern at a time
249
+ - Verify after each step
250
+
251
+ ---
252
+
253
+ ## Workflow 4: Adding vralphy to Existing Project
254
+
255
+ **Scenario**: Introducing vralphy to an established codebase
256
+
257
+ ### Steps
258
+
259
+ **1. Ensure git is clean**
260
+ ```bash
261
+ git status
262
+ # Commit or stash any changes
263
+ ```
264
+
265
+ **2. Initialize vralphy**
266
+ ```bash
267
+ vralphy init
268
+
269
+ # AI analyzes project and generates .vralphy/AGENTS.md
270
+ # Review the generated operational guide
271
+ cat .vralphy/AGENTS.md
272
+ ```
273
+
274
+ **3. Verify operational commands**
275
+ ```bash
276
+ # Test commands from AGENTS.md
277
+ npm run build
278
+ npm test
279
+ npm run lint
280
+
281
+ # If any fail, update .vralphy/AGENTS.md
282
+ ```
283
+
284
+ **4. Create specs for existing features**
285
+ ```bash
286
+ # Document what already exists
287
+ vralphy spec existing-api-endpoints
288
+ vralphy spec existing-auth-system
289
+
290
+ # Or create specs for new work only
291
+ vralphy spec new-feature
292
+ ```
293
+
294
+ **5. Initial planning**
295
+ ```bash
296
+ vralphy plan 3
297
+
298
+ # AI will:
299
+ # - Discover existing implementation
300
+ # - Identify gaps vs specs
301
+ # - Create initial plan
302
+ ```
303
+
304
+ **6. Review and adjust**
305
+ ```bash
306
+ cat IMPLEMENTATION_PLAN.md
307
+
308
+ # Remove tasks for features that already work
309
+ # Add tasks for new features
310
+ # Prioritize
311
+ ```
312
+
313
+ **7. Start building**
314
+ ```bash
315
+ # Start with small iteration count
316
+ vralphy build 5
317
+
318
+ # Verify everything works
319
+ npm test
320
+ git log -5
321
+
322
+ # Increase iterations gradually
323
+ vralphy build 10
324
+ ```
325
+
326
+ ### Migration Checklist
327
+
328
+ - [ ] Git is clean
329
+ - [ ] Tests already exist and pass
330
+ - [ ] Build commands work
331
+ - [ ] `.vralphy/AGENTS.md` is accurate
332
+ - [ ] Initial specs created
333
+ - [ ] First planning run completed
334
+ - [ ] First build run successful
335
+ - [ ] Team onboarded to workflow
336
+
337
+ ---
338
+
339
+ ## Workflow 5: Clean Slate / Re-initialization
340
+
341
+ **Scenario**: Starting fresh after experimentation
342
+
343
+ ### Steps
344
+
345
+ **1. Clean up vralphy**
346
+ ```bash
347
+ vralphy cleanup --force
348
+
349
+ # Removes:
350
+ # - .vralphy/
351
+ # - IMPLEMENTATION_PLAN.md
352
+ # Keeps:
353
+ # - specs/ (your specifications)
354
+ ```
355
+
356
+ **2. Re-initialize**
357
+ ```bash
358
+ vralphy init
359
+
360
+ # Fresh .vralphy/AGENTS.md generated
361
+ # Fresh prompt templates
362
+ # Fresh IMPLEMENTATION_PLAN.md
363
+ ```
364
+
365
+ **3. Start over**
366
+ ```bash
367
+ # Specs are preserved
368
+ # Ready to plan and build
369
+ vralphy plan 2
370
+ vralphy build 10
371
+ ```
372
+
373
+ ### When to Use
374
+
375
+ - After major project changes
376
+ - When `.vralphy/AGENTS.md` is stale
377
+ - Testing different approaches
378
+ - Onboarding new team members
379
+
380
+ ---
381
+
382
+ ## Workflow 6: Quick One-Off Changes
383
+
384
+ **Scenario**: Small, focused changes
385
+
386
+ ### Steps
387
+
388
+ **1. Add task to plan**
389
+ ```bash
390
+ echo "- [ ] Add console.log to debug authentication" >> IMPLEMENTATION_PLAN.md
391
+ ```
392
+
393
+ **2. Quick build**
394
+ ```bash
395
+ vralphy build 1
396
+
397
+ # AI implements the change
398
+ # Commits if tests pass
399
+ ```
400
+
401
+ **3. Verify**
402
+ ```bash
403
+ git diff HEAD~1
404
+ npm test
405
+ ```
406
+
407
+ ### When to Use
408
+
409
+ - Debugging
410
+ - Quick experiments
411
+ - Small improvements
412
+ - Documentation updates
413
+
414
+ ---
415
+
416
+ ## Workflow 7: Multi-Feature Development
417
+
418
+ **Scenario**: Building several related features
419
+
420
+ ### Steps
421
+
422
+ **1. Create multiple specs**
423
+ ```bash
424
+ vralphy spec user-registration
425
+ vralphy spec user-login
426
+ vralphy spec password-reset
427
+ vralphy spec email-verification
428
+ ```
429
+
430
+ **2. Review all specs**
431
+ ```bash
432
+ ls specs/
433
+ # Ensure specs are complete and consistent
434
+ ```
435
+
436
+ **3. Comprehensive planning**
437
+ ```bash
438
+ vralphy plan 5
439
+
440
+ # AI analyzes all specs
441
+ # Creates unified plan
442
+ # Identifies dependencies
443
+ ```
444
+
445
+ **4. Build in priority order**
446
+ ```bash
447
+ # AI automatically handles dependencies
448
+ vralphy build 50
449
+
450
+ # Implements features in correct order
451
+ # Tests continuously
452
+ # Commits incrementally
453
+ ```
454
+
455
+ **5. Progress tracking**
456
+ ```bash
457
+ # Periodically check progress
458
+ cat IMPLEMENTATION_PLAN.md
459
+
460
+ # View recent commits
461
+ git log --oneline -20
462
+ ```
463
+
464
+ ### Best Practices
465
+
466
+ - Define all specs upfront
467
+ - Run planning before building
468
+ - Use high iteration counts
469
+ - Monitor progress regularly
470
+ - Interrupt and re-plan if needed (Ctrl+C)
471
+
472
+ ---
473
+
474
+ ## Workflow 8: Collaborative Development
475
+
476
+ **Scenario**: Multiple developers using vralphy
477
+
478
+ ### Setup
479
+
480
+ **1. Commit vralphy files**
481
+ ```bash
482
+ git add .vralphy/ specs/ IMPLEMENTATION_PLAN.md
483
+ git commit -m "Add vralphy configuration"
484
+ git push
485
+ ```
486
+
487
+ **2. Team members pull**
488
+ ```bash
489
+ git pull
490
+ npm install -g vralphy@latest
491
+ ```
492
+
493
+ ### Daily Workflow
494
+
495
+ **Developer A**:
496
+ ```bash
497
+ # Morning: Pull latest
498
+ git pull
499
+
500
+ # Update plan
501
+ vralphy plan 2
502
+
503
+ # Build
504
+ vralphy build 10
505
+
506
+ # Push
507
+ # (vralphy auto-commits and pushes)
508
+ ```
509
+
510
+ **Developer B** (later):
511
+ ```bash
512
+ # Pull latest (includes A's changes)
513
+ git pull
514
+
515
+ # Update plan (reflects A's work)
516
+ vralphy plan 2
517
+
518
+ # Build next priority items
519
+ vralphy build 10
520
+ ```
521
+
522
+ ### Best Practices
523
+
524
+ - Pull frequently
525
+ - Re-plan after pulling
526
+ - Use smaller iteration counts
527
+ - Coordinate on high-priority items
528
+ - Communicate via specs and plan
529
+
530
+ ---
531
+
532
+ ## Workflow 9: Testing-First Development
533
+
534
+ **Scenario**: Write tests first, then implement
535
+
536
+ ### Steps
537
+
538
+ **1. Create spec with explicit test requirements**
539
+ ```bash
540
+ vralphy spec api-rate-limiting
541
+
542
+ # Include in spec:
543
+ # - Test scenarios
544
+ # - Expected behavior
545
+ # - Edge cases
546
+ ```
547
+
548
+ **2. Update plan to prioritize tests**
549
+
550
+ Edit `IMPLEMENTATION_PLAN.md`:
551
+ ```markdown
552
+ ## High Priority
553
+ - [ ] Write tests for rate limiting
554
+ - [ ] Implement rate limiting to pass tests
555
+ ```
556
+
557
+ **3. Build tests first**
558
+ ```bash
559
+ vralphy build 3
560
+
561
+ # AI writes tests first
562
+ # Tests will fail (no implementation yet)
563
+ ```
564
+
565
+ **4. Build implementation**
566
+ ```bash
567
+ vralphy build 5
568
+
569
+ # AI implements to make tests pass
570
+ ```
571
+
572
+ ### Benefits
573
+
574
+ - Clear requirements
575
+ - No implementation without tests
576
+ - High confidence in correctness
577
+
578
+ ---
579
+
580
+ ## Workflow 10: Documentation-Driven Development
581
+
582
+ **Scenario**: Document first, then build
583
+
584
+ ### Steps
585
+
586
+ **1. Write comprehensive spec**
587
+ ```bash
588
+ vralphy spec comprehensive-api-docs
589
+
590
+ # Include:
591
+ # - API endpoints
592
+ # - Request/response formats
593
+ # - Error codes
594
+ # - Examples
595
+ ```
596
+
597
+ **2. Create README sections**
598
+
599
+ Add to spec:
600
+ ```markdown
601
+ ## Documentation Requirements
602
+ - [ ] Update README with API docs
603
+ - [ ] Add JSDoc comments
604
+ - [ ] Create usage examples
605
+ ```
606
+
607
+ **3. Plan and build**
608
+ ```bash
609
+ vralphy plan 3
610
+ vralphy build 15
611
+
612
+ # AI generates:
613
+ # - Documentation
614
+ # - Examples
615
+ # - Comments
616
+ # - Implementation
617
+ ```
618
+
619
+ ---
620
+
621
+ ## Common Patterns
622
+
623
+ ### Pattern: Checkpoint and Verify
624
+
625
+ After every 5-10 build iterations:
626
+ ```bash
627
+ # Stop and verify
628
+ npm test
629
+ cat IMPLEMENTATION_PLAN.md
630
+ git log --oneline -10
631
+
632
+ # Adjust if needed
633
+ # Continue
634
+ vralphy build 10
635
+ ```
636
+
637
+ ### Pattern: Plan-Build-Plan-Build
638
+
639
+ For complex features:
640
+ ```bash
641
+ # Initial plan
642
+ vralphy plan 3
643
+
644
+ # First implementation pass
645
+ vralphy build 10
646
+
647
+ # Re-plan with new knowledge
648
+ vralphy plan 2
649
+
650
+ # Continue building
651
+ vralphy build 10
652
+ ```
653
+
654
+ ### Pattern: Spec Evolution
655
+
656
+ Specs can evolve:
657
+ ```bash
658
+ # Initial spec
659
+ vralphy spec feature
660
+
661
+ # Implement partially
662
+ vralphy build 10
663
+
664
+ # Update spec with new requirements
665
+ vi specs/feature.md
666
+
667
+ # Re-plan and continue
668
+ vralphy plan 2
669
+ vralphy build 10
670
+ ```
671
+
672
+ ### Pattern: Emergency Stop and Fix
673
+
674
+ If build goes wrong:
675
+ ```bash
676
+ # Stop immediately (Ctrl+C)
677
+
678
+ # Check what happened
679
+ git log -5
680
+ git diff HEAD~1
681
+
682
+ # Revert if needed
683
+ git reset --hard HEAD~1
684
+
685
+ # Fix the plan
686
+ vi IMPLEMENTATION_PLAN.md
687
+
688
+ # Resume carefully
689
+ vralphy build 2
690
+ ```
691
+
692
+ ---
693
+
694
+ ## Anti-Patterns to Avoid
695
+
696
+ ### ❌ Building Without Planning
697
+
698
+ ```bash
699
+ # Bad
700
+ vralphy build 20 # No plan!
701
+
702
+ # Good
703
+ vralphy plan 3
704
+ vralphy build 20
705
+ ```
706
+
707
+ ### ❌ Too Many Iterations at Once
708
+
709
+ ```bash
710
+ # Bad
711
+ vralphy build 100 # Too much!
712
+
713
+ # Good
714
+ vralphy build 10
715
+ # Check progress
716
+ vralphy build 10
717
+ ```
718
+
719
+ ### ❌ Ignoring Failed Tests
720
+
721
+ Never commit if tests fail. vralphy won't, but don't override:
722
+ ```bash
723
+ # Bad
724
+ git commit --no-verify # Skips tests!
725
+
726
+ # Good
727
+ # Let vralphy handle commits after tests pass
728
+ ```
729
+
730
+ ### ❌ Manual Code Changes During Build
731
+
732
+ ```bash
733
+ # Bad
734
+ vralphy build 20 & # Background
735
+ vi src/app.ts # Manual edit - conflict!
736
+
737
+ # Good
738
+ vralphy build 20 # Foreground
739
+ # Wait for completion
740
+ # Then make manual changes if needed
741
+ ```
742
+
743
+ ### ❌ Vague Specs
744
+
745
+ ```bash
746
+ # Bad
747
+ echo "Add authentication" > specs/auth.md
748
+
749
+ # Good
750
+ vralphy spec authentication
751
+ # Provide detailed answers to AI questions
752
+ ```
753
+
754
+ ---
755
+
756
+ ## Tips and Tricks
757
+
758
+ ### Tip 1: Use --verbose for Debugging
759
+
760
+ ```bash
761
+ vralphy --verbose build 2
762
+ # Shows detailed execution
763
+ ```
764
+
765
+ ### Tip 2: Dry Run to Preview
766
+
767
+ ```bash
768
+ vralphy --dry-run build 1
769
+ # Shows prompt without executing
770
+ ```
771
+
772
+ ### Tip 3: Customize Prompts
773
+
774
+ ```bash
775
+ vi .vralphy/prompts/build.md
776
+ # Adjust AI behavior for your project
777
+ ```
778
+
779
+ ### Tip 4: Multiple Engines
780
+
781
+ ```bash
782
+ # Use codex for planning (fast)
783
+ vralphy --engine codex plan 3
784
+
785
+ # Use claude for building (thorough)
786
+ vralphy --engine claude build 10
787
+ ```
788
+
789
+ ### Tip 5: Save Checkpoints
790
+
791
+ ```bash
792
+ # Before major changes
793
+ git tag checkpoint-before-refactor
794
+
795
+ # Experiment with vralphy
796
+ vralphy build 20
797
+
798
+ # Rollback if needed
799
+ git reset --hard checkpoint-before-refactor
800
+ ```
801
+
802
+ ---
803
+
804
+ ## Next Steps
805
+
806
+ - See [EXAMPLES.md](./EXAMPLES.md) for real-world examples
807
+ - Read [METHODOLOGY.md](./METHODOLOGY.md) for deeper understanding
808
+ - Check [COMMANDS.md](./COMMANDS.md) for command details