@polymorphism-tech/morph-spec 7.0.0 → 7.1.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 (89) hide show
  1. package/README.md +368 -368
  2. package/claude-plugin.json +14 -14
  3. package/docs/CHEATSHEET.md +199 -199
  4. package/docs/QUICKSTART.md +200 -200
  5. package/framework/CLAUDE.md +1 -1
  6. package/framework/MORPH.md +4 -1
  7. package/framework/agents.json +132 -127
  8. package/framework/rubrics/backend.json +41 -36
  9. package/framework/rules/ai-agents-standards.md +45 -15
  10. package/framework/rules/neon-standards.md +25 -26
  11. package/framework/skills/core/morph-brainstorming/SKILL.md +1 -1
  12. package/framework/skills/core/morph-plan/SKILL.md +3 -1
  13. package/framework/skills/core/morph-stack-scan/SKILL.md +3 -3
  14. package/framework/standards/STANDARDS.json +1729 -1133
  15. package/framework/standards/ai-agents/agent-session.md +160 -0
  16. package/framework/standards/ai-agents/batching.md +193 -0
  17. package/framework/standards/ai-agents/context-providers.md +188 -0
  18. package/framework/standards/ai-agents/mcp-server.md +250 -0
  19. package/framework/standards/ai-agents/mcp-tools.md +197 -0
  20. package/framework/standards/ai-agents/middleware-patterns.md +207 -0
  21. package/framework/standards/ai-agents/modalities-image-gen.md +173 -0
  22. package/framework/standards/ai-agents/modalities-speech-to-text.md +171 -0
  23. package/framework/standards/ai-agents/modalities-text-to-speech.md +181 -0
  24. package/framework/standards/ai-agents/modalities-vision.md +201 -0
  25. package/framework/standards/ai-agents/multi-agent-patterns.md +155 -0
  26. package/framework/standards/ai-agents/production.md +114 -258
  27. package/framework/standards/ai-agents/prompts-in-db.md +214 -0
  28. package/framework/standards/ai-agents/providers/model-registry.md +158 -0
  29. package/framework/standards/ai-agents/rag-custom-pgvector.md +243 -0
  30. package/framework/standards/ai-agents/service-tier-flex.md +135 -0
  31. package/framework/standards/ai-agents/setup.md +142 -316
  32. package/framework/standards/ai-agents/structured-output.md +249 -0
  33. package/framework/standards/ai-agents/sweet-spot.md +109 -0
  34. package/framework/standards/ai-agents/workflows.md +114 -284
  35. package/framework/standards/architecture/vertical-slice/vertical-slice.md +439 -429
  36. package/framework/standards/backend/api/validation.md +92 -88
  37. package/framework/standards/backend/database/postgresql/database.md +336 -332
  38. package/framework/standards/backend/database/vector-search-rag.md +599 -541
  39. package/framework/standards/backend/dotnet/fluent-validation-vsa.md +4 -0
  40. package/framework/standards/backend/dotnet/result-pattern.md +4 -0
  41. package/framework/standards/backend/dotnet/scalar-ui.md +176 -172
  42. package/framework/standards/backend/dotnet/scrutor.md +4 -0
  43. package/framework/standards/backend/dotnet/vsa-handler-patterns.md +310 -274
  44. package/framework/standards/backend/integrations/asaas/asaas-api.md +260 -216
  45. package/framework/standards/backend/integrations/hangfire/hangfire-jobs.md +354 -350
  46. package/framework/standards/backend/integrations/neon-auth/neon-auth.md +30 -19
  47. package/framework/standards/backend/integrations/resend/resend-email.md +400 -385
  48. package/framework/standards/data/nosql/cache/redis.md +106 -97
  49. package/framework/standards/data/nosql/cosmos-db.md +127 -118
  50. package/framework/standards/data/vector-search/rag-chunking.md +113 -104
  51. package/framework/standards/frontend/design-system/ai-image-generation.md +4 -0
  52. package/framework/standards/frontend/design-system/animations.md +164 -160
  53. package/framework/standards/frontend/design-system/naming.md +68 -64
  54. package/framework/standards/frontend/gsap/gsap-core.md +14 -8
  55. package/framework/standards/frontend/gsap/gsap-plugins.md +26 -21
  56. package/framework/standards/frontend/gsap/gsap-scrolltrigger.md +9 -7
  57. package/framework/standards/frontend/nextjs/app-router.md +127 -123
  58. package/framework/standards/frontend/nextjs/components.md +136 -132
  59. package/framework/standards/frontend/nextjs/data-fetching.md +130 -126
  60. package/framework/standards/frontend/nextjs/forms.md +134 -128
  61. package/framework/standards/frontend/nextjs/motion-patterns.md +328 -322
  62. package/framework/standards/frontend/nextjs/naming-conventions.md +71 -67
  63. package/framework/standards/frontend/nextjs/nextjs-patterns.md +229 -225
  64. package/framework/standards/frontend/nextjs/project-structure.md +106 -102
  65. package/framework/standards/frontend/nextjs/state-management.md +76 -72
  66. package/framework/standards/frontend/nextjs/testing.md +115 -111
  67. package/framework/standards/infrastructure/docker/easypanel-deploy.md +196 -192
  68. package/framework/standards/infrastructure/neon/neon-pgrag.md +6 -2
  69. package/framework/standards/infrastructure/neon/neon-pgvector.md +4 -0
  70. package/framework/standards/infrastructure/neon/neon-setup.md +5 -1
  71. package/framework/standards/integration/mcp/mcp-tools.md +471 -462
  72. package/framework/templates/CLAUDE.md.core.template +1 -1
  73. package/framework/templates/REGISTRY.json +1745 -1239
  74. package/framework/templates/code/dotnet/ai-agents/AgentBootstrap.cs.template +39 -0
  75. package/framework/templates/code/dotnet/ai-agents/EmbeddingService.cs.template +68 -0
  76. package/framework/templates/code/dotnet/ai-agents/ModelRegistry.cs.template +117 -0
  77. package/framework/templates/code/dotnet/ai-agents/PromptRepository.cs.template +95 -0
  78. package/framework/templates/code/dotnet/ai-agents/ResilientToolMiddleware.cs.template +61 -0
  79. package/framework/templates/code/dotnet/ai-agents/VectorSearchTool.cs.template +107 -0
  80. package/framework/templates/code/dotnet/ai-agents/model-registry.json.template +58 -0
  81. package/framework/templates/code/dotnet/backend/repository.cs +3 -10
  82. package/framework/templates/code/sql/ai-agents/agent-prompts-migration.sql.template +58 -0
  83. package/framework/templates/code/sql/ai-agents/pgvector-embeddings-migration.sql.template +91 -0
  84. package/package.json +89 -83
  85. package/src/core/templates/template-registry.js +289 -256
  86. package/src/lib/generators/context-generator.js +516 -518
  87. package/src/lib/generators/scaffold-generator.js +23 -26
  88. package/framework/standards/infrastructure/neon/neon-semantic-kernel.md +0 -310
  89. package/framework/templates/integrations/semantic-kernel-neon.cs +0 -125
@@ -1,200 +1,200 @@
1
- # morph-spec Quick Start
2
-
3
- ## Install
4
-
5
- ```bash
6
- npm install -g @polymorphism-tech/morph-spec
7
- ```
8
-
9
- > The installer automatically configures your PowerShell PATH on Windows. If `morph-spec` is not found, open a new terminal window.
10
-
11
- ---
12
-
13
- ## Initialize a project
14
-
15
- Navigate to your project root and run:
16
-
17
- ```bash
18
- morph-spec init
19
- ```
20
-
21
- `init` does the following:
22
- - Auto-detects your stack (Blazor, Next.js, Node.js, monorepo)
23
- - Creates `.morph/` with framework files, standards, and templates
24
- - Creates `.morph/context/` with inferred project context
25
- - Installs `.claude/skills/`, `.claude/agents/`, `.claude/rules/`
26
- - Writes `.claude/settings.local.json` with 10 Claude Code hooks
27
- - Copies `CLAUDE.md` with runtime instructions
28
-
29
- Verify the installation:
30
-
31
- ```bash
32
- morph-spec doctor
33
- ```
34
-
35
- ---
36
-
37
- ## Your first feature
38
-
39
- Open your project in Claude Code and run:
40
-
41
- ```
42
- /morph-proposal my-feature
43
- ```
44
-
45
- Replace `my-feature` with a short kebab-case name for your feature (e.g., `user-notifications`, `payment-flow`).
46
-
47
- The proposal pipeline runs phases 0–6 with three approval gates:
48
-
49
- ### Phase 0 — Proposal
50
-
51
- Claude analyzes your request, detects which agents are relevant, and produces `0-proposal/proposal.md`. You review it and approve (or request changes).
52
-
53
- ### Phase 1 — Setup
54
-
55
- Loads project context from `.morph/context/`, confirms stack and active agents. No approval needed.
56
-
57
- ### Phase 2 — UI/UX (conditional)
58
-
59
- Only runs if frontend agents are active. Claude generates:
60
- - `1-design/design-system.md` — colors, typography, spacing
61
- - `1-design/mockups.md` — ASCII wireframes
62
- - `1-design/components.md` — component specs
63
- - `1-design/flows.md` — user flows and edge cases
64
-
65
- You approve the UI design before design phase begins.
66
-
67
- ### Phase 3 — Design
68
-
69
- Claude produces the technical specification:
70
- - `2-design/spec.md` — full requirements, use cases, validations
71
- - `2-design/contracts.cs` — C# interfaces, DTOs, enums
72
- - `2-design/decisions.md` — architectural decision records (ADRs)
73
-
74
- You review and approve the design.
75
-
76
- ### Phase 4 — Clarify
77
-
78
- Claude identifies 3–7 ambiguities in the spec, asks you to resolve them, then updates the spec. No gate.
79
-
80
- ### Phase 6 — Tasks
81
-
82
- Claude breaks the spec into atomic tasks (`T001`, `T002`, …) saved to `3-tasks/tasks.md`. You approve the task list.
83
-
84
- At this point, planning is complete:
85
-
86
- ```
87
- ✅ Planning complete — run /morph-apply my-feature to implement
88
- ```
89
-
90
- ---
91
-
92
- ## Implement
93
-
94
- ```
95
- /morph-apply my-feature
96
- ```
97
-
98
- Claude reads `spec.md`, `contracts.cs`, and `tasks.md`, then implements task by task:
99
- - Starts each task, writes the code, marks it done
100
- - Runs 5 validators automatically after each task: security, architecture, packages, design system, Blazor concurrency
101
- - Auto-checkpoints every 3 tasks (validates, saves state)
102
- - Generates `4-implement/recap.md` on completion
103
-
104
- ---
105
-
106
- ## During development
107
-
108
- Check feature state:
109
-
110
- ```bash
111
- morph-spec state get my-feature
112
- morph-spec status my-feature
113
- ```
114
-
115
- Advance to the next phase manually (when needed):
116
-
117
- ```bash
118
- morph-spec phase advance my-feature
119
- ```
120
-
121
- Mark a task complete:
122
-
123
- ```bash
124
- morph-spec task done my-feature T001
125
- ```
126
-
127
- Run validators at any time:
128
-
129
- ```bash
130
- morph-spec validate # all validators
131
- morph-spec validate architecture # specific validator
132
- morph-spec validate packages
133
- ```
134
-
135
- ---
136
-
137
- ## Multiple features
138
-
139
- You can have multiple features in progress simultaneously. Each has its own directory under `.morph/features/`:
140
-
141
- ```
142
- .morph/features/
143
- ├── user-notifications/
144
- │ ├── 0-proposal/
145
- │ ├── 2-design/
146
- │ └── 3-tasks/
147
- └── payment-flow/
148
- ├── 0-proposal/
149
- └── 2-design/
150
- ```
151
-
152
- See all feature states:
153
-
154
- ```bash
155
- morph-spec state list
156
- ```
157
-
158
- ---
159
-
160
- ## Keeping up to date
161
-
162
- When a new version of `@polymorphism-tech/morph-spec` is published:
163
-
164
- ```bash
165
- # Update the CLI
166
- npm install -g @polymorphism-tech/morph-spec@latest
167
-
168
- # Update framework files in your project
169
- morph-spec update
170
-
171
- # Verify
172
- morph-spec doctor
173
- ```
174
-
175
- `morph-spec update` re-syncs `.morph/framework/`, `.claude/skills/`, `.claude/agents/`, `.claude/rules/`, and `CLAUDE.md`. It does not touch your config, context, or feature outputs.
176
-
177
- ---
178
-
179
- ## Tips
180
-
181
- **Use `/morph-proposal` even for small features.** The proposal phase catches scope creep, identifies the right agents, and generates contracts early — before implementation makes it expensive to change direction.
182
-
183
- **Approve explicitly at each gate.** The design gate exists to prevent implementing the wrong thing. If something in `spec.md` or `contracts.cs` looks off, say so before approving.
184
-
185
- **ADRs belong in `decisions.md`.** When Claude makes an architectural choice, it documents it there. Read it after Design completes. Decisions drive the validators that run during implementation.
186
-
187
- **`morph-spec doctor` is your first debugging step.** If something is behaving unexpectedly, doctor will surface version mismatches, missing files, and hook configuration issues.
188
-
189
- ---
190
-
191
- ## Next steps
192
-
193
- - [CHEATSHEET.md](CHEATSHEET.md) — command reference
194
- - [ARCHITECTURE.md](ARCHITECTURE.md) — system design and agent hierarchy
195
- - [CHANGELOG.md](../CHANGELOG.md) — release history
196
- - `.morph/framework/standards/` — all coding and architecture standards
197
-
198
- ---
199
-
200
- *morph-spec v4.22.1 by Polymorphism Tech*
1
+ # morph-spec Quick Start
2
+
3
+ ## Install
4
+
5
+ ```bash
6
+ npm install -g @polymorphism-tech/morph-spec
7
+ ```
8
+
9
+ > The installer automatically configures your PowerShell PATH on Windows. If `morph-spec` is not found, open a new terminal window.
10
+
11
+ ---
12
+
13
+ ## Initialize a project
14
+
15
+ Navigate to your project root and run:
16
+
17
+ ```bash
18
+ morph-spec init
19
+ ```
20
+
21
+ `init` does the following:
22
+ - Auto-detects your stack (Blazor, Next.js, Node.js, monorepo)
23
+ - Creates `.morph/` with framework files, standards, and templates
24
+ - Creates `.morph/context/` with inferred project context
25
+ - Installs `.claude/skills/`, `.claude/agents/`, `.claude/rules/`
26
+ - Writes `.claude/settings.local.json` with 10 Claude Code hooks
27
+ - Copies `CLAUDE.md` with runtime instructions
28
+
29
+ Verify the installation:
30
+
31
+ ```bash
32
+ morph-spec doctor
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Your first feature
38
+
39
+ Open your project in Claude Code and run:
40
+
41
+ ```
42
+ /morph-proposal my-feature
43
+ ```
44
+
45
+ Replace `my-feature` with a short kebab-case name for your feature (e.g., `user-notifications`, `payment-flow`).
46
+
47
+ The proposal pipeline runs phases 0–6 with three approval gates:
48
+
49
+ ### Phase 0 — Proposal
50
+
51
+ Claude analyzes your request, detects which agents are relevant, and produces `0-proposal/proposal.md`. You review it and approve (or request changes).
52
+
53
+ ### Phase 1 — Setup
54
+
55
+ Loads project context from `.morph/context/`, confirms stack and active agents. No approval needed.
56
+
57
+ ### Phase 2 — UI/UX (conditional)
58
+
59
+ Only runs if frontend agents are active. Claude generates:
60
+ - `1-design/design-system.md` — colors, typography, spacing
61
+ - `1-design/mockups.md` — ASCII wireframes
62
+ - `1-design/components.md` — component specs
63
+ - `1-design/flows.md` — user flows and edge cases
64
+
65
+ You approve the UI design before design phase begins.
66
+
67
+ ### Phase 3 — Design
68
+
69
+ Claude produces the technical specification:
70
+ - `2-design/spec.md` — full requirements, use cases, validations
71
+ - `2-design/contracts.cs` — C# interfaces, DTOs, enums
72
+ - `2-design/decisions.md` — architectural decision records (ADRs)
73
+
74
+ You review and approve the design.
75
+
76
+ ### Phase 4 — Clarify
77
+
78
+ Claude identifies 3–7 ambiguities in the spec, asks you to resolve them, then updates the spec. No gate.
79
+
80
+ ### Phase 6 — Tasks
81
+
82
+ Claude breaks the spec into atomic tasks (`T001`, `T002`, …) saved to `3-tasks/tasks.md`. You approve the task list.
83
+
84
+ At this point, planning is complete:
85
+
86
+ ```
87
+ ✅ Planning complete — run /morph-apply my-feature to implement
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Implement
93
+
94
+ ```
95
+ /morph-apply my-feature
96
+ ```
97
+
98
+ Claude reads `spec.md`, `contracts.cs`, and `tasks.md`, then implements task by task:
99
+ - Starts each task, writes the code, marks it done
100
+ - Runs 5 validators automatically after each task: security, architecture, packages, design system, Blazor concurrency
101
+ - Auto-checkpoints every 3 tasks (validates, saves state)
102
+ - Generates `4-implement/recap.md` on completion
103
+
104
+ ---
105
+
106
+ ## During development
107
+
108
+ Check feature state:
109
+
110
+ ```bash
111
+ morph-spec state get my-feature
112
+ morph-spec status my-feature
113
+ ```
114
+
115
+ Advance to the next phase manually (when needed):
116
+
117
+ ```bash
118
+ morph-spec phase advance my-feature
119
+ ```
120
+
121
+ Mark a task complete:
122
+
123
+ ```bash
124
+ morph-spec task done my-feature T001
125
+ ```
126
+
127
+ Run validators at any time:
128
+
129
+ ```bash
130
+ morph-spec validate # all validators
131
+ morph-spec validate architecture # specific validator
132
+ morph-spec validate packages
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Multiple features
138
+
139
+ You can have multiple features in progress simultaneously. Each has its own directory under `.morph/features/`:
140
+
141
+ ```
142
+ .morph/features/
143
+ ├── user-notifications/
144
+ │ ├── 0-proposal/
145
+ │ ├── 2-design/
146
+ │ └── 3-tasks/
147
+ └── payment-flow/
148
+ ├── 0-proposal/
149
+ └── 2-design/
150
+ ```
151
+
152
+ See all feature states:
153
+
154
+ ```bash
155
+ morph-spec state list
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Keeping up to date
161
+
162
+ When a new version of `@polymorphism-tech/morph-spec` is published:
163
+
164
+ ```bash
165
+ # Update the CLI
166
+ npm install -g @polymorphism-tech/morph-spec@latest
167
+
168
+ # Update framework files in your project
169
+ morph-spec update
170
+
171
+ # Verify
172
+ morph-spec doctor
173
+ ```
174
+
175
+ `morph-spec update` re-syncs `.morph/framework/`, `.claude/skills/`, `.claude/agents/`, `.claude/rules/`, and `CLAUDE.md`. It does not touch your config, context, or feature outputs.
176
+
177
+ ---
178
+
179
+ ## Tips
180
+
181
+ **Use `/morph-proposal` even for small features.** The proposal phase catches scope creep, identifies the right agents, and generates contracts early — before implementation makes it expensive to change direction.
182
+
183
+ **Approve explicitly at each gate.** The design gate exists to prevent implementing the wrong thing. If something in `spec.md` or `contracts.cs` looks off, say so before approving.
184
+
185
+ **ADRs belong in `decisions.md`.** When Claude makes an architectural choice, it documents it there. Read it after Design completes. Decisions drive the validators that run during implementation.
186
+
187
+ **`morph-spec doctor` is your first debugging step.** If something is behaving unexpectedly, doctor will surface version mismatches, missing files, and hook configuration issues.
188
+
189
+ ---
190
+
191
+ ## Next steps
192
+
193
+ - [CHEATSHEET.md](CHEATSHEET.md) — command reference
194
+ - [ARCHITECTURE.md](ARCHITECTURE.md) — system design and agent hierarchy
195
+ - [CHANGELOG.md](../CHANGELOG.md) — release history
196
+ - `.morph/framework/standards/` — all coding and architecture standards
197
+
198
+ ---
199
+
200
+ *morph-spec v7.1.1 by Polymorphism Tech*
@@ -16,7 +16,7 @@ Se não houver feature ativa, pergunte ao usuário qual feature trabalhar.
16
16
  - Pular para código sem proposal aprovado (Gate 1) e plano aprovado (Gate 2).
17
17
  - Modificar `spec.md`, `mandate.md`, `tasks.md` depois do Gate 2 — eles estão congelados.
18
18
  - Listar perguntas em texto simples — sempre use a tool `AskUserQuestion` (1-4 perguntas por chamada).
19
- - Usar `Guid.NewGuid()`, classes não-sealed sem justificativa, exceptions como fluxo de controle, Repository pattern.
19
+ - Usar `Guid.NewGuid()`, classes não-sealed sem justificativa, exceptions como fluxo de controle, camada de Service/Manager entre handler e dados, ou SQL cru sem justificativa.
20
20
 
21
21
  **SEMPRE:**
22
22
  - Auto-advance entre tarefas durante a fase implement — não pause sem ambiguidade bloqueante.
@@ -48,7 +48,10 @@ Padrões proibidos automaticamente injetados no mandate:
48
48
  - `Guid.NewGuid()` → `Guid.CreateVersion7()`
49
49
  - Classes não-sealed sem justificativa
50
50
  - Exceptions como fluxo de controle
51
- - Repository pattern / `IRepository<T>` (VSA usa handlers diretos no DbContext)
51
+ - Camada de Service/Manager entre handler e dados — o handler fala com `IRepository<T>` ou `DbContext`, nunca com um service
52
+ - SQL cru (`FromSqlRaw`, `ExecuteQuery(string)`) sem justificativa em `decisions.md` — use LINQ
53
+
54
+ Acesso a dados em VSA é híbrido: `IRepository<T>` + `IUnitOfWork` para CRUD simples; `ApplicationDbContext` injetado direto no slice quando a query for específica (joins, projeção, paginação, filtros compostos).
52
55
 
53
56
  ---
54
57