@polymorphism-tech/morph-spec 4.6.0 → 4.7.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 (239) hide show
  1. package/README.md +394 -700
  2. package/docs/ARCHITECTURE.md +331 -0
  3. package/docs/CHEATSHEET.md +221 -0
  4. package/docs/COMMAND-FLOWS.md +368 -0
  5. package/docs/QUICKSTART.md +212 -0
  6. package/docs/examples/order-management/contracts.cs +84 -0
  7. package/docs/examples/order-management/proposal.md +24 -0
  8. package/docs/examples/order-management/spec.md +162 -0
  9. package/docs/plans/2026-02-23-ddd-architecture-refactor.md +1153 -0
  10. package/docs/plans/2026-02-23-ddd-nextsteps.md +682 -0
  11. package/docs/plans/2026-02-23-infra-architect-refactor.md +437 -0
  12. package/docs/plans/2026-02-23-nextjs-code-review-design.md +156 -0
  13. package/docs/plans/2026-02-23-nextjs-code-review-impl.md +1254 -0
  14. package/docs/plans/2026-02-23-nextjs-standards-design.md +149 -0
  15. package/docs/plans/2026-02-23-nextjs-standards-impl.md +1846 -0
  16. package/framework/agents/README.md +14 -14
  17. package/framework/agents/architecture/standards-architect.md +159 -159
  18. package/framework/agents/frontend/nextjs-expert.md +87 -127
  19. package/framework/agents/infrastructure/azure-architect.md +147 -147
  20. package/framework/agents/infrastructure/infra-architect.md +45 -0
  21. package/framework/agents.json +1145 -278
  22. package/framework/rules/frontend-standards.md +0 -3
  23. package/framework/rules/nextjs-standards.md +17 -0
  24. package/framework/skills/level-0-meta/code-review-nextjs/SKILL.md +147 -0
  25. package/framework/skills/level-0-meta/code-review-nextjs/references/review-example-nextjs.md +254 -0
  26. package/framework/skills/level-0-meta/tool-usage-guide/SKILL.md +3 -3
  27. package/framework/skills/level-1-workflows/phase-design/SKILL.md +45 -9
  28. package/framework/skills/level-1-workflows/phase-tasks/SKILL.md +38 -0
  29. package/framework/standards/STANDARDS.json +121 -0
  30. package/framework/standards/architecture/ddd/bounded-contexts.md +105 -0
  31. package/framework/standards/architecture/ddd/complexity-levels.md +108 -0
  32. package/framework/standards/architecture/ddd/ubiquitous-language.md +58 -0
  33. package/framework/standards/frontend/nextjs/app-router.md +123 -0
  34. package/framework/standards/frontend/nextjs/components.md +132 -0
  35. package/framework/standards/frontend/nextjs/data-fetching.md +126 -0
  36. package/framework/standards/frontend/nextjs/forms.md +128 -0
  37. package/framework/standards/frontend/nextjs/naming-conventions.md +67 -0
  38. package/framework/standards/frontend/nextjs/project-structure.md +102 -0
  39. package/framework/standards/frontend/nextjs/state-management.md +72 -0
  40. package/framework/standards/frontend/nextjs/testing.md +111 -0
  41. package/framework/templates/REGISTRY.json +538 -142
  42. package/framework/templates/code/dotnet/contracts/contracts-level1.cs +69 -0
  43. package/framework/templates/code/dotnet/contracts/contracts-level2.cs +86 -0
  44. package/framework/templates/code/dotnet/contracts/contracts-level3.cs +41 -0
  45. package/framework/templates/docs/spec.md +49 -0
  46. package/framework/templates/frontend/nextjs/Dockerfile.nextjs.hbs +43 -0
  47. package/framework/templates/frontend/nextjs/client-component.tsx.hbs +26 -0
  48. package/framework/templates/frontend/nextjs/env.mjs.hbs +32 -0
  49. package/framework/templates/frontend/nextjs/feature-form.tsx.hbs +56 -0
  50. package/framework/templates/frontend/nextjs/page.tsx.hbs +22 -0
  51. package/framework/templates/frontend/nextjs/tsconfig.json.hbs +26 -0
  52. package/framework/templates/frontend/nextjs/use-feature.ts.hbs +54 -0
  53. package/framework/templates/project-structure/dotnet-ddd.md +70 -0
  54. package/framework/workflows/docs/enforcement-pipeline.md +2 -1
  55. package/package.json +1 -1
  56. package/scripts/scan-nextjs.mjs +169 -0
  57. package/src/commands/project/doctor.js +52 -1
  58. package/src/commands/project/init.js +15 -1
  59. package/src/commands/project/update.js +6 -1
  60. package/src/lib/standards/standards-context-injector.js +5 -0
  61. package/src/lib/validators/nextjs/index.js +6 -0
  62. package/src/lib/validators/nextjs/next-component-validator.js +181 -0
  63. package/src/lib/validators/validation-runner.js +5 -0
  64. package/src/utils/agents-installer.js +14 -2
  65. package/.morph/.morphversion +0 -5
  66. package/.morph/analytics/threads-log.jsonl +0 -6
  67. package/.morph/config/config.json +0 -8
  68. package/.morph/framework/agents.json +0 -948
  69. package/.morph/framework/standards/STANDARDS.json +0 -812
  70. package/.morph/framework/standards/ai-agents/blazor-ui.md +0 -364
  71. package/.morph/framework/standards/ai-agents/production.md +0 -415
  72. package/.morph/framework/standards/ai-agents/setup.md +0 -418
  73. package/.morph/framework/standards/ai-agents/team-orchestration.md +0 -479
  74. package/.morph/framework/standards/ai-agents/workflows.md +0 -354
  75. package/.morph/framework/standards/architecture/ddd/aggregates.md +0 -120
  76. package/.morph/framework/standards/architecture/ddd/entities.md +0 -99
  77. package/.morph/framework/standards/architecture/ddd/value-objects.md +0 -124
  78. package/.morph/framework/standards/backend/api/minimal-api.md +0 -494
  79. package/.morph/framework/standards/backend/api/rest.md +0 -492
  80. package/.morph/framework/standards/backend/api/validation.md +0 -88
  81. package/.morph/framework/standards/backend/authentication/passkeys.md +0 -428
  82. package/.morph/framework/standards/backend/database/ef-core.md +0 -199
  83. package/.morph/framework/standards/backend/database/migrations.md +0 -393
  84. package/.morph/framework/standards/backend/database/postgresql/database.md +0 -352
  85. package/.morph/framework/standards/backend/database/repository-patterns.md +0 -528
  86. package/.morph/framework/standards/backend/database/vector-search-rag.md +0 -541
  87. package/.morph/framework/standards/backend/dotnet/async.md +0 -366
  88. package/.morph/framework/standards/backend/dotnet/core.md +0 -117
  89. package/.morph/framework/standards/backend/dotnet/di.md +0 -439
  90. package/.morph/framework/standards/backend/dotnet/program-cs-checklist.md +0 -92
  91. package/.morph/framework/standards/backend/integrations/asaas/asaas-api.md +0 -216
  92. package/.morph/framework/standards/backend/integrations/clerk/clerk-auth.md +0 -290
  93. package/.morph/framework/standards/backend/integrations/hangfire/hangfire-jobs.md +0 -350
  94. package/.morph/framework/standards/backend/integrations/resend/resend-email.md +0 -385
  95. package/.morph/framework/standards/context/analytics.md +0 -96
  96. package/.morph/framework/standards/context/bundles.md +0 -110
  97. package/.morph/framework/standards/context/priming.md +0 -78
  98. package/.morph/framework/standards/core/architecture.md +0 -185
  99. package/.morph/framework/standards/core/coding.md +0 -214
  100. package/.morph/framework/standards/core/git-branching-strategy.md +0 -403
  101. package/.morph/framework/standards/core/git.md +0 -185
  102. package/.morph/framework/standards/core/testing.md +0 -295
  103. package/.morph/framework/standards/data/nosql/blob-storage.md +0 -102
  104. package/.morph/framework/standards/data/nosql/cache/redis.md +0 -97
  105. package/.morph/framework/standards/data/nosql/cosmos-db.md +0 -118
  106. package/.morph/framework/standards/data/vector-search/azure-ai-search.md +0 -121
  107. package/.morph/framework/standards/data/vector-search/rag-chunking.md +0 -104
  108. package/.morph/framework/standards/frontend/blazor/design-checklist.md +0 -222
  109. package/.morph/framework/standards/frontend/blazor/fluent-ui-setup.md +0 -595
  110. package/.morph/framework/standards/frontend/blazor/fluent-ui.md +0 -137
  111. package/.morph/framework/standards/frontend/blazor/html-conversion.md +0 -184
  112. package/.morph/framework/standards/frontend/blazor/lifecycle.md +0 -195
  113. package/.morph/framework/standards/frontend/blazor/pitfalls.md +0 -198
  114. package/.morph/framework/standards/frontend/blazor/state.md +0 -191
  115. package/.morph/framework/standards/frontend/design-system/animations.md +0 -151
  116. package/.morph/framework/standards/frontend/design-system/naming.md +0 -64
  117. package/.morph/framework/standards/frontend/nextjs/nextjs-patterns.md +0 -215
  118. package/.morph/framework/standards/infrastructure/azure/azure.md +0 -624
  119. package/.morph/framework/standards/infrastructure/azure/bicep/bicep-patterns.md +0 -422
  120. package/.morph/framework/standards/infrastructure/azure/devops/azure-devops-setup.md +0 -516
  121. package/.morph/framework/standards/infrastructure/azure/devops/local-development.md +0 -520
  122. package/.morph/framework/standards/infrastructure/azure/services/functions.md +0 -486
  123. package/.morph/framework/standards/infrastructure/azure/services/service-bus.md +0 -459
  124. package/.morph/framework/standards/infrastructure/azure/services/storage.md +0 -407
  125. package/.morph/framework/standards/infrastructure/docker/easypanel-deploy.md +0 -196
  126. package/.morph/framework/standards/infrastructure/supabase/mcp-setup.md +0 -252
  127. package/.morph/framework/standards/infrastructure/supabase/supabase-auth.md +0 -176
  128. package/.morph/framework/standards/infrastructure/supabase/supabase-pgvector.md +0 -169
  129. package/.morph/framework/standards/infrastructure/supabase/supabase-rls.md +0 -184
  130. package/.morph/framework/standards/infrastructure/supabase/supabase-storage.md +0 -153
  131. package/.morph/framework/standards/integration/api/graphql.md +0 -91
  132. package/.morph/framework/standards/integration/api/grpc.md +0 -114
  133. package/.morph/framework/standards/integration/api/rest-design.md +0 -95
  134. package/.morph/framework/standards/integration/event-driven/cqrs.md +0 -101
  135. package/.morph/framework/standards/integration/event-driven/event-sourcing.md +0 -124
  136. package/.morph/framework/standards/integration/event-driven/service-bus.md +0 -95
  137. package/.morph/framework/standards/integration/mcp/mcp-tools.md +0 -384
  138. package/.morph/framework/standards/observability/logging.md +0 -131
  139. package/.morph/framework/standards/observability/metrics.md +0 -121
  140. package/.morph/framework/standards/observability/monitoring.md +0 -114
  141. package/.morph/framework/standards/observability/tracing.md +0 -132
  142. package/.morph/framework/standards/workflows/parallel-execution.md +0 -112
  143. package/.morph/framework/standards/workflows/thread-management.md +0 -113
  144. package/.morph/framework/templates/.idea/morph-templates.xml +0 -92
  145. package/.morph/framework/templates/.vscode/morph-templates.code-snippets +0 -186
  146. package/.morph/framework/templates/IDE-SNIPPETS.md +0 -266
  147. package/.morph/framework/templates/README.md +0 -814
  148. package/.morph/framework/templates/REGISTRY.json +0 -1492
  149. package/.morph/framework/templates/code/dotnet/backend/repository.cs +0 -141
  150. package/.morph/framework/templates/code/dotnet/backend/service.cs +0 -139
  151. package/.morph/framework/templates/code/dotnet/contracts/Commands.cs +0 -74
  152. package/.morph/framework/templates/code/dotnet/contracts/Entities.cs +0 -25
  153. package/.morph/framework/templates/code/dotnet/contracts/Queries.cs +0 -74
  154. package/.morph/framework/templates/code/dotnet/contracts/README.md +0 -74
  155. package/.morph/framework/templates/code/dotnet/contracts/api-contracts.cs +0 -173
  156. package/.morph/framework/templates/code/dotnet/contracts/contracts.cs +0 -217
  157. package/.morph/framework/templates/code/dotnet/contracts/contracts.cs.hbs +0 -172
  158. package/.morph/framework/templates/code/dotnet/database/migration.cs +0 -83
  159. package/.morph/framework/templates/code/dotnet/frontend/component.razor +0 -239
  160. package/.morph/framework/templates/code/dotnet/jobs/agent.cs +0 -163
  161. package/.morph/framework/templates/code/dotnet/jobs/job.cs +0 -171
  162. package/.morph/framework/templates/code/dotnet/test.cs +0 -239
  163. package/.morph/framework/templates/code/sql/rls-policy.sql +0 -57
  164. package/.morph/framework/templates/code/sql/supabase-migration.sql +0 -100
  165. package/.morph/framework/templates/code/sql/supabase-migration.template.sql +0 -113
  166. package/.morph/framework/templates/code/typescript/contracts.ts +0 -168
  167. package/.morph/framework/templates/context/CONTEXT-FEATURE.md +0 -276
  168. package/.morph/framework/templates/context/CONTEXT.md +0 -181
  169. package/.morph/framework/templates/docs/clarifications.md +0 -253
  170. package/.morph/framework/templates/docs/onboarding.md +0 -123
  171. package/.morph/framework/templates/docs/proposal.md +0 -182
  172. package/.morph/framework/templates/docs/schema-analysis.md +0 -119
  173. package/.morph/framework/templates/docs/spec.md +0 -149
  174. package/.morph/framework/templates/docs/ui-components.md +0 -124
  175. package/.morph/framework/templates/docs/ui-design-system.md +0 -76
  176. package/.morph/framework/templates/docs/ui-flows.md +0 -167
  177. package/.morph/framework/templates/docs/ui-mockups.md +0 -98
  178. package/.morph/framework/templates/docs/user-stories.md +0 -34
  179. package/.morph/framework/templates/examples/design-system-examples.md +0 -357
  180. package/.morph/framework/templates/examples/spec-examples.md +0 -90
  181. package/.morph/framework/templates/feature/decisions.md +0 -187
  182. package/.morph/framework/templates/feature/recap.md +0 -146
  183. package/.morph/framework/templates/feature/tasks.md +0 -199
  184. package/.morph/framework/templates/infrastructure/azure/Dockerfile.example +0 -82
  185. package/.morph/framework/templates/infrastructure/azure/README.md +0 -286
  186. package/.morph/framework/templates/infrastructure/azure/app-insights.bicep +0 -63
  187. package/.morph/framework/templates/infrastructure/azure/app-service.bicep +0 -164
  188. package/.morph/framework/templates/infrastructure/azure/container-app-env.bicep +0 -49
  189. package/.morph/framework/templates/infrastructure/azure/container-app.bicep +0 -156
  190. package/.morph/framework/templates/infrastructure/azure/deploy-checklist.md +0 -426
  191. package/.morph/framework/templates/infrastructure/azure/deploy.ps1 +0 -229
  192. package/.morph/framework/templates/infrastructure/azure/deploy.sh +0 -208
  193. package/.morph/framework/templates/infrastructure/azure/key-vault.bicep +0 -91
  194. package/.morph/framework/templates/infrastructure/azure/main.bicep +0 -189
  195. package/.morph/framework/templates/infrastructure/azure/parameters.dev.json +0 -29
  196. package/.morph/framework/templates/infrastructure/azure/parameters.prod.json +0 -29
  197. package/.morph/framework/templates/infrastructure/azure/parameters.staging.json +0 -29
  198. package/.morph/framework/templates/infrastructure/azure/sql-database.bicep +0 -103
  199. package/.morph/framework/templates/infrastructure/azure/storage.bicep +0 -106
  200. package/.morph/framework/templates/infrastructure/docker/Dockerfile.template +0 -58
  201. package/.morph/framework/templates/infrastructure/docker/docker-compose.template.yml +0 -67
  202. package/.morph/framework/templates/infrastructure/docker/dockerfile-api.dockerfile +0 -38
  203. package/.morph/framework/templates/infrastructure/docker/dockerfile-web.dockerfile +0 -48
  204. package/.morph/framework/templates/infrastructure/docker/easypanel.template.json +0 -54
  205. package/.morph/framework/templates/infrastructure/github/README.md +0 -593
  206. package/.morph/framework/templates/infrastructure/github/actions/azure-auth/action.yml.hbs +0 -22
  207. package/.morph/framework/templates/infrastructure/github/actions/docker-build-push/action.yml.hbs +0 -45
  208. package/.morph/framework/templates/infrastructure/github/actions/health-check/action.yml.hbs +0 -27
  209. package/.morph/framework/templates/infrastructure/github/workflows/deploy-azure-app-service.yml.hbs +0 -61
  210. package/.morph/framework/templates/infrastructure/github/workflows/deploy-easypanel.yml.hbs +0 -31
  211. package/.morph/framework/templates/infrastructure/github/workflows/docker-build-push.yml.hbs +0 -59
  212. package/.morph/framework/templates/infrastructure/github/workflows/dotnet-build.yml.hbs +0 -39
  213. package/.morph/framework/templates/integrations/asaas-client.cs +0 -387
  214. package/.morph/framework/templates/integrations/asaas-webhook.cs +0 -351
  215. package/.morph/framework/templates/integrations/azure-identity-config.cs +0 -288
  216. package/.morph/framework/templates/integrations/clerk-config.cs +0 -258
  217. package/.morph/framework/templates/meta-prompts/fusion/fusion-agent.md +0 -76
  218. package/.morph/framework/templates/meta-prompts/fusion/fusion-aggregator.md +0 -100
  219. package/.morph/framework/templates/meta-prompts/hops/hop-retry.md +0 -78
  220. package/.morph/framework/templates/meta-prompts/hops/hop-validation.md +0 -97
  221. package/.morph/framework/templates/meta-prompts/hops/hop-wrapper.md +0 -36
  222. package/.morph/framework/templates/meta-prompts/parallel-workers/parallel-coordinator.md +0 -113
  223. package/.morph/framework/templates/meta-prompts/parallel-workers/parallel-worker.md +0 -80
  224. package/.morph/framework/templates/meta-prompts/squad-leaders/backend-squad.md +0 -90
  225. package/.morph/framework/templates/meta-prompts/squad-leaders/frontend-squad.md +0 -126
  226. package/.morph/framework/templates/meta-prompts/squad-leaders/squad-leader.md +0 -43
  227. package/.morph/framework/templates/meta-prompts/validators/checkpoint-validator.md +0 -107
  228. package/.morph/framework/templates/meta-prompts/validators/pre-commit-validator.md +0 -95
  229. package/.morph/framework/templates/saas/subscription.cs +0 -347
  230. package/.morph/framework/templates/saas/tenant.cs +0 -338
  231. package/.morph/framework/templates/state.template.json +0 -17
  232. package/.morph/framework/templates/ui/FluentDesignTheme.cs +0 -149
  233. package/.morph/framework/templates/ui/MudTheme.cs +0 -281
  234. package/.morph/framework/templates/ui/design-system.css +0 -226
  235. package/.morph/logs/tool-failures.log +0 -7
  236. package/.morph/memory/pre-compact-2026-02-23T15-43-03-521Z.json +0 -16
  237. package/.morph/state.json +0 -48
  238. package/framework/templates/code/dotnet/contracts/contracts.cs +0 -217
  239. package/framework/templates/code/dotnet/contracts/contracts.cs.hbs +0 -172
package/README.md CHANGED
@@ -1,700 +1,394 @@
1
- <h1 align="center">MORPH-SPEC</h1>
2
-
3
- <p align="center">
4
- <strong>Framework de desenvolvimento spec-driven com 30 agentes AI especializados</strong><br>
5
- <em>by Polymorphism Tech</em>
6
- </p>
7
-
8
- <p align="center">
9
- <a href="https://www.npmjs.com/package/@polymorphism-tech/morph-spec"><img src="https://img.shields.io/npm/v/@polymorphism-tech/morph-spec.svg" alt="npm version"></a>
10
- <a href="https://www.npmjs.com/package/@polymorphism-tech/morph-spec"><img src="https://img.shields.io/npm/dm/@polymorphism-tech/morph-spec.svg" alt="npm downloads"></a>
11
- <a href="#licença"><img src="https://img.shields.io/npm/l/@polymorphism-tech/morph-spec.svg" alt="license"></a>
12
- </p>
13
-
14
- <p align="center">
15
- <a href="#instalação">Instalação</a>
16
- <a href="#começando">Começando</a> •
17
- <a href="#comandos">Comandos</a> •
18
- <a href="#agentes">Agentes</a> •
19
- <a href="docs/">Documentação</a>
20
- </p>
21
-
22
- <p align="center">
23
- <strong>Guias de Uso:</strong>
24
- <a href="QUICKSTART.md">Quick Start</a> •
25
- <a href="CHEATSHEET.md">Cheat Sheet</a> •
26
- <a href="docs/README.md">API Docs</a>
27
- </p>
28
-
29
- ---
30
-
31
- ## O que é MORPH-SPEC?
32
-
33
- **M**ethodical **O**rchestration for **R**eliable **P**roduction-ready **SPEC**-driven development
34
-
35
- MORPH-SPEC é um framework de desenvolvimento orientado por especificações com **30 agentes AI especializados** organizados em 4 tiers hierárquicos. Cada agente tem expertise em tecnologias específicas e segue workflows estruturados para entregar código production-ready.
36
-
37
- **Stacks suportadas:** .NET 10/Blazor, .NET 10/Next.js, Node.js, Monorepos
38
- **Infraestrutura:** Azure Bicep (IaC) + Docker
39
- **Ferramenta:** Claude Code
40
- **Validação:** Pipeline automático de enforcement com gates por fase
41
- **Auto-Detecção:** LLM-powered context detection (v3.1+)
42
-
43
- ---
44
-
45
- ## 🚀 Novidade v3.0: LLM Interaction Enhancements
46
-
47
- MORPH-SPEC v3.0 torna o framework **explícito e orientado** para Claude Code com 8 melhorias fundamentais:
48
-
49
- ### 1. **Approval Gates** (Portões de Aprovação)
50
- - ✅ Rastreamento explícito de aprovações em `state.json`
51
- - 🚫 Bloqueio de transições de fase até aprovação explícita
52
- - 📝 Comandos: `approve`, `reject`, `approval-status`
53
-
54
- ### 2. **Checkpoint Automation** (Validação Automática)
55
- - 🔍 Auto-validação a cada 3 tasks (T003, T006, T009...)
56
- - 🛡️ 4 validators: architecture, packages, security, design-system
57
- - 🚧 Bloqueia progresso se falhas detectadas
58
-
59
- ### 3. **Stricter Phase Validation** (Validação Estrita)
60
- - 🎯 State machine com transições válidas
61
- - 📋 Validação de conteúdo (spec.md, tasks.json)
62
- - 5️⃣ Sistema de 5 gates de validação
63
-
64
- ### 4. **Agent Team Spawning** (Spawning de Agentes)
65
- - 🤖 Detecção automática quando spawnar (5+ agents, 15+ files, multi-domain)
66
- - 🏗️ Comando `spawn-team` gera configs para Task tool
67
- - 📄 Templates prontos para agent context
68
-
69
- ### 5. **Metadata Generation** (Geração de Metadados)
70
- - 📊 Auto-gera `metadata.json` após cada task
71
- - Reduz uso de tokens em 60-80%
72
- - 🔗 Links rápidos para spec, tasks, decisões
73
-
74
- ### 6. **Learning System** (Sistema de Aprendizado)
75
- - 📚 11 patterns pré-configurados (389 linhas)
76
- - 🔎 Busca: `search-patterns "{keyword}"`
77
- - 📝 Captura: `capture-pattern {feature} success "Description"`
78
-
79
- ### 7. **MCP Template Enhancement** (Templates Dinâmicos)
80
- - 🌐 17 placeholders com dados do projeto
81
- - 📈 Injeta: files, coverage, compliance, commits
82
- - 🎨 Templates: `proposal-with-mcp.md`, `spec-with-mcp.md`
83
-
84
- ### 8. **Interactive Decisions** (Decisões Estruturadas)
85
- - 💬 Templates para AskUserQuestion
86
- - 🎯 6 padrões documentados (scope, architecture, validation, etc.)
87
- - 📖 Guia completo em `.morph/framework/templates/decision-prompts.md`
88
-
89
- **Configuração:** `.morph/config/llm-interaction.json` com 3 presets (strict, lightweight, no-guardrails)
90
-
91
- **Documentação:** [docs/llm-interaction-config.md](docs/llm-interaction-config.md)
92
-
93
- **Migration:** `npx morph-spec upgrade --preset strict`
94
-
95
- ---
96
-
97
- ## ✨ Novidade v3.1: Auto-Detecção Inteligente
98
-
99
- MORPH-SPEC agora **detecta automaticamente** o contexto do seu projeto usando Claude Code:
100
-
101
- - 🤖 **LLM Analysis**: Analisa package.json, .csproj, README, estrutura de pastas
102
- - 🎯 **90%+ Accuracy**: Few-shot learning com exemplos reais (Next.js, Blazor, Monorepo)
103
- - 🔒 **Privacy-First**: Processamento local, zero chamadas externas de API
104
- - 🛡️ **Secret Sanitization**: Redação automática de API keys, passwords, tokens
105
- - 🧙 **Wizard Fallback**: Wizard interativo de 7 perguntas se LLM falhar
106
- - **Zero Manual Work**: Gera `.morph/project.md` e `config.json` em segundos
107
-
108
- **Saiba mais:** [docs/cli-auto-detection.md](docs/cli-auto-detection.md)
109
-
110
- ---
111
-
112
- ## Instalação
113
-
114
- ### Pré-requisitos
115
-
116
- - [Node.js](https://nodejs.org/) 18+
117
- - [Claude Code](https://claude.ai/code) instalado
118
-
119
- ### Instalação Rápida (Recomendado)
120
-
121
- ```bash
122
- # Navegue até seu projeto
123
- cd /caminho/do/seu/projeto
124
-
125
- # Execute o instalador (não precisa instalar nada)
126
- npx @polymorphism-tech/morph-spec init
127
- ```
128
-
129
- ### Instalação Global (Opcional)
130
-
131
- Se preferir ter o comando disponível globalmente:
132
-
133
- ```bash
134
- npm install -g @polymorphism-tech/morph-spec
135
- morph-spec init
136
- ```
137
-
138
- <details>
139
- <summary><strong>Windows + nvm-windows: Comando não reconhecido?</strong></summary>
140
-
141
- Se você usa **nvm-windows** para gerenciar versões do Node.js, o npm **não** adiciona automaticamente os pacotes globais ao PATH. Este é um [problema conhecido do nvm-windows](https://github.com/coreybutler/nvm-windows/issues/391).
142
-
143
- ### Solução 1: Adicionar ao PATH manualmente
144
-
145
- **PowerShell (executar como Administrador):**
146
- ```powershell
147
- # Verificar o caminho do npm global
148
- npm config get prefix
149
-
150
- # Adicionar ao PATH (substitua pelo caminho acima)
151
- $npmPath = "$env:APPDATA\npm"
152
- [Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";$npmPath", "User")
153
- ```
154
-
155
- Depois, **feche e reabra o terminal**.
156
-
157
- ### Solução 2: Use npx (Recomendado)
158
-
159
- O `npx` funciona sem configurar PATH:
160
- ```bash
161
- npx @polymorphism-tech/morph-spec init
162
- npx @polymorphism-tech/morph-spec doctor
163
- ```
164
-
165
- ### Verificar se funcionou
166
-
167
- ```bash
168
- morph-spec --version
169
- # Ou
170
- npx @polymorphism-tech/morph-spec --version
171
- ```
172
-
173
- ### Mais Ajuda
174
-
175
- ```bash
176
- morph-spec doctor # Detecta problemas de PATH automaticamente
177
- ```
178
-
179
- Veja também: [Troubleshooting](#troubleshooting)
180
-
181
- </details>
182
-
183
- ### Comandos CLI
184
-
185
- | Comando | Descrição |
186
- |---------|-----------|
187
- | `morph-spec init` | Inicializa MORPH e **detecta automaticamente** o contexto do projeto ✨ |
188
- | `morph-spec init --wizard` | Inicializa com wizard manual (sem auto-detecção LLM) |
189
- | `morph-spec init --skip-detection` | Inicializa sem detectar contexto (configuração manual) |
190
- | `morph-spec init --force` | Sobrescreve instalação existente |
191
- | `morph-spec update` | Atualiza projeto e **re-analisa contexto** automaticamente ✨ |
192
- | `morph-spec update --wizard` | Atualiza com wizard manual |
193
- | `morph-spec update --skip-detection` | Atualiza sem re-analisar contexto |
194
- | `morph-spec update --templates` | Atualiza apenas templates |
195
- | `morph-spec update --standards` | Atualiza apenas standards |
196
- | `morph-spec doctor` | Verifica saúde e versões da instalação |
197
-
198
- > ✨ **Novo em v3.1+:** Auto-detecção inteligente de stack, arquitetura e infraestrutura usando Claude Code!
199
-
200
- ### Verificar Instalação
201
-
202
- ```bash
203
- morph-spec doctor
204
- ```
205
-
206
- O comando `doctor` verifica:
207
- - Versão do CLI (se está atualizada)
208
- - Versão do MORPH no projeto
209
- - Estrutura de arquivos e configurações
210
-
211
- Ou abra seu projeto no Claude Code e execute:
212
- ```
213
- /morph-status
214
- ```
215
-
216
- ---
217
-
218
- ## Mantendo Atualizado
219
-
220
- ### 1. Verificar se há atualizações
221
-
222
- ```bash
223
- morph-spec doctor
224
- ```
225
-
226
- Isso mostrará se há versões mais recentes disponíveis.
227
-
228
- ### 2. Atualizar para a versão mais recente
229
-
230
- **Instalação Global:**
231
- ```bash
232
- # Primeiro, atualize o CLI
233
- npm install -g @polymorphism-tech/morph-spec@latest
234
-
235
- # Depois, atualize seu projeto
236
- cd /caminho/do/seu/projeto
237
- morph-spec update
238
- ```
239
-
240
- **Usando npx (Recomendado - sempre pega a versão mais recente):**
241
- ```bash
242
- cd /caminho/do/seu/projeto
243
- npx @polymorphism-tech/morph-spec@latest update
244
- ```
245
-
246
- ### 3. O que é atualizado?
247
-
248
- O comando `update` sincroniza:
249
- - Templates (`.morph/framework/templates/`)
250
- - Standards (`.morph/framework/standards/`)
251
- - Agentes (`.morph/framework/agents.json`)
252
- - Comandos Claude (`.claude/commands/`)
253
- - Skills (`.claude/skills/`)
254
- - Instruções (CLAUDE.md)
255
-
256
- **Importante:** Seu `config.json` é preservado!
257
-
258
- ---
259
-
260
- ## Começando
261
-
262
- ### 1. Criar uma Proposta
263
-
264
- ```
265
- /morph-proposal minha-feature
266
- ```
267
-
268
- Descreva o que quer implementar. O MORPH vai gerar a especificação completa.
269
-
270
- ### 2. Revisar a Spec
271
-
272
- Arquivos gerados em `.morph/features/minha-feature/`:
273
- - `spec.md` - Especificação técnica
274
- - `contracts.cs` - Interfaces e DTOs
275
- - `decisions.md` - Decisões arquiteturais
276
-
277
- ### 3. Aprovar o Design
278
-
279
- Revise os arquivos gerados e aprove (ou peça ajustes).
280
-
281
- ### 4. Implementar
282
-
283
- ```
284
- /morph-apply minha-feature
285
- ```
286
-
287
- O MORPH implementa task por task, com validação automática a cada etapa.
288
-
289
- ### 5. Arquivar
290
-
291
- ```
292
- /morph-archive minha-feature
293
- ```
294
-
295
- Move a feature concluída para o arquivo.
296
-
297
- ---
298
-
299
- ## Como Funciona
300
-
301
- ```
302
- ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
303
- PROPOSAL │ -> │ DESIGN │ -> │ CLARIFY │ -> │ TASKS │ -> │IMPLEMENT │
304
- │ │ │ │ │ │ │ │ │ │
305
- Contexto │ │ Spec + │ │ Q&A + │ │ Quebra │ │ Executa │
306
- │ + Agents │ │Contracts │ │ Edges │ │ Tasks │ │ + Valida │
307
- └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘
308
- | | |
309
- Spec Gate Design System Validation
310
- (C# checks) Gate Pipeline
311
- ```
312
-
313
- **Pontos de aprovação:** O MORPH para em 2 momentos para você revisar antes de continuar.
314
-
315
- **Gates de validação (v3):**
316
- - **Spec Gate** (Design -> Clarify): Valida contratos C# — CancellationToken, PascalCase, async suffix, sealed classes, records para DTOs
317
- - **Design System Gate** (Tasks -> Implement): Bloqueia se features de UI não tiverem design system definido
318
- - **Validation Pipeline** (cada task done): Roda validators baseados nos agentes ativos da feature
319
-
320
- ---
321
-
322
- ## Novidades v3 — Validation Pipeline
323
-
324
- O v3 transforma MORPH de ferramentas isoladas em um **pipeline integrado de validação**:
325
-
326
- | Feature | O que faz | Comando |
327
- |---------|-----------|---------|
328
- | **Validation Pipeline** | Roda validators automaticamente ao completar tasks | `morph-spec task done` |
329
- | **Standards Injection** | Carrega standards relevantes por agente automaticamente | `morph-spec detect-agents --json` |
330
- | **Design System Gate** | Bloqueia FASE 5 se features UI não tiverem design system | `morph-spec phase advance` |
331
- | **Spec Validation** | Valida contratos C# na FASE 2, antes de implementar | `morph-spec phase advance` |
332
- | **Decision Constraints** | ADRs em decisions.md configuram validators automaticamente | Automático |
333
- | **Auto Recap** | Gera recap.md a partir de dados reais do projeto | `morph-spec generate recap` |
334
- | **Smart Phase Advance** | Avança fases com gates de validação obrigatórios | `morph-spec phase advance` |
335
-
336
- **Fluxo de dados:**
337
- ```
338
- agents.json (30 agentes)
339
- |-> detect-agents -> state.json (agentes ativos)
340
- |-> standards-context-injector -> standards por agente
341
- |-> validation-runner -> validators por agente
342
- decisions.md (ADRs)
343
- |-> decision-constraint-loader -> constraints para validators
344
- ```
345
-
346
- ---
347
-
348
- ## Comandos
349
-
350
- ### Claude Code (Slash Commands)
351
-
352
- | Comando | Descrição |
353
- |---------|-----------|
354
- | `/morph-proposal <nome>` | Cria nova feature (fases 0-4 com pausas) |
355
- | `/morph-apply <nome>` | Implementa feature aprovada (fase 5) |
356
- | `/morph-status` | Mostra status do projeto |
357
- | `/morph-archive <nome>` | Arquiva feature concluída |
358
- | `/morph-infra <ação>` | Gerencia infraestrutura (init, validate, deploy) |
359
- | `/morph-preflight` | Validação pre-deploy Azure |
360
- | `/morph-troubleshoot <erro>` | Busca soluções para erros |
361
-
362
- ### CLI Completo
363
-
364
- | Comando | Descrição |
365
- |---------|-----------|
366
- | **Setup** | |
367
- | `morph-spec init` | Inicializa MORPH no diretório |
368
- | `morph-spec update` | Atualiza para versão mais recente |
369
- | `morph-spec doctor` | Verifica saúde da instalação |
370
- | `morph-spec detect` | Detecta stack, arquitetura, patterns |
371
- | `morph-spec detect-agents <input>` | Detecta agentes + complexidade + standards |
372
- | **Fases e Tasks** | |
373
- | `morph-spec phase advance <feature>` | Avança fase com gates de validação |
374
- | `morph-spec validate-phase <feature> <phase>` | Valida pré-requisitos de uma fase |
375
- | `morph-spec task done <feature> <ids>` | Completa tasks (roda validação antes) |
376
- | `morph-spec task start <feature> <id>` | Marca task como in_progress |
377
- | `morph-spec task next <feature>` | Mostra próxima task sugerida |
378
- | `morph-spec rollback <feature> <phase>` | Rollback para fase anterior |
379
- | **Geração** | |
380
- | `morph-spec generate design-system <md>` | Gera CSS + temas C# de ui-design-system.md |
381
- | `morph-spec generate recap <feature>` | Gera recap.md automático |
382
- | `morph-spec generate context [feature]` | Gera CONTEXT.md para Claude Code |
383
- | **Validação** | |
384
- | `morph-spec validate [validator]` | Validação de código (packages, architecture, contrast) |
385
- | `morph-spec validate-blazor [path]` | Valida patterns Fluent UI Blazor |
386
- | `morph-spec validate-blazor-state [path]` | Valida session state Blazor |
387
- | `morph-spec validate-css [path]` | Valida classes CSS em Razor files |
388
- | `morph-spec analyze-blazor-concurrency [path]` | Detecta concurrency issues em DbContext |
389
- | `morph-spec lint-fluent [path]` | Lint de patterns Fluent UI |
390
- | **State** | |
391
- | `morph-spec state list` | Lista todas as features |
392
- | `morph-spec state get <feature>` | Detalhes de uma feature |
393
- | `morph-spec state set <feature> <key> <value>` | Atualiza propriedade |
394
- | `morph-spec state checkpoint <feature> "nota"` | Cria checkpoint |
395
- | **Story-Driven** | |
396
- | `morph-spec story create <feature> <id>` | Cria story com Dev Notes |
397
- | `morph-spec story shard <feature>` | Divide spec em shards (90% token savings) |
398
- | `morph-spec story status <feature> <action>` | Gerencia sprint status |
399
- | **Learning** | |
400
- | `morph-spec learn analyze` | Aprende com histórico do projeto |
401
- | `morph-spec learn insights` | Mostra patterns aprendidos |
402
- | `morph-spec learn suggest [category]` | Sugestões por categoria |
403
- | **Outros** | |
404
- | `morph-spec troubleshoot <keywords>` | Busca soluções para erros |
405
- | `morph-spec session-summary <feature>` | Resumo da sessão atual |
406
- | `morph-spec sync` | Sincroniza standards de decisions |
407
-
408
- ---
409
-
410
- ## Agentes
411
-
412
- MORPH-SPEC possui **30 agentes** organizados em 4 tiers hierárquicos com squads:
413
-
414
- ### Tier 1 — Orchestrators (3)
415
-
416
- | Agente | Função | Ativação |
417
- |--------|--------|----------|
418
- | **Standards Architect** | Chief Architect, padrões e consistência | Sempre ativo |
419
- | **AI System Architect** | Arquitetura de sistemas multi-agente | Por keyword |
420
- | **PO/PM Advisor** | Requisitos, ROI, business value | Por keyword |
421
-
422
- ### Tier 2 — Domain Leaders (3)
423
-
424
- | Agente | Squad | Ativação |
425
- |--------|-------|----------|
426
- | **Dotnet Senior** | Backend (10 specialists) | Sempre ativo |
427
- | **Azure Architect** | Infraestrutura (5 specialists) | Sempre ativo |
428
- | **UI/UX Designer** | Frontend (3 specialists) | Por keyword |
429
-
430
- ### Tier 3 — Specialists (23)
431
-
432
- <details>
433
- <summary><strong>Backend Squad (10)</strong></summary>
434
-
435
- | Agente | Keywords |
436
- |--------|----------|
437
- | **EF Modeler** | database, entity, migration, ef core |
438
- | **Event Architect** | event, service bus, cqrs, real-time |
439
- | **API Designer** | rest, graphql, grpc, openapi |
440
- | **NoSQL/Cache Expert** | cosmos, redis, cache, blob storage |
441
- | **DDD Expert** | ddd, aggregate, bounded context |
442
- | **Hangfire Orchestrator** | scheduled, job, background, cron |
443
- | **MS Agent Expert** | agent, ai, microsoft agent framework, mcp, a2a |
444
- | **Asaas Financial** | asaas, pix, boleto, payment |
445
- | **Clerk Auth** | clerk, login, signup, oauth |
446
- | **Resend Email** | resend, email, transactional email |
447
- </details>
448
-
449
- <details>
450
- <summary><strong>Frontend Squad (3)</strong></summary>
451
-
452
- | Agente | Keywords |
453
- |--------|----------|
454
- | **Blazor Builder** | blazor, razor, component, fluent ui |
455
- | **NextJS Expert** | nextjs, react, shadcn, server actions |
456
- | **CSS Specialist** | css, design system, theme, design tokens |
457
- </details>
458
-
459
- <details>
460
- <summary><strong>Infrastructure Squad (5)</strong></summary>
461
-
462
- | Agente | Keywords |
463
- |--------|----------|
464
- | **Bicep Architect** | bicep, iac, infra, provision |
465
- | **DevOps Engineer** | pipeline, ci/cd, deploy, github actions |
466
- | **Container Specialist** | docker, container, container apps |
467
- | **Observability Expert** | monitoring, logging, tracing, app insights |
468
- | **Azure Identity** | identity, entra, passkeys, managed identity |
469
- </details>
470
-
471
- <details>
472
- <summary><strong>Quality Squad (5)</strong></summary>
473
-
474
- | Agente | Keywords |
475
- |--------|----------|
476
- | **Testing Specialist** | test, unit, integration, e2e, xunit, bunit |
477
- | **Code Analyzer** | analyze, review, refactor, clean code, solid |
478
- | **Troubleshooting Expert** | debug, troubleshoot, root cause, diagnose |
479
- | **Load Testing Expert** | load test, k6, stress test, scalability |
480
- | **Documentation Specialist** | readme, api docs, deployment guide |
481
- </details>
482
-
483
- ### Tier 4 — Validators (1)
484
-
485
- | Agente | Função | Ativação |
486
- |--------|--------|----------|
487
- | **Security Expert** | SQL injection, XSS, secrets, CSRF | Sempre ativo (hooks) |
488
-
489
- ---
490
-
491
- ## Estrutura do Projeto
492
-
493
- Após a instalação, seu projeto terá:
494
-
495
- ```
496
- seu-projeto/
497
- ├── CLAUDE.md # Instruções para o AI
498
- ├── .morph/
499
- │ ├── config/ # Configurações
500
- │ │ └── config.json
501
- │ ├── framework/
502
- │ │ ├── agents.json # 30 agentes em 4 tiers
503
- │ │ ├── standards/ # Padrões de código (26 arquivos)
504
- │ │ │ ├── coding.md
505
- │ │ │ ├── architecture.md
506
- │ │ │ ├── azure.md
507
- │ │ │ ├── blazor-*.md # Lifecycle, state, pitfalls, EF Core
508
- │ │ │ ├── css-*.md # Naming, animations
509
- │ │ │ ├── agent-framework-*.md # Setup, workflows, production, blazor-ui
510
- │ │ │ └── ...
511
- │ │ └── templates/ # Templates de código e IaC
512
- │ │ ├── infra/
513
- │ │ ├── integrations/
514
- │ │ └── saas/
515
- │ ├── context/ # Contexto do projeto e overrides
516
- │ ├── features/ # Features em desenvolvimento
517
- │ └── archive/ # Features concluídas
518
- └── .claude/
519
- ├── commands/ # Slash commands
520
- └── skills/ # Skills dos agentes (31+ arquivos)
521
- ```
522
-
523
- ---
524
-
525
- ## Templates Incluídos
526
-
527
- ### IaC (Bicep)
528
- - `main.bicep`, `container-app.bicep`, `sql-database.bicep`, `storage.bicep`, `key-vault.bicep`, `app-insights.bicep`
529
-
530
- ### Integrações
531
- - `asaas-client.cs`, `asaas-webhook.cs`, `clerk-config.cs`, `azure-identity-config.cs`
532
-
533
- ### SaaS
534
- - `subscription.cs`, `tenant.cs`
535
-
536
- ### Código
537
- - `service.cs`, `repository.cs`, `component.razor`, `agent.cs`, `job.cs`, `test.cs`
538
-
539
- ---
540
-
541
- ## Custos
542
-
543
- O MORPH segue a filosofia **"Free tier first"**:
544
-
545
- | Nível | Limite | Requer |
546
- |-------|--------|--------|
547
- | Sem aprovação | Free tier | Nada |
548
- | Com aprovação | Até $10/mês | Confirmação |
549
- | Acima de $10 | Justificativa | ADR |
550
-
551
- ---
552
-
553
- ## Troubleshooting
554
-
555
- ### Comando `morph-spec` não encontrado
556
-
557
- **Sintoma:** Após `npm install -g`, o comando não é reconhecido.
558
-
559
- **Diagnóstico:**
560
- ```bash
561
- npm config get prefix # Ver onde npm instala globalmente
562
- echo $PATH # Linux/Mac: Verificar se está no PATH
563
- $env:Path # Windows: Verificar se está no PATH
564
- ```
565
-
566
- **Causa comum:** Você está usando **nvm** ou **nvm-windows**, que não adiciona automaticamente npm global ao PATH.
567
-
568
- **Solução 1 - Usar npx (Recomendado):**
569
- ```bash
570
- npx @polymorphism-tech/morph-spec init
571
- ```
572
-
573
- **Solução 2 - Adicionar ao PATH:**
574
-
575
- **Linux/Mac:**
576
- ```bash
577
- # Adicionar ao ~/.bashrc ou ~/.zshrc
578
- export PATH="$HOME/.npm-global/bin:$PATH"
579
- ```
580
-
581
- **Windows (PowerShell como Admin):**
582
- ```powershell
583
- $npmPath = "$env:APPDATA\npm"
584
- [Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";$npmPath", "User")
585
- ```
586
-
587
- **Verificar correção:**
588
- ```bash
589
- morph-spec --version
590
- ```
591
-
592
- ---
593
-
594
- ### `morph-spec doctor` reporta problemas
595
-
596
- **O que o doctor verifica:**
597
- - Versão do CLI (atualizada?)
598
- - Versão do MORPH no projeto
599
- - Comando morph-spec no PATH
600
- - Estrutura de arquivos (.morph/, CLAUDE.md, etc.)
601
-
602
- **Se reportar "morph-spec not in PATH":**
603
- 1. Use `npx` como alternativa (sempre funciona)
604
- 2. Ou siga as instruções acima para adicionar ao PATH
605
-
606
- **Se reportar arquivos faltando:**
607
- ```bash
608
- morph-spec init --force # Reinstala estrutura completa
609
- ```
610
-
611
- ---
612
-
613
- ### Erro ao instalar globalmente no Windows
614
-
615
- **Erro:** `EPERM: operation not permitted`
616
-
617
- **Causa:** Falta de permissões de administrador.
618
-
619
- **Solução:**
620
- 1. Abra PowerShell ou CMD **como Administrador**
621
- 2. Execute: `npm install -g @polymorphism-tech/morph-spec`
622
-
623
- **Alternativa:** Use `npx` (não requer admin):
624
- ```bash
625
- npx @polymorphism-tech/morph-spec init
626
- ```
627
-
628
- ---
629
-
630
- ### nvm-windows específico
631
-
632
- Se você usa **nvm-windows** para gerenciar versões do Node.js:
633
-
634
- **Problema conhecido:** npm global não vai para PATH automaticamente
635
- **Issue oficial:** https://github.com/coreybutler/nvm-windows/issues/391
636
-
637
- **Recomendações:**
638
- 1. **Melhor opção:** Use `npx` para todos os comandos
639
- 2. **Alternativa:** Configure PATH manualmente (ver seção de instalação)
640
- 3. **Verificar:** Execute `morph-spec doctor` para diagnosticar
641
-
642
- ---
643
-
644
- ### Precisa de mais ajuda?
645
-
646
- ```bash
647
- morph-spec doctor # Diagnóstico automático
648
- morph-spec --help # Ver todos os comandos
649
- morph-spec <comando> --help # Ajuda de comando específico
650
- ```
651
-
652
- **Suporte:**
653
- - Email: support@polymorphism.com.br
654
- - Issues: [GitHub](https://github.com/lucasPolymorphism/morph-spec-framework/issues)
655
-
656
- ---
657
-
658
- ## Licença e Distribuição
659
-
660
- **Repositório:** Privado (código fonte protegido)
661
- **Package npm:** Público e gratuito via `@polymorphism-tech/morph-spec`
662
-
663
- ### Licença Proprietária
664
-
665
- O MORPH-SPEC framework é software proprietário da Polymorphism Tech. Veja [LICENSE](LICENSE) para detalhes.
666
-
667
- **Você PODE:**
668
- - Usar o CLI tool gratuitamente
669
- - Gerar projetos para uso pessoal ou comercial
670
- - Modificar código gerado pelos templates
671
- - Distribuir seus projetos criados com MORPH-SPEC
672
-
673
- **Você NÃO PODE:**
674
- - Redistribuir ou vender o framework
675
- - Criar produtos derivados competidores
676
- - Modificar ou fazer engenharia reversa do framework
677
- - Remover avisos de copyright
678
-
679
- ### Código Gerado
680
-
681
- Todo código gerado usando MORPH-SPEC é **100% seu** para usar como quiser, incluindo uso comercial.
682
-
683
- ### Suporte
684
-
685
- - Email: support@polymorphism.com.br
686
- - Website: https://polymorphism.com.br
687
- - npm: [@polymorphism-tech/morph-spec](https://www.npmjs.com/package/@polymorphism-tech/morph-spec)
688
-
689
- ---
690
-
691
- ## Links
692
-
693
- - [npm Package](https://www.npmjs.com/package/@polymorphism-tech/morph-spec)
694
- - [Documentação](docs/)
695
- - [Wiki (Base de Conhecimento)](.wiki/) - 33 artigos sobre .NET, Azure, IA, SaaS e Claude Code
696
- - [Polymorphism Tech](https://polymorphism.com.br)
697
-
698
- ---
699
-
700
- *MORPH-SPEC by Polymorphism Tech*
1
+ # morph-spec
2
+
3
+ > Spec-driven development framework for multi-stack projects. Turns feature requests into implementation-ready code through structured, AI-orchestrated phases.
4
+
5
+ **Package:** `@polymorphism-tech/morph-spec`
6
+ **Version:** 4.6.0
7
+ **Requires:** Node.js 18+, Claude Code
8
+
9
+ ---
10
+
11
+ ## What it does
12
+
13
+ morph-spec enforces a spec-first development workflow. When you ask for a feature, it does not write code immediately. It runs through structured phases (proposal, design, tasks) with approval gates before a single line of implementation is generated. Each phase produces traceable output files. Every decision is documented.
14
+
15
+ It integrates natively with Claude Code: skills become slash commands, agents become native subagents, hooks inject state context automatically, and rules enforce standards based on file paths.
16
+
17
+ ---
18
+
19
+ ## Requirements
20
+
21
+ - [Claude Code](https://claude.ai/code) (latest)
22
+ - Node.js 18+
23
+ - npm 9+ or pnpm
24
+
25
+ ---
26
+
27
+ ## Installation
28
+
29
+ Install the CLI globally:
30
+
31
+ ```bash```
32
+ npm install -g @polymorphism-tech/morph-spec
33
+ ``````
34
+
35
+ Then initialize in your project:
36
+
37
+ ```bash```
38
+ morph-spec init
39
+ ``````
40
+
41
+ Or use the interactive wizard:
42
+
43
+ ```bash```
44
+ morph-spec init --wizard
45
+ ``````
46
+
47
+ ### Init options
48
+
49
+ | Flag | Description |
50
+ |------|-------------|
51
+ | `--wizard` | Interactive step-by-step setup |
52
+ | `--skip-detection` | Skip auto-detection of stack and patterns |
53
+ | `--force` | Overwrite existing installation |
54
+ | `--skip-mcp` | Skip MCP configuration prompt |
55
+
56
+ After init, open the project in Claude Code. The framework activates automatically via `.claude/settings.local.json`.
57
+
58
+ ---
59
+
60
+ ## Project structure (after init)
61
+
62
+ ``````
63
+ your-project/
64
+ ├── CLAUDE.md # AI instructions for this project
65
+ ├── .morph/
66
+ │ ├── config/
67
+ │ │ └── config.json # Project configuration
68
+ │ ├── framework/
69
+ │ │ ├── agents.json # 37 agents in 4 tiers (READ-ONLY)
70
+ │ │ ├── standards/ # Coding and architecture standards (READ-ONLY)
71
+ │ │ └── templates/ # Code and IaC templates (READ-ONLY)
72
+ │ ├── context/ # Project context (README.md, standards.md)
73
+ │ ├── features/ # Active features
74
+ │ │ └── {feature}/
75
+ │ │ ├── 0-proposal/ # User story + acceptance criteria
76
+ │ │ ├── 1-design/ # Technical spec, contracts, decisions
77
+ │ │ ├── 2-ui/ # UI/UX design (optional, UI-heavy features)
78
+ │ │ ├── 3-tasks/ # Atomic task list
79
+ │ │ └── 4-implement/ # Recap and implementation notes
80
+ │ └── state.json # READ-ONLY managed by CLI only
81
+ └── .claude/
82
+ ├── commands/ # Slash commands
83
+ ├── skills/ # Framework skills (flat .md files)
84
+ ├── agents/ # Native subagents (37 agents)
85
+ ├── rules/ # Path-scoped standards rules
86
+ └── settings.local.json # Hooks configuration (11 hooks)
87
+ ``````
88
+
89
+ ---
90
+
91
+ ## Phase workflow
92
+
93
+ Features move through structured phases. Some are optional depending on feature type.
94
+
95
+ ``````
96
+ proposal → setup → [uiux] → design → clarify → tasks → implement → [sync]
97
+ ``````
98
+
99
+ Phases in brackets are optional. `uiux` applies to UI-heavy features. `sync` is a post-implementation reconciliation step.
100
+
101
+ ### Phase outputs
102
+
103
+ | Phase | Directory | Key files |
104
+ |-------|-----------|-----------|
105
+ | Proposal | `0-proposal/` | `proposal.md` |
106
+ | Design | `1-design/` | `spec.md`, `contracts.cs`, `decisions.md` |
107
+ | UI/UX | `2-ui/` | `design-system.md`, `mockups.md`, `components.md`, `flows.md` |
108
+ | Tasks | `3-tasks/` | `tasks.md` |
109
+ | Implement | `4-implement/` | `recap.md` |
110
+
111
+ ### Approval gates
112
+
113
+ - **Design gate** — Spec must be approved before moving to Tasks.
114
+ - **Implementation gate** — Task list must be approved before implementation starts.
115
+
116
+ Check gate status:
117
+
118
+ ```bash```
119
+ morph-spec state show {feature}
120
+ ``````
121
+
122
+ ---
123
+
124
+ ## Slash commands
125
+
126
+ These commands are available inside Claude Code after init.
127
+
128
+ | Command | Description |
129
+ |---------|-------------|
130
+ | `/morph-proposal {feature}` | Full spec pipeline (phases 0-4, pauses at approval gates) |
131
+ | `/morph-apply {feature}` | Implement approved feature (phase 5) |
132
+ | `/morph-status` | Feature status dashboard |
133
+ | `/morph-preflight` | Pre-implementation validation |
134
+
135
+ ---
136
+
137
+ ## CLI reference
138
+
139
+ ### Project management
140
+
141
+ ```bash```
142
+ morph-spec init # Initialize MORPH in current project
143
+ morph-spec init --wizard # Interactive wizard setup
144
+ morph-spec init --skip-detection # Skip stack auto-detection
145
+ morph-spec init --force # Overwrite existing installation
146
+ morph-spec update # Update framework files and re-analyze project
147
+ morph-spec update --wizard # Interactive update
148
+ morph-spec update --skip-detection # Skip detection during update
149
+ morph-spec update --templates # Update templates only
150
+ morph-spec update --standards # Update standards only
151
+ morph-spec doctor # Check installation health
152
+ morph-spec detect # Detect stack, architecture, patterns
153
+ ``````
154
+
155
+ ### Feature workflow
156
+
157
+ ```bash```
158
+ morph-spec state list # List all features and their states
159
+ morph-spec state get {feature} # Get feature state
160
+ morph-spec state set {feature} {key} {value}
161
+ morph-spec state show {feature} # Show phase + approval status
162
+ morph-spec phase advance {feature} # Advance to next phase
163
+ morph-spec task done {feature} # Mark current task complete
164
+ morph-spec task start {feature} # Start next task
165
+ morph-spec task next {feature} # Preview next task
166
+ morph-spec status {feature} # Feature status dashboard
167
+ morph-spec diff {feature} # Spec changes since last snapshot
168
+ morph-spec rollback {feature} # Rollback feature to previous phase
169
+ ``````
170
+
171
+ ### Validation and standards
172
+
173
+ ```bash```
174
+ morph-spec validate # Run all validators
175
+ morph-spec validate {validator} # Run specific validator
176
+ morph-spec standards --list # List all 74 registered standards
177
+ morph-spec standards --list --category {name}
178
+ morph-spec standards --search {query} # Search by name, tag, or ID
179
+ morph-spec standards --show {id} # Print standard content
180
+ morph-spec standards --json # Output as JSON
181
+ ``````
182
+
183
+ ### Utilities
184
+
185
+ ```bash```
186
+ morph-spec cost {bicep-file} # Estimate Azure resource costs
187
+ morph-spec troubleshoot {keywords} # Search known issues and solutions
188
+ morph-spec state checkpoint {feature} # Save state checkpoint
189
+ ``````
190
+
191
+ ---
192
+
193
+ ## Agent hierarchy
194
+
195
+ morph-spec includes 37 agents organized in 4 tiers. Tier 1-2 agents are installed as native Claude Code subagents in `.claude/agents/`. Tier 3 domain agents are installed as `.claude/agents/morph-domain-{name}.md`.
196
+
197
+ ### Tier 1 — Orchestrators (3)
198
+
199
+ | Agent | Role | Active |
200
+ |-------|------|--------|
201
+ | `standards-architect` | Chief Architect — enforces standards across all phases | Always |
202
+ | `ai-system-architect` | AI/Agent system design and orchestration | On-demand |
203
+ | `po-pm-advisor` | Product and project advisory | On-demand |
204
+
205
+ ### Tier 2 — Domain Leaders (3)
206
+
207
+ | Agent | Squad | Active |
208
+ |-------|-------|--------|
209
+ | `dotnet-senior` | Backend squad lead | Always |
210
+ | `azure-architect` | Infrastructure squad lead | Always |
211
+ | `ui-designer` | UI/UX squad lead | On-demand |
212
+
213
+ ### Tier 3 — Specialists (26)
214
+
215
+ Organized into squads:
216
+
217
+ **Backend (10):** C#/.NET specialists, EF Core, Dapper, SignalR, CQRS, Domain modeling, API design, Auth, Background services, Testing
218
+
219
+ **Frontend (3):** Blazor components, Next.js/React, CSS/design system
220
+
221
+ **Infrastructure (5):** Azure Bicep, CI/CD pipelines, Containerization, Monitoring, Cost optimization
222
+
223
+ **Quality/Cross (8):** Security review, Performance, Accessibility, Documentation, Code review, Migration, Integration, Data modeling
224
+
225
+ ### Tier 4 — Validators (5)
226
+
227
+ | Agent | Validates |
228
+ |-------|-----------|
229
+ | `security-expert` | Security vulnerabilities and compliance |
230
+ | `architecture-expert` | Architectural decisions and constraints |
231
+ | `packages-validator` | Package versions and compatibility |
232
+ | `design-system-validator` | Design system adherence |
233
+ | `blazor-concurrency-validator` | Blazor thread safety and concurrency |
234
+
235
+ ---
236
+
237
+ ## Hooks
238
+
239
+ 11 Claude Code hooks are installed into `.claude/settings.local.json` across 8 event types:
240
+
241
+ | Event | Hook | Purpose |
242
+ |-------|------|---------|
243
+ | `SessionStart` | `inject-morph-context.js` | Injects active feature spec into context (3000 char max) |
244
+ | `UserPromptSubmit` | `protect-spec-files.js` | Guards spec files at approval gates |
245
+ | `PreToolUse` | Bash guard (prompt type) | Detects destructive patterns inline |
246
+ | `PreToolUse` | `validate-feature-phase.js` | Validates phase transitions |
247
+ | `PostToolUse` | `track-output-creation.js` | Tracks feature output files as they are written |
248
+ | `PostToolUse` | `checkpoint-trigger.js` | Auto-checkpoints every 3 completed tasks |
249
+ | `PostToolUseFailure` | `handle-tool-failure.js` | Logs failures to `.morph/logs/tool-failures.log` |
250
+ | `Stop` | `session-summary.js` | Writes session summary on stop |
251
+ | `PreCompact` | `compact-context.js` | Preserves critical context before compaction |
252
+ | `Notification` | `morph-notify.js` | Routes approval gate notifications |
253
+
254
+ Protected files (via `permissions.deny`):
255
+ - `.morph/state.json` — never edited directly, CLI only
256
+ - `.morph/framework/**` read-only framework content
257
+
258
+ ---
259
+
260
+ ## Rules
261
+
262
+ Path-scoped rules are installed to `.claude/rules/` and activate automatically based on file patterns:
263
+
264
+ | Rule file | Applies to |
265
+ |-----------|-----------|
266
+ | `morph-workflow.md` | Always active — spec-first mandate, phase commands |
267
+ | `csharp-standards.md` | `**/*.cs`, `**/*.csproj` |
268
+ | `frontend-standards.md` | `**/*.razor`, `**/*.tsx`, `**/*.ts`, `**/*.css` |
269
+ | `testing-standards.md` | `tests/**`, `**/*.test.*`, `**/*.spec.*`, `**/*Tests.cs` |
270
+ | `infrastructure-standards.md` | `**/*.bicep`, `**/Dockerfile`, `**/pipelines/**` |
271
+
272
+ ---
273
+
274
+ ## Stack support
275
+
276
+ | Technology | Support |
277
+ |------------|---------|
278
+ | .NET 10 / ASP.NET Core | Full — C# contracts, EF Core, CQRS, Minimal API |
279
+ | Blazor (WebAssembly / Server / MAUI Hybrid) | Full — components, concurrency, design system |
280
+ | Next.js / React / TypeScript | Full — components, routing, state management |
281
+ | Azure (Bicep) | Full — IaC templates, cost estimation, pipelines |
282
+ | GitHub Actions | Full — CI/CD workflow templates |
283
+ | Supabase | Supported via MCP integration |
284
+
285
+ TypeScript strict mode is enforced by default. See `.morph/framework/standards/` for all coding standards.
286
+
287
+ ---
288
+
289
+ ## Update
290
+
291
+ To update the framework files in an existing project:
292
+
293
+ ```bash```
294
+ morph-spec update
295
+ ``````
296
+
297
+ This re-syncs `.morph/framework/`, `.claude/skills/`, `.claude/agents/`, `.claude/rules/`, and `CLAUDE.md` with the installed package version. Your `.morph/config/config.json`, `.morph/context/`, and feature outputs are not touched.
298
+
299
+ After updating, run `morph-spec doctor` to confirm the installation is healthy.
300
+
301
+ ---
302
+
303
+ ## Key rules
304
+
305
+ **Never skip phases.** Every feature starts with a proposal. No code is written until the design is approved and a task list exists.
306
+
307
+ **Never edit protected files directly:**
308
+ - `.morph/state.json` — use `morph-spec state set`
309
+ - `.morph/framework/**` — read-only, updated by `morph-spec update`
310
+
311
+ **Always document decisions.** Each feature has a `1-design/decisions.md`. Architectural choices go there, not in commit messages.
312
+
313
+ **Checkpoints every 3 tasks.** The framework auto-validates architecture compliance, package versions, and security after every third completed task.
314
+
315
+ ---
316
+
317
+ ## Troubleshooting
318
+
319
+ ### `morph-spec: command not found`
320
+
321
+ If you are using nvm-windows or a Node version manager, the global bin path may not be on `PATH` in your shell. Use `npx` instead:
322
+
323
+ ```bash```
324
+ npx @polymorphism-tech/morph-spec init
325
+ ``````
326
+
327
+ Or add the npm global bin to your PATH:
328
+
329
+ ```bash```
330
+ npm config get prefix
331
+ # Add {prefix}/bin to your PATH
332
+ ``````
333
+
334
+ ### `morph-spec doctor` reports issues
335
+
336
+ Run doctor to see all checks:
337
+
338
+ ```bash```
339
+ morph-spec doctor
340
+ ``````
341
+
342
+ Common fixes:
343
+
344
+ - **Missing `.claude/agents/`** — run `morph-spec update` to reinstall agents
345
+ - **Missing `.claude/rules/`** — run `morph-spec update` to reinstall rules
346
+ - **State version mismatch** — state auto-migrates on next CLI command; if it fails, back up and re-init
347
+ - **Hooks not firing** — confirm `.claude/settings.local.json` exists and contains the `hooks` key
348
+
349
+ ### EPERM on Windows global install
350
+
351
+ Windows may block global npm installs without elevated permissions. Options:
352
+
353
+ 1. Run terminal as Administrator (not recommended long-term)
354
+ 2. Change npm global prefix to a user-writable directory:
355
+
356
+ ```bat```
357
+ mkdir %APPDATA%\npm-global
358
+ npm config set prefix %APPDATA%\npm-global
359
+ :: Add %APPDATA%\npm-global to your PATH
360
+ npm install -g @polymorphism-tech/morph-spec
361
+ ``````
362
+
363
+ 3. Use `npx` for all CLI invocations
364
+
365
+ ### Hook not triggering on SessionStart
366
+
367
+ Ensure `.claude/settings.local.json` is not gitignored in your project. The file must be present for Claude Code to load hooks. If it is missing, re-run `morph-spec init --force`.
368
+
369
+ ---
370
+
371
+ ## Standards registry
372
+
373
+ The framework ships 74 registered standards across 11 categories. Browse them:
374
+
375
+ ```bash```
376
+ morph-spec standards --list
377
+ morph-spec standards --list --category csharp
378
+ morph-spec standards --search "strict mode"
379
+ morph-spec standards --show typescript-strict
380
+ ``````
381
+
382
+ Standards are stored in `.morph/framework/standards/STANDARDS.json` and sourced from `.morph/framework/standards/`.
383
+
384
+ ---
385
+
386
+ ## License
387
+
388
+ Proprietary see [LICENSE](./LICENSE).
389
+
390
+ Code generated by morph-spec (contracts, templates, implementation output) belongs to you.
391
+
392
+ ---
393
+
394
+ *morph-spec v4.6.0 by [Polymorphism Tech](https://polymorphism.tech)*