@atlashub/smartstack-cli 3.37.0 → 3.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/dist/index.js +16 -24
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +235 -265
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/scripts/extract-api-endpoints.ts +5 -5
  7. package/scripts/generate-doc-with-mock-ui.ts +10 -17
  8. package/templates/agents/ba-reader.md +9 -9
  9. package/templates/agents/ba-writer.md +12 -15
  10. package/templates/agents/code-reviewer.md +1 -1
  11. package/templates/agents/docs-context-reader.md +1 -1
  12. package/templates/agents/efcore/scan.md +3 -1
  13. package/templates/agents/gitflow/commit.md +74 -0
  14. package/templates/agents/gitflow/finish.md +5 -2
  15. package/templates/agents/gitflow/init-clone.md +3 -3
  16. package/templates/agents/gitflow/init-validate.md +3 -2
  17. package/templates/agents/gitflow/merge.md +5 -4
  18. package/templates/agents/gitflow/pr.md +5 -4
  19. package/templates/agents/gitflow/start.md +37 -5
  20. package/templates/hooks/hooks.json +11 -0
  21. package/templates/hooks/wsl-dotnet-cleanup.sh +24 -0
  22. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +20 -20
  23. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +16 -24
  24. package/templates/mcp-scaffolding/migrations/seed-roles.cs.hbs +2 -2
  25. package/templates/skills/_resources/mcp-validate-documentation-spec.md +3 -3
  26. package/templates/skills/_shared.md +15 -17
  27. package/templates/skills/ai-prompt/SKILL.md +1 -1
  28. package/templates/skills/ai-prompt/steps/step-00-init.md +47 -0
  29. package/templates/skills/apex/SKILL.md +3 -4
  30. package/templates/skills/apex/_shared.md +10 -20
  31. package/templates/skills/apex/references/analysis-methods.md +141 -0
  32. package/templates/skills/apex/references/challenge-questions.md +1 -21
  33. package/templates/skills/apex/references/core-seed-data.md +35 -58
  34. package/templates/skills/apex/references/examine-build-validation.md +82 -0
  35. package/templates/skills/apex/references/execution-frontend-gates.md +177 -0
  36. package/templates/skills/apex/references/execution-frontend-patterns.md +105 -0
  37. package/templates/skills/apex/references/execution-layer1-rules.md +96 -0
  38. package/templates/skills/apex/references/initialization-challenge-flow.md +110 -0
  39. package/templates/skills/apex/references/planning-layer-mapping.md +151 -0
  40. package/templates/skills/apex/references/post-checks.md +145 -40
  41. package/templates/skills/apex/references/smartstack-api.md +35 -51
  42. package/templates/skills/apex/references/smartstack-frontend.md +18 -18
  43. package/templates/skills/apex/references/smartstack-layers.md +38 -62
  44. package/templates/skills/apex/steps/step-00-init.md +14 -26
  45. package/templates/skills/apex/steps/step-01-analyze.md +10 -143
  46. package/templates/skills/apex/steps/step-02-plan.md +10 -92
  47. package/templates/skills/apex/steps/step-03-execute.md +45 -252
  48. package/templates/skills/apex/steps/step-04-examine.md +14 -78
  49. package/templates/skills/apex/steps/step-05-deep-review.md +2 -2
  50. package/templates/skills/apex/steps/step-08-run-tests.md +1 -0
  51. package/templates/skills/application/SKILL.md +241 -242
  52. package/templates/skills/application/references/backend-controller-hierarchy.md +16 -16
  53. package/templates/skills/application/references/backend-seeding-and-dto-output.md +83 -0
  54. package/templates/skills/application/references/backend-table-prefix-mapping.md +79 -0
  55. package/templates/skills/application/references/backend-verification.md +1 -1
  56. package/templates/skills/application/references/frontend-i18n-and-output.md +67 -0
  57. package/templates/skills/application/references/frontend-route-naming.md +117 -0
  58. package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +107 -0
  59. package/templates/skills/application/references/frontend-verification.md +12 -12
  60. package/templates/skills/application/references/init-parameter-detection.md +121 -0
  61. package/templates/skills/application/references/migration-checklist-troubleshooting.md +100 -0
  62. package/templates/skills/application/references/nav-fallback-procedure.md +199 -200
  63. package/templates/skills/application/references/provider-template.md +2 -6
  64. package/templates/skills/application/references/roles-client-project-handling.md +55 -0
  65. package/templates/skills/application/references/roles-fallback-procedure.md +149 -0
  66. package/templates/skills/application/references/test-coverage-requirements.md +213 -0
  67. package/templates/skills/application/references/test-frontend.md +3 -3
  68. package/templates/skills/application/steps/step-00-init.md +130 -260
  69. package/templates/skills/application/steps/step-01-navigation.md +170 -170
  70. package/templates/skills/application/steps/step-02-permissions.md +196 -196
  71. package/templates/skills/application/steps/step-03-roles.md +182 -339
  72. package/templates/skills/application/steps/step-03b-provider.md +133 -134
  73. package/templates/skills/application/steps/step-04-backend.md +174 -265
  74. package/templates/skills/application/steps/step-05-frontend.md +18 -144
  75. package/templates/skills/application/steps/step-06-migration.md +12 -60
  76. package/templates/skills/application/steps/step-07-tests.md +9 -76
  77. package/templates/skills/application/templates-backend.md +29 -27
  78. package/templates/skills/application/templates-frontend.md +49 -49
  79. package/templates/skills/application/templates-seed.md +57 -131
  80. package/templates/skills/business-analyse/SKILL.md +27 -30
  81. package/templates/skills/business-analyse/_architecture.md +6 -6
  82. package/templates/skills/business-analyse/_shared.md +60 -88
  83. package/templates/skills/business-analyse/questionnaire/04-data.md +3 -3
  84. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  85. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +1 -1
  86. package/templates/skills/business-analyse/react/application-viewer.md +12 -12
  87. package/templates/skills/business-analyse/react/components.md +8 -12
  88. package/templates/skills/business-analyse/react/schema.md +836 -836
  89. package/templates/skills/business-analyse/references/agent-module-prompt.md +2 -3
  90. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +190 -0
  91. package/templates/skills/business-analyse/references/cache-warming-strategy.md +2 -2
  92. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +41 -0
  93. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +74 -0
  94. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +69 -0
  95. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +1 -1
  96. package/templates/skills/business-analyse/references/compilation-structure-cards.md +297 -0
  97. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +2 -2
  98. package/templates/skills/business-analyse/references/deploy-modes.md +5 -5
  99. package/templates/skills/business-analyse/references/detection-strategies.md +7 -7
  100. package/templates/skills/business-analyse/references/handoff-file-templates.md +14 -22
  101. package/templates/skills/business-analyse/references/handoff-mappings.md +4 -4
  102. package/templates/skills/business-analyse/references/handoff-seeddata-generation.md +312 -0
  103. package/templates/skills/business-analyse/references/init-schema-deployment.md +3 -3
  104. package/templates/skills/business-analyse/references/naming-conventions.md +22 -24
  105. package/templates/skills/business-analyse/references/prd-generation.md +2 -2
  106. package/templates/skills/business-analyse/references/review-data-mapping.md +2 -2
  107. package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
  108. package/templates/skills/business-analyse/references/spec-auto-inference.md +3 -3
  109. package/templates/skills/business-analyse/references/team-orchestration.md +49 -6
  110. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  111. package/templates/skills/business-analyse/references/ui-resource-cards.md +18 -18
  112. package/templates/skills/business-analyse/references/validate-incremental-html.md +2 -2
  113. package/templates/skills/business-analyse/references/validation-checklist.md +2 -2
  114. package/templates/skills/business-analyse/schemas/application-schema.json +4 -5
  115. package/templates/skills/business-analyse/schemas/project-schema.json +1 -6
  116. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +2 -3
  117. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +4 -4
  118. package/templates/skills/business-analyse/steps/step-00-init.md +8 -17
  119. package/templates/skills/business-analyse/steps/step-01-cadrage.md +35 -198
  120. package/templates/skills/business-analyse/steps/step-01b-applications.md +16 -20
  121. package/templates/skills/business-analyse/steps/step-02-decomposition.md +1 -1
  122. package/templates/skills/business-analyse/steps/step-03a1-setup.md +4 -4
  123. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +1 -1
  124. package/templates/skills/business-analyse/steps/step-03b-ui.md +4 -4
  125. package/templates/skills/business-analyse/steps/step-03c-compile.md +66 -140
  126. package/templates/skills/business-analyse/steps/step-03d-validate.md +2 -2
  127. package/templates/skills/business-analyse/steps/step-04a-collect.md +2 -2
  128. package/templates/skills/business-analyse/steps/step-04b-analyze.md +42 -160
  129. package/templates/skills/business-analyse/steps/step-04c-decide.md +1 -1
  130. package/templates/skills/business-analyse/steps/step-05a-handoff.md +74 -104
  131. package/templates/skills/business-analyse/steps/step-05b-deploy.md +13 -11
  132. package/templates/skills/business-analyse/steps/step-06-review.md +3 -3
  133. package/templates/skills/business-analyse/templates/tpl-frd.md +13 -13
  134. package/templates/skills/business-analyse/templates/tpl-handoff.md +12 -12
  135. package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
  136. package/templates/skills/business-analyse/templates-frd.md +25 -25
  137. package/templates/skills/business-analyse/templates-react.md +15 -21
  138. package/templates/skills/controller/SKILL.md +1 -1
  139. package/templates/skills/controller/postman-templates.md +1 -1
  140. package/templates/skills/controller/references/controller-code-templates.md +2 -2
  141. package/templates/skills/controller/references/mcp-scaffold-workflow.md +209 -0
  142. package/templates/skills/controller/references/permission-sync-templates.md +13 -16
  143. package/templates/skills/controller/steps/step-00-init.md +11 -11
  144. package/templates/skills/controller/steps/step-03-generate.md +64 -103
  145. package/templates/skills/controller/templates.md +67 -71
  146. package/templates/skills/debug/SKILL.md +13 -218
  147. package/templates/skills/debug/steps/step-00-init.md +57 -0
  148. package/templates/skills/debug/steps/step-01-analyze.md +219 -0
  149. package/templates/skills/debug/steps/step-02-resolve.md +85 -0
  150. package/templates/skills/documentation/SKILL.md +49 -345
  151. package/templates/skills/documentation/data-schema.md +11 -8
  152. package/templates/skills/documentation/steps/step-00-init.md +70 -0
  153. package/templates/skills/documentation/steps/step-01-scan.md +113 -0
  154. package/templates/skills/documentation/steps/step-02-generate.md +231 -0
  155. package/templates/skills/documentation/steps/step-03-validate.md +238 -0
  156. package/templates/skills/documentation/templates.md +480 -322
  157. package/templates/skills/efcore/SKILL.md +1 -1
  158. package/templates/skills/efcore/references/both-contexts.md +32 -0
  159. package/templates/skills/efcore/references/database-operations.md +67 -0
  160. package/templates/skills/efcore/references/destructive-operations.md +38 -0
  161. package/templates/skills/efcore/references/reset-operations.md +81 -0
  162. package/templates/skills/efcore/references/seed-methods.md +86 -0
  163. package/templates/skills/efcore/references/shared-init-functions.md +250 -0
  164. package/templates/skills/efcore/references/sql-objects-injection.md +61 -0
  165. package/templates/skills/efcore/references/troubleshooting.md +81 -0
  166. package/templates/skills/efcore/steps/db/step-deploy.md +1 -32
  167. package/templates/skills/efcore/steps/db/step-reset.md +7 -103
  168. package/templates/skills/efcore/steps/db/step-seed.md +10 -132
  169. package/templates/skills/efcore/steps/db/step-status.md +5 -44
  170. package/templates/skills/efcore/steps/migration/step-02-create.md +1 -14
  171. package/templates/skills/efcore/steps/migration/step-03-validate.md +8 -62
  172. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +1 -57
  173. package/templates/skills/efcore/steps/shared/step-00-init.md +11 -254
  174. package/templates/skills/efcore/steps/squash/step-03-create.md +1 -58
  175. package/templates/skills/feature-full/SKILL.md +1 -1
  176. package/templates/skills/feature-full/steps/step-00-init.md +57 -0
  177. package/templates/skills/feature-full/steps/step-01-implementation.md +1 -1
  178. package/templates/skills/gitflow/SKILL.md +28 -5
  179. package/templates/skills/gitflow/_shared.md +109 -12
  180. package/templates/skills/gitflow/phases/abort.md +4 -0
  181. package/templates/skills/gitflow/phases/cleanup.md +4 -0
  182. package/templates/skills/gitflow/references/commit-message-generation.md +58 -0
  183. package/templates/skills/gitflow/references/commit-migration-validation.md +49 -0
  184. package/templates/skills/gitflow/references/finish-cleanup.md +55 -0
  185. package/templates/skills/gitflow/references/finish-version-bumping.md +45 -0
  186. package/templates/skills/gitflow/references/init-environment-detection.md +41 -0
  187. package/templates/skills/gitflow/references/init-questions.md +185 -0
  188. package/templates/skills/gitflow/references/init-structure-creation.md +75 -0
  189. package/templates/skills/gitflow/references/init-version-detection.md +21 -0
  190. package/templates/skills/gitflow/references/init-workspace-detection.md +43 -0
  191. package/templates/skills/gitflow/references/merge-ci-status.md +36 -0
  192. package/templates/skills/gitflow/references/merge-execution.md +62 -0
  193. package/templates/skills/gitflow/references/merge-pr-context.md +76 -0
  194. package/templates/skills/gitflow/references/pr-build-checks.md +60 -0
  195. package/templates/skills/gitflow/references/pr-generation.md +58 -0
  196. package/templates/skills/gitflow/references/start-branch-normalization.md +28 -0
  197. package/templates/skills/gitflow/references/start-worktree-creation.md +50 -0
  198. package/templates/skills/gitflow/references/sync-push-verify.md +44 -0
  199. package/templates/skills/gitflow/references/sync-rebase-conflicts.md +38 -0
  200. package/templates/skills/gitflow/steps/step-commit.md +12 -91
  201. package/templates/skills/gitflow/steps/step-finish.md +15 -159
  202. package/templates/skills/gitflow/steps/step-init.md +24 -326
  203. package/templates/skills/gitflow/steps/step-merge.md +17 -176
  204. package/templates/skills/gitflow/steps/step-pr.md +10 -116
  205. package/templates/skills/gitflow/steps/step-start.md +16 -109
  206. package/templates/skills/gitflow/steps/step-sync.md +6 -69
  207. package/templates/skills/ralph-loop/SKILL.md +6 -0
  208. package/templates/skills/ralph-loop/references/category-completeness.md +185 -0
  209. package/templates/skills/ralph-loop/references/compact-loop.md +1 -1
  210. package/templates/skills/ralph-loop/references/init-resume-recovery.md +127 -0
  211. package/templates/skills/ralph-loop/references/module-transition.md +151 -0
  212. package/templates/skills/ralph-loop/references/multi-module-queue.md +171 -0
  213. package/templates/skills/ralph-loop/references/parallel-execution.md +246 -0
  214. package/templates/skills/ralph-loop/references/task-transform-legacy.md +6 -9
  215. package/templates/skills/ralph-loop/references/team-orchestration.md +45 -3
  216. package/templates/skills/ralph-loop/steps/step-00-init.md +36 -109
  217. package/templates/skills/ralph-loop/steps/step-01-task.md +15 -163
  218. package/templates/skills/ralph-loop/steps/step-02-execute.md +8 -154
  219. package/templates/skills/ralph-loop/steps/step-04-check.md +20 -73
  220. package/templates/skills/review-code/references/owasp-api-top10.md +5 -5
  221. package/templates/skills/review-code/references/smartstack-conventions.md +568 -568
  222. package/templates/skills/validate-feature/references/api-smoke-tests.md +140 -0
  223. package/templates/skills/validate-feature/references/db-validation-checks.md +180 -0
  224. package/templates/skills/validate-feature/steps/step-01-compile.md +1 -3
  225. package/templates/skills/validate-feature/steps/step-04-api-smoke.md +34 -145
  226. package/templates/skills/validate-feature/steps/step-05-db-validation.md +74 -260
  227. package/templates/skills/workflow/SKILL.md +1 -1
  228. package/templates/skills/workflow/steps/step-00-init.md +57 -0
@@ -1,196 +1,196 @@
1
- ---
2
- name: step-02-permissions
3
- description: Generate RBAC permissions using MCP generate_permissions
4
- prev_step: steps/step-01-navigation.md
5
- next_step: steps/step-03-roles.md
6
- ---
7
-
8
- # Step 2: Permissions Generation
9
-
10
- ## MANDATORY EXECUTION RULES
11
-
12
- - ALWAYS use MCP `generate_permissions` tool - NEVER use templates
13
- - ALWAYS generate BOTH Permissions.cs constants AND PermissionConfiguration.cs HasData
14
- - NEVER skip this step - permissions are MANDATORY for security
15
- - YOU ARE AN ORCHESTRATOR calling MCP, not a generator
16
-
17
- ## YOUR TASK
18
-
19
- Call the SmartStack MCP `generate_permissions` tool to generate:
20
- 1. Permissions.cs nested class with constants
21
- 2. PermissionConfiguration.cs HasData() entries
22
-
23
- ---
24
-
25
- ## AVAILABLE STATE
26
-
27
- From previous steps:
28
-
29
- | Variable | Description |
30
- |----------|-------------|
31
- | `{level}` | context, application, module, or section |
32
- | `{full_path}` | Complete navigation path (navRoute) |
33
- | `{navigation_guid}` | GUID of the navigation entity |
34
- | `{labels}` | Object with fr, en, it, de |
35
- | `{project_type}` | "core" or "client" |
36
- | `{seeding_strategy}` | "hasdata" or "provider" |
37
-
38
- ---
39
-
40
- ## EXECUTION SEQUENCE
41
-
42
- ### 1. Determine NavRoute
43
-
44
- For permissions, the navRoute is the `{full_path}`:
45
-
46
- ```
47
- navRoute = "{full_path}"
48
- Example: "erp.sales.products"
49
- ```
50
-
51
- ### 2. Call MCP generate_permissions
52
-
53
- ```
54
- Tool: mcp__smartstack__generate_permissions
55
- Args:
56
- navRoute: "{full_path}"
57
- includeStandardActions: true
58
- includeWildcard: true
59
- ```
60
-
61
- ### 3. Parse MCP Response
62
-
63
- The tool returns:
64
- - Permissions.cs nested class structure
65
- - PermissionConfiguration.cs HasData() entries
66
- - Deterministic GUIDs for each permission
67
-
68
- ### 4. Present Permissions.cs Output
69
-
70
- ```markdown
71
- ## Permissions.cs Constants
72
-
73
- Add to `Application/Common/Authorization/Permissions.cs`:
74
-
75
- [Show Permissions.cs nested class from MCP response]
76
-
77
- **Usage in Controller:**
78
- ```csharp
79
- [RequirePermission(Permissions.{Context}.{Application}.{Module}.Read)]
80
- public async Task<ActionResult> GetAll() { ... }
81
- ```
82
- ```
83
-
84
- ### 5. Present PermissionConfiguration.cs Output
85
-
86
- ```markdown
87
- ## PermissionConfiguration.cs HasData
88
-
89
- Add to `Infrastructure/Persistence/Configurations/PermissionConfiguration.cs`:
90
-
91
- [Show HasData entries from MCP response]
92
- ```
93
-
94
- ### 6. Store Permission GUIDs
95
-
96
- Store the permission GUIDs for use in step-03-roles:
97
-
98
- ```
99
- {permission_guids} = {
100
- wildcard: "guid-for-wildcard",
101
- read: "guid-for-read",
102
- create: "guid-for-create",
103
- update: "guid-for-update",
104
- delete: "guid-for-delete"
105
- }
106
- ```
107
-
108
- ---
109
-
110
- ## CLIENT PROJECT HANDLING
111
-
112
- > **Condition:** `{seeding_strategy}` = "provider"
113
-
114
- ### 1. Call MCP generate_permissions normally
115
-
116
- The tool always returns:
117
- - Permissions.cs constants (Application layer) - **ALWAYS generated** (identical for core and client)
118
- - PermissionConfiguration.cs HasData - **REDIRECT for client projects**
119
-
120
- ### 2. Permissions.cs: IDENTICAL
121
-
122
- The `Permissions.cs` file in the Application layer is generated identically regardless of project type.
123
- Write it as usual.
124
-
125
- ### 3. PermissionConfiguration.cs: REDIRECT
126
-
127
- **For core (`{seeding_strategy}` = "hasdata"):** Write HasData() in `PermissionConfiguration.cs` (existing pattern)
128
-
129
- **For client (`{seeding_strategy}` = "provider"):** DO NOT write in PermissionConfiguration.cs (does not exist in client projects).
130
- Instead, create:
131
- - `Infrastructure/Persistence/Seeding/Data/{Domain}/{Module}PermissionSeedData.cs`
132
-
133
- Content: static class with deterministic GUIDs and method `GetPermissionEntries()`.
134
- These entries will be consumed by the `IClientSeedDataProvider` at step 03b.
135
-
136
- ### 4. Store Permission GUIDs
137
-
138
- Identical to the existing pattern - store `{permission_guids}` for step-03.
139
-
140
- ---
141
-
142
- ## TWO-FILE REQUIREMENT
143
-
144
- **CRITICAL:** SmartStack requires permissions in TWO files:
145
-
146
- | File | Layer | Content |
147
- |------|-------|---------|
148
- | `Permissions.cs` | Application | Compile-time constants |
149
- | `PermissionConfiguration.cs` | Infrastructure | EF Core HasData seeds |
150
-
151
- Both MUST be kept in sync. Missing one = runtime 403 errors.
152
-
153
- > **Client project exception:** For `{seeding_strategy}` = "provider", `PermissionConfiguration.cs` is replaced by
154
- > `{Module}PermissionSeedData.cs` + `IClientSeedDataProvider`. The `Permissions.cs` constants file is still required.
155
-
156
- ---
157
-
158
- ## MCP RESPONSE HANDLING
159
-
160
- ### Success Case
161
-
162
- If MCP returns successfully:
163
- - Display Permissions.cs code
164
- - Display PermissionConfiguration.cs HasData code
165
- - Store `{permission_guids}` for next step
166
- - Proceed to step-03-roles.md
167
-
168
- ### Error Case
169
-
170
- If MCP call fails:
171
- - Display error message
172
- - Suggest checking navRoute format
173
- - Do NOT proceed automatically
174
-
175
- ---
176
-
177
- ## SUCCESS METRICS
178
-
179
- - MCP generate_permissions called successfully
180
- - Permissions.cs code displayed
181
- - PermissionConfiguration.cs HasData displayed
182
- - Deterministic GUIDs (not placeholders)
183
- - Permission GUIDs stored for role assignment
184
- - Proceeded to step-03-roles.md
185
-
186
- ## FAILURE MODES
187
-
188
- - MCP call failed (display error, stop)
189
- - Invalid navRoute format (must be context.application.module)
190
- - Missing navigation entity (return to step-01)
191
-
192
- ---
193
-
194
- ## NEXT STEP
195
-
196
- After displaying permission code, proceed to `./step-03-roles.md`
1
+ ---
2
+ name: step-02-permissions
3
+ description: Generate RBAC permissions using MCP generate_permissions
4
+ prev_step: steps/step-01-navigation.md
5
+ next_step: steps/step-03-roles.md
6
+ ---
7
+
8
+ # Step 2: Permissions Generation
9
+
10
+ ## MANDATORY EXECUTION RULES
11
+
12
+ - ALWAYS use MCP `generate_permissions` tool - NEVER use templates
13
+ - ALWAYS generate BOTH Permissions.cs constants AND PermissionConfiguration.cs HasData
14
+ - NEVER skip this step - permissions are MANDATORY for security
15
+ - YOU ARE AN ORCHESTRATOR calling MCP, not a generator
16
+
17
+ ## YOUR TASK
18
+
19
+ Call the SmartStack MCP `generate_permissions` tool to generate:
20
+ 1. Permissions.cs nested class with constants
21
+ 2. PermissionConfiguration.cs HasData() entries
22
+
23
+ ---
24
+
25
+ ## AVAILABLE STATE
26
+
27
+ From previous steps:
28
+
29
+ | Variable | Description |
30
+ |----------|-------------|
31
+ | `{level}` | application, module, section, or resource |
32
+ | `{full_path}` | Complete navigation path (navRoute) |
33
+ | `{navigation_guid}` | GUID of the navigation entity |
34
+ | `{labels}` | Object with fr, en, it, de |
35
+ | `{project_type}` | "core" or "client" |
36
+ | `{seeding_strategy}` | "hasdata" or "provider" |
37
+
38
+ ---
39
+
40
+ ## EXECUTION SEQUENCE
41
+
42
+ ### 1. Determine NavRoute
43
+
44
+ For permissions, the navRoute is the `{full_path}`:
45
+
46
+ ```
47
+ navRoute = "{full_path}"
48
+ Example: "sales.products"
49
+ ```
50
+
51
+ ### 2. Call MCP generate_permissions
52
+
53
+ ```
54
+ Tool: mcp__smartstack__generate_permissions
55
+ Args:
56
+ navRoute: "{full_path}"
57
+ includeStandardActions: true
58
+ includeWildcard: true
59
+ ```
60
+
61
+ ### 3. Parse MCP Response
62
+
63
+ The tool returns:
64
+ - Permissions.cs nested class structure
65
+ - PermissionConfiguration.cs HasData() entries
66
+ - Deterministic GUIDs for each permission
67
+
68
+ ### 4. Present Permissions.cs Output
69
+
70
+ ```markdown
71
+ ## Permissions.cs Constants
72
+
73
+ Add to `Application/Common/Authorization/Permissions.cs`:
74
+
75
+ [Show Permissions.cs nested class from MCP response]
76
+
77
+ **Usage in Controller:**
78
+ ```csharp
79
+ [RequirePermission(Permissions.{Application}.{Module}.Read)]
80
+ public async Task<ActionResult> GetAll() { ... }
81
+ ```
82
+ ```
83
+
84
+ ### 5. Present PermissionConfiguration.cs Output
85
+
86
+ ```markdown
87
+ ## PermissionConfiguration.cs HasData
88
+
89
+ Add to `Infrastructure/Persistence/Configurations/PermissionConfiguration.cs`:
90
+
91
+ [Show HasData entries from MCP response]
92
+ ```
93
+
94
+ ### 6. Store Permission GUIDs
95
+
96
+ Store the permission GUIDs for use in step-03-roles:
97
+
98
+ ```
99
+ {permission_guids} = {
100
+ wildcard: "guid-for-wildcard",
101
+ read: "guid-for-read",
102
+ create: "guid-for-create",
103
+ update: "guid-for-update",
104
+ delete: "guid-for-delete"
105
+ }
106
+ ```
107
+
108
+ ---
109
+
110
+ ## CLIENT PROJECT HANDLING
111
+
112
+ > **Condition:** `{seeding_strategy}` = "provider"
113
+
114
+ ### 1. Call MCP generate_permissions normally
115
+
116
+ The tool always returns:
117
+ - Permissions.cs constants (Application layer) - **ALWAYS generated** (identical for core and client)
118
+ - PermissionConfiguration.cs HasData - **REDIRECT for client projects**
119
+
120
+ ### 2. Permissions.cs: IDENTICAL
121
+
122
+ The `Permissions.cs` file in the Application layer is generated identically regardless of project type.
123
+ Write it as usual.
124
+
125
+ ### 3. PermissionConfiguration.cs: REDIRECT
126
+
127
+ **For core (`{seeding_strategy}` = "hasdata"):** Write HasData() in `PermissionConfiguration.cs` (existing pattern)
128
+
129
+ **For client (`{seeding_strategy}` = "provider"):** DO NOT write in PermissionConfiguration.cs (does not exist in client projects).
130
+ Instead, create:
131
+ - `Infrastructure/Persistence/Seeding/Data/{Domain}/{Module}PermissionSeedData.cs`
132
+
133
+ Content: static class with deterministic GUIDs and method `GetPermissionEntries()`.
134
+ These entries will be consumed by the `IClientSeedDataProvider` at step 03b.
135
+
136
+ ### 4. Store Permission GUIDs
137
+
138
+ Identical to the existing pattern - store `{permission_guids}` for step-03.
139
+
140
+ ---
141
+
142
+ ## TWO-FILE REQUIREMENT
143
+
144
+ **CRITICAL:** SmartStack requires permissions in TWO files:
145
+
146
+ | File | Layer | Content |
147
+ |------|-------|---------|
148
+ | `Permissions.cs` | Application | Compile-time constants |
149
+ | `PermissionConfiguration.cs` | Infrastructure | EF Core HasData seeds |
150
+
151
+ Both MUST be kept in sync. Missing one = runtime 403 errors.
152
+
153
+ > **Client project exception:** For `{seeding_strategy}` = "provider", `PermissionConfiguration.cs` is replaced by
154
+ > `{Module}PermissionSeedData.cs` + `IClientSeedDataProvider`. The `Permissions.cs` constants file is still required.
155
+
156
+ ---
157
+
158
+ ## MCP RESPONSE HANDLING
159
+
160
+ ### Success Case
161
+
162
+ If MCP returns successfully:
163
+ - Display Permissions.cs code
164
+ - Display PermissionConfiguration.cs HasData code
165
+ - Store `{permission_guids}` for next step
166
+ - Proceed to step-03-roles.md
167
+
168
+ ### Error Case
169
+
170
+ If MCP call fails:
171
+ - Display error message
172
+ - Suggest checking navRoute format
173
+ - Do NOT proceed automatically
174
+
175
+ ---
176
+
177
+ ## SUCCESS METRICS
178
+
179
+ - MCP generate_permissions called successfully
180
+ - Permissions.cs code displayed
181
+ - PermissionConfiguration.cs HasData displayed
182
+ - Deterministic GUIDs (not placeholders)
183
+ - Permission GUIDs stored for role assignment
184
+ - Proceeded to step-03-roles.md
185
+
186
+ ## FAILURE MODES
187
+
188
+ - MCP call failed (display error, stop)
189
+ - Invalid navRoute format (must be application.module.section)
190
+ - Missing navigation entity (return to step-01)
191
+
192
+ ---
193
+
194
+ ## NEXT STEP
195
+
196
+ After displaying permission code, proceed to `./step-03-roles.md`