ai-flow-dev 2.1.2 → 2.1.3

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 CHANGED
@@ -133,7 +133,7 @@ Or using uv (Python tool manager):
133
133
  uv tool install ai-flow-dev
134
134
  ```
135
135
 
136
- **Current version:** 2.1.1
136
+ **Current version:** 2.1.2
137
137
 
138
138
  ---
139
139
 
@@ -261,8 +261,9 @@ After initialization, use these slash commands in your AI tool:
261
261
 
262
262
  > **Note:** Command prefix may vary by AI tool. Examples use `/flow-` (GitHub Copilot), but Claude may use `/` alone, Cursor may use `@`, etc. Check your tool's documentation.
263
263
 
264
- **Backend Projects:** 19 commands
265
- **Frontend/Mobile Projects:** 2 commands (build + docs-sync)
264
+ **Backend Projects:** 8 commands
265
+ **Frontend Projects:** 2 commands
266
+ **Mobile Projects:** 2 commands
266
267
  **Fullstack Projects:** Combined backend + frontend commands
267
268
 
268
269
  **Documentation & Build:**
@@ -338,7 +339,7 @@ After initialization, use these slash commands in your AI tool:
338
339
 
339
340
  ## 🎯 Generated Documentation
340
341
 
341
- **Backend** (14 docs): AGENT.md, ai-instructions.md, copilot-instructions.md, project-brief.md, plus 8 technical docs and 2 specs
342
+ **Backend** (14 docs): AGENT.md, ai-instructions.md, copilot-instructions.md, project-brief.md, README.md, plus 8 technical docs and 1 spec
342
343
 
343
344
  **Frontend** (15 docs): AGENT.md, ai-instructions.md, project-brief.md, plus 9 technical docs and 3 specs
344
345
 
package/dist/cli.js CHANGED
@@ -625,7 +625,7 @@ async function initializeProject(targetPath, aiTool, projectType, projectName, p
625
625
  program
626
626
  .name('ai-flow')
627
627
  .description('AI-powered development workflow from idea to production. Generate specs, plan features, and build with AI assistance.')
628
- .version('2.1.2');
628
+ .version('2.1.3');
629
629
  program
630
630
  .command('init')
631
631
  .description('Initialize AI Flow in current directory')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-flow-dev",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "AI-powered development workflow from idea to production. Generate specs, plan features, and build with AI assistance throughout your project lifecycle.",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",
@@ -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
@@ -36,7 +37,7 @@ Result Synthesis & Pre-population
36
37
 
37
38
  **Actions:**
38
39
 
39
- 1. Check if `.ai-flow/analysis.json` exists
40
+ 1. Check if `.ai-flow/cache/docs-analysis.json` exists
40
41
  2. If exists:
41
42
  - Read `analyzedAt` timestamp
42
43
  - Read `filesAnalyzed` with their timestamps
@@ -448,6 +449,7 @@ This scans directory organization and file counts without reading code.
448
449
  **Language-specific directory patterns:**
449
450
 
450
451
  **Node.js/TypeScript:**
452
+
451
453
  ```
452
454
  Scanning directories:
453
455
  • src/**/* or app/**/* or lib/**/*
@@ -465,6 +467,7 @@ Counting files by pattern:
465
467
  ```
466
468
 
467
469
  **Python:**
470
+
468
471
  ```
469
472
  Scanning directories:
470
473
  • app/**/*.py or src/**/*.py
@@ -479,6 +482,7 @@ Counting files by pattern:
479
482
  ```
480
483
 
481
484
  **PHP:**
485
+
482
486
  ```
483
487
  Scanning directories:
484
488
  • app/**/*.php or src/**/*.php
@@ -492,6 +496,7 @@ Counting files by pattern:
492
496
  ```
493
497
 
494
498
  **Java:**
499
+
495
500
  ```
496
501
  Scanning directories:
497
502
  • src/main/java/**/*.java
@@ -506,6 +511,7 @@ Counting files by pattern:
506
511
  ```
507
512
 
508
513
  **C#/.NET:**
514
+
509
515
  ```
510
516
  Scanning directories:
511
517
  • **/*.cs (excluding obj/, bin/)
@@ -520,6 +526,7 @@ Counting files by pattern:
520
526
  ```
521
527
 
522
528
  **Go:**
529
+
523
530
  ```
524
531
  Scanning directories:
525
532
  • **/*.go (excluding vendor/)
@@ -533,6 +540,7 @@ Counting files by pattern:
533
540
  ```
534
541
 
535
542
  **Ruby:**
543
+
536
544
  ```
537
545
  Scanning directories:
538
546
  • app/**/*.rb
@@ -559,56 +567,68 @@ Counting files by pattern:
559
567
  **Based on detected ORM:**
560
568
 
561
569
  **Prisma:**
570
+
562
571
  - Read `prisma/schema.prisma`
563
572
  - Extract model names only (regex: `model (\w+)`)
564
573
  - Count total models
565
574
  - Count relationships (count occurrences of `@relation`)
566
575
 
567
576
  **TypeORM:**
577
+
568
578
  - Glob `*.entity.{ts,js}`
569
579
  - Extract entity names from `@Entity()` decorator (regex, no full parsing)
570
580
  - Count entities
571
581
 
572
582
  **Sequelize:**
583
+
573
584
  - Glob `models/**/*.{ts,js}`
574
585
  - Count model files
575
586
 
576
587
  **Mongoose:**
588
+
577
589
  - Glob `*.schema.{ts,js}` or `models/**/*.{ts,js}`
578
590
  - Search for `new Schema(` pattern
579
591
  - Count schemas
580
592
 
581
593
  **Django:**
594
+
582
595
  - Read `*/models.py` files
583
596
  - Extract class names inheriting from `models.Model` (regex)
584
597
  - Count models
585
598
 
586
599
  **SQLAlchemy:**
600
+
587
601
  - Read `**/models.py` or `**/*_model.py`
588
602
  - Extract classes with `Base` or `db.Model` (regex)
589
603
  - Count models
590
604
 
591
605
  **Eloquent (Laravel):**
606
+
592
607
  - Glob `app/Models/**/*.php`
593
608
  - Count model files
594
609
 
595
610
  **Doctrine (Symfony/PHP):**
611
+
596
612
  - Glob `src/Entity/**/*.php`
597
613
  - Count entity files
598
614
 
599
615
  **Hibernate/JPA (Java):**
616
+
600
617
  - Glob `**/*Entity.java`
601
618
  - Count entity files
602
619
 
603
620
  **Entity Framework (.NET):**
621
+
604
622
  - Glob `**/Models/**/*.cs` or `**/Entities/**/*.cs`
605
623
  - Count entity files
606
624
 
607
625
  **GORM (Go):**
626
+
608
627
  - Search for `type.*struct` in `models/**/*.go`
609
628
  - Count structs
610
629
 
611
630
  **ActiveRecord (Ruby):**
631
+
612
632
  - Glob `app/models/**/*.rb`
613
633
  - Count model files
614
634
 
@@ -639,6 +659,7 @@ Checking docs/ directory...
639
659
  ```
640
660
 
641
661
  **Maturity Level:**
662
+
642
663
  - 🌱 **Minimal:** 0-1 docs → Suggest **MVP or Production-Ready scope**
643
664
  - 🌿 **Basic:** 2-4 docs → Suggest **Production-Ready scope**
644
665
  - 🌳 **Comprehensive:** 5-7 docs → Suggest **Production-Ready or Enterprise scope**
@@ -781,11 +802,11 @@ function selectFilesToAnalyze(files: string[], category: string, maxFiles: numbe
781
802
  services: 9,
782
803
  entities: 10,
783
804
  repositories: 8,
784
- dto: 7
805
+ dto: 7,
785
806
  };
786
807
 
787
808
  // Group by module/feature
788
- const byModule = groupBy(files, file => file.split('/')[1]);
809
+ const byModule = groupBy(files, (file) => file.split('/')[1]);
789
810
 
790
811
  // Sample proportionally from each module
791
812
  const samples = [];
@@ -851,6 +872,7 @@ Your choice: __
851
872
  **Node.js/TypeScript:**
852
873
 
853
874
  **API Endpoints (NestJS):**
875
+
854
876
  ```typescript
855
877
  // Sample up to 30 controller files
856
878
  const controllerFiles = glob('**/*.controller.{ts,js}').slice(0, 30);
@@ -867,7 +889,7 @@ for (const file of controllerFiles) {
867
889
  ...content.matchAll(/@Post\(['"](.+?)['"]\)\s+(\w+)/g),
868
890
  ...content.matchAll(/@Put\(['"](.+?)['"]\)\s+(\w+)/g),
869
891
  ...content.matchAll(/@Delete\(['"](.+?)['"]\)\s+(\w+)/g),
870
- ...content.matchAll(/@Patch\(['"](.+?)['"]\)\s+(\w+)/g)
892
+ ...content.matchAll(/@Patch\(['"](.+?)['"]\)\s+(\w+)/g),
871
893
  ];
872
894
 
873
895
  for (const [fullMatch, path, handlerName, method] of routes) {
@@ -875,13 +897,14 @@ for (const file of controllerFiles) {
875
897
  method: method,
876
898
  path: `${basePath}/${path}`,
877
899
  handler: handlerName,
878
- file: file
900
+ file: file,
879
901
  });
880
902
  }
881
903
  }
882
904
  ```
883
905
 
884
906
  **API Endpoints (Express):**
907
+
885
908
  ```typescript
886
909
  const routeFiles = glob('**/routes/**/*.{ts,js}').slice(0, 20);
887
910
 
@@ -890,16 +913,17 @@ for (const file of routeFiles) {
890
913
 
891
914
  const routes = [
892
915
  ...content.matchAll(/router\.(get|post|put|delete|patch)\(['"](.+?)['"],\s*(\w+)/g),
893
- ...content.matchAll(/app\.(get|post|put|delete|patch)\(['"](.+?)['"],\s*(\w+)/g)
916
+ ...content.matchAll(/app\.(get|post|put|delete|patch)\(['"](.+?)['"],\s*(\w+)/g),
894
917
  ];
895
918
 
896
919
  for (const [, method, path, handler] of routes) {
897
- endpoints.push({method: method.toUpperCase(), path, handler, file});
920
+ endpoints.push({ method: method.toUpperCase(), path, handler, file });
898
921
  }
899
922
  }
900
923
  ```
901
924
 
902
925
  **Entities (Prisma):**
926
+
903
927
  ```typescript
904
928
  // Read prisma/schema.prisma
905
929
  const schema = readFile('prisma/schema.prisma');
@@ -915,9 +939,9 @@ for (const [, modelName, body] of models) {
915
939
  fields: fields.map(([, name, type, decorator]) => ({
916
940
  name,
917
941
  type,
918
- decorator
942
+ decorator,
919
943
  })),
920
- relationships: [...body.matchAll(/@relation\(([^)]+)\)/g)].map(m => m[1])
944
+ relationships: [...body.matchAll(/@relation\(([^)]+)\)/g)].map((m) => m[1]),
921
945
  };
922
946
 
923
947
  entities.push(entity);
@@ -927,6 +951,7 @@ for (const [, modelName, body] of models) {
927
951
  **Python:**
928
952
 
929
953
  **API Endpoints (FastAPI):**
954
+
930
955
  ```python
931
956
  # Sample router files
932
957
  routerFiles = glob('**/*routes.py', '**/*router.py')[:20]
@@ -947,6 +972,7 @@ for file in routerFiles:
947
972
  ```
948
973
 
949
974
  **Entities (Django):**
975
+
950
976
  ```python
951
977
  # Read models.py files
952
978
  modelFiles = glob('**/models.py')[:15]
@@ -970,6 +996,7 @@ for file in modelFiles:
970
996
  **PHP:**
971
997
 
972
998
  **API Endpoints (Laravel):**
999
+
973
1000
  ```php
974
1001
  // Read routes/api.php and routes/web.php
975
1002
  $routeFiles = ['routes/api.php', 'routes/web.php'];
@@ -992,6 +1019,7 @@ foreach ($routeFiles as $file) {
992
1019
  ```
993
1020
 
994
1021
  **Entities (Eloquent):**
1022
+
995
1023
  ```php
996
1024
  // Glob app/Models/*.php
997
1025
  $modelFiles = glob('app/Models/*.php');
@@ -1014,6 +1042,7 @@ foreach ($modelFiles as $file) {
1014
1042
  **Java:**
1015
1043
 
1016
1044
  **API Endpoints (Spring Boot):**
1045
+
1017
1046
  ```java
1018
1047
  // Glob **/*Controller.java (sample 25)
1019
1048
  List<String> controllerFiles = glob("**/*Controller.java").subList(0, 25);
@@ -1040,6 +1069,7 @@ for (String file : controllerFiles) {
1040
1069
  ```
1041
1070
 
1042
1071
  **Entities (JPA/Hibernate):**
1072
+
1043
1073
  ```java
1044
1074
  // Glob **/*Entity.java
1045
1075
  List<String> entityFiles = glob("**/*Entity.java").subList(0, 30);
@@ -1069,6 +1099,7 @@ for (String file : entityFiles) {
1069
1099
  **C#/.NET:**
1070
1100
 
1071
1101
  **API Endpoints (ASP.NET Core):**
1102
+
1072
1103
  ```csharp
1073
1104
  // Glob **/*Controller.cs
1074
1105
  var controllerFiles = Directory.GetFiles(".", "*Controller.cs", SearchOption.AllDirectories).Take(25);
@@ -1095,6 +1126,7 @@ foreach (var file in controllerFiles) {
1095
1126
  ```
1096
1127
 
1097
1128
  **Entities (Entity Framework):**
1129
+
1098
1130
  ```csharp
1099
1131
  // Glob **/Models/**/*.cs or **/Entities/**/*.cs
1100
1132
  var entityFiles = Directory.GetFiles(".", "*.cs", SearchOption.AllDirectories)
@@ -1125,6 +1157,7 @@ foreach (var file in entityFiles) {
1125
1157
  **Go:**
1126
1158
 
1127
1159
  **API Endpoints (Gin):**
1160
+
1128
1161
  ```go
1129
1162
  // Read handler files
1130
1163
  handlerFiles := filepath.Glob("**/handlers/**/*.go")[:20]
@@ -1148,6 +1181,7 @@ for _, file := range handlerFiles {
1148
1181
  ```
1149
1182
 
1150
1183
  **Entities (GORM):**
1184
+
1151
1185
  ```go
1152
1186
  // Read model files
1153
1187
  modelFiles := filepath.Glob("**/models/**/*.go")[:20]
@@ -1180,6 +1214,7 @@ for _, file := range modelFiles {
1180
1214
  **Ruby:**
1181
1215
 
1182
1216
  **API Endpoints (Rails):**
1217
+
1183
1218
  ```ruby
1184
1219
  # Read routes.rb
1185
1220
  routes_file = 'config/routes.rb'
@@ -1214,6 +1249,7 @@ end
1214
1249
  ```
1215
1250
 
1216
1251
  **Entities (ActiveRecord):**
1252
+
1217
1253
  ```ruby
1218
1254
  # Glob app/models/*.rb
1219
1255
  model_files = Dir.glob('app/models/**/*.rb')[0..20]
@@ -1242,6 +1278,7 @@ end
1242
1278
  **Rust:**
1243
1279
 
1244
1280
  **API Endpoints (Actix):**
1281
+
1245
1282
  ```rust
1246
1283
  // Read handler files
1247
1284
  let handler_files: Vec<_> = glob("**/handlers/**/*.rs").unwrap().take(15).collect();
@@ -1264,6 +1301,7 @@ for file in handler_files {
1264
1301
  ```
1265
1302
 
1266
1303
  **Entities (Diesel):**
1304
+
1267
1305
  ```rust
1268
1306
  // Read schema.rs and models.rs
1269
1307
  let schema = fs::read_to_string("src/schema.rs").ok();
@@ -1287,12 +1325,14 @@ if let Some(schema_content) = schema {
1287
1325
  **Scan for security patterns across all languages:**
1288
1326
 
1289
1327
  **Authentication:**
1328
+
1290
1329
  - JWT libraries: `jsonwebtoken`, `@nestjs/jwt`, `pyjwt`, `jjwt`, etc.
1291
1330
  - Session libraries: `express-session`, `django.contrib.sessions`
1292
1331
  - OAuth libraries: `passport`, `authlib`, `spring-security-oauth2`
1293
1332
  - Password hashing: `bcrypt`, `argon2`, `password_hash` (PHP)
1294
1333
 
1295
1334
  **Validation:**
1335
+
1296
1336
  - `class-validator`, `joi`, `zod` (Node.js)
1297
1337
  - `pydantic`, `marshmallow` (Python)
1298
1338
  - Laravel validation rules (PHP)
@@ -1300,16 +1340,19 @@ if let Some(schema_content) = schema {
1300
1340
  - Data Annotations (.NET)
1301
1341
 
1302
1342
  **Rate Limiting:**
1343
+
1303
1344
  - `express-rate-limit`, `@nestjs/throttler`
1304
1345
  - `django-ratelimit`, `slowapi`
1305
1346
  - Bucket4j (Java)
1306
1347
 
1307
1348
  **CORS:**
1349
+
1308
1350
  - `cors` package (Node.js)
1309
1351
  - `django-cors-headers` (Python)
1310
1352
  - Spring CORS configuration (Java)
1311
1353
 
1312
1354
  **Security Headers:**
1355
+
1313
1356
  - `helmet` (Node.js)
1314
1357
  - `django-csp`
1315
1358
  - OWASP Java Encoder
@@ -1395,7 +1438,7 @@ Sample Endpoints:
1395
1438
  • GET /api/users/:id → UsersController.findOne
1396
1439
  • POST /api/products → ProductsController.create
1397
1440
  • PUT /api/orders/:id → OrdersController.update
1398
- [View full list in analysis.json]
1441
+ [View full list in docs-analysis.json]
1399
1442
 
1400
1443
  🗄️ Database Entities: [18 detected]
1401
1444
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -1407,7 +1450,7 @@ Core Entities:
1407
1450
  • Order (10 fields, 4 relationships)
1408
1451
  - Relationships: ManyToOne → User, OneToMany → OrderItems, etc.
1409
1452
 
1410
- [+15 more entities - see analysis.json for full schema]
1453
+ [+15 more entities - see docs-analysis.json for full schema]
1411
1454
 
1412
1455
  🔒 Security Patterns:
1413
1456
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -1492,13 +1535,16 @@ Your choice: __
1492
1535
  ```
1493
1536
 
1494
1537
  **If user selects A:**
1538
+
1495
1539
  - Mark suggestions to be addressed in relevant phases
1496
1540
  - When reaching those phases, reference: "Earlier analysis detected X, let's configure it now"
1497
1541
 
1498
1542
  **If user selects B:**
1543
+
1499
1544
  - Create `suggestions.md` with all recommendations formatted for reference
1500
1545
 
1501
1546
  **If user selects C:**
1547
+
1502
1548
  - Continue without suggestions
1503
1549
 
1504
1550
  ---
@@ -1508,7 +1554,7 @@ Your choice: __
1508
1554
  ```
1509
1555
  💾 Export Analysis to JSON?
1510
1556
 
1511
- This creates .ai-flow/analysis.json with all detected information:
1557
+ This creates .ai-flow/cache/docs-analysis.json with all detected information:
1512
1558
  • Project metadata and tech stack
1513
1559
  • Complete endpoint list with methods, paths, handlers
1514
1560
  • Full entity schemas with relationships
@@ -1592,13 +1638,13 @@ Your choice: __
1592
1638
  "source": "prisma",
1593
1639
  "file": "prisma/schema.prisma",
1594
1640
  "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}
1641
+ { "name": "id", "type": "String", "required": true, "primary": true },
1642
+ { "name": "email", "type": "String", "required": true, "unique": true },
1643
+ { "name": "password", "type": "String", "required": true }
1598
1644
  ],
1599
1645
  "relationships": [
1600
- {"type": "OneToMany", "target": "Order", "field": "orders"},
1601
- {"type": "OneToMany", "target": "Review", "field": "reviews"}
1646
+ { "type": "OneToMany", "target": "Order", "field": "orders" },
1647
+ { "type": "OneToMany", "target": "Review", "field": "reviews" }
1602
1648
  ]
1603
1649
  }
1604
1650
  // ... 17 more
@@ -1638,7 +1684,7 @@ Your choice: __
1638
1684
  "count": 87,
1639
1685
  "paths": [
1640
1686
  "src/users/users.controller.ts",
1641
- "src/products/products.controller.ts",
1687
+ "src/products/products.controller.ts"
1642
1688
  // ... all analyzed files
1643
1689
  ],
1644
1690
  "timestamps": {
@@ -1651,7 +1697,7 @@ Your choice: __
1651
1697
  ```
1652
1698
 
1653
1699
  ```
1654
- ✅ Analysis exported to .ai-flow/analysis.json
1700
+ ✅ Analysis exported to .ai-flow/cache/docs-analysis.json
1655
1701
 
1656
1702
  File size: 142 KB
1657
1703
  Contains:
@@ -1813,7 +1859,7 @@ Analysis Results:
1813
1859
  ✅ 18 database entities with 45 relationships
1814
1860
  ✅ Security patterns analyzed
1815
1861
  ✅ 7 improvement suggestions generated
1816
- ✅ Analysis exported to .ai-flow/analysis.json
1862
+ ✅ Analysis exported to .ai-flow/cache/docs-analysis.json
1817
1863
 
1818
1864
  Pre-population Status:
1819
1865
  • 45% of questionnaire answers populated
@@ -1836,7 +1882,5 @@ Press Enter to continue to Project Scope Selection...
1836
1882
  **After Phase 0 completes, ALWAYS proceed to Project Scope Selection before Phase 1.**
1837
1883
 
1838
1884
  ---
1839
- ## PHASE 1: Discovery & Business (15-20 min)
1840
-
1841
-
1842
1885
 
1886
+ ## PHASE 1: Discovery & Business (15-20 min)
@@ -1,4 +1,4 @@
1
- ## PHASE 1: Discovery & Business (15-20 min)
1
+ ## PHASE 1: Discovery & Business (15-20 min)
2
2
 
3
3
  > **Order for this phase:** 1.1 → 1.2 → 1.3 → 1.4 → 1.5 → 1.6 → 1.7 → 1.8 → 1.9 → 1.10
4
4
 
@@ -30,7 +30,7 @@ Generate executable User Stories following agile best practices with:
30
30
 
31
31
  Before executing Phase 10, verify:
32
32
 
33
- - ✅ Phase 9 completed (`roadmap.md` exists)
33
+ - ✅ Phase 9 completed (`docs/roadmap.md` exists)
34
34
  - ✅ All Phase 1-8 documentation exists
35
35
  - ✅ Roadmap contains Epics, Features, and Tasks
36
36
 
@@ -70,6 +70,8 @@ if (!args || args.length === 0) {
70
70
  /flow-build fase 10 → Generate all (or Sprint 1)
71
71
  /flow-build fase 10 EP-001 → Generate Epic 001 User Stories
72
72
  /flow-build fase 10 HU-001-001 → Generate specific User Story
73
+
74
+ Output location: docs/user-stories/
73
75
  `);
74
76
  exit();
75
77
  }
@@ -90,7 +92,7 @@ Mode: [ALL | EPIC: EP-001 | STORY: HU-001-001]
90
92
  ```
91
93
  Loading project context...
92
94
 
93
- ✅ roadmap.md (5 Epics, 18 Features, 89 SP)
95
+ docs/roadmap.md (5 Epics, 18 Features, 89 SP)
94
96
  ✅ project-brief.md (business context)
95
97
  ✅ ai-instructions.md (tech stack, patterns)
96
98
  ✅ docs/data-model.md (entities, relationships)
@@ -100,12 +102,12 @@ Loading project context...
100
102
  ✅ docs/testing.md (test strategy)
101
103
  ```
102
104
 
103
- **If roadmap.md NOT found:**
105
+ **If docs/roadmap.md NOT found:**
104
106
 
105
107
  ```
106
- ❌ Error: roadmap.md not found
108
+ ❌ Error: docs/roadmap.md not found
107
109
 
108
- Phase 10 requires roadmap.md from Phase 9.
110
+ Phase 10 requires docs/roadmap.md from Phase 9.
109
111
 
110
112
  Options:
111
113
  1. ✅ Generate roadmap first: /flow-build fase 9
@@ -129,7 +131,7 @@ Your choice (1): _
129
131
  📋 Scope Selection
130
132
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
131
133
 
132
- Found 5 Epics with 18 Features in roadmap.md
134
+ Found 5 Epics with 18 Features in docs/roadmap.md
133
135
 
134
136
  Total Story Points: 89 SP (~4-5 weeks for 1 dev)
135
137
 
@@ -185,7 +187,7 @@ Generating...
185
187
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
186
188
 
187
189
  Created:
188
- 📁 user-stories/
190
+ 📁 .ai-flow/user-stories/
189
191
  ├── EP-001/
190
192
  │ ├── HU-001-001.md ✅
191
193
  │ ├── HU-001-002.md ✅
@@ -202,7 +204,7 @@ Total: 8 User Stories (34 SP)
202
204
  🚀 Ready to start Sprint 1!
203
205
 
204
206
  Next steps:
205
- 1. Review User Stories in user-stories/ folder
207
+ 1. Review User Stories in .ai-flow/user-stories/ folder
206
208
  2. Start implementing: /flow-dev-feature HU-001-001
207
209
  3. Generate more Epics later: /flow-build fase 10 EP-003
208
210
  ```
@@ -216,7 +218,7 @@ Next steps:
216
218
  📖 Generating User Stories for EP-001
217
219
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
218
220
 
219
- Loading Epic from roadmap.md...
221
+ Loading Epic from docs/roadmap.md...
220
222
 
221
223
  Epic: EP-001 - Autenticación y Seguridad
222
224
  Priority: P0 (Critical)
@@ -246,7 +248,7 @@ Generating...
246
248
  ✅ EP-001 User Stories Generated
247
249
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
248
250
 
249
- Location: user-stories/EP-001/
251
+ Location: .ai-flow/user-stories/EP-001/
250
252
 
251
253
  Files created:
252
254
  - HU-001-001.md (5 SP, 6 tasks, 8 test cases)
@@ -271,7 +273,7 @@ Next: Start implementing with /flow-dev-feature HU-001-001
271
273
 
272
274
  Checking if file exists...
273
275
 
274
- ⚠️ user-stories/EP-001/HU-001-001.md already exists
276
+ ⚠️ .ai-flow/user-stories/EP-001/HU-001-001.md already exists
275
277
 
276
278
  File size: 4.2 KB
277
279
  Last modified: 2025-12-10 15:30
@@ -294,9 +296,9 @@ Your choice (2): _
294
296
 
295
297
  Backup current file? (Y/n): Y
296
298
 
297
- ✅ Backup created: user-stories/EP-001/.backup/HU-001-001.2025-12-12.md
299
+ ✅ Backup created: docs/user-stories/EP-001/.backup/HU-001-001.2025-12-12.md
298
300
 
299
- Loading context from roadmap.md...
301
+ Loading context from docs/roadmap.md...
300
302
  - Epic: EP-001 Autenticación
301
303
  - Feature: 1.1 Login básico (5 SP)
302
304
  - Priority: P0
@@ -311,8 +313,8 @@ Changes:
311
313
  + Refreshed Definition of Done
312
314
  ~ No changes to technical tasks
313
315
 
314
- Location: user-stories/EP-001/HU-001-001.md
315
- Backup: user-stories/EP-001/.backup/HU-001-001.2025-12-12.md
316
+ Location: .ai-flow/user-stories/EP-001/HU-001-001.md
317
+ Backup: .ai-flow/user-stories/EP-001/.backup/HU-001-001.2025-12-12.md
316
318
 
317
319
  [If file doesn't exist - New User Story]
318
320
 
@@ -322,7 +324,7 @@ Context from roadmap:
322
324
  - Epic: EP-001 Autenticación
323
325
  - Feature: 1.1 Login básico (5 SP)
324
326
  - Priority: P0 (Critical)
325
- - Tasks: 6 (from roadmap.md)
327
+ - Tasks: 6 (from docs/roadmap.md)
326
328
 
327
329
  Generating User Story with:
328
330
  ✅ User Story format (Como/Quiero/Para)
@@ -335,7 +337,7 @@ Generating User Story with:
335
337
 
336
338
  ✅ HU-001-001.md created successfully!
337
339
 
338
- Location: user-stories/EP-001/HU-001-001.md
340
+ Location: .ai-flow/user-stories/EP-001/HU-001-001.md
339
341
  Size: 4.2 KB
340
342
  Tasks: 6
341
343
  Test Cases: 8
@@ -398,7 +400,7 @@ EP-{{XXX}}: {{EPIC_NAME}}
398
400
 
399
401
  ## Tareas Técnicas
400
402
 
401
- > **Source:** Inherited from roadmap.md Feature {{FEATURE_NUMBER}}
403
+ > **Source:** Inherited from docs/roadmap.md Feature {{FEATURE_NUMBER}}
402
404
 
403
405
  ### Backend
404
406
 
@@ -539,24 +541,24 @@ EP-{{XXX}}: {{EPIC_NAME}}
539
541
 
540
542
  ### Step 10.4: Update Roadmap with Links
541
543
 
542
- **After generating User Stories, update roadmap.md to add links:**
544
+ **After generating User Stories, update docs/roadmap.md to add links:**
543
545
 
544
546
  ```
545
- Updating roadmap.md with User Story links...
547
+ Updating docs/roadmap.md with User Story links...
546
548
 
547
549
  ✅ Updated Feature 1.1 with link to HU-001-001
548
550
  ✅ Updated Feature 1.2 with link to HU-001-002
549
551
  ✅ Updated Feature 1.3 with link to HU-001-003
550
552
 
551
- roadmap.md updated successfully!
553
+ docs/roadmap.md updated successfully!
552
554
  ```
553
555
 
554
- **Updated roadmap.md format:**
556
+ **Updated docs/roadmap.md format:**
555
557
 
556
558
  ```markdown
557
559
  ### Feature 1.1: Login básico • 5 SP (~6-8h)
558
560
 
559
- **User Story:** 📖 [HU-001-001](./user-stories/EP-001/HU-001-001.md)
561
+ **User Story:** 📖 [HU-001-001](./.ai-flow/user-stories/EP-001/HU-001-001.md)
560
562
 
561
563
  **Status:** ⚪ Not Started
562
564
 
@@ -586,7 +588,7 @@ roadmap.md updated successfully!
586
588
 
587
589
  ### **3. Technical Tasks**
588
590
 
589
- - **Inherit from roadmap:** Use Tasks from roadmap.md Feature
591
+ - **Inherit from roadmap:** Use Tasks from docs/roadmap.md Feature
590
592
  - **Add file paths:** Exact location where code goes
591
593
  - **Add dependencies:** Which tasks block others
592
594
  - **Keep Story Points:** From roadmap estimation
@@ -633,7 +635,7 @@ roadmap.md updated successfully!
633
635
  - ❌ Skip acceptance criteria
634
636
  - ❌ Generate test cases without criteria
635
637
  - ❌ Use generic DoD (personalize per story if needed)
636
- - ❌ Forget to update roadmap.md with links
638
+ - ❌ Forget to update docs/roadmap.md with links
637
639
 
638
640
  ### **ALWAYS:**
639
641
 
@@ -642,7 +644,7 @@ roadmap.md updated successfully!
642
644
  - ✅ Derive 1-2 test cases per scenario
643
645
  - ✅ Link back to Epic and Feature
644
646
  - ✅ Include technical context from docs
645
- - ✅ Update roadmap.md with User Story links
647
+ - ✅ Update docs/roadmap.md with User Story links
646
648
  - ✅ Create backup before regenerating
647
649
 
648
650
  ---
@@ -662,18 +664,18 @@ Total Tasks: {{TASKS}}
662
664
  Total Test Cases: {{TC}}
663
665
 
664
666
  Files created:
665
- 📁 user-stories/
667
+ 📁 docs/user-stories/
666
668
  ├── EP-001/ (5 stories, 13 SP)
667
669
  ├── EP-002/ (3 stories, 21 SP)
668
670
  └── EP-003/ (4 stories, 18 SP)
669
671
 
670
672
  Updated:
671
- ✅ roadmap.md (added User Story links)
673
+ docs/roadmap.md (added User Story links)
672
674
 
673
675
  🚀 Ready to start development!
674
676
 
675
677
  Next steps:
676
- 1. Review User Stories in user-stories/ folder
678
+ 1. Review User Stories in docs/user-stories/ folder
677
679
  2. Start implementing: /flow-dev-feature HU-001-001
678
680
  3. Track progress: /flow-dev-work
679
681
  4. Generate more stories: /flow-build fase 10 EP-004
@@ -1042,7 +1042,7 @@ When executing this master prompt:
1042
1042
  - [ ] Present suggestions with actions and impacts
1043
1043
  - [ ] **Offer export option (0.3):**
1044
1044
  - [ ] Ask if user wants to export analysis to JSON
1045
- - [ ] If yes, create .ai-flow/analysis.json with complete analysis
1045
+ - [ ] If yes, create .ai-flow/cache/docs-analysis.json with complete analysis
1046
1046
  - [ ] Let user choose: A) Use detected info, B) Start fresh, C) Review/edit detected info
1047
1047
  - [ ] **Handle suggestions:**
1048
1048
  - [ ] If user selected A (address during build), integrate suggestions into relevant phases
@@ -788,14 +788,14 @@ With 3 developers: ~9 weeks (47% time savings)
788
788
 
789
789
  ### Step 9.5: Generate Roadmap Document (2-5 minutes - automatic)
790
790
 
791
- **Generate `roadmap.md` with complete implementation plan:**
791
+ **Generate `docs/roadmap.md` with complete implementation plan:**
792
792
 
793
793
  ```
794
794
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
795
795
  📝 Step 9.5/6: Generating Roadmap Document
796
796
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
797
797
 
798
- Writing to roadmap.md...
798
+ Writing to docs/roadmap.md...
799
799
  ```
800
800
 
801
801
  **Roadmap Document Structure:**
@@ -1159,7 +1159,7 @@ Update this roadmap as you complete features:
1159
1159
 
1160
1160
  ```
1161
1161
  ✅ Roadmap document generated
1162
- ✅ Location: roadmap.md
1162
+ ✅ Location: docs/roadmap.md
1163
1163
  ✅ Total: {{TOTAL_EPICS}} Epics, {{TOTAL_FEATURES}} Features, {{TOTAL_TASKS}} Tasks
1164
1164
  ✅ Estimated: {{TOTAL_SP}} Story Points (~{{TOTAL_WEEKS}} weeks)
1165
1165
  ```
@@ -1184,7 +1184,7 @@ Update this roadmap as you complete features:
1184
1184
  ✅ Estimated time: {{SOLO_WEEKS}} weeks (1 dev) | {{TWO_DEV_WEEKS}} weeks (2 devs)
1185
1185
  ✅ Dependency graph: Generated
1186
1186
  ✅ Execution order: Optimized for parallelization
1187
- ✅ Roadmap document: roadmap.md
1187
+ ✅ Roadmap document: docs/roadmap.md
1188
1188
 
1189
1189
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1190
1190
  🎯 What This Roadmap Guarantees
@@ -1213,14 +1213,14 @@ Update this roadmap as you complete features:
1213
1213
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1214
1214
 
1215
1215
  1. **Open the roadmap**
1216
- └─ Open roadmap.md in your editor
1216
+ └─ Open docs/roadmap.md in your editor
1217
1217
 
1218
1218
  2. **Review and adjust priorities**
1219
1219
  └─ Decide which features are MVP vs future phases
1220
1220
  └─ Adjust P0/P1/P2/P3 priorities if needed
1221
1221
 
1222
1222
  3. **Commit the roadmap**
1223
- └─ git add roadmap.md
1223
+ └─ git add docs/roadmap.md
1224
1224
  └─ git commit -m "docs: add implementation roadmap with Story Points"
1225
1225
 
1226
1226
  4. **Start implementation**
@@ -1258,7 +1258,7 @@ Update this roadmap as you complete features:
1258
1258
 
1259
1259
  Ready to start building? 🚀
1260
1260
 
1261
- Open roadmap.md and let's ship this! 💪
1261
+ Open docs/roadmap.md and let's ship this! 💪
1262
1262
 
1263
1263
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1264
1264
  ```
@@ -1276,10 +1276,10 @@ B) ✅ Start implementing from roadmap directly
1276
1276
  → Will execute: /flow-dev-feature {{FIRST_FEATURE_ID}}
1277
1277
 
1278
1278
  C) 📋 Review roadmap first
1279
- → Will open roadmap.md
1279
+ → Will open docs/roadmap.md
1280
1280
 
1281
1281
  D) ✏️ Customize roadmap
1282
- → Will open roadmap.md for editing
1282
+ → Will open docs/roadmap.md for editing
1283
1283
 
1284
1284
  Your choice (A/B/C/D): __
1285
1285
  ```
@@ -1396,7 +1396,7 @@ Please fix documentation and re-run Phase 9
1396
1396
 
1397
1397
  **9.5 Generate Roadmap Document:**
1398
1398
 
1399
- - [ ] Create `roadmap.md`
1399
+ - [ ] Create `docs/roadmap.md`
1400
1400
  - [ ] Include project overview
1401
1401
  - [ ] Include Story Points reference table
1402
1402
  - [ ] Include Epic overview table
@@ -587,7 +587,7 @@ Read .ai-flow/prompts/backend/flow-build-phase-4-security.md and execute only Ph
587
587
 
588
588
  **Generates:**
589
589
 
590
- - `.ai-flow/roadmap.md` (complete implementation plan)
590
+ - `docs/roadmap.md` (complete implementation plan)
591
591
 
592
592
  **Output includes:**
593
593
 
@@ -733,12 +733,12 @@ As your project evolves, your documentation may become out of sync with your cod
733
733
 
734
734
  **How it works:**
735
735
 
736
- 1. Compares current code state with last documented state (`.ai-flow/analysis.json`)
736
+ 1. Compares current code state with last documented state (`.ai-flow/cache/docs-analysis.json`)
737
737
  2. Detects changes in endpoints, entities, dependencies, architecture, configuration
738
738
  3. Shows report of documents that need updating
739
739
  4. Asks for confirmation to update all detected documents
740
740
  5. Updates documents incrementally (only changed sections)
741
- 6. Updates `analysis.json` with new state
741
+ 6. Updates `docs-analysis.json` with new state
742
742
 
743
743
  **When to use:**
744
744
 
@@ -60,15 +60,15 @@ const input = getArguments(); // From /feature [args]
60
60
  if (input.match(/^HU-\d{3}-\d{3}$/)) {
61
61
  mode = 'USER_STORY';
62
62
  storyId = input; // e.g., HU-001-001
63
- // Load from user-stories/EP-XXX/HU-XXX-XXX.md
64
- } else if (fs.existsSync('roadmap.md')) {
65
- // Search for Feature in roadmap.md matching input
66
- const roadmapContent = readFile('roadmap.md');
63
+ // Load from docs/user-stories/EP-XXX/HU-XXX-XXX.md
64
+ } else if (fs.existsSync('docs/roadmap.md')) {
65
+ // Search for Feature in docs/roadmap.md matching input
66
+ const roadmapContent = readFile('docs/roadmap.md');
67
67
  const featureMatch = roadmapContent.match(new RegExp(`### Feature.*${input}.*• (\d+) SP`));
68
68
  if (featureMatch) {
69
69
  mode = 'ROADMAP_FEATURE';
70
70
  featureName = input;
71
- // Extract tasks from roadmap.md
71
+ // Extract tasks from docs/roadmap.md
72
72
  } else {
73
73
  mode = 'INTERACTIVE'; // Fallback to manual questions
74
74
  }
@@ -79,11 +79,11 @@ if (input.match(/^HU-\d{3}-\d{3}$/)) {
79
79
 
80
80
  **Mode behavior:**
81
81
 
82
- | Mode | Source | Skip Phase 1 |
83
- | ----------------- | ----------------------------------- | ------------------------ |
84
- | `USER_STORY` | `user-stories/EP-XXX/HU-XXX-XXX.md` | ✅ Yes (auto-load spec) |
85
- | `ROADMAP_FEATURE` | `roadmap.md` Feature section | ✅ Yes (auto-load tasks) |
86
- | `INTERACTIVE` | Manual questions | ❌ No (ask user) |
82
+ | Mode | Source | Skip Phase 1 |
83
+ | ----------------- | ---------------------------------------- | ------------------------ |
84
+ | `USER_STORY` | `docs/user-stories/EP-XXX/HU-XXX-XXX.md` | ✅ Yes (auto-load spec) |
85
+ | `ROADMAP_FEATURE` | `docs/roadmap.md` Feature section | ✅ Yes (auto-load tasks) |
86
+ | `INTERACTIVE` | Manual questions | ❌ No (ask user) |
87
87
 
88
88
  ---
89
89
 
@@ -98,7 +98,7 @@ if (input.match(/^HU-\d{3}-\d{3}$/)) {
98
98
 
99
99
  📖 Loading User Story: HU-001-001
100
100
 
101
- Source: user-stories/EP-001/HU-001-001.md
101
+ Source: .ai-flow/user-stories/EP-001/HU-001-001.md
102
102
 
103
103
  ✅ Title: Login básico con email y contraseña
104
104
  ✅ Priority: Alta (P0)
@@ -118,7 +118,7 @@ Skipping manual questions (spec already defined)...
118
118
  🚀 Feature Workflow | Phase 1/4: Specification (AUTO-LOADED)
119
119
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
120
120
 
121
- 🗺️ Loading Feature from roadmap.md: User Entity & Repository
121
+ 🗺️ Loading Feature from docs/roadmap.md: User Entity & Repository
122
122
 
123
123
  ✅ Epic: 2 - Data Layer
124
124
  ✅ Priority: P0
@@ -144,10 +144,10 @@ Ask 3-5 key questions to understand requirements:
144
144
 
145
145
  **IF loaded from User Story (HU-XXX-XXX):**
146
146
 
147
- - Copy `user-stories/EP-XXX/HU-XXX-XXX.md` → `.ai-flow/work/NNN-HU-XXX-XXX/spec.md`
147
+ - Copy `docs/user-stories/EP-XXX/HU-XXX-XXX.md` → `.ai-flow/work/NNN-HU-XXX-XXX/spec.md`
148
148
  - Include: User Story format, Acceptance Criteria (Gherkin), Technical Tasks, Test Cases, DoD
149
149
 
150
- **IF loaded from roadmap.md Feature:**
150
+ **IF loaded from docs/roadmap.md Feature:**
151
151
 
152
152
  - Extract Feature section → `.ai-flow/work/NNN-feature-name/spec.md`
153
153
  - Include: Scope, Tasks (T001-T00N), Dependencies, Ready-to-execute command
@@ -1417,7 +1417,7 @@ Dependencies resolved:
1417
1417
  ✅ Blocks: HU-002-001 (User CRUD) - Ready to start
1418
1418
 
1419
1419
  📖 User Story Status: COMPLETED ✅
1420
- File: user-stories/EP-001/HU-001-001.md updated with completion date
1420
+ File: .ai-flow/user-stories/EP-001/HU-001-001.md updated with completion date
1421
1421
  ```
1422
1422
 
1423
1423
  **IF mode = `ROADMAP_FEATURE` or `INTERACTIVE`:**
@@ -10,7 +10,7 @@ Your mission is to detect changes in the codebase and update the project documen
10
10
 
11
11
  ### Objective
12
12
 
13
- Detect changes in the codebase compared to the last documented state (stored in `.ai-flow/analysis.json`) and update all affected documentation files automatically.
13
+ Detect changes in the codebase compared to the last documented state (stored in `.ai-flow/cache/docs-analysis.json`) and update all affected documentation files automatically.
14
14
 
15
15
  ---
16
16
 
@@ -19,12 +19,12 @@ Detect changes in the codebase compared to the last documented state (stored in
19
19
  ### Step 1: Check for Analysis File
20
20
 
21
21
  ```
22
- First, check if `.ai-flow/analysis.json` exists:
22
+ First, check if `.ai-flow/cache/docs-analysis.json` exists:
23
23
 
24
24
  - ✅ If exists → Proceed to Step 2 (Compare Changes)
25
25
  - ❌ If NOT exists → Execute full Phase 0 analysis first:
26
26
  - Run complete code analysis (as described in Phase 0)
27
- - Create `.ai-flow/analysis.json` with current state
27
+ - Create `.ai-flow/cache/docs-analysis.json` with current state
28
28
  - Then proceed to Step 2
29
29
  ```
30
30
 
@@ -33,7 +33,6 @@ First, check if `.ai-flow/analysis.json` exists:
33
33
  **Reuse Phase 0 Analysis Logic:**
34
34
 
35
35
  1. **Perform Current Code Analysis:**
36
-
37
36
  - Execute the same analysis as Phase 0 (section 0.1):
38
37
  - File structure analysis
39
38
  - AST-based code parsing (endpoints, entities, dependencies)
@@ -42,8 +41,7 @@ First, check if `.ai-flow/analysis.json` exists:
42
41
  - Generate current state snapshot
43
42
 
44
43
  2. **Compare with Previous State:**
45
-
46
- - Load `.ai-flow/analysis.json`
44
+ - Load `.ai-flow/cache/docs-analysis.json`
47
45
  - Compare current state vs previous state
48
46
  - Detect changes in:
49
47
  - **Endpoints:** New, modified, or deleted endpoints
@@ -96,6 +94,7 @@ When regenerating or updating diagrams in documentation files, follow these **cr
96
94
  **Diagram Type:** `erDiagram`
97
95
 
98
96
  **Requirements:**
97
+
99
98
  1. Show ALL entities and their relationships
100
99
  2. Include field types and constraints (PK, FK, UK)
101
100
  3. Add descriptions for complex or business-critical fields
@@ -103,6 +102,7 @@ When regenerating or updating diagrams in documentation files, follow these **cr
103
102
  5. Keep entity order logical (core entities first, then related)
104
103
 
105
104
  **Quality Checklist:**
105
+
106
106
  - [ ] Code fence is exactly ` ```mermaid ` (lowercase, no spaces)
107
107
  - [ ] All entities from database are represented
108
108
  - [ ] All foreign key relationships are shown
@@ -113,6 +113,7 @@ When regenerating or updating diagrams in documentation files, follow these **cr
113
113
  - [ ] Diagram renders without errors
114
114
 
115
115
  **Example:**
116
+
116
117
  ````markdown
117
118
  ```mermaid
118
119
  erDiagram
@@ -156,6 +157,7 @@ erDiagram
156
157
  **Diagram Type:** `graph TD` (or `graph LR`)
157
158
 
158
159
  **Requirements:**
160
+
159
161
  1. Show ALL major system components (services, databases, caches, queues)
160
162
  2. Label connections with protocols/methods (HTTPS, gRPC, REST, etc.)
161
163
  3. Use consistent styling (databases as cylinders, services as boxes)
@@ -164,6 +166,7 @@ erDiagram
164
166
  6. Include deployment context (load balancers, CDN) if relevant
165
167
 
166
168
  **Quality Checklist:**
169
+
167
170
  - [ ] Code fence is exactly ` ```mermaid ` (lowercase, no spaces)
168
171
  - [ ] All services/components from codebase are shown
169
172
  - [ ] Database connections are labeled
@@ -175,6 +178,7 @@ erDiagram
175
178
  - [ ] Diagram renders without errors
176
179
 
177
180
  **Example:**
181
+
178
182
  ````markdown
179
183
  ```mermaid
180
184
  graph TD
@@ -203,6 +207,7 @@ graph TD
203
207
  **Diagram Type:** `flowchart TD` (or `flowchart LR`)
204
208
 
205
209
  **Requirements:**
210
+
206
211
  1. Start with `([Start Terminal])`
207
212
  2. End with `([End Terminal])`
208
213
  3. Use `{Diamond}` for ALL decision points
@@ -212,6 +217,7 @@ graph TD
212
217
  7. Use consistent styling for node types
213
218
 
214
219
  **Quality Checklist:**
220
+
215
221
  - [ ] Code fence is exactly ` ```mermaid ` (lowercase, no spaces)
216
222
  - [ ] Flow starts with a terminal node
217
223
  - [ ] Flow ends with terminal node(s)
@@ -224,6 +230,7 @@ graph TD
224
230
  - [ ] Diagram renders without errors
225
231
 
226
232
  **Example:**
233
+
227
234
  ````markdown
228
235
  ```mermaid
229
236
  flowchart TD
@@ -250,19 +257,22 @@ flowchart TD
250
257
  ### Common Formatting Rules (ALL Diagrams)
251
258
 
252
259
  **CRITICAL - Code Fence Syntax:**
253
- ```
260
+
261
+ ````
254
262
  ✅ CORRECT: ```mermaid
255
263
  ❌ WRONG: ```Mermaid (capital M)
256
264
  ❌ WRONG: ``` mermaid (extra space)
257
265
  ❌ WRONG: ``mermaid (missing backtick)
258
- ```
266
+ ````
259
267
 
260
268
  **Indentation:**
269
+
261
270
  - Start Mermaid syntax at column 0 (no leading spaces/tabs)
262
271
  - Only indent within Mermaid syntax according to Mermaid rules
263
272
  - Do NOT indent the entire code block
264
273
 
265
274
  **Validation Steps:**
275
+
266
276
  1. After generating/updating diagram, verify syntax at https://mermaid.live/
267
277
  2. Check that diagram renders in VS Code markdown preview
268
278
  3. Verify all nodes and relationships are present
@@ -270,6 +280,7 @@ flowchart TD
270
280
  5. Test that styling is applied correctly
271
281
 
272
282
  **When Updating Existing Diagrams:**
283
+
273
284
  1. Read the current diagram first
274
285
  2. Identify what needs to be added/removed/modified
275
286
  3. Maintain existing styling and layout patterns
@@ -286,7 +297,6 @@ flowchart TD
286
297
  1. **For each document that needs updating:**
287
298
 
288
299
  **A) `docs/api.md`** (if endpoints changed):
289
-
290
300
  - Read current `docs/api.md`
291
301
  - Identify new/modified endpoints from analysis
292
302
  - Add new endpoints following existing API conventions
@@ -296,7 +306,6 @@ flowchart TD
296
306
  - Regenerate affected sections only
297
307
 
298
308
  **B) `docs/data-model.md`** (if entities changed):
299
-
300
309
  - Read current `docs/data-model.md`
301
310
  - Update entity definitions with new fields
302
311
  - Update relationships if changed
@@ -304,41 +313,35 @@ flowchart TD
304
313
  - Maintain all existing content that hasn't changed
305
314
 
306
315
  **C) `ai-instructions.md`** (if dependencies changed):
307
-
308
316
  - Read current `ai-instructions.md`
309
317
  - Add new dependencies to appropriate sections
310
318
  - Update version numbers if changed
311
319
  - Maintain all existing rules and patterns
312
320
 
313
321
  **D) `docs/architecture.md`** (if architecture changed):
314
-
315
322
  - Read current `docs/architecture.md`
316
323
  - Update architecture diagram (mermaid) if structure changed
317
324
  - Update module descriptions
318
325
  - Maintain all existing content
319
326
 
320
327
  **E) `specs/configuration.md`** (if env vars changed):
321
-
322
328
  - Read current `specs/configuration.md`
323
329
  - Add new environment variables
324
330
  - Update descriptions if changed
325
331
  - Maintain existing variables
326
332
 
327
333
  **F) `.env.example`** (if env vars changed):
328
-
329
334
  - Read current `.env.example`
330
335
  - Add new environment variables with example values
331
336
  - Maintain existing variables
332
337
 
333
338
  **G) `specs/security.md`** (if security patterns changed):
334
-
335
339
  - Read current `specs/security.md`
336
340
  - Update security policies if authentication/authorization changed
337
341
  - Maintain existing policies
338
342
 
339
- 2. **Update `analysis.json`:**
340
-
341
- - Save current state to `.ai-flow/analysis.json`
343
+ 2. **Update `docs-analysis.json`:**
344
+ - Save current state to `.ai-flow/cache/docs-analysis.json`
342
345
  - Update timestamp
343
346
  - Include all detected changes in metadata
344
347
 
@@ -359,7 +362,7 @@ flowchart TD
359
362
  - Agregada dependencia "@nestjs/swagger"
360
363
  - Actualizada sección de herramientas
361
364
 
362
- ✅ analysis.json actualizado con nuevo estado
365
+ docs-analysis.json actualizado con nuevo estado
363
366
  ```
364
367
 
365
368
  ### Step 5: Handle Cancellation
@@ -456,32 +459,28 @@ Actualización cancelada. Ejecuta `/flow-docs-sync` cuando estés listo para act
456
459
  ## Important Rules
457
460
 
458
461
  1. **Incremental Updates Only:**
459
-
460
462
  - Only modify sections that changed
461
463
  - Preserve all existing content that hasn't changed
462
464
  - Maintain document structure and formatting
463
465
 
464
466
  2. **Follow Existing Patterns:**
465
-
466
467
  - Use same format as existing documentation
467
468
  - Follow conventions established in original build
468
469
  - Maintain consistency with existing docs
469
470
 
470
471
  3. **Update Analysis File:**
471
-
472
- - Always update `.ai-flow/analysis.json` after document updates
472
+ - Always update `.ai-flow/cache/docs-analysis.json` after document updates
473
473
  - Include timestamp and change summary
474
474
  - Save complete current state for next comparison
475
475
 
476
476
  4. **Mermaid Diagrams:**
477
-
478
477
  - Regenerate ER diagrams when entities change
479
478
  - Regenerate architecture diagrams when structure changes
480
479
  - Use mermaid format for all diagrams
481
480
 
482
481
  5. **Error Handling:**
483
482
  - If document doesn't exist, create it following template
484
- - If analysis.json is corrupted, regenerate it
483
+ - If docs-analysis.json is corrupted, regenerate it
485
484
  - If comparison fails, show error and suggest full Phase 0 re-run
486
485
 
487
486
  ---
@@ -515,7 +514,7 @@ AI:
515
514
  - Agregado campo "avatarUrl" (String, nullable) a entidad User
516
515
  - Actualizado diagrama ER (mermaid) con nuevo campo
517
516
 
518
- ✅ analysis.json actualizado con nuevo estado
517
+ docs-analysis.json actualizado con nuevo estado
519
518
 
520
519
  Documentación sincronizada exitosamente.
521
520
  ```
@@ -523,5 +522,3 @@ Documentación sincronizada exitosamente.
523
522
  ---
524
523
 
525
524
  **BEGIN EXECUTION when user runs `/flow-docs-sync`**
526
-
527
-
@@ -10,7 +10,7 @@ Your mission is to detect changes in the frontend codebase and update the projec
10
10
 
11
11
  ### Objective
12
12
 
13
- Detect changes in the frontend codebase compared to the last documented state (stored in `.ai-flow/analysis.json`) and update all affected documentation files automatically.
13
+ Detect changes in the frontend codebase compared to the last documented state (stored in `.ai-flow/cache/docs-analysis.json`) and update all affected documentation files automatically.
14
14
 
15
15
  ---
16
16
 
@@ -19,12 +19,12 @@ Detect changes in the frontend codebase compared to the last documented state (s
19
19
  ### Step 1: Check for Analysis File
20
20
 
21
21
  ```
22
- First, check if `.ai-flow/analysis.json` exists:
22
+ First, check if `.ai-flow/cache/docs-analysis.json` exists:
23
23
 
24
24
  - ✅ If exists → Proceed to Step 2 (Compare Changes)
25
25
  - ❌ If NOT exists → Execute full Phase 0 analysis first:
26
26
  - Run complete frontend code analysis (as described in Phase 0)
27
- - Create `.ai-flow/analysis.json` with current state
27
+ - Create `.ai-flow/cache/docs-analysis.json` with current state
28
28
  - Then proceed to Step 2
29
29
  ```
30
30
 
@@ -45,7 +45,7 @@ First, check if `.ai-flow/analysis.json` exists:
45
45
 
46
46
  2. **Compare with Previous State:**
47
47
 
48
- - Load `.ai-flow/analysis.json`
48
+ - Load `.ai-flow/cache/docs-analysis.json`
49
49
  - Compare current state vs previous state
50
50
  - Detect changes in:
51
51
  - **Components:** New, modified, or deleted components
@@ -149,9 +149,9 @@ No updates required.
149
149
  - Add new test examples if patterns changed
150
150
  - Maintain existing testing strategy
151
151
 
152
- 2. **Update `analysis.json`:**
152
+ 2. **Update `docs-analysis.json`:**
153
153
 
154
- - Save current state to `.ai-flow/analysis.json`
154
+ - Save current state to `.ai-flow/cache/docs-analysis.json`
155
155
  - Update timestamp
156
156
  - Include all detected changes in metadata
157
157
 
@@ -176,7 +176,7 @@ No updates required.
176
176
  - Added dependency "@tanstack/react-query"
177
177
  - Updated tools section
178
178
 
179
- ✅ analysis.json updated with new state
179
+ docs-analysis.json updated with new state
180
180
  ```
181
181
 
182
182
  ### Step 5: Handle Cancellation
@@ -299,7 +299,7 @@ Update cancelled. Run `/flow-docs-sync` when you're ready to update the document
299
299
 
300
300
  3. **Update Analysis File:**
301
301
 
302
- - Always update `.ai-flow/analysis.json` after document updates
302
+ - Always update `.ai-flow/cache/docs-analysis.json` after document updates
303
303
  - Include timestamp and change summary
304
304
  - Save complete current state for next comparison
305
305
 
@@ -515,7 +515,7 @@ graph TB
515
515
 
516
516
  5. **Error Handling:**
517
517
  - If document doesn't exist, create it following template
518
- - If analysis.json is corrupted, regenerate it
518
+ - If docs-analysis.json is corrupted, regenerate it
519
519
  - If comparison fails, show error and suggest full Phase 0 re-run
520
520
 
521
521
  ---
@@ -549,7 +549,7 @@ AI:
549
549
  - Added new Zustand store (useCartStore)
550
550
  - Updated state management patterns section
551
551
 
552
- ✅ analysis.json updated with new state
552
+ docs-analysis.json updated with new state
553
553
 
554
554
  Documentation synchronized successfully.
555
555
  ```
@@ -10,7 +10,7 @@ Your mission is to detect changes in the mobile codebase and update the project
10
10
 
11
11
  ### Objective
12
12
 
13
- Detect changes in the mobile codebase compared to the last documented state (stored in `.ai-flow/analysis.json`) and update all affected documentation files automatically.
13
+ Detect changes in the mobile codebase compared to the last documented state (stored in `.ai-flow/cache/docs-analysis.json`) and update all affected documentation files automatically.
14
14
 
15
15
  ---
16
16
 
@@ -19,12 +19,12 @@ Detect changes in the mobile codebase compared to the last documented state (sto
19
19
  ### Step 1: Check for Analysis File
20
20
 
21
21
  ```
22
- First, check if `.ai-flow/analysis.json` exists:
22
+ First, check if `.ai-flow/cache/docs-analysis.json` exists:
23
23
 
24
24
  - ✅ If exists → Proceed to Step 2 (Compare Changes)
25
25
  - ❌ If NOT exists → Execute full Phase 0 analysis first:
26
26
  - Run complete mobile code analysis (as described in Phase 0)
27
- - Create `.ai-flow/analysis.json` with current state
27
+ - Create `.ai-flow/cache/docs-analysis.json` with current state
28
28
  - Then proceed to Step 2
29
29
  ```
30
30
 
@@ -47,7 +47,7 @@ First, check if `.ai-flow/analysis.json` exists:
47
47
 
48
48
  2. **Compare with Previous State:**
49
49
 
50
- - Load `.ai-flow/analysis.json`
50
+ - Load `.ai-flow/cache/docs-analysis.json`
51
51
  - Compare current state vs previous state
52
52
  - Detect changes in:
53
53
  - **Screens:** New, modified, or deleted screens
@@ -173,9 +173,9 @@ No updates required.
173
173
  - Update app store configuration if app.json or build config changed
174
174
  - Maintain existing configuration
175
175
 
176
- 2. **Update `analysis.json`:**
176
+ 2. **Update `docs-analysis.json`:**
177
177
 
178
- - Save current state to `.ai-flow/analysis.json`
178
+ - Save current state to `.ai-flow/cache/docs-analysis.json`
179
179
  - Update timestamp
180
180
  - Include all detected changes in metadata
181
181
 
@@ -208,7 +208,7 @@ No updates required.
208
208
  📝 specs/build-configuration.md
209
209
  - Updated build.gradle configuration
210
210
 
211
- ✅ analysis.json updated with new state
211
+ docs-analysis.json updated with new state
212
212
  ```
213
213
 
214
214
  ### Step 5: Handle Cancellation
@@ -360,7 +360,7 @@ Update cancelled. Run `/flow-docs-sync` when you're ready to update the document
360
360
 
361
361
  3. **Update Analysis File:**
362
362
 
363
- - Always update `.ai-flow/analysis.json` after document updates
363
+ - Always update `.ai-flow/cache/docs-analysis.json` after document updates
364
364
  - Include timestamp and change summary
365
365
  - Save complete current state for next comparison
366
366
 
@@ -588,7 +588,7 @@ graph TB
588
588
 
589
589
  5. **Error Handling:**
590
590
  - If document doesn't exist, create it following template
591
- - If analysis.json is corrupted, regenerate it
591
+ - If docs-analysis.json is corrupted, regenerate it
592
592
  - If comparison fails, show error and suggest full Phase 0 re-run
593
593
 
594
594
  ---
@@ -622,7 +622,7 @@ AI:
622
622
  - Added new permission (Location)
623
623
  - Updated permission handling section
624
624
 
625
- ✅ analysis.json updated with new state
625
+ docs-analysis.json updated with new state
626
626
 
627
627
  Documentation synchronized successfully.
628
628
  ```