@polymorphism-tech/morph-spec 7.0.0 → 7.1.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/README.md +367 -367
- package/framework/agents.json +132 -127
- package/framework/rubrics/backend.json +41 -36
- package/framework/rules/ai-agents-standards.md +45 -15
- package/framework/rules/neon-standards.md +25 -26
- package/framework/standards/STANDARDS.json +1729 -1133
- package/framework/standards/ai-agents/agent-session.md +160 -0
- package/framework/standards/ai-agents/batching.md +193 -0
- package/framework/standards/ai-agents/context-providers.md +188 -0
- package/framework/standards/ai-agents/mcp-server.md +250 -0
- package/framework/standards/ai-agents/mcp-tools.md +197 -0
- package/framework/standards/ai-agents/middleware-patterns.md +207 -0
- package/framework/standards/ai-agents/modalities-image-gen.md +173 -0
- package/framework/standards/ai-agents/modalities-speech-to-text.md +171 -0
- package/framework/standards/ai-agents/modalities-text-to-speech.md +181 -0
- package/framework/standards/ai-agents/modalities-vision.md +201 -0
- package/framework/standards/ai-agents/multi-agent-patterns.md +155 -0
- package/framework/standards/ai-agents/production.md +114 -258
- package/framework/standards/ai-agents/prompts-in-db.md +214 -0
- package/framework/standards/ai-agents/providers/model-registry.md +158 -0
- package/framework/standards/ai-agents/rag-custom-pgvector.md +243 -0
- package/framework/standards/ai-agents/service-tier-flex.md +135 -0
- package/framework/standards/ai-agents/setup.md +142 -316
- package/framework/standards/ai-agents/structured-output.md +249 -0
- package/framework/standards/ai-agents/sweet-spot.md +109 -0
- package/framework/standards/ai-agents/workflows.md +114 -284
- package/framework/standards/architecture/vertical-slice/vertical-slice.md +433 -429
- package/framework/standards/backend/api/validation.md +92 -88
- package/framework/standards/backend/database/postgresql/database.md +336 -332
- package/framework/standards/backend/database/vector-search-rag.md +599 -541
- package/framework/standards/backend/dotnet/fluent-validation-vsa.md +4 -0
- package/framework/standards/backend/dotnet/result-pattern.md +4 -0
- package/framework/standards/backend/dotnet/scalar-ui.md +176 -172
- package/framework/standards/backend/dotnet/scrutor.md +4 -0
- package/framework/standards/backend/dotnet/vsa-handler-patterns.md +278 -274
- package/framework/standards/backend/integrations/asaas/asaas-api.md +260 -216
- package/framework/standards/backend/integrations/hangfire/hangfire-jobs.md +354 -350
- package/framework/standards/backend/integrations/neon-auth/neon-auth.md +30 -19
- package/framework/standards/backend/integrations/resend/resend-email.md +400 -385
- package/framework/standards/data/nosql/cache/redis.md +106 -97
- package/framework/standards/data/nosql/cosmos-db.md +127 -118
- package/framework/standards/data/vector-search/rag-chunking.md +113 -104
- package/framework/standards/frontend/design-system/ai-image-generation.md +4 -0
- package/framework/standards/frontend/design-system/animations.md +164 -160
- package/framework/standards/frontend/design-system/naming.md +68 -64
- package/framework/standards/frontend/gsap/gsap-core.md +14 -8
- package/framework/standards/frontend/gsap/gsap-plugins.md +26 -21
- package/framework/standards/frontend/gsap/gsap-scrolltrigger.md +9 -7
- package/framework/standards/frontend/nextjs/app-router.md +127 -123
- package/framework/standards/frontend/nextjs/components.md +136 -132
- package/framework/standards/frontend/nextjs/data-fetching.md +130 -126
- package/framework/standards/frontend/nextjs/forms.md +134 -128
- package/framework/standards/frontend/nextjs/motion-patterns.md +328 -322
- package/framework/standards/frontend/nextjs/naming-conventions.md +71 -67
- package/framework/standards/frontend/nextjs/nextjs-patterns.md +229 -225
- package/framework/standards/frontend/nextjs/project-structure.md +106 -102
- package/framework/standards/frontend/nextjs/state-management.md +76 -72
- package/framework/standards/frontend/nextjs/testing.md +115 -111
- package/framework/standards/infrastructure/docker/easypanel-deploy.md +196 -192
- package/framework/standards/infrastructure/neon/neon-pgrag.md +6 -2
- package/framework/standards/infrastructure/neon/neon-pgvector.md +4 -0
- package/framework/standards/infrastructure/neon/neon-setup.md +5 -1
- package/framework/standards/integration/mcp/mcp-tools.md +471 -462
- package/framework/templates/REGISTRY.json +1745 -1239
- package/framework/templates/code/dotnet/ai-agents/AgentBootstrap.cs.template +39 -0
- package/framework/templates/code/dotnet/ai-agents/EmbeddingService.cs.template +68 -0
- package/framework/templates/code/dotnet/ai-agents/ModelRegistry.cs.template +117 -0
- package/framework/templates/code/dotnet/ai-agents/PromptRepository.cs.template +95 -0
- package/framework/templates/code/dotnet/ai-agents/ResilientToolMiddleware.cs.template +61 -0
- package/framework/templates/code/dotnet/ai-agents/VectorSearchTool.cs.template +107 -0
- package/framework/templates/code/dotnet/ai-agents/model-registry.json.template +58 -0
- package/framework/templates/code/sql/ai-agents/agent-prompts-migration.sql.template +58 -0
- package/framework/templates/code/sql/ai-agents/pgvector-embeddings-migration.sql.template +91 -0
- package/package.json +89 -83
- package/src/core/templates/template-registry.js +289 -256
- package/src/lib/generators/context-generator.js +516 -518
- package/src/lib/generators/scaffold-generator.js +23 -26
- package/framework/standards/infrastructure/neon/neon-semantic-kernel.md +0 -310
- package/framework/templates/integrations/semantic-kernel-neon.cs +0 -125
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
> **Keywords:** fluent-validation, validation, decorator, pipeline, vsa
|
|
6
6
|
> **Load When:** dotnet VSA projects
|
|
7
7
|
|
|
8
|
+
**Verified against:** .NET 10 + FluentValidation 11 (`AbstractValidator`/`RuleFor` API). Last-verified: 2026-05-20.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
8
12
|
## Overview
|
|
9
13
|
|
|
10
14
|
FluentValidation integrates into VSA via the decorator pattern. Validators are auto-discovered per assembly, and the `ValidationDecorator<TRequest, TResponse>` runs all matching validators before the handler executes. Failed validation short-circuits to `Result.Failure` without touching the handler.
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
> **Keywords:** result, error-handling, railway, match, monadic
|
|
6
6
|
> **Load When:** dotnet VSA projects
|
|
7
7
|
|
|
8
|
+
**Verified against:** .NET 10 (pure C# pattern — no external package). Last-verified: 2026-05-20.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
8
12
|
## Overview
|
|
9
13
|
|
|
10
14
|
The Result pattern replaces exceptions for expected failures. Every handler returns `Result` or `Result<T>`, and endpoints use `Match()` to map success/failure to HTTP responses. No try-catch in business logic.
|
|
@@ -1,172 +1,176 @@
|
|
|
1
|
-
# Scalar.AspNetCore — API Documentation UI
|
|
2
|
-
|
|
3
|
-
> **Scope:** dotnet-vsa
|
|
4
|
-
> **Layer:** 0 (always load)
|
|
5
|
-
> **Keywords:** scalar, openapi, swagger, api-docs, documentation
|
|
6
|
-
> **Load When:** dotnet VSA projects
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
app.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
|
67
|
-
|
|
68
|
-
| `ScalarTheme.
|
|
69
|
-
| `ScalarTheme.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
.
|
|
127
|
-
.Produces(StatusCodes.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
|
138
|
-
|
|
139
|
-
| `.
|
|
140
|
-
| `.
|
|
141
|
-
| `.
|
|
142
|
-
| `.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
|
166
|
-
|
|
167
|
-
|
|
|
168
|
-
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
1
|
+
# Scalar.AspNetCore — API Documentation UI
|
|
2
|
+
|
|
3
|
+
> **Scope:** dotnet-vsa
|
|
4
|
+
> **Layer:** 0 (always load)
|
|
5
|
+
> **Keywords:** scalar, openapi, swagger, api-docs, documentation
|
|
6
|
+
> **Load When:** dotnet VSA projects
|
|
7
|
+
|
|
8
|
+
**Verified against:** .NET 10 + Scalar.AspNetCore 2.x + Microsoft.AspNetCore.OpenApi 10. Last-verified: 2026-05-20.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
Scalar replaces Swagger UI as the API documentation frontend. It provides a modern UI with built-in request testing, client code generation, and dark themes. Works with ASP.NET Core's native OpenAPI support (`Microsoft.AspNetCore.OpenApi`).
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Package Setup
|
|
19
|
+
|
|
20
|
+
```xml
|
|
21
|
+
<!-- .csproj -->
|
|
22
|
+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
|
|
23
|
+
<PackageReference Include="Scalar.AspNetCore" Version="2.12.40" />
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
No Swashbuckle needed. ASP.NET Core 9+ has built-in OpenAPI document generation (`Microsoft.AspNetCore.OpenApi`); this project targets .NET 10.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Program.cs Configuration
|
|
31
|
+
|
|
32
|
+
```csharp
|
|
33
|
+
using Scalar.AspNetCore;
|
|
34
|
+
|
|
35
|
+
var builder = WebApplication.CreateBuilder(args);
|
|
36
|
+
|
|
37
|
+
// Enable OpenAPI document generation
|
|
38
|
+
builder.Services.AddOpenApi();
|
|
39
|
+
|
|
40
|
+
var app = builder.Build();
|
|
41
|
+
|
|
42
|
+
// Map the OpenAPI JSON endpoint (dev only)
|
|
43
|
+
if (app.Environment.IsDevelopment())
|
|
44
|
+
{
|
|
45
|
+
app.MapOpenApi();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Map Scalar UI at /scalar/v1
|
|
49
|
+
app.MapScalarApiReference(options =>
|
|
50
|
+
{
|
|
51
|
+
options.WithTheme(ScalarTheme.DeepSpace);
|
|
52
|
+
|
|
53
|
+
// Enable Developer Tools (request + client code panel)
|
|
54
|
+
options.WithDefaultHttpClient(
|
|
55
|
+
ScalarTarget.CSharp,
|
|
56
|
+
ScalarClient.HttpClient);
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Access URL:** `https://localhost:{port}/scalar/v1`
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Available Themes
|
|
65
|
+
|
|
66
|
+
| Theme | Description |
|
|
67
|
+
|-------|-------------|
|
|
68
|
+
| `ScalarTheme.Default` | Light theme |
|
|
69
|
+
| `ScalarTheme.DeepSpace` | Dark blue (recommended) |
|
|
70
|
+
| `ScalarTheme.Purple` | Purple accent |
|
|
71
|
+
| `ScalarTheme.Moon` | Dark grey |
|
|
72
|
+
| `ScalarTheme.Saturn` | Warm dark |
|
|
73
|
+
| `ScalarTheme.Mars` | Red accent |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## ApiTags Organization
|
|
78
|
+
|
|
79
|
+
Group endpoints by feature using a constants class and `.WithTags()`:
|
|
80
|
+
|
|
81
|
+
```csharp
|
|
82
|
+
// Constants/ApiTags.cs
|
|
83
|
+
public static class ApiTags
|
|
84
|
+
{
|
|
85
|
+
public const string Books = "books";
|
|
86
|
+
public const string Authors = "authors";
|
|
87
|
+
public const string Orders = "orders";
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Apply tags in endpoints:
|
|
92
|
+
|
|
93
|
+
```csharp
|
|
94
|
+
internal sealed class CreateBookEndpoint : IApiEndpoint
|
|
95
|
+
{
|
|
96
|
+
public void MapEndpoint(IEndpointRouteBuilder app)
|
|
97
|
+
{
|
|
98
|
+
app.MapPost("books", async (
|
|
99
|
+
IHandler<CreateBookRequest, Result<CreateBookResponse>> handler,
|
|
100
|
+
CreateBookRequest command,
|
|
101
|
+
CancellationToken cancellationToken) =>
|
|
102
|
+
{
|
|
103
|
+
var result = await handler.HandleAsync(command, cancellationToken);
|
|
104
|
+
return result.Match(
|
|
105
|
+
onSuccess: () => Results.Ok(result.Value),
|
|
106
|
+
onFailure: error => Results.BadRequest(error));
|
|
107
|
+
})
|
|
108
|
+
.WithTags(ApiTags.Books)
|
|
109
|
+
.Produces<CreateBookResponse>(StatusCodes.Status200OK)
|
|
110
|
+
.Produces(StatusCodes.Status400BadRequest);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Endpoint Metadata
|
|
118
|
+
|
|
119
|
+
Use `.Produces<T>()` to document response types for OpenAPI:
|
|
120
|
+
|
|
121
|
+
```csharp
|
|
122
|
+
app.MapGet("books/{id:guid}", async (...) => { ... })
|
|
123
|
+
.WithTags(ApiTags.Books)
|
|
124
|
+
.WithName("GetBookById")
|
|
125
|
+
.WithSummary("Get a book by its unique identifier")
|
|
126
|
+
.Produces<GetBookResponse>(StatusCodes.Status200OK)
|
|
127
|
+
.Produces(StatusCodes.Status404NotFound);
|
|
128
|
+
|
|
129
|
+
app.MapDelete("books/{id:guid}", async (...) => { ... })
|
|
130
|
+
.WithTags(ApiTags.Books)
|
|
131
|
+
.Produces(StatusCodes.Status204NoContent)
|
|
132
|
+
.Produces(StatusCodes.Status404NotFound);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Common Metadata Methods
|
|
136
|
+
|
|
137
|
+
| Method | Purpose |
|
|
138
|
+
|--------|---------|
|
|
139
|
+
| `.WithTags("tag")` | Group in Scalar sidebar |
|
|
140
|
+
| `.WithName("OperationId")` | Unique operation identifier |
|
|
141
|
+
| `.WithSummary("...")` | Short description in endpoint list |
|
|
142
|
+
| `.WithDescription("...")` | Long description in detail panel |
|
|
143
|
+
| `.Produces<T>(statusCode)` | Document success response type |
|
|
144
|
+
| `.Produces(statusCode)` | Document error response (no body) |
|
|
145
|
+
| `.ProducesProblem(statusCode)` | Document ProblemDetails response |
|
|
146
|
+
| `.RequireAuthorization()` | Marks as requiring auth in docs |
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Client Code Generation
|
|
151
|
+
|
|
152
|
+
Scalar auto-generates client code for API calls. The `WithDefaultHttpClient` option selects the default language:
|
|
153
|
+
|
|
154
|
+
| Target | Client | Description |
|
|
155
|
+
|--------|--------|-------------|
|
|
156
|
+
| `ScalarTarget.CSharp` | `ScalarClient.HttpClient` | .NET HttpClient |
|
|
157
|
+
| `ScalarTarget.JavaScript` | `ScalarClient.Fetch` | Browser fetch() |
|
|
158
|
+
| `ScalarTarget.Python` | `ScalarClient.Requests` | Python requests |
|
|
159
|
+
| `ScalarTarget.Shell` | `ScalarClient.Curl` | cURL command |
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Anti-Patterns
|
|
164
|
+
|
|
165
|
+
| Do NOT | Do Instead |
|
|
166
|
+
|--------|------------|
|
|
167
|
+
| Install Swashbuckle | Use `Microsoft.AspNetCore.OpenApi` + `Scalar.AspNetCore` |
|
|
168
|
+
| Expose OpenAPI in production | Guard with `IsDevelopment()` check |
|
|
169
|
+
| Skip `.WithTags()` on endpoints | Every endpoint needs a tag for organized docs |
|
|
170
|
+
| Skip `.Produces<T>()` | Always document response types for accurate API docs |
|
|
171
|
+
| Use magic strings for tags | Define tags in `Constants/ApiTags.cs` |
|
|
172
|
+
| Map Scalar before `MapOpenApi()` | `MapOpenApi()` first, then `MapScalarApiReference()` |
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
*MORPH-SPEC by Polymorphism Tech*
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
> **Keywords:** scrutor, di, decorators, auto-discovery, assembly-scanning
|
|
6
6
|
> **Load When:** dotnet VSA projects
|
|
7
7
|
|
|
8
|
+
**Verified against:** .NET 10 + Scrutor 7 (`Scan`/`Decorate` API). Last-verified: 2026-05-20.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
8
12
|
## Overview
|
|
9
13
|
|
|
10
14
|
Scrutor provides assembly-scanning and decoration extensions for `IServiceCollection`. In VSA, it replaces manual DI registration with convention-based auto-discovery for handlers, validators, and endpoints.
|