@atlashub/smartstack-cli 2.3.0 → 2.5.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 (33) hide show
  1. package/.documentation/cli-commands.html +1 -1
  2. package/.documentation/init.html +1 -1
  3. package/.documentation/installation.html +1 -1
  4. package/dist/index.js +1213 -815
  5. package/dist/index.js.map +1 -1
  6. package/package.json +1 -1
  7. package/templates/agents/ba-reader.md +114 -9
  8. package/templates/agents/ba-writer.md +108 -27
  9. package/templates/agents/mcp-healthcheck.md +1 -1
  10. package/templates/ralph/README.md +1 -1
  11. package/templates/ralph/ralph.config.yaml +1 -1
  12. package/templates/skills/_shared.md +60 -0
  13. package/templates/skills/application/steps/step-00-init.md +32 -8
  14. package/templates/skills/business-analyse/SKILL.md +65 -42
  15. package/templates/skills/business-analyse/_shared.md +161 -51
  16. package/templates/skills/business-analyse/questionnaire/00-application.md +166 -0
  17. package/templates/skills/business-analyse/questionnaire.md +63 -19
  18. package/templates/skills/business-analyse/react/application-viewer.md +242 -0
  19. package/templates/skills/business-analyse/react/components.md +60 -8
  20. package/templates/skills/business-analyse/react/schema.md +238 -7
  21. package/templates/skills/business-analyse/schemas/application-schema.json +389 -0
  22. package/templates/skills/business-analyse/schemas/feature-schema.json +74 -3
  23. package/templates/skills/business-analyse/steps/step-00-init.md +110 -44
  24. package/templates/skills/business-analyse/steps/step-01-cadrage.md +259 -0
  25. package/templates/skills/business-analyse/steps/step-02-decomposition.md +282 -0
  26. package/templates/skills/business-analyse/steps/step-03-specify.md +489 -0
  27. package/templates/skills/business-analyse/steps/step-04-consolidation.md +336 -0
  28. package/templates/skills/business-analyse/steps/step-05-handoff.md +1119 -0
  29. package/templates/skills/mcp/SKILL.md +2 -2
  30. package/templates/skills/business-analyse/steps/step-01-analyse.md +0 -523
  31. package/templates/skills/business-analyse/steps/step-02-specify.md +0 -899
  32. package/templates/skills/business-analyse/steps/step-03-validate.md +0 -1009
  33. package/templates/skills/business-analyse/steps/step-04-handoff.md +0 -1802
@@ -0,0 +1,489 @@
1
+ ---
2
+ name: step-03-specify
3
+ description: Iterative per-module specification - sections, entities, BR, permissions, mockups, validation
4
+ model: opus
5
+ next_step: steps/step-03-specify.md OR steps/step-04-consolidation.md (conditional)
6
+ ---
7
+
8
+ # Step 3: Specification (Iterative Per-Module)
9
+
10
+ ## MANDATORY EXECUTION RULES
11
+
12
+ - ALWAYS use ULTRATHINK mode
13
+ - This step is EXECUTED ONCE PER MODULE in topological dependency order
14
+ - ALWAYS check workflow state to determine current module
15
+ - ALWAYS reference completed modules when specifying current one
16
+ - ALWAYS propose ASCII/SVG mockups for each section
17
+ - ALL questions via AskUserQuestion tool
18
+ - ALL communication in `{language}`
19
+ - NEVER skip per-module validation
20
+
21
+ ## YOUR TASK
22
+
23
+ Specify one module completely: walk through its sections and resources with the client, define entities, business rules, use cases, permissions, mockups, and validate before moving to the next module.
24
+
25
+ ---
26
+
27
+ ## EXECUTION SEQUENCE
28
+
29
+ ### 1. Determine Current Module
30
+
31
+ ```
32
+ ba-reader.readApplicationContext({feature_id})
33
+ → Read metadata.workflow: moduleOrder, currentModuleIndex, completedModules
34
+ → currentModule = moduleOrder[currentModuleIndex]
35
+ → Display: "═══ Module {currentModuleIndex + 1}/{moduleOrder.length}: {currentModule} ═══"
36
+ ```
37
+
38
+ IF module already specified (status = "specified" in master):
39
+ Increment currentModuleIndex, re-check
40
+ IF all modules specified → Load step-04-consolidation.md, STOP
41
+
42
+ ### 2. Initialize Module Feature.json
43
+
44
+ ```
45
+ // Create or load module-level feature.json
46
+ ba-writer.create({
47
+ scope: "module",
48
+ applicationRef: {feature_id},
49
+ moduleCode: {currentModule.code},
50
+ path: "docs/business/{app}/{module_code}/business-analyse/v1.0/feature.json"
51
+ })
52
+
53
+ // Inherit application roles from master
54
+ ba-reader.readApplicationContext({feature_id})
55
+ → Copy cadrage.applicationRoles → module.applicationContext.applicationRoles
56
+ ```
57
+
58
+ Update module status in master: "pending" → "in-progress"
59
+
60
+ ### 3. Section Walkthrough with Client
61
+
62
+ > **This is the key interactive phase aligned with the 5-level SmartStack hierarchy.**
63
+ > Level 3 = Module, Level 4 = Section, Level 5 = Resource
64
+
65
+ #### 3a. Identify Module Sections
66
+
67
+ For each module, propose standard sections based on module type:
68
+
69
+ | Module Type | Typical Sections |
70
+ |-------------|-----------------|
71
+ | data-centric | list, detail, create, edit |
72
+ | workflow | list, detail, create, edit, approve, history |
73
+ | integration | list, detail, config, sync, logs |
74
+ | reporting | dashboard, detail, export, schedule |
75
+ | full-module | list, detail, create, edit, approve, history, reports, settings |
76
+
77
+ Ask via AskUserQuestion:
78
+
79
+ ```
80
+ question: "Quelles sections le module {currentModule} doit-il avoir ?"
81
+ header: "Sections"
82
+ multiSelect: true
83
+ options:
84
+ - label: "Liste"
85
+ description: "Page de liste avec filtres, tri et pagination"
86
+ - label: "Détail"
87
+ description: "Page de détail d'un enregistrement"
88
+ - label: "Création/Édition"
89
+ description: "Formulaire de création et de modification"
90
+ - label: "Validation/Approbation"
91
+ description: "Workflow de validation avec changement de statut"
92
+ ```
93
+
94
+ #### 3b. For Each Section: Propose ASCII Mockup
95
+
96
+ For each confirmed section, generate an ASCII mockup and validate with client:
97
+
98
+ Example for a list section:
99
+
100
+ ```
101
+ ╔═══════════════════════════════════════════════════════════╗
102
+ ║ {Module} > Liste [+ Nouveau] ║
103
+ ╠═══════════════════════════════════════════════════════════╣
104
+ ║ 🔍 Rechercher... │ Statut: [Tous ▾] │ Date: [Ce mois ▾] ║
105
+ ╠═══════════════════════════════════════════════════════════╣
106
+ ║ # │ {Field1} │ {Field2} │ {Field3} │ Statut │ ··· ║
107
+ ║ 1 │ VAL-001 │ Exemple 1 │ 12'500.- │ ● Brouillon │ ⋮ ║
108
+ ║ 2 │ VAL-002 │ Exemple 2 │ 8'300.- │ ● Envoyé │ ⋮ ║
109
+ ╠═══════════════════════════════════════════════════════════╣
110
+ ║ 1-25 de 142 │ ◀ 1 2 3 ··· 6 ▶ ║
111
+ ╚═══════════════════════════════════════════════════════════╝
112
+ ```
113
+
114
+ Store in specification.wireframes[]:
115
+
116
+ ```json
117
+ {
118
+ "screen": "{module}-{section}",
119
+ "section": "{section}",
120
+ "description": "Description of the screen",
121
+ "mockupFormat": "ascii",
122
+ "mockup": "╔═══...",
123
+ "elements": ["DataGrid", "FilterBar", "Pagination", "CreateButton"],
124
+ "actions": ["filter", "sort", "create", "view-detail"],
125
+ "permissionsRequired": ["business.{app}.{module}.read"]
126
+ }
127
+ ```
128
+
129
+ Ask client to validate each mockup via AskUserQuestion (batch 2-3 mockups at once if possible).
130
+
131
+ #### 3c. Identify Resources per Section
132
+
133
+ For each section, identify what resources/components are needed:
134
+
135
+ - List section → DataGrid, FilterBar, SearchInput, ExportButton
136
+ - Detail section → DetailCard, StatusBadge, ActionButtons, Timeline
137
+ - Create section → Form, ValidationMessages, SubmitButton
138
+ - Approve section → StatusTransitionPanel, CommentBox, ApproveRejectButtons
139
+
140
+ ### 4. Conditional Questionnaires
141
+
142
+ Based on module type, load questionnaires per-module:
143
+
144
+ | Condition | Category | Questionnaire |
145
+ |-----------|----------|---------------|
146
+ | Always | 04 | `questionnaire/04-data.md` |
147
+ | Has UI sections | 07 | `questionnaire/07-ui.md` |
148
+ | Has lifecycle | 11 | `questionnaire/11-data-lifecycle.md` |
149
+ | Has migration needs | 12 | `questionnaire/12-migration.md` |
150
+ | References other modules | 13 | `questionnaire/13-cross-module.md` |
151
+
152
+ Ask via AskUserQuestion, 1-2 batches per category.
153
+
154
+ ### 5. Cross-Module References
155
+
156
+ > Reference completed modules to help define current one.
157
+
158
+ ```
159
+ completedModules = ba-reader.getCompletedModulesSummary({feature_id})
160
+ → Returns max 100 lines summary: entity names, key BRs, permissions
161
+
162
+ Display: "Modules déjà spécifiés : {completedModules.map(m => m.code).join(', ')}"
163
+ ```
164
+
165
+ For each completed module's entities, ask:
166
+
167
+ ```
168
+ question: "Le module {currentModule} référence-t-il des entités de {completedModule} ?"
169
+ header: "Références"
170
+ multiSelect: true
171
+ options:
172
+ - label: "{Entity1} (FK)"
173
+ description: "Référence directe via clé étrangère"
174
+ - label: "{Entity2} (Lookup)"
175
+ description: "Table de référence / lookup"
176
+ - label: "Aucune"
177
+ description: "Pas de référence à {completedModule}"
178
+ ```
179
+
180
+ ### 6. Entity Definition
181
+
182
+ Define entities for this module (business attributes, not technical):
183
+
184
+ For each entity:
185
+
186
+ ```json
187
+ {
188
+ "name": "PascalCase",
189
+ "description": "1-2 sentences",
190
+ "attributes": [
191
+ { "name": "attributeName", "type": "string|int|decimal|datetime|enum|FK", "required": true/false, "rules": "validation description" }
192
+ ],
193
+ "relationships": [
194
+ { "target": "OtherEntity", "type": "1:N", "description": "description" }
195
+ ]
196
+ }
197
+ ```
198
+
199
+ ### 7. Business Rules Extraction
200
+
201
+ Extract business rules specific to this module:
202
+
203
+ Format: BR-{CATEGORY}-NNN where CATEGORY is VAL/CALC/WF/SEC/DATA
204
+
205
+ ```json
206
+ {
207
+ "id": "BR-VAL-001",
208
+ "rule": "Description of the rule",
209
+ "category": "Validation",
210
+ "priority": "Must",
211
+ "condition": "When X happens",
212
+ "action": "Then Y must be true",
213
+ "examples": [{ "input": "...", "expected": "..." }],
214
+ "linkedRules": ["BR-WF-002"]
215
+ }
216
+ ```
217
+
218
+ ### 8. Full Specification
219
+
220
+ Generate the complete specification for this module:
221
+
222
+ #### 8a. Actors
223
+
224
+ Inherited from application roles → mapped to module permissions
225
+
226
+ #### 8b. Use Cases (UC-NNN)
227
+
228
+ Per section: list, create, read, update, delete, approve, etc.
229
+
230
+ #### 8c. Functional Requirements (FR-NNN)
231
+
232
+ Linked to BRs and UCs
233
+
234
+ #### 8d. Permission Matrix
235
+
236
+ Roles × resources × operations with full paths: `business.{app}.{module}.{resource}.{action}`
237
+
238
+ #### 8e. Navigation
239
+
240
+ Module → Sections → Resources (levels 3-4-5 of the hierarchy)
241
+
242
+ #### 8f. SeedData Core
243
+
244
+ 5 mandatory files:
245
+
246
+ 1. NavigationModuleConfiguration (from navigation entries)
247
+ 2. NavigationTranslationConfiguration (4 languages)
248
+ 3. PermissionConfiguration (full path format)
249
+ 4. RolePermissionConfiguration (role → permission mapping)
250
+ 5. Permissions.cs constants (PascalCase)
251
+
252
+ #### 8g. Gherkin Scenarios
253
+
254
+ BDD acceptance tests per UC
255
+
256
+ #### 8h. Validations
257
+
258
+ Field validation rules
259
+
260
+ #### 8i. Business Messages
261
+
262
+ Minimum 4: success, error CRUD, error validation, error permission
263
+
264
+ #### 8j. Entity Lifecycle
265
+
266
+ State machines for entities with status/state
267
+
268
+ #### 8k. API Endpoints
269
+
270
+ RESTful routes following SmartStack patterns
271
+
272
+ #### 8l. i18n Keys
273
+
274
+ Translation keys for all UI text (4 languages: fr, en, it, de)
275
+
276
+ ### 9. Per-Module Validation
277
+
278
+ > **Fused from old step-03-validate.md, run INLINE after specification.**
279
+
280
+ #### 9a. Completeness Checks
281
+
282
+ | Section | Minimum | Status |
283
+ |---------|---------|--------|
284
+ | actors | 2 | PASS/FAIL |
285
+ | useCases | 2 | PASS/FAIL |
286
+ | functionalRequirements | 4 | PASS/FAIL |
287
+ | permissionMatrix | 1 resource × 2 roles | PASS/FAIL |
288
+ | entities | 1 | PASS/FAIL |
289
+ | wireframes | 2 | PASS/FAIL |
290
+ | gherkinScenarios | 2 per UC | PASS/FAIL |
291
+ | validations | 1 | PASS/FAIL |
292
+ | messages | 4 | PASS/FAIL |
293
+ | lifeCycles | 1 (if entity has status) | PASS/FAIL |
294
+ | seedDataCore | 5 sections present | PASS/FAIL (BLOCKING) |
295
+
296
+ #### 9b. Consistency Checks
297
+
298
+ - Every UC has ≥1 linked FR
299
+ - Every FR has ≥1 linked BR
300
+ - All BR references exist in analysis.businessRules
301
+ - All actors appear in permissionMatrix
302
+ - Permission paths use full format: `business.{app}.{module}.{resource}.{action}`
303
+ - rolePermissions paths match permissions paths
304
+ - API routes use consistent prefix
305
+
306
+ #### 9c. Convention Checks
307
+
308
+ - UC-NNN format
309
+ - FR-NNN format
310
+ - BR-{CATEGORY}-NNN format
311
+ - Entity names PascalCase
312
+ - Field names camelCase
313
+ - Permission paths dot-separated lowercase
314
+
315
+ #### 9d. Decision
316
+
317
+ IF validation PASS:
318
+ Display summary, ask client for confirmation
319
+
320
+ IF validation FAIL:
321
+ Display errors, offer:
322
+ ```
323
+ options:
324
+ - label: "Auto-corriger"
325
+ description: "Corriger automatiquement les erreurs détectées"
326
+ - label: "Réviser manuellement"
327
+ description: "Revenir aux sections problématiques"
328
+ - label: "Forcer la validation"
329
+ description: "Accepter malgré les erreurs (risqué)"
330
+ ```
331
+
332
+ ### 10. Module Summary with Roles & Permissions
333
+
334
+ Display comprehensive summary:
335
+
336
+ ```
337
+ ═══════════════════════════════════════════════════════════
338
+ MODULE SPÉCIFIÉ: {currentModule} ({currentModuleIndex + 1}/{total})
339
+ ═══════════════════════════════════════════════════════════
340
+
341
+ | Aspect | Valeur |
342
+ |--------|--------|
343
+ | Entités | {count} ({entity names}) |
344
+ | Business Rules | {count} (VAL: X, CALC: Y, WF: Z) |
345
+ | Use Cases | {count} (UC-001 → UC-NNN) |
346
+ | Exigences | {count} FRs |
347
+ | Sections | {count} ({section names}) |
348
+ | Maquettes | {count} wireframes |
349
+ | Permissions | {count} paths |
350
+ | Tests Gherkin | {count} scénarios |
351
+ | Messages | {count} |
352
+
353
+ ### Rôles & Permissions pour {currentModule}
354
+ | Rôle | Permissions |
355
+ |------|------------|
356
+ | {App} Admin | business.{app}.{module}.* |
357
+ | {App} Manager | read, create, update, assign |
358
+ | {App} Contributor | read, create, update |
359
+ | {App} Viewer | read |
360
+
361
+ → Validation: {PASS/FAIL}
362
+ ═══════════════════════════════════════════════════════════
363
+ ```
364
+
365
+ Ask via AskUserQuestion:
366
+
367
+ ```
368
+ question: "Le module {currentModule} est-il correctement spécifié ?"
369
+ header: "Module"
370
+ options:
371
+ - label: "Validé"
372
+ description: "Passer au module suivant"
373
+ - label: "Réviser"
374
+ description: "Modifier des éléments du module"
375
+ ```
376
+
377
+ ### 11. Write Module Feature.json
378
+
379
+ ```
380
+ ba-writer.enrichSection({
381
+ featureId: {module_feature_id},
382
+ section: "specification",
383
+ data: { ...all specification sections... }
384
+ })
385
+
386
+ ba-writer.enrichSection({
387
+ featureId: {module_feature_id},
388
+ section: "analysis",
389
+ data: { entities, businessRules, processFlow }
390
+ })
391
+
392
+ ba-writer.updateStatus({module_feature_id}, "specified")
393
+
394
+ // Update master
395
+ ba-writer.updateModuleStatus({feature_id}, {currentModule.code}, "specified")
396
+ ```
397
+
398
+ ### 12. Loop Decision
399
+
400
+ ```
401
+ ba-writer.advanceModuleLoop({feature_id})
402
+ → Increments currentModuleIndex
403
+ → Updates completedModules
404
+ → Updates currentModule
405
+
406
+ IF currentModuleIndex < moduleOrder.length:
407
+ Display: "→ Module suivant: {nextModule} ({currentModuleIndex + 1}/{total})"
408
+ Load: steps/step-03-specify.md (RE-ENTER this step)
409
+
410
+ IF currentModuleIndex >= moduleOrder.length:
411
+ Display: "═══ Tous les modules spécifiés! Passage à la consolidation... ═══"
412
+ ba-writer.updateStatus({feature_id}, "specified")
413
+ Load: steps/step-04-consolidation.md
414
+ ```
415
+
416
+ ---
417
+
418
+ ## SINGLE-MODULE MODE
419
+
420
+ When only 1 module in moduleOrder:
421
+
422
+ - Same full specification flow
423
+ - Skip cross-module references (section 5)
424
+ - After validation → direct to step-04-consolidation.md (auto-consolidation)
425
+
426
+ ---
427
+
428
+ ## RESUME SUPPORT
429
+
430
+ IF the step is resumed (e.g., after interruption):
431
+
432
+ ```
433
+ Read metadata.workflow.currentModuleIndex
434
+ Read metadata.workflow.currentModule
435
+ → Resume at the correct module
436
+ → If module has partial data, show what exists and continue from there
437
+ ```
438
+
439
+ ---
440
+
441
+ ## CONTEXT MANAGEMENT
442
+
443
+ | Loaded | Not Loaded |
444
+ |--------|------------|
445
+ | _shared.md | Other module feature.json (full) |
446
+ | feature-schema.json | Questionnaires not needed |
447
+ | Questionnaires for this module | Templates |
448
+ | Completed modules summary (100 lines max) | React viewer files |
449
+
450
+ ---
451
+
452
+ ## STATE VARIABLES
453
+
454
+ | Variable | Description |
455
+ |----------|-------------|
456
+ | `{currentModule}` | Current module being specified |
457
+ | `{currentModuleIndex}` | Index in moduleOrder |
458
+ | `{completedModules}` | Array of already specified module codes |
459
+ | `{module_feature_id}` | Feature ID for the module-level feature.json |
460
+
461
+ ---
462
+
463
+ ## SUCCESS METRICS
464
+
465
+ - All sections walked through with client
466
+ - ASCII mockups proposed and validated for key sections
467
+ - Entities defined with business attributes
468
+ - Business rules extracted and categorized
469
+ - Per-module validation PASS
470
+ - Client confirmed module specification
471
+ - Module feature.json written
472
+ - Master updated with module status
473
+ - Loop advanced correctly
474
+
475
+ ## FAILURE MODES
476
+
477
+ - Validation FAIL → offer auto-correct / manual revise / force
478
+ - Client rejects → revise specific sections
479
+ - Cross-module reference error → clarify with client
480
+ - Interruption → resumable via workflow state
481
+
482
+ ---
483
+
484
+ ## NEXT STEP
485
+
486
+ Conditional:
487
+
488
+ - IF modules remaining → Re-load `./step-03-specify.md`
489
+ - IF all modules done → Load `./step-04-consolidation.md`