@atlashub/smartstack-cli 2.3.0 → 2.4.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 +2 -2
  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,282 @@
1
+ ---
2
+ name: step-02-decomposition
3
+ description: Module decomposition - identify modules, dependency graph, topological sort, client checkpoint
4
+ model: sonnet
5
+ next_step: steps/step-03-specify.md
6
+ ---
7
+
8
+ # Step 2: Decomposition
9
+
10
+ ## MANDATORY EXECUTION RULES
11
+
12
+ - ALWAYS present the module structure to the client for validation (BLOCKING checkpoint)
13
+ - NEVER proceed to specification without client approval of module structure
14
+ - ALWAYS sort modules by dependency (foundations first)
15
+ - ALWAYS detect dependency cycles (ERROR if found)
16
+ - This step runs for BOTH application mode and single-module mode (trivial for single)
17
+
18
+ ## YOUR TASK
19
+
20
+ Decompose the application scope into ordered modules. Identify dependencies between modules and determine the processing order for iterative specification.
21
+
22
+ ---
23
+
24
+ ## EXECUTION SEQUENCE
25
+
26
+ ### 1. Read Cadrage Results
27
+
28
+ ```
29
+ ba-reader.findFeature({feature_id})
30
+ → Read cadrage.globalScope (mustHave, shouldHave, couldHave)
31
+ → Read cadrage.stakeholders (roles, tasks, pain points)
32
+ → Read cadrage.applicationRoles
33
+ → Read cadrage.codebaseContext (existing modules found)
34
+ → Read metadata.workflow.mode
35
+ ```
36
+
37
+ IF status already "decomposed":
38
+ Display: "Decomposition already completed. Loading next step."
39
+ Load: steps/step-03-specify.md
40
+ STOP
41
+
42
+ ### 2. Module Identification
43
+
44
+ **From the scope items and stakeholder needs, identify distinct modules:**
45
+
46
+ For each mustHave/shouldHave scope item:
47
+ - Group related items into cohesive functional units
48
+ - Each module should be independently deployable
49
+ - Each module maps to a navigation entry at Level 3 (Module)
50
+
51
+ **ULTRATHINK Challenge:**
52
+ - "Is this one module or two? Could a user need only half of it?"
53
+ - "Are there hidden modules not mentioned in scope? (e.g., Notifications, Dashboard)"
54
+ - "Does the codebase already have modules that should be extended vs. created new?"
55
+
56
+ **For each module, determine:**
57
+ ```json
58
+ {
59
+ "code": "PascalCase module name",
60
+ "description": "1-2 sentence description",
61
+ "featureType": "data-centric | integration | ui-centric | workflow | reporting | full-module",
62
+ "entities": ["Anticipated entity names"],
63
+ "priority": "must | should | could",
64
+ "estimatedComplexity": "simple | medium | complex"
65
+ }
66
+ ```
67
+
68
+ **Complexity estimation rules:**
69
+ | Criteria | Simple | Medium | Complex |
70
+ |----------|--------|--------|---------|
71
+ | Entities | ≤2 | 3-5 | >5 |
72
+ | Expected UCs | ≤4 | 5-10 | >10 |
73
+ | Integrations | 0 | 1-2 | >2 |
74
+ | Workflows | None | Simple | Multi-step with approvals |
75
+
76
+ ### 3. Present Module List to Client
77
+
78
+ Display the identified modules as markdown:
79
+
80
+ ```
81
+ ## Modules identifiés pour {application_name}
82
+
83
+ | # | Module | Type | Priorité | Complexité | Entités pressenties |
84
+ |---|--------|------|----------|------------|---------------------|
85
+ | 1 | Customers | data-centric | must | medium | Customer, Address, Contact |
86
+ | 2 | Products | data-centric | must | simple | Product, Category |
87
+ | 3 | Orders | workflow | must | complex | Order, OrderLine |
88
+ | 4 | Invoices | workflow | should | medium | Invoice, InvoiceLine, Payment |
89
+ ```
90
+
91
+ Ask via AskUserQuestion:
92
+ ```
93
+ question: "Ces modules correspondent-ils à votre vision de l'application ?"
94
+ header: "Modules"
95
+ options:
96
+ - label: "Validé"
97
+ description: "La liste des modules est correcte, on peut continuer"
98
+ - label: "Ajouter un module"
99
+ description: "Il manque un module dans la liste"
100
+ - label: "Retirer un module"
101
+ description: "Un module est en trop ou hors périmètre"
102
+ - label: "Modifier un module"
103
+ description: "Renommer, fusionner ou découper un module"
104
+ ```
105
+
106
+ IF modifications requested:
107
+ Apply changes and re-present the list
108
+ Loop until "Validé"
109
+
110
+ ### 4. Dependency Analysis
111
+
112
+ For each pair of modules, determine dependencies:
113
+
114
+ **Dependency types:**
115
+ | Type | Signal | Example |
116
+ |------|--------|---------|
117
+ | FK | Module A references entity from module B | Order.CustomerId → Customer |
118
+ | Event | Module A produces event consumed by module B | Order.Created → Invoice.AutoGenerate |
119
+ | Shared-entity | Both modules operate on same entity | Both Orders and Invoices reference Customer |
120
+ | Lookup | Module A uses reference data from module B | Products.CategoryId → Categories (if separate module) |
121
+
122
+ **For each dependency found:**
123
+ ```json
124
+ {
125
+ "from": "Orders",
126
+ "to": "Customers",
127
+ "type": "FK",
128
+ "description": "Order references Customer via CustomerId"
129
+ }
130
+ ```
131
+
132
+ ### 5. Topological Sort
133
+
134
+ Sort modules so dependencies are processed first:
135
+
136
+ **Algorithm:**
137
+ 1. Build adjacency list from dependency edges
138
+ 2. Compute in-degree for each module (number of dependencies)
139
+ 3. Start with modules having in-degree 0 (no dependencies)
140
+ 4. Process in BFS order: remove processed modules, reduce in-degrees
141
+ 5. Group into layers (modules with same depth can be processed in parallel)
142
+
143
+ **Cycle detection:**
144
+ IF a cycle is detected:
145
+ Display ERROR:
146
+ ```
147
+ ⚠ Dépendance circulaire détectée : {Module A} → {Module B} → {Module A}
148
+ Les modules ne peuvent pas dépendre mutuellement.
149
+ ```
150
+ Ask user to resolve: remove one direction of the dependency
151
+
152
+ **Result:**
153
+ ```json
154
+ {
155
+ "topologicalOrder": ["Customers", "Products", "Orders", "Invoices"],
156
+ "layers": [
157
+ { "layer": 0, "modules": ["Customers", "Products"] },
158
+ { "layer": 1, "modules": ["Orders"] },
159
+ { "layer": 2, "modules": ["Invoices"] }
160
+ ]
161
+ }
162
+ ```
163
+
164
+ ### 6. Client Checkpoint (BLOCKING)
165
+
166
+ Display the complete decomposition as markdown:
167
+
168
+ ```
169
+ ## Structure de l'application {application_name}
170
+
171
+ ### Graphe de dépendances
172
+
173
+ ```
174
+ Customers ──┐
175
+ ├──→ Orders ──→ Invoices
176
+ Products ───┘
177
+ ```
178
+
179
+ ### Ordre de traitement
180
+
181
+ | Ordre | Module | Dépend de | Complexité |
182
+ |-------|--------|-----------|------------|
183
+ | 1 | Customers | (aucune) | medium |
184
+ | 2 | Products | (aucune) | simple |
185
+ | 3 | Orders | Customers, Products | complex |
186
+ | 4 | Invoices | Orders, Customers | medium |
187
+
188
+ > Les modules seront spécifiés dans cet ordre. Chaque module sera
189
+ > détaillé avec ses sections, entités, permissions et maquettes,
190
+ > puis validé avant de passer au suivant.
191
+ ```
192
+
193
+ Ask via AskUserQuestion:
194
+ ```
195
+ question: "Validez-vous cette structure et cet ordre de traitement ?"
196
+ header: "Validation"
197
+ options:
198
+ - label: "Validé, on commence"
199
+ description: "Commencer la spécification par {first_module}"
200
+ - label: "Modifier l'ordre"
201
+ description: "Changer la priorité de traitement des modules"
202
+ - label: "Revenir aux modules"
203
+ description: "Modifier la liste des modules"
204
+ ```
205
+
206
+ IF "Revenir aux modules": Go back to step 3
207
+ IF "Modifier l'ordre": Re-sort and re-present
208
+
209
+ ### 7. Write Module Registry
210
+
211
+ Use ba-writer to update master feature.json:
212
+
213
+ ```
214
+ ba-writer.enrichModuleRegistry({
215
+ featureId: {feature_id},
216
+ modules: [{module objects with all fields}],
217
+ dependencyGraph: {
218
+ edges: [{dependency edges}],
219
+ topologicalOrder: [{sorted module codes}],
220
+ layers: [{layer groups}]
221
+ }
222
+ })
223
+
224
+ // Initialize workflow loop state
225
+ ba-writer.enrichSection({
226
+ featureId: {feature_id},
227
+ section: "metadata.workflow",
228
+ data: {
229
+ moduleOrder: [{topological order}],
230
+ currentModuleIndex: 0,
231
+ completedModules: [],
232
+ currentModule: {first module code}
233
+ }
234
+ })
235
+
236
+ ba-writer.updateStatus({feature_id}, "decomposed")
237
+ ```
238
+
239
+ ### 8. Create Module Directories
240
+
241
+ For each module in moduleOrder:
242
+ ```
243
+ Create: docs/business/{app}/{module_code}/business-analyse/v1.0/
244
+ ```
245
+
246
+ > Module feature.json files will be created by step-03 when each module is processed.
247
+
248
+ ### 9. Display Summary
249
+
250
+ ```
251
+ ## Decomposition Complete - {feature_id}
252
+
253
+ | Aspect | Value |
254
+ |--------|-------|
255
+ | Modules identified | {count} |
256
+ | Dependencies | {edge count} |
257
+ | Dependency layers | {layer count} |
258
+ | First module | {first module name} |
259
+
260
+ ### Processing Order
261
+ {numbered list of modules}
262
+
263
+ → Starting iterative specification with {first_module}...
264
+ ```
265
+
266
+ ---
267
+
268
+ ## SINGLE-MODULE MODE
269
+
270
+ When `workflow.mode = "module"` or only 1 scope item identified:
271
+
272
+ 1. Create a single module entry with code = `{module_name}` from init
273
+ 2. No dependency analysis needed
274
+ 3. **Simplified checkpoint:** Quick confirmation instead of full validation
275
+ 4. Set moduleOrder = [{single module code}]
276
+ 5. Proceed to step-03
277
+
278
+ ---
279
+
280
+ ## NEXT STEP
281
+
282
+ Load: `./step-03-specify.md`