@polymorphism-tech/morph-spec 4.8.11 → 4.8.14
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 +379 -379
- package/bin/{task-manager.cjs → task-manager.js} +47 -158
- package/claude-plugin.json +14 -14
- package/docs/CHEATSHEET.md +203 -203
- package/docs/QUICKSTART.md +1 -1
- package/framework/agents.json +111 -24
- package/framework/hooks/README.md +202 -202
- package/framework/hooks/claude-code/pre-tool-use/enforce-phase-writes.js +6 -0
- package/framework/hooks/claude-code/session-start/inject-morph-context.js +7 -0
- package/framework/hooks/claude-code/statusline.py +6 -0
- package/framework/hooks/claude-code/stop/validate-completion.js +21 -2
- package/framework/hooks/dev/guard-version-numbers.js +1 -1
- package/framework/hooks/shared/phase-utils.js +3 -0
- package/framework/skills/level-0-meta/tool-usage-guide/SKILL.md +55 -0
- package/framework/skills/level-1-workflows/phase-clarify/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/phase-codebase-analysis/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/phase-design/SKILL.md +57 -1
- package/framework/skills/level-1-workflows/phase-implement/SKILL.md +23 -1
- package/framework/skills/level-1-workflows/phase-setup/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/phase-tasks/SKILL.md +25 -2
- package/framework/skills/level-1-workflows/phase-uiux/SKILL.md +1 -1
- package/package.json +87 -87
- package/src/commands/project/update.js +12 -2
- package/src/commands/state/advance-phase.js +32 -13
- package/src/commands/tasks/task.js +2 -2
- package/src/core/paths/output-schema.js +1 -0
- package/src/lib/detectors/design-system-detector.js +5 -4
- package/src/lib/tasks/task-parser.js +94 -0
- package/src/lib/validators/content/content-validator.js +34 -106
package/README.md
CHANGED
|
@@ -1,379 +1,379 @@
|
|
|
1
|
-
# morph-spec
|
|
2
|
-
|
|
3
|
-
> Spec-driven development framework for multi-stack projects. Turns feature requests into implementation-ready code through structured, AI-orchestrated phases.
|
|
4
|
-
|
|
5
|
-
**Package:** `@polymorphism-tech/morph-spec`
|
|
6
|
-
**Version:** 4.8.
|
|
7
|
-
**Requires:** Node.js 18+, Claude Code
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## What it does
|
|
12
|
-
|
|
13
|
-
morph-spec enforces a spec-first development workflow. When you ask for a feature, it does not write code immediately. It runs through structured phases (proposal, design, tasks) with approval gates before a single line of implementation is generated. Each phase produces traceable output files. Every decision is documented.
|
|
14
|
-
|
|
15
|
-
It integrates natively with Claude Code: skills become slash commands, agents become native subagents, hooks inject state context automatically, and rules enforce standards based on file paths.
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## Requirements
|
|
20
|
-
|
|
21
|
-
- [Claude Code](https://claude.ai/code) (latest)
|
|
22
|
-
- Node.js 18+
|
|
23
|
-
- npm 9+ or pnpm
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Installation
|
|
28
|
-
|
|
29
|
-
Install the CLI globally:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npm install -g @polymorphism-tech/morph-spec
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Then initialize in your project:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
morph-spec init
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Init options
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
| Flag | Description |
|
|
45
|
-
| ------------ | ------------------------------------- |
|
|
46
|
-
| `--force` | Overwrite existing installation |
|
|
47
|
-
| `--skip-mcp` | Skip MCP configuration prompt |
|
|
48
|
-
| `--path` | Target directory (default: cwd) |
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
After init, open the project in Claude Code. The framework activates automatically via `.claude/settings.local.json`.
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## Project structure (after init)
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
your-project/
|
|
59
|
-
├── CLAUDE.md # AI instructions for this project
|
|
60
|
-
├── .morph/
|
|
61
|
-
│ ├── config/
|
|
62
|
-
│ │ └── config.json # Project configuration
|
|
63
|
-
│ ├── framework/
|
|
64
|
-
│ │ ├── agents.json # 38 agents in 4 tiers (READ-ONLY)
|
|
65
|
-
│ │ ├── standards/ # Coding and architecture standards (READ-ONLY)
|
|
66
|
-
│ │ └── templates/ # Code and IaC templates (READ-ONLY)
|
|
67
|
-
│ ├── context/ # Project context (README.md, standards.md)
|
|
68
|
-
│ ├── features/ # Active features
|
|
69
|
-
│ │ └── {feature}/
|
|
70
|
-
│ │ ├── 0-proposal/ # User story + acceptance criteria
|
|
71
|
-
│ │ ├── 1-design/ # Technical spec, contracts, decisions
|
|
72
|
-
│ │ ├── 2-ui/ # UI/UX design (optional, UI-heavy features)
|
|
73
|
-
│ │ ├── 3-tasks/ # Atomic task list
|
|
74
|
-
│ │ └── 4-implement/ # Recap and implementation notes
|
|
75
|
-
│ └── state.json # READ-ONLY — managed by CLI only
|
|
76
|
-
└── .claude/
|
|
77
|
-
├── commands/ # Slash commands
|
|
78
|
-
├── skills/ # Framework skills (flat .md files)
|
|
79
|
-
├── agents/ # Native subagents (38 agents)
|
|
80
|
-
├── rules/ # Path-scoped standards rules
|
|
81
|
-
└── settings.local.json # Hooks configuration (10 hooks)
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## Phase workflow
|
|
87
|
-
|
|
88
|
-
Features move through structured phases. Some are optional depending on feature type.
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
proposal → setup → [uiux] → design → clarify → tasks → implement → [sync]
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Phases in brackets are optional. `uiux` applies to UI-heavy features. `sync` is a post-implementation reconciliation step.
|
|
95
|
-
|
|
96
|
-
### Phase outputs
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
| Phase | Directory | Key files |
|
|
100
|
-
| --------- | -------------- | ------------------------------------------------------------- |
|
|
101
|
-
| Proposal | `0-proposal/` | `proposal.md` |
|
|
102
|
-
| Design | `1-design/` | `spec.md`, `contracts.cs`, `decisions.md` |
|
|
103
|
-
| UI/UX | `2-ui/` | `design-system.md`, `mockups.md`, `components.md`, `flows.md` |
|
|
104
|
-
| Tasks | `3-tasks/` | `tasks.md` |
|
|
105
|
-
| Implement | `4-implement/` | `recap.md` |
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
### Approval gates
|
|
109
|
-
|
|
110
|
-
- **Design gate** — Spec must be approved before moving to Tasks.
|
|
111
|
-
- **Implementation gate** — Task list must be approved before implementation starts.
|
|
112
|
-
|
|
113
|
-
Check gate status:
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
morph-spec approval-status {feature}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## Slash commands
|
|
122
|
-
|
|
123
|
-
These commands are available inside Claude Code after init.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
| Command | Description |
|
|
127
|
-
| --------------------------- | --------------------------------------------------------- |
|
|
128
|
-
| `/morph-proposal {feature}` | Full spec pipeline (phases 0-4, pauses at approval gates) |
|
|
129
|
-
| `/morph-apply {feature}` | Implement approved feature (phase 5) |
|
|
130
|
-
| `/morph-status` | Feature status dashboard |
|
|
131
|
-
| `/morph-preflight` | Pre-implementation validation |
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
## CLI reference
|
|
137
|
-
|
|
138
|
-
### Project management
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
morph-spec init # Initialize MORPH in current project
|
|
142
|
-
morph-spec init --force # Overwrite existing installation
|
|
143
|
-
morph-spec update # Update framework files and re-analyze project
|
|
144
|
-
morph-spec doctor # Check installation health
|
|
145
|
-
morph-spec doctor --full # Full health check (all file verifications)
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### Feature workflow
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
morph-spec state list # List all features and their states
|
|
152
|
-
morph-spec state get {feature} # Get feature state
|
|
153
|
-
morph-spec state set {feature} {key} {value}
|
|
154
|
-
morph-spec phase advance {feature} # Advance to next phase
|
|
155
|
-
morph-spec task done {feature} # Mark current task complete
|
|
156
|
-
morph-spec task start {feature} # Start next task
|
|
157
|
-
morph-spec task next {feature} # Preview next task
|
|
158
|
-
morph-spec status {feature} # Feature status dashboard
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Validation
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
morph-spec validate # Run all validators
|
|
165
|
-
morph-spec validate {validator} # Run specific validator
|
|
166
|
-
morph-spec validate-feature {feature} # Content-aware feature validation
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
---
|
|
170
|
-
|
|
171
|
-
## Agent hierarchy
|
|
172
|
-
|
|
173
|
-
morph-spec includes 38 agents organized in 4 tiers (3+4+26+5). Tier 1-2 agents are installed as native Claude Code subagents in `.claude/agents/`. Tier 3 domain agents are installed as `.claude/agents/morph-domain-{name}.md`.
|
|
174
|
-
|
|
175
|
-
### Tier 1 — Orchestrators (3)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
| Agent | Role | Active |
|
|
179
|
-
| --------------------- | ------------------------------------------------------ | --------- |
|
|
180
|
-
| `standards-architect` | Chief Architect — enforces standards across all phases | Always |
|
|
181
|
-
| `ai-system-architect` | AI/Agent system design and orchestration | On-demand |
|
|
182
|
-
| `po-pm-advisor` | Product and project advisory | On-demand |
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
### Tier 2 — Domain Leaders (4)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
| Agent | Squad | Active |
|
|
189
|
-
| ------------------ | ------------------------- | --------- |
|
|
190
|
-
| `dotnet-senior` | Backend squad lead | Always |
|
|
191
|
-
| `infra-architect` | Infrastructure squad lead | Always |
|
|
192
|
-
| `domain-architect` | DDD & domain modeling | On-demand |
|
|
193
|
-
| `ui-designer` | UI/UX squad lead | On-demand |
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
### Tier 3 — Specialists (26)
|
|
197
|
-
|
|
198
|
-
Organized into squads:
|
|
199
|
-
|
|
200
|
-
**Backend (10):** C#/.NET specialists, EF Core, Dapper, SignalR, CQRS, Domain modeling, API design, Auth, Background services, Testing
|
|
201
|
-
|
|
202
|
-
**Frontend (3):** Blazor components, Next.js/React, CSS/design system
|
|
203
|
-
|
|
204
|
-
**Infrastructure (5):** Azure Bicep, CI/CD pipelines, Containerization, Monitoring, Cost optimization
|
|
205
|
-
|
|
206
|
-
**Quality/Cross (8):** Security review, Performance, Accessibility, Documentation, Code review, Migration, Integration, Data modeling
|
|
207
|
-
|
|
208
|
-
### Tier 4 — Validators (5)
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
| Agent | Validates |
|
|
212
|
-
| ------------------------------ | --------------------------------------- |
|
|
213
|
-
| `security-expert` | Security vulnerabilities and compliance |
|
|
214
|
-
| `architecture-expert` | Architectural decisions and constraints |
|
|
215
|
-
| `packages-validator` | Package versions and compatibility |
|
|
216
|
-
| `design-system-validator` | Design system adherence |
|
|
217
|
-
| `blazor-concurrency-validator` | Blazor thread safety and concurrency |
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
## Hooks
|
|
223
|
-
|
|
224
|
-
10 Claude Code hooks are installed into `.claude/settings.local.json` across 8 event types:
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
| Event | Hook | Purpose |
|
|
228
|
-
| -------------------- | -------------------------- | ----------------------------------------------------------------- |
|
|
229
|
-
| `SessionStart` | `inject-morph-context.js` | Injects active feature spec into context (configurable char max) |
|
|
230
|
-
| `UserPromptSubmit` | `enrich-prompt.js` | Context-aware prompt enrichment, wrong-phase warnings |
|
|
231
|
-
| `PreToolUse` | Bash guard (prompt type) | Detects destructive patterns inline via Claude's reasoning |
|
|
232
|
-
| `PreToolUse` | `protect-spec-files.js` | Blocks edits to spec files after approval gate |
|
|
233
|
-
| `PreToolUse` | `enforce-phase-writes.js` | Ensures writes go to the correct phase directory |
|
|
234
|
-
| `PostToolUse` | `dispatch.js` | Triggers auto-checkpoints on task completion |
|
|
235
|
-
| `PostToolUseFailure` | `handle-tool-failure.js` | Logs failures to `.morph/logs/tool-failures.log` |
|
|
236
|
-
| `Stop` | `validate-completion.js` | Warns about incomplete tasks/missing outputs/pending gates |
|
|
237
|
-
| `PreCompact` | `save-morph-context.js` | Snapshots state to `.morph/memory/` before compaction |
|
|
238
|
-
| `Notification` | `approval-reminder.js` | Reminds about pending approval gates |
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
Protected files (via `permissions.deny`):
|
|
242
|
-
|
|
243
|
-
- `.morph/state.json` — never edited directly, CLI only
|
|
244
|
-
- `.morph/framework/`** — read-only framework content
|
|
245
|
-
|
|
246
|
-
---
|
|
247
|
-
|
|
248
|
-
## Rules
|
|
249
|
-
|
|
250
|
-
Path-scoped rules are installed to `.claude/rules/` and activate automatically based on file patterns:
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
| Rule file | Applies to |
|
|
254
|
-
| ----------------------------- | -------------------------------------------------------- |
|
|
255
|
-
| `morph-workflow.md` | Always active — spec-first mandate, phase commands |
|
|
256
|
-
| `csharp-standards.md` | `**/*.cs`, `**/*.csproj` |
|
|
257
|
-
| `frontend-standards.md` | `**/*.razor`, `**/*.css`, `**/*.scss` |
|
|
258
|
-
| `nextjs-standards.md` | `**/*.tsx`, `**/*.ts` |
|
|
259
|
-
| `testing-standards.md` | `tests/`**, `**/*.test.*`, `**/*.spec.*`, `**/*Tests.cs` |
|
|
260
|
-
| `infrastructure-standards.md` | `**/*.bicep`, `**/Dockerfile`, `**/pipelines/**` |
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
---
|
|
264
|
-
|
|
265
|
-
## Stack support
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
| Technology | Support |
|
|
269
|
-
| ------------------------------------------- | ------------------------------------------------ |
|
|
270
|
-
| .NET 10 / ASP.NET Core | Full — C# contracts, EF Core, CQRS, Minimal API |
|
|
271
|
-
| Blazor (WebAssembly / Server / MAUI Hybrid) | Full — components, concurrency, design system |
|
|
272
|
-
| Next.js / React / TypeScript | Full — components, routing, state management |
|
|
273
|
-
| Azure (Bicep) | Full — IaC templates, cost estimation, pipelines |
|
|
274
|
-
| GitHub Actions | Full — CI/CD workflow templates |
|
|
275
|
-
| Supabase | Supported via MCP integration |
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
TypeScript strict mode is enforced by default. See `.morph/framework/standards/` for all coding standards.
|
|
279
|
-
|
|
280
|
-
---
|
|
281
|
-
|
|
282
|
-
## Update
|
|
283
|
-
|
|
284
|
-
To update the framework files in an existing project:
|
|
285
|
-
|
|
286
|
-
```bash
|
|
287
|
-
morph-spec update
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
This re-syncs `.morph/framework/`, `.claude/skills/`, `.claude/agents/`, `.claude/rules/`, and `CLAUDE.md` with the installed package version. Your `.morph/config/config.json`, `.morph/context/`, and feature outputs are not touched.
|
|
291
|
-
|
|
292
|
-
After updating, run `morph-spec doctor` to confirm the installation is healthy.
|
|
293
|
-
|
|
294
|
-
---
|
|
295
|
-
|
|
296
|
-
## Key rules
|
|
297
|
-
|
|
298
|
-
**Never skip phases.** Every feature starts with a proposal. No code is written until the design is approved and a task list exists.
|
|
299
|
-
|
|
300
|
-
**Never edit protected files directly:**
|
|
301
|
-
|
|
302
|
-
- `.morph/state.json` — use `morph-spec state set`
|
|
303
|
-
- `.morph/framework/`** — read-only, updated by `morph-spec update`
|
|
304
|
-
|
|
305
|
-
**Always document decisions.** Each feature has a `1-design/decisions.md`. Architectural choices go there, not in commit messages.
|
|
306
|
-
|
|
307
|
-
**Checkpoints every 3 tasks.** The framework auto-validates architecture compliance, package versions, and security after every third completed task.
|
|
308
|
-
|
|
309
|
-
---
|
|
310
|
-
|
|
311
|
-
## Troubleshooting
|
|
312
|
-
|
|
313
|
-
### `morph-spec: command not found`
|
|
314
|
-
|
|
315
|
-
If you are using nvm-windows or a Node version manager, the global bin path may not be on `PATH` in your shell. Use `npx` instead:
|
|
316
|
-
|
|
317
|
-
```bash
|
|
318
|
-
npx @polymorphism-tech/morph-spec init
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
Or add the npm global bin to your PATH:
|
|
322
|
-
|
|
323
|
-
```bash
|
|
324
|
-
npm config get prefix
|
|
325
|
-
# Add {prefix}/bin to your PATH
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
### `morph-spec doctor` reports issues
|
|
329
|
-
|
|
330
|
-
Run doctor to see all checks:
|
|
331
|
-
|
|
332
|
-
```bash
|
|
333
|
-
morph-spec doctor
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
Common fixes:
|
|
337
|
-
|
|
338
|
-
- **Missing `.claude/agents/`** — run `morph-spec update` to reinstall agents
|
|
339
|
-
- **Missing `.claude/rules/`** — run `morph-spec update` to reinstall rules
|
|
340
|
-
- **State version mismatch** — state auto-migrates on next CLI command; if it fails, back up and re-init
|
|
341
|
-
- **Hooks not firing** — confirm `.claude/settings.local.json` exists and contains the `hooks` key
|
|
342
|
-
|
|
343
|
-
### EPERM on Windows global install
|
|
344
|
-
|
|
345
|
-
Windows may block global npm installs without elevated permissions. Options:
|
|
346
|
-
|
|
347
|
-
1. Run terminal as Administrator (not recommended long-term)
|
|
348
|
-
2. Change npm global prefix to a user-writable directory:
|
|
349
|
-
|
|
350
|
-
```bat
|
|
351
|
-
mkdir %APPDATA%\npm-global
|
|
352
|
-
npm config set prefix %APPDATA%\npm-global
|
|
353
|
-
:: Add %APPDATA%\npm-global to your PATH
|
|
354
|
-
npm install -g @polymorphism-tech/morph-spec
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
1. Use `npx` for all CLI invocations
|
|
358
|
-
|
|
359
|
-
### Hook not triggering on SessionStart
|
|
360
|
-
|
|
361
|
-
Ensure `.claude/settings.local.json` is not gitignored in your project. The file must be present for Claude Code to load hooks. If it is missing, re-run `morph-spec init --force`.
|
|
362
|
-
|
|
363
|
-
---
|
|
364
|
-
|
|
365
|
-
## Standards
|
|
366
|
-
|
|
367
|
-
The framework ships 82 registered standards across 11 categories, stored in `.morph/framework/standards/STANDARDS.json`. Standards are enforced via path-scoped rules installed to `.claude/rules/` during `morph-spec init`.
|
|
368
|
-
|
|
369
|
-
---
|
|
370
|
-
|
|
371
|
-
## License
|
|
372
|
-
|
|
373
|
-
Proprietary — see [LICENSE](./LICENSE).
|
|
374
|
-
|
|
375
|
-
Code generated by morph-spec (contracts, templates, implementation output) belongs to you.
|
|
376
|
-
|
|
377
|
-
---
|
|
378
|
-
|
|
379
|
-
*morph-spec v4.8.
|
|
1
|
+
# morph-spec
|
|
2
|
+
|
|
3
|
+
> Spec-driven development framework for multi-stack projects. Turns feature requests into implementation-ready code through structured, AI-orchestrated phases.
|
|
4
|
+
|
|
5
|
+
**Package:** `@polymorphism-tech/morph-spec`
|
|
6
|
+
**Version:** 4.8.14
|
|
7
|
+
**Requires:** Node.js 18+, Claude Code
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## What it does
|
|
12
|
+
|
|
13
|
+
morph-spec enforces a spec-first development workflow. When you ask for a feature, it does not write code immediately. It runs through structured phases (proposal, design, tasks) with approval gates before a single line of implementation is generated. Each phase produces traceable output files. Every decision is documented.
|
|
14
|
+
|
|
15
|
+
It integrates natively with Claude Code: skills become slash commands, agents become native subagents, hooks inject state context automatically, and rules enforce standards based on file paths.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
- [Claude Code](https://claude.ai/code) (latest)
|
|
22
|
+
- Node.js 18+
|
|
23
|
+
- npm 9+ or pnpm
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
Install the CLI globally:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install -g @polymorphism-tech/morph-spec
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Then initialize in your project:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
morph-spec init
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Init options
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
| Flag | Description |
|
|
45
|
+
| ------------ | ------------------------------------- |
|
|
46
|
+
| `--force` | Overwrite existing installation |
|
|
47
|
+
| `--skip-mcp` | Skip MCP configuration prompt |
|
|
48
|
+
| `--path` | Target directory (default: cwd) |
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
After init, open the project in Claude Code. The framework activates automatically via `.claude/settings.local.json`.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Project structure (after init)
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
your-project/
|
|
59
|
+
├── CLAUDE.md # AI instructions for this project
|
|
60
|
+
├── .morph/
|
|
61
|
+
│ ├── config/
|
|
62
|
+
│ │ └── config.json # Project configuration
|
|
63
|
+
│ ├── framework/
|
|
64
|
+
│ │ ├── agents.json # 38 agents in 4 tiers (READ-ONLY)
|
|
65
|
+
│ │ ├── standards/ # Coding and architecture standards (READ-ONLY)
|
|
66
|
+
│ │ └── templates/ # Code and IaC templates (READ-ONLY)
|
|
67
|
+
│ ├── context/ # Project context (README.md, standards.md)
|
|
68
|
+
│ ├── features/ # Active features
|
|
69
|
+
│ │ └── {feature}/
|
|
70
|
+
│ │ ├── 0-proposal/ # User story + acceptance criteria
|
|
71
|
+
│ │ ├── 1-design/ # Technical spec, contracts, decisions
|
|
72
|
+
│ │ ├── 2-ui/ # UI/UX design (optional, UI-heavy features)
|
|
73
|
+
│ │ ├── 3-tasks/ # Atomic task list
|
|
74
|
+
│ │ └── 4-implement/ # Recap and implementation notes
|
|
75
|
+
│ └── state.json # READ-ONLY — managed by CLI only
|
|
76
|
+
└── .claude/
|
|
77
|
+
├── commands/ # Slash commands
|
|
78
|
+
├── skills/ # Framework skills (flat .md files)
|
|
79
|
+
├── agents/ # Native subagents (38 agents)
|
|
80
|
+
├── rules/ # Path-scoped standards rules
|
|
81
|
+
└── settings.local.json # Hooks configuration (10 hooks)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Phase workflow
|
|
87
|
+
|
|
88
|
+
Features move through structured phases. Some are optional depending on feature type.
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
proposal → setup → [uiux] → design → clarify → tasks → implement → [sync]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Phases in brackets are optional. `uiux` applies to UI-heavy features. `sync` is a post-implementation reconciliation step.
|
|
95
|
+
|
|
96
|
+
### Phase outputs
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
| Phase | Directory | Key files |
|
|
100
|
+
| --------- | -------------- | ------------------------------------------------------------- |
|
|
101
|
+
| Proposal | `0-proposal/` | `proposal.md` |
|
|
102
|
+
| Design | `1-design/` | `spec.md`, `contracts.cs`, `decisions.md` |
|
|
103
|
+
| UI/UX | `2-ui/` | `design-system.md`, `mockups.md`, `components.md`, `flows.md` |
|
|
104
|
+
| Tasks | `3-tasks/` | `tasks.md` |
|
|
105
|
+
| Implement | `4-implement/` | `recap.md` |
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
### Approval gates
|
|
109
|
+
|
|
110
|
+
- **Design gate** — Spec must be approved before moving to Tasks.
|
|
111
|
+
- **Implementation gate** — Task list must be approved before implementation starts.
|
|
112
|
+
|
|
113
|
+
Check gate status:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
morph-spec approval-status {feature}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Slash commands
|
|
122
|
+
|
|
123
|
+
These commands are available inside Claude Code after init.
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
| Command | Description |
|
|
127
|
+
| --------------------------- | --------------------------------------------------------- |
|
|
128
|
+
| `/morph-proposal {feature}` | Full spec pipeline (phases 0-4, pauses at approval gates) |
|
|
129
|
+
| `/morph-apply {feature}` | Implement approved feature (phase 5) |
|
|
130
|
+
| `/morph-status` | Feature status dashboard |
|
|
131
|
+
| `/morph-preflight` | Pre-implementation validation |
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## CLI reference
|
|
137
|
+
|
|
138
|
+
### Project management
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
morph-spec init # Initialize MORPH in current project
|
|
142
|
+
morph-spec init --force # Overwrite existing installation
|
|
143
|
+
morph-spec update # Update framework files and re-analyze project
|
|
144
|
+
morph-spec doctor # Check installation health
|
|
145
|
+
morph-spec doctor --full # Full health check (all file verifications)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Feature workflow
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
morph-spec state list # List all features and their states
|
|
152
|
+
morph-spec state get {feature} # Get feature state
|
|
153
|
+
morph-spec state set {feature} {key} {value}
|
|
154
|
+
morph-spec phase advance {feature} # Advance to next phase
|
|
155
|
+
morph-spec task done {feature} # Mark current task complete
|
|
156
|
+
morph-spec task start {feature} # Start next task
|
|
157
|
+
morph-spec task next {feature} # Preview next task
|
|
158
|
+
morph-spec status {feature} # Feature status dashboard
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Validation
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
morph-spec validate # Run all validators
|
|
165
|
+
morph-spec validate {validator} # Run specific validator
|
|
166
|
+
morph-spec validate-feature {feature} # Content-aware feature validation
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Agent hierarchy
|
|
172
|
+
|
|
173
|
+
morph-spec includes 38 agents organized in 4 tiers (3+4+26+5). Tier 1-2 agents are installed as native Claude Code subagents in `.claude/agents/`. Tier 3 domain agents are installed as `.claude/agents/morph-domain-{name}.md`.
|
|
174
|
+
|
|
175
|
+
### Tier 1 — Orchestrators (3)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
| Agent | Role | Active |
|
|
179
|
+
| --------------------- | ------------------------------------------------------ | --------- |
|
|
180
|
+
| `standards-architect` | Chief Architect — enforces standards across all phases | Always |
|
|
181
|
+
| `ai-system-architect` | AI/Agent system design and orchestration | On-demand |
|
|
182
|
+
| `po-pm-advisor` | Product and project advisory | On-demand |
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
### Tier 2 — Domain Leaders (4)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
| Agent | Squad | Active |
|
|
189
|
+
| ------------------ | ------------------------- | --------- |
|
|
190
|
+
| `dotnet-senior` | Backend squad lead | Always |
|
|
191
|
+
| `infra-architect` | Infrastructure squad lead | Always |
|
|
192
|
+
| `domain-architect` | DDD & domain modeling | On-demand |
|
|
193
|
+
| `ui-designer` | UI/UX squad lead | On-demand |
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
### Tier 3 — Specialists (26)
|
|
197
|
+
|
|
198
|
+
Organized into squads:
|
|
199
|
+
|
|
200
|
+
**Backend (10):** C#/.NET specialists, EF Core, Dapper, SignalR, CQRS, Domain modeling, API design, Auth, Background services, Testing
|
|
201
|
+
|
|
202
|
+
**Frontend (3):** Blazor components, Next.js/React, CSS/design system
|
|
203
|
+
|
|
204
|
+
**Infrastructure (5):** Azure Bicep, CI/CD pipelines, Containerization, Monitoring, Cost optimization
|
|
205
|
+
|
|
206
|
+
**Quality/Cross (8):** Security review, Performance, Accessibility, Documentation, Code review, Migration, Integration, Data modeling
|
|
207
|
+
|
|
208
|
+
### Tier 4 — Validators (5)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
| Agent | Validates |
|
|
212
|
+
| ------------------------------ | --------------------------------------- |
|
|
213
|
+
| `security-expert` | Security vulnerabilities and compliance |
|
|
214
|
+
| `architecture-expert` | Architectural decisions and constraints |
|
|
215
|
+
| `packages-validator` | Package versions and compatibility |
|
|
216
|
+
| `design-system-validator` | Design system adherence |
|
|
217
|
+
| `blazor-concurrency-validator` | Blazor thread safety and concurrency |
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Hooks
|
|
223
|
+
|
|
224
|
+
10 Claude Code hooks are installed into `.claude/settings.local.json` across 8 event types:
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
| Event | Hook | Purpose |
|
|
228
|
+
| -------------------- | -------------------------- | ----------------------------------------------------------------- |
|
|
229
|
+
| `SessionStart` | `inject-morph-context.js` | Injects active feature spec into context (configurable char max) |
|
|
230
|
+
| `UserPromptSubmit` | `enrich-prompt.js` | Context-aware prompt enrichment, wrong-phase warnings |
|
|
231
|
+
| `PreToolUse` | Bash guard (prompt type) | Detects destructive patterns inline via Claude's reasoning |
|
|
232
|
+
| `PreToolUse` | `protect-spec-files.js` | Blocks edits to spec files after approval gate |
|
|
233
|
+
| `PreToolUse` | `enforce-phase-writes.js` | Ensures writes go to the correct phase directory |
|
|
234
|
+
| `PostToolUse` | `dispatch.js` | Triggers auto-checkpoints on task completion |
|
|
235
|
+
| `PostToolUseFailure` | `handle-tool-failure.js` | Logs failures to `.morph/logs/tool-failures.log` |
|
|
236
|
+
| `Stop` | `validate-completion.js` | Warns about incomplete tasks/missing outputs/pending gates |
|
|
237
|
+
| `PreCompact` | `save-morph-context.js` | Snapshots state to `.morph/memory/` before compaction |
|
|
238
|
+
| `Notification` | `approval-reminder.js` | Reminds about pending approval gates |
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
Protected files (via `permissions.deny`):
|
|
242
|
+
|
|
243
|
+
- `.morph/state.json` — never edited directly, CLI only
|
|
244
|
+
- `.morph/framework/`** — read-only framework content
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Rules
|
|
249
|
+
|
|
250
|
+
Path-scoped rules are installed to `.claude/rules/` and activate automatically based on file patterns:
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
| Rule file | Applies to |
|
|
254
|
+
| ----------------------------- | -------------------------------------------------------- |
|
|
255
|
+
| `morph-workflow.md` | Always active — spec-first mandate, phase commands |
|
|
256
|
+
| `csharp-standards.md` | `**/*.cs`, `**/*.csproj` |
|
|
257
|
+
| `frontend-standards.md` | `**/*.razor`, `**/*.css`, `**/*.scss` |
|
|
258
|
+
| `nextjs-standards.md` | `**/*.tsx`, `**/*.ts` |
|
|
259
|
+
| `testing-standards.md` | `tests/`**, `**/*.test.*`, `**/*.spec.*`, `**/*Tests.cs` |
|
|
260
|
+
| `infrastructure-standards.md` | `**/*.bicep`, `**/Dockerfile`, `**/pipelines/**` |
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Stack support
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
| Technology | Support |
|
|
269
|
+
| ------------------------------------------- | ------------------------------------------------ |
|
|
270
|
+
| .NET 10 / ASP.NET Core | Full — C# contracts, EF Core, CQRS, Minimal API |
|
|
271
|
+
| Blazor (WebAssembly / Server / MAUI Hybrid) | Full — components, concurrency, design system |
|
|
272
|
+
| Next.js / React / TypeScript | Full — components, routing, state management |
|
|
273
|
+
| Azure (Bicep) | Full — IaC templates, cost estimation, pipelines |
|
|
274
|
+
| GitHub Actions | Full — CI/CD workflow templates |
|
|
275
|
+
| Supabase | Supported via MCP integration |
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
TypeScript strict mode is enforced by default. See `.morph/framework/standards/` for all coding standards.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Update
|
|
283
|
+
|
|
284
|
+
To update the framework files in an existing project:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
morph-spec update
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
This re-syncs `.morph/framework/`, `.claude/skills/`, `.claude/agents/`, `.claude/rules/`, and `CLAUDE.md` with the installed package version. Your `.morph/config/config.json`, `.morph/context/`, and feature outputs are not touched.
|
|
291
|
+
|
|
292
|
+
After updating, run `morph-spec doctor` to confirm the installation is healthy.
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Key rules
|
|
297
|
+
|
|
298
|
+
**Never skip phases.** Every feature starts with a proposal. No code is written until the design is approved and a task list exists.
|
|
299
|
+
|
|
300
|
+
**Never edit protected files directly:**
|
|
301
|
+
|
|
302
|
+
- `.morph/state.json` — use `morph-spec state set`
|
|
303
|
+
- `.morph/framework/`** — read-only, updated by `morph-spec update`
|
|
304
|
+
|
|
305
|
+
**Always document decisions.** Each feature has a `1-design/decisions.md`. Architectural choices go there, not in commit messages.
|
|
306
|
+
|
|
307
|
+
**Checkpoints every 3 tasks.** The framework auto-validates architecture compliance, package versions, and security after every third completed task.
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Troubleshooting
|
|
312
|
+
|
|
313
|
+
### `morph-spec: command not found`
|
|
314
|
+
|
|
315
|
+
If you are using nvm-windows or a Node version manager, the global bin path may not be on `PATH` in your shell. Use `npx` instead:
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
npx @polymorphism-tech/morph-spec init
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Or add the npm global bin to your PATH:
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
npm config get prefix
|
|
325
|
+
# Add {prefix}/bin to your PATH
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### `morph-spec doctor` reports issues
|
|
329
|
+
|
|
330
|
+
Run doctor to see all checks:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
morph-spec doctor
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Common fixes:
|
|
337
|
+
|
|
338
|
+
- **Missing `.claude/agents/`** — run `morph-spec update` to reinstall agents
|
|
339
|
+
- **Missing `.claude/rules/`** — run `morph-spec update` to reinstall rules
|
|
340
|
+
- **State version mismatch** — state auto-migrates on next CLI command; if it fails, back up and re-init
|
|
341
|
+
- **Hooks not firing** — confirm `.claude/settings.local.json` exists and contains the `hooks` key
|
|
342
|
+
|
|
343
|
+
### EPERM on Windows global install
|
|
344
|
+
|
|
345
|
+
Windows may block global npm installs without elevated permissions. Options:
|
|
346
|
+
|
|
347
|
+
1. Run terminal as Administrator (not recommended long-term)
|
|
348
|
+
2. Change npm global prefix to a user-writable directory:
|
|
349
|
+
|
|
350
|
+
```bat
|
|
351
|
+
mkdir %APPDATA%\npm-global
|
|
352
|
+
npm config set prefix %APPDATA%\npm-global
|
|
353
|
+
:: Add %APPDATA%\npm-global to your PATH
|
|
354
|
+
npm install -g @polymorphism-tech/morph-spec
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
1. Use `npx` for all CLI invocations
|
|
358
|
+
|
|
359
|
+
### Hook not triggering on SessionStart
|
|
360
|
+
|
|
361
|
+
Ensure `.claude/settings.local.json` is not gitignored in your project. The file must be present for Claude Code to load hooks. If it is missing, re-run `morph-spec init --force`.
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Standards
|
|
366
|
+
|
|
367
|
+
The framework ships 82 registered standards across 11 categories, stored in `.morph/framework/standards/STANDARDS.json`. Standards are enforced via path-scoped rules installed to `.claude/rules/` during `morph-spec init`.
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## License
|
|
372
|
+
|
|
373
|
+
Proprietary — see [LICENSE](./LICENSE).
|
|
374
|
+
|
|
375
|
+
Code generated by morph-spec (contracts, templates, implementation output) belongs to you.
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
*morph-spec v4.8.14 by [Polymorphism Tech](https://polymorphism.tech)*
|