ai-flow-dev 2.1.2 → 2.1.4
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 -40
- package/dist/cli.js +69 -47
- package/dist/cli.js.map +1 -1
- package/package.json +5 -5
- package/prompts/backend/flow-build-phase-0.md +96 -84
- package/prompts/backend/flow-build-phase-1.md +10 -18
- package/prompts/backend/flow-build-phase-10.md +199 -583
- package/prompts/backend/flow-build-phase-2.md +152 -86
- package/prompts/backend/flow-build-phase-3.md +108 -68
- package/prompts/backend/flow-build-phase-4.md +5 -8
- package/prompts/backend/flow-build-phase-5.md +39 -12
- package/prompts/backend/flow-build-phase-6.md +29 -8
- package/prompts/backend/flow-build-phase-7.md +121 -41
- package/prompts/backend/flow-build-phase-8.md +28 -65
- package/prompts/backend/flow-build-phase-9.md +267 -1298
- package/prompts/backend/flow-build.md +881 -957
- package/prompts/backend/flow-dev-commit.md +27 -50
- package/prompts/backend/flow-dev-feature.md +1929 -2017
- package/prompts/backend/flow-dev-fix.md +936 -964
- package/prompts/backend/flow-dev-refactor.md +672 -701
- package/prompts/backend/flow-dev-review.md +356 -389
- package/prompts/backend/flow-dev-work.md +1066 -1118
- package/prompts/backend/flow-docs-sync.md +31 -210
- package/prompts/frontend/flow-build-phase-0.md +503 -484
- package/prompts/frontend/flow-build-phase-1.md +445 -433
- package/prompts/frontend/flow-build-phase-2.md +910 -957
- package/prompts/frontend/flow-build-phase-3.md +692 -664
- package/prompts/frontend/flow-build-phase-4.md +478 -463
- package/prompts/frontend/flow-build-phase-5.md +488 -467
- package/prompts/frontend/flow-build-phase-6.md +571 -550
- package/prompts/frontend/flow-build-phase-7.md +560 -592
- package/prompts/frontend/flow-build-phase-8.md +17 -42
- package/prompts/frontend/flow-build.md +457 -503
- package/prompts/frontend/flow-docs-sync.md +24 -45
- package/prompts/mobile/flow-build-phase-0.md +104 -97
- package/prompts/mobile/flow-build-phase-1.md +137 -122
- package/prompts/mobile/flow-build-phase-2.md +123 -130
- package/prompts/mobile/flow-build-phase-3.md +144 -149
- package/prompts/mobile/flow-build-phase-4.md +140 -132
- package/prompts/mobile/flow-build-phase-5.md +70 -70
- package/prompts/mobile/flow-build-phase-6.md +136 -134
- package/prompts/mobile/flow-build-phase-7.md +24 -58
- package/prompts/mobile/flow-build-phase-8.md +17 -42
- package/prompts/mobile/flow-build.md +47 -97
- package/prompts/mobile/flow-docs-sync.md +23 -42
- package/prompts/shared/mermaid-guidelines.md +106 -0
- package/prompts/shared/scope-levels.md +126 -0
- package/prompts/shared/story-points.md +65 -0
- package/prompts/shared/task-format.md +86 -0
- package/templates/AGENT.template.md +194 -15
- package/templates/backend/README.template.md +2 -32
- package/templates/backend/ai-instructions.template.md +2 -32
- package/templates/backend/copilot-instructions.template.md +2 -22
- package/templates/backend/docs/api.template.md +89 -20
- package/templates/backend/docs/architecture.template.md +165 -53
- package/templates/backend/docs/business-flows.template.md +7 -14
- package/templates/backend/docs/code-standards.template.md +2 -38
- package/templates/backend/docs/contributing.template.md +2 -16
- package/templates/backend/docs/data-model.template.md +125 -21
- package/templates/backend/docs/operations.template.md +179 -50
- package/templates/backend/docs/testing.template.md +2 -42
- package/templates/backend/project-brief.template.md +2 -28
- package/templates/backend/specs/configuration.template.md +2 -14
- package/templates/backend/specs/security.template.md +2 -32
- package/templates/frontend/README.template.md +2 -18
- package/templates/frontend/ai-instructions.template.md +2 -20
- package/templates/frontend/docs/api-integration.template.md +12 -30
- package/templates/frontend/docs/components.template.md +2 -28
- package/templates/frontend/docs/error-handling.template.md +11 -27
- package/templates/frontend/docs/operations.template.md +8 -18
- package/templates/frontend/docs/performance.template.md +8 -18
- package/templates/frontend/docs/pwa.template.md +8 -18
- package/templates/frontend/docs/state-management.template.md +2 -28
- package/templates/frontend/docs/styling.template.md +2 -26
- package/templates/frontend/docs/testing.template.md +2 -28
- package/templates/frontend/project-brief.template.md +2 -16
- package/templates/frontend/specs/accessibility.template.md +8 -18
- package/templates/frontend/specs/configuration.template.md +2 -24
- package/templates/frontend/specs/security.template.md +10 -24
- package/templates/fullstack/README.template.md +17 -47
- package/templates/fullstack/ai-instructions.template.md +17 -45
- package/templates/fullstack/project-brief.template.md +16 -42
- package/templates/fullstack/specs/configuration.template.md +16 -42
- package/templates/mobile/README.template.md +11 -29
- package/templates/mobile/ai-instructions.template.md +11 -27
- package/templates/mobile/docs/app-store.template.md +11 -29
- package/templates/mobile/docs/architecture.template.md +14 -38
- package/templates/mobile/docs/native-features.template.md +16 -44
- package/templates/mobile/docs/navigation.template.md +9 -23
- package/templates/mobile/docs/offline-strategy.template.md +10 -26
- package/templates/mobile/docs/permissions.template.md +9 -23
- package/templates/mobile/docs/state-management.template.md +12 -32
- package/templates/mobile/docs/testing.template.md +14 -38
- package/templates/mobile/project-brief.template.md +12 -30
- package/templates/mobile/specs/build-configuration.template.md +10 -26
- package/templates/mobile/specs/deployment.template.md +9 -23
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
### 🎯 Objective
|
|
7
7
|
|
|
8
8
|
Efficiently analyze existing projects using a **layered, incremental approach** that:
|
|
9
|
+
|
|
9
10
|
- ✅ Minimizes context usage (50-75% reduction)
|
|
10
11
|
- ✅ Supports ALL major backend languages and frameworks
|
|
11
12
|
- ✅ Provides smart caching for instant re-runs
|
|
@@ -25,9 +26,7 @@ Layer 3: Selective Deep Analysis (1-5 minutes, ~5,000-25,000 tokens, OPTIONAL)
|
|
|
25
26
|
↓
|
|
26
27
|
Result Synthesis & Pre-population
|
|
27
28
|
```
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
29
|
+
---
|
|
31
30
|
## 0.0 Check for Existing Analysis (Layer 0)
|
|
32
31
|
|
|
33
32
|
```
|
|
@@ -36,7 +35,7 @@ Result Synthesis & Pre-population
|
|
|
36
35
|
|
|
37
36
|
**Actions:**
|
|
38
37
|
|
|
39
|
-
1. Check if `.ai-flow/analysis.json` exists
|
|
38
|
+
1. Check if `.ai-flow/cache/docs-analysis.json` exists
|
|
40
39
|
2. If exists:
|
|
41
40
|
- Read `analyzedAt` timestamp
|
|
42
41
|
- Read `filesAnalyzed` with their timestamps
|
|
@@ -101,9 +100,7 @@ Your choice: __
|
|
|
101
100
|
|
|
102
101
|
Proceeding to Layer 1...
|
|
103
102
|
```
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
103
|
+
---
|
|
107
104
|
## 0.1 Layer 1: Fast Metadata Scan (10-20 seconds)
|
|
108
105
|
|
|
109
106
|
```
|
|
@@ -402,13 +399,12 @@ Checking for Swift project...
|
|
|
402
399
|
✅ Layer 1 Complete (15 seconds)
|
|
403
400
|
|
|
404
401
|
📦 Project Detected:
|
|
405
|
-
|
|
402
|
+
---
|
|
406
403
|
Name: [from package.json/composer.json/etc.]
|
|
407
404
|
Language: [TypeScript/Python/PHP/Java/etc.]
|
|
408
405
|
Version: [language version]
|
|
409
406
|
Package Manager: [npm/composer/maven/etc.]
|
|
410
|
-
|
|
411
|
-
|
|
407
|
+
---
|
|
412
408
|
🚀 Framework: [Name] v[version]
|
|
413
409
|
🗄️ ORM/Database: [Name] v[version]
|
|
414
410
|
|
|
@@ -419,9 +415,7 @@ Checking for Swift project...
|
|
|
419
415
|
|
|
420
416
|
💾 Context Used: ~1,200 tokens
|
|
421
417
|
⏱️ Time Elapsed: 15s
|
|
422
|
-
|
|
423
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
424
|
-
|
|
418
|
+
---
|
|
425
419
|
Continue to Layer 2? (Structural analysis - no code reading yet)
|
|
426
420
|
|
|
427
421
|
A) ✅ Yes - Continue (Recommended)
|
|
@@ -432,9 +426,7 @@ Your choice: __ (Auto-continue in 3s)
|
|
|
432
426
|
```
|
|
433
427
|
|
|
434
428
|
**Context Usage:** ~1,000-1,500 tokens
|
|
435
|
-
|
|
436
|
-
---
|
|
437
|
-
|
|
429
|
+
---
|
|
438
430
|
## 0.2 Layer 2: Structural Analysis (30-90 seconds)
|
|
439
431
|
|
|
440
432
|
```
|
|
@@ -448,6 +440,7 @@ This scans directory organization and file counts without reading code.
|
|
|
448
440
|
**Language-specific directory patterns:**
|
|
449
441
|
|
|
450
442
|
**Node.js/TypeScript:**
|
|
443
|
+
|
|
451
444
|
```
|
|
452
445
|
Scanning directories:
|
|
453
446
|
• src/**/* or app/**/* or lib/**/*
|
|
@@ -465,6 +458,7 @@ Counting files by pattern:
|
|
|
465
458
|
```
|
|
466
459
|
|
|
467
460
|
**Python:**
|
|
461
|
+
|
|
468
462
|
```
|
|
469
463
|
Scanning directories:
|
|
470
464
|
• app/**/*.py or src/**/*.py
|
|
@@ -479,6 +473,7 @@ Counting files by pattern:
|
|
|
479
473
|
```
|
|
480
474
|
|
|
481
475
|
**PHP:**
|
|
476
|
+
|
|
482
477
|
```
|
|
483
478
|
Scanning directories:
|
|
484
479
|
• app/**/*.php or src/**/*.php
|
|
@@ -492,6 +487,7 @@ Counting files by pattern:
|
|
|
492
487
|
```
|
|
493
488
|
|
|
494
489
|
**Java:**
|
|
490
|
+
|
|
495
491
|
```
|
|
496
492
|
Scanning directories:
|
|
497
493
|
• src/main/java/**/*.java
|
|
@@ -506,6 +502,7 @@ Counting files by pattern:
|
|
|
506
502
|
```
|
|
507
503
|
|
|
508
504
|
**C#/.NET:**
|
|
505
|
+
|
|
509
506
|
```
|
|
510
507
|
Scanning directories:
|
|
511
508
|
• **/*.cs (excluding obj/, bin/)
|
|
@@ -520,6 +517,7 @@ Counting files by pattern:
|
|
|
520
517
|
```
|
|
521
518
|
|
|
522
519
|
**Go:**
|
|
520
|
+
|
|
523
521
|
```
|
|
524
522
|
Scanning directories:
|
|
525
523
|
• **/*.go (excluding vendor/)
|
|
@@ -533,6 +531,7 @@ Counting files by pattern:
|
|
|
533
531
|
```
|
|
534
532
|
|
|
535
533
|
**Ruby:**
|
|
534
|
+
|
|
536
535
|
```
|
|
537
536
|
Scanning directories:
|
|
538
537
|
• app/**/*.rb
|
|
@@ -559,56 +558,68 @@ Counting files by pattern:
|
|
|
559
558
|
**Based on detected ORM:**
|
|
560
559
|
|
|
561
560
|
**Prisma:**
|
|
561
|
+
|
|
562
562
|
- Read `prisma/schema.prisma`
|
|
563
563
|
- Extract model names only (regex: `model (\w+)`)
|
|
564
564
|
- Count total models
|
|
565
565
|
- Count relationships (count occurrences of `@relation`)
|
|
566
566
|
|
|
567
567
|
**TypeORM:**
|
|
568
|
+
|
|
568
569
|
- Glob `*.entity.{ts,js}`
|
|
569
570
|
- Extract entity names from `@Entity()` decorator (regex, no full parsing)
|
|
570
571
|
- Count entities
|
|
571
572
|
|
|
572
573
|
**Sequelize:**
|
|
574
|
+
|
|
573
575
|
- Glob `models/**/*.{ts,js}`
|
|
574
576
|
- Count model files
|
|
575
577
|
|
|
576
578
|
**Mongoose:**
|
|
579
|
+
|
|
577
580
|
- Glob `*.schema.{ts,js}` or `models/**/*.{ts,js}`
|
|
578
581
|
- Search for `new Schema(` pattern
|
|
579
582
|
- Count schemas
|
|
580
583
|
|
|
581
584
|
**Django:**
|
|
585
|
+
|
|
582
586
|
- Read `*/models.py` files
|
|
583
587
|
- Extract class names inheriting from `models.Model` (regex)
|
|
584
588
|
- Count models
|
|
585
589
|
|
|
586
590
|
**SQLAlchemy:**
|
|
591
|
+
|
|
587
592
|
- Read `**/models.py` or `**/*_model.py`
|
|
588
593
|
- Extract classes with `Base` or `db.Model` (regex)
|
|
589
594
|
- Count models
|
|
590
595
|
|
|
591
596
|
**Eloquent (Laravel):**
|
|
597
|
+
|
|
592
598
|
- Glob `app/Models/**/*.php`
|
|
593
599
|
- Count model files
|
|
594
600
|
|
|
595
601
|
**Doctrine (Symfony/PHP):**
|
|
602
|
+
|
|
596
603
|
- Glob `src/Entity/**/*.php`
|
|
597
604
|
- Count entity files
|
|
598
605
|
|
|
599
606
|
**Hibernate/JPA (Java):**
|
|
607
|
+
|
|
600
608
|
- Glob `**/*Entity.java`
|
|
601
609
|
- Count entity files
|
|
602
610
|
|
|
603
611
|
**Entity Framework (.NET):**
|
|
612
|
+
|
|
604
613
|
- Glob `**/Models/**/*.cs` or `**/Entities/**/*.cs`
|
|
605
614
|
- Count entity files
|
|
606
615
|
|
|
607
616
|
**GORM (Go):**
|
|
617
|
+
|
|
608
618
|
- Search for `type.*struct` in `models/**/*.go`
|
|
609
619
|
- Count structs
|
|
610
620
|
|
|
611
621
|
**ActiveRecord (Ruby):**
|
|
622
|
+
|
|
612
623
|
- Glob `app/models/**/*.rb`
|
|
613
624
|
- Count model files
|
|
614
625
|
|
|
@@ -639,6 +650,7 @@ Checking docs/ directory...
|
|
|
639
650
|
```
|
|
640
651
|
|
|
641
652
|
**Maturity Level:**
|
|
653
|
+
|
|
642
654
|
- 🌱 **Minimal:** 0-1 docs → Suggest **MVP or Production-Ready scope**
|
|
643
655
|
- 🌿 **Basic:** 2-4 docs → Suggest **Production-Ready scope**
|
|
644
656
|
- 🌳 **Comprehensive:** 5-7 docs → Suggest **Production-Ready or Enterprise scope**
|
|
@@ -652,7 +664,7 @@ Checking docs/ directory...
|
|
|
652
664
|
🏛️ Architecture Pattern: [Feature-based/Layer-based/Modular/Hybrid]
|
|
653
665
|
|
|
654
666
|
📊 Code Structure:
|
|
655
|
-
|
|
667
|
+
---
|
|
656
668
|
[Language-specific breakdown, e.g., for Node.js:]
|
|
657
669
|
|
|
658
670
|
Controllers: [X files]
|
|
@@ -670,8 +682,7 @@ Checking docs/ directory...
|
|
|
670
682
|
Tests: [X files] → Coverage estimate: [Low/Medium/High]
|
|
671
683
|
|
|
672
684
|
[etc., adapt to detected language]
|
|
673
|
-
|
|
674
|
-
|
|
685
|
+
---
|
|
675
686
|
📂 Organization:
|
|
676
687
|
[Example for Feature-based:]
|
|
677
688
|
✓ src/users/ (3 controllers, 5 services, 2 entities)
|
|
@@ -691,9 +702,7 @@ Checking docs/ directory...
|
|
|
691
702
|
|
|
692
703
|
💾 Context Used: ~3,500 tokens (total: ~4,700)
|
|
693
704
|
⏱️ Time Elapsed: 1m 15s
|
|
694
|
-
|
|
695
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
696
|
-
|
|
705
|
+
---
|
|
697
706
|
💡 Recommended Scope: [MVP / Production-Ready / Enterprise]
|
|
698
707
|
(Based on detected maturity level and code complexity)
|
|
699
708
|
|
|
@@ -707,9 +716,7 @@ Your choice: __
|
|
|
707
716
|
```
|
|
708
717
|
|
|
709
718
|
**Context Usage:** ~2,000-5,000 tokens (cumulative: ~3,000-6,500)
|
|
710
|
-
|
|
711
|
-
---
|
|
712
|
-
|
|
719
|
+
---
|
|
713
720
|
## 0.3 Layer 3: Selective Deep Analysis (1-5 minutes, OPTIONAL)
|
|
714
721
|
|
|
715
722
|
```
|
|
@@ -753,8 +760,7 @@ Select areas (use arrow keys, space to select, enter to confirm):
|
|
|
753
760
|
⏱️ Estimated time: 90-120 seconds
|
|
754
761
|
💾 Context cost: ~8,000-15,000 tokens
|
|
755
762
|
⚠️ HIGH CONTEXT USAGE
|
|
756
|
-
|
|
757
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
763
|
+
---
|
|
758
764
|
Total estimated: ~2-3 minutes, ~9,000-18,000 tokens
|
|
759
765
|
|
|
760
766
|
Or:
|
|
@@ -781,11 +787,11 @@ function selectFilesToAnalyze(files: string[], category: string, maxFiles: numbe
|
|
|
781
787
|
services: 9,
|
|
782
788
|
entities: 10,
|
|
783
789
|
repositories: 8,
|
|
784
|
-
dto: 7
|
|
790
|
+
dto: 7,
|
|
785
791
|
};
|
|
786
792
|
|
|
787
793
|
// Group by module/feature
|
|
788
|
-
const byModule = groupBy(files, file => file.split('/')[1]);
|
|
794
|
+
const byModule = groupBy(files, (file) => file.split('/')[1]);
|
|
789
795
|
|
|
790
796
|
// Sample proportionally from each module
|
|
791
797
|
const samples = [];
|
|
@@ -851,6 +857,7 @@ Your choice: __
|
|
|
851
857
|
**Node.js/TypeScript:**
|
|
852
858
|
|
|
853
859
|
**API Endpoints (NestJS):**
|
|
860
|
+
|
|
854
861
|
```typescript
|
|
855
862
|
// Sample up to 30 controller files
|
|
856
863
|
const controllerFiles = glob('**/*.controller.{ts,js}').slice(0, 30);
|
|
@@ -867,7 +874,7 @@ for (const file of controllerFiles) {
|
|
|
867
874
|
...content.matchAll(/@Post\(['"](.+?)['"]\)\s+(\w+)/g),
|
|
868
875
|
...content.matchAll(/@Put\(['"](.+?)['"]\)\s+(\w+)/g),
|
|
869
876
|
...content.matchAll(/@Delete\(['"](.+?)['"]\)\s+(\w+)/g),
|
|
870
|
-
...content.matchAll(/@Patch\(['"](.+?)['"]\)\s+(\w+)/g)
|
|
877
|
+
...content.matchAll(/@Patch\(['"](.+?)['"]\)\s+(\w+)/g),
|
|
871
878
|
];
|
|
872
879
|
|
|
873
880
|
for (const [fullMatch, path, handlerName, method] of routes) {
|
|
@@ -875,13 +882,14 @@ for (const file of controllerFiles) {
|
|
|
875
882
|
method: method,
|
|
876
883
|
path: `${basePath}/${path}`,
|
|
877
884
|
handler: handlerName,
|
|
878
|
-
file: file
|
|
885
|
+
file: file,
|
|
879
886
|
});
|
|
880
887
|
}
|
|
881
888
|
}
|
|
882
889
|
```
|
|
883
890
|
|
|
884
891
|
**API Endpoints (Express):**
|
|
892
|
+
|
|
885
893
|
```typescript
|
|
886
894
|
const routeFiles = glob('**/routes/**/*.{ts,js}').slice(0, 20);
|
|
887
895
|
|
|
@@ -890,16 +898,17 @@ for (const file of routeFiles) {
|
|
|
890
898
|
|
|
891
899
|
const routes = [
|
|
892
900
|
...content.matchAll(/router\.(get|post|put|delete|patch)\(['"](.+?)['"],\s*(\w+)/g),
|
|
893
|
-
...content.matchAll(/app\.(get|post|put|delete|patch)\(['"](.+?)['"],\s*(\w+)/g)
|
|
901
|
+
...content.matchAll(/app\.(get|post|put|delete|patch)\(['"](.+?)['"],\s*(\w+)/g),
|
|
894
902
|
];
|
|
895
903
|
|
|
896
904
|
for (const [, method, path, handler] of routes) {
|
|
897
|
-
endpoints.push({method: method.toUpperCase(), path, handler, file});
|
|
905
|
+
endpoints.push({ method: method.toUpperCase(), path, handler, file });
|
|
898
906
|
}
|
|
899
907
|
}
|
|
900
908
|
```
|
|
901
909
|
|
|
902
910
|
**Entities (Prisma):**
|
|
911
|
+
|
|
903
912
|
```typescript
|
|
904
913
|
// Read prisma/schema.prisma
|
|
905
914
|
const schema = readFile('prisma/schema.prisma');
|
|
@@ -915,9 +924,9 @@ for (const [, modelName, body] of models) {
|
|
|
915
924
|
fields: fields.map(([, name, type, decorator]) => ({
|
|
916
925
|
name,
|
|
917
926
|
type,
|
|
918
|
-
decorator
|
|
927
|
+
decorator,
|
|
919
928
|
})),
|
|
920
|
-
relationships: [...body.matchAll(/@relation\(([^)]+)\)/g)].map(m => m[1])
|
|
929
|
+
relationships: [...body.matchAll(/@relation\(([^)]+)\)/g)].map((m) => m[1]),
|
|
921
930
|
};
|
|
922
931
|
|
|
923
932
|
entities.push(entity);
|
|
@@ -927,6 +936,7 @@ for (const [, modelName, body] of models) {
|
|
|
927
936
|
**Python:**
|
|
928
937
|
|
|
929
938
|
**API Endpoints (FastAPI):**
|
|
939
|
+
|
|
930
940
|
```python
|
|
931
941
|
# Sample router files
|
|
932
942
|
routerFiles = glob('**/*routes.py', '**/*router.py')[:20]
|
|
@@ -947,6 +957,7 @@ for file in routerFiles:
|
|
|
947
957
|
```
|
|
948
958
|
|
|
949
959
|
**Entities (Django):**
|
|
960
|
+
|
|
950
961
|
```python
|
|
951
962
|
# Read models.py files
|
|
952
963
|
modelFiles = glob('**/models.py')[:15]
|
|
@@ -970,6 +981,7 @@ for file in modelFiles:
|
|
|
970
981
|
**PHP:**
|
|
971
982
|
|
|
972
983
|
**API Endpoints (Laravel):**
|
|
984
|
+
|
|
973
985
|
```php
|
|
974
986
|
// Read routes/api.php and routes/web.php
|
|
975
987
|
$routeFiles = ['routes/api.php', 'routes/web.php'];
|
|
@@ -992,6 +1004,7 @@ foreach ($routeFiles as $file) {
|
|
|
992
1004
|
```
|
|
993
1005
|
|
|
994
1006
|
**Entities (Eloquent):**
|
|
1007
|
+
|
|
995
1008
|
```php
|
|
996
1009
|
// Glob app/Models/*.php
|
|
997
1010
|
$modelFiles = glob('app/Models/*.php');
|
|
@@ -1014,6 +1027,7 @@ foreach ($modelFiles as $file) {
|
|
|
1014
1027
|
**Java:**
|
|
1015
1028
|
|
|
1016
1029
|
**API Endpoints (Spring Boot):**
|
|
1030
|
+
|
|
1017
1031
|
```java
|
|
1018
1032
|
// Glob **/*Controller.java (sample 25)
|
|
1019
1033
|
List<String> controllerFiles = glob("**/*Controller.java").subList(0, 25);
|
|
@@ -1040,6 +1054,7 @@ for (String file : controllerFiles) {
|
|
|
1040
1054
|
```
|
|
1041
1055
|
|
|
1042
1056
|
**Entities (JPA/Hibernate):**
|
|
1057
|
+
|
|
1043
1058
|
```java
|
|
1044
1059
|
// Glob **/*Entity.java
|
|
1045
1060
|
List<String> entityFiles = glob("**/*Entity.java").subList(0, 30);
|
|
@@ -1069,6 +1084,7 @@ for (String file : entityFiles) {
|
|
|
1069
1084
|
**C#/.NET:**
|
|
1070
1085
|
|
|
1071
1086
|
**API Endpoints (ASP.NET Core):**
|
|
1087
|
+
|
|
1072
1088
|
```csharp
|
|
1073
1089
|
// Glob **/*Controller.cs
|
|
1074
1090
|
var controllerFiles = Directory.GetFiles(".", "*Controller.cs", SearchOption.AllDirectories).Take(25);
|
|
@@ -1095,6 +1111,7 @@ foreach (var file in controllerFiles) {
|
|
|
1095
1111
|
```
|
|
1096
1112
|
|
|
1097
1113
|
**Entities (Entity Framework):**
|
|
1114
|
+
|
|
1098
1115
|
```csharp
|
|
1099
1116
|
// Glob **/Models/**/*.cs or **/Entities/**/*.cs
|
|
1100
1117
|
var entityFiles = Directory.GetFiles(".", "*.cs", SearchOption.AllDirectories)
|
|
@@ -1125,6 +1142,7 @@ foreach (var file in entityFiles) {
|
|
|
1125
1142
|
**Go:**
|
|
1126
1143
|
|
|
1127
1144
|
**API Endpoints (Gin):**
|
|
1145
|
+
|
|
1128
1146
|
```go
|
|
1129
1147
|
// Read handler files
|
|
1130
1148
|
handlerFiles := filepath.Glob("**/handlers/**/*.go")[:20]
|
|
@@ -1148,6 +1166,7 @@ for _, file := range handlerFiles {
|
|
|
1148
1166
|
```
|
|
1149
1167
|
|
|
1150
1168
|
**Entities (GORM):**
|
|
1169
|
+
|
|
1151
1170
|
```go
|
|
1152
1171
|
// Read model files
|
|
1153
1172
|
modelFiles := filepath.Glob("**/models/**/*.go")[:20]
|
|
@@ -1180,6 +1199,7 @@ for _, file := range modelFiles {
|
|
|
1180
1199
|
**Ruby:**
|
|
1181
1200
|
|
|
1182
1201
|
**API Endpoints (Rails):**
|
|
1202
|
+
|
|
1183
1203
|
```ruby
|
|
1184
1204
|
# Read routes.rb
|
|
1185
1205
|
routes_file = 'config/routes.rb'
|
|
@@ -1214,6 +1234,7 @@ end
|
|
|
1214
1234
|
```
|
|
1215
1235
|
|
|
1216
1236
|
**Entities (ActiveRecord):**
|
|
1237
|
+
|
|
1217
1238
|
```ruby
|
|
1218
1239
|
# Glob app/models/*.rb
|
|
1219
1240
|
model_files = Dir.glob('app/models/**/*.rb')[0..20]
|
|
@@ -1242,6 +1263,7 @@ end
|
|
|
1242
1263
|
**Rust:**
|
|
1243
1264
|
|
|
1244
1265
|
**API Endpoints (Actix):**
|
|
1266
|
+
|
|
1245
1267
|
```rust
|
|
1246
1268
|
// Read handler files
|
|
1247
1269
|
let handler_files: Vec<_> = glob("**/handlers/**/*.rs").unwrap().take(15).collect();
|
|
@@ -1264,6 +1286,7 @@ for file in handler_files {
|
|
|
1264
1286
|
```
|
|
1265
1287
|
|
|
1266
1288
|
**Entities (Diesel):**
|
|
1289
|
+
|
|
1267
1290
|
```rust
|
|
1268
1291
|
// Read schema.rs and models.rs
|
|
1269
1292
|
let schema = fs::read_to_string("src/schema.rs").ok();
|
|
@@ -1287,12 +1310,14 @@ if let Some(schema_content) = schema {
|
|
|
1287
1310
|
**Scan for security patterns across all languages:**
|
|
1288
1311
|
|
|
1289
1312
|
**Authentication:**
|
|
1313
|
+
|
|
1290
1314
|
- JWT libraries: `jsonwebtoken`, `@nestjs/jwt`, `pyjwt`, `jjwt`, etc.
|
|
1291
1315
|
- Session libraries: `express-session`, `django.contrib.sessions`
|
|
1292
1316
|
- OAuth libraries: `passport`, `authlib`, `spring-security-oauth2`
|
|
1293
1317
|
- Password hashing: `bcrypt`, `argon2`, `password_hash` (PHP)
|
|
1294
1318
|
|
|
1295
1319
|
**Validation:**
|
|
1320
|
+
|
|
1296
1321
|
- `class-validator`, `joi`, `zod` (Node.js)
|
|
1297
1322
|
- `pydantic`, `marshmallow` (Python)
|
|
1298
1323
|
- Laravel validation rules (PHP)
|
|
@@ -1300,16 +1325,19 @@ if let Some(schema_content) = schema {
|
|
|
1300
1325
|
- Data Annotations (.NET)
|
|
1301
1326
|
|
|
1302
1327
|
**Rate Limiting:**
|
|
1328
|
+
|
|
1303
1329
|
- `express-rate-limit`, `@nestjs/throttler`
|
|
1304
1330
|
- `django-ratelimit`, `slowapi`
|
|
1305
1331
|
- Bucket4j (Java)
|
|
1306
1332
|
|
|
1307
1333
|
**CORS:**
|
|
1334
|
+
|
|
1308
1335
|
- `cors` package (Node.js)
|
|
1309
1336
|
- `django-cors-headers` (Python)
|
|
1310
1337
|
- Spring CORS configuration (Java)
|
|
1311
1338
|
|
|
1312
1339
|
**Security Headers:**
|
|
1340
|
+
|
|
1313
1341
|
- `helmet` (Node.js)
|
|
1314
1342
|
- `django-csp`
|
|
1315
1343
|
- OWASP Java Encoder
|
|
@@ -1363,8 +1391,7 @@ Security Headers:
|
|
|
1363
1391
|
ℹ️ Remaining checks deferred
|
|
1364
1392
|
⏱️ Elapsed: 20s
|
|
1365
1393
|
💾 Tokens: 1,800
|
|
1366
|
-
|
|
1367
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1394
|
+
---
|
|
1368
1395
|
Total: 2m 20s | 14,500 tokens used
|
|
1369
1396
|
Remaining context: 155,500 tokens
|
|
1370
1397
|
```
|
|
@@ -1375,7 +1402,7 @@ Remaining context: 155,500 tokens
|
|
|
1375
1402
|
✅ Layer 3 Complete (2m 30s)
|
|
1376
1403
|
|
|
1377
1404
|
📡 API Endpoints: [127 detected]
|
|
1378
|
-
|
|
1405
|
+
---
|
|
1379
1406
|
By Method:
|
|
1380
1407
|
GET: 58 endpoints
|
|
1381
1408
|
POST: 32 endpoints
|
|
@@ -1395,10 +1422,10 @@ Sample Endpoints:
|
|
|
1395
1422
|
• GET /api/users/:id → UsersController.findOne
|
|
1396
1423
|
• POST /api/products → ProductsController.create
|
|
1397
1424
|
• PUT /api/orders/:id → OrdersController.update
|
|
1398
|
-
[View full list in analysis.json]
|
|
1425
|
+
[View full list in docs-analysis.json]
|
|
1399
1426
|
|
|
1400
1427
|
🗄️ Database Entities: [18 detected]
|
|
1401
|
-
|
|
1428
|
+
---
|
|
1402
1429
|
Core Entities:
|
|
1403
1430
|
• User (8 fields, 3 relationships)
|
|
1404
1431
|
- Relationships: OneToMany → Orders, OneToMany → Reviews
|
|
@@ -1407,10 +1434,10 @@ Core Entities:
|
|
|
1407
1434
|
• Order (10 fields, 4 relationships)
|
|
1408
1435
|
- Relationships: ManyToOne → User, OneToMany → OrderItems, etc.
|
|
1409
1436
|
|
|
1410
|
-
[+15 more entities - see analysis.json for full schema]
|
|
1437
|
+
[+15 more entities - see docs-analysis.json for full schema]
|
|
1411
1438
|
|
|
1412
1439
|
🔒 Security Patterns:
|
|
1413
|
-
|
|
1440
|
+
---
|
|
1414
1441
|
✅ Authentication: JWT with bcrypt
|
|
1415
1442
|
✅ Validation: class-validator + DTOs
|
|
1416
1443
|
⚠️ Rate Limiting: Not detected
|
|
@@ -1419,14 +1446,11 @@ Core Entities:
|
|
|
1419
1446
|
|
|
1420
1447
|
💾 Context Used: ~14,500 tokens (total: ~18,700)
|
|
1421
1448
|
⏱️ Time Elapsed: 3m 45s
|
|
1422
|
-
|
|
1423
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1449
|
+
---
|
|
1424
1450
|
```
|
|
1425
1451
|
|
|
1426
1452
|
**Context Usage:** ~5,000-25,000 tokens (cumulative: ~8,000-31,500)
|
|
1427
|
-
|
|
1428
|
-
---
|
|
1429
|
-
|
|
1453
|
+
---
|
|
1430
1454
|
## 0.4 Proactive Improvement Suggestions
|
|
1431
1455
|
|
|
1432
1456
|
```
|
|
@@ -1474,9 +1498,7 @@ Based on my analysis, I found opportunities for improvement:
|
|
|
1474
1498
|
Action: Implement cursor-based or offset pagination
|
|
1475
1499
|
Impact: Better performance with large datasets
|
|
1476
1500
|
Estimated effort: 2-3 hours
|
|
1477
|
-
|
|
1478
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1479
|
-
|
|
1501
|
+
---
|
|
1480
1502
|
Would you like to:
|
|
1481
1503
|
|
|
1482
1504
|
A) ✅ Address these during build (I'll integrate into relevant phases)
|
|
@@ -1492,23 +1514,24 @@ Your choice: __
|
|
|
1492
1514
|
```
|
|
1493
1515
|
|
|
1494
1516
|
**If user selects A:**
|
|
1517
|
+
|
|
1495
1518
|
- Mark suggestions to be addressed in relevant phases
|
|
1496
1519
|
- When reaching those phases, reference: "Earlier analysis detected X, let's configure it now"
|
|
1497
1520
|
|
|
1498
1521
|
**If user selects B:**
|
|
1522
|
+
|
|
1499
1523
|
- Create `suggestions.md` with all recommendations formatted for reference
|
|
1500
1524
|
|
|
1501
1525
|
**If user selects C:**
|
|
1502
|
-
- Continue without suggestions
|
|
1503
|
-
|
|
1504
|
-
---
|
|
1505
1526
|
|
|
1527
|
+
- Continue without suggestions
|
|
1528
|
+
---
|
|
1506
1529
|
## 0.5 Export Analysis Results
|
|
1507
1530
|
|
|
1508
1531
|
```
|
|
1509
1532
|
💾 Export Analysis to JSON?
|
|
1510
1533
|
|
|
1511
|
-
This creates .ai-flow/analysis.json with all detected information:
|
|
1534
|
+
This creates .ai-flow/cache/docs-analysis.json with all detected information:
|
|
1512
1535
|
• Project metadata and tech stack
|
|
1513
1536
|
• Complete endpoint list with methods, paths, handlers
|
|
1514
1537
|
• Full entity schemas with relationships
|
|
@@ -1592,13 +1615,13 @@ Your choice: __
|
|
|
1592
1615
|
"source": "prisma",
|
|
1593
1616
|
"file": "prisma/schema.prisma",
|
|
1594
1617
|
"fields": [
|
|
1595
|
-
{"name": "id", "type": "String", "required": true, "primary": true},
|
|
1596
|
-
{"name": "email", "type": "String", "required": true, "unique": true},
|
|
1597
|
-
{"name": "password", "type": "String", "required": true}
|
|
1618
|
+
{ "name": "id", "type": "String", "required": true, "primary": true },
|
|
1619
|
+
{ "name": "email", "type": "String", "required": true, "unique": true },
|
|
1620
|
+
{ "name": "password", "type": "String", "required": true }
|
|
1598
1621
|
],
|
|
1599
1622
|
"relationships": [
|
|
1600
|
-
{"type": "OneToMany", "target": "Order", "field": "orders"},
|
|
1601
|
-
{"type": "OneToMany", "target": "Review", "field": "reviews"}
|
|
1623
|
+
{ "type": "OneToMany", "target": "Order", "field": "orders" },
|
|
1624
|
+
{ "type": "OneToMany", "target": "Review", "field": "reviews" }
|
|
1602
1625
|
]
|
|
1603
1626
|
}
|
|
1604
1627
|
// ... 17 more
|
|
@@ -1638,7 +1661,7 @@ Your choice: __
|
|
|
1638
1661
|
"count": 87,
|
|
1639
1662
|
"paths": [
|
|
1640
1663
|
"src/users/users.controller.ts",
|
|
1641
|
-
"src/products/products.controller.ts"
|
|
1664
|
+
"src/products/products.controller.ts"
|
|
1642
1665
|
// ... all analyzed files
|
|
1643
1666
|
],
|
|
1644
1667
|
"timestamps": {
|
|
@@ -1651,7 +1674,7 @@ Your choice: __
|
|
|
1651
1674
|
```
|
|
1652
1675
|
|
|
1653
1676
|
```
|
|
1654
|
-
✅ Analysis exported to .ai-flow/analysis.json
|
|
1677
|
+
✅ Analysis exported to .ai-flow/cache/docs-analysis.json
|
|
1655
1678
|
|
|
1656
1679
|
File size: 142 KB
|
|
1657
1680
|
Contains:
|
|
@@ -1662,9 +1685,7 @@ Contains:
|
|
|
1662
1685
|
|
|
1663
1686
|
You can view/edit this file anytime or share with your team.
|
|
1664
1687
|
```
|
|
1665
|
-
|
|
1666
|
-
---
|
|
1667
|
-
|
|
1688
|
+
---
|
|
1668
1689
|
## 0.6 Load Detected Context & Pre-populate Answers
|
|
1669
1690
|
|
|
1670
1691
|
**If user selected "Use detected information":**
|
|
@@ -1725,9 +1746,7 @@ Phase 7 (Operations):
|
|
|
1725
1746
|
❓ Environment setup: [NEED TO ASK]
|
|
1726
1747
|
❓ Monitoring: [NEED TO ASK]
|
|
1727
1748
|
❓ Logging: [NEED TO ASK]
|
|
1728
|
-
|
|
1729
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1730
|
-
|
|
1749
|
+
---
|
|
1731
1750
|
📊 Analysis Summary:
|
|
1732
1751
|
• Pre-populated: ~45% of answers
|
|
1733
1752
|
• Need to ask: ~55% (gaps in documentation)
|
|
@@ -1737,9 +1756,7 @@ Ready to proceed to Project Scope Selection?
|
|
|
1737
1756
|
|
|
1738
1757
|
Type 'yes' to continue: __
|
|
1739
1758
|
```
|
|
1740
|
-
|
|
1741
|
-
---
|
|
1742
|
-
|
|
1759
|
+
---
|
|
1743
1760
|
## 0.7 Error Handling & Recovery
|
|
1744
1761
|
|
|
1745
1762
|
**If any layer fails:**
|
|
@@ -1793,16 +1810,13 @@ Progress: 24 of 30 files analyzed (80% success rate)
|
|
|
1793
1810
|
3. **Out of memory:** Reduce sample size, retry
|
|
1794
1811
|
4. **Context limit:** Stop analysis, use partial results
|
|
1795
1812
|
5. **Network timeout:** (if remote files) Retry with backoff
|
|
1796
|
-
|
|
1797
|
-
---
|
|
1798
|
-
|
|
1813
|
+
---
|
|
1799
1814
|
## 🎯 Summary: Phase 0 Complete
|
|
1800
1815
|
|
|
1801
1816
|
```
|
|
1802
|
-
|
|
1817
|
+
---
|
|
1803
1818
|
✅ CONTEXT DISCOVERY COMPLETE
|
|
1804
|
-
|
|
1805
|
-
|
|
1819
|
+
---
|
|
1806
1820
|
📊 Project: ecommerce-api
|
|
1807
1821
|
🛠️ Stack: TypeScript 5.3 + NestJS 10.2 + Prisma 5.7 + PostgreSQL
|
|
1808
1822
|
📈 Maturity: Basic documentation
|
|
@@ -1813,7 +1827,7 @@ Analysis Results:
|
|
|
1813
1827
|
✅ 18 database entities with 45 relationships
|
|
1814
1828
|
✅ Security patterns analyzed
|
|
1815
1829
|
✅ 7 improvement suggestions generated
|
|
1816
|
-
✅ Analysis exported to .ai-flow/analysis.json
|
|
1830
|
+
✅ Analysis exported to .ai-flow/cache/docs-analysis.json
|
|
1817
1831
|
|
|
1818
1832
|
Pre-population Status:
|
|
1819
1833
|
• 45% of questionnaire answers populated
|
|
@@ -1826,17 +1840,15 @@ Performance:
|
|
|
1826
1840
|
📊 Remaining: 181,300 tokens for phases 1-7
|
|
1827
1841
|
|
|
1828
1842
|
Next Step: Project Scope Selection
|
|
1829
|
-
|
|
1830
|
-
|
|
1843
|
+
---
|
|
1831
1844
|
Press Enter to continue to Project Scope Selection...
|
|
1832
1845
|
```
|
|
1833
|
-
|
|
1834
|
-
---
|
|
1835
|
-
|
|
1846
|
+
---
|
|
1836
1847
|
**After Phase 0 completes, ALWAYS proceed to Project Scope Selection before Phase 1.**
|
|
1837
|
-
|
|
1838
|
-
---
|
|
1848
|
+
---
|
|
1839
1849
|
## PHASE 1: Discovery & Business (15-20 min)
|
|
1840
1850
|
|
|
1841
1851
|
|
|
1842
1852
|
|
|
1853
|
+
|
|
1854
|
+
|