@polymorphism-tech/morph-spec 4.3.3 → 4.3.4
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/analytics/threads-log.jsonl +9 -0
- package/{stacks/blazor-azure/.morph → .morph}/config/config.json +9 -9
- package/.morph/state.json +48 -0
- package/bin/detect-agents.js +1 -2
- package/bin/morph-spec.js +2 -15
- package/{stacks/blazor-azure/.morph/config → framework}/agents.json +948 -948
- package/{stacks/nextjs-supabase/.claude → framework}/commands/morph-infra.md +1 -1
- package/framework/hooks/README.md +282 -0
- package/framework/hooks/agent-stop/validate-and-continue.js +96 -0
- package/framework/hooks/agent-stop/validate-checkpoints.js +101 -0
- package/framework/hooks/agent-stop/validate-tests.js +109 -0
- package/framework/hooks/agent-teams/dispatch.js +67 -0
- package/framework/hooks/agent-teams/phase-advanced.js +80 -0
- package/framework/hooks/agent-teams/task-completed.js +76 -0
- package/framework/hooks/agent-teams/teammate-idle.js +70 -0
- package/framework/hooks/commit-msg/conventional-commits.sh +33 -0
- package/framework/hooks/pre-commit/agents.sh +25 -0
- package/framework/hooks/pre-commit/orchestrator.sh +64 -0
- package/framework/hooks/pre-commit/specs.sh +50 -0
- package/framework/hooks/pre-push/run-tests.sh +44 -0
- package/framework/index/troubleshooting-index.json +184 -0
- package/framework/memory/patterns-learned.md +766 -0
- package/framework/skills/level-0-meta/README.md +7 -0
- package/framework/skills/level-0-meta/code-review.md +226 -0
- package/framework/skills/level-0-meta/morph-checklist.md +117 -0
- package/framework/skills/level-0-meta/simulation-checklist.md +77 -0
- package/framework/skills/level-1-workflows/README.md +7 -0
- package/framework/skills/level-1-workflows/morph-replicate.md +213 -0
- package/framework/skills/level-1-workflows/phase-clarify.md +131 -0
- package/framework/skills/level-1-workflows/phase-design.md +213 -0
- package/framework/skills/level-1-workflows/phase-setup.md +106 -0
- package/framework/skills/level-1-workflows/phase-tasks.md +164 -0
- package/framework/skills/level-1-workflows/phase-uiux.md +169 -0
- package/framework/skills/level-2-domains/README.md +14 -0
- package/framework/skills/level-2-domains/ai-agents/ai-system-architect.md +192 -0
- package/framework/skills/level-2-domains/architecture/po-pm-advisor.md +197 -0
- package/framework/skills/level-2-domains/architecture/prompt-engineer.md +189 -0
- package/framework/skills/level-2-domains/architecture/seo-growth-hacker.md +320 -0
- package/framework/skills/level-2-domains/architecture/standards-architect.md +156 -0
- package/framework/skills/level-2-domains/backend/api-designer.md +59 -0
- package/framework/skills/level-2-domains/backend/dotnet-senior.md +77 -0
- package/framework/skills/level-2-domains/backend/ef-modeler.md +58 -0
- package/framework/skills/level-2-domains/backend/hangfire-orchestrator.md +126 -0
- package/framework/skills/level-2-domains/backend/ms-agent-expert.md +45 -0
- package/framework/skills/level-2-domains/frontend/blazor-builder.md +210 -0
- package/framework/skills/level-2-domains/frontend/nextjs-expert.md +154 -0
- package/framework/skills/level-2-domains/frontend/ui-ux-designer.md +191 -0
- package/framework/skills/level-2-domains/infrastructure/azure-architect.md +142 -0
- package/framework/skills/level-2-domains/infrastructure/azure-deploy-specialist.md +699 -0
- package/framework/skills/level-2-domains/infrastructure/bicep-architect.md +126 -0
- package/framework/skills/level-2-domains/infrastructure/container-specialist.md +131 -0
- package/framework/skills/level-2-domains/infrastructure/devops-engineer.md +119 -0
- package/framework/skills/level-2-domains/integrations/asaas-financial.md +130 -0
- package/framework/skills/level-2-domains/integrations/azure-identity.md +142 -0
- package/framework/skills/level-2-domains/integrations/clerk-auth.md +108 -0
- package/framework/skills/level-2-domains/integrations/hangfire-orchestrator.md +64 -0
- package/framework/skills/level-2-domains/integrations/resend-email.md +119 -0
- package/framework/skills/level-2-domains/quality/code-analyzer.md +235 -0
- package/framework/skills/level-2-domains/quality/testing-specialist.md +126 -0
- package/framework/skills/level-3-technologies/README.md +7 -0
- package/framework/skills/level-4-patterns/README.md +7 -0
- package/framework/squad-templates/backend-only.json +34 -0
- package/framework/squad-templates/frontend-only.json +34 -0
- package/framework/squad-templates/full-stack.json +52 -0
- package/framework/templates/.idea/morph-templates.xml +92 -0
- package/framework/templates/.vscode/morph-templates.code-snippets +186 -0
- package/framework/templates/IDE-SNIPPETS.md +266 -0
- package/framework/templates/README.md +814 -0
- package/framework/templates/REGISTRY.json +1677 -0
- package/framework/templates/code/dotnet/backend/repository.cs +141 -0
- package/framework/templates/code/dotnet/backend/service.cs +139 -0
- package/framework/templates/code/dotnet/contracts/Commands.cs +74 -0
- package/framework/templates/code/dotnet/contracts/Entities.cs +25 -0
- package/framework/templates/code/dotnet/contracts/Queries.cs +74 -0
- package/framework/templates/code/dotnet/contracts/README.md +74 -0
- package/framework/templates/code/dotnet/contracts/api-contracts.cs +173 -0
- package/framework/templates/code/dotnet/contracts/contracts.cs +217 -0
- package/framework/templates/code/dotnet/database/migration.cs +83 -0
- package/framework/templates/code/dotnet/frontend/component.razor +239 -0
- package/framework/templates/code/dotnet/jobs/agent.cs +163 -0
- package/framework/templates/code/dotnet/jobs/job.cs +171 -0
- package/framework/templates/code/dotnet/test.cs +239 -0
- package/framework/templates/code/sql/rls-policy.sql +57 -0
- package/framework/templates/code/sql/supabase-migration.sql +100 -0
- package/framework/templates/code/sql/supabase-migration.template.sql +113 -0
- package/framework/templates/code/typescript/contracts.ts +168 -0
- package/framework/templates/context/CONTEXT-FEATURE.md +276 -0
- package/framework/templates/context/CONTEXT.md +181 -0
- package/framework/templates/docs/proposal.md +182 -0
- package/framework/templates/docs/spec.md +149 -0
- package/framework/templates/examples/design-system-examples.md +357 -0
- package/framework/templates/examples/spec-examples.md +90 -0
- package/framework/templates/feature/decisions.md +187 -0
- package/framework/templates/feature/recap.md +146 -0
- package/framework/templates/feature/tasks.md +199 -0
- package/framework/templates/infrastructure/azure/Dockerfile.example +82 -0
- package/framework/templates/infrastructure/azure/README.md +286 -0
- package/framework/templates/infrastructure/azure/app-insights.bicep +63 -0
- package/framework/templates/infrastructure/azure/app-service.bicep +164 -0
- package/framework/templates/infrastructure/azure/container-app-env.bicep +49 -0
- package/framework/templates/infrastructure/azure/container-app.bicep +156 -0
- package/framework/templates/infrastructure/azure/deploy-checklist.md +426 -0
- package/framework/templates/infrastructure/azure/deploy.ps1 +229 -0
- package/framework/templates/infrastructure/azure/deploy.sh +208 -0
- package/framework/templates/infrastructure/azure/key-vault.bicep +91 -0
- package/framework/templates/infrastructure/azure/main.bicep +189 -0
- package/framework/templates/infrastructure/azure/parameters.dev.json +29 -0
- package/framework/templates/infrastructure/azure/parameters.prod.json +29 -0
- package/framework/templates/infrastructure/azure/parameters.staging.json +29 -0
- package/framework/templates/infrastructure/azure/sql-database.bicep +103 -0
- package/framework/templates/infrastructure/azure/storage.bicep +106 -0
- package/framework/templates/infrastructure/docker/Dockerfile.template +58 -0
- package/framework/templates/infrastructure/docker/docker-compose.template.yml +67 -0
- package/framework/templates/infrastructure/docker/dockerfile-api.dockerfile +38 -0
- package/framework/templates/infrastructure/docker/dockerfile-web.dockerfile +48 -0
- package/framework/templates/infrastructure/docker/easypanel.template.json +54 -0
- package/framework/templates/infrastructure/github/README.md +593 -0
- package/framework/templates/infrastructure/github/actions/azure-auth/action.yml.hbs +22 -0
- package/framework/templates/infrastructure/github/actions/docker-build-push/action.yml.hbs +45 -0
- package/framework/templates/infrastructure/github/actions/health-check/action.yml.hbs +27 -0
- package/framework/templates/infrastructure/github/workflows/deploy-azure-app-service.yml.hbs +61 -0
- package/framework/templates/infrastructure/github/workflows/deploy-easypanel.yml.hbs +31 -0
- package/framework/templates/infrastructure/github/workflows/docker-build-push.yml.hbs +59 -0
- package/framework/templates/infrastructure/github/workflows/dotnet-build.yml.hbs +39 -0
- package/framework/templates/integrations/asaas-client.cs +387 -0
- package/framework/templates/integrations/asaas-webhook.cs +351 -0
- package/framework/templates/integrations/azure-identity-config.cs +288 -0
- package/framework/templates/integrations/clerk-config.cs +258 -0
- package/framework/templates/meta-prompts/fusion/fusion-agent.md +76 -0
- package/framework/templates/meta-prompts/fusion/fusion-aggregator.md +100 -0
- package/framework/templates/meta-prompts/hops/hop-retry.md +78 -0
- package/framework/templates/meta-prompts/hops/hop-validation.md +97 -0
- package/framework/templates/meta-prompts/hops/hop-wrapper.md +36 -0
- package/framework/templates/meta-prompts/parallel-workers/parallel-coordinator.md +113 -0
- package/framework/templates/meta-prompts/parallel-workers/parallel-worker.md +80 -0
- package/framework/templates/meta-prompts/squad-leaders/backend-squad.md +90 -0
- package/framework/templates/meta-prompts/squad-leaders/frontend-squad.md +126 -0
- package/framework/templates/meta-prompts/squad-leaders/squad-leader.md +43 -0
- package/framework/templates/meta-prompts/validators/checkpoint-validator.md +107 -0
- package/framework/templates/meta-prompts/validators/pre-commit-validator.md +95 -0
- package/framework/templates/saas/subscription.cs +347 -0
- package/framework/templates/saas/tenant.cs +338 -0
- package/framework/templates/state.template.json +17 -0
- package/framework/templates/ui/FluentDesignTheme.cs +149 -0
- package/framework/templates/ui/MudTheme.cs +281 -0
- package/framework/templates/ui/design-system.css +226 -0
- package/framework/workflows/README.md +1041 -0
- package/framework/workflows/configs/design-impl.json +49 -0
- package/framework/workflows/configs/fast-track.json +42 -0
- package/framework/workflows/configs/full-morph.json +79 -0
- package/framework/workflows/configs/fusion.json +39 -0
- package/framework/workflows/configs/long-running.json +33 -0
- package/framework/workflows/configs/standard.json +60 -0
- package/framework/workflows/configs/ui-refresh.json +49 -0
- package/framework/workflows/configs/zero-touch.json +75 -0
- package/framework/workflows/docs/STORY-DRIVEN-DEVELOPMENT.md +392 -0
- package/framework/workflows/docs/design-impl.md +37 -0
- package/framework/workflows/docs/enforcement-pipeline.md +668 -0
- package/framework/workflows/docs/fast-track.md +29 -0
- package/framework/workflows/docs/full-morph.md +76 -0
- package/framework/workflows/docs/standard.md +44 -0
- package/framework/workflows/docs/ui-refresh.md +39 -0
- package/package.json +3 -3
- package/src/commands/feature/create-story.js +11 -7
- package/src/commands/project/detect-agents.js +1 -2
- package/src/commands/project/init.js +69 -32
- package/src/commands/project/update.js +2 -2
- package/src/commands/templates/template-customize.js +3 -17
- package/src/commands/templates/template-list.js +1 -15
- package/src/commands/templates/template-render.js +2 -3
- package/src/commands/templates/template-show.js +3 -5
- package/src/core/templates/template-registry.js +9 -23
- package/src/lib/detectors/structure-detector.js +3 -3
- package/src/lib/generators/context-generator.js +18 -6
- package/src/lib/hooks/hook-executor.js +0 -2
- package/src/lib/orchestration/team-orchestrator.js +1 -2
- package/src/lib/standards/standards-context-injector.js +3 -4
- package/src/lib/troubleshooting/troubleshoot-grep.js +3 -9
- package/src/lib/validators/validation-runner.js +1 -2
- package/src/utils/file-copier.js +1 -2
- package/docs/README.md +0 -144
- package/docs/api/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/api/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/api/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/api/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/api/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/api/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/api/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/api/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -978
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -1049
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/api/scripts/collapse.js +0 -39
- package/docs/api/scripts/commonNav.js +0 -28
- package/docs/api/scripts/linenumber.js +0 -25
- package/docs/api/scripts/nav.js +0 -12
- package/docs/api/scripts/polyfill.js +0 -4
- package/docs/api/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/api/scripts/prettify/lang-css.js +0 -2
- package/docs/api/scripts/prettify/prettify.js +0 -28
- package/docs/api/scripts/search.js +0 -99
- package/docs/api/styles/jsdoc.css +0 -776
- package/docs/api/styles/prettify.css +0 -80
- package/docs/cli-auto-detection.md +0 -219
- package/docs/getting-started.md +0 -296
- package/docs/installation.md +0 -361
- package/docs/next-generation/AGENTS.md +0 -521
- package/docs/next-generation/ANALYSIS.md +0 -555
- package/docs/next-generation/ARCHITECTURE.md +0 -436
- package/docs/next-generation/CONTEXT-OPTIMIZATION.md +0 -267
- package/docs/next-generation/EXECUTION-FLOW.md +0 -274
- package/docs/next-generation/FEATURES.md +0 -688
- package/docs/next-generation/META-PROMPTS.md +0 -235
- package/docs/next-generation/MIGRATION-GUIDE.md +0 -253
- package/docs/next-generation/README.md +0 -231
- package/docs/next-generation/ROADMAP.md +0 -801
- package/docs/next-generation/THREAD-MANAGEMENT.md +0 -240
- package/docs/templates.md +0 -418
- package/docs/troubleshooting.md +0 -269
- package/docs/validation-checklist.md +0 -264
- package/scripts/postinstall.js +0 -132
- package/src/lib/stacks/index.js +0 -7
- package/src/lib/stacks/stack-resolver.js +0 -180
- package/stacks/blazor-azure/.claude/commands/morph-deploy.md +0 -529
- package/stacks/blazor-azure/.claude/commands/morph-infra.md +0 -209
- package/stacks/blazor-azure/.morph/.morphversion +0 -5
- package/stacks/blazor-azure/.morph/project/context/README.md +0 -17
- package/stacks/blazor-azure/CLAUDE.md +0 -155
- package/stacks/blazor-azure/README.md +0 -79
- package/stacks/nextjs-supabase/.claude/commands/morph-apply.md +0 -221
- package/stacks/nextjs-supabase/.claude/commands/morph-archive.md +0 -79
- package/stacks/nextjs-supabase/.claude/commands/morph-deploy.md +0 -529
- package/stacks/nextjs-supabase/.claude/commands/morph-preflight.md +0 -227
- package/stacks/nextjs-supabase/.claude/commands/morph-proposal.md +0 -122
- package/stacks/nextjs-supabase/.claude/commands/morph-status.md +0 -86
- package/stacks/nextjs-supabase/.claude/commands/morph-troubleshoot.md +0 -122
- package/stacks/nextjs-supabase/.morph/.morphversion +0 -5
- package/stacks/nextjs-supabase/.morph/config/agents.json +0 -345
- package/stacks/nextjs-supabase/.morph/config/config.json +0 -9
- package/stacks/nextjs-supabase/.morph/project/context/README.md +0 -17
- package/stacks/nextjs-supabase/.morph/standards/ai-agents/blazor-ui.md +0 -364
- package/stacks/nextjs-supabase/.morph/standards/ai-agents/production.md +0 -415
- package/stacks/nextjs-supabase/.morph/standards/ai-agents/setup.md +0 -418
- package/stacks/nextjs-supabase/.morph/standards/ai-agents/team-orchestration.md +0 -479
- package/stacks/nextjs-supabase/.morph/standards/ai-agents/workflows.md +0 -354
- package/stacks/nextjs-supabase/.morph/standards/architecture/ddd/aggregates.md +0 -120
- package/stacks/nextjs-supabase/.morph/standards/architecture/ddd/entities.md +0 -99
- package/stacks/nextjs-supabase/.morph/standards/architecture/ddd/value-objects.md +0 -124
- package/stacks/nextjs-supabase/.morph/standards/backend/api/minimal-api.md +0 -494
- package/stacks/nextjs-supabase/.morph/standards/backend/api/rest.md +0 -492
- package/stacks/nextjs-supabase/.morph/standards/backend/api/validation.md +0 -88
- package/stacks/nextjs-supabase/.morph/standards/backend/authentication/passkeys.md +0 -428
- package/stacks/nextjs-supabase/.morph/standards/backend/database/ef-core.md +0 -199
- package/stacks/nextjs-supabase/.morph/standards/backend/database/migrations.md +0 -393
- package/stacks/nextjs-supabase/.morph/standards/backend/database/postgresql/database.md +0 -352
- package/stacks/nextjs-supabase/.morph/standards/backend/database/repository-patterns.md +0 -528
- package/stacks/nextjs-supabase/.morph/standards/backend/database/vector-search-rag.md +0 -541
- package/stacks/nextjs-supabase/.morph/standards/backend/dotnet/async.md +0 -366
- package/stacks/nextjs-supabase/.morph/standards/backend/dotnet/core.md +0 -117
- package/stacks/nextjs-supabase/.morph/standards/backend/dotnet/di.md +0 -439
- package/stacks/nextjs-supabase/.morph/standards/backend/dotnet/program-cs-checklist.md +0 -92
- package/stacks/nextjs-supabase/.morph/standards/backend/integrations/asaas/asaas-api.md +0 -216
- package/stacks/nextjs-supabase/.morph/standards/backend/integrations/clerk/clerk-auth.md +0 -290
- package/stacks/nextjs-supabase/.morph/standards/backend/integrations/hangfire/hangfire-jobs.md +0 -350
- package/stacks/nextjs-supabase/.morph/standards/backend/integrations/resend/resend-email.md +0 -385
- package/stacks/nextjs-supabase/.morph/standards/context/analytics.md +0 -96
- package/stacks/nextjs-supabase/.morph/standards/context/bundles.md +0 -110
- package/stacks/nextjs-supabase/.morph/standards/context/priming.md +0 -78
- package/stacks/nextjs-supabase/.morph/standards/core/architecture.md +0 -185
- package/stacks/nextjs-supabase/.morph/standards/core/coding.md +0 -214
- package/stacks/nextjs-supabase/.morph/standards/core/git-branching-strategy.md +0 -403
- package/stacks/nextjs-supabase/.morph/standards/core/git.md +0 -185
- package/stacks/nextjs-supabase/.morph/standards/core/testing.md +0 -295
- package/stacks/nextjs-supabase/.morph/standards/data/nosql/blob-storage.md +0 -102
- package/stacks/nextjs-supabase/.morph/standards/data/nosql/cache/redis.md +0 -97
- package/stacks/nextjs-supabase/.morph/standards/data/nosql/cosmos-db.md +0 -118
- package/stacks/nextjs-supabase/.morph/standards/data/vector-search/azure-ai-search.md +0 -121
- package/stacks/nextjs-supabase/.morph/standards/data/vector-search/rag-chunking.md +0 -104
- package/stacks/nextjs-supabase/.morph/standards/frontend/blazor/design-checklist.md +0 -222
- package/stacks/nextjs-supabase/.morph/standards/frontend/blazor/fluent-ui-setup.md +0 -595
- package/stacks/nextjs-supabase/.morph/standards/frontend/blazor/fluent-ui.md +0 -137
- package/stacks/nextjs-supabase/.morph/standards/frontend/blazor/html-conversion.md +0 -184
- package/stacks/nextjs-supabase/.morph/standards/frontend/blazor/lifecycle.md +0 -195
- package/stacks/nextjs-supabase/.morph/standards/frontend/blazor/pitfalls.md +0 -198
- package/stacks/nextjs-supabase/.morph/standards/frontend/blazor/state.md +0 -191
- package/stacks/nextjs-supabase/.morph/standards/frontend/design-system/animations.md +0 -151
- package/stacks/nextjs-supabase/.morph/standards/frontend/design-system/naming.md +0 -64
- package/stacks/nextjs-supabase/.morph/standards/frontend/nextjs/nextjs-patterns.md +0 -198
- package/stacks/nextjs-supabase/.morph/standards/infrastructure/azure/azure.md +0 -624
- package/stacks/nextjs-supabase/.morph/standards/infrastructure/azure/bicep/bicep-patterns.md +0 -422
- package/stacks/nextjs-supabase/.morph/standards/infrastructure/azure/devops/azure-devops-setup.md +0 -516
- package/stacks/nextjs-supabase/.morph/standards/infrastructure/azure/devops/local-development.md +0 -520
- package/stacks/nextjs-supabase/.morph/standards/infrastructure/azure/services/functions.md +0 -486
- package/stacks/nextjs-supabase/.morph/standards/infrastructure/azure/services/service-bus.md +0 -459
- package/stacks/nextjs-supabase/.morph/standards/infrastructure/azure/services/storage.md +0 -407
- package/stacks/nextjs-supabase/.morph/standards/infrastructure/docker/easypanel-deploy.md +0 -196
- package/stacks/nextjs-supabase/.morph/standards/infrastructure/supabase/mcp-setup.md +0 -252
- package/stacks/nextjs-supabase/.morph/standards/infrastructure/supabase/supabase-auth.md +0 -176
- package/stacks/nextjs-supabase/.morph/standards/infrastructure/supabase/supabase-pgvector.md +0 -169
- package/stacks/nextjs-supabase/.morph/standards/infrastructure/supabase/supabase-rls.md +0 -184
- package/stacks/nextjs-supabase/.morph/standards/infrastructure/supabase/supabase-storage.md +0 -153
- package/stacks/nextjs-supabase/.morph/standards/integration/api/graphql.md +0 -91
- package/stacks/nextjs-supabase/.morph/standards/integration/api/grpc.md +0 -114
- package/stacks/nextjs-supabase/.morph/standards/integration/api/rest-design.md +0 -95
- package/stacks/nextjs-supabase/.morph/standards/integration/event-driven/cqrs.md +0 -101
- package/stacks/nextjs-supabase/.morph/standards/integration/event-driven/event-sourcing.md +0 -124
- package/stacks/nextjs-supabase/.morph/standards/integration/event-driven/service-bus.md +0 -95
- package/stacks/nextjs-supabase/.morph/standards/observability/logging.md +0 -131
- package/stacks/nextjs-supabase/.morph/standards/observability/metrics.md +0 -121
- package/stacks/nextjs-supabase/.morph/standards/observability/monitoring.md +0 -114
- package/stacks/nextjs-supabase/.morph/standards/observability/tracing.md +0 -132
- package/stacks/nextjs-supabase/.morph/standards/workflows/parallel-execution.md +0 -112
- package/stacks/nextjs-supabase/.morph/standards/workflows/thread-management.md +0 -113
- package/stacks/nextjs-supabase/CLAUDE.md +0 -155
- package/stacks/nextjs-supabase/README.md +0 -103
- /package/{stacks/blazor-azure/.claude → framework}/commands/morph-apply.md +0 -0
- /package/{stacks/blazor-azure/.claude → framework}/commands/morph-archive.md +0 -0
- /package/{stacks/blazor-azure/.claude → framework}/commands/morph-preflight.md +0 -0
- /package/{stacks/blazor-azure/.claude → framework}/commands/morph-proposal.md +0 -0
- /package/{stacks/blazor-azure/.claude → framework}/commands/morph-status.md +0 -0
- /package/{stacks/blazor-azure/.claude → framework}/commands/morph-troubleshoot.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/ai-agents/blazor-ui.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/ai-agents/production.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/ai-agents/setup.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/ai-agents/team-orchestration.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/ai-agents/workflows.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/architecture/ddd/aggregates.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/architecture/ddd/entities.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/architecture/ddd/value-objects.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/api/minimal-api.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/api/rest.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/api/validation.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/authentication/passkeys.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/database/ef-core.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/database/migrations.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/database/postgresql/database.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/database/repository-patterns.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/database/vector-search-rag.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/dotnet/async.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/dotnet/core.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/dotnet/di.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/dotnet/program-cs-checklist.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/integrations/asaas/asaas-api.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/integrations/clerk/clerk-auth.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/integrations/hangfire/hangfire-jobs.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/backend/integrations/resend/resend-email.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/context/analytics.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/context/bundles.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/context/priming.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/core/architecture.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/core/coding.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/core/git-branching-strategy.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/core/git.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/core/testing.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/data/nosql/blob-storage.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/data/nosql/cache/redis.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/data/nosql/cosmos-db.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/data/vector-search/azure-ai-search.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/data/vector-search/rag-chunking.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/blazor/design-checklist.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/blazor/fluent-ui-setup.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/blazor/fluent-ui.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/blazor/html-conversion.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/blazor/lifecycle.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/blazor/pitfalls.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/blazor/state.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/design-system/animations.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/design-system/naming.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/frontend/nextjs/nextjs-patterns.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/azure/azure.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/azure/bicep/bicep-patterns.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/azure/devops/azure-devops-setup.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/azure/devops/local-development.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/azure/services/functions.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/azure/services/service-bus.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/azure/services/storage.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/docker/easypanel-deploy.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/supabase/mcp-setup.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/supabase/supabase-auth.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/supabase/supabase-pgvector.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/supabase/supabase-rls.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/infrastructure/supabase/supabase-storage.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/integration/api/graphql.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/integration/api/grpc.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/integration/api/rest-design.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/integration/event-driven/cqrs.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/integration/event-driven/event-sourcing.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/integration/event-driven/service-bus.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/observability/logging.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/observability/metrics.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/observability/monitoring.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/observability/tracing.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/workflows/parallel-execution.md +0 -0
- /package/{stacks/blazor-azure/.morph → framework}/standards/workflows/thread-management.md +0 -0
|
@@ -41,7 +41,7 @@ Quando o usuário solicitar `/morph-infra init`:
|
|
|
41
41
|
└── app-insights.bicep
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
2. Copiar templates de `.morph/templates/
|
|
44
|
+
2. Copiar templates de `.morph/templates/infrastructure/...`
|
|
45
45
|
|
|
46
46
|
3. Substituir placeholders:
|
|
47
47
|
- `{{APP_NAME}}` → nome do projeto
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# MORPH-SPEC Hooks Architecture
|
|
2
|
+
|
|
3
|
+
Git hooks and Agent Teams event handlers for automated validation.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
framework/hooks/ # Universal hooks (all stacks share)
|
|
9
|
+
├── pre-commit/
|
|
10
|
+
│ ├── agents.sh # Validates agents.json Schema
|
|
11
|
+
│ ├── specs.sh # Validates spec.md sections
|
|
12
|
+
│ └── orchestrator.sh # Calls framework + stack hooks
|
|
13
|
+
├── commit-msg/
|
|
14
|
+
│ └── conventional-commits.sh # Enforces Conventional Commits format
|
|
15
|
+
├── pre-push/
|
|
16
|
+
│ └── run-tests.sh # Runs test suite before push
|
|
17
|
+
├── agent-teams/
|
|
18
|
+
│ ├── teammate-idle.js # Agent Teams idle event
|
|
19
|
+
│ ├── task-completed.js # Task completion validation
|
|
20
|
+
│ └── phase-advanced.js # Phase advancement validation
|
|
21
|
+
└── README.md # This file
|
|
22
|
+
|
|
23
|
+
.morph/hooks/ # Project-specific hooks (optional)
|
|
24
|
+
└── pre-commit/
|
|
25
|
+
└── tests-{lang}.sh # Language-specific test coverage
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Hook Types
|
|
29
|
+
|
|
30
|
+
### Pre-Commit Hooks (Bash)
|
|
31
|
+
|
|
32
|
+
**Universal (framework/hooks/pre-commit/):**
|
|
33
|
+
- `agents.sh` - Validates agents.json with JSON Schema (BLOCKING)
|
|
34
|
+
- `specs.sh` - Validates spec.md required sections (BLOCKING)
|
|
35
|
+
- `orchestrator.sh` - Master hook that calls all hooks (BLOCKING)
|
|
36
|
+
|
|
37
|
+
**Project-Specific (.morph/hooks/pre-commit/):**
|
|
38
|
+
- `tests-csharp.sh` - C# test coverage (WARNING ONLY)
|
|
39
|
+
- `tests-typescript.sh` - TypeScript test coverage (WARNING ONLY)
|
|
40
|
+
|
|
41
|
+
### Commit Message Hook (Bash)
|
|
42
|
+
|
|
43
|
+
**Universal (framework/hooks/commit-msg/):**
|
|
44
|
+
- `conventional-commits.sh` - Enforces Conventional Commits format (BLOCKING)
|
|
45
|
+
- Validates: `<type>(<scope>): <description>` format
|
|
46
|
+
- Allowed types: feat, fix, docs, style, refactor, perf, test, chore, build, ci, revert
|
|
47
|
+
|
|
48
|
+
### Pre-Push Hook (Bash)
|
|
49
|
+
|
|
50
|
+
**Universal (framework/hooks/pre-push/):**
|
|
51
|
+
- `run-tests.sh` - Runs full test suite before push (BLOCKING)
|
|
52
|
+
- Auto-detects .NET (`dotnet test`) or Node.js (`npm test`) projects
|
|
53
|
+
|
|
54
|
+
### Agent Teams Hooks (JavaScript)
|
|
55
|
+
|
|
56
|
+
**Universal (framework/hooks/agent-teams/):**
|
|
57
|
+
- `teammate-idle.js` - Triggered when teammate is idle, validates recent work
|
|
58
|
+
- `task-completed.js` - Triggered when task marked complete, validates deliverables
|
|
59
|
+
- `phase-advanced.js` - Triggered when advancing phases, validates outputs and deliverables
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
### Git Hooks (Pre-Commit, Commit-Msg, Pre-Push)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# In your project root (.git/hooks directory)
|
|
67
|
+
cd .git/hooks
|
|
68
|
+
|
|
69
|
+
# Pre-commit hook (validates agents.json, spec.md, runs stack tests)
|
|
70
|
+
ln -sf ../../framework/hooks/pre-commit/orchestrator.sh pre-commit
|
|
71
|
+
chmod +x pre-commit
|
|
72
|
+
|
|
73
|
+
# Commit-msg hook (enforces Conventional Commits format)
|
|
74
|
+
ln -sf ../../framework/hooks/commit-msg/conventional-commits.sh commit-msg
|
|
75
|
+
chmod +x commit-msg
|
|
76
|
+
|
|
77
|
+
# Pre-push hook (runs test suite before push)
|
|
78
|
+
ln -sf ../../framework/hooks/pre-push/run-tests.sh pre-push
|
|
79
|
+
chmod +x pre-push
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Agent Teams Hooks
|
|
83
|
+
|
|
84
|
+
Add to `.claude/settings.local.json`:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"hooks": {
|
|
89
|
+
"TeammateIdle": "node framework/hooks/agent-teams/teammate-idle.js {feature}",
|
|
90
|
+
"TaskCompleted": "node framework/hooks/agent-teams/task-completed.js {feature} {taskId}",
|
|
91
|
+
"PhaseAdvanced": "node framework/hooks/agent-teams/phase-advanced.js {feature} {fromPhase} {toPhase}"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## How It Works
|
|
97
|
+
|
|
98
|
+
### Pre-Commit Flow
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
git commit -m "message"
|
|
102
|
+
↓
|
|
103
|
+
.git/hooks/pre-commit executes
|
|
104
|
+
↓
|
|
105
|
+
framework/hooks/pre-commit/orchestrator.sh
|
|
106
|
+
├─ Runs framework hooks (agents.sh, specs.sh)
|
|
107
|
+
└─ Runs stack hooks (.morph/hooks/pre-commit/*.sh)
|
|
108
|
+
↓
|
|
109
|
+
If ANY FAILS → COMMIT BLOCKED
|
|
110
|
+
If ALL PASS → COMMIT ALLOWED
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Agent Teams Flow
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
Teammate becomes idle
|
|
117
|
+
↓
|
|
118
|
+
Claude Code triggers "TeammateIdle" event
|
|
119
|
+
↓
|
|
120
|
+
framework/hooks/agent-teams/teammate-idle.js
|
|
121
|
+
├─ Loads agents.json
|
|
122
|
+
├─ Filters validators with hook_triggers: ["TeammateIdle"]
|
|
123
|
+
├─ Executes validators via hook-executor.js
|
|
124
|
+
└─ Formats results
|
|
125
|
+
↓
|
|
126
|
+
If BLOCKED → Show errors, prevent teammate from proceeding
|
|
127
|
+
If PASSED → Allow teammate to continue
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Configuring Validators
|
|
131
|
+
|
|
132
|
+
Validators register for hook events in `agents.json`:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"security-expert": {
|
|
137
|
+
"tier": 4,
|
|
138
|
+
"role": "validator",
|
|
139
|
+
"relationships": {
|
|
140
|
+
"runs_in": "hooks",
|
|
141
|
+
"hook_triggers": ["TeammateIdle", "TaskCompleted"]
|
|
142
|
+
},
|
|
143
|
+
"hook_behavior": {
|
|
144
|
+
"validates": ["SQL injection", "XSS", "Secrets"],
|
|
145
|
+
"severity": "error",
|
|
146
|
+
"blocks_on_fail": true
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Testing Hooks
|
|
153
|
+
|
|
154
|
+
### Pre-Commit Hooks
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# Test orchestrator
|
|
158
|
+
bash framework/hooks/pre-commit/orchestrator.sh
|
|
159
|
+
|
|
160
|
+
# Test individual hook
|
|
161
|
+
bash framework/hooks/pre-commit/agents.sh
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Git Hooks
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Test pre-commit orchestrator
|
|
168
|
+
bash framework/hooks/pre-commit/orchestrator.sh
|
|
169
|
+
|
|
170
|
+
# Test individual framework hooks
|
|
171
|
+
bash framework/hooks/pre-commit/agents.sh
|
|
172
|
+
bash framework/hooks/pre-commit/specs.sh
|
|
173
|
+
|
|
174
|
+
# Test commit-msg hook (pass test message as argument)
|
|
175
|
+
echo "feat(test): add new feature" > /tmp/test-msg.txt
|
|
176
|
+
bash framework/hooks/commit-msg/conventional-commits.sh /tmp/test-msg.txt
|
|
177
|
+
|
|
178
|
+
# Test pre-push hook
|
|
179
|
+
bash framework/hooks/pre-push/run-tests.sh
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Agent Teams Hooks
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Simulate TeammateIdle event
|
|
186
|
+
node framework/hooks/agent-teams/teammate-idle.js test-feature --verbose --dry-run
|
|
187
|
+
|
|
188
|
+
# Simulate TaskCompleted event
|
|
189
|
+
node framework/hooks/agent-teams/task-completed.js test-feature T001 --verbose --dry-run
|
|
190
|
+
|
|
191
|
+
# Simulate PhaseAdvanced event
|
|
192
|
+
node framework/hooks/agent-teams/phase-advanced.js test-feature design clarify --verbose --dry-run
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Bypassing Hooks
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# Skip pre-commit hooks (NOT RECOMMENDED)
|
|
199
|
+
git commit --no-verify
|
|
200
|
+
|
|
201
|
+
# Skip commit-msg hook (NOT RECOMMENDED)
|
|
202
|
+
git commit --no-verify
|
|
203
|
+
|
|
204
|
+
# Skip pre-push hook (NOT RECOMMENDED)
|
|
205
|
+
git push --no-verify
|
|
206
|
+
|
|
207
|
+
# Skip task completion validation (NOT RECOMMENDED)
|
|
208
|
+
morph-spec task done feature-name task-id --skip-validation
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Creating Custom Hooks
|
|
212
|
+
|
|
213
|
+
### Stack-Specific Pre-Commit Hook
|
|
214
|
+
|
|
215
|
+
Create `.morph/hooks/pre-commit/my-hook.sh`:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
#!/bin/bash
|
|
219
|
+
# Scope: my-stack | Custom validation
|
|
220
|
+
echo "🎯 Running custom validation..."
|
|
221
|
+
|
|
222
|
+
# Your validation logic here
|
|
223
|
+
|
|
224
|
+
exit 0
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
The orchestrator will automatically detect and run it.
|
|
228
|
+
|
|
229
|
+
### New Hook Event Type
|
|
230
|
+
|
|
231
|
+
Add to `framework/hooks/agent-teams/`:
|
|
232
|
+
|
|
233
|
+
```javascript
|
|
234
|
+
#!/usr/bin/env node
|
|
235
|
+
// Scope: universal | My custom event
|
|
236
|
+
|
|
237
|
+
import { executeHook, formatHookResults } from '../../src/lib/hooks/hook-executor.js';
|
|
238
|
+
|
|
239
|
+
// Your hook logic here
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Register in `agents.json`:
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"hook_triggers": ["MyCustomEvent"]
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Troubleshooting
|
|
251
|
+
|
|
252
|
+
### Pre-Commit Hook Not Running
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Check if hook exists
|
|
256
|
+
ls -la .git/hooks/pre-commit
|
|
257
|
+
|
|
258
|
+
# Recreate symlink
|
|
259
|
+
cd .git/hooks
|
|
260
|
+
ln -sf ../../framework/hooks/pre-commit/orchestrator.sh pre-commit
|
|
261
|
+
chmod +x pre-commit
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Agent Teams Hook Failing
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
# Test manually with verbose output
|
|
268
|
+
node framework/hooks/agent-teams/teammate-idle.js my-feature --verbose
|
|
269
|
+
|
|
270
|
+
# Check agents.json configuration
|
|
271
|
+
npx morph-spec validate-agents-skills
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## References
|
|
275
|
+
|
|
276
|
+
- Hook executor: `src/lib/hooks/hook-executor.js`
|
|
277
|
+
- Checkpoint hooks: `src/lib/checkpoints/checkpoint-hooks.js`
|
|
278
|
+
- Agents configuration: `.morph/config/agents.json`
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
*MORPH-SPEC v4.0.0 - Hooks Architecture*
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Stop Hook: validate-and-continue
|
|
4
|
+
*
|
|
5
|
+
* Runs architecture and security validators.
|
|
6
|
+
* Writes structured JSON to stdout for stop-hook-executor to parse.
|
|
7
|
+
*
|
|
8
|
+
* Output format:
|
|
9
|
+
* {
|
|
10
|
+
* "passed": boolean,
|
|
11
|
+
* "issues": [{ "message": string, "severity": "error"|"warning" }],
|
|
12
|
+
* "suggestions": [string],
|
|
13
|
+
* "error": string | null
|
|
14
|
+
* }
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { execSync } from 'child_process';
|
|
18
|
+
import { existsSync } from 'fs';
|
|
19
|
+
import { join } from 'path';
|
|
20
|
+
|
|
21
|
+
const VALIDATORS = ['architecture', 'security'];
|
|
22
|
+
const cwd = process.cwd();
|
|
23
|
+
|
|
24
|
+
async function runValidators() {
|
|
25
|
+
const issues = [];
|
|
26
|
+
const suggestions = [];
|
|
27
|
+
let allPassed = true;
|
|
28
|
+
|
|
29
|
+
for (const validator of VALIDATORS) {
|
|
30
|
+
try {
|
|
31
|
+
const validateBin = join(cwd, 'bin/validate.js');
|
|
32
|
+
if (!existsSync(validateBin)) {
|
|
33
|
+
// Validator binary not found — skip gracefully
|
|
34
|
+
suggestions.push(`Install morph-spec validator: bin/validate.js not found`);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const result = execSync(
|
|
39
|
+
`node "${validateBin}" ${validator} --json --quiet`,
|
|
40
|
+
{ encoding: 'utf8', stdio: 'pipe', cwd, timeout: 60000 }
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const parsed = JSON.parse(result);
|
|
44
|
+
if (parsed.errors > 0) {
|
|
45
|
+
allPassed = false;
|
|
46
|
+
(parsed.issues || []).forEach(issue => {
|
|
47
|
+
if (issue.severity === 'error') {
|
|
48
|
+
issues.push({ message: `[${validator}] ${issue.message}`, severity: 'error' });
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (parsed.warnings > 0) {
|
|
54
|
+
(parsed.issues || []).forEach(issue => {
|
|
55
|
+
if (issue.severity === 'warning') {
|
|
56
|
+
issues.push({ message: `[${validator}] ${issue.message}`, severity: 'warning' });
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
} catch (err) {
|
|
61
|
+
// If validator fails to run, report as warning but don't block
|
|
62
|
+
issues.push({
|
|
63
|
+
message: `[${validator}] Validator execution failed: ${err.message}`,
|
|
64
|
+
severity: 'warning'
|
|
65
|
+
});
|
|
66
|
+
suggestions.push(`Run manually: node bin/validate.js ${validator}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!allPassed && issues.some(i => i.severity === 'error')) {
|
|
71
|
+
suggestions.push('Fix architecture and security violations before continuing');
|
|
72
|
+
suggestions.push('See framework/standards/architecture.md for patterns');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const output = {
|
|
76
|
+
passed: allPassed,
|
|
77
|
+
validatorsRun: VALIDATORS,
|
|
78
|
+
issues,
|
|
79
|
+
suggestions,
|
|
80
|
+
timestamp: new Date().toISOString(),
|
|
81
|
+
error: null
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
process.stdout.write(JSON.stringify(output));
|
|
85
|
+
process.exit(allPassed ? 0 : 1);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
runValidators().catch(err => {
|
|
89
|
+
process.stdout.write(JSON.stringify({
|
|
90
|
+
passed: false,
|
|
91
|
+
issues: [{ message: err.message, severity: 'error' }],
|
|
92
|
+
suggestions: [],
|
|
93
|
+
error: err.message
|
|
94
|
+
}));
|
|
95
|
+
process.exit(1);
|
|
96
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Stop Hook: validate-checkpoints
|
|
4
|
+
*
|
|
5
|
+
* Checks that the last 3 tasks passed their checkpoints.
|
|
6
|
+
* Reads from state.json checkpoint history.
|
|
7
|
+
*
|
|
8
|
+
* Output format: { passed, issues, suggestions, checkpointSummary, error }
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { readFileSync, existsSync } from 'fs';
|
|
12
|
+
import { join } from 'path';
|
|
13
|
+
|
|
14
|
+
const cwd = process.cwd();
|
|
15
|
+
const REQUIRED_PASSING = 3;
|
|
16
|
+
|
|
17
|
+
function validateCheckpoints() {
|
|
18
|
+
const statePath = join(cwd, '.morph/state.json');
|
|
19
|
+
|
|
20
|
+
if (!existsSync(statePath)) {
|
|
21
|
+
process.stdout.write(JSON.stringify({
|
|
22
|
+
passed: true,
|
|
23
|
+
issues: [],
|
|
24
|
+
suggestions: ['State file not found — checkpoint validation skipped'],
|
|
25
|
+
checkpointSummary: null,
|
|
26
|
+
error: null
|
|
27
|
+
}));
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let state;
|
|
32
|
+
try {
|
|
33
|
+
state = JSON.parse(readFileSync(statePath, 'utf8'));
|
|
34
|
+
} catch (err) {
|
|
35
|
+
process.stdout.write(JSON.stringify({
|
|
36
|
+
passed: false,
|
|
37
|
+
issues: [{ message: `Failed to read state.json: ${err.message}`, severity: 'error' }],
|
|
38
|
+
suggestions: [],
|
|
39
|
+
error: err.message
|
|
40
|
+
}));
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Find all features with checkpoints
|
|
45
|
+
const features = Object.entries(state.features || {});
|
|
46
|
+
const issues = [];
|
|
47
|
+
const suggestions = [];
|
|
48
|
+
let allPassed = true;
|
|
49
|
+
|
|
50
|
+
for (const [featureName, feature] of features) {
|
|
51
|
+
if (feature.phase !== 'implement') continue;
|
|
52
|
+
|
|
53
|
+
const checkpoints = feature.checkpoints || [];
|
|
54
|
+
const recentCheckpoints = checkpoints.slice(-REQUIRED_PASSING);
|
|
55
|
+
|
|
56
|
+
if (recentCheckpoints.length === 0) {
|
|
57
|
+
// No checkpoints yet — pass
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const failedRecent = recentCheckpoints.filter(c => c.passed === false);
|
|
62
|
+
if (failedRecent.length > 0) {
|
|
63
|
+
allPassed = false;
|
|
64
|
+
issues.push({
|
|
65
|
+
message: `Feature ${featureName}: ${failedRecent.length} recent checkpoint(s) failed`,
|
|
66
|
+
severity: 'error'
|
|
67
|
+
});
|
|
68
|
+
suggestions.push(`Review checkpoint failures in ${featureName} before continuing`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const checkpointSummary = features.map(([name, f]) => ({
|
|
73
|
+
feature: name,
|
|
74
|
+
totalCheckpoints: f.checkpoints?.length || 0,
|
|
75
|
+
recentPassed: (f.checkpoints || []).slice(-3).filter(c => c.passed !== false).length
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
const output = {
|
|
79
|
+
passed: allPassed,
|
|
80
|
+
issues,
|
|
81
|
+
suggestions,
|
|
82
|
+
checkpointSummary,
|
|
83
|
+
timestamp: new Date().toISOString(),
|
|
84
|
+
error: null
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
process.stdout.write(JSON.stringify(output));
|
|
88
|
+
process.exit(allPassed ? 0 : 1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
validateCheckpoints();
|
|
93
|
+
} catch (err) {
|
|
94
|
+
process.stdout.write(JSON.stringify({
|
|
95
|
+
passed: false,
|
|
96
|
+
issues: [{ message: err.message, severity: 'error' }],
|
|
97
|
+
suggestions: [],
|
|
98
|
+
error: err.message
|
|
99
|
+
}));
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Stop Hook: validate-tests
|
|
4
|
+
*
|
|
5
|
+
* Runs the project test suite (if available) and returns results.
|
|
6
|
+
* Gracefully handles projects without tests.
|
|
7
|
+
*
|
|
8
|
+
* Output format: { passed, issues, suggestions, testResults, error }
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { execSync } from 'child_process';
|
|
12
|
+
import { existsSync, readFileSync } from 'fs';
|
|
13
|
+
import { join } from 'path';
|
|
14
|
+
|
|
15
|
+
const cwd = process.cwd();
|
|
16
|
+
|
|
17
|
+
function validateTests() {
|
|
18
|
+
// Check if test runner is configured
|
|
19
|
+
let pkgJson;
|
|
20
|
+
try {
|
|
21
|
+
pkgJson = JSON.parse(readFileSync(join(cwd, 'package.json'), 'utf8'));
|
|
22
|
+
} catch {
|
|
23
|
+
process.stdout.write(JSON.stringify({
|
|
24
|
+
passed: true,
|
|
25
|
+
issues: [],
|
|
26
|
+
suggestions: ['No package.json found — test validation skipped'],
|
|
27
|
+
testResults: null,
|
|
28
|
+
error: null
|
|
29
|
+
}));
|
|
30
|
+
process.exit(0);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const hasTestScript = pkgJson.scripts?.test && !pkgJson.scripts.test.includes('no test specified');
|
|
34
|
+
const hasVitest = pkgJson.dependencies?.vitest || pkgJson.devDependencies?.vitest;
|
|
35
|
+
const hasJest = pkgJson.dependencies?.jest || pkgJson.devDependencies?.jest;
|
|
36
|
+
|
|
37
|
+
if (!hasTestScript && !hasVitest && !hasJest) {
|
|
38
|
+
process.stdout.write(JSON.stringify({
|
|
39
|
+
passed: true,
|
|
40
|
+
issues: [],
|
|
41
|
+
suggestions: ['No test runner configured — consider adding vitest or jest'],
|
|
42
|
+
testResults: { skipped: true, reason: 'No test runner found' },
|
|
43
|
+
error: null
|
|
44
|
+
}));
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const testCmd = hasVitest ? 'npx vitest run' : (hasJest ? 'npx jest' : 'npm test');
|
|
50
|
+
const output = execSync(`${testCmd} --passWithNoTests`, {
|
|
51
|
+
encoding: 'utf8',
|
|
52
|
+
stdio: 'pipe',
|
|
53
|
+
cwd,
|
|
54
|
+
timeout: 300000 // 5 minutes for tests
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Parse test results from output
|
|
58
|
+
const passedMatch = output.match(/(\d+)\s+passed/);
|
|
59
|
+
const failedMatch = output.match(/(\d+)\s+failed/);
|
|
60
|
+
const skippedMatch = output.match(/(\d+)\s+skipped/);
|
|
61
|
+
|
|
62
|
+
const testResults = {
|
|
63
|
+
passed: parseInt(passedMatch?.[1] || '0'),
|
|
64
|
+
failed: parseInt(failedMatch?.[1] || '0'),
|
|
65
|
+
skipped: parseInt(skippedMatch?.[1] || '0'),
|
|
66
|
+
rawOutput: output.substring(0, 500) // First 500 chars
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
process.stdout.write(JSON.stringify({
|
|
70
|
+
passed: testResults.failed === 0,
|
|
71
|
+
issues: testResults.failed > 0
|
|
72
|
+
? [{ message: `${testResults.failed} test(s) failed`, severity: 'error' }]
|
|
73
|
+
: [],
|
|
74
|
+
suggestions: testResults.failed > 0
|
|
75
|
+
? ['Fix failing tests before continuing implementation']
|
|
76
|
+
: [],
|
|
77
|
+
testResults,
|
|
78
|
+
timestamp: new Date().toISOString(),
|
|
79
|
+
error: null
|
|
80
|
+
}));
|
|
81
|
+
process.exit(testResults.failed === 0 ? 0 : 1);
|
|
82
|
+
} catch (err) {
|
|
83
|
+
// Extract test failure count from error output
|
|
84
|
+
const output = err.stdout || err.stderr || err.message;
|
|
85
|
+
const failedMatch = output.match(/(\d+)\s+failed/);
|
|
86
|
+
const failed = parseInt(failedMatch?.[1] || '1');
|
|
87
|
+
|
|
88
|
+
process.stdout.write(JSON.stringify({
|
|
89
|
+
passed: false,
|
|
90
|
+
issues: [{ message: `Test suite failed with ${failed} failure(s)`, severity: 'error' }],
|
|
91
|
+
suggestions: ['Review test output and fix failing tests', 'Run: npm test locally'],
|
|
92
|
+
testResults: { failed, rawOutput: output.substring(0, 500) },
|
|
93
|
+
error: null
|
|
94
|
+
}));
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
validateTests();
|
|
101
|
+
} catch (err) {
|
|
102
|
+
process.stdout.write(JSON.stringify({
|
|
103
|
+
passed: false,
|
|
104
|
+
issues: [{ message: err.message, severity: 'error' }],
|
|
105
|
+
suggestions: [],
|
|
106
|
+
error: err.message
|
|
107
|
+
}));
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Agent Teams Hook Dispatcher
|
|
5
|
+
*
|
|
6
|
+
* Reads Claude Code PostToolUse JSON from stdin and dispatches to the
|
|
7
|
+
* appropriate agent-teams hook based on the Bash command content.
|
|
8
|
+
*
|
|
9
|
+
* Wired via .claude/settings.local.json:
|
|
10
|
+
* "PostToolUse": [{ "matcher": "Bash", "hooks": [{ "type": "command", "command": "node framework/hooks/agent-teams/dispatch.js" }] }]
|
|
11
|
+
*
|
|
12
|
+
* Dispatches:
|
|
13
|
+
* morph-spec task done <feature> <taskId> → task-completed.js <feature> <taskId>
|
|
14
|
+
* morph-spec phase advance <feature> → phase-advanced.js <feature> <from> <to>
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { execSync } from 'child_process';
|
|
18
|
+
import { readFileSync } from 'fs';
|
|
19
|
+
import { join, dirname } from 'path';
|
|
20
|
+
import { fileURLToPath } from 'url';
|
|
21
|
+
|
|
22
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
|
|
24
|
+
let input = '';
|
|
25
|
+
process.stdin.setEncoding('utf-8');
|
|
26
|
+
process.stdin.on('data', chunk => { input += chunk; });
|
|
27
|
+
process.stdin.on('end', () => {
|
|
28
|
+
try {
|
|
29
|
+
const payload = JSON.parse(input || '{}');
|
|
30
|
+
const command = payload?.tool_input?.command || '';
|
|
31
|
+
dispatch(command);
|
|
32
|
+
} catch {
|
|
33
|
+
// Non-JSON or empty stdin — ignore silently
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
function dispatch(command) {
|
|
39
|
+
// morph-spec task done <feature> <taskId> [--skip-validation]
|
|
40
|
+
const taskDoneMatch = command.match(/morph-spec\s+task\s+done\s+(\S+)\s+(\S+)/);
|
|
41
|
+
if (taskDoneMatch) {
|
|
42
|
+
const [, feature, taskId] = taskDoneMatch;
|
|
43
|
+
run(`node "${join(__dirname, 'task-completed.js')}" ${feature} ${taskId}`);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// morph-spec phase advance <feature>
|
|
48
|
+
const phaseAdvanceMatch = command.match(/morph-spec\s+phase\s+advance\s+(\S+)/);
|
|
49
|
+
if (phaseAdvanceMatch) {
|
|
50
|
+
const [, feature] = phaseAdvanceMatch;
|
|
51
|
+
// from/to phases not available at PostToolUse time — use placeholder
|
|
52
|
+
run(`node "${join(__dirname, 'phase-advanced.js')}" ${feature} unknown advanced`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// No match — exit cleanly
|
|
57
|
+
process.exit(0);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function run(cmd) {
|
|
61
|
+
try {
|
|
62
|
+
execSync(cmd, { stdio: 'inherit', cwd: join(__dirname, '../../..') });
|
|
63
|
+
} catch {
|
|
64
|
+
// Hook failures are non-blocking for the dispatch layer
|
|
65
|
+
}
|
|
66
|
+
process.exit(0);
|
|
67
|
+
}
|