@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlashub/smartstack-cli",
3
- "version": "2.6.2",
3
+ "version": "2.7.0",
4
4
  "description": "SmartStack Claude Code automation toolkit - GitFlow, APEX, EF Core migrations, prompts and more",
5
5
  "author": {
6
6
  "name": "SmartStack",
@@ -133,6 +133,29 @@ Permissions: business.sales.products.{read|create|update}
133
133
  FKs exposed: Product.Id, Category.Id
134
134
  ```
135
135
 
136
+ ### listAllModuleIds
137
+ List all UC, BR, FR IDs across all specified module feature.json files. Used by ba-writer for collision detection.
138
+
139
+ **Input:**
140
+ - applicationFeatureId: FEAT-NNN (master)
141
+
142
+ **Process:**
143
+ 1. Read master feature.json → get modules[].code and modules[].featureJsonPath
144
+ 2. For each module with status "specified" or "handed-off":
145
+ a. Read module feature.json
146
+ b. Extract: specification.useCases[].id, analysis.businessRules[].id, specification.functionalRequirements[].id
147
+ 3. Return map of all IDs per module
148
+
149
+ **Output:**
150
+ ```json
151
+ {
152
+ "UserManagement": { "ucIds": ["UC-UM-001", "UC-UM-002"], "brIds": ["BR-VAL-UM-001"], "frIds": ["FR-UM-001"] },
153
+ "RepairManagement": { "ucIds": ["UC-RM-001"], "brIds": ["BR-VAL-RM-001"], "frIds": ["FR-RM-001"] }
154
+ }
155
+ ```
156
+
157
+ Used by: ba-writer.enrichSection() for ID collision check before writing specification section.
158
+
136
159
  ### readSection
137
160
  Extract and format a specific section from a feature.json.
138
161
 
@@ -72,7 +72,35 @@ Merge a section into an existing feature.json.
72
72
  5. Update metadata.updatedBy with agent name
73
73
  6. Write back with pretty-print (2-space indent)
74
74
  7. Validate schema before writing
75
- 8. Return confirmation with section size and status
75
+ 8. **ID Collision Check (for specification section):**
76
+ a. Extract all IDs from the data being written (UC-*, BR-*, FR-*)
77
+ b. Via ba-reader.listAllModuleIds(), list all IDs from ALREADY-SPECIFIED modules
78
+ c. If ANY collision detected → BLOCK write, list collisions with module names
79
+ d. The calling step MUST fix the IDs before retrying
80
+ 9. **Cross-Reference Validation (for specification and handoff sections):** See CROSS-REFERENCE VALIDATION section below
81
+ 10. Return confirmation with section size and status
82
+
83
+ ### enrichModuleHandoff
84
+ Write the handoff section into a module feature.json. Specialized operation for step-05 module loop.
85
+
86
+ **Input:**
87
+ - moduleFeatureId: FEAT-NNN or path to module feature.json
88
+ - handoffData: { complexity, filesToCreate, brToCodeMapping, apiEndpointSummary, prdFile, totalFiles, totalTasks, handedOffAt }
89
+
90
+ **Process:**
91
+ 1. Locate the module feature.json via findFeature
92
+ 2. Validate handoffData.filesToCreate has all 7 categories (domain, application, infrastructure, api, frontend, seedData, tests)
93
+ 3. Validate each fileSpec has at minimum path + type
94
+ 4. Validate brToCodeMapping[].ruleId references exist in analysis.businessRules[].id
95
+ 5. Write the handoff section
96
+ 6. Update status → "handed-off"
97
+ 7. **POST-WRITE VERIFICATION:** Re-read the module feature.json and confirm:
98
+ - handoff !== {}
99
+ - handoff.filesToCreate contains all 7 categories
100
+ - handoff.brToCodeMapping.length > 0
101
+ - status === "handed-off"
102
+ 8. IF verification fails → return error with details
103
+ 9. Return confirmation with stats (files per category, total BRs mapped)
76
104
 
77
105
  ### updateStatus
78
106
  Transition the status through defined workflow.
@@ -173,9 +201,9 @@ Perform these structural checks before every write:
173
201
 
174
202
  **ID Patterns:**
175
203
  - id: must match `FEAT-\d{3}` (e.g., FEAT-001)
176
- - BR IDs: must match `BR-(VAL|CALC|WF|SEC|DATA)-\d{3}` (e.g., BR-SEC-042)
177
- - UC IDs: must match `UC-\d{3}` (e.g., UC-007)
178
- - FR IDs: must match `FR-\d{3}` (e.g., FR-012)
204
+ - BR IDs: must match `BR-(VAL|CALC|WF|SEC|DATA)-[A-Z]{2,4}-\d{3}` (e.g., BR-SEC-RM-042) — module prefix MANDATORY in multi-module mode
205
+ - UC IDs: must match `UC-[A-Z]{2,4}-\d{3}` (e.g., UC-RM-007) — module prefix MANDATORY in multi-module mode
206
+ - FR IDs: must match `FR-[A-Z]{2,4}-\d{3}` (e.g., FR-RM-012) — module prefix MANDATORY in multi-module mode
179
207
  - Permission paths: must match `business\.{app}\.{module}\.{resource}\.{action}` (e.g., business.crm.contacts.read)
180
208
 
181
209
  **Metadata:**
@@ -227,6 +255,37 @@ Versions are stored as separate files in versioned directories. Always store fea
227
255
  - Update on every create operation
228
256
  - Read before write to avoid conflicts
229
257
 
258
+ ## CROSS-REFERENCE VALIDATION (MANDATORY)
259
+
260
+ Before EVERY enrichSection() call for specification or handoff sections, validate referential integrity.
261
+
262
+ ### After enrichSection("specification")
263
+ 1. Build SET_BR from analysis.businessRules[].id
264
+ 2. For each useCases[].linkedRules[] → verify ∈ SET_BR
265
+ 3. For each functionalRequirements[].linkedRules[] → verify ∈ SET_BR
266
+ 4. Build SET_UC from useCases[].id
267
+ 5. For each functionalRequirements[].linkedUseCases[] → verify ∈ SET_UC
268
+ 6. Build SET_PERM from permissionMatrix.permissions[].path
269
+ 7. For each roleAssignments[].permissions[] → verify ∈ SET_PERM
270
+ 8. Build SET_SCREEN from uiWireframes[].screen
271
+ 9. For each sections[].wireframe → verify ∈ SET_SCREEN
272
+
273
+ ### After enrichSection("handoff")
274
+ 1. Build SET_FR from specification.functionalRequirements[].id
275
+ 2. Build SET_UC from specification.useCases[].id
276
+ 3. Build SET_SCREEN from specification.uiWireframes[].screen
277
+ 4. Build SET_BR from analysis.businessRules[].id
278
+ 5. For each filesToCreate.*[].linkedFRs[] → verify ∈ SET_FR
279
+ 6. For each filesToCreate.*[].linkedUCs[] → verify ∈ SET_UC
280
+ 7. For each filesToCreate.*[].linkedWireframes[] → verify ∈ SET_SCREEN
281
+ 8. For each brToCodeMapping[].ruleId → verify ∈ SET_BR
282
+
283
+ ### On violation
284
+ - LIST all violations (do not stop at first)
285
+ - AUTO-FIX: remove dangling refs, add missing items if source data exists
286
+ - LOG in changelog[] with warning
287
+ - NEVER write a feature.json with broken references
288
+
230
289
  ## Execution Rules
231
290
 
232
291
  1. **Always read before write** - merge with existing content when enriching
@@ -149,7 +149,7 @@ Q0.8: "Quel rôle par défaut pour les nouveaux utilisateurs ?"
149
149
  | Anti-pattern | Signal | Action |
150
150
  |--------------|--------|--------|
151
151
  | Too many modules | > 10 modules for v1 | Suggest phased approach: core modules first |
152
- | No clear priority | "Everything is must-have" | Apply MoSCoW: "If you could only ship 3 modules?" |
152
+ | No clear priority | "Everything is must-have" | Challenge priorities: "If you could only ship 3 modules?" |
153
153
  | Role confusion | Mixing business roles with system roles | Clarify: "We're defining system access levels, not job titles" |
154
154
  | Monolithic thinking | "It's all one big module" | Challenge: "Could a user only need access to part of this?" |
155
155
 
@@ -1,11 +1,11 @@
1
1
  # Category 3: Functional Scope
2
2
 
3
- > **Usage:** Scope definition with MoSCoW
3
+ > **Usage:** Scope definition with priority levels
4
4
  > **When to load:** ALWAYS (core)
5
5
 
6
6
  ---
7
7
 
8
- ## 3.1 Functionality (MoSCoW)
8
+ ## 3.1 Functionality (Priority Levels)
9
9
 
10
10
  | # | Question | Answer Type |
11
11
  |---|----------|-------------|
@@ -311,7 +311,7 @@ Each question kept passes this test:
311
311
  | 0. Application Identity | 8 | step-01 (app mode) | Application name, modules, roles |
312
312
  | 1. Business Context | 4 | step-01 | Problem + AS-IS/TO-BE |
313
313
  | 2. Stakeholders | 8 | step-01 | Roles + needs |
314
- | 3. Functional Scope | 8 | step-01 | MoSCoW + flows |
314
+ | 3. Functional Scope | 8 | step-01 | Priority levels + flows |
315
315
  | 4. Data | 8 | step-03 (per module) | Entities + rules |
316
316
  | 5. Integrations | 8 | step-01 (conditional) | Systems + flows |
317
317
  | 6. Security | 8 | step-01 (conditional) | Permissions + restrictions |
@@ -62,7 +62,7 @@ Displays the application-level framing:
62
62
  | AS-IS | cadrage.asIs | Text block |
63
63
  | TO-BE | cadrage.toBe | Text block |
64
64
  | Stakeholders | cadrage.stakeholders | Table: role, description, frequency |
65
- | Global Scope | cadrage.globalScope | MoSCoW badges: Must/Should/Could/Out |
65
+ | Global Scope | cadrage.globalScope | Priority badges: Essentiel/Important/Optionnel/Exclu |
66
66
  | Risks | cadrage.risks | Severity-colored cards |
67
67
 
68
68
  ### Tab: Modules
@@ -347,6 +347,84 @@ export interface FeatureSpecification {
347
347
  lifeCycles: EntityLifeCycle[];
348
348
  seedDataCore: SeedDataCore;
349
349
  i18nKeys: I18nKey[];
350
+ sections: Section[];
351
+ dashboards: Dashboard[];
352
+ extensions?: Record<string, unknown>;
353
+ }
354
+
355
+ // --- Sections & Resources (Levels 4-5) ---
356
+
357
+ export interface Section {
358
+ code: string;
359
+ labels: Record<'fr' | 'en' | 'it' | 'de', string>;
360
+ route: string;
361
+ icon: string;
362
+ permission: string;
363
+ wireframe: string;
364
+ useCases: string[];
365
+ businessRules: string[];
366
+ resources: Resource[];
367
+ }
368
+
369
+ export interface Resource {
370
+ code: string;
371
+ type: ResourceType;
372
+ entity: string;
373
+ parentEntity?: string;
374
+ permission: string;
375
+ columns?: string[];
376
+ fields?: FormField[];
377
+ actions?: string[];
378
+ filters?: string[];
379
+ kpis?: string[];
380
+ chartType?: ChartType;
381
+ dataSource?: string;
382
+ }
383
+
384
+ export type ResourceType = 'SmartTable' | 'SmartForm' | 'DetailCard' | 'KpiPanel' | 'KpiCard'
385
+ | 'Timeline' | 'EntitySelect' | 'Chart' | 'Map' | 'FileUpload' | 'StatusBadge'
386
+ | 'ActionMenu' | 'FilterBar' | 'Tabs';
387
+
388
+ export type ChartType = 'bar' | 'line' | 'pie' | 'area' | 'donut' | 'stacked-bar';
389
+
390
+ export interface FormField {
391
+ name: string;
392
+ component: FormComponent;
393
+ source?: string;
394
+ required?: boolean;
395
+ validation?: string;
396
+ }
397
+
398
+ export type FormComponent = 'Input' | 'TextArea' | 'Select' | 'MultiSelect' | 'DatePicker'
399
+ | 'DateRangePicker' | 'NumberInput' | 'Toggle' | 'EntitySelect' | 'FileUpload'
400
+ | 'RichText' | 'ColorPicker';
401
+
402
+ export interface Dashboard {
403
+ code: string;
404
+ title: string;
405
+ description: string;
406
+ linkedUCs: string[];
407
+ refreshMode: 'static' | 'polling' | 'signalr';
408
+ defaultPeriod: 'day' | 'week' | 'month' | 'quarter' | 'year';
409
+ kpis: DashboardKpi[];
410
+ filters: DashboardFilter[];
411
+ permissionsRequired: string[];
412
+ }
413
+
414
+ export interface DashboardKpi {
415
+ code: string;
416
+ label: string;
417
+ metric: string;
418
+ format: 'number' | 'currency' | 'percent' | 'duration';
419
+ visualization: 'kpi-card' | 'bar' | 'line' | 'pie' | 'area' | 'donut' | 'stacked-bar';
420
+ dataSource: string;
421
+ dimensions?: string[];
422
+ }
423
+
424
+ export interface DashboardFilter {
425
+ field: string;
426
+ type: 'dateRange' | 'select' | 'multiselect' | 'search';
427
+ label: string;
350
428
  }
351
429
 
352
430
  export interface ValidationRule {
@@ -744,6 +822,15 @@ export type {
744
822
  BrToCodeMapping,
745
823
  ValidationDecision,
746
824
  FeatureSuggestion,
747
- ChangelogEntry
825
+ ChangelogEntry,
826
+ Section,
827
+ Resource,
828
+ ResourceType,
829
+ FormField,
830
+ FormComponent,
831
+ Dashboard,
832
+ DashboardKpi,
833
+ DashboardFilter,
834
+ ChartType
748
835
  } from './business-analyse';
749
836
  ```
@@ -162,6 +162,21 @@
162
162
  "codebaseContext": {
163
163
  "type": "string",
164
164
  "description": "Summary of existing modules/patterns found during pre-research"
165
+ },
166
+ "coverageMatrix": {
167
+ "type": "array",
168
+ "description": "Maps every requirement from the original brief/prompt to a scope category. Ensures nothing is lost silently.",
169
+ "items": {
170
+ "type": "object",
171
+ "required": ["item", "category", "module"],
172
+ "properties": {
173
+ "item": { "type": "string", "description": "Requirement from the original brief" },
174
+ "category": { "type": "string", "enum": ["mustHave", "shouldHave", "couldHave", "outOfScope", "implicit"] },
175
+ "module": { "type": ["string", "null"], "description": "Module code that covers this requirement (null if cross-cutting)" },
176
+ "ucRef": { "type": ["string", "null"], "description": "UC ID if already assigned" },
177
+ "notes": { "type": "string" }
178
+ }
179
+ }
165
180
  }
166
181
  }
167
182
  },
@@ -202,7 +217,7 @@
202
217
  "priority": {
203
218
  "type": "string",
204
219
  "enum": ["must", "should", "could"],
205
- "description": "MoSCoW priority from global scope"
220
+ "description": "Priority level from global scope"
206
221
  },
207
222
  "sortOrder": {
208
223
  "type": "integer",