@polymorphism-tech/morph-spec 1.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.
Files changed (83) hide show
  1. package/README.md +279 -0
  2. package/bin/morph-spec.js +53 -0
  3. package/content/.claude/commands/morph-apply.md +66 -0
  4. package/content/.claude/commands/morph-archive.md +79 -0
  5. package/content/.claude/commands/morph-costs.md +206 -0
  6. package/content/.claude/commands/morph-infra.md +209 -0
  7. package/content/.claude/commands/morph-proposal.md +60 -0
  8. package/content/.claude/commands/morph-status.md +71 -0
  9. package/content/.claude/settings.local.json +15 -0
  10. package/content/.claude/skills/infra/bicep-architect.md +419 -0
  11. package/content/.claude/skills/infra/container-specialist.md +437 -0
  12. package/content/.claude/skills/infra/devops-engineer.md +405 -0
  13. package/content/.claude/skills/integrations/asaas-financial.md +333 -0
  14. package/content/.claude/skills/integrations/azure-identity.md +309 -0
  15. package/content/.claude/skills/integrations/clerk-auth.md +290 -0
  16. package/content/.claude/skills/specialists/azure-architect.md +142 -0
  17. package/content/.claude/skills/specialists/cost-guardian.md +110 -0
  18. package/content/.claude/skills/specialists/ef-modeler.md +200 -0
  19. package/content/.claude/skills/specialists/hangfire-orchestrator.md +245 -0
  20. package/content/.claude/skills/specialists/ms-agent-expert.md +209 -0
  21. package/content/.claude/skills/specialists/po-pm-advisor.md +197 -0
  22. package/content/.claude/skills/specialists/standards-architect.md +78 -0
  23. package/content/.claude/skills/specialists/ui-ux-designer.md +325 -0
  24. package/content/.claude/skills/stacks/dotnet-blazor.md +352 -0
  25. package/content/.claude/skills/stacks/dotnet-nextjs.md +402 -0
  26. package/content/.claude/skills/stacks/shopify.md +445 -0
  27. package/content/.morph/archive/.gitkeep +25 -0
  28. package/content/.morph/config/agents.json +149 -0
  29. package/content/.morph/config/config.template.json +96 -0
  30. package/content/.morph/examples/api-nextjs/README.md +241 -0
  31. package/content/.morph/examples/api-nextjs/contracts.ts +307 -0
  32. package/content/.morph/examples/api-nextjs/spec.md +399 -0
  33. package/content/.morph/examples/api-nextjs/tasks.md +168 -0
  34. package/content/.morph/examples/micro-saas/README.md +125 -0
  35. package/content/.morph/examples/micro-saas/contracts.cs +358 -0
  36. package/content/.morph/examples/micro-saas/decisions.md +246 -0
  37. package/content/.morph/examples/micro-saas/spec.md +236 -0
  38. package/content/.morph/examples/micro-saas/tasks.md +150 -0
  39. package/content/.morph/examples/multi-agent/README.md +309 -0
  40. package/content/.morph/examples/multi-agent/contracts.cs +433 -0
  41. package/content/.morph/examples/multi-agent/spec.md +479 -0
  42. package/content/.morph/examples/multi-agent/tasks.md +185 -0
  43. package/content/.morph/features/.gitkeep +25 -0
  44. package/content/.morph/project.md +159 -0
  45. package/content/.morph/specs/.gitkeep +20 -0
  46. package/content/.morph/standards/architecture.md +190 -0
  47. package/content/.morph/standards/azure.md +184 -0
  48. package/content/.morph/standards/coding.md +342 -0
  49. package/content/.morph/templates/agent.cs +172 -0
  50. package/content/.morph/templates/component.razor +239 -0
  51. package/content/.morph/templates/contracts.cs +217 -0
  52. package/content/.morph/templates/decisions.md +106 -0
  53. package/content/.morph/templates/infra/app-insights.bicep +63 -0
  54. package/content/.morph/templates/infra/container-app-env.bicep +49 -0
  55. package/content/.morph/templates/infra/container-app.bicep +156 -0
  56. package/content/.morph/templates/infra/key-vault.bicep +91 -0
  57. package/content/.morph/templates/infra/main.bicep +155 -0
  58. package/content/.morph/templates/infra/parameters.dev.json +23 -0
  59. package/content/.morph/templates/infra/parameters.prod.json +23 -0
  60. package/content/.morph/templates/infra/sql-database.bicep +103 -0
  61. package/content/.morph/templates/infra/storage.bicep +106 -0
  62. package/content/.morph/templates/integrations/asaas-client.cs +387 -0
  63. package/content/.morph/templates/integrations/asaas-webhook.cs +351 -0
  64. package/content/.morph/templates/integrations/azure-identity-config.cs +288 -0
  65. package/content/.morph/templates/integrations/clerk-config.cs +258 -0
  66. package/content/.morph/templates/job.cs +171 -0
  67. package/content/.morph/templates/migration.cs +83 -0
  68. package/content/.morph/templates/proposal.md +155 -0
  69. package/content/.morph/templates/recap.md +105 -0
  70. package/content/.morph/templates/repository.cs +141 -0
  71. package/content/.morph/templates/saas/subscription.cs +347 -0
  72. package/content/.morph/templates/saas/tenant.cs +338 -0
  73. package/content/.morph/templates/service.cs +139 -0
  74. package/content/.morph/templates/spec.md +147 -0
  75. package/content/.morph/templates/tasks.md +235 -0
  76. package/content/.morph/templates/test.cs +239 -0
  77. package/content/CLAUDE.md +318 -0
  78. package/package.json +50 -0
  79. package/src/commands/doctor.js +132 -0
  80. package/src/commands/init.js +121 -0
  81. package/src/commands/update.js +84 -0
  82. package/src/utils/file-copier.js +50 -0
  83. package/src/utils/logger.js +32 -0
@@ -0,0 +1,209 @@
1
+ # /morph-infra - Infrastructure Management
2
+
3
+ Gerencia infraestrutura Azure usando Bicep templates.
4
+
5
+ ## Uso
6
+
7
+ ```
8
+ /morph-infra [action] [options]
9
+ ```
10
+
11
+ ### Actions
12
+
13
+ | Action | Descrição |
14
+ |--------|-----------|
15
+ | `init` | Inicializa estrutura IaC no projeto |
16
+ | `validate` | Valida templates Bicep |
17
+ | `plan` | Mostra what-if de mudanças |
18
+ | `deploy` | Executa deploy dos recursos |
19
+ | `destroy` | Remove todos os recursos |
20
+
21
+ ---
22
+
23
+ ## Workflow
24
+
25
+ ### 1. INIT - Inicializar IaC
26
+
27
+ Quando o usuário solicitar `/morph-infra init`:
28
+
29
+ 1. Criar estrutura `infra/` no projeto:
30
+ ```
31
+ infra/
32
+ ├── main.bicep
33
+ ├── parameters.dev.json
34
+ ├── parameters.prod.json
35
+ └── modules/
36
+ ├── container-app.bicep
37
+ ├── container-app-env.bicep
38
+ ├── sql-database.bicep
39
+ ├── storage.bicep
40
+ ├── key-vault.bicep
41
+ └── app-insights.bicep
42
+ ```
43
+
44
+ 2. Copiar templates de `.morph/templates/infra/`
45
+
46
+ 3. Substituir placeholders:
47
+ - `{{APP_NAME}}` → nome do projeto
48
+ - `{{SUBSCRIPTION_ID}}` → solicitar ao usuário
49
+ - `{{RESOURCE_GROUP}}` → sugerir padrão `rg-{app}-{env}`
50
+
51
+ 4. Documentar no `decisions.md` a estrutura criada
52
+
53
+ ---
54
+
55
+ ### 2. VALIDATE - Validar Templates
56
+
57
+ Quando o usuário solicitar `/morph-infra validate`:
58
+
59
+ 1. Executar validação Bicep:
60
+ ```bash
61
+ az bicep build --file infra/main.bicep
62
+ ```
63
+
64
+ 2. Verificar parâmetros necessários
65
+
66
+ 3. Reportar erros ou sucesso
67
+
68
+ ---
69
+
70
+ ### 3. PLAN - Preview de Mudanças
71
+
72
+ Quando o usuário solicitar `/morph-infra plan [env]`:
73
+
74
+ 1. Verificar se Azure CLI está autenticado:
75
+ ```bash
76
+ az account show
77
+ ```
78
+
79
+ 2. Executar what-if:
80
+ ```bash
81
+ az deployment group what-if \
82
+ --resource-group rg-{app}-{env} \
83
+ --template-file infra/main.bicep \
84
+ --parameters @infra/parameters.{env}.json
85
+ ```
86
+
87
+ 3. Apresentar resumo de mudanças:
88
+ - Recursos a criar
89
+ - Recursos a modificar
90
+ - Recursos a deletar
91
+ - Custos estimados
92
+
93
+ 4. ⛔ **PARE e aguarde aprovação** para deploy
94
+
95
+ ---
96
+
97
+ ### 4. DEPLOY - Executar Deploy
98
+
99
+ Quando o usuário solicitar `/morph-infra deploy [env]`:
100
+
101
+ 1. Verificar aprovação do plan
102
+
103
+ 2. Criar resource group se não existir:
104
+ ```bash
105
+ az group create --name rg-{app}-{env} --location brazilsouth
106
+ ```
107
+
108
+ 3. Executar deploy:
109
+ ```bash
110
+ az deployment group create \
111
+ --resource-group rg-{app}-{env} \
112
+ --template-file infra/main.bicep \
113
+ --parameters @infra/parameters.{env}.json
114
+ ```
115
+
116
+ 4. Capturar outputs:
117
+ - Container App URL
118
+ - SQL Connection String
119
+ - Key Vault URI
120
+
121
+ 5. Atualizar documentação com informações do deploy
122
+
123
+ ---
124
+
125
+ ### 5. DESTROY - Remover Recursos
126
+
127
+ Quando o usuário solicitar `/morph-infra destroy [env]`:
128
+
129
+ 1. ⚠️ **ALERTAR** que esta ação é irreversível
130
+
131
+ 2. Listar recursos que serão deletados
132
+
133
+ 3. ⛔ **PARE e aguarde confirmação explícita** ("sim, deletar")
134
+
135
+ 4. Executar:
136
+ ```bash
137
+ az group delete --name rg-{app}-{env} --yes --no-wait
138
+ ```
139
+
140
+ ---
141
+
142
+ ## Regras de Segurança
143
+
144
+ ### NUNCA:
145
+ - Expor secrets em logs
146
+ - Commitar arquivos com secrets
147
+ - Deletar recursos de produção sem confirmação explícita
148
+ - Criar recursos fora do Bicep (zero portal)
149
+
150
+ ### SEMPRE:
151
+ - Usar Key Vault para secrets
152
+ - Validar Bicep antes de deploy
153
+ - Executar what-if antes de deploy
154
+ - Documentar custos estimados
155
+ - Manter parameters.json separados por ambiente
156
+
157
+ ---
158
+
159
+ ## Cost Guardian Integration
160
+
161
+ Antes de qualquer deploy, verificar com Cost Guardian:
162
+
163
+ 1. Estimar custos mensais dos recursos
164
+ 2. Verificar se está dentro dos limites aprovados:
165
+ - Free tier: sem aprovação
166
+ - Até $10/mês: requer confirmação
167
+ - Acima de $10: requer ADR
168
+
169
+ ---
170
+
171
+ ## Exemplo de Uso
172
+
173
+ ```
174
+ Usuário: /morph-infra init
175
+ Claude: Criando estrutura IaC...
176
+ - infra/main.bicep
177
+ - infra/parameters.dev.json
178
+ - infra/modules/*.bicep
179
+ Pronto! Execute /morph-infra validate para verificar.
180
+
181
+ Usuário: /morph-infra plan dev
182
+ Claude: Analisando mudanças para ambiente dev...
183
+
184
+ CRIAR:
185
+ + Container App Environment
186
+ + Container App
187
+ + SQL Server (Free)
188
+ + Storage Account (LRS)
189
+ + Key Vault
190
+ + Application Insights
191
+
192
+ CUSTO ESTIMADO: ~$0/mês (Free tier)
193
+
194
+ Aprovar deploy? (sim/não)
195
+
196
+ Usuário: sim
197
+ Claude: Executando deploy...
198
+ ✓ Resource Group criado
199
+ ✓ Deploy concluído em 3m 45s
200
+
201
+ OUTPUTS:
202
+ - URL: https://myapp-dev.azurecontainerapps.io
203
+ - SQL: tcp:myapp-dev-sql.database.windows.net
204
+ - Key Vault: https://myapp-dev-kv.vault.azure.net
205
+ ```
206
+
207
+ ---
208
+
209
+ *MORPH-SPEC by Polymorphism Tech*
@@ -0,0 +1,60 @@
1
+ # Create MORPH Feature Proposal
2
+
3
+ Crie uma nova proposta de feature seguindo o workflow MORPH.
4
+
5
+ ## Contexto
6
+
7
+ Leia os seguintes arquivos para entender o projeto:
8
+ - `.morph/project.md` - Contexto e convenções do projeto
9
+ - `.morph/standards/` - Padrões técnicos
10
+ - `.morph/config/agents.json` - Agentes disponíveis
11
+
12
+ ## Workflow
13
+
14
+ 1. **Analise a solicitação** e identifique:
15
+ - Problema a resolver
16
+ - Usuários afetados
17
+ - Impacto esperado
18
+
19
+ 2. **Crie a estrutura da feature**:
20
+ ```
21
+ .morph/features/{feature-name}/
22
+ ├── proposal.md # Proposta inicial
23
+ ├── spec.md # Especificação técnica (iniciar)
24
+ └── tasks.md # Lista de tasks (iniciar)
25
+ ```
26
+
27
+ 3. **Preencha `proposal.md`** baseado em `.morph/templates/proposal.md`:
28
+ - Problem Statement
29
+ - Proposed Solution
30
+ - Success Metrics
31
+ - Scope (In/Out)
32
+ - Estimated Effort
33
+ - Cost Impact
34
+
35
+ 4. **Inicie `spec.md`** com:
36
+ - User Stories principais
37
+ - Arquitetura proposta
38
+ - Data Model inicial
39
+
40
+ 5. **Inicie `tasks.md`** com:
41
+ - Tasks de alto nível identificadas
42
+ - Checkpoints sugeridos
43
+
44
+ 6. **Ative agentes especializados** baseado nas keywords:
45
+ - ⏰ Hangfire: scheduled, job, background
46
+ - 🎨 UI/UX: wizard, dashboard, complex
47
+ - 📋 PO/PM: unclear, requirements, priority
48
+
49
+ ## Output
50
+
51
+ Ao final, apresente:
52
+ 1. Resumo da proposta
53
+ 2. Agentes ativados
54
+ 3. Custo estimado
55
+ 4. Perguntas de clarificação (se houver)
56
+ 5. Solicitar aprovação para prosseguir para DESIGN
57
+
58
+ ---
59
+
60
+ **Feature solicitada:** $ARGUMENTS
@@ -0,0 +1,71 @@
1
+ # MORPH Project Status
2
+
3
+ Mostre o status atual do projeto MORPH e features em desenvolvimento.
4
+
5
+ ## O que verificar
6
+
7
+ ### 1. Configuração MORPH
8
+ - [ ] `.morph/project.md` existe e está preenchido
9
+ - [ ] `.morph/config/config.json` configurado
10
+ - [ ] `.morph/standards/` presentes
11
+
12
+ ### 2. Features Ativas
13
+
14
+ Verifique `.morph/features/` e para cada feature:
15
+
16
+ ```
17
+ Feature: {name}
18
+ ├── Status: {Draft|In Review|Approved|In Progress|Done}
19
+ ├── Phase: {Proposal|Design|Clarify|Tasks|Implement}
20
+ ├── Progress: {X}/{Y} tasks
21
+ ├── Agents: {lista de agentes ativos}
22
+ └── Cost: ${X}/month estimated
23
+ ```
24
+
25
+ ### 3. Features Arquivadas
26
+
27
+ Verifique `.morph/archive/` e liste:
28
+ - Quantas features concluídas
29
+ - Tempo total gasto
30
+ - Custo acumulado
31
+
32
+ ### 4. Specs Ativas
33
+
34
+ Verifique `.morph/specs/` para specs consolidadas.
35
+
36
+ ## Output
37
+
38
+ Apresente um dashboard como:
39
+
40
+ ```
41
+ ╔════════════════════════════════════════════╗
42
+ ║ MORPH PROJECT STATUS ║
43
+ ╠════════════════════════════════════════════╣
44
+ ║ Project: {name} ║
45
+ ║ Type: Blazor Server ║
46
+ ╠════════════════════════════════════════════╣
47
+ ║ FEATURES IN PROGRESS ║
48
+ ╠════════════════════════════════════════════╣
49
+ ║ 📝 {feature-1} ║
50
+ ║ Phase: Implement | Tasks: 5/12 ║
51
+ ║ Agents: 📐☁️🔥🗄️💰 ║
52
+ ╠════════════════════════════════════════════╣
53
+ ║ 📝 {feature-2} ║
54
+ ║ Phase: Design | Tasks: 0/0 ║
55
+ ║ Agents: 📐☁️🔥🗄️💰⏰ ║
56
+ ╠════════════════════════════════════════════╣
57
+ ║ ARCHIVED: 3 features ║
58
+ ║ TOTAL COST: ~$12/month ║
59
+ ╚════════════════════════════════════════════╝
60
+ ```
61
+
62
+ ## Ações Disponíveis
63
+
64
+ Sugira próximas ações:
65
+ - `/morph-proposal {feature}` - Criar nova feature
66
+ - `/morph-apply {feature}` - Implementar feature
67
+ - `/morph-archive {feature}` - Arquivar feature concluída
68
+
69
+ ---
70
+
71
+ $ARGUMENTS
@@ -0,0 +1,15 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(dotnet:*)",
5
+ "Bash(git:*)",
6
+ "Read",
7
+ "Write",
8
+ "Edit",
9
+ "Glob",
10
+ "Grep"
11
+ ],
12
+ "deny": []
13
+ },
14
+ "model": "claude-sonnet-4-20250514"
15
+ }