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