@polymorphism-tech/morph-spec 4.3.2 → 4.3.4

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 (414) hide show
  1. package/.morph/analytics/threads-log.jsonl +9 -0
  2. package/{stacks/blazor-azure/.morph → .morph}/config/config.json +9 -9
  3. package/.morph/state.json +48 -0
  4. package/bin/detect-agents.js +1 -2
  5. package/bin/morph-spec.js +2 -15
  6. package/{stacks/nextjs-supabase/.morph/config → framework}/agents.json +948 -948
  7. package/{stacks/nextjs-supabase/.claude → framework}/commands/morph-infra.md +1 -1
  8. package/framework/hooks/README.md +282 -0
  9. package/framework/hooks/agent-stop/validate-and-continue.js +96 -0
  10. package/framework/hooks/agent-stop/validate-checkpoints.js +101 -0
  11. package/framework/hooks/agent-stop/validate-tests.js +109 -0
  12. package/framework/hooks/agent-teams/dispatch.js +67 -0
  13. package/framework/hooks/agent-teams/phase-advanced.js +80 -0
  14. package/framework/hooks/agent-teams/task-completed.js +76 -0
  15. package/framework/hooks/agent-teams/teammate-idle.js +70 -0
  16. package/framework/hooks/commit-msg/conventional-commits.sh +33 -0
  17. package/framework/hooks/pre-commit/agents.sh +25 -0
  18. package/framework/hooks/pre-commit/orchestrator.sh +64 -0
  19. package/framework/hooks/pre-commit/specs.sh +50 -0
  20. package/framework/hooks/pre-push/run-tests.sh +44 -0
  21. package/framework/index/troubleshooting-index.json +184 -0
  22. package/framework/memory/patterns-learned.md +766 -0
  23. package/framework/skills/level-0-meta/README.md +7 -0
  24. package/framework/skills/level-0-meta/code-review.md +226 -0
  25. package/framework/skills/level-0-meta/morph-checklist.md +117 -0
  26. package/framework/skills/level-0-meta/simulation-checklist.md +77 -0
  27. package/framework/skills/level-1-workflows/README.md +7 -0
  28. package/framework/skills/level-1-workflows/morph-replicate.md +213 -0
  29. package/framework/skills/level-1-workflows/phase-clarify.md +131 -0
  30. package/framework/skills/level-1-workflows/phase-design.md +213 -0
  31. package/framework/skills/level-1-workflows/phase-setup.md +106 -0
  32. package/framework/skills/level-1-workflows/phase-tasks.md +164 -0
  33. package/framework/skills/level-1-workflows/phase-uiux.md +169 -0
  34. package/framework/skills/level-2-domains/README.md +14 -0
  35. package/framework/skills/level-2-domains/ai-agents/ai-system-architect.md +192 -0
  36. package/framework/skills/level-2-domains/architecture/po-pm-advisor.md +197 -0
  37. package/framework/skills/level-2-domains/architecture/prompt-engineer.md +189 -0
  38. package/framework/skills/level-2-domains/architecture/seo-growth-hacker.md +320 -0
  39. package/framework/skills/level-2-domains/architecture/standards-architect.md +156 -0
  40. package/framework/skills/level-2-domains/backend/api-designer.md +59 -0
  41. package/framework/skills/level-2-domains/backend/dotnet-senior.md +77 -0
  42. package/framework/skills/level-2-domains/backend/ef-modeler.md +58 -0
  43. package/framework/skills/level-2-domains/backend/hangfire-orchestrator.md +126 -0
  44. package/framework/skills/level-2-domains/backend/ms-agent-expert.md +45 -0
  45. package/framework/skills/level-2-domains/frontend/blazor-builder.md +210 -0
  46. package/framework/skills/level-2-domains/frontend/nextjs-expert.md +154 -0
  47. package/framework/skills/level-2-domains/frontend/ui-ux-designer.md +191 -0
  48. package/framework/skills/level-2-domains/infrastructure/azure-architect.md +142 -0
  49. package/framework/skills/level-2-domains/infrastructure/azure-deploy-specialist.md +699 -0
  50. package/framework/skills/level-2-domains/infrastructure/bicep-architect.md +126 -0
  51. package/framework/skills/level-2-domains/infrastructure/container-specialist.md +131 -0
  52. package/framework/skills/level-2-domains/infrastructure/devops-engineer.md +119 -0
  53. package/framework/skills/level-2-domains/integrations/asaas-financial.md +130 -0
  54. package/framework/skills/level-2-domains/integrations/azure-identity.md +142 -0
  55. package/framework/skills/level-2-domains/integrations/clerk-auth.md +108 -0
  56. package/framework/skills/level-2-domains/integrations/hangfire-orchestrator.md +64 -0
  57. package/framework/skills/level-2-domains/integrations/resend-email.md +119 -0
  58. package/framework/skills/level-2-domains/quality/code-analyzer.md +235 -0
  59. package/framework/skills/level-2-domains/quality/testing-specialist.md +126 -0
  60. package/framework/skills/level-3-technologies/README.md +7 -0
  61. package/framework/skills/level-4-patterns/README.md +7 -0
  62. package/framework/squad-templates/backend-only.json +34 -0
  63. package/framework/squad-templates/frontend-only.json +34 -0
  64. package/framework/squad-templates/full-stack.json +52 -0
  65. package/framework/templates/.idea/morph-templates.xml +92 -0
  66. package/framework/templates/.vscode/morph-templates.code-snippets +186 -0
  67. package/framework/templates/IDE-SNIPPETS.md +266 -0
  68. package/framework/templates/README.md +814 -0
  69. package/framework/templates/REGISTRY.json +1677 -0
  70. package/framework/templates/code/dotnet/backend/repository.cs +141 -0
  71. package/framework/templates/code/dotnet/backend/service.cs +139 -0
  72. package/framework/templates/code/dotnet/contracts/Commands.cs +74 -0
  73. package/framework/templates/code/dotnet/contracts/Entities.cs +25 -0
  74. package/framework/templates/code/dotnet/contracts/Queries.cs +74 -0
  75. package/framework/templates/code/dotnet/contracts/README.md +74 -0
  76. package/framework/templates/code/dotnet/contracts/api-contracts.cs +173 -0
  77. package/framework/templates/code/dotnet/contracts/contracts.cs +217 -0
  78. package/framework/templates/code/dotnet/database/migration.cs +83 -0
  79. package/framework/templates/code/dotnet/frontend/component.razor +239 -0
  80. package/framework/templates/code/dotnet/jobs/agent.cs +163 -0
  81. package/framework/templates/code/dotnet/jobs/job.cs +171 -0
  82. package/framework/templates/code/dotnet/test.cs +239 -0
  83. package/framework/templates/code/sql/rls-policy.sql +57 -0
  84. package/framework/templates/code/sql/supabase-migration.sql +100 -0
  85. package/framework/templates/code/sql/supabase-migration.template.sql +113 -0
  86. package/framework/templates/code/typescript/contracts.ts +168 -0
  87. package/framework/templates/context/CONTEXT-FEATURE.md +276 -0
  88. package/framework/templates/context/CONTEXT.md +181 -0
  89. package/framework/templates/docs/proposal.md +182 -0
  90. package/framework/templates/docs/spec.md +149 -0
  91. package/framework/templates/examples/design-system-examples.md +357 -0
  92. package/framework/templates/examples/spec-examples.md +90 -0
  93. package/framework/templates/feature/decisions.md +187 -0
  94. package/framework/templates/feature/recap.md +146 -0
  95. package/framework/templates/feature/tasks.md +199 -0
  96. package/framework/templates/infrastructure/azure/Dockerfile.example +82 -0
  97. package/framework/templates/infrastructure/azure/README.md +286 -0
  98. package/framework/templates/infrastructure/azure/app-insights.bicep +63 -0
  99. package/framework/templates/infrastructure/azure/app-service.bicep +164 -0
  100. package/framework/templates/infrastructure/azure/container-app-env.bicep +49 -0
  101. package/framework/templates/infrastructure/azure/container-app.bicep +156 -0
  102. package/framework/templates/infrastructure/azure/deploy-checklist.md +426 -0
  103. package/framework/templates/infrastructure/azure/deploy.ps1 +229 -0
  104. package/framework/templates/infrastructure/azure/deploy.sh +208 -0
  105. package/framework/templates/infrastructure/azure/key-vault.bicep +91 -0
  106. package/framework/templates/infrastructure/azure/main.bicep +189 -0
  107. package/framework/templates/infrastructure/azure/parameters.dev.json +29 -0
  108. package/framework/templates/infrastructure/azure/parameters.prod.json +29 -0
  109. package/framework/templates/infrastructure/azure/parameters.staging.json +29 -0
  110. package/framework/templates/infrastructure/azure/sql-database.bicep +103 -0
  111. package/framework/templates/infrastructure/azure/storage.bicep +106 -0
  112. package/framework/templates/infrastructure/docker/Dockerfile.template +58 -0
  113. package/framework/templates/infrastructure/docker/docker-compose.template.yml +67 -0
  114. package/framework/templates/infrastructure/docker/dockerfile-api.dockerfile +38 -0
  115. package/framework/templates/infrastructure/docker/dockerfile-web.dockerfile +48 -0
  116. package/framework/templates/infrastructure/docker/easypanel.template.json +54 -0
  117. package/framework/templates/infrastructure/github/README.md +593 -0
  118. package/framework/templates/infrastructure/github/actions/azure-auth/action.yml.hbs +22 -0
  119. package/framework/templates/infrastructure/github/actions/docker-build-push/action.yml.hbs +45 -0
  120. package/framework/templates/infrastructure/github/actions/health-check/action.yml.hbs +27 -0
  121. package/framework/templates/infrastructure/github/workflows/deploy-azure-app-service.yml.hbs +61 -0
  122. package/framework/templates/infrastructure/github/workflows/deploy-easypanel.yml.hbs +31 -0
  123. package/framework/templates/infrastructure/github/workflows/docker-build-push.yml.hbs +59 -0
  124. package/framework/templates/infrastructure/github/workflows/dotnet-build.yml.hbs +39 -0
  125. package/framework/templates/integrations/asaas-client.cs +387 -0
  126. package/framework/templates/integrations/asaas-webhook.cs +351 -0
  127. package/framework/templates/integrations/azure-identity-config.cs +288 -0
  128. package/framework/templates/integrations/clerk-config.cs +258 -0
  129. package/framework/templates/meta-prompts/fusion/fusion-agent.md +76 -0
  130. package/framework/templates/meta-prompts/fusion/fusion-aggregator.md +100 -0
  131. package/framework/templates/meta-prompts/hops/hop-retry.md +78 -0
  132. package/framework/templates/meta-prompts/hops/hop-validation.md +97 -0
  133. package/framework/templates/meta-prompts/hops/hop-wrapper.md +36 -0
  134. package/framework/templates/meta-prompts/parallel-workers/parallel-coordinator.md +113 -0
  135. package/framework/templates/meta-prompts/parallel-workers/parallel-worker.md +80 -0
  136. package/framework/templates/meta-prompts/squad-leaders/backend-squad.md +90 -0
  137. package/framework/templates/meta-prompts/squad-leaders/frontend-squad.md +126 -0
  138. package/framework/templates/meta-prompts/squad-leaders/squad-leader.md +43 -0
  139. package/framework/templates/meta-prompts/validators/checkpoint-validator.md +107 -0
  140. package/framework/templates/meta-prompts/validators/pre-commit-validator.md +95 -0
  141. package/framework/templates/saas/subscription.cs +347 -0
  142. package/framework/templates/saas/tenant.cs +338 -0
  143. package/framework/templates/state.template.json +17 -0
  144. package/framework/templates/ui/FluentDesignTheme.cs +149 -0
  145. package/framework/templates/ui/MudTheme.cs +281 -0
  146. package/framework/templates/ui/design-system.css +226 -0
  147. package/framework/workflows/README.md +1041 -0
  148. package/framework/workflows/configs/design-impl.json +49 -0
  149. package/framework/workflows/configs/fast-track.json +42 -0
  150. package/framework/workflows/configs/full-morph.json +79 -0
  151. package/framework/workflows/configs/fusion.json +39 -0
  152. package/framework/workflows/configs/long-running.json +33 -0
  153. package/framework/workflows/configs/standard.json +60 -0
  154. package/framework/workflows/configs/ui-refresh.json +49 -0
  155. package/framework/workflows/configs/zero-touch.json +75 -0
  156. package/framework/workflows/docs/STORY-DRIVEN-DEVELOPMENT.md +392 -0
  157. package/framework/workflows/docs/design-impl.md +37 -0
  158. package/framework/workflows/docs/enforcement-pipeline.md +668 -0
  159. package/framework/workflows/docs/fast-track.md +29 -0
  160. package/framework/workflows/docs/full-morph.md +76 -0
  161. package/framework/workflows/docs/standard.md +44 -0
  162. package/framework/workflows/docs/ui-refresh.md +39 -0
  163. package/package.json +3 -3
  164. package/src/commands/feature/create-story.js +11 -7
  165. package/src/commands/project/detect-agents.js +1 -2
  166. package/src/commands/project/init.js +78 -31
  167. package/src/commands/project/update.js +9 -5
  168. package/src/commands/templates/template-customize.js +3 -17
  169. package/src/commands/templates/template-list.js +1 -15
  170. package/src/commands/templates/template-render.js +2 -3
  171. package/src/commands/templates/template-show.js +3 -5
  172. package/src/core/templates/template-registry.js +9 -23
  173. package/src/lib/detectors/structure-detector.js +3 -3
  174. package/src/lib/generators/context-generator.js +18 -6
  175. package/src/lib/hooks/hook-executor.js +0 -2
  176. package/src/lib/orchestration/team-orchestrator.js +1 -2
  177. package/src/lib/standards/standards-context-injector.js +3 -4
  178. package/src/lib/troubleshooting/troubleshoot-grep.js +3 -9
  179. package/src/lib/validators/validation-runner.js +1 -2
  180. package/src/utils/file-copier.js +1 -2
  181. package/docs/README.md +0 -144
  182. package/docs/api/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  183. package/docs/api/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  184. package/docs/api/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  185. package/docs/api/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  186. package/docs/api/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  187. package/docs/api/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  188. package/docs/api/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  189. package/docs/api/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  190. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  191. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -978
  192. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  193. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  194. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  195. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  196. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -1049
  197. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  198. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  199. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  200. package/docs/api/scripts/collapse.js +0 -39
  201. package/docs/api/scripts/commonNav.js +0 -28
  202. package/docs/api/scripts/linenumber.js +0 -25
  203. package/docs/api/scripts/nav.js +0 -12
  204. package/docs/api/scripts/polyfill.js +0 -4
  205. package/docs/api/scripts/prettify/Apache-License-2.0.txt +0 -202
  206. package/docs/api/scripts/prettify/lang-css.js +0 -2
  207. package/docs/api/scripts/prettify/prettify.js +0 -28
  208. package/docs/api/scripts/search.js +0 -99
  209. package/docs/api/styles/jsdoc.css +0 -776
  210. package/docs/api/styles/prettify.css +0 -80
  211. package/docs/cli-auto-detection.md +0 -219
  212. package/docs/getting-started.md +0 -296
  213. package/docs/installation.md +0 -361
  214. package/docs/next-generation/AGENTS.md +0 -521
  215. package/docs/next-generation/ANALYSIS.md +0 -555
  216. package/docs/next-generation/ARCHITECTURE.md +0 -436
  217. package/docs/next-generation/CONTEXT-OPTIMIZATION.md +0 -267
  218. package/docs/next-generation/EXECUTION-FLOW.md +0 -274
  219. package/docs/next-generation/FEATURES.md +0 -688
  220. package/docs/next-generation/META-PROMPTS.md +0 -235
  221. package/docs/next-generation/MIGRATION-GUIDE.md +0 -253
  222. package/docs/next-generation/README.md +0 -231
  223. package/docs/next-generation/ROADMAP.md +0 -801
  224. package/docs/next-generation/THREAD-MANAGEMENT.md +0 -240
  225. package/docs/templates.md +0 -418
  226. package/docs/troubleshooting.md +0 -269
  227. package/docs/validation-checklist.md +0 -264
  228. package/scripts/postinstall.js +0 -132
  229. package/src/lib/stacks/index.js +0 -7
  230. package/src/lib/stacks/stack-resolver.js +0 -180
  231. package/stacks/blazor-azure/.claude/commands/morph-deploy.md +0 -529
  232. package/stacks/blazor-azure/.claude/commands/morph-infra.md +0 -209
  233. package/stacks/blazor-azure/.morph/.morphversion +0 -5
  234. package/stacks/blazor-azure/.morph/archive/.gitkeep +0 -25
  235. package/stacks/blazor-azure/.morph/config/agents.json +0 -948
  236. package/stacks/blazor-azure/.morph/config/config.template.json +0 -122
  237. package/stacks/blazor-azure/.morph/features/.gitkeep +0 -25
  238. package/stacks/blazor-azure/.morph/hooks/pre-commit/tests-csharp.sh +0 -61
  239. package/stacks/blazor-azure/.morph/project/context/README.md +0 -17
  240. package/stacks/blazor-azure/.morph/project.md +0 -160
  241. package/stacks/blazor-azure/.morph/schemas/agent.schema.json +0 -296
  242. package/stacks/blazor-azure/.morph/schemas/tasks.schema.json +0 -220
  243. package/stacks/blazor-azure/.morph/specs/.gitkeep +0 -20
  244. package/stacks/blazor-azure/.morph/state.json +0 -18
  245. package/stacks/blazor-azure/.morph/test-infra/example.bicep +0 -59
  246. package/stacks/blazor-azure/CLAUDE.md +0 -155
  247. package/stacks/blazor-azure/README.md +0 -79
  248. package/stacks/nextjs-supabase/.claude/commands/morph-apply.md +0 -221
  249. package/stacks/nextjs-supabase/.claude/commands/morph-archive.md +0 -79
  250. package/stacks/nextjs-supabase/.claude/commands/morph-deploy.md +0 -529
  251. package/stacks/nextjs-supabase/.claude/commands/morph-preflight.md +0 -227
  252. package/stacks/nextjs-supabase/.claude/commands/morph-proposal.md +0 -122
  253. package/stacks/nextjs-supabase/.claude/commands/morph-status.md +0 -86
  254. package/stacks/nextjs-supabase/.claude/commands/morph-troubleshoot.md +0 -122
  255. package/stacks/nextjs-supabase/.morph/.morphversion +0 -5
  256. package/stacks/nextjs-supabase/.morph/config/config.json +0 -9
  257. package/stacks/nextjs-supabase/.morph/config/config.template.json +0 -92
  258. package/stacks/nextjs-supabase/.morph/hooks/pre-commit/tests-typescript.sh +0 -61
  259. package/stacks/nextjs-supabase/.morph/project/context/README.md +0 -17
  260. package/stacks/nextjs-supabase/.morph/project.md +0 -168
  261. package/stacks/nextjs-supabase/.morph/standards/ai-agents/blazor-ui.md +0 -364
  262. package/stacks/nextjs-supabase/.morph/standards/ai-agents/production.md +0 -415
  263. package/stacks/nextjs-supabase/.morph/standards/ai-agents/setup.md +0 -418
  264. package/stacks/nextjs-supabase/.morph/standards/ai-agents/team-orchestration.md +0 -479
  265. package/stacks/nextjs-supabase/.morph/standards/ai-agents/workflows.md +0 -354
  266. package/stacks/nextjs-supabase/.morph/standards/architecture/ddd/aggregates.md +0 -120
  267. package/stacks/nextjs-supabase/.morph/standards/architecture/ddd/entities.md +0 -99
  268. package/stacks/nextjs-supabase/.morph/standards/architecture/ddd/value-objects.md +0 -124
  269. package/stacks/nextjs-supabase/.morph/standards/backend/api/minimal-api.md +0 -494
  270. package/stacks/nextjs-supabase/.morph/standards/backend/api/rest.md +0 -492
  271. package/stacks/nextjs-supabase/.morph/standards/backend/api/validation.md +0 -88
  272. package/stacks/nextjs-supabase/.morph/standards/backend/authentication/passkeys.md +0 -428
  273. package/stacks/nextjs-supabase/.morph/standards/backend/database/ef-core.md +0 -199
  274. package/stacks/nextjs-supabase/.morph/standards/backend/database/migrations.md +0 -393
  275. package/stacks/nextjs-supabase/.morph/standards/backend/database/postgresql/database.md +0 -352
  276. package/stacks/nextjs-supabase/.morph/standards/backend/database/repository-patterns.md +0 -528
  277. package/stacks/nextjs-supabase/.morph/standards/backend/database/vector-search-rag.md +0 -541
  278. package/stacks/nextjs-supabase/.morph/standards/backend/dotnet/async.md +0 -366
  279. package/stacks/nextjs-supabase/.morph/standards/backend/dotnet/core.md +0 -117
  280. package/stacks/nextjs-supabase/.morph/standards/backend/dotnet/di.md +0 -439
  281. package/stacks/nextjs-supabase/.morph/standards/backend/dotnet/program-cs-checklist.md +0 -92
  282. package/stacks/nextjs-supabase/.morph/standards/backend/integrations/asaas/asaas-api.md +0 -216
  283. package/stacks/nextjs-supabase/.morph/standards/backend/integrations/clerk/clerk-auth.md +0 -290
  284. package/stacks/nextjs-supabase/.morph/standards/backend/integrations/hangfire/hangfire-jobs.md +0 -350
  285. package/stacks/nextjs-supabase/.morph/standards/backend/integrations/resend/resend-email.md +0 -385
  286. package/stacks/nextjs-supabase/.morph/standards/context/analytics.md +0 -96
  287. package/stacks/nextjs-supabase/.morph/standards/context/bundles.md +0 -110
  288. package/stacks/nextjs-supabase/.morph/standards/context/priming.md +0 -78
  289. package/stacks/nextjs-supabase/.morph/standards/core/architecture.md +0 -185
  290. package/stacks/nextjs-supabase/.morph/standards/core/coding.md +0 -214
  291. package/stacks/nextjs-supabase/.morph/standards/core/git-branching-strategy.md +0 -403
  292. package/stacks/nextjs-supabase/.morph/standards/core/git.md +0 -185
  293. package/stacks/nextjs-supabase/.morph/standards/core/testing.md +0 -295
  294. package/stacks/nextjs-supabase/.morph/standards/data/nosql/blob-storage.md +0 -102
  295. package/stacks/nextjs-supabase/.morph/standards/data/nosql/cache/redis.md +0 -97
  296. package/stacks/nextjs-supabase/.morph/standards/data/nosql/cosmos-db.md +0 -118
  297. package/stacks/nextjs-supabase/.morph/standards/data/vector-search/azure-ai-search.md +0 -121
  298. package/stacks/nextjs-supabase/.morph/standards/data/vector-search/rag-chunking.md +0 -104
  299. package/stacks/nextjs-supabase/.morph/standards/frontend/blazor/design-checklist.md +0 -222
  300. package/stacks/nextjs-supabase/.morph/standards/frontend/blazor/fluent-ui-setup.md +0 -595
  301. package/stacks/nextjs-supabase/.morph/standards/frontend/blazor/fluent-ui.md +0 -137
  302. package/stacks/nextjs-supabase/.morph/standards/frontend/blazor/html-conversion.md +0 -184
  303. package/stacks/nextjs-supabase/.morph/standards/frontend/blazor/lifecycle.md +0 -195
  304. package/stacks/nextjs-supabase/.morph/standards/frontend/blazor/pitfalls.md +0 -198
  305. package/stacks/nextjs-supabase/.morph/standards/frontend/blazor/state.md +0 -191
  306. package/stacks/nextjs-supabase/.morph/standards/frontend/design-system/animations.md +0 -151
  307. package/stacks/nextjs-supabase/.morph/standards/frontend/design-system/naming.md +0 -64
  308. package/stacks/nextjs-supabase/.morph/standards/frontend/nextjs/nextjs-patterns.md +0 -198
  309. package/stacks/nextjs-supabase/.morph/standards/infrastructure/azure/azure.md +0 -624
  310. package/stacks/nextjs-supabase/.morph/standards/infrastructure/azure/bicep/bicep-patterns.md +0 -422
  311. package/stacks/nextjs-supabase/.morph/standards/infrastructure/azure/devops/azure-devops-setup.md +0 -516
  312. package/stacks/nextjs-supabase/.morph/standards/infrastructure/azure/devops/local-development.md +0 -520
  313. package/stacks/nextjs-supabase/.morph/standards/infrastructure/azure/services/functions.md +0 -486
  314. package/stacks/nextjs-supabase/.morph/standards/infrastructure/azure/services/service-bus.md +0 -459
  315. package/stacks/nextjs-supabase/.morph/standards/infrastructure/azure/services/storage.md +0 -407
  316. package/stacks/nextjs-supabase/.morph/standards/infrastructure/docker/easypanel-deploy.md +0 -196
  317. package/stacks/nextjs-supabase/.morph/standards/infrastructure/supabase/mcp-setup.md +0 -252
  318. package/stacks/nextjs-supabase/.morph/standards/infrastructure/supabase/supabase-auth.md +0 -176
  319. package/stacks/nextjs-supabase/.morph/standards/infrastructure/supabase/supabase-pgvector.md +0 -169
  320. package/stacks/nextjs-supabase/.morph/standards/infrastructure/supabase/supabase-rls.md +0 -184
  321. package/stacks/nextjs-supabase/.morph/standards/infrastructure/supabase/supabase-storage.md +0 -153
  322. package/stacks/nextjs-supabase/.morph/standards/integration/api/graphql.md +0 -91
  323. package/stacks/nextjs-supabase/.morph/standards/integration/api/grpc.md +0 -114
  324. package/stacks/nextjs-supabase/.morph/standards/integration/api/rest-design.md +0 -95
  325. package/stacks/nextjs-supabase/.morph/standards/integration/event-driven/cqrs.md +0 -101
  326. package/stacks/nextjs-supabase/.morph/standards/integration/event-driven/event-sourcing.md +0 -124
  327. package/stacks/nextjs-supabase/.morph/standards/integration/event-driven/service-bus.md +0 -95
  328. package/stacks/nextjs-supabase/.morph/standards/observability/logging.md +0 -131
  329. package/stacks/nextjs-supabase/.morph/standards/observability/metrics.md +0 -121
  330. package/stacks/nextjs-supabase/.morph/standards/observability/monitoring.md +0 -114
  331. package/stacks/nextjs-supabase/.morph/standards/observability/tracing.md +0 -132
  332. package/stacks/nextjs-supabase/.morph/standards/workflows/parallel-execution.md +0 -112
  333. package/stacks/nextjs-supabase/.morph/standards/workflows/thread-management.md +0 -113
  334. package/stacks/nextjs-supabase/CLAUDE.md +0 -155
  335. package/stacks/nextjs-supabase/README.md +0 -103
  336. /package/{stacks/blazor-azure/.claude → framework}/commands/morph-apply.md +0 -0
  337. /package/{stacks/blazor-azure/.claude → framework}/commands/morph-archive.md +0 -0
  338. /package/{stacks/blazor-azure/.claude → framework}/commands/morph-preflight.md +0 -0
  339. /package/{stacks/blazor-azure/.claude → framework}/commands/morph-proposal.md +0 -0
  340. /package/{stacks/blazor-azure/.claude → framework}/commands/morph-status.md +0 -0
  341. /package/{stacks/blazor-azure/.claude → framework}/commands/morph-troubleshoot.md +0 -0
  342. /package/{stacks/blazor-azure/.morph → framework}/standards/ai-agents/blazor-ui.md +0 -0
  343. /package/{stacks/blazor-azure/.morph → framework}/standards/ai-agents/production.md +0 -0
  344. /package/{stacks/blazor-azure/.morph → framework}/standards/ai-agents/setup.md +0 -0
  345. /package/{stacks/blazor-azure/.morph → framework}/standards/ai-agents/team-orchestration.md +0 -0
  346. /package/{stacks/blazor-azure/.morph → framework}/standards/ai-agents/workflows.md +0 -0
  347. /package/{stacks/blazor-azure/.morph → framework}/standards/architecture/ddd/aggregates.md +0 -0
  348. /package/{stacks/blazor-azure/.morph → framework}/standards/architecture/ddd/entities.md +0 -0
  349. /package/{stacks/blazor-azure/.morph → framework}/standards/architecture/ddd/value-objects.md +0 -0
  350. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/api/minimal-api.md +0 -0
  351. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/api/rest.md +0 -0
  352. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/api/validation.md +0 -0
  353. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/authentication/passkeys.md +0 -0
  354. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/database/ef-core.md +0 -0
  355. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/database/migrations.md +0 -0
  356. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/database/postgresql/database.md +0 -0
  357. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/database/repository-patterns.md +0 -0
  358. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/database/vector-search-rag.md +0 -0
  359. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/dotnet/async.md +0 -0
  360. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/dotnet/core.md +0 -0
  361. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/dotnet/di.md +0 -0
  362. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/dotnet/program-cs-checklist.md +0 -0
  363. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/integrations/asaas/asaas-api.md +0 -0
  364. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/integrations/clerk/clerk-auth.md +0 -0
  365. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/integrations/hangfire/hangfire-jobs.md +0 -0
  366. /package/{stacks/blazor-azure/.morph → framework}/standards/backend/integrations/resend/resend-email.md +0 -0
  367. /package/{stacks/blazor-azure/.morph → framework}/standards/context/analytics.md +0 -0
  368. /package/{stacks/blazor-azure/.morph → framework}/standards/context/bundles.md +0 -0
  369. /package/{stacks/blazor-azure/.morph → framework}/standards/context/priming.md +0 -0
  370. /package/{stacks/blazor-azure/.morph → framework}/standards/core/architecture.md +0 -0
  371. /package/{stacks/blazor-azure/.morph → framework}/standards/core/coding.md +0 -0
  372. /package/{stacks/blazor-azure/.morph → framework}/standards/core/git-branching-strategy.md +0 -0
  373. /package/{stacks/blazor-azure/.morph → framework}/standards/core/git.md +0 -0
  374. /package/{stacks/blazor-azure/.morph → framework}/standards/core/testing.md +0 -0
  375. /package/{stacks/blazor-azure/.morph → framework}/standards/data/nosql/blob-storage.md +0 -0
  376. /package/{stacks/blazor-azure/.morph → framework}/standards/data/nosql/cache/redis.md +0 -0
  377. /package/{stacks/blazor-azure/.morph → framework}/standards/data/nosql/cosmos-db.md +0 -0
  378. /package/{stacks/blazor-azure/.morph → framework}/standards/data/vector-search/azure-ai-search.md +0 -0
  379. /package/{stacks/blazor-azure/.morph → framework}/standards/data/vector-search/rag-chunking.md +0 -0
  380. /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/blazor/design-checklist.md +0 -0
  381. /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/blazor/fluent-ui-setup.md +0 -0
  382. /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/blazor/fluent-ui.md +0 -0
  383. /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/blazor/html-conversion.md +0 -0
  384. /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/blazor/lifecycle.md +0 -0
  385. /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/blazor/pitfalls.md +0 -0
  386. /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/blazor/state.md +0 -0
  387. /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/design-system/animations.md +0 -0
  388. /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/design-system/naming.md +0 -0
  389. /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/nextjs/nextjs-patterns.md +0 -0
  390. /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/azure/azure.md +0 -0
  391. /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/azure/bicep/bicep-patterns.md +0 -0
  392. /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/azure/devops/azure-devops-setup.md +0 -0
  393. /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/azure/devops/local-development.md +0 -0
  394. /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/azure/services/functions.md +0 -0
  395. /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/azure/services/service-bus.md +0 -0
  396. /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/azure/services/storage.md +0 -0
  397. /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/docker/easypanel-deploy.md +0 -0
  398. /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/supabase/mcp-setup.md +0 -0
  399. /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/supabase/supabase-auth.md +0 -0
  400. /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/supabase/supabase-pgvector.md +0 -0
  401. /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/supabase/supabase-rls.md +0 -0
  402. /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/supabase/supabase-storage.md +0 -0
  403. /package/{stacks/blazor-azure/.morph → framework}/standards/integration/api/graphql.md +0 -0
  404. /package/{stacks/blazor-azure/.morph → framework}/standards/integration/api/grpc.md +0 -0
  405. /package/{stacks/blazor-azure/.morph → framework}/standards/integration/api/rest-design.md +0 -0
  406. /package/{stacks/blazor-azure/.morph → framework}/standards/integration/event-driven/cqrs.md +0 -0
  407. /package/{stacks/blazor-azure/.morph → framework}/standards/integration/event-driven/event-sourcing.md +0 -0
  408. /package/{stacks/blazor-azure/.morph → framework}/standards/integration/event-driven/service-bus.md +0 -0
  409. /package/{stacks/blazor-azure/.morph → framework}/standards/observability/logging.md +0 -0
  410. /package/{stacks/blazor-azure/.morph → framework}/standards/observability/metrics.md +0 -0
  411. /package/{stacks/blazor-azure/.morph → framework}/standards/observability/monitoring.md +0 -0
  412. /package/{stacks/blazor-azure/.morph → framework}/standards/observability/tracing.md +0 -0
  413. /package/{stacks/blazor-azure/.morph → framework}/standards/workflows/parallel-execution.md +0 -0
  414. /package/{stacks/blazor-azure/.morph → framework}/standards/workflows/thread-management.md +0 -0
@@ -0,0 +1,1041 @@
1
+ # MORPH-SPEC Workflow Detection System
2
+
3
+ > Automatic workflow selection based on request analysis and complexity estimation
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ 1. [Overview](#overview)
10
+ 2. [Workflow Types](#workflow-types)
11
+ 3. [Detection Algorithm](#detection-algorithm)
12
+ 4. [Usage Guide](#usage-guide)
13
+ 5. [Configuration System](#configuration-system)
14
+ 6. [Customization](#customization)
15
+ 7. [Examples](#examples)
16
+ 8. [Troubleshooting](#troubleshooting)
17
+
18
+ ---
19
+
20
+ ## Overview
21
+
22
+ The MORPH-SPEC framework includes an **intelligent workflow detection system** that automatically selects the appropriate development workflow based on analyzing the user's feature request.
23
+
24
+ ### Why Workflows?
25
+
26
+ Different types of changes require different levels of planning and documentation:
27
+
28
+ - **Bug fix:** Doesn't need full architectural design
29
+ - **New feature:** Needs spec, contracts, tasks breakdown
30
+ - **Complete system:** Needs all phases (proposal, design, UI/UX, tasks, etc.)
31
+ - **HTML → Code conversion:** Needs prototype analysis, not technical spec
32
+ - **Visual redesign:** Needs design system, not business logic contracts
33
+
34
+ ### Benefits
35
+
36
+ | Benefit | Impact |
37
+ |---------|--------|
38
+ | **Automatic Selection** | System chooses workflow - user doesn't need framework knowledge |
39
+ | **Optimized Workflows** | Fast-track skips 80% of phases for trivial changes |
40
+ | **Token Efficiency** | Standard workflow uses 60% fewer outputs than full-morph |
41
+ | **Clear Expectations** | Each workflow defines pause points and deliverables |
42
+ | **Guided Experience** | Framework tells user what phases to expect |
43
+ | **Extensible** | Easy to add new workflows (just add JSON config) |
44
+
45
+ ---
46
+
47
+ ## Workflow Types
48
+
49
+ ### 1. fast-track (Trivial Changes)
50
+
51
+ **Purpose:** Quick fixes, CSS tweaks, small bugs, edge cases
52
+
53
+ **Criteria:**
54
+ - ≤3 files modified
55
+ - ≤50 lines of code
56
+ - No new components
57
+ - No infrastructure changes
58
+ - No architectural decisions
59
+
60
+ **Keywords:**
61
+ - `bug`, `fix`, `corrigir`, `ajustar`
62
+ - `hotfix`, `edge case`
63
+ - `cor`, `css`, `typo`
64
+
65
+ **Phases:**
66
+ 1. **Quick Analysis** (combines: proposal + setup + design)
67
+ - 1 paragraph analysis
68
+ - No formal spec.md
69
+ 2. **Implement**
70
+ - Direct code changes
71
+ - Commit message only
72
+
73
+ **Phases Skipped:**
74
+ - PROPOSAL, SETUP, UIUX, DESIGN, CLARIFY, TASKS, SYNC
75
+
76
+ **Outputs:**
77
+ - Commit message (no .md files)
78
+
79
+ **Example Requests:**
80
+ - "fix typo in login button"
81
+ - "change color of primary button to blue"
82
+ - "adjust padding in header component"
83
+
84
+ ---
85
+
86
+ ### 2. standard (Medium Complexity)
87
+
88
+ **Purpose:** Single features, refactorings, optimizations, simple integrations
89
+
90
+ **Criteria:**
91
+ - 3-10 files modified
92
+ - 50-500 lines of code
93
+ - 1-2 simple components
94
+ - No infrastructure
95
+ - Tactical decisions only
96
+
97
+ **Keywords:**
98
+ - `paginação`, `pagination`
99
+ - `filtro`, `filter`, `filtering`
100
+ - `refactor`, `refatorar`
101
+ - `performance`, `otimizar`
102
+ - `export`, `sorting`, `search`
103
+
104
+ **Phases:**
105
+ 1. **PROPOSAL** (simplified)
106
+ - 1-2 paragraphs
107
+ - Quick cost estimate
108
+ 2. **DESIGN** (concise)
109
+ - spec.md only (1-2 pages)
110
+ - No contracts.cs (unless API changes)
111
+ - decisions.md (if any)
112
+ 3. **TASKS** (if >5 tasks)
113
+ - Task breakdown with dependencies
114
+ 4. **IMPLEMENT**
115
+ - Task-by-task implementation
116
+
117
+ **Phases Skipped:**
118
+ - SETUP (context already loaded)
119
+ - UIUX (no significant frontend changes)
120
+ - CLARIFY (spec is clear for this type)
121
+ - SYNC (tactical decisions, not strategic)
122
+
123
+ **Outputs:**
124
+ - proposal.md (minimal)
125
+ - spec.md (concise)
126
+ - tasks.json (if >5 tasks)
127
+ - recap.md
128
+
129
+ **Example Requests:**
130
+ - "add pagination to users table"
131
+ - "add filtering by date to reports"
132
+ - "export data to CSV"
133
+ - "optimize slow query in dashboard"
134
+
135
+ ---
136
+
137
+ ### 3. full-morph (High Complexity)
138
+
139
+ **Purpose:** Complete systems, major features, architecture changes, integrations
140
+
141
+ **Criteria:**
142
+ - >10 files modified
143
+ - >500 lines of code
144
+ - Multiple new components
145
+ - Infrastructure changes (optional)
146
+ - Architectural decisions required
147
+
148
+ **Keywords:**
149
+ - `sistema`, `system`
150
+ - `autenticação`, `authentication`
151
+ - `integração`, `integration`, `integrate`
152
+ - `pattern`, `cqrs`, `subsistema`, `subsystem`
153
+ - `architecture`, `infraestrutura`, `infrastructure`
154
+ - `complete`, `completo`, `complex`, `complexo`
155
+
156
+ **Phases:**
157
+ 1. **CONTEXT** - Load project context
158
+ 2. **PROPOSAL** - ⏸️ Pause for approval
159
+ 3. **SETUP** - Activate agents, create feature folder
160
+ 4. **UIUX** - ⏸️ Pause for approval (if UI changes)
161
+ 5. **DESIGN** - ⏸️ Pause for approval
162
+ 6. **CLARIFY** - Resolve ambiguities
163
+ 7. **TASKS** - ⏸️ Pause for approval
164
+ 8. **IMPLEMENT** - Task-by-task
165
+ 9. **SYNC** - ⏸️ Pause for approval (promote decisions to standards)
166
+
167
+ **Phases Skipped:**
168
+ - None (all phases mandatory)
169
+
170
+ **Outputs:**
171
+ - proposal.md
172
+ - ui-design-system.md
173
+ - ui-mockups.md
174
+ - ui-components.md
175
+ - ui-flows.md
176
+ - spec.md
177
+ - contracts.cs
178
+ - tasks.json
179
+ - decisions.md
180
+ - recap.md
181
+
182
+ **Example Requests:**
183
+ - "implement complete authentication system with OAuth"
184
+ - "build user management CRUD with roles and permissions"
185
+ - "integrate Azure Cognitive Search with RAG"
186
+ - "deploy to Azure with Bicep infrastructure"
187
+
188
+ ---
189
+
190
+ ### 4. design-impl (Prototype → Code)
191
+
192
+ **Purpose:** Convert HTML prototypes, Figma designs, mockups, or screenshots to functional code
193
+
194
+ **Criteria:**
195
+ - Has existing prototype/mockup/design
196
+ - Prototype formats: HTML, Figma, screenshots, wireframes
197
+ - No business logic design needed (already in prototype)
198
+
199
+ **Keywords:**
200
+ - `prototipo`, `prototype`
201
+ - `figma`, `html para`, `html to`
202
+ - `convert html`, `converter design`, `convert design`
203
+ - `replicar`, `replicate`
204
+ - `from design`, `from mockup`
205
+ - `mockup`, `screenshot`, `wireframe`
206
+
207
+ **Phases:**
208
+ 1. **PROTOTYPE ANALYSIS** - ⏸️ Pause for confirmation
209
+ - Analyze HTML/Figma structure
210
+ - Map components
211
+ - Identify reusable patterns
212
+ 2. **TASKS** - ⏸️ Pause for approval
213
+ - List screens to implement
214
+ - Order by dependencies
215
+ 3. **IMPLEMENT**
216
+ - Screen by screen implementation
217
+
218
+ **Phases Skipped:**
219
+ - PROPOSAL (prototype is the proposal)
220
+ - SETUP, UIUX, DESIGN (already done in prototype)
221
+ - CLARIFY (visual design is clear)
222
+ - SYNC (no strategic decisions)
223
+
224
+ **Outputs:**
225
+ - recap.md
226
+ - design-system.css (optional - extracted patterns)
227
+ - .razor code (or .tsx for Next.js)
228
+
229
+ **Example Requests:**
230
+ - "convert HTML prototype to Blazor components"
231
+ - "implement screens from Figma design"
232
+ - "replicate this dashboard mockup in Next.js"
233
+
234
+ ---
235
+
236
+ ### 5. ui-refresh (Visual Redesign)
237
+
238
+ **Purpose:** Visual-only changes to existing functional pages (no business logic modifications)
239
+
240
+ **Criteria:**
241
+ - Existing functional pages
242
+ - Only visual changes (colors, spacing, layout, animations)
243
+ - No business logic changes
244
+ - No new features
245
+ - No infrastructure
246
+
247
+ **Keywords:**
248
+ - `redesign`, `redesenhar`
249
+ - `bonito`, `estetica`, `aesthetic`
250
+ - `modernizar`, `modernize`
251
+ - `restyling`
252
+ - `refresh visual`, `refresh ui`
253
+ - `make prettier`, `look better`
254
+
255
+ **Phases:**
256
+ 1. **VISUAL ANALYSIS** - ⏸️ Pause for aesthetic direction
257
+ - Analyze current design
258
+ - Identify improvement opportunities
259
+ - Propose aesthetic direction
260
+ 2. **DESIGN SYSTEM** (simplified) - ⏸️ Pause for approval
261
+ - CSS components checklist
262
+ - Color palette
263
+ - Spacing/typography updates
264
+ 3. **IMPLEMENT**
265
+ - Page by page visual updates
266
+
267
+ **Phases Skipped:**
268
+ - SETUP (full context not needed)
269
+ - PROPOSAL (visual analysis replaces it)
270
+ - DESIGN (no technical spec needed)
271
+ - CONTRACTS (no API changes)
272
+ - TASKS (page list is simple)
273
+ - CLARIFY, SYNC
274
+
275
+ **Outputs:**
276
+ - design-refresh-checklist.md
277
+ - design-system.css
278
+ - .razor pages (visual changes only)
279
+ - recap.md
280
+
281
+ **Example Requests:**
282
+ - "redesign dashboard to look more modern"
283
+ - "make the checkout page more aesthetic"
284
+ - "modernize the landing page design"
285
+
286
+ ---
287
+
288
+ ## Detection Algorithm
289
+
290
+ ### Scoring System
291
+
292
+ The detector uses a **weighted scoring algorithm** with 4 factors:
293
+
294
+ | Factor | Weight | What It Analyzes |
295
+ |--------|--------|------------------|
296
+ | **Keywords** | 40% | Matched keywords from workflow configs |
297
+ | **Complexity** | 30% | Estimated files/lines/components needed |
298
+ | **Priority** | 20% | Workflow priority level (specific > generic) |
299
+ | **Context** | 10% | Special conditions (has prototype? existing pages?) |
300
+
301
+ ### Complexity Estimation
302
+
303
+ The system analyzes the request text to estimate:
304
+
305
+ **1. Scope Indicators:**
306
+
307
+ ```javascript
308
+ {
309
+ trivial: ['button', 'cor', 'color', 'css', 'fix', 'typo', 'edge case', 'one'],
310
+ small: ['add', 'create', 'single', 'simple', 'quick'],
311
+ medium: ['feature', 'pagination', 'filter', 'export', 'refactor', 'optimize'],
312
+ large: ['system', 'complete', 'all', 'multiple', 'integration', 'architecture'],
313
+ huge: ['platform', 'infrastructure', 'subsystem', 'migrate', 'rebuild']
314
+ }
315
+ ```
316
+
317
+ **2. Component Indicators:**
318
+
319
+ Keywords like: `component`, `page`, `screen`, `form`, `table`, `chart`, `modal`
320
+
321
+ **3. Entity Indicators:**
322
+
323
+ Keywords like: `user`, `order`, `product`, `customer`, `invoice`, `report`
324
+
325
+ **4. Infrastructure Indicators:**
326
+
327
+ Keywords like: `bicep`, `azure`, `deploy`, `docker`, `kubernetes`, `infrastructure`, `terraform`
328
+
329
+ **Estimation Output:**
330
+
331
+ ```javascript
332
+ {
333
+ files: 5, // Estimated number of files to modify
334
+ lines: 200, // Estimated lines of code
335
+ components: 1, // Estimated new components
336
+ hasInfra: false // Infrastructure changes detected?
337
+ }
338
+ ```
339
+
340
+ ### Penalties & Boosts
341
+
342
+ **Penalties:**
343
+ - **-50%** for workflows with no keyword matches (except full-morph fallback)
344
+
345
+ **Boosts:**
346
+ - **+20%** for workflows with 3+ keyword matches
347
+
348
+ ### Priority Levels
349
+
350
+ | Priority | Workflows | Strategy |
351
+ |----------|-----------|----------|
352
+ | **1** (Highest) | fast-track, design-impl | Very specific criteria - match early |
353
+ | **2** (Medium) | standard, ui-refresh | Medium specificity |
354
+ | **3** (Fallback) | full-morph | Catches everything else |
355
+
356
+ ### Selection Logic
357
+
358
+ 1. **Load all workflow configs** from `framework/workflows/configs/*.json`
359
+ 2. **Estimate complexity** from user request
360
+ 3. **Score each workflow** using weighted algorithm
361
+ 4. **Apply penalties/boosts** based on keyword matches
362
+ 5. **Sort by score** (highest first)
363
+ 6. **Return top result** with confidence level
364
+ 7. **Include alternatives** (next 2 workflows with score >0.2)
365
+
366
+ ---
367
+
368
+ ## Usage Guide
369
+
370
+ ### Automatic Detection (Recommended)
371
+
372
+ ```bash
373
+ # When creating a feature
374
+ npx morph-spec feature create user-pagination \
375
+ --request "add pagination to users table"
376
+
377
+ # System automatically:
378
+ # 1. Analyzes request
379
+ # 2. Detects workflow (standard in this case)
380
+ # 3. Sets workflow in state.json
381
+ # 4. Shows expected phases and outputs
382
+ ```
383
+
384
+ ### Manual Detection
385
+
386
+ ```bash
387
+ # Analyze request without creating feature
388
+ npx morph-spec detect-workflow "implement complete authentication system"
389
+
390
+ # Output:
391
+ Detected Workflow: full-morph (92% confidence)
392
+
393
+ Criteria Match:
394
+ ✓ Keywords: "authentication", "complete", "system"
395
+ ✓ Estimated: 15 files, ~800 lines
396
+ ✓ Infrastructure: detected
397
+
398
+ Phases to Run:
399
+ 1. CONTEXT
400
+ 2. PROPOSAL - ⏸️ Pause for approval
401
+ ...
402
+
403
+ Alternative Workflows:
404
+ - standard (15%): If scope reduced to basic login only
405
+ ```
406
+
407
+ ### JSON Output (for automation)
408
+
409
+ ```bash
410
+ npx morph-spec detect-workflow "add pagination" --json
411
+
412
+ # Output:
413
+ {
414
+ "workflowId": "standard",
415
+ "confidence": 0.85,
416
+ "matchedKeywords": ["paginação"],
417
+ "estimatedComplexity": {
418
+ "files": 5,
419
+ "lines": 200,
420
+ "components": 1,
421
+ "hasInfra": false
422
+ },
423
+ "reasoning": "Matched keyword 'paginação' + estimated 5 files (3-10 range)",
424
+ "alternativeWorkflows": [
425
+ {
426
+ "workflowId": "fast-track",
427
+ "confidence": 0.3,
428
+ "reason": "Could be simple if only UI change"
429
+ }
430
+ ]
431
+ }
432
+ ```
433
+
434
+ ### Manual Override
435
+
436
+ ```bash
437
+ # Force specific workflow
438
+ npx morph-spec state set user-auth workflow full-morph
439
+
440
+ # Re-detect after request changes
441
+ npx morph-spec state detect-workflow user-auth \
442
+ "implement basic login only (no OAuth)"
443
+ ```
444
+
445
+ ### View Current Workflow
446
+
447
+ ```bash
448
+ npx morph-spec state get user-auth workflow
449
+
450
+ # Output:
451
+ Workflow: standard
452
+ Detection: Auto (85% confidence)
453
+ Phases: PROPOSAL, DESIGN, TASKS, IMPLEMENT (4 phases)
454
+ Current Phase: design (2/4)
455
+ ```
456
+
457
+ ---
458
+
459
+ ## Configuration System
460
+
461
+ ### File Structure
462
+
463
+ ```
464
+ framework/workflows/
465
+ ├── docs/ # Documentation
466
+ │ ├── STORY-DRIVEN-DEVELOPMENT.md # Philosophy
467
+ │ ├── fast-track.md # Fast-track workflow details
468
+ │ ├── standard.md # Standard workflow details
469
+ │ ├── full-morph.md # Full-morph workflow details
470
+ │ ├── design-impl.md # Design-impl workflow details
471
+ │ └── ui-refresh.md # UI-refresh workflow details
472
+
473
+ └── configs/ # Executable configs
474
+ ├── fast-track.json # Fast-track configuration
475
+ ├── standard.json # Standard configuration
476
+ ├── full-morph.json # Full-morph configuration
477
+ ├── design-impl.json # Design-impl configuration
478
+ └── ui-refresh.json # UI-refresh configuration
479
+ ```
480
+
481
+ ### Configuration Schema
482
+
483
+ ```json
484
+ {
485
+ "id": "workflow-id",
486
+ "name": "Workflow Display Name",
487
+ "description": "Brief description",
488
+
489
+ "criteria": {
490
+ "maxFiles": 10,
491
+ "minFiles": 3,
492
+ "maxLines": 500,
493
+ "minLines": 50,
494
+ "maxComponents": 2,
495
+ "minComponents": 0,
496
+ "noInfrastructure": true,
497
+ "infrastructure": false,
498
+ "hasPrototype": false,
499
+ "hasExistingPages": false,
500
+ "onlyVisualChanges": false,
501
+ "noBusinessLogic": false,
502
+ "architecturalDecisions": false
503
+ },
504
+
505
+ "keywords": [
506
+ "keyword1",
507
+ "keyword2",
508
+ "portuguese-keyword",
509
+ "english-keyword"
510
+ ],
511
+
512
+ "phases": {
513
+ "run": ["phase1", "phase2"],
514
+ "skip": ["phase3", "phase4"],
515
+ "combined": {
516
+ "quick-analysis": ["proposal", "setup", "design"]
517
+ }
518
+ },
519
+
520
+ "pausePoints": [
521
+ {
522
+ "phase": "design",
523
+ "question": "Approve design to proceed?",
524
+ "condition": "hasUIAgents"
525
+ }
526
+ ],
527
+
528
+ "outputs": {
529
+ "required": ["spec.md", "recap.md"],
530
+ "optional": ["design-system.css"],
531
+ "skip": ["contracts.cs", "tasks.json"]
532
+ },
533
+
534
+ "priority": 2
535
+ }
536
+ ```
537
+
538
+ ### Field Descriptions
539
+
540
+ | Field | Type | Description |
541
+ |-------|------|-------------|
542
+ | `id` | string | Unique workflow identifier (kebab-case) |
543
+ | `name` | string | Display name for UI/logs |
544
+ | `description` | string | Brief explanation of workflow purpose |
545
+ | `criteria` | object | Conditions for workflow match |
546
+ | `keywords` | array | Keywords to match in user request |
547
+ | `phases.run` | array | Phases to execute |
548
+ | `phases.skip` | array | Phases to skip |
549
+ | `phases.combined` | object | Phases to combine (e.g., "quick-analysis") |
550
+ | `pausePoints` | array | Where to pause for user approval |
551
+ | `outputs.required` | array | Required output files |
552
+ | `outputs.optional` | array | Optional output files |
553
+ | `outputs.skip` | array | Output files to skip |
554
+ | `priority` | number | 1 (highest) to 3 (fallback) |
555
+
556
+ ---
557
+
558
+ ## Customization
559
+
560
+ ### Adding a New Workflow
561
+
562
+ **1. Create Config File:**
563
+
564
+ Create `framework/workflows/configs/my-workflow.json`:
565
+
566
+ ```json
567
+ {
568
+ "id": "my-workflow",
569
+ "name": "My Custom Workflow",
570
+ "description": "Custom workflow for specific use case",
571
+ "criteria": {
572
+ "minFiles": 5,
573
+ "maxFiles": 15
574
+ },
575
+ "keywords": ["custom-keyword", "my-use-case"],
576
+ "phases": {
577
+ "run": ["proposal", "design", "implement"],
578
+ "skip": ["setup", "clarify", "tasks"]
579
+ },
580
+ "pausePoints": [
581
+ { "phase": "design", "question": "Approve custom design?" }
582
+ ],
583
+ "outputs": {
584
+ "required": ["spec.md", "recap.md"]
585
+ },
586
+ "priority": 2
587
+ }
588
+ ```
589
+
590
+ **2. Create Documentation:**
591
+
592
+ Create `framework/workflows/docs/my-workflow.md` explaining the workflow.
593
+
594
+ **3. Test Detection:**
595
+
596
+ ```bash
597
+ npx morph-spec detect-workflow "request with custom-keyword"
598
+ ```
599
+
600
+ ### Modifying Existing Workflows
601
+
602
+ **Example: Add keywords to standard workflow**
603
+
604
+ Edit `framework/workflows/configs/standard.json`:
605
+
606
+ ```json
607
+ {
608
+ "keywords": [
609
+ "paginação", "pagination",
610
+ "filtro", "filter", "filtering",
611
+ "my-new-keyword" // Added
612
+ ]
613
+ }
614
+ ```
615
+
616
+ **Example: Change complexity criteria**
617
+
618
+ ```json
619
+ {
620
+ "criteria": {
621
+ "minFiles": 5, // Changed from 3
622
+ "maxFiles": 15 // Changed from 10
623
+ }
624
+ }
625
+ ```
626
+
627
+ ### Stack-Specific Customization
628
+
629
+ If you need stack-specific workflow tweaks:
630
+
631
+ **Option 1: Override in project**
632
+
633
+ Copy workflow config to project:
634
+ ```bash
635
+ cp framework/workflows/configs/standard.json \
636
+ .morph/config/workflows/standard-override.json
637
+ ```
638
+
639
+ Modify as needed. Project configs take precedence.
640
+
641
+ **Option 2: Extend with conditions**
642
+
643
+ Add stack-specific conditions in config:
644
+
645
+ ```json
646
+ {
647
+ "criteria": {
648
+ "stackSpecific": {
649
+ "blazor-azure": {
650
+ "minFiles": 5
651
+ },
652
+ "nextjs-supabase": {
653
+ "minFiles": 3
654
+ }
655
+ }
656
+ }
657
+ }
658
+ ```
659
+
660
+ ---
661
+
662
+ ## Examples
663
+
664
+ ### Example 1: Bug Fix (fast-track)
665
+
666
+ **Request:** "fix typo in login button"
667
+
668
+ **Detection Result:**
669
+ ```
670
+ Workflow: fast-track (95% confidence)
671
+ Keywords: "fix", "typo"
672
+ Estimated: 1 file, ~5 lines
673
+ Phases: Quick Analysis → Implement
674
+ ```
675
+
676
+ **User Experience:**
677
+ ```bash
678
+ npx morph-spec feature create login-typo --request "fix typo in login button"
679
+
680
+ # Output:
681
+ ✓ Detected workflow: fast-track
682
+ ⚡ Quick workflow - no spec files needed
683
+ 📝 Write quick analysis (1 paragraph) and implement
684
+
685
+ # User writes quick analysis, then:
686
+ npx morph-spec phase advance login-typo
687
+
688
+ # Output:
689
+ ⏩ Skipping: setup, uiux, design, clarify, tasks, sync
690
+ ➡️ Next phase: implement
691
+ ```
692
+
693
+ ### Example 2: Pagination (standard)
694
+
695
+ **Request:** "add pagination to users table"
696
+
697
+ **Detection Result:**
698
+ ```
699
+ Workflow: standard (85% confidence)
700
+ Keywords: "paginação"
701
+ Estimated: 5 files, ~200 lines
702
+ Phases: PROPOSAL → DESIGN → TASKS → IMPLEMENT
703
+ ```
704
+
705
+ **User Experience:**
706
+ ```bash
707
+ npx morph-spec feature create user-pagination \
708
+ --request "add pagination to users table"
709
+
710
+ # Output:
711
+ ✓ Detected workflow: standard
712
+ 📋 Phases: PROPOSAL (simplified) → DESIGN (concise) → TASKS → IMPLEMENT
713
+ 📄 Outputs: proposal.md, spec.md, tasks.json, recap.md
714
+ ```
715
+
716
+ ### Example 3: Authentication (full-morph)
717
+
718
+ **Request:** "implement complete authentication system with OAuth"
719
+
720
+ **Detection Result:**
721
+ ```
722
+ Workflow: full-morph (92% confidence)
723
+ Keywords: "authentication", "complete", "OAuth", "system"
724
+ Estimated: 15 files, ~800 lines
725
+ Phases: ALL (9 phases mandatory)
726
+ ```
727
+
728
+ **User Experience:**
729
+ ```bash
730
+ npx morph-spec feature create user-auth \
731
+ --request "implement complete authentication system with OAuth"
732
+
733
+ # Output:
734
+ ✓ Detected workflow: full-morph
735
+ 📋 ALL phases required (9 phases)
736
+ ⏸️ 5 pause points for approval
737
+ 📄 Complete outputs (10+ files)
738
+ ```
739
+
740
+ ### Example 4: Figma Conversion (design-impl)
741
+
742
+ **Request:** "implement screens from Figma design"
743
+
744
+ **Detection Result:**
745
+ ```
746
+ Workflow: design-impl (88% confidence)
747
+ Keywords: "figma", "implement", "screens"
748
+ Phases: PROTOTYPE ANALYSIS → TASKS → IMPLEMENT
749
+ ```
750
+
751
+ **User Experience:**
752
+ ```bash
753
+ npx morph-spec feature create dashboard-screens \
754
+ --request "implement screens from Figma design"
755
+
756
+ # Output:
757
+ ✓ Detected workflow: design-impl
758
+ 📋 Phases: PROTOTYPE ANALYSIS → TASKS (screen list) → IMPLEMENT
759
+ ⏩ Skipping: PROPOSAL, DESIGN, CLARIFY, SYNC
760
+ 📄 Outputs: recap.md, design-system.css (optional)
761
+ ```
762
+
763
+ ### Example 5: Redesign (ui-refresh)
764
+
765
+ **Request:** "redesign dashboard to look more modern"
766
+
767
+ **Detection Result:**
768
+ ```
769
+ Workflow: ui-refresh (82% confidence)
770
+ Keywords: "redesign", "modern"
771
+ Estimated: Visual changes only
772
+ Phases: VISUAL ANALYSIS → DESIGN SYSTEM → IMPLEMENT
773
+ ```
774
+
775
+ **User Experience:**
776
+ ```bash
777
+ npx morph-spec feature create dashboard-redesign \
778
+ --request "redesign dashboard to look more modern"
779
+
780
+ # Output:
781
+ ✓ Detected workflow: ui-refresh
782
+ 📋 Phases: VISUAL ANALYSIS → DESIGN SYSTEM (simplified) → IMPLEMENT
783
+ ⚠️ Visual changes only - no business logic
784
+ 📄 Outputs: design-refresh-checklist.md, CSS
785
+ ```
786
+
787
+ ---
788
+
789
+ ## Troubleshooting
790
+
791
+ ### Wrong Workflow Detected
792
+
793
+ **Problem:** System detected `full-morph` but you know it's a simple change.
794
+
795
+ **Solution 1: Provide more context**
796
+ ```bash
797
+ npx morph-spec feature create simple-fix \
798
+ --request "add pagination (simple, already have paginator component)"
799
+ ```
800
+
801
+ **Solution 2: Manual override**
802
+ ```bash
803
+ npx morph-spec state set my-feature workflow standard
804
+ ```
805
+
806
+ **Solution 3: Improve keywords**
807
+
808
+ If this happens often, add keywords to workflow config:
809
+ ```json
810
+ {
811
+ "keywords": [
812
+ "simple",
813
+ "já temos componente"
814
+ ]
815
+ }
816
+ ```
817
+
818
+ ### Low Confidence Score
819
+
820
+ **Problem:** Detection confidence <50%
821
+
822
+ **Possible Causes:**
823
+ - Ambiguous request
824
+ - No keyword matches
825
+ - Complexity unclear
826
+
827
+ **Solutions:**
828
+ 1. Be more specific in request:
829
+ - ❌ "add feature"
830
+ - ✅ "add pagination feature to users table"
831
+
832
+ 2. Include scope indicators:
833
+ - ❌ "authentication"
834
+ - ✅ "complete authentication system with OAuth"
835
+
836
+ 3. Mention technologies:
837
+ - ❌ "deploy"
838
+ - ✅ "deploy to Azure with Bicep"
839
+
840
+ ### Multiple Workflows Seem Valid
841
+
842
+ **Problem:** standard (60%) vs full-morph (55%) - unclear which is better
843
+
844
+ **Best Practice:**
845
+ - **If unsure, go with higher complexity** (full-morph)
846
+ - Reason: Better to have extra documentation than missing critical design
847
+ - You can always skip optional phases later with `--force`
848
+
849
+ **Alternative:**
850
+ Use `detect-workflow` first to see both options:
851
+ ```bash
852
+ npx morph-spec detect-workflow "add authentication"
853
+
854
+ # Review both workflows
855
+ # Decide based on:
856
+ # - Do I have prototype/existing code?
857
+ # - Is this greenfield or adding to existing?
858
+ # - Do I need full architectural design?
859
+ ```
860
+
861
+ ### Workflow Doesn't Match Project Needs
862
+
863
+ **Problem:** Your project always needs certain phases regardless of complexity
864
+
865
+ **Solution: Create custom workflow**
866
+
867
+ Example: "Always need UI/UX phase for Blazor projects"
868
+
869
+ Create `framework/workflows/configs/blazor-standard.json`:
870
+ ```json
871
+ {
872
+ "id": "blazor-standard",
873
+ "name": "Blazor Standard (with UI/UX)",
874
+ "criteria": {
875
+ "minFiles": 3,
876
+ "maxFiles": 10
877
+ },
878
+ "keywords": ["pagination", "filter"],
879
+ "phases": {
880
+ "run": ["proposal", "uiux", "design", "tasks", "implement"],
881
+ "skip": ["setup", "clarify", "sync"]
882
+ },
883
+ "priority": 2
884
+ }
885
+ ```
886
+
887
+ ### Phases Skipped That You Need
888
+
889
+ **Problem:** Workflow skipped UIUX but you need it
890
+
891
+ **Solution 1: Force phase**
892
+ ```bash
893
+ # Manually go to UIUX phase
894
+ npx morph-spec phase set my-feature uiux
895
+ ```
896
+
897
+ **Solution 2: Override workflow**
898
+ ```bash
899
+ # Use full-morph (includes all phases)
900
+ npx morph-spec state set my-feature workflow full-morph
901
+ ```
902
+
903
+ **Solution 3: Document in decisions.md**
904
+ ```markdown
905
+ ## ADR: Added UI/UX Phase to Standard Workflow
906
+
907
+ **Context:** Standard workflow skipped UI/UX but we needed Fluent UI design.
908
+
909
+ **Decision:** Manually went to UI/UX phase after proposal.
910
+
911
+ **Consequences:** Workflow became: PROPOSAL → UIUX → DESIGN → TASKS → IMPLEMENT
912
+ ```
913
+
914
+ ---
915
+
916
+ ## API Reference
917
+
918
+ ### detectWorkflow(options)
919
+
920
+ Analyzes a user request and returns the best workflow match.
921
+
922
+ **Parameters:**
923
+ ```javascript
924
+ {
925
+ userRequest: string, // Required: User's feature request
926
+ projectPath?: string, // Optional: Project path (default: '.')
927
+ featureName?: string // Optional: Feature name
928
+ }
929
+ ```
930
+
931
+ **Returns:**
932
+ ```javascript
933
+ {
934
+ workflowId: string, // Selected workflow ID
935
+ confidence: number, // 0-1 confidence score
936
+ matchedKeywords: string[], // Keywords that matched
937
+ estimatedComplexity: {
938
+ files: number,
939
+ lines: number,
940
+ components: number,
941
+ hasInfra: boolean
942
+ },
943
+ reasoning: string, // Human-readable explanation
944
+ alternativeWorkflows: Array<{
945
+ workflowId: string,
946
+ confidence: number,
947
+ reason: string
948
+ }>
949
+ }
950
+ ```
951
+
952
+ **Example:**
953
+ ```javascript
954
+ import { detectWorkflow } from './src/lib/workflow-detector.js';
955
+
956
+ const result = await detectWorkflow({
957
+ userRequest: "add pagination to users table",
958
+ projectPath: ".",
959
+ featureName: "user-pagination"
960
+ });
961
+
962
+ console.log(result.workflowId); // "standard"
963
+ console.log(result.confidence); // 0.85
964
+ ```
965
+
966
+ ### getWorkflowConfig(workflowId, projectPath?)
967
+
968
+ Loads a workflow configuration by ID.
969
+
970
+ **Parameters:**
971
+ ```javascript
972
+ workflowId: string, // Workflow ID (e.g., "standard")
973
+ projectPath?: string // Optional: Project path (default: '.')
974
+ ```
975
+
976
+ **Returns:**
977
+ ```javascript
978
+ {
979
+ id: string,
980
+ name: string,
981
+ description: string,
982
+ criteria: object,
983
+ keywords: string[],
984
+ phases: object,
985
+ pausePoints: array,
986
+ outputs: object,
987
+ priority: number
988
+ }
989
+ ```
990
+
991
+ **Example:**
992
+ ```javascript
993
+ import { getWorkflowConfig } from './src/lib/workflow-detector.js';
994
+
995
+ const config = getWorkflowConfig('standard');
996
+ console.log(config.phases.skip); // ["setup", "uiux", "clarify", "sync"]
997
+ ```
998
+
999
+ ### listWorkflows(projectPath?)
1000
+
1001
+ Lists all available workflows.
1002
+
1003
+ **Parameters:**
1004
+ ```javascript
1005
+ projectPath?: string // Optional: Project path (default: '.')
1006
+ ```
1007
+
1008
+ **Returns:**
1009
+ ```javascript
1010
+ Array<{
1011
+ id: string,
1012
+ name: string,
1013
+ description: string
1014
+ }>
1015
+ ```
1016
+
1017
+ **Example:**
1018
+ ```javascript
1019
+ import { listWorkflows } from './src/lib/workflow-detector.js';
1020
+
1021
+ const workflows = listWorkflows();
1022
+ workflows.forEach(w => {
1023
+ console.log(`${w.id}: ${w.name}`);
1024
+ });
1025
+ ```
1026
+
1027
+ ---
1028
+
1029
+ ## See Also
1030
+
1031
+ - [STORY-DRIVEN-DEVELOPMENT.md](docs/STORY-DRIVEN-DEVELOPMENT.md) - Philosophy and principles
1032
+ - [fast-track.md](docs/fast-track.md) - Fast-track workflow details
1033
+ - [standard.md](docs/standard.md) - Standard workflow details
1034
+ - [full-morph.md](docs/full-morph.md) - Full-morph workflow details
1035
+ - [design-impl.md](docs/design-impl.md) - Design implementation workflow
1036
+ - [ui-refresh.md](docs/ui-refresh.md) - UI refresh workflow
1037
+ - [Root CLAUDE.md](../../CLAUDE.md) - Main framework instructions
1038
+
1039
+ ---
1040
+
1041
+ *MORPH-SPEC Framework - Polymorphism Tech*