@atlashub/smartstack-cli 4.32.0 → 4.33.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 (38) hide show
  1. package/.documentation/index.html +2 -2
  2. package/.documentation/init.html +358 -174
  3. package/dist/mcp-entry.mjs +271 -44
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/mcp-scaffolding/controller.cs.hbs +54 -128
  7. package/templates/project/README.md +19 -0
  8. package/templates/skills/apex/SKILL.md +16 -10
  9. package/templates/skills/apex/_shared.md +1 -1
  10. package/templates/skills/apex/references/checks/architecture-checks.sh +154 -0
  11. package/templates/skills/apex/references/checks/backend-checks.sh +194 -0
  12. package/templates/skills/apex/references/checks/frontend-checks.sh +448 -0
  13. package/templates/skills/apex/references/checks/infrastructure-checks.sh +255 -0
  14. package/templates/skills/apex/references/checks/security-checks.sh +153 -0
  15. package/templates/skills/apex/references/checks/seed-checks.sh +536 -0
  16. package/templates/skills/apex/references/frontend-route-wiring-app-tsx.md +49 -192
  17. package/templates/skills/apex/references/post-checks.md +124 -2156
  18. package/templates/skills/apex/references/smartstack-api.md +160 -957
  19. package/templates/skills/apex/references/smartstack-frontend.md +134 -1022
  20. package/templates/skills/apex/references/smartstack-layers.md +12 -6
  21. package/templates/skills/apex/steps/step-00-init.md +81 -238
  22. package/templates/skills/apex/steps/step-03-execute.md +25 -752
  23. package/templates/skills/apex/steps/step-03a-layer0-domain.md +118 -0
  24. package/templates/skills/apex/steps/step-03b-layer1-seed.md +91 -0
  25. package/templates/skills/apex/steps/step-03c-layer2-backend.md +240 -0
  26. package/templates/skills/apex/steps/step-03d-layer3-frontend.md +300 -0
  27. package/templates/skills/apex/steps/step-03e-layer4-devdata.md +44 -0
  28. package/templates/skills/apex/steps/step-04-examine.md +70 -150
  29. package/templates/skills/application/references/frontend-i18n-and-output.md +2 -2
  30. package/templates/skills/application/references/frontend-route-naming.md +5 -1
  31. package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +49 -198
  32. package/templates/skills/application/references/frontend-verification.md +11 -11
  33. package/templates/skills/application/steps/step-05-frontend.md +26 -15
  34. package/templates/skills/application/templates-frontend.md +4 -0
  35. package/templates/skills/cli-app-sync/SKILL.md +2 -2
  36. package/templates/skills/cli-app-sync/references/comparison-map.md +1 -1
  37. package/templates/skills/controller/references/controller-code-templates.md +70 -67
  38. package/templates/skills/controller/references/mcp-scaffold-workflow.md +5 -1
@@ -6,124 +6,127 @@
6
6
 
7
7
  ## Controller Template
8
8
 
9
- **Target path:** `src/SmartStack.Api/Controllers/{ApplicationPascal}/{entity}Controller.cs`
9
+ **Target path:** `src/SmartStack.Api/Controllers/{ApplicationPascal}/{ModulePascal}/{entity}Controller.cs`
10
10
 
11
11
  > Application mapping: `administration` → `Administration`, `support` → `Support`, `myspace` → `MySpace`
12
+ > Deep hierarchy: navRoute segments map to folder levels.
12
13
 
13
14
  ```csharp
15
+ using MediatR;
14
16
  using Microsoft.AspNetCore.Mvc;
15
- using Microsoft.AspNetCore.Http;
17
+ using SmartStack.Api.Authorization;
18
+ using SmartStack.Api.Routing;
16
19
  using SmartStack.Application.Common.Authorization;
17
- using SmartStack.Application.Common.Interfaces;
18
- using SmartStack.Domain.Entities;
19
20
 
20
21
  namespace SmartStack.Api.Controllers.{area};
21
22
 
22
23
  [ApiController]
23
- [Route("api/{area_lowercase}/[controller]")]
24
- [Authorize]
25
- public class {module}Controller : ControllerBase
24
+ [NavRoute("{app}.{module}")]
25
+ [Microsoft.AspNetCore.Authorization.Authorize]
26
+ [Produces("application/json")]
27
+ [Tags("{namePlural}")]
28
+ public class {entity}Controller : ControllerBase
26
29
  {
27
- private readonly IApplicationDbContext _context;
28
- private readonly ICurrentUserService _currentUser;
29
- private readonly ILogger<{module}Controller> _logger;
30
-
31
- public {module}Controller(
32
- IApplicationDbContext context,
33
- ICurrentUserService currentUser,
34
- ILogger<{module}Controller> logger)
35
- {
36
- _context = context;
37
- _currentUser = currentUser;
38
- _logger = logger;
39
- }
30
+ private readonly ISender _mediator;
31
+
32
+ public {entity}Controller(ISender mediator) => _mediator = mediator;
40
33
 
41
34
  // Endpoints generated based on plan...
42
35
  }
43
36
  ```
44
37
 
38
+ **Key conventions:**
39
+ - `ISender _mediator` (MediatR) — NOT `IApplicationDbContext` or `I{Name}Service`
40
+ - `[Microsoft.AspNetCore.Authorization.Authorize]` — fully qualified
41
+ - `[NavRoute]` is the ONLY route attribute — do NOT combine with `[Route("api/...")]`
42
+ - `[Tags]` and `[Produces("application/json")]` always present
43
+ - `[RequirePermission]` on every endpoint — `[Authorize]` alone has no RBAC
44
+
45
45
  ---
46
46
 
47
47
  ## GET Endpoint Example
48
48
 
49
49
  ```csharp
50
50
  [HttpGet]
51
- [RequirePermission(Permissions.{module}.View)]
52
- [ProducesResponseType(typeof(PaginatedResult<{entity}ResponseDto>), StatusCodes.Status200OK)]
51
+ [RequirePermission(Permissions.{Module}.{Resource}.View)]
52
+ [ProducesResponseType(typeof(List<{entity}ListDto>), StatusCodes.Status200OK)]
53
53
  [ProducesResponseType(StatusCodes.Status401Unauthorized)]
54
54
  [ProducesResponseType(StatusCodes.Status403Forbidden)]
55
- public async Task<IActionResult> GetAll(
56
- [FromQuery] int page = 1,
57
- [FromQuery] int pageSize = 20,
58
- CancellationToken ct = default)
55
+ public async Task<ActionResult<List<{entity}ListDto>>> GetAll(CancellationToken ct)
59
56
  {
60
- var query = _context.{module}
61
- .AsNoTracking()
62
- .OrderByDescending(x => x.CreatedAt);
63
-
64
- var total = await query.CountAsync(ct);
65
- var items = await query
66
- .Skip((page - 1) * pageSize)
67
- .Take(pageSize)
68
- .Select(x => new {entity}ResponseDto(x))
69
- .ToListAsync(ct);
70
-
71
- return Ok(new PaginatedResult<{entity}ResponseDto>(items, total, page, pageSize));
57
+ var result = await _mediator.Send(new Get{entityPlural}Query(), ct);
58
+ return Ok(result);
72
59
  }
73
60
  ```
74
61
 
75
62
  **Endpoint attributes to include:**
76
63
  1. `[HttpGet]`, `[HttpPost]`, etc.
77
- 2. `[RequirePermission(Permissions.{module}.View)]`
78
- 3. `[ProducesResponseType(typeof(...), StatusCodes.Status200OK)]`
64
+ 2. `[RequirePermission(Permissions.{Module}.{Resource}.View)]` — permission constants
65
+ 3. `[ProducesResponseType(typeof(...), StatusCodes.Status200OK)]` — StatusCodes constants
79
66
  4. `[ProducesResponseType(StatusCodes.Status401Unauthorized)]`
80
67
  5. `[ProducesResponseType(StatusCodes.Status403Forbidden)]`
81
68
 
82
69
  ---
83
70
 
71
+ ## Return Types by Endpoint
72
+
73
+ | Endpoint | Return Type | Notes |
74
+ |----------|-------------|-------|
75
+ | GetAll | `Task<ActionResult<List<{entity}ListDto>>>` | List DTO for summary |
76
+ | GetById | `Task<ActionResult<{entity}DetailDto>>` | Detail DTO with full data |
77
+ | Create | `Task<ActionResult<{entity}DetailDto>>` | Returns 201 with CreatedAtAction |
78
+ | Update | `Task<ActionResult<{entity}DetailDto>>` | Check `result.IsNotFound` |
79
+ | Delete | `Task<IActionResult>` | Returns 204 NoContent or 404 |
80
+
81
+ ---
82
+
84
83
  ## DTO Templates
85
84
 
86
85
  **Target paths:**
87
86
  ```
88
- src/SmartStack.Application/DTOs/{module}/{entity}CreateDto.cs
89
- src/SmartStack.Application/DTOs/{module}/{entity}UpdateDto.cs
90
- src/SmartStack.Application/DTOs/{module}/{entity}ResponseDto.cs
87
+ src/SmartStack.Application/{Application}/{Module}/DTOs/{entity}ListDto.cs
88
+ src/SmartStack.Application/{Application}/{Module}/DTOs/{entity}DetailDto.cs
89
+ src/SmartStack.Application/{Application}/{Module}/DTOs/Create{entity}Request.cs
90
+ src/SmartStack.Application/{Application}/{Module}/DTOs/Update{entity}Request.cs
91
91
  ```
92
92
 
93
- **CreateDto:**
94
- ```csharp
95
- public record {entity}CreateDto(
96
- string Name,
97
- // ... required properties
98
- );
99
- ```
93
+ > DTOs are in `Application/{Domain}/.../DTOs/` — NOT in `Application/DTOs/{module}/`.
100
94
 
101
- **UpdateDto:**
95
+ **ListDto (for GetAll):**
102
96
  ```csharp
103
- public record {entity}UpdateDto(
104
- string? Name,
105
- // ... optional properties
97
+ public record {entity}ListDto(
98
+ Guid Id,
99
+ string Name,
100
+ // ... summary properties
101
+ DateTime CreatedAt
106
102
  );
107
103
  ```
108
104
 
109
- **ResponseDto:**
105
+ **DetailDto (for GetById, Create, Update):**
110
106
  ```csharp
111
- public record {entity}ResponseDto(
107
+ public record {entity}DetailDto(
112
108
  Guid Id,
113
109
  string Name,
114
- // ... all public properties
110
+ // ... all properties
115
111
  DateTime CreatedAt,
116
112
  DateTime? UpdatedAt
117
- )
118
- {
119
- public {entity}ResponseDto({entity} entity) : this(
120
- entity.Id,
121
- entity.Name,
122
- // ... mapping
123
- entity.CreatedAt,
124
- entity.UpdatedAt
125
- ) { }
126
- }
113
+ );
114
+ ```
115
+
116
+ **CreateRequest:**
117
+ ```csharp
118
+ public record Create{entity}Request(
119
+ string Name
120
+ // ... required properties
121
+ );
122
+ ```
123
+
124
+ **UpdateRequest:**
125
+ ```csharp
126
+ public record Update{entity}Request(
127
+ string? Name
128
+ // ... optional properties
129
+ );
127
130
  ```
128
131
 
129
132
  ---
@@ -68,12 +68,16 @@ const controllerCall = await mcp__smartstack__scaffold_extension({
68
68
  options: {
69
69
  navRoute: "{permission_path}", // MANDATORY for NavRoute attribute
70
70
  navRouteSuffix: null, // Optional: e.g., "details" → [NavRoute("path", Suffix = "details")]
71
+ customSegment: null, // Optional: e.g., "user/dashboard" → [NavRoute("path", CustomSegment = "user/dashboard")]
71
72
  dryRun: false
72
73
  }
73
74
  });
74
75
 
75
76
  // Expected output:
76
- // Api/Controllers/{area}/{entityName}Controller.cs with [NavRoute] attribute
77
+ // Api/Controllers/{Application}/{Module}/{entityName}Controller.cs with [NavRoute] attribute
78
+ // Uses MediatR (ISender _mediator), [Microsoft.AspNetCore.Authorization.Authorize] (fully qualified),
79
+ // [Tags], [Produces("application/json")], [RequirePermission] with Permissions constants,
80
+ // [ProducesResponseType] with StatusCodes.* constants including 401/403
77
81
  ```
78
82
 
79
83
  **From response, extract:**