@atlashub/smartstack-cli 1.14.3 → 1.16.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.
@@ -0,0 +1,159 @@
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
+
36
+ ---
37
+
38
+ ## EXECUTION SEQUENCE
39
+
40
+ ### 1. Determine NavRoute
41
+
42
+ For permissions, the navRoute is the `{full_path}`:
43
+
44
+ ```
45
+ navRoute = "{full_path}"
46
+ Example: "erp.sales.products"
47
+ ```
48
+
49
+ ### 2. Call MCP generate_permissions
50
+
51
+ ```
52
+ Tool: mcp__smartstack__generate_permissions
53
+ Args:
54
+ navRoute: "{full_path}"
55
+ includeStandardActions: true
56
+ includeWildcard: true
57
+ ```
58
+
59
+ ### 3. Parse MCP Response
60
+
61
+ The tool returns:
62
+ - Permissions.cs nested class structure
63
+ - PermissionConfiguration.cs HasData() entries
64
+ - Deterministic GUIDs for each permission
65
+
66
+ ### 4. Present Permissions.cs Output
67
+
68
+ ```markdown
69
+ ## Permissions.cs Constants
70
+
71
+ Add to `Application/Common/Authorization/Permissions.cs`:
72
+
73
+ [Show Permissions.cs nested class from MCP response]
74
+
75
+ **Usage in Controller:**
76
+ ```csharp
77
+ [RequirePermission(Permissions.{Context}.{Application}.{Module}.Read)]
78
+ public async Task<ActionResult> GetAll() { ... }
79
+ ```
80
+ ```
81
+
82
+ ### 5. Present PermissionConfiguration.cs Output
83
+
84
+ ```markdown
85
+ ## PermissionConfiguration.cs HasData
86
+
87
+ Add to `Infrastructure/Persistence/Configurations/PermissionConfiguration.cs`:
88
+
89
+ [Show HasData entries from MCP response]
90
+ ```
91
+
92
+ ### 6. Store Permission GUIDs
93
+
94
+ Store the permission GUIDs for use in step-03-roles:
95
+
96
+ ```
97
+ {permission_guids} = {
98
+ wildcard: "guid-for-wildcard",
99
+ read: "guid-for-read",
100
+ create: "guid-for-create",
101
+ update: "guid-for-update",
102
+ delete: "guid-for-delete"
103
+ }
104
+ ```
105
+
106
+ ---
107
+
108
+ ## TWO-FILE REQUIREMENT
109
+
110
+ **CRITICAL:** SmartStack requires permissions in TWO files:
111
+
112
+ | File | Layer | Content |
113
+ |------|-------|---------|
114
+ | `Permissions.cs` | Application | Compile-time constants |
115
+ | `PermissionConfiguration.cs` | Infrastructure | EF Core HasData seeds |
116
+
117
+ Both MUST be kept in sync. Missing one = runtime 403 errors.
118
+
119
+ ---
120
+
121
+ ## MCP RESPONSE HANDLING
122
+
123
+ ### Success Case
124
+
125
+ If MCP returns successfully:
126
+ - Display Permissions.cs code
127
+ - Display PermissionConfiguration.cs HasData code
128
+ - Store `{permission_guids}` for next step
129
+ - Proceed to step-03-roles.md
130
+
131
+ ### Error Case
132
+
133
+ If MCP call fails:
134
+ - Display error message
135
+ - Suggest checking navRoute format
136
+ - Do NOT proceed automatically
137
+
138
+ ---
139
+
140
+ ## SUCCESS METRICS
141
+
142
+ - MCP generate_permissions called successfully
143
+ - Permissions.cs code displayed
144
+ - PermissionConfiguration.cs HasData displayed
145
+ - Deterministic GUIDs (not placeholders)
146
+ - Permission GUIDs stored for role assignment
147
+ - Proceeded to step-03-roles.md
148
+
149
+ ## FAILURE MODES
150
+
151
+ - MCP call failed (display error, stop)
152
+ - Invalid navRoute format (must be context.application.module)
153
+ - Missing navigation entity (return to step-01)
154
+
155
+ ---
156
+
157
+ ## NEXT STEP
158
+
159
+ After displaying permission code, proceed to `./step-03-roles.md`
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: step-03-roles
3
+ description: Generate role-permission mappings using MCP scaffold_role_permissions
4
+ prev_step: steps/step-02-permissions.md
5
+ next_step: steps/step-04-backend.md
6
+ ---
7
+
8
+ # Step 3: Role-Permission Mapping
9
+
10
+ ## MANDATORY EXECUTION RULES
11
+
12
+ - ALWAYS use MCP `scaffold_role_permissions` tool - NEVER use templates
13
+ - ALWAYS assign permissions to default roles
14
+ - NEVER leave permissions without role assignments
15
+ - YOU ARE AN ORCHESTRATOR calling MCP, not a generator
16
+
17
+ ## YOUR TASK
18
+
19
+ Call the SmartStack MCP `scaffold_role_permissions` tool to generate:
20
+ 1. RolePermissionConfiguration.cs HasData() entries
21
+ 2. Default role assignments (PlatformAdmin, TenantAdmin, StandardUser)
22
+
23
+ ---
24
+
25
+ ## AVAILABLE STATE
26
+
27
+ From previous steps:
28
+
29
+ | Variable | Description |
30
+ |----------|-------------|
31
+ | `{full_path}` | Complete navigation path (navRoute) |
32
+ | `{level}` | context, application, module, or section |
33
+ | `{permission_guids}` | GUIDs for generated permissions |
34
+
35
+ ---
36
+
37
+ ## EXECUTION SEQUENCE
38
+
39
+ ### 1. Determine Default Role Assignments
40
+
41
+ Based on navigation context, apply default role mappings:
42
+
43
+ | Context | PlatformAdmin | TenantAdmin | StandardUser |
44
+ |---------|---------------|-------------|--------------|
45
+ | `platform.*` | Full CRUD | Read only | None |
46
+ | `business.*` | Full CRUD | Full CRUD | Read only |
47
+ | `personal.*` | None | Full CRUD | Full CRUD |
48
+
49
+ ### 2. Call MCP scaffold_role_permissions
50
+
51
+ ```
52
+ Tool: mcp__smartstack__scaffold_role_permissions
53
+ Args:
54
+ navRoute: "{full_path}"
55
+ roles:
56
+ platformAdmin: ["read", "create", "update", "delete"] # Adjust based on context
57
+ tenantAdmin: ["read", "create", "update"] # Adjust based on context
58
+ standardUser: ["read"] # Adjust based on context
59
+ includeWildcard: true
60
+ ```
61
+
62
+ ### 3. Parse MCP Response
63
+
64
+ The tool returns:
65
+ - RolePermissionConfiguration.cs HasData() entries
66
+ - Permission ID variable references
67
+ - Role ID variable references
68
+
69
+ ### 4. Present Output to User
70
+
71
+ ```markdown
72
+ ## Role-Permission Mappings
73
+
74
+ ### Assigned Permissions
75
+
76
+ | Role | Permissions |
77
+ |------|-------------|
78
+ | SuperAdmin | `{full_path}.*` (via wildcard) |
79
+ | PlatformAdmin | `{full_path}.read`, `.create`, `.update`, `.delete` |
80
+ | TenantAdmin | `{full_path}.read`, `.create`, `.update` |
81
+ | StandardUser | `{full_path}.read` |
82
+
83
+ ### RolePermissionConfiguration.cs HasData
84
+
85
+ Add to `Infrastructure/Persistence/Configurations/RolePermissionConfiguration.cs`:
86
+
87
+ [Show HasData entries from MCP response]
88
+ ```
89
+
90
+ ### 5. Confirm with User (Optional)
91
+
92
+ If the default role assignments don't match the user's needs:
93
+
94
+ ```yaml
95
+ questions:
96
+ - header: "Role Access"
97
+ question: "Adjust role permissions for {full_path}?"
98
+ options:
99
+ - label: "Keep defaults (Recommended)"
100
+ description: "PlatformAdmin: CRUD, TenantAdmin: CRU, StandardUser: R"
101
+ - label: "All roles full access"
102
+ description: "All roles get full CRUD access"
103
+ - label: "Custom"
104
+ description: "I'll specify custom permissions"
105
+ multiSelect: false
106
+ ```
107
+
108
+ ---
109
+
110
+ ## DEFAULT ROLE GUIDS
111
+
112
+ SmartStack uses well-known GUIDs for default roles:
113
+
114
+ | Role | GUID |
115
+ |------|------|
116
+ | SuperAdmin | `11111111-1111-1111-1111-111111111111` |
117
+ | PlatformAdmin | `22222222-2222-2222-2222-222222222222` |
118
+ | TenantAdmin | `33333333-3333-3333-3333-333333333333` |
119
+ | StandardUser | `44444444-4444-4444-4444-444444444444` |
120
+
121
+ ---
122
+
123
+ ## MCP RESPONSE HANDLING
124
+
125
+ ### Success Case
126
+
127
+ If MCP returns successfully:
128
+ - Display RolePermission HasData code
129
+ - Show role-permission summary table
130
+ - Proceed to step-04-backend.md
131
+
132
+ ### Error Case
133
+
134
+ If MCP call fails:
135
+ - Display error message
136
+ - Suggest checking permission GUIDs
137
+ - Provide manual template as fallback
138
+
139
+ ---
140
+
141
+ ## SUCCESS METRICS
142
+
143
+ - MCP scaffold_role_permissions called successfully
144
+ - Role-permission mappings displayed
145
+ - All default roles have appropriate access
146
+ - Proceeded to step-04-backend.md
147
+
148
+ ## FAILURE MODES
149
+
150
+ - MCP call failed (display error, suggest fallback)
151
+ - Permission GUIDs not available (return to step-02)
152
+ - Invalid navRoute (return to step-00)
153
+
154
+ ---
155
+
156
+ ## NEXT STEP
157
+
158
+ After displaying role-permission mappings, proceed to `./step-04-backend.md`
@@ -0,0 +1,202 @@
1
+ ---
2
+ name: step-04-backend
3
+ description: Generate backend code using MCP scaffold_extension
4
+ prev_step: steps/step-03-roles.md
5
+ next_step: steps/step-05-frontend.md
6
+ ---
7
+
8
+ # Step 4: Backend Generation
9
+
10
+ ## MANDATORY EXECUTION RULES
11
+
12
+ - ALWAYS use MCP `scaffold_extension` tool - NEVER use templates
13
+ - ALWAYS generate Entity + Service + Controller as a unit
14
+ - NEVER skip controller generation - API is required
15
+ - YOU ARE AN ORCHESTRATOR calling MCP, not a generator
16
+
17
+ ## YOUR TASK
18
+
19
+ Call the SmartStack MCP `scaffold_extension` tool with type "feature" to generate:
20
+ 1. Domain Entity with EF Configuration
21
+ 2. Application Service (Interface + Implementation)
22
+ 3. API Controller with NavRoute attribute
23
+ 4. DTOs (Response, Create, Update)
24
+
25
+ ---
26
+
27
+ ## AVAILABLE STATE
28
+
29
+ From previous steps:
30
+
31
+ | Variable | Description |
32
+ |----------|-------------|
33
+ | `{level}` | context, application, module, or section |
34
+ | `{code}` | kebab-case identifier |
35
+ | `{full_path}` | Complete navigation path (navRoute) |
36
+ | `{labels}` | Object with fr, en, it, de |
37
+
38
+ ---
39
+
40
+ ## EXECUTION SEQUENCE
41
+
42
+ ### 1. Derive Entity Name
43
+
44
+ Convert `{code}` to PascalCase for entity name:
45
+
46
+ ```
47
+ code: "products" → entityName: "Product"
48
+ code: "order-items" → entityName: "OrderItem"
49
+ code: "user-profiles" → entityName: "UserProfile"
50
+ ```
51
+
52
+ ### 2. Determine Table Prefix
53
+
54
+ Based on navigation context:
55
+
56
+ | Context | Prefix |
57
+ |---------|--------|
58
+ | platform.administration | `auth_` or `cfg_` |
59
+ | platform.support | `support_` |
60
+ | business.* | `ref_` or domain-specific |
61
+ | personal.* | `usr_` |
62
+
63
+ ### 3. Call MCP scaffold_extension
64
+
65
+ ```
66
+ Tool: mcp__smartstack__scaffold_extension
67
+ Args:
68
+ type: "feature"
69
+ name: "{entityName}" # PascalCase
70
+ options:
71
+ navRoute: "{full_path}"
72
+ tablePrefix: "{prefix}"
73
+ schema: "core"
74
+ withDtos: true
75
+ withValidation: true
76
+ withRepository: false # Use service pattern
77
+ skipComponent: true # Frontend in next step
78
+ dryRun: false
79
+ ```
80
+
81
+ ### 4. Parse MCP Response
82
+
83
+ The tool generates:
84
+ - `Domain/{EntityName}.cs` - Entity with BaseEntity
85
+ - `Infrastructure/Persistence/Configurations/{EntityName}Configuration.cs` - EF Config
86
+ - `Application/Services/I{EntityName}Service.cs` - Interface
87
+ - `Application/Services/{EntityName}Service.cs` - Implementation
88
+ - `Api/Controllers/{EntityName}Controller.cs` - REST Controller
89
+ - `Application/DTOs/{EntityName}Dto.cs` - Response DTO
90
+ - `Application/DTOs/Create{EntityName}Dto.cs` - Create request
91
+ - `Application/DTOs/Update{EntityName}Dto.cs` - Update request
92
+
93
+ ### 5. Present Output to User
94
+
95
+ ```markdown
96
+ ## Backend Code Generated
97
+
98
+ ### Domain Layer
99
+ - `Domain/{EntityName}.cs`
100
+
101
+ ### Infrastructure Layer
102
+ - `Persistence/Configurations/{EntityName}Configuration.cs`
103
+
104
+ ### Application Layer
105
+ - `Services/I{EntityName}Service.cs`
106
+ - `Services/{EntityName}Service.cs`
107
+ - `DTOs/{EntityName}Dto.cs`
108
+ - `DTOs/Create{EntityName}Dto.cs`
109
+ - `DTOs/Update{EntityName}Dto.cs`
110
+
111
+ ### API Layer
112
+ - `Controllers/{EntityName}Controller.cs`
113
+ - NavRoute: `{full_path}`
114
+ - Endpoints:
115
+ - GET /api/{code} - List all
116
+ - GET /api/{code}/{id} - Get by ID
117
+ - POST /api/{code} - Create
118
+ - PUT /api/{code}/{id} - Update
119
+ - DELETE /api/{code}/{id} - Delete
120
+
121
+ ### Next Steps
122
+ 1. Add DbSet to ICoreDbContext: `public DbSet<{EntityName}> {EntityName}s => Set<{EntityName}>();`
123
+ 2. Register service in DI: `services.AddScoped<I{EntityName}Service, {EntityName}Service>();`
124
+ 3. Run: `dotnet ef migrations add core_vX.X.X_XXX_Add{EntityName}`
125
+ ```
126
+
127
+ ### 6. Store Entity Info
128
+
129
+ Store entity information for frontend generation:
130
+
131
+ ```
132
+ {entity_name} = "{EntityName}"
133
+ {entity_code} = "{code}"
134
+ {api_route} = "/api/{code}"
135
+ ```
136
+
137
+ ---
138
+
139
+ ## CONTROLLER NAVROUTE
140
+
141
+ The generated controller uses NavRoute attribute:
142
+
143
+ ```csharp
144
+ [NavRoute("{full_path}")]
145
+ [ApiController]
146
+ [Authorize]
147
+ public class {EntityName}Controller : ControllerBase
148
+ {
149
+ [HttpGet]
150
+ [RequirePermission(Permissions.{Context}.{Application}.{Module}.Read)]
151
+ public async Task<ActionResult<IEnumerable<{EntityName}Dto>>> GetAll() { ... }
152
+
153
+ // ... other CRUD methods
154
+ }
155
+ ```
156
+
157
+ This ensures:
158
+ - API route is derived from navigation path
159
+ - Permissions use the constants from Permissions.cs
160
+ - Frontend can discover API path from NavRoute registry
161
+
162
+ ---
163
+
164
+ ## MCP RESPONSE HANDLING
165
+
166
+ ### Success Case
167
+
168
+ If MCP returns successfully:
169
+ - Display all generated files
170
+ - Show DbSet and DI registration instructions
171
+ - Store entity info for frontend
172
+ - Proceed to step-05-frontend.md
173
+
174
+ ### Error Case
175
+
176
+ If MCP call fails:
177
+ - Display error message
178
+ - Suggest checking entity name format
179
+ - Do NOT proceed automatically
180
+
181
+ ---
182
+
183
+ ## SUCCESS METRICS
184
+
185
+ - MCP scaffold_extension called successfully
186
+ - Entity, Service, Controller generated
187
+ - DTOs generated
188
+ - NavRoute attribute included
189
+ - Entity info stored for frontend
190
+ - Proceeded to step-05-frontend.md
191
+
192
+ ## FAILURE MODES
193
+
194
+ - MCP call failed (display error, stop)
195
+ - Invalid entity name (must be PascalCase)
196
+ - Invalid navRoute format
197
+
198
+ ---
199
+
200
+ ## NEXT STEP
201
+
202
+ After displaying backend code, proceed to `./step-05-frontend.md`