@polymorphism-tech/morph-spec 4.22.0 → 5.0.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 (211) hide show
  1. package/CLAUDE.md +57 -71
  2. package/README.md +2 -2
  3. package/bin/morph-spec.js +224 -491
  4. package/claude-plugin.json +1 -1
  5. package/docs/CHEATSHEET.md +1 -1
  6. package/docs/QUICKSTART.md +1 -1
  7. package/framework/CLAUDE.md +55 -38
  8. package/framework/MORPH.md +244 -0
  9. package/framework/agents.json +127 -1198
  10. package/framework/commands/morph-apply.md +56 -240
  11. package/framework/commands/morph-archive.md +48 -85
  12. package/framework/commands/morph-preflight.md +7 -7
  13. package/framework/commands/morph-proposal.md +35 -191
  14. package/framework/commands/morph-status.md +19 -50
  15. package/framework/commands/morph-troubleshoot.md +2 -2
  16. package/framework/evals/rubrics/README.md +44 -0
  17. package/framework/evals/rubrics/architecture.md +46 -0
  18. package/framework/evals/rubrics/code-quality.md +50 -0
  19. package/framework/evals/rubrics/contracts.md +47 -0
  20. package/framework/evals/rubrics/test-coverage.md +50 -0
  21. package/framework/evals/scenarios/dotnet-crud.yaml +42 -0
  22. package/framework/evals/scenarios/nextjs-auth.yaml +38 -0
  23. package/framework/evals/suites/standard.yaml +5 -0
  24. package/framework/evals/trace-schema.md +67 -0
  25. package/framework/hooks/claude-code/core/README.md +3 -0
  26. package/framework/hooks/claude-code/core/denylist.json +14 -0
  27. package/framework/hooks/claude-code/{pre-tool-use → core}/enforce-phase-writes.js +5 -5
  28. package/framework/hooks/claude-code/core/post-edit-typecheck.js +69 -0
  29. package/framework/hooks/claude-code/core/pre-bash-denylist.js +29 -0
  30. package/framework/hooks/claude-code/{pre-tool-use → core}/protect-spec-files.js +4 -6
  31. package/framework/hooks/claude-code/{stop → core}/validate-completion.js +13 -82
  32. package/framework/hooks/shared/phase-utils.js +20 -31
  33. package/framework/hooks/shared/state-reader.js +4 -5
  34. package/framework/{skills/level-0-meta/mcp-registry.json → mcp/registry.json} +254 -243
  35. package/framework/phases.json +41 -115
  36. package/framework/rubrics/eval-rubric.json +66 -0
  37. package/framework/skills/README.md +39 -64
  38. package/framework/skills/core/README.md +3 -0
  39. package/framework/skills/core/morph-brainstorming/SKILL.md +102 -0
  40. package/framework/skills/core/morph-eval/SKILL.md +57 -0
  41. package/framework/skills/core/morph-implement/SKILL.md +83 -0
  42. package/framework/skills/core/morph-plan/SKILL.md +64 -0
  43. package/framework/skills/core/morph-review/SKILL.md +62 -0
  44. package/framework/skills/core/morph-stack-scan/SKILL.md +109 -0
  45. package/framework/skills/core/morph-standards/SKILL.md +49 -0
  46. package/framework/templates/CLAUDE.md.core.guide.md +29 -0
  47. package/framework/templates/CLAUDE.md.core.template +22 -0
  48. package/framework/templates/REGISTRY.json +4 -4
  49. package/framework/workflows/configs/fast-track.json +5 -10
  50. package/framework/workflows/configs/full.json +4 -8
  51. package/framework/workflows/configs/quick.json +32 -0
  52. package/framework/workflows/configs/standard.json +57 -64
  53. package/package.json +7 -6
  54. package/src/commands/mcp/mcp-setup.js +58 -31
  55. package/src/commands/project/doctor.js +69 -70
  56. package/src/commands/project/init.js +26 -5
  57. package/src/commands/project/status.js +18 -19
  58. package/src/commands/state/approve.js +1 -1
  59. package/src/commands/validation/validate-feature.js +18 -112
  60. package/src/core/paths/output-schema.js +133 -152
  61. package/src/core/state/phase-state-machine.js +10 -24
  62. package/src/core/state/state-manager.js +17 -17
  63. package/src/core/workflows/workflow-detector.js +214 -31
  64. package/src/core/workflows/workflow-router.js +204 -0
  65. package/src/dashboard/app/pages/AgentMap.jsx +32 -33
  66. package/src/dashboard/app/pages/LiveState.jsx +1 -1
  67. package/src/dashboard/app/pages/PhasePipeline.jsx +2 -4
  68. package/src/dashboard/app/pages/SkillsLibrary.jsx +2 -3
  69. package/src/dashboard/app/pages/Workflows.jsx +2 -2
  70. package/src/dashboard/scanner/agents-scanner.js +30 -35
  71. package/src/lib/agents/metrics-aggregator.js +1 -1
  72. package/src/lib/agents/output-collector.js +7 -9
  73. package/src/lib/context/context-builder.js +289 -0
  74. package/src/lib/detectors/claude-config-detector.js +19 -3
  75. package/src/lib/generators/context-generator.js +20 -42
  76. package/src/lib/generators/index.js +1 -0
  77. package/src/lib/generators/mandate-generator.js +512 -0
  78. package/src/lib/generators/metadata-extractor.js +1 -1
  79. package/src/lib/generators/recap-generator.js +3 -4
  80. package/src/lib/installers/mcp-installer.js +300 -92
  81. package/src/lib/phase-chain/phase-validator.js +36 -40
  82. package/src/lib/stack/stack-profile.js +74 -91
  83. package/src/lib/tasks/task-parser.js +1 -1
  84. package/src/lib/tasks/wave-resolver.js +353 -0
  85. package/src/lib/validators/checkpoint-persistence.js +2 -2
  86. package/src/lib/validators/content/cross-phase-validator.js +281 -0
  87. package/src/lib/validators/content/index.js +1 -0
  88. package/src/lib/validators/shared/emit-validator-dispatch.js +6 -56
  89. package/src/scripts/global-install.js +2 -27
  90. package/src/utils/agents-installer.js +224 -447
  91. package/src/utils/claude-settings-manager.js +57 -15
  92. package/src/utils/file-copier.js +1 -0
  93. package/src/utils/hooks-installer.js +15 -117
  94. package/src/utils/skills-installer.js +12 -18
  95. package/bin/detect-agents.js +0 -226
  96. package/bin/task-manager.js +0 -1036
  97. package/framework/agents/README.md +0 -13
  98. package/framework/agents/ai-agents/ai-system-architect.md +0 -194
  99. package/framework/agents/ai-agents/vector-search-expert.md +0 -247
  100. package/framework/agents/architecture/architecture-expert.md +0 -98
  101. package/framework/agents/architecture/morph-spec-architect.md +0 -66
  102. package/framework/agents/architecture/packages-validator.md +0 -89
  103. package/framework/agents/architecture/security-expert.md +0 -79
  104. package/framework/agents/architecture/seo-growth-hacker.md +0 -168
  105. package/framework/agents/architecture/standards-architect.md +0 -153
  106. package/framework/agents/backend/dotnet-senior.md +0 -163
  107. package/framework/agents/backend/ef-modeler.md +0 -119
  108. package/framework/agents/backend/hangfire-orchestrator.md +0 -133
  109. package/framework/agents/backend/ms-agent-expert.md +0 -55
  110. package/framework/agents/backend/neon-expert.md +0 -379
  111. package/framework/agents/frontend/css-specialist.md +0 -89
  112. package/framework/agents/frontend/design-system-validator.md +0 -100
  113. package/framework/agents/frontend/gsap-animator.md +0 -131
  114. package/framework/agents/frontend/nextjs-component-validator.md +0 -97
  115. package/framework/agents/frontend/nextjs-expert.md +0 -201
  116. package/framework/agents/frontend/ui-designer.md +0 -259
  117. package/framework/agents/infrastructure/infra-architect.md +0 -215
  118. package/framework/agents/integrations/asaas-financial.md +0 -138
  119. package/framework/agents/integrations/neon-auth.md +0 -151
  120. package/framework/agents/integrations/resend-email.md +0 -127
  121. package/framework/hooks/claude-code/post-tool-use/agent-complete.js +0 -122
  122. package/framework/hooks/claude-code/post-tool-use/dispatch.js +0 -363
  123. package/framework/hooks/claude-code/post-tool-use/handle-tool-failure.js +0 -78
  124. package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +0 -194
  125. package/framework/hooks/claude-code/pre-compact/save-morph-context.js +0 -199
  126. package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +0 -55
  127. package/framework/hooks/claude-code/session-start/inject-morph-context.js +0 -323
  128. package/framework/hooks/claude-code/session-start/post-compact-restore.js +0 -41
  129. package/framework/hooks/claude-code/session-start/resume-context.js +0 -77
  130. package/framework/hooks/claude-code/teammate-idle/teammate-idle.js +0 -90
  131. package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +0 -114
  132. package/framework/hooks/shared/compact-restore.js +0 -123
  133. package/framework/hooks/shared/dispatch-helpers.js +0 -147
  134. package/framework/hooks/shared/skill-reminder-helpers.js +0 -79
  135. package/framework/hooks/shared/stale-task-reset.js +0 -57
  136. package/framework/hooks/shared/worktree-helpers.js +0 -75
  137. package/framework/skills/level-0-meta/README.md +0 -7
  138. package/framework/skills/level-0-meta/morph-agent-teams/SKILL.md +0 -472
  139. package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +0 -174
  140. package/framework/skills/level-0-meta/morph-brainstorming/references/proposal-example.md +0 -138
  141. package/framework/skills/level-0-meta/morph-checklist/SKILL.md +0 -145
  142. package/framework/skills/level-0-meta/morph-code-review/SKILL.md +0 -250
  143. package/framework/skills/level-0-meta/morph-code-review/references/review-example.md +0 -164
  144. package/framework/skills/level-0-meta/morph-code-review/references/review-guidelines.md +0 -100
  145. package/framework/skills/level-0-meta/morph-code-review/scripts/scan-csharp.mjs +0 -151
  146. package/framework/skills/level-0-meta/morph-code-review-nextjs/SKILL.md +0 -165
  147. package/framework/skills/level-0-meta/morph-code-review-nextjs/references/review-example-nextjs.md +0 -254
  148. package/framework/skills/level-0-meta/morph-code-review-nextjs/scripts/scan-nextjs.mjs +0 -189
  149. package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +0 -344
  150. package/framework/skills/level-0-meta/morph-frontend-review/scripts/scan-accessibility.mjs +0 -376
  151. package/framework/skills/level-0-meta/morph-gemini-image/SKILL.md +0 -290
  152. package/framework/skills/level-0-meta/morph-init/SKILL.md +0 -537
  153. package/framework/skills/level-0-meta/morph-parallel-dispatch/SKILL.md +0 -225
  154. package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +0 -401
  155. package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-dev-server.mjs +0 -153
  156. package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-stack.mjs +0 -234
  157. package/framework/skills/level-0-meta/morph-simulation-checklist/SKILL.md +0 -106
  158. package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +0 -243
  159. package/framework/skills/level-0-meta/morph-tool-usage-guide/references/tools-per-phase.md +0 -169
  160. package/framework/skills/level-0-meta/morph-verification-before-completion/SKILL.md +0 -148
  161. package/framework/skills/level-0-meta/morph-verification-before-completion/scripts/check-phase-outputs.mjs +0 -110
  162. package/framework/skills/level-1-workflows/README.md +0 -7
  163. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +0 -269
  164. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +0 -453
  165. package/framework/skills/level-1-workflows/morph-phase-design/references/architecture-analysis-guide.md +0 -44
  166. package/framework/skills/level-1-workflows/morph-phase-design/references/spec-authoring-guide.md +0 -55
  167. package/framework/skills/level-1-workflows/morph-phase-design/references/spec-example.md +0 -253
  168. package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +0 -38
  169. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +0 -634
  170. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +0 -50
  171. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +0 -54
  172. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +0 -47
  173. package/framework/skills/level-1-workflows/morph-phase-implement/references/recap-example.md +0 -132
  174. package/framework/skills/level-1-workflows/morph-phase-implement/references/vsa-implementation-guide.md +0 -92
  175. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +0 -257
  176. package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +0 -14
  177. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +0 -291
  178. package/framework/skills/level-1-workflows/morph-phase-tasks/references/task-planning-patterns.md +0 -143
  179. package/framework/skills/level-1-workflows/morph-phase-tasks/references/tasks-example.md +0 -404
  180. package/framework/skills/level-1-workflows/morph-phase-tasks/scripts/validate-tasks.mjs +0 -112
  181. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +0 -995
  182. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +0 -147
  183. package/framework/squad-templates/backend-only.json +0 -47
  184. package/framework/squad-templates/frontend-only.json +0 -56
  185. package/framework/squad-templates/full-stack.json +0 -74
  186. package/src/commands/agents/agent-metrics.js +0 -174
  187. package/src/commands/agents/audit-dispatch.js +0 -82
  188. package/src/commands/agents/detect-agents.js +0 -275
  189. package/src/commands/agents/dispatch-agents.js +0 -461
  190. package/src/commands/agents/index.js +0 -13
  191. package/src/commands/agents/manage-agents.js +0 -352
  192. package/src/commands/agents/project-metrics.js +0 -74
  193. package/src/commands/phase/phase-reset.js +0 -74
  194. package/src/commands/scope/escalate.js +0 -217
  195. package/src/commands/state/advance-phase.js +0 -600
  196. package/src/commands/state/phase-runner.js +0 -215
  197. package/src/commands/state/state.js +0 -444
  198. package/src/commands/task/expand.js +0 -100
  199. package/src/commands/tasks/index.js +0 -4
  200. package/src/commands/tasks/task.js +0 -105
  201. package/src/commands/templates/index.js +0 -5
  202. package/src/commands/templates/template-render.js +0 -93
  203. package/src/commands/trust/trust.js +0 -118
  204. package/src/lib/agents/agents-manager.js +0 -349
  205. package/src/lib/build/build-runner.js +0 -99
  206. package/src/lib/checkpoints/checkpoint-hooks.js +0 -111
  207. package/src/lib/contracts/sprint-contract-generator.js +0 -137
  208. package/src/lib/scope/impact-analyzer.js +0 -106
  209. package/src/lib/trust/trust-manager.js +0 -157
  210. package/src/utils/tier-helpers.js +0 -24
  211. /package/framework/hooks/claude-code/{post-tool-use → core}/loop-detect.js +0 -0
@@ -1,54 +0,0 @@
1
- # Morph-Spec Implementer Dispatch
2
-
3
- You are implementing tasks for the feature '{{FEATURE_NAME}}' as agent '{{AGENT_ID}}'.
4
-
5
- ## Context
6
-
7
- **Spec:** Read `.morph/features/{{FEATURE_NAME}}/2-design/spec.md`
8
- **Contracts:** Read `.morph/features/{{FEATURE_NAME}}/2-design/contracts.cs`
9
- **Plan:** Read `.morph/features/{{FEATURE_NAME}}/3-plan/plan.md`
10
- **Standards:** Read relevant files in `.morph/framework/standards/`
11
- **Code Templates:** Read `.morph/framework/templates/code/dotnet/feature/` (endpoint, handler, validator) — follow these patterns exactly
12
-
13
- ## UI Reference (Stitch HTML)
14
-
15
- {{STITCH_CONTEXT}}
16
-
17
- ## Image Assets
18
-
19
- {{ASSETS_CONTEXT}}
20
-
21
- ## Agent Briefing
22
-
23
- {{AGENT_BRIEFING}}
24
-
25
- ## Tasks Assigned
26
-
27
- {{TASK_LIST}}
28
-
29
- ## Execution Rules
30
-
31
- 1. Before starting each task:
32
- - Execute: `morph-spec task start {{FEATURE_NAME}} {{TASK_ID}}`
33
-
34
- 2. For each task, follow TDD:
35
- - Write the failing test first
36
- - Run it to verify it fails
37
- - Write minimal implementation to pass
38
- - Run tests to verify they pass
39
- - Commit
40
-
41
- 3. Before marking any task done:
42
- - Verify build compiles: `dotnet build` or `npm run build`
43
- - Run relevant tests
44
- - Execute: `morph-spec task done {{FEATURE_NAME}} {{TASK_ID}}`
45
-
46
- 4. Every 3 tasks:
47
- - Execute: `morph-spec checkpoint-save {{FEATURE_NAME}}`
48
- - Execute: `morph-spec validate-feature {{FEATURE_NAME}} --phase implement`
49
-
50
- 5. Contracts are the source of truth — all DTOs, interfaces, and types MUST match `contracts.cs` exactly
51
-
52
- 6. Modify ONLY files listed in your assigned tasks. Do NOT touch files outside your domain.
53
-
54
- 7. If you encounter a dependency on another agent's work, STOP and report it.
@@ -1,47 +0,0 @@
1
- # Morph-Spec Spec Compliance Review
2
-
3
- You are a Tier-4 spec reviewer for feature '{{FEATURE_NAME}}'.
4
-
5
- ## Review Scope
6
-
7
- Review the implementation against the specification. Your job is to ensure the code matches the spec EXACTLY — no more, no less.
8
-
9
- ## Reference Documents
10
-
11
- Read these before reviewing:
12
- - `.morph/features/{{FEATURE_NAME}}/2-design/spec.md` — The specification
13
- - `.morph/features/{{FEATURE_NAME}}/2-design/contracts.cs` — The contracts (source of truth)
14
- - `.morph/features/{{FEATURE_NAME}}/3-plan/plan.md` — The implementation plan
15
-
16
- ## Review Checklist
17
-
18
- For each task implemented, verify:
19
-
20
- 1. **Completeness** — All acceptance criteria from spec.md are implemented
21
- 2. **Correctness** — DTOs, interfaces, and types match contracts.cs exactly
22
- 3. **No over-building** — No features, flags, or abstractions not in the spec
23
- 4. **No under-building** — No missing error handling, validations, or edge cases from the spec
24
- 5. **Naming** — All names match the contracts (exact casing and spelling)
25
-
26
- ## Output Format
27
-
28
- ```json
29
- {
30
- "passed": true/false,
31
- "issues": [
32
- {
33
- "severity": "error|warning",
34
- "file": "path/to/file",
35
- "description": "What doesn't match the spec",
36
- "specReference": "Which section of spec.md"
37
- }
38
- ]
39
- }
40
- ```
41
-
42
- ## Rules
43
-
44
- - Only flag issues that represent spec non-compliance
45
- - Do NOT flag style preferences or minor improvements
46
- - Every issue MUST reference a specific section of spec.md or contracts.cs
47
- - If the implementation matches the spec, output `{ "passed": true, "issues": [] }`
@@ -1,132 +0,0 @@
1
- # Feature Recap: Photo Processing Pipeline
2
-
3
- > Example of a well-structured recap.md. Filled-in reference — not a template.
4
-
5
- ## Summary
6
-
7
- | Field | Value |
8
- |-------|-------|
9
- | **Feature ID** | photo-processing |
10
- | **Completed** | 2025-01-22 |
11
- | **Total Tasks** | 11 / 11 |
12
- | **Time Spent** | ~9h |
13
- | **Agents Used** | dotnet-senior, nextjs-expert, infra-architect |
14
- | **Stack** | blazor-azure |
15
-
16
- ---
17
-
18
- ## Tasks Completed
19
-
20
- | ID | Title | Category | Duration |
21
- |----|-------|----------|----------|
22
- | T001 | Define C# contracts and interfaces | Contract | 25min |
23
- | T002 | Create ProcessingJob entity and enum | Domain | 30min |
24
- | T003 | EF Core migration and DbContext setup | Infrastructure | 50min |
25
- | T004 | Azure Blob Storage service | Infrastructure | 45min |
26
- | T005 | Implement PhotoProcessingService | Service | 65min |
27
- | T006 | Implement Hangfire background job | Job | 70min |
28
- | T007 | Upload and status endpoints | API | 40min |
29
- | T008 | Blazor upload page component | UI | 60min |
30
- | T009 | Blazor status polling page | UI | 65min |
31
- | T010 | Unit tests for PhotoProcessingService | Test | 55min |
32
- | T011 | Integration tests for upload + status API | Test | 70min |
33
-
34
- ---
35
-
36
- ## What Was Delivered
37
-
38
- ### Functionality
39
- - Photo upload via Blazor form (10MB limit, .jpg/.png only)
40
- - Azure Blob Storage integration with `uploads/{jobId}/original.jpg` path structure
41
- - Hangfire background job with 3-retry exponential backoff (5s/30s/120s)
42
- - Real-time status polling page (5s interval, stops on terminal state)
43
- - Download redirect for completed jobs
44
-
45
- ### Backend (.NET)
46
- - Endpoints: `POST /api/upload`, `GET /api/status/{id}`, `GET /api/download/{id}`
47
- - Services: `PhotoProcessingService`, `PhotoProcessingJob`
48
- - Simulation: `FakeBlobStorageService`, `FakePhotoProcessingJob` for dev mode
49
-
50
- ### Frontend (Blazor)
51
- - Pages: `Upload.razor`, `ProcessingStatus.razor`
52
- - Polling via `PeriodicTimer` — no SignalR dependency
53
-
54
- ---
55
-
56
- ## Files Created
57
-
58
- ```
59
- src/Domain/Entities/ProcessingJob.cs
60
- src/Domain/Enums/ProcessingStatus.cs
61
- src/Application/PhotoProcessing/Interfaces/IPhotoProcessingService.cs
62
- src/Application/PhotoProcessing/Commands/UploadPhotoCommand.cs
63
- src/Application/PhotoProcessing/Queries/GetJobStatusQuery.cs
64
- src/Application/PhotoProcessing/DTOs/JobStatusDto.cs
65
- src/Application/PhotoProcessing/PhotoProcessingService.cs
66
- src/Application/PhotoProcessing/PhotoProcessingJob.cs
67
- src/Application/PhotoProcessing/FakePhotoProcessingJob.cs
68
- src/Infrastructure/Storage/IBlobStorageService.cs
69
- src/Infrastructure/Storage/AzureBlobStorageService.cs
70
- src/Infrastructure/Storage/FakeBlobStorageService.cs
71
- src/Infrastructure/Persistence/Configurations/ProcessingJobConfiguration.cs
72
- src/Web/Endpoints/PhotoProcessingEndpoints.cs
73
- src/Web/Pages/Upload.razor + .cs
74
- src/Web/Pages/ProcessingStatus.razor + .cs
75
- tests/Unit/Application/PhotoProcessing/PhotoProcessingServiceTests.cs
76
- tests/Integration/Api/PhotoProcessingEndpointTests.cs
77
- tests/Integration/Fixtures/PhotoProcessingApiFixture.cs
78
- ```
79
-
80
- ## Files Modified
81
-
82
- ```
83
- src/Infrastructure/Persistence/AppDbContext.cs
84
- src/Infrastructure/DependencyInjection.cs
85
- src/Application/DependencyInjection.cs
86
- src/Web/Program.cs
87
- ```
88
-
89
- ---
90
-
91
- ## Architecture Decisions
92
-
93
- | Decision | Rationale |
94
- |----------|-----------|
95
- | PeriodicTimer for polling (not SignalR) | Simpler, no hub overhead, sufficient at MVP scale |
96
- | FakeBlobStorageService as Singleton | Stores in-memory dict; Scoped would lose state between requests |
97
- | Hangfire RetryCount on entity (not Hangfire built-in) | Domain owns retry state; allows custom error messages per attempt |
98
-
99
- See full ADRs in `decisions.md`
100
-
101
- ---
102
-
103
- ## Test Coverage
104
-
105
- | Type | Files | Notes |
106
- |------|-------|-------|
107
- | Unit | `PhotoProcessingServiceTests.cs` | Happy path, invalid type, size limit, 404, all statuses |
108
- | Integration | `PhotoProcessingEndpointTests.cs` | POST /upload, GET /status, GET /download (completed + pending) |
109
-
110
- ---
111
-
112
- ## Issues Encountered
113
-
114
- | Issue | Resolution |
115
- |-------|-----------|
116
- | `FakeBlobStorageService` registered as `Scoped` — lost uploads between requests | Changed to `Singleton` per simulation-checklist.md |
117
- | `PeriodicTimer` not stopping on component dispose | Added `CancellationTokenSource` + dispose pattern in `ProcessingStatus.razor.cs` |
118
-
119
- ---
120
-
121
- ## Metrics
122
-
123
- | Metric | Value |
124
- |--------|-------|
125
- | Tasks Completed | 11 / 11 |
126
- | Checkpoints Passed | 3 (after T003, T006, T009) |
127
- | Bugs Found | 2 |
128
- | Bugs Fixed | 2 |
129
-
130
- ---
131
-
132
- *MORPH-SPEC by Polymorphism Tech*
@@ -1,92 +0,0 @@
1
- # VSA Implementation Guide
2
-
3
- > Guia completo de implementação para Vertical Slice Architecture.
4
- > Referenciado pelo Passo 1.5 de `phase-implement/SKILL.md`.
5
- > **Ref:** `framework/standards/architecture/vertical-slice/vertical-slice.md`
6
-
7
- ---
8
-
9
- ## Estrutura de Arquivos Obrigatória por Slice
10
-
11
- ```
12
- Features/
13
- └── {Entity}Feature/
14
- ├── {Entity}Errors.cs ← 1 arquivo por feature (compartilhado)
15
- ├── Create{Entity}/
16
- │ ├── Create{Entity}Handler.cs ← Request + Response records + Handler
17
- │ ├── Create{Entity}Validator.cs ← AbstractValidator<Request>
18
- │ └── Create{Entity}Endpoint.cs ← IApiEndpoint (internal sealed)
19
- ├── GetAll{Entity}s/
20
- │ ├── GetAll{Entity}sHandler.cs ← sem Validator (sem parâmetros)
21
- │ └── GetAll{Entity}sEndpoint.cs
22
- ├── Get{Entity}ById/
23
- │ ├── Get{Entity}ByIdHandler.cs
24
- │ ├── Get{Entity}ByIdValidator.cs
25
- │ └── Get{Entity}ByIdEndpoint.cs
26
- ├── Update{Entity}/
27
- │ ├── Update{Entity}Handler.cs
28
- │ ├── Update{Entity}Validator.cs
29
- │ └── Update{Entity}Endpoint.cs
30
- └── Delete{Entity}/
31
- ├── Delete{Entity}Handler.cs
32
- ├── Delete{Entity}Validator.cs
33
- └── Delete{Entity}Endpoint.cs
34
- ```
35
-
36
- ---
37
-
38
- ## 9 Regras Obrigatórias por Slice
39
-
40
- 1. `Request` e `Response` records ficam no **mesmo arquivo** que o `Handler`
41
- 2. Tudo `sealed` — handlers, endpoints, validators, records
42
- 3. `Guid.CreateVersion7()` para gerar IDs (não `Guid.NewGuid()`)
43
- 4. Endpoints usam `result.Match(onSuccess, onFailure)` — nunca acesse `result.Value` sem checar `IsSuccess`
44
- 5. Endpoints são `internal sealed` (não public)
45
- 6. `{Entity}Errors` é static e compartilhado entre todos os slices da feature
46
- 7. Handlers de escrita (Create/Update/Delete) injetam `IRepository<T>` + `IUnitOfWork`
47
- 8. Handlers de leitura (GetAll/GetById) injetam apenas `IRepository<T>`
48
- 9. GetAll não tem Validator
49
-
50
- ---
51
-
52
- ## Registrar Entidade no DbContext
53
-
54
- ```csharp
55
- // Database/ApplicationDbContext.cs — adicionar:
56
- public DbSet<{Entity}> {Entities} { get; set; } = null!;
57
- ```
58
-
59
- ---
60
-
61
- ## Criar Migration Após DbContext Atualizado
62
-
63
- ```bash
64
- dotnet ef migrations add Add{Entity}
65
- dotnet ef database update
66
- ```
67
-
68
- ---
69
-
70
- ## Registrar Tag em ApiTags (se necessário)
71
-
72
- ```csharp
73
- // Constants/ApiTags.cs — adicionar:
74
- public const string {Entities} = "{entities}";
75
- ```
76
-
77
- ---
78
-
79
- ## O que NÃO Precisa Fazer (auto-discovery via reflection)
80
-
81
- - ❌ Registrar handler manualmente no Program.cs — `AddHandlersFromAssembly()` faz isso
82
- - ❌ Registrar endpoint manualmente — `RegisterApiEndpointsFromAssembly()` faz isso
83
- - ❌ Registrar validator manualmente — `AddValidatorsFromAssembly()` faz isso
84
- - ❌ Criar Application Service layer — handler acessa IRepository diretamente
85
-
86
- ---
87
-
88
- ## Verificar Build Após Cada Slice
89
-
90
- ```bash
91
- dotnet build
92
- ```
@@ -1,257 +0,0 @@
1
- ---
2
- name: morph-phase-plan
3
- description: MORPH-SPEC Phase 3 (Plan). Generates a detailed implementation plan with exact file paths, TDD code blocks, and execution strategy analysis. Produces plan.md in 3-plan/. Use after design phase to create an actionable implementation plan before task breakdown.
4
- argument-hint: "[feature-name]"
5
- user-invocable: false
6
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
- cliVersion: "4.22.0"
8
- ---
9
-
10
- # MORPH Plan — Phase 3
11
-
12
- > INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
13
-
14
- Generate a detailed implementation plan with exact paths, TDD code, and execution strategy.
15
-
16
- ## Prerequisites
17
-
18
- - [ ] Phase 2 (Design) completed and approved
19
- - [ ] `spec.md` defined
20
- - [ ] `contracts.cs` or `contracts.ts` defined
21
-
22
- ## Recommended Tools
23
-
24
- > **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` for complete guide.
25
-
26
- | Action | Tool | Alternative |
27
- |--------|------|-------------|
28
- | Read spec + contracts + decisions | **Read** all outputs | — |
29
- | Analyze existing codebase | **Glob** + **Grep** patterns | — |
30
- | Look up library docs | **Context7 MCP** `query_docs()` | **WebSearch** |
31
- | Dispatch agents for analysis | **Bash** `morph-spec dispatch-agents $ARGUMENTS plan` | — |
32
- | Update state | **Bash** `morph-spec state mark-output $ARGUMENTS plan` | — |
33
-
34
- **Anti-patterns:**
35
- - Generating plan without reading contracts (contracts are the source of truth!)
36
- - Generic paths ("add the file") — always use exact paths
37
- - Incomplete code in plan ("add validation") — always include complete code
38
- - Skipping existing codebase analysis (existing patterns guide the plan)
39
- - Ignoring `config.architecture.style` — VSA and standard architectures have different structures
40
-
41
- ---
42
-
43
- ## Pre-flight
44
-
45
- ### 0. Ensure plan phase
46
-
47
- ```bash
48
- morph-spec state get $ARGUMENTS
49
- ```
50
-
51
- Check the `"phase"` field:
52
- - `"phase": "plan"` → correct phase, proceed
53
- - any other value → run `morph-spec phase advance $ARGUMENTS` and re-check
54
-
55
- > **Rule:** Never write to `3-plan/` until the phase is `plan`.
56
-
57
- ## MANDATORY: Session Tasks
58
-
59
- > **BEFORE reading any files**, analyze the planning workflow and create session tasks.
60
- >
61
- > **Rules:** Minimum 2 tasks, typically 3-5. Mark `in_progress` before starting, `completed` after.
62
- >
63
- > **Typical tasks:** feature analysis, execution strategy, plan.md generation, plan approval
64
-
65
- ### 1. Read all prerequisites in PARALLEL
66
-
67
- ```
68
- Read: .morph/features/{feature}/2-design/spec.md
69
- + Read: .morph/features/{feature}/2-design/contracts.cs (or contracts.ts)
70
- + Read: .morph/features/{feature}/2-design/decisions.md
71
- + Read: .morph/features/{feature}/2-design/decisions.md
72
- + Read: .morph/features/{feature}/2-design/schema-analysis.md (if exists)
73
- + Read: .morph/config/config.json
74
- ```
75
-
76
- ---
77
-
78
- ## Workflow
79
-
80
- ### Step 1: Analyze Feature for Context
81
-
82
- 1. **Scan existing codebase** — Glob to find files that will be modified/created
83
- 2. **Identify patterns** — Grep for patterns similar to what will be implemented
84
- 3. **Check library docs** — Context7 for dependency documentation
85
- 4. **Detect architecture:**
86
-
87
- ```bash
88
- cat .morph/config/config.json | grep -A3 '"architecture"'
89
- ```
90
-
91
- | `config.architecture.style` value | Path structure |
92
- |------------------------------------|---------------|
93
- | `"vertical-slice"` | VSA: `Features/{Entity}Feature/{Operation}/` |
94
- | any other value | Standard layer-based |
95
-
96
- ### Step 2: Determine Execution Strategy
97
-
98
- Run the dispatch analysis:
99
-
100
- ```bash
101
- morph-spec dispatch-agents $ARGUMENTS plan
102
- ```
103
-
104
- **Factors for recommendation:**
105
-
106
- | Factor | Calculation |
107
- |--------|-------------|
108
- | `taskCount` | Number of functional requirements + technical components in spec |
109
- | `domainCount` | Distinct domains in activeAgents (backend, frontend, infra) |
110
- | `agentCount` | Total activeAgents |
111
- | `independence` | % of tasks without cross-domain dependencies |
112
-
113
- **Decision:**
114
-
115
- | Scenario | Recommendation |
116
- |----------|----------------|
117
- | `taskCount < 8` AND `domainCount <= 2` | **Single session** — direct sequential implementation |
118
- | `taskCount 8-20` AND `domainCount 2-3` | **Subagent-Driven** — one subagent per task group |
119
- | `taskCount > 20` OR `domainCount > 3` | **Agent Teams** — multi-domain coordination |
120
-
121
- ### Step 3: Generate `plan.md`
122
-
123
- Create `.morph/features/$ARGUMENTS/3-plan/plan.md` with this structure:
124
-
125
- ```markdown
126
- # {Feature Name} Implementation Plan
127
-
128
- > **For Claude:** Use morph-phase-implement to execute this plan.
129
-
130
- **Goal:** {One sentence describing what will be built}
131
-
132
- **Architecture:** {2-3 sentences about the approach}
133
-
134
- **Tech Stack:** {Key technologies}
135
-
136
- **Execution Strategy:** {single | subagents | agent-teams} (Recommended)
137
-
138
- ---
139
-
140
- ## GROUP {A} — {Group Name}
141
-
142
- {Pattern and context for the group}
143
-
144
- ### {A1} — {Task Name} [FR001, FR003]
145
-
146
- **Spec refs:** FR001 (description), FR003 (description)
147
- **Contracts:** {RelevantRequest}, {RelevantResponse}, {ErrorType}
148
-
149
- **Files:**
150
- - Create: `exact/path/to/file.cs`
151
- - Modify: `exact/path/to/existing.cs:123-145`
152
- - Test: `tests/exact/path/to/test.cs`
153
-
154
- **Step 1: Write the failing test**
155
-
156
- (Complete test code)
157
-
158
- **Step 2: Run test to verify it fails**
159
-
160
- Run: `{exact command}`
161
- Expected: FAIL with "{message}"
162
-
163
- **Step 3: Write minimal implementation**
164
-
165
- (Complete implementation code)
166
-
167
- **Step 4: Run test to verify it passes**
168
-
169
- Run: `{exact command}`
170
- Expected: PASS
171
-
172
- **Step 5: Commit**
173
-
174
- git add {files}
175
- git commit -m "{message}"
176
- ```
177
-
178
- **Mandatory rules:**
179
- - **FR cross-references in EVERY task** — each task MUST reference the spec FRs it implements (e.g., `[FR001, FR003]`). Extract FR IDs from spec.md and map them to task groups. Include `Spec refs:` and `Contracts:` fields.
180
- - Exact paths ALWAYS (never "add the file somewhere")
181
- - COMPLETE code in each step (never "add validation later" or "implement here")
182
- - Exact test commands with expected output (pass/fail message)
183
- - Each task follows the TDD 5-step cycle above — this is what makes the plan actionable
184
- - Keep each step to a 2-5 minute action
185
-
186
- ### Step 4: Update State
187
-
188
- ```bash
189
- morph-spec state mark-output $ARGUMENTS plan
190
- ```
191
-
192
- ---
193
-
194
- ## Mandatory Approval Pause
195
-
196
- Use `AskUserQuestion` to capture approval before advancing. This gate prevents task breakdown from starting with an unapproved plan.
197
-
198
- ```json
199
- {
200
- "questions": [
201
- {
202
- "header": "Approval",
203
- "question": "Implementation plan generated. Approve to start task breakdown?",
204
- "multiSelect": false,
205
- "options": [
206
- { "label": "Approve plan", "description": "Advance to task breakdown phase" },
207
- { "label": "I have feedback", "description": "Type what you want to change" }
208
- ]
209
- },
210
- {
211
- "header": "Execution",
212
- "question": "Which execution strategy for implementation?",
213
- "multiSelect": false,
214
- "options": [
215
- { "label": "{Recommendation} (Recommended)", "description": "{Justification from Step 2 analysis}" },
216
- { "label": "{Alternative 1}", "description": "{Description}" },
217
- { "label": "{Alternative 2}", "description": "{Description}" }
218
- ]
219
- }
220
- ]
221
- }
222
- ```
223
-
224
- > The first "Execution" option should be the context-aware recommendation from Step 2. Alternatives are the other strategies.
225
-
226
- - **"Approve plan"** →
227
- ```bash
228
- morph-spec approve $ARGUMENTS plan
229
- morph-spec phase advance $ARGUMENTS
230
- ```
231
- - **"I have feedback" or "Other"** → apply the feedback and repeat this PAUSE
232
-
233
- ---
234
-
235
- ## Phase Outputs
236
-
237
- <!-- morph-outputs:plan -->
238
- | Output | Path |
239
- |--------|------|
240
- | `plan` | `.morph/features/{feature}/3-plan/plan.md` |
241
- <!-- /morph-outputs -->
242
-
243
- ---
244
-
245
- ## Advancement Criteria
246
-
247
- - [x] `plan.md` created with all groups and tasks
248
- - [x] Exact paths for all files
249
- - [x] Complete code in each step
250
- - [x] Test commands with expected output
251
- - [x] Execution strategy defined and approved
252
- - [x] State updated (`mark-output plan`)
253
- - [x] User approved plan via `AskUserQuestion`
254
-
255
- ---
256
-
257
- After approval: proceed automatically to Phase 5 (Tasks).
@@ -1,14 +0,0 @@
1
- {
2
- "sessionId": "",
3
- "feature": "",
4
- "phase": "",
5
- "hooks": [
6
- {
7
- "name": "set-terminal-title",
8
- "event": "UserPromptSubmit",
9
- "result": "failed",
10
- "ts": "16:38:44"
11
- }
12
- ],
13
- "skills": []
14
- }