ai-flow-dev 2.2.0 → 2.2.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.
Files changed (74) hide show
  1. package/README.md +28 -24
  2. package/dist/cli.js +228 -418
  3. package/dist/cli.js.map +1 -1
  4. package/package.json +1 -1
  5. package/prompts/backend/flow-build-phase-0.md +286 -4
  6. package/prompts/backend/flow-build-phase-1.md +19 -0
  7. package/prompts/backend/flow-build-phase-2.md +19 -0
  8. package/prompts/backend/flow-build-phase-3.md +19 -0
  9. package/prompts/backend/flow-build-phase-4.md +19 -0
  10. package/prompts/backend/flow-build-phase-5.md +19 -0
  11. package/prompts/backend/flow-build-phase-6.md +19 -0
  12. package/prompts/backend/flow-build-phase-7.md +19 -0
  13. package/prompts/backend/flow-build-phase-9.md +14 -0
  14. package/prompts/backend/flow-build.md +2 -0
  15. package/prompts/backend/flow-check-review.md +20 -0
  16. package/prompts/backend/flow-check-test.md +14 -0
  17. package/prompts/backend/flow-check.md +67 -0
  18. package/prompts/backend/flow-commit.md +53 -0
  19. package/prompts/backend/flow-docs-sync.md +55 -53
  20. package/prompts/backend/flow-work-feature.md +42 -0
  21. package/prompts/backend/flow-work-fix.md +33 -0
  22. package/prompts/backend/flow-work-refactor.md +32 -0
  23. package/prompts/backend/flow-work-resume.md +32 -0
  24. package/prompts/backend/flow-work.md +129 -0
  25. package/prompts/frontend/flow-build-phase-0.md +363 -35
  26. package/prompts/frontend/flow-build-phase-1.md +433 -404
  27. package/prompts/frontend/flow-build-phase-2.md +508 -872
  28. package/prompts/frontend/flow-build-phase-3.md +629 -562
  29. package/prompts/frontend/flow-build-phase-4.md +438 -382
  30. package/prompts/frontend/flow-build-phase-5.md +559 -362
  31. package/prompts/frontend/flow-build-phase-6.md +383 -452
  32. package/prompts/frontend/flow-build-phase-7.md +818 -392
  33. package/prompts/frontend/flow-build-phase-9.md +14 -0
  34. package/prompts/frontend/flow-build.md +2 -0
  35. package/prompts/frontend/flow-check-review.md +20 -0
  36. package/prompts/frontend/flow-check-test.md +14 -0
  37. package/prompts/frontend/flow-check.md +67 -0
  38. package/prompts/frontend/flow-commit.md +53 -0
  39. package/prompts/frontend/flow-docs-sync.md +39 -35
  40. package/prompts/frontend/flow-work-feature.md +42 -0
  41. package/prompts/frontend/flow-work-fix.md +33 -0
  42. package/prompts/frontend/flow-work-refactor.md +32 -0
  43. package/prompts/frontend/flow-work-resume.md +32 -0
  44. package/prompts/frontend/flow-work.md +129 -0
  45. package/prompts/mobile/flow-build-phase-0.md +366 -37
  46. package/prompts/mobile/flow-build-phase-1.md +438 -493
  47. package/prompts/mobile/flow-build-phase-2.md +458 -464
  48. package/prompts/mobile/flow-build-phase-3.md +613 -487
  49. package/prompts/mobile/flow-build-phase-4.md +439 -258
  50. package/prompts/mobile/flow-build-phase-5.md +582 -250
  51. package/prompts/mobile/flow-build-phase-6.md +389 -359
  52. package/prompts/mobile/flow-build-phase-7.md +871 -285
  53. package/prompts/mobile/flow-build-phase-9.md +14 -0
  54. package/prompts/mobile/flow-build.md +2 -0
  55. package/prompts/mobile/flow-check-review.md +20 -0
  56. package/prompts/mobile/flow-check-test.md +14 -0
  57. package/prompts/mobile/flow-check.md +67 -0
  58. package/prompts/mobile/flow-commit.md +53 -0
  59. package/prompts/mobile/flow-docs-sync.md +39 -40
  60. package/prompts/mobile/flow-work-feature.md +42 -0
  61. package/prompts/mobile/flow-work-fix.md +33 -0
  62. package/prompts/mobile/flow-work-refactor.md +32 -0
  63. package/prompts/mobile/flow-work-resume.md +32 -0
  64. package/prompts/mobile/flow-work.md +129 -0
  65. package/prompts/shared/smart-skip-preflight.md +214 -0
  66. package/templates/AGENT.template.md +13 -3
  67. package/templates/backend/.clauderules.template +5 -4
  68. package/templates/backend/.cursorrules.template +1 -1
  69. package/prompts/backend/flow-dev-commit.md +0 -829
  70. package/prompts/backend/flow-dev-feature.md +0 -1948
  71. package/prompts/backend/flow-dev-fix.md +0 -952
  72. package/prompts/backend/flow-dev-refactor.md +0 -690
  73. package/prompts/backend/flow-dev-review.md +0 -372
  74. package/prompts/backend/flow-dev-work.md +0 -1081
@@ -1,494 +1,524 @@
1
- # Phase 6: Testing Strategy
1
+ ## PHASE 6: Testing Strategy (15-20 min)
2
2
 
3
- **Duration:** 15-25 minutes
4
- **Questions:** ~12 questions
5
- **Output:** docs/testing.md, parts of ai-instructions.md
6
- ---
7
- ## 🎯 Objective
3
+ > **Order for this phase:**
4
+ >
5
+ > - **MVP:** 6.1 6.2 (smoke tests) → 6.7 (CI basics)
6
+ > - **Production-Ready:** 6.1 → 6.1b → 6.2 → 6.3 → 6.4 → 6.5 → 6.6 → 6.7
7
+ > - **Enterprise:** 6.1 → 6.1b → 6.2 → 6.3 → 6.4 → 6.5 → 6.6 → 6.7 → 6.8 → 6.9
8
8
 
9
- Define your mobile testing strategy:
9
+ > **📌 Scope-based behavior:**
10
+ >
11
+ > - **MVP:** Ask 6.1 (framework), 6.2 (smoke tests only), 6.7 (CI basics) - **Target: 15-25% coverage**
12
+ > - **Production-Ready:** Ask all questions 6.1-6.7 - **Target: 60-80% coverage**
13
+ > - **Enterprise:** Ask all questions 6.1-6.9 - **Target: 80-95% coverage + contract/load tests**
10
14
 
11
- 1. What testing frameworks will you use?
12
- 2. What types of tests will you write?
13
- 3. How will you test on devices/emulators?
14
- 4. What coverage targets?
15
- 5. How will tests run in CI/CD?
16
- ---
17
- ## 📋 Questions
15
+ ### Objective
18
16
 
19
- ### Question 6.1: Unit Testing Framework
17
+ Define testing approach, tools, and quality gates.
20
18
 
21
- **What unit test framework will you use?**
19
+ **🚨 Important: All projects require basic testing. Scope determines depth, not whether to test.**
22
20
 
23
- **If React Native:**
21
+ ---
24
22
 
25
- - A) **Jest** (Recommended)
26
- - Built-in with React Native
27
- - Snapshot testing
28
- - Best for: Most React Native apps
23
+ ## 🔍 Pre-Flight Check (Smart Skip Logic)
29
24
 
30
- - B) **Vitest**
31
- - Faster, ESM native
32
- - Best for: Modern setups
25
+ > 📎 **Reference:** See [prompts/shared/smart-skip-preflight.md](../shared/smart-skip-preflight.md) for the complete smart skip logic.
33
26
 
34
- **If Flutter:**
27
+ **Execute Pre-Flight Check for Phase 6:**
35
28
 
36
- - A) ⭐ **Flutter Test** (Built-in)
37
- - Widget testing
38
- - Unit testing
39
- - Best for: All Flutter apps
29
+ - **Target File**: `docs/testing.md`
30
+ - **Phase Name**: "TESTING STRATEGY"
31
+ - **Key Items**: Test framework, coverage targets, test types, CI/CD integration
32
+ - **Typical Gaps**: E2E strategy, load testing, performance testing
40
33
 
41
- **If Native iOS:**
34
+ **Proceed with appropriate scenario based on audit data from `.ai-flow/cache/audit-data.json`**
42
35
 
43
- - A) ⭐ **XCTest** (Built-in)
44
- - Unit tests
45
- - UI tests
46
- - Best for: All iOS apps
36
+ ---
47
37
 
48
- **If Native Android:**
38
+ ## Phase 6 Questions (Full Mode)
49
39
 
50
- - A) **JUnit** (Standard)
51
- - Unit tests
52
- - Best for: All Android apps
40
+ **6.1 Testing Framework**
53
41
 
54
- **Your answer:**
55
- ---
56
- ### Question 6.2: Component/Screen Testing
57
-
58
- **How will you test components and screens?**
59
-
60
- **If React Native:**
61
-
62
- - A) ⭐ **React Native Testing Library** (Recommended)
63
- - User-centric testing
64
- - Accessible queries
65
- - Best for: All React Native apps
66
-
67
- **If Flutter:**
68
-
69
- - A) ⭐ **Widget Testing** (Built-in)
70
- - Test widgets in isolation
71
- - Best for: All Flutter apps
72
-
73
- **If Native iOS:**
74
-
75
- - A) ⭐ **XCUITest** (Built-in)
76
- - UI testing framework
77
- - Best for: All iOS apps
78
-
79
- **If Native Android:**
80
-
81
- - A) ⭐ **Espresso** (Recommended)
82
- - UI testing framework
83
- - Best for: All Android apps
84
-
85
- **Your answer:**
86
- ---
87
- ### Question 6.3: E2E Testing Framework
88
-
89
- **What E2E testing tool will you use?**
90
-
91
- **If React Native:**
42
+ ```
92
43
 
93
- - A) **Detox** (Recommended)
94
- - Gray-box E2E testing
95
- - Works with iOS and Android
96
- - Best for: Most React Native apps
44
+ Which testing tools will you use?
97
45
 
98
- - B) **Maestro**
99
- - Declarative E2E testing
100
- - Cross-platform
101
- - Best for: Simple E2E flows
46
+ JavaScript/TypeScript:
47
+ A) ⭐ Jest - Most popular, great ecosystem
48
+ B) Vitest - Modern, fast, Vite-compatible
49
+ C) Mocha + Chai
50
+ D) AVA
102
51
 
103
- - C) **Appium**
104
- - WebDriver-based
105
- - Cross-platform
106
- - Best for: Complex E2E scenarios
52
+ Python:
53
+ E) ⭐ pytest - Modern, feature-rich
54
+ F) unittest - Built-in
55
+ G) nose2
107
56
 
108
- **If Flutter:**
57
+ Java:
58
+ H) ⭐ JUnit 5 + Mockito
59
+ I) TestNG
109
60
 
110
- - A) ⭐ **Integration Test** (Built-in)
111
- - Flutter's integration testing
112
- - Best for: Most Flutter apps
61
+ Your choice: \_\_
113
62
 
114
- - B) **Maestro**
115
- - Declarative E2E testing
116
- - Best for: Simple E2E flows
63
+ Assertion library: **
64
+ Mocking library: **
117
65
 
118
- **If Native:**
66
+ ```
119
67
 
120
- - A) **Appium** (Recommended)
121
- - Cross-platform
122
- - Works with iOS and Android
123
- - Best for: Native apps
68
+ **6.1b Testing Philosophy** (Production-Ready and Enterprise only)
124
69
 
125
- **Your answer:**
126
- ---
127
- ### Question 6.4: Testing on Physical Devices
70
+ ```
71
+ What is your testing philosophy?
128
72
 
129
- **How will you test on physical devices?**
73
+ A) Test-First (TDD) - Write tests before code
74
+ - Red-Green-Refactor cycle
75
+ - Higher initial effort, better design
76
+ - Best for: Complex business logic, critical systems
130
77
 
131
- A) **TestFlight (iOS) + Firebase App Distribution (Android)** (Recommended)
78
+ B) 🔥 Test-After - Write tests after implementation
79
+ - Faster initial development
80
+ - Risk of untested edge cases
81
+ - Best for: Rapid prototyping, time-sensitive features
132
82
 
133
- - Beta testing on real devices
134
- - Best for: Most apps
83
+ C) ⚡ Behavior-Driven (BDD) - Write tests as specifications
84
+ - Given/When/Then format
85
+ - Business-readable tests
86
+ - Best for: Domain-heavy applications
135
87
 
136
- B) **TestFlight (iOS) + Google Play Internal Testing (Android)**
88
+ D) 🏆 Hybrid - TDD for core logic, test-after for simple features
89
+ - Balance of speed and quality
90
+ - Pragmatic approach
137
91
 
138
- - Official store channels
139
- - Best for: Store-focused testing
92
+ Your choice: __
93
+ ```
140
94
 
141
- C) **Device Farm Services**
95
+ **6.2 Test Types**
142
96
 
143
- - AWS Device Farm
144
- - BrowserStack App Automate
145
- - Sauce Labs
146
- - Best for: Multiple device testing
97
+ ```
98
+ [If MVP scope selected, ask simplified version:]
147
99
 
148
- D) **Manual Testing Only**
100
+ For MVP, we'll focus on smoke tests (critical path verification).
101
+ Which critical flows should be tested?
149
102
 
150
- - Test on personal devices
151
- - Best for: Small teams, MVPs
103
+ Select 3-5 most important endpoints/features:
104
+ A) Authentication (login/register)
105
+ B) Main business operation (e.g., create order, post article)
106
+ C) User profile/account management
107
+ D) Payment processing (if applicable)
108
+ E) Data retrieval (main GET endpoints)
152
109
 
153
- **Your answer:**
154
- ---
155
- ### Question 6.5: Emulator/Simulator Strategy
110
+ Selected: __
156
111
 
157
- **How will you use emulators/simulators?**
112
+ Test approach: Integration tests covering happy path of selected flows
113
+ Coverage target: 15-25%
114
+ Test type: Integration/E2E only (no unit tests required for MVP)
158
115
 
159
- A) **Local Emulators + CI Emulators** (Recommended)
116
+ [If Production-Ready or Enterprise scope selected, ask full version:]
160
117
 
161
- - Develop locally with iOS Simulator / Android Emulator
162
- - Run tests in CI with emulators
163
- - Best for: Most teams
118
+ Which test types will you implement?
164
119
 
165
- B) **Local Only**
120
+ A) Unit Tests
121
+ - Test individual functions/methods in isolation
122
+ - Fast, numerous
123
+ - Mock all dependencies
166
124
 
167
- - No CI emulator testing
168
- - Best for: Small teams
125
+ B) Integration Tests
126
+ - Test multiple components together
127
+ - Database, external APIs
128
+ - Slower but more realistic
169
129
 
170
- C) **Cloud Emulators Only**
130
+ C) E2E (End-to-End) Tests
131
+ - Test full user flows
132
+ - API endpoints from request to response
133
+ - Tool: Supertest (Node.js), pytest with TestClient (Python)
171
134
 
172
- - Use cloud services for all testing
173
- - Best for: Teams without local setup
135
+ D) 🏆 Contract Tests (Advanced - Enterprise recommended)
136
+ - Verify API contracts between services
137
+ - Tool: Pact, Spring Cloud Contract
174
138
 
175
- **Your answer:**
176
- ---
177
- ### Question 6.6: Testing Pyramid Distribution
139
+ E) ⚡ Load/Performance Tests (Enterprise recommended)
140
+ - Tool: Artillery, K6, JMeter
178
141
 
179
- **What test distribution will you target?**
142
+ F) 🔬 Chaos Engineering (Enterprise only)
143
+ - Test system resilience to failures
144
+ - Tool: Chaos Monkey, Litmus, Gremlin
180
145
 
181
- A) ⭐ **Standard Pyramid** (Recommended)
146
+ Selected: __
182
147
 
148
+ Pyramid distribution:
183
149
  - 70% Unit tests
184
150
  - 20% Integration tests
185
151
  - 10% E2E tests
186
- - Best for: Most apps
187
-
188
- B) **Heavy Unit**
152
+ (Adjust as needed)
189
153
 
190
- - 85% Unit tests
191
- - 10% Integration tests
192
- - 5% E2E tests
193
- - Best for: Logic-heavy apps
154
+ ```
194
155
 
195
- C) **Heavy Integration**
156
+ **6.3 Test Database** [Skip if MVP scope]
196
157
 
197
- - 50% Unit tests
198
- - 40% Integration tests
199
- - 10% E2E tests
200
- - Best for: UI-heavy apps
158
+ ```
159
+ [Production-Ready/Enterprise only]
201
160
 
202
- **Your answer:**
203
- ---
204
- #### 🎨 MOBILE TESTING PYRAMID VISUALIZATION
161
+ How will you handle database in tests?
205
162
 
206
- **Use this diagram format** to visualize mobile test distribution strategy:
163
+ A) In-memory database
164
+ - SQLite for testing, PostgreSQL for prod
165
+ - Fast, isolated
207
166
 
208
- ```mermaid
209
- graph TB
210
- subgraph "Mobile Testing Pyramid"
211
- E2E["📱 E2E Tests (10%)<br/>Detox/Appium<br/>Slow, Expensive<br/>Full user flows on device"]
212
- INT["🔗 Integration Tests (20%)<br/>Component + API<br/>Medium Speed<br/>Screen rendering + navigation"]
213
- UNIT["⚡ Unit Tests (70%)<br/>Jest/XCTest<br/>Fast, Cheap<br/>Business logic, hooks, utilities"]
214
- end
167
+ B) 🏆 Docker test database
168
+ - Same DB as production
169
+ - More realistic
170
+ - Tool: Testcontainers
215
171
 
216
- E2E --> INT
217
- INT --> UNIT
172
+ C) 🔄 Shared test database
173
+ - One DB for all tests
174
+ - Reset between test suites
218
175
 
219
- style E2E fill:#fce4ec,stroke:#c2185b,stroke-width:2px
220
- style INT fill:#fff4e6,stroke:#f57c00,stroke-width:2px
221
- style UNIT fill:#e8f5e9,stroke:#388e3c,stroke-width:3px
176
+ D) 🎭 Mock database
177
+ - Mock all DB calls
178
+ - Fastest, but less realistic
222
179
 
223
- classDef note fill:#f5f5f5,stroke:#666,stroke-dasharray: 5 5
180
+ Your choice: __
224
181
 
225
- note1["Run on Real Devices/Emulators<br/>Test platform-specific behavior<br/>Slow feedback (minutes)"]:::note
226
- note2["Test screen components<br/>Navigation flows<br/>API integration<br/>Medium feedback"]:::note
227
- note3["Test pure functions<br/>Redux reducers<br/>Utilities, validators<br/>Fast feedback (seconds)"]:::note
182
+ Test data strategy:
183
+ A) Factories/Fixtures - Generate test data programmatically
184
+ B) Seed files - Load from JSON/SQL files
185
+ C) Inline - Create data in each test
228
186
 
229
- E2E -.-> note1
230
- INT -.-> note2
231
- UNIT -.-> note3
232
187
  ```
233
188
 
234
- **Mobile-Specific Testing Layers:**
235
-
236
- ```mermaid
237
- graph TB
238
- subgraph "Mobile Test Types"
239
- E2E_LAYER["E2E Layer<br/>Detox, Maestro, Appium"]
240
- SCREEN_LAYER["Screen Tests<br/>React Native Testing Library<br/>Flutter Widget Tests"]
241
- COMPONENT_LAYER["Component Tests<br/>Rendering, Props, Events"]
242
- LOGIC_LAYER["Unit Tests<br/>Hooks, Utils, State Logic"]
243
- STATIC_LAYER["Static Analysis<br/>TypeScript, ESLint"]
244
- end
245
-
246
- E2E_LAYER --> SCREEN_LAYER
247
- SCREEN_LAYER --> COMPONENT_LAYER
248
- COMPONENT_LAYER --> LOGIC_LAYER
249
- LOGIC_LAYER --> STATIC_LAYER
250
-
251
- DEVICES["Real Devices<br/>iOS + Android"]
252
- EMULATORS["Emulators/Simulators<br/>Fast feedback"]
253
-
254
- E2E_LAYER -.->|Run on| DEVICES
255
- SCREEN_LAYER -.->|Run on| EMULATORS
256
-
257
- style E2E_LAYER fill:#fce4ec,stroke:#c2185b,stroke-width:2px
258
- style SCREEN_LAYER fill:#fff4e6,stroke:#f57c00,stroke-width:2px
259
- style COMPONENT_LAYER fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
260
- style LOGIC_LAYER fill:#e1f5ff,stroke:#1976d2,stroke-width:2px
261
- style STATIC_LAYER fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
189
+ **6.4 Test Data Management** [Skip if MVP scope]
190
+
262
191
  ```
192
+ [Production-Ready/Enterprise only]
263
193
 
264
- **Platform-Specific Testing Considerations:**
194
+ How will you create test data?
265
195
 
266
- ```mermaid
267
- graph LR
268
- subgraph "Cross-Platform Mobile Testing"
269
- SHARED[Shared Business Logic<br/>Unit Tests (Jest)]
270
- RN_SCREEN[React Native<br/>Screen Tests]
271
- FLUTTER_WIDGET[Flutter<br/>Widget Tests]
272
- end
196
+ A) ⭐ Factory pattern
197
+ - Libraries: factory_boy (Python), Fishery (TypeScript)
198
+ - Generate realistic data on demand
273
199
 
274
- subgraph "Platform Tests"
275
- IOS_E2E[iOS E2E<br/>XCUITest/Detox]
276
- ANDROID_E2E[Android E2E<br/>Espresso/Detox]
277
- end
200
+ B) Fixtures
201
+ - Predefined test data
202
+ - Loaded before tests
278
203
 
279
- SHARED --> RN_SCREEN
280
- SHARED --> FLUTTER_WIDGET
204
+ C) Faker
205
+ - Random realistic data
206
+ - Library: @faker-js/faker, Faker (Python)
281
207
 
282
- RN_SCREEN --> IOS_E2E
283
- RN_SCREEN --> ANDROID_E2E
208
+ Your approach: __
284
209
 
285
- FLUTTER_WIDGET --> IOS_E2E
286
- FLUTTER_WIDGET --> ANDROID_E2E
210
+ Example test data needs:
211
+ - Users with various roles
212
+ - Products with different states
213
+ - Orders in different stages
214
+ - Payment records
215
+ - [Add your specific needs]
287
216
 
288
- style SHARED fill:#e8f5e9
289
- style RN_SCREEN fill:#e1f5ff
290
- style FLUTTER_WIDGET fill:#e1f5ff
291
- style IOS_E2E fill:#fce4ec
292
- style ANDROID_E2E fill:#fff4e6
293
217
  ```
294
218
 
295
- **When to Use Each Diagram:**
219
+ **6.5 Mocking Strategy** [Skip if MVP scope]
296
220
 
297
- - **Testing Pyramid**: Best for understanding test distribution strategy
298
- - **Mobile Test Types**: Best for showing all testing layers including emulators/devices
299
- - **Cross-Platform**: Best for React Native/Flutter apps with shared logic
221
+ ```
222
+ [Production-Ready/Enterprise only]
300
223
 
301
- **Diagram Guidelines:**
224
+ What will you mock?
302
225
 
303
- - Color code by test type (E2E=pink, Integration=orange, Unit=green)
304
- - Show device vs emulator distinction
305
- - Include platform-specific considerations (iOS/Android)
306
- - Highlight speed/cost trade-offs
307
- - Update percentages based on selected strategy (A, B, or C)
308
- ---
309
- ---
310
- ### Question 6.7: Code Coverage Targets
226
+ A) External APIs - Third-party services
227
+ B) Database - In unit tests
228
+ C) File system - S3, local storage
229
+ D) Time/Date - For deterministic tests
230
+ E) Email/SMS - Sending services
231
+ F) ✅ Payment gateways
311
232
 
312
- **What code coverage targets will you set?**
233
+ Mocking approach:
234
+ A) ⭐ Manual mocks - jest.fn(), unittest.mock
235
+ B) Library - MSW (Mock Service Worker), nock
236
+ C) Test doubles - Stubs, spies, mocks
313
237
 
314
- A) **80% Overall** (Recommended)
238
+ When NOT to mock:
239
+ - Internal business logic
240
+ - Simple utilities
241
+ - Value objects
315
242
 
316
- - 80% line coverage
317
- - 70% branch coverage
318
- - Best for: Most apps
243
+ ```
319
244
 
320
- B) **90% Overall**
245
+ **6.6 Test Organization** [Skip if MVP scope]
321
246
 
322
- - 90% line coverage
323
- - 80% branch coverage
324
- - Best for: Critical apps
247
+ ```
248
+ [Production-Ready/Enterprise only]
325
249
 
326
- C) **70% Overall**
250
+ Test file structure:
327
251
 
328
- - 70% line coverage
329
- - 60% branch coverage
330
- - Best for: MVPs, small apps
252
+ A) ⭐ Co-located with source
253
+ ```
331
254
 
332
- D) **No Coverage Target**
255
+ src/
256
+ users/
257
+ user.service.ts
258
+ user.service.spec.ts
333
259
 
334
- - Test what's important
335
- - Best for: Very small projects
260
+ ```
336
261
 
337
- **Your answer:**
338
- ---
339
- ### Question 6.8: Snapshot Testing
262
+ B) Separate test directory
263
+ ```
340
264
 
341
- **Will you use snapshot testing?**
265
+ src/users/user.service.ts
266
+ tests/users/user.service.test.ts
342
267
 
343
- **If React Native:**
268
+ ````
344
269
 
345
- - A) ⭐ **Yes - Jest Snapshots** (Recommended)
346
- - Catch unintended UI changes
347
- - Best for: Component regression testing
270
+ Test naming:
348
271
 
349
- - B) **No Snapshot Testing**
350
- - Manual visual review
351
- - Best for: Rapidly changing UIs
272
+ ```typescript
273
+ describe('UserService', () => {
274
+ describe('createUser', () => {
275
+ it('should create a new user with valid data', async () => {
276
+ // Arrange
277
+ const userData = { email: 'test@example.com', name: 'Test' };
352
278
 
353
- **If Flutter:**
279
+ // Act
280
+ const result = await userService.createUser(userData);
354
281
 
355
- - A) ⭐ **Yes - Golden Tests** (Recommended)
356
- - Flutter's snapshot testing
357
- - Best for: Widget regression testing
282
+ // Assert
283
+ expect(result).toBeDefined();
284
+ expect(result.email).toBe(userData.email);
285
+ });
358
286
 
359
- **Your answer:**
360
- ---
361
- ### Question 6.9: Performance Testing
287
+ it('should throw error when email is duplicated', async () => {
288
+ // ...
289
+ });
290
+ });
291
+ });
292
+ ````
362
293
 
363
- **Will you test app performance?**
294
+ Naming pattern:
295
+ A) ⭐ "should [expected behavior] when [condition]"
296
+ B) "it [expected behavior]"
297
+ C) Free-form
364
298
 
365
- A) ⭐ **Yes - Basic Performance** (Recommended)
299
+ ````
366
300
 
367
- - App launch time
368
- - Screen render time
369
- - Memory usage
370
- - Best for: Most apps
301
+ **6.6.1 Contract Testing** [If selected in 6.2]
371
302
 
372
- B) **Yes - Comprehensive Performance**
303
+ ```
304
+ [Production-Ready/Enterprise only]
305
+
306
+ Contract testing tool:
307
+ A) ⭐ Pact - Consumer-driven contracts
308
+ B) Spring Cloud Contract - Provider contracts
309
+ C) Other: __
310
+
311
+ Contract strategy:
312
+ A) ⭐ Consumer-driven - Frontend/consumers define contracts
313
+ B) Provider-driven - Backend defines contracts
314
+ C) Both - Hybrid approach
315
+
316
+ Contract storage:
317
+ A) ⭐ Pact Broker - Centralized contract storage
318
+ B) Git repository - Version contracts in code
319
+ C) Other: __
320
+
321
+ Contract versioning:
322
+ - Strategy: __
323
+ - Breaking changes: __
324
+ ```
373
325
 
374
- - FPS monitoring
375
- - Network performance
376
- - Battery usage
377
- - Best for: Performance-critical apps
326
+ **6.6.2 Load/Performance Testing** [If selected in 6.2]
378
327
 
379
- C) **No Performance Testing**
328
+ ```
329
+ [Production-Ready/Enterprise only]
330
+
331
+ Load testing tool:
332
+ A) ⭐ Artillery - Node.js, YAML-based
333
+ B) K6 - Modern, JavaScript-based
334
+ C) JMeter - Java-based, GUI available
335
+ D) Locust - Python-based
336
+ E) Other: __
337
+
338
+ Test scenarios:
339
+ - Normal load: __ requests/second
340
+ - Peak load: __ requests/second
341
+ - Stress test: __ requests/second (beyond capacity)
342
+ - Duration: __ minutes
343
+
344
+ Performance thresholds:
345
+ - Response time p50: < __ ms
346
+ - Response time p95: < __ ms
347
+ - Response time p99: < __ ms
348
+ - Error rate: < __%
349
+ - Throughput: > __ requests/second
350
+
351
+ When to run:
352
+ A) ⭐ Before major releases
353
+ B) Weekly automated runs
354
+ C) On-demand only
355
+ ```
380
356
 
381
- - Manual testing only
382
- - Best for: MVPs
357
+ **6.6.3 Chaos Engineering** [If selected in 6.2 - Enterprise only]
383
358
 
384
- **Your answer:**
385
- ---
386
- ### Question 6.10: Accessibility Testing
359
+ ```
360
+ [Enterprise only]
361
+
362
+ Chaos engineering tool:
363
+ A) ⭐ Chaos Monkey (Netflix)
364
+ B) Litmus (Kubernetes)
365
+ C) Gremlin - Managed chaos platform
366
+ D) Custom scripts
367
+ E) Other: __
368
+
369
+ Chaos experiments to run:
370
+ A) Network latency injection
371
+ B) Service failures
372
+ C) Database connection failures
373
+ D) CPU/memory exhaustion
374
+ E) Disk space issues
375
+ F) Network partition
376
+
377
+ → Your selection (e.g., A, B, C): __
378
+
379
+ Safety rules:
380
+ - Run only in: [Staging, Production with approval]
381
+ - Blast radius: __% of traffic/instances
382
+ - Auto-rollback: [Yes/No]
383
+ - Approval required: [Yes/No]
384
+ ```
387
385
 
388
- **Will you test accessibility?**
386
+ **6.7 CI/CD Testing** [All scopes - simplified for MVP]
389
387
 
390
- A) ⭐ **Yes - Basic Accessibility** (Recommended)
388
+ ```
389
+ [If MVP scope:]
390
+ For MVP, we'll set up basic CI to run smoke tests.
391
391
 
392
- - Screen reader support (TalkBack/VoiceOver)
393
- - Touch target sizes
394
- - Color contrast
395
- - Best for: Most apps
392
+ When will smoke tests run?
393
+ A) On pull request (GitHub Actions, GitLab CI) - Recommended
394
+ B) Before deploy only
396
395
 
397
- B) **Yes - Comprehensive Accessibility**
396
+ Selected: __
398
397
 
399
- - WCAG 2.1 AA compliance
400
- - Full accessibility audit
401
- - Best for: Public-facing apps
398
+ Quality gate for MVP:
399
+ - All smoke tests must pass
400
+ - ⚠️ Coverage tracking (no minimum required)
402
401
 
403
- C) **No Accessibility Testing**
402
+ [If Production-Ready or Enterprise scope:]
404
403
 
405
- - Not a priority
406
- - Best for: Internal apps
404
+ When will tests run?
407
405
 
408
- **Your answer:**
409
- ---
410
- ### Question 6.11: CI/CD Testing Strategy
406
+ A) ⭐ On every commit (pre-commit hook) - Catch issues early
407
+ B) 🔥 On pull request (GitHub Actions, GitLab CI) - Most popular, prevents broken merges
408
+ C) Before deploy (staging pipeline) - Recommended safety check
409
+ D) Nightly (comprehensive test suite) - For slow/extensive tests
411
410
 
412
- **How will tests run in CI/CD?**
411
+ Selected: __
413
412
 
414
- A) ⭐ **Run All Tests on PR** (Recommended)
413
+ Quality gates:
415
414
 
416
- - Unit tests: Fast (<5 min)
417
- - Integration tests: Medium (<15 min)
418
- - E2E tests: Slow (<30 min)
419
- - Best for: Most teams
415
+ - All tests must pass
416
+ - Coverage must be >= __% (15-25% MVP, 60-80% Production, 80-95% Enterprise)
417
+ - No linting errors
418
+ - Performance benchmarks met (optional, Enterprise recommended)
420
419
 
421
- B) **Run Unit Tests on PR, E2E on Merge**
420
+ Failing a quality gate:
421
+ A) ⭐ Block merge/deploy - Force fix
422
+ B) ⚠️ Warning only - Allow with justification
422
423
 
423
- - Faster PR feedback
424
- - E2E on main branch
425
- - Best for: Large teams
424
+ ```
426
425
 
427
- C) **Run Tests Manually**
426
+ ### Phase 6 Output
428
427
 
429
- - No automated testing
430
- - Best for: Very small teams
428
+ ```
429
+ 📋 PHASE 6 SUMMARY:
430
+
431
+ **If MVP scope (A):**
432
+ Testing Framework: [Jest/pytest/JUnit] (6.1)
433
+ Test Types: Smoke tests on critical paths [selected 3-5 critical flows] (6.2)
434
+ Test Approach: Integration/E2E tests covering happy path only (6.2)
435
+ Coverage Target: 15-25% (6.2)
436
+ CI/CD Testing: [on PR/before deploy] + quality gate: all tests must pass (6.7)
437
+ Status: Basic testing implemented for MVP
438
+
439
+ **If Production-Ready (B):**
440
+ Testing Framework: [Jest/pytest/JUnit + assertion library + mocking library] (6.1)
441
+ Test Types: [unit/integration/e2e - selected types] (6.2)
442
+ Test Distribution: [pyramid percentages: 70/20/10 or custom] (6.2)
443
+ Test Database: [in-memory/Docker/shared/mock + initial data strategy] (6.3)
444
+ Test Data Management: [factories/fixtures/faker approach + specific test data needs] (6.4)
445
+ Mocking Strategy: [what to mock (APIs/DB/files/time/email/payments) + approach] (6.5)
446
+ Test Organization: [co-located/separate folder + naming pattern] (6.6)
447
+ CI/CD Testing: [when tests run (commit/PR/deploy/nightly) + quality gates (pass/60-80% coverage/lint) + gate behavior (block/warn)] (6.7)
448
+ Status: Comprehensive testing strategy implemented
449
+
450
+ **If Enterprise (C):**
451
+ Testing Framework: [Jest/pytest/JUnit + assertion library + mocking library] (6.1)
452
+ Test Types: [unit/integration/e2e/contract/load/chaos - all types] (6.2)
453
+ Test Distribution: [pyramid percentages: 70/20/10 or custom] (6.2)
454
+ Test Database: [in-memory/Docker/shared/mock + initial data strategy] (6.3)
455
+ Test Data Management: [factories/fixtures/faker approach + specific test data needs] (6.4)
456
+ Mocking Strategy: [what to mock (APIs/DB/files/time/email/payments) + approach] (6.5)
457
+ Test Organization: [co-located/separate folder + naming pattern] (6.6)
458
+ Contract Testing: [tool (Pact/Spring Cloud Contract) + strategy + storage + versioning] (6.6.1)
459
+ Load Testing: [tool (Artillery/K6/JMeter) + scenarios + thresholds + schedule] (6.6.2)
460
+ Chaos Engineering: [tool (Chaos Monkey/Litmus/Gremlin) + experiments + safety rules] (6.6.3)
461
+ CI/CD Testing: [when tests run (commit/PR/deploy/nightly) + quality gates (pass/80-95% coverage/lint/performance) + gate behavior (block/warn)] (6.7)
462
+ Status: Exhaustive testing strategy with advanced scenarios
463
+
464
+ Is this correct? (Yes/No)
465
+ ```
466
+ ---
467
+ ### 📄 Generate Phase 6 Documents
431
468
 
432
- **Your answer:**
433
- ---
434
- ### Question 6.12: Test Data Management
469
+ **Before starting generation:**
435
470
 
436
- **How will you manage test data?**
471
+ ```
472
+ 📖 Loading context from previous phases...
473
+ ✅ Re-reading docs/code-standards.md
474
+ ✅ Re-reading ai-instructions.md
475
+ ```
437
476
 
438
- A) ⭐ **Mock Data + Test Fixtures** (Recommended)
477
+ **Generate `docs/testing.md` automatically:**
439
478
 
440
- - Mock API responses
441
- - Use fixtures for consistent data
442
- - Best for: Most apps
479
+ - Use template: `.ai-flow/templates/docs/testing.template.md`
480
+ - **If MVP scope:** Fill with basic testing strategy: framework selection, smoke tests on critical paths, coverage 15-25%, basic CI setup. Mark advanced sections as "Not implemented yet - expand when moving to Production-Ready"
481
+ - **If Production-Ready:** Fill with comprehensive testing strategy: framework, unit/integration/e2e tests, 60-80% coverage, test data management, mocking, full CI/CD
482
+ - **If Enterprise:** Fill with exhaustive testing strategy: all Production-Ready items + contract tests, load tests, security tests, 80-95% coverage, performance benchmarks
483
+ - Write to: `docs/testing.md`
443
484
 
444
- B) **Test Database**
485
+ ```
486
+ ✅ Generated: docs/testing.md
445
487
 
446
- - Separate test database
447
- - Best for: Integration testing
488
+ Document has been created with all Phase 6 information.
448
489
 
449
- C) **Real API (Staging)**
490
+ 📝 Would you like to make any corrections before continuing?
450
491
 
451
- - Use staging environment
452
- - Best for: E2E testing
492
+ If yes: Edit the file and type "ready" when done. I'll re-read it.
493
+ If no: Type "continue" to proceed to Phase 7.
494
+ ```
453
495
 
454
- **Your answer:**
455
- ---
456
- ## ✅ Phase 6 Completion
496
+ **If user edits file:**
497
+ Re-read file to refresh context before continuing.
498
+ ---
499
+ **Proceed to Phase 7 only after documents are validated.**
457
500
 
458
- After answering all questions, summarize:
501
+ > ⚠️ **CRITICAL:** DO NOT generate README.md in this phase. README.md is ONLY generated in Phase 8 (step 8.5) after framework initialization.
502
+ ---
459
503
 
460
- ```
461
- ---
462
- ✅ Phase 6 Complete: Testing Strategy
463
- ---
464
- Selected Testing Stack:
465
- - Unit Tests: Jest (React Native Testing Library)
466
- - E2E Tests: Detox
467
- - Device Testing: TestFlight + Firebase App Distribution
468
- - Coverage Target: 80% overall
469
- - Snapshot Testing: Yes (Jest Snapshots)
470
- - Performance Testing: Basic
471
- - Accessibility Testing: Basic
472
- - CI/CD: Run all tests on PR
473
-
474
- Proceed to Phase 7 (Store Deployment)? (Y/n)
475
- ```
476
- ---
477
504
  ## 📝 Generated Documents
478
505
 
479
506
  After Phase 6, generate/update:
507
+ - `docs/testing.md` - Testing strategy and quality gates
508
+
509
+ ---
480
510
 
481
- - `docs/testing.md` - Testing strategy and setup guide
482
- - `ai-instructions.md` - Add testing rules
483
- ---
484
- **Next Phase:** Phase 7 - Store Deployment
511
+ **Next Phase:** Phase 7 - Operations & Deployment (10-15 min)
485
512
 
486
- Read: `.ai-flow/prompts/mobile/flow-build-phase-7-deployment.md`
487
- ---
488
- **Last Updated:** 2025-01-XX
513
+ Read: `.ai-flow/prompts/backend/flow-build-phase-7.md`
489
514
 
490
- **Version:** 1.4.0
515
+ ---
491
516
 
517
+ **Last Updated:** 2025-12-20
518
+ **Version:** 2.1.8
492
519
 
520
+ ---
493
521
 
522
+ ## PHASE 7: Operations & Deployment (10-15 min)
494
523
 
524
+ ````