@atlashub/smartstack-cli 2.6.2 → 2.7.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/agents.html +1 -1
  2. package/.documentation/apex.html +1 -1
  3. package/.documentation/business-analyse.html +749 -1419
  4. package/.documentation/cli-commands.html +1 -1
  5. package/.documentation/commands.html +1 -1
  6. package/.documentation/css/styles.css +160 -0
  7. package/.documentation/efcore.html +1 -1
  8. package/.documentation/gitflow.html +3 -453
  9. package/.documentation/hooks.html +1 -1
  10. package/.documentation/index.html +177 -68
  11. package/.documentation/init.html +747 -290
  12. package/.documentation/installation.html +63 -8
  13. package/.documentation/ralph-loop.html +1 -1
  14. package/.documentation/test-web.html +1 -1
  15. package/dist/index.js +588 -339
  16. package/dist/index.js.map +1 -1
  17. package/package.json +1 -1
  18. package/templates/agents/ba-reader.md +23 -0
  19. package/templates/agents/ba-writer.md +63 -4
  20. package/templates/skills/business-analyse/questionnaire/00-application.md +1 -1
  21. package/templates/skills/business-analyse/questionnaire/03-scope.md +2 -2
  22. package/templates/skills/business-analyse/questionnaire.md +1 -1
  23. package/templates/skills/business-analyse/react/application-viewer.md +1 -1
  24. package/templates/skills/business-analyse/react/schema.md +88 -1
  25. package/templates/skills/business-analyse/schemas/application-schema.json +16 -1
  26. package/templates/skills/business-analyse/schemas/feature-schema.json +19 -986
  27. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +157 -0
  28. package/templates/skills/business-analyse/schemas/sections/discovery-schema.json +82 -0
  29. package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +80 -0
  30. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +69 -0
  31. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +445 -0
  32. package/templates/skills/business-analyse/schemas/sections/validation-schema.json +93 -0
  33. package/templates/skills/business-analyse/schemas/shared/common-defs.json +133 -0
  34. package/templates/skills/business-analyse/steps/step-01-cadrage.md +22 -3
  35. package/templates/skills/business-analyse/steps/step-03-specify.md +129 -0
  36. package/templates/skills/business-analyse/steps/step-04-consolidation.md +38 -5
  37. package/templates/skills/business-analyse/steps/step-05-handoff.md +94 -218
@@ -0,0 +1,133 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "common-defs.json",
4
+ "title": "SmartStack BA - Shared Definitions",
5
+ "description": "Reusable $defs shared across all BA sub-schemas",
6
+
7
+ "$defs": {
8
+ "stepStatus": {
9
+ "type": "object",
10
+ "properties": {
11
+ "status": { "type": "string", "enum": ["pending", "in-progress", "completed", "skipped"] },
12
+ "startedAt": { "type": ["string", "null"], "format": "date-time" },
13
+ "completedAt": { "type": ["string", "null"], "format": "date-time" }
14
+ }
15
+ },
16
+
17
+ "moduleStatus": {
18
+ "type": "string",
19
+ "enum": ["draft", "framed", "analysed", "specified", "approved", "consolidated", "handed-off"]
20
+ },
21
+
22
+ "priority": {
23
+ "type": "string",
24
+ "enum": ["must", "should", "could"]
25
+ },
26
+
27
+ "roleLevel": {
28
+ "type": "string",
29
+ "enum": ["admin", "manager", "contributor", "viewer"]
30
+ },
31
+
32
+ "fileSpec": {
33
+ "type": "object",
34
+ "required": ["path", "type"],
35
+ "properties": {
36
+ "path": { "type": "string", "description": "Relative file path" },
37
+ "type": { "type": "string", "description": "File type (Entity, Service, DTO, Repository, Migration, HasData, Constants, ApiController, Page, DashboardPage, Component, ApiClient, ReduxSlice, UnitTests, IntegrationTests, Enum)" },
38
+ "linkedFRs": { "type": "array", "items": { "type": "string" }, "description": "Linked functional requirement IDs (FR-XXX)" },
39
+ "linkedUCs": { "type": "array", "items": { "type": "string" }, "description": "Linked use case IDs (UC-XXX)" },
40
+ "linkedWireframes": {
41
+ "type": "array",
42
+ "items": { "type": "string" },
43
+ "description": "Linked wireframe screen identifiers from specification.uiWireframes[].screen. MANDATORY for Page and DashboardPage types."
44
+ },
45
+ "wireframeAcceptanceCriteria": {
46
+ "type": "string",
47
+ "description": "Acceptance criteria describing how the implementation must match the wireframe layout. MANDATORY for Page and DashboardPage types."
48
+ },
49
+ "category": { "type": "string", "enum": ["core", "business"], "description": "SeedData category: core (navigation/permissions) or business (lookup tables)" },
50
+ "source": { "type": "string", "description": "Source path in feature.json for derivation" },
51
+ "description": { "type": "string" },
52
+ "pattern": { "type": "string", "description": "Reference pattern from existing codebase" },
53
+ "instructions": { "type": "string" },
54
+ "dashboardRef": { "type": "string", "description": "Reference to specification.dashboards[].code for DashboardPage type files" }
55
+ }
56
+ },
57
+
58
+ "resource": {
59
+ "type": "object",
60
+ "required": ["code", "type", "entity"],
61
+ "description": "Level 5 (Resource) - a SmartStack React component within a section",
62
+ "properties": {
63
+ "code": { "type": "string", "description": "Unique resource code (kebab-case: repair-grid, repair-form)" },
64
+ "type": {
65
+ "type": "string",
66
+ "enum": ["SmartTable", "SmartForm", "DetailCard", "KpiPanel", "KpiCard", "Timeline", "EntitySelect", "Chart", "Map", "FileUpload", "StatusBadge", "ActionMenu", "FilterBar", "Tabs"],
67
+ "description": "SmartStack React component type"
68
+ },
69
+ "entity": { "type": "string", "description": "Primary entity this resource displays/edits" },
70
+ "parentEntity": { "type": "string", "description": "Parent entity for child tables (e.g., RepairPart parent=Repair)" },
71
+ "permission": { "type": "string", "description": "Permission required for this resource" },
72
+ "columns": { "type": "array", "items": { "type": "string" }, "description": "For SmartTable: visible columns" },
73
+ "fields": {
74
+ "type": "array",
75
+ "description": "For SmartForm: form fields",
76
+ "items": {
77
+ "type": "object",
78
+ "required": ["name", "component"],
79
+ "properties": {
80
+ "name": { "type": "string" },
81
+ "component": { "type": "string", "enum": ["Input", "TextArea", "Select", "MultiSelect", "DatePicker", "DateRangePicker", "NumberInput", "Toggle", "EntitySelect", "FileUpload", "RichText", "ColorPicker"] },
82
+ "source": { "type": "string", "description": "Lookup table entity for Select/MultiSelect" },
83
+ "required": { "type": "boolean" },
84
+ "validation": { "type": "string" }
85
+ }
86
+ }
87
+ },
88
+ "actions": { "type": "array", "items": { "type": "string" }, "description": "Row/item actions (view, edit, delete, etc.)" },
89
+ "filters": { "type": "array", "items": { "type": "string" }, "description": "Available filter fields" },
90
+ "kpis": { "type": "array", "items": { "type": "string" }, "description": "For KpiPanel: entity fields to display as KPIs" },
91
+ "chartType": { "type": "string", "enum": ["bar", "line", "pie", "area", "donut", "stacked-bar"], "description": "For Chart resource" },
92
+ "dataSource": { "type": "string", "description": "API endpoint or entity for data" }
93
+ }
94
+ },
95
+
96
+ "suggestion": {
97
+ "type": "object",
98
+ "required": ["type", "code", "reason"],
99
+ "properties": {
100
+ "type": { "type": "string", "enum": ["module", "section", "integration", "enhancement"] },
101
+ "code": { "type": "string", "description": "Suggested module/section code (PascalCase)" },
102
+ "title": { "type": "string" },
103
+ "reason": { "type": "string", "description": "Why this is suggested based on the current analysis" },
104
+ "accepted": { "type": ["boolean", "null"], "description": "null = not yet answered, true = accepted, false = rejected" }
105
+ }
106
+ },
107
+
108
+ "changelogEntry": {
109
+ "type": "object",
110
+ "required": ["timestamp", "changes"],
111
+ "properties": {
112
+ "step": { "type": "string" },
113
+ "version": { "type": "string" },
114
+ "timestamp": { "type": "string", "format": "date-time" },
115
+ "author": { "type": "string" },
116
+ "changes": { "type": "array", "items": { "type": "string" } },
117
+ "warnings": { "type": "array", "items": { "type": "string" } },
118
+ "decision": { "type": "string" }
119
+ }
120
+ },
121
+
122
+ "documentation": {
123
+ "type": "object",
124
+ "description": "Documentation requirements captured during BA",
125
+ "properties": {
126
+ "userDocRequired": { "type": "boolean", "default": true },
127
+ "techDocRequired": { "type": "boolean", "default": false },
128
+ "generatedAt": { "type": ["string", "null"], "format": "date-time" },
129
+ "status": { "type": "string", "enum": ["pending", "generated", "skipped"], "default": "pending" }
130
+ }
131
+ }
132
+ }
133
+ }
@@ -116,7 +116,7 @@ Load these categories in order:
116
116
  - ULTRATHINK: Map stakeholders to application roles
117
117
 
118
118
  **Category 03 - Scope** (`questionnaire/03-scope.md`)
119
- - Q3.1-Q3.8: MoSCoW prioritization, flows, errors
119
+ - Q3.1-Q3.8: Priority levels (Essentiel/Important/Optionnel/Hors périmètre), flows, errors
120
120
  - 2 AskUserQuestion batches
121
121
  - ULTRATHINK: Ensure scope items map to modules
122
122
 
@@ -202,7 +202,25 @@ Classify per probability/impact:
202
202
  - High/Low or Low/High → Medium (monitor)
203
203
  - Low/Low → Low (accept)
204
204
 
205
- ### 9. Write Cadrage to Feature.json
205
+ ### 9. Coverage Matrix (MANDATORY)
206
+
207
+ BEFORE transitioning to step-02:
208
+
209
+ 1. Re-read the original prompt/brief in its entirety
210
+ 2. For EACH distinct feature/requirement mentioned:
211
+ a. Create an entry in cadrage.coverageMatrix[]
212
+ b. Assign it to mustHave, shouldHave, couldHave, or outOfScope
213
+ c. Assign the module that will cover it (or null if cross-cutting)
214
+ 3. Present the matrix to the client:
215
+ "Voici la matrice de couverture de votre brief. {N} fonctionnalités identifiées :"
216
+ (show as markdown table)
217
+ 4. Ask: "Y a-t-il des éléments que j'ai oublié ou mal classé ?"
218
+ 5. Iterate until the client confirms
219
+
220
+ **VALIDATION:** Every line of the original prompt must map to at least one coverageMatrix entry.
221
+ If a feature is in mustHave → it MUST have at least one UC in the corresponding module (verified in step-03).
222
+
223
+ ### 10. Write Cadrage to Feature.json
206
224
 
207
225
  Use ba-writer to enrich master feature.json:
208
226
 
@@ -225,6 +243,7 @@ ba-writer.enrichSection({
225
243
  applicationRoles: [{from section 6}],
226
244
  risks: [{from section 8}],
227
245
  acceptanceCriteria: [{derived from scope}],
246
+ coverageMatrix: [{from section 9}],
228
247
  codebaseContext: {codebase_context}
229
248
  }
230
249
  })
@@ -232,7 +251,7 @@ ba-writer.enrichSection({
232
251
  ba-writer.updateStatus({feature_id}, "framed")
233
252
  ```
234
253
 
235
- ### 10. Display Summary
254
+ ### 11. Display Summary
236
255
 
237
256
  ```
238
257
  ## Cadrage Complete - {feature_id}
@@ -18,6 +18,27 @@ next_step: steps/step-03-specify.md OR steps/step-04-consolidation.md (condition
18
18
  - ALL communication in `{language}`
19
19
  - NEVER skip per-module validation
20
20
  - **WIREFRAME RULE:** Every section MUST have a wireframe in `specification.uiWireframes[]`. No section without a validated mockup.
21
+ - **ID NAMING RULE (MANDATORY, NO EXCEPTION):**
22
+ All IDs MUST include a module prefix to guarantee application-wide uniqueness.
23
+ The prefix is derived from the module code initials (2-4 chars):
24
+ UserManagement → UM | VehicleManagement → VM | PartsInventory → PI
25
+ RepairManagement → RM | MaintenanceSchedule → MS | DataSync → DS
26
+ Notifications → NT | Dashboard → DB | Orders → OR | Customers → CU
27
+
28
+ Patterns:
29
+ UC-{PREFIX}-{NNN} → UC-RM-001, UC-PI-003
30
+ BR-{CAT}-{PREFIX}-{NNN} → BR-VAL-RM-001, BR-CALC-PI-002
31
+ FR-{PREFIX}-{NNN} → FR-RM-001
32
+ OBJ-{PREFIX}-{NNN} → OBJ-RM-001
33
+ AC-{PREFIX}-{NNN} → AC-RM-001
34
+ RISK-{PREFIX}-{NNN} → RISK-RM-001
35
+
36
+ NEVER use bare IDs (UC-001, BR-VAL-001) in multi-module mode.
37
+ - **SCHEMA CONFORMITY RULE:**
38
+ ALL data MUST fit within the defined feature-schema.json structure.
39
+ NEVER create custom top-level fields (KPIDefinitions, ChartConfigurations, etc.)
40
+ Dashboard modules MUST use specification.dashboards[] (it exists in the schema).
41
+ If truly needed, use specification.extensions: {} (additionalProperties: true).
21
42
 
22
43
  ## YOUR TASK
23
44
 
@@ -58,6 +79,40 @@ ba-reader.readApplicationContext({feature_id})
58
79
 
59
80
  Update module status in master: "pending" → "in-progress"
60
81
 
82
+ ### 2-bis. Coverage Verification (MANDATORY)
83
+
84
+ > **Before specifying any module, verify that the coverageMatrix from cadrage covers this module.**
85
+
86
+ ```
87
+ ba-reader.readApplicationContext({feature_id})
88
+ → Read cadrage.coverageMatrix[]
89
+ → Filter entries where module = {currentModule.code}
90
+ → Group by category: mustHave, shouldHave, couldHave
91
+ ```
92
+
93
+ Display to client:
94
+ ```
95
+ Module {currentModule}: Coverage from original brief
96
+
97
+ | # | Requirement | Category |
98
+ |---|-------------|----------|
99
+ | 1 | {item} | {category} |
100
+ | ... | ... | ... |
101
+
102
+ Total: {N} requirements mapped to this module
103
+ - Must-have: {count}
104
+ - Should-have: {count}
105
+ - Could-have: {count}
106
+ ```
107
+
108
+ **VALIDATION:** If mustHave count = 0 AND module is in must priority:
109
+ → WARNING: "Module {currentModule} is must-priority but has no must-have requirements in coverageMatrix. Verify cadrage coverage."
110
+
111
+ **POST-SPECIFICATION CHECK (at end of module, before advancing):**
112
+ For EACH mustHave item in coverageMatrix for this module:
113
+ → Verify at least 1 UC exists that covers this requirement
114
+ → If uncovered: BLOCK and ask client to either add a UC or reclassify the requirement
115
+
61
116
  ### 3. Section Walkthrough with Client
62
117
 
63
118
  > **This is the key interactive phase aligned with the 5-level SmartStack hierarchy.**
@@ -94,6 +149,54 @@ options:
94
149
  description: "Tableau de bord avec KPIs, graphiques (Recharts) et métriques clés"
95
150
  ```
96
151
 
152
+ #### 3a-bis. Structure Sections with Resources (Levels 4 & 5)
153
+
154
+ For EACH section confirmed in 3a, build the `specification.sections[]` structure:
155
+
156
+ 1. For each resource in the section, determine:
157
+ - The SmartStack component type (SmartTable, SmartForm, DetailCard, KpiPanel, Chart, Map, Timeline, etc.)
158
+ - The entity it operates on
159
+ - Columns/fields based on entity attributes
160
+ - Permission (inherit from section or more specific)
161
+ - Available actions
162
+
163
+ 2. Link use cases to sections:
164
+ - Each UC MUST belong to exactly ONE section
165
+ - Map UC to section based on the primary action (list → UC-XX-001, create → UC-XX-003, etc.)
166
+
167
+ 3. Link business rules to sections:
168
+ - Each BR can belong to one or more sections
169
+ - Map BR based on where it's enforced (validation BR → create/edit section, calc BR → detail section)
170
+
171
+ 4. Build the section object:
172
+ ```json
173
+ {
174
+ "code": "list",
175
+ "labels": { "fr": "Liste", "en": "List", "it": "Elenco", "de": "Liste" },
176
+ "route": "/business/{app}/{module}/list",
177
+ "icon": "list",
178
+ "permission": "business.{app}.{module}.read",
179
+ "wireframe": "{module}-list",
180
+ "useCases": ["UC-{PREFIX}-001", "UC-{PREFIX}-002"],
181
+ "businessRules": ["BR-VAL-{PREFIX}-001"],
182
+ "resources": [
183
+ {
184
+ "code": "{module}-grid",
185
+ "type": "SmartTable",
186
+ "entity": "{MainEntity}",
187
+ "permission": "business.{app}.{module}.read",
188
+ "columns": ["name", "status", "createdAt"],
189
+ "actions": ["view", "edit", "delete"],
190
+ "filters": ["status", "dateRange"]
191
+ }
192
+ ]
193
+ }
194
+ ```
195
+
196
+ 5. Write `specification.sections[]` via ba-writer.enrichSection()
197
+
198
+ **VALIDATION:** Every UC must appear in exactly one section.useCases[]. No orphan UCs.
199
+
97
200
  #### 3b. For Each Section: Generate MANDATORY ASCII Mockup
98
201
 
99
202
  > **BLOCKING RULE:** Every section MUST have a wireframe. No section proceeds to entity definition (step 6) without a validated mockup stored in `specification.uiWireframes[]`.
@@ -156,6 +259,32 @@ After client validates the mockup, map each wireframe element to a SmartStack Re
156
259
 
157
260
  Store the component mapping alongside the wireframe to ensure downstream skills use the correct components.
158
261
 
262
+ #### 3b-ter. Generate Structural Layout
263
+
264
+ For EACH wireframe generated in 3b, generate a `layout` object alongside the ASCII mockup:
265
+
266
+ 1. From the ASCII mockup, extract the visual regions (header, toolbar, main content, sidebar, etc.)
267
+ 2. For each region, map the visual elements to SmartStack component types
268
+ 3. Build the layout structure:
269
+ ```json
270
+ {
271
+ "type": "page",
272
+ "regions": [
273
+ { "id": "toolbar", "position": "top", "components": [
274
+ { "type": "FilterBar", "resourceRef": "{module}-filters" },
275
+ { "type": "ActionMenu", "resourceRef": "{module}-actions", "permission": "business.{app}.{module}.create" }
276
+ ]},
277
+ { "id": "content", "position": "main", "span": 12, "components": [
278
+ { "type": "SmartTable", "resourceRef": "{module}-grid" }
279
+ ]}
280
+ ]
281
+ }
282
+ ```
283
+ 4. Cross-validate: each component in layout.regions[].components[] MUST have a corresponding resource in sections[].resources[]
284
+ 5. Write layout alongside mockup in uiWireframes[]
285
+
286
+ **RULE:** The layout is the source of truth for ralph-loop. The mockup is for human validation only.
287
+
159
288
  #### 3c. Identify Resources per Section
160
289
 
161
290
  For each section, identify what resources/components are needed:
@@ -175,7 +175,40 @@ options:
175
175
  description: "Le Manager devrait aussi pouvoir approuver les factures"
176
176
  ```
177
177
 
178
- ### 4. End-to-End Flows
178
+ ### 4. Semantic Validation (MANDATORY)
179
+
180
+ For EACH module feature.json, execute these checks:
181
+
182
+ | # | Check | Rule | Severity |
183
+ |---|-------|------|----------|
184
+ | 1 | Permission orpheline | Every permissionMatrix.permissions[].path is used by at least one useCases[].permission | WARNING |
185
+ | 2 | UC sans FR | Every useCases[].id is referenced by at least one functionalRequirements[].linkedUseCases[] | WARNING |
186
+ | 3 | Entity sans endpoint | Every entities[].name has at least one endpoint in apiEndpoints[] | WARNING |
187
+ | 4 | UC sans scenario | Every useCases[].mainScenario has at least 2 steps | WARNING |
188
+ | 5 | Role sans permissions | Every applicationRole has at least one entry in roleAssignments[] | WARNING |
189
+ | 6 | Navigation sans traduction | Every navigation.entries[].code has translations in 4 languages in seedDataCore.navigationTranslations[] | ERROR |
190
+ | 7 | LifeCycle terminal | Every lifeCycles[].states[] has at least one state with isTerminal: true | WARNING |
191
+ | 8 | Schema conformity | No custom fields outside defined schema (no KPIDefinitions, ChartConfigurations, etc.) | ERROR |
192
+ | 9 | Wireframe coverage | Every navigation section has a corresponding uiWireframes[].screen | ERROR |
193
+ | 10 | Doublon entity | No entity with same name in two different modules (unless shared via dependencyGraph) | ERROR |
194
+
195
+ Store results in consolidation.semanticChecks[]:
196
+ ```json
197
+ {
198
+ "check": "permission-orpheline",
199
+ "module": "RepairManagement",
200
+ "status": "PASS|WARNING|ERROR",
201
+ "details": "Permission business.freebike.repairmanagement.export not referenced by any UC",
202
+ "autoFixed": false
203
+ }
204
+ ```
205
+
206
+ **Blocking rule:**
207
+ - 0 ERROR → PASS
208
+ - ≥1 ERROR → BLOCK (fix before handoff, ask user for each)
209
+ - WARNING only → PASS with user notification
210
+
211
+ ### 5. End-to-End Flows
179
212
 
180
213
  Identify business processes that span multiple modules:
181
214
 
@@ -206,7 +239,7 @@ Customer ──[read]──→ Order ──[create]──→ Order ──[approv
206
239
  Contributor Contributor Manager System Manager
207
240
  ```
208
241
 
209
- ### 5. Global Risk Assessment
242
+ ### 6. Global Risk Assessment
210
243
 
211
244
  Evaluate application-level risks:
212
245
 
@@ -219,7 +252,7 @@ Evaluate application-level risks:
219
252
  | E2E flow length | {max steps} | ≤8 | PASS/WARNING |
220
253
  | Permission paths | {total} | ≤100 | PASS/WARNING |
221
254
 
222
- ### 6. Consolidation Summary
255
+ ### 7. Consolidation Summary
223
256
 
224
257
  Display comprehensive summary:
225
258
  ```
@@ -252,7 +285,7 @@ Display comprehensive summary:
252
285
  ═══════════════════════════════════════════════════════════
253
286
  ```
254
287
 
255
- ### 7. Final Client Approval (BLOCKING)
288
+ ### 8. Final Client Approval (BLOCKING)
256
289
 
257
290
  Ask via AskUserQuestion:
258
291
  ```
@@ -273,7 +306,7 @@ IF "Réviser un module":
273
306
  IF "Modifier les interactions":
274
307
  Re-enter section 2-4 of this step
275
308
 
276
- ### 8. Write Consolidation
309
+ ### 9. Write Consolidation
277
310
 
278
311
  ```
279
312
  ba-writer.enrichSection({