@polymorphism-tech/morph-spec 4.6.0 → 4.7.1

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 +414 -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
@@ -1,814 +0,0 @@
1
- # MORPH-SPEC Template System
2
-
3
- > **Technology-Based Organization for Multi-Stack Reusability**
4
-
5
- ## Overview
6
-
7
- The MORPH-SPEC template system provides **57 production-ready templates** organized by **technology** (not by stack) to enable maximum reusability across current and future stacks.
8
-
9
- **Key Principle:** Templates are grouped by the **technology they use** (dotnet, typescript, sql, azure, docker), allowing new stacks like `vue-firebase` or `angular-mongodb` to reuse existing templates for .NET, TypeScript, SQL, etc.
10
-
11
- ---
12
-
13
- ## 📁 Directory Structure
14
-
15
- ```
16
- framework/templates/
17
- ├── docs/ # Universal documentation templates
18
- │ ├── proposal.md # Feature proposal (required)
19
- │ └── spec.md # Technical specification (required)
20
-
21
- ├── feature/ # Feature management
22
- │ ├── tasks.md # Implementation tasks (required)
23
- │ ├── decisions.md # Architecture Decision Records (required)
24
- │ └── recap.md # Post-implementation summary (required)
25
-
26
- ├── context/ # Context generation
27
- │ ├── CONTEXT.md # Project-level context
28
- │ └── CONTEXT-FEATURE.md # Feature-level context
29
-
30
- ├── code/ # Code templates organized by technology
31
- │ ├── dotnet/
32
- │ │ ├── backend/
33
- │ │ │ ├── service.cs # Service layer
34
- │ │ │ ├── repository.cs # Data access layer
35
- │ │ │ └── test.cs # Unit tests
36
- │ │ ├── frontend/
37
- │ │ │ └── component.razor # Blazor components
38
- │ │ ├── database/
39
- │ │ │ └── migration.cs # EF Core migrations
40
- │ │ ├── jobs/
41
- │ │ │ ├── job.cs # Hangfire background jobs
42
- │ │ │ └── agent.cs # MS Agent Framework agents
43
- │ │ └── contracts/
44
- │ │ ├── contracts.cs # Base contracts
45
- │ │ ├── Commands.cs # CQRS commands
46
- │ │ ├── Queries.cs # CQRS queries
47
- │ │ ├── Entities.cs # Domain entities
48
- │ │ ├── api-contracts.cs # API contracts
49
- │ │ └── README.md # Contracts documentation
50
- │ │
51
- │ ├── typescript/
52
- │ │ └── contracts.ts # TypeScript type definitions
53
- │ │
54
- │ └── sql/
55
- │ ├── supabase-migration.sql # Basic migration
56
- │ ├── supabase-migration.template.sql # Enhanced migration
57
- │ └── rls-policy.sql # Row-level security
58
-
59
- ├── infrastructure/
60
- │ ├── azure/ # Azure Bicep templates
61
- │ │ ├── main.bicep # Main orchestration (required)
62
- │ │ ├── container-app.bicep # Container Apps
63
- │ │ ├── container-app-env.bicep # Container environment
64
- │ │ ├── app-service.bicep # App Service
65
- │ │ ├── sql-database.bicep # Azure SQL
66
- │ │ ├── storage.bicep # Storage Account
67
- │ │ ├── key-vault.bicep # Key Vault
68
- │ │ ├── app-insights.bicep # Application Insights
69
- │ │ ├── parameters.dev.json # Dev parameters
70
- │ │ ├── parameters.staging.json # Staging parameters
71
- │ │ ├── parameters.prod.json # Prod parameters
72
- │ │ ├── deploy.ps1 # PowerShell deploy
73
- │ │ ├── deploy.sh # Bash deploy
74
- │ │ ├── deploy-checklist.md # Pre-deploy checklist
75
- │ │ ├── azure-pipelines-deploy.yml # Azure DevOps
76
- │ │ ├── Dockerfile.example # Dockerfile example
77
- │ │ └── README.md # Infrastructure docs
78
- │ │
79
- │ ├── docker/ # Docker & EasyPanel
80
- │ │ ├── dockerfile-api.dockerfile # .NET API
81
- │ │ ├── dockerfile-web.dockerfile # Next.js web
82
- │ │ ├── Dockerfile.template # Generic
83
- │ │ ├── docker-compose.template.yml # Compose
84
- │ │ └── easypanel.template.json # EasyPanel config
85
- │ │
86
- │ └── github/ # GitHub Actions CI/CD
87
- │ ├── workflows/ # Reusable workflow templates
88
- │ │ ├── dotnet-build.yml.hbs # .NET restore, build, test
89
- │ │ ├── docker-build-push.yml.hbs # Docker build & push
90
- │ │ ├── deploy-azure-app-service.yml.hbs # Azure App Service deployment
91
- │ │ └── deploy-easypanel.yml.hbs # EasyPanel deployment
92
- │ │
93
- │ ├── actions/ # Composite action templates
94
- │ │ ├── docker-build-push/action.yml.hbs
95
- │ │ ├── health-check/action.yml.hbs
96
- │ │ └── azure-auth/action.yml.hbs
97
- │ │
98
- │ └── README.md # GitHub Actions docs
99
-
100
- ├── integrations/ # Platform-agnostic integrations
101
- │ ├── asaas-client.cs # Asaas financial API
102
- │ ├── asaas-webhook.cs # Asaas webhooks
103
- │ ├── azure-identity-config.cs # Azure AD/Entra
104
- │ └── clerk-config.cs # Clerk auth
105
-
106
- ├── ui/ # Design systems
107
- │ ├── design-system.css # CSS tokens
108
- │ ├── FluentDesignTheme.cs # Fluent UI theme
109
- │ └── MudTheme.cs # MudBlazor theme
110
-
111
- ├── saas/ # Multi-tenant patterns
112
- │ ├── subscription.cs # Subscription model
113
- │ └── tenant.cs # Tenant model
114
-
115
- ├── examples/ # Reference implementations
116
- │ ├── spec-examples.md # Example specs
117
- │ └── design-system-examples.md # Design system examples
118
-
119
- └── REGISTRY.json # Template metadata registry
120
- ```
121
-
122
- ---
123
-
124
- ## 🏗️ Technology-Based Architecture
125
-
126
- **Why organize by technology instead of by stack?**
127
-
128
- | Organization | Pros | Cons | Best For |
129
- |--------------|------|------|----------|
130
- | **By Stack** (old v1) | Stack-specific optimizations | Duplicate templates, hard to reuse | Single-stack projects |
131
- | **By Technology** (new v2) | Reusable, DRY, future-proof | Requires stack override mechanism | Multi-stack frameworks |
132
-
133
- **Example:** A `.NET service.cs` template works for both `blazor-azure` and `nextjs-supabase` stacks (both use .NET backend). No need to duplicate!
134
-
135
- **Future-proof:** When we create `vue-firebase` stack, we can reuse:
136
- - `code/typescript/` templates
137
- - `infrastructure/docker/` templates
138
- - `integrations/` templates (Clerk, etc.)
139
-
140
- **Only create NEW templates for Vue-specific code.**
141
-
142
- ---
143
-
144
- ## ⚙️ Template Engine: Handlebars
145
-
146
- All templates use **Handlebars** with **20+ custom helpers**.
147
-
148
- ### Basic Syntax
149
-
150
- ```handlebars
151
- # Feature: {{titleCase FEATURE_NAME}}
152
-
153
- Namespace: {{pascalCase FEATURE_NAME}}
154
-
155
- Created: {{DATE}}
156
- ```
157
-
158
- ### Available Helpers
159
-
160
- | Helper | Input | Output | Usage |
161
- |--------|-------|--------|-------|
162
- | `{{pascalCase str}}` | `user-profile` | `UserProfile` | Class names |
163
- | `{{camelCase str}}` | `user-profile` | `userProfile` | Variable names |
164
- | `{{snakeCase str}}` | `user-profile` | `user_profile` | SQL tables |
165
- | `{{upperSnakeCase str}}` | `user-profile` | `USER_PROFILE` | Constants |
166
- | `{{titleCase str}}` | `user-profile` | `User Profile` | Titles |
167
- | `{{kebabCase str}}` | `User Profile` | `user-profile` | URLs |
168
- | `{{pluralize str}}` | `user` | `users` | Collections |
169
- | `{{singularize str}}` | `users` | `user` | Entities |
170
- | `{{eq a b}}` | `"blazor" "blazor"` | `true` | Conditionals |
171
- | `{{or a b}}` | `false true` | `true` | Logical OR |
172
- | `{{and a b}}` | `true false` | `false` | Logical AND |
173
- | `{{default val fallback}}` | `null "default"` | `"default"` | Defaults |
174
-
175
- ### Conditional Logic
176
-
177
- ```handlebars
178
- {{#if (eq STACK "blazor-azure")}}
179
- // Azure-specific code
180
- {{else if (eq STACK "nextjs-supabase")}}
181
- // Supabase-specific code
182
- {{else}}
183
- // Generic code
184
- {{/if}}
185
- ```
186
-
187
- ### Deprecated: Pre-computed Variables
188
-
189
- **❌ Old (v1):**
190
- ```handlebars
191
- {{pascalCase FEATURE_NAME}} <!-- Pre-computed in bin/render-template.js -->
192
- ```
193
-
194
- **✅ New (v2):**
195
- ```handlebars
196
- {{pascalCase FEATURE_NAME}} <!-- Computed via Handlebars helper -->
197
- ```
198
-
199
- ---
200
-
201
- ## 🛠️ CLI Commands
202
-
203
- ### List All Templates
204
-
205
- ```bash
206
- # List all templates
207
- morph-spec template list
208
-
209
- # Filter by category
210
- morph-spec template list --category code
211
- morph-spec template list --category infrastructure
212
-
213
- # Filter by phase
214
- morph-spec template list --phase implement
215
-
216
- # Filter by stack applicability
217
- morph-spec template list --stack blazor-azure
218
-
219
- # Show only required templates
220
- morph-spec template list --required
221
- ```
222
-
223
- **Output:**
224
- ```
225
- 📦 Universal Templates (9)
226
- proposal Feature Proposal [REQUIRED] [UNIVERSAL] [HBS]
227
- spec Technical Specification [REQUIRED] [UNIVERSAL] [HBS]
228
- tasks Implementation Tasks [REQUIRED] [UNIVERSAL] [HBS]
229
- ...
230
-
231
- 📦 Technology-Based Templates (48)
232
- dotnet-backend-service .NET Service Class [UNIVERSAL] [HBS] (dotnet)
233
- typescript-contracts TypeScript Contracts [UNIVERSAL] [HBS] (typescript)
234
- azure-bicep-main Main Bicep Orchestration [REQUIRED] [UNIVERSAL] [HBS] (bicep)
235
- ...
236
- ```
237
-
238
- ### Show Template Details
239
-
240
- ```bash
241
- # Show metadata
242
- morph-spec template show dotnet-backend-service
243
-
244
- # Show with file preview
245
- morph-spec template show dotnet-backend-service --preview
246
-
247
- # Show with resolved path
248
- morph-spec template show dotnet-backend-service --show-path
249
- ```
250
-
251
- **Output:**
252
- ```
253
- Template: dotnet-backend-service
254
-
255
- 📋 Metadata
256
- ID: dotnet-backend-service
257
- Name: .NET Service Class
258
- Path: code/dotnet/backend/service.cs
259
- Location: framework
260
- Category: code
261
- Phase: implement
262
- Required: No
263
- Technology: dotnet
264
- Applicable Stacks: blazor-azure, nextjs-supabase
265
-
266
- 📝 Description
267
- C# service class template with dependency injection and interface pattern
268
-
269
- 🔑 Variables
270
- {{FEATURE_NAME}}
271
- {{NAMESPACE}}
272
-
273
- 📄 Output Name
274
- {FeatureName}Service.cs
275
-
276
- 💡 Usage Hint
277
- morph-spec template render dotnet-backend-service output.cs '{"FEATURE_NAME":"user-auth","NAMESPACE":"MyApp"}'
278
- ```
279
-
280
- ### Render Template
281
-
282
- ```bash
283
- # Render to file
284
- morph-spec template render dotnet-backend-service UserAuthService.cs '{
285
- "FEATURE_NAME": "user-auth",
286
- "NAMESPACE": "MyApp.Services"
287
- }'
288
-
289
- # Dry run (preview only)
290
- morph-spec template render dotnet-backend-service output.cs '{"FEATURE_NAME":"test"}' --dry-run
291
-
292
- # Auto-resolve path (searches framework → stack override)
293
- morph-spec template render proposal proposal.md '{"FEATURE_NAME":"auth"}' --resolve-path
294
- ```
295
-
296
- **Default Variables (auto-injected):**
297
- - `DATE`: `2026-02-17`
298
- - `YEAR`: `2026`
299
- - `TIMESTAMP`: `2026-02-17T19:38:00.000Z`
300
-
301
- ### Customize Template (Stack Override)
302
-
303
- ```bash
304
- # Copy to stack-specific directory (override framework version)
305
- morph-spec template customize dotnet-backend-service --stack blazor-azure
306
-
307
- # Copy to project-local (cross-stack override)
308
- morph-spec template customize dotnet-backend-service --local
309
-
310
- # Force overwrite if exists
311
- morph-spec template customize dotnet-backend-service --stack blazor-azure --force
312
- ```
313
-
314
- **Output:**
315
- ```
316
- Source: framework/templates/code/dotnet/backend/service.cs
317
- Destination: stacks/blazor-azure/.morph/framework/templates/code/dotnet/backend/service.cs
318
-
319
- ✅ Template copied for customization
320
-
321
- 📝 Next Steps
322
- 1. Edit the template file:
323
- stacks/blazor-azure/.morph/framework/templates/code/dotnet/backend/service.cs
324
-
325
- 2. Template will now be used instead of framework version
326
- (Stack-specific templates take precedence)
327
-
328
- 3. Test rendering:
329
- morph-spec template render dotnet-backend-service output.cs '{"FEATURE_NAME":"test"}'
330
-
331
- ⚠️ Customized templates won't receive framework updates
332
- To get updates: delete customized version and re-run this command
333
- ```
334
-
335
- ---
336
-
337
- ## 🔄 GitHub Actions Templates
338
-
339
- The framework provides reusable GitHub Actions workflows and composite actions for CI/CD automation.
340
-
341
- ### Structure
342
-
343
- ```
344
- infrastructure/github/
345
- ├── workflows/ # Reusable workflow templates
346
- │ ├── dotnet-build.yml.hbs # .NET restore, build, test
347
- │ ├── docker-build-push.yml.hbs # Docker build & push
348
- │ ├── deploy-azure-app-service.yml.hbs # Azure App Service deployment
349
- │ └── deploy-easypanel.yml.hbs # EasyPanel deployment
350
-
351
- └── actions/ # Composite action templates
352
- ├── docker-build-push/action.yml.hbs
353
- ├── health-check/action.yml.hbs
354
- └── azure-auth/action.yml.hbs
355
- ```
356
-
357
- ### Reusable Workflows vs Composite Actions
358
-
359
- | Type | Purpose | Location | Usage |
360
- |------|---------|----------|-------|
361
- | **Reusable Workflows** | Complete CI/CD pipelines (multi-job) | `workflows/*.yml.hbs` | Called via `uses:` from stack workflows |
362
- | **Composite Actions** | Reusable step logic (single responsibility) | `actions/*/action.yml.hbs` | Called via `uses:` in workflow steps |
363
-
364
- ### Deployment Strategy Difference
365
-
366
- **Blazor-Azure:** Direct .NET publish to Azure App Service (no Docker)
367
- - `dotnet publish` → `azure/webapps-deploy@v2`
368
- - Bicep deploys App Service Plan + App Service
369
- - Authentication: OIDC (Federated Identity)
370
-
371
- **NextJS-Supabase:** Docker containers to EasyPanel
372
- - `docker build` → `docker push` → EasyPanel webhook
373
- - Multi-service deployment (API + Web)
374
- - Registry: GitHub Container Registry (ghcr.io)
375
-
376
- ### Template Rendering
377
-
378
- **GitHub Actions Constraint:**
379
- - ❌ GitHub Actions CANNOT reference parent directories (`../../../../framework/`)
380
- - ✅ Solution: Framework templates are **rendered** into each stack's `.github/` directory
381
- - Rendered `.yml` files are **committed** to repos (not `.yml.hbs` templates)
382
-
383
- **Rendering Process:**
384
- ```bash
385
- # Render all GitHub Actions templates for a stack (manual for now)
386
- # Future: morph-spec template render github-workflows --stack blazor-azure
387
- ```
388
-
389
- ### Handlebars Variables
390
-
391
- - `{{APP_NAME}}` - Application name from config.json
392
- - `{{DOTNET_VERSION}}` - .NET SDK version
393
- - `{{GITHUB_OWNER}}` - GitHub organization/user
394
- - `{{kebabCase APP_NAME}}` - Docker image name format
395
- - `${{{{ inputs.* }}}}` - GitHub Actions runtime syntax (escaped with `{{{{raw}}}}`)
396
-
397
- ### Authentication & Secrets
398
-
399
- **Azure (Blazor-Azure):**
400
- ```yaml
401
- # OIDC (Federated Identity) - Recommended
402
- - uses: azure/login@v1
403
- with:
404
- client-id: ${{{{ secrets.AZURE_CLIENT_ID }}}}
405
- tenant-id: ${{{{ secrets.AZURE_TENANT_ID }}}}
406
- subscription-id: ${{{{ secrets.AZURE_SUBSCRIPTION_ID }}}}
407
- ```
408
-
409
- **Docker Registry (NextJS-Supabase):**
410
- ```yaml
411
- # GitHub Container Registry (ghcr.io)
412
- - uses: docker/login-action@v3
413
- with:
414
- registry: ghcr.io
415
- username: ${{{{ github.actor }}}}
416
- password: ${{{{ secrets.GITHUB_TOKEN }}}}
417
- ```
418
-
419
- **GitHub Secrets to Configure:**
420
- - Blazor-Azure: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_SUBSCRIPTION_ID`
421
- - NextJS-Supabase: `GITHUB_TOKEN` (auto), `EASYPANEL_API_TOKEN`
422
-
423
- ### Example: Blazor-Azure CI/CD
424
-
425
- **CI Build Workflow** (`stacks/blazor-azure/.morph/framework/templates/infrastructure/github/workflows/ci-build.yml.hbs`):
426
- ```yaml
427
- name: CI Build
428
-
429
- on:
430
- pull_request:
431
- branches: [main, staging]
432
-
433
- jobs:
434
- build:
435
- uses: ./.github/workflows/dotnet-build.yml # Framework template (rendered)
436
- with:
437
- dotnet-version: '{{DOTNET_VERSION}}'
438
- run-tests: true
439
-
440
- security:
441
- runs-on: ubuntu-latest
442
- steps:
443
- - uses: actions/checkout@v4
444
- - name: Check vulnerable packages
445
- run: dotnet list package --vulnerable --include-transitive
446
- ```
447
-
448
- **Production Deployment** (`cd-prod.yml.hbs`):
449
- ```yaml
450
- name: Deploy to Production
451
-
452
- on:
453
- push:
454
- branches: [main]
455
-
456
- jobs:
457
- build:
458
- uses: ./.github/workflows/dotnet-build.yml
459
- with:
460
- dotnet-version: '{{DOTNET_VERSION}}'
461
- secrets: inherit
462
-
463
- deploy:
464
- needs: build
465
- uses: ./.github/workflows/deploy-azure-app-service.yml
466
- with:
467
- environment: 'production'
468
- resource-group: 'rg-{{kebabCase APP_NAME}}-prod'
469
- app-service-name: 'app-{{kebabCase APP_NAME}}-prod'
470
- secrets: inherit
471
- ```
472
-
473
- ### Stack-Specific Overrides
474
-
475
- Stack-specific workflow templates in:
476
- - `stacks/blazor-azure/.morph/framework/templates/infrastructure/github/workflows/`
477
- - `stacks/nextjs-supabase/.morph/framework/templates/infrastructure/github/workflows/`
478
-
479
- **Resolution Order:**
480
- 1. Project-local: `.morph/framework/templates/infrastructure/github/workflows/ci-build.yml.hbs`
481
- 2. Stack default: `stacks/{stack}/.morph/framework/templates/infrastructure/github/workflows/ci-build.yml.hbs`
482
- 3. Framework fallback: `framework/templates/infrastructure/github/workflows/dotnet-build.yml.hbs`
483
-
484
- ---
485
-
486
- ## 🔀 Stack Override Mechanism
487
-
488
- **Resolution Order:**
489
-
490
- 1. **Stack-specific override** (highest priority)
491
- - `stacks/{stack}/.morph/framework/templates/code/dotnet/backend/service.cs`
492
-
493
- 2. **Project-local override** (medium priority)
494
- - `.morph/framework/templates/code/dotnet/backend/service.cs`
495
-
496
- 3. **Framework template** (fallback)
497
- - `framework/templates/code/dotnet/backend/service.cs`
498
-
499
- **Use Cases for Overrides:**
500
-
501
- | Scenario | Override Location | Example |
502
- |----------|-------------------|---------|
503
- | Stack-specific tweak | `stacks/{stack}/.morph/framework/templates/` | Blazor uses different DI pattern |
504
- | Project-wide customization | `.morph/framework/templates/` | Company-specific code style |
505
- | Use framework default | None (no override) | Standard templates work fine |
506
-
507
- **Example:**
508
-
509
- ```bash
510
- # Create stack override for Blazor
511
- morph-spec template customize dotnet-backend-service --stack blazor-azure
512
-
513
- # Edit the override
514
- code stacks/blazor-azure/.morph/framework/templates/code/dotnet/backend/service.cs
515
-
516
- # Now all renders for blazor-azure will use the override
517
- morph-spec template render dotnet-backend-service UserService.cs '...' --stack blazor-azure
518
- ```
519
-
520
- ---
521
-
522
- ## 📊 Template Registry (REGISTRY.json)
523
-
524
- The `REGISTRY.json` file is the **single source of truth** for all template metadata.
525
-
526
- ### Schema
527
-
528
- ```json
529
- {
530
- "version": "2.0.0",
531
- "templates": [
532
- {
533
- "id": "dotnet-backend-service",
534
- "name": ".NET Service Class",
535
- "path": "code/dotnet/backend/service.cs",
536
- "location": "framework",
537
- "category": "code",
538
- "phase": "implement",
539
- "required": false,
540
- "technology": "dotnet",
541
- "applicableStacks": ["blazor-azure", "nextjs-supabase"],
542
- "engine": "handlebars",
543
- "placeholders": ["FEATURE_NAME", "NAMESPACE"],
544
- "outputName": "{FeatureName}Service.cs",
545
- "deprecated": false
546
- }
547
- ]
548
- }
549
- ```
550
-
551
- ### Discovery API
552
-
553
- ```javascript
554
- import {
555
- getAllTemplates,
556
- getTemplateById,
557
- getTemplatesByCategory,
558
- getTemplatesByTechnology,
559
- resolveTemplatePathById
560
- } from '../src/lib/template-registry.js';
561
-
562
- // Get all templates
563
- const all = getAllTemplates();
564
-
565
- // Get specific template
566
- const service = getTemplateById('dotnet-backend-service');
567
-
568
- // Filter by category
569
- const codeTemplates = getTemplatesByCategory('code');
570
-
571
- // Filter by technology
572
- const dotnetTemplates = getTemplatesByTechnology('dotnet');
573
-
574
- // Resolve path with fallback
575
- const path = resolveTemplatePathById('dotnet-backend-service', '/project', 'blazor-azure');
576
- // Returns: framework/templates/code/dotnet/backend/service.cs
577
- // Or: stacks/blazor-azure/.morph/framework/templates/code/dotnet/backend/service.cs (if override exists)
578
- ```
579
-
580
- ---
581
-
582
- ## 🚀 Creating New Templates
583
-
584
- ### 1. Create Template File
585
-
586
- ```bash
587
- # For .NET templates
588
- touch framework/templates/code/dotnet/backend/my-template.cs
589
-
590
- # For infrastructure templates
591
- touch framework/templates/infrastructure/azure/my-resource.bicep
592
- ```
593
-
594
- ### 2. Add Handlebars Placeholders
595
-
596
- ```handlebars
597
- namespace {{pascalCase NAMESPACE}};
598
-
599
- public class {{pascalCase FEATURE_NAME}}Service
600
- {
601
- // TODO: Implement {{titleCase FEATURE_NAME}} logic
602
- }
603
- ```
604
-
605
- ### 3. Register in REGISTRY.json
606
-
607
- ```json
608
- {
609
- "id": "dotnet-backend-my-template",
610
- "name": "My Custom Template",
611
- "path": "code/dotnet/backend/my-template.cs",
612
- "location": "framework",
613
- "category": "code",
614
- "phase": "implement",
615
- "required": false,
616
- "technology": "dotnet",
617
- "applicableStacks": ["blazor-azure"],
618
- "engine": "handlebars",
619
- "placeholders": ["FEATURE_NAME", "NAMESPACE"],
620
- "outputName": "{FeatureName}MyTemplate.cs",
621
- "deprecated": false
622
- }
623
- ```
624
-
625
- ### 4. Test Rendering
626
-
627
- ```bash
628
- morph-spec template render dotnet-backend-my-template output.cs '{
629
- "FEATURE_NAME": "user-auth",
630
- "NAMESPACE": "MyApp.Services"
631
- }'
632
- ```
633
-
634
- ---
635
-
636
- ## 📦 Migration Guide: v1 → v2
637
-
638
- ### What Changed
639
-
640
- | Aspect | v1 (Stack-Based) | v2 (Technology-Based) |
641
- |--------|------------------|----------------------|
642
- | **Location** | `stacks/{stack}/.morph/framework/templates/` | `framework/templates/{technology}/` |
643
- | **Organization** | By stack (blazor-azure, nextjs-supabase) | By technology (dotnet, azure, docker) |
644
- | **Duplication** | High (proposal.md × 2, decisions.md × 2) | Low (shared templates in framework) |
645
- | **Template Engine** | 3 engines (custom, Handlebars, mixed) | 1 engine (Handlebars with helpers) |
646
- | **Pre-computed Variables** | `{{pascalCase FEATURE_NAME}}` | `{{pascalCase FEATURE_NAME}}` (helpers) |
647
- | **Registry** | None (hardcoded paths) | `REGISTRY.json` (centralized metadata) |
648
- | **CLI** | None | `morph-spec template list/show/render/customize` |
649
- | **Future Stacks** | Must copy templates | Reuse existing technology templates |
650
-
651
- ### Breaking Changes
652
-
653
- **1. Template Paths**
654
-
655
- ```diff
656
- - stacks/blazor-azure/.morph/framework/templates/service.cs
657
- + framework/templates/code/dotnet/backend/service.cs
658
-
659
- - stacks/blazor-azure/.morph/framework/templates/infra/main.bicep
660
- + framework/templates/infrastructure/azure/main.bicep
661
-
662
- - stacks/nextjs-supabase/.morph/framework/templates/dockerfile-web.dockerfile
663
- + framework/templates/infrastructure/docker/dockerfile-web.dockerfile
664
- ```
665
-
666
- **2. Pre-computed Variables**
667
-
668
- ```diff
669
- - {{pascalCase FEATURE_NAME}}
670
- + {{pascalCase FEATURE_NAME}}
671
-
672
- - {{camelCase FEATURE_NAME}}
673
- + {{camelCase FEATURE_NAME}}
674
-
675
- - {{snakeCase FEATURE_NAME}}
676
- + {{snakeCase FEATURE_NAME}}
677
- ```
678
-
679
- **3. Template Resolution**
680
-
681
- ```javascript
682
- // Old (v1)
683
- const templatePath = join(resolveTemplatesDir(projectPath), 'service.cs');
684
-
685
- // New (v2)
686
- const templatePath = resolveTemplatePath(projectPath, 'code/dotnet/backend/service.cs', stackId);
687
- // Automatically falls back: stack override → framework
688
- ```
689
-
690
- ### Migration Steps
691
-
692
- **Step 1:** Update code to use `resolveTemplatePath()`
693
-
694
- ```javascript
695
- import { resolveTemplatePath } from '../lib/stack-resolver.js';
696
-
697
- // Before
698
- const path = join(resolveTemplatesDir(process.cwd()), 'service.cs');
699
-
700
- // After
701
- const path = resolveTemplatePath(process.cwd(), 'code/dotnet/backend/service.cs', 'blazor-azure');
702
- ```
703
-
704
- **Step 2:** Update template syntax to Handlebars
705
-
706
- ```handlebars
707
- <!-- Before -->
708
- namespace {{NAMESPACE}};
709
- public class {{pascalCase FEATURE_NAME}}Service { }
710
-
711
- <!-- After -->
712
- namespace {{pascalCase NAMESPACE}};
713
- public class {{pascalCase FEATURE_NAME}}Service { }
714
- ```
715
-
716
- **Step 3:** Use CLI commands instead of hardcoded paths
717
-
718
- ```bash
719
- # Before (hardcoded)
720
- cp framework/templates/proposal.md .morph/features/user-auth/proposal.md
721
-
722
- # After (CLI)
723
- morph-spec template render proposal .morph/features/user-auth/proposal.md '{
724
- "FEATURE_NAME": "user-auth"
725
- }'
726
- ```
727
-
728
- ---
729
-
730
- ## 🎯 Best Practices
731
-
732
- ### 1. **Use Helpers, Not Pre-computed Variables**
733
-
734
- ```handlebars
735
- ✅ GOOD:
736
- {{pascalCase FEATURE_NAME}}Service
737
-
738
- ❌ BAD:
739
- {{pascalCase FEATURE_NAME}}Service // Deprecated, won't work
740
- ```
741
-
742
- ### 2. **Keep Templates Technology-Agnostic**
743
-
744
- ```handlebars
745
- ✅ GOOD: code/dotnet/backend/service.cs
746
- Works for: blazor-azure, nextjs-supabase, future-dotnet-stack
747
-
748
- ❌ BAD: code/blazor/service.cs
749
- Locked to Blazor only
750
- ```
751
-
752
- ### 3. **Use Stack Conditionals for Differences**
753
-
754
- ```handlebars
755
- {{#if (eq STACK "blazor-azure")}}
756
- // Azure-specific implementation
757
- {{else if (eq STACK "nextjs-supabase")}}
758
- // Supabase-specific implementation
759
- {{else}}
760
- // Generic implementation
761
- {{/if}}
762
- ```
763
-
764
- ### 4. **Document Applicability in Registry**
765
-
766
- ```json
767
- {
768
- "technology": "dotnet",
769
- "applicableStacks": ["blazor-azure", "nextjs-supabase"],
770
- "description": "Works with any .NET backend stack"
771
- }
772
- ```
773
-
774
- ### 5. **Override Only When Necessary**
775
-
776
- ```bash
777
- # Only customize if framework template doesn't meet needs
778
- morph-spec template customize dotnet-backend-service --stack blazor-azure
779
-
780
- # Otherwise, use framework version (gets updates automatically)
781
- morph-spec template render dotnet-backend-service output.cs '...'
782
- ```
783
-
784
- ---
785
-
786
- ## 📚 References
787
-
788
- - **Template Registry API:** [`src/lib/template-registry.js`](../../src/lib/template-registry.js)
789
- - **Template Renderer:** [`src/lib/template-renderer.js`](../../src/lib/template-renderer.js)
790
- - **Stack Resolver:** [`src/lib/stack-resolver.js`](../../src/lib/stack-resolver.js)
791
- - **CLI Commands:** [`src/commands/template-*.js`](../../src/commands/)
792
- - **Handlebars Docs:** https://handlebarsjs.com/
793
-
794
- ---
795
-
796
- ## 🤝 Contributing
797
-
798
- ### Adding New Technology
799
-
800
- 1. Create directory: `framework/templates/code/{technology}/`
801
- 2. Add templates with Handlebars syntax
802
- 3. Register in `REGISTRY.json` with `"technology": "{technology}"`
803
- 4. Test with `morph-spec template render`
804
- 5. Document in this README
805
-
806
- ### Deprecating Templates
807
-
808
- 1. Add `"deprecated": true` to `REGISTRY.json`
809
- 2. Add `"deprecationReason": "Reason here"`
810
- 3. Keep file for backward compatibility or remove after major version bump
811
-
812
- ---
813
-
814
- **MORPH-SPEC Template System v2.0** - Technology-Based, Future-Proof, DRY ✨