@polymorphism-tech/morph-spec 1.0.4 → 2.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 (152) hide show
  1. package/CLAUDE.md +1381 -0
  2. package/LICENSE +72 -0
  3. package/README.md +89 -6
  4. package/bin/detect-agents.js +225 -0
  5. package/bin/morph-spec.js +120 -0
  6. package/bin/render-template.js +302 -0
  7. package/bin/semantic-detect-agents.js +246 -0
  8. package/bin/validate-agents-skills.js +239 -0
  9. package/bin/validate-agents.js +69 -0
  10. package/bin/validate-phase.js +263 -0
  11. package/content/.azure/README.md +293 -0
  12. package/content/.azure/docs/azure-devops-setup.md +454 -0
  13. package/content/.azure/docs/branch-strategy.md +398 -0
  14. package/content/.azure/docs/local-development.md +515 -0
  15. package/content/.azure/pipelines/pipeline-variables.yml +34 -0
  16. package/content/.azure/pipelines/prod-pipeline.yml +319 -0
  17. package/content/.azure/pipelines/staging-pipeline.yml +234 -0
  18. package/content/.azure/pipelines/templates/build-dotnet.yml +75 -0
  19. package/content/.azure/pipelines/templates/deploy-app-service.yml +94 -0
  20. package/content/.azure/pipelines/templates/deploy-container-app.yml +120 -0
  21. package/content/.azure/pipelines/templates/infra-deploy.yml +90 -0
  22. package/content/.claude/commands/morph-apply.md +118 -26
  23. package/content/.claude/commands/morph-archive.md +9 -9
  24. package/content/.claude/commands/morph-clarify.md +184 -0
  25. package/content/.claude/commands/morph-design.md +275 -0
  26. package/content/.claude/commands/morph-proposal.md +56 -15
  27. package/content/.claude/commands/morph-setup.md +100 -0
  28. package/content/.claude/commands/morph-status.md +47 -32
  29. package/content/.claude/commands/morph-tasks.md +319 -0
  30. package/content/.claude/commands/morph-uiux.md +211 -0
  31. package/content/.claude/skills/specialists/ai-system-architect.md +604 -0
  32. package/content/.claude/skills/specialists/ms-agent-expert.md +143 -89
  33. package/content/.claude/skills/specialists/ui-ux-designer.md +744 -9
  34. package/content/.claude/skills/stacks/dotnet-blazor.md +244 -8
  35. package/content/.claude/skills/stacks/dotnet-nextjs.md +2 -2
  36. package/content/.morph/.morphversion +5 -0
  37. package/content/.morph/config/agents.json +101 -8
  38. package/content/.morph/config/azure-pricing.json +70 -0
  39. package/content/.morph/config/azure-pricing.schema.json +50 -0
  40. package/content/.morph/config/config.template.json +15 -3
  41. package/content/.morph/docs/STORY-DRIVEN-DEVELOPMENT.md +392 -0
  42. package/content/.morph/hooks/README.md +239 -0
  43. package/content/.morph/hooks/pre-commit-agents.sh +24 -0
  44. package/content/.morph/hooks/pre-commit-all.sh +48 -0
  45. package/content/.morph/hooks/pre-commit-costs.sh +91 -0
  46. package/content/.morph/hooks/pre-commit-specs.sh +49 -0
  47. package/content/.morph/hooks/pre-commit-tests.sh +60 -0
  48. package/content/.morph/project.md +5 -4
  49. package/content/.morph/schemas/agent.schema.json +296 -0
  50. package/content/.morph/standards/agent-framework-setup.md +453 -0
  51. package/content/.morph/standards/architecture.md +142 -7
  52. package/content/.morph/standards/azure.md +218 -23
  53. package/content/.morph/standards/coding.md +47 -12
  54. package/content/.morph/standards/dotnet10-migration.md +494 -0
  55. package/content/.morph/standards/fluent-ui-setup.md +590 -0
  56. package/content/.morph/standards/migration-guide.md +514 -0
  57. package/content/.morph/standards/passkeys-auth.md +423 -0
  58. package/content/.morph/standards/vector-search-rag.md +536 -0
  59. package/content/.morph/state.json +18 -0
  60. package/content/.morph/templates/FluentDesignTheme.cs +149 -0
  61. package/content/.morph/templates/MudTheme.cs +281 -0
  62. package/content/.morph/templates/contracts.cs +55 -55
  63. package/content/.morph/templates/decisions.md +4 -4
  64. package/content/.morph/templates/design-system.css +226 -0
  65. package/content/.morph/templates/infra/.dockerignore.example +89 -0
  66. package/content/.morph/templates/infra/Dockerfile.example +82 -0
  67. package/content/.morph/templates/infra/README.md +286 -0
  68. package/content/.morph/templates/infra/app-service.bicep +164 -0
  69. package/content/.morph/templates/infra/deploy.ps1 +229 -0
  70. package/content/.morph/templates/infra/deploy.sh +208 -0
  71. package/content/.morph/templates/infra/main.bicep +41 -7
  72. package/content/.morph/templates/infra/parameters.dev.json +6 -0
  73. package/content/.morph/templates/infra/parameters.prod.json +6 -0
  74. package/content/.morph/templates/infra/parameters.staging.json +29 -0
  75. package/content/.morph/templates/proposal.md +3 -3
  76. package/content/.morph/templates/recap.md +3 -3
  77. package/content/.morph/templates/spec.md +9 -8
  78. package/content/.morph/templates/sprint-status.yaml +68 -0
  79. package/content/.morph/templates/state.template.json +222 -0
  80. package/content/.morph/templates/story.md +143 -0
  81. package/content/.morph/templates/tasks.md +1 -1
  82. package/content/.morph/templates/ui-components.md +276 -0
  83. package/content/.morph/templates/ui-design-system.md +286 -0
  84. package/content/.morph/templates/ui-flows.md +336 -0
  85. package/content/.morph/templates/ui-mockups.md +133 -0
  86. package/content/.morph/test-infra/example.bicep +59 -0
  87. package/content/CLAUDE.md +124 -0
  88. package/content/README.md +79 -0
  89. package/detectors/config-detector.js +223 -0
  90. package/detectors/conversation-analyzer.js +163 -0
  91. package/detectors/index.js +84 -0
  92. package/detectors/standards-generator.js +275 -0
  93. package/detectors/structure-detector.js +221 -0
  94. package/docs/README.md +149 -0
  95. package/docs/api/cost-calculator.js.html +513 -0
  96. package/docs/api/design-system-generator.js.html +382 -0
  97. package/docs/api/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  98. package/docs/api/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  99. package/docs/api/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  100. package/docs/api/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  101. package/docs/api/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  102. package/docs/api/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  103. package/docs/api/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  104. package/docs/api/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  105. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  106. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  107. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  108. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  109. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  110. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  111. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  112. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  113. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  114. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  115. package/docs/api/global.html +5263 -0
  116. package/docs/api/index.html +96 -0
  117. package/docs/api/scripts/collapse.js +39 -0
  118. package/docs/api/scripts/commonNav.js +28 -0
  119. package/docs/api/scripts/linenumber.js +25 -0
  120. package/docs/api/scripts/nav.js +12 -0
  121. package/docs/api/scripts/polyfill.js +4 -0
  122. package/docs/api/scripts/prettify/Apache-License-2.0.txt +202 -0
  123. package/docs/api/scripts/prettify/lang-css.js +2 -0
  124. package/docs/api/scripts/prettify/prettify.js +28 -0
  125. package/docs/api/scripts/search.js +99 -0
  126. package/docs/api/state-manager.js.html +423 -0
  127. package/docs/api/styles/jsdoc.css +776 -0
  128. package/docs/api/styles/prettify.css +80 -0
  129. package/docs/examples.md +328 -0
  130. package/docs/getting-started.md +302 -0
  131. package/docs/installation.md +361 -0
  132. package/docs/templates.md +418 -0
  133. package/docs/validation-checklist.md +266 -0
  134. package/package.json +39 -12
  135. package/src/commands/cost.js +181 -0
  136. package/src/commands/create-story.js +283 -0
  137. package/src/commands/detect.js +104 -0
  138. package/src/commands/doctor.js +67 -0
  139. package/src/commands/generate.js +149 -0
  140. package/src/commands/init.js +69 -45
  141. package/src/commands/shard-spec.js +224 -0
  142. package/src/commands/sprint-status.js +250 -0
  143. package/src/commands/state.js +333 -0
  144. package/src/commands/sync.js +167 -0
  145. package/src/commands/update-pricing.js +206 -0
  146. package/src/commands/update.js +88 -13
  147. package/src/lib/complexity-analyzer.js +292 -0
  148. package/src/lib/cost-calculator.js +429 -0
  149. package/src/lib/design-system-generator.js +298 -0
  150. package/src/lib/state-manager.js +340 -0
  151. package/src/utils/file-copier.js +59 -0
  152. package/src/utils/version-checker.js +175 -0
@@ -0,0 +1,398 @@
1
+ # Estratégia de Branches - MORPH-SPEC
2
+
3
+ > **Git Flow simplificado para one-person business**
4
+
5
+ ---
6
+
7
+ ## 🌳 Estrutura de Branches
8
+
9
+ ```
10
+ main/master (produção)
11
+
12
+ │ PR (com aprovação)
13
+
14
+ staging (homologação)
15
+
16
+ │ PR (automático merge)
17
+
18
+ feature/* (desenvolvimento)
19
+ ```
20
+
21
+ ###**Branches Principais**
22
+
23
+ | Branch | Propósito | Deploy | Aprovação |
24
+ |--------|-----------|--------|-----------|
25
+ | **`main`** ou **`master`** | Produção | Container Apps (always-on) | ✅ Obrigatória |
26
+ | **`staging`** | Homologação/QA | Container Apps (scale-to-zero) | ❌ Nenhuma |
27
+
28
+ ### **Branches Temporárias**
29
+
30
+ | Padrão | Exemplo | Propósito |
31
+ |--------|---------|-----------|
32
+ | `feature/*` | `feature/add-payments` | Nova funcionalidade |
33
+ | `bugfix/*` | `bugfix/fix-login` | Correção de bug |
34
+ | `hotfix/*` | `hotfix/critical-security` | Correção urgente em prod |
35
+
36
+ ---
37
+
38
+ ## 🔄 Workflow Completo
39
+
40
+ ### 1. Nova Feature
41
+
42
+ ```bash
43
+ # Atualizar staging
44
+ git checkout staging
45
+ git pull origin staging
46
+
47
+ # Criar feature branch
48
+ git checkout -b feature/pagamentos-asaas
49
+
50
+ # Desenvolver localmente
51
+ # ... code, test, commit ...
52
+
53
+ # Push
54
+ git push origin feature/pagamentos-asaas
55
+
56
+ # Criar PR para staging
57
+ ```
58
+
59
+ **Azure DevOps**:
60
+ 1. **Repos** → **Pull Requests** → **New**
61
+ 2. Source: `feature/pagamentos-asaas`
62
+ 3. Target: `staging`
63
+ 4. Title: "feat: integração com Asaas para pagamentos recorrentes"
64
+ 5. Description: Detalhar mudanças
65
+ 6. **Create**
66
+ 7. **Approve** (você mesmo) e **Complete**
67
+
68
+ **Resultado**: Pipeline staging triggado automaticamente
69
+
70
+ ---
71
+
72
+ ### 2. Bug Fix
73
+
74
+ ```bash
75
+ # Partir de staging
76
+ git checkout staging
77
+ git pull origin staging
78
+
79
+ # Criar bugfix branch
80
+ git checkout -b bugfix/corrigir-calculo-total
81
+
82
+ # Corrigir + testar
83
+ git add .
84
+ git commit -m "fix: corrige cálculo de total no carrinho"
85
+
86
+ # Push e PR para staging
87
+ git push origin bugfix/corrigir-calculo-total
88
+ ```
89
+
90
+ ---
91
+
92
+ ### 3. Hotfix (Produção)
93
+
94
+ ```bash
95
+ # Partir de main (produção)
96
+ git checkout main
97
+ git pull origin main
98
+
99
+ # Criar hotfix branch
100
+ git checkout -b hotfix/vulnerabilidade-critica
101
+
102
+ # Corrigir urgentemente
103
+ git add .
104
+ git commit -m "fix: corrige vulnerabilidade SQL injection"
105
+
106
+ # Push
107
+ git push origin hotfix/vulnerabilidade-critica
108
+
109
+ # Criar 2 PRs:
110
+ # 1. hotfix → main (deploy imediato)
111
+ # 2. hotfix → staging (manter ambientes sincronizados)
112
+ ```
113
+
114
+ **Atenção**: Hotfix é para emergências! Use com moderação.
115
+
116
+ ---
117
+
118
+ ### 4. Release (Staging → Produção)
119
+
120
+ ```bash
121
+ # Quando staging estiver estável e testado
122
+
123
+ # Criar PR no Azure DevOps:
124
+ # Source: staging
125
+ # Target: main
126
+
127
+ # Self-review checklist:
128
+ # - [ ] Funcionalidades testadas em staging
129
+ # - [ ] Performance OK
130
+ # - [ ] Sem erros nos logs
131
+ # - [ ] Migrations aplicadas
132
+ # - [ ] Documentação atualizada
133
+
134
+ # Approve e Complete
135
+ # Pipeline prod triggará
136
+ # ⏸️ Approval gate aparecerá
137
+ # Aprovar após validar deployment summary
138
+ ```
139
+
140
+ ---
141
+
142
+ ## ⚙️ Configuração Azure DevOps
143
+
144
+ ### Branch Policies (Staging)
145
+
146
+ **Repos** → **Branches** → `staging` → **Branch policies**:
147
+
148
+ ```
149
+ ✅ Require a minimum number of reviewers: 0
150
+ (você pode fazer self-merge)
151
+
152
+ ✅ Check for linked work items: Recommended
153
+ (boa prática para rastreabilidade)
154
+
155
+ ✅ Check for comment resolution: All
156
+ (resolver comentários antes de merge)
157
+
158
+ ✅ Build validation:
159
+ - Pipeline: staging-pipeline
160
+ - Trigger: Automatic
161
+ - Policy requirement: Required
162
+ ```
163
+
164
+ ### Branch Policies (Main)
165
+
166
+ **Repos** → **Branches** → `main` → **Branch policies**:
167
+
168
+ ```
169
+ ✅ Require a minimum number of reviewers: 0
170
+ (você faz self-review com approval gate no pipeline)
171
+
172
+ ✅ Check for linked work items: Required
173
+ (obrigatório para rastreabilidade)
174
+
175
+ ✅ Check for comment resolution: All
176
+
177
+ ✅ Build validation:
178
+ - Pipeline: prod-pipeline
179
+ - Trigger: Automatic
180
+ - Policy requirement: Required
181
+
182
+ ❌ Limit merge types:
183
+ ✅ Squash merge only (recomendado)
184
+ (mantém histórico limpo)
185
+ ```
186
+
187
+ ---
188
+
189
+ ## 🎯 Boas Práticas
190
+
191
+ ### Commits
192
+
193
+ ```bash
194
+ # Use Conventional Commits
195
+ feat: adiciona integração com Asaas
196
+ fix: corrige cálculo de desconto
197
+ docs: atualiza README com instruções de deploy
198
+ refactor: simplifica lógica de autenticação
199
+ test: adiciona testes para carrinho de compras
200
+ chore: atualiza dependências do projeto
201
+
202
+ # Seja descritivo no body (se necessário)
203
+ git commit -m "feat: integração Asaas" -m "
204
+ - Adiciona AsaasClient para chamadas API
205
+ - Implementa webhook para notificações
206
+ - Cria tabela Subscriptions para assinaturas
207
+ - Adiciona testes de integração
208
+ "
209
+ ```
210
+
211
+ ### Feature Branches
212
+
213
+ ```bash
214
+ # ✅ Bom
215
+ feature/add-asaas-integration
216
+ feature/user-dashboard
217
+ bugfix/fix-login-redirect
218
+
219
+ # ❌ Ruim
220
+ my-changes
221
+ temp
222
+ test
223
+ wip
224
+ ```
225
+
226
+ ### Merge vs Squash vs Rebase
227
+
228
+ **Recomendação para one-person business**: **Squash merge**
229
+
230
+ ```
231
+ # Vantagens squash:
232
+ - Histórico limpo em main/staging
233
+ - Cada merge = 1 commit = 1 feature
234
+ - Fácil reverter feature inteira
235
+ - Fácil ler changelog
236
+
237
+ # Configurar no Azure DevOps:
238
+ Branch Policies → Limit merge types → Squash merge only
239
+ ```
240
+
241
+ ---
242
+
243
+ ## 📊 Visualização do Fluxo
244
+
245
+ ```
246
+ ┌─────────────────────────────────────────────────────────┐
247
+ │ Developer Local │
248
+ │ │
249
+ │ feature/pagamentos-asaas │
250
+ │ │ │
251
+ │ ├─ commit: adiciona AsaasClient │
252
+ │ ├─ commit: implementa webhook │
253
+ │ └─ commit: adiciona testes │
254
+ └──────────────────────│──────────────────────────────────┘
255
+
256
+ │ git push
257
+ │ + PR para staging
258
+
259
+ ┌─────────────────────────────────────────────────────────┐
260
+ │ Staging Branch │
261
+ │ │
262
+ │ Squash merge │
263
+ │ └─ feat: integração completa com Asaas │
264
+ │ │
265
+ │ Pipeline staging-pipeline triggado │
266
+ │ └─ Deploy automático para staging │
267
+ └──────────────────────│──────────────────────────────────┘
268
+
269
+ │ Testes manuais OK
270
+ │ PR staging → main
271
+
272
+ ┌─────────────────────────────────────────────────────────┐
273
+ │ Main Branch (Produção) │
274
+ │ │
275
+ │ Squash merge │
276
+ │ └─ feat: integração completa com Asaas │
277
+ │ │
278
+ │ Pipeline prod-pipeline triggado │
279
+ │ ├─ Build & Security Scan │
280
+ │ ├─ ⏸️ Approval gate (você aprova) │
281
+ │ └─ Deploy para produção │
282
+ └─────────────────────────────────────────────────────────┘
283
+ ```
284
+
285
+ ---
286
+
287
+ ## 🆘 Cenários Comuns
288
+
289
+ ### Conflito de Merge
290
+
291
+ ```bash
292
+ # Atualizar feature branch com staging
293
+ git checkout feature/minha-feature
294
+ git fetch origin
295
+ git merge origin/staging
296
+
297
+ # Resolver conflitos manualmente
298
+ # Editar arquivos, escolher versão correta
299
+
300
+ git add .
301
+ git commit -m "merge: resolve conflitos com staging"
302
+ git push origin feature/minha-feature
303
+ ```
304
+
305
+ ### Reverter um Merge
306
+
307
+ ```bash
308
+ # Se merge em staging deu problema
309
+ git checkout staging
310
+ git revert -m 1 <commit-hash-do-merge>
311
+ git push origin staging
312
+
313
+ # Pipeline triggará e deployará versão sem a feature
314
+ ```
315
+
316
+ ### Sincronizar Branch Desatualizada
317
+
318
+ ```bash
319
+ # Sua feature ficou muito desatualizada
320
+ git checkout feature/antiga
321
+ git fetch origin
322
+ git merge origin/staging
323
+
324
+ # Ou, se preferir histórico limpo (rebase)
325
+ git rebase origin/staging
326
+
327
+ # Se houver conflitos, resolve e continua
328
+ git rebase --continue
329
+
330
+ git push origin feature/antiga --force-with-lease
331
+ ```
332
+
333
+ ### Deletar Branch Remota
334
+
335
+ ```bash
336
+ # Após merge, deletar feature branch
337
+ git push origin --delete feature/minha-feature
338
+
339
+ # Deletar local também
340
+ git branch -d feature/minha-feature
341
+ ```
342
+
343
+ ---
344
+
345
+ ## 📅 Cadência Recomendada
346
+
347
+ ### Para One-Person Business
348
+
349
+ | Atividade | Frequência | Descrição |
350
+ |-----------|------------|-----------|
351
+ | **Commits** | Várias vezes/dia | Commits pequenos e frequentes |
352
+ | **Push** | 1-2x/dia | Push ao final do dia ou feature completa |
353
+ | **PR → Staging** | 1-3x/semana | Quando feature está funcional |
354
+ | **Deploy Staging** | Automático | Após merge no staging |
355
+ | **PR → Prod** | 1x/semana ou quinzenal | Quando staging está estável |
356
+ | **Deploy Prod** | Conforme necessário | Após aprovação manual |
357
+
358
+ **Dica**: Não acumule muitas features antes de fazer release. Releases pequenos e frequentes são mais seguros.
359
+
360
+ ---
361
+
362
+ ## ✅ Checklist de PR
363
+
364
+ ### Antes de Criar PR
365
+
366
+ - [ ] Código testado localmente
367
+ - [ ] Unit tests passando (`dotnet test`)
368
+ - [ ] Sem warnings de compilação
369
+ - [ ] Código formatado/lint OK
370
+ - [ ] Commits com mensagens descritivas
371
+ - [ ] Branch atualizada com target (staging ou main)
372
+
373
+ ### Ao Criar PR
374
+
375
+ - [ ] Título descritivo (feat/fix/docs/etc)
376
+ - [ ] Descrição clara do que mudou
377
+ - [ ] Linkar work item se houver
378
+ - [ ] Adicionar screenshots se for UI
379
+
380
+ ### Antes de Aprovar (Self-Review)
381
+
382
+ - [ ] Revisar diff completo
383
+ - [ ] Verificar se não commitou secrets/senhas
384
+ - [ ] Verificar se não tem console.log/debug temporário
385
+ - [ ] Pipeline de build passou
386
+ - [ ] Sem conflitos
387
+
388
+ ---
389
+
390
+ ## 📚 Referências
391
+
392
+ - [Git Flow](https://nvie.com/posts/a-successful-git-branching-model/)
393
+ - [Conventional Commits](https://www.conventionalcommits.org/)
394
+ - [Azure Repos Branch Policies](https://learn.microsoft.com/azure/devops/repos/git/branch-policies)
395
+
396
+ ---
397
+
398
+ *MORPH-SPEC by Polymorphism Tech*