@polymorphism-tech/morph-spec 4.22.0 → 6.0.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.
- package/CLAUDE.md +57 -71
- package/README.md +2 -2
- package/bin/morph-spec.js +224 -491
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +55 -38
- package/framework/MORPH.md +244 -0
- package/framework/agents.json +127 -1198
- package/framework/commands/morph-apply.md +56 -240
- package/framework/commands/morph-archive.md +48 -85
- package/framework/commands/morph-preflight.md +7 -7
- package/framework/commands/morph-proposal.md +35 -191
- package/framework/commands/morph-status.md +19 -50
- package/framework/commands/morph-troubleshoot.md +2 -2
- package/framework/evals/rubrics/README.md +44 -0
- package/framework/evals/rubrics/architecture.md +46 -0
- package/framework/evals/rubrics/code-quality.md +50 -0
- package/framework/evals/rubrics/contracts.md +47 -0
- package/framework/evals/rubrics/test-coverage.md +50 -0
- package/framework/evals/scenarios/dotnet-crud.yaml +42 -0
- package/framework/evals/scenarios/nextjs-auth.yaml +38 -0
- package/framework/evals/suites/standard.yaml +5 -0
- package/framework/evals/trace-schema.md +67 -0
- package/framework/hooks/claude-code/core/README.md +3 -0
- package/framework/hooks/claude-code/core/denylist.json +14 -0
- package/framework/hooks/claude-code/{pre-tool-use → core}/enforce-phase-writes.js +5 -5
- package/framework/hooks/claude-code/core/post-edit-typecheck.js +69 -0
- package/framework/hooks/claude-code/core/pre-bash-denylist.js +29 -0
- package/framework/hooks/claude-code/{pre-tool-use → core}/protect-spec-files.js +4 -6
- package/framework/hooks/claude-code/{stop → core}/validate-completion.js +13 -82
- package/framework/hooks/shared/phase-utils.js +20 -31
- package/framework/hooks/shared/state-reader.js +4 -5
- package/framework/{skills/level-0-meta/mcp-registry.json → mcp/registry.json} +254 -243
- package/framework/phases.json +41 -115
- package/framework/rubrics/eval-rubric.json +66 -0
- package/framework/skills/README.md +39 -64
- package/framework/skills/core/README.md +3 -0
- package/framework/skills/core/morph-brainstorming/SKILL.md +102 -0
- package/framework/skills/core/morph-eval/SKILL.md +57 -0
- package/framework/skills/core/morph-implement/SKILL.md +83 -0
- package/framework/skills/core/morph-plan/SKILL.md +64 -0
- package/framework/skills/core/morph-review/SKILL.md +62 -0
- package/framework/skills/core/morph-stack-scan/SKILL.md +109 -0
- package/framework/skills/core/morph-standards/SKILL.md +49 -0
- package/framework/templates/CLAUDE.md.core.guide.md +29 -0
- package/framework/templates/CLAUDE.md.core.template +22 -0
- package/framework/templates/REGISTRY.json +4 -4
- package/framework/workflows/configs/fast-track.json +5 -10
- package/framework/workflows/configs/full.json +4 -8
- package/framework/workflows/configs/quick.json +32 -0
- package/framework/workflows/configs/standard.json +57 -64
- package/package.json +7 -6
- package/src/commands/mcp/mcp-setup.js +58 -31
- package/src/commands/project/doctor.js +69 -70
- package/src/commands/project/init.js +26 -5
- package/src/commands/project/status.js +18 -19
- package/src/commands/state/approve.js +1 -1
- package/src/commands/validation/validate-feature.js +18 -112
- package/src/core/paths/output-schema.js +133 -152
- package/src/core/state/phase-state-machine.js +10 -24
- package/src/core/state/state-manager.js +17 -17
- package/src/core/workflows/workflow-detector.js +214 -31
- package/src/core/workflows/workflow-router.js +204 -0
- package/src/dashboard/app/pages/AgentMap.jsx +32 -33
- package/src/dashboard/app/pages/LiveState.jsx +1 -1
- package/src/dashboard/app/pages/PhasePipeline.jsx +2 -4
- package/src/dashboard/app/pages/SkillsLibrary.jsx +2 -3
- package/src/dashboard/app/pages/Workflows.jsx +2 -2
- package/src/dashboard/scanner/agents-scanner.js +30 -35
- package/src/lib/agents/metrics-aggregator.js +1 -1
- package/src/lib/agents/output-collector.js +7 -9
- package/src/lib/context/context-builder.js +289 -0
- package/src/lib/detectors/claude-config-detector.js +19 -3
- package/src/lib/generators/context-generator.js +20 -42
- package/src/lib/generators/index.js +1 -0
- package/src/lib/generators/mandate-generator.js +512 -0
- package/src/lib/generators/metadata-extractor.js +1 -1
- package/src/lib/generators/recap-generator.js +3 -4
- package/src/lib/installers/mcp-installer.js +300 -92
- package/src/lib/phase-chain/phase-validator.js +36 -40
- package/src/lib/stack/stack-profile.js +74 -91
- package/src/lib/tasks/task-parser.js +1 -1
- package/src/lib/tasks/wave-resolver.js +353 -0
- package/src/lib/validators/checkpoint-persistence.js +2 -2
- package/src/lib/validators/content/cross-phase-validator.js +281 -0
- package/src/lib/validators/content/index.js +1 -0
- package/src/lib/validators/shared/emit-validator-dispatch.js +6 -56
- package/src/scripts/global-install.js +2 -27
- package/src/utils/agents-installer.js +224 -447
- package/src/utils/claude-settings-manager.js +57 -15
- package/src/utils/file-copier.js +1 -0
- package/src/utils/hooks-installer.js +15 -117
- package/src/utils/skills-installer.js +12 -18
- package/bin/detect-agents.js +0 -226
- package/bin/task-manager.js +0 -1036
- package/framework/agents/README.md +0 -13
- package/framework/agents/ai-agents/ai-system-architect.md +0 -194
- package/framework/agents/ai-agents/vector-search-expert.md +0 -247
- package/framework/agents/architecture/architecture-expert.md +0 -98
- package/framework/agents/architecture/morph-spec-architect.md +0 -66
- package/framework/agents/architecture/packages-validator.md +0 -89
- package/framework/agents/architecture/security-expert.md +0 -79
- package/framework/agents/architecture/seo-growth-hacker.md +0 -168
- package/framework/agents/architecture/standards-architect.md +0 -153
- package/framework/agents/backend/dotnet-senior.md +0 -163
- package/framework/agents/backend/ef-modeler.md +0 -119
- package/framework/agents/backend/hangfire-orchestrator.md +0 -133
- package/framework/agents/backend/ms-agent-expert.md +0 -55
- package/framework/agents/backend/neon-expert.md +0 -379
- package/framework/agents/frontend/css-specialist.md +0 -89
- package/framework/agents/frontend/design-system-validator.md +0 -100
- package/framework/agents/frontend/gsap-animator.md +0 -131
- package/framework/agents/frontend/nextjs-component-validator.md +0 -97
- package/framework/agents/frontend/nextjs-expert.md +0 -201
- package/framework/agents/frontend/ui-designer.md +0 -259
- package/framework/agents/infrastructure/infra-architect.md +0 -215
- package/framework/agents/integrations/asaas-financial.md +0 -138
- package/framework/agents/integrations/neon-auth.md +0 -151
- package/framework/agents/integrations/resend-email.md +0 -127
- package/framework/hooks/claude-code/post-tool-use/agent-complete.js +0 -122
- package/framework/hooks/claude-code/post-tool-use/dispatch.js +0 -363
- package/framework/hooks/claude-code/post-tool-use/handle-tool-failure.js +0 -78
- package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +0 -194
- package/framework/hooks/claude-code/pre-compact/save-morph-context.js +0 -199
- package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +0 -55
- package/framework/hooks/claude-code/session-start/inject-morph-context.js +0 -323
- package/framework/hooks/claude-code/session-start/post-compact-restore.js +0 -41
- package/framework/hooks/claude-code/session-start/resume-context.js +0 -77
- package/framework/hooks/claude-code/teammate-idle/teammate-idle.js +0 -90
- package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +0 -114
- package/framework/hooks/shared/compact-restore.js +0 -123
- package/framework/hooks/shared/dispatch-helpers.js +0 -147
- package/framework/hooks/shared/skill-reminder-helpers.js +0 -79
- package/framework/hooks/shared/stale-task-reset.js +0 -57
- package/framework/hooks/shared/worktree-helpers.js +0 -75
- package/framework/skills/level-0-meta/README.md +0 -7
- package/framework/skills/level-0-meta/morph-agent-teams/SKILL.md +0 -472
- package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +0 -174
- package/framework/skills/level-0-meta/morph-brainstorming/references/proposal-example.md +0 -138
- package/framework/skills/level-0-meta/morph-checklist/SKILL.md +0 -145
- package/framework/skills/level-0-meta/morph-code-review/SKILL.md +0 -250
- package/framework/skills/level-0-meta/morph-code-review/references/review-example.md +0 -164
- package/framework/skills/level-0-meta/morph-code-review/references/review-guidelines.md +0 -100
- package/framework/skills/level-0-meta/morph-code-review/scripts/scan-csharp.mjs +0 -151
- package/framework/skills/level-0-meta/morph-code-review-nextjs/SKILL.md +0 -165
- package/framework/skills/level-0-meta/morph-code-review-nextjs/references/review-example-nextjs.md +0 -254
- package/framework/skills/level-0-meta/morph-code-review-nextjs/scripts/scan-nextjs.mjs +0 -189
- package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +0 -344
- package/framework/skills/level-0-meta/morph-frontend-review/scripts/scan-accessibility.mjs +0 -376
- package/framework/skills/level-0-meta/morph-gemini-image/SKILL.md +0 -290
- package/framework/skills/level-0-meta/morph-init/SKILL.md +0 -537
- package/framework/skills/level-0-meta/morph-parallel-dispatch/SKILL.md +0 -225
- package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +0 -401
- package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-dev-server.mjs +0 -153
- package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-stack.mjs +0 -234
- package/framework/skills/level-0-meta/morph-simulation-checklist/SKILL.md +0 -106
- package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +0 -243
- package/framework/skills/level-0-meta/morph-tool-usage-guide/references/tools-per-phase.md +0 -169
- package/framework/skills/level-0-meta/morph-verification-before-completion/SKILL.md +0 -148
- package/framework/skills/level-0-meta/morph-verification-before-completion/scripts/check-phase-outputs.mjs +0 -110
- package/framework/skills/level-1-workflows/README.md +0 -7
- package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +0 -269
- package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +0 -453
- package/framework/skills/level-1-workflows/morph-phase-design/references/architecture-analysis-guide.md +0 -44
- package/framework/skills/level-1-workflows/morph-phase-design/references/spec-authoring-guide.md +0 -55
- package/framework/skills/level-1-workflows/morph-phase-design/references/spec-example.md +0 -253
- package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +0 -38
- package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +0 -634
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +0 -50
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +0 -54
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +0 -47
- package/framework/skills/level-1-workflows/morph-phase-implement/references/recap-example.md +0 -132
- package/framework/skills/level-1-workflows/morph-phase-implement/references/vsa-implementation-guide.md +0 -92
- package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +0 -257
- package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +0 -14
- package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +0 -291
- package/framework/skills/level-1-workflows/morph-phase-tasks/references/task-planning-patterns.md +0 -143
- package/framework/skills/level-1-workflows/morph-phase-tasks/references/tasks-example.md +0 -404
- package/framework/skills/level-1-workflows/morph-phase-tasks/scripts/validate-tasks.mjs +0 -112
- package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +0 -995
- package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +0 -147
- package/framework/squad-templates/backend-only.json +0 -47
- package/framework/squad-templates/frontend-only.json +0 -56
- package/framework/squad-templates/full-stack.json +0 -74
- package/src/commands/agents/agent-metrics.js +0 -174
- package/src/commands/agents/audit-dispatch.js +0 -82
- package/src/commands/agents/detect-agents.js +0 -275
- package/src/commands/agents/dispatch-agents.js +0 -461
- package/src/commands/agents/index.js +0 -13
- package/src/commands/agents/manage-agents.js +0 -352
- package/src/commands/agents/project-metrics.js +0 -74
- package/src/commands/phase/phase-reset.js +0 -74
- package/src/commands/scope/escalate.js +0 -217
- package/src/commands/state/advance-phase.js +0 -600
- package/src/commands/state/phase-runner.js +0 -215
- package/src/commands/state/state.js +0 -444
- package/src/commands/task/expand.js +0 -100
- package/src/commands/tasks/index.js +0 -4
- package/src/commands/tasks/task.js +0 -105
- package/src/commands/templates/index.js +0 -5
- package/src/commands/templates/template-render.js +0 -93
- package/src/commands/trust/trust.js +0 -118
- package/src/lib/agents/agents-manager.js +0 -349
- package/src/lib/build/build-runner.js +0 -99
- package/src/lib/checkpoints/checkpoint-hooks.js +0 -111
- package/src/lib/contracts/sprint-contract-generator.js +0 -137
- package/src/lib/scope/impact-analyzer.js +0 -106
- package/src/lib/trust/trust-manager.js +0 -157
- package/src/utils/tier-helpers.js +0 -24
- /package/framework/hooks/claude-code/{post-tool-use → core}/loop-detect.js +0 -0
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
# Feature Specification: Photo Processing Pipeline
|
|
2
|
-
|
|
3
|
-
> Example of a well-structured spec.md. This is a filled-in reference — not a template.
|
|
4
|
-
|
|
5
|
-
| Field | Value |
|
|
6
|
-
|-------|-------|
|
|
7
|
-
| **ID** | photo-processing |
|
|
8
|
-
| **Status** | Approved |
|
|
9
|
-
| **Created** | 2025-01-15 |
|
|
10
|
-
| **Stack** | blazor-azure |
|
|
11
|
-
| **Complexity** | Medium |
|
|
12
|
-
| **Estimated Cost** | ~$5.50/month |
|
|
13
|
-
| **Agents** | Core: All / Specialists: dotnet-senior, nextjs-expert, infra-architect |
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Overview
|
|
18
|
-
|
|
19
|
-
**Problem:** Users cannot submit photos for AI transformation — the core product value proposition is blocked.
|
|
20
|
-
|
|
21
|
-
**Solution:** End-to-end pipeline: upload → Blob Storage → Hangfire background job → AI processing → download link.
|
|
22
|
-
|
|
23
|
-
**Success Criteria:**
|
|
24
|
-
- [ ] Upload endpoint accepts .jpg/.png up to 10MB and stores in Azure Blob
|
|
25
|
-
- [ ] Background job processes photo and updates status to Completed within 120s (p95)
|
|
26
|
-
- [ ] Status polling page reflects real-time processing progress
|
|
27
|
-
- [ ] Failed jobs retry up to 3 times with exponential backoff
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## Requirements
|
|
32
|
-
|
|
33
|
-
**Functional:**
|
|
34
|
-
FR1: Upload photo (.jpg/.png, max 10MB) via Blazor form
|
|
35
|
-
FR2: Store photo in Azure Blob Storage under `uploads/{jobId}`
|
|
36
|
-
FR3: Enqueue Hangfire background job for AI processing
|
|
37
|
-
FR4: Status polling endpoint returns `{ status, progress, createdAt }`
|
|
38
|
-
FR5: Download endpoint redirects to Blob URL for completed jobs
|
|
39
|
-
|
|
40
|
-
**Non-Functional:**
|
|
41
|
-
NFR1: Processing time < 120s for p95 of requests
|
|
42
|
-
NFR2: Upload endpoint < 2s response time
|
|
43
|
-
NFR3: Retry 3x on AI API failure with 5s/30s/120s backoff
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## User Stories
|
|
48
|
-
|
|
49
|
-
### US001: Upload Photo
|
|
50
|
-
**As** an authenticated user **I want** to upload a photo **so that** the AI can transform it.
|
|
51
|
-
|
|
52
|
-
**Acceptance Criteria:**
|
|
53
|
-
1. Accepts .jpg and .png files only — rejects other formats with clear error
|
|
54
|
-
2. Rejects files larger than 10MB with a specific error message
|
|
55
|
-
3. Returns a `jobId` and redirects to `/processing/{jobId}` on success
|
|
56
|
-
|
|
57
|
-
**Edge Cases:**
|
|
58
|
-
- Network timeout during upload: show retry button
|
|
59
|
-
- Duplicate upload: create new job each time (idempotency not required)
|
|
60
|
-
|
|
61
|
-
### US002: Track Progress
|
|
62
|
-
**As** a user who uploaded a photo **I want** to see real-time status **so that** I know when my photo is ready.
|
|
63
|
-
|
|
64
|
-
**Acceptance Criteria:**
|
|
65
|
-
1. Page polls `/api/status/{jobId}` every 5 seconds
|
|
66
|
-
2. Shows status label: Pending / Processing / Completed / Failed
|
|
67
|
-
3. Shows "Download" button when status = Completed
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## Technical Design
|
|
72
|
-
|
|
73
|
-
### Stack
|
|
74
|
-
|
|
75
|
-
| Component | Technology |
|
|
76
|
-
|-----------|------------|
|
|
77
|
-
| Frontend | Blazor Server |
|
|
78
|
-
| Backend | .NET 10 / C# 14 Minimal API |
|
|
79
|
-
| Background Jobs | Hangfire (self-hosted) |
|
|
80
|
-
| Storage | Azure Blob Storage (LRS) |
|
|
81
|
-
| Database | Azure SQL |
|
|
82
|
-
|
|
83
|
-
### Data Model
|
|
84
|
-
|
|
85
|
-
#### ProcessingJob
|
|
86
|
-
|
|
87
|
-
| Column | Type | Constraints |
|
|
88
|
-
|--------|------|-------------|
|
|
89
|
-
| Id | Guid | PK, default NEWID() |
|
|
90
|
-
| OriginalPhotoUrl | nvarchar(500) | NOT NULL |
|
|
91
|
-
| ProcessedPhotoUrl | nvarchar(500) | NULL (populated after processing) |
|
|
92
|
-
| Status | int | NOT NULL, default 0 (Pending) |
|
|
93
|
-
| ErrorMessage | nvarchar(1000) | NULL |
|
|
94
|
-
| RetryCount | int | NOT NULL, default 0 |
|
|
95
|
-
| CreatedAt | datetime2 | NOT NULL, default GETUTCDATE() |
|
|
96
|
-
| UpdatedAt | datetime2 | NOT NULL |
|
|
97
|
-
|
|
98
|
-
#### ProcessingStatus Enum
|
|
99
|
-
|
|
100
|
-
```csharp
|
|
101
|
-
public enum ProcessingStatus
|
|
102
|
-
{
|
|
103
|
-
Pending = 0,
|
|
104
|
-
Processing = 1,
|
|
105
|
-
Completed = 2,
|
|
106
|
-
Failed = 100
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Contracts
|
|
111
|
-
|
|
112
|
-
```csharp
|
|
113
|
-
// Commands
|
|
114
|
-
public record UploadPhotoCommand(IFormFile Photo, string? Email);
|
|
115
|
-
public record UploadPhotoResult(Guid JobId);
|
|
116
|
-
|
|
117
|
-
// Queries
|
|
118
|
-
public record GetJobStatusQuery(Guid JobId);
|
|
119
|
-
public record JobStatusDto(Guid JobId, ProcessingStatus Status, string? ProcessedPhotoUrl, DateTime CreatedAt);
|
|
120
|
-
|
|
121
|
-
// Service Interface
|
|
122
|
-
public interface IPhotoProcessingService
|
|
123
|
-
{
|
|
124
|
-
Task<UploadPhotoResult> UploadAsync(UploadPhotoCommand command, CancellationToken ct);
|
|
125
|
-
Task<JobStatusDto> GetStatusAsync(GetJobStatusQuery query, CancellationToken ct);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Hangfire Job
|
|
129
|
-
public interface IPhotoProcessingJob
|
|
130
|
-
{
|
|
131
|
-
Task ProcessAsync(Guid jobId, CancellationToken ct);
|
|
132
|
-
}
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
## UI/UX Design
|
|
138
|
-
|
|
139
|
-
### Upload Page (/upload)
|
|
140
|
-
|
|
141
|
-
```
|
|
142
|
-
┌─────────────────────────────────────┐
|
|
143
|
-
│ Upload Photo │
|
|
144
|
-
│ ───────────────────────────────── │
|
|
145
|
-
│ [📁 Select File] photo.jpg (2.3MB) │
|
|
146
|
-
│ │
|
|
147
|
-
│ Allowed: JPG, PNG — Max: 10MB │
|
|
148
|
-
│ │
|
|
149
|
-
│ [Upload →] │
|
|
150
|
-
│ │
|
|
151
|
-
│ Error state: │
|
|
152
|
-
│ ⚠ File too large. Max size is 10MB. │
|
|
153
|
-
└─────────────────────────────────────┘
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### Status Page (/processing/{jobId})
|
|
157
|
-
|
|
158
|
-
```
|
|
159
|
-
┌─────────────────────────────────────┐
|
|
160
|
-
│ Processing your photo │
|
|
161
|
-
│ ───────────────────────────────── │
|
|
162
|
-
│ Status: ⏳ Processing │
|
|
163
|
-
│ ████████░░░░░░░ 60% │
|
|
164
|
-
│ │
|
|
165
|
-
│ Started: 2025-01-15 14:32:01 │
|
|
166
|
-
│ │
|
|
167
|
-
│ [Completed state]: │
|
|
168
|
-
│ Status: ✅ Done! │
|
|
169
|
-
│ [📥 Download] │
|
|
170
|
-
└─────────────────────────────────────┘
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## Flows
|
|
176
|
-
|
|
177
|
-
### Upload Flow
|
|
178
|
-
**Trigger:** User submits photo form
|
|
179
|
-
|
|
180
|
-
1. User selects file → client validates type/size before submit
|
|
181
|
-
2. `POST /api/upload` — server validates, uploads to Blob at `uploads/{jobId}/original.jpg`
|
|
182
|
-
3. Create `ProcessingJob` entity (status = Pending)
|
|
183
|
-
4. Enqueue Hangfire job with `jobId`
|
|
184
|
-
5. Return `{ jobId }` → client redirects to `/processing/{jobId}`
|
|
185
|
-
|
|
186
|
-
**End State:** Job queued, user on status page
|
|
187
|
-
|
|
188
|
-
### Processing Flow
|
|
189
|
-
**Trigger:** Hangfire executes job
|
|
190
|
-
|
|
191
|
-
1. Load `ProcessingJob` by Id, set status = Processing
|
|
192
|
-
2. Download original from Blob Storage
|
|
193
|
-
3. Call AI API (`POST /transform`, multipart/form-data)
|
|
194
|
-
4. On success: upload result to `uploads/{jobId}/processed.jpg`, set status = Completed
|
|
195
|
-
5. On failure: increment RetryCount, set status = Failed if RetryCount >= 3
|
|
196
|
-
|
|
197
|
-
**End State:** Job = Completed (photo available) or Failed (user sees error)
|
|
198
|
-
|
|
199
|
-
---
|
|
200
|
-
|
|
201
|
-
## Cost Estimate
|
|
202
|
-
|
|
203
|
-
| Resource | SKU | Monthly | Justification |
|
|
204
|
-
|----------|-----|---------|---------------|
|
|
205
|
-
| Blob Storage | LRS | $0.02 | ~500 photos/month × 2 files × avg 3MB |
|
|
206
|
-
| Azure SQL | Basic | $4.99 | < 100k jobs/month |
|
|
207
|
-
| Container App | Consumption | $0.49 | Scale to zero when idle |
|
|
208
|
-
| Hangfire | Self-hosted | $0.00 | In-process with Container App |
|
|
209
|
-
| **Total** | | **~$5.50** | |
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
## ADRs
|
|
214
|
-
|
|
215
|
-
### ADR-001: Hangfire over Azure Functions for Background Processing
|
|
216
|
-
**Status:** Accepted
|
|
217
|
-
**Context:** Need async processing for AI photo transformation (30–120s duration).
|
|
218
|
-
**Decision:** Hangfire (self-hosted in Container App)
|
|
219
|
-
**Alternatives:**
|
|
220
|
-
1. Azure Functions — serverless, auto-scaling, but cold start latency + $10/mo for 50k executions
|
|
221
|
-
2. Quartz.NET — more features (CRON, clustering), steeper learning curve
|
|
222
|
-
**Trade-offs:** Simplicity + zero cost vs scalability (Hangfire sufficient for MVP < 10k/month)
|
|
223
|
-
|
|
224
|
-
### ADR-002: Polling over WebSockets for Status Updates
|
|
225
|
-
**Status:** Accepted
|
|
226
|
-
**Context:** Users need real-time feedback; SSE/WebSocket adds Blazor Hub complexity.
|
|
227
|
-
**Decision:** 5-second HTTP polling from Blazor component
|
|
228
|
-
**Trade-offs:** Slightly higher server load vs significantly simpler implementation; polling sufficient at MVP scale
|
|
229
|
-
|
|
230
|
-
---
|
|
231
|
-
|
|
232
|
-
## Security
|
|
233
|
-
|
|
234
|
-
| Action | Required Policy |
|
|
235
|
-
|--------|-----------------|
|
|
236
|
-
| Upload | Authenticated user |
|
|
237
|
-
| View status | Owner of job (check UserId) |
|
|
238
|
-
| Download | Owner of job (check UserId) |
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## Definition of Done
|
|
243
|
-
|
|
244
|
-
- [ ] Upload endpoint working, validated with unit + integration tests
|
|
245
|
-
- [ ] Hangfire job processes photos end-to-end in dev environment
|
|
246
|
-
- [ ] Status page shows correct states (Pending/Processing/Completed/Failed)
|
|
247
|
-
- [ ] Code review approved
|
|
248
|
-
- [ ] Deployed to staging environment
|
|
249
|
-
- [ ] `recap.md` generated with implementation notes
|
|
250
|
-
|
|
251
|
-
---
|
|
252
|
-
|
|
253
|
-
*MORPH-SPEC by Polymorphism Tech*
|
|
@@ -1,38 +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:06:20"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"name": "set-terminal-title",
|
|
14
|
-
"event": "UserPromptSubmit",
|
|
15
|
-
"result": "failed",
|
|
16
|
-
"ts": "16:12:07"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"name": "set-terminal-title",
|
|
20
|
-
"event": "UserPromptSubmit",
|
|
21
|
-
"result": "failed",
|
|
22
|
-
"ts": "16:12:15"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"name": "set-terminal-title",
|
|
26
|
-
"event": "UserPromptSubmit",
|
|
27
|
-
"result": "failed",
|
|
28
|
-
"ts": "16:12:15"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"name": "set-terminal-title",
|
|
32
|
-
"event": "UserPromptSubmit",
|
|
33
|
-
"result": "failed",
|
|
34
|
-
"ts": "16:12:40"
|
|
35
|
-
}
|
|
36
|
-
],
|
|
37
|
-
"skills": []
|
|
38
|
-
}
|