@atlashub/smartstack-cli 3.5.0 → 3.6.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 (40) hide show
  1. package/dist/index.js +13 -0
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/skills/business-analyse/SKILL.md +26 -15
  5. package/templates/skills/business-analyse/_architecture.md +1 -1
  6. package/templates/skills/business-analyse/_elicitation.md +1 -1
  7. package/templates/skills/business-analyse/_module-loop.md +4 -4
  8. package/templates/skills/business-analyse/html/ba-interactive.html +39 -10
  9. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  10. package/templates/skills/business-analyse/questionnaire.md +2 -2
  11. package/templates/skills/business-analyse/react/components.md +1 -1
  12. package/templates/skills/business-analyse/react/schema.md +1 -1
  13. package/templates/skills/business-analyse/references/html-data-mapping.md +4 -3
  14. package/templates/skills/business-analyse/schemas/feature-schema.json +1 -1
  15. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  16. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +1 -0
  17. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  18. package/templates/skills/business-analyse/steps/step-00-init.md +29 -0
  19. package/templates/skills/business-analyse/steps/step-01-cadrage.md +166 -6
  20. package/templates/skills/business-analyse/steps/step-02-decomposition.md +4 -4
  21. package/templates/skills/business-analyse/steps/{step-03a-specify.md → step-03a-data.md} +10 -359
  22. package/templates/skills/business-analyse/steps/step-03b-ui.md +414 -0
  23. package/templates/skills/business-analyse/steps/step-03c-compile.md +343 -0
  24. package/templates/skills/business-analyse/steps/{step-03b-compile.md → step-03d-validate.md} +26 -308
  25. package/templates/skills/business-analyse/steps/step-04-consolidation.md +2 -2
  26. package/templates/skills/business-analyse/steps/step-05a-handoff.md +49 -292
  27. package/templates/skills/business-analyse/steps/step-05b-mapping.md +302 -0
  28. package/templates/skills/business-analyse/steps/step-05c-deploy.md +296 -0
  29. package/templates/skills/business-analyse/steps/step-05d-html.md +326 -0
  30. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  31. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +1 -1
  32. package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
  33. package/templates/skills/controller/steps/step-03-generate.md +2 -1
  34. package/templates/skills/ralph-loop/SKILL.md +17 -2
  35. package/templates/skills/ralph-loop/references/core-seed-data.md +538 -0
  36. package/templates/skills/ralph-loop/steps/step-00-init.md +2 -0
  37. package/templates/skills/ralph-loop/steps/step-01-task.md +25 -2
  38. package/templates/skills/ralph-loop/steps/step-02-execute.md +39 -15
  39. package/templates/skills/ralph-loop/steps/step-04-check.md +87 -4
  40. package/templates/skills/business-analyse/steps/step-05b-deploy.md +0 -475
@@ -0,0 +1,343 @@
1
+ ---
2
+ name: step-03c-compile
3
+ description: Module specification compilation - actors, use cases, FRs, permissions, navigation, seed data, Gherkin, i18n
4
+ model: opus
5
+ next_step: steps/step-03d-validate.md
6
+ ---
7
+
8
+ > **Context files:** `_shared.md` | `_module-loop.md`
9
+
10
+ # Step 3c: Specification Compilation
11
+
12
+ ## MANDATORY EXECUTION RULES
13
+
14
+ - ALWAYS use ULTRATHINK mode
15
+ - This step COMPILES the specification from the interactive phase (step-03a) into feature.json
16
+ - ALWAYS validate specification completeness before writing
17
+ - ALL communication in `{language}`
18
+ - NEVER skip per-module validation
19
+ - **ID NAMING RULE (MANDATORY, NO EXCEPTION):**
20
+ All IDs MUST include a module prefix to guarantee application-wide uniqueness.
21
+ The prefix is derived from the module code initials (2-4 chars):
22
+ UserManagement → UM | VehicleManagement → VM | PartsInventory → PI
23
+ RepairManagement → RM | MaintenanceSchedule → MS | DataSync → DS
24
+ Notifications → NT | Dashboard → DB | Orders → OR | Customers → CU
25
+
26
+ Patterns:
27
+ UC-{PREFIX}-{NNN} → UC-RM-001, UC-PI-003
28
+ BR-{CAT}-{PREFIX}-{NNN} → BR-VAL-RM-001, BR-CALC-PI-002
29
+ FR-{PREFIX}-{NNN} → FR-RM-001
30
+ OBJ-{PREFIX}-{NNN} → OBJ-RM-001
31
+ AC-{PREFIX}-{NNN} → AC-RM-001
32
+ RISK-{PREFIX}-{NNN} → RISK-RM-001
33
+
34
+ NEVER use bare IDs (UC-001, BR-VAL-001) in multi-module mode.
35
+ - **SCHEMA CONFORMITY RULE:**
36
+ ALL data MUST fit within the defined feature-schema.json structure.
37
+ NEVER create custom top-level fields (KPIDefinitions, ChartConfigurations, etc.)
38
+ Dashboard modules MUST use specification.dashboards[] (it exists in the schema).
39
+ If truly needed, use specification.extensions: {} (additionalProperties: true).
40
+
41
+ ## YOUR TASK
42
+
43
+ Compile all data collected in step-03a (data) and step-03b (UI) into the module specification: generate actors, use cases, functional requirements, permission matrix, navigation, seed data, Gherkin scenarios, validations, messages, lifecycle, API endpoints, and i18n keys.
44
+
45
+ ---
46
+
47
+ ### 8. Full Specification
48
+
49
+ Generate the complete specification for this module. **Each subsection below includes a STRUCTURE CARD showing the EXACT JSON format. Follow them precisely.**
50
+
51
+ #### 8a. Actors
52
+
53
+ Inherited from application roles → mapped to module permissions.
54
+
55
+ > **STRUCTURE CARD: specification.actors[]**
56
+ > ```json
57
+ > {
58
+ > "role": "Sales Manager",
59
+ > "description": "Creates and approves orders",
60
+ > "permissions": [
61
+ > "business.{app}.{module}.read",
62
+ > "business.{app}.{module}.create",
63
+ > "business.{app}.{module}.update"
64
+ > ]
65
+ > }
66
+ > ```
67
+ > **MANDATORY fields:** `role`, `permissions` (array of permission paths)
68
+ > **FORBIDDEN fields:** Do NOT use `systemRole`. Use `permissions` array.
69
+
70
+ #### 8b. Use Cases (UC-{PREFIX}-NNN)
71
+
72
+ Per section: list, create, read, update, delete, approve, etc.
73
+
74
+ > **STRUCTURE CARD: specification.useCases[]**
75
+ > ```json
76
+ > {
77
+ > "id": "UC-{PREFIX}-001",
78
+ > "name": "Create Order",
79
+ > "primaryActor": "Sales Representative",
80
+ > "permission": "business.{app}.{module}.create",
81
+ > "preconditions": ["Customer exists", "Products in stock"],
82
+ > "postconditions": ["Order created with Draft status"],
83
+ > "mainScenario": [
84
+ > "1. User navigates to creation form",
85
+ > "2. User fills in required fields",
86
+ > "3. System validates data (BR-VAL-{PREFIX}-001)",
87
+ > "4. System creates the record",
88
+ > "5. System displays confirmation"
89
+ > ],
90
+ > "alternativeScenarios": [
91
+ > { "name": "Validation failure", "steps": ["1. System detects invalid data", "2. System highlights errors"] }
92
+ > ],
93
+ > "errorScenarios": [
94
+ > { "name": "Server error", "steps": ["1. System shows error message", "2. Data preserved for retry"] }
95
+ > ],
96
+ > "linkedRules": ["BR-VAL-{PREFIX}-001", "BR-WF-{PREFIX}-002"]
97
+ > }
98
+ > ```
99
+ > **MANDATORY fields:** `id`, `name`, `primaryActor`, `permission`, `mainScenario`, `linkedRules`
100
+ > **FORBIDDEN fields:** Do NOT use `actor` (use `primaryActor`), `linkedBRs` (use `linkedRules`), `linkedFRs` (not in UC, FRs link to UCs instead)
101
+
102
+ #### 8c. Functional Requirements (FR-{PREFIX}-NNN)
103
+
104
+ Linked to BRs and UCs.
105
+
106
+ > **STRUCTURE CARD: specification.functionalRequirements[]**
107
+ > ```json
108
+ > {
109
+ > "id": "FR-{PREFIX}-001",
110
+ > "statement": "System MUST validate customer budget before order creation",
111
+ > "priority": "must|should|could",
112
+ > "linkedRules": ["BR-VAL-{PREFIX}-001"],
113
+ > "linkedUseCases": ["UC-{PREFIX}-001"],
114
+ > "acceptanceCriteria": [
115
+ > "Order rejected if total > budget",
116
+ > "Error message displayed with remaining budget"
117
+ > ]
118
+ > }
119
+ > ```
120
+ > **MANDATORY fields:** `id`, `statement`, `priority`, `linkedUseCases`
121
+ > **FORBIDDEN fields:** Do NOT use `name`/`description` (use `statement` with System MUST/SHOULD/COULD format), `linkedUCs` (use `linkedUseCases`), `linkedBRs` (use `linkedRules`)
122
+
123
+ #### 8d. Permission Matrix
124
+
125
+ Roles × resources × operations with full paths.
126
+
127
+ > **STRUCTURE CARD: specification.permissionMatrix**
128
+ > ```json
129
+ > {
130
+ > "permissions": [
131
+ > { "path": "business.{app}.{module}.read", "action": "read", "description": "View records" },
132
+ > { "path": "business.{app}.{module}.create", "action": "create", "description": "Create new records" },
133
+ > { "path": "business.{app}.{module}.update", "action": "update", "description": "Update existing records" },
134
+ > { "path": "business.{app}.{module}.delete", "action": "delete", "description": "Delete records" },
135
+ > { "path": "business.{app}.{module}.export", "action": "export", "description": "Export data" }
136
+ > ],
137
+ > "roleAssignments": [
138
+ > { "role": "{App} Admin", "permissions": ["business.{app}.{module}.read", "business.{app}.{module}.create", "business.{app}.{module}.update", "business.{app}.{module}.delete", "business.{app}.{module}.export"] },
139
+ > { "role": "{App} Manager", "permissions": ["business.{app}.{module}.read", "business.{app}.{module}.create", "business.{app}.{module}.update"] },
140
+ > { "role": "{App} Viewer", "permissions": ["business.{app}.{module}.read"] }
141
+ > ]
142
+ > }
143
+ > ```
144
+ > **STRUCTURE:** Object with 2 arrays: `permissions[]` and `roleAssignments[]`
145
+ > **FORBIDDEN:** Do NOT use a flat array with `resource`/`roles` fields. Always use the nested structure above.
146
+
147
+ #### 8e. Navigation
148
+
149
+ Module → Sections → Resources (levels 3-4-5 of the hierarchy).
150
+
151
+ > **STRUCTURE CARD: specification.navigation**
152
+ > ```json
153
+ > {
154
+ > "entries": [
155
+ > { "level": "module", "code": "{module}", "labels": {"fr": "...", "en": "..."}, "route": "/business/{app}/{module}", "icon": "list" },
156
+ > { "level": "section", "code": "list", "labels": {"fr": "Liste", "en": "List", "it": "Elenco", "de": "Liste"}, "route": "/business/{app}/{module}/list", "icon": "list" },
157
+ > { "level": "section", "code": "dashboard", "labels": {"fr": "Dashboard", "en": "Dashboard"}, "route": "/business/{app}/{module}/dashboard", "icon": "chart-bar", "isNew": true }
158
+ > ]
159
+ > }
160
+ > ```
161
+
162
+ #### 8f. SeedData Core
163
+
164
+ 5 MANDATORY typed arrays — each with structured objects, NOT flat strings or objects.
165
+
166
+ > **STRUCTURE CARD: specification.seedDataCore**
167
+ > ```json
168
+ > {
169
+ > "navigationModules": [
170
+ > { "code": "{module}", "label": "{Module Name}", "icon": "list", "route": "/business/{app}/{module}", "parentCode": "{app}", "sort": 1 }
171
+ > ],
172
+ > "navigationTranslations": [
173
+ > { "moduleCode": "{module}", "language": "fr", "label": "..." },
174
+ > { "moduleCode": "{module}", "language": "en", "label": "..." },
175
+ > { "moduleCode": "{module}", "language": "it", "label": "..." },
176
+ > { "moduleCode": "{module}", "language": "de", "label": "..." }
177
+ > ],
178
+ > "permissions": [
179
+ > { "path": "business.{app}.{module}.read", "action": "read", "description": "View {module}" },
180
+ > { "path": "business.{app}.{module}.create", "action": "create", "description": "Create {module}" }
181
+ > ],
182
+ > "rolePermissions": [
183
+ > { "role": "{App} Admin", "permissionPath": "business.{app}.{module}.*" },
184
+ > { "role": "{App} Manager", "permissionPath": "business.{app}.{module}.read" }
185
+ > ],
186
+ > "permissionConstants": [
187
+ > { "constantName": "{Module}Read", "path": "business.{app}.{module}.read" },
188
+ > { "constantName": "{Module}Create", "path": "business.{app}.{module}.create" }
189
+ > ]
190
+ > }
191
+ > ```
192
+ > **MANDATORY:** All 5 arrays must be present. Each element must be an object, NOT a string.
193
+ > **FORBIDDEN:** Do NOT use `navigationModule` (singular string), `permissions` as flat string array, `rolePermissions` as flat object, `permissionsConstants` as comma-separated string.
194
+
195
+ #### 8g. Gherkin Scenarios
196
+
197
+ BDD acceptance tests per UC.
198
+
199
+ > **STRUCTURE CARD: specification.gherkinScenarios[]**
200
+ > ```json
201
+ > {
202
+ > "feature": "{Module} Management",
203
+ > "scenarios": [
204
+ > {
205
+ > "name": "Create a new record with valid data",
206
+ > "tags": ["@{module}", "@create", "@smoke"],
207
+ > "given": ["An authenticated user with role Manager", "No existing record with code 'TEST-001'"],
208
+ > "when": ["The user fills the creation form", "The user submits the form"],
209
+ > "then": ["The record is created with Draft status", "A success message is displayed"]
210
+ > }
211
+ > ]
212
+ > }
213
+ > ```
214
+ > **STRUCTURE:** Object with `feature` string + `scenarios[]` array. Each scenario has `given`, `when`, `then` as ARRAYS of strings.
215
+ > **FORBIDDEN:** Do NOT use flat arrays of `{uc, scenario, given, when, then}` where given/when/then are single strings.
216
+
217
+ #### 8h. Validations
218
+
219
+ Field validation rules per entity.
220
+
221
+ > **STRUCTURE CARD: specification.validations[]**
222
+ > ```json
223
+ > {
224
+ > "entity": "Order",
225
+ > "field": "amount",
226
+ > "rules": ["required", "decimal", "min:0.01", "max:999999.99"],
227
+ > "errorMessageKey": "validation.{module}.amount.invalid"
228
+ > }
229
+ > ```
230
+ > **MANDATORY fields:** `entity`, `field`, `rules` (array), `errorMessageKey`
231
+ > **FORBIDDEN fields:** Do NOT use `rule` (singular string) or `message` (use `errorMessageKey`).
232
+
233
+ #### 8i. Business Messages
234
+
235
+ Minimum 4: success, error CRUD, error validation, error permission.
236
+
237
+ > **STRUCTURE CARD: specification.messages[]**
238
+ > ```json
239
+ > {
240
+ > "code": "{MODULE}-SUCCESS-CREATE",
241
+ > "type": "success|error|warning|info",
242
+ > "title": "Record Created",
243
+ > "message": "The record {code} has been created successfully.",
244
+ > "i18nKey": "message.{module}.created"
245
+ > }
246
+ > ```
247
+ > **MANDATORY fields:** `code`, `type`, `message`, `i18nKey`
248
+ > **FORBIDDEN:** Do NOT omit `title` or `i18nKey`. Every message MUST have an i18n key.
249
+
250
+ #### 8j. Entity Lifecycle
251
+
252
+ State machines for entities with status/state.
253
+ **Note:** If depth = full and 3a-state was executed, lifeCycles are already defined. Verify completeness and add any missing states/transitions.
254
+
255
+ > **STRUCTURE CARD: specification.lifeCycles[]**
256
+ > ```json
257
+ > {
258
+ > "entity": "Order",
259
+ > "field": "status",
260
+ > "initialState": "draft",
261
+ > "states": [
262
+ > { "id": "draft", "displayName": "Brouillon", "color": "gray", "allowedTransitions": ["submitted"], "isTerminal": false },
263
+ > { "id": "submitted", "displayName": "Soumis", "color": "blue", "allowedTransitions": ["approved", "rejected"], "isTerminal": false },
264
+ > { "id": "approved", "displayName": "Approuvé", "color": "green", "allowedTransitions": ["archived"], "isTerminal": false },
265
+ > { "id": "rejected", "displayName": "Rejeté", "color": "red", "allowedTransitions": [], "isTerminal": true },
266
+ > { "id": "archived", "displayName": "Archivé", "color": "purple", "allowedTransitions": [], "isTerminal": true }
267
+ > ],
268
+ > "transitions": [
269
+ > {
270
+ > "from": "draft", "to": "submitted", "action": "submit",
271
+ > "label": { "fr": "Soumettre", "en": "Submit" },
272
+ > "permission": "business.{app}.{module}.update",
273
+ > "guards": ["BR-VAL-{PREFIX}-001"],
274
+ > "effects": [{ "type": "notification", "target": "role:manager", "template": "{module}-submitted" }],
275
+ > "confirm": true
276
+ > }
277
+ > ]
278
+ > }
279
+ > ```
280
+ > **MANDATORY:** `states` MUST be an array of OBJECTS with `id`, `displayName`, `color`, `allowedTransitions`, `isTerminal`. NEVER use flat string arrays.
281
+ > **Colors:** gray (draft/new), blue (in-progress), green (active/approved), yellow (warning/pending), orange (review), red (error/rejected), purple (archived/terminal)
282
+ > **FORBIDDEN:** Do NOT use `states: ["Active", "Inactive"]` (flat strings), `terminalStates` (use `isTerminal: true` on each state).
283
+
284
+ #### 8k. API Endpoints
285
+
286
+ RESTful routes following SmartStack patterns.
287
+
288
+ > **STRUCTURE CARD: specification.apiEndpoints[]**
289
+ > ```json
290
+ > {
291
+ > "method": "GET|POST|PUT|PATCH|DELETE",
292
+ > "path": "/api/business/{app}/{module}",
293
+ > "permission": "business.{app}.{module}.read",
294
+ > "requestDto": "Get{Module}Query",
295
+ > "responseDto": "{Module}Dto[]",
296
+ > "description": "List all records with pagination and filters"
297
+ > }
298
+ > ```
299
+ > **MANDATORY fields:** `method`, `path`, `permission`, `description`
300
+ > **Recommended:** Include `requestDto` and `responseDto` for implementation clarity.
301
+
302
+ #### 8l. i18n Keys
303
+
304
+ Translation keys for all UI text (4 languages: fr, en, it, de).
305
+
306
+ > **STRUCTURE CARD: specification.i18nKeys**
307
+ > ```json
308
+ > {
309
+ > "title": { "fr": "{Module}", "en": "{Module}", "it": "{Module}", "de": "{Module}" },
310
+ > "list": { "title": { "fr": "Liste", "en": "List" }, "empty": { "fr": "Aucun enregistrement", "en": "No records" } },
311
+ > "create": { "title": { "fr": "Nouveau", "en": "New" } },
312
+ > "detail": { "title": { "fr": "Détail", "en": "Detail" } },
313
+ > "buttons": { "create": { "fr": "Créer", "en": "Create" }, "edit": { "fr": "Modifier", "en": "Edit" }, "delete": { "fr": "Supprimer", "en": "Delete" } },
314
+ > "validation": { "required": { "fr": "Ce champ est requis", "en": "This field is required" } }
315
+ > }
316
+ > ```
317
+
318
+ ---
319
+
320
+ ## SELF-VERIFICATION (MANDATORY before loading next step)
321
+
322
+ Before loading step-03d-validate, verify all 12 subsections (8a-8l) are populated:
323
+
324
+ 1. **8a. Actors** - At least 2 roles with permissions
325
+ 2. **8b. Use Cases** - At least 2 UCs with complete structure
326
+ 3. **8c. Functional Requirements** - At least 4 FRs with linked UCs and BRs
327
+ 4. **8d. Permission Matrix** - Resources and role assignments defined
328
+ 5. **8e. Navigation** - Module, sections, and resource routes specified
329
+ 6. **8f. SeedData Core** - All 5 arrays populated with structured objects
330
+ 7. **8g. Gherkin Scenarios** - BDD scenarios for each major UC
331
+ 8. **8h. Validations** - Field rules with error message keys
332
+ 9. **8i. Business Messages** - Minimum 4 messages (success, error CRUD, validation, permission)
333
+ 10. **8j. Entity Lifecycle** - State machines with transitions if entity has status
334
+ 11. **8k. API Endpoints** - RESTful routes with permissions
335
+ 12. **8l. i18n Keys** - Translation keys in 4 languages (fr, en, it, de)
336
+
337
+ **IF any subsection is missing → STOP and request the missing data before proceeding.**
338
+
339
+ ---
340
+
341
+ ## NEXT STEP
342
+
343
+ Load: `steps/step-03d-validate.md`