@polymorphism-tech/morph-spec 10.0.0 → 10.2.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 +2 -0
- package/README.md +3 -7
- package/bin/morph-spec.js +1 -41
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +27 -38
- package/docs/QUICKSTART.md +31 -191
- package/framework/CLAUDE.md +2 -2
- package/framework/MORPH.md +2 -2
- package/framework/agents.json +0 -1
- package/framework/commands/morph-archive.md +1 -1
- package/framework/commands/morph-preflight.md +6 -7
- package/framework/docs/CLI.md +24 -21
- package/framework/hooks/README.md +2 -2
- package/framework/hooks/claude-code/core/validate-completion.js +0 -35
- package/framework/hooks/shared/e2e-check.js +44 -7
- package/framework/hooks/shared/heavy-command.js +12 -1
- package/framework/hooks/shared/next-step.js +4 -4
- package/framework/mcp/registry.json +4 -4
- package/framework/phases.json +4 -4
- package/framework/rules/ai-agents-standards.md +1 -1
- package/framework/rules/data-standards.md +1 -1
- package/framework/rules/hangfire-standards.md +1 -1
- package/framework/rules/neon-auth-standards.md +1 -1
- package/framework/rules/neon-standards.md +3 -3
- package/framework/schemas/config.schema.json +20 -1
- package/framework/schemas/feature.schema.json +1 -0
- package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
- package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
- package/framework/skills/core/morph-apply/SKILL.md +8 -7
- package/framework/skills/core/morph-apply/references/hotfix.md +1 -1
- package/framework/skills/core/morph-apply/references/review.md +5 -5
- package/framework/skills/core/morph-plan/SKILL.md +22 -16
- package/framework/skills/core/morph-plan/references/critique.md +11 -8
- package/framework/skills/core/morph-plan/references/interview.md +18 -6
- package/framework/skills/core/morph-uiux/SKILL.md +2 -2
- package/framework/standards/STANDARDS.json +20 -24
- package/framework/standards/STANDARDS.meta.json +12 -19
- package/framework/standards/ai-agents/rag-custom-pgvector.md +1 -0
- package/framework/standards/architecture/stack-baseline.md +26 -3
- package/framework/standards/backend/database/postgresql/database.md +22 -1
- package/framework/standards/backend/dotnet/vsa-handler-patterns.md +33 -1
- package/framework/standards/backend/integrations/hangfire/hangfire-jobs.md +2 -1
- package/framework/standards/backend/integrations/neon-auth/neon-auth.md +10 -9
- package/framework/standards/infrastructure/docker/local-compose-isolation.md +2 -2
- package/framework/standards/infrastructure/neon/neon-pgvector.md +62 -20
- package/framework/standards/infrastructure/neon/neon-platform.md +61 -0
- package/framework/standards/infrastructure/neon/neon-setup.md +14 -13
- package/framework/standards/integration/mcp/mcp-tools.md +20 -20
- package/framework/templates/docs/plan.md +4 -1
- package/framework/templates/examples/design-system-examples.md +0 -3
- package/framework/templates/infrastructure/docker/docker-compose.template.yml +1 -1
- package/package.json +1 -1
- package/src/commands/project/doctor.js +0 -1
- package/src/commands/state/approve.js +9 -109
- package/src/commands/state/auto-approval.js +1 -1
- package/src/commands/state/create.js +1 -1
- package/src/commands/state/gate-check.js +2 -2
- package/src/commands/state/report-check.js +44 -2
- package/src/commands/validation/verify.js +7 -3
- package/src/core/state/state-manager.js +0 -24
- package/src/lib/detectors/index.js +1 -1
- package/src/lib/heavy/cleanup.js +8 -2
- package/src/lib/installers/memory-installer.js +1 -1
- package/src/lib/plan/checks.js +8 -1
- package/src/lib/plan/critique.js +23 -3
- package/src/lib/review-confirmation.js +67 -0
- package/src/lib/review-reports.js +1 -0
- package/src/lib/risk-detector.js +2 -2
- package/src/lib/tasks/test-nodes.js +5 -0
- package/src/lib/tasks/test-runner.js +37 -43
- package/src/lib/telemetry/telemetry-reader.js +1 -2
- package/src/lib/telemetry/verify-event.js +7 -0
- package/src/lib/validators/verify-cache.js +63 -0
- package/src/lib/validators/verify-runner.js +98 -23
- package/src/utils/agents-installer.js +2 -2
- package/src/utils/hooks-installer.js +0 -20
- package/bin/validate.js +0 -212
- package/framework/hooks/claude-code/__pycache__/statusline.cpython-313.pyc +0 -0
- package/framework/standards/infrastructure/neon/neon-pgrag.md +0 -243
- package/src/commands/observability/telemetry.js +0 -60
- package/src/commands/validation/validate-feature.js +0 -337
package/CLAUDE.md
CHANGED
|
@@ -8,6 +8,8 @@ morph-spec is a spec-driven development harness CLI (`@polymorphism-tech/morph-s
|
|
|
8
8
|
|
|
9
9
|
This repo is the **framework source code** — not a project that uses morph-spec.
|
|
10
10
|
|
|
11
|
+
**Do not run the morph-spec workflow here.** No `init`, `create`, `plan-check`, `gate-check`, `approve`, `advance`, `verify`, `context refresh` or `finish`, and no `/morph-plan` or `/morph-apply` as a process, even if a prompt starts with one: confirm first. Work here is ordinary: a normal branch, `npm test`, `npm run generate:check`, a PR. `framework/skills/` and `framework/CLAUDE.md` are source to edit, not instructions to follow. `/.morph/` is gitignored: this repo keeps no morph-spec state.
|
|
12
|
+
|
|
11
13
|
## Build & Test Commands
|
|
12
14
|
|
|
13
15
|
```bash
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> Spec-driven development framework for multi-stack projects. Turns feature requests into implementation-ready code through structured, AI-orchestrated phases.
|
|
4
4
|
|
|
5
5
|
**Package:** `@polymorphism-tech/morph-spec`
|
|
6
|
-
**Version:** 10.
|
|
6
|
+
**Version:** 10.2.0
|
|
7
7
|
**Requires:** Node.js 22+, Claude Code
|
|
8
8
|
|
|
9
9
|
---
|
|
@@ -115,7 +115,7 @@ In `trust: "auto"` mode (default), gates auto-pass without risk signals. See `fr
|
|
|
115
115
|
Check gate status:
|
|
116
116
|
|
|
117
117
|
```bash
|
|
118
|
-
morph-spec
|
|
118
|
+
morph-spec status {feature}
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
---
|
|
@@ -165,7 +165,6 @@ morph-spec fleet # Every active feature (root + wor
|
|
|
165
165
|
morph-spec status {feature} # Feature status dashboard
|
|
166
166
|
morph-spec approve {feature} {gate} # Approve a phase gate (plan, uiux, review)
|
|
167
167
|
morph-spec advance {feature} # Approve the current gate and scaffold the next phase folder
|
|
168
|
-
morph-spec approval-status {feature} # Show approval status for all gates
|
|
169
168
|
morph-spec finish {feature} --pr|--merge # Close a feature: archive + integrate (PR or local merge) + teardown
|
|
170
169
|
morph-spec archive {feature} # Archive WITHOUT integrating (legacy feature / cleanup)
|
|
171
170
|
```
|
|
@@ -177,9 +176,6 @@ Progress within a feature is the slice reports `3-implement/reports/F{n}.md`: ab
|
|
|
177
176
|
### Validation
|
|
178
177
|
|
|
179
178
|
```bash
|
|
180
|
-
morph-spec validate # Run all validators
|
|
181
|
-
morph-spec validate {validator} # Run specific validator
|
|
182
|
-
morph-spec validate-feature {feature} # Content-aware feature validation
|
|
183
179
|
morph-spec verify {feature} # Deterministic build+tests+validators chain, before the LLM judge
|
|
184
180
|
```
|
|
185
181
|
|
|
@@ -380,4 +376,4 @@ Code generated by morph-spec (contracts, templates, implementation output) belon
|
|
|
380
376
|
|
|
381
377
|
---
|
|
382
378
|
|
|
383
|
-
*morph-spec v10.
|
|
379
|
+
*morph-spec v10.2.0 by [Polymorphism Tech](https://polymorphism.tech)*
|
package/bin/morph-spec.js
CHANGED
|
@@ -35,7 +35,6 @@ const stackSetCommand = lazy('../src/commands/project/stack-set.js', 'stackSetCo
|
|
|
35
35
|
const testsAuditCommand = lazy('../src/commands/validation/tests-audit.js', 'testsAuditCommand');
|
|
36
36
|
|
|
37
37
|
const approveCommand = lazy('../src/commands/state/approve.js', 'approveCommand');
|
|
38
|
-
const approvalStatusCommand = lazy('../src/commands/state/approve.js', 'approvalStatusCommand');
|
|
39
38
|
const unapproveCommand = lazy('../src/commands/state/approve.js', 'unapproveCommand');
|
|
40
39
|
const advanceCommand = lazy('../src/commands/state/advance.js', 'advanceCommand');
|
|
41
40
|
const archiveCommand = lazy('../src/commands/state/archive.js', 'archiveCommand');
|
|
@@ -55,8 +54,6 @@ const graphAffectedCommand = lazy('../src/commands/graph/affected.js', 'graphAff
|
|
|
55
54
|
const graphExplainCommand = lazy('../src/commands/graph/explain.js', 'graphExplainCommand');
|
|
56
55
|
const graphDiffCommand = lazy('../src/commands/graph/diff.js', 'graphDiffCommand');
|
|
57
56
|
|
|
58
|
-
const validateCommand = lazy('./validate.js', 'validateCommand');
|
|
59
|
-
const validateFeatureCommand = lazy('../src/commands/validation/validate-feature.js', 'validateFeatureCommand');
|
|
60
57
|
const verifyCommand = lazy('../src/commands/validation/verify.js', 'verifyCommand');
|
|
61
58
|
const e2eUpCommand = lazy('../src/commands/e2e/e2e.js', 'e2eUpCommand');
|
|
62
59
|
const e2eStatusCommand = lazy('../src/commands/e2e/e2e.js', 'e2eStatusCommand');
|
|
@@ -72,7 +69,6 @@ const contextRefreshCommand = lazy('../src/commands/context/context-refresh.js',
|
|
|
72
69
|
|
|
73
70
|
const dashboardCommand = lazy('../src/commands/dashboard/dashboard.js', 'dashboardCommand');
|
|
74
71
|
|
|
75
|
-
const telemetryCommand = lazy('../src/commands/observability/telemetry.js', 'telemetryCommand');
|
|
76
72
|
const costCommand = lazy('../src/commands/observability/cost.js', 'costCommand');
|
|
77
73
|
|
|
78
74
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -216,12 +212,6 @@ program
|
|
|
216
212
|
.option('--json', 'Output as JSON')
|
|
217
213
|
.action((feature, options) => deleteCommand(feature, options));
|
|
218
214
|
|
|
219
|
-
program
|
|
220
|
-
.command('approval-status <feature>')
|
|
221
|
-
.description('Show approval status for all gates')
|
|
222
|
-
.option('--json', 'Output as JSON')
|
|
223
|
-
.action((feature, options) => approvalStatusCommand(feature, options));
|
|
224
|
-
|
|
225
215
|
program
|
|
226
216
|
.command('unapprove <feature> <gate>')
|
|
227
217
|
.description('Revoke a phase gate approval (recovery only)')
|
|
@@ -324,29 +314,6 @@ graphCommand
|
|
|
324
314
|
.option('--json', 'Output as JSON')
|
|
325
315
|
.action((options) => graphDiffCommand(options));
|
|
326
316
|
|
|
327
|
-
program
|
|
328
|
-
.command('validate [validator]')
|
|
329
|
-
.description('Run project validations (all | packages | next-components | spec-tasks)')
|
|
330
|
-
.option('-v, --verbose', 'Show detailed output')
|
|
331
|
-
.option('--auto-fix, --fix', 'Auto-fix issues where possible')
|
|
332
|
-
.option('--no-fail', 'Don\'t exit with error code')
|
|
333
|
-
.action((validator, options) => {
|
|
334
|
-
const args = validator ? [validator] : ['all'];
|
|
335
|
-
if (options.verbose) args.push('--verbose');
|
|
336
|
-
if (options.autoFix) args.push('--auto-fix');
|
|
337
|
-
if (options.noFail) args.push('--no-fail');
|
|
338
|
-
validateCommand(args);
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
program
|
|
342
|
-
.command('validate-feature <feature>')
|
|
343
|
-
.alias('vf')
|
|
344
|
-
.description('Content-aware validation of feature outputs (sections, schema, contracts)')
|
|
345
|
-
.option('--phase <phase>', 'Validate outputs for a specific phase')
|
|
346
|
-
.option('--json', 'Output as JSON')
|
|
347
|
-
.option('-v, --verbose', 'Show detailed output')
|
|
348
|
-
.action(validateFeatureCommand);
|
|
349
|
-
|
|
350
317
|
program
|
|
351
318
|
.command('verify <feature>')
|
|
352
319
|
.description('Run the deterministic verification chain (build + tests + validators + e2e) — code before the LLM judge')
|
|
@@ -361,6 +328,7 @@ program
|
|
|
361
328
|
.option('--skip-build', 'Skip the build node. The run is partial, so the verification stamp is NOT written (reason "skip-build")')
|
|
362
329
|
.option('--skip-e2e', 'Skip the e2e node (Docker bring-up + Playwright)')
|
|
363
330
|
.option('--fresh-e2e', 'Recreate the e2e stack from scratch: down -v (named volumes included), drop the freshness stamp, rebuild, re-seed auth')
|
|
331
|
+
.option('--fresh', 'Run every node again, ignoring the green nodes of an earlier run on this same tree. Use it when something outside the tree changed (.env, database, tool version)')
|
|
364
332
|
.option('--no-persist', 'Do not persist the result to feature.json')
|
|
365
333
|
.option('--ci', 'Push morph/<feature> and take the proof from the project CI (creates .github/workflows/morph-verify.yml when no workflow runs verify). Same stamp, source "ci". No GitHub/gh/workflow = local verify with the reason; uncommitted code = exit 2; CI still running after 50 min = exit 3, no stamp')
|
|
366
334
|
.action((feature, options) =>
|
|
@@ -593,14 +561,6 @@ program
|
|
|
593
561
|
.option('--no-open', 'Don\'t auto-open browser')
|
|
594
562
|
.action(dashboardCommand);
|
|
595
563
|
|
|
596
|
-
program
|
|
597
|
-
.command('telemetry')
|
|
598
|
-
.description('Summarize the harness execution path from .morph/logs/events.jsonl (skills, personas, standards read, tool mix, prompts)')
|
|
599
|
-
.option('--json', 'Output the aggregate as JSON')
|
|
600
|
-
.option('--feature <name>', 'Narrow the summary to a single feature')
|
|
601
|
-
.option('--limit <n>', 'How many recent prompts to show (default 10)', (v) => parseInt(v, 10))
|
|
602
|
-
.action((options) => telemetryCommand(options));
|
|
603
|
-
|
|
604
564
|
program
|
|
605
565
|
.command('cost [feature]')
|
|
606
566
|
.description('Cost-facing view over .morph/logs/events.jsonl: bytes re-ingested by kind (proxy, not tokens), dispatch counts, real tokens when observed')
|
package/claude-plugin.json
CHANGED
package/docs/CHEATSHEET.md
CHANGED
|
@@ -23,18 +23,17 @@ morph-spec --version
|
|
|
23
23
|
## Phase workflow
|
|
24
24
|
|
|
25
25
|
```
|
|
26
|
-
|
|
26
|
+
plan → [uiux] → implement → review
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
`uiux` is optional
|
|
29
|
+
`uiux` is optional and runs after the plan gate. Which phases actually run for a given feature is also shaped by its **work type** (see below): a `chore` writes a short plan and goes straight to implement, a `hotfix` follows its own path.
|
|
30
30
|
|
|
31
31
|
| Phase | Folder | Gate |
|
|
32
32
|
|-------|--------|------|
|
|
33
|
-
|
|
|
34
|
-
| uiux *(optional)* | `1-design/` | ✅ |
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
| review | `4-review/` | ✅ Gate 3 |
|
|
33
|
+
| plan | `2-plan/` | ✅ `plan` (`plan.md` + `checks.json`) |
|
|
34
|
+
| uiux *(optional)* | `1-design/` | ✅ `uiux` |
|
|
35
|
+
| implement | `3-implement/` | — (one row per `Cn` in `report.md`) |
|
|
36
|
+
| review | `4-review/` | ✅ `review` (Gate 3) |
|
|
38
37
|
|
|
39
38
|
---
|
|
40
39
|
|
|
@@ -42,9 +41,9 @@ proposal → [uiux] → plan → implement → review
|
|
|
42
41
|
|
|
43
42
|
| Command | Purpose |
|
|
44
43
|
|---------|---------|
|
|
45
|
-
| `/morph-
|
|
46
|
-
| `/morph-hotfix {feature}` |
|
|
47
|
-
| `/morph-apply {feature}` |
|
|
44
|
+
| `/morph-plan {feature or issue link}` | From a request to the approved plan: routes by work type (`feature`/`bug`/`chore`/`hotfix`), opens with a thesis against the code |
|
|
45
|
+
| `/morph-hotfix {feature}` | Production incident: surgical fix, Gate 3 always human |
|
|
46
|
+
| `/morph-apply {feature}` | Implements the whole plan, runs `verify` and Gate 3, closes with `finish` |
|
|
48
47
|
| `/morph-status [feature]` | Status of the active (or specified) feature |
|
|
49
48
|
| `/morph-archive {feature}` | Archive **without integrating** (legacy feature / cleanup) — normal close is `morph-spec finish --pr\|--merge` |
|
|
50
49
|
| `/morph-preflight` | Pre-deploy validation (specs, contracts, tests, infra) |
|
|
@@ -57,7 +56,6 @@ proposal → [uiux] → plan → implement → review
|
|
|
57
56
|
```bash
|
|
58
57
|
morph-spec approve {feature} {gate} [--mode auto] [--approver name] [--notes text]
|
|
59
58
|
morph-spec advance {feature} [--design] # approve current gate + scaffold next phase folder in one step
|
|
60
|
-
morph-spec approval-status {feature} [--json]
|
|
61
59
|
morph-spec unapprove {feature} {gate} [--reason text] # recovery only
|
|
62
60
|
morph-spec finish {feature} --pr|--merge [--push] [--keep] [--force] [--discard-ignored] # normal close: archive + integrate + teardown
|
|
63
61
|
morph-spec archive {feature} [--force] [--no-git] # archive WITHOUT integrating (legacy feature / cleanup)
|
|
@@ -69,14 +67,15 @@ morph-spec archive {feature} [--force] [--no-git] # archive WITHOUT integ
|
|
|
69
67
|
|
|
70
68
|
## CLI — feature birth & work-type routing
|
|
71
69
|
|
|
72
|
-
Every feature is born with a **work type** that dimensions its pipeline: `feature` (full
|
|
70
|
+
Every feature is born with a **work type** that dimensions its pipeline: `feature` (full plan → [uiux] → implement → review), `bug` (same flow, lean plan), `chore` (short plan, straight to implement), `hotfix` (surgical fix, human Gate 3 always, even under `trust: auto`).
|
|
73
71
|
|
|
74
|
-
Every feature is also born with an **identity**:
|
|
72
|
+
Every feature is also born with an **identity**: a description is required (`create` refuses a nameless scaffold without it), `name` defaults to the slug. `--request` is kept literally in `feature.json → description`, and the plan critique checks the plan against it.
|
|
75
73
|
|
|
76
74
|
```bash
|
|
75
|
+
morph-spec create {feature} --request '<free text>' # detector classifies the type AND seeds the description
|
|
76
|
+
morph-spec create {feature} --type <t> --request '<title> <url>' # issue link: the type is picked, the body stays out of the argument
|
|
77
77
|
morph-spec create {feature} --type feature|bug|chore|hotfix --description "<what/why>"
|
|
78
|
-
morph-spec
|
|
79
|
-
morph-spec retype {feature} {newType} # change type mid-flight (blocked after Gate 3)
|
|
78
|
+
morph-spec retype {feature} {newType} # change type mid-flight (blocked after Gate 3)
|
|
80
79
|
```
|
|
81
80
|
|
|
82
81
|
---
|
|
@@ -84,7 +83,9 @@ morph-spec retype {feature} {newType} # change type mid-flig
|
|
|
84
83
|
## CLI — state (server-side, timestamped)
|
|
85
84
|
|
|
86
85
|
```bash
|
|
87
|
-
morph-spec
|
|
86
|
+
morph-spec next {feature} [--json] # the next step, decided from disk
|
|
87
|
+
morph-spec gate-check {feature} {gate} [--json] # decide + record whether the gate pauses
|
|
88
|
+
morph-spec gate-decision {feature} {gate} --pause <bool> [--reason] [--signals json] # writes gateDecisions by hand
|
|
88
89
|
```
|
|
89
90
|
|
|
90
91
|
Never hand-edit `gateDecisions`/`approvalGates` in `feature.json` — always go through these commands (they collide with the `state-sync` hook otherwise).
|
|
@@ -94,25 +95,16 @@ Never hand-edit `gateDecisions`/`approvalGates` in `feature.json` — always go
|
|
|
94
95
|
## CLI — validation
|
|
95
96
|
|
|
96
97
|
```bash
|
|
97
|
-
morph-spec
|
|
98
|
-
morph-spec
|
|
99
|
-
morph-spec
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
## CLI — DAG
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
morph-spec dag {feature} [--json] # sequential vs parallel dispatch decision (effort-weighted)
|
|
108
|
-
morph-spec dag {feature} --mermaid # emit the tasks.json DAG as a Mermaid flowchart
|
|
98
|
+
morph-spec plan-check {feature} [--json] # validate plan.md, write checks.json
|
|
99
|
+
morph-spec verify {feature} [--json] [--filter <ids>] [--skip-tests] [--skip-build] [--skip-e2e] # deterministic build+test+validator+e2e chain; the gate reads the unfiltered run
|
|
100
|
+
morph-spec report-check {feature} [--before-eval] [--json] # state of the implement and of the Gate 3 reports
|
|
109
101
|
```
|
|
110
102
|
|
|
111
103
|
---
|
|
112
104
|
|
|
113
105
|
## CLI — worktrees (parallel development / fleet)
|
|
114
106
|
|
|
115
|
-
One feature = one git worktree = one Claude Code instance. Each worktree gets its own deterministic port block (`.morph/worktree.env`)
|
|
107
|
+
One feature = one git worktree = one Claude Code instance. Each worktree gets its own deterministic port block (`.morph/worktree.env`).
|
|
116
108
|
|
|
117
109
|
```bash
|
|
118
110
|
morph-spec create {feature} --description "<what/why>" --worktree # birth the feature already isolated in its own worktree
|
|
@@ -120,9 +112,8 @@ morph-spec worktree setup {feature} # create worktrees/{feature}/ on bran
|
|
|
120
112
|
morph-spec worktree link [--all] # relink shared infra (node_modules[, .claude, .morph/framework])
|
|
121
113
|
morph-spec worktree list [--json] # active feature worktrees with phase/gate status
|
|
122
114
|
# Close a worktree feature with `morph-spec finish {feature} --pr|--merge` (see above) — it absorbed `worktree finish`.
|
|
123
|
-
morph-spec handoff {feature} [--json] [--here] # regenerate the handoff doc — resolves the owning tree and writes THERE, safe to run from the root
|
|
124
115
|
morph-spec doctor --worktrees [--prune] # reconcile git's registry × disk × features; --prune also clears a dangling root worktree.path pointer
|
|
125
|
-
morph-spec fleet [--json] # every active feature (root + worktrees) with phase/gates/ports/
|
|
116
|
+
morph-spec fleet [--json] # every active feature (root + worktrees) with phase/gates/ports/activity
|
|
126
117
|
```
|
|
127
118
|
|
|
128
119
|
---
|
|
@@ -145,14 +136,13 @@ morph-spec dashboard [--port 3200] # open the ins
|
|
|
145
136
|
.morph/
|
|
146
137
|
├── config/config.json # project config (editable)
|
|
147
138
|
├── framework/ # READ-ONLY
|
|
148
|
-
│ ├── agents.json #
|
|
139
|
+
│ ├── agents.json # the 3 Gate 3 personas
|
|
149
140
|
│ ├── standards/ # standards registry
|
|
150
|
-
│ └──
|
|
141
|
+
│ └── CLI.md # every command in detail
|
|
151
142
|
├── context/ # project context (editable)
|
|
152
143
|
├── features/{feature}/
|
|
153
144
|
│ ├── feature.json # authoritative, committed
|
|
154
|
-
│
|
|
155
|
-
│ └── 0-proposal/ 1-design/ 2-plan/ 3-implement/ 4-review/
|
|
145
|
+
│ └── 1-design/ 2-plan/ 3-implement/ 4-review/
|
|
156
146
|
└── state.json # gitignored, derived index — never hand-edited
|
|
157
147
|
|
|
158
148
|
.claude/
|
|
@@ -171,18 +161,17 @@ Never edited directly — go through CLI commands or `morph-spec update` instead
|
|
|
171
161
|
| Path | Protected by |
|
|
172
162
|
|------|-------------|
|
|
173
163
|
| `.morph/state.json`, `.morph/framework/**` | `permissions.deny` |
|
|
174
|
-
| `
|
|
164
|
+
| `2-plan/checks.json`, and the body of `2-plan/plan.md` after the plan gate (only `## Errata` is appended) | `protect-spec-files` hook |
|
|
175
165
|
|
|
176
166
|
---
|
|
177
167
|
|
|
178
168
|
## Links
|
|
179
169
|
|
|
180
170
|
- [QUICKSTART.md](QUICKSTART.md) — step-by-step guide
|
|
181
|
-
- [ARCHITECTURE.md](ARCHITECTURE.md) — system design
|
|
182
171
|
- [CHANGELOG.md](../CHANGELOG.md) — release history
|
|
183
172
|
- [npm](https://www.npmjs.com/package/@polymorphism-tech/morph-spec)
|
|
184
173
|
- support@polymorphism.com.br
|
|
185
174
|
|
|
186
175
|
---
|
|
187
176
|
|
|
188
|
-
*morph-spec v10.
|
|
177
|
+
*morph-spec v10.2.0 by Polymorphism Tech*
|
package/docs/QUICKSTART.md
CHANGED
|
@@ -1,82 +1,47 @@
|
|
|
1
1
|
# morph-spec Quick Start
|
|
2
2
|
|
|
3
|
+
One page: install, run `doctor`, paste the issue, open the PR.
|
|
4
|
+
|
|
3
5
|
## Install
|
|
4
6
|
|
|
5
7
|
```bash
|
|
6
8
|
npm install -g @polymorphism-tech/morph-spec@latest --prefer-online
|
|
7
9
|
```
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
---
|
|
11
|
+
If `morph-spec` is not found on Windows, open a new terminal window.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Set up the project
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
From the project root:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
morph-spec init
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
`init` does the following:
|
|
22
|
-
- Auto-detects your stack (.NET, Next.js, Node.js, monorepo)
|
|
23
|
-
- Creates `.morph/` with framework files, standards, and templates
|
|
24
|
-
- Creates `.morph/context/` with inferred project context
|
|
25
|
-
- Installs `.claude/skills/`, `.claude/agents/`, `.claude/rules/`
|
|
26
|
-
- Writes `.claude/settings.local.json` with the fail-open Claude Code hooks (see `docs/ARCHITECTURE.md`)
|
|
27
|
-
- Copies `CLAUDE.md` with runtime instructions
|
|
28
|
-
|
|
29
|
-
Verify the installation:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
19
|
morph-spec doctor
|
|
33
20
|
```
|
|
34
21
|
|
|
35
|
-
|
|
22
|
+
`init` installs the harness into `.morph/` and `.claude/`. `doctor` is your first debugging step: it reports version mismatches, missing files and hook problems.
|
|
36
23
|
|
|
37
|
-
##
|
|
24
|
+
## Paste the issue
|
|
38
25
|
|
|
39
|
-
Open
|
|
26
|
+
Open the project in Claude Code and paste the link:
|
|
40
27
|
|
|
41
28
|
```
|
|
42
|
-
/morph-
|
|
29
|
+
/morph-plan https://github.com/your-org/your-repo/issues/123
|
|
43
30
|
```
|
|
44
31
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
The proposal pipeline runs the `proposal` and `plan` phases (plus the optional `uiux` phase), with an approval gate at each:
|
|
48
|
-
|
|
49
|
-
### Proposal (Gate 1)
|
|
32
|
+
A free-text request works too: `/morph-plan user-notifications`, then describe what you want.
|
|
50
33
|
|
|
51
|
-
Claude
|
|
34
|
+
Claude reads the issue, checks it against the code and opens with a thesis: "asks for X; the code shows Y; I propose Z". There is no process question. How much it asks depends on what is at stake:
|
|
52
35
|
|
|
53
|
-
|
|
36
|
+
| The request is | What happens |
|
|
37
|
+
|---|---|
|
|
38
|
+
| clear and matches the code | a one-line thesis, then it moves on |
|
|
39
|
+
| missing something, or contradicts the code | up to 3 challenges, each with evidence |
|
|
40
|
+
| unclear about the outcome, or high risk | a full interview with you |
|
|
54
41
|
|
|
55
|
-
|
|
56
|
-
- `design-system.md` — colors, typography, spacing
|
|
57
|
-
- `mockups.md` — ASCII wireframes
|
|
58
|
-
- `components.md` — component specs
|
|
59
|
-
- `flows.md` — user flows and edge cases
|
|
42
|
+
The result is `2-plan/plan.md`: the problem, the outcome sought, what is out of scope, and the scenarios `C1..Cn` that define done. Read `## Padrões assumidos` at the end: to veto a default, tell Claude its number before implementing.
|
|
60
43
|
|
|
61
|
-
You approve the
|
|
62
|
-
|
|
63
|
-
### Plan (Gate 2)
|
|
64
|
-
|
|
65
|
-
Claude produces, under `2-plan/`:
|
|
66
|
-
- `usecases/UC-*.md` — the behavior, with postconditions observable in a test
|
|
67
|
-
- `spec.md` — architecture, contracts and the `## Contrato de implementação` section (standards, runtime verification)
|
|
68
|
-
- `tasks.json` — ordered task breakdown (`T001`, `T002`, …)
|
|
69
|
-
- `decisions.md` — architectural decision records (optional)
|
|
70
|
-
|
|
71
|
-
Claude identifies ambiguities in the spec and resolves them with you before finalizing. You review and approve the use cases, spec and task list together.
|
|
72
|
-
|
|
73
|
-
At this point, planning is complete:
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
✅ Planning complete — run /morph-apply my-feature to implement
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
---
|
|
44
|
+
You approve the gates yourself. If you have a question about the issue, ask the person who wrote it.
|
|
80
45
|
|
|
81
46
|
## Implement
|
|
82
47
|
|
|
@@ -84,169 +49,44 @@ At this point, planning is complete:
|
|
|
84
49
|
/morph-apply my-feature
|
|
85
50
|
```
|
|
86
51
|
|
|
87
|
-
Claude
|
|
88
|
-
- Records task progress in `tasks.json`, writing the mutable `status`/`outputs`/`notes` fields
|
|
89
|
-
- Runs the validators relevant to your stack after each task (e.g. `architecture`/`packages`/`contract-compliance` for .NET, `nextjs-component`/`css`/`design-system` for Next.js) via `morph-spec verify`
|
|
90
|
-
- Closes each task when `verify` is green and every `doneCriteria` has the evidence that proves it — red triggers an autonomous correction loop, not a pause
|
|
91
|
-
- Generates `3-implement/recap.md` on completion, then Gate 3 review (`4-review/`)
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## During development
|
|
96
|
-
|
|
97
|
-
Check feature state:
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
morph-spec status my-feature
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Approve the current gate and scaffold the next phase folder in one step:
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
morph-spec advance my-feature
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Task progress is recorded in `tasks.json` — Claude writes the mutable `status`/`outputs`/`notes` fields directly, and there is no separate CLI command for marking a task done.
|
|
110
|
-
|
|
111
|
-
Run validators at any time:
|
|
52
|
+
Claude implements the whole plan in one session, tracks each scenario in `3-implement/report.md`, runs `verify`, and dispatches the Gate 3 reviewers in fresh context. If a discovery makes the outcome sought false, it stops and asks you.
|
|
112
53
|
|
|
113
|
-
|
|
114
|
-
morph-spec validate # all validators
|
|
115
|
-
morph-spec validate architecture # specific validator
|
|
116
|
-
morph-spec validate packages
|
|
117
|
-
```
|
|
54
|
+
## Open the PR
|
|
118
55
|
|
|
119
|
-
|
|
56
|
+
When Gate 3 passes, Claude asks how to integrate. You can also run it yourself:
|
|
120
57
|
|
|
121
58
|
```bash
|
|
122
|
-
morph-spec
|
|
123
|
-
morph-spec verify my-feature T001 # scoped to one task
|
|
59
|
+
morph-spec finish my-feature --pr
|
|
124
60
|
```
|
|
125
61
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
## Work-type routing
|
|
129
|
-
|
|
130
|
-
Not every change needs the full pipeline walked above. Every feature is born with a **work type** that dimensions its pipeline:
|
|
62
|
+
`finish` archives the feature, pushes `morph/my-feature` and opens the PR.
|
|
131
63
|
|
|
132
|
-
|
|
64
|
+
## Along the way
|
|
133
65
|
|
|
134
66
|
```bash
|
|
135
|
-
|
|
136
|
-
morph-spec
|
|
137
|
-
#
|
|
138
|
-
morph-spec create my-fix --type bug --description "what broke"
|
|
139
|
-
# chore: skips straight to implement (Gates 1/2 stamped by policy)
|
|
140
|
-
morph-spec create my-chore --type chore --description "the tidy-up"
|
|
141
|
-
# hotfix: scout → surgical fix → test loop; Gate 3 always pauses for a human
|
|
142
|
-
morph-spec create my-hotfix --type hotfix --description "the incident"
|
|
67
|
+
morph-spec next my-feature # what happens next, read from disk
|
|
68
|
+
morph-spec status my-feature # phase, gates and progress
|
|
69
|
+
morph-spec fleet # every active feature
|
|
143
70
|
```
|
|
144
71
|
|
|
145
|
-
|
|
72
|
+
Picked up a session mid-feature? Run `/morph-apply my-feature`. It resumes from `3-implement/report.md`.
|
|
146
73
|
|
|
147
|
-
|
|
148
|
-
morph-spec create my-feature --request "produção caiu, corrigir urgente"
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
Change the type later if it turns out to be wrong (blocked after Gate 3):
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
morph-spec retype my-feature hotfix --reason "escalated to production incident"
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
Production incidents run through the dedicated `/morph-hotfix my-feature` slash command instead of `/morph-proposal`.
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
## Parallel development with worktrees
|
|
162
|
-
|
|
163
|
-
Independent features can be developed in parallel, each isolated in its own git worktree — one feature, one worktree, one Claude Code instance:
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
morph-spec create my-feature --description "what & why" --worktree # birth the feature already isolated
|
|
167
|
-
# or, for an existing feature:
|
|
168
|
-
morph-spec worktree setup my-feature # creates worktrees/my-feature/ on branch morph/my-feature
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
Open the new worktree directory in its own Claude Code instance and work normally — a SessionStart hook injects the worktree's feature identity into context automatically. When the feature is done (Gate 3 approved), close it in one step:
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
morph-spec finish my-feature --merge # archive + merge --no-ff into the default branch (local), tear down the worktree
|
|
175
|
-
# or, to open a PR instead of merging locally:
|
|
176
|
-
morph-spec finish my-feature --pr # archive + push morph/my-feature + gh pr create (keeps the branch the PR needs)
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
`finish` archives the feature (committing the move inside `morph/my-feature`) *and* integrates *and* tears down the worktree in one step — it replaces the old `worktree finish` + separate `archive`. The same command closes features developed **without** a worktree (they're born on `morph/{feature}` too).
|
|
180
|
-
|
|
181
|
-
List every active worktree with its phase and gate status:
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
morph-spec worktree list
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
---
|
|
188
|
-
|
|
189
|
-
## Multiple features
|
|
190
|
-
|
|
191
|
-
You can have multiple features in progress simultaneously. Each has its own directory under `.morph/features/`, with its own committed `feature.json`:
|
|
192
|
-
|
|
193
|
-
```
|
|
194
|
-
.morph/features/
|
|
195
|
-
├── user-notifications/
|
|
196
|
-
│ ├── feature.json
|
|
197
|
-
│ ├── 0-proposal/
|
|
198
|
-
│ └── 2-plan/
|
|
199
|
-
└── payment-flow/
|
|
200
|
-
├── feature.json
|
|
201
|
-
└── 0-proposal/
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
See every active feature — root and worktrees — with phase, gates, and activity:
|
|
205
|
-
|
|
206
|
-
```bash
|
|
207
|
-
morph-spec fleet
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
---
|
|
74
|
+
Not everything needs the full flow. `/morph-plan` routes by work type: `feature` and `bug` run the whole flow, `chore` writes a short plan and goes straight to implementation. For a production incident, use `/morph-hotfix my-feature`: Gate 3 always stops for a human.
|
|
211
75
|
|
|
212
76
|
## Keeping up to date
|
|
213
77
|
|
|
214
|
-
When a new version of `@polymorphism-tech/morph-spec` is published:
|
|
215
|
-
|
|
216
78
|
```bash
|
|
217
|
-
# Update the CLI (--prefer-online bypasses the ~5 min local packument cache)
|
|
218
79
|
npm install -g @polymorphism-tech/morph-spec@latest --prefer-online
|
|
219
|
-
|
|
220
|
-
# Update framework files in your project
|
|
221
80
|
morph-spec update
|
|
222
|
-
|
|
223
|
-
# Verify
|
|
224
81
|
morph-spec doctor
|
|
225
82
|
```
|
|
226
83
|
|
|
227
|
-
`morph-spec update` re-syncs `.morph/framework/`, `.claude/skills/`, `.claude/agents/`, `.claude/rules/`, and `CLAUDE.md`. It does not touch your config, context, or feature outputs.
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
## Tips
|
|
232
|
-
|
|
233
|
-
**Use `/morph-proposal` even for small features.** The proposal phase catches scope creep, identifies the right agents, and generates contracts early — before implementation makes it expensive to change direction.
|
|
234
|
-
|
|
235
|
-
**Approve explicitly at each gate.** The design gate exists to prevent implementing the wrong thing. If something in `spec.md` or `contracts.cs` looks off, say so before approving.
|
|
236
|
-
|
|
237
|
-
**ADRs belong in `decisions.md`.** When Claude makes an architectural choice, it documents it there. Read it after Design completes. Decisions drive the validators that run during implementation.
|
|
238
|
-
|
|
239
|
-
**`morph-spec doctor` is your first debugging step.** If something is behaving unexpectedly, doctor will surface version mismatches, missing files, and hook configuration issues.
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
84
|
## Next steps
|
|
244
85
|
|
|
245
86
|
- [CHEATSHEET.md](CHEATSHEET.md) — command reference
|
|
246
|
-
-
|
|
87
|
+
- `.morph/framework/CLI.md` — every command in detail
|
|
247
88
|
- [CHANGELOG.md](../CHANGELOG.md) — release history
|
|
248
|
-
- `.morph/framework/standards/` — all coding and architecture standards
|
|
249
89
|
|
|
250
90
|
---
|
|
251
91
|
|
|
252
|
-
*morph-spec v10.
|
|
92
|
+
*morph-spec v10.2.0 by Polymorphism Tech*
|
package/framework/CLAUDE.md
CHANGED
|
@@ -22,7 +22,7 @@ Prefixo `morph-spec`; detalhe em `.morph/framework/CLI.md`.
|
|
|
22
22
|
|
|
23
23
|
| Comando | Para quê |
|
|
24
24
|
|---|---|
|
|
25
|
-
| `create <f> --request
|
|
25
|
+
| `create <f> --request '…' [--worktree]` | nasce a feature |
|
|
26
26
|
| `next <f>` | o próximo passo, do disco |
|
|
27
27
|
| `plan-check <f>` | valida o plano, grava `checks.json` |
|
|
28
28
|
| `gate-check <f> <gate>` / `approve` / `advance` | decide e aprova gates |
|
|
@@ -38,7 +38,7 @@ Prefixo `morph-spec`; detalhe em `.morph/framework/CLI.md`.
|
|
|
38
38
|
|
|
39
39
|
## Gate 3 (sub-agents)
|
|
40
40
|
|
|
41
|
-
`morph-verifier`, `morph-reviewer`, `morph-security` em `.claude/agents/`, gerados de `agents.json` — nunca edite à mão. Com a crítica do plano (`Plan` nativo, `morph-plan`), são os únicos sub-agents do fluxo; o resto é feito nesta sessão.
|
|
41
|
+
`morph-verifier`, `morph-reviewer`, `morph-security` em `.claude/agents/`, gerados de `agents.json` — nunca edite à mão. Com a crítica do plano (`Plan` nativo, `morph-plan`), são os únicos sub-agents do fluxo; o resto é feito nesta sessão. Do Gate 3, leia o relatório que gravam, não a mensagem final.
|
|
42
42
|
|
|
43
43
|
<!-- morph-agents:start -->
|
|
44
44
|
_Lista derivada na instalação. Bloco vazio → `morph-spec setup-infra --reinstall`._
|
package/framework/MORPH.md
CHANGED
|
@@ -15,7 +15,7 @@ Entre gates, você opera sozinho: faz o que `next` mandar (`implement`, `verify`
|
|
|
15
15
|
| `next` devolve `escalate` (3 verify vermelhos seguidos) | `AskUserQuestion`: aceitar, continuar ou parar. Nunca uma 4ª tentativa por conta própria |
|
|
16
16
|
| `verify` exit 3 | fila cheia, não vermelho: no máximo uma chamada nova |
|
|
17
17
|
|
|
18
|
-
Na abertura do plano vale o contrário: o
|
|
18
|
+
Na abertura do plano vale o contrário: confronte o pedido com o código e pergunte o que a tese não fecha. **A prova é o código:** `verify` prova o determinístico, o Gate 3 prova cada cenário `Cn`. Estilo é nota, nunca bloqueio.
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
@@ -40,7 +40,7 @@ Na abertura do plano vale o contrário: o modo entrevista pergunta até fechar o
|
|
|
40
40
|
|
|
41
41
|
### 2.1 Roteamento por tipo de trabalho
|
|
42
42
|
|
|
43
|
-
`morph-spec create <f> --request
|
|
43
|
+
`morph-spec create <f> --request '<pedido>'` (ou `--type <t> --request '…'`).
|
|
44
44
|
|
|
45
45
|
| Tipo | Pipeline | Gates |
|
|
46
46
|
| --- | --- | --- |
|
package/framework/agents.json
CHANGED
|
@@ -23,7 +23,7 @@ is idempotent: an already-archived feature is reported, not re-moved.
|
|
|
23
23
|
|
|
24
24
|
1. **Verify** the feature cleared Gate 3:
|
|
25
25
|
```
|
|
26
|
-
morph-spec
|
|
26
|
+
morph-spec status {feature} --verbose
|
|
27
27
|
```
|
|
28
28
|
Gate `review` must be `approved`. If not, stop and report what's missing (don't force it without
|
|
29
29
|
the user's say-so).
|