@atlashub/smartstack-cli 2.1.0 → 2.3.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 (38) hide show
  1. package/.documentation/business-analyse.html +1503 -1058
  2. package/dist/index.js +92 -55
  3. package/dist/index.js.map +1 -1
  4. package/package.json +10 -7
  5. package/templates/agents/ba-reader.md +250 -0
  6. package/templates/agents/ba-writer.md +210 -0
  7. package/templates/agents/docs-context-reader.md +51 -33
  8. package/templates/skills/_shared.md +2 -0
  9. package/templates/skills/business-analyse/SKILL.md +120 -108
  10. package/templates/skills/business-analyse/_shared.md +136 -146
  11. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +478 -0
  12. package/templates/skills/business-analyse/questionnaire/01-context.md +3 -15
  13. package/templates/skills/business-analyse/questionnaire/03-scope.md +7 -7
  14. package/templates/skills/business-analyse/questionnaire/08-performance.md +7 -21
  15. package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -13
  16. package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -13
  17. package/templates/skills/business-analyse/questionnaire/12-migration.md +1 -1
  18. package/templates/skills/business-analyse/questionnaire.md +72 -76
  19. package/templates/skills/business-analyse/react/components.md +317 -154
  20. package/templates/skills/business-analyse/react/i18n-template.md +167 -106
  21. package/templates/skills/business-analyse/react/schema.md +474 -107
  22. package/templates/skills/business-analyse/schemas/feature-schema.json +860 -0
  23. package/templates/skills/business-analyse/steps/step-00-init.md +395 -285
  24. package/templates/skills/business-analyse/steps/step-01-analyse.md +523 -0
  25. package/templates/skills/business-analyse/steps/step-02-specify.md +899 -0
  26. package/templates/skills/business-analyse/steps/step-03-validate.md +1009 -0
  27. package/templates/skills/business-analyse/steps/step-04-handoff.md +1802 -0
  28. package/templates/skills/business-analyse/templates/tpl-handoff.md +49 -64
  29. package/templates/skills/business-analyse/steps/step-01-discover.md +0 -737
  30. package/templates/skills/business-analyse/steps/step-02-analyse.md +0 -299
  31. package/templates/skills/business-analyse/steps/step-03-specify.md +0 -472
  32. package/templates/skills/business-analyse/steps/step-04-validate.md +0 -335
  33. package/templates/skills/business-analyse/steps/step-05-handoff.md +0 -741
  34. package/templates/skills/business-analyse/steps/step-06-doc-html.md +0 -320
  35. package/templates/skills/business-analyse/templates/00-context.md +0 -105
  36. package/templates/skills/business-analyse/templates/tpl-brd.md +0 -97
  37. package/templates/skills/business-analyse/templates/tpl-discovery.md +0 -78
  38. package/templates/skills/business-analyse/tracking/change-template.md +0 -30
@@ -0,0 +1,523 @@
1
+ ---
2
+ name: step-01-analyse
3
+ description: Merged Discovery + Analysis - Elicitation, business rules, entities, proactive suggestions
4
+ next_step: steps/step-02-specify.md
5
+ ---
6
+
7
+ ## YOUR TASK:
8
+
9
+ Execute combined discovery and analysis: elicit requirements using ULTRATHINK mode, formalize business rules and entities, and suggest complementary modules.
10
+
11
+ > **ULTRATHINK MODE:**
12
+ > - Consider ALL edge cases before formulating questions
13
+ > - Challenge EVERY stakeholder assumption
14
+ > - Anticipate UNEXPRESSED needs
15
+ > - Validate completeness before proceeding
16
+ > - DO NOT accept vague answers
17
+ > - Extract IMPLICIT rules from discovery responses
18
+
19
+ ---
20
+
21
+ ## EXECUTION SEQUENCE:
22
+
23
+ ### 1. Read Current State
24
+
25
+ Use **ba-reader** agent to read feature.json:
26
+ - `feature_id`, `application_name`, `module_name`, `use_case`, `language`, `economy_mode`
27
+ - Determine if delta mode (refactoring) or new feature
28
+
29
+ Use **ba-writer** agent to update feature.json:
30
+ - Set `metadata.steps.analyse.status = "in-progress"`
31
+
32
+ **Language Config:**
33
+ All AskUserQuestion calls must use `{language}` (default: fr).
34
+ See `_shared.md` for language configuration.
35
+
36
+ > **⚠️ BRANDING:** Never use "SmartStack" in user-facing communication.
37
+ > Use "la plateforme", "l'application", or "le système" instead.
38
+
39
+ ---
40
+
41
+ ### 2. Determine Feature Type (for use_case = "new" or "micro")
42
+
43
+ Analyze `feature.description` to classify:
44
+
45
+ | Type | Keywords | Categories to Load |
46
+ |------|----------|------------------|
47
+ | **Data-centric** | management, CRUD, entity, data | 01, 02, 03, 04, 06, 11 |
48
+ | **Integration** | API, sync, import, export, external | 01, 02, 03, 05, 06 |
49
+ | **UI-centric** | screen, form, dashboard, interface | 01, 02, 03, 06, 07 |
50
+ | **Workflow** | process, validation, workflow, steps | 01, 02, 03, 06, 09 |
51
+ | **Reporting** | report, export, statistics, KPI | 01, 02, 03, 04, 08 |
52
+ | **Full-module** | module, complete, feature | ALL |
53
+ | **Micro** | (from -m flag) | 01, 02, 03, 06 (minimal) |
54
+
55
+ Use **ba-writer** to set `metadata.featureType = {feature_type}`
56
+
57
+ ---
58
+
59
+ ### 3. Codebase Pre-Research (3 Phases)
60
+
61
+ > **RULE: Explore BEFORE asking questions. Informed questions > generic questions.**
62
+
63
+ **Phase 3a: MCP SmartStack (if available)**
64
+
65
+ Call MCP tools (if not already done in step-00):
66
+ - `mcp__smartstack__analyze_extension_points` → discover existing modules/entities
67
+ - `mcp__smartstack__api_docs` → check existing API
68
+ - `mcp__smartstack__validate_conventions` → validate module naming
69
+
70
+ **Phase 3b: Parallel agents (if NOT economy_mode)**
71
+
72
+ ```
73
+ Agent 1: "Search for existing domain entities in {application_name}.
74
+ List entities, attributes, relationships."
75
+
76
+ Agent 2: "Search for integrations, services, SignalR, background jobs
77
+ that {module_name} might connect with."
78
+
79
+ Agent 3: "Search for existing page patterns in {application_name}
80
+ (if UI-centric). List structures, components, navigation."
81
+ ```
82
+
83
+ **Phase 3c: Economy mode**
84
+
85
+ Use Glob/Grep directly:
86
+ - Find 2-3 reference modules
87
+ - Read key files to understand patterns
88
+ - Extract domain context
89
+
90
+ **Store findings:**
91
+ Use **ba-writer** to add to `discovery.codebaseContext`:
92
+ - Existing modules in {application_name}
93
+ - Reusable entities and patterns
94
+ - Potential integration points
95
+ - RBAC patterns observed
96
+
97
+ ---
98
+
99
+ ### 4. Load Questionnaire Categories (Progressive)
100
+
101
+ **ALWAYS load (core):**
102
+ ```
103
+ questionnaire/01-context.md # ~50 lines
104
+ questionnaire/02-stakeholders.md # ~70 lines
105
+ questionnaire/03-scope.md # ~60 lines
106
+ questionnaire/06-security.md # ~70 lines
107
+ ```
108
+
109
+ **Conditional (based on feature_type):**
110
+ ```
111
+ Data-centric OR Full → questionnaire/04-data.md, 11-data-lifecycle.md
112
+ Integration OR Full → questionnaire/05-integrations.md
113
+ UI-centric OR Full → questionnaire/07-ui.md
114
+ Reporting OR Critical → questionnaire/08-performance.md
115
+ Workflow OR Constraints → questionnaire/09-constraints.md
116
+ New module → questionnaire/12-migration.md, 13-cross-module.md
117
+ ```
118
+
119
+ **Micro mode shortcut:**
120
+ Load ONLY questionnaire/01-context.md (minimal 4 questions):
121
+ - What entity/feature?
122
+ - What fields/attributes?
123
+ - What values/states?
124
+ - Who can view/edit?
125
+ - Any business rules?
126
+ - Validation: correct summary?
127
+
128
+ **Delta mode (refactoring):**
129
+ Load only categories relevant to the CHANGE description.
130
+ Skip categories already answered in previous version.
131
+
132
+ ---
133
+
134
+ ### 5. Interactive Elicitation
135
+
136
+ > **RULE: Use `AskUserQuestion` for EVERY question batch. NEVER list questions as text.**
137
+ > **RULE: Question field does NOT support markdown. Use direct output for summaries.**
138
+
139
+ **Flow per category:**
140
+
141
+ 1. Load questionnaire file for the category
142
+ 2. Ask batches of max 4 questions via AskUserQuestion with predefined options
143
+ 3. Process answers → apply ULTRATHINK + 5 Elicitation Techniques (see `_shared.md`)
144
+ 4. If vague → follow-up with targeted probes
145
+ 5. After category: display summary as direct text output (supports markdown)
146
+ 6. Ask validation with SHORT question: "Is this summary correct?"
147
+ 7. If corrections needed → apply follow-ups
148
+ 8. Move to next category
149
+
150
+ **ULTRATHINK checkpoints during elicitation:**
151
+ - After Q1: If answer is solution-oriented → reframe to problem
152
+ - After Q2: If only 1-2 stakeholder types → probe for hidden users
153
+ - After Q3: If > 5 Must-Have → ask to prioritize implementation order
154
+ - If answer is vague → apply Technique 3 (Concrete Scenario)
155
+ - If any answer contains permission attributes → flag as RBAC violation
156
+
157
+ **Reformulation loop (after each category):**
158
+
159
+ Step 1: Display summary as direct text (supports markdown):
160
+ ```
161
+ ## Synthèse - {category_name}
162
+
163
+ - **Point 1:** {summary}
164
+ - **Point 2:** {summary}
165
+ ```
166
+
167
+ Step 2: Ask validation with SHORT question via AskUserQuestion:
168
+ ```
169
+ question: "Cette synthèse est-elle correcte ?"
170
+ options: [
171
+ { label: "Correct" },
172
+ { label: "Partiellement" },
173
+ { label: "Incorrect" }
174
+ ]
175
+ ```
176
+
177
+ - **Correct** → proceed to next category
178
+ - **Partiellement** → ask: "Quelles corrections ?"
179
+ - **Incorrect** → re-ask with refined questions
180
+
181
+ ---
182
+
183
+ ### 6. Business Rules Extraction (from discovery + ULTRATHINK)
184
+
185
+ Scan all elicitation answers for implicit and explicit rules:
186
+
187
+ **Sources to analyze:**
188
+ - Scope constraints (category 03)
189
+ - Data validations (category 04)
190
+ - Security restrictions (category 06)
191
+ - Process conditions from flow descriptions
192
+ - Stakeholder-mentioned constraints
193
+
194
+ **Rule categories:**
195
+ | Category | Example | BR-ID Pattern |
196
+ |----------|---------|---|
197
+ | Validation | "Email must be unique" | BR-VAL-XXX |
198
+ | Calculation | "Total = sum of lines" | BR-CALC-XXX |
199
+ | Workflow | "Manager must approve > 1000$" | BR-WF-XXX |
200
+ | Security | "Only admin can delete" | BR-SEC-XXX |
201
+ | Data | "Created date is immutable" | BR-DATA-XXX |
202
+
203
+ **Rule formalization:**
204
+
205
+ For each identified rule, create:
206
+ ```json
207
+ {
208
+ "id": "BR-{category}-NNN",
209
+ "name": "Rule name",
210
+ "category": "validation|calculation|workflow|security|data",
211
+ "statement": "IF {condition} THEN {result} ELSE {alternative}",
212
+ "priority": "must|should|could",
213
+ "conditions": ["condition 1", "condition 2"],
214
+ "examples": [
215
+ { "input": "example input", "expected": "example output" }
216
+ ],
217
+ "testability": "How to verify this rule"
218
+ }
219
+ ```
220
+
221
+ **ULTRATHINK checkpoint:**
222
+ - Each rule is testable?
223
+ - Rules don't contradict each other?
224
+ - No rule is solution-oriented (HOW instead of WHAT)?
225
+ - Priority aligns with scope (Must-Have → must, etc.)?
226
+
227
+ Use **ba-writer** to add all rules to `analysis.businessRules[]`
228
+
229
+ ---
230
+
231
+ ### 7. Business Objectives Extraction
232
+
233
+ From discovery context, formalize measurable objectives:
234
+
235
+ ```json
236
+ {
237
+ "id": "OBJ-NNN",
238
+ "objective": "description",
239
+ "metric": "what to measure",
240
+ "target": "target value"
241
+ }
242
+ ```
243
+
244
+ Examples:
245
+ - OBJ-001: Reduce manual data entry time by 50%
246
+ - OBJ-002: Achieve 95% first-pass accuracy
247
+ - OBJ-003: Enable 100% of stakeholders to access real-time KPIs
248
+
249
+ Use **ba-writer** to add to `analysis.businessObjectives[]`
250
+
251
+ ---
252
+
253
+ ### 8. Entity Definition - Business View (NO technical fields)
254
+
255
+ From data questions and scope, define entities:
256
+
257
+ **CRITICAL RULES:**
258
+ - Business attributes ONLY (NO Id, TenantId, CreatedBy, UpdatedBy, etc.)
259
+ - NO role attributes (User.Role, User.IsAdmin, User.AccessLevel)
260
+ - RBAC is separate (step-02)
261
+ - Relationships: 1:1, 1:N, N:M
262
+
263
+ **Per entity, document:**
264
+ ```json
265
+ {
266
+ "name": "EntityName (PascalCase)",
267
+ "description": "Business description",
268
+ "businessAttributes": [
269
+ { "name": "field", "type": "string", "required": true, "description": "meaning" }
270
+ ],
271
+ "relationships": [
272
+ { "name": "RelationshipName", "cardinality": "1:N", "with": "OtherEntity" }
273
+ ]
274
+ }
275
+ ```
276
+
277
+ **ULTRATHINK checkpoint:**
278
+ - All entities from discovery captured?
279
+ - Relationships complete?
280
+ - No orphan entities?
281
+ - **NO RBAC CHECK:** No role/permission/access-level as attribute?
282
+
283
+ If permission attributes detected → FLAG error: "RBAC violation detected in entity {name}. Roles belong in Permission Matrix (step-02), not data model."
284
+
285
+ Use **ba-writer** to add to `analysis.entities[]`
286
+
287
+ ---
288
+
289
+ ### 9. Process Flow Modeling
290
+
291
+ Model the main business flow:
292
+
293
+ ```
294
+ Entry Points → [Decision Points] → [Actions/Validations] → Exit Points
295
+ ↓ ↓ ↓ ↓
296
+ Trigger Link to BR-WF rules Link to BR-VAL Success/Failure
297
+ ```
298
+
299
+ For each decision point, link to relevant BR-WF rules.
300
+ Document alternative flows (error paths, exceptions).
301
+
302
+ Example structure:
303
+ ```
304
+ 1. User submits request → BR-VAL-001 (validation)
305
+ ├─ Valid → BR-WF-001 (workflow: awaiting approval)
306
+ │ └─ Manager approves → BR-WF-002 (accept)
307
+ │ └─ Request processed
308
+ └─ Invalid → BR-VAL-002 (error: required field missing)
309
+ └─ User corrected
310
+ ```
311
+
312
+ Use **ba-writer** to add to `analysis.processFlow` (text or ASCII diagram)
313
+
314
+ ---
315
+
316
+ ### 10. Integrations & Cross-Module Impact
317
+
318
+ From discovery, identify:
319
+
320
+ | System | Direction | Data | Frequency | Format |
321
+ |--------|-----------|------|-----------|--------|
322
+ | {system} | In/Out/Bi | {data} | Real-time/Batch | JSON/CSV/API |
323
+
324
+ For each integration:
325
+ - Data format expected
326
+ - Error handling strategy
327
+ - Fallback behavior
328
+
329
+ Document cross-module dependencies:
330
+ - Which existing entities are referenced?
331
+ - Which modules depend on this module?
332
+
333
+ Use **ba-writer** to add to `analysis.integrations[]` and `analysis.crossModuleImpact`
334
+
335
+ ---
336
+
337
+ ### 11. Proactive Suggestions (NEW - skip for micro mode)
338
+
339
+ After scope and entities are defined:
340
+
341
+ 1. Load `patterns/suggestion-catalog.md` (if available)
342
+ 2. Match module type against catalog patterns
343
+ 3. Present via AskUserQuestion:
344
+
345
+ ```json
346
+ {
347
+ "question": "Based on your {module} module, I suggest complementary additions. Which interest you?",
348
+ "header": "Suggestions",
349
+ "options": [
350
+ { "label": "{Suggestion 1}", "description": "{reason}" },
351
+ { "label": "{Suggestion 2}", "description": "{reason}" },
352
+ { "label": "None", "description": "No additional modules needed" }
353
+ ],
354
+ "multiSelect": true
355
+ }
356
+ ```
357
+
358
+ Examples (for each module type):
359
+ - **Data-centric:** Bulk import, Audit trail, Export templates, Archive strategy
360
+ - **Integration:** Error recovery, Health monitoring, Retry policy, Logging
361
+ - **UI-centric:** Mobile-responsive design, Accessibility audit, Dark mode, Offline support
362
+ - **Workflow:** Escalation rules, SLA tracking, Approval chains, Notifications
363
+ - **Reporting:** Scheduled exports, Data freshness, Custom dashboards, Mobile reports
364
+
365
+ For each accepted suggestion:
366
+ ```json
367
+ {
368
+ "suggestion": "...",
369
+ "description": "...",
370
+ "acceptedStatus": true,
371
+ "impactOnTimeline": "{days if any}",
372
+ "linkedRules": ["BR-IDs affected"]
373
+ }
374
+ ```
375
+
376
+ Use **ba-writer** to add to `analysis.suggestions[]`
377
+
378
+ ---
379
+
380
+ ### 12. Risk Analysis
381
+
382
+ Identify risks from elicitation answers (skip for micro mode):
383
+
384
+ Ask via AskUserQuestion:
385
+
386
+ ```json
387
+ {
388
+ "question": "Quels risques métier identifiez-vous ?",
389
+ "options": [
390
+ { "label": "Adoption", "description": "Users might not adopt the module" },
391
+ { "label": "Data quality", "description": "Migration of existing data problematic" },
392
+ { "label": "Process gaps", "description": "Current process is misunderstood or will change" },
393
+ { "label": "Dependencies", "description": "Depends on another module not ready" }
394
+ ],
395
+ "multiSelect": true
396
+ }
397
+ ```
398
+
399
+ For each identified risk, classify:
400
+
401
+ | Probability | Impact | Priority |
402
+ |---|---|---|
403
+ | High | High | **Critical** — mitigation required |
404
+ | High | Low | **Medium** — monitor |
405
+ | Low | High | **Medium** — contingency plan |
406
+ | Low | Low | **Low** — accept |
407
+
408
+ Store each risk:
409
+ ```json
410
+ {
411
+ "id": "RISK-NNN",
412
+ "type": "business|technical|organizational",
413
+ "description": "...",
414
+ "probability": "high|medium|low",
415
+ "impact": "high|medium|low",
416
+ "priority": "critical|medium|low",
417
+ "mitigation": "..."
418
+ }
419
+ ```
420
+
421
+ Use **ba-writer** to add to `discovery.risks[]`
422
+
423
+ ---
424
+
425
+ ### 13. Write to feature.json
426
+
427
+ Use **ba-writer** agent to enrich:
428
+ - `discovery` section: problem, asIs, toBe, trigger, stakeholders, scope, risks, codebaseContext, openQuestions
429
+ - `analysis` section: objectives, businessRules, entities, processFlow, integrations, crossModuleImpact, dataLifecycle, suggestions
430
+ - Update `metadata.steps.analyse.status = "completed"`
431
+ - **Initialize changelog** with first entry:
432
+
433
+ ```json
434
+ {
435
+ "changelog": [
436
+ {
437
+ "step": "step-01-analyse",
438
+ "timestamp": "2025-02-01T09:00:00Z",
439
+ "changes": [
440
+ "Discovery: {stakeholder_count} stakeholders, {scope_must} must-haves",
441
+ "Analysis: {br_count} business rules, {entity_count} entities, {obj_count} objectives",
442
+ "Suggestions: {accepted_count}/{total_count} accepted",
443
+ "Risks: {risk_count} identified ({critical_count} critical)"
444
+ ]
445
+ }
446
+ ]
447
+ }
448
+ ```
449
+
450
+ ---
451
+
452
+ ### 14. Display Summary and Load Next Step
453
+
454
+ **Display:**
455
+
456
+ ```
457
+ ANALYSE - {feature_id}
458
+ ├── Status: analysed
459
+ ├── Feature Type: {feature_type}
460
+ ├── Stakeholders: {count}
461
+ ├── Scope: {must} Must, {should} Should, {could} Could
462
+ ├── Business Rules: {br_count}
463
+ ├── Business Objectives: {obj_count}
464
+ ├── Entities: {entity_count}
465
+ ├── Integrations: {integration_count}
466
+ ├── Risks: {risk_count} ({critical_count} critical)
467
+ ├── Suggestions: {accepted}/{total}
468
+ ├── feature.json: {location}
469
+ └── Next: step-02-specify.md
470
+ ```
471
+
472
+ Load next step:
473
+ ```
474
+ Read and execute: steps/step-02-specify.md
475
+ ```
476
+
477
+ ---
478
+
479
+ ## OUTPUT FORMAT:
480
+
481
+ This step enriches `feature.json` with:
482
+ - `discovery` section: complete elicitation findings
483
+ - `analysis` section: rules, objectives, entities, flows, integrations, suggestions
484
+ - Status: draft → analysed
485
+
486
+ **Context reduction strategy:**
487
+ - Use feature.json as single source of truth
488
+ - Load questionnaires progressively (max 150-200 lines at a time)
489
+ - Use agents (ba-reader, ba-writer) to avoid re-reading
490
+
491
+ ---
492
+
493
+ ## ERROR HANDLING:
494
+
495
+ **If user abandons mid-way:**
496
+ 1. Save partial analysis with answers collected
497
+ 2. Mark incomplete sections with "[INCOMPLETE]"
498
+ 3. Update status to "in-progress"
499
+ 4. Allow resume with same feature_id
500
+
501
+ **If MCP unavailable:**
502
+ 1. Use Glob/Grep for codebase exploration
503
+ 2. Continue with discovery
504
+ 3. Note in codebaseContext: "MCP unavailable"
505
+
506
+ **If business rules contradict:**
507
+ 1. Identify conflicting BR-IDs
508
+ 2. Ask user to resolve via AskUserQuestion
509
+ 3. Document resolution in rule notes
510
+
511
+ **If permission paths detected in entities:**
512
+ STOP and flag error: "RBAC violation in entity attributes. Roles must be in Permission Matrix (step-02)."
513
+
514
+ **If micro mode and user provides complex requirements:**
515
+ 1. Warn: "Micro mode is for simple features. Consider full analysis mode."
516
+ 2. Allow upgrade to full mode
517
+ 3. Preserve micro answers in feature.json
518
+
519
+ ---
520
+
521
+ ## NEXT STEP:
522
+
523
+ After completion, proceed to `steps/step-02-specify.md`