@polymorphism-tech/morph-spec 2.3.0 → 3.0.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/CLAUDE.md +446 -1730
- package/README.md +515 -516
- package/bin/morph-spec.js +366 -294
- package/bin/task-manager.js +429 -368
- package/bin/validate.js +369 -268
- package/content/.claude/commands/morph-apply.md +221 -158
- package/content/.claude/commands/morph-deploy.md +529 -0
- package/content/.claude/commands/morph-preflight.md +227 -0
- package/content/.claude/commands/morph-proposal.md +122 -101
- package/content/.claude/commands/morph-status.md +86 -86
- package/content/.claude/commands/morph-troubleshoot.md +122 -0
- package/content/.claude/skills/infra/azure-deploy-specialist.md +699 -0
- package/content/.claude/skills/level-0-meta/README.md +7 -0
- package/content/.claude/skills/level-0-meta/code-review.md +226 -0
- package/content/.claude/skills/level-0-meta/morph-checklist.md +117 -0
- package/content/.claude/skills/level-0-meta/simulation-checklist.md +77 -0
- package/content/.claude/skills/level-1-workflows/README.md +7 -0
- package/content/.claude/skills/level-1-workflows/morph-replicate.md +213 -0
- package/content/.claude/{commands/morph-clarify.md → skills/level-1-workflows/phase-clarify.md} +131 -184
- package/content/.claude/{commands/morph-design.md → skills/level-1-workflows/phase-design.md} +213 -275
- package/content/.claude/skills/level-1-workflows/phase-setup.md +106 -0
- package/content/.claude/skills/level-1-workflows/phase-tasks.md +164 -0
- package/content/.claude/{commands/morph-uiux.md → skills/level-1-workflows/phase-uiux.md} +169 -211
- package/content/.claude/skills/level-2-domains/README.md +14 -0
- package/content/.claude/skills/level-2-domains/ai-agents/ai-system-architect.md +192 -0
- package/content/.claude/skills/{specialists → level-2-domains/architecture}/po-pm-advisor.md +197 -197
- package/content/.claude/skills/level-2-domains/architecture/standards-architect.md +156 -0
- package/content/.claude/skills/level-2-domains/backend/dotnet-senior.md +287 -0
- package/content/.claude/skills/level-2-domains/backend/ef-modeler.md +113 -0
- package/content/.claude/skills/level-2-domains/backend/hangfire-orchestrator.md +126 -0
- package/content/.claude/skills/level-2-domains/backend/ms-agent-expert.md +109 -0
- package/content/.claude/skills/level-2-domains/frontend/blazor-builder.md +210 -0
- package/content/.claude/skills/level-2-domains/frontend/nextjs-expert.md +154 -0
- package/content/.claude/skills/level-2-domains/frontend/ui-ux-designer.md +191 -0
- package/content/.claude/skills/{specialists → level-2-domains/infrastructure}/azure-architect.md +142 -142
- package/content/.claude/skills/level-2-domains/infrastructure/bicep-architect.md +126 -0
- package/content/.claude/skills/level-2-domains/infrastructure/container-specialist.md +131 -0
- package/content/.claude/skills/level-2-domains/infrastructure/devops-engineer.md +119 -0
- package/content/.claude/skills/level-2-domains/integrations/asaas-financial.md +130 -0
- package/content/.claude/skills/level-2-domains/integrations/azure-identity.md +142 -0
- package/content/.claude/skills/level-2-domains/integrations/clerk-auth.md +108 -0
- package/content/.claude/skills/level-2-domains/integrations/resend-email.md +119 -0
- package/content/.claude/skills/level-2-domains/quality/code-analyzer.md +235 -0
- package/content/.claude/skills/level-2-domains/quality/testing-specialist.md +126 -0
- package/content/.claude/skills/level-3-technologies/README.md +7 -0
- package/content/.claude/skills/level-4-patterns/README.md +7 -0
- package/content/.claude/skills/specialists/prompt-engineer.md +189 -0
- package/content/.claude/skills/specialists/seo-growth-hacker.md +320 -0
- package/content/.morph/config/agents.json +762 -242
- package/content/.morph/config/config.template.json +122 -108
- package/content/.morph/docs/workflows/design-impl.md +37 -0
- package/content/.morph/docs/workflows/enforcement-pipeline.md +668 -0
- package/content/.morph/docs/workflows/fast-track.md +29 -0
- package/content/.morph/docs/workflows/full-morph.md +76 -0
- package/content/.morph/docs/workflows/standard.md +44 -0
- package/content/.morph/docs/workflows/ui-refresh.md +39 -0
- package/content/.morph/examples/scheduled-reports/decisions.md +158 -0
- package/content/.morph/examples/scheduled-reports/proposal.md +95 -0
- package/content/.morph/examples/scheduled-reports/spec.md +267 -0
- package/content/.morph/hooks/README.md +348 -239
- package/content/.morph/hooks/pre-commit-agents.sh +24 -24
- package/content/.morph/hooks/task-completed.js +73 -0
- package/content/.morph/hooks/teammate-idle.js +68 -0
- package/content/.morph/schemas/tasks.schema.json +220 -0
- package/content/.morph/standards/agent-framework-blazor-ui.md +359 -0
- package/content/.morph/standards/agent-framework-production.md +410 -0
- package/content/.morph/standards/agent-framework-setup.md +413 -453
- package/content/.morph/standards/agent-framework-workflows.md +349 -0
- package/content/.morph/standards/agent-teams-workflow.md +474 -0
- package/content/.morph/standards/architecture.md +325 -325
- package/content/.morph/standards/azure.md +605 -379
- package/content/.morph/standards/dotnet10-migration.md +520 -494
- package/content/.morph/templates/CONTEXT-FEATURE.md +276 -0
- package/content/.morph/templates/CONTEXT.md +170 -0
- package/content/.morph/templates/agent.cs +163 -172
- package/content/.morph/templates/clarify-questions.md +159 -0
- package/content/.morph/templates/contracts/Commands.cs +74 -0
- package/content/.morph/templates/contracts/Entities.cs +25 -0
- package/content/.morph/templates/contracts/Queries.cs +74 -0
- package/content/.morph/templates/contracts/README.md +74 -0
- package/content/.morph/templates/decisions.md +123 -106
- package/content/.morph/templates/infra/azure-pipelines-deploy.yml +480 -0
- package/content/.morph/templates/infra/deploy-checklist.md +426 -0
- package/content/.morph/templates/proposal.md +141 -155
- package/content/.morph/templates/recap.md +94 -105
- package/content/.morph/templates/simulation.md +353 -0
- package/content/.morph/templates/spec.md +149 -148
- package/content/.morph/templates/state.template.json +222 -222
- package/content/.morph/templates/tasks.md +257 -235
- package/content/.morph/templates/ui-components.md +362 -276
- package/content/CLAUDE.md +150 -442
- package/detectors/structure-detector.js +245 -250
- package/docs/README.md +144 -149
- package/docs/getting-started.md +301 -302
- package/docs/installation.md +361 -361
- package/docs/validation-checklist.md +265 -266
- package/package.json +80 -80
- package/src/commands/advance-phase.js +266 -0
- package/src/commands/analyze-blazor-concurrency.js +193 -0
- package/src/commands/deploy.js +780 -0
- package/src/commands/detect-agents.js +167 -0
- package/src/commands/doctor.js +356 -280
- package/src/commands/generate-context.js +40 -0
- package/src/commands/init.js +258 -245
- package/src/commands/lint-fluent.js +352 -0
- package/src/commands/rollback-phase.js +185 -0
- package/src/commands/session-summary.js +291 -0
- package/src/commands/task.js +78 -75
- package/src/commands/troubleshoot.js +222 -0
- package/src/commands/update.js +192 -159
- package/src/commands/validate-blazor-state.js +210 -0
- package/src/commands/validate-blazor.js +156 -0
- package/src/commands/validate-css.js +84 -0
- package/src/commands/validate-phase.js +221 -0
- package/src/lib/blazor-concurrency-analyzer.js +288 -0
- package/src/lib/blazor-state-validator.js +291 -0
- package/src/lib/blazor-validator.js +374 -0
- package/src/lib/complexity-analyzer.js +441 -292
- package/src/lib/context-generator.js +513 -0
- package/src/lib/continuous-validator.js +421 -440
- package/src/lib/css-validator.js +352 -0
- package/src/lib/decision-constraint-loader.js +109 -0
- package/src/lib/design-system-detector.js +187 -0
- package/src/lib/design-system-scaffolder.js +299 -0
- package/src/lib/hook-executor.js +256 -0
- package/src/lib/recap-generator.js +205 -0
- package/src/lib/spec-validator.js +258 -0
- package/src/lib/standards-context-injector.js +287 -0
- package/src/lib/state-manager.js +397 -340
- package/src/lib/team-orchestrator.js +322 -0
- package/src/lib/troubleshoot-grep.js +194 -0
- package/src/lib/troubleshoot-index.js +144 -0
- package/src/lib/validation-runner.js +283 -0
- package/src/lib/validators/contract-compliance-validator.js +273 -0
- package/src/lib/validators/design-system-validator.js +231 -0
- package/src/utils/file-copier.js +187 -139
- package/content/.claude/commands/morph-costs.md +0 -206
- package/content/.claude/commands/morph-setup.md +0 -100
- package/content/.claude/commands/morph-tasks.md +0 -319
- package/content/.claude/skills/infra/bicep-architect.md +0 -419
- package/content/.claude/skills/infra/container-specialist.md +0 -437
- package/content/.claude/skills/infra/devops-engineer.md +0 -405
- package/content/.claude/skills/integrations/asaas-financial.md +0 -333
- package/content/.claude/skills/integrations/azure-identity.md +0 -309
- package/content/.claude/skills/integrations/clerk-auth.md +0 -290
- package/content/.claude/skills/specialists/ai-system-architect.md +0 -604
- package/content/.claude/skills/specialists/cost-guardian.md +0 -110
- package/content/.claude/skills/specialists/ef-modeler.md +0 -211
- package/content/.claude/skills/specialists/hangfire-orchestrator.md +0 -255
- package/content/.claude/skills/specialists/ms-agent-expert.md +0 -263
- package/content/.claude/skills/specialists/standards-architect.md +0 -78
- package/content/.claude/skills/specialists/ui-ux-designer.md +0 -1100
- package/content/.claude/skills/stacks/dotnet-blazor.md +0 -606
- package/content/.claude/skills/stacks/dotnet-nextjs.md +0 -402
- package/content/.claude/skills/stacks/shopify.md +0 -445
- package/content/.morph/config/azure-pricing.json +0 -70
- package/content/.morph/config/azure-pricing.schema.json +0 -50
- package/content/.morph/hooks/pre-commit-costs.sh +0 -91
- package/docs/api/cost-calculator.js.html +0 -513
- package/docs/api/design-system-generator.js.html +0 -382
- package/docs/api/global.html +0 -5263
- package/docs/api/index.html +0 -96
- package/docs/api/state-manager.js.html +0 -423
- package/src/commands/cost.js +0 -181
- package/src/commands/update-pricing.js +0 -206
- package/src/lib/cost-calculator.js +0 -429
package/content/.claude/skills/{specialists → level-2-domains/infrastructure}/azure-architect.md
RENAMED
|
@@ -1,142 +1,142 @@
|
|
|
1
|
-
# Azure Architect
|
|
2
|
-
|
|
3
|
-
Especialista em infraestrutura Azure com foco em Infrastructure as Code (Bicep).
|
|
4
|
-
|
|
5
|
-
## Responsabilidades
|
|
6
|
-
|
|
7
|
-
1. **Desenhar infraestrutura Azure** para projetos
|
|
8
|
-
2. **Criar templates Bicep** para provisionar recursos
|
|
9
|
-
3. **Estimar custos** antes de aprovar recursos
|
|
10
|
-
4. **Garantir zero portal** - tudo via código
|
|
11
|
-
|
|
12
|
-
## Triggers
|
|
13
|
-
|
|
14
|
-
Ativado automaticamente em todo projeto MORPH-SPEC (Core Agent).
|
|
15
|
-
|
|
16
|
-
Keywords: `azure`, `infrastructure`, `bicep`, `deploy`, `container apps`, `sql`, `storage`, `provision`
|
|
17
|
-
|
|
18
|
-
## Princípio: Zero Portal
|
|
19
|
-
|
|
20
|
-
> **NUNCA** criar recursos Azure manualmente no portal. Tudo via Bicep.
|
|
21
|
-
|
|
22
|
-
## Estrutura IaC
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
infra/
|
|
26
|
-
├── main.bicep # Entry point
|
|
27
|
-
├── parameters.dev.json # Ambiente dev
|
|
28
|
-
├── parameters.prod.json # Ambiente prod
|
|
29
|
-
└── modules/
|
|
30
|
-
├── container-app.bicep # Container Apps
|
|
31
|
-
├── sql-database.bicep # Azure SQL
|
|
32
|
-
├── storage.bicep # Storage Account
|
|
33
|
-
├── key-vault.bicep # Key Vault
|
|
34
|
-
├── app-insights.bicep # Monitoring
|
|
35
|
-
└── service-bus.bicep # Mensageria
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Template Bicep Base
|
|
39
|
-
|
|
40
|
-
```bicep
|
|
41
|
-
// infra/main.bicep
|
|
42
|
-
targetScope = 'resourceGroup'
|
|
43
|
-
|
|
44
|
-
@description('Environment name')
|
|
45
|
-
param environment string = 'dev'
|
|
46
|
-
|
|
47
|
-
@description('Location for resources')
|
|
48
|
-
param location string = resourceGroup().location
|
|
49
|
-
|
|
50
|
-
@description('Application name')
|
|
51
|
-
param appName string
|
|
52
|
-
|
|
53
|
-
// Variables
|
|
54
|
-
var resourcePrefix = '${appName}-${environment}'
|
|
55
|
-
|
|
56
|
-
// Container App Environment
|
|
57
|
-
module containerAppEnv 'modules/container-app-env.bicep' = {
|
|
58
|
-
name: 'containerAppEnv'
|
|
59
|
-
params: {
|
|
60
|
-
name: '${resourcePrefix}-env'
|
|
61
|
-
location: location
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Container App
|
|
66
|
-
module containerApp 'modules/container-app.bicep' = {
|
|
67
|
-
name: 'containerApp'
|
|
68
|
-
params: {
|
|
69
|
-
name: resourcePrefix
|
|
70
|
-
location: location
|
|
71
|
-
environmentId: containerAppEnv.outputs.id
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Recursos Recomendados por Tier
|
|
77
|
-
|
|
78
|
-
### Free Tier (Sem aprovação)
|
|
79
|
-
|
|
80
|
-
| Recurso | Config | Custo |
|
|
81
|
-
|---------|--------|-------|
|
|
82
|
-
| Azure SQL | Free 32GB | $0 |
|
|
83
|
-
| Container Apps | Scale to zero | ~$0 |
|
|
84
|
-
| Storage | LRS 5GB | ~$0 |
|
|
85
|
-
| App Insights | Free tier | $0 |
|
|
86
|
-
|
|
87
|
-
### Basic Tier (Até $10/mês)
|
|
88
|
-
|
|
89
|
-
| Recurso | Config | Custo |
|
|
90
|
-
|---------|--------|-------|
|
|
91
|
-
| Azure SQL | Basic DTU | ~$5 |
|
|
92
|
-
| Service Bus | Basic | ~$0.05 |
|
|
93
|
-
| Key Vault | Standard | ~$0.03 |
|
|
94
|
-
|
|
95
|
-
## Comandos de Deploy
|
|
96
|
-
|
|
97
|
-
```powershell
|
|
98
|
-
# Criar resource group
|
|
99
|
-
az group create --name rg-{app}-{env} --location brazilsouth
|
|
100
|
-
|
|
101
|
-
# Deploy com Bicep
|
|
102
|
-
az deployment group create \
|
|
103
|
-
--resource-group rg-{app}-{env} \
|
|
104
|
-
--template-file infra/main.bicep \
|
|
105
|
-
--parameters @infra/parameters.{env}.json
|
|
106
|
-
|
|
107
|
-
# Validar antes de deploy
|
|
108
|
-
az deployment group what-if \
|
|
109
|
-
--resource-group rg-{app}-{env} \
|
|
110
|
-
--template-file infra/main.bicep \
|
|
111
|
-
--parameters @infra/parameters.{env}.json
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## Quando usar SDK .NET vs Bicep
|
|
115
|
-
|
|
116
|
-
| Recurso | Abordagem | Motivo |
|
|
117
|
-
|---------|-----------|--------|
|
|
118
|
-
| SQL, Storage, Container Apps | Bicep | Infra estática, declarativa |
|
|
119
|
-
| Azure AI, Fabric | SDK .NET | Recursos dinâmicos, runtime |
|
|
120
|
-
| Secrets | Key Vault + Bicep | Segurança |
|
|
121
|
-
|
|
122
|
-
## Documentação de Referência
|
|
123
|
-
|
|
124
|
-
- [Azure Bicep](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/)
|
|
125
|
-
- [Container Apps](https://learn.microsoft.com/en-us/azure/container-apps/)
|
|
126
|
-
- [Azure SQL](https://learn.microsoft.com/en-us/azure/azure-sql/)
|
|
127
|
-
- [Azure SDK for .NET](https://learn.microsoft.com/en-us/dotnet/azure/)
|
|
128
|
-
- [Pricing Calculator](https://azure.microsoft.com/en-us/pricing/calculator/)
|
|
129
|
-
|
|
130
|
-
## Checklist de Infraestrutura
|
|
131
|
-
|
|
132
|
-
- [ ] Bicep válido (`az bicep build`)
|
|
133
|
-
- [ ] Parâmetros para dev e prod
|
|
134
|
-
- [ ] Custos estimados e documentados
|
|
135
|
-
- [ ] Secrets no Key Vault (não hardcoded)
|
|
136
|
-
- [ ] Logs configurados (App Insights)
|
|
137
|
-
- [ ] Scale-to-zero onde possível
|
|
138
|
-
- [ ] Naming convention consistente
|
|
139
|
-
|
|
140
|
-
---
|
|
141
|
-
|
|
142
|
-
*MORPH-SPEC by Polymorphism Tech*
|
|
1
|
+
# Azure Architect
|
|
2
|
+
|
|
3
|
+
Especialista em infraestrutura Azure com foco em Infrastructure as Code (Bicep).
|
|
4
|
+
|
|
5
|
+
## Responsabilidades
|
|
6
|
+
|
|
7
|
+
1. **Desenhar infraestrutura Azure** para projetos
|
|
8
|
+
2. **Criar templates Bicep** para provisionar recursos
|
|
9
|
+
3. **Estimar custos** antes de aprovar recursos
|
|
10
|
+
4. **Garantir zero portal** - tudo via código
|
|
11
|
+
|
|
12
|
+
## Triggers
|
|
13
|
+
|
|
14
|
+
Ativado automaticamente em todo projeto MORPH-SPEC (Core Agent).
|
|
15
|
+
|
|
16
|
+
Keywords: `azure`, `infrastructure`, `bicep`, `deploy`, `container apps`, `sql`, `storage`, `provision`
|
|
17
|
+
|
|
18
|
+
## Princípio: Zero Portal
|
|
19
|
+
|
|
20
|
+
> **NUNCA** criar recursos Azure manualmente no portal. Tudo via Bicep.
|
|
21
|
+
|
|
22
|
+
## Estrutura IaC
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
infra/
|
|
26
|
+
├── main.bicep # Entry point
|
|
27
|
+
├── parameters.dev.json # Ambiente dev
|
|
28
|
+
├── parameters.prod.json # Ambiente prod
|
|
29
|
+
└── modules/
|
|
30
|
+
├── container-app.bicep # Container Apps
|
|
31
|
+
├── sql-database.bicep # Azure SQL
|
|
32
|
+
├── storage.bicep # Storage Account
|
|
33
|
+
├── key-vault.bicep # Key Vault
|
|
34
|
+
├── app-insights.bicep # Monitoring
|
|
35
|
+
└── service-bus.bicep # Mensageria
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Template Bicep Base
|
|
39
|
+
|
|
40
|
+
```bicep
|
|
41
|
+
// infra/main.bicep
|
|
42
|
+
targetScope = 'resourceGroup'
|
|
43
|
+
|
|
44
|
+
@description('Environment name')
|
|
45
|
+
param environment string = 'dev'
|
|
46
|
+
|
|
47
|
+
@description('Location for resources')
|
|
48
|
+
param location string = resourceGroup().location
|
|
49
|
+
|
|
50
|
+
@description('Application name')
|
|
51
|
+
param appName string
|
|
52
|
+
|
|
53
|
+
// Variables
|
|
54
|
+
var resourcePrefix = '${appName}-${environment}'
|
|
55
|
+
|
|
56
|
+
// Container App Environment
|
|
57
|
+
module containerAppEnv 'modules/container-app-env.bicep' = {
|
|
58
|
+
name: 'containerAppEnv'
|
|
59
|
+
params: {
|
|
60
|
+
name: '${resourcePrefix}-env'
|
|
61
|
+
location: location
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Container App
|
|
66
|
+
module containerApp 'modules/container-app.bicep' = {
|
|
67
|
+
name: 'containerApp'
|
|
68
|
+
params: {
|
|
69
|
+
name: resourcePrefix
|
|
70
|
+
location: location
|
|
71
|
+
environmentId: containerAppEnv.outputs.id
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Recursos Recomendados por Tier
|
|
77
|
+
|
|
78
|
+
### Free Tier (Sem aprovação)
|
|
79
|
+
|
|
80
|
+
| Recurso | Config | Custo |
|
|
81
|
+
|---------|--------|-------|
|
|
82
|
+
| Azure SQL | Free 32GB | $0 |
|
|
83
|
+
| Container Apps | Scale to zero | ~$0 |
|
|
84
|
+
| Storage | LRS 5GB | ~$0 |
|
|
85
|
+
| App Insights | Free tier | $0 |
|
|
86
|
+
|
|
87
|
+
### Basic Tier (Até $10/mês)
|
|
88
|
+
|
|
89
|
+
| Recurso | Config | Custo |
|
|
90
|
+
|---------|--------|-------|
|
|
91
|
+
| Azure SQL | Basic DTU | ~$5 |
|
|
92
|
+
| Service Bus | Basic | ~$0.05 |
|
|
93
|
+
| Key Vault | Standard | ~$0.03 |
|
|
94
|
+
|
|
95
|
+
## Comandos de Deploy
|
|
96
|
+
|
|
97
|
+
```powershell
|
|
98
|
+
# Criar resource group
|
|
99
|
+
az group create --name rg-{app}-{env} --location brazilsouth
|
|
100
|
+
|
|
101
|
+
# Deploy com Bicep
|
|
102
|
+
az deployment group create \
|
|
103
|
+
--resource-group rg-{app}-{env} \
|
|
104
|
+
--template-file infra/main.bicep \
|
|
105
|
+
--parameters @infra/parameters.{env}.json
|
|
106
|
+
|
|
107
|
+
# Validar antes de deploy
|
|
108
|
+
az deployment group what-if \
|
|
109
|
+
--resource-group rg-{app}-{env} \
|
|
110
|
+
--template-file infra/main.bicep \
|
|
111
|
+
--parameters @infra/parameters.{env}.json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Quando usar SDK .NET vs Bicep
|
|
115
|
+
|
|
116
|
+
| Recurso | Abordagem | Motivo |
|
|
117
|
+
|---------|-----------|--------|
|
|
118
|
+
| SQL, Storage, Container Apps | Bicep | Infra estática, declarativa |
|
|
119
|
+
| Azure AI, Fabric | SDK .NET | Recursos dinâmicos, runtime |
|
|
120
|
+
| Secrets | Key Vault + Bicep | Segurança |
|
|
121
|
+
|
|
122
|
+
## Documentação de Referência
|
|
123
|
+
|
|
124
|
+
- [Azure Bicep](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/)
|
|
125
|
+
- [Container Apps](https://learn.microsoft.com/en-us/azure/container-apps/)
|
|
126
|
+
- [Azure SQL](https://learn.microsoft.com/en-us/azure/azure-sql/)
|
|
127
|
+
- [Azure SDK for .NET](https://learn.microsoft.com/en-us/dotnet/azure/)
|
|
128
|
+
- [Pricing Calculator](https://azure.microsoft.com/en-us/pricing/calculator/)
|
|
129
|
+
|
|
130
|
+
## Checklist de Infraestrutura
|
|
131
|
+
|
|
132
|
+
- [ ] Bicep válido (`az bicep build`)
|
|
133
|
+
- [ ] Parâmetros para dev e prod
|
|
134
|
+
- [ ] Custos estimados e documentados
|
|
135
|
+
- [ ] Secrets no Key Vault (não hardcoded)
|
|
136
|
+
- [ ] Logs configurados (App Insights)
|
|
137
|
+
- [ ] Scale-to-zero onde possível
|
|
138
|
+
- [ ] Naming convention consistente
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
*MORPH-SPEC by Polymorphism Tech*
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Bicep Architect
|
|
2
|
+
|
|
3
|
+
> **Layer:** 2 | **Load:** on-keyword | **Keywords:** bicep, iac, infrastructure as code, provision, azure resource, deploy
|
|
4
|
+
|
|
5
|
+
Especialista em Infrastructure as Code com Azure Bicep. **Zero Portal** — all infra via code.
|
|
6
|
+
|
|
7
|
+
## Structure
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
infra/
|
|
11
|
+
├── main.bicep # Entry point
|
|
12
|
+
├── main.bicepparam # Parameters (alt to JSON)
|
|
13
|
+
├── parameters.dev.json
|
|
14
|
+
├── parameters.prod.json
|
|
15
|
+
└── modules/
|
|
16
|
+
├── container-app.bicep
|
|
17
|
+
├── container-app-env.bicep
|
|
18
|
+
├── sql-database.bicep
|
|
19
|
+
├── storage.bicep
|
|
20
|
+
├── key-vault.bicep
|
|
21
|
+
├── app-insights.bicep
|
|
22
|
+
├── service-bus.bicep
|
|
23
|
+
└── redis-cache.bicep
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Main Template Pattern
|
|
27
|
+
|
|
28
|
+
```bicep
|
|
29
|
+
targetScope = 'resourceGroup'
|
|
30
|
+
|
|
31
|
+
@allowed(['dev', 'staging', 'prod'])
|
|
32
|
+
param environment string = 'dev'
|
|
33
|
+
param location string = resourceGroup().location
|
|
34
|
+
@minLength(3) @maxLength(20) param appName string
|
|
35
|
+
@secure() param sqlAdminPassword string
|
|
36
|
+
|
|
37
|
+
var resourcePrefix = '${appName}-${environment}'
|
|
38
|
+
var tags = { environment: environment, application: appName, managedBy: 'bicep' }
|
|
39
|
+
|
|
40
|
+
resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
|
|
41
|
+
name: '${resourcePrefix}-logs'
|
|
42
|
+
location: location
|
|
43
|
+
tags: tags
|
|
44
|
+
properties: { sku: { name: 'PerGB2018' }, retentionInDays: 30 }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module appInsights 'modules/app-insights.bicep' = { name: 'appInsights', params: { ... } }
|
|
48
|
+
module containerAppEnv 'modules/container-app-env.bicep' = { name: 'env', params: { ... } }
|
|
49
|
+
module containerApp 'modules/container-app.bicep' = { name: 'app', params: { ... } }
|
|
50
|
+
module sqlDatabase 'modules/sql-database.bicep' = { name: 'sql', params: { ... } }
|
|
51
|
+
module keyVault 'modules/key-vault.bicep' = { name: 'kv', params: { ... } }
|
|
52
|
+
|
|
53
|
+
output containerAppUrl string = containerApp.outputs.url
|
|
54
|
+
output sqlConnectionString string = sqlDatabase.outputs.connectionString
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## SQL Database Module (Free Tier)
|
|
58
|
+
|
|
59
|
+
```bicep
|
|
60
|
+
// modules/sql-database.bicep
|
|
61
|
+
param serverName string
|
|
62
|
+
param databaseName string
|
|
63
|
+
param location string
|
|
64
|
+
param tags object = {}
|
|
65
|
+
param adminUsername string = 'sqladmin'
|
|
66
|
+
@secure() param adminPassword string
|
|
67
|
+
param useFree bool = true
|
|
68
|
+
|
|
69
|
+
resource sqlServer 'Microsoft.Sql/servers@2023-05-01-preview' = {
|
|
70
|
+
name: serverName
|
|
71
|
+
location: location
|
|
72
|
+
tags: tags
|
|
73
|
+
properties: { administratorLogin: adminUsername, administratorLoginPassword: adminPassword,
|
|
74
|
+
version: '12.0', minimalTlsVersion: '1.2', publicNetworkAccess: 'Enabled' }
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
resource db 'Microsoft.Sql/servers/databases@2023-05-01-preview' = {
|
|
78
|
+
parent: sqlServer
|
|
79
|
+
name: databaseName
|
|
80
|
+
location: location
|
|
81
|
+
sku: useFree ? { name: 'Free', tier: 'Free' } : { name: 'Basic', tier: 'Basic' }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
resource firewall 'Microsoft.Sql/servers/firewallRules@2023-05-01-preview' = {
|
|
85
|
+
parent: sqlServer
|
|
86
|
+
name: 'AllowAllAzureIps'
|
|
87
|
+
properties: { startIpAddress: '0.0.0.0', endIpAddress: '0.0.0.0' }
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
> **Container App module:** See `container-specialist.md` for full Container App + ACR Bicep.
|
|
92
|
+
|
|
93
|
+
## Commands
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
az bicep build --file infra/main.bicep # Validate
|
|
97
|
+
az deployment group what-if -g rg-app-dev -f infra/main.bicep -p @infra/parameters.dev.json # Preview
|
|
98
|
+
az deployment group create -g rg-app-dev -f infra/main.bicep -p @infra/parameters.dev.json # Deploy
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Parameters File
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
|
|
106
|
+
"contentVersion": "1.0.0.0",
|
|
107
|
+
"parameters": {
|
|
108
|
+
"environment": { "value": "dev" },
|
|
109
|
+
"appName": { "value": "myapp" },
|
|
110
|
+
"sqlAdminPassword": { "reference": { "keyVault": { "id": "/subscriptions/.../vaults/{kv}" }, "secretName": "sql-admin-password" } }
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Checklist
|
|
116
|
+
- [ ] Bicep valid (`az bicep build`)
|
|
117
|
+
- [ ] Modules for reusable resources
|
|
118
|
+
- [ ] Parameters for dev and prod
|
|
119
|
+
- [ ] Secrets referenced from Key Vault
|
|
120
|
+
- [ ] Tags on all resources
|
|
121
|
+
- [ ] What-if executed before deploy
|
|
122
|
+
- [ ] Outputs for important values
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
*MORPH-SPEC by Polymorphism Tech*
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Container Specialist
|
|
2
|
+
|
|
3
|
+
> **Layer:** 2 | **Load:** on-keyword | **Keywords:** docker, container, containerize, container apps, acr, registry, image
|
|
4
|
+
|
|
5
|
+
Especialista em containerização com Docker e deploy para Azure Container Apps.
|
|
6
|
+
|
|
7
|
+
## Dockerfile (.NET Multi-stage)
|
|
8
|
+
|
|
9
|
+
```dockerfile
|
|
10
|
+
FROM mcr.microsoft.com/dotnet/sdk:10.0-alpine AS build
|
|
11
|
+
WORKDIR /src
|
|
12
|
+
COPY ["src/Web/Web.csproj", "src/Web/"]
|
|
13
|
+
COPY ["src/Application/Application.csproj", "src/Application/"]
|
|
14
|
+
COPY ["src/Domain/Domain.csproj", "src/Domain/"]
|
|
15
|
+
COPY ["src/Infrastructure/Infrastructure.csproj", "src/Infrastructure/"]
|
|
16
|
+
RUN dotnet restore "src/Web/Web.csproj"
|
|
17
|
+
COPY . .
|
|
18
|
+
WORKDIR "/src/src/Web"
|
|
19
|
+
RUN dotnet publish "Web.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
|
20
|
+
|
|
21
|
+
FROM mcr.microsoft.com/dotnet/aspnet:10.0-alpine AS final
|
|
22
|
+
WORKDIR /app
|
|
23
|
+
RUN addgroup -g 1000 appgroup && adduser -u 1000 -G appgroup -D appuser
|
|
24
|
+
COPY --from=publish /app/publish .
|
|
25
|
+
RUN chown -R appuser:appgroup /app
|
|
26
|
+
USER appuser
|
|
27
|
+
EXPOSE 8080
|
|
28
|
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
29
|
+
CMD wget --quiet --tries=1 --spider http://localhost:8080/health || exit 1
|
|
30
|
+
ENTRYPOINT ["dotnet", "Web.dll"]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Image Sizes
|
|
34
|
+
| Base Image | Size |
|
|
35
|
+
|------------|------|
|
|
36
|
+
| `aspnet:10.0` | ~220MB |
|
|
37
|
+
| `aspnet:10.0-alpine` | ~110MB |
|
|
38
|
+
| `aspnet:10.0-chiseled` | ~80MB (most secure) |
|
|
39
|
+
|
|
40
|
+
## ACR (Azure Container Registry)
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
az acr create -g rg-myapp -n myappacr --sku Basic
|
|
44
|
+
az acr login -n myappacr
|
|
45
|
+
az acr build --registry myappacr --image myapp:v1 .
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Container App (Bicep)
|
|
49
|
+
|
|
50
|
+
```bicep
|
|
51
|
+
param name string
|
|
52
|
+
param location string
|
|
53
|
+
param tags object = {}
|
|
54
|
+
param environmentId string
|
|
55
|
+
param containerImage string
|
|
56
|
+
param registryServer string
|
|
57
|
+
param registryUsername string
|
|
58
|
+
@secure() param registryPassword string
|
|
59
|
+
|
|
60
|
+
resource containerApp 'Microsoft.App/containerApps@2023-05-01' = {
|
|
61
|
+
name: name
|
|
62
|
+
location: location
|
|
63
|
+
tags: tags
|
|
64
|
+
properties: {
|
|
65
|
+
managedEnvironmentId: environmentId
|
|
66
|
+
configuration: {
|
|
67
|
+
ingress: { external: true, targetPort: 8080, transport: 'http', allowInsecure: false }
|
|
68
|
+
registries: [{ server: registryServer, username: registryUsername, passwordSecretRef: 'reg-pwd' }]
|
|
69
|
+
secrets: [{ name: 'reg-pwd', value: registryPassword }]
|
|
70
|
+
}
|
|
71
|
+
template: {
|
|
72
|
+
containers: [{
|
|
73
|
+
name: name, image: containerImage
|
|
74
|
+
resources: { cpu: json('0.25'), memory: '0.5Gi' }
|
|
75
|
+
probes: [
|
|
76
|
+
{ type: 'Liveness', httpGet: { path: '/health', port: 8080 }, initialDelaySeconds: 10 }
|
|
77
|
+
{ type: 'Readiness', httpGet: { path: '/health/ready', port: 8080 }, initialDelaySeconds: 5 }
|
|
78
|
+
]
|
|
79
|
+
}]
|
|
80
|
+
scale: { minReplicas: 0, maxReplicas: 5
|
|
81
|
+
rules: [{ name: 'http-scale', http: { metadata: { concurrentRequests: '100' } } }]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
output url string = 'https://${containerApp.properties.configuration.ingress.fqdn}'
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Health Checks (ASP.NET)
|
|
90
|
+
|
|
91
|
+
```csharp
|
|
92
|
+
builder.Services.AddHealthChecks()
|
|
93
|
+
.AddSqlServer(connString, name: "database", tags: new[] { "ready" });
|
|
94
|
+
|
|
95
|
+
app.MapHealthChecks("/health");
|
|
96
|
+
app.MapHealthChecks("/health/ready", new() { Predicate = c => c.Tags.Contains("ready") });
|
|
97
|
+
app.MapHealthChecks("/health/live", new() { Predicate = _ => false }); // Always healthy
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Docker Compose (Dev)
|
|
101
|
+
|
|
102
|
+
```yaml
|
|
103
|
+
services:
|
|
104
|
+
web:
|
|
105
|
+
build: { context: ., dockerfile: Dockerfile }
|
|
106
|
+
ports: ["8080:8080"]
|
|
107
|
+
environment:
|
|
108
|
+
- ConnectionStrings__Default=Server=db;Database=App;User=sa;Password=Pass!;TrustServerCertificate=true
|
|
109
|
+
depends_on: { db: { condition: service_healthy } }
|
|
110
|
+
db:
|
|
111
|
+
image: mcr.microsoft.com/mssql/server:2022-latest
|
|
112
|
+
environment: [ACCEPT_EULA=Y, SA_PASSWORD=YourStrong!Passw0rd]
|
|
113
|
+
ports: ["1433:1433"]
|
|
114
|
+
volumes: [sqldata:/var/opt/mssql]
|
|
115
|
+
volumes:
|
|
116
|
+
sqldata:
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Checklist
|
|
120
|
+
- [ ] Dockerfile multi-stage with alpine/chiseled
|
|
121
|
+
- [ ] .dockerignore configured
|
|
122
|
+
- [ ] Non-root user in container
|
|
123
|
+
- [ ] Health checks (liveness + readiness)
|
|
124
|
+
- [ ] Docker Compose for dev
|
|
125
|
+
- [ ] ACR created and configured
|
|
126
|
+
- [ ] Container App with scale-to-zero
|
|
127
|
+
- [ ] Probes configured
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
*MORPH-SPEC by Polymorphism Tech*
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# DevOps Engineer
|
|
2
|
+
|
|
3
|
+
> **Layer:** 2 | **Load:** on-keyword | **Keywords:** pipeline, ci/cd, deploy, release, azure devops, github actions, build, automation
|
|
4
|
+
|
|
5
|
+
Especialista em CI/CD, pipelines e automação de deploy.
|
|
6
|
+
|
|
7
|
+
## Azure Pipelines
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
trigger:
|
|
11
|
+
branches: { include: [main, develop] }
|
|
12
|
+
paths: { exclude: ['**/*.md'] }
|
|
13
|
+
|
|
14
|
+
variables:
|
|
15
|
+
buildConfiguration: 'Release'
|
|
16
|
+
dotnetVersion: '10.0.x'
|
|
17
|
+
|
|
18
|
+
stages:
|
|
19
|
+
- stage: Build
|
|
20
|
+
jobs:
|
|
21
|
+
- job: BuildJob
|
|
22
|
+
pool: { vmImage: 'ubuntu-latest' }
|
|
23
|
+
steps:
|
|
24
|
+
- task: UseDotNet@2
|
|
25
|
+
inputs: { version: '$(dotnetVersion)' }
|
|
26
|
+
- task: DotNetCoreCLI@2
|
|
27
|
+
displayName: 'Restore'
|
|
28
|
+
inputs: { command: 'restore', projects: '**/*.csproj' }
|
|
29
|
+
- task: DotNetCoreCLI@2
|
|
30
|
+
displayName: 'Build'
|
|
31
|
+
inputs: { command: 'build', arguments: '-c $(buildConfiguration) --no-restore' }
|
|
32
|
+
- task: DotNetCoreCLI@2
|
|
33
|
+
displayName: 'Test'
|
|
34
|
+
inputs: { command: 'test', projects: '**/tests/**/*.csproj', arguments: '--collect:"XPlat Code Coverage"' }
|
|
35
|
+
- task: DotNetCoreCLI@2
|
|
36
|
+
displayName: 'Publish'
|
|
37
|
+
inputs: { command: 'publish', publishWebProjects: true, arguments: '-c $(buildConfiguration) -o $(Build.ArtifactStagingDirectory)' }
|
|
38
|
+
- task: PublishBuildArtifacts@1
|
|
39
|
+
inputs: { pathToPublish: '$(Build.ArtifactStagingDirectory)', artifactName: 'drop' }
|
|
40
|
+
|
|
41
|
+
- stage: DeployDev
|
|
42
|
+
dependsOn: Build
|
|
43
|
+
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))
|
|
44
|
+
jobs:
|
|
45
|
+
- deployment: Deploy
|
|
46
|
+
environment: 'development'
|
|
47
|
+
strategy:
|
|
48
|
+
runOnce:
|
|
49
|
+
deploy:
|
|
50
|
+
steps:
|
|
51
|
+
- task: AzureCLI@2
|
|
52
|
+
inputs:
|
|
53
|
+
scriptType: 'bash'
|
|
54
|
+
inlineScript: 'az containerapp update --name app-dev -g rg-dev --image $(image)'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## GitHub Actions
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
name: CI/CD
|
|
61
|
+
on:
|
|
62
|
+
push: { branches: [main, develop] }
|
|
63
|
+
pull_request: { branches: [main] }
|
|
64
|
+
|
|
65
|
+
jobs:
|
|
66
|
+
build:
|
|
67
|
+
runs-on: ubuntu-latest
|
|
68
|
+
steps:
|
|
69
|
+
- uses: actions/checkout@v4
|
|
70
|
+
- uses: actions/setup-dotnet@v4
|
|
71
|
+
with: { dotnet-version: '10.0.x' }
|
|
72
|
+
- run: dotnet restore && dotnet build -c Release --no-restore && dotnet test -c Release --no-build
|
|
73
|
+
- run: dotnet publish src/Web/Web.csproj -c Release -o ./publish
|
|
74
|
+
|
|
75
|
+
docker:
|
|
76
|
+
needs: build
|
|
77
|
+
if: github.event_name == 'push'
|
|
78
|
+
runs-on: ubuntu-latest
|
|
79
|
+
permissions: { contents: read, packages: write }
|
|
80
|
+
steps:
|
|
81
|
+
- uses: actions/checkout@v4
|
|
82
|
+
- uses: docker/login-action@v3
|
|
83
|
+
with: { registry: ghcr.io, username: '${{ github.actor }}', password: '${{ secrets.GITHUB_TOKEN }}' }
|
|
84
|
+
- uses: docker/build-push-action@v5
|
|
85
|
+
with: { push: true, tags: 'ghcr.io/${{ github.repository }}:${{ github.sha }}' }
|
|
86
|
+
|
|
87
|
+
deploy:
|
|
88
|
+
needs: docker
|
|
89
|
+
if: github.ref == 'refs/heads/main'
|
|
90
|
+
runs-on: ubuntu-latest
|
|
91
|
+
environment: production
|
|
92
|
+
steps:
|
|
93
|
+
- uses: azure/login@v2
|
|
94
|
+
with: { creds: '${{ secrets.AZURE_CREDENTIALS }}' }
|
|
95
|
+
- uses: azure/container-apps-deploy-action@v1
|
|
96
|
+
with: { resourceGroup: rg-prod, containerAppName: app-prod, imageToDeploy: 'ghcr.io/${{ github.repository }}:${{ github.sha }}' }
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
> **Dockerfile:** See `container-specialist.md` for optimized multi-stage Dockerfile.
|
|
100
|
+
|
|
101
|
+
## Secrets Management
|
|
102
|
+
|
|
103
|
+
| Platform | Method |
|
|
104
|
+
|----------|--------|
|
|
105
|
+
| Azure DevOps | Variable Groups + Key Vault references |
|
|
106
|
+
| GitHub Actions | Repository/Environment Secrets |
|
|
107
|
+
|
|
108
|
+
## Checklist
|
|
109
|
+
- [ ] Trigger configured (branches, paths)
|
|
110
|
+
- [ ] Build: restore, build, test, publish
|
|
111
|
+
- [ ] Code coverage published
|
|
112
|
+
- [ ] Deploy to dev automatic (develop branch)
|
|
113
|
+
- [ ] Deploy to prod with approval (main branch)
|
|
114
|
+
- [ ] Secrets in Key Vault or variable groups
|
|
115
|
+
- [ ] Health check after deploy
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
*MORPH-SPEC by Polymorphism Tech*
|