@polymorphism-tech/morph-spec 8.44.0 → 8.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/CLAUDE.md +11 -9
  2. package/README.md +10 -10
  3. package/bin/morph-spec.js +11 -13
  4. package/bin/validate.js +379 -379
  5. package/claude-plugin.json +1 -1
  6. package/docs/CHEATSHEET.md +2 -4
  7. package/docs/QUICKSTART.md +6 -6
  8. package/framework/CLAUDE.md +6 -8
  9. package/framework/MORPH.md +39 -45
  10. package/framework/agents.json +8 -9
  11. package/framework/commands/morph-apply.md +1 -3
  12. package/framework/commands/morph-hotfix.md +1 -1
  13. package/framework/commands/morph-proposal.md +2 -2
  14. package/framework/docs/CLI.md +15 -14
  15. package/framework/evals/review-checklist.md +90 -0
  16. package/framework/evals/trace-schema.md +2 -12
  17. package/framework/hooks/README.md +2 -3
  18. package/framework/hooks/claude-code/core/heavy-gate.js +1 -1
  19. package/framework/hooks/claude-code/core/protect-spec-files.js +2 -2
  20. package/framework/hooks/claude-code/core/telemetry-log.js +2 -2
  21. package/framework/hooks/claude-code/core/trace-autogen.js +1 -22
  22. package/framework/hooks/claude-code/core/validate-completion.js +3 -56
  23. package/framework/hooks/claude-code/statusline.sh +11 -11
  24. package/framework/hooks/git/commit-msg/conventional-commits.sh +33 -33
  25. package/framework/hooks/git/pre-commit/agents.sh +25 -25
  26. package/framework/hooks/git/pre-commit/orchestrator.sh +64 -64
  27. package/framework/hooks/git/pre-commit/specs.sh +50 -50
  28. package/framework/hooks/git/pre-push/run-tests.sh +44 -44
  29. package/framework/hooks/shared/build-check.js +1 -1
  30. package/framework/hooks/shared/comment-scanner.js +1 -1
  31. package/framework/hooks/shared/phase-utils.js +0 -5
  32. package/framework/hooks/shared/stdin-reader.js +26 -26
  33. package/framework/phases.json +4 -6
  34. package/framework/rubrics/backend.json +1 -1
  35. package/framework/rubrics/default.json +1 -1
  36. package/framework/rubrics/frontend.json +1 -1
  37. package/framework/rules/morph-workflow.md +6 -6
  38. package/framework/schemas/config.schema.json +4 -0
  39. package/framework/schemas/feature.schema.json +5 -29
  40. package/framework/schemas/tasks.schema.json +6 -2
  41. package/framework/skills/README.md +1 -2
  42. package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
  43. package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
  44. package/framework/skills/core/morph-apply/SKILL.md +145 -246
  45. package/framework/skills/core/morph-brainstorming/SKILL.md +1 -1
  46. package/framework/skills/core/morph-hotfix/SKILL.md +5 -3
  47. package/framework/skills/core/morph-implement/SKILL.md +101 -201
  48. package/framework/skills/core/morph-machine/SKILL.md +3 -3
  49. package/framework/skills/core/morph-media/SKILL.md +1 -1
  50. package/framework/skills/core/morph-plan/SKILL.md +171 -287
  51. package/framework/skills/core/morph-proposal/SKILL.md +4 -5
  52. package/framework/skills/core/morph-review/SKILL.md +122 -430
  53. package/framework/skills/core/morph-stack-scan/SKILL.md +1 -1
  54. package/framework/skills/core/morph-standards/SKILL.md +2 -2
  55. package/framework/skills/core/morph-uiux/SKILL.md +2 -3
  56. package/framework/standards/STANDARDS.json +10 -10
  57. package/framework/standards/ai-agents/agent-archetypes.md +1 -1
  58. package/framework/standards/ai-agents/agent-session.md +1 -1
  59. package/framework/standards/ai-agents/agent-spec.md +1 -1
  60. package/framework/standards/ai-agents/batching.md +1 -1
  61. package/framework/standards/ai-agents/context-providers.md +1 -1
  62. package/framework/standards/ai-agents/conversational-agent-with-phases.md +1 -1
  63. package/framework/standards/ai-agents/cost-and-budget.md +1 -1
  64. package/framework/standards/ai-agents/durable-workflows-hitl.md +1 -1
  65. package/framework/standards/ai-agents/guardrails.md +1 -1
  66. package/framework/standards/ai-agents/llm-runtime-defaults.md +1 -1
  67. package/framework/standards/ai-agents/mcp-server.md +1 -1
  68. package/framework/standards/ai-agents/mcp-tools.md +1 -1
  69. package/framework/standards/ai-agents/media-pipeline.md +1 -1
  70. package/framework/standards/ai-agents/media-video.md +1 -1
  71. package/framework/standards/ai-agents/middleware-patterns.md +1 -1
  72. package/framework/standards/ai-agents/modalities-image-gen.md +1 -1
  73. package/framework/standards/ai-agents/modalities-speech-to-text.md +1 -1
  74. package/framework/standards/ai-agents/modalities-text-to-speech.md +1 -1
  75. package/framework/standards/ai-agents/modalities-vision.md +1 -1
  76. package/framework/standards/ai-agents/multi-agent-patterns.md +1 -1
  77. package/framework/standards/ai-agents/observability-patterns.md +3 -3
  78. package/framework/standards/ai-agents/production.md +2 -2
  79. package/framework/standards/ai-agents/prompt-sources.md +1 -1
  80. package/framework/standards/ai-agents/providers/model-registry.md +1 -1
  81. package/framework/standards/ai-agents/rag-custom-pgvector.md +1 -1
  82. package/framework/standards/ai-agents/service-tier-flex.md +1 -1
  83. package/framework/standards/ai-agents/setup.md +1 -1
  84. package/framework/standards/ai-agents/structured-output.md +1 -1
  85. package/framework/standards/ai-agents/sweet-spot.md +1 -1
  86. package/framework/standards/ai-agents/testing-ai.md +1 -1
  87. package/framework/standards/ai-agents/tool-adapters.md +1 -1
  88. package/framework/standards/ai-agents/vector-data-extensions.md +1 -1
  89. package/framework/standards/ai-agents/workflows.md +1 -1
  90. package/framework/templates/CLAUDE.md.core.template +1 -1
  91. package/framework/templates/IDE-SNIPPETS.md +262 -262
  92. package/framework/templates/README.md +1 -1
  93. package/framework/templates/REGISTRY.json +0 -81
  94. package/framework/templates/code/dotnet/abstractions/api-endpoint.cs +7 -7
  95. package/framework/templates/code/dotnet/feature/endpoint.cs.hbs +21 -21
  96. package/framework/templates/code/dotnet/feature/request.cs.hbs +4 -4
  97. package/framework/templates/code/dotnet/feature/response.cs.hbs +4 -4
  98. package/framework/templates/code/sql/ai-agents/pgvector-embeddings-migration.sql.template +91 -91
  99. package/framework/templates/docs/spec.md +19 -205
  100. package/framework/templates/docs/ui-components.md +52 -52
  101. package/framework/templates/docs/ui-design-system.md +76 -76
  102. package/framework/templates/docs/ui-flows.md +167 -167
  103. package/framework/templates/frontend/nextjs/client-component.tsx.hbs +26 -26
  104. package/framework/templates/frontend/nextjs/feature-form.tsx.hbs +56 -56
  105. package/framework/templates/frontend/nextjs/tsconfig.json.hbs +26 -26
  106. package/framework/templates/infrastructure/docker/Dockerfile.template +58 -58
  107. package/framework/templates/infrastructure/docker/dockerfile-api.dockerfile +38 -38
  108. package/framework/templates/infrastructure/docker/dockerfile-web.dockerfile +48 -48
  109. package/framework/templates/infrastructure/github/README.md +56 -56
  110. package/framework/templates/infrastructure/github/actions/docker-build-push/action.yml.hbs +45 -45
  111. package/framework/templates/infrastructure/github/actions/health-check/action.yml.hbs +27 -27
  112. package/framework/templates/infrastructure/github/workflows/docker-build-push.yml.hbs +59 -59
  113. package/framework/templates/infrastructure/github/workflows/dotnet-build.yml.hbs +39 -39
  114. package/framework/templates/meta-prompts/fusion/fusion-agent.md +76 -76
  115. package/framework/templates/meta-prompts/fusion/fusion-aggregator.md +100 -100
  116. package/framework/templates/meta-prompts/validators/pre-commit-validator.md +95 -95
  117. package/framework/templates/state.template.json +17 -17
  118. package/framework/templates/ui/design-system.css +226 -226
  119. package/package.json +2 -2
  120. package/src/commands/e2e/e2e.js +1 -1
  121. package/src/commands/project/heavy.js +1 -1
  122. package/src/commands/project/status.js +3 -3
  123. package/src/commands/state/approve.js +7 -49
  124. package/src/commands/state/gate-check.js +16 -106
  125. package/src/commands/state/gate-decision.js +1 -1
  126. package/src/commands/state/report-check.js +42 -17
  127. package/src/commands/validation/mutate.js +1 -1
  128. package/src/commands/validation/scout-check.js +28 -0
  129. package/src/commands/validation/validate-feature.js +5 -32
  130. package/src/commands/validation/verify.js +98 -48
  131. package/src/core/paths/output-schema.js +0 -2
  132. package/src/core/state/state-manager.js +1 -2
  133. package/src/core/templates/template-renderer.js +477 -477
  134. package/src/dashboard/app/lib/format.js +5 -0
  135. package/src/dashboard/app/main.jsx +13 -13
  136. package/src/dashboard/app/pages/FeatureDetail.jsx +16 -22
  137. package/src/dashboard/app/pages/Features.jsx +7 -7
  138. package/src/dashboard/app/pages/PhasePipeline.jsx +1 -1
  139. package/src/dashboard/app/pages/Rubrics.jsx +7 -11
  140. package/src/dashboard/scanner/docs-scanner.js +1 -2
  141. package/src/dashboard/scanner/features-scanner.js +3 -4
  142. package/src/dashboard/scanner/rubrics-scanner.js +12 -12
  143. package/src/dashboard/vite.config.js +24 -24
  144. package/src/lib/agents/output-collector.js +0 -1
  145. package/src/lib/ci/ci-verify.js +118 -0
  146. package/src/lib/ci/github-ci.js +192 -0
  147. package/src/lib/ci/workflow-scaffold.js +122 -0
  148. package/src/lib/detectors/design-system-detector.js +188 -188
  149. package/src/lib/evaluator-report.js +52 -334
  150. package/src/lib/generators/design-system-generator.js +508 -508
  151. package/src/lib/generators/handoff-generator.js +4 -5
  152. package/src/lib/installers/memory-installer.js +2 -2
  153. package/src/lib/mutation/manifest.js +8 -2
  154. package/src/lib/mutation/report.js +5 -3
  155. package/src/lib/mutation/runner.js +9 -7
  156. package/src/lib/risk-detector.js +60 -122
  157. package/src/lib/scout/scout-check.js +293 -0
  158. package/src/lib/tasks/task-classifier.js +30 -30
  159. package/src/lib/tasks/task-parser.js +209 -209
  160. package/src/lib/tasks/tasks-json-parser.js +7 -5
  161. package/src/lib/tasks/test-nodes.js +1 -1
  162. package/src/lib/tasks/test-runner.js +1 -1
  163. package/src/lib/telemetry/verify-event.js +3 -2
  164. package/src/lib/validators/css/css-validator.js +340 -340
  165. package/src/lib/validators/reuse/reuse-validator.js +6 -8
  166. package/src/lib/validators/verify-runner.js +1 -1
  167. package/src/scripts/setup-infra.js +1 -1
  168. package/src/utils/agent-id-mapper.js +11 -11
  169. package/src/utils/agents-installer.js +5 -9
  170. package/src/utils/claude-settings-manager.js +300 -300
  171. package/src/utils/hooks-installer.js +3 -10
  172. package/src/utils/skills-installer.js +1 -1
  173. package/framework/evals/proof-rubrics/README.md +0 -76
  174. package/framework/evals/proof-rubrics/eval-de-modelo.md +0 -80
  175. package/framework/evals/proof-rubrics/fiacao.md +0 -54
  176. package/framework/evals/proof-rubrics/guard-cego.md +0 -52
  177. package/framework/evals/proof-rubrics/media-claims.md +0 -109
  178. package/framework/evals/proof-rubrics/mutation-proof.md +0 -107
  179. package/framework/evals/proof-rubrics/observabilidade-genai.md +0 -119
  180. package/framework/evals/proof-rubrics/verde-nao-e-coberto.md +0 -48
  181. package/framework/evals/rubrics/README.md +0 -45
  182. package/framework/evals/rubrics/architecture.md +0 -103
  183. package/framework/evals/rubrics/code-quality.md +0 -98
  184. package/framework/evals/rubrics/condensed.md +0 -57
  185. package/framework/evals/rubrics/contracts.md +0 -67
  186. package/framework/evals/rubrics/test-coverage.md +0 -99
  187. package/framework/evals/scenarios/dotnet-crud.yaml +0 -42
  188. package/framework/evals/scenarios/nextjs-auth.yaml +0 -38
  189. package/framework/evals/suites/standard.yaml +0 -5
  190. package/framework/hooks/claude-code/__pycache__/statusline.cpython-313.pyc +0 -0
  191. package/framework/hooks/claude-code/core/post-edit-typecheck.js +0 -127
  192. package/framework/skills/core/morph-eval/SKILL.md +0 -64
  193. package/framework/templates/.idea/morph-templates.xml +0 -92
  194. package/framework/templates/.vscode/morph-templates.code-snippets +0 -186
  195. package/framework/templates/docs/clarifications.md +0 -253
  196. package/framework/templates/docs/onboarding.md +0 -122
  197. package/framework/templates/docs/schema-analysis.md +0 -119
  198. package/framework/templates/docs/user-stories.md +0 -34
  199. package/src/commands/state/score.js +0 -147
@@ -1,253 +0,0 @@
1
- # Clarifications - {{FEATURE_NAME_TITLE}}
2
-
3
- **Feature**: {{FEATURE_NAME}}
4
- **Date**: {{DATE}}
5
- **Phase**: CLARIFY (Phase 3)
6
- **Status**: {{#if status}}{{status}}{{else}}In Progress{{/if}}
7
-
8
- ---
9
-
10
- ## Purpose
11
-
12
- This document addresses ambiguities, edge cases, and questions identified during the design review. All clarifications should be incorporated back into `spec.md` after approval.
13
-
14
- ---
15
-
16
- ## Questions & Answers
17
-
18
- {{#each questions}}
19
- ### Q{{this.id}}: {{this.category}} - {{this.title}}
20
-
21
- **Question:**
22
- {{this.question}}
23
-
24
- **Context:**
25
- {{this.context}}
26
-
27
- **Answer:**
28
- {{this.answer}}
29
-
30
- **Impact:**
31
- {{this.impact}}
32
-
33
- **Spec Updates Required:**
34
- {{#each this.specUpdates}}
35
- - {{this}}
36
- {{/each}}
37
-
38
- **Priority:** {{this.priority}}
39
- **Resolved:** {{#if this.resolved}}✅ Yes{{else}}❌ No{{/if}}
40
- **Resolved By:** {{#if this.resolvedBy}}{{this.resolvedBy}}{{else}}_Pending_{{/if}}
41
-
42
- ---
43
- {{/each}}
44
-
45
- ## Edge Cases Identified
46
-
47
- {{#each edgeCases}}
48
- ### EC{{@index}}: {{this.title}}
49
-
50
- **Scenario:**
51
- {{this.scenario}}
52
-
53
- **Current Behavior:**
54
- {{this.currentBehavior}}
55
-
56
- **Expected Behavior:**
57
- {{this.expectedBehavior}}
58
-
59
- **Proposed Solution:**
60
- {{this.proposedSolution}}
61
-
62
- **Acceptance Criteria:**
63
- {{#each this.acceptanceCriteria}}
64
- - [ ] {{this}}
65
- {{/each}}
66
-
67
- **Affected Components:**
68
- {{#each this.affectedComponents}}
69
- - {{this}}
70
- {{/each}}
71
-
72
- ---
73
- {{/each}}
74
-
75
- ## Assumptions Validated
76
-
77
- {{#each assumptions}}
78
- ### A{{@index}}: {{this.title}}
79
-
80
- **Assumption:**
81
- {{this.description}}
82
-
83
- **Validation:**
84
- {{#if this.validated}}✅ Confirmed{{else}}❌ Invalid{{/if}}
85
-
86
- **Notes:**
87
- {{this.notes}}
88
-
89
- **Action Required:**
90
- {{#if this.action}}{{this.action}}{{else}}_None_{{/if}}
91
-
92
- ---
93
- {{/each}}
94
-
95
- ## Business Rules Clarified
96
-
97
- {{#each businessRules}}
98
- ### BR{{@index}}: {{this.title}}
99
-
100
- **Rule:**
101
- {{this.rule}}
102
-
103
- **Rationale:**
104
- {{this.rationale}}
105
-
106
- **Examples:**
107
- {{#each this.examples}}
108
- - {{this}}
109
- {{/each}}
110
-
111
- **Exceptions:**
112
- {{#if this.exceptions}}
113
- {{#each this.exceptions}}
114
- - {{this}}
115
- {{/each}}
116
- {{else}}
117
- _None_
118
- {{/if}}
119
-
120
- ---
121
- {{/each}}
122
-
123
- ## Data Validation Rules
124
-
125
- {{#each dataValidations}}
126
- ### DV{{@index}}: {{this.field}} Validation
127
-
128
- **Field:** {{this.field}}
129
- **Entity:** {{this.entity}}
130
-
131
- **Validation Rules:**
132
- {{#each this.rules}}
133
- - {{this}}
134
- {{/each}}
135
-
136
- **Error Messages:**
137
- {{#each this.errorMessages}}
138
- - {{this.condition}}: "{{this.message}}"
139
- {{/each}}
140
-
141
- **Impact on UX:**
142
- {{this.uxImpact}}
143
-
144
- ---
145
- {{/each}}
146
-
147
- ## Performance & Scalability Clarifications
148
-
149
- {{#each performanceClarifications}}
150
- ### PC{{@index}}: {{this.title}}
151
-
152
- **Concern:**
153
- {{this.concern}}
154
-
155
- **Clarification:**
156
- {{this.clarification}}
157
-
158
- **Solution:**
159
- {{this.solution}}
160
-
161
- **Performance Target:**
162
- {{this.target}}
163
-
164
- ---
165
- {{/each}}
166
-
167
- ## Security & Authorization Clarifications
168
-
169
- {{#each securityClarifications}}
170
- ### SC{{@index}}: {{this.title}}
171
-
172
- **Security Concern:**
173
- {{this.concern}}
174
-
175
- **Clarification:**
176
- {{this.clarification}}
177
-
178
- **Implementation:**
179
- {{this.implementation}}
180
-
181
- **Affected Roles:**
182
- {{#each this.affectedRoles}}
183
- - {{this}}
184
- {{/each}}
185
-
186
- ---
187
- {{/each}}
188
-
189
- ## Integration & External Dependencies
190
-
191
- {{#each integrationClarifications}}
192
- ### IC{{@index}}: {{this.title}}
193
-
194
- **External System:**
195
- {{this.externalSystem}}
196
-
197
- **Question:**
198
- {{this.question}}
199
-
200
- **Clarification:**
201
- {{this.clarification}}
202
-
203
- **API Endpoint/Method:**
204
- {{this.apiDetails}}
205
-
206
- **Error Handling:**
207
- {{this.errorHandling}}
208
-
209
- ---
210
- {{/each}}
211
-
212
- ## Summary
213
-
214
- **Total Questions:** {{#if totalQuestions}}{{totalQuestions}}{{else}}0{{/if}}
215
- **Resolved:** {{#if resolvedCount}}{{resolvedCount}}{{else}}0{{/if}}
216
- **Pending:** {{#if pendingCount}}{{pendingCount}}{{else}}0{{/if}}
217
-
218
- **Edge Cases Identified:** {{#if edgeCaseCount}}{{edgeCaseCount}}{{else}}0{{/if}}
219
- **Business Rules Documented:** {{#if businessRuleCount}}{{businessRuleCount}}{{else}}0{{/if}}
220
- **Assumptions Validated:** {{#if assumptionCount}}{{assumptionCount}}{{else}}0{{/if}}
221
-
222
- ---
223
-
224
- ## Next Steps
225
-
226
- 1. [ ] Resolve all pending questions
227
- 2. [ ] Update `spec.md` with all clarifications
228
- 3. [ ] Update `contracts.cs` if data model changes are needed
229
- 4. [ ] Document breaking changes in `decisions.md`
230
- 5. [ ] Get stakeholder approval on all clarifications
231
- 6. [ ] Advance to Phase 4 (Tasks)
232
-
233
- ---
234
-
235
- ## Spec Updates Log
236
-
237
- **Changes to be made to `spec.md`:**
238
-
239
- {{#each specUpdates}}
240
- ### Update {{@index}}
241
-
242
- **Section:** {{this.section}}
243
- **Type:** {{this.type}}
244
- **Description:** {{this.description}}
245
- **From Clarification:** {{this.clarificationId}}
246
-
247
- ---
248
- {{/each}}
249
-
250
- ---
251
-
252
- *Generated by MORPH-SPEC v{{FRAMEWORK_VERSION}}*
253
- *All clarifications must be incorporated into spec.md before advancing to Phase 4*
@@ -1,122 +0,0 @@
1
- # Onboarding Guide — {{PROJECT_NAME}}
2
-
3
- > Generated by MORPH-SPEC on {{DATE}}
4
-
5
- ---
6
-
7
- ## Project Overview
8
-
9
- - **Project:** {{PROJECT_NAME}}
10
- - **Stack:** {{STACK}}
11
- - **Architecture:** {{ARCHITECTURE}}
12
-
13
- ---
14
-
15
- ## Active Agents
16
-
17
- The following agents are configured for this project:
18
-
19
- {{AGENTS_LIST}}
20
-
21
- ---
22
-
23
- ## Available MCPs & Plugins
24
-
25
- {{AVAILABLE_MCPS}}
26
-
27
- ---
28
-
29
- ## Standards
30
-
31
- The following standards are enforced in this project:
32
-
33
- {{STANDARDS_SUMMARY}}
34
-
35
- Standards are located in:
36
- - `.morph/framework/standards/` — Framework standards (universal)
37
- - `.morph/context/` — Project-specific overrides
38
-
39
- ---
40
-
41
- ## Configured Workflow
42
-
43
- {{WORKFLOW_SUMMARY}}
44
-
45
- ### Available Workflows
46
-
47
- | Workflow | Description | Phases |
48
- |----------|-------------|--------|
49
- | fast-track | Simple, well-defined features | 0→1→2→4→5 |
50
- | standard | Most features | 0→1→(1.5)→2→3→4→5 |
51
- | full-morph | Complex features with sync | 0→1→1.5→2→3→4→5→6 |
52
- | design-impl | Pre-planned work | 2→4→5 |
53
- | ui-refresh | Visual redesigns | 1.5→2→5 |
54
-
55
- ---
56
-
57
- ## Key Commands
58
-
59
- ```bash
60
- # Start a feature
61
- # Just ask Claude Code to implement something
62
-
63
- # Check feature progress
64
- morph-spec status <feature>
65
-
66
- # Validate feature outputs
67
- morph-spec validate-feature <feature>
68
-
69
- # Approve the current gate and scaffold the next phase folder
70
- morph-spec advance <feature>
71
-
72
- # Archive a finished feature (after Gate 3)
73
- morph-spec archive <feature>
74
-
75
- # Health check
76
- morph-spec doctor
77
- ```
78
-
79
- > **Task tracking lives in `tasks.json`.** During the implement phase Claude records
80
- > progress by writing `tasks.json` directly (only the `status`, `outputs`, and `notes`
81
- > fields). State is synced automatically by the `state-sync` hook — there is no CLI
82
- > command to mark a task done.
83
-
84
- ---
85
-
86
- ## Project Structure
87
-
88
- ```
89
- {{PROJECT_NAME}}/
90
- ├── CLAUDE.md # Claude Code instructions
91
- ├── .morph/
92
- │ ├── config/
93
- │ │ └── config.json # Project configuration
94
- │ ├── framework/
95
- │ │ ├── agents.json # Agent definitions
96
- │ │ ├── standards/ # Framework standards
97
- │ │ └── templates/ # Output templates
98
- │ ├── context/ # Project context & overrides
99
- │ └── features/{feature}/ # Feature outputs
100
- │ ├── 0-proposal/
101
- │ ├── 1-design/ # optional (UI-heavy features)
102
- │ ├── 2-plan/
103
- │ ├── 3-implement/
104
- │ └── 4-review/
105
- └── .claude/
106
- ├── commands/ # Slash commands
107
- ├── skills/ # Workflow skills
108
- └── settings.local.json # Hooks & permissions
109
- ```
110
-
111
- ---
112
-
113
- ## Getting Started
114
-
115
- 1. **Ask Claude Code** to implement a feature
116
- 2. **Follow the phases** — the framework guides you automatically
117
- 3. **Approve at pauses** — design and task breakdowns need your approval
118
- 4. **Check progress** with `morph-spec status <feature>`
119
-
120
- ---
121
-
122
- *Generated by MORPH-SPEC v{{VERSION}} — Polymorphism Tech*
@@ -1,119 +0,0 @@
1
- # Schema Analysis - {{FEATURE_NAME_TITLE}}
2
-
3
- **Feature**: {{FEATURE_NAME}}
4
- **Date**: {{DATE}}
5
- **Method**: {{#if method}}{{method}}{{else}}Manual Code Analysis{{/if}}
6
- **Analyzed By**: {{AUTHOR}}
7
-
8
- ---
9
-
10
- ## Summary
11
-
12
- **Tables Analyzed**: {{#if tableCount}}{{tableCount}}{{else}}0{{/if}}
13
- **Code Files Scanned**: {{#if fileCount}}{{fileCount}}{{else}}0{{/if}}
14
- **MCP Tools Used**: {{#if mcpUsed}}{{mcpUsed}}{{else}}No (manual analysis){{/if}}
15
-
16
- ---
17
-
18
- ## Tables Analyzed
19
-
20
- {{#each tables}}
21
- ### Table: {{this.name}}
22
-
23
- **Source:**
24
- {{#if this.mcpSource}}- MCP: {{this.mcpSource}}{{/if}}
25
- {{#if this.codeSource}}- Code: {{this.codeSource}}{{/if}}
26
-
27
- **Columns:**
28
- | Column Name | Type | Nullable | Default | Notes |
29
- |------------|------|----------|---------|-------|
30
- {{#each this.columns}}
31
- | {{this.name}} | {{this.type}} | {{#if this.nullable}}YES{{else}}NO{{/if}} | {{#if this.default}}{{this.default}}{{else}}-{{/if}} | {{#if this.notes}}{{this.notes}}{{else}}-{{/if}} |
32
- {{/each}}
33
-
34
- **Relationships:**
35
- {{#each this.relationships}}
36
- - {{this.description}}
37
- {{/each}}
38
-
39
- **Indexes:**
40
- {{#each this.indexes}}
41
- - {{this.description}}
42
- {{/each}}
43
-
44
- ---
45
- {{/each}}
46
-
47
- ## ⚠️ CRITICAL FINDINGS
48
-
49
- ### Field Name Mismatches (MUST FIX)
50
-
51
- {{#if fieldMismatches}}
52
- {{#each fieldMismatches}}
53
- - ❌ {{this.description}}
54
- {{/each}}
55
- {{else}}
56
- ✅ No field name mismatches found
57
- {{/if}}
58
-
59
- ### Type Mismatches
60
-
61
- {{#if typeMismatches}}
62
- {{#each typeMismatches}}
63
- - ⚠️ {{this.description}}
64
- {{/each}}
65
- {{else}}
66
- ✅ No type mismatches found
67
- {{/if}}
68
-
69
- ### Relationship Corrections
70
-
71
- {{#if relationshipIssues}}
72
- {{#each relationshipIssues}}
73
- - ⚠️ {{this.description}}
74
- {{/each}}
75
- {{else}}
76
- ✅ All relationships correctly identified
77
- {{/if}}
78
-
79
- ---
80
-
81
- ## Recommendations for contracts.cs
82
-
83
- Based on real schema analysis:
84
-
85
- \`\`\`csharp
86
- {{#each dtoRecommendations}}
87
- // {{this.tableName}} → {{this.dtoName}}
88
- public record {{this.dtoName}}(
89
- {{#each this.fields}}
90
- {{this.type}} {{this.name}}{{#if this.nullable}}?{{/if}}{{#unless @last}},{{/unless}} // {{#if this.comment}}{{this.comment}}{{/if}}
91
- {{/each}}
92
- );
93
-
94
- {{/each}}
95
- \`\`\`
96
-
97
- ---
98
-
99
- ## Analysis Notes
100
-
101
- {{#if notes}}
102
- {{notes}}
103
- {{else}}
104
- _No additional notes._
105
- {{/if}}
106
-
107
- ---
108
-
109
- ## Next Steps
110
-
111
- - [ ] Verify schema analysis with stakeholders
112
- - [ ] Generate `contracts.cs` using real field names
113
- - [ ] Update `spec.md` data model section with findings
114
- - [ ] Document any schema migrations needed in `decisions.md`
115
-
116
- ---
117
-
118
- *Generated by MORPH-SPEC v{{FRAMEWORK_VERSION}}*
119
- *Schema analysis helps prevent DTO field name mismatches and ensures contracts match real database schema*
@@ -1,34 +0,0 @@
1
- # User Stories: {{featureName}}
2
-
3
- > Generated: {{date}} | Feature: {{featureName}} | Status: Draft
4
-
5
- ---
6
-
7
- ## Story 1: [Actor] [Action]
8
-
9
- **Feature:** {{featureName}}
10
- **Priority:** High / Medium / Low
11
-
12
- ### Optimal Path
13
- 1. [Step 1]
14
- 2. [Step 2]
15
- 3. [Step 3 — success state]
16
-
17
- ### Edge Cases
18
- - [Edge case] → [Expected behavior]
19
- - [Error condition] → [Expected error handling]
20
-
21
- ### Acceptance Criteria
22
- - [ ] [Measurable criterion 1]
23
- - [ ] [Measurable criterion 2]
24
- - [ ] Edge: [edge case criterion]
25
-
26
- ---
27
-
28
- ## Story 2: [Actor] [Action]
29
-
30
- [Repeat structure above]
31
-
32
- ---
33
-
34
- *Generated by MORPH-SPEC — complete before implementation begins*
@@ -1,147 +0,0 @@
1
- import chalk from 'chalk';
2
- import { existsSync, readFileSync } from 'fs';
3
- import { join } from 'path';
4
- import { getFeature, updateFeature } from '../../core/state/state-manager.js';
5
- import { assertOwnerTree, ownerTreeRefusalLines } from '../../lib/worktree/feature-truth.js';
6
-
7
- /** Fixed --dims order: a,c,q,t (mirrors the morph-eval dimension weights). */
8
- const DIM_KEYS = ['architecture', 'contracts', 'codeQuality', 'testCoverage'];
9
-
10
- /**
11
- * taskScores keys are pinned to `^T\d+$` by feature.schema.json, and tasks.schema.json
12
- * pins the same shape for the task ids themselves. Anything else — a dotted `T3.2`
13
- * above all — is split on the dot by `updateFeature` and lands as a NESTED key that
14
- * neither the schema nor the gate-check proxy can see.
15
- */
16
- const TASK_ID_PATTERN = /^T\d+$/;
17
-
18
- const USAGE_LINE = 'Usage: morph-spec score <feature> <task> <score> [--dims a,c,q,t] e.g. morph-spec score my-feature T1 9.2 --dims "9,10,9,9"';
19
-
20
- function parseScoreValue(raw, label) {
21
- // `Number('')` and `Number(' ')` are 0 — finite and inside 0-10, so the range check
22
- // below waves them through and a blank value gets recorded as a real zero. Refuse the
23
- // empty shape BEFORE Number() so no score can ever be fabricated.
24
- const text = raw === undefined || raw === null ? '' : String(raw).trim();
25
- if (text === '') {
26
- const got = raw === undefined ? 'no value was passed' : `got "${raw}"`;
27
- console.error(chalk.red(`\n❌ Missing ${label}: ${got} — a blank value is refused, never recorded as 0`));
28
- console.error(chalk.gray(` ${USAGE_LINE}\n`));
29
- process.exit(1);
30
- }
31
- const value = Number(text);
32
- if (!Number.isFinite(value) || value < 0 || value > 10) {
33
- console.error(chalk.red(`\n❌ Invalid ${label}: "${raw}" — expected a number between 0 and 10\n`));
34
- process.exit(1);
35
- }
36
- return value;
37
- }
38
-
39
- function assertTaskIdShape(taskId) {
40
- const id = taskId === undefined || taskId === null ? '' : String(taskId);
41
- if (TASK_ID_PATTERN.test(id)) return;
42
- console.error(chalk.red(`\n❌ Invalid task id: "${id}" — expected the pattern T<n> (T1, T7, T12)`));
43
- console.error(chalk.gray(
44
- ` taskScores keys are pinned by feature.schema.json (propertyNames.pattern "^T\\d+$").\n` +
45
- ` A dotted id is split on the "." and written as a nested key, invisible to the gate-check proxy.\n` +
46
- ` ${USAGE_LINE}\n`
47
- ));
48
- process.exit(1);
49
- }
50
-
51
- /**
52
- * `morph-spec score <feature> <task> <score> [--dims a,c,q,t]` — record a
53
- * task eval score under `taskScores` in the authoritative feature.json.
54
- *
55
- * The timestamp is stamped server-side (`updatedAt`), the write is atomic
56
- * (state-manager), attempts auto-increment and bestScore is kept — this
57
- * replaces the fragile manual Edit of feature.json from the skills.
58
- */
59
- export async function scoreCommand(featureName, taskId, scoreArg, options = {}) {
60
- try {
61
- // Argument validation runs before any state read or write: a refusal must never
62
- // leave a fabricated or nested taskScores entry behind.
63
- assertTaskIdShape(taskId);
64
- const score = parseScoreValue(scoreArg, 'score');
65
-
66
- const feature = getFeature(featureName);
67
- if (!feature) {
68
- console.error(chalk.red(`\n❌ Feature not found: ${featureName}\n`));
69
- process.exit(1);
70
- }
71
-
72
- const owner = assertOwnerTree(featureName, process.cwd());
73
- if (owner.blocked) {
74
- for (const { tone, text } of ownerTreeRefusalLines(featureName, owner.tree, owner.branch, `morph-spec score ${featureName} ${taskId} ${scoreArg}`)) {
75
- console.error(chalk[tone](text));
76
- }
77
- process.exit(1);
78
- }
79
-
80
- if (feature.taskVerifications?.[taskId]?.status === 'fail') {
81
- console.error(chalk.yellow(`⚠️ Último verify de ${taskId} está VERMELHO — score sendo gravado sobre código que não passou no verify determinístico`));
82
- }
83
-
84
- let dimensions;
85
- if (options.dims) {
86
- // Commander captures --dims as variadic (`<dims...>`), so an UNQUOTED
87
- // comma list typed in PowerShell — `--dims 9.5,9,9,9` — that arrives as
88
- // 4 separate argv tokens (confirmed: Commander binds only the first
89
- // token to a non-variadic option and silently drops the rest) is not
90
- // lost. Accept either shape: one comma-joined string (the documented,
91
- // quoted form) or N separate tokens — split on both separators so a
92
- // mix of the two never matters either.
93
- const raw = Array.isArray(options.dims) ? options.dims.join(' ') : String(options.dims);
94
- const parts = raw.split(/[,\s]+/).filter(Boolean);
95
- if (parts.length !== DIM_KEYS.length) {
96
- console.error(chalk.red(
97
- `\n❌ --dims expects ${DIM_KEYS.length} values in order a,c,q,t (architecture,contracts,code-quality,test-coverage) — got ${parts.length} (${JSON.stringify(parts)}).\n` +
98
- ` Quote the value under PowerShell to keep it as one argument: --dims "9.5,9,9,9"\n`
99
- ));
100
- process.exit(1);
101
- }
102
- dimensions = {};
103
- DIM_KEYS.forEach((key, i) => {
104
- dimensions[key] = parseScoreValue(parts[i], `--dims ${key}`);
105
- });
106
- }
107
-
108
- // Non-fatal sanity check: warn when the task id is unknown to tasks.json.
109
- const tasksPath = join(process.cwd(), '.morph', 'features', featureName, '2-plan', 'tasks.json');
110
- if (existsSync(tasksPath)) {
111
- try {
112
- const tasks = JSON.parse(readFileSync(tasksPath, 'utf8')).tasks || [];
113
- if (!tasks.some(t => t.id === taskId)) {
114
- console.error(chalk.yellow(`⚠️ Task "${taskId}" not found in tasks.json — recording anyway`));
115
- }
116
- } catch {
117
- // unreadable tasks.json — the score is still worth recording
118
- }
119
- }
120
-
121
- const prev = feature.taskScores?.[taskId];
122
- const entry = {
123
- lastScore: score,
124
- bestScore: prev?.bestScore != null ? Math.max(prev.bestScore, score) : score,
125
- attempts: (prev?.attempts ?? 0) + 1,
126
- ...(dimensions ? { dimensions } : {}),
127
- updatedAt: new Date().toISOString(),
128
- };
129
-
130
- await updateFeature(featureName, `taskScores.${taskId}`, entry);
131
-
132
- if (options.json) {
133
- console.log(JSON.stringify({ feature: featureName, task: taskId, ...entry }, null, 2));
134
- return;
135
- }
136
-
137
- console.log(chalk.green(`\n✅ Score recorded: ${featureName}/${taskId} → ${entry.lastScore}`));
138
- console.log(chalk.gray(` best: ${entry.bestScore} | attempts: ${entry.attempts} | updatedAt: ${entry.updatedAt}`));
139
- if (dimensions) {
140
- console.log(chalk.gray(` dims: arch=${dimensions.architecture} contracts=${dimensions.contracts} quality=${dimensions.codeQuality} tests=${dimensions.testCoverage}`));
141
- }
142
- console.log('');
143
- } catch (error) {
144
- console.error(chalk.red(`\n❌ Error recording score: ${error.message}\n`));
145
- process.exit(1);
146
- }
147
- }