@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
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: step-00-init
3
3
  description: Initialize Business Analysis - Parse flags, route use case, create feature.json
4
- next_step: steps/step-01-analyse.md
4
+ next_step: steps/step-01-cadrage.md
5
5
  ---
6
6
 
7
7
  # Step 00: Initialize Business Analysis
@@ -37,6 +37,7 @@ question_mode: false
37
37
  refactor_mode: false
38
38
  micro_mode: false
39
39
  interactive_mode: false
40
+ application_mode: false # Multi-module application analysis
40
41
  ```
41
42
 
42
43
  ### Flag Parsing Rules
@@ -51,6 +52,7 @@ interactive_mode: false
51
52
  | `-r` | `--refactor` | Refactoring mode | next arg = FEAT-ID, remaining = change description |
52
53
  | `-m` | `--micro` | Micro feature mode | none |
53
54
  | `-i` | `--interactive` | Interactive mode | none |
55
+ | `-app` | `--application` | Application mode: multi-module analysis | none |
54
56
 
55
57
  **Remaining arguments after flag removal = feature_description**
56
58
 
@@ -135,33 +137,79 @@ ba -m "Add email notification on approval"
135
137
  ba "Create order management system"
136
138
  ```
137
139
 
138
- ## Step 3: MCP Health Check
140
+ ## Step 2B: Application Mode Detection
139
141
 
140
- Verify MCP availability (non-blocking).
142
+ **IF `-app` flag is set:**
143
+ - Set `{workflow_mode}` = "application"
144
+ - Set `{use_case}` = "application"
141
145
 
142
- **Check file:** `.claude/mcp-status.json`
146
+ **ELSE IF no explicit mode flag:**
147
+ - Analyze `{feature_description}` for multi-module signals:
148
+ - Keywords: "application", "system", "platform", "suite", "complet", "ensemble"
149
+ - Multiple module mentions (3+ distinct functional areas)
150
+ - Scope description spanning multiple domains
151
+ - IF multi-module signals detected:
152
+ ```
153
+ AskUserQuestion:
154
+ question: "Votre description semble couvrir plusieurs modules. Voulez-vous une analyse multi-module (application complète) ?"
155
+ header: "Mode"
156
+ options:
157
+ - label: "Oui, analyse application"
158
+ description: "Identifier les modules, les analyser un par un avec validation client"
159
+ - label: "Non, module unique"
160
+ description: "Traiter comme un seul module"
161
+ ```
162
+ - IF user confirms multi-module: Set `{workflow_mode}` = "application"
163
+ - ELSE: Set `{workflow_mode}` = "module"
143
164
 
144
- | Condition | Action |
145
- |-----------|--------|
146
- | File missing | Perform full health check |
147
- | > 7 days old | Perform full health check |
148
- | ≤ 7 days old | Quick connectivity test |
149
- | Error status | Display warning, continue |
165
+ ## Step 3: MCP Prerequisite Check (BLOCKING)
150
166
 
151
- **Full health check:**
152
- 1. Call `mcp__smartstack__validate_conventions`
153
- 2. Verify installed version
154
- 3. List available tools
155
- 4. Update `.claude/mcp-status.json`
167
+ Verify MCP availability. **This check is BLOCKING** - the skill cannot proceed without MCP.
156
168
 
157
- **Quick test:**
158
- - Bash only, no LLM call
159
- - Check if `.claude/mcp/` exists and has recent files
169
+ > See `_shared.md` → "MCP Prerequisite Guard (BLOCKING)" for the full pattern.
160
170
 
161
- **Display result:**
162
- - Success: "MCP available: yes"
163
- - Warning: "MCP check skipped (cache expired)"
164
- - Error: "MCP unavailable: using fallback (slower analysis)"
171
+ **Detection:** Call MCP with minimal parameters:
172
+
173
+ ```
174
+ mcp__smartstack__validate_conventions({ checks: ["tables"] })
175
+ ```
176
+
177
+ **Decision matrix:**
178
+
179
+ | Result | Action |
180
+ |--------|--------|
181
+ | Success response | Set `mcp_available = true`, continue to Step 4 |
182
+ | Connection error / tool not found | **STOP EXECUTION** - display error below |
183
+
184
+ **On success:**
185
+ - Set `mcp_available = true`
186
+ - Update `.claude/mcp-status.json` cache
187
+ - Continue workflow
188
+
189
+ **On failure (STOP):**
190
+
191
+ ```
192
+ ═══════════════════════════════════════════════════════════════
193
+ MCP SMARTSTACK NOT AVAILABLE - SKILL BLOCKED
194
+ ═══════════════════════════════════════════════════════════════
195
+
196
+ The SmartStack MCP server is required for business-analyse
197
+ but could not be reached.
198
+
199
+ To install:
200
+ claude mcp add smartstack -- npx --package @atlashub/smartstack-cli smartstack-mcp
201
+
202
+ To verify:
203
+ /mcp:healthcheck
204
+
205
+ After installation, restart Claude Code and retry.
206
+
207
+ ═══════════════════════════════════════════════════════════════
208
+ ```
209
+
210
+ **DO NOT** offer fallback modes, economy mode workarounds, or degraded execution.
211
+ **DO NOT** continue to Step 4 or any subsequent step.
212
+ **STOP the skill immediately.**
165
213
 
166
214
  ## Step 4: Interactive Mode
167
215
 
@@ -301,25 +349,43 @@ docs_dir: "docs/business/{app}/{module}/business-analyse/v{version}"
301
349
  output_dir: same as docs_dir
302
350
  ```
303
351
 
304
- ## Step 10: Create Initial feature.json
305
-
306
- Create the main feature document using ba-writer agent.
307
-
308
- **Call ba-writer:**
309
- ```
310
- ba-writer.createFeature({
311
- id: feature_id,
312
- application: application_name,
313
- module: module_name,
314
- featureDescription: feature_description,
315
- language: language,
316
- useCase: use_case,
317
- featureType: feature_type OR null,
318
- economyMode: economy_mode,
319
- mcpAvailable: mcp_available
352
+ ## Step 10: Create Master feature.json
353
+
354
+ Create the master feature document using ba-writer agent.
355
+
356
+ **Use ba-writer agent:**
357
+
358
+ ```
359
+ ba-writer.createApplicationFeature({
360
+ id: {feature_id},
361
+ version: "1.0",
362
+ scope: "application",
363
+ status: "draft",
364
+ metadata: {
365
+ application: {application_name},
366
+ context: "business",
367
+ language: {language},
368
+ featureDescription: {feature_description},
369
+ useCase: {use_case},
370
+ mcpAvailable: {mcp_available},
371
+ economyMode: {economy_mode},
372
+ workflow: {
373
+ mode: {workflow_mode},
374
+ moduleOrder: [],
375
+ currentModuleIndex: 0,
376
+ completedModules: [],
377
+ currentModule: null
378
+ }
379
+ }
320
380
  })
321
381
  ```
322
382
 
383
+ **Output path:**
384
+ - Application mode: `docs/business/{app}/business-analyse/v1.0/feature.json`
385
+ - Module mode: `docs/business/{app}/business-analyse/v1.0/feature.json` (same - always create master first)
386
+
387
+ > **Note:** Even in single-module mode, we create the master feature.json. The decomposition step will trivially identify one module.
388
+
323
389
  **Result structure:**
324
390
  ```json
325
391
  {
@@ -443,18 +509,17 @@ NEXT STEP: step-01-analyse ({use_case} mode)
443
509
 
444
510
  ## Step 13: Load Next Step
445
511
 
446
- Execute the next step in the workflow.
512
+ **All modes except question (-q) and micro (-m):**
513
+ After showing initialization summary, proceed to `./step-01-cadrage.md`
447
514
 
448
- **Read file:**
449
- ```
450
- steps/step-01-analyse.md
451
- ```
515
+ **Question mode (-q):** EXIT after ba-reader answers the question.
516
+ **Micro mode (-m):** Load `./step-05-handoff.md` directly.
452
517
 
453
518
  **Pass context variables:**
454
519
  ```yaml
455
520
  feature_id: string
456
521
  feature_description: string
457
- use_case: "new" | "question" | "refactoring" | "micro"
522
+ use_case: "new" | "question" | "refactoring" | "micro" | "application"
458
523
  application_name: string
459
524
  module_name: string
460
525
  language: string
@@ -463,6 +528,7 @@ auto_mode: boolean
463
528
  economy_mode: boolean
464
529
  interactive_mode: boolean
465
530
  mcp_available: boolean
531
+ workflow_mode: string
466
532
  ```
467
533
 
468
534
  ## Error Handling
@@ -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`