@polymorphism-tech/morph-spec 11.1.1 → 11.3.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 +3 -2
- package/bin/morph-spec.js +13 -23
- package/docs/CHEATSHEET.md +3 -3
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +3 -1
- package/framework/MORPH.md +8 -3
- package/framework/agents.json +4 -4
- package/framework/docs/CLI.md +28 -18
- package/framework/evals/review-checklist.md +35 -18
- package/framework/hooks/README.md +18 -11
- package/framework/hooks/claude-code/core/README.md +2 -2
- package/framework/hooks/claude-code/core/chain.js +9 -25
- package/framework/hooks/claude-code/core/comment-guard.js +3 -9
- package/framework/hooks/claude-code/core/conventional-commit.js +3 -3
- package/framework/hooks/claude-code/core/graph-refresh-kick.js +6 -6
- package/framework/hooks/claude-code/core/masked-exit.js +4 -3
- package/framework/hooks/claude-code/core/pre-bash-denylist.js +2 -2
- package/framework/hooks/claude-code/core/protect-spec-files.js +2 -4
- package/framework/hooks/claude-code/core/stack-changed.js +5 -4
- package/framework/hooks/claude-code/core/validate-completion.js +15 -12
- package/framework/hooks/shared/contract.js +22 -1
- package/framework/hooks/shared/git-paths.js +6 -0
- package/framework/hooks/shared/graph-freshness.js +3 -3
- package/framework/hooks/shared/graph-refresh.js +5 -10
- package/framework/hooks/shared/hook-response.js +1 -18
- package/framework/hooks/shared/payload-utils.js +12 -1
- package/framework/hooks/shared/phase-utils.js +4 -52
- package/framework/hooks/shared/report-progress.js +1 -1
- package/framework/mcp/registry.json +16 -32
- package/framework/rules/ai-agents-standards.md +9 -1
- package/framework/rules/dotnet-templates.md +32 -33
- package/framework/rules/gsap-standards.md +8 -0
- package/framework/rules/infrastructure-standards.md +9 -9
- package/framework/rules/mcp-standards.md +10 -0
- package/framework/rules/neon-standards.md +4 -4
- package/framework/rules/nextjs-templates.md +10 -11
- package/framework/rules/ui-design.md +2 -2
- package/framework/schemas/config.schema.json +11 -0
- package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
- package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
- package/framework/skills/core/morph-apply/SKILL.md +6 -4
- package/framework/skills/core/morph-plan/SKILL.md +1 -1
- package/framework/skills/core/morph-uiux/SKILL.md +5 -5
- package/framework/standards/STANDARDS.json +8 -4
- package/framework/standards/STANDARDS.meta.json +1 -1
- package/framework/standards/ai-agents/agent-archetypes.md +1 -1
- package/framework/standards/ai-agents/middleware-patterns.md +0 -2
- package/framework/standards/ai-agents/prompt-sources.md +2 -2
- package/framework/standards/ai-agents/providers/model-registry.md +9 -12
- package/framework/standards/ai-agents/rag-custom-pgvector.md +2 -9
- package/framework/standards/frontend/design-system/ai-image-generation.md +1 -1
- package/framework/standards/infrastructure/docker/local-compose-isolation.md +2 -2
- package/framework/standards/integration/mcp/mcp-tools.md +125 -267
- package/framework/templates/README.md +52 -82
- package/framework/templates/REGISTRY.json +1 -281
- package/framework/templates/code/sql/ai-agents/agent-prompts-migration.sql.template +3 -4
- package/framework/templates/context/design-system.md +1 -1
- package/framework/templates/docs/plan.md +2 -2
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Providers/model-registry.v2.json +1 -1
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaDisclosureTests.cs +1 -1
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Morph.AiKit.Tests.csproj +3 -5
- package/framework/templates/frontend/nextjs/gsap-scroll-section.tsx.hbs +13 -17
- package/framework/templates/infrastructure/docker/docker-compose.template.yml +15 -16
- package/framework/templates/infrastructure/github/README.md +10 -13
- package/package.json +7 -16
- package/src/commands/graph/build.js +2 -2
- package/src/commands/mcp/manual-setup.js +95 -0
- package/src/commands/mcp/mcp-setup.js +26 -192
- package/src/commands/project/doctor.js +48 -142
- package/src/commands/project/env.js +2 -1
- package/src/commands/project/init-contract.js +2 -2
- package/src/commands/project/init.js +34 -294
- package/src/commands/project/stack-scan.js +6 -14
- package/src/commands/project/stack-set.js +3 -1
- package/src/commands/project/standards.js +1 -2
- package/src/commands/project/update.js +87 -205
- package/src/commands/scaffold/scaffold.js +43 -5
- package/src/commands/validation/check.js +12 -10
- package/src/commands/validation/prove-red.js +61 -22
- package/src/core/paths/output-schema.js +8 -27
- package/src/core/templates/template-registry.js +8 -43
- package/src/core/templates/template-renderer.js +3 -200
- package/src/lib/ai/ai-checks.js +1 -1
- package/src/lib/ai/ai-project-scan.js +2 -5
- package/src/lib/ai/code-audit.js +3 -8
- package/src/lib/ai/registry-audit.js +2 -1
- package/src/lib/check/signals.js +25 -7
- package/src/lib/config/project-config.js +3 -2
- package/src/lib/contract/apply.js +2 -1
- package/src/lib/contract/defaults.js +2 -2
- package/src/lib/contract/merge.js +1 -0
- package/src/lib/contract/scan.js +5 -5
- package/src/lib/detectors/claude-config-detector.js +44 -98
- package/src/lib/detectors/mcp-config.js +2 -1
- package/src/lib/diff/diff-lines.js +4 -9
- package/src/lib/generators/scaffold-generator.js +5 -17
- package/src/lib/git/default-branch.js +5 -13
- package/src/lib/graph/graph-health.js +1 -1
- package/src/lib/graph/graph-loader.js +2 -1
- package/src/lib/graph/graphifyignore.js +5 -5
- package/src/lib/graph/sanitize.js +2 -2
- package/src/lib/installers/effects.js +0 -13
- package/src/lib/installers/install-manifest.js +56 -0
- package/src/lib/installers/mcp-installer.js +16 -19
- package/src/lib/installers/memory-installer.js +5 -8
- package/src/lib/installers/rules-installer.js +9 -15
- package/src/lib/installers/stack-assets.js +54 -7
- package/src/lib/installers/stack-sync.js +16 -16
- package/src/lib/installers/stack-tooling.js +4 -3
- package/src/lib/json-file.js +9 -0
- package/src/lib/plan/artifact-vocabulary.js +1 -1
- package/src/lib/plan/checks.js +4 -3
- package/src/lib/plan/media.js +6 -6
- package/src/lib/plan/plan-parser.js +6 -11
- package/src/lib/review-reports.js +13 -18
- package/src/lib/scan/worktree-dirs.js +1 -3
- package/src/lib/specs/adr-index.js +4 -4
- package/src/lib/specs/revocations.js +3 -3
- package/src/lib/stack/stack-scan.js +4 -4
- package/src/lib/standards/registry.js +1 -1
- package/src/lib/standards/verified-against.js +3 -3
- package/src/lib/tests-audit/audit.js +3 -3
- package/src/lib/text.js +5 -0
- package/src/scripts/global-install.js +41 -19
- package/src/scripts/setup-infra.js +68 -187
- package/src/utils/agents-installer.js +21 -60
- package/src/utils/claude-md-injector.js +16 -50
- package/src/utils/claude-settings-manager.js +29 -27
- package/src/utils/file-copier.js +3 -4
- package/src/utils/hooks-installer.js +83 -62
- package/src/utils/skills-installer.js +18 -78
- package/src/utils/version-checker.js +2 -31
- package/CLAUDE.md +0 -118
- package/framework/commands/create-umbraco-lp.md +0 -37
- package/framework/commands/migrate-lp-to-umbraco.md +0 -35
- package/framework/commands/morph-apply.md +0 -14
- package/framework/hooks/shared/spawn-command.js +0 -23
- package/framework/templates/CLAUDE.md.core.guide.md +0 -29
- package/framework/templates/CLAUDE.md.core.template +0 -22
- package/framework/templates/IDE-SNIPPETS.md +0 -262
- package/framework/templates/code/dotnet/ai-agents/AgentBootstrap.cs.template +0 -26
- package/framework/templates/code/dotnet/ai-agents/EmbeddingService.cs.template +0 -28
- package/framework/templates/code/dotnet/ai-agents/ModelRegistry.cs.template +0 -99
- package/framework/templates/code/dotnet/ai-agents/ResilientToolMiddleware.cs.template +0 -40
- package/framework/templates/code/dotnet/ai-agents/VectorSearchTool.cs.template +0 -54
- package/framework/templates/code/dotnet/ai-agents/model-registry.json.template +0 -53
- package/framework/templates/code/dotnet/contracts/README.md +0 -74
- package/framework/templates/code/dotnet/database/vector-entity.cs +0 -49
- package/framework/templates/code/sql/ai-agents/pgvector-embeddings-migration.sql.template +0 -91
- package/framework/templates/code/sql/postgresql-migration.template.sql +0 -108
- package/framework/templates/code/typescript/contracts.ts +0 -140
- package/framework/templates/context/ARCHITECTURE.md +0 -106
- package/framework/templates/examples/design-system-examples.md +0 -354
- package/framework/templates/infrastructure/docker/Dockerfile.template +0 -58
- package/framework/templates/infrastructure/github/actions/docker-build-push/action.yml.hbs +0 -45
- package/framework/templates/infrastructure/github/actions/health-check/action.yml.hbs +0 -27
- package/framework/templates/integrations/asaas-client.cs +0 -332
- package/framework/templates/integrations/asaas-webhook.cs +0 -290
- package/framework/templates/integrations/neon-auth-config.cs +0 -170
- package/framework/templates/ui/design-system.css +0 -226
- package/src/commands/context/context-refresh.js +0 -63
- package/src/lib/detectors/index.js +0 -178
- package/src/lib/generators/architecture-scanner.js +0 -543
- package/src/lib/generators/settings-generator.js +0 -97
- package/src/lib/graph/god-nodes.js +0 -65
- package/src/lib/installers/templates-reconcile.js +0 -26
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
// Neon Auth signs with EdDSA (Ed25519), which Microsoft.IdentityModel cannot verify: needs BouncyCastle.Cryptography >= 2.3.1 (CVE-2024-30172).
|
|
2
|
-
using System.Security.Claims;
|
|
3
|
-
using System.Text;
|
|
4
|
-
using Microsoft.AspNetCore.Authentication;
|
|
5
|
-
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
|
6
|
-
using Microsoft.Extensions.Options;
|
|
7
|
-
using Microsoft.IdentityModel.JsonWebTokens;
|
|
8
|
-
using Microsoft.IdentityModel.Tokens;
|
|
9
|
-
using Org.BouncyCastle.Crypto.Parameters;
|
|
10
|
-
using Org.BouncyCastle.Crypto.Signers;
|
|
11
|
-
|
|
12
|
-
namespace {{Namespace}}.Infrastructure.Auth;
|
|
13
|
-
|
|
14
|
-
public class NeonAuthOptions
|
|
15
|
-
{
|
|
16
|
-
public const string SectionName = "NeonAuth";
|
|
17
|
-
|
|
18
|
-
// Public value, commit it in appsettings.Development.json: when missing, every request is a bare 401 with nothing in the logs.
|
|
19
|
-
public string BaseUrl { get; set; } = string.Empty;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public sealed class NeonAuthJwksProvider(HttpClient httpClient, IOptions<NeonAuthOptions> options)
|
|
23
|
-
{
|
|
24
|
-
private static readonly TimeSpan CacheTtl = TimeSpan.FromMinutes(15);
|
|
25
|
-
private readonly SemaphoreSlim _refreshLock = new(1, 1);
|
|
26
|
-
private JsonWebKeySet? _cached;
|
|
27
|
-
private DateTimeOffset _cachedAt;
|
|
28
|
-
|
|
29
|
-
public async Task<JsonWebKey?> GetKeyAsync(string kid, CancellationToken cancellationToken)
|
|
30
|
-
{
|
|
31
|
-
var keySet = await GetKeySetAsync(forceRefresh: false, cancellationToken);
|
|
32
|
-
var key = keySet.Keys.FirstOrDefault(k => k.Kid == kid);
|
|
33
|
-
if (key is not null) return key;
|
|
34
|
-
|
|
35
|
-
// Unknown kid may be a key rotation: refresh once instead of waiting out the TTL.
|
|
36
|
-
keySet = await GetKeySetAsync(forceRefresh: true, cancellationToken);
|
|
37
|
-
return keySet.Keys.FirstOrDefault(k => k.Kid == kid);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
private async Task<JsonWebKeySet> GetKeySetAsync(bool forceRefresh, CancellationToken cancellationToken)
|
|
41
|
-
{
|
|
42
|
-
if (!forceRefresh && _cached is not null && DateTimeOffset.UtcNow - _cachedAt < CacheTtl)
|
|
43
|
-
return _cached;
|
|
44
|
-
|
|
45
|
-
await _refreshLock.WaitAsync(cancellationToken);
|
|
46
|
-
try
|
|
47
|
-
{
|
|
48
|
-
if (!forceRefresh && _cached is not null && DateTimeOffset.UtcNow - _cachedAt < CacheTtl)
|
|
49
|
-
return _cached;
|
|
50
|
-
|
|
51
|
-
var jwksUri = $"{options.Value.BaseUrl.TrimEnd('/')}/.well-known/jwks.json";
|
|
52
|
-
var json = await httpClient.GetStringAsync(jwksUri, cancellationToken);
|
|
53
|
-
_cached = new JsonWebKeySet(json);
|
|
54
|
-
_cachedAt = DateTimeOffset.UtcNow;
|
|
55
|
-
return _cached;
|
|
56
|
-
}
|
|
57
|
-
finally
|
|
58
|
-
{
|
|
59
|
-
_refreshLock.Release();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public static class NeonAuthServiceExtensions
|
|
65
|
-
{
|
|
66
|
-
public static IServiceCollection AddNeonAuthentication(
|
|
67
|
-
this IServiceCollection services,
|
|
68
|
-
IConfiguration configuration)
|
|
69
|
-
{
|
|
70
|
-
services.Configure<NeonAuthOptions>(configuration.GetSection(NeonAuthOptions.SectionName));
|
|
71
|
-
services.AddHttpClient<NeonAuthJwksProvider>();
|
|
72
|
-
|
|
73
|
-
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
|
74
|
-
.AddJwtBearer(options =>
|
|
75
|
-
{
|
|
76
|
-
// No options.Authority: Neon Auth serves no /.well-known/openid-configuration to fetch.
|
|
77
|
-
options.TokenValidationParameters = new TokenValidationParameters
|
|
78
|
-
{
|
|
79
|
-
ValidateIssuer = true,
|
|
80
|
-
ValidIssuer = configuration["NeonAuth:BaseUrl"],
|
|
81
|
-
ValidateAudience = false,
|
|
82
|
-
ValidateLifetime = true,
|
|
83
|
-
NameClaimType = "sub",
|
|
84
|
-
// The key is trusted inside SignatureValidator below, not by this flag.
|
|
85
|
-
ValidateIssuerSigningKey = false,
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
// Separate pass because the validator needs NeonAuthJwksProvider from DI.
|
|
90
|
-
services.AddOptions<JwtBearerOptions>(JwtBearerDefaults.AuthenticationScheme)
|
|
91
|
-
.Configure<NeonAuthJwksProvider>((options, jwks) =>
|
|
92
|
-
{
|
|
93
|
-
options.TokenValidationParameters.SignatureValidator = (token, _) =>
|
|
94
|
-
{
|
|
95
|
-
var jwt = new JsonWebToken(token);
|
|
96
|
-
|
|
97
|
-
// Pin the algorithm against alg-substitution attacks.
|
|
98
|
-
if (!string.Equals(jwt.Alg, "EdDSA", StringComparison.Ordinal))
|
|
99
|
-
throw new SecurityTokenInvalidSignatureException(
|
|
100
|
-
$"Unsupported alg '{jwt.Alg}' — Neon Auth tokens must be EdDSA.");
|
|
101
|
-
|
|
102
|
-
var kid = jwt.Kid;
|
|
103
|
-
if (string.IsNullOrEmpty(kid))
|
|
104
|
-
throw new SecurityTokenInvalidSignatureException("Token is missing 'kid'.");
|
|
105
|
-
|
|
106
|
-
// SignatureValidator has no async overload; the JWKS is cached, so only a cold miss blocks on I/O.
|
|
107
|
-
var jwk = jwks.GetKeyAsync(kid, CancellationToken.None).GetAwaiter().GetResult()
|
|
108
|
-
?? throw new SecurityTokenInvalidSignatureException(
|
|
109
|
-
$"No JWKS key found for kid '{kid}'.");
|
|
110
|
-
|
|
111
|
-
if (jwk.Kty != "OKP" || jwk.Crv != "Ed25519")
|
|
112
|
-
throw new SecurityTokenInvalidSignatureException(
|
|
113
|
-
"JWKS key is not an Ed25519 (OKP) key.");
|
|
114
|
-
|
|
115
|
-
var parts = token.Split('.');
|
|
116
|
-
if (parts.Length != 3)
|
|
117
|
-
throw new SecurityTokenInvalidSignatureException(
|
|
118
|
-
"Malformed JWT — expected 3 segments.");
|
|
119
|
-
|
|
120
|
-
var signingInput = Encoding.ASCII.GetBytes($"{parts[0]}.{parts[1]}");
|
|
121
|
-
var signature = Base64UrlEncoder.DecodeBytes(parts[2]);
|
|
122
|
-
var publicKey = new Ed25519PublicKeyParameters(Base64UrlEncoder.DecodeBytes(jwk.X), 0);
|
|
123
|
-
|
|
124
|
-
var verifier = new Ed25519Signer();
|
|
125
|
-
verifier.Init(forSigning: false, publicKey);
|
|
126
|
-
verifier.BlockUpdate(signingInput, 0, signingInput.Length);
|
|
127
|
-
|
|
128
|
-
if (!verifier.VerifySignature(signature))
|
|
129
|
-
throw new SecurityTokenInvalidSignatureException(
|
|
130
|
-
"Ed25519 signature verification failed.");
|
|
131
|
-
|
|
132
|
-
// Must be JsonWebToken: returning a JwtSecurityToken fails with IDX10506 on ASP.NET Core 8+.
|
|
133
|
-
return jwt;
|
|
134
|
-
};
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
services.AddAuthorization();
|
|
138
|
-
|
|
139
|
-
return services;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
public interface ICurrentUserService
|
|
144
|
-
{
|
|
145
|
-
string? UserId { get; }
|
|
146
|
-
string? Email { get; }
|
|
147
|
-
bool IsAuthenticated { get; }
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
public class CurrentUserService(IHttpContextAccessor httpContextAccessor) : ICurrentUserService
|
|
151
|
-
{
|
|
152
|
-
public string? UserId =>
|
|
153
|
-
httpContextAccessor.HttpContext?.User.FindFirstValue("sub");
|
|
154
|
-
|
|
155
|
-
public string? Email =>
|
|
156
|
-
httpContextAccessor.HttpContext?.User.FindFirstValue("email");
|
|
157
|
-
|
|
158
|
-
public bool IsAuthenticated =>
|
|
159
|
-
httpContextAccessor.HttpContext?.User.Identity?.IsAuthenticated ?? false;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
public static class NeonAuthMiddlewareExtensions
|
|
163
|
-
{
|
|
164
|
-
public static IApplicationBuilder UseNeonAuthentication(this IApplicationBuilder app)
|
|
165
|
-
{
|
|
166
|
-
app.UseAuthentication();
|
|
167
|
-
app.UseAuthorization();
|
|
168
|
-
return app;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Design System - {Project Name}
|
|
3
|
-
*
|
|
4
|
-
* CSS Variables generated from design-system.md
|
|
5
|
-
* Use estas variáveis em todo o projeto para manter consistência visual.
|
|
6
|
-
*
|
|
7
|
-
* Template MORPH-SPEC by Polymorphism Tech
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
:root {
|
|
11
|
-
/* ========================================
|
|
12
|
-
* CORES PRINCIPAIS
|
|
13
|
-
* ======================================== */
|
|
14
|
-
|
|
15
|
-
--color-primary: #{hex da cor primária};
|
|
16
|
-
--color-primary-hover: #{hex da cor primária mais escura};
|
|
17
|
-
--color-primary-active: #{hex da cor primária ainda mais escura};
|
|
18
|
-
|
|
19
|
-
--color-secondary: #{hex da cor secundária};
|
|
20
|
-
--color-secondary-hover: #{hex};
|
|
21
|
-
--color-secondary-active: #{hex};
|
|
22
|
-
|
|
23
|
-
/* ========================================
|
|
24
|
-
* CORES DE ESTADO
|
|
25
|
-
* ======================================== */
|
|
26
|
-
|
|
27
|
-
--color-success: #{hex};
|
|
28
|
-
--color-success-bg: #{hex com transparência ou shade mais claro};
|
|
29
|
-
--color-success-border: #{hex};
|
|
30
|
-
|
|
31
|
-
--color-error: #{hex};
|
|
32
|
-
--color-error-bg: #{hex};
|
|
33
|
-
--color-error-border: #{hex};
|
|
34
|
-
|
|
35
|
-
--color-warning: #{hex};
|
|
36
|
-
--color-warning-bg: #{hex};
|
|
37
|
-
--color-warning-border: #{hex};
|
|
38
|
-
|
|
39
|
-
--color-info: #{hex};
|
|
40
|
-
--color-info-bg: #{hex};
|
|
41
|
-
--color-info-border: #{hex};
|
|
42
|
-
|
|
43
|
-
/* ========================================
|
|
44
|
-
* ESCALA DE NEUTROS (Cinzas)
|
|
45
|
-
* ======================================== */
|
|
46
|
-
|
|
47
|
-
--color-gray-50: #{hex};
|
|
48
|
-
--color-gray-100: #{hex};
|
|
49
|
-
--color-gray-200: #{hex};
|
|
50
|
-
--color-gray-300: #{hex};
|
|
51
|
-
--color-gray-400: #{hex};
|
|
52
|
-
--color-gray-500: #{hex};
|
|
53
|
-
--color-gray-600: #{hex};
|
|
54
|
-
--color-gray-700: #{hex};
|
|
55
|
-
--color-gray-800: #{hex};
|
|
56
|
-
--color-gray-900: #{hex};
|
|
57
|
-
|
|
58
|
-
/* ========================================
|
|
59
|
-
* TIPOGRAFIA - FONTES
|
|
60
|
-
* ======================================== */
|
|
61
|
-
|
|
62
|
-
--font-sans: '{Font Name}', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
|
|
63
|
-
--font-serif: '{Font Name}', Georgia, 'Times New Roman', serif;
|
|
64
|
-
--font-mono: '{Font Name}', 'Fira Code', 'Courier New', Consolas, monospace;
|
|
65
|
-
|
|
66
|
-
/* ========================================
|
|
67
|
-
* TIPOGRAFIA - TAMANHOS
|
|
68
|
-
* ======================================== */
|
|
69
|
-
|
|
70
|
-
--text-xs: 0.75rem; /* 12px */
|
|
71
|
-
--text-sm: 0.875rem; /* 14px */
|
|
72
|
-
--text-base: 1rem; /* 16px */
|
|
73
|
-
--text-lg: 1.125rem; /* 18px */
|
|
74
|
-
--text-xl: 1.25rem; /* 20px */
|
|
75
|
-
--text-2xl: 1.5rem; /* 24px */
|
|
76
|
-
--text-3xl: 1.875rem; /* 30px */
|
|
77
|
-
--text-4xl: 2.25rem; /* 36px */
|
|
78
|
-
--text-5xl: 3rem; /* 48px */
|
|
79
|
-
|
|
80
|
-
/* ========================================
|
|
81
|
-
* TIPOGRAFIA - LINE HEIGHTS
|
|
82
|
-
* ======================================== */
|
|
83
|
-
|
|
84
|
-
--leading-none: 1;
|
|
85
|
-
--leading-tight: 1.25;
|
|
86
|
-
--leading-snug: 1.375;
|
|
87
|
-
--leading-normal: 1.5;
|
|
88
|
-
--leading-relaxed: 1.625;
|
|
89
|
-
--leading-loose: 2;
|
|
90
|
-
|
|
91
|
-
/* ========================================
|
|
92
|
-
* TIPOGRAFIA - FONT WEIGHTS
|
|
93
|
-
* ======================================== */
|
|
94
|
-
|
|
95
|
-
--font-light: 300;
|
|
96
|
-
--font-regular: 400;
|
|
97
|
-
--font-medium: 500;
|
|
98
|
-
--font-semibold: 600;
|
|
99
|
-
--font-bold: 700;
|
|
100
|
-
--font-extrabold: 800;
|
|
101
|
-
|
|
102
|
-
/* ========================================
|
|
103
|
-
* ESPAÇAMENTO
|
|
104
|
-
* Baseado em múltiplos de {base}px (ex: 4px)
|
|
105
|
-
* ======================================== */
|
|
106
|
-
|
|
107
|
-
--space-0: 0;
|
|
108
|
-
--space-1: 0.25rem; /* 4px */
|
|
109
|
-
--space-2: 0.5rem; /* 8px */
|
|
110
|
-
--space-3: 0.75rem; /* 12px */
|
|
111
|
-
--space-4: 1rem; /* 16px */
|
|
112
|
-
--space-5: 1.25rem; /* 20px */
|
|
113
|
-
--space-6: 1.5rem; /* 24px */
|
|
114
|
-
--space-7: 1.75rem; /* 28px */
|
|
115
|
-
--space-8: 2rem; /* 32px */
|
|
116
|
-
--space-10: 2.5rem; /* 40px */
|
|
117
|
-
--space-12: 3rem; /* 48px */
|
|
118
|
-
--space-16: 4rem; /* 64px */
|
|
119
|
-
--space-20: 5rem; /* 80px */
|
|
120
|
-
--space-24: 6rem; /* 96px */
|
|
121
|
-
|
|
122
|
-
/* ========================================
|
|
123
|
-
* BORDER RADIUS
|
|
124
|
-
* ======================================== */
|
|
125
|
-
|
|
126
|
-
--rounded-none: 0;
|
|
127
|
-
--rounded-sm: 0.125rem; /* 2px */
|
|
128
|
-
--rounded-md: 0.375rem; /* 6px */
|
|
129
|
-
--rounded-lg: 0.5rem; /* 8px */
|
|
130
|
-
--rounded-xl: 0.75rem; /* 12px */
|
|
131
|
-
--rounded-2xl: 1rem; /* 16px */
|
|
132
|
-
--rounded-full: 9999px;
|
|
133
|
-
|
|
134
|
-
/* ========================================
|
|
135
|
-
* SOMBRAS (Shadows)
|
|
136
|
-
* ======================================== */
|
|
137
|
-
|
|
138
|
-
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
139
|
-
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
140
|
-
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
141
|
-
--shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
142
|
-
--shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
|
143
|
-
|
|
144
|
-
/* ========================================
|
|
145
|
-
* Z-INDEX LAYERS
|
|
146
|
-
* ======================================== */
|
|
147
|
-
|
|
148
|
-
--z-0: 0;
|
|
149
|
-
--z-10: 10;
|
|
150
|
-
--z-20: 20;
|
|
151
|
-
--z-30: 30;
|
|
152
|
-
--z-40: 40;
|
|
153
|
-
--z-50: 50; /* Modals, dropdowns */
|
|
154
|
-
--z-100: 100; /* Tooltips */
|
|
155
|
-
--z-max: 9999; /* Toasts, notifications */
|
|
156
|
-
|
|
157
|
-
/* ========================================
|
|
158
|
-
* TRANSITIONS / ANIMATIONS
|
|
159
|
-
* ======================================== */
|
|
160
|
-
|
|
161
|
-
--transition-fast: 150ms ease-in-out;
|
|
162
|
-
--transition-base: 250ms ease-in-out;
|
|
163
|
-
--transition-slow: 350ms ease-in-out;
|
|
164
|
-
|
|
165
|
-
--ease-in: cubic-bezier(0.4, 0, 1, 1);
|
|
166
|
-
--ease-out: cubic-bezier(0, 0, 0.2, 1);
|
|
167
|
-
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
|
|
168
|
-
|
|
169
|
-
/* ========================================
|
|
170
|
-
* BREAKPOINTS (informativo - usar em media queries)
|
|
171
|
-
* ======================================== */
|
|
172
|
-
|
|
173
|
-
/* @media (min-width: 640px) - sm */
|
|
174
|
-
/* @media (min-width: 768px) - md */
|
|
175
|
-
/* @media (min-width: 1024px) - lg */
|
|
176
|
-
/* @media (min-width: 1280px) - xl */
|
|
177
|
-
/* @media (min-width: 1536px) - 2xl */
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/* ========================================
|
|
181
|
-
* MODO ESCURO (Dark Mode)
|
|
182
|
-
* Opcional - ajuste as cores para dark theme
|
|
183
|
-
* ======================================== */
|
|
184
|
-
|
|
185
|
-
@media (prefers-color-scheme: dark) {
|
|
186
|
-
:root {
|
|
187
|
-
/* Inverter cores conforme necessário */
|
|
188
|
-
--color-gray-50: #{hex do gray-900};
|
|
189
|
-
--color-gray-900: #{hex do gray-50};
|
|
190
|
-
/* ... outras inversões */
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/* ========================================
|
|
195
|
-
* CLASSES UTILITÁRIAS (Exemplo)
|
|
196
|
-
* ======================================== */
|
|
197
|
-
|
|
198
|
-
/* Exemplo de uso das variáveis */
|
|
199
|
-
.btn-primary {
|
|
200
|
-
background-color: var(--color-primary);
|
|
201
|
-
color: white;
|
|
202
|
-
padding: var(--space-2) var(--space-4);
|
|
203
|
-
border-radius: var(--rounded-md);
|
|
204
|
-
font-weight: var(--font-semibold);
|
|
205
|
-
transition: background-color var(--transition-base);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.btn-primary:hover {
|
|
209
|
-
background-color: var(--color-primary-hover);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.card {
|
|
213
|
-
background-color: white;
|
|
214
|
-
padding: var(--space-6);
|
|
215
|
-
border-radius: var(--rounded-lg);
|
|
216
|
-
box-shadow: var(--shadow-md);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.text-muted {
|
|
220
|
-
color: var(--color-gray-600);
|
|
221
|
-
font-size: var(--text-sm);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/* ========================================
|
|
225
|
-
* FIM DO DESIGN SYSTEM
|
|
226
|
-
* ======================================== */
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { scanArchitecture, renderArchitectureContext } from '../../lib/generators/architecture-scanner.js';
|
|
2
|
-
import { logger } from '../../utils/logger.js';
|
|
3
|
-
|
|
4
|
-
export async function contextRefreshCommand(options = {}) {
|
|
5
|
-
const projectPath = options.path || process.cwd();
|
|
6
|
-
|
|
7
|
-
if (!options.quiet) {
|
|
8
|
-
logger.header('Architecture Context Refresh');
|
|
9
|
-
logger.dim(`Scanning: ${projectPath}`);
|
|
10
|
-
logger.blank();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
const scanResult = await scanArchitecture(projectPath);
|
|
15
|
-
|
|
16
|
-
if (options.json) {
|
|
17
|
-
console.log(JSON.stringify(scanResult, null, 2));
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const outputPath = await renderArchitectureContext(projectPath, scanResult);
|
|
22
|
-
|
|
23
|
-
if (!options.quiet) {
|
|
24
|
-
const counts = [];
|
|
25
|
-
if (scanResult.entities.length > 0) counts.push(`${scanResult.entities.length} entities`);
|
|
26
|
-
if (scanResult.endpoints.length > 0) counts.push(`${scanResult.endpoints.length} endpoints`);
|
|
27
|
-
if (scanResult.nextjs.pages.length > 0) counts.push(`${scanResult.nextjs.pages.length} pages`);
|
|
28
|
-
if (scanResult.nextjs.components.length > 0) counts.push(`${scanResult.nextjs.components.length} components`);
|
|
29
|
-
if (scanResult.integrations.length > 0) counts.push(`${scanResult.integrations.length} integrations`);
|
|
30
|
-
if (scanResult.database.length > 0) counts.push(`${scanResult.database.length} tables`);
|
|
31
|
-
if (scanResult.stack.dotnet.length > 0) counts.push(`${scanResult.stack.dotnet.length} .NET packages`);
|
|
32
|
-
if (scanResult.stack.npm.length > 0) counts.push(`${scanResult.stack.npm.length} npm packages`);
|
|
33
|
-
|
|
34
|
-
if (counts.length > 0) {
|
|
35
|
-
logger.success(`Found: ${counts.join(', ')}`);
|
|
36
|
-
} else {
|
|
37
|
-
logger.warn('No architectural patterns detected (empty project?)');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
logger.success(`Written to: ${outputPath}`);
|
|
41
|
-
|
|
42
|
-
if (options.verbose) {
|
|
43
|
-
logger.blank();
|
|
44
|
-
if (scanResult.entities.length > 0) {
|
|
45
|
-
logger.info('Entities:');
|
|
46
|
-
for (const e of scanResult.entities) logger.dim(` ${e.name} (${e.type}) — ${e.path}`);
|
|
47
|
-
}
|
|
48
|
-
if (scanResult.endpoints.length > 0) {
|
|
49
|
-
logger.info('Endpoints:');
|
|
50
|
-
for (const ep of scanResult.endpoints) logger.dim(` ${ep.method || '???'} ${ep.route} — ${ep.name}`);
|
|
51
|
-
}
|
|
52
|
-
if (scanResult.nextjs.pages.length > 0) {
|
|
53
|
-
logger.info('Pages:');
|
|
54
|
-
for (const p of scanResult.nextjs.pages) logger.dim(` ${p.route} — ${p.path}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
} catch (err) {
|
|
59
|
-
if (options.quiet) throw err;
|
|
60
|
-
logger.error(`Scan failed: ${err.message}`);
|
|
61
|
-
process.exitCode = 1;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, readdirSync } from 'fs';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
|
|
4
|
-
import { PACKAGE_LOCATIONS } from '../../../framework/hooks/shared/frontend-locations.js';
|
|
5
|
-
|
|
6
|
-
export { PACKAGE_LOCATIONS };
|
|
7
|
-
|
|
8
|
-
export function detectProject(targetPath, opts = {}) {
|
|
9
|
-
const structure = {
|
|
10
|
-
stack: 'unknown',
|
|
11
|
-
architecture: null,
|
|
12
|
-
uiLibrary: null,
|
|
13
|
-
integrations: [],
|
|
14
|
-
hasVercel: false,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
try {
|
|
18
|
-
const allDeps = {};
|
|
19
|
-
let rootPkg = null;
|
|
20
|
-
let scripts = [];
|
|
21
|
-
for (const loc of PACKAGE_LOCATIONS) {
|
|
22
|
-
const pkgPath = join(targetPath, loc, 'package.json');
|
|
23
|
-
if (!existsSync(pkgPath)) continue;
|
|
24
|
-
try {
|
|
25
|
-
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
26
|
-
if (loc === '.') rootPkg = pkg;
|
|
27
|
-
Object.assign(allDeps, pkg.dependencies, pkg.devDependencies);
|
|
28
|
-
scripts.push(...Object.keys(pkg.scripts || {}));
|
|
29
|
-
if (loc !== '.' && (pkg.dependencies?.next || pkg.dependencies?.react || pkg.dependencies?.vue)) {
|
|
30
|
-
structure.frontendPath = loc;
|
|
31
|
-
}
|
|
32
|
-
} catch {}
|
|
33
|
-
}
|
|
34
|
-
const depNames = Object.keys(allDeps);
|
|
35
|
-
|
|
36
|
-
if (depNames.length > 0) {
|
|
37
|
-
|
|
38
|
-
if (depNames.includes('next')) {
|
|
39
|
-
structure.stack = 'nextjs';
|
|
40
|
-
} else if (depNames.includes('react')) {
|
|
41
|
-
structure.stack = 'react';
|
|
42
|
-
} else if (depNames.includes('vue')) {
|
|
43
|
-
structure.stack = 'vue';
|
|
44
|
-
} else if (depNames.includes('express') || depNames.includes('fastify') || depNames.includes('hono')) {
|
|
45
|
-
structure.stack = 'nodejs';
|
|
46
|
-
} else if (rootPkg?.name) {
|
|
47
|
-
structure.stack = 'nodejs';
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (existsSync(join(targetPath, 'components.json')) || existsSync(join(targetPath, structure.frontendPath || '.', 'components.json')) || depNames.includes('@shadcn/ui')) {
|
|
51
|
-
structure.uiLibrary = 'shadcn';
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (depNames.includes('@neondatabase/serverless') || depNames.includes('postgres') || depNames.includes('pg')) {
|
|
55
|
-
structure.integrations.push('neon');
|
|
56
|
-
}
|
|
57
|
-
if (depNames.includes('@neon/auth') || depNames.includes('@neondatabase/auth')) {
|
|
58
|
-
structure.integrations.push('neon-auth');
|
|
59
|
-
}
|
|
60
|
-
if (depNames.includes('stripe')) {
|
|
61
|
-
structure.integrations.push('stripe');
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (depNames.includes('vercel') || scripts.includes('vercel')) {
|
|
65
|
-
structure.hasVercel = true;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
let hasDotnet = false;
|
|
70
|
-
const csprojLocations = ['.', 'src', 'src/Api', 'src/Web', 'src/backend'];
|
|
71
|
-
|
|
72
|
-
function checkCsproj(filePath) {
|
|
73
|
-
hasDotnet = true;
|
|
74
|
-
try {
|
|
75
|
-
const content = readFileSync(filePath, 'utf8');
|
|
76
|
-
if (content.includes('Hangfire')) {
|
|
77
|
-
if (!structure.integrations.includes('hangfire')) structure.integrations.push('hangfire');
|
|
78
|
-
}
|
|
79
|
-
// Same heuristic as the package.json side (`pg`/`postgres` → neon).
|
|
80
|
-
if (content.includes('Npgsql')) {
|
|
81
|
-
if (!structure.integrations.includes('neon')) structure.integrations.push('neon');
|
|
82
|
-
}
|
|
83
|
-
} catch {}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
for (const loc of csprojLocations) {
|
|
87
|
-
try {
|
|
88
|
-
const dir = join(targetPath, loc);
|
|
89
|
-
if (!existsSync(dir)) continue;
|
|
90
|
-
const entries = readdirSyncSafe(dir);
|
|
91
|
-
for (const e of entries.filter(f => f.endsWith('.csproj'))) {
|
|
92
|
-
checkCsproj(join(dir, e));
|
|
93
|
-
}
|
|
94
|
-
for (const sub of entries) {
|
|
95
|
-
const subDir = join(dir, sub);
|
|
96
|
-
for (const e of readdirSyncSafe(subDir).filter(f => f.endsWith('.csproj'))) {
|
|
97
|
-
checkCsproj(join(subDir, e));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
} catch {}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (hasDotnet) {
|
|
104
|
-
if (structure.stack === 'nextjs' || structure.stack === 'react' || structure.stack === 'vue') {
|
|
105
|
-
structure.stack = `${structure.stack}+dotnet`;
|
|
106
|
-
} else if (structure.stack === 'unknown') {
|
|
107
|
-
structure.stack = 'dotnet';
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (existsSync(join(targetPath, 'vercel.json'))) {
|
|
112
|
-
structure.hasVercel = true;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (structure.stack === 'unknown' && existsSync(join(targetPath, 'tsconfig.json'))) {
|
|
116
|
-
structure.stack = 'nodejs';
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
try {
|
|
120
|
-
const configPath = join(targetPath, '.morph/config/config.json');
|
|
121
|
-
if (existsSync(configPath)) {
|
|
122
|
-
const config = JSON.parse(readFileSync(configPath, 'utf8'));
|
|
123
|
-
if (config.architecture?.style) {
|
|
124
|
-
structure.architecture = config.architecture.style;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
} catch {}
|
|
128
|
-
|
|
129
|
-
if (existsSync(join(targetPath, 'docker-compose.yml')) ||
|
|
130
|
-
existsSync(join(targetPath, 'docker-compose.yaml')) ||
|
|
131
|
-
existsSync(join(targetPath, 'Dockerfile'))) {
|
|
132
|
-
if (!structure.integrations.includes('docker')) structure.integrations.push('docker');
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const azureSignals = [
|
|
136
|
-
'.azure',
|
|
137
|
-
'azure-pipelines.yml',
|
|
138
|
-
'infra/main.bicep',
|
|
139
|
-
'infra',
|
|
140
|
-
];
|
|
141
|
-
const hasAzure = azureSignals.some(signal => {
|
|
142
|
-
const p = join(targetPath, signal);
|
|
143
|
-
if (!existsSync(p)) return false;
|
|
144
|
-
if (signal === 'infra') {
|
|
145
|
-
return readdirSyncSafe(p).some(f => f.endsWith('.bicep'));
|
|
146
|
-
}
|
|
147
|
-
return true;
|
|
148
|
-
});
|
|
149
|
-
if (hasAzure && !structure.integrations.includes('azure')) {
|
|
150
|
-
structure.integrations.push('azure');
|
|
151
|
-
}
|
|
152
|
-
} catch {
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return {
|
|
156
|
-
structure,
|
|
157
|
-
inferred: {
|
|
158
|
-
markdown: opts.generateStandards ? generateInferredMarkdown(structure) : '',
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function readdirSyncSafe(dir) {
|
|
164
|
-
try {
|
|
165
|
-
return readdirSync(dir);
|
|
166
|
-
} catch {
|
|
167
|
-
return [];
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function generateInferredMarkdown(structure) {
|
|
172
|
-
const lines = [`## Detected Stack: ${structure.stack}`];
|
|
173
|
-
if (structure.architecture) lines.push(`Architecture: ${structure.architecture}`);
|
|
174
|
-
if (structure.uiLibrary) lines.push(`UI Library: ${structure.uiLibrary}`);
|
|
175
|
-
if (structure.integrations.length > 0) lines.push(`Integrations: ${structure.integrations.join(', ')}`);
|
|
176
|
-
if (structure.hasVercel) lines.push(`Vercel: detected`);
|
|
177
|
-
return lines.join('\n');
|
|
178
|
-
}
|