@atlashub/smartstack-cli 3.37.0 → 3.39.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 (228) hide show
  1. package/dist/index.js +16 -24
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +235 -265
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/scripts/extract-api-endpoints.ts +5 -5
  7. package/scripts/generate-doc-with-mock-ui.ts +10 -17
  8. package/templates/agents/ba-reader.md +9 -9
  9. package/templates/agents/ba-writer.md +12 -15
  10. package/templates/agents/code-reviewer.md +1 -1
  11. package/templates/agents/docs-context-reader.md +1 -1
  12. package/templates/agents/efcore/scan.md +3 -1
  13. package/templates/agents/gitflow/commit.md +74 -0
  14. package/templates/agents/gitflow/finish.md +5 -2
  15. package/templates/agents/gitflow/init-clone.md +3 -3
  16. package/templates/agents/gitflow/init-validate.md +3 -2
  17. package/templates/agents/gitflow/merge.md +5 -4
  18. package/templates/agents/gitflow/pr.md +5 -4
  19. package/templates/agents/gitflow/start.md +37 -5
  20. package/templates/hooks/hooks.json +11 -0
  21. package/templates/hooks/wsl-dotnet-cleanup.sh +24 -0
  22. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +20 -20
  23. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +16 -24
  24. package/templates/mcp-scaffolding/migrations/seed-roles.cs.hbs +2 -2
  25. package/templates/skills/_resources/mcp-validate-documentation-spec.md +3 -3
  26. package/templates/skills/_shared.md +15 -17
  27. package/templates/skills/ai-prompt/SKILL.md +1 -1
  28. package/templates/skills/ai-prompt/steps/step-00-init.md +47 -0
  29. package/templates/skills/apex/SKILL.md +3 -4
  30. package/templates/skills/apex/_shared.md +10 -20
  31. package/templates/skills/apex/references/analysis-methods.md +141 -0
  32. package/templates/skills/apex/references/challenge-questions.md +1 -21
  33. package/templates/skills/apex/references/core-seed-data.md +35 -58
  34. package/templates/skills/apex/references/examine-build-validation.md +82 -0
  35. package/templates/skills/apex/references/execution-frontend-gates.md +177 -0
  36. package/templates/skills/apex/references/execution-frontend-patterns.md +105 -0
  37. package/templates/skills/apex/references/execution-layer1-rules.md +96 -0
  38. package/templates/skills/apex/references/initialization-challenge-flow.md +110 -0
  39. package/templates/skills/apex/references/planning-layer-mapping.md +151 -0
  40. package/templates/skills/apex/references/post-checks.md +145 -40
  41. package/templates/skills/apex/references/smartstack-api.md +35 -51
  42. package/templates/skills/apex/references/smartstack-frontend.md +18 -18
  43. package/templates/skills/apex/references/smartstack-layers.md +38 -62
  44. package/templates/skills/apex/steps/step-00-init.md +14 -26
  45. package/templates/skills/apex/steps/step-01-analyze.md +10 -143
  46. package/templates/skills/apex/steps/step-02-plan.md +10 -92
  47. package/templates/skills/apex/steps/step-03-execute.md +45 -252
  48. package/templates/skills/apex/steps/step-04-examine.md +14 -78
  49. package/templates/skills/apex/steps/step-05-deep-review.md +2 -2
  50. package/templates/skills/apex/steps/step-08-run-tests.md +1 -0
  51. package/templates/skills/application/SKILL.md +241 -242
  52. package/templates/skills/application/references/backend-controller-hierarchy.md +16 -16
  53. package/templates/skills/application/references/backend-seeding-and-dto-output.md +83 -0
  54. package/templates/skills/application/references/backend-table-prefix-mapping.md +79 -0
  55. package/templates/skills/application/references/backend-verification.md +1 -1
  56. package/templates/skills/application/references/frontend-i18n-and-output.md +67 -0
  57. package/templates/skills/application/references/frontend-route-naming.md +117 -0
  58. package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +107 -0
  59. package/templates/skills/application/references/frontend-verification.md +12 -12
  60. package/templates/skills/application/references/init-parameter-detection.md +121 -0
  61. package/templates/skills/application/references/migration-checklist-troubleshooting.md +100 -0
  62. package/templates/skills/application/references/nav-fallback-procedure.md +199 -200
  63. package/templates/skills/application/references/provider-template.md +2 -6
  64. package/templates/skills/application/references/roles-client-project-handling.md +55 -0
  65. package/templates/skills/application/references/roles-fallback-procedure.md +149 -0
  66. package/templates/skills/application/references/test-coverage-requirements.md +213 -0
  67. package/templates/skills/application/references/test-frontend.md +3 -3
  68. package/templates/skills/application/steps/step-00-init.md +130 -260
  69. package/templates/skills/application/steps/step-01-navigation.md +170 -170
  70. package/templates/skills/application/steps/step-02-permissions.md +196 -196
  71. package/templates/skills/application/steps/step-03-roles.md +182 -339
  72. package/templates/skills/application/steps/step-03b-provider.md +133 -134
  73. package/templates/skills/application/steps/step-04-backend.md +174 -265
  74. package/templates/skills/application/steps/step-05-frontend.md +18 -144
  75. package/templates/skills/application/steps/step-06-migration.md +12 -60
  76. package/templates/skills/application/steps/step-07-tests.md +9 -76
  77. package/templates/skills/application/templates-backend.md +29 -27
  78. package/templates/skills/application/templates-frontend.md +49 -49
  79. package/templates/skills/application/templates-seed.md +57 -131
  80. package/templates/skills/business-analyse/SKILL.md +27 -30
  81. package/templates/skills/business-analyse/_architecture.md +6 -6
  82. package/templates/skills/business-analyse/_shared.md +60 -88
  83. package/templates/skills/business-analyse/questionnaire/04-data.md +3 -3
  84. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  85. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +1 -1
  86. package/templates/skills/business-analyse/react/application-viewer.md +12 -12
  87. package/templates/skills/business-analyse/react/components.md +8 -12
  88. package/templates/skills/business-analyse/react/schema.md +836 -836
  89. package/templates/skills/business-analyse/references/agent-module-prompt.md +2 -3
  90. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +190 -0
  91. package/templates/skills/business-analyse/references/cache-warming-strategy.md +2 -2
  92. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +41 -0
  93. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +74 -0
  94. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +69 -0
  95. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +1 -1
  96. package/templates/skills/business-analyse/references/compilation-structure-cards.md +297 -0
  97. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +2 -2
  98. package/templates/skills/business-analyse/references/deploy-modes.md +5 -5
  99. package/templates/skills/business-analyse/references/detection-strategies.md +7 -7
  100. package/templates/skills/business-analyse/references/handoff-file-templates.md +14 -22
  101. package/templates/skills/business-analyse/references/handoff-mappings.md +4 -4
  102. package/templates/skills/business-analyse/references/handoff-seeddata-generation.md +312 -0
  103. package/templates/skills/business-analyse/references/init-schema-deployment.md +3 -3
  104. package/templates/skills/business-analyse/references/naming-conventions.md +22 -24
  105. package/templates/skills/business-analyse/references/prd-generation.md +2 -2
  106. package/templates/skills/business-analyse/references/review-data-mapping.md +2 -2
  107. package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
  108. package/templates/skills/business-analyse/references/spec-auto-inference.md +3 -3
  109. package/templates/skills/business-analyse/references/team-orchestration.md +49 -6
  110. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  111. package/templates/skills/business-analyse/references/ui-resource-cards.md +18 -18
  112. package/templates/skills/business-analyse/references/validate-incremental-html.md +2 -2
  113. package/templates/skills/business-analyse/references/validation-checklist.md +2 -2
  114. package/templates/skills/business-analyse/schemas/application-schema.json +4 -5
  115. package/templates/skills/business-analyse/schemas/project-schema.json +1 -6
  116. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +2 -3
  117. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +4 -4
  118. package/templates/skills/business-analyse/steps/step-00-init.md +8 -17
  119. package/templates/skills/business-analyse/steps/step-01-cadrage.md +35 -198
  120. package/templates/skills/business-analyse/steps/step-01b-applications.md +16 -20
  121. package/templates/skills/business-analyse/steps/step-02-decomposition.md +1 -1
  122. package/templates/skills/business-analyse/steps/step-03a1-setup.md +4 -4
  123. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +1 -1
  124. package/templates/skills/business-analyse/steps/step-03b-ui.md +4 -4
  125. package/templates/skills/business-analyse/steps/step-03c-compile.md +66 -140
  126. package/templates/skills/business-analyse/steps/step-03d-validate.md +2 -2
  127. package/templates/skills/business-analyse/steps/step-04a-collect.md +2 -2
  128. package/templates/skills/business-analyse/steps/step-04b-analyze.md +42 -160
  129. package/templates/skills/business-analyse/steps/step-04c-decide.md +1 -1
  130. package/templates/skills/business-analyse/steps/step-05a-handoff.md +74 -104
  131. package/templates/skills/business-analyse/steps/step-05b-deploy.md +13 -11
  132. package/templates/skills/business-analyse/steps/step-06-review.md +3 -3
  133. package/templates/skills/business-analyse/templates/tpl-frd.md +13 -13
  134. package/templates/skills/business-analyse/templates/tpl-handoff.md +12 -12
  135. package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
  136. package/templates/skills/business-analyse/templates-frd.md +25 -25
  137. package/templates/skills/business-analyse/templates-react.md +15 -21
  138. package/templates/skills/controller/SKILL.md +1 -1
  139. package/templates/skills/controller/postman-templates.md +1 -1
  140. package/templates/skills/controller/references/controller-code-templates.md +2 -2
  141. package/templates/skills/controller/references/mcp-scaffold-workflow.md +209 -0
  142. package/templates/skills/controller/references/permission-sync-templates.md +13 -16
  143. package/templates/skills/controller/steps/step-00-init.md +11 -11
  144. package/templates/skills/controller/steps/step-03-generate.md +64 -103
  145. package/templates/skills/controller/templates.md +67 -71
  146. package/templates/skills/debug/SKILL.md +13 -218
  147. package/templates/skills/debug/steps/step-00-init.md +57 -0
  148. package/templates/skills/debug/steps/step-01-analyze.md +219 -0
  149. package/templates/skills/debug/steps/step-02-resolve.md +85 -0
  150. package/templates/skills/documentation/SKILL.md +49 -345
  151. package/templates/skills/documentation/data-schema.md +11 -8
  152. package/templates/skills/documentation/steps/step-00-init.md +70 -0
  153. package/templates/skills/documentation/steps/step-01-scan.md +113 -0
  154. package/templates/skills/documentation/steps/step-02-generate.md +231 -0
  155. package/templates/skills/documentation/steps/step-03-validate.md +238 -0
  156. package/templates/skills/documentation/templates.md +480 -322
  157. package/templates/skills/efcore/SKILL.md +1 -1
  158. package/templates/skills/efcore/references/both-contexts.md +32 -0
  159. package/templates/skills/efcore/references/database-operations.md +67 -0
  160. package/templates/skills/efcore/references/destructive-operations.md +38 -0
  161. package/templates/skills/efcore/references/reset-operations.md +81 -0
  162. package/templates/skills/efcore/references/seed-methods.md +86 -0
  163. package/templates/skills/efcore/references/shared-init-functions.md +250 -0
  164. package/templates/skills/efcore/references/sql-objects-injection.md +61 -0
  165. package/templates/skills/efcore/references/troubleshooting.md +81 -0
  166. package/templates/skills/efcore/steps/db/step-deploy.md +1 -32
  167. package/templates/skills/efcore/steps/db/step-reset.md +7 -103
  168. package/templates/skills/efcore/steps/db/step-seed.md +10 -132
  169. package/templates/skills/efcore/steps/db/step-status.md +5 -44
  170. package/templates/skills/efcore/steps/migration/step-02-create.md +1 -14
  171. package/templates/skills/efcore/steps/migration/step-03-validate.md +8 -62
  172. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +1 -57
  173. package/templates/skills/efcore/steps/shared/step-00-init.md +11 -254
  174. package/templates/skills/efcore/steps/squash/step-03-create.md +1 -58
  175. package/templates/skills/feature-full/SKILL.md +1 -1
  176. package/templates/skills/feature-full/steps/step-00-init.md +57 -0
  177. package/templates/skills/feature-full/steps/step-01-implementation.md +1 -1
  178. package/templates/skills/gitflow/SKILL.md +28 -5
  179. package/templates/skills/gitflow/_shared.md +109 -12
  180. package/templates/skills/gitflow/phases/abort.md +4 -0
  181. package/templates/skills/gitflow/phases/cleanup.md +4 -0
  182. package/templates/skills/gitflow/references/commit-message-generation.md +58 -0
  183. package/templates/skills/gitflow/references/commit-migration-validation.md +49 -0
  184. package/templates/skills/gitflow/references/finish-cleanup.md +55 -0
  185. package/templates/skills/gitflow/references/finish-version-bumping.md +45 -0
  186. package/templates/skills/gitflow/references/init-environment-detection.md +41 -0
  187. package/templates/skills/gitflow/references/init-questions.md +185 -0
  188. package/templates/skills/gitflow/references/init-structure-creation.md +75 -0
  189. package/templates/skills/gitflow/references/init-version-detection.md +21 -0
  190. package/templates/skills/gitflow/references/init-workspace-detection.md +43 -0
  191. package/templates/skills/gitflow/references/merge-ci-status.md +36 -0
  192. package/templates/skills/gitflow/references/merge-execution.md +62 -0
  193. package/templates/skills/gitflow/references/merge-pr-context.md +76 -0
  194. package/templates/skills/gitflow/references/pr-build-checks.md +60 -0
  195. package/templates/skills/gitflow/references/pr-generation.md +58 -0
  196. package/templates/skills/gitflow/references/start-branch-normalization.md +28 -0
  197. package/templates/skills/gitflow/references/start-worktree-creation.md +50 -0
  198. package/templates/skills/gitflow/references/sync-push-verify.md +44 -0
  199. package/templates/skills/gitflow/references/sync-rebase-conflicts.md +38 -0
  200. package/templates/skills/gitflow/steps/step-commit.md +12 -91
  201. package/templates/skills/gitflow/steps/step-finish.md +15 -159
  202. package/templates/skills/gitflow/steps/step-init.md +24 -326
  203. package/templates/skills/gitflow/steps/step-merge.md +17 -176
  204. package/templates/skills/gitflow/steps/step-pr.md +10 -116
  205. package/templates/skills/gitflow/steps/step-start.md +16 -109
  206. package/templates/skills/gitflow/steps/step-sync.md +6 -69
  207. package/templates/skills/ralph-loop/SKILL.md +6 -0
  208. package/templates/skills/ralph-loop/references/category-completeness.md +185 -0
  209. package/templates/skills/ralph-loop/references/compact-loop.md +1 -1
  210. package/templates/skills/ralph-loop/references/init-resume-recovery.md +127 -0
  211. package/templates/skills/ralph-loop/references/module-transition.md +151 -0
  212. package/templates/skills/ralph-loop/references/multi-module-queue.md +171 -0
  213. package/templates/skills/ralph-loop/references/parallel-execution.md +246 -0
  214. package/templates/skills/ralph-loop/references/task-transform-legacy.md +6 -9
  215. package/templates/skills/ralph-loop/references/team-orchestration.md +45 -3
  216. package/templates/skills/ralph-loop/steps/step-00-init.md +36 -109
  217. package/templates/skills/ralph-loop/steps/step-01-task.md +15 -163
  218. package/templates/skills/ralph-loop/steps/step-02-execute.md +8 -154
  219. package/templates/skills/ralph-loop/steps/step-04-check.md +20 -73
  220. package/templates/skills/review-code/references/owasp-api-top10.md +5 -5
  221. package/templates/skills/review-code/references/smartstack-conventions.md +568 -568
  222. package/templates/skills/validate-feature/references/api-smoke-tests.md +140 -0
  223. package/templates/skills/validate-feature/references/db-validation-checks.md +180 -0
  224. package/templates/skills/validate-feature/steps/step-01-compile.md +1 -3
  225. package/templates/skills/validate-feature/steps/step-04-api-smoke.md +34 -145
  226. package/templates/skills/validate-feature/steps/step-05-db-validation.md +74 -260
  227. package/templates/skills/workflow/SKILL.md +1 -1
  228. package/templates/skills/workflow/steps/step-00-init.md +57 -0
@@ -1,836 +1,836 @@
1
- # TypeScript Schema - Feature JSON Types
2
-
3
- > **Usage:** TypeScript interfaces aligned with feature-schema.json and application-schema.json
4
- > **Loaded in:** step-05b-deploy.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`
7
-
8
- ---
9
-
10
- ## Type Definitions
11
-
12
- ```typescript
13
- // web/smartstack-web/src/types/business-analyse.ts
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
-
186
- /**
187
- * Module-level Feature JSON structure
188
- * Matches schemas/feature-schema.json
189
- * Progressively enriched by each BA step
190
- */
191
- export interface FeatureJson {
192
- id: string; // FEAT-XXX
193
- version: string; // 1.0, 1.1, etc.
194
- status: FeatureStatus;
195
- scope?: 'module';
196
- metadata: FeatureMetadata;
197
- applicationContext?: ApplicationContext;
198
- discovery: FeatureDiscovery;
199
- analysis: FeatureAnalysis;
200
- specification: FeatureSpecification;
201
- validation: FeatureValidation;
202
- handoff: FeatureHandoff;
203
- suggestions: FeatureSuggestion[];
204
- changelog: ChangelogEntry[];
205
- }
206
-
207
- export type FeatureStatus = 'draft' | 'framed' | 'analysed' | 'decomposed' | 'specified' | 'consolidated' | 'approved' | 'handed-off';
208
-
209
- export interface FeatureMetadata {
210
- application: string;
211
- module: string;
212
- language: string;
213
- featureType: 'new' | 'refactoring' | 'micro';
214
- scope?: 'application' | 'module';
215
- applicationRef?: string | null;
216
- moduleIndex?: number | null;
217
- createdAt: string;
218
- updatedAt: string;
219
- previousVersion: string | null;
220
- }
221
-
222
- export interface ApplicationContext {
223
- applicationRoles: ApplicationRole[];
224
- permissionBase: string;
225
- relatedModules: string[];
226
- }
227
-
228
- // --- Discovery ---
229
-
230
- export interface FeatureDiscovery {
231
- problem: string;
232
- asIs: string;
233
- toBe: string;
234
- trigger: string;
235
- stakeholders: Stakeholder[];
236
- scope: FeatureScope;
237
- risks: Risk[];
238
- acceptanceCriteria: AcceptanceCriterion[];
239
- }
240
-
241
- export interface Stakeholder {
242
- role: string;
243
- description: string;
244
- tasks: string[];
245
- frequency: 'daily' | 'weekly' | 'monthly' | 'rarely';
246
- }
247
-
248
- export interface FeatureScope {
249
- mustHave: string[];
250
- shouldHave: string[];
251
- couldHave: string[];
252
- outOfScope: string[];
253
- mainFlow: string[];
254
- alternativeFlows: AlternativeFlow[];
255
- }
256
-
257
- export interface AlternativeFlow {
258
- condition: string;
259
- steps: string[];
260
- }
261
-
262
- export interface Risk {
263
- id: string;
264
- description: string;
265
- severity: 'high' | 'medium' | 'low';
266
- mitigation: string;
267
- }
268
-
269
- export interface AcceptanceCriterion {
270
- id: string;
271
- description: string;
272
- testable: boolean;
273
- }
274
-
275
- // --- Analysis ---
276
-
277
- export interface FeatureAnalysis {
278
- objectives: BusinessObjective[];
279
- businessRules: BusinessRule[];
280
- entities: Entity[];
281
- processFlow: string;
282
- integrations: Integration[];
283
- }
284
-
285
- export interface BusinessObjective {
286
- id: string;
287
- description: string;
288
- measurable: boolean;
289
- }
290
-
291
- export interface BusinessRule {
292
- id: string; // BR-XXX
293
- rule: string;
294
- category: 'Validation' | 'Calculation' | 'Workflow' | 'Security' | 'Data';
295
- priority: 'Must' | 'Should' | 'Could';
296
- condition: string;
297
- action: string;
298
- examples: BusinessRuleExample[];
299
- linkedRules: string[]; // Cross-reference other BR-IDs
300
- }
301
-
302
- export interface BusinessRuleExample {
303
- input: string;
304
- expected: string;
305
- }
306
-
307
- export interface Entity {
308
- name: string; // PascalCase
309
- description: string;
310
- attributes: EntityAttribute[];
311
- relationships: EntityRelationship[];
312
- }
313
-
314
- export interface EntityAttribute {
315
- name: string;
316
- type: string;
317
- required: boolean;
318
- rules: string;
319
- }
320
-
321
- export interface EntityRelationship {
322
- target: string;
323
- type: '1:1' | '1:N' | 'N:1' | 'N:M';
324
- description: string;
325
- }
326
-
327
- export interface Integration {
328
- system: string;
329
- direction: 'inbound' | 'outbound' | 'bidirectional';
330
- protocol: string;
331
- description: string;
332
- }
333
-
334
- // --- Specification ---
335
-
336
- export interface FeatureSpecification {
337
- actors: Actor[];
338
- useCases: UseCase[];
339
- functionalRequirements: FunctionalRequirement[];
340
- permissionMatrix: PermissionMatrix;
341
- navigation: NavigationHierarchy;
342
- gherkinScenarios: GherkinScenario[];
343
- apiEndpoints: ApiEndpoint[];
344
- validations: ValidationRule[];
345
- wireframes: Wireframe[];
346
- messages: BusinessMessage[];
347
- lifeCycles: EntityLifeCycle[];
348
- seedDataCore: SeedDataCore;
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;
428
- }
429
-
430
- export interface ValidationRule {
431
- field: string;
432
- rules: string;
433
- errorMessage: string;
434
- }
435
-
436
- export interface Wireframe {
437
- screen: string;
438
- section?: string; // Section code (list, detail, create, etc.)
439
- description: string;
440
- mockupFormat?: 'ascii' | 'svg'; // Format of the mockup
441
- mockup?: string; // ASCII art or inline SVG content
442
- elements: string[];
443
- actions: string[];
444
- permissionsRequired: string[];
445
- }
446
-
447
- export interface BusinessMessage {
448
- code: string; // SCREAMING_SNAKE_CASE
449
- type: 'success' | 'error' | 'warning' | 'info';
450
- title: string;
451
- message: string; // User-facing with {placeholders}
452
- i18nKey: string; // Dot-separated key
453
- }
454
-
455
- export interface EntityLifeCycle {
456
- entity: string; // PascalCase entity name
457
- states: LifeCycleState[];
458
- }
459
-
460
- export interface LifeCycleState {
461
- id: string; // State code (Draft, Active, etc.)
462
- displayName: string;
463
- description?: string;
464
- allowedTransitions: string[];
465
- isTerminal: boolean;
466
- }
467
-
468
- export interface SeedDataCore {
469
- navigationModules: SeedDataNavModule[];
470
- navigationTranslations: SeedDataNavTranslation[];
471
- permissions: SeedDataPermission[];
472
- rolePermissions: SeedDataRolePermission[];
473
- permissionConstants: SeedDataPermissionConstant[];
474
- }
475
-
476
- export interface SeedDataNavModule {
477
- code: string;
478
- label: string;
479
- icon: string;
480
- route: string;
481
- parentCode: string | null;
482
- sort: number;
483
- }
484
-
485
- export interface SeedDataNavTranslation {
486
- moduleCode: string;
487
- language: 'fr' | 'en' | 'it' | 'de';
488
- label: string;
489
- }
490
-
491
- export interface SeedDataPermission {
492
- path: string; // Module-level: business.{app}.{module}.{action} or section-level: business.{app}.{module}.{section}.{action}
493
- action: string;
494
- description?: string;
495
- }
496
-
497
- export interface SeedDataRolePermission {
498
- role: string;
499
- permissionPath: string; // Must match permissions[].path
500
- }
501
-
502
- export interface SeedDataPermissionConstant {
503
- constantName: string; // PascalCase (e.g., VehiclesRead)
504
- path: string; // Matching permission path
505
- }
506
-
507
- export interface Actor {
508
- name: string;
509
- description: string;
510
- permissionBase: string;
511
- }
512
-
513
- export interface UseCase {
514
- id: string; // UC-XXX
515
- name: string;
516
- actor: string;
517
- permission: string;
518
- preconditions: string[];
519
- postconditions: string[];
520
- mainScenario: string[];
521
- alternativeScenarios: { condition: string; steps: string[] }[];
522
- errorScenarios: { error: string; message: string; action: string }[];
523
- linkedRules: string[]; // BR-IDs
524
- }
525
-
526
- export interface FunctionalRequirement {
527
- id: string; // FR-XXX
528
- statement: string;
529
- priority: 'Must' | 'Should' | 'Could';
530
- acceptanceCriteria: string[];
531
- linkedUseCases: string[]; // UC-IDs
532
- linkedRules: string[]; // BR-IDs
533
- }
534
-
535
- export interface PermissionMatrix {
536
- roles: string[];
537
- permissions: PermissionEntry[];
538
- roleAssignments: RoleAssignment[];
539
- }
540
-
541
- export interface PermissionEntry {
542
- path: string; // business.{app}.{module}.{action}
543
- description: string;
544
- }
545
-
546
- export interface RoleAssignment {
547
- role: string;
548
- permissions: string[]; // Permission paths
549
- }
550
-
551
- export interface NavigationHierarchy {
552
- entries: NavigationEntry[];
553
- }
554
-
555
- export interface NavigationEntry {
556
- level: 'context' | 'application' | 'module' | 'section';
557
- code: string;
558
- labels: Record<string, string>; // {fr, en, it, de}
559
- route: string;
560
- icon: string;
561
- isNew: boolean;
562
- }
563
-
564
- export interface GherkinScenario {
565
- feature: string;
566
- name: string;
567
- tags: string[];
568
- steps: string;
569
- }
570
-
571
- export interface ApiEndpoint {
572
- path: string;
573
- method: 'GET' | 'POST' | 'PUT' | 'DELETE';
574
- permission: string;
575
- requestBody: string | null;
576
- responseType: string;
577
- }
578
-
579
- export interface I18nKey {
580
- key: string;
581
- fr: string;
582
- en: string;
583
- it: string;
584
- de: string;
585
- }
586
-
587
- // --- Validation ---
588
-
589
- export interface FeatureValidation {
590
- validatedAt: string | null;
591
- completenessChecks: CompletenessCheck[];
592
- consistencyChecks: ConsistencyCheck[];
593
- conventionChecks: ConventionCheck[];
594
- riskAssessments: RiskAssessment[];
595
- warnings: string[];
596
- decision: ValidationDecision;
597
- }
598
-
599
- export interface CompletenessCheck {
600
- section: string;
601
- count: number;
602
- minimum: number;
603
- status: 'PASS' | 'FAIL' | 'WARNING';
604
- }
605
-
606
- export interface ConsistencyCheck {
607
- check: string;
608
- passed: number;
609
- warnings: number;
610
- errors: number;
611
- status: 'PASS' | 'FAIL' | 'WARNING';
612
- }
613
-
614
- export interface ConventionCheck {
615
- check: string;
616
- status: 'PASS' | 'FAIL' | 'WARNING';
617
- details: string;
618
- }
619
-
620
- export interface RiskAssessment {
621
- risk: string;
622
- value: number;
623
- threshold: number;
624
- status: 'ACCEPTABLE' | 'WARNING' | 'CRITICAL' | 'MONITORED';
625
- }
626
-
627
- export interface ValidationDecision {
628
- approved: boolean;
629
- reason: string;
630
- approvalMode: 'standard' | 'micro' | 'delta' | 'force';
631
- approvedBy: string;
632
- approvedAt: string;
633
- }
634
-
635
- // --- Handoff ---
636
-
637
- export interface FeatureHandoff {
638
- complexity: 'simple' | 'medium' | 'complex';
639
- complexityDetails?: {
640
- entities: number;
641
- useCases: number;
642
- businessRules: number;
643
- calculated: string;
644
- };
645
- filesToCreate: FilesToCreate;
646
- brToCodeMapping: BrToCodeMapping[];
647
- apiEndpointSummary: ApiEndpointSummaryEntry[];
648
- ralphPrd: object | null; // .ralph/prd.json content
649
- }
650
-
651
- export interface FilesToCreate {
652
- domain: FileSpec[];
653
- application: FileSpec[];
654
- infrastructure: FileSpec[];
655
- api: FileSpec[];
656
- frontend: FileSpec[];
657
- seedData: FileSpec[];
658
- tests: FileSpec[];
659
- }
660
-
661
- export interface FileSpec {
662
- path: string;
663
- type: string; // Entity, Service, DTO, HasData, Constants, ApiController, Page, Component, etc.
664
- linkedFRs?: string[]; // FR-XXX references
665
- linkedUCs?: string[]; // UC-XXX references
666
- category?: 'core' | 'business'; // For seedData files
667
- source?: string; // Derivation source in feature.json
668
- description?: string;
669
- }
670
-
671
- export interface BrToCodeMapping {
672
- ruleId: string; // BR-XXX from analysis.businessRules
673
- title: string;
674
- implementationPoints: ImplementationPoint[];
675
- }
676
-
677
- export interface ImplementationPoint {
678
- layer: string; // Domain, Application, Infrastructure, API, Frontend
679
- component: string; // File name
680
- method: string; // Method or attribute
681
- implementation: string; // How the rule is enforced
682
- }
683
-
684
- export interface ApiEndpointSummaryEntry {
685
- operation: string;
686
- method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
687
- route: string; // MUST match specification.apiEndpoints[].path
688
- linkedUC: string;
689
- permissions: string;
690
- }
691
-
692
- // --- Suggestions & Changelog ---
693
-
694
- export interface FeatureSuggestion {
695
- type: 'module' | 'section' | 'integration' | 'enhancement';
696
- code: string;
697
- title: string;
698
- reason: string;
699
- accepted: boolean | null;
700
- }
701
-
702
- export interface ChangelogEntry {
703
- step?: string; // step-01-analyse, step-02-specify, etc.
704
- version?: string;
705
- timestamp: string;
706
- author?: string;
707
- changes: string[];
708
- warnings?: string[];
709
- decision?: string;
710
- }
711
- ```
712
-
713
- ---
714
-
715
- ## Data Loading
716
-
717
- ```typescript
718
- // web/smartstack-web/src/services/businessAnalyse.ts
719
-
720
- import type { FeatureJson, ApplicationFeatureJson } from '../types/business-analyse';
721
-
722
- /**
723
- * Load module-level feature.json from docs path
724
- * The web app reads the JSON directly - no transformation needed
725
- */
726
- export async function loadFeature(
727
- app: string,
728
- module: string,
729
- version: string
730
- ): Promise<FeatureJson> {
731
- const response = await fetch(
732
- `/docs/business/${app}/${module}/business-analyse/v${version}/feature.json`
733
- );
734
- return response.json();
735
- }
736
-
737
- /**
738
- * Load application-level (master) feature.json
739
- */
740
- export async function loadApplicationFeature(
741
- app: string,
742
- version: string
743
- ): Promise<ApplicationFeatureJson> {
744
- const response = await fetch(
745
- `/docs/business/${app}/business-analyse/v${version}/feature.json`
746
- );
747
- return response.json();
748
- }
749
-
750
- /**
751
- * List available versions for a module
752
- */
753
- export async function listVersions(
754
- app: string,
755
- module: string
756
- ): Promise<string[]> {
757
- const response = await fetch(
758
- `/api/docs/business/${app}/${module}/business-analyse/versions`
759
- );
760
- return response.json();
761
- }
762
-
763
- /**
764
- * List available versions for an application (master)
765
- */
766
- export async function listApplicationVersions(
767
- app: string
768
- ): Promise<string[]> {
769
- const response = await fetch(
770
- `/api/docs/business/${app}/business-analyse/versions`
771
- );
772
- return response.json();
773
- }
774
- ```
775
-
776
- ---
777
-
778
- ## Index Export
779
-
780
- ```typescript
781
- // web/smartstack-web/src/types/index.ts
782
-
783
- export type {
784
- // Application-level types
785
- ApplicationFeatureJson,
786
- ApplicationStatus,
787
- ApplicationMetadata,
788
- WorkflowState,
789
- ApplicationCadrage,
790
- GlobalScope,
791
- ApplicationRole,
792
- ApplicationModule,
793
- DependencyGraph,
794
- DependencyEdge,
795
- DependencyLayer,
796
- ApplicationConsolidation,
797
- CrossModuleInteractions,
798
- E2EFlow,
799
- PermissionCoherence,
800
-
801
- // Module-level types
802
- FeatureJson,
803
- FeatureStatus,
804
- FeatureMetadata,
805
- ApplicationContext,
806
- FeatureDiscovery,
807
- FeatureAnalysis,
808
- FeatureSpecification,
809
- FeatureValidation,
810
- FeatureHandoff,
811
- BusinessRule,
812
- UseCase,
813
- FunctionalRequirement,
814
- Entity,
815
- PermissionMatrix,
816
- Wireframe,
817
- BusinessMessage,
818
- EntityLifeCycle,
819
- SeedDataCore,
820
- FilesToCreate,
821
- FileSpec,
822
- BrToCodeMapping,
823
- ValidationDecision,
824
- FeatureSuggestion,
825
- ChangelogEntry,
826
- Section,
827
- Resource,
828
- ResourceType,
829
- FormField,
830
- FormComponent,
831
- Dashboard,
832
- DashboardKpi,
833
- DashboardFilter,
834
- ChartType
835
- } from './business-analyse';
836
- ```
1
+ # TypeScript Schema - Feature JSON Types
2
+
3
+ > **Usage:** TypeScript interfaces aligned with feature-schema.json and application-schema.json
4
+ > **Loaded in:** step-05b-deploy.md (for web app rendering)
5
+ > **Source (module):** `docs/{app}/{module}/business-analyse/v{X.Y}/feature.json`
6
+ > **Source (application):** `docs/{app}/business-analyse/v{X.Y}/feature.json`
7
+
8
+ ---
9
+
10
+ ## Type Definitions
11
+
12
+ ```typescript
13
+ // web/smartstack-web/src/types/docs.ts
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
+
186
+ /**
187
+ * Module-level Feature JSON structure
188
+ * Matches schemas/feature-schema.json
189
+ * Progressively enriched by each BA step
190
+ */
191
+ export interface FeatureJson {
192
+ id: string; // FEAT-XXX
193
+ version: string; // 1.0, 1.1, etc.
194
+ status: FeatureStatus;
195
+ scope?: 'module';
196
+ metadata: FeatureMetadata;
197
+ applicationContext?: ApplicationContext;
198
+ discovery: FeatureDiscovery;
199
+ analysis: FeatureAnalysis;
200
+ specification: FeatureSpecification;
201
+ validation: FeatureValidation;
202
+ handoff: FeatureHandoff;
203
+ suggestions: FeatureSuggestion[];
204
+ changelog: ChangelogEntry[];
205
+ }
206
+
207
+ export type FeatureStatus = 'draft' | 'framed' | 'analysed' | 'decomposed' | 'specified' | 'consolidated' | 'approved' | 'handed-off';
208
+
209
+ export interface FeatureMetadata {
210
+ application: string;
211
+ module: string;
212
+ language: string;
213
+ featureType: 'new' | 'refactoring' | 'micro';
214
+ scope?: 'application' | 'module';
215
+ applicationRef?: string | null;
216
+ moduleIndex?: number | null;
217
+ createdAt: string;
218
+ updatedAt: string;
219
+ previousVersion: string | null;
220
+ }
221
+
222
+ export interface ApplicationContext {
223
+ applicationRoles: ApplicationRole[];
224
+ permissionBase: string;
225
+ relatedModules: string[];
226
+ }
227
+
228
+ // --- Discovery ---
229
+
230
+ export interface FeatureDiscovery {
231
+ problem: string;
232
+ asIs: string;
233
+ toBe: string;
234
+ trigger: string;
235
+ stakeholders: Stakeholder[];
236
+ scope: FeatureScope;
237
+ risks: Risk[];
238
+ acceptanceCriteria: AcceptanceCriterion[];
239
+ }
240
+
241
+ export interface Stakeholder {
242
+ role: string;
243
+ description: string;
244
+ tasks: string[];
245
+ frequency: 'daily' | 'weekly' | 'monthly' | 'rarely';
246
+ }
247
+
248
+ export interface FeatureScope {
249
+ mustHave: string[];
250
+ shouldHave: string[];
251
+ couldHave: string[];
252
+ outOfScope: string[];
253
+ mainFlow: string[];
254
+ alternativeFlows: AlternativeFlow[];
255
+ }
256
+
257
+ export interface AlternativeFlow {
258
+ condition: string;
259
+ steps: string[];
260
+ }
261
+
262
+ export interface Risk {
263
+ id: string;
264
+ description: string;
265
+ severity: 'high' | 'medium' | 'low';
266
+ mitigation: string;
267
+ }
268
+
269
+ export interface AcceptanceCriterion {
270
+ id: string;
271
+ description: string;
272
+ testable: boolean;
273
+ }
274
+
275
+ // --- Analysis ---
276
+
277
+ export interface FeatureAnalysis {
278
+ objectives: BusinessObjective[];
279
+ businessRules: BusinessRule[];
280
+ entities: Entity[];
281
+ processFlow: string;
282
+ integrations: Integration[];
283
+ }
284
+
285
+ export interface BusinessObjective {
286
+ id: string;
287
+ description: string;
288
+ measurable: boolean;
289
+ }
290
+
291
+ export interface BusinessRule {
292
+ id: string; // BR-XXX
293
+ rule: string;
294
+ category: 'Validation' | 'Calculation' | 'Workflow' | 'Security' | 'Data';
295
+ priority: 'Must' | 'Should' | 'Could';
296
+ condition: string;
297
+ action: string;
298
+ examples: BusinessRuleExample[];
299
+ linkedRules: string[]; // Cross-reference other BR-IDs
300
+ }
301
+
302
+ export interface BusinessRuleExample {
303
+ input: string;
304
+ expected: string;
305
+ }
306
+
307
+ export interface Entity {
308
+ name: string; // PascalCase
309
+ description: string;
310
+ attributes: EntityAttribute[];
311
+ relationships: EntityRelationship[];
312
+ }
313
+
314
+ export interface EntityAttribute {
315
+ name: string;
316
+ type: string;
317
+ required: boolean;
318
+ rules: string;
319
+ }
320
+
321
+ export interface EntityRelationship {
322
+ target: string;
323
+ type: '1:1' | '1:N' | 'N:1' | 'N:M';
324
+ description: string;
325
+ }
326
+
327
+ export interface Integration {
328
+ system: string;
329
+ direction: 'inbound' | 'outbound' | 'bidirectional';
330
+ protocol: string;
331
+ description: string;
332
+ }
333
+
334
+ // --- Specification ---
335
+
336
+ export interface FeatureSpecification {
337
+ actors: Actor[];
338
+ useCases: UseCase[];
339
+ functionalRequirements: FunctionalRequirement[];
340
+ permissionMatrix: PermissionMatrix;
341
+ navigation: NavigationHierarchy;
342
+ gherkinScenarios: GherkinScenario[];
343
+ apiEndpoints: ApiEndpoint[];
344
+ validations: ValidationRule[];
345
+ wireframes: Wireframe[];
346
+ messages: BusinessMessage[];
347
+ lifeCycles: EntityLifeCycle[];
348
+ seedDataCore: SeedDataCore;
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;
428
+ }
429
+
430
+ export interface ValidationRule {
431
+ field: string;
432
+ rules: string;
433
+ errorMessage: string;
434
+ }
435
+
436
+ export interface Wireframe {
437
+ screen: string;
438
+ section?: string; // Section code (list, detail, create, etc.)
439
+ description: string;
440
+ mockupFormat?: 'ascii' | 'svg'; // Format of the mockup
441
+ mockup?: string; // ASCII art or inline SVG content
442
+ elements: string[];
443
+ actions: string[];
444
+ permissionsRequired: string[];
445
+ }
446
+
447
+ export interface BusinessMessage {
448
+ code: string; // SCREAMING_SNAKE_CASE
449
+ type: 'success' | 'error' | 'warning' | 'info';
450
+ title: string;
451
+ message: string; // User-facing with {placeholders}
452
+ i18nKey: string; // Dot-separated key
453
+ }
454
+
455
+ export interface EntityLifeCycle {
456
+ entity: string; // PascalCase entity name
457
+ states: LifeCycleState[];
458
+ }
459
+
460
+ export interface LifeCycleState {
461
+ id: string; // State code (Draft, Active, etc.)
462
+ displayName: string;
463
+ description?: string;
464
+ allowedTransitions: string[];
465
+ isTerminal: boolean;
466
+ }
467
+
468
+ export interface SeedDataCore {
469
+ navigationModules: SeedDataNavModule[];
470
+ navigationTranslations: SeedDataNavTranslation[];
471
+ permissions: SeedDataPermission[];
472
+ rolePermissions: SeedDataRolePermission[];
473
+ permissionConstants: SeedDataPermissionConstant[];
474
+ }
475
+
476
+ export interface SeedDataNavModule {
477
+ code: string;
478
+ label: string;
479
+ icon: string;
480
+ route: string;
481
+ parentCode: string | null;
482
+ sort: number;
483
+ }
484
+
485
+ export interface SeedDataNavTranslation {
486
+ moduleCode: string;
487
+ language: 'fr' | 'en' | 'it' | 'de';
488
+ label: string;
489
+ }
490
+
491
+ export interface SeedDataPermission {
492
+ path: string; // Module-level: {app}.{module}.{action} or section-level: {app}.{module}.{section}.{action}
493
+ action: string;
494
+ description?: string;
495
+ }
496
+
497
+ export interface SeedDataRolePermission {
498
+ role: string;
499
+ permissionPath: string; // Must match permissions[].path
500
+ }
501
+
502
+ export interface SeedDataPermissionConstant {
503
+ constantName: string; // PascalCase (e.g., VehiclesRead)
504
+ path: string; // Matching permission path
505
+ }
506
+
507
+ export interface Actor {
508
+ name: string;
509
+ description: string;
510
+ permissionBase: string;
511
+ }
512
+
513
+ export interface UseCase {
514
+ id: string; // UC-XXX
515
+ name: string;
516
+ actor: string;
517
+ permission: string;
518
+ preconditions: string[];
519
+ postconditions: string[];
520
+ mainScenario: string[];
521
+ alternativeScenarios: { condition: string; steps: string[] }[];
522
+ errorScenarios: { error: string; message: string; action: string }[];
523
+ linkedRules: string[]; // BR-IDs
524
+ }
525
+
526
+ export interface FunctionalRequirement {
527
+ id: string; // FR-XXX
528
+ statement: string;
529
+ priority: 'Must' | 'Should' | 'Could';
530
+ acceptanceCriteria: string[];
531
+ linkedUseCases: string[]; // UC-IDs
532
+ linkedRules: string[]; // BR-IDs
533
+ }
534
+
535
+ export interface PermissionMatrix {
536
+ roles: string[];
537
+ permissions: PermissionEntry[];
538
+ roleAssignments: RoleAssignment[];
539
+ }
540
+
541
+ export interface PermissionEntry {
542
+ path: string; // {app}.{module}.{action}
543
+ description: string;
544
+ }
545
+
546
+ export interface RoleAssignment {
547
+ role: string;
548
+ permissions: string[]; // Permission paths
549
+ }
550
+
551
+ export interface NavigationHierarchy {
552
+ entries: NavigationEntry[];
553
+ }
554
+
555
+ export interface NavigationEntry {
556
+ level: 'application' | 'module' | 'section' | 'resource';
557
+ code: string;
558
+ labels: Record<string, string>; // {fr, en, it, de}
559
+ route: string;
560
+ icon: string;
561
+ isNew: boolean;
562
+ }
563
+
564
+ export interface GherkinScenario {
565
+ feature: string;
566
+ name: string;
567
+ tags: string[];
568
+ steps: string;
569
+ }
570
+
571
+ export interface ApiEndpoint {
572
+ path: string;
573
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
574
+ permission: string;
575
+ requestBody: string | null;
576
+ responseType: string;
577
+ }
578
+
579
+ export interface I18nKey {
580
+ key: string;
581
+ fr: string;
582
+ en: string;
583
+ it: string;
584
+ de: string;
585
+ }
586
+
587
+ // --- Validation ---
588
+
589
+ export interface FeatureValidation {
590
+ validatedAt: string | null;
591
+ completenessChecks: CompletenessCheck[];
592
+ consistencyChecks: ConsistencyCheck[];
593
+ conventionChecks: ConventionCheck[];
594
+ riskAssessments: RiskAssessment[];
595
+ warnings: string[];
596
+ decision: ValidationDecision;
597
+ }
598
+
599
+ export interface CompletenessCheck {
600
+ section: string;
601
+ count: number;
602
+ minimum: number;
603
+ status: 'PASS' | 'FAIL' | 'WARNING';
604
+ }
605
+
606
+ export interface ConsistencyCheck {
607
+ check: string;
608
+ passed: number;
609
+ warnings: number;
610
+ errors: number;
611
+ status: 'PASS' | 'FAIL' | 'WARNING';
612
+ }
613
+
614
+ export interface ConventionCheck {
615
+ check: string;
616
+ status: 'PASS' | 'FAIL' | 'WARNING';
617
+ details: string;
618
+ }
619
+
620
+ export interface RiskAssessment {
621
+ risk: string;
622
+ value: number;
623
+ threshold: number;
624
+ status: 'ACCEPTABLE' | 'WARNING' | 'CRITICAL' | 'MONITORED';
625
+ }
626
+
627
+ export interface ValidationDecision {
628
+ approved: boolean;
629
+ reason: string;
630
+ approvalMode: 'standard' | 'micro' | 'delta' | 'force';
631
+ approvedBy: string;
632
+ approvedAt: string;
633
+ }
634
+
635
+ // --- Handoff ---
636
+
637
+ export interface FeatureHandoff {
638
+ complexity: 'simple' | 'medium' | 'complex';
639
+ complexityDetails?: {
640
+ entities: number;
641
+ useCases: number;
642
+ businessRules: number;
643
+ calculated: string;
644
+ };
645
+ filesToCreate: FilesToCreate;
646
+ brToCodeMapping: BrToCodeMapping[];
647
+ apiEndpointSummary: ApiEndpointSummaryEntry[];
648
+ ralphPrd: object | null; // .ralph/prd.json content
649
+ }
650
+
651
+ export interface FilesToCreate {
652
+ domain: FileSpec[];
653
+ application: FileSpec[];
654
+ infrastructure: FileSpec[];
655
+ api: FileSpec[];
656
+ frontend: FileSpec[];
657
+ seedData: FileSpec[];
658
+ tests: FileSpec[];
659
+ }
660
+
661
+ export interface FileSpec {
662
+ path: string;
663
+ type: string; // Entity, Service, DTO, HasData, Constants, ApiController, Page, Component, etc.
664
+ linkedFRs?: string[]; // FR-XXX references
665
+ linkedUCs?: string[]; // UC-XXX references
666
+ category?: 'core' | 'business'; // For seedData files
667
+ source?: string; // Derivation source in feature.json
668
+ description?: string;
669
+ }
670
+
671
+ export interface BrToCodeMapping {
672
+ ruleId: string; // BR-XXX from analysis.businessRules
673
+ title: string;
674
+ implementationPoints: ImplementationPoint[];
675
+ }
676
+
677
+ export interface ImplementationPoint {
678
+ layer: string; // Domain, Application, Infrastructure, API, Frontend
679
+ component: string; // File name
680
+ method: string; // Method or attribute
681
+ implementation: string; // How the rule is enforced
682
+ }
683
+
684
+ export interface ApiEndpointSummaryEntry {
685
+ operation: string;
686
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
687
+ route: string; // MUST match specification.apiEndpoints[].path
688
+ linkedUC: string;
689
+ permissions: string;
690
+ }
691
+
692
+ // --- Suggestions & Changelog ---
693
+
694
+ export interface FeatureSuggestion {
695
+ type: 'module' | 'section' | 'integration' | 'enhancement';
696
+ code: string;
697
+ title: string;
698
+ reason: string;
699
+ accepted: boolean | null;
700
+ }
701
+
702
+ export interface ChangelogEntry {
703
+ step?: string; // step-01-analyse, step-02-specify, etc.
704
+ version?: string;
705
+ timestamp: string;
706
+ author?: string;
707
+ changes: string[];
708
+ warnings?: string[];
709
+ decision?: string;
710
+ }
711
+ ```
712
+
713
+ ---
714
+
715
+ ## Data Loading
716
+
717
+ ```typescript
718
+ // web/smartstack-web/src/services/businessAnalyse.ts
719
+
720
+ import type { FeatureJson, ApplicationFeatureJson } from '../types/business-analyse';
721
+
722
+ /**
723
+ * Load module-level feature.json from docs path
724
+ * The web app reads the JSON directly - no transformation needed
725
+ */
726
+ export async function loadFeature(
727
+ app: string,
728
+ module: string,
729
+ version: string
730
+ ): Promise<FeatureJson> {
731
+ const response = await fetch(
732
+ `/docs/${app}/${module}/business-analyse/v${version}/feature.json`
733
+ );
734
+ return response.json();
735
+ }
736
+
737
+ /**
738
+ * Load application-level (master) feature.json
739
+ */
740
+ export async function loadApplicationFeature(
741
+ app: string,
742
+ version: string
743
+ ): Promise<ApplicationFeatureJson> {
744
+ const response = await fetch(
745
+ `/docs/${app}/business-analyse/v${version}/feature.json`
746
+ );
747
+ return response.json();
748
+ }
749
+
750
+ /**
751
+ * List available versions for a module
752
+ */
753
+ export async function listVersions(
754
+ app: string,
755
+ module: string
756
+ ): Promise<string[]> {
757
+ const response = await fetch(
758
+ `/api/docs/${app}/${module}/business-analyse/versions`
759
+ );
760
+ return response.json();
761
+ }
762
+
763
+ /**
764
+ * List available versions for an application (master)
765
+ */
766
+ export async function listApplicationVersions(
767
+ app: string
768
+ ): Promise<string[]> {
769
+ const response = await fetch(
770
+ `/api/docs/${app}/business-analyse/versions`
771
+ );
772
+ return response.json();
773
+ }
774
+ ```
775
+
776
+ ---
777
+
778
+ ## Index Export
779
+
780
+ ```typescript
781
+ // web/smartstack-web/src/types/index.ts
782
+
783
+ export type {
784
+ // Application-level types
785
+ ApplicationFeatureJson,
786
+ ApplicationStatus,
787
+ ApplicationMetadata,
788
+ WorkflowState,
789
+ ApplicationCadrage,
790
+ GlobalScope,
791
+ ApplicationRole,
792
+ ApplicationModule,
793
+ DependencyGraph,
794
+ DependencyEdge,
795
+ DependencyLayer,
796
+ ApplicationConsolidation,
797
+ CrossModuleInteractions,
798
+ E2EFlow,
799
+ PermissionCoherence,
800
+
801
+ // Module-level types
802
+ FeatureJson,
803
+ FeatureStatus,
804
+ FeatureMetadata,
805
+ ApplicationContext,
806
+ FeatureDiscovery,
807
+ FeatureAnalysis,
808
+ FeatureSpecification,
809
+ FeatureValidation,
810
+ FeatureHandoff,
811
+ BusinessRule,
812
+ UseCase,
813
+ FunctionalRequirement,
814
+ Entity,
815
+ PermissionMatrix,
816
+ Wireframe,
817
+ BusinessMessage,
818
+ EntityLifeCycle,
819
+ SeedDataCore,
820
+ FilesToCreate,
821
+ FileSpec,
822
+ BrToCodeMapping,
823
+ ValidationDecision,
824
+ FeatureSuggestion,
825
+ ChangelogEntry,
826
+ Section,
827
+ Resource,
828
+ ResourceType,
829
+ FormField,
830
+ FormComponent,
831
+ Dashboard,
832
+ DashboardKpi,
833
+ DashboardFilter,
834
+ ChartType
835
+ } from './docs';
836
+ ```