@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
@@ -0,0 +1,96 @@
1
+ # Layer 1: Execution Rules — Application + API + Seed Data
2
+
3
+ > **Loaded by:** step-03-execute.md (section: Layer 1)
4
+ > **Purpose:** Critical rules for Layer 1 execution — NavRoute, permissions, validators, code generation, frontend patterns.
5
+
6
+ ---
7
+
8
+ ## NavRoute and Permission Kebab-Case (CRITICAL)
9
+
10
+ **ALL NavRoute segments and permission codes MUST use kebab-case for multi-word identifiers.**
11
+
12
+ Root cause (test-apex-007): Controllers had `[NavRoute("humanresources.employees")]` instead of `[NavRoute("human-resources.employees")]`. This mismatched seed data routes and permission codes, causing 404s and permission denials at runtime.
13
+
14
+ **Rules:**
15
+ - NavRoute: `human-resources.employees` (NEVER `humanresources.employees`)
16
+ - Permissions: `human-resources.employees.read` (segments MATCH NavRoute exactly)
17
+ - Seed data codes: `human-resources` (NEVER `humanresources`)
18
+ - C# class names stay PascalCase (`HumanResourcesController`) — only route/permission strings use kebab-case
19
+ - POST-CHECKs 41 + 48 validate this. Fix BEFORE committing.
20
+
21
+ ---
22
+
23
+ ## Controller Route Attribute (BLOCKING)
24
+
25
+ **Controllers with `[NavRoute]` must NOT have `[Route]` attribute.**
26
+
27
+ Root cause (test-apex-007): ALL 7 controllers had BOTH `[Route("api/...")]` AND `[NavRoute("...")]`. In SmartStack, `[NavRoute]` resolves routes dynamically from Navigation entities in the database at startup. Having `[Route]` alongside causes route conflicts → all endpoints return 404.
28
+
29
+ **Rules:**
30
+ - `[NavRoute("app.module")]` is the ONLY route attribute needed on controllers
31
+ - **FORBIDDEN:** `[Route("api/human-resources/employees")]` alongside `[NavRoute]`
32
+ - **FORBIDDEN:** `[Route("api/[controller]")]` alongside `[NavRoute]`
33
+ - If generating via MCP `scaffold_extension` with `navRoute` option → output is correct (NavRoute only)
34
+ - If generating via `/controller` skill → verify NO `[Route]` is added
35
+ - POST-CHECK 50 validates this. Fix BEFORE committing.
36
+
37
+ ---
38
+
39
+ ## Validators DI Registration (CRITICAL)
40
+
41
+ After creating validators, they MUST be registered in DI. Without registration, `[FromBody]` DTOs are never validated.
42
+
43
+ ```csharp
44
+ In DependencyInjection.cs (or ServiceCollectionExtensions.cs):
45
+ services.AddValidatorsFromAssemblyContaining<Create{Entity}DtoValidator>();
46
+ ```
47
+
48
+ POST-CHECK 46 validates this. If validators exist but no DI registration → BLOCKING.
49
+
50
+ ---
51
+
52
+ ## Date Fields — Use DateOnly (CRITICAL)
53
+
54
+ **ALL date-only fields in DTOs MUST use `DateOnly`, NEVER `string`.**
55
+
56
+ Root cause (test-apex-007): WorkLog DTO had `string Date` instead of `DateOnly Date`. This causes: no date validation, inconsistent date formats, parsing errors.
57
+
58
+ **Type mapping for DTOs:**
59
+
60
+ | Domain type | DTO type | Example |
61
+ |-------------|----------|---------|
62
+ | `DateTime` | `DateTime` | `CreatedAt`, `UpdatedAt` |
63
+ | Date-only field | `DateOnly` | `Date`, `StartDate`, `EndDate`, `BirthDate` |
64
+ | `string` for date | **FORBIDDEN** | Never use `string` for dates |
65
+ | `DateTime` for date-only | **Avoid** | Use `DateOnly` when no time component needed |
66
+
67
+ POST-CHECK 47 validates this. If a DTO has `string` type for a property named `*Date*` → BLOCKING.
68
+
69
+ ---
70
+
71
+ ## Code Generation (if entities have codePattern != "manual")
72
+
73
+ For each entity with auto-generated code pattern (from feature.json or step-02 decisions):
74
+
75
+ ```
76
+ 1. Create CodePatternConfig for the entity (strategy, prefix, digits from codePattern)
77
+ 2. Register ICodeGenerator<TEntity> in DependencyInjection.cs (Infrastructure layer)
78
+ → See references/code-generation.md for DI registration pattern
79
+ 3. Update CreateDto: REMOVE Code property (auto-generated, not user-provided)
80
+ 4. Update CreateDtoValidator: REMOVE Code regex rule (not in DTO anymore)
81
+ 5. Update service CreateAsync: inject ICodeGenerator<TEntity>, call NextCodeAsync()
82
+ → Code is auto-generated BEFORE entity creation
83
+ → See references/code-generation.md for service integration pattern
84
+ 6. Keep Code in ResponseDto (returned to frontend after creation)
85
+ 7. Keep Code in UpdateDto ONLY if code is mutable (rare — discuss with user)
86
+ ```
87
+
88
+ **CRITICAL:** If `codePattern.strategy == "manual"` (or no codePattern), keep the current behavior: Code stays in CreateDto, user provides it, validator has regex rule.
89
+
90
+ ---
91
+
92
+ ## Sequential vs Parallel Execution
93
+
94
+ **If economy_mode:** Execute each item from the plan sequentially using skills and MCP.
95
+
96
+ **If NOT economy_mode:** See `references/agent-teams-protocol.md` for parallel team-based execution with exec-backend and exec-frontend teammates.
@@ -0,0 +1,110 @@
1
+ # Initialization — Challenge Flow & Hierarchy Definition
2
+
3
+ > **Loaded by:** step-00-init.md (sections 4-5)
4
+ > **Purpose:** Detailed flow for challenging user hierarchy assumptions and defining the 4-level navigation structure.
5
+
6
+ ---
7
+
8
+ ## Challenge Questions Reference
9
+
10
+ > **Complete question templates with validation:**
11
+ > Load `references/challenge-questions.md` for the actual YAML question blocks and validation logic.
12
+
13
+ ---
14
+
15
+ ## 4-Level Navigation Hierarchy (BLOCKING RULE)
16
+
17
+ SmartStack uses a **4-level navigation hierarchy:**
18
+ - **Level 1: Application** — e.g., "HumanResources", "ProjectManagement"
19
+ - **Level 2: Module** — e.g., "Employees", "Timesheet"
20
+ - **Level 3: Section** — e.g., "List", "Dashboard", "Approval"
21
+ - **Level 4: Resource** — e.g., "Export", "Settings" (optional)
22
+
23
+ **BLOCKING RULE:** Every module MUST have at least one section. A module without sections produces an incomplete navigation tree, broken seed data, and missing frontend routes.
24
+
25
+ ---
26
+
27
+ ## Step 4: Validate Application Level (4a)
28
+
29
+ Load application question from `references/challenge-questions.md` section 4a.
30
+
31
+ **If `{app_name}` was clearly inferred from the task description:**
32
+ - Skip question, use inferred value
33
+
34
+ **If unclear:**
35
+ - Present question with best guess as recommended option
36
+ - Options:
37
+ 1. "Inferred app name (Recommended)" + description
38
+ 2. "New application" + option to create
39
+ 3. "Existing application" + option to select from scanned projects
40
+ - If "New application": collect `{app_name}`, `{app_code}`, `{app_icon}`, `{app_labels}` (4 langs)
41
+ - If "Existing application": scan `**/Seeding/Data/**/NavigationApplicationSeedData.cs` and present discovered apps
42
+
43
+ ---
44
+
45
+ ## Step 4b: Validate Module Level
46
+
47
+ Load module question from `references/challenge-questions.md` section 4b.
48
+
49
+ **If `{module_code}` was clearly inferred:**
50
+ - Skip question
51
+
52
+ **If unclear:**
53
+ - Present question with best guess(es) as options
54
+ - Options:
55
+ 1. "Inferred module code (Recommended)" + from task description
56
+ 2. "Alternative suggestions" + based on keywords
57
+ - User selects or enters custom value
58
+ - Store as `{module_code}` (kebab-case)
59
+
60
+ ---
61
+
62
+ ## Step 4c: Define Sections (MANDATORY — at least one)
63
+
64
+ Load section questions from `references/challenge-questions.md` section 4c.
65
+
66
+ **BLOCKING VALIDATION:** Sections list MUST contain at least one entry before proceeding.
67
+
68
+ Infer section suggestions from:
69
+ 1. Task description (extract nouns/concepts that suggest functional sub-areas)
70
+ 2. PRD/feature.json if available (module.sections)
71
+ 3. Common patterns: "list" (default for simple CRUD), "dashboard", "settings", "reports"
72
+
73
+ **Question format:**
74
+ ```yaml
75
+ question: "What sections should the module '{module_code}' contain?
76
+ (Select at least one — use 'Other' to add custom sections)"
77
+ options:
78
+ - label: "<inferred section 1>"
79
+ description: "Primary functional area based on module purpose"
80
+ - label: "<inferred section 2>"
81
+ description: "Secondary functional area"
82
+ - label: "<inferred section 3>"
83
+ description: "Additional area inferred from context"
84
+ multiSelect: true
85
+ ```
86
+
87
+ **Validation (BLOCKING):**
88
+ ```
89
+ IF {sections}.length == 0:
90
+ DISPLAY: "Every module must have at least one section."
91
+ → Re-ask the sections question
92
+ → DO NOT proceed to next step
93
+ ```
94
+
95
+ **Store for each section:**
96
+ ```yaml
97
+ sections:
98
+ - code: "section-kebab"
99
+ labels: { fr: "...", en: "...", it: "...", de: "..." }
100
+ icon: "LucideIconName"
101
+ displayOrder: 10
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Delegate Mode Skip (if -d)
107
+
108
+ When `/ralph-loop` invokes `/apex -d {prd_path}`, ALL hierarchy is extracted from the PRD file:
109
+ - Skip sections 2-4 (no interactive questions)
110
+ - Jump directly to section 3 (MCP verify)
@@ -0,0 +1,151 @@
1
+ # Planning — Layer Mapping, Skill Assignment, Parallelization Strategy
2
+
3
+ > **Loaded by:** step-02-plan.md (sections 1-4)
4
+ > **Purpose:** Map analyzed elements to layers, assign skills/MCP tools, and identify parallelization opportunities.
5
+
6
+ ---
7
+
8
+ ## Map Changes to Layers
9
+
10
+ For each element identified in step-01, assign to a SmartStack layer:
11
+
12
+ | Layer | Category | Order |
13
+ |-------|----------|-------|
14
+ | 0 | Domain (entities, enums, exceptions) | Sequential |
15
+ | 0 | Infrastructure - EF Configs | Sequential |
16
+ | 0 | Infrastructure - Migration (BLOCKING) | Sequential |
17
+ | 1 | Application (services, DTOs, validators) | Parallel |
18
+ | 1 | API (controllers) | Parallel |
19
+ | 1 | Infrastructure - Seed Data | Parallel |
20
+ | 2 | Frontend (pages, components) | Parallel |
21
+ | 2 | I18n (translations) | Parallel |
22
+ | 3 | Tests | Sequential |
23
+
24
+ ---
25
+
26
+ ## Entity Definition Template
27
+
28
+ Each entity in the plan MUST include:
29
+
30
+ ```yaml
31
+ Entity: {EntityName}
32
+ - tenantMode: strict | optional | scoped | none
33
+ - codePattern: auto-generated strategy (if applicable)
34
+ - fkFields: [{field, targetEntity}] (if applicable)
35
+ - acceptance criteria: [AC1, AC2, ...]
36
+ ```
37
+
38
+ The `tenantMode` decision (from step-01) drives:
39
+ - EF query filters
40
+ - Seed data approach
41
+ - API authorization
42
+
43
+ See `smartstack-layers.md` for tenant mode seed data strategies.
44
+
45
+ ---
46
+
47
+ ## Assign Skill/MCP per File
48
+
49
+ For EACH file in the plan, specify HOW it will be created/modified.
50
+
51
+ **Format:**
52
+
53
+ ```markdown
54
+ | # | File | Action | Tool |
55
+ |---|------|--------|------|
56
+ | 1 | Domain/Entities/.../MyEntity.cs | create | MCP scaffold_extension |
57
+ | 2 | Infrastructure/.../MyEntityConfiguration.cs | create | MCP scaffold_extension |
58
+ | 3 | Migration | create | MCP suggest_migration + dotnet ef |
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Layer 0 — Domain + Infrastructure (sequential)
64
+
65
+ | # | File | Action | Tool |
66
+ |---|------|--------|------|
67
+ | 1 | Domain/Entities/.../Entity.cs | create | MCP scaffold_extension |
68
+ | 2 | Infrastructure/.../EntityConfiguration.cs | create | MCP scaffold_extension |
69
+ | 3 | Infrastructure/Migrations/ | create | MCP suggest_migration + dotnet ef |
70
+
71
+ ---
72
+
73
+ ## Layer 1 — Application + API + Seed Data (parallel)
74
+
75
+ **Backend:** Application/API/Seed Data
76
+
77
+ | # | File | Action | Tool |
78
+ |---|------|--------|------|
79
+ | 4 | Application/Services/.../Service.cs | create | MCP scaffold_extension |
80
+ | 5 | Application/DTOs/.../Dto.cs | create | MCP scaffold_extension |
81
+ | 6 | Api/Controllers/.../Controller.cs | create | /controller skill or MCP scaffold_extension |
82
+ | 7 | Seeding/Data/NavigationApplicationSeedData.cs | create | Reference smartstack-layers.md (once per app) |
83
+ | 7b | Seeding/Data/ApplicationRolesSeedData.cs | create | Reference smartstack-layers.md (once per app) |
84
+ | 7c | Infrastructure/Services/CodeGeneration/ | create | Reference code-generation.md (per entity with codePattern != manual) |
85
+ | 8 | Seeding/Data/.../NavigationModuleSeedData.cs | create | Reference core-seed-data.md (4 langs: fr, en, it, de) |
86
+ | 8c | ↳ (same file) Section methods | add | Reference core-seed-data.md §2b (if sections exist) |
87
+ | 8d | ↳ (same file) Resource methods | add | Reference core-seed-data.md §2b (if resources exist) |
88
+ | 8b | Application/Authorization/Permissions.cs | create | MCP generate_permissions |
89
+ | 9 | Seeding/Data/.../PermissionsSeedData.cs | create | MCP generate_permissions |
90
+ | 10 | Seeding/Data/.../RolesSeedData.cs | create | Reference smartstack-layers.md |
91
+ | 10b | Seeding/{App}SeedDataProvider.cs | create | Reference core-seed-data.md (IClientSeedDataProvider + DI) |
92
+
93
+ **Frontend:** API Client, Routes, Pages, I18n
94
+
95
+ | # | File | Action | Tool |
96
+ |---|------|--------|------|
97
+ | 11 | src/pages/{App}/{Mod}/ListPage.tsx | create | /ui-components skill |
98
+ | 11b | src/pages/{App}/{Mod}/CreatePage.tsx | create | /ui-components skill (FK: EntityLookup) |
99
+ | 11c | src/pages/{App}/{Mod}/EditPage.tsx | create | /ui-components skill (FK: EntityLookup) |
100
+ | 11d | src/pages/{App}/{Mod}/{Section}Page.tsx | create | /ui-components skill (per section in `{sections}`) |
101
+ | 11e | src/pages/{App}/{Mod}/{Section}DetailPage.tsx | create | /ui-components skill (per section) |
102
+ | 12 | src/services/api/{module}Api.ts | create | MCP scaffold_api_client |
103
+ | 13 | src/routes/{module}.tsx | create | MCP scaffold_routes |
104
+ | 14 | src/i18n/locales/{lang}/{module}.json | create | Reference smartstack-frontend.md (4 languages) |
105
+
106
+ **FK Field Guidance:** If step-01 identified `fkFields[]`, every Create/Edit page MUST use `EntityLookup` for those fields (see `smartstack-frontend.md` section 6). The corresponding backend GetAll endpoints (Layer 1) MUST support `?search=` parameter.
107
+
108
+ ---
109
+
110
+ ## Layer 2b — Documentation (after frontend pages exist)
111
+
112
+ | # | File | Action | Tool |
113
+ |---|------|--------|------|
114
+ | 14b | src/pages/docs/business/{app}/{module}/doc-data.ts | create | /documentation skill |
115
+ | 14c | src/pages/docs/business/{app}/{module}/index.tsx | create | /documentation skill |
116
+
117
+ ---
118
+
119
+ ## Layer 3 — Tests (sequential)
120
+
121
+ | # | File | Action | Tool |
122
+ |---|------|--------|------|
123
+ | 15 | tests/.../EntityTests.cs | create | MCP scaffold_tests |
124
+ | 16 | tests/.../ServiceTests.cs | create | MCP scaffold_tests |
125
+
126
+ ---
127
+
128
+ ## Identify Parallelization (Agent Teams)
129
+
130
+ If NOT economy_mode AND Layer 1 has both backend and frontend work:
131
+
132
+ **Create agent teams to execute Layer 1 backend and frontend in parallel.**
133
+
134
+ See `references/agent-teams-protocol.md` for team creation, teammate spawning, task coordination, and shutdown procedures.
135
+
136
+ ---
137
+
138
+ ## Delegate Mode Fast Path
139
+
140
+ When `/ralph-loop` invokes `/apex -d {prd_path}`, PRD tasks already define the scope:
141
+
142
+ Map each PRD task to a layer based on `task.category`:
143
+ - `domain` → Layer 0
144
+ - `infrastructure` → Layer 0
145
+ - `application` → Layer 1
146
+ - `api` → Layer 1
147
+ - `seedData` → Layer 1
148
+ - `frontend` → Layer 2
149
+ - `test` → Layer 3
150
+
151
+ For each task: infer file_path, action, and tool from category. SKIP user checkpoint. Jump to "Estimated Commits" section.
@@ -14,7 +14,7 @@ if [ -n "$SEED_FILES" ]; then
14
14
  if [ -n "$BAD_ROUTES" ]; then
15
15
  echo "BLOCKING: Navigation routes must be full paths starting with /"
16
16
  echo "$BAD_ROUTES"
17
- echo "Expected: \"/business/human-resources\" NOT \"humanresources\""
17
+ echo "Expected: \"/human-resources\" NOT \"humanresources\""
18
18
  exit 1
19
19
  fi
20
20
  fi
@@ -512,35 +512,7 @@ if [ -n "$CREATE_VALIDATORS" ]; then
512
512
  fi
513
513
  ```
514
514
 
515
- ### POST-CHECK 19: SeedConstants must NOT contain ContextId (pre-seeded by SmartStack core)
516
-
517
- ```bash
518
- # NavigationContext IDs (business, platform, personal) are pre-seeded by SmartStack core
519
- # with hardcoded GUIDs. Client code MUST look them up by code at runtime, NEVER generate them.
520
- SEED_CONST_FILES=$(find src/ -path "*/Seeding/*" -name "SeedConstants.cs" 2>/dev/null)
521
- SEED_ALL_FILES=$(find src/ -path "*/Seeding/Data/*" -name "*.cs" 2>/dev/null)
522
- if [ -n "$SEED_CONST_FILES" ]; then
523
- BAD_CONTEXT_ID=$(grep -Pn 'ContextId\s*=' $SEED_CONST_FILES 2>/dev/null)
524
- if [ -n "$BAD_CONTEXT_ID" ]; then
525
- echo "BLOCKING: SeedConstants must NOT contain a ContextId constant"
526
- echo "NavigationContext IDs are pre-seeded by SmartStack core with hardcoded GUIDs"
527
- echo "Fix: Remove ContextId from SeedConstants. In SeedDataProvider, query:"
528
- echo " var ctx = await db.NavigationContexts.FirstOrDefaultAsync(c => c.Code == \"business\", ct);"
529
- echo "$BAD_CONTEXT_ID"
530
- exit 1
531
- fi
532
- fi
533
- if [ -n "$SEED_ALL_FILES" ]; then
534
- BAD_CTX_GUID=$(grep -Pn 'DeterministicGuid\("nav:(business|platform|personal)"\)' $SEED_ALL_FILES 2>/dev/null)
535
- if [ -n "$BAD_CTX_GUID" ]; then
536
- echo "BLOCKING: Deterministic GUID for NavigationContext detected"
537
- echo "Context IDs (business, platform, personal) are pre-seeded by SmartStack core"
538
- echo "Fix: Look up context by code at runtime in SeedDataProvider.SeedNavigationAsync()"
539
- echo "$BAD_CTX_GUID"
540
- exit 1
541
- fi
542
- fi
543
- ```
515
+ ### POST-CHECK 19: (REMOVED Context level no longer exists in SmartStack navigation hierarchy)
544
516
 
545
517
  ### POST-CHECK 20: RolePermission seed data must NOT use deterministic role GUIDs
546
518
 
@@ -764,12 +736,12 @@ if [ -n "$PERM_FILES" ]; then
764
736
  PATH_VAL=$(echo "$line" | grep -oP '"[^"]*\.[^"]*"' | tr -d '"')
765
737
  if [ -n "$PATH_VAL" ]; then
766
738
  DOTS=$(echo "$PATH_VAL" | tr -cd '.' | wc -c)
767
- # Module permissions: 3 dots (context.app.module.action = 4 segments = 3+1)
768
- # Section permissions: 4 dots (context.app.module.section.action = 5 segments = 4+1)
739
+ # Module permissions: 2 dots (app.module.action = 3 segments = 2+1)
740
+ # Section permissions: 3 dots (app.module.section.action = 4 segments = 3+1)
769
741
  # Wildcard: ends with .* (valid at any level)
770
742
  if echo "$PATH_VAL" | grep -qP '\.\*$'; then
771
743
  continue # Wildcards are valid
772
- elif [ "$DOTS" -lt 3 ] || [ "$DOTS" -gt 5 ]; then
744
+ elif [ "$DOTS" -lt 2 ] || [ "$DOTS" -gt 4 ]; then
773
745
  echo "WARNING: Permission path has unexpected segment count ($((DOTS+1)) segments): $PATH_VAL"
774
746
  fi
775
747
  fi
@@ -1072,7 +1044,7 @@ fi
1072
1044
  ```bash
1073
1045
  # NavRoute segments are navigation entity Codes joined by dots.
1074
1046
  # Multi-word codes MUST use kebab-case (e.g., "human-resources", NOT "humanresources").
1075
- # Verified from SmartStack.app: "business.support-client.my-tickets", "platform.administration.access-requests"
1047
+ # Verified from SmartStack.app: "support-client.my-tickets", "administration.access-requests"
1076
1048
  CTRL_FILES=$(find src/ -path "*/Controllers/*" -name "*Controller.cs" 2>/dev/null)
1077
1049
  if [ -n "$CTRL_FILES" ]; then
1078
1050
  for f in $CTRL_FILES; do
@@ -1084,7 +1056,7 @@ if [ -n "$CTRL_FILES" ]; then
1084
1056
  echo "BLOCKING: NavRoute segment '$SEG' in $f appears to be concatenated multi-word without hyphens"
1085
1057
  echo " Full NavRoute: $NAVROUTE_VAL"
1086
1058
  echo " Fix: Use kebab-case: e.g., 'humanresources' → 'human-resources'"
1087
- echo " SmartStack convention (from SmartStack.app): 'business.support-client.my-tickets'"
1059
+ echo " SmartStack convention (from SmartStack.app): 'support-client.my-tickets'"
1088
1060
  exit 1
1089
1061
  fi
1090
1062
  done
@@ -1110,8 +1082,8 @@ fi
1110
1082
 
1111
1083
  ```bash
1112
1084
  # Permission codes in [RequirePermission] and Permissions.cs MUST use kebab-case for multi-word segments.
1113
- # SmartStack.app convention: "business.support-client.my-tickets.read" (kebab-case everywhere)
1114
- # FORBIDDEN: "business.humanresources.employees.read" — must be "business.human-resources.employees.read"
1085
+ # SmartStack.app convention: "support-client.my-tickets.read" (kebab-case everywhere)
1086
+ # FORBIDDEN: "humanresources.employees.read" — must be "human-resources.employees.read"
1115
1087
 
1116
1088
  # Check [RequirePermission] attributes in controllers
1117
1089
  CTRL_FILES=$(find src/ -path "*/Controllers/*" -name "*Controller.cs" 2>/dev/null)
@@ -1126,7 +1098,7 @@ if [ -n "$CTRL_FILES" ]; then
1126
1098
  echo "BLOCKING: Permission code segment '$SEG' in $f appears concatenated without hyphens"
1127
1099
  echo " Full permission: $PERM"
1128
1100
  echo " Fix: Use kebab-case: e.g., 'humanresources' → 'human-resources'"
1129
- echo " SmartStack convention: 'business.support-client.my-tickets.read'"
1101
+ echo " SmartStack convention: 'support-client.my-tickets.read'"
1130
1102
  exit 1
1131
1103
  fi
1132
1104
  done
@@ -1378,8 +1350,8 @@ fi
1378
1350
  ### POST-CHECK 48: NavRoute attribute values must use kebab-case (BLOCKING)
1379
1351
 
1380
1352
  ```bash
1381
- # Root cause (test-apex-007): Controllers had [NavRoute("business.humanresources.employees")]
1382
- # instead of [NavRoute("business.human-resources.employees")]. This causes route mismatch with
1353
+ # Root cause (test-apex-007): Controllers had [NavRoute("humanresources.employees")]
1354
+ # instead of [NavRoute("human-resources.employees")]. This causes route mismatch with
1383
1355
  # seed data and permission codes, resulting in 404s at runtime.
1384
1356
  CTRL_FILES=$(find src/ -path "*/Controllers/*" -name "*Controller.cs" 2>/dev/null)
1385
1357
  if [ -n "$CTRL_FILES" ]; then
@@ -1476,4 +1448,137 @@ if [ -n "$CTRL_FILES" ]; then
1476
1448
  fi
1477
1449
  ```
1478
1450
 
1451
+ ### POST-CHECK 51: RolesSeedData must map standard role-permission matrix (BLOCKING)
1452
+
1453
+ ```bash
1454
+ # SmartStack standard role-permission matrix:
1455
+ # Admin = wildcard (*) — full access
1456
+ # Manager = CRU (read + create + update) — no delete
1457
+ # Contributor = CR (read + create) — no update, no delete
1458
+ # Viewer = R (read only)
1459
+ # If RolesSeedData deviates from this matrix, the RBAC model is broken.
1460
+ ROLE_SEED_FILES=$(find src/ -path "*/Seeding/Data/*" -name "*RolesSeedData.cs" ! -name "ApplicationRolesSeedData.cs" 2>/dev/null)
1461
+ if [ -n "$ROLE_SEED_FILES" ]; then
1462
+ FAIL=false
1463
+ for f in $ROLE_SEED_FILES; do
1464
+ # Skip ApplicationRolesSeedData (defines roles, not mappings)
1465
+ BASENAME=$(basename "$f")
1466
+ if [ "$BASENAME" = "ApplicationRolesSeedData.cs" ]; then continue; fi
1467
+
1468
+ # Check Admin has wildcard
1469
+ HAS_ADMIN_WILDCARD=$(grep -Pc '(admin|Admin).*\*' "$f" 2>/dev/null)
1470
+ if [ "$HAS_ADMIN_WILDCARD" -eq 0 ]; then
1471
+ # Also accept .Access or wildcard pattern
1472
+ HAS_ADMIN_ACCESS=$(grep -Pc '(admin|Admin).*(Access|Wildcard|IsWildcard)' "$f" 2>/dev/null)
1473
+ if [ "$HAS_ADMIN_ACCESS" -eq 0 ]; then
1474
+ echo "BLOCKING: Admin role missing wildcard (*) permission in $f"
1475
+ echo "Fix: Admin must map to wildcard permission (navRoute.*) or use IsWildcard=true"
1476
+ FAIL=true
1477
+ fi
1478
+ fi
1479
+
1480
+ # Check Viewer has NO delete/create/update
1481
+ VIEWER_WRITE=$(grep -Pc '(viewer|Viewer).*(\.delete|\.create|\.update|Delete|Create|Update)' "$f" 2>/dev/null)
1482
+ if [ "$VIEWER_WRITE" -gt 0 ]; then
1483
+ echo "BLOCKING: Viewer role has write permissions (create/update/delete) in $f"
1484
+ echo "Fix: Viewer must only have read permission. Remove create/update/delete mappings."
1485
+ FAIL=true
1486
+ fi
1487
+
1488
+ # Check Manager has NO delete
1489
+ MANAGER_DELETE=$(grep -Pc '(manager|Manager).*(\.delete|Delete)' "$f" 2>/dev/null)
1490
+ if [ "$MANAGER_DELETE" -gt 0 ]; then
1491
+ echo "WARNING: Manager role has delete permission in $f"
1492
+ echo "SmartStack standard: Manager = CRU (no delete). Verify this is intentional."
1493
+ fi
1494
+ done
1495
+ if [ "$FAIL" = true ]; then
1496
+ exit 1
1497
+ fi
1498
+ fi
1499
+ ```
1500
+
1501
+ ### POST-CHECK 52: PermissionAction enum must use valid typed values only (BLOCKING)
1502
+
1503
+ ```bash
1504
+ # Valid PermissionAction enum values: Access(0), Read(1), Create(2), Update(3), Delete(4),
1505
+ # Export(5), Import(6), Approve(7), Reject(8), Assign(9), Execute(10)
1506
+ # FORBIDDEN: Enum.Parse<PermissionAction>("...") — runtime crash if value doesn't exist
1507
+ # FORBIDDEN: (PermissionAction)99 or any cast beyond 0-10
1508
+ SEED_FILES=$(find src/ -path "*/Seeding/Data/*" -name "*.cs" 2>/dev/null)
1509
+ if [ -n "$SEED_FILES" ]; then
1510
+ FAIL=false
1511
+ for f in $SEED_FILES; do
1512
+ # Check for Enum.Parse<PermissionAction> usage
1513
+ ENUM_PARSE=$(grep -Pn 'Enum\.Parse<PermissionAction>' "$f" 2>/dev/null)
1514
+ if [ -n "$ENUM_PARSE" ]; then
1515
+ echo "BLOCKING: Enum.Parse<PermissionAction> detected — runtime crash risk: $f"
1516
+ echo "$ENUM_PARSE"
1517
+ echo "Fix: Use typed enum directly: PermissionAction.Read (NOT Enum.Parse<PermissionAction>(\"Read\"))"
1518
+ FAIL=true
1519
+ fi
1520
+
1521
+ # Check for invalid cast values (PermissionAction)N where N > 10
1522
+ INVALID_CAST=$(grep -Pn '\(PermissionAction\)\s*([1-9]\d{1,}|[2-9]\d)' "$f" 2>/dev/null)
1523
+ if [ -n "$INVALID_CAST" ]; then
1524
+ echo "BLOCKING: Invalid PermissionAction cast detected (value > 10): $f"
1525
+ echo "$INVALID_CAST"
1526
+ echo "Valid values: Access(0), Read(1), Create(2), Update(3), Delete(4), Export(5), Import(6), Approve(7), Reject(8), Assign(9), Execute(10)"
1527
+ FAIL=true
1528
+ fi
1529
+ done
1530
+ if [ "$FAIL" = true ]; then
1531
+ exit 1
1532
+ fi
1533
+ fi
1534
+ ```
1535
+
1536
+ ### POST-CHECK 53: Navigation translation completeness — 4 languages per level (BLOCKING)
1537
+
1538
+ ```bash
1539
+ # Every navigation seed data file must provide translations for ALL 4 languages (fr, en, it, de).
1540
+ # If sections exist (GetSectionEntries), GetSectionTranslationEntries MUST also exist.
1541
+ # If resources exist (GetResourceEntries), resource translation entries MUST also exist.
1542
+ NAV_SEED_FILES=$(find src/ -path "*/Seeding/Data/*" -name "*NavigationSeedData.cs" ! -name "*Application*" 2>/dev/null)
1543
+ if [ -n "$NAV_SEED_FILES" ]; then
1544
+ FAIL=false
1545
+ for f in $NAV_SEED_FILES; do
1546
+ # Check module translations have all 4 languages
1547
+ LANG_COUNT=$(grep -c 'LanguageCode\s*=' "$f" 2>/dev/null)
1548
+ HAS_FR=$(grep -c '"fr"' "$f" 2>/dev/null)
1549
+ HAS_EN=$(grep -c '"en"' "$f" 2>/dev/null)
1550
+ HAS_IT=$(grep -c '"it"' "$f" 2>/dev/null)
1551
+ HAS_DE=$(grep -c '"de"' "$f" 2>/dev/null)
1552
+
1553
+ if [ "$HAS_FR" -eq 0 ] || [ "$HAS_EN" -eq 0 ] || [ "$HAS_IT" -eq 0 ] || [ "$HAS_DE" -eq 0 ]; then
1554
+ echo "BLOCKING: Missing language(s) in navigation translations: $f"
1555
+ echo " fr=$HAS_FR, en=$HAS_EN, it=$HAS_IT, de=$HAS_DE (all must be > 0)"
1556
+ echo "Fix: Add NavigationTranslationSeedEntry for all 4 languages (fr, en, it, de)"
1557
+ FAIL=true
1558
+ fi
1559
+
1560
+ # If sections exist, section translations MUST exist
1561
+ HAS_SECTION_ENTRIES=$(grep -c 'GetSectionEntries' "$f" 2>/dev/null)
1562
+ HAS_SECTION_TRANSLATIONS=$(grep -c 'GetSectionTranslationEntries' "$f" 2>/dev/null)
1563
+ if [ "$HAS_SECTION_ENTRIES" -gt 0 ] && [ "$HAS_SECTION_TRANSLATIONS" -eq 0 ]; then
1564
+ echo "BLOCKING: Sections defined but GetSectionTranslationEntries() missing: $f"
1565
+ echo "Fix: Add GetSectionTranslationEntries() with 4 languages per section (ref core-seed-data.md §2b)"
1566
+ FAIL=true
1567
+ fi
1568
+
1569
+ # If resources exist, resource translations MUST exist
1570
+ HAS_RESOURCE_ENTRIES=$(grep -c 'GetResourceEntries' "$f" 2>/dev/null)
1571
+ HAS_RESOURCE_TRANSLATIONS=$(grep -Pc 'ResourceTranslation|GetResourceTranslation|NavigationEntityType\.Resource.*LanguageCode' "$f" 2>/dev/null)
1572
+ if [ "$HAS_RESOURCE_ENTRIES" -gt 0 ] && [ "$HAS_RESOURCE_TRANSLATIONS" -eq 0 ]; then
1573
+ echo "BLOCKING: Resources defined but resource translations missing: $f"
1574
+ echo "Fix: Add resource translation entries with 4 languages per resource (ref core-seed-data.md §2b)"
1575
+ FAIL=true
1576
+ fi
1577
+ done
1578
+ if [ "$FAIL" = true ]; then
1579
+ exit 1
1580
+ fi
1581
+ fi
1582
+ ```
1583
+
1479
1584
  **If ANY POST-CHECK fails → fix in step-03, re-validate.**