@atlashub/smartstack-cli 2.0.0 → 2.1.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 (32) hide show
  1. package/.documentation/agents.html +147 -40
  2. package/.documentation/apex.html +1 -1
  3. package/.documentation/business-analyse.html +3 -3
  4. package/.documentation/cli-commands.html +2 -2
  5. package/.documentation/commands.html +14 -14
  6. package/.documentation/efcore.html +14 -14
  7. package/.documentation/gitflow.html +12 -12
  8. package/.documentation/hooks.html +41 -3
  9. package/.documentation/index.html +1 -1
  10. package/.documentation/init.html +2 -2
  11. package/.documentation/installation.html +11 -11
  12. package/.documentation/js/app.js +1 -1
  13. package/.documentation/ralph-loop.html +1 -1
  14. package/.documentation/test-web.html +4 -4
  15. package/dist/index.js +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/mcp-entry.mjs +57595 -4569
  18. package/dist/mcp-entry.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/templates/skills/business-analyse/_shared.md +55 -14
  21. package/templates/skills/business-analyse/steps/step-03-specify.md +63 -0
  22. package/templates/skills/business-analyse/steps/step-04-validate.md +23 -1
  23. package/templates/skills/business-analyse/steps/step-05-handoff.md +136 -53
  24. package/templates/skills/business-analyse/templates/tpl-handoff.md +99 -23
  25. package/templates/skills/controller/templates.md +82 -0
  26. package/templates/skills/efcore/references/zero-downtime-patterns.md +227 -0
  27. package/templates/skills/efcore/steps/migration/step-03-validate.md +19 -0
  28. package/templates/skills/review-code/SKILL.md +4 -2
  29. package/templates/skills/review-code/references/owasp-api-top10.md +243 -0
  30. package/templates/skills/review-code/references/security-checklist.md +86 -1
  31. package/templates/skills/review-code/references/smartstack-conventions.md +166 -0
  32. package/templates/skills/workflow/SKILL.md +27 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlashub/smartstack-cli",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "SmartStack Claude Code automation toolkit - GitFlow, APEX, EF Core migrations, prompts and more",
5
5
  "author": {
6
6
  "name": "SmartStack",
@@ -70,14 +70,15 @@ Route pattern : `/business/{application}/{module}/{section}`
70
70
 
71
71
  ### Classes de Base des Entités
72
72
 
73
- | Classe | Champs auto-inclus | Quand utiliser |
74
- |--------|--------------------|----------------|
75
- | `Entity` | `Id` (Guid) | Entité simple sans audit |
76
- | `AuditableEntity` | + `CreatedBy`, `CreatedDate`, `ModifiedBy`, `ModifiedDate` | **Défaut pour toute entité métier** |
77
- | `SoftDeletableEntity` | + `IsDeleted`, `DeletedBy`, `DeletedDate` | Entité avec suppression logique |
78
- | `HierarchicalEntity` | + `ParentId`, `Level`, `Path` | Arborescences (catégories, menus) |
73
+ | Classe | Interface | Champs auto-inclus | Quand utiliser |
74
+ |--------|-----------|---------------------|----------------|
75
+ | `BaseEntity` | - | `Id` (Guid), `TenantId`, `CreatedAt`, `UpdatedAt` | **Défaut pour toute entité métier** |
76
+ | `BaseEntity` | `IAuditableEntity` | + `CreatedBy`, `UpdatedBy` | Entité avec audit complet |
77
+ | `SystemEntity` | - | `Id` (Guid), `CreatedAt` (pas de TenantId) | Entités système (navigation, permissions) |
78
+ | `BaseEntity` | `ISoftDeletable` | + `IsDeleted`, `DeletedBy`, `DeletedAt` | Entité avec suppression logique |
79
+ | `HierarchicalEntity` | - | + `ParentId`, `Level`, `Path` | Arborescences (catégories, menus) |
79
80
 
80
- > **IMPORTANT :** Ne JAMAIS proposer `CreatedBy`, `ModifiedBy`, `IsDeleted` comme champs explicites — ils sont AUTOMATIQUES via la classe de base.
81
+ > **IMPORTANT :** Ne JAMAIS proposer `CreatedBy`, `UpdatedBy`, `IsDeleted`, `TenantId` comme champs explicites — ils sont AUTOMATIQUES via la classe de base ou l'interface.
81
82
 
82
83
  ### Services d'Intégration Disponibles
83
84
 
@@ -91,13 +92,53 @@ Route pattern : `/business/{application}/{module}/{section}`
91
92
 
92
93
  ### Conventions Base de Données
93
94
 
94
- | Aspect | Convention |
95
- |--------|------------|
96
- | Schema | `core` (socle) vs `ext` (extensions/métier) |
97
- | Tables | PascalCase au pluriel (`Orders`, `OrderLines`) |
98
- | FK | `{Entity}Id` (ex: `ClientId`, `OrderId`) |
99
- | Index | `IX_{Table}_{Column}` |
100
- | Migration | 1 migration par feature, nommée via MCP |
95
+ | Aspect | Convention | Exemple |
96
+ |--------|------------|---------|
97
+ | Schema | `core` (socle SmartStack) vs `extensions` (entités client/métier) | `core.auth_Roles`, `extensions.bik_FreeBickes` |
98
+ | Tables | `{prefix}_{EntityPlural}` (préfixe domaine + PascalCase pluriel) | `auth_Users`, `nav_Applications`, `supp_Tickets` |
99
+ | Préfixes domaine | `auth_` (auth), `nav_` (navigation), `cfg_` (config), `ref_` (références), `wkf_` (workflows), `ai_` (IA), `loc_` (i18n), `lic_` (licences), `tenant_` (tenants), `support_` (support) | Pour un nouveau module métier : choisir un préfixe court (3-5 chars) |
100
+ | FK | `{Entity}Id` (ex: `ClientId`, `OrderId`) | |
101
+ | Index | `IX_{Table}_{Column}` | `IX_bik_FreeBickes_TenantId_Code` |
102
+ | Migration | 1 migration par feature, nommée via MCP (`suggest_migration`) | `extensions_v1.0.0_001_AddFreeBicke` |
103
+
104
+ ### Conventions de Dossiers (Clean Architecture)
105
+
106
+ | Couche | Pattern de dossiers | Exemple (module FreeBicke dans business > operations) |
107
+ |--------|--------------------|---------------------------------------------------------|
108
+ | **Domain** | `{Project}.Domain/Business/{Application}/{Module}/` | `Domain/Business/Operations/FreeBicke/FreeBicke.cs` |
109
+ | **Application/DTOs** | `{Project}.Application/Business/{Application}/{Module}/DTOs/` | `Application/Business/Operations/FreeBicke/DTOs/FreeBickeDto.cs` |
110
+ | **Application/Interfaces** | `{Project}.Application/Common/Interfaces/` | `Application/Common/Interfaces/IFreeBickeService.cs` |
111
+ | **Infrastructure/Config** | `{Project}.Infrastructure/Persistence/Configurations/{Module}/` | `Configurations/FreeBicke/FreeBickeConfiguration.cs` |
112
+ | **Infrastructure/Services** | `{Project}.Infrastructure/Services/{Module}/` | `Services/FreeBicke/FreeBickeService.cs` |
113
+ | **Infrastructure/SeedData** | `{Project}.Infrastructure/Persistence/Seeding/Data/{Module}/` | `Seeding/Data/FreeBicke/FreeBickeSeedData.cs` |
114
+ | **API/Controllers** | `{Project}.Api/Controllers/Business/{Application}/` | `Controllers/Business/Operations/FreeBickeController.cs` |
115
+ | **Frontend/Pages** | `web/src/pages/business/{application}/{module}/` | `pages/business/operations/freebicke/page.tsx` |
116
+ | **Frontend/i18n** | `web/src/i18n/locales/{lang}/{module}.json` | `locales/fr/freebicke.json` |
117
+
118
+ > **IMPORTANT :** Chaque module a son **propre sous-dossier** dans chaque couche. Ne JAMAIS mettre tous les fichiers à la racine d'une couche.
119
+
120
+ ### SeedData Core (Obligatoire pour chaque feature)
121
+
122
+ > **Chaque nouvelle feature nécessite des SeedData dans 5 fichiers core** pour être fonctionnelle (navigation visible, permissions actives, rôles assignés).
123
+
124
+ | # | Fichier | Contenu | Mécanisme |
125
+ |---|---------|---------|-----------|
126
+ | 1 | `NavigationModuleConfiguration.cs` | Entrée module dans `nav_Modules` (HasData) | EF Core Migration |
127
+ | 2 | `NavigationTranslationConfiguration.cs` | Traductions du module (4 langues × chaque entité nav) | EF Core Migration |
128
+ | 3 | `PermissionConfiguration.cs` | Permissions CRUD + wildcards dans `nav_Permissions` (HasData) | EF Core Migration |
129
+ | 4 | `Permissions.cs` (Application layer) | Constantes compile-time pour `[RequirePermission]` | Code |
130
+ | 5 | `RolePermissionConfiguration.cs` | Associations rôle-permission dans `auth_RolePermissions` (HasData) | EF Core Migration |
131
+
132
+ **Rôles par défaut pour chaque application (4 niveaux) :**
133
+
134
+ | Rôle | Permissions | Description |
135
+ |------|-------------|-------------|
136
+ | **{App} Admin** | `{context}.{app}.*` (wildcard) | Accès complet à l'application |
137
+ | **{App} Manager** | `read`, `create`, `update`, `assign` | Gestion complète sans suppression |
138
+ | **{App} Contributor** | `read`, `create`, `update` | Contribution active |
139
+ | **{App} Viewer** | `read` uniquement | Consultation seule |
140
+
141
+ > **CRITIQUE :** Si les SeedData ne sont pas créés, le module sera invisible dans la navigation et les permissions retourneront 403.
101
142
 
102
143
  ### Contraintes Non-Négociables
103
144
 
@@ -169,6 +169,69 @@ For each BR, create corresponding FR:
169
169
 
170
170
  ---
171
171
 
172
+ ### 6b. Specify Navigation Hierarchy & SeedData Requirements
173
+
174
+ > **CRITICAL:** Every new feature requires navigation entries and seed data to be functional.
175
+ > Without these, the module will be invisible and permissions will block all access (403).
176
+
177
+ **Navigation hierarchy for this feature:**
178
+
179
+ ```markdown
180
+ ### Navigation Hierarchy
181
+
182
+ | Level | Code | Label (EN) | Label (FR) | Route | Icon | New? |
183
+ |-------|------|-----------|-----------|-------|------|------|
184
+ | Context | business | Business | Métier | /business | Briefcase | Existing/New |
185
+ | Application | {application_name} | {App Label EN} | {App Label FR} | /business/{app} | {Icon} | Existing/New |
186
+ | Module | {module_name} | {Module Label EN} | {Module Label FR} | /business/{app}/{module} | {Icon} | **NEW** |
187
+ | Section (opt.) | {section} | {Section Label EN} | {Section Label FR} | /business/{app}/{module}/{section} | {Icon} | **NEW** |
188
+ ```
189
+
190
+ > **Rule:** Only create entries marked "New". Existing entries are reused from the database.
191
+ > Provide labels in 4 languages: FR, EN, IT, DE.
192
+
193
+ **Permission hierarchy for this module:**
194
+
195
+ ```markdown
196
+ ### Permission Hierarchy (HasData seeds)
197
+
198
+ | Permission Path | Level | Action | Description |
199
+ |----------------|-------|--------|-------------|
200
+ | `business.{app}.{module}.*` | Module | Wildcard | Full module access |
201
+ | `business.{app}.{module}.read` | Module | Read | View list and details |
202
+ | `business.{app}.{module}.create` | Module | Create | Create new entries |
203
+ | `business.{app}.{module}.update` | Module | Update | Modify existing |
204
+ | `business.{app}.{module}.delete` | Module | Delete | Remove entries |
205
+ | `business.{app}.{module}.export` | Module | Execute | Export data (if needed) |
206
+ ```
207
+
208
+ **Role-Permission assignments (default matrix):**
209
+
210
+ | Permission | {App} Admin | {App} Manager | {App} Contributor | {App} Viewer |
211
+ |------------|-------------|---------------|-------------------|--------------|
212
+ | `*.{module}.*` | X | - | - | - |
213
+ | `*.{module}.read` | - | X | X | X |
214
+ | `*.{module}.create` | - | X | X | - |
215
+ | `*.{module}.update` | - | X | X | - |
216
+ | `*.{module}.delete` | - | - | - | - |
217
+ | `*.{module}.export` | - | X | - | - |
218
+
219
+ > **Note:** Admin gets wildcard (includes all actions). SuperAdmin inherits via `*` wildcard.
220
+
221
+ **SeedData files to create/modify:**
222
+
223
+ > **5 mandatory files** for every new module (4 EF Core HasData + 1 Application code):
224
+
225
+ | # | File | Layer | Action | Content |
226
+ |---|------|-------|--------|---------|
227
+ | 1 | `NavigationModuleConfiguration.cs` | Infrastructure (HasData) | Add entry | Module in `nav_Modules` |
228
+ | 2 | `NavigationTranslationConfiguration.cs` | Infrastructure (HasData) | Add entries | 4 translations (fr, en, it, de) per nav entity |
229
+ | 3 | `PermissionConfiguration.cs` | Infrastructure (HasData) | Add entries | All permissions listed above |
230
+ | 4 | `Permissions.cs` | Application (code) | Add static class | Compile-time constants for `[RequirePermission]` |
231
+ | 5 | `RolePermissionConfiguration.cs` | Infrastructure (HasData) | Add entries | Role→Permission for {App} Admin, {App} Manager, {App} Contributor, {App} Viewer |
232
+
233
+ ---
234
+
172
235
  ### 7. Create UI Wireframes
173
236
 
174
237
  **Main screen wireframe:**
@@ -50,6 +50,9 @@ Read `{output_dir}/digest-03.md` for compressed context from previous step.
50
50
  - [ ] UI wireframes provided
51
51
  - [ ] Gherkin scenarios cover happy path + errors
52
52
  - [ ] i18n keys defined for messages
53
+ - [ ] Navigation hierarchy defined (Context/Application/Module/Section)
54
+ - [ ] SeedData requirements identified (navigation, permissions, roles, rolePermissions)
55
+ - [ ] Role-Permission assignment matrix specified (4 default roles)
53
56
 
54
57
  ---
55
58
 
@@ -88,6 +91,23 @@ INVALID: {app}.{module}.{action}
88
91
  - PascalCase for entity names
89
92
  - Matches module naming convention
90
93
 
94
+ **Folder structure conventions:**
95
+ - Domain entities in `Domain/Business/{Application}/{Module}/` (not flat `Entities/`)
96
+ - Application DTOs in `Application/Business/{Application}/{Module}/DTOs/` (not `Features/`)
97
+ - Infrastructure configs in `Configurations/{Module}/` (subfolder per module)
98
+ - Infrastructure services in `Services/{Module}/` (subfolder per module)
99
+ - Infrastructure seeds in `Seeding/Data/{Module}/` (subfolder per module)
100
+ - Controllers in `Controllers/Business/{Application}/` (grouped by context)
101
+ - Table naming: `{prefix}_{EntityPlural}` in correct schema (`core` or `extensions`)
102
+
103
+ **SeedData completeness:**
104
+ - [ ] Navigation hierarchy specified (new Context/Application/Module/Section entries)
105
+ - [ ] Translations specified for all 4 languages (fr, en, it, de)
106
+ - [ ] Permission paths follow format `business.{app}.{module}.{action}`
107
+ - [ ] Wildcard permission included (`business.{app}.{module}.*`)
108
+ - [ ] Role-Permission matrix covers 4 default roles (Admin, Manager, Contributor, Viewer)
109
+ - [ ] SeedData files listed in FRD section 6b
110
+
91
111
  ---
92
112
 
93
113
  ### 5. Documentation Freshness Check
@@ -207,7 +227,9 @@ INVALID: {app}.{module}.{action}
207
227
  "conventions": {
208
228
  "permissions": "OK",
209
229
  "navRoute": "OK",
210
- "naming": "OK"
230
+ "naming": "OK",
231
+ "folderStructure": "OK",
232
+ "seedData": "OK"
211
233
  },
212
234
  "risks": [
213
235
  {
@@ -54,27 +54,33 @@ Read: templates/tpl-handoff.md # ~100 lines
54
54
 
55
55
  **CRITICAL: Handoff must reference ACTUAL code patterns!**
56
56
 
57
+ > **NOTE:** Use `{project_namespace}` (from 00-context.md) instead of hardcoded "SmartStack".
58
+ > For client projects, namespace is typically `{ProjectName}` (e.g., `demo_multitenant`).
59
+
57
60
  If `{economy_mode}` = false, launch parallel agents:
58
61
 
59
62
  ```
60
63
  Agent 1: Backend patterns
61
- "Explore src/SmartStack.Domain/Entities/ and
62
- src/SmartStack.Application/Features/ to document:
63
- - Entity naming pattern
64
- - CQRS handler pattern
65
- - Validation pattern
66
- - Repository pattern"
64
+ "Explore src/{project_namespace}.Domain/Business/ and
65
+ src/{project_namespace}.Application/Business/ to document:
66
+ - Entity naming pattern and folder hierarchy (Domain/{Context}/{App}/{Module}/)
67
+ - Service interface pattern (Application/Common/Interfaces/)
68
+ - DTO pattern (Application/{Context}/{App}/{Module}/DTOs/)
69
+ - Validation pattern"
67
70
 
68
71
  Agent 2: Frontend patterns
69
- "Explore web/smartstack-web/src/pages/business/ to document:
72
+ "Explore web/src/pages/business/ to document:
70
73
  - Page component structure
71
74
  - API service pattern
72
75
  - i18n usage pattern
73
76
  - Form handling pattern"
74
77
 
75
78
  Agent 3: Infrastructure patterns
76
- "Explore src/SmartStack.Infrastructure/ to document:
77
- - EF Core configuration pattern
79
+ "Explore src/{project_namespace}.Infrastructure/ to document:
80
+ - EF Core configuration pattern (Persistence/Configurations/{Module}/)
81
+ - Service implementation pattern (Services/{Module}/)
82
+ - SeedData pattern (Persistence/Seeding/Data/{Module}/)
83
+ - Navigation/Permission/RolePermission seed files
78
84
  - DbContext registration
79
85
  - Migration naming convention"
80
86
  ```
@@ -87,25 +93,46 @@ If `{economy_mode}` = true:
87
93
 
88
94
  ### 5. Map Specifications to Files
89
95
 
96
+ > **IMPORTANT:** Replace `{project_namespace}` with the actual project namespace (from 00-context.md).
97
+ > Use the folder hierarchy `{Context}/{Application}/{Module}/` — NEVER put files at the root of a layer.
98
+
90
99
  **Backend files to create:**
91
100
 
92
101
  | Layer | File | Template/Pattern |
93
102
  |-------|------|------------------|
94
- | Domain | `src/SmartStack.Domain/Entities/Business/{Entity}.cs` | Standard entity |
95
- | Application | `src/SmartStack.Application/Features/{Module}/Commands/` | CQRS pattern |
96
- | Application | `src/SmartStack.Application/Features/{Module}/Queries/` | CQRS pattern |
97
- | Application | `src/SmartStack.Application/Features/{Module}/DTOs/` | Request/Response DTOs |
98
- | Application | `src/SmartStack.Application/Features/{Module}/Validators/` | FluentValidation |
99
- | Infrastructure | `src/SmartStack.Infrastructure/Persistence/Configurations/` | EF Core config |
100
- | API | `src/SmartStack.Api/Controllers/Business/{Module}Controller.cs` | NavRoute controller |
103
+ | Domain | `src/{project_namespace}.Domain/Business/{Application}/{Module}/{Entity}.cs` | BaseEntity + IAuditableEntity |
104
+ | Application/DTOs | `src/{project_namespace}.Application/Business/{Application}/{Module}/DTOs/{Entity}Dto.cs` | Record DTOs (Response, Create, Update) |
105
+ | Application/DTOs | `src/{project_namespace}.Application/Business/{Application}/{Module}/DTOs/{Entity}MappingExtensions.cs` | Entity DTO mapping |
106
+ | Application/Interface | `src/{project_namespace}.Application/Common/Interfaces/I{Entity}Service.cs` | Service interface |
107
+ | Application/Permissions | `src/{project_namespace}.Application/Business/{Application}/{Module}/Permissions.cs` | Static permission constants |
108
+ | Infrastructure/Config | `src/{project_namespace}.Infrastructure/Persistence/Configurations/{Module}/{Entity}Configuration.cs` | EF Core config + HasData |
109
+ | Infrastructure/Service | `src/{project_namespace}.Infrastructure/Services/{Module}/{Entity}Service.cs` | Service implementation |
110
+ | API | `src/{project_namespace}.Api/Controllers/Business/{Application}/{Module}Controller.cs` | NavRoute + RequirePermission |
111
+
112
+ **SeedData files to create/modify (CRITICAL — without these, module is invisible and returns 403):**
113
+
114
+ | Layer | File | Content |
115
+ |-------|------|---------|
116
+ > **5 mandatory seed files** for every new module. 4 are EF Core Configurations (HasData → migrations), 1 is Application layer code.
117
+
118
+ | # | Layer | File | Type | Content |
119
+ |---|-------|------|------|---------|
120
+ | 1 | Infrastructure | `Persistence/Configurations/Navigation/NavigationModuleConfiguration.cs` | HasData (migration) | Module entry in `nav_Modules` |
121
+ | 2 | Infrastructure | `Persistence/Configurations/Navigation/NavigationTranslationConfiguration.cs` | HasData (migration) | 4 translations (fr, en, it, de) per new nav entity |
122
+ | 3 | Infrastructure | `Persistence/Configurations/Navigation/PermissionConfiguration.cs` | HasData (migration) | Wildcard + CRUD permissions in `nav_Permissions` |
123
+ | 4 | Application | `Application/Business/{Application}/{Module}/Permissions.cs` | Code (compile-time) | Static constants for `[RequirePermission]` |
124
+ | 5 | Infrastructure | `Persistence/Configurations/Authorization/RolePermissionConfiguration.cs` | HasData (migration) | Role→Permission for {App} Admin, {App} Manager, {App} Contributor, {App} Viewer |
125
+
126
+ **Optional :** `Persistence/Seeding/Data/{Module}/{Entity}SeedData.cs` — Demo data for development (runtime, not migration)
101
127
 
102
128
  **Frontend files to create:**
103
129
 
104
130
  | Layer | File | Pattern |
105
131
  |-------|------|---------|
106
- | Pages | `web/smartstack-web/src/pages/business/{app}/{module}/` | Page components |
107
- | Services | `web/smartstack-web/src/services/api/{module}Api.ts` | Axios service |
108
- | i18n | `web/smartstack-web/src/i18n/locales/{lang}/{module}.json` | 4 languages |
132
+ | Pages | `web/src/pages/business/{app}/{module}/page.tsx` | Page component (list + actions) |
133
+ | Components | `web/src/components/business/{module}/` | Entity-specific components |
134
+ | Services | `web/src/services/api/{module}Api.ts` | Axios service (typed) |
135
+ | i18n | `web/src/i18n/locales/{lang}/{module}.json` | 4 languages (fr, en, it, de) |
109
136
 
110
137
  ---
111
138
 
@@ -116,25 +143,49 @@ For each file, provide explicit instructions:
116
143
  ```markdown
117
144
  ### Backend: {Entity}.cs
118
145
 
119
- **Path:** `src/SmartStack.Domain/Entities/Business/{Entity}.cs`
146
+ **Path:** `src/{project_namespace}.Domain/Business/{Application}/{Module}/{Entity}.cs`
120
147
 
121
- **Reference:** Copy pattern from `src/SmartStack.Domain/Entities/Business/[ExistingEntity].cs`
148
+ **Reference:** Copy pattern from existing entity in same layer (use Explore agent to find)
122
149
 
123
- **Properties to add:**
150
+ **Base class:** `BaseEntity` + `IAuditableEntity` (provides Id, TenantId, CreatedAt, UpdatedAt, CreatedBy, UpdatedBy)
151
+
152
+ **Properties to add (business properties ONLY — base class fields are automatic):**
124
153
  | Property | Type | Attributes | From BR |
125
154
  |----------|------|------------|---------|
126
- | Id | Guid | [Key] | - |
127
155
  | {attr1} | string | [Required, MaxLength(100)] | BR-001 |
128
156
  | {attr2} | decimal | [Precision(18,2)] | BR-002 |
129
- | TenantId | Guid | [Required] | Multi-tenant |
130
- | CreatedAt | DateTime | Audit | - |
131
- | UpdatedAt | DateTime | Audit | - |
157
+ | Code | string | [Required, MaxLength(50)] | Unique per tenant |
158
+
159
+ > **DO NOT add:** Id, TenantId, CreatedAt, UpdatedAt, CreatedBy, UpdatedBy these are automatic via BaseEntity/IAuditableEntity.
132
160
 
133
161
  **Business rules to implement:**
134
162
  - BR-001: {rule} -> Implement in Validator
135
163
  - BR-002: {rule} -> Implement in Entity method
136
164
  ```
137
165
 
166
+ ```markdown
167
+ ### SeedData: Navigation + Permissions + Roles
168
+
169
+ **CRITICAL: These seeds make the module visible and accessible. Without them → 403 errors.**
170
+
171
+ **Step 1 — Navigation seeds:**
172
+ - Add module entry in `NavigationModuleConfiguration.cs` (HasData)
173
+ - Add 4 translations per nav entity in `NavigationTranslationConfiguration.cs`
174
+ - Use deterministic GUIDs (SHA256 of full_path or sequential pattern)
175
+
176
+ **Step 2 — Permission seeds:**
177
+ - Add CRUD permissions + wildcard in `PermissionConfiguration.cs` (HasData)
178
+ - Add compile-time constants in `Permissions.cs` (Application layer)
179
+
180
+ **Step 3 — Role-Permission seeds:**
181
+ - Add associations in `RolePermissionConfiguration.cs` (HasData)
182
+ - Default: Admin=wildcard, Manager=read+create+update, Contributor=read+create+update, Viewer=read
183
+
184
+ **Step 4 — Migration:**
185
+ - Run MCP `suggest_migration` for naming
186
+ - Create migration with `dotnet ef migrations add`
187
+ ```
188
+
138
189
  ---
139
190
 
140
191
  ### 7. Map Business Rules to Code
@@ -272,12 +323,32 @@ Ce document est un prompt autonome pour Claude Code.
272
323
 
273
324
  ## 7. POST-IMPLEMENTATION CHECKLIST
274
325
 
275
- - [ ] Build backend OK (`dotnet build`)
276
- - [ ] Build frontend OK (`pnpm build`)
326
+ **Build & Tests:**
327
+ - [ ] Backend build OK (`dotnet build`)
328
+ - [ ] Frontend build OK (`pnpm build`)
277
329
  - [ ] Tests pass (`dotnet test`)
278
- - [ ] EF Core migration created
279
- - [ ] Permissions in PermissionConfiguration.cs
330
+
331
+ **Folder Conventions:**
332
+ - [ ] Domain entities in `Domain/Business/{Application}/{Module}/` (not flat)
333
+ - [ ] Application DTOs in `Application/Business/{Application}/{Module}/DTOs/`
334
+ - [ ] Infrastructure configs in `Configurations/{Module}/` (subfolder)
335
+ - [ ] Infrastructure services in `Services/{Module}/` (subfolder)
336
+ - [ ] Controller in `Controllers/Business/{Application}/`
337
+
338
+ **SeedData Core (CRITICAL):**
339
+ - [ ] Navigation module entry in `NavigationModuleConfiguration.cs` (HasData)
340
+ - [ ] Navigation translations in `NavigationTranslationConfiguration.cs` (4 langues)
341
+ - [ ] Permissions in `PermissionConfiguration.cs` (HasData: CRUD + wildcard)
342
+ - [ ] Permission constants in `Permissions.cs` (Application layer)
343
+ - [ ] Role-Permission assignments in `RolePermissionConfiguration.cs` (HasData: 4 roles)
344
+ - [ ] EF Core migration created (includes all HasData seeds)
345
+
346
+ **Frontend & i18n:**
280
347
  - [ ] i18n complete (FR, EN, IT, DE)
348
+ - [ ] Nested routes (NOT flat routes)
349
+ - [ ] Pages in `pages/business/{app}/{module}/`
350
+
351
+ **Documentation:**
281
352
  - [ ] Documentation: `/business-analyse:6-doc-html {feature_id}`
282
353
  - [ ] Documentation manifest updated: `docs-manifest.json`
283
354
 
@@ -379,39 +450,51 @@ Each task must have: `id`, `description`, `status: "pending"`, `category`, `depe
379
450
  ```
380
451
  LAYER 1 - DOMAIN (if entities defined in handoff section 3/4):
381
452
  Task per entity:
382
- description: "Create {Entity} entity in Domain/Entities/Business/ with properties: {property_list}"
453
+ description: "Create {Entity} entity in Domain/Business/{Application}/{Module}/{Entity}.cs with properties: {property_list}. Use BaseEntity + IAuditableEntity."
383
454
  category: "domain"
384
455
  dependencies: []
385
- acceptance_criteria: "Entity compiles, properties match handoff spec, correct base class (SoftDeletableEntity/AuditableEntity)"
456
+ acceptance_criteria: "Entity compiles, properties match handoff spec, correct base class (BaseEntity + IAuditableEntity), correct namespace and folder hierarchy"
386
457
  Task (if enums needed):
387
458
  description: "Create domain enums for {Module}: {EnumList} in Domain/Enums/{Module}/"
388
459
  category: "domain"
389
460
  dependencies: []
390
461
  acceptance_criteria: "Enums compile, values match handoff spec"
391
462
 
392
- LAYER 2 - APPLICATION (if CQRS handlers defined in handoff section 3/4):
463
+ LAYER 1.5 - SEED DATA (ALWAYS included for new modules):
464
+ Task 1 (navigation seeds):
465
+ description: "Create navigation seed data: add module entry in NavigationModuleConfiguration.cs (HasData) + 4-language translations in NavigationTranslationConfiguration.cs. Use deterministic GUIDs."
466
+ category: "seed-data"
467
+ dependencies: []
468
+ acceptance_criteria: "HasData entries compile, module visible in nav_Modules, translations in 4 languages (fr, en, it, de)"
469
+ Task 2 (permission seeds):
470
+ description: "Create permission seeds: add CRUD + wildcard permissions in PermissionConfiguration.cs (HasData) + compile-time constants in Permissions.cs (Application layer) for business.{app}.{module}"
471
+ category: "seed-data"
472
+ dependencies: [ID of navigation seed task]
473
+ acceptance_criteria: "HasData entries compile, Permissions.cs constants usable in [RequirePermission], wildcard + read/create/update/delete permissions present"
474
+ Task 3 (role-permission seeds):
475
+ description: "Create role-permission seed data: assign permissions to 4 default roles (Admin=wildcard, Manager=read+create+update, Contributor=read+create+update, Viewer=read) in RolePermissionConfiguration.cs (HasData)"
476
+ category: "seed-data"
477
+ dependencies: [ID of permission seed task]
478
+ acceptance_criteria: "HasData entries compile, 4 role levels assigned, Admin has wildcard access"
479
+
480
+ LAYER 2 - APPLICATION (if service interfaces/DTOs defined in handoff section 3/4):
393
481
  Task per entity:
394
- description: "Create CQRS for {Entity}: Commands ({Create/Update/Delete}Command + Handlers), Queries (GetAll/GetById + Handlers), DTOs ({Entity}Dto, Create/UpdateRequest), Validator"
482
+ description: "Create Application layer for {Entity}: Service interface (I{Entity}Service.cs), DTOs ({Entity}Dto, Create{Entity}Request, Update{Entity}Request in DTOs/), MappingExtensions"
395
483
  category: "application"
396
484
  dependencies: [ID of corresponding DOMAIN task for this entity]
397
- acceptance_criteria: "Handlers compile, validators defined with business rules, DTOs match handoff properties"
398
- Task (once per module):
399
- description: "Register permissions in Permissions.cs and PermissionConfiguration.cs for business.{app}.{module}"
400
- category: "application"
401
- dependencies: [IDs of ALL application tasks for this module]
402
- acceptance_criteria: "Permissions compile, HasData seed includes all permissions from handoff"
485
+ acceptance_criteria: "Interface compiles, DTOs match handoff properties, mapping extensions cover all properties"
403
486
 
404
487
  LAYER 3 - INFRASTRUCTURE (if EF Core config or services in handoff):
405
488
  Task per entity:
406
- description: "Create EF Core configuration for {Entity} with indexes, relationships, and schema"
489
+ description: "Create EF Core configuration in Configurations/{Module}/{Entity}Configuration.cs with table prefix, indexes, relationships, and schema (core or extensions)"
407
490
  category: "infrastructure"
408
491
  dependencies: [ID of corresponding DOMAIN task for this entity]
409
- acceptance_criteria: "Configuration compiles, DbSet registered in DbContext, indexes match handoff"
492
+ acceptance_criteria: "Configuration compiles, DbSet registered in DbContext, table uses {prefix}_{Entity}s naming, indexes match handoff"
410
493
  Task (once per module):
411
- description: "Create EF Core migration for {Module} entities"
494
+ description: "Create EF Core migration for {Module} entities (includes navigation, permission, and role-permission seed data from HasData)"
412
495
  category: "infrastructure"
413
- dependencies: [IDs of ALL EF Core configuration tasks]
414
- acceptance_criteria: "Migration applies without errors, 3 files present (Migration.cs, Designer.cs, ModelSnapshot.cs)"
496
+ dependencies: [IDs of ALL EF Core configuration tasks + ALL seed-data tasks]
497
+ acceptance_criteria: "Migration applies without errors, 3 files present (Migration.cs, Designer.cs, ModelSnapshot.cs), HasData seeds included in migration"
415
498
  Task per service (if services needed):
416
499
  description: "Create {Service} implementing I{Service} with DI registration"
417
500
  category: "infrastructure"
@@ -420,27 +503,27 @@ LAYER 3 - INFRASTRUCTURE (if EF Core config or services in handoff):
420
503
 
421
504
  LAYER 4 - API (if endpoints defined in handoff section 8):
422
505
  Task per controller:
423
- description: "Create {Entity}Controller with endpoints: {endpoint list} and [NavRoute] + [Authorize] attributes"
506
+ description: "Create {Entity}Controller in Controllers/Business/{Application}/ with endpoints: {endpoint list}, [NavRoute('business.{app}.{module}')] + [Authorize] + [RequirePermission(Permissions.{Module}.Read)] attributes"
424
507
  category: "api"
425
- dependencies: [IDs of APPLICATION tasks for this entity + INFRASTRUCTURE migration task]
426
- acceptance_criteria: "Controller compiles, endpoints respond, Swagger displays all routes"
508
+ dependencies: [IDs of APPLICATION tasks for this entity + INFRASTRUCTURE migration task + seed-data permission task]
509
+ acceptance_criteria: "Controller compiles, endpoints respond, Swagger displays all routes, [RequirePermission] uses Permissions.cs constants (not string literals)"
427
510
 
428
511
  LAYER 5 - FRONTEND (if frontend files in handoff section 5):
429
512
  Task (API service):
430
- description: "Create {module}Api.ts API service with Axios calls for all endpoints"
513
+ description: "Create web/src/services/api/{module}Api.ts API service with Axios calls for all endpoints"
431
514
  category: "frontend"
432
515
  dependencies: [IDs of ALL API controller tasks]
433
516
  acceptance_criteria: "API service compiles, all endpoints covered, types match DTOs"
434
517
  Task per page:
435
- description: "Create {PageName}.tsx with {description of page content}"
518
+ description: "Create web/src/pages/business/{app}/{module}/page.tsx with {description of page content}"
436
519
  category: "frontend"
437
520
  dependencies: [ID of frontend API service task]
438
521
  acceptance_criteria: "Page renders, API calls work, navigation functional"
439
522
  Task (routes):
440
- description: "Add routes in App.tsx for business/{app}/{module} and register in navigation"
523
+ description: "Add NESTED routes (NOT flat) in App.tsx for business/{app}/{module} and register in navigation"
441
524
  category: "frontend"
442
525
  dependencies: [IDs of ALL frontend page tasks]
443
- acceptance_criteria: "Routes resolve, navigation links appear in menu"
526
+ acceptance_criteria: "Nested routes resolve, navigation links appear in menu, no redirect to Home"
444
527
 
445
528
  LAYER 6 - I18N (if i18n keys in handoff section 10):
446
529
  Task:
@@ -510,7 +593,7 @@ Write to: `.ralph/prd.json`
510
593
  "tasks": [
511
594
  {
512
595
  "id": 1,
513
- "description": "Create {Entity} entity in Domain layer with properties: {list}",
596
+ "description": "Create {Entity} entity in Domain/Business/{Application}/{Module}/{Entity}.cs with properties: {list}",
514
597
  "status": "pending",
515
598
  "category": "domain",
516
599
  "dependencies": [],