@atlashub/smartstack-cli 1.37.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 (123) 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/config/mcp-defaults.json +62 -0
  16. package/dist/index.js +58 -5
  17. package/dist/index.js.map +1 -1
  18. package/dist/mcp-entry.mjs +70010 -0
  19. package/dist/mcp-entry.mjs.map +1 -0
  20. package/package.json +14 -5
  21. package/templates/agents/gitflow/start.md +5 -4
  22. package/templates/agents/mcp-healthcheck.md +15 -13
  23. package/templates/mcp-scaffolding/component.tsx.hbs +298 -0
  24. package/templates/mcp-scaffolding/controller.cs.hbs +184 -0
  25. package/templates/mcp-scaffolding/entity-extension.cs.hbs +231 -0
  26. package/templates/mcp-scaffolding/frontend/api-client.ts.hbs +116 -0
  27. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +133 -0
  28. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +134 -0
  29. package/templates/mcp-scaffolding/migrations/seed-roles.cs.hbs +261 -0
  30. package/templates/mcp-scaffolding/service-extension.cs.hbs +53 -0
  31. package/templates/mcp-scaffolding/tests/controller.test.cs.hbs +413 -0
  32. package/templates/mcp-scaffolding/tests/entity.test.cs.hbs +239 -0
  33. package/templates/mcp-scaffolding/tests/repository.test.cs.hbs +441 -0
  34. package/templates/mcp-scaffolding/tests/security.test.cs.hbs +442 -0
  35. package/templates/mcp-scaffolding/tests/service.test.cs.hbs +390 -0
  36. package/templates/mcp-scaffolding/tests/validator.test.cs.hbs +428 -0
  37. package/templates/ralph/README.md +3 -3
  38. package/templates/ralph/ralph.config.yaml +2 -2
  39. package/templates/skills/admin/SKILL.md +42 -0
  40. package/templates/skills/business-analyse/_shared.md +79 -15
  41. package/templates/skills/business-analyse/questionnaire/01-context.md +4 -4
  42. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +3 -3
  43. package/templates/skills/business-analyse/questionnaire/03-scope.md +4 -4
  44. package/templates/skills/business-analyse/questionnaire/04-data.md +7 -7
  45. package/templates/skills/business-analyse/questionnaire/05-integrations.md +1 -1
  46. package/templates/skills/business-analyse/questionnaire/06-security.md +3 -3
  47. package/templates/skills/business-analyse/questionnaire/07-ui.md +1 -1
  48. package/templates/skills/business-analyse/questionnaire/08-performance.md +3 -3
  49. package/templates/skills/business-analyse/questionnaire/09-constraints.md +4 -4
  50. package/templates/skills/business-analyse/questionnaire/10-documentation.md +2 -2
  51. package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +2 -2
  52. package/templates/skills/business-analyse/questionnaire/12-migration.md +1 -1
  53. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +2 -2
  54. package/templates/skills/business-analyse/steps/step-01-discover.md +50 -25
  55. package/templates/skills/business-analyse/steps/step-03-specify.md +63 -0
  56. package/templates/skills/business-analyse/steps/step-04-validate.md +23 -1
  57. package/templates/skills/business-analyse/steps/step-05-handoff.md +248 -66
  58. package/templates/skills/business-analyse/templates/tpl-handoff.md +99 -23
  59. package/templates/skills/cc-agent/SKILL.md +129 -0
  60. package/templates/skills/cc-agent/references/agent-frontmatter.md +213 -0
  61. package/templates/skills/cc-agent/references/permission-modes.md +102 -0
  62. package/templates/skills/cc-agent/references/tools-reference.md +144 -0
  63. package/templates/skills/cc-agent/steps/step-00-init.md +134 -0
  64. package/templates/skills/cc-agent/steps/step-01-design.md +186 -0
  65. package/templates/skills/cc-agent/steps/step-02-generate.md +204 -0
  66. package/templates/skills/cc-agent/steps/step-03-validate.md +130 -0
  67. package/templates/skills/cc-agent/templates/agent-categorized.md +67 -0
  68. package/templates/skills/cc-agent/templates/agent-standalone.md +56 -0
  69. package/templates/skills/cc-agent/templates/agent-with-skills.md +94 -0
  70. package/templates/skills/cc-audit/SKILL.md +108 -0
  71. package/templates/skills/cc-audit/references/agent-checklist.md +91 -0
  72. package/templates/skills/cc-audit/references/hook-checklist.md +110 -0
  73. package/templates/skills/cc-audit/references/skill-checklist.md +70 -0
  74. package/templates/skills/cc-audit/steps/step-00-init.md +98 -0
  75. package/templates/skills/cc-audit/steps/step-01-scan.md +142 -0
  76. package/templates/skills/cc-audit/steps/step-02-analyze.md +158 -0
  77. package/templates/skills/cc-audit/steps/step-03-report.md +142 -0
  78. package/templates/skills/cc-skill/SKILL.md +134 -0
  79. package/templates/skills/cc-skill/references/best-practices.md +167 -0
  80. package/templates/skills/cc-skill/references/frontmatter-reference.md +182 -0
  81. package/templates/skills/cc-skill/references/skill-patterns.md +199 -0
  82. package/templates/skills/cc-skill/steps/step-00-init.md +119 -0
  83. package/templates/skills/cc-skill/steps/step-01-design.md +199 -0
  84. package/templates/skills/cc-skill/steps/step-02-generate.md +145 -0
  85. package/templates/skills/cc-skill/steps/step-03-steps.md +151 -0
  86. package/templates/skills/cc-skill/steps/step-04-validate.md +124 -0
  87. package/templates/skills/cc-skill/templates/skill-forked.md +85 -0
  88. package/templates/skills/cc-skill/templates/skill-progressive.md +102 -0
  89. package/templates/skills/cc-skill/templates/skill-simple.md +75 -0
  90. package/templates/skills/cc-skill/templates/step-template.md +82 -0
  91. package/templates/skills/check-version/SKILL.md +6 -0
  92. package/templates/skills/controller/templates.md +82 -0
  93. package/templates/skills/debug/SKILL.md +4 -0
  94. package/templates/skills/documentation/SKILL.md +1 -0
  95. package/templates/skills/efcore/SKILL.md +5 -0
  96. package/templates/skills/efcore/references/zero-downtime-patterns.md +227 -0
  97. package/templates/skills/efcore/steps/db/step-deploy.md +26 -5
  98. package/templates/skills/efcore/steps/migration/step-03-validate.md +19 -0
  99. package/templates/skills/efcore/steps/shared/step-00-init.md +21 -7
  100. package/templates/skills/explore/SKILL.md +28 -32
  101. package/templates/skills/feature-full/SKILL.md +1 -0
  102. package/templates/skills/gitflow/SKILL.md +8 -0
  103. package/templates/skills/gitflow/steps/step-start.md +45 -10
  104. package/templates/skills/mcp/SKILL.md +38 -18
  105. package/templates/skills/quick-search/SKILL.md +8 -1
  106. package/templates/skills/ralph-loop/SKILL.md +1 -1
  107. package/templates/skills/ralph-loop/steps/step-00-init.md +8 -68
  108. package/templates/skills/ralph-loop/steps/step-04-check.md +1 -1
  109. package/templates/skills/refactor/SKILL.md +1 -0
  110. package/templates/skills/review-code/SKILL.md +11 -3
  111. package/templates/skills/review-code/references/owasp-api-top10.md +243 -0
  112. package/templates/skills/review-code/references/security-checklist.md +86 -1
  113. package/templates/skills/review-code/references/smartstack-conventions.md +166 -0
  114. package/templates/skills/ui-components/SKILL.md +31 -438
  115. package/templates/skills/ui-components/accessibility.md +170 -0
  116. package/templates/skills/ui-components/patterns/data-table.md +39 -0
  117. package/templates/skills/ui-components/patterns/entity-card.md +77 -0
  118. package/templates/skills/ui-components/patterns/grid-layout.md +91 -0
  119. package/templates/skills/ui-components/patterns/kanban.md +43 -0
  120. package/templates/skills/ui-components/style-guide.md +86 -0
  121. package/templates/skills/utils/SKILL.md +1 -0
  122. package/templates/skills/validate/SKILL.md +1 -0
  123. package/templates/skills/workflow/SKILL.md +27 -0
@@ -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`
147
+
148
+ **Reference:** Copy pattern from existing entity in same layer (use Explore agent to find)
120
149
 
121
- **Reference:** Copy pattern from `src/SmartStack.Domain/Entities/Business/[ExistingEntity].cs`
150
+ **Base class:** `BaseEntity` + `IAuditableEntity` (provides Id, TenantId, CreatedAt, UpdatedAt, CreatedBy, UpdatedBy)
122
151
 
123
- **Properties to add:**
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
 
@@ -359,56 +430,137 @@ mkdir -p .ralph/reports
359
430
 
360
431
  **ULTRATHINK about task decomposition:**
361
432
  - Each task must be atomic (implementable in one Ralph iteration)
362
- - Tasks follow the SmartStack layer order: Domain → Application → Infrastructure → API → Frontend → Tests → Validation
433
+ - Tasks follow the SmartStack layer order: Domain → Application → Infrastructure → API → Frontend → i18n → Tests → Validation
363
434
  - Conditionally include tasks based on feature scope (skip layers not present in the handoff document)
435
+ - Each task MUST include `category`, `dependencies`, and `acceptance_criteria` (schema v2)
364
436
 
365
- **Conditional Task Generation Rules:**
437
+ **Granularity Rules:**
438
+ - 1 task per entity (domain, EF config, unit tests)
439
+ - 1 task per entity for CQRS (commands + queries + DTOs grouped per entity)
440
+ - 1 task per controller (API)
441
+ - 1 task per page (frontend)
442
+ - Max 1 entity per task — do NOT group multiple entities into a single task
443
+ - Enums and shared value objects can be grouped in 1 task if they belong to the same module
444
+
445
+ **Conditional Task Generation Rules (v2 schema):**
366
446
 
367
447
  For each layer, generate tasks ONLY if the handoff document contains specifications for that layer.
448
+ Each task must have: `id`, `description`, `status: "pending"`, `category`, `dependencies`, `acceptance_criteria`.
368
449
 
369
450
  ```
370
451
  LAYER 1 - DOMAIN (if entities defined in handoff section 3/4):
371
- Task: "Create {Entity} entity in SmartStack.Domain/Entities/Business/ with properties: {property_list}"
372
- Task: "Create {Entity}Status enum if status workflow defined"
373
- (One task per entity)
374
-
375
- LAYER 2 - APPLICATION (if CQRS handlers defined in handoff section 3/4):
376
- Task: "Create CQRS Commands for {Entity}: {Create/Update/Delete}Command + Handler + Validator"
377
- Task: "Create CQRS Queries for {Entity}: GetAll{Entity}Query, Get{Entity}ByIdQuery + Handlers"
378
- Task: "Create DTOs for {Entity}: {Entity}Dto, Create{Entity}Request, Update{Entity}Request"
379
- Task: "Register permissions in Permissions.cs and PermissionConfiguration.cs for business.{app}.{module}"
452
+ Task per entity:
453
+ description: "Create {Entity} entity in Domain/Business/{Application}/{Module}/{Entity}.cs with properties: {property_list}. Use BaseEntity + IAuditableEntity."
454
+ category: "domain"
455
+ dependencies: []
456
+ acceptance_criteria: "Entity compiles, properties match handoff spec, correct base class (BaseEntity + IAuditableEntity), correct namespace and folder hierarchy"
457
+ Task (if enums needed):
458
+ description: "Create domain enums for {Module}: {EnumList} in Domain/Enums/{Module}/"
459
+ category: "domain"
460
+ dependencies: []
461
+ acceptance_criteria: "Enums compile, values match handoff spec"
462
+
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):
481
+ Task per entity:
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"
483
+ category: "application"
484
+ dependencies: [ID of corresponding DOMAIN task for this entity]
485
+ acceptance_criteria: "Interface compiles, DTOs match handoff properties, mapping extensions cover all properties"
380
486
 
381
487
  LAYER 3 - INFRASTRUCTURE (if EF Core config or services in handoff):
382
- Task: "Create EF Core configuration for {Entity} with HasData seed and migration"
383
- Task: "Register {Entity} DbSet in ApplicationDbContext"
384
- Task: "Create {Entity}Service implementing I{Entity}Service with DI registration" (if services needed)
488
+ Task per entity:
489
+ description: "Create EF Core configuration in Configurations/{Module}/{Entity}Configuration.cs with table prefix, indexes, relationships, and schema (core or extensions)"
490
+ category: "infrastructure"
491
+ dependencies: [ID of corresponding DOMAIN task for this entity]
492
+ acceptance_criteria: "Configuration compiles, DbSet registered in DbContext, table uses {prefix}_{Entity}s naming, indexes match handoff"
493
+ Task (once per module):
494
+ description: "Create EF Core migration for {Module} entities (includes navigation, permission, and role-permission seed data from HasData)"
495
+ category: "infrastructure"
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"
498
+ Task per service (if services needed):
499
+ description: "Create {Service} implementing I{Service} with DI registration"
500
+ category: "infrastructure"
501
+ dependencies: [IDs of relevant DOMAIN + APPLICATION tasks]
502
+ acceptance_criteria: "Service compiles, registered in DI, follows existing patterns"
385
503
 
386
504
  LAYER 4 - API (if endpoints defined in handoff section 8):
387
- Task: "Create {Module}Controller with CRUD endpoints: GET, POST, GET/{id}, PUT/{id}, DELETE/{id}"
505
+ Task per controller:
506
+ description: "Create {Entity}Controller in Controllers/Business/{Application}/ with endpoints: {endpoint list}, [NavRoute('business.{app}.{module}')] + [Authorize] + [RequirePermission(Permissions.{Module}.Read)] attributes"
507
+ category: "api"
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)"
388
510
 
389
511
  LAYER 5 - FRONTEND (if frontend files in handoff section 5):
390
- Task: "Create {module}Api.ts API service with Axios calls"
391
- Task: "Create use{Module}.ts hook with React Query + SignalR"
392
- Task: "Create {Module}Page.tsx list page with EntityCard"
393
- Task: "Create {Module}Form.tsx create/edit form"
394
- Task: "Add routes in App.tsx for business/{app}/{module}"
512
+ Task (API service):
513
+ description: "Create web/src/services/api/{module}Api.ts API service with Axios calls for all endpoints"
514
+ category: "frontend"
515
+ dependencies: [IDs of ALL API controller tasks]
516
+ acceptance_criteria: "API service compiles, all endpoints covered, types match DTOs"
517
+ Task per page:
518
+ description: "Create web/src/pages/business/{app}/{module}/page.tsx with {description of page content}"
519
+ category: "frontend"
520
+ dependencies: [ID of frontend API service task]
521
+ acceptance_criteria: "Page renders, API calls work, navigation functional"
522
+ Task (routes):
523
+ description: "Add NESTED routes (NOT flat) in App.tsx for business/{app}/{module} and register in navigation"
524
+ category: "frontend"
525
+ dependencies: [IDs of ALL frontend page tasks]
526
+ acceptance_criteria: "Nested routes resolve, navigation links appear in menu, no redirect to Home"
395
527
 
396
528
  LAYER 6 - I18N (if i18n keys in handoff section 10):
397
- Task: "Create i18n translation files for {module} in 4 languages (fr, en, it, de)"
529
+ Task:
530
+ description: "Create i18n translation files for {module} in 4 languages (fr, en, it, de)"
531
+ category: "i18n"
532
+ dependencies: [IDs of frontend page tasks]
533
+ acceptance_criteria: "4 language files created, all keys from handoff present, no missing translations"
398
534
 
399
535
  LAYER 7 - TESTS (always included):
400
- Task: "Create unit tests: {Entity}ValidatorTests + {Entity}Tests"
401
- Task: "Create integration tests: {Module}ControllerTests with 200, 201, 400, 403, 404 scenarios"
536
+ Task per entity:
537
+ description: "Create unit tests for {Entity}: {Entity}ValidatorTests + {Entity}Tests (entity methods)"
538
+ category: "test"
539
+ dependencies: [ID of APPLICATION task for this entity]
540
+ acceptance_criteria: "Tests pass, validator rules covered, entity methods tested"
541
+ Task per controller:
542
+ description: "Create integration tests for {Entity}Controller: 200, 201, 400, 403, 404 scenarios"
543
+ category: "test"
544
+ dependencies: [ID of API task for this controller]
545
+ acceptance_criteria: "Tests pass, all status codes covered, permission denial tested"
402
546
 
403
547
  LAYER 8 - VALIDATION (always included):
404
- Task: "Run dotnet build, pnpm build, dotnet test - fix any failures"
405
- Task: "Run MCP validate_conventions to verify all naming conventions"
548
+ Task 1:
549
+ description: "Run dotnet build + dotnet test - fix any build errors or test failures"
550
+ category: "validation"
551
+ dependencies: [IDs of ALL test tasks]
552
+ acceptance_criteria: "Build succeeds, all tests pass"
553
+ Task 2:
554
+ description: "Run MCP validate_conventions to verify all naming and structural conventions"
555
+ category: "validation"
556
+ dependencies: [ID of validation task 1]
557
+ acceptance_criteria: "MCP validation clean, no convention violations"
406
558
  ```
407
559
 
408
560
  **Sizing rules:**
409
- - Simple feature (1 entity, CRUD only): ~8-12 tasks
410
- - Medium feature (2-3 entities, business rules): ~15-20 tasks
411
- - Complex feature (multiple entities, integrations): ~20-30 tasks
561
+ - Simple feature (1 entity, CRUD only): ~10-15 tasks
562
+ - Medium feature (2-3 entities, business rules): ~18-25 tasks
563
+ - Complex feature (multiple entities, integrations): ~25-35 tasks
412
564
 
413
565
  #### 12bis.3 Write prd.json
414
566
 
@@ -416,20 +568,50 @@ Write to: `.ralph/prd.json`
416
568
 
417
569
  ```json
418
570
  {
571
+ "$version": "2.0.0",
419
572
  "feature": "{feature_id} - {feature_description}",
573
+ "status": "pending",
420
574
  "created": "{ISO 8601 timestamp}",
421
- "max_iterations": 30,
422
- "completion_promise": "IMPLEMENTATION COMPLETE",
423
- "current_iteration": 1,
424
- "source": "{output_dir}/4-development-handoff.md",
575
+ "updated_at": "{ISO 8601 timestamp}",
576
+ "metadata": {
577
+ "cli_version": "{version from package.json}",
578
+ "branch": "{current git branch}",
579
+ "project_path": "{cwd}",
580
+ "mcp_servers": { "smartstack": true, "context7": true }
581
+ },
582
+ "config": {
583
+ "max_iterations": 30,
584
+ "completion_promise": "IMPLEMENTATION COMPLETE",
585
+ "current_iteration": 1
586
+ },
587
+ "source": {
588
+ "type": "ba-handoff",
589
+ "handoff_path": "{output_dir}/4-development-handoff.md",
590
+ "frd_path": "{output_dir}/3-functional-specification.md",
591
+ "brd_path": "{output_dir}/2-business-requirements.md"
592
+ },
425
593
  "tasks": [
426
- { "id": 1, "description": "...", "passes": false },
427
- { "id": 2, "description": "...", "passes": false }
428
- ]
594
+ {
595
+ "id": 1,
596
+ "description": "Create {Entity} entity in Domain/Business/{Application}/{Module}/{Entity}.cs with properties: {list}",
597
+ "status": "pending",
598
+ "category": "domain",
599
+ "dependencies": [],
600
+ "acceptance_criteria": "Entity compiles, properties match handoff spec",
601
+ "started_at": null,
602
+ "completed_at": null,
603
+ "iteration": null,
604
+ "commit_hash": null,
605
+ "files_changed": { "created": [], "modified": [] },
606
+ "validation": null,
607
+ "error": null
608
+ }
609
+ ],
610
+ "history": []
429
611
  }
430
612
  ```
431
613
 
432
- > **Note:** The `source` field links back to the handoff document for reference. It is not read by Ralph's execution engine and is backward-compatible.
614
+ > **Schema v2.0.0** Compatible avec ralph-loop step-01 sans migration. Chaque tache inclut `category`, `dependencies` et `acceptance_criteria` pour un pilotage precis de l'execution.
433
615
 
434
616
  #### 12bis.4 Initialize progress.txt
435
617
 
@@ -37,6 +37,9 @@ This document is a self-contained prompt for Claude Code.
37
37
  | Feature ID | {FEAT-XXX} |
38
38
  | Module | business/{application}/{module} |
39
39
  | Base Permission | `business.{app}.{module}` |
40
+ | Project Namespace | `{project_namespace}` |
41
+ | DB Schema | `extensions` (client entities) / `core` (navigation, permissions) |
42
+ | Table Prefix | `{prefix}_` (e.g., `bik_`) |
40
43
  | Complexity | {Simple/Medium/Complex} |
41
44
 
42
45
  ## 2. [EXPLORE] EXISTING PATTERNS
@@ -45,42 +48,73 @@ BEFORE coding, explore these files to understand the patterns:
45
48
 
46
49
  ```
47
50
  BACKEND:
48
- - src/SmartStack.Domain/Entities/ → Entity structure
49
- - src/SmartStack.Application/Features/ → CQRS pattern
50
- - src/SmartStack.Infrastructure/Persistence/Configurations/ → EF Core
51
+ - src/{project_namespace}.Domain/Business/ → Entity structure + folder hierarchy
52
+ - src/{project_namespace}.Application/Business/ → DTOs + service interfaces
53
+ - src/{project_namespace}.Application/Common/Interfaces/ → Service contracts
54
+ - src/{project_namespace}.Infrastructure/Persistence/Configurations/ → EF Core configs (subfolder per module)
55
+ - src/{project_namespace}.Infrastructure/Services/ → Service implementations (subfolder per module)
56
+ - src/{project_namespace}.Infrastructure/Persistence/Seeding/Data/ → SeedData patterns
57
+
58
+ SEED DATA (CRITICAL):
59
+ - NavigationModuleConfiguration.cs → How modules are seeded (HasData)
60
+ - NavigationTranslationConfiguration.cs → How translations are seeded (4 languages)
61
+ - PermissionConfiguration.cs → How permissions are seeded (HasData)
62
+ - RolePermissionConfiguration.cs → How role-permission mappings are seeded
51
63
 
52
64
  FRONTEND:
53
- - web/smartstack-web/src/pages/business/ → Existing pages
54
- - web/smartstack-web/src/components/ → Reusable components
55
- - web/smartstack-web/src/services/api/ → API calls
65
+ - web/src/pages/business/ → Existing pages
66
+ - web/src/components/ → Reusable components
67
+ - web/src/services/api/ → API calls
56
68
  ```
57
69
 
58
70
  ## 3. FILES TO CREATE
59
71
 
60
72
  ### 3.1 Backend
61
73
 
62
- | File | Template | Description |
63
- |------|----------|-------------|
64
- | `Domain/Entities/{Entity}.cs` | Domain Entity | Properties + rules |
65
- | `Application/Features/{Module}/` | CQRS | MediatR handlers |
66
- | `Infrastructure/.../Configurations/` | EF Core | Config + HasData |
67
- | `Api/Controllers/Business/` | Controller | REST endpoints |
68
-
69
- ### 3.2 Frontend
70
-
71
- | File | Template | Description |
72
- |------|----------|-------------|
73
- | `pages/business/{app}/{module}/` | React Page | List + detail |
74
- | `services/api/{module}Api.ts` | API Service | Axios calls |
75
- | `i18n/locales/{lang}/{module}.json` | Translations | FR, EN, IT, DE |
74
+ | File | Path Pattern | Description |
75
+ |------|-------------|-------------|
76
+ | Domain Entity | `Domain/Business/{Application}/{Module}/{Entity}.cs` | BaseEntity + IAuditableEntity |
77
+ | Service Interface | `Application/Common/Interfaces/I{Entity}Service.cs` | Service contract |
78
+ | DTOs | `Application/Business/{Application}/{Module}/DTOs/{Entity}Dto.cs` | Response, Create, Update records |
79
+ | Mapping | `Application/Business/{Application}/{Module}/DTOs/{Entity}MappingExtensions.cs` | Entity DTO mapping |
80
+ | Permission Constants | `Application/Business/{Application}/{Module}/Permissions.cs` | Compile-time constants |
81
+ | EF Configuration | `Infrastructure/Persistence/Configurations/{Module}/{Entity}Configuration.cs` | Table + indexes + HasData |
82
+ | Service Implementation | `Infrastructure/Services/{Module}/{Entity}Service.cs` | Business logic |
83
+ | Controller | `Api/Controllers/Business/{Application}/{Module}Controller.cs` | NavRoute + RequirePermission |
84
+
85
+ ### 3.2 SeedData Core (CRITICAL without these, module is invisible and returns 403)
86
+
87
+ > **5 mandatory files** for every new module (4 EF Core HasData + 1 Application code):
88
+
89
+ | # | File | Layer | Content |
90
+ |---|------|-------|---------|
91
+ | 1 | `NavigationModuleConfiguration.cs` | Infrastructure (HasData) | Module entry in `nav_Modules` |
92
+ | 2 | `NavigationTranslationConfiguration.cs` | Infrastructure (HasData) | 4 translations (fr, en, it, de) per nav entity |
93
+ | 3 | `PermissionConfiguration.cs` | Infrastructure (HasData) | Wildcard + CRUD permissions in `nav_Permissions` |
94
+ | 4 | `Permissions.cs` | Application (code) | Compile-time constants for `[RequirePermission]` |
95
+ | 5 | `RolePermissionConfiguration.cs` | Infrastructure (HasData) | Role→Permission for {App} Admin, {App} Manager, {App} Contributor, {App} Viewer |
96
+
97
+ ### 3.3 Frontend
98
+
99
+ | File | Path Pattern | Description |
100
+ |------|-------------|-------------|
101
+ | Main Page | `pages/business/{app}/{module}/page.tsx` | List + actions |
102
+ | Components | `components/business/{module}/` | Entity-specific components |
103
+ | API Service | `services/api/{module}Api.ts` | Typed Axios calls |
104
+ | Translations | `i18n/locales/{lang}/{module}.json` | FR, EN, IT, DE |
76
105
 
77
106
  ## 4. DETAILED SPECIFICATIONS
78
107
 
79
108
  ### 4.1 Entity
80
109
 
110
+ **Base class:** `BaseEntity` + `IAuditableEntity`
111
+ **Table name:** `{prefix}_{EntityPlural}` in schema `extensions` (e.g., `extensions.bik_FreeBickes`)
112
+ **Schema:** `extensions` for business entities, `core` for system entities (navigation, permissions)
113
+ > DO NOT add Id, TenantId, CreatedAt, UpdatedAt, CreatedBy, UpdatedBy — these are automatic via BaseEntity + IAuditableEntity.
114
+
81
115
  | Attribute | Description | Required | Rules |
82
116
  |-----------|-------------|----------|-------|
83
- | Id | Unique identifier | Yes | GUID |
117
+ | Code | Unique code per tenant | Yes | MaxLength(50), unique index with TenantId |
84
118
  | {attr} | {description} | {Yes/No} | {validation} |
85
119
 
86
120
  ### 4.2 API Endpoints
@@ -99,6 +133,31 @@ FRONTEND:
99
133
  |-------|------|----------------|
100
134
  | BR-001 | {rule} | {where to implement} |
101
135
 
136
+ ### 4.4 SeedData Specifications
137
+
138
+ **Navigation seeds:**
139
+ | Level | Code | Label FR | Label EN | Label IT | Label DE | Icon | Route |
140
+ |-------|------|----------|----------|----------|----------|------|-------|
141
+ | Module | {module} | {label_fr} | {label_en} | {label_it} | {label_de} | {Icon} | /business/{app}/{module} |
142
+
143
+ **Permission seeds:**
144
+ | Path | Level | Action | Description |
145
+ |------|-------|--------|-------------|
146
+ | business.{app}.{module}.* | Module | Wildcard | Full access |
147
+ | business.{app}.{module}.read | Module | Read | View |
148
+ | business.{app}.{module}.create | Module | Create | Create |
149
+ | business.{app}.{module}.update | Module | Update | Modify |
150
+ | business.{app}.{module}.delete | Module | Delete | Remove |
151
+
152
+ **Role-Permission matrix:**
153
+ | Permission | {App} Admin | {App} Manager | {App} Contributor | {App} Viewer |
154
+ |------------|-------------|---------------|-------------------|--------------|
155
+ | wildcard (*) | X | - | - | - |
156
+ | read | - | X | X | X |
157
+ | create | - | X | X | - |
158
+ | update | - | X | X | - |
159
+ | delete | - | - | - | - |
160
+
102
161
  ## 5. REQUIRED TESTS
103
162
 
104
163
  - [ ] Unit test: Entity validation
@@ -108,12 +167,29 @@ FRONTEND:
108
167
 
109
168
  ## 6. POST-IMPLEMENTATION CHECKLIST
110
169
 
170
+ **Build & Tests:**
111
171
  - [ ] Backend build OK
112
172
  - [ ] Frontend build OK
113
173
  - [ ] Tests passing
114
- - [ ] EF Core migration created
115
- - [ ] Permissions in PermissionConfiguration.cs
174
+
175
+ **Folder Conventions:**
176
+ - [ ] Domain entities in `Domain/Business/{Application}/{Module}/`
177
+ - [ ] Application DTOs in `Application/Business/{Application}/{Module}/DTOs/`
178
+ - [ ] Infrastructure configs in `Configurations/{Module}/`
179
+ - [ ] Infrastructure services in `Services/{Module}/`
180
+ - [ ] Controller in `Controllers/Business/{Application}/`
181
+
182
+ **SeedData Core (CRITICAL):**
183
+ - [ ] Navigation module entry (HasData in NavigationModuleConfiguration.cs)
184
+ - [ ] Navigation translations (4 languages in NavigationTranslationConfiguration.cs)
185
+ - [ ] Permissions (HasData in PermissionConfiguration.cs: wildcard + CRUD)
186
+ - [ ] Permission constants (Permissions.cs in Application layer)
187
+ - [ ] Role-Permission assignments (HasData in RolePermissionConfiguration.cs: 4 roles)
188
+ - [ ] EF Core migration created (includes all HasData seeds)
189
+
190
+ **Frontend & i18n:**
116
191
  - [ ] i18n complete (4 languages)
192
+ - [ ] Nested routes (NOT flat)
117
193
  - [ ] Documentation: `/business-analyse:6-doc-html {FEAT-XXX}`
118
194
 
119
195
  ---