@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
@@ -1,8 +1,9 @@
1
1
  # TypeScript Schema - Feature JSON Types
2
2
 
3
- > **Usage:** TypeScript interfaces aligned with feature-schema.json
4
- > **Loaded in:** step-04-handoff.md (for web app rendering)
5
- > **Source:** `docs/business/{app}/{module}/business-analyse/v{X.Y}/feature.json`
3
+ > **Usage:** TypeScript interfaces aligned with feature-schema.json and application-schema.json
4
+ > **Loaded in:** step-05-handoff.md (for web app rendering)
5
+ > **Source (module):** `docs/business/{app}/{module}/business-analyse/v{X.Y}/feature.json`
6
+ > **Source (application):** `docs/business/{app}/business-analyse/v{X.Y}/feature.json`
6
7
 
7
8
  ---
8
9
 
@@ -11,8 +12,179 @@
11
12
  ```typescript
12
13
  // web/smartstack-web/src/types/business-analyse.ts
13
14
 
15
+ // ===================================================================
16
+ // APPLICATION-LEVEL TYPES (master feature.json, scope: "application")
17
+ // ===================================================================
18
+
19
+ /**
20
+ * Application-level Feature JSON structure
21
+ * Matches schemas/application-schema.json
22
+ * Master document for multi-module BA
23
+ */
24
+ export interface ApplicationFeatureJson {
25
+ id: string; // FEAT-XXX
26
+ version: string;
27
+ status: ApplicationStatus;
28
+ scope: 'application';
29
+ metadata: ApplicationMetadata;
30
+ cadrage: ApplicationCadrage;
31
+ modules: ApplicationModule[];
32
+ dependencyGraph: DependencyGraph;
33
+ consolidation: ApplicationConsolidation;
34
+ suggestions: FeatureSuggestion[];
35
+ changelog: ChangelogEntry[];
36
+ }
37
+
38
+ export type ApplicationStatus = 'draft' | 'framed' | 'decomposed' | 'specified' | 'consolidated' | 'handed-off';
39
+
40
+ export interface ApplicationMetadata {
41
+ application: string;
42
+ language: string;
43
+ featureDescription: string;
44
+ scope: 'application';
45
+ createdAt: string;
46
+ updatedAt: string;
47
+ workflow: WorkflowState;
48
+ }
49
+
50
+ export interface WorkflowState {
51
+ mode: 'application' | 'module';
52
+ moduleOrder: string[];
53
+ currentModuleIndex: number;
54
+ completedModules: string[];
55
+ currentModule: string | null;
56
+ }
57
+
58
+ export interface ApplicationCadrage {
59
+ problem: string;
60
+ asIs: string;
61
+ toBe: string;
62
+ trigger: string;
63
+ stakeholders: Stakeholder[];
64
+ globalScope: GlobalScope;
65
+ applicationRoles: ApplicationRole[];
66
+ risks: Risk[];
67
+ acceptanceCriteria: AcceptanceCriterion[];
68
+ codebaseContext?: Record<string, unknown>;
69
+ }
70
+
71
+ export interface GlobalScope {
72
+ mustHave: string[];
73
+ shouldHave: string[];
74
+ couldHave: string[];
75
+ outOfScope: string[];
76
+ }
77
+
78
+ export interface ApplicationRole {
79
+ name: string;
80
+ level: 'admin' | 'manager' | 'contributor' | 'viewer';
81
+ description: string;
82
+ defaultPermissions: string[];
83
+ moduleRestrictions?: string[];
84
+ }
85
+
86
+ export interface ApplicationModule {
87
+ code: string;
88
+ description: string;
89
+ featureType: string;
90
+ entities: string[];
91
+ priority: 'must' | 'should' | 'could';
92
+ estimatedComplexity: 'simple' | 'medium' | 'complex';
93
+ status: 'pending' | 'in-progress' | 'specified' | 'validated';
94
+ featureJsonPath?: string;
95
+ sortOrder: number;
96
+ dependencies: string[];
97
+ dependents: string[];
98
+ }
99
+
100
+ export interface DependencyGraph {
101
+ edges: DependencyEdge[];
102
+ topologicalOrder: string[];
103
+ layers: DependencyLayer[];
104
+ }
105
+
106
+ export interface DependencyEdge {
107
+ from: string;
108
+ to: string;
109
+ type: 'FK' | 'Event' | 'Shared-entity' | 'Lookup';
110
+ description: string;
111
+ }
112
+
113
+ export interface DependencyLayer {
114
+ layer: number;
115
+ modules: string[];
116
+ }
117
+
118
+ export interface ApplicationConsolidation {
119
+ crossModuleInteractions: CrossModuleInteractions;
120
+ permissionCoherence: PermissionCoherence;
121
+ e2eFlows: E2EFlow[];
122
+ globalRiskAssessment: Record<string, unknown>;
123
+ }
124
+
125
+ export interface CrossModuleInteractions {
126
+ fkReferences: FKReference[];
127
+ sharedEntities: SharedEntity[];
128
+ events: ModuleEvent[];
129
+ sharedReferenceData: SharedReferenceData[];
130
+ }
131
+
132
+ export interface FKReference {
133
+ sourceModule: string;
134
+ sourceEntity: string;
135
+ sourceField: string;
136
+ targetModule: string;
137
+ targetEntity: string;
138
+ targetField: string;
139
+ required: boolean;
140
+ }
141
+
142
+ export interface SharedEntity {
143
+ entity: string;
144
+ definedIn: string;
145
+ referencedBy: string[];
146
+ referenceType: string;
147
+ }
148
+
149
+ export interface ModuleEvent {
150
+ producer: string;
151
+ event: string;
152
+ consumers: string[];
153
+ description: string;
154
+ }
155
+
156
+ export interface SharedReferenceData {
157
+ table: string;
158
+ usedBy: string[];
159
+ owner: string;
160
+ }
161
+
162
+ export interface PermissionCoherence {
163
+ roleConsistency: boolean;
164
+ pathFormatValid: boolean;
165
+ hierarchyRespected: boolean;
166
+ conflictsResolved: number;
167
+ }
168
+
169
+ export interface E2EFlow {
170
+ name: string;
171
+ steps: E2EFlowStep[];
172
+ actors: string[];
173
+ data: string;
174
+ }
175
+
176
+ export interface E2EFlowStep {
177
+ module: string;
178
+ action: string;
179
+ permission: string;
180
+ }
181
+
182
+ // ===================================================================
183
+ // MODULE-LEVEL TYPES (per-module feature.json, scope: "module")
184
+ // ===================================================================
185
+
14
186
  /**
15
- * Complete Feature JSON structure
187
+ * Module-level Feature JSON structure
16
188
  * Matches schemas/feature-schema.json
17
189
  * Progressively enriched by each BA step
18
190
  */
@@ -20,7 +192,9 @@ export interface FeatureJson {
20
192
  id: string; // FEAT-XXX
21
193
  version: string; // 1.0, 1.1, etc.
22
194
  status: FeatureStatus;
195
+ scope?: 'module';
23
196
  metadata: FeatureMetadata;
197
+ applicationContext?: ApplicationContext;
24
198
  discovery: FeatureDiscovery;
25
199
  analysis: FeatureAnalysis;
26
200
  specification: FeatureSpecification;
@@ -30,18 +204,27 @@ export interface FeatureJson {
30
204
  changelog: ChangelogEntry[];
31
205
  }
32
206
 
33
- export type FeatureStatus = 'draft' | 'analysed' | 'specified' | 'approved' | 'handed-off';
207
+ export type FeatureStatus = 'draft' | 'framed' | 'analysed' | 'decomposed' | 'specified' | 'consolidated' | 'approved' | 'handed-off';
34
208
 
35
209
  export interface FeatureMetadata {
36
210
  application: string;
37
211
  module: string;
38
212
  language: string;
39
213
  featureType: 'new' | 'refactoring' | 'micro';
214
+ scope?: 'application' | 'module';
215
+ applicationRef?: string | null;
216
+ moduleIndex?: number | null;
40
217
  createdAt: string;
41
218
  updatedAt: string;
42
219
  previousVersion: string | null;
43
220
  }
44
221
 
222
+ export interface ApplicationContext {
223
+ applicationRoles: ApplicationRole[];
224
+ permissionBase: string;
225
+ relatedModules: string[];
226
+ }
227
+
45
228
  // --- Discovery ---
46
229
 
47
230
  export interface FeatureDiscovery {
@@ -137,7 +320,7 @@ export interface EntityAttribute {
137
320
 
138
321
  export interface EntityRelationship {
139
322
  target: string;
140
- type: 'OneToMany' | 'ManyToOne' | 'ManyToMany' | 'OneToOne';
323
+ type: '1:1' | '1:N' | 'N:1' | 'N:M';
141
324
  description: string;
142
325
  }
143
326
 
@@ -158,9 +341,91 @@ export interface FeatureSpecification {
158
341
  navigation: NavigationHierarchy;
159
342
  gherkinScenarios: GherkinScenario[];
160
343
  apiEndpoints: ApiEndpoint[];
344
+ validations: ValidationRule[];
345
+ wireframes: Wireframe[];
346
+ messages: BusinessMessage[];
347
+ lifeCycles: EntityLifeCycle[];
348
+ seedDataCore: SeedDataCore;
161
349
  i18nKeys: I18nKey[];
162
350
  }
163
351
 
352
+ export interface ValidationRule {
353
+ field: string;
354
+ rules: string;
355
+ errorMessage: string;
356
+ }
357
+
358
+ export interface Wireframe {
359
+ screen: string;
360
+ section?: string; // Section code (list, detail, create, etc.)
361
+ description: string;
362
+ mockupFormat?: 'ascii' | 'svg'; // Format of the mockup
363
+ mockup?: string; // ASCII art or inline SVG content
364
+ elements: string[];
365
+ actions: string[];
366
+ permissionsRequired: string[];
367
+ }
368
+
369
+ export interface BusinessMessage {
370
+ code: string; // SCREAMING_SNAKE_CASE
371
+ type: 'success' | 'error' | 'warning' | 'info';
372
+ title: string;
373
+ message: string; // User-facing with {placeholders}
374
+ i18nKey: string; // Dot-separated key
375
+ }
376
+
377
+ export interface EntityLifeCycle {
378
+ entity: string; // PascalCase entity name
379
+ states: LifeCycleState[];
380
+ }
381
+
382
+ export interface LifeCycleState {
383
+ id: string; // State code (Draft, Active, etc.)
384
+ displayName: string;
385
+ description?: string;
386
+ allowedTransitions: string[];
387
+ isTerminal: boolean;
388
+ }
389
+
390
+ export interface SeedDataCore {
391
+ navigationModules: SeedDataNavModule[];
392
+ navigationTranslations: SeedDataNavTranslation[];
393
+ permissions: SeedDataPermission[];
394
+ rolePermissions: SeedDataRolePermission[];
395
+ permissionConstants: SeedDataPermissionConstant[];
396
+ }
397
+
398
+ export interface SeedDataNavModule {
399
+ code: string;
400
+ label: string;
401
+ icon: string;
402
+ route: string;
403
+ parentCode: string | null;
404
+ sort: number;
405
+ }
406
+
407
+ export interface SeedDataNavTranslation {
408
+ moduleCode: string;
409
+ language: 'fr' | 'en' | 'it' | 'de';
410
+ label: string;
411
+ }
412
+
413
+ export interface SeedDataPermission {
414
+ path: string; // Full path: business.{app}.{module}.{resource}.{action}
415
+ action: string;
416
+ description?: string;
417
+ }
418
+
419
+ export interface SeedDataRolePermission {
420
+ role: string;
421
+ permissionPath: string; // Must match permissions[].path
422
+ }
423
+
424
+ export interface SeedDataPermissionConstant {
425
+ constantName: string; // PascalCase (e.g., VehiclesRead)
426
+ path: string; // Matching permission path
427
+ }
428
+
164
429
  export interface Actor {
165
430
  name: string;
166
431
  description: string;
@@ -244,54 +509,112 @@ export interface I18nKey {
244
509
  // --- Validation ---
245
510
 
246
511
  export interface FeatureValidation {
247
- decision: 'APPROVED' | 'REJECTED';
248
- completeness: Record<string, { score: string; issues: string[] }>;
249
- consistency: Record<string, 'OK' | 'FAIL'>;
250
- conventions: Record<string, 'OK' | 'FAIL'>;
251
- risks: ValidatedRisk[];
252
- issues: ValidationIssue[];
512
+ validatedAt: string | null;
513
+ completenessChecks: CompletenessCheck[];
514
+ consistencyChecks: ConsistencyCheck[];
515
+ conventionChecks: ConventionCheck[];
516
+ riskAssessments: RiskAssessment[];
517
+ warnings: string[];
518
+ decision: ValidationDecision;
519
+ }
520
+
521
+ export interface CompletenessCheck {
522
+ section: string;
523
+ count: number;
524
+ minimum: number;
525
+ status: 'PASS' | 'FAIL' | 'WARNING';
253
526
  }
254
527
 
255
- export interface ValidatedRisk {
528
+ export interface ConsistencyCheck {
529
+ check: string;
530
+ passed: number;
531
+ warnings: number;
532
+ errors: number;
533
+ status: 'PASS' | 'FAIL' | 'WARNING';
534
+ }
535
+
536
+ export interface ConventionCheck {
537
+ check: string;
538
+ status: 'PASS' | 'FAIL' | 'WARNING';
539
+ details: string;
540
+ }
541
+
542
+ export interface RiskAssessment {
256
543
  risk: string;
257
- severity: 'High' | 'Medium' | 'Low';
258
- mitigation: string;
259
- status: 'Mitigated' | 'Accepted' | 'Open';
544
+ value: number;
545
+ threshold: number;
546
+ status: 'ACCEPTABLE' | 'WARNING' | 'CRITICAL' | 'MONITORED';
260
547
  }
261
548
 
262
- export interface ValidationIssue {
263
- severity: 'critical' | 'warning' | 'info';
264
- section: string;
265
- message: string;
549
+ export interface ValidationDecision {
550
+ approved: boolean;
551
+ reason: string;
552
+ approvalMode: 'standard' | 'micro' | 'delta' | 'force';
553
+ approvedBy: string;
554
+ approvedAt: string;
266
555
  }
267
556
 
268
557
  // --- Handoff ---
269
558
 
270
559
  export interface FeatureHandoff {
271
- complexity: 'Simple' | 'Medium' | 'Complex';
272
- filesToCreate: FileSpec[];
560
+ complexity: 'simple' | 'medium' | 'complex';
561
+ complexityDetails?: {
562
+ entities: number;
563
+ useCases: number;
564
+ businessRules: number;
565
+ calculated: string;
566
+ };
567
+ filesToCreate: FilesToCreate;
273
568
  brToCodeMapping: BrToCodeMapping[];
274
- ralphPrd: object | null; // .ralph/prd.json content
569
+ apiEndpointSummary: ApiEndpointSummaryEntry[];
570
+ ralphPrd: object | null; // .ralph/prd.json content
571
+ }
572
+
573
+ export interface FilesToCreate {
574
+ domain: FileSpec[];
575
+ application: FileSpec[];
576
+ infrastructure: FileSpec[];
577
+ api: FileSpec[];
578
+ frontend: FileSpec[];
579
+ seedData: FileSpec[];
580
+ tests: FileSpec[];
275
581
  }
276
582
 
277
583
  export interface FileSpec {
278
584
  path: string;
279
- layer: string;
280
- type: string;
281
- description: string;
585
+ type: string; // Entity, Service, DTO, HasData, Constants, ApiController, Page, Component, etc.
586
+ linkedFRs?: string[]; // FR-XXX references
587
+ linkedUCs?: string[]; // UC-XXX references
588
+ category?: 'core' | 'business'; // For seedData files
589
+ source?: string; // Derivation source in feature.json
590
+ description?: string;
282
591
  }
283
592
 
284
593
  export interface BrToCodeMapping {
285
- brId: string;
286
- rule: string;
287
- implementation: string;
288
- file: string;
594
+ ruleId: string; // BR-XXX from analysis.businessRules
595
+ title: string;
596
+ implementationPoints: ImplementationPoint[];
597
+ }
598
+
599
+ export interface ImplementationPoint {
600
+ layer: string; // Domain, Application, Infrastructure, API, Frontend
601
+ component: string; // File name
602
+ method: string; // Method or attribute
603
+ implementation: string; // How the rule is enforced
604
+ }
605
+
606
+ export interface ApiEndpointSummaryEntry {
607
+ operation: string;
608
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
609
+ route: string; // MUST match specification.apiEndpoints[].path
610
+ linkedUC: string;
611
+ permissions: string;
289
612
  }
290
613
 
291
614
  // --- Suggestions & Changelog ---
292
615
 
293
616
  export interface FeatureSuggestion {
294
- type: 'module' | 'section' | 'integration';
617
+ type: 'module' | 'section' | 'integration' | 'enhancement';
295
618
  code: string;
296
619
  title: string;
297
620
  reason: string;
@@ -299,9 +622,13 @@ export interface FeatureSuggestion {
299
622
  }
300
623
 
301
624
  export interface ChangelogEntry {
302
- version: string;
625
+ step?: string; // step-01-analyse, step-02-specify, etc.
626
+ version?: string;
303
627
  timestamp: string;
628
+ author?: string;
304
629
  changes: string[];
630
+ warnings?: string[];
631
+ decision?: string;
305
632
  }
306
633
  ```
307
634
 
@@ -312,10 +639,10 @@ export interface ChangelogEntry {
312
639
  ```typescript
313
640
  // web/smartstack-web/src/services/businessAnalyse.ts
314
641
 
315
- import type { FeatureJson } from '../types/business-analyse';
642
+ import type { FeatureJson, ApplicationFeatureJson } from '../types/business-analyse';
316
643
 
317
644
  /**
318
- * Load feature.json from docs path
645
+ * Load module-level feature.json from docs path
319
646
  * The web app reads the JSON directly - no transformation needed
320
647
  */
321
648
  export async function loadFeature(
@@ -329,6 +656,19 @@ export async function loadFeature(
329
656
  return response.json();
330
657
  }
331
658
 
659
+ /**
660
+ * Load application-level (master) feature.json
661
+ */
662
+ export async function loadApplicationFeature(
663
+ app: string,
664
+ version: string
665
+ ): Promise<ApplicationFeatureJson> {
666
+ const response = await fetch(
667
+ `/docs/business/${app}/business-analyse/v${version}/feature.json`
668
+ );
669
+ return response.json();
670
+ }
671
+
332
672
  /**
333
673
  * List available versions for a module
334
674
  */
@@ -341,6 +681,18 @@ export async function listVersions(
341
681
  );
342
682
  return response.json();
343
683
  }
684
+
685
+ /**
686
+ * List available versions for an application (master)
687
+ */
688
+ export async function listApplicationVersions(
689
+ app: string
690
+ ): Promise<string[]> {
691
+ const response = await fetch(
692
+ `/api/docs/business/${app}/business-analyse/versions`
693
+ );
694
+ return response.json();
695
+ }
344
696
  ```
345
697
 
346
698
  ---
@@ -351,9 +703,28 @@ export async function listVersions(
351
703
  // web/smartstack-web/src/types/index.ts
352
704
 
353
705
  export type {
706
+ // Application-level types
707
+ ApplicationFeatureJson,
708
+ ApplicationStatus,
709
+ ApplicationMetadata,
710
+ WorkflowState,
711
+ ApplicationCadrage,
712
+ GlobalScope,
713
+ ApplicationRole,
714
+ ApplicationModule,
715
+ DependencyGraph,
716
+ DependencyEdge,
717
+ DependencyLayer,
718
+ ApplicationConsolidation,
719
+ CrossModuleInteractions,
720
+ E2EFlow,
721
+ PermissionCoherence,
722
+
723
+ // Module-level types
354
724
  FeatureJson,
355
725
  FeatureStatus,
356
726
  FeatureMetadata,
727
+ ApplicationContext,
357
728
  FeatureDiscovery,
358
729
  FeatureAnalysis,
359
730
  FeatureSpecification,
@@ -364,6 +735,14 @@ export type {
364
735
  FunctionalRequirement,
365
736
  Entity,
366
737
  PermissionMatrix,
738
+ Wireframe,
739
+ BusinessMessage,
740
+ EntityLifeCycle,
741
+ SeedDataCore,
742
+ FilesToCreate,
743
+ FileSpec,
744
+ BrToCodeMapping,
745
+ ValidationDecision,
367
746
  FeatureSuggestion,
368
747
  ChangelogEntry
369
748
  } from './business-analyse';