@atlashub/smartstack-cli 2.2.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 (37) hide show
  1. package/.documentation/business-analyse.html +1503 -1058
  2. package/.documentation/cli-commands.html +1 -1
  3. package/.documentation/init.html +1 -1
  4. package/.documentation/installation.html +1 -1
  5. package/dist/index.js +76 -47
  6. package/dist/index.js.map +1 -1
  7. package/package.json +10 -7
  8. package/templates/agents/ba-reader.md +114 -9
  9. package/templates/agents/ba-writer.md +108 -27
  10. package/templates/agents/mcp-healthcheck.md +1 -1
  11. package/templates/ralph/README.md +1 -1
  12. package/templates/ralph/ralph.config.yaml +1 -1
  13. package/templates/skills/_shared.md +60 -0
  14. package/templates/skills/application/steps/step-00-init.md +32 -8
  15. package/templates/skills/business-analyse/SKILL.md +65 -42
  16. package/templates/skills/business-analyse/_shared.md +161 -51
  17. package/templates/skills/business-analyse/questionnaire/00-application.md +166 -0
  18. package/templates/skills/business-analyse/questionnaire/03-scope.md +7 -7
  19. package/templates/skills/business-analyse/questionnaire/12-migration.md +1 -1
  20. package/templates/skills/business-analyse/questionnaire.md +63 -19
  21. package/templates/skills/business-analyse/react/application-viewer.md +242 -0
  22. package/templates/skills/business-analyse/react/components.md +60 -8
  23. package/templates/skills/business-analyse/react/schema.md +413 -34
  24. package/templates/skills/business-analyse/schemas/application-schema.json +389 -0
  25. package/templates/skills/business-analyse/schemas/feature-schema.json +287 -46
  26. package/templates/skills/business-analyse/steps/step-00-init.md +110 -44
  27. package/templates/skills/business-analyse/steps/step-01-cadrage.md +259 -0
  28. package/templates/skills/business-analyse/steps/step-02-decomposition.md +282 -0
  29. package/templates/skills/business-analyse/steps/step-03-specify.md +489 -0
  30. package/templates/skills/business-analyse/steps/step-04-consolidation.md +336 -0
  31. package/templates/skills/business-analyse/steps/step-05-handoff.md +1119 -0
  32. package/templates/skills/business-analyse/templates/tpl-handoff.md +11 -2
  33. package/templates/skills/mcp/SKILL.md +2 -2
  34. package/templates/skills/business-analyse/steps/step-01-analyse.md +0 -505
  35. package/templates/skills/business-analyse/steps/step-02-specify.md +0 -833
  36. package/templates/skills/business-analyse/steps/step-03-validate.md +0 -862
  37. package/templates/skills/business-analyse/steps/step-04-handoff.md +0 -1593
@@ -0,0 +1,259 @@
1
+ ---
2
+ name: step-01-cadrage
3
+ description: Application/module framing - context, problem, stakeholders, scope, application roles
4
+ model: opus
5
+ next_step: steps/step-02-decomposition.md
6
+ ---
7
+
8
+ # Step 1: Cadrage (Framing)
9
+
10
+ ## MANDATORY EXECUTION RULES
11
+
12
+ - ALWAYS use ULTRATHINK mode for this step
13
+ - ALWAYS apply the 5 Elicitation Techniques from `_shared.md`
14
+ - NEVER accept vague answers — probe deeper
15
+ - NEVER define entities or business rules here — that's per-module in step-03
16
+ - ALL questions via AskUserQuestion tool (NEVER as text dumps)
17
+ - ALL communication in `{language}` (from feature.json.metadata.language)
18
+
19
+ ## YOUR TASK
20
+
21
+ Frame the analysis scope at the **application level**: understand the problem, stakeholders, scope, and define application-level roles. This step works for both multi-module applications and single modules.
22
+
23
+ **Key difference from old step-01-analyse:** This step does NOT define entities, business rules, or process flows. Those are per-module and handled in step-03.
24
+
25
+ ---
26
+
27
+ ## EXECUTION SEQUENCE
28
+
29
+ ### 1. Read Current State
30
+
31
+ ```
32
+ ba-reader.findFeature({feature_id})
33
+ → Read metadata: application, language, workflow.mode, useCase
34
+ → Read cadrage section (if resuming)
35
+ ```
36
+
37
+ IF cadrage already completed (status = "framed"):
38
+ Display: "Cadrage already completed. Loading next step."
39
+ Load: steps/step-02-decomposition.md
40
+ STOP
41
+
42
+ ### 2. Codebase Pre-Research
43
+
44
+ > **Same pattern as previous step-01-analyse.** Understand what already exists.
45
+
46
+ **Phase 2a: MCP Tools (if available)**
47
+ ```
48
+ IF mcp_available:
49
+ Call: mcp__smartstack__analyze_extension_points
50
+ → Discover existing modules, entities, services
51
+
52
+ Call: mcp__smartstack__api_docs
53
+ → Existing API documentation
54
+
55
+ Call: mcp__smartstack__validate_conventions
56
+ → Validate application/module naming
57
+
58
+ Store findings in {codebase_context}
59
+ ```
60
+
61
+ **Phase 2b: Parallel Agents (unless economy_mode)**
62
+ ```
63
+ IF NOT economy_mode:
64
+ Launch 3 agents in parallel:
65
+ Agent 1: Search for existing domain entities (Glob: **/Domain/**/*.cs)
66
+ Agent 2: Search for existing services/integrations (Grep: IService, IRepository)
67
+ Agent 3: Search for existing page patterns (Glob: **/pages/business/**/*.tsx)
68
+
69
+ Merge findings into {codebase_context}
70
+ ```
71
+
72
+ **Phase 2c: Economy Mode**
73
+ ```
74
+ IF economy_mode:
75
+ Use Glob/Grep directly (no subagents)
76
+ Quick scan of Domain/, Application/, pages/ directories
77
+ ```
78
+
79
+ ### 3. Application-Level Questionnaire (application mode)
80
+
81
+ > **Only loaded when workflow.mode = "application"**
82
+
83
+ Load: `questionnaire/00-application.md`
84
+
85
+ Ask questions in batches of max 4 via AskUserQuestion:
86
+
87
+ **Batch 1 (Q0.1-Q0.2): Application Identity**
88
+ - Application name (PascalCase)
89
+ - Application purpose (1-2 sentences)
90
+
91
+ **Batch 2 (Q0.3-Q0.4): Module Landscape**
92
+ - How many modules envisioned
93
+ - Which are must-have for first release
94
+
95
+ **Batch 3 (Q0.5-Q0.6): Application Roles**
96
+ - Standard 4-tier roles or customize
97
+ - Module-specific role restrictions
98
+
99
+ **Batch 4 (Q0.7-Q0.8): Cross-Module**
100
+ - Business processes spanning modules
101
+ - Default role for new users
102
+
103
+ After each batch: Apply ULTRATHINK + Elicitation Techniques.
104
+
105
+ ### 4. Core Questionnaires (always)
106
+
107
+ Load these categories in order:
108
+
109
+ **Category 01 - Context** (`questionnaire/01-context.md`)
110
+ - Q1.1-Q1.4: Problem, AS-IS, TO-BE, trigger
111
+ - 1 AskUserQuestion batch
112
+
113
+ **Category 02 - Stakeholders** (`questionnaire/02-stakeholders.md`)
114
+ - Q2.1-Q2.8: Roles, tasks, frequency, pain points
115
+ - 2 AskUserQuestion batches
116
+ - ULTRATHINK: Map stakeholders to application roles
117
+
118
+ **Category 03 - Scope** (`questionnaire/03-scope.md`)
119
+ - Q3.1-Q3.8: MoSCoW prioritization, flows, errors
120
+ - 2 AskUserQuestion batches
121
+ - ULTRATHINK: Ensure scope items map to modules
122
+
123
+ ### 5. Conditional Questionnaires
124
+
125
+ Based on feature description analysis, load additional categories:
126
+
127
+ | Condition | Category | Questionnaire |
128
+ |-----------|----------|---------------|
129
+ | Security concerns mentioned | 06 | `questionnaire/06-security.md` |
130
+ | Integration with external systems | 05 | `questionnaire/05-integrations.md` |
131
+ | Performance requirements | 08 | `questionnaire/08-performance.md` |
132
+ | Technical constraints | 09 | `questionnaire/09-constraints.md` |
133
+ | Documentation requirements | 10 | `questionnaire/10-documentation.md` |
134
+
135
+ > **Categories 04 (data), 07 (ui), 11 (data-lifecycle), 12 (migration), 13 (cross-module) are per-module and loaded in step-03.**
136
+
137
+ ### 6. Application Roles Definition
138
+
139
+ > **Define roles at the APPLICATION level, not per-module.**
140
+
141
+ IF application mode AND roles not yet defined from Q0.5:
142
+ Propose the standard 4-tier roles:
143
+
144
+ ```
145
+ Application Roles for {application_name}:
146
+
147
+ | Role | Level | Default Permissions |
148
+ |------|-------|-------------------|
149
+ | {App} Admin | admin | business.{app}.* (wildcard) |
150
+ | {App} Manager | manager | read, create, update, assign |
151
+ | {App} Contributor | contributor | read, create, update |
152
+ | {App} Viewer | viewer | read only |
153
+ ```
154
+
155
+ Ask via AskUserQuestion:
156
+ ```
157
+ question: "Ces 4 rôles conviennent-ils pour {application_name} ?"
158
+ header: "Rôles"
159
+ options:
160
+ - label: "Oui, parfait"
161
+ description: "Utiliser les 4 rôles standards tels quels"
162
+ - label: "Renommer"
163
+ description: "Garder 4 niveaux mais personnaliser les noms"
164
+ - label: "Personnaliser"
165
+ description: "Modifier le nombre ou les permissions des rôles"
166
+ ```
167
+
168
+ IF single-module mode:
169
+ Same role definition but inferred from stakeholders
170
+
171
+ ### 7. Proactive Suggestions
172
+
173
+ > **Same pattern as previous step-01.** Load suggestion catalog.
174
+
175
+ Load: `patterns/suggestion-catalog.md`
176
+
177
+ 1. Analyze scope items and stakeholder needs
178
+ 2. Match against catalog patterns
179
+ 3. Present top 3-4 suggestions via AskUserQuestion (multiSelect: true)
180
+ 4. Store accepted suggestions in `suggestions[]`
181
+
182
+ ### 8. Risk Analysis
183
+
184
+ Ask via AskUserQuestion:
185
+ ```
186
+ question: "Quels sont les principaux risques pour ce projet ?"
187
+ header: "Risques"
188
+ multiSelect: true
189
+ options:
190
+ - label: "Adoption utilisateur"
191
+ description: "Risque que les utilisateurs n'adoptent pas le système"
192
+ - label: "Qualité des données"
193
+ description: "Données existantes incomplètes ou incohérentes à migrer"
194
+ - label: "Dépendances techniques"
195
+ description: "Dépendance à des systèmes externes ou des APIs"
196
+ - label: "Complexité fonctionnelle"
197
+ description: "Règles métier complexes ou mal documentées"
198
+ ```
199
+
200
+ Classify per probability/impact:
201
+ - High/High → Critical (mitigation required)
202
+ - High/Low or Low/High → Medium (monitor)
203
+ - Low/Low → Low (accept)
204
+
205
+ ### 9. Write Cadrage to Feature.json
206
+
207
+ Use ba-writer to enrich master feature.json:
208
+
209
+ ```
210
+ ba-writer.enrichSection({
211
+ featureId: {feature_id},
212
+ section: "cadrage",
213
+ data: {
214
+ problem: {Q1.1 answer},
215
+ asIs: {Q1.2 answer},
216
+ toBe: {Q1.3 answer},
217
+ trigger: {Q1.4 answer},
218
+ stakeholders: [{mapped from Q2.x answers}],
219
+ globalScope: {
220
+ mustHave: [{from Q3.x}],
221
+ shouldHave: [{from Q3.x}],
222
+ couldHave: [{from Q3.x}],
223
+ outOfScope: [{from Q3.x}]
224
+ },
225
+ applicationRoles: [{from section 6}],
226
+ risks: [{from section 8}],
227
+ acceptanceCriteria: [{derived from scope}],
228
+ codebaseContext: {codebase_context}
229
+ }
230
+ })
231
+
232
+ ba-writer.updateStatus({feature_id}, "framed")
233
+ ```
234
+
235
+ ### 10. Display Summary
236
+
237
+ ```
238
+ ## Cadrage Complete - {feature_id}
239
+
240
+ | Aspect | Count |
241
+ |--------|-------|
242
+ | Stakeholders | {count} |
243
+ | Must-have scope items | {count} |
244
+ | Application roles | {count} |
245
+ | Risks identified | {count} |
246
+ | Suggestions accepted | {count} |
247
+
248
+ ### Application Roles
249
+ {table of roles with permission levels}
250
+
251
+ ### Next Step
252
+ → Module decomposition (step-02-decomposition.md)
253
+ ```
254
+
255
+ ---
256
+
257
+ ## NEXT STEP
258
+
259
+ Load: `./step-02-decomposition.md`
@@ -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`