@polymorphism-tech/morph-spec 4.3.7 → 4.6.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/.morph/.morphversion +3 -3
- package/.morph/analytics/threads-log.jsonl +6 -9
- package/.morph/config/config.json +2 -3
- package/.morph/framework/standards/STANDARDS.json +812 -0
- package/.morph/{standards → framework/standards}/ai-agents/team-orchestration.md +3 -3
- package/.morph/{standards → framework/standards}/frontend/nextjs/nextjs-patterns.md +17 -0
- package/.morph/framework/standards/integration/mcp/mcp-tools.md +384 -0
- package/.morph/{templates → framework/templates}/README.md +17 -17
- package/.morph/{templates → framework/templates}/REGISTRY.json +48 -233
- package/.morph/framework/templates/code/dotnet/contracts/contracts.cs.hbs +172 -0
- package/.morph/{templates → framework/templates}/context/CONTEXT-FEATURE.md +1 -1
- package/.morph/{templates → framework/templates}/context/CONTEXT.md +3 -3
- package/.morph/framework/templates/docs/clarifications.md +253 -0
- package/.morph/framework/templates/docs/onboarding.md +123 -0
- package/.morph/framework/templates/docs/schema-analysis.md +119 -0
- package/.morph/{templates → framework/templates}/docs/spec.md +149 -149
- package/.morph/framework/templates/docs/ui-components.md +124 -0
- package/.morph/framework/templates/docs/ui-design-system.md +76 -0
- package/.morph/framework/templates/docs/ui-flows.md +167 -0
- package/.morph/framework/templates/docs/ui-mockups.md +98 -0
- package/.morph/framework/templates/docs/user-stories.md +34 -0
- package/.morph/{templates → framework/templates}/examples/spec-examples.md +1 -1
- package/.morph/{templates → framework/templates}/infrastructure/github/README.md +11 -11
- package/.morph/{templates → framework/templates}/infrastructure/github/workflows/deploy-azure-app-service.yml.hbs +2 -2
- package/.morph/{templates → framework/templates}/meta-prompts/parallel-workers/parallel-worker.md +2 -2
- package/.morph/{templates → framework/templates}/meta-prompts/validators/pre-commit-validator.md +1 -1
- package/.morph/logs/tool-failures.log +7 -0
- package/.morph/memory/pre-compact-2026-02-23T15-43-03-521Z.json +16 -0
- package/.morph/state.json +1 -1
- package/CLAUDE.md +77 -155
- package/README.md +20 -18
- package/bin/detect-agents.js +1 -1
- package/bin/morph-spec.js +116 -266
- package/bin/task-manager.cjs +2 -2
- package/bin/validate.js +1 -1
- package/claude-plugin.json +14 -0
- package/docs/claude-alignment-report.md +137 -0
- package/docs/plans/2026-02-22-claude-docs-morph-alignment-analysis.md +512 -0
- package/docs/plans/2026-02-22-claude-settings.md +515 -0
- package/docs/plans/2026-02-22-morph-cc-alignment-impl.md +728 -0
- package/docs/plans/2026-02-22-morph-spec-next.md +478 -0
- package/docs/plans/2026-02-22-native-alignment-design.md +199 -0
- package/docs/plans/2026-02-22-native-alignment-impl.md +925 -0
- package/docs/plans/2026-02-22-native-enrichment-design.md +244 -0
- package/docs/plans/2026-02-22-native-enrichment.md +735 -0
- package/framework/CLAUDE.md +77 -0
- package/framework/{skills/level-2-domains → agents}/ai-agents/ai-system-architect.md +7 -3
- package/framework/{skills/level-2-domains → agents}/architecture/po-pm-advisor.md +7 -1
- package/framework/{skills/level-2-domains → agents}/architecture/prompt-engineer.md +7 -1
- package/framework/{skills/level-2-domains → agents}/architecture/seo-growth-hacker.md +7 -1
- package/framework/{skills/level-2-domains → agents}/architecture/standards-architect.md +10 -6
- package/framework/agents/backend/api-designer.md +103 -0
- package/framework/{skills/level-2-domains → agents}/backend/dotnet-senior.md +7 -1
- package/framework/agents/backend/ef-modeler.md +119 -0
- package/framework/{skills/level-2-domains → agents}/backend/hangfire-orchestrator.md +8 -4
- package/framework/{skills/level-2-domains → agents}/backend/ms-agent-expert.md +7 -3
- package/framework/{skills/level-2-domains → agents}/frontend/blazor-builder.md +7 -3
- package/framework/{skills/level-2-domains → agents}/frontend/nextjs-expert.md +7 -3
- package/framework/{skills/level-2-domains → agents}/frontend/ui-ux-designer.md +8 -2
- package/framework/{skills/level-2-domains → agents}/infrastructure/azure-architect.md +7 -1
- package/framework/{skills/level-2-domains → agents}/infrastructure/azure-deploy-specialist.md +7 -1
- package/framework/{skills/level-2-domains → agents}/infrastructure/bicep-architect.md +7 -3
- package/framework/{skills/level-2-domains → agents}/infrastructure/container-specialist.md +7 -3
- package/framework/{skills/level-2-domains → agents}/infrastructure/devops-engineer.md +7 -3
- package/framework/{skills/level-2-domains → agents}/integrations/asaas-financial.md +7 -3
- package/framework/{skills/level-2-domains → agents}/integrations/azure-identity.md +7 -3
- package/framework/{skills/level-2-domains → agents}/integrations/clerk-auth.md +7 -3
- package/framework/{skills/level-2-domains/integrations/hangfire-orchestrator.md → agents/integrations/hangfire-integration.md} +7 -1
- package/framework/{skills/level-2-domains → agents}/integrations/resend-email.md +7 -3
- package/framework/{skills/level-2-domains → agents}/quality/code-analyzer.md +9 -5
- package/framework/{skills/level-2-domains → agents}/quality/testing-specialist.md +7 -3
- package/framework/commands/morph-apply.md +9 -9
- package/framework/commands/morph-archive.md +8 -8
- package/framework/commands/morph-infra.md +1 -1
- package/framework/commands/morph-proposal.md +9 -9
- package/framework/commands/morph-status.md +3 -3
- package/framework/commands/morph-troubleshoot.md +1 -1
- package/framework/hooks/README.md +201 -282
- package/framework/hooks/claude-code/notification/approval-reminder.js +52 -0
- package/framework/hooks/claude-code/post-tool-use/dispatch.js +83 -0
- package/framework/hooks/claude-code/post-tool-use/handle-tool-failure.js +42 -0
- package/framework/hooks/claude-code/pre-compact/save-morph-context.js +61 -0
- package/framework/hooks/claude-code/pre-tool-use/enforce-phase-writes.js +71 -0
- package/framework/hooks/claude-code/pre-tool-use/protect-readonly-files.js +58 -0
- package/framework/hooks/claude-code/pre-tool-use/protect-spec-files.js +64 -0
- package/framework/hooks/claude-code/session-start/inject-morph-context.js +94 -0
- package/framework/hooks/claude-code/statusline.py +538 -0
- package/framework/hooks/claude-code/statusline.sh +7 -0
- package/framework/hooks/claude-code/stop/validate-completion.js +88 -0
- package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +91 -0
- package/framework/hooks/shared/hook-response.js +45 -0
- package/framework/hooks/shared/phase-utils.js +129 -0
- package/framework/hooks/shared/state-reader.js +138 -0
- package/framework/hooks/shared/stdin-reader.js +26 -0
- package/framework/phases.json +145 -0
- package/framework/rules/csharp-standards.md +10 -0
- package/framework/rules/frontend-standards.md +14 -0
- package/framework/rules/infrastructure-standards.md +13 -0
- package/framework/rules/morph-workflow.md +86 -0
- package/framework/rules/testing-standards.md +11 -0
- package/framework/skills/README.md +66 -0
- package/framework/skills/level-0-meta/brainstorming/SKILL.md +135 -0
- package/framework/skills/level-0-meta/brainstorming/references/proposal-example.md +138 -0
- package/framework/skills/level-0-meta/{code-review.md → code-review/SKILL.md} +13 -4
- package/framework/skills/level-0-meta/code-review/references/review-example.md +164 -0
- package/framework/skills/level-0-meta/code-review/scripts/scan-csharp.mjs +121 -0
- package/framework/skills/level-0-meta/mcp-registry.json +207 -0
- package/framework/skills/level-0-meta/{morph-checklist.md → morph-checklist/SKILL.md} +8 -3
- package/framework/skills/{level-1-workflows/morph-replicate.md → level-0-meta/morph-replicate/SKILL.md} +13 -6
- package/framework/skills/level-0-meta/{simulation-checklist.md → simulation-checklist/SKILL.md} +9 -4
- package/framework/skills/level-0-meta/tool-usage-guide/SKILL.md +334 -0
- package/framework/skills/level-0-meta/verification-before-completion/SKILL.md +147 -0
- package/framework/skills/level-0-meta/verification-before-completion/scripts/check-phase-outputs.mjs +110 -0
- package/framework/skills/level-1-workflows/{phase-clarify.md → phase-clarify/SKILL.md} +65 -4
- package/framework/skills/level-1-workflows/phase-clarify/references/clarifications-example.md +117 -0
- package/framework/skills/level-1-workflows/phase-codebase-analysis/SKILL.md +181 -0
- package/framework/skills/level-1-workflows/phase-design/SKILL.md +303 -0
- package/framework/skills/level-1-workflows/phase-design/references/spec-example.md +253 -0
- package/framework/skills/level-1-workflows/phase-implement/SKILL.md +254 -0
- package/framework/skills/level-1-workflows/phase-implement/references/recap-example.md +132 -0
- package/framework/skills/level-1-workflows/phase-setup/SKILL.md +171 -0
- package/framework/skills/level-1-workflows/{phase-tasks.md → phase-tasks/SKILL.md} +89 -7
- package/framework/skills/level-1-workflows/phase-tasks/references/tasks-example.md +231 -0
- package/framework/skills/level-1-workflows/phase-tasks/scripts/validate-tasks.mjs +112 -0
- package/framework/skills/level-1-workflows/phase-uiux/SKILL.md +246 -0
- package/framework/standards/STANDARDS.json +812 -0
- package/framework/standards/ai-agents/team-orchestration.md +3 -3
- package/framework/standards/frontend/nextjs/nextjs-patterns.md +17 -0
- package/framework/standards/integration/mcp/mcp-tools.md +384 -0
- package/framework/templates/README.md +17 -17
- package/framework/templates/REGISTRY.json +48 -233
- package/framework/templates/code/dotnet/contracts/contracts.cs.hbs +172 -0
- package/framework/templates/context/CONTEXT-FEATURE.md +1 -1
- package/framework/templates/context/CONTEXT.md +3 -3
- package/framework/templates/docs/clarifications.md +253 -0
- package/framework/templates/docs/onboarding.md +123 -0
- package/framework/templates/docs/schema-analysis.md +119 -0
- package/framework/templates/docs/spec.md +149 -149
- package/framework/templates/docs/ui-components.md +124 -0
- package/framework/templates/docs/ui-design-system.md +76 -0
- package/framework/templates/docs/ui-flows.md +167 -0
- package/framework/templates/docs/ui-mockups.md +98 -0
- package/framework/templates/docs/user-stories.md +34 -0
- package/framework/templates/examples/spec-examples.md +1 -1
- package/framework/templates/infrastructure/github/README.md +11 -11
- package/framework/templates/infrastructure/github/workflows/deploy-azure-app-service.yml.hbs +2 -2
- package/framework/templates/meta-prompts/parallel-workers/parallel-worker.md +2 -2
- package/framework/templates/meta-prompts/validators/pre-commit-validator.md +1 -1
- package/framework/workflows/configs/express.json +45 -0
- package/framework/workflows/configs/spec-only.json +43 -0
- package/framework/workflows/docs/enforcement-pipeline.md +8 -8
- package/framework/workflows/docs/full-morph.md +3 -3
- package/package.json +3 -1
- package/scripts/generate-refs.js +336 -0
- package/scripts/generate-standards-registry.js +44 -0
- package/scripts/validate-real.mjs +255 -0
- package/src/commands/feature/create-story.js +362 -361
- package/src/commands/feature/shard-spec.js +225 -224
- package/src/commands/feature/sprint-status.js +1 -1
- package/src/commands/generation/generate-onboarding.js +169 -0
- package/src/commands/generation/generate.js +2 -2
- package/src/commands/mcp/mcp-setup.js +315 -0
- package/src/commands/project/changes.js +66 -0
- package/src/commands/project/checkpoint.js +209 -0
- package/src/commands/project/cost.js +179 -0
- package/src/commands/project/diff.js +278 -0
- package/src/commands/project/doctor.js +55 -7
- package/src/commands/project/init.js +318 -136
- package/src/commands/project/revert.js +173 -0
- package/src/commands/project/standards.js +80 -0
- package/src/commands/project/status.js +376 -0
- package/src/commands/project/update-agents.js +23 -0
- package/src/commands/project/update.js +60 -88
- package/src/commands/state/advance-phase.js +4 -3
- package/src/commands/state/state.js +10 -3
- package/src/commands/state/validate-phase.js +19 -2
- package/src/commands/templates/template-customize.js +4 -4
- package/src/commands/templates/template-render.js +1 -1
- package/src/commands/templates/template-show.js +1 -1
- package/src/commands/validation/validate-feature.js +359 -0
- package/src/core/orchestrator.js +3 -38
- package/src/core/paths/output-schema.js +135 -0
- package/src/core/state/state-manager.js +831 -592
- package/src/core/templates/template-registry.js +2 -2
- package/src/core/workflows/workflow-detector.js +17 -1
- package/src/lib/agents/micro-agent-factory.js +1 -1
- package/src/lib/context/context-bundler.js +2 -1
- package/src/lib/detectors/claude-config-detector.js +390 -0
- package/src/lib/detectors/conversation-analyzer.js +4 -4
- package/src/lib/detectors/design-system-detector.js +6 -5
- package/src/lib/detectors/standards-generator.js +2 -2
- package/src/lib/generators/context-generator.js +539 -538
- package/src/lib/generators/recap-generator.js +1 -1
- package/src/lib/generators/settings-generator.js +210 -0
- package/src/lib/hooks/hook-executor.js +1 -1
- package/src/lib/installers/mcp-installer.js +299 -0
- package/src/lib/learning/learning-system.js +3 -3
- package/src/lib/orchestration/team-orchestrator.js +1 -1
- package/src/lib/standards/standards-context-injector.js +7 -7
- package/src/lib/threads/thread-coordinator.js +1 -1
- package/src/lib/troubleshooting/troubleshoot-grep.js +1 -1
- package/src/lib/validators/contracts/contract-compliance-validator.js +274 -273
- package/src/lib/validators/design-system/design-system-validator.js +1 -1
- package/src/lib/validators/spec-validator.js +258 -258
- package/src/lib/validators/validation-runner.js +270 -269
- package/src/utils/agents-installer.js +206 -0
- package/src/utils/claude-settings-manager.js +258 -0
- package/src/utils/file-copier.js +1 -1
- package/src/utils/hooks-installer.js +354 -28
- package/src/utils/skills-installer.js +118 -0
- package/.morph/project/context/README.md +0 -17
- package/.morph/project/context/detection-log.md +0 -16
- package/.morph/project/standards/inferred.md +0 -59
- package/framework/hooks/agent-stop/validate-and-continue.js +0 -96
- package/framework/hooks/agent-stop/validate-checkpoints.js +0 -101
- package/framework/hooks/agent-stop/validate-tests.js +0 -109
- package/framework/hooks/agent-teams/dispatch.js +0 -67
- package/framework/hooks/agent-teams/phase-advanced.js +0 -80
- package/framework/hooks/agent-teams/task-completed.js +0 -76
- package/framework/hooks/agent-teams/teammate-idle.js +0 -70
- package/framework/skills/level-1-workflows/phase-design.md +0 -213
- package/framework/skills/level-1-workflows/phase-setup.md +0 -106
- package/framework/skills/level-1-workflows/phase-uiux.md +0 -169
- package/framework/skills/level-2-domains/backend/api-designer.md +0 -59
- package/framework/skills/level-2-domains/backend/ef-modeler.md +0 -58
- package/framework/skills/level-3-technologies/README.md +0 -7
- package/framework/skills/level-4-patterns/README.md +0 -7
- package/src/commands/agents/agents-fuse.js +0 -97
- package/src/commands/agents/micro-agent.js +0 -112
- package/src/commands/agents/spawn-team.js +0 -237
- package/src/commands/agents/squad-template.js +0 -146
- package/src/commands/analytics/analytics.js +0 -176
- package/src/commands/context/context-prime.js +0 -63
- package/src/commands/context/core-four.js +0 -54
- package/src/commands/generation/generate-context.js +0 -40
- package/src/commands/project/detect-agents.js +0 -207
- package/src/commands/project/detect-workflow.js +0 -174
- package/src/commands/threads/thread-template.js +0 -103
- package/src/commands/threads/threads.js +0 -261
- package/src/commands/utils/session-summary.js +0 -291
- package/src/llm/analyzer.js +0 -215
- package/src/llm/few-shot-examples.js +0 -216
- package/src/llm/project-config-schema.json +0 -188
- package/src/llm/prompt-builder.js +0 -96
- /package/.morph/{config → framework}/agents.json +0 -0
- /package/.morph/{standards → framework/standards}/ai-agents/blazor-ui.md +0 -0
- /package/.morph/{standards → framework/standards}/ai-agents/production.md +0 -0
- /package/.morph/{standards → framework/standards}/ai-agents/setup.md +0 -0
- /package/.morph/{standards → framework/standards}/ai-agents/workflows.md +0 -0
- /package/.morph/{standards → framework/standards}/architecture/ddd/aggregates.md +0 -0
- /package/.morph/{standards → framework/standards}/architecture/ddd/entities.md +0 -0
- /package/.morph/{standards → framework/standards}/architecture/ddd/value-objects.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/api/minimal-api.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/api/rest.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/api/validation.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/authentication/passkeys.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/database/ef-core.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/database/migrations.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/database/postgresql/database.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/database/repository-patterns.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/database/vector-search-rag.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/dotnet/async.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/dotnet/core.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/dotnet/di.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/dotnet/program-cs-checklist.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/integrations/asaas/asaas-api.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/integrations/clerk/clerk-auth.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/integrations/hangfire/hangfire-jobs.md +0 -0
- /package/.morph/{standards → framework/standards}/backend/integrations/resend/resend-email.md +0 -0
- /package/.morph/{standards → framework/standards}/context/analytics.md +0 -0
- /package/.morph/{standards → framework/standards}/context/bundles.md +0 -0
- /package/.morph/{standards → framework/standards}/context/priming.md +0 -0
- /package/.morph/{standards → framework/standards}/core/architecture.md +0 -0
- /package/.morph/{standards → framework/standards}/core/coding.md +0 -0
- /package/.morph/{standards → framework/standards}/core/git-branching-strategy.md +0 -0
- /package/.morph/{standards → framework/standards}/core/git.md +0 -0
- /package/.morph/{standards → framework/standards}/core/testing.md +0 -0
- /package/.morph/{standards → framework/standards}/data/nosql/blob-storage.md +0 -0
- /package/.morph/{standards → framework/standards}/data/nosql/cache/redis.md +0 -0
- /package/.morph/{standards → framework/standards}/data/nosql/cosmos-db.md +0 -0
- /package/.morph/{standards → framework/standards}/data/vector-search/azure-ai-search.md +0 -0
- /package/.morph/{standards → framework/standards}/data/vector-search/rag-chunking.md +0 -0
- /package/.morph/{standards → framework/standards}/frontend/blazor/design-checklist.md +0 -0
- /package/.morph/{standards → framework/standards}/frontend/blazor/fluent-ui-setup.md +0 -0
- /package/.morph/{standards → framework/standards}/frontend/blazor/fluent-ui.md +0 -0
- /package/.morph/{standards → framework/standards}/frontend/blazor/html-conversion.md +0 -0
- /package/.morph/{standards → framework/standards}/frontend/blazor/lifecycle.md +0 -0
- /package/.morph/{standards → framework/standards}/frontend/blazor/pitfalls.md +0 -0
- /package/.morph/{standards → framework/standards}/frontend/blazor/state.md +0 -0
- /package/.morph/{standards → framework/standards}/frontend/design-system/animations.md +0 -0
- /package/.morph/{standards → framework/standards}/frontend/design-system/naming.md +0 -0
- /package/.morph/{standards → framework/standards}/infrastructure/azure/azure.md +0 -0
- /package/.morph/{standards → framework/standards}/infrastructure/azure/bicep/bicep-patterns.md +0 -0
- /package/.morph/{standards → framework/standards}/infrastructure/azure/devops/azure-devops-setup.md +0 -0
- /package/.morph/{standards → framework/standards}/infrastructure/azure/devops/local-development.md +0 -0
- /package/.morph/{standards → framework/standards}/infrastructure/azure/services/functions.md +0 -0
- /package/.morph/{standards → framework/standards}/infrastructure/azure/services/service-bus.md +0 -0
- /package/.morph/{standards → framework/standards}/infrastructure/azure/services/storage.md +0 -0
- /package/.morph/{standards → framework/standards}/infrastructure/docker/easypanel-deploy.md +0 -0
- /package/.morph/{standards → framework/standards}/infrastructure/supabase/mcp-setup.md +0 -0
- /package/.morph/{standards → framework/standards}/infrastructure/supabase/supabase-auth.md +0 -0
- /package/.morph/{standards → framework/standards}/infrastructure/supabase/supabase-pgvector.md +0 -0
- /package/.morph/{standards → framework/standards}/infrastructure/supabase/supabase-rls.md +0 -0
- /package/.morph/{standards → framework/standards}/infrastructure/supabase/supabase-storage.md +0 -0
- /package/.morph/{standards → framework/standards}/integration/api/graphql.md +0 -0
- /package/.morph/{standards → framework/standards}/integration/api/grpc.md +0 -0
- /package/.morph/{standards → framework/standards}/integration/api/rest-design.md +0 -0
- /package/.morph/{standards → framework/standards}/integration/event-driven/cqrs.md +0 -0
- /package/.morph/{standards → framework/standards}/integration/event-driven/event-sourcing.md +0 -0
- /package/.morph/{standards → framework/standards}/integration/event-driven/service-bus.md +0 -0
- /package/.morph/{standards → framework/standards}/observability/logging.md +0 -0
- /package/.morph/{standards → framework/standards}/observability/metrics.md +0 -0
- /package/.morph/{standards → framework/standards}/observability/monitoring.md +0 -0
- /package/.morph/{standards → framework/standards}/observability/tracing.md +0 -0
- /package/.morph/{standards → framework/standards}/workflows/parallel-execution.md +0 -0
- /package/.morph/{standards → framework/standards}/workflows/thread-management.md +0 -0
- /package/.morph/{templates → framework/templates}/.idea/morph-templates.xml +0 -0
- /package/.morph/{templates → framework/templates}/.vscode/morph-templates.code-snippets +0 -0
- /package/.morph/{templates → framework/templates}/IDE-SNIPPETS.md +0 -0
- /package/.morph/{templates → framework/templates}/code/dotnet/backend/repository.cs +0 -0
- /package/.morph/{templates → framework/templates}/code/dotnet/backend/service.cs +0 -0
- /package/.morph/{templates → framework/templates}/code/dotnet/contracts/Commands.cs +0 -0
- /package/.morph/{templates → framework/templates}/code/dotnet/contracts/Entities.cs +0 -0
- /package/.morph/{templates → framework/templates}/code/dotnet/contracts/Queries.cs +0 -0
- /package/.morph/{templates → framework/templates}/code/dotnet/contracts/README.md +0 -0
- /package/.morph/{templates → framework/templates}/code/dotnet/contracts/api-contracts.cs +0 -0
- /package/.morph/{templates → framework/templates}/code/dotnet/contracts/contracts.cs +0 -0
- /package/.morph/{templates → framework/templates}/code/dotnet/database/migration.cs +0 -0
- /package/.morph/{templates → framework/templates}/code/dotnet/frontend/component.razor +0 -0
- /package/.morph/{templates → framework/templates}/code/dotnet/jobs/agent.cs +0 -0
- /package/.morph/{templates → framework/templates}/code/dotnet/jobs/job.cs +0 -0
- /package/.morph/{templates → framework/templates}/code/dotnet/test.cs +0 -0
- /package/.morph/{templates → framework/templates}/code/sql/rls-policy.sql +0 -0
- /package/.morph/{templates → framework/templates}/code/sql/supabase-migration.sql +0 -0
- /package/.morph/{templates → framework/templates}/code/sql/supabase-migration.template.sql +0 -0
- /package/.morph/{templates → framework/templates}/code/typescript/contracts.ts +0 -0
- /package/.morph/{templates → framework/templates}/docs/proposal.md +0 -0
- /package/.morph/{templates → framework/templates}/examples/design-system-examples.md +0 -0
- /package/.morph/{templates → framework/templates}/feature/decisions.md +0 -0
- /package/.morph/{templates → framework/templates}/feature/recap.md +0 -0
- /package/.morph/{templates → framework/templates}/feature/tasks.md +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/Dockerfile.example +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/README.md +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/app-insights.bicep +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/app-service.bicep +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/container-app-env.bicep +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/container-app.bicep +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/deploy-checklist.md +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/deploy.ps1 +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/deploy.sh +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/key-vault.bicep +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/main.bicep +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/parameters.dev.json +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/parameters.prod.json +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/parameters.staging.json +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/sql-database.bicep +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/azure/storage.bicep +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/docker/Dockerfile.template +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/docker/docker-compose.template.yml +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/docker/dockerfile-api.dockerfile +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/docker/dockerfile-web.dockerfile +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/docker/easypanel.template.json +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/github/actions/azure-auth/action.yml.hbs +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/github/actions/docker-build-push/action.yml.hbs +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/github/actions/health-check/action.yml.hbs +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/github/workflows/deploy-easypanel.yml.hbs +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/github/workflows/docker-build-push.yml.hbs +0 -0
- /package/.morph/{templates → framework/templates}/infrastructure/github/workflows/dotnet-build.yml.hbs +0 -0
- /package/.morph/{templates → framework/templates}/integrations/asaas-client.cs +0 -0
- /package/.morph/{templates → framework/templates}/integrations/asaas-webhook.cs +0 -0
- /package/.morph/{templates → framework/templates}/integrations/azure-identity-config.cs +0 -0
- /package/.morph/{templates → framework/templates}/integrations/clerk-config.cs +0 -0
- /package/.morph/{templates → framework/templates}/meta-prompts/fusion/fusion-agent.md +0 -0
- /package/.morph/{templates → framework/templates}/meta-prompts/fusion/fusion-aggregator.md +0 -0
- /package/.morph/{templates → framework/templates}/meta-prompts/hops/hop-retry.md +0 -0
- /package/.morph/{templates → framework/templates}/meta-prompts/hops/hop-validation.md +0 -0
- /package/.morph/{templates → framework/templates}/meta-prompts/hops/hop-wrapper.md +0 -0
- /package/.morph/{templates → framework/templates}/meta-prompts/parallel-workers/parallel-coordinator.md +0 -0
- /package/.morph/{templates → framework/templates}/meta-prompts/squad-leaders/backend-squad.md +0 -0
- /package/.morph/{templates → framework/templates}/meta-prompts/squad-leaders/frontend-squad.md +0 -0
- /package/.morph/{templates → framework/templates}/meta-prompts/squad-leaders/squad-leader.md +0 -0
- /package/.morph/{templates → framework/templates}/meta-prompts/validators/checkpoint-validator.md +0 -0
- /package/.morph/{templates → framework/templates}/saas/subscription.cs +0 -0
- /package/.morph/{templates → framework/templates}/saas/tenant.cs +0 -0
- /package/.morph/{templates → framework/templates}/state.template.json +0 -0
- /package/.morph/{templates → framework/templates}/ui/FluentDesignTheme.cs +0 -0
- /package/.morph/{templates → framework/templates}/ui/MudTheme.cs +0 -0
- /package/.morph/{templates → framework/templates}/ui/design-system.css +0 -0
- /package/framework/{skills/level-2-domains → agents}/README.md +0 -0
- /package/framework/hooks/{commit-msg → git/commit-msg}/conventional-commits.sh +0 -0
- /package/framework/hooks/{pre-commit → git/pre-commit}/agents.sh +0 -0
- /package/framework/hooks/{pre-commit → git/pre-commit}/orchestrator.sh +0 -0
- /package/framework/hooks/{pre-commit → git/pre-commit}/specs.sh +0 -0
- /package/framework/hooks/{pre-push → git/pre-push}/run-tests.sh +0 -0
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: phase-clarify
|
|
3
|
+
description: MORPH-SPEC Phase 3 (Clarify). Reviews spec.md for ambiguities, generates 3-7 targeted clarification questions, waits for user answers, then updates spec with edge cases and clarification sections. Use after design approval to eliminate spec ambiguities before task breakdown begins.
|
|
4
|
+
argument-hint: "[feature-name]"
|
|
5
|
+
user-invocable: false
|
|
6
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
7
|
+
---
|
|
8
|
+
|
|
1
9
|
# MORPH Clarify - FASE 3
|
|
2
10
|
|
|
3
11
|
> INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
|
|
@@ -10,11 +18,39 @@ Identifique ambiguidades na especificação e faça perguntas de clarificação
|
|
|
10
18
|
- [ ] `spec.md` aprovado pelo usuário
|
|
11
19
|
- [ ] `contracts.cs` definidos
|
|
12
20
|
|
|
21
|
+
## Ferramentas Recomendadas
|
|
22
|
+
|
|
23
|
+
> **Ref:** `framework/skills/level-0-meta/tool-usage-guide/SKILL.md` para guia completo.
|
|
24
|
+
> **Ref:** `framework/standards/integration/mcp/mcp-tools.md` para referência MCP.
|
|
25
|
+
> **Example:** `references/clarifications-example.md` — filled-in clarifications.md showing expected Q&A format.
|
|
26
|
+
|
|
27
|
+
| Ação | Ferramenta | Alternativa |
|
|
28
|
+
|------|------------|-------------|
|
|
29
|
+
| Ler spec.md completo | **Read** spec.md | — |
|
|
30
|
+
| Ler contracts.cs | **Read** contracts.cs | — |
|
|
31
|
+
| Ler schema-analysis.md | **Read** schema-analysis.md | — |
|
|
32
|
+
| Verificar viabilidade de requisito | **Context7 MCP** `query_docs()` | **WebSearch** + **WebFetch** |
|
|
33
|
+
| Verificar issues/limitações conhecidas | **GitHub MCP** `search_issues()` | **Bash** `gh issue list --search "..."` |
|
|
34
|
+
| Pesquisar edge cases externos | **WebSearch** | — |
|
|
35
|
+
| Verificar comportamento UI existente | **Playwright MCP** `browser_navigate()` + `browser_snapshot()` | **WebFetch** URL |
|
|
36
|
+
| Atualizar spec com clarificações | **Edit** spec.md | — |
|
|
37
|
+
| Criar clarifications.md | **Bash** `npx morph-spec template render docs/clarifications ...` | — |
|
|
38
|
+
| Atualizar state | **Bash** `npx morph-spec state mark-output ... clarifications` | — |
|
|
39
|
+
|
|
40
|
+
**MCPs desta fase:** Context7 (validar viabilidade), GitHub (issues conhecidas), Playwright (verificar UI existente).
|
|
41
|
+
|
|
42
|
+
**Anti-padrões:**
|
|
43
|
+
- ❌ Task agent para ler spec (use Read direto)
|
|
44
|
+
- ❌ Reescrever spec do zero (use Edit para atualizar seções)
|
|
45
|
+
- ❌ Pular cross-reference com schema-analysis.md (crítico para precisão)
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
13
49
|
## Workflow
|
|
14
50
|
|
|
15
51
|
### Passo 1: Analisar Spec
|
|
16
52
|
|
|
17
|
-
Leia `.morph/
|
|
53
|
+
Leia `.morph/features/$ARGUMENTS/1-design/spec.md` em detalhes e identifique:
|
|
18
54
|
|
|
19
55
|
#### 1.1. Ambiguidades
|
|
20
56
|
- Requisitos vagos ou genéricos
|
|
@@ -90,6 +126,21 @@ Após receber respostas do usuário, atualize o spec com:
|
|
|
90
126
|
|
|
91
127
|
2. **Atualizar seções relevantes** com detalhes adicionados
|
|
92
128
|
|
|
129
|
+
### CHECKPOINT: Validar Respostas Completas
|
|
130
|
+
|
|
131
|
+
**⏸️ PAUSE - Antes de atualizar spec:**
|
|
132
|
+
|
|
133
|
+
- [ ] Todas as perguntas foram respondidas pelo usuário?
|
|
134
|
+
- [ ] Nenhuma resposta é ambígua ou contraditória?
|
|
135
|
+
- [ ] Respostas são consistentes com `contracts.cs` existente?
|
|
136
|
+
- [ ] Respostas são consistentes com `schema-analysis.md`?
|
|
137
|
+
|
|
138
|
+
**❌ Se alguma checkbox NÃO estiver marcada:**
|
|
139
|
+
→ Voltar e pedir esclarecimento adicional ao usuário
|
|
140
|
+
|
|
141
|
+
**✅ Se TODAS as checkboxes estiverem marcadas:**
|
|
142
|
+
→ Prosseguir para atualizar spec.md
|
|
143
|
+
|
|
93
144
|
### Passo 6: Validar Edge Cases
|
|
94
145
|
|
|
95
146
|
Documente no spec como lidar com cada edge case identificado:
|
|
@@ -106,12 +157,12 @@ Documente no spec como lidar com cada edge case identificado:
|
|
|
106
157
|
### Passo 7: Atualizar State
|
|
107
158
|
|
|
108
159
|
```bash
|
|
109
|
-
npx morph-spec state set
|
|
160
|
+
npx morph-spec state set $ARGUMENTS phase clarify
|
|
110
161
|
```
|
|
111
162
|
|
|
112
163
|
## Outputs Gerados/Atualizados
|
|
113
164
|
|
|
114
|
-
- `.morph/
|
|
165
|
+
- `.morph/features/$ARGUMENTS/1-design/spec.md` - Atualizado com:
|
|
115
166
|
- Seção "Clarifications" com perguntas e respostas
|
|
116
167
|
- Edge cases documentados
|
|
117
168
|
- Requisitos mais específicos
|
|
@@ -128,4 +179,14 @@ npx morph-spec state set {feature-name} phase clarify
|
|
|
128
179
|
|
|
129
180
|
---
|
|
130
181
|
|
|
131
|
-
|
|
182
|
+
## Integração com Superpowers
|
|
183
|
+
|
|
184
|
+
> Disponível quando o plugin `superpowers` está instalado.
|
|
185
|
+
|
|
186
|
+
| Skill | Quando Usar | Invocação |
|
|
187
|
+
|-------|-------------|-----------|
|
|
188
|
+
| `systematic-debugging` | Para investigar ambiguidades técnicas complexas | `Skill(superpowers:systematic-debugging)` |
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
Continuar automaticamente para FASE 4 (Tasks) após clarificações resolvidas.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Clarifications - Photo Processing Pipeline
|
|
2
|
+
|
|
3
|
+
> Example of a well-structured clarifications.md. Filled-in reference — not a template.
|
|
4
|
+
> Each Q&A is concise: question raised during design review → answer → spec update.
|
|
5
|
+
|
|
6
|
+
**Feature**: photo-processing
|
|
7
|
+
**Phase**: CLARIFY (Phase 3)
|
|
8
|
+
**Status**: Resolved — all items incorporated into spec.md
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Questions & Answers
|
|
13
|
+
|
|
14
|
+
### Q1: File size limit — 10MB for all users or tiered?
|
|
15
|
+
|
|
16
|
+
**Question:** The spec says max 10MB but the proposal mentioned "higher for pro users." Should we implement tiered limits now?
|
|
17
|
+
|
|
18
|
+
**Answer:** Free tier: 10MB. Pro tier: 50MB. Enforce via `[Authorize]` + claims check in the upload endpoint. YAGNI — don't build a generic tier system, just check the plan claim directly.
|
|
19
|
+
|
|
20
|
+
**Spec Updates:**
|
|
21
|
+
- Updated `spec.md` FR1 to specify tiered limits
|
|
22
|
+
- Added `CanUploadLargeFile` policy to Security section
|
|
23
|
+
- Updated `UploadPhotoCommand` to accept `userPlan` claim
|
|
24
|
+
|
|
25
|
+
**Priority:** High — affects contracts
|
|
26
|
+
**Resolved:** ✅ Yes
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
### Q2: Processed photo retention — indefinite or expiring?
|
|
31
|
+
|
|
32
|
+
**Question:** Should processed photos in Blob Storage be kept forever, or do they expire?
|
|
33
|
+
|
|
34
|
+
**Answer:** Auto-delete after 30 days via Blob lifecycle policy (no code needed, configured in Azure). Free tier: 7 days. Pro tier: 30 days. This is infrastructure-only — `ProcessingJob.ProcessedPhotoUrl` stays in DB but becomes a dead link after expiry.
|
|
35
|
+
|
|
36
|
+
**Spec Updates:**
|
|
37
|
+
- Added ADR-003 (Blob lifecycle policy over code-based cleanup)
|
|
38
|
+
- Added note to `AzureBlobStorageService` about lifecycle dependency
|
|
39
|
+
|
|
40
|
+
**Priority:** Low — no code change
|
|
41
|
+
**Resolved:** ✅ Yes
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### Q3: AI API — async webhook or polling?
|
|
46
|
+
|
|
47
|
+
**Question:** spec.md assumed Hangfire polls job completion, but the AI vendor docs mention a webhook callback option.
|
|
48
|
+
|
|
49
|
+
**Answer:** Use fire-and-forget HTTP call + Hangfire continuation (not webhook). The AI API's webhook requires a public URL we don't have in dev. Fire-and-forget is simpler and testable. If the vendor SLA changes, we can swap to webhook via `IPhotoProcessingJob` interface — no consumer changes needed.
|
|
50
|
+
|
|
51
|
+
**Spec Updates:**
|
|
52
|
+
- Clarified Processing Flow in spec.md to show fire-and-forget + await pattern
|
|
53
|
+
- Added to Risks: "AI API webhook migration path if needed"
|
|
54
|
+
|
|
55
|
+
**Priority:** High — affects job implementation
|
|
56
|
+
**Resolved:** ✅ Yes
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Edge Cases
|
|
61
|
+
|
|
62
|
+
### EC1: Upload during Hangfire downtime
|
|
63
|
+
|
|
64
|
+
**Scenario:** User uploads successfully but Hangfire server is stopped — job never executes.
|
|
65
|
+
|
|
66
|
+
**Expected Behavior:** Job stays in `Pending` indefinitely. On next Hangfire server start, job auto-resumes (Hangfire persistent storage).
|
|
67
|
+
|
|
68
|
+
**Solution:** No code change. Add monitoring alert if job stays Pending > 10 minutes.
|
|
69
|
+
|
|
70
|
+
**Acceptance Criteria:**
|
|
71
|
+
- [ ] `ProcessingJob` with status `Pending` survives Hangfire restart
|
|
72
|
+
- [ ] Hangfire picks up orphaned jobs on startup (built-in behavior, covered by docs)
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
### EC2: Concurrent uploads of same file
|
|
77
|
+
|
|
78
|
+
**Scenario:** User double-clicks Upload button, sending two identical requests simultaneously.
|
|
79
|
+
|
|
80
|
+
**Expected Behavior:** Two separate `ProcessingJob` records created. Both process independently. No deduplication (not required at MVP scale).
|
|
81
|
+
|
|
82
|
+
**Solution:** No code change. Each request gets a fresh GUID. If deduplication becomes needed, add idempotency key header in v2.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Business Rules Clarified
|
|
87
|
+
|
|
88
|
+
### BR1: Only the uploading user can download their processed photo
|
|
89
|
+
|
|
90
|
+
**Rule:** `GET /api/download/{jobId}` must check `job.UserId == currentUserId`. Return 403 if mismatch.
|
|
91
|
+
|
|
92
|
+
**Rationale:** Users might guess sequential GUIDs (they can't since we use random GUIDs, but defense in depth).
|
|
93
|
+
|
|
94
|
+
**Implementation:** Add `[Authorize]` + ownership check to download endpoint. Already in Security section of spec.md.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Summary
|
|
99
|
+
|
|
100
|
+
| | Count |
|
|
101
|
+
|---|---|
|
|
102
|
+
| Questions Answered | 3 / 3 |
|
|
103
|
+
| Edge Cases Documented | 2 |
|
|
104
|
+
| Business Rules Clarified | 1 |
|
|
105
|
+
| Spec Updates Made | 6 |
|
|
106
|
+
|
|
107
|
+
## Next Steps
|
|
108
|
+
|
|
109
|
+
1. [x] All questions resolved
|
|
110
|
+
2. [x] `spec.md` updated with all clarifications
|
|
111
|
+
3. [x] `contracts.cs` updated (`UploadPhotoCommand` + plan claim)
|
|
112
|
+
4. [x] Stakeholder approval received
|
|
113
|
+
5. [ ] Advance to Phase 4 (Tasks)
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
*MORPH-SPEC by Polymorphism Tech*
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: phase-codebase-analysis
|
|
3
|
+
description: MORPH-SPEC Design sub-phase that analyzes existing codebase and database schema, producing schema-analysis.md with real column names, types, relationships, and field mismatches. Use at the start of Design phase before generating contracts.cs to prevent incorrect field names or types.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MORPH Codebase Analysis - Sub-fase de DESIGN
|
|
9
|
+
|
|
10
|
+
> INTERNAL: Automation skill for schema analysis step within Phase 2 (Design).
|
|
11
|
+
> Called by `phase-design.md` Passo 2. Not a standalone user command.
|
|
12
|
+
|
|
13
|
+
Automatiza a análise de código existente para gerar `schema-analysis.md` com dados reais do banco/código.
|
|
14
|
+
|
|
15
|
+
## Pré-requisitos
|
|
16
|
+
|
|
17
|
+
- [ ] FASE 1 (Setup) concluída
|
|
18
|
+
- [ ] Feature tem `proposal.md` aprovado
|
|
19
|
+
- [ ] Contexto do projeto carregado (stack, agentes)
|
|
20
|
+
|
|
21
|
+
## Ferramentas Recomendadas
|
|
22
|
+
|
|
23
|
+
> **Ref:** `framework/skills/level-0-meta/tool-usage-guide/SKILL.md` para guia completo.
|
|
24
|
+
> **Ref:** `framework/standards/integration/mcp/mcp-tools.md` para referência MCP.
|
|
25
|
+
|
|
26
|
+
| Ação | Ferramenta | Alternativa |
|
|
27
|
+
|------|------------|-------------|
|
|
28
|
+
| Listar tabelas do banco | **Supabase MCP** `list_tables()` | **Grep** `.from(` no código |
|
|
29
|
+
| Obter schema de tabela | **Supabase MCP** `get_table_schema()` | **Read** type definitions |
|
|
30
|
+
| Obter relacionamentos FK | **Supabase MCP** `get_relationships()` | **Grep** JOIN/FK patterns |
|
|
31
|
+
| Obter políticas RLS | **Supabase MCP** `query()` | **Read** policy files |
|
|
32
|
+
| Encontrar queries no código | **Grep** `\.from\(` em `*.ts,*.tsx,*.js,*.cs` | — |
|
|
33
|
+
| Encontrar type definitions | **Glob** `src/**/types/**/*.ts` ou `**/Entities/**/*.cs` | — |
|
|
34
|
+
| Ler arquivos encontrados | **Read** cada arquivo | — |
|
|
35
|
+
| Análise multi-arquivo complexa | **Task** (subagent Explore) | Read individual |
|
|
36
|
+
| Gerar schema-analysis.md | **Write** usando template | **Bash** template render |
|
|
37
|
+
|
|
38
|
+
**MCPs desta fase:** Supabase (schema — **PRIORITÁRIO**), Database MCPs genéricos.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Workflow Automatizado
|
|
43
|
+
|
|
44
|
+
### Passo 1: Detectar Método de Análise
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
SE MCP Supabase disponível:
|
|
48
|
+
→ Usar Método A (MCP direto)
|
|
49
|
+
SE MCP Database disponível:
|
|
50
|
+
→ Usar Método A adaptado
|
|
51
|
+
SENÃO:
|
|
52
|
+
→ Usar Método B (análise estática de código)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Passo 2A: Método MCP (Preferencial)
|
|
56
|
+
|
|
57
|
+
**Ferramentas:** Supabase MCP
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
// 1. Listar todas as tabelas
|
|
61
|
+
const tables = await mcp__supabase__list_tables();
|
|
62
|
+
|
|
63
|
+
// 2. Para cada tabela relevante à feature:
|
|
64
|
+
for (const table of relevantTables) {
|
|
65
|
+
// 2a. Schema completo
|
|
66
|
+
const schema = await mcp__supabase__get_table_schema({ table: table.name });
|
|
67
|
+
// → column_name, data_type, is_nullable, column_default
|
|
68
|
+
|
|
69
|
+
// 2b. Relacionamentos
|
|
70
|
+
const rels = await mcp__supabase__get_relationships({ table: table.name });
|
|
71
|
+
// → foreign_table, foreign_column, constraint_type
|
|
72
|
+
|
|
73
|
+
// 2c. Indexes
|
|
74
|
+
const indexes = await mcp__supabase__query({
|
|
75
|
+
query: `SELECT indexname, indexdef FROM pg_indexes WHERE tablename = '${table.name}'`
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// 2d. RLS policies (segurança)
|
|
79
|
+
const policies = await mcp__supabase__query({
|
|
80
|
+
query: `SELECT policyname, cmd, qual FROM pg_policies WHERE tablename = '${table.name}'`
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Passo 2B: Método Análise Estática (Fallback)
|
|
86
|
+
|
|
87
|
+
**Ferramentas:** Grep, Glob, Read, Task (subagent para projetos grandes)
|
|
88
|
+
|
|
89
|
+
**Fase B1: Encontrar Queries**
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Grep: "\.from\(|\.select\(|SELECT |supabase\.|context\.|dbContext\.|DbSet<"
|
|
93
|
+
Type: ts,tsx,js,jsx,cs
|
|
94
|
+
Output: files_with_matches
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Fase B2: Ler Arquivos de Query**
|
|
98
|
+
|
|
99
|
+
Para cada arquivo encontrado, use **Read** para extrair:
|
|
100
|
+
- Nomes de tabelas: `from('leads')`, `DbSet<Lead>`, `FROM leads`
|
|
101
|
+
- Nomes de colunas: `.select('fullname, phonenumber')`, `l.FullName`
|
|
102
|
+
- Tipos de dados: TypeScript interfaces, C# DTOs
|
|
103
|
+
- Relacionamentos: JOIN clauses, navigation properties
|
|
104
|
+
|
|
105
|
+
**Fase B3: Encontrar Type Definitions**
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
# TypeScript/JavaScript:
|
|
109
|
+
Glob: "src/**/types/**/*.ts"
|
|
110
|
+
Glob: "src/**/*.d.ts"
|
|
111
|
+
Glob: "src/**/interfaces/*.ts"
|
|
112
|
+
|
|
113
|
+
# .NET:
|
|
114
|
+
Glob: "**/*Dto.cs"
|
|
115
|
+
Glob: "**/Entities/**/*.cs"
|
|
116
|
+
Glob: "**/Models/**/*.cs"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Fase B4: Quando usar Task (subagent)**
|
|
120
|
+
|
|
121
|
+
Use Task subagent **APENAS** quando:
|
|
122
|
+
- Projeto tem 20+ arquivos de query
|
|
123
|
+
- Múltiplos padrões de acesso a dados (Supabase + EF Core + raw SQL)
|
|
124
|
+
- Análise precisa de contexto cruzado entre muitos arquivos
|
|
125
|
+
|
|
126
|
+
Não use Task subagent quando:
|
|
127
|
+
- Projeto tem < 10 arquivos de query (Read direto é mais rápido)
|
|
128
|
+
- Padrão de acesso a dados é uniforme (só Supabase OU só EF Core)
|
|
129
|
+
|
|
130
|
+
### Passo 3: Mapear Inconsistências
|
|
131
|
+
|
|
132
|
+
Crie um mapa de:
|
|
133
|
+
|
|
134
|
+
| Frontend/Código | Banco de Dados | Tipo | Problema |
|
|
135
|
+
|----------------|----------------|------|----------|
|
|
136
|
+
| user.name | users.fullname | string | ❌ MISMATCH |
|
|
137
|
+
| lead.phone | leads.phonenumber | string | ❌ MISMATCH |
|
|
138
|
+
| order.metadata | orders.metadata | JSONB | ⚠️ Type complex |
|
|
139
|
+
|
|
140
|
+
### Passo 4: Gerar `schema-analysis.md`
|
|
141
|
+
|
|
142
|
+
Use o template em `framework/templates/docs/schema-analysis.md`:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
npx morph-spec template render docs/schema-analysis \
|
|
146
|
+
.morph/features/{feature-name}/1-design/schema-analysis.md \
|
|
147
|
+
'{ "FEATURE_NAME": "{feature-name}", "DATE": "..." }'
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
OU use **Write** tool para criar diretamente com os dados coletados.
|
|
151
|
+
|
|
152
|
+
### Passo 5: Atualizar State
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
npx morph-spec state mark-output {feature-name} schema-analysis
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Outputs
|
|
161
|
+
|
|
162
|
+
- `.morph/features/{feature}/1-design/schema-analysis.md`
|
|
163
|
+
- State atualizado com output `schemaAnalysis`
|
|
164
|
+
|
|
165
|
+
## CHECKPOINT
|
|
166
|
+
|
|
167
|
+
Antes de prosseguir para contracts.cs, apresente ao usuário:
|
|
168
|
+
|
|
169
|
+
- [ ] Analisei {N} tabelas
|
|
170
|
+
- [ ] Encontrei {N} field name mismatches
|
|
171
|
+
- [ ] Encontrei {N} type mismatches
|
|
172
|
+
- [ ] Mapeei {N} relacionamentos
|
|
173
|
+
- [ ] `schema-analysis.md` criado
|
|
174
|
+
|
|
175
|
+
**Perguntas obrigatórias:**
|
|
176
|
+
1. "O schema analysis está correto?"
|
|
177
|
+
2. "Posso gerar contracts.cs com base nesse schema real?"
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
*MORPH-SPEC by Polymorphism Tech*
|