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.
- package/README.md +28 -0
- package/dist/commands/cleanup.d.ts +18 -0
- package/dist/commands/cleanup.d.ts.map +1 -0
- package/dist/commands/cleanup.js +117 -0
- package/dist/commands/cleanup.js.map +1 -0
- package/dist/commands/cleanup.test.d.ts +2 -0
- package/dist/commands/cleanup.test.d.ts.map +1 -0
- package/dist/commands/cleanup.test.js +133 -0
- package/dist/commands/cleanup.test.js.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/docs/COMMANDS.md +613 -0
- package/docs/DESIGN.md +537 -0
- package/docs/EXAMPLES.md +812 -0
- package/docs/METHODOLOGY.md +390 -0
- package/docs/README.md +110 -0
- package/docs/WORKFLOWS.md +808 -0
- package/package.json +2 -1
package/docs/EXAMPLES.md
ADDED
|
@@ -0,0 +1,812 @@
|
|
|
1
|
+
# Real-World Examples
|
|
2
|
+
|
|
3
|
+
Concrete examples of using vralphy in different scenarios.
|
|
4
|
+
|
|
5
|
+
## Example 1: Node.js REST API
|
|
6
|
+
|
|
7
|
+
### Scenario
|
|
8
|
+
|
|
9
|
+
Building a REST API for a task management application.
|
|
10
|
+
|
|
11
|
+
### Project Setup
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
mkdir task-api
|
|
15
|
+
cd task-api
|
|
16
|
+
npm init -y
|
|
17
|
+
git init
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Initialize vralphy
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
vralphy init
|
|
24
|
+
|
|
25
|
+
# Output:
|
|
26
|
+
# Created:
|
|
27
|
+
# + specs/
|
|
28
|
+
# + .vralphy/AGENTS.md
|
|
29
|
+
# + .vralphy/prompts/
|
|
30
|
+
# + IMPLEMENTATION_PLAN.md
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Generated AGENTS.md
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
## Build & Run
|
|
37
|
+
- Build: `npm run build`
|
|
38
|
+
- Dev: `npm run dev`
|
|
39
|
+
|
|
40
|
+
## Validation
|
|
41
|
+
- Tests: `npm test`
|
|
42
|
+
- Lint: `npm run lint`
|
|
43
|
+
|
|
44
|
+
## Tech Stack
|
|
45
|
+
- Node.js + Express
|
|
46
|
+
- TypeScript
|
|
47
|
+
- Jest for testing
|
|
48
|
+
|
|
49
|
+
## Codebase Patterns
|
|
50
|
+
- REST endpoints in src/routes/
|
|
51
|
+
- Business logic in src/services/
|
|
52
|
+
- Data models in src/models/
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Create Specifications
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
vralphy spec task-crud
|
|
59
|
+
|
|
60
|
+
# AI asks:
|
|
61
|
+
# - What fields should a task have?
|
|
62
|
+
# Response: id, title, description, status, createdAt, updatedAt
|
|
63
|
+
|
|
64
|
+
# - What statuses are valid?
|
|
65
|
+
# Response: TODO, IN_PROGRESS, DONE
|
|
66
|
+
|
|
67
|
+
# - Should tasks have priorities?
|
|
68
|
+
# Response: Yes - LOW, MEDIUM, HIGH
|
|
69
|
+
|
|
70
|
+
# - Authentication required?
|
|
71
|
+
# Response: Yes, JWT-based
|
|
72
|
+
|
|
73
|
+
# Output: specs/task-crud.md
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Plan Implementation
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
vralphy plan 3
|
|
80
|
+
|
|
81
|
+
# IMPLEMENTATION_PLAN.md generated:
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```markdown
|
|
85
|
+
# Implementation Plan
|
|
86
|
+
|
|
87
|
+
## High Priority
|
|
88
|
+
- [ ] Set up Express server with TypeScript
|
|
89
|
+
- [ ] Create Task model with validation
|
|
90
|
+
- [ ] Implement POST /tasks endpoint
|
|
91
|
+
- [ ] Implement GET /tasks endpoint
|
|
92
|
+
- [ ] Implement GET /tasks/:id endpoint
|
|
93
|
+
- [ ] Implement PUT /tasks/:id endpoint
|
|
94
|
+
- [ ] Implement DELETE /tasks/:id endpoint
|
|
95
|
+
|
|
96
|
+
## Medium Priority
|
|
97
|
+
- [ ] Add JWT authentication middleware
|
|
98
|
+
- [ ] Add request validation
|
|
99
|
+
- [ ] Add error handling
|
|
100
|
+
- [ ] Write unit tests for routes
|
|
101
|
+
- [ ] Write integration tests
|
|
102
|
+
|
|
103
|
+
## Low Priority
|
|
104
|
+
- [ ] Add API documentation
|
|
105
|
+
- [ ] Add rate limiting
|
|
106
|
+
- [ ] Add logging
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Build Implementation
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
vralphy build 20
|
|
113
|
+
|
|
114
|
+
# Iteration 1: Sets up Express + TypeScript
|
|
115
|
+
# Commit: "Set up Express server with TypeScript configuration"
|
|
116
|
+
|
|
117
|
+
# Iteration 2: Creates Task model
|
|
118
|
+
# Commit: "Add Task model with validation"
|
|
119
|
+
|
|
120
|
+
# Iteration 3-7: Implements CRUD endpoints
|
|
121
|
+
# Commit: "Add POST /tasks endpoint with tests"
|
|
122
|
+
# Commit: "Add GET /tasks endpoint with tests"
|
|
123
|
+
# ...
|
|
124
|
+
|
|
125
|
+
# Iteration 8: Adds authentication
|
|
126
|
+
# Commit: "Add JWT authentication middleware"
|
|
127
|
+
|
|
128
|
+
# After 20 iterations, most features complete
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Verify Progress
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
cat IMPLEMENTATION_PLAN.md
|
|
135
|
+
|
|
136
|
+
# Shows:
|
|
137
|
+
# ✓ All high priority tasks completed
|
|
138
|
+
# ✓ Most medium priority tasks completed
|
|
139
|
+
# - Low priority tasks remain
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Continue if Needed
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
vralphy build 10
|
|
146
|
+
|
|
147
|
+
# Completes remaining tasks
|
|
148
|
+
# All tests pass
|
|
149
|
+
# API ready for deployment
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Final Result
|
|
153
|
+
|
|
154
|
+
- Working REST API with 7 endpoints
|
|
155
|
+
- JWT authentication
|
|
156
|
+
- Request validation
|
|
157
|
+
- Error handling
|
|
158
|
+
- Comprehensive test suite
|
|
159
|
+
- ~40 commits with clear messages
|
|
160
|
+
- Total time: ~2 hours
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Example 2: React Component Library
|
|
165
|
+
|
|
166
|
+
### Scenario
|
|
167
|
+
|
|
168
|
+
Creating a reusable component library for internal use.
|
|
169
|
+
|
|
170
|
+
### Initialize
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
mkdir ui-components
|
|
174
|
+
cd ui-components
|
|
175
|
+
npm create vite@latest . -- --template react-ts
|
|
176
|
+
git init
|
|
177
|
+
vralphy init
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Create Specs
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Button component
|
|
184
|
+
vralphy spec button-component
|
|
185
|
+
|
|
186
|
+
# AI asks:
|
|
187
|
+
# - Variants? Response: primary, secondary, danger
|
|
188
|
+
# - Sizes? Response: small, medium, large
|
|
189
|
+
# - States? Response: default, hover, active, disabled
|
|
190
|
+
# - Icons? Response: Yes, optional leading/trailing
|
|
191
|
+
|
|
192
|
+
# Output: specs/button-component.md
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Card component
|
|
197
|
+
vralphy spec card-component
|
|
198
|
+
|
|
199
|
+
# Output: specs/card-component.md
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Input component
|
|
204
|
+
vralphy spec input-component
|
|
205
|
+
|
|
206
|
+
# Output: specs/input-component.md
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Plan and Build
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
vralphy plan 5
|
|
213
|
+
vralphy build 30
|
|
214
|
+
|
|
215
|
+
# AI generates:
|
|
216
|
+
# - Component files
|
|
217
|
+
# - TypeScript types
|
|
218
|
+
# - CSS modules
|
|
219
|
+
# - Storybook stories
|
|
220
|
+
# - Unit tests
|
|
221
|
+
# - Documentation
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Generated Files
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
src/components/
|
|
228
|
+
├── Button/
|
|
229
|
+
│ ├── Button.tsx
|
|
230
|
+
│ ├── Button.module.css
|
|
231
|
+
│ ├── Button.test.tsx
|
|
232
|
+
│ ├── Button.stories.tsx
|
|
233
|
+
│ └── index.ts
|
|
234
|
+
├── Card/
|
|
235
|
+
│ ├── Card.tsx
|
|
236
|
+
│ ├── Card.module.css
|
|
237
|
+
│ ├── Card.test.tsx
|
|
238
|
+
│ ├── Card.stories.tsx
|
|
239
|
+
│ └── index.ts
|
|
240
|
+
└── Input/
|
|
241
|
+
├── Input.tsx
|
|
242
|
+
├── Input.module.css
|
|
243
|
+
├── Input.test.tsx
|
|
244
|
+
├── Input.stories.tsx
|
|
245
|
+
└── index.ts
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Result
|
|
249
|
+
|
|
250
|
+
- 3 fully-featured components
|
|
251
|
+
- Storybook documentation
|
|
252
|
+
- 100% test coverage
|
|
253
|
+
- TypeScript types
|
|
254
|
+
- Accessible (ARIA attributes)
|
|
255
|
+
- Total time: ~1.5 hours
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Example 3: CLI Tool (TypeScript)
|
|
260
|
+
|
|
261
|
+
### Scenario
|
|
262
|
+
|
|
263
|
+
Building a command-line tool for data migration.
|
|
264
|
+
|
|
265
|
+
### Setup
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
mkdir data-migrator
|
|
269
|
+
cd data-migrator
|
|
270
|
+
npm init -y
|
|
271
|
+
git init
|
|
272
|
+
vralphy init
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Spec Creation
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
vralphy spec cli-interface
|
|
279
|
+
|
|
280
|
+
# AI asks about:
|
|
281
|
+
# - Commands needed
|
|
282
|
+
# - Flags and options
|
|
283
|
+
# - Input/output formats
|
|
284
|
+
# - Error handling
|
|
285
|
+
|
|
286
|
+
# Output: specs/cli-interface.md
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
vralphy spec data-transformation
|
|
291
|
+
|
|
292
|
+
# AI asks about:
|
|
293
|
+
# - Source formats (CSV, JSON, XML)
|
|
294
|
+
# - Target formats
|
|
295
|
+
# - Transformation rules
|
|
296
|
+
# - Validation
|
|
297
|
+
|
|
298
|
+
# Output: specs/data-transformation.md
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Implementation
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
vralphy plan 3
|
|
305
|
+
vralphy build 25
|
|
306
|
+
|
|
307
|
+
# AI creates:
|
|
308
|
+
# - Commander.js setup
|
|
309
|
+
# - CSV parser
|
|
310
|
+
# - JSON transformer
|
|
311
|
+
# - XML handler
|
|
312
|
+
# - Validation logic
|
|
313
|
+
# - Error handling
|
|
314
|
+
# - Tests
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Usage Example
|
|
318
|
+
|
|
319
|
+
Generated CLI:
|
|
320
|
+
```bash
|
|
321
|
+
data-migrator transform \
|
|
322
|
+
--input data.csv \
|
|
323
|
+
--output data.json \
|
|
324
|
+
--format json \
|
|
325
|
+
--validate
|
|
326
|
+
|
|
327
|
+
# ✓ Parsed 1000 records
|
|
328
|
+
# ✓ Validated 1000 records
|
|
329
|
+
# ✓ Transformed 1000 records
|
|
330
|
+
# ✓ Wrote to data.json
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Result
|
|
334
|
+
|
|
335
|
+
- Full-featured CLI tool
|
|
336
|
+
- Multiple data formats supported
|
|
337
|
+
- Comprehensive validation
|
|
338
|
+
- Good error messages
|
|
339
|
+
- Well-tested
|
|
340
|
+
- Total time: ~2 hours
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## Example 4: Bug Fix in Existing Codebase
|
|
345
|
+
|
|
346
|
+
### Scenario
|
|
347
|
+
|
|
348
|
+
Authentication fails when email contains `+` character.
|
|
349
|
+
|
|
350
|
+
### Project State
|
|
351
|
+
|
|
352
|
+
- Existing Express API
|
|
353
|
+
- vralphy already initialized
|
|
354
|
+
- Test suite exists
|
|
355
|
+
|
|
356
|
+
### Add Bug to Plan
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
echo "- [ ] Fix: Authentication fails for emails with + character" >> IMPLEMENTATION_PLAN.md
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Let AI Fix It
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
vralphy build 3
|
|
366
|
+
|
|
367
|
+
# Iteration 1: AI searches for auth code
|
|
368
|
+
# Finds: Email validation regex doesn't handle +
|
|
369
|
+
|
|
370
|
+
# Iteration 2: AI fixes regex
|
|
371
|
+
# Updates: src/validators/email.ts
|
|
372
|
+
|
|
373
|
+
# Iteration 3: AI adds test
|
|
374
|
+
# Creates: test to prevent regression
|
|
375
|
+
|
|
376
|
+
# Commit: "Fix email validation to handle + character"
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### Generated Fix
|
|
380
|
+
|
|
381
|
+
```typescript
|
|
382
|
+
// Before
|
|
383
|
+
const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
384
|
+
|
|
385
|
+
// After (fixed by AI)
|
|
386
|
+
const emailRegex = /^[a-zA-Z0-9._+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
387
|
+
// ^ added +
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### Generated Test
|
|
391
|
+
|
|
392
|
+
```typescript
|
|
393
|
+
describe('Email Validation', () => {
|
|
394
|
+
it('should accept email with + character', () => {
|
|
395
|
+
expect(validateEmail('user+tag@example.com')).toBe(true);
|
|
396
|
+
});
|
|
397
|
+
});
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Result
|
|
401
|
+
|
|
402
|
+
- Bug fixed
|
|
403
|
+
- Test added
|
|
404
|
+
- 1 commit
|
|
405
|
+
- Total time: ~5 minutes
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## Example 5: Database Migration (Rust)
|
|
410
|
+
|
|
411
|
+
### Scenario
|
|
412
|
+
|
|
413
|
+
Adding Postgres support to existing SQLite-based Rust application.
|
|
414
|
+
|
|
415
|
+
### Initialize
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
cd rust-app
|
|
419
|
+
vralphy init
|
|
420
|
+
|
|
421
|
+
# AI detects Rust project
|
|
422
|
+
# Generates AGENTS.md:
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
```markdown
|
|
426
|
+
## Build & Run
|
|
427
|
+
- Build: `cargo build`
|
|
428
|
+
- Run: `cargo run`
|
|
429
|
+
|
|
430
|
+
## Validation
|
|
431
|
+
- Tests: `cargo test`
|
|
432
|
+
- Lint: `cargo clippy`
|
|
433
|
+
- Check: `cargo check`
|
|
434
|
+
|
|
435
|
+
## Tech Stack
|
|
436
|
+
- Rust
|
|
437
|
+
- SQLite (current)
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Create Spec
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
vralphy spec postgres-migration
|
|
444
|
+
|
|
445
|
+
# AI asks:
|
|
446
|
+
# - Keep SQLite support? Response: Yes (both)
|
|
447
|
+
# - Migration strategy? Response: Abstract database layer
|
|
448
|
+
# - Connection pooling? Response: Yes, using r2d2
|
|
449
|
+
# - Schema migration? Response: Use diesel
|
|
450
|
+
|
|
451
|
+
# Output: specs/postgres-migration.md
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### Plan and Build
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
vralphy plan 5
|
|
458
|
+
vralphy build 30
|
|
459
|
+
|
|
460
|
+
# AI creates:
|
|
461
|
+
# - Database abstraction trait
|
|
462
|
+
# - SQLite implementation
|
|
463
|
+
# - Postgres implementation
|
|
464
|
+
# - Connection pool setup
|
|
465
|
+
# - Migration scripts
|
|
466
|
+
# - Tests for both databases
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### Result
|
|
470
|
+
|
|
471
|
+
- Database abstraction layer
|
|
472
|
+
- Both SQLite and Postgres work
|
|
473
|
+
- Connection pooling
|
|
474
|
+
- Backward compatible
|
|
475
|
+
- Full test coverage
|
|
476
|
+
- Total time: ~3 hours
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
## Example 6: Adding Tests to Legacy Code
|
|
481
|
+
|
|
482
|
+
### Scenario
|
|
483
|
+
|
|
484
|
+
Untested JavaScript codebase needs test coverage.
|
|
485
|
+
|
|
486
|
+
### Initialize
|
|
487
|
+
|
|
488
|
+
```bash
|
|
489
|
+
cd legacy-app
|
|
490
|
+
vralphy init
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
### Create Spec
|
|
494
|
+
|
|
495
|
+
```bash
|
|
496
|
+
vralphy spec test-coverage
|
|
497
|
+
|
|
498
|
+
# AI asks:
|
|
499
|
+
# - Test framework preference? Response: Jest
|
|
500
|
+
# - Coverage goal? Response: 80%
|
|
501
|
+
# - Test types needed? Response: Unit + integration
|
|
502
|
+
# - Priority modules? Response: auth, payments, user
|
|
503
|
+
|
|
504
|
+
# Output: specs/test-coverage.md
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
### Update Plan
|
|
508
|
+
|
|
509
|
+
```markdown
|
|
510
|
+
# IMPLEMENTATION_PLAN.md
|
|
511
|
+
|
|
512
|
+
## High Priority
|
|
513
|
+
- [ ] Set up Jest configuration
|
|
514
|
+
- [ ] Add tests for auth module
|
|
515
|
+
- [ ] Add tests for payments module
|
|
516
|
+
- [ ] Add tests for user module
|
|
517
|
+
|
|
518
|
+
## Medium Priority
|
|
519
|
+
- [ ] Add tests for utils
|
|
520
|
+
- [ ] Add integration tests
|
|
521
|
+
- [ ] Set up CI/CD with test runs
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
### Build Tests
|
|
525
|
+
|
|
526
|
+
```bash
|
|
527
|
+
vralphy build 40
|
|
528
|
+
|
|
529
|
+
# AI:
|
|
530
|
+
# - Sets up Jest
|
|
531
|
+
# - Writes unit tests for each module
|
|
532
|
+
# - Writes integration tests
|
|
533
|
+
# - Achieves 85% coverage
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### Result
|
|
537
|
+
|
|
538
|
+
- Jest configured
|
|
539
|
+
- 150+ tests added
|
|
540
|
+
- 85% code coverage
|
|
541
|
+
- CI/CD pipeline updated
|
|
542
|
+
- Bugs found and fixed during testing
|
|
543
|
+
- Total time: ~4 hours
|
|
544
|
+
|
|
545
|
+
---
|
|
546
|
+
|
|
547
|
+
## Example 7: Documentation Generation
|
|
548
|
+
|
|
549
|
+
### Scenario
|
|
550
|
+
|
|
551
|
+
API needs comprehensive documentation.
|
|
552
|
+
|
|
553
|
+
### Create Spec
|
|
554
|
+
|
|
555
|
+
```bash
|
|
556
|
+
vralphy spec api-documentation
|
|
557
|
+
|
|
558
|
+
# AI asks:
|
|
559
|
+
# - Format? Response: OpenAPI 3.0
|
|
560
|
+
# - Include examples? Response: Yes
|
|
561
|
+
# - Authentication docs? Response: Yes, JWT
|
|
562
|
+
# - Error codes? Response: Yes, all codes
|
|
563
|
+
|
|
564
|
+
# Output: specs/api-documentation.md
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### Build
|
|
568
|
+
|
|
569
|
+
```bash
|
|
570
|
+
vralphy build 15
|
|
571
|
+
|
|
572
|
+
# AI generates:
|
|
573
|
+
# - OpenAPI specification
|
|
574
|
+
# - README with API overview
|
|
575
|
+
# - JSDoc comments in code
|
|
576
|
+
# - Postman collection
|
|
577
|
+
# - Example requests/responses
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
### Generated Files
|
|
581
|
+
|
|
582
|
+
```
|
|
583
|
+
docs/
|
|
584
|
+
├── openapi.yaml # Full OpenAPI spec
|
|
585
|
+
├── API.md # Human-readable docs
|
|
586
|
+
└── examples/
|
|
587
|
+
├── auth.http # Auth examples
|
|
588
|
+
├── users.http # User endpoints
|
|
589
|
+
└── tasks.http # Task endpoints
|
|
590
|
+
|
|
591
|
+
README.md # Updated with API docs
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
### Result
|
|
595
|
+
|
|
596
|
+
- Complete API documentation
|
|
597
|
+
- OpenAPI spec
|
|
598
|
+
- Code examples
|
|
599
|
+
- Postman collection
|
|
600
|
+
- Total time: ~1 hour
|
|
601
|
+
|
|
602
|
+
---
|
|
603
|
+
|
|
604
|
+
## Example 8: Performance Optimization
|
|
605
|
+
|
|
606
|
+
### Scenario
|
|
607
|
+
|
|
608
|
+
Application has slow database queries.
|
|
609
|
+
|
|
610
|
+
### Create Spec
|
|
611
|
+
|
|
612
|
+
```bash
|
|
613
|
+
vralphy spec query-optimization
|
|
614
|
+
|
|
615
|
+
# AI asks:
|
|
616
|
+
# - Target improvement? Response: 50% faster
|
|
617
|
+
# - Problem queries? Response: User dashboard, reports
|
|
618
|
+
# - Caching allowed? Response: Yes, Redis
|
|
619
|
+
# - Metrics tracking? Response: Yes, add logging
|
|
620
|
+
|
|
621
|
+
# Output: specs/query-optimization.md
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
### Plan and Build
|
|
625
|
+
|
|
626
|
+
```bash
|
|
627
|
+
vralphy plan 3
|
|
628
|
+
vralphy build 20
|
|
629
|
+
|
|
630
|
+
# AI:
|
|
631
|
+
# - Analyzes slow queries
|
|
632
|
+
# - Adds database indexes
|
|
633
|
+
# - Implements Redis caching
|
|
634
|
+
# - Adds query logging
|
|
635
|
+
# - Writes performance tests
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
### Results
|
|
639
|
+
|
|
640
|
+
- 60% query time reduction (exceeded goal)
|
|
641
|
+
- Redis caching layer
|
|
642
|
+
- Database indexes added
|
|
643
|
+
- Performance monitoring
|
|
644
|
+
- Total time: ~2 hours
|
|
645
|
+
|
|
646
|
+
---
|
|
647
|
+
|
|
648
|
+
## Example 9: Microservice Creation
|
|
649
|
+
|
|
650
|
+
### Scenario
|
|
651
|
+
|
|
652
|
+
Creating a new microservice for email notifications.
|
|
653
|
+
|
|
654
|
+
### Setup
|
|
655
|
+
|
|
656
|
+
```bash
|
|
657
|
+
mkdir email-service
|
|
658
|
+
cd email-service
|
|
659
|
+
npm init -y
|
|
660
|
+
git init
|
|
661
|
+
vralphy init
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
### Create Specs
|
|
665
|
+
|
|
666
|
+
```bash
|
|
667
|
+
vralphy spec email-service-api
|
|
668
|
+
vralphy spec email-templates
|
|
669
|
+
vralphy spec queue-processing
|
|
670
|
+
vralphy spec provider-integration
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
### Build Complete Service
|
|
674
|
+
|
|
675
|
+
```bash
|
|
676
|
+
vralphy plan 5
|
|
677
|
+
vralphy build 50
|
|
678
|
+
|
|
679
|
+
# AI builds:
|
|
680
|
+
# - Express API
|
|
681
|
+
# - Email templates (Handlebars)
|
|
682
|
+
# - Bull queue for async processing
|
|
683
|
+
# - SendGrid integration
|
|
684
|
+
# - Retry logic
|
|
685
|
+
# - Tests
|
|
686
|
+
# - Docker setup
|
|
687
|
+
# - README
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
### Result
|
|
691
|
+
|
|
692
|
+
- Complete microservice
|
|
693
|
+
- Queue-based processing
|
|
694
|
+
- Email provider integration
|
|
695
|
+
- Templating system
|
|
696
|
+
- Docker containerized
|
|
697
|
+
- Comprehensive tests
|
|
698
|
+
- Total time: ~4 hours
|
|
699
|
+
|
|
700
|
+
---
|
|
701
|
+
|
|
702
|
+
## Example 10: Mobile App Backend
|
|
703
|
+
|
|
704
|
+
### Scenario
|
|
705
|
+
|
|
706
|
+
Building backend for a mobile todo app.
|
|
707
|
+
|
|
708
|
+
### Specs
|
|
709
|
+
|
|
710
|
+
```bash
|
|
711
|
+
vralphy spec user-management
|
|
712
|
+
vralphy spec todo-api
|
|
713
|
+
vralphy spec realtime-sync
|
|
714
|
+
vralphy spec offline-support
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
### Build
|
|
718
|
+
|
|
719
|
+
```bash
|
|
720
|
+
vralphy plan 5
|
|
721
|
+
vralphy build 60
|
|
722
|
+
|
|
723
|
+
# AI creates:
|
|
724
|
+
# - REST API
|
|
725
|
+
# - WebSocket server (realtime)
|
|
726
|
+
# - Conflict resolution (offline)
|
|
727
|
+
# - JWT auth
|
|
728
|
+
# - Push notifications
|
|
729
|
+
# - Database (Postgres)
|
|
730
|
+
# - Tests
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
### Features Implemented
|
|
734
|
+
|
|
735
|
+
- User registration/login
|
|
736
|
+
- CRUD operations for todos
|
|
737
|
+
- Real-time sync via WebSockets
|
|
738
|
+
- Offline conflict resolution
|
|
739
|
+
- Push notifications
|
|
740
|
+
- Complete test suite
|
|
741
|
+
|
|
742
|
+
### Result
|
|
743
|
+
|
|
744
|
+
- Production-ready backend
|
|
745
|
+
- Real-time features
|
|
746
|
+
- Offline support
|
|
747
|
+
- Total time: ~5 hours
|
|
748
|
+
|
|
749
|
+
---
|
|
750
|
+
|
|
751
|
+
## Common Patterns Across Examples
|
|
752
|
+
|
|
753
|
+
### Pattern 1: Spec → Plan → Build
|
|
754
|
+
|
|
755
|
+
All examples follow this pattern:
|
|
756
|
+
1. Write detailed specifications
|
|
757
|
+
2. Let AI plan the implementation
|
|
758
|
+
3. Build autonomously
|
|
759
|
+
|
|
760
|
+
### Pattern 2: Incremental Testing
|
|
761
|
+
|
|
762
|
+
Every example includes tests:
|
|
763
|
+
- Written alongside implementation
|
|
764
|
+
- Run after each change
|
|
765
|
+
- Gate commits on test success
|
|
766
|
+
|
|
767
|
+
### Pattern 3: Clear Commits
|
|
768
|
+
|
|
769
|
+
All examples produce clear git history:
|
|
770
|
+
- Descriptive commit messages
|
|
771
|
+
- Small, focused changes
|
|
772
|
+
- Easy to review
|
|
773
|
+
|
|
774
|
+
### Pattern 4: Documentation
|
|
775
|
+
|
|
776
|
+
AI generates documentation:
|
|
777
|
+
- Code comments
|
|
778
|
+
- README files
|
|
779
|
+
- API documentation
|
|
780
|
+
- Usage examples
|
|
781
|
+
|
|
782
|
+
---
|
|
783
|
+
|
|
784
|
+
## Time Savings
|
|
785
|
+
|
|
786
|
+
### Traditional Development vs vralphy
|
|
787
|
+
|
|
788
|
+
**Example 1 (REST API)**:
|
|
789
|
+
- Traditional: 8-10 hours
|
|
790
|
+
- vralphy: 2 hours
|
|
791
|
+
- **Savings: 75%**
|
|
792
|
+
|
|
793
|
+
**Example 4 (Bug Fix)**:
|
|
794
|
+
- Traditional: 30-60 minutes
|
|
795
|
+
- vralphy: 5 minutes
|
|
796
|
+
- **Savings: 90%**
|
|
797
|
+
|
|
798
|
+
**Example 6 (Add Tests)**:
|
|
799
|
+
- Traditional: 2-3 days
|
|
800
|
+
- vralphy: 4 hours
|
|
801
|
+
- **Savings: 80%**
|
|
802
|
+
|
|
803
|
+
**Average: 70-80% time savings**
|
|
804
|
+
|
|
805
|
+
---
|
|
806
|
+
|
|
807
|
+
## Next Steps
|
|
808
|
+
|
|
809
|
+
- Apply these patterns to your projects
|
|
810
|
+
- Read [WORKFLOWS.md](./WORKFLOWS.md) for detailed workflows
|
|
811
|
+
- Check [METHODOLOGY.md](./METHODOLOGY.md) for deeper understanding
|
|
812
|
+
- See [COMMANDS.md](./COMMANDS.md) for command reference
|