@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
@@ -1,141 +1,487 @@
1
- # TypeScript Schema - FRD Data Types
1
+ # TypeScript Schema - Feature JSON Types
2
2
 
3
- > **Usage:** TypeScript interfaces for FRD documentation
4
- > **Loaded in:** step-06-doc-html.md
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`
5
6
 
6
7
  ---
7
8
 
8
9
  ## Type Definitions
9
10
 
10
11
  ```typescript
11
- // web/smartstack-web/src/pages/docs/business/{app}/{module}/types.ts
12
+ // web/smartstack-web/src/types/business-analyse.ts
12
13
 
13
14
  /**
14
- * Use Case definition from FRD
15
+ * Complete Feature JSON structure
16
+ * Matches schemas/feature-schema.json
17
+ * Progressively enriched by each BA step
15
18
  */
16
- export interface UseCase {
17
- /** Unique identifier (e.g., "UC-001") */
19
+ export interface FeatureJson {
20
+ id: string; // FEAT-XXX
21
+ version: string; // 1.0, 1.1, etc.
22
+ status: FeatureStatus;
23
+ metadata: FeatureMetadata;
24
+ discovery: FeatureDiscovery;
25
+ analysis: FeatureAnalysis;
26
+ specification: FeatureSpecification;
27
+ validation: FeatureValidation;
28
+ handoff: FeatureHandoff;
29
+ suggestions: FeatureSuggestion[];
30
+ changelog: ChangelogEntry[];
31
+ }
32
+
33
+ export type FeatureStatus = 'draft' | 'analysed' | 'specified' | 'approved' | 'handed-off';
34
+
35
+ export interface FeatureMetadata {
36
+ application: string;
37
+ module: string;
38
+ language: string;
39
+ featureType: 'new' | 'refactoring' | 'micro';
40
+ createdAt: string;
41
+ updatedAt: string;
42
+ previousVersion: string | null;
43
+ }
44
+
45
+ // --- Discovery ---
46
+
47
+ export interface FeatureDiscovery {
48
+ problem: string;
49
+ asIs: string;
50
+ toBe: string;
51
+ trigger: string;
52
+ stakeholders: Stakeholder[];
53
+ scope: FeatureScope;
54
+ risks: Risk[];
55
+ acceptanceCriteria: AcceptanceCriterion[];
56
+ }
57
+
58
+ export interface Stakeholder {
59
+ role: string;
60
+ description: string;
61
+ tasks: string[];
62
+ frequency: 'daily' | 'weekly' | 'monthly' | 'rarely';
63
+ }
64
+
65
+ export interface FeatureScope {
66
+ mustHave: string[];
67
+ shouldHave: string[];
68
+ couldHave: string[];
69
+ outOfScope: string[];
70
+ mainFlow: string[];
71
+ alternativeFlows: AlternativeFlow[];
72
+ }
73
+
74
+ export interface AlternativeFlow {
75
+ condition: string;
76
+ steps: string[];
77
+ }
78
+
79
+ export interface Risk {
18
80
  id: string;
19
- /** Use case name */
20
- name: string;
21
- /** Primary actor role */
22
- actor: string;
23
- /** Required permission path */
24
- permission: string;
25
- /** Brief description */
26
81
  description: string;
82
+ severity: 'high' | 'medium' | 'low';
83
+ mitigation: string;
27
84
  }
28
85
 
29
- /**
30
- * Business Rule from BRD
31
- */
32
- export interface BusinessRule {
33
- /** Unique identifier (e.g., "BR-001") */
86
+ export interface AcceptanceCriterion {
87
+ id: string;
88
+ description: string;
89
+ testable: boolean;
90
+ }
91
+
92
+ // --- Analysis ---
93
+
94
+ export interface FeatureAnalysis {
95
+ objectives: BusinessObjective[];
96
+ businessRules: BusinessRule[];
97
+ entities: Entity[];
98
+ processFlow: string;
99
+ integrations: Integration[];
100
+ }
101
+
102
+ export interface BusinessObjective {
34
103
  id: string;
35
- /** Rule description */
104
+ description: string;
105
+ measurable: boolean;
106
+ }
107
+
108
+ export interface BusinessRule {
109
+ id: string; // BR-XXX
36
110
  rule: string;
37
- /** Category: Validation, Calculation, Workflow, Security, Data */
38
111
  category: 'Validation' | 'Calculation' | 'Workflow' | 'Security' | 'Data';
39
- /** MoSCoW priority */
40
112
  priority: 'Must' | 'Should' | 'Could';
113
+ condition: string;
114
+ action: string;
115
+ examples: BusinessRuleExample[];
116
+ linkedRules: string[]; // Cross-reference other BR-IDs
41
117
  }
42
118
 
43
- /**
44
- * Permission definition
45
- */
46
- export interface Permission {
47
- /** Full permission path (e.g., "business.sales.orders.read") */
48
- path: string;
49
- /** Human-readable description */
119
+ export interface BusinessRuleExample {
120
+ input: string;
121
+ expected: string;
122
+ }
123
+
124
+ export interface Entity {
125
+ name: string; // PascalCase
50
126
  description: string;
51
- /** Roles that have this permission */
52
- roles: string[];
127
+ attributes: EntityAttribute[];
128
+ relationships: EntityRelationship[];
53
129
  }
54
130
 
55
- /**
56
- * Complete FRD data structure
57
- */
58
- export interface FrdData {
59
- /** Feature identifier (e.g., "FEAT-001") */
60
- featureId: string;
61
- /** Module name in PascalCase */
62
- moduleName: string;
63
- /** Application name in PascalCase */
64
- applicationName: string;
65
- /** Document version */
66
- version: string;
67
- /** List of use cases */
131
+ export interface EntityAttribute {
132
+ name: string;
133
+ type: string;
134
+ required: boolean;
135
+ rules: string;
136
+ }
137
+
138
+ export interface EntityRelationship {
139
+ target: string;
140
+ type: '1:1' | '1:N' | 'N:1' | 'N:M';
141
+ description: string;
142
+ }
143
+
144
+ export interface Integration {
145
+ system: string;
146
+ direction: 'inbound' | 'outbound' | 'bidirectional';
147
+ protocol: string;
148
+ description: string;
149
+ }
150
+
151
+ // --- Specification ---
152
+
153
+ export interface FeatureSpecification {
154
+ actors: Actor[];
68
155
  useCases: UseCase[];
69
- /** List of business rules */
70
- businessRules: BusinessRule[];
71
- /** List of permissions */
72
- permissions: Permission[];
156
+ functionalRequirements: FunctionalRequirement[];
157
+ permissionMatrix: PermissionMatrix;
158
+ navigation: NavigationHierarchy;
159
+ gherkinScenarios: GherkinScenario[];
160
+ apiEndpoints: ApiEndpoint[];
161
+ validations: ValidationRule[];
162
+ wireframes: Wireframe[];
163
+ messages: BusinessMessage[];
164
+ lifeCycles: EntityLifeCycle[];
165
+ seedDataCore: SeedDataCore;
166
+ i18nKeys: I18nKey[];
167
+ }
168
+
169
+ export interface ValidationRule {
170
+ field: string;
171
+ rules: string;
172
+ errorMessage: string;
173
+ }
174
+
175
+ export interface Wireframe {
176
+ screen: string;
177
+ description: string;
178
+ elements: string[];
179
+ actions: string[];
180
+ permissionsRequired: string[];
181
+ }
182
+
183
+ export interface BusinessMessage {
184
+ code: string; // SCREAMING_SNAKE_CASE
185
+ type: 'success' | 'error' | 'warning' | 'info';
186
+ title: string;
187
+ message: string; // User-facing with {placeholders}
188
+ i18nKey: string; // Dot-separated key
189
+ }
190
+
191
+ export interface EntityLifeCycle {
192
+ entity: string; // PascalCase entity name
193
+ states: LifeCycleState[];
194
+ }
195
+
196
+ export interface LifeCycleState {
197
+ id: string; // State code (Draft, Active, etc.)
198
+ displayName: string;
199
+ description?: string;
200
+ allowedTransitions: string[];
201
+ isTerminal: boolean;
202
+ }
203
+
204
+ export interface SeedDataCore {
205
+ navigationModules: SeedDataNavModule[];
206
+ navigationTranslations: SeedDataNavTranslation[];
207
+ permissions: SeedDataPermission[];
208
+ rolePermissions: SeedDataRolePermission[];
209
+ permissionConstants: SeedDataPermissionConstant[];
210
+ }
211
+
212
+ export interface SeedDataNavModule {
213
+ code: string;
214
+ label: string;
215
+ icon: string;
216
+ route: string;
217
+ parentCode: string | null;
218
+ sort: number;
219
+ }
220
+
221
+ export interface SeedDataNavTranslation {
222
+ moduleCode: string;
223
+ language: 'fr' | 'en' | 'it' | 'de';
224
+ label: string;
225
+ }
226
+
227
+ export interface SeedDataPermission {
228
+ path: string; // Full path: business.{app}.{module}.{resource}.{action}
229
+ action: string;
230
+ description?: string;
231
+ }
232
+
233
+ export interface SeedDataRolePermission {
234
+ role: string;
235
+ permissionPath: string; // Must match permissions[].path
236
+ }
237
+
238
+ export interface SeedDataPermissionConstant {
239
+ constantName: string; // PascalCase (e.g., VehiclesRead)
240
+ path: string; // Matching permission path
241
+ }
242
+
243
+ export interface Actor {
244
+ name: string;
245
+ description: string;
246
+ permissionBase: string;
247
+ }
248
+
249
+ export interface UseCase {
250
+ id: string; // UC-XXX
251
+ name: string;
252
+ actor: string;
253
+ permission: string;
254
+ preconditions: string[];
255
+ postconditions: string[];
256
+ mainScenario: string[];
257
+ alternativeScenarios: { condition: string; steps: string[] }[];
258
+ errorScenarios: { error: string; message: string; action: string }[];
259
+ linkedRules: string[]; // BR-IDs
260
+ }
261
+
262
+ export interface FunctionalRequirement {
263
+ id: string; // FR-XXX
264
+ statement: string;
265
+ priority: 'Must' | 'Should' | 'Could';
266
+ acceptanceCriteria: string[];
267
+ linkedUseCases: string[]; // UC-IDs
268
+ linkedRules: string[]; // BR-IDs
269
+ }
270
+
271
+ export interface PermissionMatrix {
272
+ roles: string[];
273
+ permissions: PermissionEntry[];
274
+ roleAssignments: RoleAssignment[];
275
+ }
276
+
277
+ export interface PermissionEntry {
278
+ path: string; // business.{app}.{module}.{action}
279
+ description: string;
280
+ }
281
+
282
+ export interface RoleAssignment {
283
+ role: string;
284
+ permissions: string[]; // Permission paths
285
+ }
286
+
287
+ export interface NavigationHierarchy {
288
+ entries: NavigationEntry[];
289
+ }
290
+
291
+ export interface NavigationEntry {
292
+ level: 'context' | 'application' | 'module' | 'section';
293
+ code: string;
294
+ labels: Record<string, string>; // {fr, en, it, de}
295
+ route: string;
296
+ icon: string;
297
+ isNew: boolean;
298
+ }
299
+
300
+ export interface GherkinScenario {
301
+ feature: string;
302
+ name: string;
303
+ tags: string[];
304
+ steps: string;
305
+ }
306
+
307
+ export interface ApiEndpoint {
308
+ path: string;
309
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
310
+ permission: string;
311
+ requestBody: string | null;
312
+ responseType: string;
313
+ }
314
+
315
+ export interface I18nKey {
316
+ key: string;
317
+ fr: string;
318
+ en: string;
319
+ it: string;
320
+ de: string;
321
+ }
322
+
323
+ // --- Validation ---
324
+
325
+ export interface FeatureValidation {
326
+ validatedAt: string | null;
327
+ completenessChecks: CompletenessCheck[];
328
+ consistencyChecks: ConsistencyCheck[];
329
+ conventionChecks: ConventionCheck[];
330
+ riskAssessments: RiskAssessment[];
331
+ warnings: string[];
332
+ decision: ValidationDecision;
333
+ }
334
+
335
+ export interface CompletenessCheck {
336
+ section: string;
337
+ count: number;
338
+ minimum: number;
339
+ status: 'PASS' | 'FAIL' | 'WARNING';
340
+ }
341
+
342
+ export interface ConsistencyCheck {
343
+ check: string;
344
+ passed: number;
345
+ warnings: number;
346
+ errors: number;
347
+ status: 'PASS' | 'FAIL' | 'WARNING';
348
+ }
349
+
350
+ export interface ConventionCheck {
351
+ check: string;
352
+ status: 'PASS' | 'FAIL' | 'WARNING';
353
+ details: string;
354
+ }
355
+
356
+ export interface RiskAssessment {
357
+ risk: string;
358
+ value: number;
359
+ threshold: number;
360
+ status: 'ACCEPTABLE' | 'WARNING' | 'CRITICAL' | 'MONITORED';
361
+ }
362
+
363
+ export interface ValidationDecision {
364
+ approved: boolean;
365
+ reason: string;
366
+ approvalMode: 'standard' | 'micro' | 'delta' | 'force';
367
+ approvedBy: string;
368
+ approvedAt: string;
369
+ }
370
+
371
+ // --- Handoff ---
372
+
373
+ export interface FeatureHandoff {
374
+ complexity: 'simple' | 'medium' | 'complex';
375
+ complexityDetails?: {
376
+ entities: number;
377
+ useCases: number;
378
+ businessRules: number;
379
+ calculated: string;
380
+ };
381
+ filesToCreate: FilesToCreate;
382
+ brToCodeMapping: BrToCodeMapping[];
383
+ apiEndpointSummary: ApiEndpointSummaryEntry[];
384
+ ralphPrd: object | null; // .ralph/prd.json content
385
+ }
386
+
387
+ export interface FilesToCreate {
388
+ domain: FileSpec[];
389
+ application: FileSpec[];
390
+ infrastructure: FileSpec[];
391
+ api: FileSpec[];
392
+ frontend: FileSpec[];
393
+ seedData: FileSpec[];
394
+ tests: FileSpec[];
395
+ }
396
+
397
+ export interface FileSpec {
398
+ path: string;
399
+ type: string; // Entity, Service, DTO, HasData, Constants, ApiController, Page, Component, etc.
400
+ linkedFRs?: string[]; // FR-XXX references
401
+ linkedUCs?: string[]; // UC-XXX references
402
+ category?: 'core' | 'business'; // For seedData files
403
+ source?: string; // Derivation source in feature.json
404
+ description?: string;
405
+ }
406
+
407
+ export interface BrToCodeMapping {
408
+ ruleId: string; // BR-XXX from analysis.businessRules
409
+ title: string;
410
+ implementationPoints: ImplementationPoint[];
411
+ }
412
+
413
+ export interface ImplementationPoint {
414
+ layer: string; // Domain, Application, Infrastructure, API, Frontend
415
+ component: string; // File name
416
+ method: string; // Method or attribute
417
+ implementation: string; // How the rule is enforced
418
+ }
419
+
420
+ export interface ApiEndpointSummaryEntry {
421
+ operation: string;
422
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
423
+ route: string; // MUST match specification.apiEndpoints[].path
424
+ linkedUC: string;
425
+ permissions: string;
426
+ }
427
+
428
+ // --- Suggestions & Changelog ---
429
+
430
+ export interface FeatureSuggestion {
431
+ type: 'module' | 'section' | 'integration' | 'enhancement';
432
+ code: string;
433
+ title: string;
434
+ reason: string;
435
+ accepted: boolean | null;
436
+ }
437
+
438
+ export interface ChangelogEntry {
439
+ step?: string; // step-01-analyse, step-02-specify, etc.
440
+ version?: string;
441
+ timestamp: string;
442
+ author?: string;
443
+ changes: string[];
444
+ warnings?: string[];
445
+ decision?: string;
73
446
  }
74
447
  ```
75
448
 
76
449
  ---
77
450
 
78
- ## Data File Template
451
+ ## Data Loading
79
452
 
80
453
  ```typescript
81
- // web/smartstack-web/src/pages/docs/business/{app}/{module}/frdData.ts
454
+ // web/smartstack-web/src/services/businessAnalyse.ts
82
455
 
83
- import type { FrdData } from './types';
456
+ import type { FeatureJson } from '../types/business-analyse';
84
457
 
85
458
  /**
86
- * FRD data extracted from 3-functional-specification.md
87
- * Generated by /business-analyse:6-doc-html
459
+ * Load feature.json from docs path
460
+ * The web app reads the JSON directly - no transformation needed
88
461
  */
89
- export const frdData: FrdData = {
90
- featureId: '{{feature_id}}',
91
- moduleName: '{{module_name}}',
92
- applicationName: '{{application_name}}',
93
- version: '1.0',
94
-
95
- useCases: [
96
- {
97
- id: 'UC-001',
98
- name: '{{use_case_name}}',
99
- actor: '{{actor}}',
100
- permission: 'business.{{app}}.{{module}}.{{action}}',
101
- description: '{{description}}'
102
- }
103
- // Add more use cases...
104
- ],
105
-
106
- businessRules: [
107
- {
108
- id: 'BR-001',
109
- rule: '{{rule_description}}',
110
- category: 'Validation',
111
- priority: 'Must'
112
- }
113
- // Add more business rules...
114
- ],
115
-
116
- permissions: [
117
- {
118
- path: 'business.{{app}}.{{module}}.read',
119
- description: 'View {{module}} data',
120
- roles: ['Admin', 'Manager', 'User', 'ReadOnly']
121
- },
122
- {
123
- path: 'business.{{app}}.{{module}}.create',
124
- description: 'Create new {{module}}',
125
- roles: ['Admin', 'Manager']
126
- },
127
- {
128
- path: 'business.{{app}}.{{module}}.update',
129
- description: 'Update existing {{module}}',
130
- roles: ['Admin', 'Manager']
131
- },
132
- {
133
- path: 'business.{{app}}.{{module}}.delete',
134
- description: 'Delete {{module}}',
135
- roles: ['Admin']
136
- }
137
- ]
138
- };
462
+ export async function loadFeature(
463
+ app: string,
464
+ module: string,
465
+ version: string
466
+ ): Promise<FeatureJson> {
467
+ const response = await fetch(
468
+ `/docs/business/${app}/${module}/business-analyse/v${version}/feature.json`
469
+ );
470
+ return response.json();
471
+ }
472
+
473
+ /**
474
+ * List available versions for a module
475
+ */
476
+ export async function listVersions(
477
+ app: string,
478
+ module: string
479
+ ): Promise<string[]> {
480
+ const response = await fetch(
481
+ `/api/docs/business/${app}/${module}/business-analyse/versions`
482
+ );
483
+ return response.json();
484
+ }
139
485
  ```
140
486
 
141
487
  ---
@@ -143,9 +489,30 @@ export const frdData: FrdData = {
143
489
  ## Index Export
144
490
 
145
491
  ```typescript
146
- // web/smartstack-web/src/pages/docs/business/{app}/{module}/index.ts
492
+ // web/smartstack-web/src/types/index.ts
147
493
 
148
- export { {ModuleName}FrdDocPage } from './FrdDocPage';
149
- export type { FrdData, UseCase, BusinessRule, Permission } from './types';
150
- export { frdData } from './frdData';
494
+ export type {
495
+ FeatureJson,
496
+ FeatureStatus,
497
+ FeatureMetadata,
498
+ FeatureDiscovery,
499
+ FeatureAnalysis,
500
+ FeatureSpecification,
501
+ FeatureValidation,
502
+ FeatureHandoff,
503
+ BusinessRule,
504
+ UseCase,
505
+ FunctionalRequirement,
506
+ Entity,
507
+ PermissionMatrix,
508
+ BusinessMessage,
509
+ EntityLifeCycle,
510
+ SeedDataCore,
511
+ FilesToCreate,
512
+ FileSpec,
513
+ BrToCodeMapping,
514
+ ValidationDecision,
515
+ FeatureSuggestion,
516
+ ChangelogEntry
517
+ } from './business-analyse';
151
518
  ```