@polymorphism-tech/morph-spec 10.12.1 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +27 -57
- package/README.md +51 -340
- package/bin/morph-spec.js +22 -373
- package/docs/CHEATSHEET.md +37 -166
- package/docs/QUICKSTART.md +14 -74
- package/framework/CLAUDE.md +15 -26
- package/framework/MORPH.md +34 -101
- package/framework/agents.json +8 -8
- package/framework/commands/morph-apply.md +5 -5
- package/framework/commands/morph-infra.md +1 -1
- package/framework/docs/CLI.md +74 -886
- package/framework/evals/review-checklist.md +14 -14
- package/framework/hooks/README.md +21 -189
- package/framework/hooks/claude-code/core/README.md +2 -5
- package/framework/hooks/claude-code/core/conventional-commit.js +2 -2
- package/framework/hooks/claude-code/core/denylist.json +3 -3
- package/framework/hooks/claude-code/core/graph-refresh-kick.js +2 -2
- package/framework/hooks/claude-code/core/masked-exit.js +6 -6
- package/framework/hooks/claude-code/core/pre-bash-denylist.js +2 -2
- package/framework/hooks/claude-code/core/protect-spec-files.js +17 -61
- package/framework/hooks/claude-code/core/stack-changed.js +35 -0
- package/framework/hooks/claude-code/core/validate-completion.js +32 -87
- package/framework/hooks/shared/{heavy-command.js → command-kind.js} +6 -79
- package/framework/hooks/shared/command-tokens.js +0 -139
- package/framework/hooks/shared/contract.js +14 -0
- package/framework/hooks/shared/feature-slug.js +21 -0
- package/framework/hooks/shared/frontend-locations.js +0 -1
- package/framework/hooks/shared/git-paths.js +0 -15
- package/framework/hooks/shared/graph-freshness.js +0 -19
- package/framework/hooks/shared/hook-response.js +0 -7
- package/framework/hooks/shared/morph-cli.js +2 -81
- package/framework/hooks/shared/owner-words.js +2 -120
- package/framework/hooks/shared/payload-utils.js +0 -39
- package/framework/hooks/shared/report-progress.js +7 -101
- package/framework/hooks/statusline.js +16 -60
- package/framework/mcp/registry.json +2 -2
- package/framework/rules/ai-agents-standards.md +1 -1
- package/framework/rules/asaas-standards.md +1 -1
- package/framework/rules/ef-standards.md +1 -1
- package/framework/rules/gsap-standards.md +1 -1
- package/framework/rules/hangfire-standards.md +1 -1
- package/framework/rules/implement-report.md +3 -3
- package/framework/rules/neon-auth-standards.md +1 -1
- package/framework/rules/nextjs-standards.md +1 -1
- package/framework/rules/plan-grammar.md +13 -11
- package/framework/rules/resend-standards.md +1 -1
- package/framework/rules/ui-design.md +4 -0
- package/framework/schemas/config.schema.json +95 -310
- package/framework/skills/README.md +12 -32
- 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 +21 -46
- package/framework/skills/core/morph-plan/SKILL.md +28 -63
- package/framework/skills/core/morph-uiux/SKILL.md +23 -25
- package/framework/{templates/docs/ui-mockups.md → skills/core/morph-uiux/references/mockups.md} +4 -4
- package/framework/standards/STANDARDS.json +10 -11
- package/framework/standards/STANDARDS.meta.json +1 -1
- package/framework/standards/ai-agents/evals-with-cache.md +18 -32
- package/framework/standards/ai-agents/observability-patterns.md +2 -2
- package/framework/standards/architecture/code-comments.md +2 -5
- package/framework/standards/architecture/engineering-lens.md +1 -1
- package/framework/standards/backend/dotnet/testing.md +4 -4
- package/framework/standards/frontend/nextjs/lint.md +24 -10
- package/framework/standards/frontend/nextjs/testing.md +2 -2
- package/framework/standards/infrastructure/docker/local-compose-isolation.md +14 -30
- package/framework/templates/CLAUDE.md.core.guide.md +2 -2
- package/framework/templates/README.md +1 -1
- package/framework/templates/REGISTRY.json +3 -33
- package/framework/templates/docs/plan.md +3 -2
- package/framework/templates/dotnet/ai-kit/README.md +2 -4
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalCacheMissException.cs +1 -1
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalFixture.cs +1 -1
- package/package.json +1 -2
- package/src/commands/graph/explain.js +2 -1
- package/src/commands/graph/status.js +2 -1
- package/src/commands/mcp/mcp-setup.js +1 -2
- package/src/commands/project/doctor.js +5 -341
- package/src/commands/project/env.js +21 -52
- package/src/commands/project/init-contract.js +47 -0
- package/src/commands/project/init.js +36 -66
- package/src/commands/project/stack-scan.js +1 -1
- package/src/commands/project/update.js +15 -50
- package/src/commands/validation/check.js +128 -0
- package/src/commands/validation/plan-check.js +41 -64
- package/src/commands/validation/prove-red.js +1 -1
- package/src/core/paths/output-schema.js +0 -22
- package/src/core/templates/template-renderer.js +0 -14
- package/src/lib/ai/ai-project-scan.js +1 -6
- package/src/lib/check/attempts.js +38 -0
- package/src/lib/check/signals.js +145 -0
- package/src/lib/config/project-config.js +13 -0
- package/src/lib/contract/apply.js +62 -0
- package/src/lib/contract/defaults.js +96 -0
- package/src/lib/contract/merge.js +79 -0
- package/src/lib/contract/ports.js +43 -0
- package/src/lib/contract/scan.js +102 -0
- package/src/lib/detectors/claude-config-detector.js +7 -0
- package/src/lib/{procs → detectors}/mcp-config.js +1 -37
- package/src/lib/diff/diff-lines.js +64 -0
- package/src/lib/generators/architecture-scanner.js +1 -1
- package/src/lib/generators/scaffold-generator.js +0 -7
- package/src/lib/git/default-branch.js +0 -122
- package/src/lib/graph/diff-tree.js +2 -1
- package/src/lib/graph/god-nodes.js +2 -1
- package/src/lib/graph/graphify-runtime.js +0 -1
- package/src/lib/graph/graphifyignore.js +1 -1
- package/src/lib/graph/sanitize.js +2 -8
- package/src/lib/installers/memory-installer.js +15 -30
- package/src/lib/installers/stack-sync.js +16 -9
- package/src/lib/plan/checks.js +20 -64
- package/src/lib/plan/media.js +1 -1
- package/src/lib/plan/plan-parser.js +5 -5
- package/src/lib/review-reports.js +3 -77
- package/src/lib/scan/worktree-dirs.js +3 -0
- package/src/lib/specs/adr-index.js +2 -2
- package/src/lib/stack/dotnet-build-ignores.js +10 -2
- package/src/lib/stack/stack-scan.js +2 -2
- package/src/lib/stack-filter.js +3 -2
- package/src/lib/tests-audit/audit.js +1 -1
- package/src/scripts/setup-infra.js +6 -59
- package/src/utils/agents-installer.js +1 -34
- package/src/utils/atomic-json.js +27 -0
- package/src/utils/file-copier.js +4 -12
- package/src/utils/hooks-installer.js +9 -107
- package/claude-plugin.json +0 -14
- package/framework/commands/morph-archive.md +0 -46
- package/framework/commands/morph-hotfix.md +0 -17
- package/framework/commands/morph-preflight.md +0 -180
- package/framework/commands/morph-review.md +0 -15
- package/framework/commands/morph-status.md +0 -37
- package/framework/hooks/claude-code/core/block-destructive-worktree-removal.js +0 -80
- package/framework/hooks/claude-code/core/block-raw-worktree-add.js +0 -72
- package/framework/hooks/claude-code/core/enforce-phase-writes.js +0 -100
- package/framework/hooks/claude-code/core/gate-guard.js +0 -148
- package/framework/hooks/claude-code/core/heavy-gate.js +0 -78
- package/framework/hooks/claude-code/core/heavy-release.js +0 -23
- package/framework/hooks/claude-code/core/loop-detect.js +0 -79
- package/framework/hooks/claude-code/core/state-sync.js +0 -214
- package/framework/hooks/claude-code/core/telemetry-log.js +0 -259
- package/framework/hooks/claude-code/core/test-budget.js +0 -29
- package/framework/hooks/claude-code/core/worktree-context.js +0 -249
- package/framework/hooks/claude-code/core/worktree-create.js +0 -119
- package/framework/hooks/claude-code/core/worktree-env-inject.js +0 -68
- package/framework/hooks/claude-code/core/worktree-remove.js +0 -55
- package/framework/hooks/shared/build-check.js +0 -120
- package/framework/hooks/shared/claim-registry.js +0 -125
- package/framework/hooks/shared/e2e-check.js +0 -1022
- package/framework/hooks/shared/feature-locator.js +0 -82
- package/framework/hooks/shared/gate-event.js +0 -18
- package/framework/hooks/shared/gate-question.js +0 -20
- package/framework/hooks/shared/heavy-config.js +0 -113
- package/framework/hooks/shared/heavy-holders.js +0 -85
- package/framework/hooks/shared/heavy-slots.js +0 -280
- package/framework/hooks/shared/host-services.js +0 -440
- package/framework/hooks/shared/next-step.js +0 -181
- package/framework/hooks/shared/redact-secrets.js +0 -44
- package/framework/hooks/shared/reparse-scan.js +0 -40
- package/framework/hooks/shared/state-reader.js +0 -220
- package/framework/hooks/shared/state-writer.js +0 -112
- package/framework/hooks/shared/telemetry-logger.js +0 -101
- package/framework/hooks/shared/transcript-usage.js +0 -58
- package/framework/hooks/shared/worktree-root.js +0 -71
- package/framework/phases.json +0 -92
- package/framework/schemas/feature.schema.json +0 -242
- package/framework/skills/core/morph-apply/references/hotfix.md +0 -46
- package/framework/skills/core/morph-apply/references/machine.md +0 -30
- package/framework/skills/core/morph-apply/references/review.md +0 -77
- package/framework/skills/core/morph-plan/references/critique.md +0 -51
- package/framework/skills/core/morph-plan/references/interview.md +0 -37
- package/framework/templates/state.template.json +0 -17
- package/src/commands/dashboard/dashboard.js +0 -74
- package/src/commands/e2e/e2e.js +0 -400
- package/src/commands/observability/cost.js +0 -283
- package/src/commands/project/branch.js +0 -129
- package/src/commands/project/claim.js +0 -132
- package/src/commands/project/doctor-procs.js +0 -162
- package/src/commands/project/fleet.js +0 -66
- package/src/commands/project/heavy.js +0 -81
- package/src/commands/project/install-plugin-cmd.js +0 -27
- package/src/commands/project/status.js +0 -61
- package/src/commands/project/worktree.js +0 -1234
- package/src/commands/state/advance.js +0 -248
- package/src/commands/state/approve.js +0 -303
- package/src/commands/state/archive.js +0 -231
- package/src/commands/state/auto-approval.js +0 -67
- package/src/commands/state/create.js +0 -274
- package/src/commands/state/delete.js +0 -192
- package/src/commands/state/finish.js +0 -1247
- package/src/commands/state/gate-check.js +0 -244
- package/src/commands/state/gate-decision.js +0 -122
- package/src/commands/state/list.js +0 -244
- package/src/commands/state/next.js +0 -24
- package/src/commands/state/recap.js +0 -80
- package/src/commands/state/report-check.js +0 -244
- package/src/commands/state/retype.js +0 -110
- package/src/commands/validation/verify.js +0 -421
- package/src/core/state/feature-identity.js +0 -10
- package/src/core/state/gate-order.js +0 -23
- package/src/core/state/lifecycle-audit.js +0 -171
- package/src/core/state/state-manager.js +0 -523
- package/src/core/templates/template-seed.js +0 -21
- package/src/core/work-types.js +0 -44
- package/src/dashboard/app/App.jsx +0 -84
- package/src/dashboard/app/components/ActivityFeed.jsx +0 -166
- package/src/dashboard/app/components/CommandPalette.jsx +0 -144
- package/src/dashboard/app/components/DetailPanel.jsx +0 -43
- package/src/dashboard/app/components/EntityLink.jsx +0 -42
- package/src/dashboard/app/components/ErrorBoundary.jsx +0 -47
- package/src/dashboard/app/components/FlowGraph.jsx +0 -19
- package/src/dashboard/app/components/GatePauses.jsx +0 -116
- package/src/dashboard/app/components/KnowledgeMarkdown.jsx +0 -42
- package/src/dashboard/app/components/Markdown.jsx +0 -38
- package/src/dashboard/app/components/PhaseRail.jsx +0 -100
- package/src/dashboard/app/components/SearchFilter.jsx +0 -36
- package/src/dashboard/app/components/SessionMap.jsx +0 -77
- package/src/dashboard/app/components/Sidebar.jsx +0 -147
- package/src/dashboard/app/hooks/useMorphQuery.js +0 -44
- package/src/dashboard/app/hooks/usePref.js +0 -34
- package/src/dashboard/app/lib/format.js +0 -69
- package/src/dashboard/app/lib/phases.js +0 -75
- package/src/dashboard/app/lib/project.js +0 -38
- package/src/dashboard/app/main.jsx +0 -13
- package/src/dashboard/app/pages/Activity.jsx +0 -28
- package/src/dashboard/app/pages/AgentMap.jsx +0 -363
- package/src/dashboard/app/pages/FeatureDetail.jsx +0 -579
- package/src/dashboard/app/pages/Features.jsx +0 -393
- package/src/dashboard/app/pages/Guide.jsx +0 -145
- package/src/dashboard/app/pages/HookInspector.jsx +0 -444
- package/src/dashboard/app/pages/PhasePipeline.jsx +0 -273
- package/src/dashboard/app/pages/Portfolio.jsx +0 -190
- package/src/dashboard/app/pages/RulesMap.jsx +0 -285
- package/src/dashboard/app/pages/SkillsLibrary.jsx +0 -468
- package/src/dashboard/app/pages/Standards.jsx +0 -392
- package/src/dashboard/app/styles/index.css +0 -187
- package/src/dashboard/index.html +0 -14
- package/src/dashboard/package.json +0 -32
- package/src/dashboard/scanner/activity-scanner.js +0 -321
- package/src/dashboard/scanner/agents-scanner.js +0 -67
- package/src/dashboard/scanner/docs-scanner.js +0 -34
- package/src/dashboard/scanner/feature-status.js +0 -7
- package/src/dashboard/scanner/features-scanner.js +0 -397
- package/src/dashboard/scanner/hooks-scanner.js +0 -96
- package/src/dashboard/scanner/index.js +0 -21
- package/src/dashboard/scanner/phases-scanner.js +0 -14
- package/src/dashboard/scanner/portfolio.js +0 -129
- package/src/dashboard/scanner/project-api.js +0 -160
- package/src/dashboard/scanner/rules-scanner.js +0 -46
- package/src/dashboard/scanner/skills-scanner.js +0 -104
- package/src/dashboard/scanner/standards-scanner.js +0 -38
- package/src/dashboard/vite-plugin-morph-data.js +0 -120
- package/src/dashboard/vite.config.js +0 -26
- package/src/lib/ci/ci-verify.js +0 -30
- package/src/lib/ci/github-ci.js +0 -52
- package/src/lib/ci/pr-checks.js +0 -76
- package/src/lib/e2e/applicability.js +0 -39
- package/src/lib/e2e/compose-env.js +0 -80
- package/src/lib/e2e/stack-teardown.js +0 -96
- package/src/lib/git/branch-classifier.js +0 -104
- package/src/lib/git/evidence-staleness.js +0 -40
- package/src/lib/git/gh.js +0 -15
- package/src/lib/git/pending-prs.js +0 -58
- package/src/lib/git/pr-files.js +0 -31
- package/src/lib/git/pr-index.js +0 -39
- package/src/lib/git/tree-fingerprint.js +0 -58
- package/src/lib/git/tree-state.js +0 -125
- package/src/lib/heavy/cleanup.js +0 -72
- package/src/lib/heavy/gate.js +0 -168
- package/src/lib/heavy/live-stacks.js +0 -64
- package/src/lib/heavy/reclaim.js +0 -107
- package/src/lib/heavy/watchdog.js +0 -46
- package/src/lib/next-step.js +0 -12
- package/src/lib/plan/critique.js +0 -67
- package/src/lib/plan/plan-template.js +0 -18
- package/src/lib/procs/classify.js +0 -91
- package/src/lib/procs/list.js +0 -124
- package/src/lib/procs/prune.js +0 -47
- package/src/lib/procs/wslconfig.js +0 -70
- package/src/lib/projects/registry.js +0 -121
- package/src/lib/recap/piper.js +0 -36
- package/src/lib/recap/recap.js +0 -259
- package/src/lib/review-confirmation.js +0 -66
- package/src/lib/risk/diff-risk.js +0 -137
- package/src/lib/risk-detector.js +0 -638
- package/src/lib/specs/design-seed.js +0 -18
- package/src/lib/specs/screen-checklist.js +0 -315
- package/src/lib/stack/stack-profile.js +0 -69
- package/src/lib/tasks/eval-node.js +0 -293
- package/src/lib/tasks/linux-runner.js +0 -200
- package/src/lib/tasks/test-nodes.js +0 -414
- package/src/lib/tasks/test-runner.js +0 -569
- package/src/lib/telemetry/metrics.js +0 -384
- package/src/lib/telemetry/telemetry-reader.js +0 -276
- package/src/lib/telemetry/verify-event.js +0 -57
- package/src/lib/validators/code-budget/code-budget-validator.js +0 -170
- package/src/lib/validators/contracts/contract-compliance-validator.js +0 -219
- package/src/lib/validators/nextjs/next-component-validator.js +0 -142
- package/src/lib/validators/packages/package-validator.js +0 -310
- package/src/lib/validators/reuse/reuse-validator.js +0 -202
- package/src/lib/validators/reuse/symbol-scanner.js +0 -64
- package/src/lib/validators/validation-runner.js +0 -188
- package/src/lib/validators/verify-cache.js +0 -63
- package/src/lib/validators/verify-runner.js +0 -971
- package/src/lib/verify/affected.js +0 -143
- package/src/lib/verify/detached.js +0 -159
- package/src/lib/view/feature-html.js +0 -480
- package/src/lib/view/feature-page.client.js +0 -109
- package/src/lib/view/feature-page.css +0 -278
- package/src/lib/view/feature-view.js +0 -113
- package/src/lib/view/flow-layers.js +0 -79
- package/src/lib/view/flow-svg.js +0 -63
- package/src/lib/view/tokens.css +0 -18
- package/src/lib/work-type-detector.js +0 -81
- package/src/lib/worktree/dirs.js +0 -3
- package/src/lib/worktree/docker-audit.js +0 -175
- package/src/lib/worktree/env-allocator.js +0 -177
- package/src/lib/worktree/feature-truth.js +0 -145
- package/src/lib/worktree/finish-backup.js +0 -529
- package/src/lib/worktree/fleet-scanner.js +0 -223
- package/src/lib/worktree/ignored-triage.js +0 -136
- package/src/lib/worktree/vscode-settings.js +0 -112
- package/src/lib/worktree/worktree-audit.js +0 -323
- package/src/lib/worktree/worktree-include.js +0 -44
- package/src/scripts/install-plugin.js +0 -114
package/CLAUDE.md
CHANGED
|
@@ -4,19 +4,15 @@ This file provides guidance to Claude Code when working with code in **this repo
|
|
|
4
4
|
|
|
5
5
|
## What This Is
|
|
6
6
|
|
|
7
|
-
morph-spec is a
|
|
7
|
+
morph-spec is a harness CLI (`@polymorphism-tech/morph-spec`) that makes Claude Code write code well: a plan with scenarios `C1..Cn`, a red proof per scenario, review personas in fresh context, and a `## Resultado` an orchestrator reads. The CLI installs the harness (contract, skills, rules, personas, hooks) and owns the deterministic steps (`plan-check`, `prove-red`, `check`); Claude Code runs the flow from `framework/MORPH.md` and the core skills. It never orchestrates: worktrees, the Claude call and the PR belong to whoever runs it.
|
|
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`, `
|
|
11
|
+
**Do not run the morph-spec workflow here.** No `init`, `plan-check`, `prove-red`, `check` or `context refresh`, 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
12
|
|
|
13
13
|
## Build & Test Commands
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
# Once per clone: the dashboard render smoke test (test/dashboard/pages-smoke.test.js)
|
|
17
|
-
# needs the dashboard's own deps and FAILS without them — CI installs them too
|
|
18
|
-
cd src/dashboard && npm install
|
|
19
|
-
|
|
20
16
|
# Dev loop: only the test files the current change can reach (vs the merge-base with main)
|
|
21
17
|
npm run test:changed # add -- --list to see the selection and why
|
|
22
18
|
|
|
@@ -25,7 +21,7 @@ npm run test:changed # add -- --list to see the selection and why
|
|
|
25
21
|
npm test
|
|
26
22
|
|
|
27
23
|
# A subtree or file (still parallel); --test-concurrency=1 to debug serially
|
|
28
|
-
node scripts/run-tests.mjs test/
|
|
24
|
+
node scripts/run-tests.mjs test/commands/check.test.js
|
|
29
25
|
|
|
30
26
|
# Coverage
|
|
31
27
|
npm run test:coverage
|
|
@@ -43,58 +39,33 @@ No build step — pure ESM JavaScript, runs directly via Node.js 22+.
|
|
|
43
39
|
|
|
44
40
|
### Module Layout
|
|
45
41
|
|
|
46
|
-
- **`bin/morph-spec.js`** — Commander.js CLI entry point: install/inspect commands
|
|
47
|
-
- **`src/commands/`** — CLI command handlers
|
|
48
|
-
- **`src/core/`** —
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
- `
|
|
53
|
-
-
|
|
54
|
-
- `
|
|
55
|
-
- `
|
|
56
|
-
- `
|
|
57
|
-
- `
|
|
58
|
-
- **`src/utils/`** — Shared utilities (logger, banner, file-copier, claude-settings-manager, agents-installer, skills-installer, hooks-installer)
|
|
59
|
-
- **`framework/`** — Metadata installed into target projects (READ-ONLY at runtime):
|
|
60
|
-
- `MORPH.md` — NLH charter (the single source of behavioral truth; ≤ 8k chars, `resident-size` canary)
|
|
61
|
-
- `CLAUDE.md` — Runtime instructions injected into target's `.claude/CLAUDE.md` (≤ 3k chars)
|
|
62
|
-
- `agents.json` — the 3 Gate 3 personas (see below); `maxTurns` per persona
|
|
63
|
-
- `phases.json` — 4 phases (plan, uiux, implement, review)
|
|
64
|
-
- `standards/STANDARDS.json` — index of available standards
|
|
65
|
-
- `hooks/claude-code/core/` — fail-open guardrail hooks (+ `hooks/shared/` for what hooks and `src/` both read)
|
|
66
|
-
- `skills/core/` — core NLH skills (single source of truth; listed on the `**Skills core**` line of MORPH.md §7)
|
|
67
|
-
- `rules/` — path-scoped stack rules only (`paths:` frontmatter); no always-on rule
|
|
42
|
+
- **`bin/morph-spec.js`** — Commander.js CLI entry point: install/inspect commands (`init`, `update`, `setup-infra`, `doctor`, `standards`, `graph`, `stack-*`) and the deterministic steps of the loop (`plan-check`, `prove-red`, `check`, `env`).
|
|
43
|
+
- **`src/commands/`** — CLI command handlers by domain (project/, validation/, graph/, scaffold/, mcp/, context/, standards/).
|
|
44
|
+
- **`src/core/`** — `paths/output-schema.js` (**single source of truth** for the feature files: `plan`, `checks`, `implementReport`, the review reports, the `1-design/` docs) and `templates/` (Handlebars registry and renderer).
|
|
45
|
+
- **`src/lib/`** — `contract/` (scan → defaults → merge → apply of `.morph/config/config.json`, and `ports.js` for the branch-hash ports), `check/` (signals and attempts), `plan/` (the one `plan.md` parser and `checks.json` builder), `review-reports.js` (the one reader of the persona reports), `diff/`, `graph/`, `stack/`, `installers/`, `generators/`, `ai/` (`doctor --ai`), `stack-filter.js`.
|
|
46
|
+
- **`src/utils/`** — installers (agents, skills, hooks, claude-settings), logger, file-copier, version-checker.
|
|
47
|
+
- **`framework/`** — what `init` installs into target projects (read-only at runtime):
|
|
48
|
+
- `MORPH.md` — the NLH charter (≤ 8k chars, `resident-size` canary); `CLAUDE.md` — injected into the target's `.claude/CLAUDE.md` (≤ 3k chars)
|
|
49
|
+
- `agents.json` — the 3 review personas; `.claude/agents/morph-*.md` are generated from it
|
|
50
|
+
- `skills/core/` — `morph-plan`, `morph-apply`, `morph-uiux` (+ the Umbraco ones), listed in MORPH.md
|
|
51
|
+
- `rules/` — path-scoped stack rules (`paths:` + `stacks:`), no always-on rule
|
|
52
|
+
- `hooks/claude-code/core/` — fail-open guardrails; `hooks/shared/` — what hooks and `src/` both read
|
|
53
|
+
- `standards/` + `STANDARDS.json`, `templates/` + `REGISTRY.json`, `mcp/registry.json`, `schemas/`, `evals/review-checklist.md`
|
|
68
54
|
- `docs/CLI.md` — the CLI reference, one `###` per command, installed as `.morph/framework/CLI.md`
|
|
69
|
-
- `templates/` — Handlebars templates for code generation
|
|
70
|
-
- `mcp/registry.json` — MCP server registry
|
|
71
|
-
- `evals/review-checklist.md` — o que os agentes do Gate 3 procuram (veredito SHIP/FIX + bloqueador com evidência)
|
|
72
55
|
|
|
73
56
|
### Key Architectural Patterns
|
|
74
57
|
|
|
75
|
-
**NLH (Natural Language Harness):**
|
|
76
|
-
|
|
77
|
-
**Output schema as single source of truth:** `src/core/paths/output-schema.js` defines all output types. Run `npm run generate` after modifying it.
|
|
78
|
-
|
|
79
|
-
**Fail-open hooks:** All hooks check `stateExists()` first and return `{}` if state is missing/corrupt. Hooks never throw or write state.
|
|
80
|
-
|
|
81
|
-
**Atomic state writes:** `state-manager.js` writes to `${path}.tmp.${pid}` then renames.
|
|
58
|
+
**NLH (Natural Language Harness):** behavior lives in `framework/MORPH.md` and the skills. JS hooks are silent guardrails, never orchestrators.
|
|
82
59
|
|
|
83
|
-
**
|
|
60
|
+
**The contract:** `.morph/config/config.json` (`project.stack`/`tags`, `tests[]` with `tier`, `risk` globs, `limits`), shape in `framework/schemas/config.schema.json`. `init` writes it from a scan and is idempotent (`_generated` fingerprints keep hand edits). Every hook and validation command starts from `contractExists()`: no contract, no-op (hooks) or exit 2.
|
|
84
61
|
|
|
85
|
-
**
|
|
86
|
-
|
|
87
|
-
### Phase Sequence
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
plan → [uiux] → implement → review
|
|
91
|
-
```
|
|
62
|
+
**The feature is the branch:** `.morph/features/<slugOfBranch>/` (`framework/hooks/shared/feature-slug.js`). No state file, no phases, no gates: `plan.md` freezes once `checks.json` exists, progress is `3-implement/report.md` (`pendente`/`feito`/`bloqueado` per `Cn`), and `check --report` writes `## Resultado` (`pronto` | `precisa-humano` with the signals).
|
|
92
63
|
|
|
93
|
-
|
|
64
|
+
**Fail-open hooks:** every hook returns `null` on any error or without a contract. Hooks never throw and never write project state.
|
|
94
65
|
|
|
95
|
-
|
|
66
|
+
**Stack-aware filtering:** assets declare `stacks:` in frontmatter (or `stack` in `agents.json`); `getProjectTags` unites `project.stack`, `project.tags` and `integrations`, and only matching assets install.
|
|
96
67
|
|
|
97
|
-
|
|
68
|
+
**Review:** `agents.json` has the 3 read-only roles — `verifier` (runs each `Cn`), `reviewer` (plan.md + diff), `security` (sensitive diffs) — dispatched once, in fresh context, by the session that implemented. Their reports in `4-review/` feed the `sem-revisao`/`revisao-fix`/`nao-provado` signals of `check --report`.
|
|
98
69
|
|
|
99
70
|
## Testing Conventions
|
|
100
71
|
|
|
@@ -125,14 +96,13 @@ A matriz "mexeu em X → verifique Y" mora em `.claude/rules/matrix-*.md`, uma r
|
|
|
125
96
|
| --- | --- |
|
|
126
97
|
| `.claude/rules/matrix-agents.md` | Personas (`agents.json`) e o installer delas |
|
|
127
98
|
| `.claude/rules/matrix-standards.md` | Standards, registro e seções |
|
|
128
|
-
| `.claude/rules/matrix-hooks.md` | Hooks
|
|
99
|
+
| `.claude/rules/matrix-hooks.md` | Hooks e comment-guard |
|
|
129
100
|
| `.claude/rules/matrix-charter.md` | Carta NLH, skills e docs instaláveis |
|
|
130
|
-
| `.claude/rules/matrix-templates-ai.md` |
|
|
131
|
-
| `.claude/rules/matrix-plan-review.md` | Plano, progresso,
|
|
132
|
-
| `.claude/rules/matrix-
|
|
133
|
-
| `.claude/rules/matrix-
|
|
134
|
-
| `.claude/rules/matrix-
|
|
135
|
-
| `.claude/rules/matrix-platform.md` | MCP, installers, procs, heavy e dashboard |
|
|
101
|
+
| `.claude/rules/matrix-templates-ai.md` | Templates, ai-kit e CI |
|
|
102
|
+
| `.claude/rules/matrix-plan-review.md` | Plano, progresso, feature pelo branch e relatórios de revisão |
|
|
103
|
+
| `.claude/rules/matrix-check.md` | `check`, sinais e portas pelo branch |
|
|
104
|
+
| `.claude/rules/matrix-graph.md` | Grafo de codebase |
|
|
105
|
+
| `.claude/rules/matrix-platform.md` | MCP, installers e contrato |
|
|
136
106
|
|
|
137
107
|
### Test Coverage
|
|
138
108
|
|
package/README.md
CHANGED
|
@@ -1,379 +1,90 @@
|
|
|
1
1
|
# morph-spec
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Harness para o Claude Code escrever código bem: plano com cenários, prova de que o teste morde, revisão em contexto novo e um resultado que um orquestrador lê.
|
|
4
4
|
|
|
5
5
|
**Package:** `@polymorphism-tech/morph-spec`
|
|
6
|
-
**Version:**
|
|
6
|
+
**Version:** 11.0.0
|
|
7
7
|
**Requires:** Node.js 22+, Claude Code
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## O que faz
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Cada mudança passa por quatro passos, numa sessão só do Claude Code, com ou sem humano:
|
|
14
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 22+
|
|
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@latest --prefer-online
|
|
33
15
|
```
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
morph-spec init
|
|
16
|
+
issue ──→ plano (Cn) ──→ prova vermelha ──→ implementação ──→ revisão ──→ ## Resultado
|
|
17
|
+
plan-check prove-red check personas check --report
|
|
39
18
|
```
|
|
40
19
|
|
|
41
|
-
|
|
42
|
-
|
|
20
|
+
| Passo | O que garante |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| **Plano** (`/morph-plan`) | `2-plan/plan.md` com cenários `C1..Cn` em Dado/Quando/Então, cada um com o tipo de prova; `plan-check` valida e grava `checks.json`, e o plano congela |
|
|
23
|
+
| **Prova** (`prove-red`) | o teste do cenário falha sem a mudança — um teste que passa dos dois jeitos não prova nada |
|
|
24
|
+
| **Implementação** (`/morph-apply`) | o plano inteiro, com `check` rodando os testes do contrato do repo |
|
|
25
|
+
| **Revisão** | três personas em contexto novo (`morph-verifier`, `morph-reviewer`, `morph-security`), uma rodada, cada achado com frequência × severidade |
|
|
26
|
+
| **Resultado** | `check --report` grava `status: pronto` ou `status: precisa-humano` com os motivos no `3-implement/report.md` |
|
|
43
27
|
|
|
44
|
-
|
|
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`.
|
|
28
|
+
O morph-spec não orquestra: quem cria a worktree, chama o Claude e abre o PR é quem roda (um bot com a label `agente`, o Orca, `claude -w`, você). Ele só percebe onde está — a feature é a pasta do branch, as portas saem do hash do branch.
|
|
52
29
|
|
|
53
30
|
---
|
|
54
31
|
|
|
55
|
-
##
|
|
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 # 10 personas (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
|
-
│ │ ├── feature.json # Authoritative state (committed)
|
|
71
|
-
│ │ ├── 2-plan/ # plan.md + checks.json (from plan-check)
|
|
72
|
-
│ │ ├── 1-design/ # UI/UX design (optional, after the plan gate)
|
|
73
|
-
│ │ ├── 3-implement/ # reports/F{n}.md — one per plan slice
|
|
74
|
-
│ │ └── 4-review/ # verifier.md + reviewer.md [+ security.md]
|
|
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 (one morph-{id}.md per persona)
|
|
80
|
-
├── rules/ # Stack-aware, path-scoped standards rules
|
|
81
|
-
└── settings.local.json # Hooks configuration
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## Phase workflow
|
|
87
|
-
|
|
88
|
-
Features move through structured phases. Some are optional depending on feature type.
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
plan → [uiux] → implement → review
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
`uiux` is optional — it applies only to UI-heavy features and comes after the plan gate.
|
|
95
|
-
|
|
96
|
-
### Phase outputs
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
| Phase | Directory | Key files |
|
|
100
|
-
| --------- | --------------- | ------------------------------------------------------------------ |
|
|
101
|
-
| Plan | `2-plan/` | `plan.md` (scenarios `C{n}`, decisions, slices `F{n}`), `checks.json`, `stack-scan.md`, `scout-map.md` |
|
|
102
|
-
| Design | `1-design/` | `design-system.md`, `mockups.md`, `components.md`, `flows.md` |
|
|
103
|
-
| Implement | `3-implement/` | `reports/F{n}.md` + source code |
|
|
104
|
-
| Review | `4-review/` | `verifier.md`, `reviewer.md`, `security.md` (when required) |
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
### Approval gates
|
|
108
|
-
|
|
109
|
-
- **Plan gate** — `plan.md` must pass `morph-spec plan-check` with zero errors (it writes `checks.json`) before implement.
|
|
110
|
-
- **UI/UX gate** (optional) — the `1-design/` outputs, after the plan gate.
|
|
111
|
-
- **Gate 3 (Review)** — independent sub-agents write `verifier.md` (every `C{n}` proved), `reviewer.md` and, when required, `security.md`, each answering SHIP or FIX.
|
|
112
|
-
|
|
113
|
-
In `trust: "auto"` mode (default), gates auto-pass without risk signals. See `framework/MORPH.md` for risk-signal details.
|
|
114
|
-
|
|
115
|
-
Check gate status:
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
morph-spec status {feature}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## Work-type routing & worktrees
|
|
124
|
-
|
|
125
|
-
Not every change deserves the full pipeline. Every feature is born with a **work type** — `feature`, `bug`, `chore`, or `hotfix` — set via `morph-spec create {feature} --type <type>` or classified from free text with `--request "<text>"`. The type dimensions the pipeline: `feature` and `bug` run the full plan → [uiux] → implement → review sequence; `chore` skips straight to implement (plan gate stamped by policy at birth); `hotfix` runs scout (read-only root-cause) → surgical fix → test loop, and its Gate 3 always pauses for a human even under `trust: auto`. Change the type mid-flight with `morph-spec retype {feature} {newType}` (undoes only policy-stamped gates, preserves human approvals, blocked after Gate 3).
|
|
126
|
-
|
|
127
|
-
Independent features can also be developed **in parallel, each isolated in its own git worktree** — one feature, one worktree, one Claude Code instance. `morph-spec create {feature} --worktree` (or `morph-spec worktree setup {feature}`) creates `worktrees/{feature}/` on branch `morph/{feature}`. The authoritative `feature.json` travels committed on the branch; shared infra (`node_modules`, `.claude`, `.morph/framework`) is linked via junctions (`morph-spec worktree link --all` repairs it if missing). Close out with `morph-spec finish {feature} --pr|--merge` (archive + integrate + teardown); `morph-spec worktree list` shows every active worktree with its phase and gate status.
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## Slash commands
|
|
132
|
-
|
|
133
|
-
These commands are available inside Claude Code after init.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
| Command | Description |
|
|
137
|
-
| ------------------------------ | ---------------------------------------------------------- |
|
|
138
|
-
| `/morph-plan {feature}` | Interview, `plan.md`, `plan-check` and the plan gate |
|
|
139
|
-
| `/morph-apply {feature}` | Autonomous execution + review (Gate 3) |
|
|
140
|
-
| `/morph-hotfix {feature}` | Surgical hotfix ADW — scout → fix → human Gate 3 → ship |
|
|
141
|
-
| `/morph-status [feature]` | Status of the active (or specified) feature |
|
|
142
|
-
| `/morph-archive {feature}` | Archive **without integrating** (legacy feature / cleanup); normal close is `morph-spec finish --pr\|--merge` |
|
|
143
|
-
| `/morph-preflight` | Pre-deploy validation (specs, contracts, tests, infra) |
|
|
144
|
-
| `/morph-troubleshoot [error]` | Root-cause diagnosis for .NET/Next.js errors |
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## CLI reference
|
|
150
|
-
|
|
151
|
-
### Project management
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
morph-spec init # Initialize MORPH in current project
|
|
155
|
-
morph-spec init --force # Overwrite existing installation
|
|
156
|
-
morph-spec update # Update framework files and re-analyze project
|
|
157
|
-
morph-spec doctor # Check installation health
|
|
158
|
-
morph-spec doctor --full # Full health check (all file verifications)
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Feature workflow
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
morph-spec fleet # Every active feature (root + worktrees): phase, gates, activity
|
|
165
|
-
morph-spec status {feature} # Feature status dashboard
|
|
166
|
-
morph-spec approve {feature} {gate} # Approve a phase gate (plan, uiux, review)
|
|
167
|
-
morph-spec advance {feature} # Approve the current gate and scaffold the next phase folder
|
|
168
|
-
morph-spec finish {feature} --pr|--merge # Close a feature: archive + integrate (PR or local merge) + teardown
|
|
169
|
-
morph-spec archive {feature} # Archive WITHOUT integrating (legacy feature / cleanup)
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
`finish` is the normal close for both flows: it archives (committing the move inside `morph/{feature}`), then integrates — `--merge` merges `--no-ff` into the default branch locally; `--pr` pushes the branch and runs `gh pr create` (needs `origin` + authenticated `gh`) — and tears down the worktree if there is one. Plain `archive` is reserved for legacy features (born before every feature had a `morph/{feature}` branch) and cleanup.
|
|
173
|
-
|
|
174
|
-
Progress within a feature is the slice reports `3-implement/reports/F{n}.md`: absent means pending, `PARCIAL` on the first line means partial. There is no CLI command for starting or finishing a slice.
|
|
175
|
-
|
|
176
|
-
### Validation
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
morph-spec verify {feature} # Deterministic build+tests+validators chain, before the LLM judge
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
### Work-type routing
|
|
183
|
-
|
|
184
|
-
```bash
|
|
185
|
-
morph-spec create {feature} --type feature|bug|chore|hotfix --description "<what/why>" # Explicit birth: type dimensions the pipeline, description is required
|
|
186
|
-
morph-spec create {feature} --request "<free text>" # Detector classifies the type AND seeds the description
|
|
187
|
-
morph-spec retype {feature} {newType} # Change work type mid-flight (blocked after Gate 3)
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### Worktrees (parallel development)
|
|
32
|
+
## Instalação
|
|
191
33
|
|
|
192
34
|
```bash
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
morph-spec
|
|
196
|
-
morph-spec worktree list [--json] # List active feature worktrees with phase/gate status
|
|
197
|
-
# Close a worktree feature with `morph-spec finish {feature} --pr|--merge` (see Feature workflow).
|
|
35
|
+
npm install -g @polymorphism-tech/morph-spec@latest
|
|
36
|
+
cd seu-repo
|
|
37
|
+
morph-spec init # ou: morph-spec init --dry-run
|
|
198
38
|
```
|
|
199
39
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
morph-spec graph build # Extract the graph (local AST, zero tokens)
|
|
204
|
-
morph-spec graph status # Size, freshness, sanitizer health
|
|
205
|
-
morph-spec graph affected {symbol} --uses-only # Who actually uses it (not who implements it)
|
|
206
|
-
morph-spec graph explain {symbol} # Neighbourhood, cited file:line
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
The gain is **precision, not recall**: the graph finds nothing grep would miss, but it drops 58% of the noise and tells you *what kind* of relationship each hit is — the difference between "20 types implement this interface" and "2 actually use it". The graph is never consumed raw: a sanitizing layer fixes the C# namespace-scope resolution gap that would otherwise report **zero** consumers where two exist.
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
## Agent model
|
|
214
|
-
|
|
215
|
-
morph-spec dispatches 10 flat personas — no tiers, no hierarchy — defined in `.morph/framework/agents.json` (single source of truth) and installed identically to `.claude/agents/morph-{id}.md`. Claude picks the right persona per plan slice from the domains/keywords in `agents.json`, then dispatches it via the `Agent` tool.
|
|
216
|
-
|
|
217
|
-
| Persona | Domain | Model |
|
|
218
|
-
| ---------------- | -------------------------------------- | ------ |
|
|
219
|
-
| `dotnet-senior` | Backend (.NET, VSA) | sonnet |
|
|
220
|
-
| `ef-modeler` | EF Core / Postgres modeling | sonnet |
|
|
221
|
-
| `maf-expert` | Microsoft Agent Framework | sonnet |
|
|
222
|
-
| `nextjs-expert` | Frontend (Next.js/React) | sonnet |
|
|
223
|
-
| `ui-designer` | UI/UX, design systems | sonnet |
|
|
224
|
-
| `infra-engineer` | Jobs, deployment, observability | sonnet |
|
|
225
|
-
| `verifier` | Gate 3: proves every scenario `C{n}` (read-only) | sonnet (opus for prompt/model or media) |
|
|
226
|
-
| `reviewer` | Gate 3: judges the diff (read-only) | sonnet |
|
|
227
|
-
| `security` | Gate 3: security review (read-only) | opus |
|
|
228
|
-
| `scout` | Read-only codebase diagnosis | sonnet |
|
|
229
|
-
|
|
230
|
-
`morph-spec doctor` detects drift between `agents.json` and the generated `.claude/agents/morph-*.md` files — never hand-edit the generated files.
|
|
40
|
+
O `init` lê os manifests (`package.json`, `*.csproj`, `pyproject.toml`, compose, `components.json`) e escreve o **contrato do repo** em `.morph/config/config.json`: stack, comandos de teste por tier, globs de risco por categoria e limites. Instala só o que a stack usa — rules por `paths:`, skills, personas e hooks. Rodar de novo atualiza sem apagar edição manual. Funciona em .NET, Next.js/React/Vue, Node, Python, LP Umbraco e site estático.
|
|
231
41
|
|
|
232
42
|
---
|
|
233
43
|
|
|
234
|
-
##
|
|
235
|
-
|
|
236
|
-
Guardrail hooks are installed into `.claude/settings.local.json` across 13 event bindings. All are **fail-open** — they check that state exists first and silently no-op on missing/corrupt state; they never throw, write state, or orchestrate.
|
|
44
|
+
## Modo autônomo
|
|
237
45
|
|
|
46
|
+
Com `MORPH_AUTONOMOUS=1` (ou sem humano) a sessão não pergunta: o que não é decisão dela termina como `precisa-humano` e o orquestrador abre o PR como rascunho. Sinais que levam a isso:
|
|
238
47
|
|
|
239
|
-
|
|
|
240
|
-
|
|
|
241
|
-
| `
|
|
242
|
-
| `
|
|
243
|
-
| `
|
|
244
|
-
| `
|
|
245
|
-
| `
|
|
246
|
-
| `
|
|
247
|
-
| `
|
|
248
|
-
| `
|
|
48
|
+
| Sinal | Quando |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `risco` | o diff toca dados, envio a pessoas, acesso/segurança ou infra |
|
|
51
|
+
| `cenarios-propostos` | a issue veio sem cenários e o agente os propôs |
|
|
52
|
+
| `degrau` | cenário com migration ou mudança irreversível |
|
|
53
|
+
| `pr-grande` / `plano-grande` | acima dos limites do contrato |
|
|
54
|
+
| `preso` | 8 tentativas, ou 3 vermelhos com o mesmo erro |
|
|
55
|
+
| `vermelho`, `pendente`, `sem-prova` | teste falhando, cenário não fechado, nenhum teste rodou |
|
|
56
|
+
| `sem-revisao`, `revisao-fix`, `nao-provado` | revisão ausente, revisão pedindo correção, cenário que o verificador não provou |
|
|
57
|
+
| `nao-commitado` | trabalho fora do commit, que o PR não leva |
|
|
249
58
|
|
|
250
|
-
|
|
251
|
-
Protected files (via `permissions.deny`):
|
|
252
|
-
|
|
253
|
-
- `.morph/state.json` — never edited directly, derived from `feature.json` files
|
|
254
|
-
- `.morph/framework/` — read-only framework content
|
|
59
|
+
Template de issue: **Objetivo / Cenários (Cn) / Fora de escopo**.
|
|
255
60
|
|
|
256
61
|
---
|
|
257
62
|
|
|
258
|
-
##
|
|
63
|
+
## Comandos
|
|
259
64
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
|
263
|
-
|
|
|
264
|
-
| `
|
|
265
|
-
| `
|
|
266
|
-
| `
|
|
267
|
-
| `
|
|
268
|
-
| `
|
|
65
|
+
| Comando | Para quê |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| `init [--dry-run]` | contrato do repo e instalação filtrada pela stack |
|
|
68
|
+
| `update` | reinstala os payloads da versão da CLI |
|
|
69
|
+
| `plan-check` | valida o plano e grava `checks.json` |
|
|
70
|
+
| `prove-red <f> --test "<cmd>"` | o teste do cenário falha sem a mudança? |
|
|
71
|
+
| `check [--tier fast\|full\|e2e] [--report]` | testes do contrato + sinais de risco; `--report` grava `## Resultado` |
|
|
72
|
+
| `env` | portas e `COMPOSE_PROJECT_NAME` do branch |
|
|
73
|
+
| `standards --find "<tema>"` | o standard certo, por digest e âncora |
|
|
74
|
+
| `graph affected\|explain <símbolo>` | blast radius pelo grafo de código (sem grafo, grep) |
|
|
75
|
+
| `stack-scan`, `stack-set`, `tests-audit` | auditoria da stack, declaração da stack, auditoria dos testes |
|
|
76
|
+
| `doctor [--full\|--mcp\|--ai]` | saúde da instalação |
|
|
269
77
|
|
|
78
|
+
Referência completa: [`framework/docs/CLI.md`](framework/docs/CLI.md).
|
|
270
79
|
|
|
271
80
|
---
|
|
272
81
|
|
|
273
|
-
##
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
| Technology | Support |
|
|
277
|
-
| ------------------------------------------- | ------------------------------------------------------------- |
|
|
278
|
-
| .NET 10 / ASP.NET Core | Full — VSA with direct handlers, result pattern, Minimal API |
|
|
279
|
-
| EF Core / Neon (Postgres) | Full — migrations, Neon Auth (Better Auth) |
|
|
280
|
-
| Next.js / React / TypeScript | Full — components, routing, state management |
|
|
281
|
-
| Microsoft Agent Framework (MAF) | Full — single-agent + structured output + tools + RAG |
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
TypeScript strict mode is enforced by default. See `.morph/framework/standards/` for all coding standards.
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
## Update
|
|
289
|
-
|
|
290
|
-
To update the framework files in an existing project:
|
|
82
|
+
## Desenvolvimento
|
|
291
83
|
|
|
292
84
|
```bash
|
|
293
|
-
|
|
85
|
+
npm test # suíte inteira (paralela)
|
|
86
|
+
npm run test:changed # só o que a mudança alcança
|
|
87
|
+
npm run generate:check && npm run validate
|
|
294
88
|
```
|
|
295
89
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
After updating, run `morph-spec doctor` to confirm the installation is healthy.
|
|
299
|
-
|
|
300
|
-
---
|
|
301
|
-
|
|
302
|
-
## Key rules
|
|
303
|
-
|
|
304
|
-
**Never skip phases.** Every feature starts with a plan. No code is written until `plan.md` passes `plan-check` and the plan gate is approved.
|
|
305
|
-
|
|
306
|
-
**Never edit protected files directly:**
|
|
307
|
-
|
|
308
|
-
- `.morph/state.json` — derived automatically from `feature.json`; use `morph-spec approve`/`advance`/`gate-decision` to change feature state
|
|
309
|
-
- `.morph/framework/` — read-only, updated by `morph-spec update`
|
|
310
|
-
|
|
311
|
-
**Always document decisions.** Architectural choices go in the `## Decisões` section of `2-plan/plan.md` (ADRs are indexed when the feature closes), not in commit messages.
|
|
312
|
-
|
|
313
|
-
**Verify runs once per feature.** `morph-spec verify {feature}` runs the build + test + validator chain relevant to your stack; red triggers an autonomous correction loop rather than a pause. Gate 3 is three independent sub-agents (verifier, reviewer, security when required) that answer SHIP or FIX with evidence-typed blockers.
|
|
314
|
-
|
|
315
|
-
---
|
|
316
|
-
|
|
317
|
-
## Troubleshooting
|
|
318
|
-
|
|
319
|
-
### `morph-spec: command not found`
|
|
320
|
-
|
|
321
|
-
The installer automatically adds the npm global directory to your PowerShell `$PROFILE`. Open a **new terminal** after installing. If it still doesn't work, add it manually:
|
|
322
|
-
|
|
323
|
-
```bash
|
|
324
|
-
npm config get prefix
|
|
325
|
-
# Add {prefix} 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@latest --prefer-online
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
1. Open a new terminal (the installer adds npm to your PATH automatically)
|
|
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 setup-infra` or `morph-spec init --force`.
|
|
362
|
-
|
|
363
|
-
---
|
|
364
|
-
|
|
365
|
-
## Standards
|
|
366
|
-
|
|
367
|
-
The framework ships 60 registered standards across 7 categories (`ai-agents`, `architecture`, `backend`, `data`, `frontend`, `infrastructure`, `integration`), stored in `.morph/framework/standards/STANDARDS.json`. Standards are looked up on demand (by keyword/alias) rather than preloaded wholesale into context, and enforced via stack-aware, 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 v10.12.1 by [Polymorphism Tech](https://polymorphism.tech)*
|
|
90
|
+
Veja [`CLAUDE.md`](CLAUDE.md) para a arquitetura do código e [`CONTRIBUTING.md`](CONTRIBUTING.md) para o fluxo de PR e release.
|