@polymorphism-tech/morph-spec 4.10.6 → 4.10.8
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 +3 -0
- package/LICENSE +71 -71
- package/README.md +379 -379
- package/bin/morph-spec.js +89 -0
- package/bin/task-manager.js +59 -6
- package/claude-plugin.json +14 -14
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +206 -206
- package/framework/agents/README.md +14 -14
- package/framework/agents/architecture/standards-architect.md +159 -159
- package/framework/agents/frontend/blazor-builder.md +13 -0
- package/framework/agents/frontend/css-specialist.md +87 -0
- package/framework/agents/frontend/nextjs-expert.md +13 -0
- package/framework/agents/frontend/nextjs-ui-specialist.md +218 -0
- package/framework/agents/frontend/ui-ux-designer.md +80 -10
- package/framework/agents/infrastructure/azure-architect.md +149 -149
- package/framework/agents/infrastructure/infra-architect.md +48 -48
- package/framework/agents.json +2268 -2567
- package/framework/hooks/README.md +204 -204
- package/framework/hooks/claude-code/post-tool-use/dispatch.js +10 -5
- package/framework/hooks/claude-code/session-start/inject-morph-context.js +10 -24
- package/framework/hooks/shared/phase-utils.js +139 -139
- package/framework/hooks/shared/worktree-helpers.js +30 -8
- package/framework/rules/csharp-standards.md +13 -13
- package/framework/rules/frontend-standards.md +13 -13
- package/framework/rules/infrastructure-standards.md +16 -16
- package/framework/rules/testing-standards.md +14 -14
- package/framework/skills/README.md +0 -1
- package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +12 -0
- package/framework/skills/level-0-meta/morph-code-review-nextjs/references/review-example-nextjs.md +254 -254
- package/framework/skills/level-0-meta/morph-init/SKILL.md +88 -3
- package/framework/skills/level-1-workflows/morph-phase-clarify/SKILL.md +247 -247
- package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +270 -270
- package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +515 -499
- package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +508 -471
- package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +12 -1
- package/framework/skills/level-1-workflows/morph-phase-setup/SKILL.md +272 -258
- package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +317 -311
- package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +424 -323
- package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +1 -1
- package/framework/standards/STANDARDS.json +2040 -2040
- package/framework/standards/frontend/nextjs/motion-patterns.md +321 -0
- package/framework/standards/frontend/nextjs/nextjs-patterns.md +17 -17
- package/framework/templates/README.md +814 -814
- package/framework/templates/code/dotnet/contracts/Commands.cs +74 -74
- package/framework/templates/code/dotnet/contracts/Entities.cs +25 -25
- package/framework/templates/code/dotnet/contracts/Queries.cs +74 -74
- package/framework/templates/code/dotnet/contracts/README.md +74 -74
- package/framework/templates/code/dotnet/contracts/api-contracts.cs +173 -173
- package/framework/templates/code/dotnet/frontend/component.razor +239 -239
- package/framework/templates/code/dotnet/jobs/agent.cs +163 -163
- package/framework/templates/code/dotnet/jobs/job.cs +171 -171
- package/framework/templates/code/dotnet/test.cs +239 -239
- package/framework/templates/code/sql/rls-policy.sql +57 -57
- package/framework/templates/code/sql/supabase-migration.sql +100 -100
- package/framework/templates/code/sql/supabase-migration.template.sql +113 -113
- package/framework/templates/code/typescript/contracts.ts +168 -168
- package/framework/templates/context/CONTEXT.md +181 -181
- package/framework/templates/context/design-system.md +211 -0
- package/framework/templates/docs/proposal.md +182 -182
- package/framework/templates/docs/user-stories.md +34 -34
- package/framework/templates/examples/design-system-examples.md +357 -357
- package/framework/templates/examples/spec-examples.md +90 -90
- package/framework/templates/feature/decisions.md +187 -187
- package/framework/templates/feature/recap.md +146 -146
- package/framework/templates/feature/tasks.md +199 -199
- package/framework/templates/infrastructure/azure/README.md +286 -286
- package/framework/templates/infrastructure/azure/deploy-checklist.md +426 -426
- package/framework/templates/infrastructure/azure/parameters.dev.json +29 -29
- package/framework/templates/infrastructure/azure/parameters.prod.json +29 -29
- package/framework/templates/infrastructure/azure/parameters.staging.json +29 -29
- package/framework/templates/infrastructure/docker/docker-compose.template.yml +67 -67
- package/framework/templates/infrastructure/docker/dockerfile-api.dockerfile +38 -38
- package/framework/templates/infrastructure/docker/dockerfile-web.dockerfile +48 -48
- package/framework/templates/infrastructure/docker/easypanel.template.json +54 -54
- package/package.json +82 -82
- package/src/commands/agents/agent-metrics.js +174 -0
- package/src/commands/agents/audit-dispatch.js +82 -0
- package/src/commands/agents/detect-agents.js +275 -0
- package/src/commands/agents/dispatch-agents.js +41 -135
- package/src/commands/agents/index.js +13 -4
- package/src/commands/agents/manage-agents.js +352 -0
- package/src/commands/project/doctor.js +59 -0
- package/src/commands/project/install-plugin-cmd.js +28 -28
- package/src/commands/project/setup-infra-cmd.js +12 -12
- package/src/commands/project/update.js +1 -17
- package/src/commands/project/worktree.js +58 -2
- package/src/commands/state/advance-phase.js +11 -3
- package/src/commands/tasks/index.js +4 -4
- package/src/commands/templates/index.js +5 -5
- package/src/commands/utils/index.js +3 -3
- package/src/commands/validation/index.js +4 -4
- package/src/core/state/phase-state-machine.js +217 -217
- package/src/core/state/state-manager.js +81 -0
- package/src/lib/agents/agents-manager.js +349 -0
- package/src/lib/agents/metrics-calculator.js +125 -0
- package/src/lib/agents/output-collector.js +75 -0
- package/src/lib/generators/context-generator.js +8 -7
- package/src/lib/generators/design-system-generator.js +298 -298
- package/src/lib/generators/index.js +10 -10
- package/src/lib/generators/metadata-extractor.js +387 -387
- package/src/lib/stack-filter.js +65 -65
- package/src/lib/standards/index.js +7 -7
- package/src/lib/standards/standards-context-injector.js +302 -302
- package/src/lib/tasks/task-parser.js +94 -3
- package/src/lib/validators/architecture/architecture-validator.js +387 -387
- package/src/lib/validators/architecture/index.js +7 -7
- package/src/lib/validators/blazor/blazor-concurrency-analyzer.js +316 -316
- package/src/lib/validators/blazor/blazor-state-validator.js +279 -279
- package/src/lib/validators/blazor/blazor-validator.js +369 -369
- package/src/lib/validators/blazor/index.js +9 -9
- package/src/lib/validators/checkpoint-persistence.js +39 -0
- package/src/lib/validators/content/content-validator.js +287 -279
- package/src/lib/validators/content/index.js +7 -7
- package/src/lib/validators/contracts/index.js +7 -7
- package/src/lib/validators/css/css-validator.js +352 -352
- package/src/lib/validators/css/index.js +7 -7
- package/src/lib/validators/design-system/design-system-validator.js +231 -231
- package/src/lib/validators/design-system/index.js +7 -7
- package/src/lib/validators/nextjs/index.js +6 -6
- package/src/lib/validators/nextjs/next-component-validator.js +183 -183
- package/src/lib/validators/packages/index.js +7 -7
- package/src/lib/validators/packages/package-validator.js +360 -360
- package/src/lib/validators/shared/index.js +12 -12
- package/src/lib/validators/shared/issue-counter.js +18 -18
- package/src/lib/validators/shared/result-formatter.js +124 -124
- package/src/lib/validators/spec-validator.js +2 -2
- package/src/lib/validators/ui/index.js +7 -7
- package/src/lib/validators/ui/ui-contrast-validator.js +422 -422
- package/src/lib/validators/validation-runner.js +20 -0
- package/src/scripts/global-install.js +58 -58
- package/src/scripts/install-plugin.js +126 -126
- package/src/scripts/setup-infra.js +1 -17
- package/src/utils/agent-id-mapper.js +11 -0
- package/src/utils/agents-installer.js +40 -8
- package/src/utils/claude-md-injector.js +90 -90
- package/src/utils/claude-settings-manager.js +1 -1
- package/src/utils/file-copier.js +200 -196
- package/src/utils/hooks-installer.js +556 -739
- package/src/utils/logger.js +32 -32
- package/src/utils/skills-installer.js +178 -178
- package/src/utils/tier-helpers.js +24 -0
- package/src/utils/version-checker.js +175 -175
- package/framework/agents/architecture/po-pm-advisor.md +0 -203
- package/framework/hooks/claude-code/user-prompt/set-terminal-title.js +0 -68
- package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +0 -38
- package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +0 -14
- package/framework/templates/.idea/morph-templates.xml +0 -92
- package/framework/templates/.vscode/morph-templates.code-snippets +0 -186
|
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 4 (Plan). Generates a detailed implementation plan
|
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
-
cliVersion: "4.10.
|
|
7
|
+
cliVersion: "4.10.8"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH Plan — Phase 4
|
|
@@ -65,6 +65,17 @@ Read: .morph/features/{feature}/1-design/spec.md
|
|
|
65
65
|
+ Read: .morph/config/config.json
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
### 1.5 Create session tasks for visibility
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
TaskCreate: "Analyze feature for execution strategy" → activeForm: "Analyzing feature"
|
|
72
|
+
TaskCreate: "Determine execution strategy" → activeForm: "Planning strategy"
|
|
73
|
+
TaskCreate: "Generate plan.md" → activeForm: "Writing plan"
|
|
74
|
+
TaskCreate: "Plan approval" → activeForm: "Awaiting plan approval"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Update each to `in_progress` before starting and `completed` after finishing.
|
|
78
|
+
|
|
68
79
|
---
|
|
69
80
|
|
|
70
81
|
## Workflow
|
|
@@ -1,258 +1,272 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: morph-phase-setup
|
|
3
|
-
description: MORPH-SPEC Phase 1 (Setup). Reads project context, detects tech stack, activates relevant agents by reading agents.json, and confirms the feature environment. Use at the start of every MORPH-SPEC feature workflow after proposal approval to load standards and initialize the context.
|
|
4
|
-
argument-hint: "[feature-name]"
|
|
5
|
-
user-invocable: false
|
|
6
|
-
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
-
cliVersion: "4.10.
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# MORPH Setup — Phase 1
|
|
11
|
-
|
|
12
|
-
> INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
|
|
13
|
-
|
|
14
|
-
Initialize the context and prepare the environment for an approved feature.
|
|
15
|
-
|
|
16
|
-
## Prerequisites
|
|
17
|
-
|
|
18
|
-
- [ ] Feature has `proposal.md` created (Phase 0 complete)
|
|
19
|
-
- [ ] Proposal was approved by the user
|
|
20
|
-
- [ ] Agents were detected and registered in state
|
|
21
|
-
|
|
22
|
-
## Recommended Tools
|
|
23
|
-
|
|
24
|
-
> **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` for full guide.
|
|
25
|
-
> **Ref:** `framework/standards/integration/mcp/mcp-tools.md` for MCP reference.
|
|
26
|
-
|
|
27
|
-
| Action | Tool | Alternative |
|
|
28
|
-
|--------|------|-------------|
|
|
29
|
-
| Verify state | **Bash** `npx morph-spec state get` | — |
|
|
30
|
-
| Detect agents + standards | **
|
|
31
|
-
| Read project context | **Read** `.morph/context/README.md` | — |
|
|
32
|
-
| Read config | **Read** `.morph/config/config.json` | — |
|
|
33
|
-
| Detect VSA architecture | **Read** `.morph/config/config.json` → check `config.architecture.style` | — |
|
|
34
|
-
| Scan project structure | **Glob** `src/**/*.{ts,tsx,cs}` | — |
|
|
35
|
-
| Repository metadata | **GitHub MCP** `get_repo()` | **Bash** `gh repo view --json` |
|
|
36
|
-
| Update state | **Bash** `npx morph-spec state set` | — |
|
|
37
|
-
|
|
38
|
-
**MCPs for this phase:** GitHub (optional — repo metadata).
|
|
39
|
-
|
|
40
|
-
**Anti-patterns:**
|
|
41
|
-
- Do not
|
|
42
|
-
- Do not use a Task agent for
|
|
43
|
-
- Do not use WebSearch for local project info (use Read/Glob)
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## Workflow
|
|
48
|
-
|
|
49
|
-
### ENTRY CHECKPOINT: Verify Prerequisites
|
|
50
|
-
|
|
51
|
-
Before proceeding with setup:
|
|
52
|
-
|
|
53
|
-
- [ ] Does `proposal.md` exist in `.morph/features/$ARGUMENTS/0-proposal/`?
|
|
54
|
-
- [ ] Was the proposal presented and approved by the user?
|
|
55
|
-
- [ ] Is the feature registered in state?
|
|
56
|
-
|
|
57
|
-
If any checkbox is NOT checked → go back to Phase 0 (Proposal).
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
###
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
MCP
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
##
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
-
|
|
243
|
-
-
|
|
244
|
-
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
1
|
+
---
|
|
2
|
+
name: morph-phase-setup
|
|
3
|
+
description: MORPH-SPEC Phase 1 (Setup). Reads project context, detects tech stack, activates relevant agents by reading agents.json, and confirms the feature environment. Use at the start of every MORPH-SPEC feature workflow after proposal approval to load standards and initialize the context.
|
|
4
|
+
argument-hint: "[feature-name]"
|
|
5
|
+
user-invocable: false
|
|
6
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
+
cliVersion: "4.10.8"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# MORPH Setup — Phase 1
|
|
11
|
+
|
|
12
|
+
> INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
|
|
13
|
+
|
|
14
|
+
Initialize the context and prepare the environment for an approved feature.
|
|
15
|
+
|
|
16
|
+
## Prerequisites
|
|
17
|
+
|
|
18
|
+
- [ ] Feature has `proposal.md` created (Phase 0 complete)
|
|
19
|
+
- [ ] Proposal was approved by the user
|
|
20
|
+
- [ ] Agents were detected and registered in state
|
|
21
|
+
|
|
22
|
+
## Recommended Tools
|
|
23
|
+
|
|
24
|
+
> **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` for full guide.
|
|
25
|
+
> **Ref:** `framework/standards/integration/mcp/mcp-tools.md` for MCP reference.
|
|
26
|
+
|
|
27
|
+
| Action | Tool | Alternative |
|
|
28
|
+
|--------|------|-------------|
|
|
29
|
+
| Verify state | **Bash** `npx morph-spec state get` | — |
|
|
30
|
+
| Detect agents + standards | **Bash** `npx morph-spec detect-agents $ARGUMENTS --json` → parse → **Bash** `npx morph-spec state add-agent` | **Read** agents.json manually |
|
|
31
|
+
| Read project context | **Read** `.morph/context/README.md` | — |
|
|
32
|
+
| Read config | **Read** `.morph/config/config.json` | — |
|
|
33
|
+
| Detect VSA architecture | **Read** `.morph/config/config.json` → check `config.architecture.style` | — |
|
|
34
|
+
| Scan project structure | **Glob** `src/**/*.{ts,tsx,cs}` | — |
|
|
35
|
+
| Repository metadata | **GitHub MCP** `get_repo()` | **Bash** `gh repo view --json` |
|
|
36
|
+
| Update state | **Bash** `npx morph-spec state set` | — |
|
|
37
|
+
|
|
38
|
+
**MCPs for this phase:** GitHub (optional — repo metadata).
|
|
39
|
+
|
|
40
|
+
**Anti-patterns:**
|
|
41
|
+
- Do not read agents.json manually for keyword matching — use `npx morph-spec detect-agents` CLI
|
|
42
|
+
- Do not use a Task agent for agent detection (CLI is faster and consistent)
|
|
43
|
+
- Do not use WebSearch for local project info (use Read/Glob)
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Workflow
|
|
48
|
+
|
|
49
|
+
### ENTRY CHECKPOINT: Verify Prerequisites
|
|
50
|
+
|
|
51
|
+
Before proceeding with setup:
|
|
52
|
+
|
|
53
|
+
- [ ] Does `proposal.md` exist in `.morph/features/$ARGUMENTS/0-proposal/`?
|
|
54
|
+
- [ ] Was the proposal presented and approved by the user?
|
|
55
|
+
- [ ] Is the feature registered in state?
|
|
56
|
+
|
|
57
|
+
If any checkbox is NOT checked → go back to Phase 0 (Proposal).
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### Create session tasks for visibility
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
TaskCreate: "Detect agents and load standards" → activeForm: "Detecting agents"
|
|
65
|
+
TaskCreate: "Validate MCP connections" → activeForm: "Validating MCPs"
|
|
66
|
+
TaskCreate: "Confirm stack with user" → activeForm: "Confirming stack"
|
|
67
|
+
TaskCreate: "Configure feature state" → activeForm: "Configuring state"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Update each task to `in_progress` before its step and `completed` after.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### Step 1: Load Project Context
|
|
75
|
+
|
|
76
|
+
Read these files first — they inform all subsequent decisions:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npx morph-spec state get $ARGUMENTS
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
If the feature doesn't exist in state, go back to Phase 0.
|
|
83
|
+
|
|
84
|
+
Then read:
|
|
85
|
+
- `.morph/context/README.md` — project overview, tech stack, architecture
|
|
86
|
+
- `.morph/config/config.json` — project configuration
|
|
87
|
+
|
|
88
|
+
### Step 2: Detect Agents and Load Standards
|
|
89
|
+
|
|
90
|
+
#### Step 2.0: Detect Architecture Style and Activate Architect
|
|
91
|
+
|
|
92
|
+
Read `.morph/config/config.json` and check `config.architecture.style`:
|
|
93
|
+
|
|
94
|
+
| Value | Action |
|
|
95
|
+
|-------|--------|
|
|
96
|
+
| `"vertical-slice"` | `npx morph-spec state add-agent $ARGUMENTS vsa-architect` |
|
|
97
|
+
| absent / any other value | `npx morph-spec state add-agent $ARGUMENTS domain-architect` |
|
|
98
|
+
|
|
99
|
+
Proceed with normal keyword detection for all other agents. The architect was already added above — skip it during keyword matching to avoid duplication.
|
|
100
|
+
|
|
101
|
+
#### Step 2.1: Keyword Detection
|
|
102
|
+
|
|
103
|
+
Use the `detect-agents` CLI to match agent keywords against the proposal (excludes architects already handled in Step 2.0):
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npx morph-spec detect-agents $ARGUMENTS --exclude domain-architect,vsa-architect --json
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
This reads the proposal from `.morph/features/$ARGUMENTS/0-proposal/proposal.md` and agents.json, returning JSON with `detected[]` and `skipped[]` arrays. Agents with `active_phases: ['*']` are always included.
|
|
110
|
+
|
|
111
|
+
Parse the JSON output and add each detected agent to state:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npx morph-spec state add-agent $ARGUMENTS {agent-id}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Run `add-agent` once per detected agent ID from the `detected[]` array.
|
|
118
|
+
|
|
119
|
+
**To load standards for detected agents:**
|
|
120
|
+
- For each active agent, read the standards referenced by the `standards[]` field in `agents.json`
|
|
121
|
+
- Standard files are located at `.morph/framework/standards/{path}`
|
|
122
|
+
|
|
123
|
+
**Standards resolution order:**
|
|
124
|
+
1. `.morph/context/*.md` — project overrides (highest priority)
|
|
125
|
+
2. `.morph/framework/standards/` — standards installed by morph-spec
|
|
126
|
+
3. `framework/standards/` — npm package standards (fallback)
|
|
127
|
+
|
|
128
|
+
### Step 2.5: Validate MCP Connections
|
|
129
|
+
|
|
130
|
+
Check that configured MCPs are working before proceeding.
|
|
131
|
+
|
|
132
|
+
**1. Collect recommended MCPs:**
|
|
133
|
+
- Read `framework/phases.json` → for each phase in the feature's workflow, collect `recommendedMCPs[]`
|
|
134
|
+
- Read `framework/skills/level-0-meta/mcp-registry.json` → get `healthCheck` for each MCP
|
|
135
|
+
|
|
136
|
+
**2. Identify configured MCPs:**
|
|
137
|
+
- Read `.claude/settings.local.json` → identify which MCPs are in `mcpServers`
|
|
138
|
+
|
|
139
|
+
**3. For each MCP that is CONFIGURED AND RECOMMENDED:**
|
|
140
|
+
1. Search your available tools for one containing `healthCheck.toolPattern` in the name
|
|
141
|
+
2. If the tool exists → execute the `healthCheck.testCall` with `healthCheck.testParams`
|
|
142
|
+
3. Evaluate the result:
|
|
143
|
+
|
|
144
|
+
| Result | Action |
|
|
145
|
+
|--------|--------|
|
|
146
|
+
| **Success** | `✓ {MCP} — connection verified` |
|
|
147
|
+
| **Tool not found** | `○ {MCP} — needs restart to activate` |
|
|
148
|
+
| **Error** | → Use `AskUserQuestion` with 3 options (below) |
|
|
149
|
+
|
|
150
|
+
**On error — ask the user:**
|
|
151
|
+
|
|
152
|
+
Use `AskUserQuestion` with header `"{MCP}"` and options:
|
|
153
|
+
- **Continue without {MCP}** — show the `fallback` field from the registry and proceed
|
|
154
|
+
- **Reconfigure credentials** — collect new credentials and update `.claude/settings.local.json`
|
|
155
|
+
- **Stop setup** — abort and report what needs to be fixed
|
|
156
|
+
|
|
157
|
+
**4. For MCPs RECOMMENDED but NOT CONFIGURED:**
|
|
158
|
+
- Print `△ {MCP} — not configured (fallback: {registry.fallback})`
|
|
159
|
+
- Suggestion: `Tip: configure with /morph-init refresh or npx morph-spec mcp setup`
|
|
160
|
+
|
|
161
|
+
**Summary:** Show a status table for each MCP before proceeding:
|
|
162
|
+
```
|
|
163
|
+
MCP Readiness:
|
|
164
|
+
✓ context7 — connection verified
|
|
165
|
+
○ playwright — needs restart
|
|
166
|
+
△ supabase — not configured (fallback: Grep + Read for schema)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
### Step 2.9: Check for Missing Agents
|
|
172
|
+
|
|
173
|
+
Run a quick check to verify all expected agents are installed for this project's stack:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
npx morph-spec doctor 2>&1 | grep -A 1 "agents completeness"
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
If the output shows **missing agents**, inform the user:
|
|
180
|
+
|
|
181
|
+
> ⚠ Some agents for your stack are not installed. Run `npx morph-spec setup-infra` to install them.
|
|
182
|
+
|
|
183
|
+
Use `AskUserQuestion` with header `"Agents"` and options:
|
|
184
|
+
- **Install now** — run `npx morph-spec setup-infra` to reinstall with current stack tags
|
|
185
|
+
- **Continue without** — proceed with available agents (may lack specialized support)
|
|
186
|
+
|
|
187
|
+
If "Install now" is selected, run the command and continue.
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
### Step 3: Confirm Stack
|
|
192
|
+
|
|
193
|
+
Based on the proposal and context, confirm:
|
|
194
|
+
- Tech stack (Blazor Server, Next.js, .NET API, Node.js CLI, etc.)
|
|
195
|
+
- Applicable architectural patterns
|
|
196
|
+
- Existing reusable components
|
|
197
|
+
|
|
198
|
+
### Step 4: List Active Agents and Dispatch Preview
|
|
199
|
+
|
|
200
|
+
Show the agents detected from the proposal:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
npx morph-spec state get $ARGUMENTS
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Parse the JSON and list `activeAgents` with their emojis/icons and responsibilities (look up each agent in `.morph/framework/agents.json` for the `icon` field).
|
|
207
|
+
|
|
208
|
+
**If there are 2+ specialist agents active**, show the dispatch plan for the next phase:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
npx morph-spec dispatch-agents $ARGUMENTS design
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
This shows which agents will be dispatched in parallel during the design phase and which tasks they'll execute.
|
|
215
|
+
|
|
216
|
+
> **Important mapping:** `agents[].id` from the dispatch config = `subagent_type` in the `Agent` tool.
|
|
217
|
+
> Example: `id: "nextjs-expert"` → `Agent(subagent_type=nextjs-expert, prompt=agent.taskPrompt)`.
|
|
218
|
+
> Each `id` corresponds to the `name:` field in the frontmatter of the file in `.claude/agents/`.
|
|
219
|
+
|
|
220
|
+
### Step 5: Update State and Determine Next Phase
|
|
221
|
+
|
|
222
|
+
Update the feature state:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
npx morph-spec state set $ARGUMENTS status in_progress
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Determine the next phase** based on active agents:
|
|
229
|
+
|
|
230
|
+
| Condition | Next Phase |
|
|
231
|
+
|-----------|------------|
|
|
232
|
+
| `ui-designer` is in activeAgents | **uiux** (UI/UX phase) |
|
|
233
|
+
| `ui-designer` is NOT in activeAgents | **design** (skip uiux) |
|
|
234
|
+
|
|
235
|
+
Announce the next phase clearly to the user.
|
|
236
|
+
|
|
237
|
+
## Outputs
|
|
238
|
+
|
|
239
|
+
Present to the user:
|
|
240
|
+
|
|
241
|
+
1. **Context loaded**:
|
|
242
|
+
- Project name
|
|
243
|
+
- Confirmed stack
|
|
244
|
+
- Applicable standards
|
|
245
|
+
|
|
246
|
+
2. **Active agents**:
|
|
247
|
+
- Agent list with emojis/icons and tier
|
|
248
|
+
- Responsibilities of each agent
|
|
249
|
+
|
|
250
|
+
3. **Next phase**:
|
|
251
|
+
- Which phase comes next (uiux or design)
|
|
252
|
+
- Why (ui-designer presence or absence)
|
|
253
|
+
|
|
254
|
+
## Advancement Criteria
|
|
255
|
+
|
|
256
|
+
- [x] Project context loaded
|
|
257
|
+
- [x] Standards identified (framework + project)
|
|
258
|
+
- [x] Stack confirmed
|
|
259
|
+
- [x] Agents listed with icons
|
|
260
|
+
- [x] State updated to in_progress
|
|
261
|
+
- [x] Next phase determined
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Worktree Note
|
|
266
|
+
|
|
267
|
+
Worktree isolation is handled automatically by `/morph-proposal` Step 0 and `/morph-apply` Step 0.
|
|
268
|
+
If a worktree is active, all file operations MUST use the worktree path (injected in session context as `WORKTREE_PATH`).
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
Continue automatically to the next phase (UI/UX if ui-designer detected, otherwise Design).
|