ai-flow-dev 2.1.3 → 2.1.5
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 +25 -38
- package/dist/cli.js +68 -46
- package/dist/cli.js.map +1 -1
- package/package.json +5 -5
- package/prompts/backend/flow-build-phase-0.md +31 -63
- package/prompts/backend/flow-build-phase-1.md +9 -17
- package/prompts/backend/flow-build-phase-10.md +199 -585
- 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 +120 -40
- 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 +20 -196
- 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 +14 -35
- 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 +13 -32
- 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
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# Code Standards
|
|
2
2
|
|
|
3
3
|
> Coding conventions, quality rules, and best practices for {{PROJECT_NAME}}
|
|
4
|
-
|
|
5
4
|
---
|
|
6
|
-
|
|
7
5
|
## 🎨 Code Style
|
|
8
6
|
|
|
9
7
|
### Formatting
|
|
@@ -30,9 +28,7 @@
|
|
|
30
28
|
# Format code
|
|
31
29
|
{{FORMAT_COMMAND}}
|
|
32
30
|
```
|
|
33
|
-
|
|
34
31
|
---
|
|
35
|
-
|
|
36
32
|
## 📝 Naming Conventions
|
|
37
33
|
|
|
38
34
|
### Files
|
|
@@ -115,9 +111,7 @@ const hasPermission = false;
|
|
|
115
111
|
const canEdit = checkPermissions();
|
|
116
112
|
const shouldRefresh = false;
|
|
117
113
|
```
|
|
118
|
-
|
|
119
114
|
---
|
|
120
|
-
|
|
121
115
|
## 🏗️ Code Organization
|
|
122
116
|
|
|
123
117
|
### File Structure
|
|
@@ -201,9 +195,7 @@ import { validateEmail } from '@/utils/validation';
|
|
|
201
195
|
```
|
|
202
196
|
|
|
203
197
|
{{/IF}}
|
|
204
|
-
|
|
205
198
|
---
|
|
206
|
-
|
|
207
199
|
## {{#IF TYPESCRIPT}}📘 TypeScript Rules{{ELSE}}📘 Type System{{/IF}}
|
|
208
200
|
|
|
209
201
|
{{#IF TYPESCRIPT}}
|
|
@@ -267,9 +259,7 @@ class Repository<T> {
|
|
|
267
259
|
```
|
|
268
260
|
|
|
269
261
|
{{/IF}}
|
|
270
|
-
|
|
271
262
|
---
|
|
272
|
-
|
|
273
263
|
## 🚨 Error Handling
|
|
274
264
|
|
|
275
265
|
### Strategy
|
|
@@ -299,9 +289,7 @@ class Repository<T> {
|
|
|
299
289
|
```{{LANGUAGE}}
|
|
300
290
|
{{ERROR_LOGGING_EXAMPLE}}
|
|
301
291
|
```
|
|
302
|
-
|
|
303
292
|
---
|
|
304
|
-
|
|
305
293
|
## 📝 Logging Standards
|
|
306
294
|
|
|
307
295
|
### Log Levels
|
|
@@ -395,9 +383,7 @@ class Repository<T> {
|
|
|
395
383
|
# Find by request ID
|
|
396
384
|
{{LOG_REQUEST_ID_QUERY}}
|
|
397
385
|
```
|
|
398
|
-
|
|
399
386
|
---
|
|
400
|
-
|
|
401
387
|
## 📝 Comments and Documentation
|
|
402
388
|
|
|
403
389
|
### When to Comment
|
|
@@ -496,9 +482,7 @@ for (const user of users) {
|
|
|
496
482
|
// FIXME(username): Description of bug that needs fixing
|
|
497
483
|
// HACK(username): Explanation of why this hack exists
|
|
498
484
|
```
|
|
499
|
-
|
|
500
485
|
---
|
|
501
|
-
|
|
502
486
|
## 🧪 Code Quality Metrics
|
|
503
487
|
|
|
504
488
|
### Function Complexity
|
|
@@ -522,9 +506,7 @@ for (const user of users) {
|
|
|
522
506
|
**Maximum File Length:** {{MAX_FILE_LENGTH}} lines
|
|
523
507
|
|
|
524
508
|
**When to split:** If file exceeds limit or has multiple responsibilities
|
|
525
|
-
|
|
526
509
|
---
|
|
527
|
-
|
|
528
510
|
## ✅ Code Quality Rules
|
|
529
511
|
|
|
530
512
|
### Functions
|
|
@@ -563,9 +545,7 @@ for (const user of users) {
|
|
|
563
545
|
- ✅ Avoid premature optimization
|
|
564
546
|
- ✅ Readable over clever
|
|
565
547
|
- ❌ Don't over-engineer
|
|
566
|
-
|
|
567
548
|
---
|
|
568
|
-
|
|
569
549
|
## 🔒 Security Coding Standards
|
|
570
550
|
|
|
571
551
|
### Input Validation
|
|
@@ -591,9 +571,7 @@ for (const user of users) {
|
|
|
591
571
|
```{{LANGUAGE}}
|
|
592
572
|
{{SECRETS_EXAMPLE}}
|
|
593
573
|
```
|
|
594
|
-
|
|
595
574
|
---
|
|
596
|
-
|
|
597
575
|
## 🧹 Code Smell Detection
|
|
598
576
|
|
|
599
577
|
### Common Code Smells
|
|
@@ -607,9 +585,7 @@ for (const user of users) {
|
|
|
607
585
|
| Dead Code | Unused code | Delete it |
|
|
608
586
|
| Magic Numbers | Unexplained constants | Use named constants |
|
|
609
587
|
| Nested Conditionals | Deep if/else nesting | Use early returns, guard clauses |
|
|
610
|
-
|
|
611
588
|
---
|
|
612
|
-
|
|
613
589
|
## 📦 Dependency Management
|
|
614
590
|
|
|
615
591
|
### Rules
|
|
@@ -631,9 +607,7 @@ for (const user of users) {
|
|
|
631
607
|
```bash
|
|
632
608
|
{{SECURITY_AUDIT_COMMAND}}
|
|
633
609
|
```
|
|
634
|
-
|
|
635
610
|
---
|
|
636
|
-
|
|
637
611
|
## 🔧 Linting
|
|
638
612
|
|
|
639
613
|
**Tool:** {{LINTER}}
|
|
@@ -655,9 +629,7 @@ for (const user of users) {
|
|
|
655
629
|
{{#EACH LINT_RULE}}
|
|
656
630
|
- **{{RULE_NAME}}**: {{RULE_DESCRIPTION}}
|
|
657
631
|
{{/EACH}}
|
|
658
|
-
|
|
659
632
|
---
|
|
660
|
-
|
|
661
633
|
## ✍️ Git Commit Standards
|
|
662
634
|
|
|
663
635
|
### Commit Message Format
|
|
@@ -713,9 +685,7 @@ Closes #123
|
|
|
713
685
|
- ✅ One logical change per commit
|
|
714
686
|
- ❌ Don't mix refactoring with feature changes
|
|
715
687
|
- ❌ Don't commit broken code
|
|
716
|
-
|
|
717
688
|
---
|
|
718
|
-
|
|
719
689
|
## 📋 Code Review Checklist
|
|
720
690
|
|
|
721
691
|
### Before Requesting Review
|
|
@@ -738,9 +708,7 @@ Closes #123
|
|
|
738
708
|
- [ ] No security vulnerabilities
|
|
739
709
|
- [ ] Performance is acceptable
|
|
740
710
|
- [ ] Follows architecture patterns
|
|
741
|
-
|
|
742
711
|
---
|
|
743
|
-
|
|
744
712
|
## 🎯 Code Examples
|
|
745
713
|
|
|
746
714
|
### Controller Example
|
|
@@ -772,9 +740,7 @@ Closes #123
|
|
|
772
740
|
```{{LANGUAGE}}
|
|
773
741
|
{{TEST_EXAMPLE}}
|
|
774
742
|
```
|
|
775
|
-
|
|
776
743
|
---
|
|
777
|
-
|
|
778
744
|
## 🚀 Performance Guidelines
|
|
779
745
|
|
|
780
746
|
### Database
|
|
@@ -802,9 +768,7 @@ Closes #123
|
|
|
802
768
|
- ✅ Stream large files
|
|
803
769
|
- ❌ Don't load entire files into memory
|
|
804
770
|
- ❌ Don't create memory leaks
|
|
805
|
-
|
|
806
771
|
---
|
|
807
|
-
|
|
808
772
|
## 📚 Resources
|
|
809
773
|
|
|
810
774
|
### Official Docs
|
|
@@ -818,11 +782,11 @@ Closes #123
|
|
|
818
782
|
{{#EACH STYLE_GUIDE}}
|
|
819
783
|
- [{{GUIDE_NAME}}]({{GUIDE_URL}})
|
|
820
784
|
{{/EACH}}
|
|
821
|
-
|
|
822
785
|
---
|
|
823
|
-
|
|
824
786
|
**Document Version:** 1.0
|
|
825
787
|
|
|
826
788
|
**Last Updated:** {{GENERATION_DATE}}
|
|
827
789
|
|
|
828
790
|
**Generated by:** AI Flow v1.0.0
|
|
791
|
+
|
|
792
|
+
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# Contributing Guide
|
|
2
2
|
|
|
3
3
|
> How to contribute to {{PROJECT_NAME}}
|
|
4
|
-
|
|
5
4
|
---
|
|
6
|
-
|
|
7
5
|
## 🚀 Getting Started
|
|
8
6
|
|
|
9
7
|
### Prerequisites
|
|
@@ -35,9 +33,7 @@ cp .env.example .env
|
|
|
35
33
|
# Start development server
|
|
36
34
|
{{DEV_COMMAND}}
|
|
37
35
|
```
|
|
38
|
-
|
|
39
36
|
---
|
|
40
|
-
|
|
41
37
|
## 🔄 Development Workflow
|
|
42
38
|
|
|
43
39
|
1. Create feature branch from `main`
|
|
@@ -48,9 +44,7 @@ cp .env.example .env
|
|
|
48
44
|
6. Push and create pull request
|
|
49
45
|
7. Address review comments
|
|
50
46
|
8. Merge after approval
|
|
51
|
-
|
|
52
47
|
---
|
|
53
|
-
|
|
54
48
|
## 🌿 Branch Strategy
|
|
55
49
|
|
|
56
50
|
**Main Branches:**
|
|
@@ -71,9 +65,7 @@ feature/add-user-authentication
|
|
|
71
65
|
bugfix/fix-login-redirect
|
|
72
66
|
hotfix/patch-security-vulnerability
|
|
73
67
|
```
|
|
74
|
-
|
|
75
68
|
---
|
|
76
|
-
|
|
77
69
|
## ✅ Before Committing
|
|
78
70
|
|
|
79
71
|
```bash
|
|
@@ -86,9 +78,7 @@ hotfix/patch-security-vulnerability
|
|
|
86
78
|
# Check coverage
|
|
87
79
|
{{COVERAGE_COMMAND}}
|
|
88
80
|
```
|
|
89
|
-
|
|
90
81
|
---
|
|
91
|
-
|
|
92
82
|
## 📝 Commit Standards
|
|
93
83
|
|
|
94
84
|
**Format:** {{COMMIT_FORMAT}}
|
|
@@ -107,9 +97,7 @@ Closes #123
|
|
|
107
97
|
```
|
|
108
98
|
|
|
109
99
|
{{/IF}}
|
|
110
|
-
|
|
111
100
|
---
|
|
112
|
-
|
|
113
101
|
## 🔍 Code Review
|
|
114
102
|
|
|
115
103
|
### Review Checklist
|
|
@@ -120,9 +108,7 @@ Closes #123
|
|
|
120
108
|
- [ ] No console.logs
|
|
121
109
|
- [ ] No security vulnerabilities
|
|
122
110
|
- [ ] Performance acceptable
|
|
123
|
-
|
|
124
111
|
---
|
|
125
|
-
|
|
126
112
|
## 📚 Documentation
|
|
127
113
|
|
|
128
114
|
{{#EACH DOC_LOCATION}}
|
|
@@ -156,8 +142,8 @@ The command will:
|
|
|
156
142
|
4. Automatically update affected documents
|
|
157
143
|
|
|
158
144
|
**For more information:** See the AI Flow README for detailed usage instructions.
|
|
159
|
-
|
|
160
145
|
---
|
|
161
|
-
|
|
162
146
|
**Last Updated:** {{GENERATION_DATE}}
|
|
163
147
|
|
|
148
|
+
|
|
149
|
+
|
|
@@ -14,9 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
**Data Access Layer:** {{DATA_ACCESS_LAYER}}
|
|
16
16
|
|
|
17
|
-
**Data Ownership:** {{DATA_OWNERSHIP}}
|
|
18
|
-
|
|
19
|
-
---
|
|
17
|
+
## **Data Ownership:** {{DATA_OWNERSHIP}}
|
|
20
18
|
|
|
21
19
|
## 📊 Entity Catalog
|
|
22
20
|
|
|
@@ -114,8 +112,9 @@
|
|
|
114
112
|
{{/EACH}}
|
|
115
113
|
|
|
116
114
|
{{ELSE}}
|
|
115
|
+
|
|
117
116
|
- No indexes explicitly defined yet. Indexes will be created based on query patterns and foreign keys.
|
|
118
|
-
{{/IF}}
|
|
117
|
+
{{/IF}}
|
|
119
118
|
|
|
120
119
|
### Index Guidelines
|
|
121
120
|
|
|
@@ -136,12 +135,14 @@
|
|
|
136
135
|
|
|
137
136
|
**Supported Levels:**
|
|
138
137
|
{{#EACH ISOLATION_LEVEL}}
|
|
138
|
+
|
|
139
139
|
- **{{LEVEL_NAME}}**: {{LEVEL_DESCRIPTION}}
|
|
140
|
-
{{/EACH}}
|
|
140
|
+
{{/EACH}}
|
|
141
141
|
|
|
142
142
|
### Transaction Strategy
|
|
143
143
|
|
|
144
144
|
**When to use transactions:**
|
|
145
|
+
|
|
145
146
|
- ✅ Multi-step operations that must succeed or fail together
|
|
146
147
|
- ✅ Updates affecting multiple tables
|
|
147
148
|
- ✅ Operations requiring consistency guarantees
|
|
@@ -151,11 +152,13 @@
|
|
|
151
152
|
|
|
152
153
|
{{#IF TRANSACTION_PATTERNS}}
|
|
153
154
|
{{#EACH TRANSACTION_PATTERN}}
|
|
155
|
+
|
|
154
156
|
#### {{PATTERN_NAME}}
|
|
155
157
|
|
|
156
158
|
**Use Case:** {{PATTERN_USE_CASE}}
|
|
157
159
|
|
|
158
160
|
**Implementation:**
|
|
161
|
+
|
|
159
162
|
```{{LANGUAGE}}
|
|
160
163
|
{{PATTERN_EXAMPLE}}
|
|
161
164
|
```
|
|
@@ -164,8 +167,33 @@
|
|
|
164
167
|
|
|
165
168
|
{{/EACH}}
|
|
166
169
|
{{ELSE}}
|
|
170
|
+
|
|
167
171
|
- Transaction patterns to be defined based on business requirements.
|
|
168
|
-
{{/IF}}
|
|
172
|
+
{{/IF}}
|
|
173
|
+
|
|
174
|
+
### Transaction Boundaries (Atomic Operations)
|
|
175
|
+
|
|
176
|
+
{{#IF TRANSACTION_BOUNDARIES}}
|
|
177
|
+
{{#EACH TRANSACTION_BOUNDARY}}
|
|
178
|
+
|
|
179
|
+
#### {{OPERATION_NAME}}
|
|
180
|
+
|
|
181
|
+
**Description:** {{DESCRIPTION}}
|
|
182
|
+
|
|
183
|
+
**Steps (all or nothing):**
|
|
184
|
+
{{#EACH STEP}}
|
|
185
|
+
{{STEP_NUMBER}}. {{STEP_DESCRIPTION}} {{#IF IN_TRANSACTION}}✅ In transaction{{ELSE}}⚡ Outside (async){{/IF}}
|
|
186
|
+
{{/EACH}}
|
|
187
|
+
|
|
188
|
+
**Rollback Trigger:** {{ROLLBACK_TRIGGER}}
|
|
189
|
+
|
|
190
|
+
**Compensating Actions:** {{COMPENSATING_ACTIONS}}
|
|
191
|
+
|
|
192
|
+
{{/EACH}}
|
|
193
|
+
{{ELSE}}
|
|
194
|
+
|
|
195
|
+
- No explicit transaction boundaries defined. Individual operations are atomic by default.
|
|
196
|
+
{{/IF}}
|
|
169
197
|
|
|
170
198
|
### Consistency Model
|
|
171
199
|
|
|
@@ -173,17 +201,19 @@
|
|
|
173
201
|
|
|
174
202
|
{{#IF EVENTUAL_CONSISTENCY}}
|
|
175
203
|
**Eventual Consistency:**
|
|
204
|
+
|
|
176
205
|
- Acceptable delay: {{CONSISTENCY_DELAY}}
|
|
177
206
|
- Replication lag tolerance: {{REPLICATION_LAG}}
|
|
178
207
|
- Conflict resolution: {{CONFLICT_RESOLUTION}}
|
|
179
|
-
{{/IF}}
|
|
208
|
+
{{/IF}}
|
|
180
209
|
|
|
181
210
|
{{#IF STRONG_CONSISTENCY}}
|
|
182
211
|
**Strong Consistency:**
|
|
212
|
+
|
|
183
213
|
- All reads see latest writes
|
|
184
214
|
- Synchronous replication required
|
|
185
215
|
- Higher latency, lower throughput
|
|
186
|
-
{{/IF}}
|
|
216
|
+
{{/IF}}
|
|
187
217
|
|
|
188
218
|
---
|
|
189
219
|
|
|
@@ -195,26 +225,29 @@
|
|
|
195
225
|
|
|
196
226
|
{{#IF PRISMA_MIGRATE}}
|
|
197
227
|
**Prisma Migrate:**
|
|
228
|
+
|
|
198
229
|
- Location: `prisma/migrations/`
|
|
199
230
|
- Generate migration: `npx prisma migrate dev --name migration_name`
|
|
200
231
|
- Apply migration: `npx prisma migrate deploy`
|
|
201
|
-
{{/IF}}
|
|
232
|
+
{{/IF}}
|
|
202
233
|
|
|
203
234
|
{{#IF TYPEORM_MIGRATIONS}}
|
|
204
235
|
**TypeORM Migrations:**
|
|
236
|
+
|
|
205
237
|
- Location: `src/migrations/`
|
|
206
238
|
- Generate migration: `npm run migration:generate -- -n MigrationName`
|
|
207
239
|
- Run migration: `npm run migration:run`
|
|
208
240
|
- Revert migration: `npm run migration:revert`
|
|
209
|
-
{{/IF}}
|
|
241
|
+
{{/IF}}
|
|
210
242
|
|
|
211
243
|
{{#IF ALEMBIC}}
|
|
212
244
|
**Alembic (Python):**
|
|
245
|
+
|
|
213
246
|
- Location: `alembic/versions/`
|
|
214
247
|
- Generate migration: `alembic revision --autogenerate -m "migration_name"`
|
|
215
248
|
- Apply migration: `alembic upgrade head`
|
|
216
249
|
- Rollback: `alembic downgrade -1`
|
|
217
|
-
{{/IF}}
|
|
250
|
+
{{/IF}}
|
|
218
251
|
|
|
219
252
|
### Migration Strategy
|
|
220
253
|
|
|
@@ -250,8 +283,9 @@
|
|
|
250
283
|
| {{VERSION}} | {{DESCRIPTION}} | {{APPLIED_DATE}} | {{#IF ROLLBACK_AVAILABLE}}Yes{{ELSE}}No{{/IF}} |
|
|
251
284
|
{{/EACH}}
|
|
252
285
|
{{ELSE}}
|
|
286
|
+
|
|
253
287
|
- Migration history will be tracked by the migration tool.
|
|
254
|
-
{{/IF}}
|
|
288
|
+
{{/IF}}
|
|
255
289
|
|
|
256
290
|
---
|
|
257
291
|
|
|
@@ -288,7 +322,81 @@
|
|
|
288
322
|
|
|
289
323
|
---
|
|
290
324
|
|
|
291
|
-
##
|
|
325
|
+
## �️ Soft Delete & Data Lifecycle
|
|
326
|
+
|
|
327
|
+
### Deletion Strategy
|
|
328
|
+
|
|
329
|
+
**Soft Delete Field:** `{{SOFT_DELETE_FIELD}}` ({{SOFT_DELETE_TYPE}})
|
|
330
|
+
|
|
331
|
+
**Default Query Behavior:** {{SOFT_DELETE_QUERY_DEFAULT}}
|
|
332
|
+
|
|
333
|
+
### Entity Deletion Rules
|
|
334
|
+
|
|
335
|
+
| Entity | Delete Type | Field | Cleanup Policy |
|
|
336
|
+
| ------ | ----------- | ----- | -------------- |
|
|
337
|
+
|
|
338
|
+
{{#EACH ENTITY_DELETE_RULE}}
|
|
339
|
+
| {{ENTITY}} | {{DELETE_TYPE}} | {{FIELD}} | {{CLEANUP_POLICY}} |
|
|
340
|
+
{{/EACH}}
|
|
341
|
+
|
|
342
|
+
### Permanent Cleanup Schedule
|
|
343
|
+
|
|
344
|
+
**Policy:** {{CLEANUP_POLICY}}
|
|
345
|
+
**Schedule:** {{CLEANUP_SCHEDULE}}
|
|
346
|
+
**Retention Period:** {{RETENTION_DAYS}} days
|
|
347
|
+
|
|
348
|
+
### Cascade Delete Behavior
|
|
349
|
+
|
|
350
|
+
{{#EACH CASCADE_DELETE}}
|
|
351
|
+
|
|
352
|
+
- **{{PARENT_ENTITY}}** → **{{CHILD_ENTITY}}**: {{BEHAVIOR}}
|
|
353
|
+
{{/EACH}}
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## 🔄 State Machines
|
|
358
|
+
|
|
359
|
+
{{#IF STATE_MACHINES}}
|
|
360
|
+
{{#EACH STATE_MACHINE}}
|
|
361
|
+
|
|
362
|
+
### {{ENTITY_NAME}} State Machine
|
|
363
|
+
|
|
364
|
+
**States:** {{STATES}}
|
|
365
|
+
|
|
366
|
+
**Initial State:** {{INITIAL_STATE}}
|
|
367
|
+
|
|
368
|
+
**Terminal States:** {{TERMINAL_STATES}}
|
|
369
|
+
|
|
370
|
+
```mermaid
|
|
371
|
+
stateDiagram-v2
|
|
372
|
+
{{STATE_DIAGRAM}}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
#### Valid Transitions
|
|
376
|
+
|
|
377
|
+
| From | To | Action | Guards | Side Effects |
|
|
378
|
+
| ---- | --- | ------ | ------ | ------------ |
|
|
379
|
+
|
|
380
|
+
{{#EACH TRANSITION}}
|
|
381
|
+
| {{FROM}} | {{TO}} | {{ACTION}} | {{GUARDS}} | {{SIDE_EFFECTS}} |
|
|
382
|
+
{{/EACH}}
|
|
383
|
+
|
|
384
|
+
#### Invalid Transitions (Explicitly Forbidden)
|
|
385
|
+
|
|
386
|
+
{{#EACH INVALID_TRANSITION}}
|
|
387
|
+
|
|
388
|
+
- `{{FROM}}` → `{{TO}}`: {{REASON}}
|
|
389
|
+
{{/EACH}}
|
|
390
|
+
|
|
391
|
+
{{/EACH}}
|
|
392
|
+
{{ELSE}}
|
|
393
|
+
|
|
394
|
+
- No state machines defined. Entities use simple status fields without formal transition rules.
|
|
395
|
+
{{/IF}}
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## �📦 Serialization Contracts
|
|
292
400
|
|
|
293
401
|
### API Representations
|
|
294
402
|
|
|
@@ -312,9 +420,7 @@
|
|
|
312
420
|
{{RESPONSE_SCHEMA}}
|
|
313
421
|
```
|
|
314
422
|
|
|
315
|
-
**Notes:** {{NOTES}}
|
|
316
|
-
|
|
317
|
-
---
|
|
423
|
+
## **Notes:** {{NOTES}}
|
|
318
424
|
|
|
319
425
|
{{/EACH}}
|
|
320
426
|
|
|
@@ -328,8 +434,8 @@
|
|
|
328
434
|
- Consumers: {{CONSUMERS}}
|
|
329
435
|
- Schema:
|
|
330
436
|
`json
|
|
331
|
-
|
|
332
|
-
|
|
437
|
+
{{SCHEMA}}
|
|
438
|
+
`
|
|
333
439
|
{{/EACH}}
|
|
334
440
|
{{ELSE}}
|
|
335
441
|
- No asynchronous payloads defined.
|
|
@@ -362,9 +468,7 @@
|
|
|
362
468
|
|
|
363
469
|
**Retention Policy:** {{RETENTION_POLICY}}
|
|
364
470
|
|
|
365
|
-
**Compliance Scope:** {{COMPLIANCE_SCOPE}}
|
|
366
|
-
|
|
367
|
-
---
|
|
471
|
+
## **Compliance Scope:** {{COMPLIANCE_SCOPE}}
|
|
368
472
|
|
|
369
473
|
## 🧪 Testing & Quality Gates
|
|
370
474
|
|