@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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> **Scope:** stacks=["dotnet"]
|
|
4
4
|
> **Layer:** 1 (on-keyword)
|
|
5
5
|
> **Keywords:** eval, evals, response cache, cache de respostas, dataset de eval, regressão de prompt, troca de modelo, model swap, prompt regression, EvalFixture, OfflineChatClient, DiskBasedResponseCacheProvider, nó evals, --refresh-cache
|
|
6
|
-
> **Read by Claude in:** implement (quando a feature muda prompt, troca modelo, ou o projeto vai declarar
|
|
6
|
+
> **Read by Claude in:** implement (quando a feature muda prompt, troca modelo, ou o projeto vai declarar a eval no contrato)
|
|
7
7
|
|
|
8
8
|
**Verified against:** Microsoft.Extensions.AI.Evaluation 10.9.0 + `.Quality` + `.Reporting` (ai-pin 2026-09-08); provado por `templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalFixture.cs`, que compila e roda no CI contra exatamente essas versões. A superfície de `DiskBasedReportingConfiguration`, `DiskBasedResponseCacheProvider`, `ReportingConfiguration` e dos avaliadores de `.Quality` foi **medida por reflexão sobre as assemblies `Microsoft.Extensions.AI.Evaluation*` 10.9.0** em 2026-09-08. Last-verified: 2026-09-08.
|
|
9
9
|
|
|
@@ -36,7 +36,7 @@ invocado. Trocando o cliente interno por um que **recusa** (`OfflineChatClient`)
|
|
|
36
36
|
caminho para a rede fica fechado — ou tudo resolve pela cache, ou a suíte fica vermelha
|
|
37
37
|
nomeando o cenário que faltou.
|
|
38
38
|
|
|
39
|
-
Isso é o que permite
|
|
39
|
+
Isso é o que permite a eval existir no CI de um repositório que **não tem uma única
|
|
40
40
|
chave de LLM nos seus workflows**. Um mecanismo que exigisse uma chave seria adotado por
|
|
41
41
|
ninguém.
|
|
42
42
|
|
|
@@ -207,51 +207,37 @@ como se tivesse verificado algo.
|
|
|
207
207
|
|
|
208
208
|
## Quando o eval roda
|
|
209
209
|
|
|
210
|
-
Declare-o como
|
|
210
|
+
Declare-o como mais uma entrada em `project.tests[]` do contrato, no tier `full`, com o
|
|
211
|
+
ambiente que o `EvalFixture.FromEnvironment` lê (`MORPH_EVAL_CACHE` obrigatório;
|
|
212
|
+
`MORPH_EVAL_DATASET`, `MORPH_EVAL_RESULTS`, `MORPH_EVAL_ENVFILE` com padrão ao lado da cache) no
|
|
213
|
+
campo `env` da própria entrada — o `check` o injeta só naquele comando, igual em todo SO:
|
|
211
214
|
|
|
212
215
|
```json
|
|
213
|
-
{
|
|
214
|
-
"project": {
|
|
215
|
-
"tests": [
|
|
216
|
-
{ "id": "unit", "command": "dotnet test tests/App.Tests/App.Tests.csproj" },
|
|
217
|
-
{
|
|
218
|
-
"id": "evals",
|
|
219
|
-
"runner": "evals",
|
|
220
|
-
"command": "dotnet test tests/App.Tests/App.Tests.csproj --filter-trait Category=Eval",
|
|
221
|
-
"evals": { "cachePath": "tests/App.Tests/eval-cache", "envFile": ".env.evals" }
|
|
222
|
-
}
|
|
223
|
-
],
|
|
224
|
-
"evals": { "watch": ["tenants/**", "product/**", "config/model-registry.json"] }
|
|
225
|
-
}
|
|
226
|
-
}
|
|
216
|
+
{ "id": "evals", "tier": "full", "env": { "MORPH_EVAL_CACHE": "tests/App.Tests/eval-cache" }, "command": "dotnet test tests/App.Tests/App.Tests.csproj --filter-trait Category=Eval" }
|
|
227
217
|
```
|
|
228
218
|
|
|
229
219
|
| Quando | O que acontece |
|
|
230
220
|
|---|---|
|
|
231
|
-
| `
|
|
232
|
-
| miss de cache sem credencial | **reprova** nomeando o cenário, o caminho, o
|
|
233
|
-
|
|
|
221
|
+
| `morph-spec check --tier full` | **roda**, offline, contra a cache commitada |
|
|
222
|
+
| miss de cache sem credencial | **reprova** nomeando o cenário, o caminho, o modo de regravação e o arquivo de credencial |
|
|
223
|
+
| `MORPH_EVAL_MODE=refresh` | regrava a árvore contra o provider real. **Nunca implícito**: é uma chamada paga |
|
|
234
224
|
|
|
235
225
|
**Miss jamais vira `skip`.** A tentação é real ("não dá para avaliar, então não avalio") e
|
|
236
226
|
recria o buraco que este harness já fechou duas vezes: gate verde sobre verificação que não
|
|
237
227
|
aconteceu. E há razão positiva: em CI, com cache commitada, um miss significa **uma coisa
|
|
238
228
|
só** — o prompt ou o modelo mudou e ninguém regravou. O miss é o veredito, não o obstáculo.
|
|
239
229
|
|
|
240
|
-
##
|
|
230
|
+
## O que conta como "mudei o prompt"
|
|
241
231
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
carimbado no mesmo commit ⇒ o gate **pausa** e nomeia o caminho.
|
|
232
|
+
O plano declara: cenário de prompt ou modelo tem `prova: eval`, e o verificador roda a eval antes
|
|
233
|
+
de dizer PROVADO. Arquivo de prompt, registry de modelo e dataset por tenant são os caminhos que
|
|
234
|
+
contam; a cache e o dataset regravados não.
|
|
246
235
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
O detector é por caminho, e as três formas conhecidas de escapar dele estão ditas em voz
|
|
251
|
-
alta, porque um detector que se apresenta como completo e não é vale menos que nenhum:
|
|
236
|
+
Há três formas conhecidas de escapar dessa régua, ditas em voz alta, porque uma régua que se
|
|
237
|
+
apresenta como completa e não é vale menos que nenhuma:
|
|
252
238
|
|
|
253
239
|
1. **eval trivialmente verde** — um cenário só, asserção vazia. É a mesma classe de contorno
|
|
254
|
-
de um teste vazio, e a resposta é o
|
|
240
|
+
de um teste vazio, e a resposta é o verificador (bloqueador `teste`: teste que não morde), não uma segunda regra determinística
|
|
255
241
|
que também seria contornável;
|
|
256
242
|
2. **prompt publicado direto no banco**, sem tocar arquivo;
|
|
257
243
|
3. **modelo trocado por variável de ambiente** no provedor de deploy — invisível ao
|
|
@@ -276,7 +262,7 @@ real é legível offline. O que a mitiga é o fato medido acima — a chave depe
|
|
|
276
262
|
| Standard | Cobre |
|
|
277
263
|
|---|---|
|
|
278
264
|
| `testing-ai` | Fake roteirizado rodando o loop real do agente; prova ferramenta escolhida, argumentos e guard. **Sem rede, sem modelo** |
|
|
279
|
-
| `evals-with-cache` (este) | Modelo **real** com cache em disco; dataset por tenant/agente; regressão de prompt e de modelo;
|
|
265
|
+
| `evals-with-cache` (este) | Modelo **real** com cache em disco; dataset por tenant/agente; regressão de prompt e de modelo; a eval no tier `full` do contrato |
|
|
280
266
|
|
|
281
267
|
Em uma frase: `testing-ai` prova que **o código em volta do modelo** se comporta;
|
|
282
268
|
`evals-with-cache` prova que **o modelo** ainda responde o que respondia.
|
|
@@ -294,7 +294,7 @@ A metade de harness deste assunto (o que o fake captura, e como assertar sobre i
|
|
|
294
294
|
`ai-agents-testing-ai`. O veredito ternário e o escape registrado, que são o que torna um guard
|
|
295
295
|
auditável pela mesma via, são de `ai-agents-guardrails`.
|
|
296
296
|
|
|
297
|
-
> **O que
|
|
297
|
+
> **O que a revisão procura.** Os nomes concretos — `ActivitySource`, spans, métricas e atributos
|
|
298
298
|
> requeridos — estão medidos na tabela **"Nomes de span, métricas e atributos — medidos"** acima, e
|
|
299
299
|
> **não** são repetidos aqui: uma segunda lista dos mesmos nomes é a segunda verdade nascendo. A
|
|
300
300
|
> régua de avaliação correspondente vive em
|
|
@@ -354,7 +354,7 @@ Workflow para diagnosticar um incidente relatado ("o agente X respondeu errado/l
|
|
|
354
354
|
- `ai-agents-conversational-agent-with-phases` — o compositor de turno e a invariante "derivado sem cache" que torna o hash confiável
|
|
355
355
|
- `ai-agents-testing-ai` — a metade de harness da rastreabilidade (captura do fake, prompt cru com opt-in)
|
|
356
356
|
- `ai-agents-guardrails` — veredito ternário e escape registrado, auditáveis pela mesma telemetria
|
|
357
|
-
- `.morph/framework/evals/review-checklist.md` — a régua
|
|
357
|
+
- `.morph/framework/evals/review-checklist.md` — a régua da revisão para a propriedade desta seção
|
|
358
358
|
- `infrastructure-docker-coolify-deploy` — Serilog/JSON console log para o pipeline de agregação em produção
|
|
359
359
|
- Reference implementation (compila e conta spans contra o pin): `templates/dotnet/ai-kit/src/Morph.AiKit/Observability/MorphOpenTelemetryExtensions.cs` + `tests/Morph.AiKit.Tests/TelemetryTests.cs`
|
|
360
360
|
- [OpenTelemetry Semantic Conventions for GenAI](https://opentelemetry.io/docs/specs/semconv/gen-ai/)
|
|
@@ -42,7 +42,7 @@ Só o **porquê que o código não mostra**:
|
|
|
42
42
|
## O que não merece
|
|
43
43
|
|
|
44
44
|
- **História de processo.** Fatia, cenário, ADR, Gate, avaliador, `plan.md`, mockup, "confirmado ao
|
|
45
|
-
implementar a F2", "
|
|
45
|
+
implementar a F2", "a revisão pediu". Isso vai na mensagem de commit e no `plan.md`, onde tem
|
|
46
46
|
data e autor e não envelhece dentro do arquivo. Em teste, o elo com o cenário vai no **nome**
|
|
47
47
|
do teste (`C5_estado_do_lead_espelha_o_crm`, `DisplayName`), nunca em `// C5`.
|
|
48
48
|
- **Repetição do código.** `// incrementa o contador` sobre `count++`, `// valida o request` sobre
|
|
@@ -97,10 +97,7 @@ processo, banner/`#region`, código comentado, bloco de mais de 3 linhas ou `///
|
|
|
97
97
|
publicado. Comentário que o arquivo já tinha nunca é acusado. Repetir o código em uma linha não é
|
|
98
98
|
detectável por forma: fica com a revisão abaixo.
|
|
99
99
|
|
|
100
|
-
Comentário que o código dispensava é nota do
|
|
101
|
-
do `morph-spec verify` mede, nas linhas que a feature adicionou (validador `code-budget`), quantas
|
|
102
|
-
linhas de comentário citam processo e a densidade de comentário sobre o código adicionado, e avisa
|
|
103
|
-
com os números e os arquivos mais comentados.
|
|
100
|
+
Comentário que o código dispensava é nota do revisor (`review-checklist.md`), não bloqueador.
|
|
104
101
|
|
|
105
102
|
---
|
|
106
103
|
|
|
@@ -86,7 +86,7 @@ A branch é `morph/{f}`, criada pelo CLI. Commits seguem Conventional Commits:
|
|
|
86
86
|
`<tipo>(<escopo>): <assunto>`, com o tipo em `feat`, `fix`, `refactor`, `test`, `chore`, `docs`,
|
|
87
87
|
`perf`, `ci`, `build`, `style` ou `revert`. O hook `conventional-commit` recusa outra forma.
|
|
88
88
|
|
|
89
|
-
## O que bloqueia
|
|
89
|
+
## O que bloqueia na revisão
|
|
90
90
|
|
|
91
91
|
Só o que o **diff introduziu**. O que já existia no arquivo vira nota.
|
|
92
92
|
|
|
@@ -119,7 +119,7 @@ Tests are paid for by **risk, not by new code**. The plan (`morph-plan`) marks e
|
|
|
119
119
|
with `prova:` and, for a test, a `risco:` (business rule, money, external contract, concurrency,
|
|
120
120
|
data integrity, regression). The budget is **one test per risky scenario, plus the regression test of
|
|
121
121
|
the bug being fixed**; going above it takes a one-line justification on the scenario. A scenario
|
|
122
|
-
without risk — CRUD, DTO, mapping, wiring, constants, layout — is `prova: leitura`: the
|
|
122
|
+
without risk — CRUD, DTO, mapping, wiring, constants, layout — is `prova: leitura`: the
|
|
123
123
|
verifier proves it by reading the code, and it gets no test.
|
|
124
124
|
|
|
125
125
|
- **Table before copy.** Scenarios of the same behavior — including its edge cases (null, empty,
|
|
@@ -137,9 +137,9 @@ verifier proves it by reading the code, and it gets no test.
|
|
|
137
137
|
- **Order is free, proof is not the implementer's:** a bug gets a regression test, and a risky
|
|
138
138
|
scenario gets its test, in whatever order the code comes out. The implementer does not run red→green
|
|
139
139
|
cycles nor mutate production code to watch a test fail; it runs its own filter once before the
|
|
140
|
-
report, and
|
|
141
|
-
- **A
|
|
142
|
-
|
|
140
|
+
report, and `morph-spec prove-red` is what shows the test bites.
|
|
141
|
+
- **A test that stays green** under `prove-red` is fixed by tightening an existing assertion or
|
|
142
|
+
adding a table row, not by one new test per case.
|
|
143
143
|
|
|
144
144
|
---
|
|
145
145
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **Scope:** nextjs
|
|
4
4
|
> **Layer:** 0 (resumo injetado pela rule `nextjs-standards` (`**/*.ts`, `**/*.tsx`); o `stack-scan` acusa o projeto sem este arquivo)
|
|
5
|
-
> **Keywords:** eslint, lint, eslint.config.mjs, no-restricted-imports, no-restricted-paths, no-restricted-syntax, no-default-export, no-explicit-any, forbid-elements, elemento cru, framer-motion, zustand
|
|
5
|
+
> **Keywords:** eslint, lint, eslint.config.mjs, no-restricted-imports, no-restricted-paths, no-restricted-syntax, no-default-export, no-explicit-any, forbid-elements, elemento cru, jsx-a11y, acessibilidade, teclado, foco, framer-motion, zustand
|
|
6
6
|
> **Load When:** projeto Next.js sem `eslint.config.mjs` com `no-restricted-imports`, ou o lint acusou uma destas regras
|
|
7
7
|
|
|
8
8
|
**Verified against:** eslint 9.39.5, eslint-config-next 16.4.2 (typescript-eslint 8.71.2, eslint-plugin-import 2.32.0), next 16.4.2, typescript 6.0.3 (sonda: um arquivo ruim por regra → erro da regra esperada, `no-console` → aviso, arquivos conformes e o scaffold `morph-spec scaffold nextjs` → 0 problemas). Last-verified: 2026-10-18.
|
|
@@ -19,10 +19,9 @@ Dependências (`npm i -D eslint@9 eslint-config-next typescript`). ESLint 9 é a
|
|
|
19
19
|
`eslint-plugin-import` e `eslint-plugin-react` declaram como peer; o typescript-eslint do
|
|
20
20
|
`eslint-config-next` pede TypeScript `<6.1`.
|
|
21
21
|
|
|
22
|
-
No Next 16 o `next build` não roda mais o lint. O
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
vermelha. As zonas são relativas a essa raiz.
|
|
22
|
+
No Next 16 o `next build` não roda mais o lint. O `morph-spec init` declara o script `lint` do
|
|
23
|
+
`package.json` no tier `fast` do contrato, e o `morph-spec check` o roda a cada passada: sem script
|
|
24
|
+
`lint`, nada cobra. As zonas são relativas à raiz do app.
|
|
26
25
|
|
|
27
26
|
`eslint.config.mjs`:
|
|
28
27
|
|
|
@@ -62,6 +61,13 @@ const RAW_ELEMENTS = [
|
|
|
62
61
|
['dialog', 'Dialog ou AlertDialog de @/components/ui'],
|
|
63
62
|
].map(([element, use]) => ({ element, message: `Elemento cru: use ${use}. Falta o componente? npx shadcn@latest add.` }))
|
|
64
63
|
|
|
64
|
+
const A11Y_RULES = [
|
|
65
|
+
'alt-text', 'aria-props', 'aria-proptypes', 'aria-role', 'aria-unsupported-elements',
|
|
66
|
+
'role-has-required-aria-props', 'role-supports-aria-props', 'click-events-have-key-events',
|
|
67
|
+
'no-static-element-interactions', 'interactive-supports-focus', 'tabindex-no-positive',
|
|
68
|
+
'heading-has-content', 'iframe-has-title',
|
|
69
|
+
].map((rule) => [`jsx-a11y/${rule}`, rule === 'aria-role' ? ['error', { ignoreNonDOM: true }] : 'error'])
|
|
70
|
+
|
|
65
71
|
const FETCH_IN_EFFECT = {
|
|
66
72
|
selector:
|
|
67
73
|
"CallExpression[callee.name='useEffect'] CallExpression:matches([callee.name='fetch'], [callee.name='apiClient'], [callee.object.name='apiClient'])",
|
|
@@ -73,6 +79,7 @@ export default defineConfig([
|
|
|
73
79
|
...nextTs,
|
|
74
80
|
globalIgnores(['.next/**', 'out/**', 'build/**', 'next-env.d.ts']),
|
|
75
81
|
{
|
|
82
|
+
ignores: ['**/*.cjs'],
|
|
76
83
|
rules: {
|
|
77
84
|
'no-restricted-imports': restrictedImports(DEEP_FEATURE),
|
|
78
85
|
'import/no-restricted-paths': ['error', {
|
|
@@ -95,7 +102,7 @@ export default defineConfig([
|
|
|
95
102
|
{
|
|
96
103
|
files: ['**/*.tsx'],
|
|
97
104
|
ignores: ['**/components/ui/**'],
|
|
98
|
-
rules: { 'react/forbid-elements': ['error', { forbid: RAW_ELEMENTS }] },
|
|
105
|
+
rules: { 'react/forbid-elements': ['error', { forbid: RAW_ELEMENTS }], ...Object.fromEntries(A11Y_RULES) },
|
|
99
106
|
},
|
|
100
107
|
{
|
|
101
108
|
files: ['app/layout.tsx', 'src/app/layout.tsx'],
|
|
@@ -119,7 +126,8 @@ export default defineConfig([
|
|
|
119
126
|
|
|
120
127
|
Cada override de `no-restricted-imports` e `no-restricted-syntax` substitui a lista inteira da
|
|
121
128
|
regra naquele arquivo, por isso o bloco do layout repete `FETCH_IN_EFFECT` e o de `features/`
|
|
122
|
-
repete os pacotes banidos.
|
|
129
|
+
repete os pacotes banidos. O bloco global ignora `.cjs` porque o `eslint-config-next` não declara
|
|
130
|
+
o plugin `import` para essa extensão: sem o `ignores`, tocar o `postcss.config.cjs` derruba o lint.
|
|
123
131
|
|
|
124
132
|
## O que cada regra compra
|
|
125
133
|
|
|
@@ -134,15 +142,21 @@ repete os pacotes banidos.
|
|
|
134
142
|
| `import/no-restricted-paths` `src/features` ↛ `src/app` | feature importando rota | a dependência é de mão única: a rota compõe a feature |
|
|
135
143
|
| `import/no-restricted-paths` `src/hooks` ↛ cliente da API | hook compartilhado chamando o backend | chamada à API é de feature, com a key factory dela; hook compartilhado é só de UI |
|
|
136
144
|
| `react/forbid-elements` `button`, `input`, `textarea`, `select`, `table`, `dialog` (fora de `components/ui/`) | elemento HTML cru onde o projeto tem componente | o primitivo do shadcn já carrega foco, estados, tema e acessibilidade; recriá-lo por tela é o que faz duas telas do mesmo app parecerem de apps diferentes |
|
|
145
|
+
| `jsx-a11y/*` de `A11Y_RULES` como erro (fora de `components/ui/`) | `div` clicável sem teclado, `tabIndex` positivo, `img` sem `alt`, `role` sem o `aria-*` que exige, ARIA inexistente, título vazio, `iframe` sem `title` | o `eslint-config-next` liga só 6 destas, e como aviso: o agente entrega tela que o mouse usa e o teclado não, e nada reprova. `aria-role` ignora componente (`role` ali é prop de domínio) e `no-noninteractive-tabindex` fica de fora: `<span tabIndex={0}>` em volta de botão desabilitado com tooltip e área com rolagem focável são padrões corretos. `div` que só faz `stopPropagation` ou fundo de modal fechado por Esc é a exceção pontual abaixo |
|
|
137
146
|
| `no-restricted-syntax` fetch/`apiClient` dentro de `useEffect` | busca de dado no efeito | sem cache, sem dedup, corrida entre requisições e cascata de render; Server Component ou TanStack Query resolvem |
|
|
138
147
|
| `no-restricted-syntax` `'use client'` em `app/layout.tsx` | layout raiz no cliente | perde `metadata` e manda a árvore inteira para o bundle do cliente |
|
|
139
148
|
| `import/no-default-export` (exceto arquivos de rota e `*.config.*`) | `export default` em componente e hook | nome único em todo import: busca e rename acham todos os usos; o Next exige `default` só nos arquivos de convenção |
|
|
140
149
|
| `@typescript-eslint/no-explicit-any` | `any` | desliga o tipo no ponto onde o dado da API entra; o certo é schema Zod + `z.infer` |
|
|
141
150
|
| `no-console` (aviso) | `console.log` esquecido | ruído no console do usuário e dado vazando; aviso, porque o diagnóstico local é legítimo |
|
|
142
151
|
|
|
143
|
-
|
|
144
|
-
`
|
|
145
|
-
|
|
152
|
+
As `A11Y_RULES` valem como erro em todo projeto com `eslint-config-next` instalado (o
|
|
153
|
+
`eslint-plugin-jsx-a11y` vem com ele), e a `react/forbid-elements` também quando há
|
|
154
|
+
`components.json`: declare-as no `eslint.config`, que é o que leva o erro ao editor e ao `check`, com
|
|
155
|
+
a mensagem que nomeia o componente. As duas valem só em
|
|
156
|
+
`.js`, `.jsx`, `.ts` e `.tsx` fora de `components/ui/`: o `eslint-config-next` não declara os plugins
|
|
157
|
+
para `.cjs`, e regra de plugin ali derruba o eslint (sondado com o 16.4.6: um arquivo ruim por regra
|
|
158
|
+
de `A11Y_RULES` → o erro esperado; o arquivo conforme, `.cjs`, `.mjs` e `components/ui/` → 0
|
|
159
|
+
problemas). A regra vem do eslint-plugin-react que o `eslint-config-next` instala (sondada com
|
|
146
160
|
o 7.37.5 do eslint-config-next 16.4.6: `<button>`, `<input>` e `<table>` em `features/` → erro; o
|
|
147
161
|
wrapper em `components/ui/` → 0 problemas). `<input type="file">` ou `type="hidden"` sem componente
|
|
148
162
|
equivalente é a exceção pontual abaixo, com o motivo.
|
|
@@ -107,7 +107,7 @@ Tests are paid for by **risk, not by new code**. The plan (`morph-plan`) marks e
|
|
|
107
107
|
with `prova:` and, for a test, a `risco:` (business rule, money, external contract, concurrency,
|
|
108
108
|
data integrity, regression). The budget is **one test per risky scenario, plus the regression test of
|
|
109
109
|
the bug being fixed**; going above it takes a one-line justification on the scenario. A scenario
|
|
110
|
-
without risk — CRUD, DTO, mapping, wiring, constants, layout — is `prova: leitura`: the
|
|
110
|
+
without risk — CRUD, DTO, mapping, wiring, constants, layout — is `prova: leitura`: the
|
|
111
111
|
verifier proves it by reading the code, and it gets no test. Rendering, layout and copy are
|
|
112
112
|
`leitura` or `e2e`, never a unit test per component.
|
|
113
113
|
|
|
@@ -123,7 +123,7 @@ verifier proves it by reading the code, and it gets no test. Rendering, layout a
|
|
|
123
123
|
- **Order is free, proof is not the implementer's:** a bug gets a regression test, and a risky
|
|
124
124
|
scenario (a formatter of money, a reducer with rules, a schema) gets its test, in whatever order the code comes out. The
|
|
125
125
|
implementer does not run red→green cycles nor mutate production code to watch a test fail; it
|
|
126
|
-
runs its own filter once before the report, and
|
|
126
|
+
runs its own filter once before the report, and `morph-spec prove-red` shows the test bites.
|
|
127
127
|
|
|
128
128
|
## Common Mistakes
|
|
129
129
|
|
|
@@ -5,18 +5,20 @@
|
|
|
5
5
|
> **Keywords:** docker compose, worktree, ports, container_name, POSTGRES_PORT, COMPOSE_PROJECT_NAME, local dev, e2e stack
|
|
6
6
|
> **Load When:** a compose file, a dev-server port, or a worktree stack is being written or debugged
|
|
7
7
|
|
|
8
|
-
**Verified against:** Docker Compose v2 + morph-spec
|
|
8
|
+
**Verified against:** Docker Compose v2 + morph-spec 11 (ports by branch hash). The `pgvector/pgvector:pg17` tag was confirmed on Docker Hub; the image was not run. Last-verified: 2026-11-24.
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
## Why this exists
|
|
13
13
|
|
|
14
|
-
Every
|
|
14
|
+
Every worktree runs its **own** compose stack — its own project, its own postgres, its own volumes. That only holds if the compose file lets the harness pick the host ports and the project name. A file that hardcodes either one looks isolated and collides the moment a second worktree starts: `container_name` is never prefixed by the project, and a fixed `5432:5432` is one host port for everybody.
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
`morph-spec env` derives everything from the **branch name**, with no registry: the same branch gets the same ports on any machine. It prints the exports for a shell (`eval "$(morph-spec env)"`, or `--powershell`), and `morph-spec check` runs the contract's test commands with the same values.
|
|
17
17
|
|
|
18
18
|
## Port layout (one contract, everywhere)
|
|
19
19
|
|
|
20
|
+
A block of 10 ports starting at `4000 + slot × 10`, the slot taken from a hash of the branch (100 slots; a block holding a port Chromium refuses is skipped):
|
|
21
|
+
|
|
20
22
|
| Offset | Variable | Compose mapping |
|
|
21
23
|
|---|---|---|
|
|
22
24
|
| +0 | `PORT` | `"${PORT:-3000}:3000"` — web / dev server |
|
|
@@ -25,48 +27,31 @@ The harness gives each worktree a **block of 10 ports** (`.morph/worktree.env`,
|
|
|
25
27
|
| +3 | `REDIS_PORT` | `"${REDIS_PORT:-6379}:6379"` (reserved) |
|
|
26
28
|
| +4..+9 | free | project-specific services |
|
|
27
29
|
|
|
28
|
-
Also exported: `COMPOSE_PROJECT_NAME
|
|
30
|
+
Also exported: `COMPOSE_PROJECT_NAME` = the branch, lowercased (isolates container, network and volume names). Two branches can hash to the same slot: with many worktrees open at once, a port already taken is the first thing to suspect.
|
|
29
31
|
|
|
30
32
|
## Project-named port variables
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
A compose file that reads a port by another name (`"${PG_PORT:-5433}:5432"`) is **not** fed by the block: it publishes its own default. Declare the name the project reads:
|
|
33
35
|
|
|
34
36
|
```json
|
|
35
37
|
{ "e2e": { "portEnvNames": { "postgres": "PG_PORT" } } }
|
|
36
38
|
```
|
|
37
39
|
|
|
38
|
-
Keys are `web`, `api`, `postgres` and `redis`. Each declared name carries the **same value** as the standard variable
|
|
40
|
+
Keys are `web`, `api`, `postgres` and `redis`. Each declared name carries the **same value** as the standard variable. An invalid name or an unknown key is dropped.
|
|
39
41
|
|
|
40
42
|
## Core Rules
|
|
41
43
|
|
|
42
44
|
- NEVER set `container_name` — Compose already names containers `<project>-<service>-1`, and an explicit name is shared by every worktree
|
|
43
45
|
- ALWAYS publish host ports through a variable with a default: `"${PORT:-3000}:3000"`, never `"3000:3000"` nor `published: 3000`
|
|
44
|
-
- ALWAYS keep the database name stable (`POSTGRES_DB: ${POSTGRES_DB:-app}`) — the project name already namespaces the container and the volume; baking a
|
|
45
|
-
- ALWAYS declare a healthcheck on every service — `docker compose up --wait`
|
|
46
|
+
- ALWAYS keep the database name stable (`POSTGRES_DB: ${POSTGRES_DB:-app}`) — the project name already namespaces the container and the volume; baking a branch name into the DB name outlives the branch
|
|
47
|
+
- ALWAYS declare a healthcheck on every service — `docker compose up --wait` is meaningless without one
|
|
46
48
|
- ALWAYS give `DATABASE_URL` an in-network default so the stack comes up with no `.env`: `postgresql://postgres:postgres@postgres:5432/${POSTGRES_DB:-app}`
|
|
47
49
|
- ALWAYS read the base URL from the environment in `playwright.config.ts`: `process.env.PLAYWRIGHT_BASE_URL ?? \`http://localhost:${process.env.PORT ?? 3000}\``
|
|
48
|
-
- NEVER put a
|
|
49
|
-
- NEVER put a variable from the port layout table above (nor `PLAYWRIGHT_BASE_URL`, nor a name declared in `e2e.portEnvNames`) in that credentials file — the harness **ignores** it and says which key it ignored on stderr. Ports come from the allocated block; the file carries credentials. A `.env.e2e` copied from a sibling worktree carries THAT worktree's block, and before the filter existed it silently repointed this stack at the neighbour's postgres
|
|
50
|
-
|
|
51
|
-
## What the harness enforces
|
|
52
|
-
|
|
53
|
-
- Inside a secondary worktree, a compose with a fixed host port or a `container_name` **fails the `verify` e2e node** (`compose-not-isolable`) — Gate 3 cannot pass on a stack that cannot run beside its siblings. At the primary root the same finding is a warning.
|
|
54
|
-
- `morph-spec finish` and `morph-spec delete` tear the stack down with `down --remove-orphans --rmi local -v` (`--keep-volumes` on `finish` drops the `-v`) and delete the freshness stamp. `--rmi local` removes only the images compose built, never a pulled one (`postgres`) that the next feature would download again; `docker builder prune` never runs, because the build cache is global to the machine. `morph-spec worktree remove` (and `worktree reap`, which goes through it) tears down a `morph/{f}` branch without volumes (the feature is still open) and a `morph-task/*` branch with `-v` (the task is disposable). Every one of these also stops the `e2e.hostServices` processes.
|
|
55
|
-
- Two worktrees never share `POSTGRES_PORT`: the block is allocated first-free-index per feature and released only when the worktree is removed.
|
|
56
|
-
- The credentials env file is read **after** the block but cannot outrank it. All four surfaces (`e2e up`, the `verify` e2e node, the teardown, `morph-spec env`) build their environment through the same `buildComposeEnv`, which drops the layout keys coming from that file and names them on **stderr** — stdout stays eval-safe for `eval "$(morph-spec env)"`. With no block allocated (outside a worktree) nothing is filtered: there the file is the only port source.
|
|
57
|
-
|
|
58
|
-
## Services on the host
|
|
50
|
+
- NEVER put a port from the layout table in a committed `.env` — a value copied from a sibling worktree repoints this stack at the neighbour's postgres. Credentials go in a gitignored file; ports come from the block
|
|
59
51
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
```json
|
|
63
|
-
"e2e": { "hostServices": [
|
|
64
|
-
{ "name": "web", "build": "npm run build", "start": "node .next/standalone/server.js",
|
|
65
|
-
"env": { "PORT": "${PORT}" }, "health": "http://localhost:${PORT}/" }
|
|
66
|
-
] }
|
|
67
|
-
```
|
|
52
|
+
## Tearing down
|
|
68
53
|
|
|
69
|
-
|
|
54
|
+
Whoever created the worktree removes it (the orchestrator, `claude -w`, Orca). Before removing, `docker compose -p <COMPOSE_PROJECT_NAME> down --remove-orphans -v` drops the containers, the network and the volumes of that branch; `--rmi local` also removes only the images compose built, never a pulled one (`postgres`) that the next branch would download again.
|
|
70
55
|
|
|
71
56
|
## Minimal compose skeleton
|
|
72
57
|
|
|
@@ -109,6 +94,5 @@ volumes:
|
|
|
109
94
|
```bash
|
|
110
95
|
# inside the worktree, outside Claude Code
|
|
111
96
|
eval "$(morph-spec env)" # PowerShell: morph-spec env --powershell | Invoke-Expression
|
|
112
|
-
|
|
113
|
-
docker compose up -d --wait # lands in project morph-{feature}, on the block's ports
|
|
97
|
+
docker compose up -d --wait # lands in the project named after the branch, on the block's ports
|
|
114
98
|
```
|
|
@@ -13,7 +13,7 @@ Preencha cada campo uma vez, no setup. Não modifique a estrutura.
|
|
|
13
13
|
|
|
14
14
|
**Harness** — não alterar. Esta seção instrui o modelo a:
|
|
15
15
|
1. Ler `MORPH.md` ao iniciar a sessão
|
|
16
|
-
2.
|
|
16
|
+
2. Tomar a feature pela pasta do branch atual (`.morph/features/<slug-do-branch>/`)
|
|
17
17
|
3. Assumir o papel correspondente sem aguardar instrução
|
|
18
18
|
|
|
19
19
|
**Standards do projeto** — opcional. Apenas se algum standard específico do projeto desvia do default do stack. Default já injetado pelo morph-plan.
|
|
@@ -25,5 +25,5 @@ Preencha cada campo uma vez, no setup. Não modifique a estrutura.
|
|
|
25
25
|
- Mantenha < 60 linhas — conteúdo acima não cabe em contexto comprimido.
|
|
26
26
|
- Não adicione regras condicionais (sem "se dotnet, então...").
|
|
27
27
|
- Não inline conteúdo de standards — aponte por ID, nunca copie.
|
|
28
|
-
- Não adicione campo "Feature ativa" estático —
|
|
28
|
+
- Não adicione campo "Feature ativa" estático — a feature é a do branch.
|
|
29
29
|
- Este arquivo pertence ao projeto. Versione no git.
|
|
@@ -18,7 +18,7 @@ through the registry, and this README never repeats a path the registry already
|
|
|
18
18
|
|
|
19
19
|
```
|
|
20
20
|
framework/templates/
|
|
21
|
-
├── docs/ # plan.md (the plan's single source)
|
|
21
|
+
├── docs/ # plan.md (the plan's single source)
|
|
22
22
|
├── context/ # ARCHITECTURE.md, design-system.md
|
|
23
23
|
│
|
|
24
24
|
├── code/ # Code templates, by technology
|
|
@@ -308,7 +308,9 @@
|
|
|
308
308
|
"phase": "implement",
|
|
309
309
|
"description": "Neon Auth (Better Auth) EdDSA/Ed25519 JWT validation for .NET via BouncyCastle — cached JWKS provider + manual SignatureValidator (no OIDC discovery available)",
|
|
310
310
|
"outputName": "NeonAuthConfig.cs",
|
|
311
|
-
"placeholders": [
|
|
311
|
+
"placeholders": [
|
|
312
|
+
"Namespace"
|
|
313
|
+
],
|
|
312
314
|
"deprecated": false,
|
|
313
315
|
"validatePlaceholders": true
|
|
314
316
|
},
|
|
@@ -325,21 +327,6 @@
|
|
|
325
327
|
"deprecated": false,
|
|
326
328
|
"validatePlaceholders": true
|
|
327
329
|
},
|
|
328
|
-
{
|
|
329
|
-
"id": "ui-mockups",
|
|
330
|
-
"kind": "template",
|
|
331
|
-
"name": "UI Mockups",
|
|
332
|
-
"path": "docs/ui-mockups.md",
|
|
333
|
-
"category": "documentation",
|
|
334
|
-
"phase": "uiux",
|
|
335
|
-
"description": "Por tela: protótipo HTML, direção escolhida, checklist de tela de 5 itens, componentes e fluxo",
|
|
336
|
-
"outputName": "mockups.md",
|
|
337
|
-
"placeholders": [
|
|
338
|
-
"FEATURE_NAME"
|
|
339
|
-
],
|
|
340
|
-
"deprecated": false,
|
|
341
|
-
"validatePlaceholders": true
|
|
342
|
-
},
|
|
343
330
|
{
|
|
344
331
|
"id": "github-workflow-dotnet-build",
|
|
345
332
|
"kind": "template",
|
|
@@ -798,23 +785,6 @@
|
|
|
798
785
|
"deprecated": false,
|
|
799
786
|
"placeholders": [],
|
|
800
787
|
"validatePlaceholders": true
|
|
801
|
-
},
|
|
802
|
-
{
|
|
803
|
-
"id": "state-template",
|
|
804
|
-
"kind": "template",
|
|
805
|
-
"name": "state.json",
|
|
806
|
-
"path": "state.template.json",
|
|
807
|
-
"category": "context",
|
|
808
|
-
"phase": null,
|
|
809
|
-
"outputName": null,
|
|
810
|
-
"description": "Initial .morph/state.json scaffold for a new project",
|
|
811
|
-
"deprecated": false,
|
|
812
|
-
"placeholders": [
|
|
813
|
-
"PROJECT_NAME",
|
|
814
|
-
"PROJECT_TYPE",
|
|
815
|
-
"TIMESTAMP"
|
|
816
|
-
],
|
|
817
|
-
"validatePlaceholders": true
|
|
818
788
|
}
|
|
819
789
|
]
|
|
820
790
|
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
arquivo, classe, tabela ou sigla interna. "Atenção" é opcional e repete: o que merece um olhar antes de aprovar. -->
|
|
10
10
|
|
|
11
11
|
- Nome: <como você chamaria esta feature numa conversa, com acento>
|
|
12
|
+
- Tipo: <feature | bug | chore | hotfix>
|
|
12
13
|
- Hoje: <o que acontece hoje e quem sente>
|
|
13
14
|
- Depois: <o que passa a acontecer e como essa pessoa percebe>
|
|
14
15
|
- Atenção: <o que pode dar errado ou não tem volta>
|
|
@@ -34,7 +35,7 @@ Resultado buscado: <o estado depois: o que muda, para quem, como se percebe.>
|
|
|
34
35
|
|
|
35
36
|
1. <padrão e o valor escolhido>
|
|
36
37
|
|
|
37
|
-
<!-- Opcionais
|
|
38
|
+
<!-- Opcionais: "Fluxo" (h2), o caminho pelo sistema, e "Estados" (h2), se algo muda de
|
|
38
39
|
estado. Uma transição por linha: "- origem → destino: gatilho". -->
|
|
39
40
|
|
|
40
41
|
## Cenários
|
|
@@ -63,7 +64,7 @@ Resultado buscado: <o estado depois: o que muda, para quem, como se percebe.>
|
|
|
63
64
|
### Conflitos com o acervo
|
|
64
65
|
|
|
65
66
|
<!-- ADR do índice (.morph/specs/adrs/) que este plano contradiz: "nenhum", ou a tabela abaixo fora do bloco.
|
|
66
|
-
|
|
67
|
+
Cada linha diz o que muda no índice: total retira o ADR; parcial o mantém com o escopo onde ainda vale.
|
|
67
68
|
```
|
|
68
69
|
| ADR | Mudança | Escopo em que o antigo ainda vale |
|
|
69
70
|
|---|---|---|
|
|
@@ -44,8 +44,7 @@ dotnet test --solution Morph.AiKit.sln -c Release --no-build
|
|
|
44
44
|
> Consequência: **um parser escrito só para o sumário do VSTest não conta os testes
|
|
45
45
|
> deste projeto** — um parser que procure uma linha *começando* em
|
|
46
46
|
> `Aprovado!`/`Passed!` **e** contendo `Total de testes:`/`Total:` falha nos dois
|
|
47
|
-
> eixos, e nos dois locales.
|
|
48
|
-
> desde a issue #115; antes, a contagem deste projeto voltava desconhecida.
|
|
47
|
+
> eixos, e nos dois locales.
|
|
49
48
|
|
|
50
49
|
> **Descoberta parcial não pode passar verde.** O `.csproj` de teste declara
|
|
51
50
|
> `TestingPlatformCommandLineArguments` com o piso `--minimum-expected-tests N`
|
|
@@ -54,8 +53,7 @@ dotnet test --solution Morph.AiKit.sln -c Release --no-build
|
|
|
54
53
|
> (`ZeroTests`) — o piso não supera esse veredito (medido duas vezes, com piso
|
|
55
54
|
> 275 e com piso 1). Sem piso, uma execução que descobre **1 de 115** imprime
|
|
56
55
|
> *"Aprovado!"* e sai **0** — medido. O piso mora no `.csproj`, e não no passo
|
|
57
|
-
> do workflow, para valer em toda invocação (CI, máquina do dev e o
|
|
58
|
-
> do `morph-spec verify`); por isso nenhum chamador repassa a flag. Ao adicionar
|
|
56
|
+
> do workflow, para valer em toda invocação (CI, máquina do dev e o `morph-spec check`); por isso nenhum chamador repassa a flag. Ao adicionar
|
|
59
57
|
> testes, suba o piso — `test/framework/ai-kit-ci-packaging.test.js` reprova um
|
|
60
58
|
> piso que ficou para trás da contagem de `[Fact]`/`[Theory]`.
|
|
61
59
|
|
|
@@ -2,7 +2,7 @@ namespace Morph.AiKit.Evals;
|
|
|
2
2
|
|
|
3
3
|
public sealed class EvalCacheMissException : Exception
|
|
4
4
|
{
|
|
5
|
-
public const string RefreshCommand = "
|
|
5
|
+
public const string RefreshCommand = "MORPH_EVAL_MODE=refresh + o comando de eval do contrato";
|
|
6
6
|
|
|
7
7
|
public EvalCacheMissException(string scenarioName, string cachePath, string envFile)
|
|
8
8
|
: base(BuildMessage(scenarioName, cachePath, envFile))
|
|
@@ -325,7 +325,7 @@ public sealed class EvalFixture : IAsyncDisposable
|
|
|
325
325
|
=> Environment.GetEnvironmentVariable(variable)
|
|
326
326
|
?? throw new InvalidOperationException(
|
|
327
327
|
$"eval-env-missing: a variavel {variable} nao esta definida. "
|
|
328
|
-
+ "
|
|
328
|
+
+ "Defina-a no .runsettings do projeto de eval ou no comando de eval do contrato (project.tests[]).");
|
|
329
329
|
|
|
330
330
|
private static EvalMode ParseMode(string? raw) => (raw ?? "offline").ToLowerInvariant() switch
|
|
331
331
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polymorphism-tech/morph-spec",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"description": "MORPH-SPEC: NLH (Natural Language Harness) for spec-driven development with Claude Code",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
"bin/",
|
|
28
28
|
"src/",
|
|
29
29
|
"framework/",
|
|
30
|
-
"claude-plugin.json",
|
|
31
30
|
"docs/QUICKSTART.md",
|
|
32
31
|
"docs/CHEATSHEET.md",
|
|
33
32
|
"README.md",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { loadGraph, getFreshness, describeStale } from '../../lib/graph/graph-loader.js';
|
|
3
|
-
import { buildIndex, resolveLabel, neighborhood
|
|
3
|
+
import { buildIndex, resolveLabel, neighborhood } from '../../lib/graph/sanitize.js';
|
|
4
|
+
import { isTestPath } from '../../lib/diff/diff-lines.js';
|
|
4
5
|
|
|
5
6
|
const FALLBACK_HINT = 'Sem resposta do grafo, caia para grep/Glob.';
|
|
6
7
|
|
|
@@ -2,7 +2,8 @@ import chalk from 'chalk';
|
|
|
2
2
|
import {
|
|
3
3
|
loadGraph, getFreshness, describeStale, refreshState, staleCause,
|
|
4
4
|
} from '../../lib/graph/graph-loader.js';
|
|
5
|
-
import { buildIndex, classifyLabel
|
|
5
|
+
import { buildIndex, classifyLabel } from '../../lib/graph/sanitize.js';
|
|
6
|
+
import { isTestPath } from '../../lib/diff/diff-lines.js';
|
|
6
7
|
import { GRAPHIFY_VERSION, detectGraphifyVersion } from '../../lib/graph/graphify-runtime.js';
|
|
7
8
|
|
|
8
9
|
function summarizeSanitize(index) {
|
|
@@ -11,8 +11,7 @@ import {
|
|
|
11
11
|
generateSetupInstructions,
|
|
12
12
|
formatMcpStatusTable,
|
|
13
13
|
loadMcpRegistry,
|
|
14
|
-
isRemoteMcp
|
|
15
|
-
patchConfigForPlatform
|
|
14
|
+
isRemoteMcp
|
|
16
15
|
} from '../../lib/installers/mcp-installer.js';
|
|
17
16
|
import { detectClaudeConfig } from '../../lib/detectors/claude-config-detector.js';
|
|
18
17
|
import { detectProject } from '../../lib/detectors/index.js';
|