@atlashub/smartstack-cli 3.38.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 (47) hide show
  1. package/dist/mcp-entry.mjs +62 -37
  2. package/dist/mcp-entry.mjs.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/agents/efcore/scan.md +3 -1
  5. package/templates/agents/gitflow/commit.md +74 -0
  6. package/templates/agents/gitflow/finish.md +5 -2
  7. package/templates/agents/gitflow/init-clone.md +3 -3
  8. package/templates/agents/gitflow/init-validate.md +3 -2
  9. package/templates/agents/gitflow/merge.md +5 -0
  10. package/templates/agents/gitflow/pr.md +5 -0
  11. package/templates/agents/gitflow/start.md +8 -1
  12. package/templates/hooks/hooks.json +11 -0
  13. package/templates/hooks/wsl-dotnet-cleanup.sh +24 -0
  14. package/templates/skills/apex/references/core-seed-data.md +0 -1
  15. package/templates/skills/apex/references/examine-build-validation.md +1 -6
  16. package/templates/skills/apex/references/smartstack-frontend.md +1 -1
  17. package/templates/skills/apex/steps/step-03-execute.md +4 -9
  18. package/templates/skills/apex/steps/step-08-run-tests.md +1 -2
  19. package/templates/skills/application/SKILL.md +241 -241
  20. package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +5 -5
  21. package/templates/skills/application/references/frontend-verification.md +1 -1
  22. package/templates/skills/application/references/init-parameter-detection.md +121 -120
  23. package/templates/skills/application/references/migration-checklist-troubleshooting.md +100 -100
  24. package/templates/skills/application/references/nav-fallback-procedure.md +199 -199
  25. package/templates/skills/application/steps/step-00-init.md +130 -130
  26. package/templates/skills/application/steps/step-01-navigation.md +170 -170
  27. package/templates/skills/application/steps/step-02-permissions.md +196 -196
  28. package/templates/skills/application/steps/step-03-roles.md +182 -182
  29. package/templates/skills/application/steps/step-03b-provider.md +133 -133
  30. package/templates/skills/application/steps/step-04-backend.md +174 -174
  31. package/templates/skills/application/steps/step-05-frontend.md +1 -1
  32. package/templates/skills/application/templates-frontend.md +7 -7
  33. package/templates/skills/business-analyse/react/schema.md +836 -836
  34. package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
  35. package/templates/skills/business-analyse/templates-frd.md +1 -1
  36. package/templates/skills/efcore/SKILL.md +1 -1
  37. package/templates/skills/efcore/steps/migration/step-02-create.md +1 -14
  38. package/templates/skills/gitflow/SKILL.md +27 -4
  39. package/templates/skills/gitflow/_shared.md +86 -12
  40. package/templates/skills/gitflow/phases/abort.md +4 -0
  41. package/templates/skills/gitflow/phases/cleanup.md +4 -0
  42. package/templates/skills/gitflow/references/finish-cleanup.md +4 -0
  43. package/templates/skills/gitflow/references/init-structure-creation.md +4 -0
  44. package/templates/skills/gitflow/references/start-worktree-creation.md +1 -1
  45. package/templates/skills/ralph-loop/steps/step-04-check.md +1 -2
  46. package/templates/skills/review-code/references/smartstack-conventions.md +568 -568
  47. package/templates/skills/validate-feature/steps/step-01-compile.md +1 -6
@@ -1,182 +1,182 @@
1
- ---
2
- name: step-03-roles
3
- description: Generate application roles and role-permission mappings using MCP scaffold_role_permissions (with fallback)
4
- prev_step: steps/step-02-permissions.md
5
- next_step: steps/step-03b-provider.md
6
- ---
7
-
8
- # Step 3: Application Roles & Role-Permission Mapping
9
-
10
- ## MANDATORY EXECUTION RULES
11
-
12
- - For **client projects** (`seeding_strategy = "provider"`): Generate ApplicationRolesSeedData.cs and module role mappings
13
- - For **core projects** (`seeding_strategy = "hasdata"`): Use RolePermissionConfiguration.cs
14
- - PREFER MCP `scaffold_role_permissions` tool as the primary method
15
- - If MCP is unavailable or the call fails, use the FALLBACK PROCEDURE below
16
- - ALWAYS assign permissions to default roles
17
- - NEVER leave permissions without role assignments
18
- - ALWAYS WRITE generated code to the actual files
19
-
20
- ## YOUR TASK
21
-
22
- For **client projects**:
23
- 1. **ApplicationRolesSeedData.cs** (once per application) — defines the 4 application-scoped roles
24
- 2. **{Module}RolePermissionSeedData.cs** (per module) — maps permissions to roles by Code
25
-
26
- For **core projects**:
27
- 1. RolePermissionConfiguration.cs HasData() entries
28
- 2. Default role assignments (SuperAdmin, PlatformAdmin, TenantAdmin, StandardUser)
29
- 3. Application-scoped role assignments (Admin, Manager, Contributor, Viewer)
30
-
31
- ---
32
-
33
- ## AVAILABLE STATE
34
-
35
- From previous steps:
36
-
37
- | Variable | Description |
38
- |----------|-------------|
39
- | `{full_path}` | Complete navigation path (navRoute) |
40
- | `{level}` | application, module, or section |
41
- | `{permission_guids}` | GUIDs for generated permissions |
42
- | `{mcp_available}` | Boolean - MCP connectivity status |
43
- | `{project_type}` | "core" or "client" |
44
- | `{seeding_strategy}` | "hasdata" or "provider" |
45
-
46
- ---
47
-
48
- ## EXECUTION SEQUENCE (MCP Primary)
49
-
50
- ### 1. Determine Default Role Assignments
51
-
52
- See [references/roles-client-project-handling.md](../references/roles-client-project-handling.md) for:
53
- - Default role mapping table by application prefix
54
- - ApplicationRolesSeedData.cs requirements (once per application)
55
- - {Module}RolePermissionSeedData.cs requirements (per module)
56
-
57
- ### 2. Call MCP scaffold_role_permissions
58
-
59
- ```
60
- Tool: mcp__smartstack__scaffold_role_permissions
61
- Args:
62
- navRoute: "{full_path}"
63
- roles:
64
- platformAdmin: ["read", "create", "update", "delete"] # Adjust based on context
65
- tenantAdmin: ["read", "create", "update"] # Adjust based on context
66
- standardUser: ["read"] # Adjust based on context
67
- includeWildcard: true
68
- ```
69
-
70
- ### 3. Parse MCP Response
71
-
72
- The tool returns:
73
- - RolePermissionConfiguration.cs HasData() entries
74
- - Permission ID variable references
75
- - Role ID variable references
76
-
77
- ### 4. Write Code to Files
78
-
79
- **CRITICAL:** WRITE the generated code to the actual RolePermissionConfiguration.cs file.
80
-
81
- ### 5. Present Summary
82
-
83
- ```markdown
84
- ## Role-Permission Mappings
85
-
86
- | Role | Permissions |
87
- |------|-------------|
88
- | SuperAdmin | `{full_path}.*` (via wildcard) |
89
- | PlatformAdmin | `{full_path}.read`, `.create`, `.update`, `.delete` |
90
- | TenantAdmin | `{full_path}.read`, `.create`, `.update` |
91
- | StandardUser | `{full_path}.read` |
92
- ```
93
-
94
- ### 6. Confirm with User (Optional)
95
-
96
- ```yaml
97
- questions:
98
- - header: "Role Access"
99
- question: "Adjust role permissions for {full_path}?"
100
- options:
101
- - label: "Keep defaults (Recommended)"
102
- description: "PlatformAdmin: CRUD, TenantAdmin: CRU, StandardUser: R"
103
- - label: "All roles full access"
104
- description: "All roles get full CRUD access"
105
- - label: "Custom"
106
- description: "I'll specify custom permissions"
107
- multiSelect: false
108
- ```
109
-
110
- ---
111
-
112
- ## MCP RESPONSE HANDLING
113
-
114
- ### Success Case
115
-
116
- If MCP returns successfully:
117
- - Write RolePermission HasData code to file
118
- - Show role-permission summary table
119
- - Proceed to step-04-backend.md
120
-
121
- ### Error Case
122
-
123
- If MCP call fails or `{mcp_available}` = false:
124
- - Log the error for reference
125
- - Proceed to FALLBACK PROCEDURE below
126
- - Do NOT stop the workflow
127
-
128
- ---
129
-
130
- ## CLIENT PROJECT HANDLING
131
-
132
- > **Condition:** `{seeding_strategy}` = "provider"
133
-
134
- See [references/roles-client-project-handling.md](../references/roles-client-project-handling.md) for:
135
- - ApplicationRolesSeedData.cs creation (once per application)
136
- - {Module}RolePermissionSeedData.cs creation (per module)
137
- - Role code naming and GUID generation rules
138
- - Detection of existing ApplicationRolesSeedData.cs
139
-
140
- ---
141
-
142
- ## FALLBACK PROCEDURE (When MCP Unavailable)
143
-
144
- See [references/roles-fallback-procedure.md](../references/roles-fallback-procedure.md) for the complete 7-step fallback:
145
- - **F1:** Read existing RolePermissionConfiguration.cs to determine state
146
- - **F2:** Read role GUIDs (system-level and application-scoped)
147
- - **F3:** Determine default mappings based on application prefix
148
- - **F4:** Generate RolePermission HasData entries using permission GUIDs
149
- - **F5:** Write code to RolePermissionConfiguration.cs (CRITICAL: WRITE not display)
150
- - **F6:** Present summary
151
- - **F7:** Offer user adjustment option
152
-
153
- ---
154
-
155
- ## SUCCESS METRICS
156
-
157
- **For client projects:**
158
- - ApplicationRolesSeedData.cs created (once per application)
159
- - {Module}RolePermissionSeedData.cs created with role-permission mappings
160
- - All 4 application roles defined with valid Code values
161
- - Proceeded to step-03b-provider.md
162
-
163
- **For core projects:**
164
- - Role-permission mappings generated (via MCP or fallback)
165
- - RolePermissionConfiguration.cs WRITTEN with new entries
166
- - All default roles have appropriate access
167
- - Proceeded to step-04-backend.md
168
-
169
- ## FAILURE MODES
170
-
171
- - Permission GUIDs not available from step-02 (return to step-02)
172
- - Role GUIDs not found in project (ask user, use well-known defaults)
173
- - Invalid navRoute format (return to step-00)
174
-
175
- ---
176
-
177
- ## NEXT STEP
178
-
179
- After role-permission mappings are generated (via MCP or fallback) and written to files,
180
- proceed to `./step-03b-provider.md`
181
-
182
- > **Note:** step-03b will automatically skip if `{seeding_strategy}` = "hasdata" and proceed directly to step-04-backend.
1
+ ---
2
+ name: step-03-roles
3
+ description: Generate application roles and role-permission mappings using MCP scaffold_role_permissions (with fallback)
4
+ prev_step: steps/step-02-permissions.md
5
+ next_step: steps/step-03b-provider.md
6
+ ---
7
+
8
+ # Step 3: Application Roles & Role-Permission Mapping
9
+
10
+ ## MANDATORY EXECUTION RULES
11
+
12
+ - For **client projects** (`seeding_strategy = "provider"`): Generate ApplicationRolesSeedData.cs and module role mappings
13
+ - For **core projects** (`seeding_strategy = "hasdata"`): Use RolePermissionConfiguration.cs
14
+ - PREFER MCP `scaffold_role_permissions` tool as the primary method
15
+ - If MCP is unavailable or the call fails, use the FALLBACK PROCEDURE below
16
+ - ALWAYS assign permissions to default roles
17
+ - NEVER leave permissions without role assignments
18
+ - ALWAYS WRITE generated code to the actual files
19
+
20
+ ## YOUR TASK
21
+
22
+ For **client projects**:
23
+ 1. **ApplicationRolesSeedData.cs** (once per application) — defines the 4 application-scoped roles
24
+ 2. **{Module}RolePermissionSeedData.cs** (per module) — maps permissions to roles by Code
25
+
26
+ For **core projects**:
27
+ 1. RolePermissionConfiguration.cs HasData() entries
28
+ 2. Default role assignments (SuperAdmin, PlatformAdmin, TenantAdmin, StandardUser)
29
+ 3. Application-scoped role assignments (Admin, Manager, Contributor, Viewer)
30
+
31
+ ---
32
+
33
+ ## AVAILABLE STATE
34
+
35
+ From previous steps:
36
+
37
+ | Variable | Description |
38
+ |----------|-------------|
39
+ | `{full_path}` | Complete navigation path (navRoute) |
40
+ | `{level}` | application, module, section, or resource |
41
+ | `{permission_guids}` | GUIDs for generated permissions |
42
+ | `{mcp_available}` | Boolean - MCP connectivity status |
43
+ | `{project_type}` | "core" or "client" |
44
+ | `{seeding_strategy}` | "hasdata" or "provider" |
45
+
46
+ ---
47
+
48
+ ## EXECUTION SEQUENCE (MCP Primary)
49
+
50
+ ### 1. Determine Default Role Assignments
51
+
52
+ See [references/roles-client-project-handling.md](../references/roles-client-project-handling.md) for:
53
+ - Default role mapping table by application prefix
54
+ - ApplicationRolesSeedData.cs requirements (once per application)
55
+ - {Module}RolePermissionSeedData.cs requirements (per module)
56
+
57
+ ### 2. Call MCP scaffold_role_permissions
58
+
59
+ ```
60
+ Tool: mcp__smartstack__scaffold_role_permissions
61
+ Args:
62
+ navRoute: "{full_path}"
63
+ roles:
64
+ platformAdmin: ["read", "create", "update", "delete"] # Adjust based on context
65
+ tenantAdmin: ["read", "create", "update"] # Adjust based on context
66
+ standardUser: ["read"] # Adjust based on context
67
+ includeWildcard: true
68
+ ```
69
+
70
+ ### 3. Parse MCP Response
71
+
72
+ The tool returns:
73
+ - RolePermissionConfiguration.cs HasData() entries
74
+ - Permission ID variable references
75
+ - Role ID variable references
76
+
77
+ ### 4. Write Code to Files
78
+
79
+ **CRITICAL:** WRITE the generated code to the actual RolePermissionConfiguration.cs file.
80
+
81
+ ### 5. Present Summary
82
+
83
+ ```markdown
84
+ ## Role-Permission Mappings
85
+
86
+ | Role | Permissions |
87
+ |------|-------------|
88
+ | SuperAdmin | `{full_path}.*` (via wildcard) |
89
+ | PlatformAdmin | `{full_path}.read`, `.create`, `.update`, `.delete` |
90
+ | TenantAdmin | `{full_path}.read`, `.create`, `.update` |
91
+ | StandardUser | `{full_path}.read` |
92
+ ```
93
+
94
+ ### 6. Confirm with User (Optional)
95
+
96
+ ```yaml
97
+ questions:
98
+ - header: "Role Access"
99
+ question: "Adjust role permissions for {full_path}?"
100
+ options:
101
+ - label: "Keep defaults (Recommended)"
102
+ description: "PlatformAdmin: CRUD, TenantAdmin: CRU, StandardUser: R"
103
+ - label: "All roles full access"
104
+ description: "All roles get full CRUD access"
105
+ - label: "Custom"
106
+ description: "I'll specify custom permissions"
107
+ multiSelect: false
108
+ ```
109
+
110
+ ---
111
+
112
+ ## MCP RESPONSE HANDLING
113
+
114
+ ### Success Case
115
+
116
+ If MCP returns successfully:
117
+ - Write RolePermission HasData code to file
118
+ - Show role-permission summary table
119
+ - Proceed to step-04-backend.md
120
+
121
+ ### Error Case
122
+
123
+ If MCP call fails or `{mcp_available}` = false:
124
+ - Log the error for reference
125
+ - Proceed to FALLBACK PROCEDURE below
126
+ - Do NOT stop the workflow
127
+
128
+ ---
129
+
130
+ ## CLIENT PROJECT HANDLING
131
+
132
+ > **Condition:** `{seeding_strategy}` = "provider"
133
+
134
+ See [references/roles-client-project-handling.md](../references/roles-client-project-handling.md) for:
135
+ - ApplicationRolesSeedData.cs creation (once per application)
136
+ - {Module}RolePermissionSeedData.cs creation (per module)
137
+ - Role code naming and GUID generation rules
138
+ - Detection of existing ApplicationRolesSeedData.cs
139
+
140
+ ---
141
+
142
+ ## FALLBACK PROCEDURE (When MCP Unavailable)
143
+
144
+ See [references/roles-fallback-procedure.md](../references/roles-fallback-procedure.md) for the complete 7-step fallback:
145
+ - **F1:** Read existing RolePermissionConfiguration.cs to determine state
146
+ - **F2:** Read role GUIDs (system-level and application-scoped)
147
+ - **F3:** Determine default mappings based on application prefix
148
+ - **F4:** Generate RolePermission HasData entries using permission GUIDs
149
+ - **F5:** Write code to RolePermissionConfiguration.cs (CRITICAL: WRITE not display)
150
+ - **F6:** Present summary
151
+ - **F7:** Offer user adjustment option
152
+
153
+ ---
154
+
155
+ ## SUCCESS METRICS
156
+
157
+ **For client projects:**
158
+ - ApplicationRolesSeedData.cs created (once per application)
159
+ - {Module}RolePermissionSeedData.cs created with role-permission mappings
160
+ - All 4 application roles defined with valid Code values
161
+ - Proceeded to step-03b-provider.md
162
+
163
+ **For core projects:**
164
+ - Role-permission mappings generated (via MCP or fallback)
165
+ - RolePermissionConfiguration.cs WRITTEN with new entries
166
+ - All default roles have appropriate access
167
+ - Proceeded to step-04-backend.md
168
+
169
+ ## FAILURE MODES
170
+
171
+ - Permission GUIDs not available from step-02 (return to step-02)
172
+ - Role GUIDs not found in project (ask user, use well-known defaults)
173
+ - Invalid navRoute format (return to step-00)
174
+
175
+ ---
176
+
177
+ ## NEXT STEP
178
+
179
+ After role-permission mappings are generated (via MCP or fallback) and written to files,
180
+ proceed to `./step-03b-provider.md`
181
+
182
+ > **Note:** step-03b will automatically skip if `{seeding_strategy}` = "hasdata" and proceed directly to step-04-backend.
@@ -1,133 +1,133 @@
1
- ---
2
- name: step-03b-provider
3
- description: Generate IClientSeedDataProvider implementation for client projects
4
- prev_step: steps/step-03-roles.md
5
- next_step: steps/step-04-backend.md
6
- ---
7
-
8
- # Step 3b: Client Seed Data Provider (Client Projects Only)
9
-
10
- ## CONDITION D'EXECUTION
11
-
12
- > This step executes ONLY if `{seeding_strategy}` = "provider" (client project).
13
- > If `{seeding_strategy}` = "hasdata", skip directly to step-04-backend.md.
14
-
15
- ## MANDATORY EXECUTION RULES
16
-
17
- - ONLY execute for client projects (`{seeding_strategy}` = "provider")
18
- - ALWAYS use factory methods (`NavigationModule.Create(...)`, etc.) - NEVER `new Entity()`
19
- - ALWAYS implement idempotence (check existence before inserting)
20
- - ALWAYS register the provider in DI
21
- - ALWAYS consume the SeedData classes created in steps 01-03
22
-
23
- ## YOUR TASK
24
-
25
- Generate the `IClientSeedDataProvider` implementation that wires the SeedData files
26
- created in steps 01, 02, 03 into the SmartStack Core seeding pipeline.
27
-
28
- ---
29
-
30
- ## AVAILABLE STATE
31
-
32
- From previous steps:
33
-
34
- | Variable | Description |
35
- |----------|-------------|
36
- | `{level}` | application, module, or section |
37
- | `{code}` | kebab-case identifier |
38
- | `{full_path}` | Complete navigation path |
39
- | `{labels}` | Object with fr, en, it, de |
40
- | `{descriptions}` | Object with fr, en, it, de |
41
- | `{icon}` | Lucide icon name |
42
- | `{display_order}` | Numeric display order |
43
- | `{navigation_guid}` | GUID of the navigation entity |
44
- | `{permission_guids}` | GUIDs for generated permissions |
45
- | `{project_type}` | "client" (guaranteed at this step) |
46
- | `{seeding_strategy}` | "provider" (guaranteed at this step) |
47
-
48
- ---
49
-
50
- ## FILES TO GENERATE
51
-
52
- See [references/provider-template.md](../references/provider-template.md) for the complete implementation:
53
- - **ApplicationRolesSeedData.cs** (once per application) — defines application-scoped roles (Admin, Manager, Contributor, Viewer)
54
- - **Provider class** (`{AppPascalName}SeedDataProvider.cs`) with 4 seed methods (Navigation, Roles, Permissions, RolePermissions)
55
- - **DI registration** pattern for `Infrastructure/DependencyInjection.cs`
56
- - **7 critical rules** (factory methods, idempotence, execution order, SaveChangesAsync order, deterministic GUIDs, FK by Code, Order property)
57
-
58
- ---
59
-
60
- ## EXECUTION SEQUENCE
61
-
62
- ### 1. Read SeedData files from steps 01-03
63
-
64
- Identify all SeedData files created in previous steps:
65
-
66
- ```
67
- Glob: **/Persistence/Seeding/Data/{Domain}/*SeedData.cs
68
- Glob: **/Persistence/Seeding/Data/ApplicationRolesSeedData.cs
69
- ```
70
-
71
- Expected files:
72
- - `ApplicationRolesSeedData.cs` (application-level, once per app)
73
- - `{Module}NavigationSeedData.cs` (from step 01)
74
- - `{Module}NavigationTranslationSeedData.cs` (from step 01)
75
- - `{Module}PermissionSeedData.cs` (from step 02)
76
- - `{Module}RolePermissionSeedData.cs` (from step 03)
77
-
78
- ### 2. Generate Provider Class
79
-
80
- Using the SeedData files as data sources, generate the `{AppPascalName}SeedDataProvider.cs` following the pattern above.
81
-
82
- Adapt the template:
83
- - Replace `{AppPascalName}` with the PascalCase application name
84
- - Replace `{app_code}` with the kebab-case application code
85
- - Fill in the actual navigation, permission, and role-permission creation logic
86
- using the helper methods from the SeedData classes
87
-
88
- ### 3. Register in DI
89
-
90
- Find and update `Infrastructure/DependencyInjection.cs`:
91
-
92
- ```
93
- Glob: **/Infrastructure/DependencyInjection.cs
94
- ```
95
-
96
- Add the `IClientSeedDataProvider` registration.
97
-
98
- ### 4. Verify
99
-
100
- Before proceeding to step-04, verify:
101
- - [ ] ApplicationRolesSeedData.cs created (once per application)
102
- - [ ] Provider generated with 4 methods (SeedNavigationAsync, SeedRolesAsync, SeedPermissionsAsync, SeedRolePermissionsAsync)
103
- - [ ] Execution order: Navigation → Roles → Permissions → RolePermissions
104
- - [ ] Registered in DI (`services.AddScoped<IClientSeedDataProvider, ...>()`)
105
- - [ ] Consumes SeedData classes from steps 01-03 + ApplicationRolesSeedData
106
- - [ ] Idempotent (check existence before insert)
107
- - [ ] Uses factory methods (no `new Entity()`)
108
-
109
- ---
110
-
111
- ## SUCCESS METRICS
112
-
113
- - ApplicationRolesSeedData.cs created (application-level)
114
- - Provider class generated with all 4 seed methods (Navigation, Roles, Permissions, RolePermissions)
115
- - Correct execution order enforced
116
- - DI registration added
117
- - SeedData classes from steps 01-03 + ApplicationRolesSeedData properly consumed
118
- - All methods are idempotent
119
- - Factory methods used throughout
120
- - Proceeded to step-04-backend.md
121
-
122
- ## FAILURE MODES
123
-
124
- - SeedData files not found from previous steps (return to step-01)
125
- - DependencyInjection.cs not found (ask user for DI registration location)
126
- - Missing IClientSeedDataProvider interface (verify SmartStack.Application reference)
127
-
128
- ---
129
-
130
- ## NEXT STEP
131
-
132
- After generating the provider and registering it in DI,
133
- proceed to `./step-04-backend.md`
1
+ ---
2
+ name: step-03b-provider
3
+ description: Generate IClientSeedDataProvider implementation for client projects
4
+ prev_step: steps/step-03-roles.md
5
+ next_step: steps/step-04-backend.md
6
+ ---
7
+
8
+ # Step 3b: Client Seed Data Provider (Client Projects Only)
9
+
10
+ ## CONDITION D'EXECUTION
11
+
12
+ > This step executes ONLY if `{seeding_strategy}` = "provider" (client project).
13
+ > If `{seeding_strategy}` = "hasdata", skip directly to step-04-backend.md.
14
+
15
+ ## MANDATORY EXECUTION RULES
16
+
17
+ - ONLY execute for client projects (`{seeding_strategy}` = "provider")
18
+ - ALWAYS use factory methods (`NavigationModule.Create(...)`, etc.) - NEVER `new Entity()`
19
+ - ALWAYS implement idempotence (check existence before inserting)
20
+ - ALWAYS register the provider in DI
21
+ - ALWAYS consume the SeedData classes created in steps 01-03
22
+
23
+ ## YOUR TASK
24
+
25
+ Generate the `IClientSeedDataProvider` implementation that wires the SeedData files
26
+ created in steps 01, 02, 03 into the SmartStack Core seeding pipeline.
27
+
28
+ ---
29
+
30
+ ## AVAILABLE STATE
31
+
32
+ From previous steps:
33
+
34
+ | Variable | Description |
35
+ |----------|-------------|
36
+ | `{level}` | application, module, section, or resource |
37
+ | `{code}` | kebab-case identifier |
38
+ | `{full_path}` | Complete navigation path |
39
+ | `{labels}` | Object with fr, en, it, de |
40
+ | `{descriptions}` | Object with fr, en, it, de |
41
+ | `{icon}` | Lucide icon name |
42
+ | `{display_order}` | Numeric display order |
43
+ | `{navigation_guid}` | GUID of the navigation entity |
44
+ | `{permission_guids}` | GUIDs for generated permissions |
45
+ | `{project_type}` | "client" (guaranteed at this step) |
46
+ | `{seeding_strategy}` | "provider" (guaranteed at this step) |
47
+
48
+ ---
49
+
50
+ ## FILES TO GENERATE
51
+
52
+ See [references/provider-template.md](../references/provider-template.md) for the complete implementation:
53
+ - **ApplicationRolesSeedData.cs** (once per application) — defines application-scoped roles (Admin, Manager, Contributor, Viewer)
54
+ - **Provider class** (`{AppPascalName}SeedDataProvider.cs`) with 4 seed methods (Navigation, Roles, Permissions, RolePermissions)
55
+ - **DI registration** pattern for `Infrastructure/DependencyInjection.cs`
56
+ - **7 critical rules** (factory methods, idempotence, execution order, SaveChangesAsync order, deterministic GUIDs, FK by Code, Order property)
57
+
58
+ ---
59
+
60
+ ## EXECUTION SEQUENCE
61
+
62
+ ### 1. Read SeedData files from steps 01-03
63
+
64
+ Identify all SeedData files created in previous steps:
65
+
66
+ ```
67
+ Glob: **/Persistence/Seeding/Data/{Domain}/*SeedData.cs
68
+ Glob: **/Persistence/Seeding/Data/ApplicationRolesSeedData.cs
69
+ ```
70
+
71
+ Expected files:
72
+ - `ApplicationRolesSeedData.cs` (application-level, once per app)
73
+ - `{Module}NavigationSeedData.cs` (from step 01)
74
+ - `{Module}NavigationTranslationSeedData.cs` (from step 01)
75
+ - `{Module}PermissionSeedData.cs` (from step 02)
76
+ - `{Module}RolePermissionSeedData.cs` (from step 03)
77
+
78
+ ### 2. Generate Provider Class
79
+
80
+ Using the SeedData files as data sources, generate the `{AppPascalName}SeedDataProvider.cs` following the pattern above.
81
+
82
+ Adapt the template:
83
+ - Replace `{AppPascalName}` with the PascalCase application name
84
+ - Replace `{app_code}` with the kebab-case application code
85
+ - Fill in the actual navigation, permission, and role-permission creation logic
86
+ using the helper methods from the SeedData classes
87
+
88
+ ### 3. Register in DI
89
+
90
+ Find and update `Infrastructure/DependencyInjection.cs`:
91
+
92
+ ```
93
+ Glob: **/Infrastructure/DependencyInjection.cs
94
+ ```
95
+
96
+ Add the `IClientSeedDataProvider` registration.
97
+
98
+ ### 4. Verify
99
+
100
+ Before proceeding to step-04, verify:
101
+ - [ ] ApplicationRolesSeedData.cs created (once per application)
102
+ - [ ] Provider generated with 4 methods (SeedNavigationAsync, SeedRolesAsync, SeedPermissionsAsync, SeedRolePermissionsAsync)
103
+ - [ ] Execution order: Navigation → Roles → Permissions → RolePermissions
104
+ - [ ] Registered in DI (`services.AddScoped<IClientSeedDataProvider, ...>()`)
105
+ - [ ] Consumes SeedData classes from steps 01-03 + ApplicationRolesSeedData
106
+ - [ ] Idempotent (check existence before insert)
107
+ - [ ] Uses factory methods (no `new Entity()`)
108
+
109
+ ---
110
+
111
+ ## SUCCESS METRICS
112
+
113
+ - ApplicationRolesSeedData.cs created (application-level)
114
+ - Provider class generated with all 4 seed methods (Navigation, Roles, Permissions, RolePermissions)
115
+ - Correct execution order enforced
116
+ - DI registration added
117
+ - SeedData classes from steps 01-03 + ApplicationRolesSeedData properly consumed
118
+ - All methods are idempotent
119
+ - Factory methods used throughout
120
+ - Proceeded to step-04-backend.md
121
+
122
+ ## FAILURE MODES
123
+
124
+ - SeedData files not found from previous steps (return to step-01)
125
+ - DependencyInjection.cs not found (ask user for DI registration location)
126
+ - Missing IClientSeedDataProvider interface (verify SmartStack.Application reference)
127
+
128
+ ---
129
+
130
+ ## NEXT STEP
131
+
132
+ After generating the provider and registering it in DI,
133
+ proceed to `./step-04-backend.md`