@atlashub/smartstack-cli 4.17.1 → 4.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/package.json +1 -1
  2. package/templates/agents/ba-reader.md +86 -80
  3. package/templates/agents/ba-writer.md +321 -413
  4. package/templates/agents/docs-context-reader.md +3 -3
  5. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +133 -0
  6. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +126 -0
  7. package/templates/skills/apex/SKILL.md +29 -16
  8. package/templates/skills/apex/_shared.md +62 -9
  9. package/templates/skills/apex/references/analysis-methods.md +8 -6
  10. package/templates/skills/apex/references/challenge-questions.md +5 -5
  11. package/templates/skills/apex/references/core-seed-data.md +68 -45
  12. package/templates/skills/apex/references/frontend-route-wiring-app-tsx.md +26 -21
  13. package/templates/skills/apex/references/parallel-execution.md +156 -0
  14. package/templates/skills/apex/references/person-extension-pattern.md +12 -12
  15. package/templates/skills/apex/references/post-checks.md +1748 -1726
  16. package/templates/skills/apex/references/smartstack-api.md +63 -57
  17. package/templates/skills/apex/references/smartstack-frontend-compliance.md +594 -0
  18. package/templates/skills/apex/references/smartstack-frontend.md +1246 -1842
  19. package/templates/skills/apex/references/smartstack-layers.md +98 -145
  20. package/templates/skills/apex/steps/step-00-init.md +30 -6
  21. package/templates/skills/apex/steps/step-01-analyze.md +27 -23
  22. package/templates/skills/apex/steps/step-02-plan.md +12 -12
  23. package/templates/skills/apex/steps/step-03-execute.md +198 -143
  24. package/templates/skills/apex/steps/step-04-examine.md +24 -93
  25. package/templates/skills/apex/steps/step-05-deep-review.md +16 -16
  26. package/templates/skills/apex/steps/step-06-resolve.md +9 -9
  27. package/templates/skills/apex/steps/step-07-tests.md +3 -1
  28. package/templates/skills/apex/steps/step-08-run-tests.md +1 -1
  29. package/templates/skills/business-analyse/SKILL.md +182 -301
  30. package/templates/skills/business-analyse/_shared.md +119 -336
  31. package/templates/skills/business-analyse/html/ba-interactive.html +703 -82
  32. package/templates/skills/business-analyse/html/build-html.js +41 -3
  33. package/templates/skills/business-analyse/html/src/partials/cadrage-context.html +34 -0
  34. package/templates/skills/business-analyse/html/src/partials/cadrage-risks.html +48 -0
  35. package/templates/skills/business-analyse/html/src/partials/cadrage-scope.html +49 -0
  36. package/templates/skills/business-analyse/html/src/partials/cadrage-stakeholders.html +55 -0
  37. package/templates/skills/business-analyse/html/src/partials/cadrage-success.html +34 -0
  38. package/templates/skills/business-analyse/html/src/partials/consol-datamodel.html +8 -0
  39. package/templates/skills/business-analyse/html/src/partials/consol-flows.html +29 -0
  40. package/templates/skills/business-analyse/html/src/partials/consol-interactions.html +8 -0
  41. package/templates/skills/business-analyse/html/src/partials/consol-permissions.html +8 -0
  42. package/templates/skills/business-analyse/html/src/partials/decomp-dependencies.html +38 -0
  43. package/templates/skills/business-analyse/html/src/partials/decomp-modules.html +51 -0
  44. package/templates/skills/business-analyse/html/src/partials/handoff-summary.html +24 -0
  45. package/templates/skills/business-analyse/html/src/partials/module-spec-container.html +4 -0
  46. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +17 -1
  47. package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +31 -5
  48. package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +100 -63
  49. package/templates/skills/business-analyse/html/src/scripts/06-render-mockups.js +372 -0
  50. package/templates/skills/business-analyse/html/src/scripts/10-comments.js +41 -13
  51. package/templates/skills/business-analyse/html/src/styles/09-mockups-html.css +136 -0
  52. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +7 -5
  53. package/templates/skills/business-analyse/questionnaire/02-stakeholders-scope.md +142 -0
  54. package/templates/skills/business-analyse/questionnaire/03-data-ui.md +94 -0
  55. package/templates/skills/business-analyse/questionnaire/04-risks-metrics.md +150 -0
  56. package/templates/skills/business-analyse/questionnaire/05-cross-module.md +69 -0
  57. package/templates/skills/business-analyse/questionnaire.md +23 -280
  58. package/templates/skills/business-analyse/react/application-viewer.md +2 -2
  59. package/templates/skills/business-analyse/react/components.md +4 -4
  60. package/templates/skills/business-analyse/react/i18n-template.md +1 -1
  61. package/templates/skills/business-analyse/react/schema.md +14 -14
  62. package/templates/skills/business-analyse/references/acceptance-criteria.md +25 -25
  63. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +3 -3
  64. package/templates/skills/business-analyse/references/compilation-structure-cards.md +1 -1
  65. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +7 -7
  66. package/templates/skills/business-analyse/references/deploy-data-build.md +14 -12
  67. package/templates/skills/business-analyse/references/deploy-modes.md +10 -10
  68. package/templates/skills/business-analyse/references/detection-strategies.md +6 -6
  69. package/templates/skills/business-analyse/references/html-data-mapping.md +15 -15
  70. package/templates/skills/business-analyse/references/naming-conventions.md +4 -4
  71. package/templates/skills/business-analyse/references/review-data-mapping.md +29 -29
  72. package/templates/skills/business-analyse/references/robustness-checks.md +36 -33
  73. package/templates/skills/business-analyse/references/spec-auto-inference.md +2 -2
  74. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  75. package/templates/skills/business-analyse/references/ui-resource-cards.md +1 -1
  76. package/templates/skills/business-analyse/references/validation-checklist.md +9 -6
  77. package/templates/skills/business-analyse/references/wireframe-svg-style-guide.md +2 -2
  78. package/templates/skills/business-analyse/schemas/application-schema.json +8 -8
  79. package/templates/skills/business-analyse/schemas/feature-schema.json +3 -3
  80. package/templates/skills/business-analyse/schemas/index-schema.json +47 -0
  81. package/templates/skills/business-analyse/schemas/project-schema.json +6 -6
  82. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  83. package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +5 -3
  84. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +4 -4
  85. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  86. package/templates/skills/business-analyse/schemas/shared/common-defs.json +4 -3
  87. package/templates/skills/business-analyse/steps/step-00-init.md +93 -134
  88. package/templates/skills/business-analyse/steps/step-01-cadrage.md +136 -172
  89. package/templates/skills/business-analyse/steps/step-02-structure.md +175 -0
  90. package/templates/skills/business-analyse/steps/step-03-specify.md +198 -0
  91. package/templates/skills/business-analyse/steps/step-04-consolidate.md +478 -0
  92. package/templates/skills/business-analyse/steps/step-05-deploy.md +220 -0
  93. package/templates/skills/business-analyse/steps/step-06-review.md +51 -69
  94. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  95. package/templates/skills/business-analyse/templates/tpl-handoff.md +20 -17
  96. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +2 -2
  97. package/templates/skills/business-analyse/templates-react.md +2 -2
  98. package/templates/skills/derive-prd/SKILL.md +92 -0
  99. package/templates/skills/derive-prd/references/acceptance-criteria.md +169 -0
  100. package/templates/skills/derive-prd/references/entity-domain-mapping.md +115 -0
  101. package/templates/skills/{business-analyse → derive-prd}/references/handoff-file-templates.md +131 -120
  102. package/templates/skills/{business-analyse → derive-prd}/references/handoff-mappings.md +95 -95
  103. package/templates/skills/{business-analyse → derive-prd}/references/handoff-seeddata-generation.md +312 -312
  104. package/templates/skills/{business-analyse → derive-prd}/references/prd-generation.md +262 -258
  105. package/templates/skills/derive-prd/references/readiness-scoring.md +104 -0
  106. package/templates/skills/derive-prd/schemas/handoff-schema.json +95 -0
  107. package/templates/skills/derive-prd/steps/step-00-validate.md +130 -0
  108. package/templates/skills/derive-prd/steps/step-01-transform.md +206 -0
  109. package/templates/skills/derive-prd/steps/step-02-export.md +181 -0
  110. package/templates/skills/{business-analyse → derive-prd}/templates/tpl-progress.md +172 -172
  111. package/templates/skills/ralph-loop/SKILL.md +10 -4
  112. package/templates/skills/ralph-loop/references/category-completeness.md +20 -4
  113. package/templates/skills/ralph-loop/references/compact-loop.md +80 -48
  114. package/templates/skills/ralph-loop/references/init-resume-recovery.md +4 -2
  115. package/templates/skills/ralph-loop/references/parallel-execution.md +27 -27
  116. package/templates/skills/ralph-loop/steps/step-00-init.md +19 -9
  117. package/templates/skills/ralph-loop/steps/step-01-task.md +12 -4
  118. package/templates/skills/ralph-loop/steps/step-02-execute.md +9 -4
  119. package/templates/skills/ralph-loop/steps/step-03-commit.md +1 -1
  120. package/templates/skills/ralph-loop/steps/step-04-check.md +5 -21
  121. package/templates/skills/ralph-loop/steps/step-05-report.md +6 -1
  122. package/templates/skills/apex/references/agent-teams-protocol.md +0 -203
  123. package/templates/skills/business-analyse/_architecture.md +0 -124
  124. package/templates/skills/business-analyse/_elicitation.md +0 -206
  125. package/templates/skills/business-analyse/_module-loop.md +0 -115
  126. package/templates/skills/business-analyse/_suggestions.md +0 -34
  127. package/templates/skills/business-analyse/questionnaire/00-application.md +0 -160
  128. package/templates/skills/business-analyse/questionnaire/00b-project.md +0 -85
  129. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +0 -189
  130. package/templates/skills/business-analyse/questionnaire/03-scope.md +0 -164
  131. package/templates/skills/business-analyse/questionnaire/04-data.md +0 -88
  132. package/templates/skills/business-analyse/questionnaire/05-integrations.md +0 -58
  133. package/templates/skills/business-analyse/questionnaire/06-security.md +0 -68
  134. package/templates/skills/business-analyse/questionnaire/07-ui.md +0 -76
  135. package/templates/skills/business-analyse/questionnaire/08-performance.md +0 -42
  136. package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -45
  137. package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -43
  138. package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +0 -59
  139. package/templates/skills/business-analyse/questionnaire/12-migration.md +0 -58
  140. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +0 -69
  141. package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +0 -135
  142. package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +0 -136
  143. package/templates/skills/business-analyse/references/agent-module-prompt.md +0 -362
  144. package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +0 -557
  145. package/templates/skills/business-analyse/references/cache-warming-strategy.md +0 -566
  146. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +0 -41
  147. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +0 -74
  148. package/templates/skills/business-analyse/references/cadrage-pre-analysis.md +0 -115
  149. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +0 -68
  150. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +0 -85
  151. package/templates/skills/business-analyse/references/team-orchestration.md +0 -1022
  152. package/templates/skills/business-analyse/references/validate-incremental-html.md +0 -121
  153. package/templates/skills/business-analyse/steps/step-01b-applications.md +0 -419
  154. package/templates/skills/business-analyse/steps/step-02-decomposition.md +0 -387
  155. package/templates/skills/business-analyse/steps/step-03a-data.md +0 -16
  156. package/templates/skills/business-analyse/steps/step-03a1-setup.md +0 -506
  157. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +0 -301
  158. package/templates/skills/business-analyse/steps/step-03b-ui.md +0 -425
  159. package/templates/skills/business-analyse/steps/step-03c-compile.md +0 -611
  160. package/templates/skills/business-analyse/steps/step-03d-validate.md +0 -783
  161. package/templates/skills/business-analyse/steps/step-04-consolidation.md +0 -17
  162. package/templates/skills/business-analyse/steps/step-04a-collect.md +0 -415
  163. package/templates/skills/business-analyse/steps/step-04b-analyze.md +0 -163
  164. package/templates/skills/business-analyse/steps/step-04c-decide.md +0 -186
  165. package/templates/skills/business-analyse/steps/step-05a-handoff.md +0 -840
  166. package/templates/skills/business-analyse/steps/step-05b-deploy.md +0 -522
  167. package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +0 -703
@@ -1,301 +0,0 @@
1
- ---
2
- name: step-03a2-analysis
3
- description: Analysis section - objectives, entities, business rules, process flow
4
- model: opus
5
- next_step: steps/step-03b-ui.md
6
- ---
7
-
8
- > **Context files:** `_shared.md` | `_elicitation.md` | `_architecture.md` | `_module-loop.md`
9
- > **Reference (check 7):** `references/entity-architecture-decision.md` — Entity scoring for unresolved relationship targets
10
-
11
- # Step 3a2: Analysis - Entities & Business Logic
12
-
13
- ## MANDATORY EXECUTION RULES
14
-
15
- - ALWAYS use ULTRATHINK mode
16
- - This step follows step-03a1-setup.md (module already initialized)
17
- - **ID NAMING RULE:** All IDs MUST include module prefix (BR-{CAT}-{PREFIX}-{NNN}, OBJ-{PREFIX}-{NNN}, etc.)
18
- - **SCHEMA CONFORMITY RULE:** ALL data MUST fit within feature-schema.json structure
19
-
20
- ## MODE DETECTION (inherited from step-03a1)
21
-
22
- > **CRITICAL: Re-check your execution mode before proceeding.**
23
-
24
- **IF you are running as a TEAM AGENT** (your prompt contains `PROPOSE & REVIEW` or `team-lead` as recipient):
25
- → **NEVER** use `AskUserQuestion` — replace ALL user interactions with ULTRATHINK autonomous decisions
26
- → You are in autonomous mode — make all choices based on decomposition data + SmartStack conventions
27
- → Do NOT present options to the user — you PROPOSE to the team lead via SendMessage, not to the user
28
-
29
- **IF you are running in the MAIN CONVERSATION** (classic inline mode):
30
- → Normal interactive mode — use `AskUserQuestion` as documented below
31
-
32
- ## YOUR TASK
33
-
34
- Define the module's analysis section: objectives, entities (with attributes and relationships), business rules, process flow, and data lifecycle.
35
-
36
- ---
37
-
38
- ## EXECUTION SEQUENCE
39
-
40
- ### 6. Analysis Section
41
-
42
- #### 6a. Objectives
43
-
44
- Define measurable business objectives for this module:
45
-
46
- > **STRUCTURE CARD: analysis.objectives[]**
47
- > ```json
48
- > { "id": "OBJ-{PREFIX}-001", "objective": "Reduce order processing time", "metric": "Average time to fulfillment", "target": "< 4 hours" }
49
- > ```
50
-
51
- #### 6b. Entity Definition
52
-
53
- Define entities for this module (business attributes, not technical):
54
-
55
- > **STRUCTURE CARD: analysis.entities[]** — Field names are EXACT. Do NOT deviate.
56
- > ```json
57
- > {
58
- > "name": "PascalCase",
59
- > "description": "1-2 sentences describing the entity purpose",
60
- > "attributes": [
61
- > {
62
- > "name": "attributeName",
63
- > "description": "What this attribute represents",
64
- > "required": true,
65
- > "unique": false,
66
- > "validation": "Format: XXX-NNNNN, max 100 chars, etc."
67
- > }
68
- > ],
69
- > "relationships": [
70
- > { "target": "OtherEntity", "type": "1:1|1:N|N:1|N:M", "description": "description" }
71
- > ]
72
- > }
73
- > ```
74
- > **FORBIDDEN fields in attributes:** Do NOT use `type`, `values`, `rules`.
75
- > Use `description` to explain what the attribute is, `validation` for format/constraint rules, `unique` as boolean.
76
- >
77
- > **FORBIDDEN FORMAT — DO NOT USE (technical/database schema):**
78
- > ```json
79
- > {
80
- > "name": "Project",
81
- > "tableName": "rh_projects",
82
- > "primaryKey": "id",
83
- > "fields": [
84
- > { "name": "code", "type": "UUID", "required": true }
85
- > ]
86
- > }
87
- > ```
88
- > **Why forbidden:** `tableName`, `primaryKey` are technical fields that do NOT belong in analysis. `fields[]` is NOT recognized by the build pipeline — only `attributes[]` is. `type` with SQL types (UUID, string, timestamp) belongs in implementation, not analysis. Using this format causes **empty entity data in the HTML documentation** and **broken PRD extraction**.
89
- > The canonical format uses `attributes[]` (not `fields[]`), `relationships[]` (not FK inside fields), and NO technical fields (tableName, primaryKey).
90
-
91
- #### 6b-bis. Code Pattern Definition
92
-
93
- For EACH entity defined above, determine the code generation strategy.
94
-
95
- > **STRUCTURE CARD: analysis.entities[].codePattern**
96
- > ```json
97
- > {
98
- > "strategy": "sequential|timestamp-daily|timestamp-minute|year-sequential|uuid-short|manual",
99
- > "prefix": "emp",
100
- > "includeTenantSlug": true,
101
- > "separator": "-",
102
- > "estimatedVolume": 1000,
103
- > "digits": 5,
104
- > "example": "acme-emp-00001"
105
- > }
106
- > ```
107
-
108
- **Strategy selection heuristic** (use as default when user does not specify):
109
-
110
- | Entity type / name pattern | Default strategy | Example |
111
- |---------------------------|-----------------|---------|
112
- | Invoice, Order, Receipt, Bill, Delivery | `timestamp-daily` | `acme-inv-20260215-001` |
113
- | Ticket, Request, Incident, Support, Alert | `timestamp-minute` | `acme-ticket-202602151430-001` |
114
- | Contract, Agreement, Policy, License | `year-sequential` | `acme-ctr-2026-00001` |
115
- | Reference, Category, Tag, Type, Status | `uuid-short` | `acme-ref-a1b2c3d4` |
116
- | Employee, Customer, Partner, Project, Product | `sequential` | `acme-emp-00001` |
117
- | User says "manual" or "user-provided" | `manual` | (user types the code) |
118
-
119
- **Digits calculation (x10 rule):**
120
- - Use Q4.4 (estimated volume) as input
121
- - Apply: `digits = max(4, ceil(log10(volume * 10)))`
122
- - If no volume estimate: default to 5 digits (capacity: 99,999)
123
-
124
- **Interactive question (if NOT team agent):**
125
-
126
- ```yaml
127
- questions:
128
- - header: "Code Pattern"
129
- question: "For entity {entityName}, how should the Code be generated?"
130
- options:
131
- - label: "Auto-sequential (Recommended)"
132
- description: "{tenant}-{prefix}-00001 — simple sequential numbering"
133
- - label: "Date-based (daily)"
134
- description: "{tenant}-{prefix}-20260215-001 — includes creation date"
135
- - label: "Year-sequential"
136
- description: "{tenant}-{prefix}-2026-00001 — yearly numbering"
137
- - label: "Manual entry"
138
- description: "User provides the code — no auto-generation"
139
- multiSelect: false
140
- ```
141
-
142
- If team agent: use heuristic defaults autonomously.
143
-
144
- **Reference:** See `apex/references/code-generation.md` for full ICodeGenerator<T> implementation details, DI registration patterns, and backend service integration.
145
-
146
- #### 6b-ter. Person Role Detection
147
-
148
- > **CRITICAL: Detect entities representing person roles to avoid duplicating User data.**
149
- > SmartStack User entity already contains: FirstName, LastName, Email, DisplayName, DepartmentId, JobTitleId, PhoneNumber, etc.
150
- > Entities that represent person roles MUST be linked to User via the Person Extension Pattern.
151
-
152
- **Step 1 — Name-based detection:**
153
-
154
- Known person role names (mandatory User link):
155
- - Employee, Manager, Instructor, Teacher, Trainer, Technician
156
-
157
- Known person role names (optional User link):
158
- - Customer, Client, Supplier, Vendor, Patient, Student, Member, Participant, Candidate, Applicant, Contact, Lead, Prospect, Volunteer, Contractor, Freelancer, Consultant
159
-
160
- **Step 2 — Attribute-based detection:**
161
-
162
- If an entity has 3+ attributes among: firstName, lastName, email, phoneNumber, department, jobTitle, address → flag as potential person role.
163
-
164
- **Step 3 — Interactive confirmation:**
165
-
166
- IF entity name matches a known person role OR attribute detection triggers:
167
-
168
- Use `AskUserQuestion` with 3 options:
169
- 1. "User link mandatory (Recommended)" — the entity is ALWAYS a system User (Employee, Manager)
170
- 2. "User link optional" — the entity MAY have a system account (Customer with portal)
171
- 3. "Independent entity" — no User link (rare: only if the person will NEVER log in)
172
-
173
- **Step 4 — Apply Person Extension config:**
174
-
175
- IF option 1 or 2 selected:
176
- - Store `personRoleConfig` in the entity's structure card
177
- - For mandatory mode: REMOVE attributes that duplicate User (firstName, lastName, email, displayName, department, jobTitle, phoneNumber) from entity attributes
178
- - For optional mode: KEEP person attributes but mark as "fallback when no User linked"
179
-
180
- > **STRUCTURE CARD: analysis.entities[].personRoleConfig**
181
- > ```json
182
- > {
183
- > "personRoleConfig": {
184
- > "linkedEntity": "User",
185
- > "fkField": "UserId",
186
- > "userLinkMode": "mandatory|optional",
187
- > "inheritedFields": ["FirstName", "LastName", "Email", "DisplayName",
188
- > "Department", "JobTitle", "PhoneNumber"]
189
- > }
190
- > }
191
- > ```
192
-
193
- IF option 3 selected: do not add personRoleConfig (entity stays independent).
194
-
195
- #### 6c. Process Flow
196
-
197
- Define the main business process flow for this module (not lifecycle — that's in 8j):
198
-
199
- > **STRUCTURE CARD: analysis.processFlow**
200
- > ```json
201
- > {
202
- > "entryPoints": ["User navigates to module", "System event triggers action"],
203
- > "mainFlow": [
204
- > { "step": 1, "actor": "Manager", "action": "Opens the list", "system": "Displays filtered records" },
205
- > { "step": 2, "actor": "Manager", "action": "Creates a record", "system": "Validates BR-VAL-{PREFIX}-001" },
206
- > { "step": 3, "actor": "System", "action": "Saves record", "system": "Sends notification" }
207
- > ],
208
- > "decisionPoints": [
209
- > { "condition": "Is amount > threshold?", "ifTrue": "Route to approver", "ifFalse": "Auto-approve", "rule": "BR-WF-{PREFIX}-001" }
210
- > ],
211
- > "alternativeFlows": ["Bulk import via CSV", "Automatic sync from SFTP"]
212
- > }
213
- > ```
214
- > **FORBIDDEN:** Do NOT put lifecycle/state machine data here. Use `specification.lifeCycles[]` for that.
215
-
216
- #### 6d. Data Lifecycle (MANDATORY — ALL modules)
217
-
218
- > **CRITICAL:** This section is MANDATORY for EVERY module, even simple ones without GDPR requirements.
219
- > Missing `analysis.dataLifecycle` causes BLOCKING errors in step-03d validation and consolidation structural checks.
220
-
221
- Define data retention and lifecycle policies:
222
-
223
- > **STRUCTURE CARD: analysis.dataLifecycle**
224
- > ```json
225
- > {
226
- > "retentionPeriod": "7 years",
227
- > "archiveStrategy": "Move to cold storage after 2 years",
228
- > "gdprCompliance": "PII anonymized on request, data export available",
229
- > "states": [
230
- > { "name": "active", "transitions": ["archived", "deleted"] },
231
- > { "name": "archived", "transitions": ["active"] },
232
- > { "name": "deleted", "transitions": [] }
233
- > ]
234
- > }
235
- > ```
236
- >
237
- > **Standard defaults** (use for modules without specific GDPR/retention requirements):
238
- > ```json
239
- > {
240
- > "retentionPeriod": "Standard (as per company policy)",
241
- > "archiveStrategy": "Soft-delete with audit trail",
242
- > "gdprCompliance": "N/A — no PII or standard audit trail only",
243
- > "states": [
244
- > { "name": "active", "transitions": ["archived"] },
245
- > { "name": "archived", "transitions": ["active"] }
246
- > ]
247
- > }
248
- > ```
249
-
250
- ### 7. Business Rules Extraction
251
-
252
- Extract business rules specific to this module:
253
-
254
- > **STRUCTURE CARD: analysis.businessRules[]** — Field names are EXACT. Do NOT deviate.
255
- > ```json
256
- > {
257
- > "id": "BR-VAL-{PREFIX}-001",
258
- > "name": "Short rule name",
259
- > "category": "validation|calculation|workflow|security|data",
260
- > "statement": "IF {condition} THEN {consequence} ELSE {alternative}",
261
- > "priority": "must|should|could",
262
- > "conditions": ["Condition 1", "Condition 2"],
263
- > "examples": [{ "input": "Order total $5000, budget $2000", "expected": "Order rejected" }],
264
- > "testability": "Via unit test with mock data / integration test"
265
- > }
266
- > ```
267
- > **MANDATORY fields:** `id`, `name`, `category`, `statement`, `priority`
268
- > **FORBIDDEN fields:** Do NOT use `rule`, `condition` (singular), `action`. Use `name` + `statement` (IF/THEN/ELSE format) + `conditions` (array).
269
- > **ID PATTERN:** `BR-{CAT}-{PREFIX}-{NNN}` where CAT = VAL|CALC|WF|SEC|DATA, PREFIX = module initials (2-4 chars)
270
- > **category values:** lowercase only: `validation`, `calculation`, `workflow`, `security`, `data`
271
-
272
- ---
273
-
274
- ## SELF-VERIFICATION (MANDATORY before loading step-03b-ui)
275
-
276
- Before proceeding to step-03b-ui.md, VERIFY:
277
-
278
- 1. **Module feature.json exists** at expected path (`docs/{app}/business-analyse/v{X.Y}/feature.json`)
279
- 2. **Module feature.json has analysis section** with `entities[]` (at least 1) and `businessRules[]` (at least 1)
280
- 3. **Entity schema compliance (BLOCKING)** — EVERY entity has `attributes[]` (NOT `fields[]`) and `relationships[]` arrays.
281
- Quick check: `analysis.entities.every(e => Array.isArray(e.attributes) && e.attributes.length >= 1)`
282
- IF any entity has `fields[]` instead of `attributes[]` → STRUCTURAL ERROR, fix before proceeding.
283
- IF any entity has `tableName` or `primaryKey` → STRUCTURAL ERROR, these are technical fields that do not belong in analysis.
284
- 4. **Module status in master** = "in-progress" (set by section 2 above)
285
- 5. **Master modules[].featureJsonPath** for this module ≠ null (set by ba-writer.create)
286
- 6. **Sections identified** with clear roles and entities assigned
287
- 7. **Unresolved relationship targets (BLOCKING)** — For EACH entity's `relationships[].target`:
288
- - Check if the target entity exists in THIS module's `entities[]`
289
- - OR in a completed/planned module's `entities[]`
290
- - OR is a known config list / external system reference
291
- - **IF unresolved:** Apply the Entity Sourcing Pattern from step-03a1 section 5-bis
292
- (ULTRATHINK scoring + domain coherence + recommendation + AskUserQuestion)
293
- - This catches entities discovered DURING analysis that weren't identified in setup
294
-
295
- **IF any check fails → FIX before proceeding.** Do NOT load step-03b-ui with incomplete data.
296
-
297
- ---
298
-
299
- ## NEXT STEP
300
-
301
- Load: `steps/step-03b-ui.md`