@atlashub/smartstack-cli 4.32.0 → 4.34.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.
- package/.documentation/index.html +2 -2
- package/.documentation/init.html +358 -174
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-entry.mjs +271 -44
- package/dist/mcp-entry.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/mcp-scaffolding/controller.cs.hbs +54 -128
- package/templates/project/README.md +19 -0
- package/templates/project/claude-md/api.CLAUDE.md.template +315 -0
- package/templates/project/claude-md/application.CLAUDE.md.template +181 -0
- package/templates/project/claude-md/domain.CLAUDE.md.template +125 -0
- package/templates/project/claude-md/infrastructure.CLAUDE.md.template +168 -0
- package/templates/project/claude-md/root.CLAUDE.md.template +339 -0
- package/templates/project/claude-md/web.CLAUDE.md.template +339 -0
- package/templates/skills/apex/SKILL.md +16 -10
- package/templates/skills/apex/_shared.md +1 -1
- package/templates/skills/apex/references/checks/architecture-checks.sh +154 -0
- package/templates/skills/apex/references/checks/backend-checks.sh +194 -0
- package/templates/skills/apex/references/checks/frontend-checks.sh +448 -0
- package/templates/skills/apex/references/checks/infrastructure-checks.sh +255 -0
- package/templates/skills/apex/references/checks/security-checks.sh +153 -0
- package/templates/skills/apex/references/checks/seed-checks.sh +536 -0
- package/templates/skills/apex/references/frontend-route-wiring-app-tsx.md +49 -192
- package/templates/skills/apex/references/post-checks.md +124 -2156
- package/templates/skills/apex/references/smartstack-api.md +160 -957
- package/templates/skills/apex/references/smartstack-frontend.md +134 -1022
- package/templates/skills/apex/references/smartstack-layers.md +12 -6
- package/templates/skills/apex/steps/step-00-init.md +81 -238
- package/templates/skills/apex/steps/step-03-execute.md +25 -752
- package/templates/skills/apex/steps/step-03a-layer0-domain.md +118 -0
- package/templates/skills/apex/steps/step-03b-layer1-seed.md +91 -0
- package/templates/skills/apex/steps/step-03c-layer2-backend.md +240 -0
- package/templates/skills/apex/steps/step-03d-layer3-frontend.md +300 -0
- package/templates/skills/apex/steps/step-03e-layer4-devdata.md +44 -0
- package/templates/skills/apex/steps/step-04-examine.md +70 -150
- package/templates/skills/application/references/frontend-i18n-and-output.md +2 -2
- package/templates/skills/application/references/frontend-route-naming.md +5 -1
- package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +49 -198
- package/templates/skills/application/references/frontend-verification.md +11 -11
- package/templates/skills/application/steps/step-05-frontend.md +26 -15
- package/templates/skills/application/templates-frontend.md +4 -0
- package/templates/skills/cli-app-sync/SKILL.md +2 -2
- package/templates/skills/cli-app-sync/references/comparison-map.md +1 -1
- package/templates/skills/controller/references/controller-code-templates.md +70 -67
- 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
|
|
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
|
-
[
|
|
24
|
-
[Authorize]
|
|
25
|
-
|
|
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
|
|
28
|
-
|
|
29
|
-
|
|
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.{
|
|
52
|
-
[ProducesResponseType(typeof(
|
|
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<
|
|
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
|
|
61
|
-
|
|
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.{
|
|
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/
|
|
89
|
-
src/SmartStack.Application/
|
|
90
|
-
src/SmartStack.Application/
|
|
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
|
-
|
|
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
|
-
**
|
|
95
|
+
**ListDto (for GetAll):**
|
|
102
96
|
```csharp
|
|
103
|
-
public record {entity}
|
|
104
|
-
|
|
105
|
-
|
|
97
|
+
public record {entity}ListDto(
|
|
98
|
+
Guid Id,
|
|
99
|
+
string Name,
|
|
100
|
+
// ... summary properties
|
|
101
|
+
DateTime CreatedAt
|
|
106
102
|
);
|
|
107
103
|
```
|
|
108
104
|
|
|
109
|
-
**
|
|
105
|
+
**DetailDto (for GetById, Create, Update):**
|
|
110
106
|
```csharp
|
|
111
|
-
public record {entity}
|
|
107
|
+
public record {entity}DetailDto(
|
|
112
108
|
Guid Id,
|
|
113
109
|
string Name,
|
|
114
|
-
// ... all
|
|
110
|
+
// ... all properties
|
|
115
111
|
DateTime CreatedAt,
|
|
116
112
|
DateTime? UpdatedAt
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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/{
|
|
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:**
|