@polymorphism-tech/morph-spec 7.4.0 → 7.6.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/README.md +2 -2
- package/bin/morph-spec.js +18 -0
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +9 -4
- package/framework/MORPH.md +4 -4
- package/framework/agents.json +1 -1
- package/framework/commands/create-umbraco-lp.md +35 -0
- package/framework/commands/migrate-lp-to-umbraco.md +33 -0
- package/framework/commands/morph-archive.md +17 -27
- package/framework/commands/morph-preflight.md +10 -5
- package/framework/hooks/claude-code/core/enforce-phase-writes.js +115 -90
- package/framework/hooks/claude-code/core/protect-spec-files.js +32 -30
- package/framework/hooks/claude-code/core/state-sync.js +16 -48
- package/framework/hooks/shared/state-reader.js +74 -8
- package/framework/hooks/shared/state-writer.js +124 -0
- package/framework/rules/infrastructure-standards.md +4 -4
- package/framework/rules/morph-task-tracking.md +69 -49
- package/framework/rules/morph-workflow.md +192 -191
- package/framework/skills/core/create-umbraco-lp/SKILL.md +272 -0
- package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +531 -0
- package/framework/skills/core/morph-apply/SKILL.md +15 -15
- package/framework/skills/core/morph-brainstorming/SKILL.md +5 -5
- package/framework/skills/core/morph-eval/SKILL.md +1 -1
- package/framework/skills/core/morph-implement/SKILL.md +5 -4
- package/framework/skills/core/morph-plan/SKILL.md +6 -6
- package/framework/skills/core/morph-proposal/SKILL.md +8 -7
- package/framework/skills/core/morph-review/SKILL.md +3 -3
- package/framework/skills/core/morph-stack-scan/SKILL.md +1 -1
- package/framework/skills/core/morph-standards/SKILL.md +1 -1
- package/framework/standards/STANDARDS.json +80 -8
- package/framework/standards/ai-agents/durable-workflows-hitl.md +191 -0
- package/framework/standards/ai-agents/rag-custom-pgvector.md +246 -243
- package/framework/standards/ai-agents/setup.md +3 -0
- package/framework/standards/ai-agents/vector-data-extensions.md +170 -0
- package/framework/standards/ai-agents/workflows.md +190 -187
- package/framework/standards/infrastructure/docker/{easypanel-deploy.md → coolify-deploy.md} +49 -20
- package/framework/templates/README.md +7 -7
- package/framework/templates/REGISTRY.json +15 -17
- package/framework/templates/context/CONTEXT-FEATURE.md +10 -17
- package/framework/templates/context/CONTEXT.md +181 -180
- package/framework/templates/docs/onboarding.md +122 -118
- package/framework/templates/docs/proposal.md +12 -2
- package/framework/templates/docs/spec.md +228 -228
- package/framework/templates/frontend/nextjs/Dockerfile.nextjs.hbs +1 -1
- package/framework/templates/infrastructure/docker/coolify.template.json +49 -0
- package/framework/templates/infrastructure/github/README.md +6 -6
- package/framework/templates/infrastructure/github/workflows/deploy-coolify.yml.hbs +33 -0
- package/framework/templates/meta-prompts/parallel-workers/parallel-worker.md +80 -80
- package/framework/templates/meta-prompts/squad-leaders/backend-squad.md +90 -89
- package/framework/templates/meta-prompts/squad-leaders/frontend-squad.md +2 -1
- package/framework/templates/meta-prompts/squad-leaders/squad-leader.md +44 -43
- package/framework/templates/meta-prompts/validators/checkpoint-validator.md +107 -107
- package/package.json +1 -1
- package/src/commands/project/update.js +415 -368
- package/src/commands/project/worktree.js +212 -210
- package/src/commands/state/advance.js +82 -0
- package/src/commands/state/archive.js +111 -0
- package/src/commands/validation/validate-feature.js +229 -105
- package/src/core/state/state-manager.js +238 -66
- package/src/dashboard/scanner/state-scanner.js +35 -8
- package/src/lib/generators/context-generator.js +12 -8
- package/src/utils/file-copier.js +7 -0
- package/framework/templates/infrastructure/docker/easypanel.template.json +0 -46
- package/framework/templates/infrastructure/github/workflows/deploy-easypanel.yml.hbs +0 -31
|
@@ -1,191 +1,192 @@
|
|
|
1
|
-
---
|
|
2
|
-
stacks:
|
|
3
|
-
- "*"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# MORPH-SPEC Workflow Rules
|
|
7
|
-
|
|
8
|
-
> Always-active rules for all MORPH-SPEC managed projects.
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## Spec-First Mandate
|
|
13
|
-
|
|
14
|
-
**NEVER skip to code without a specification.** Every feature must progress through phases:
|
|
15
|
-
|
|
16
|
-
1. **Proposal** — Problem statement + acceptance criteria (`0-proposal/proposal.md`)
|
|
17
|
-
2. **Design** (optional, UI-heavy) — Design system + mockups + flows (`1-design/`)
|
|
18
|
-
3. **Plan** — Technical spec + mandate + tasks (`2-plan/spec.md`, `mandate.md`, `tasks.json`)
|
|
19
|
-
4. **Implement** — Code + recap (`3-implement/recap.md`)
|
|
20
|
-
5. **Review** — Review report + Gate 3 (`4-review/review-report.md`)
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## Phase Sequence
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
proposal → [design] → plan → implement → review
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Use `morph-spec status {feature}` to see current phase and pending approval gates.
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## Phase Commands
|
|
35
|
-
|
|
36
|
-
| Command | Purpose |
|
|
37
|
-
|---------|---------|
|
|
38
|
-
| `/morph-proposal {feature}` | Full spec pipeline (phases 1-4, pauses for approval) |
|
|
39
|
-
| `/morph-apply {feature}` | Implement feature (phase 5) |
|
|
40
|
-
| `/morph-status` | Feature dashboard |
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## State & Outputs
|
|
45
|
-
|
|
46
|
-
| Path | Notes |
|
|
47
|
-
|------|-------|
|
|
48
|
-
| `.morph/state.json` | **READ-ONLY** —
|
|
49
|
-
| `.morph/features/{feature}/{phase}/` | Feature outputs organized by phase |
|
|
50
|
-
| `.morph/framework/` | **READ-ONLY** — framework files managed by morph-spec |
|
|
51
|
-
| `.morph/config/config.json` | Project configuration (editable) |
|
|
52
|
-
|
|
53
|
-
### output types
|
|
54
|
-
|
|
55
|
-
Output types are defined in `src/core/paths/output-schema.js`. State sync is
|
|
56
|
-
handled automatically by the `state-sync.js` PostToolUse hook — the agent
|
|
57
|
-
does not need to
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## Output Paths
|
|
62
|
-
|
|
63
|
-
All outputs go in `.morph/features/{feature}/`:
|
|
64
|
-
|
|
65
|
-
| Phase | Path |
|
|
66
|
-
|-------|------|
|
|
67
|
-
| Proposal | `0-proposal/proposal.md`, `stack-scan.md`, `migration-plan.md` (optional) |
|
|
68
|
-
| Design (optional) | `1-design/design-system.md`, `mockups.md`, `components.md`, `flows.md` |
|
|
69
|
-
| Plan | `2-plan/spec.md`, `mandate.md`, `tasks.json`, `decisions.md` |
|
|
70
|
-
| Implement | `3-implement/recap.md` + source code |
|
|
71
|
-
| Review | `4-review/review-report.md` |
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
## Checkpoints
|
|
76
|
-
|
|
77
|
-
Run a checkpoint every 3 completed tasks:
|
|
78
|
-
- Validate architecture compliance
|
|
79
|
-
- Check package versions
|
|
80
|
-
- Scan for security issues
|
|
81
|
-
- Verify design system adherence (UI features)
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## Approval Gates
|
|
86
|
-
|
|
87
|
-
Before completing any phase, verify pending approval gates:
|
|
88
|
-
- `morph-spec approval-status <feature>` — check which gates are pending
|
|
89
|
-
- `morph-spec approve <feature> <gate>` — approve a gate (
|
|
90
|
-
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
- `.morph/
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
| Before task
|
|
161
|
-
|
|
|
162
|
-
|
|
|
163
|
-
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
- **
|
|
180
|
-
- **
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
1
|
+
---
|
|
2
|
+
stacks:
|
|
3
|
+
- "*"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# MORPH-SPEC Workflow Rules
|
|
7
|
+
|
|
8
|
+
> Always-active rules for all MORPH-SPEC managed projects.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Spec-First Mandate
|
|
13
|
+
|
|
14
|
+
**NEVER skip to code without a specification.** Every feature must progress through phases:
|
|
15
|
+
|
|
16
|
+
1. **Proposal** — Problem statement + acceptance criteria (`0-proposal/proposal.md`)
|
|
17
|
+
2. **Design** (optional, UI-heavy) — Design system + mockups + flows (`1-design/`)
|
|
18
|
+
3. **Plan** — Technical spec + mandate + tasks (`2-plan/spec.md`, `mandate.md`, `tasks.json`)
|
|
19
|
+
4. **Implement** — Code + recap (`3-implement/recap.md`)
|
|
20
|
+
5. **Review** — Review report + Gate 3 (`4-review/review-report.md`)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Phase Sequence
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
proposal → [design] → plan → implement → review
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use `morph-spec status {feature}` to see current phase and pending approval gates.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Phase Commands
|
|
35
|
+
|
|
36
|
+
| Command | Purpose |
|
|
37
|
+
|---------|---------|
|
|
38
|
+
| `/morph-proposal {feature}` | Full spec pipeline (phases 1-4, pauses for approval) |
|
|
39
|
+
| `/morph-apply {feature}` | Implement feature (phase 5) |
|
|
40
|
+
| `/morph-status` | Feature dashboard |
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## State & Outputs
|
|
45
|
+
|
|
46
|
+
| Path | Notes |
|
|
47
|
+
|------|-------|
|
|
48
|
+
| `.morph/state.json` | **READ-ONLY** — updated automatically by the `state-sync` hook |
|
|
49
|
+
| `.morph/features/{feature}/{phase}/` | Feature outputs organized by phase |
|
|
50
|
+
| `.morph/framework/` | **READ-ONLY** — framework files managed by morph-spec |
|
|
51
|
+
| `.morph/config/config.json` | Project configuration (editable) |
|
|
52
|
+
|
|
53
|
+
### output types
|
|
54
|
+
|
|
55
|
+
Output types are defined in `src/core/paths/output-schema.js`. State sync is
|
|
56
|
+
handled automatically by the `state-sync.js` PostToolUse hook — the agent
|
|
57
|
+
does not need to record outputs through any CLI call.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Output Paths
|
|
62
|
+
|
|
63
|
+
All outputs go in `.morph/features/{feature}/`:
|
|
64
|
+
|
|
65
|
+
| Phase | Path |
|
|
66
|
+
|-------|------|
|
|
67
|
+
| Proposal | `0-proposal/proposal.md`, `stack-scan.md`, `migration-plan.md` (optional) |
|
|
68
|
+
| Design (optional) | `1-design/design-system.md`, `mockups.md`, `components.md`, `flows.md` |
|
|
69
|
+
| Plan | `2-plan/spec.md`, `mandate.md`, `tasks.json`, `decisions.md` |
|
|
70
|
+
| Implement | `3-implement/recap.md` + source code |
|
|
71
|
+
| Review | `4-review/review-report.md` |
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Checkpoints
|
|
76
|
+
|
|
77
|
+
Run a checkpoint every 3 completed tasks:
|
|
78
|
+
- Validate architecture compliance
|
|
79
|
+
- Check package versions
|
|
80
|
+
- Scan for security issues
|
|
81
|
+
- Verify design system adherence (UI features)
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Approval Gates
|
|
86
|
+
|
|
87
|
+
Before completing any phase, verify pending approval gates:
|
|
88
|
+
- `morph-spec approval-status <feature>` — check which gates are pending
|
|
89
|
+
- `morph-spec approve <feature> <gate>` — approve a gate (`proposal`, `plan`, `review`; `uiux` if applicable)
|
|
90
|
+
- `morph-spec advance <feature>` — approve the current gate AND scaffold the next phase folder in one step
|
|
91
|
+
- Gates must be approved before advancing to the next phase
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Protected Files
|
|
96
|
+
|
|
97
|
+
**NEVER directly edit:**
|
|
98
|
+
- `.morph/state.json` — Managed by CLI only
|
|
99
|
+
- `.morph/framework/**` — Read-only framework content
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Test File Policy
|
|
104
|
+
|
|
105
|
+
When a test fails, always follow this order:
|
|
106
|
+
|
|
107
|
+
1. **Analyze first** — determine if the IMPLEMENTATION is wrong or the TEST SPEC is wrong
|
|
108
|
+
2. **Fix implementation first** — the test is the spec; trust it by default
|
|
109
|
+
3. **Only modify a test file if the test expectation itself is incorrect** — wrong expected value, wrong behavior modeled
|
|
110
|
+
4. **Before modifying any test file, explain WHY the test spec is wrong** — what the correct behavior is and why the test doesn't model it
|
|
111
|
+
|
|
112
|
+
Do not modify test files to make a failing test pass when the implementation is the actual problem.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Context Maintenance
|
|
117
|
+
|
|
118
|
+
After making structural changes (new packages, dependencies, project config changes), update the project context:
|
|
119
|
+
- Edit `.morph/context/README.md` — update Tech Stack, Architecture, Key Integrations sections
|
|
120
|
+
- Update `.morph/config/config.json` — update stack, architecture, integrations, paths
|
|
121
|
+
- Structural changes include: package.json, .csproj, next.config.*, tsconfig.json, docker-compose.yml
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Spec-Driven Task Execution (implement phase)
|
|
126
|
+
|
|
127
|
+
BEFORE implementing ANY task during the implement phase:
|
|
128
|
+
|
|
129
|
+
1. **Read tasks.json** → identify the current task object (`id`, `description`, `doneCriteria`, `dependencies`)
|
|
130
|
+
2. **Read spec.md** → the FR sections that the task `description` references
|
|
131
|
+
3. **Read the contracts** → the DTOs/interfaces are defined inside `spec.md` (v5 keeps contracts in the spec, not separate files)
|
|
132
|
+
4. Only then begin implementation
|
|
133
|
+
|
|
134
|
+
This is **NON-NEGOTIABLE**. The spec is the source of truth. Code that doesn't match the spec is a bug.
|
|
135
|
+
|
|
136
|
+
Every task in `tasks.json` MUST reference its FR(s) in the `description` field so the link to the spec is explicit:
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"id": "T1",
|
|
140
|
+
"title": "Create user endpoint",
|
|
141
|
+
"description": "Implement user CRUD (FR001) and input validation (FR003). Contracts: CreateUserRequest, CreateUserResponse, UserErrors.",
|
|
142
|
+
"dependencies": [],
|
|
143
|
+
"effort": "M",
|
|
144
|
+
"doneCriteria": "POST /users creates a user and rejects invalid input",
|
|
145
|
+
"status": "pending",
|
|
146
|
+
"outputs": ["Features/UserFeature/Create/Handler.cs", "Validator.cs", "Endpoint.cs"],
|
|
147
|
+
"group": "backend"
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Mandatory Skills per Phase
|
|
154
|
+
|
|
155
|
+
During implementation, these skills MUST be invoked at the specified triggers:
|
|
156
|
+
|
|
157
|
+
### Implement Phase
|
|
158
|
+
| Trigger | Skill | When |
|
|
159
|
+
|---------|-------|------|
|
|
160
|
+
| Before each task | `superpowers:test-driven-development` | Invoke BEFORE writing any code for a task |
|
|
161
|
+
| Before marking a task complete | `morph-verification-before-completion` | Invoke BEFORE setting a task's `status` to `completed` in `tasks.json` |
|
|
162
|
+
| On bug/unexpected | `superpowers:systematic-debugging` | Invoke IF a bug or unexpected behavior is encountered |
|
|
163
|
+
| After all tasks | `morph-post-implementation` | Invoke AFTER all tasks completed |
|
|
164
|
+
| Before PR | `morph-checklist` | Invoke BEFORE creating pull request |
|
|
165
|
+
|
|
166
|
+
### Tasks Phase
|
|
167
|
+
| Trigger | Skill | When |
|
|
168
|
+
|---------|-------|------|
|
|
169
|
+
| On parallel tasks | `superpowers:dispatching-parallel-agents` | When parallel task groups are identified |
|
|
170
|
+
| Before completion | `morph-verification-before-completion` | Before completing the tasks phase |
|
|
171
|
+
|
|
172
|
+
These are MANDATORY. Use the `Skill()` tool. Do NOT skip.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Scope Escalation
|
|
177
|
+
|
|
178
|
+
If during implementation a task reveals significantly more complexity than estimated:
|
|
179
|
+
- **Low impact:** record the added scope in the task's `notes` field (in `tasks.json`) and track the sub-steps with native `TaskCreate`/`TaskUpdate` for the current session
|
|
180
|
+
- **Medium/High impact:** `/morph-scope-escalation <feature>` — re-opens the plan so the frozen contract (`title`/`description`/`dependencies`/`doneCriteria`) can be amended through the gate
|
|
181
|
+
- **Never** implement extra functionality within a task without registering it — in `notes` for small additions, or via scope escalation for anything that changes the plan contract
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Context Window Tip
|
|
186
|
+
|
|
187
|
+
When using 3+ MCPs, add `"experimental": { "mcpCliMode": true }` to `.claude/settings.json`.
|
|
188
|
+
MCP tools load on-demand instead of all at startup — keeps context clean for actual work.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
*MORPH-SPEC by Polymorphism Tech*
|