@atlashub/smartstack-cli 2.1.0 → 2.2.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 (35) hide show
  1. package/dist/index.js +18 -10
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/agents/ba-reader.md +250 -0
  5. package/templates/agents/ba-writer.md +210 -0
  6. package/templates/agents/docs-context-reader.md +51 -33
  7. package/templates/skills/_shared.md +2 -0
  8. package/templates/skills/business-analyse/SKILL.md +120 -108
  9. package/templates/skills/business-analyse/_shared.md +136 -146
  10. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +478 -0
  11. package/templates/skills/business-analyse/questionnaire/01-context.md +3 -15
  12. package/templates/skills/business-analyse/questionnaire/08-performance.md +7 -21
  13. package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -13
  14. package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -13
  15. package/templates/skills/business-analyse/questionnaire.md +72 -76
  16. package/templates/skills/business-analyse/react/components.md +317 -154
  17. package/templates/skills/business-analyse/react/i18n-template.md +167 -106
  18. package/templates/skills/business-analyse/react/schema.md +325 -106
  19. package/templates/skills/business-analyse/schemas/feature-schema.json +690 -0
  20. package/templates/skills/business-analyse/steps/step-00-init.md +395 -285
  21. package/templates/skills/business-analyse/steps/step-01-analyse.md +505 -0
  22. package/templates/skills/business-analyse/steps/step-02-specify.md +833 -0
  23. package/templates/skills/business-analyse/steps/step-03-validate.md +862 -0
  24. package/templates/skills/business-analyse/steps/step-04-handoff.md +1593 -0
  25. package/templates/skills/business-analyse/templates/tpl-handoff.md +39 -63
  26. package/templates/skills/business-analyse/steps/step-01-discover.md +0 -737
  27. package/templates/skills/business-analyse/steps/step-02-analyse.md +0 -299
  28. package/templates/skills/business-analyse/steps/step-03-specify.md +0 -472
  29. package/templates/skills/business-analyse/steps/step-04-validate.md +0 -335
  30. package/templates/skills/business-analyse/steps/step-05-handoff.md +0 -741
  31. package/templates/skills/business-analyse/steps/step-06-doc-html.md +0 -320
  32. package/templates/skills/business-analyse/templates/00-context.md +0 -105
  33. package/templates/skills/business-analyse/templates/tpl-brd.md +0 -97
  34. package/templates/skills/business-analyse/templates/tpl-discovery.md +0 -78
  35. package/templates/skills/business-analyse/tracking/change-template.md +0 -30
@@ -1,141 +1,346 @@
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 {
34
87
  id: string;
35
- /** Rule description */
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 {
103
+ id: string;
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
126
+ description: string;
127
+ attributes: EntityAttribute[];
128
+ relationships: EntityRelationship[];
129
+ }
130
+
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: 'OneToMany' | 'ManyToOne' | 'ManyToMany' | 'OneToOne';
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[];
155
+ useCases: UseCase[];
156
+ functionalRequirements: FunctionalRequirement[];
157
+ permissionMatrix: PermissionMatrix;
158
+ navigation: NavigationHierarchy;
159
+ gherkinScenarios: GherkinScenario[];
160
+ apiEndpoints: ApiEndpoint[];
161
+ i18nKeys: I18nKey[];
162
+ }
163
+
164
+ export interface Actor {
165
+ name: string;
50
166
  description: string;
51
- /** Roles that have this permission */
167
+ permissionBase: string;
168
+ }
169
+
170
+ export interface UseCase {
171
+ id: string; // UC-XXX
172
+ name: string;
173
+ actor: string;
174
+ permission: string;
175
+ preconditions: string[];
176
+ postconditions: string[];
177
+ mainScenario: string[];
178
+ alternativeScenarios: { condition: string; steps: string[] }[];
179
+ errorScenarios: { error: string; message: string; action: string }[];
180
+ linkedRules: string[]; // BR-IDs
181
+ }
182
+
183
+ export interface FunctionalRequirement {
184
+ id: string; // FR-XXX
185
+ statement: string;
186
+ priority: 'Must' | 'Should' | 'Could';
187
+ acceptanceCriteria: string[];
188
+ linkedUseCases: string[]; // UC-IDs
189
+ linkedRules: string[]; // BR-IDs
190
+ }
191
+
192
+ export interface PermissionMatrix {
52
193
  roles: string[];
194
+ permissions: PermissionEntry[];
195
+ roleAssignments: RoleAssignment[];
53
196
  }
54
197
 
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 */
198
+ export interface PermissionEntry {
199
+ path: string; // business.{app}.{module}.{action}
200
+ description: string;
201
+ }
202
+
203
+ export interface RoleAssignment {
204
+ role: string;
205
+ permissions: string[]; // Permission paths
206
+ }
207
+
208
+ export interface NavigationHierarchy {
209
+ entries: NavigationEntry[];
210
+ }
211
+
212
+ export interface NavigationEntry {
213
+ level: 'context' | 'application' | 'module' | 'section';
214
+ code: string;
215
+ labels: Record<string, string>; // {fr, en, it, de}
216
+ route: string;
217
+ icon: string;
218
+ isNew: boolean;
219
+ }
220
+
221
+ export interface GherkinScenario {
222
+ feature: string;
223
+ name: string;
224
+ tags: string[];
225
+ steps: string;
226
+ }
227
+
228
+ export interface ApiEndpoint {
229
+ path: string;
230
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
231
+ permission: string;
232
+ requestBody: string | null;
233
+ responseType: string;
234
+ }
235
+
236
+ export interface I18nKey {
237
+ key: string;
238
+ fr: string;
239
+ en: string;
240
+ it: string;
241
+ de: string;
242
+ }
243
+
244
+ // --- Validation ---
245
+
246
+ 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[];
253
+ }
254
+
255
+ export interface ValidatedRisk {
256
+ risk: string;
257
+ severity: 'High' | 'Medium' | 'Low';
258
+ mitigation: string;
259
+ status: 'Mitigated' | 'Accepted' | 'Open';
260
+ }
261
+
262
+ export interface ValidationIssue {
263
+ severity: 'critical' | 'warning' | 'info';
264
+ section: string;
265
+ message: string;
266
+ }
267
+
268
+ // --- Handoff ---
269
+
270
+ export interface FeatureHandoff {
271
+ complexity: 'Simple' | 'Medium' | 'Complex';
272
+ filesToCreate: FileSpec[];
273
+ brToCodeMapping: BrToCodeMapping[];
274
+ ralphPrd: object | null; // .ralph/prd.json content
275
+ }
276
+
277
+ export interface FileSpec {
278
+ path: string;
279
+ layer: string;
280
+ type: string;
281
+ description: string;
282
+ }
283
+
284
+ export interface BrToCodeMapping {
285
+ brId: string;
286
+ rule: string;
287
+ implementation: string;
288
+ file: string;
289
+ }
290
+
291
+ // --- Suggestions & Changelog ---
292
+
293
+ export interface FeatureSuggestion {
294
+ type: 'module' | 'section' | 'integration';
295
+ code: string;
296
+ title: string;
297
+ reason: string;
298
+ accepted: boolean | null;
299
+ }
300
+
301
+ export interface ChangelogEntry {
66
302
  version: string;
67
- /** List of use cases */
68
- useCases: UseCase[];
69
- /** List of business rules */
70
- businessRules: BusinessRule[];
71
- /** List of permissions */
72
- permissions: Permission[];
303
+ timestamp: string;
304
+ changes: string[];
73
305
  }
74
306
  ```
75
307
 
76
308
  ---
77
309
 
78
- ## Data File Template
310
+ ## Data Loading
79
311
 
80
312
  ```typescript
81
- // web/smartstack-web/src/pages/docs/business/{app}/{module}/frdData.ts
313
+ // web/smartstack-web/src/services/businessAnalyse.ts
82
314
 
83
- import type { FrdData } from './types';
315
+ import type { FeatureJson } from '../types/business-analyse';
84
316
 
85
317
  /**
86
- * FRD data extracted from 3-functional-specification.md
87
- * Generated by /business-analyse:6-doc-html
318
+ * Load feature.json from docs path
319
+ * The web app reads the JSON directly - no transformation needed
88
320
  */
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
- };
321
+ export async function loadFeature(
322
+ app: string,
323
+ module: string,
324
+ version: string
325
+ ): Promise<FeatureJson> {
326
+ const response = await fetch(
327
+ `/docs/business/${app}/${module}/business-analyse/v${version}/feature.json`
328
+ );
329
+ return response.json();
330
+ }
331
+
332
+ /**
333
+ * List available versions for a module
334
+ */
335
+ export async function listVersions(
336
+ app: string,
337
+ module: string
338
+ ): Promise<string[]> {
339
+ const response = await fetch(
340
+ `/api/docs/business/${app}/${module}/business-analyse/versions`
341
+ );
342
+ return response.json();
343
+ }
139
344
  ```
140
345
 
141
346
  ---
@@ -143,9 +348,23 @@ export const frdData: FrdData = {
143
348
  ## Index Export
144
349
 
145
350
  ```typescript
146
- // web/smartstack-web/src/pages/docs/business/{app}/{module}/index.ts
351
+ // web/smartstack-web/src/types/index.ts
147
352
 
148
- export { {ModuleName}FrdDocPage } from './FrdDocPage';
149
- export type { FrdData, UseCase, BusinessRule, Permission } from './types';
150
- export { frdData } from './frdData';
353
+ export type {
354
+ FeatureJson,
355
+ FeatureStatus,
356
+ FeatureMetadata,
357
+ FeatureDiscovery,
358
+ FeatureAnalysis,
359
+ FeatureSpecification,
360
+ FeatureValidation,
361
+ FeatureHandoff,
362
+ BusinessRule,
363
+ UseCase,
364
+ FunctionalRequirement,
365
+ Entity,
366
+ PermissionMatrix,
367
+ FeatureSuggestion,
368
+ ChangelogEntry
369
+ } from './business-analyse';
151
370
  ```