@polymorphism-tech/morph-spec 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +68 -400
- package/README.md +198 -76
- package/bin/detect-agents.js +227 -225
- package/bin/morph-spec.js +10 -0
- package/bin/render-template.js +303 -302
- package/bin/semantic-detect-agents.js +247 -246
- package/bin/{task-manager.js → task-manager.cjs} +12 -1
- package/bin/validate-agents-skills.js +257 -251
- package/bin/validate-agents.js +70 -69
- package/bin/validate-phase.js +263 -263
- package/docs/getting-started.md +3 -3
- package/package.json +3 -4
- package/scripts/reorganize-skills.cjs +175 -0
- package/scripts/validate-agents-structure.cjs +52 -0
- package/scripts/validate-skills.cjs +180 -0
- package/src/commands/create-story.js +354 -351
- package/src/commands/detect-agents.js +13 -2
- package/src/commands/detect.js +104 -104
- package/src/commands/state.js +334 -333
- package/src/commands/sync.js +167 -167
- package/src/commands/task.js +1 -1
- package/src/commands/update.js +13 -1
- package/src/lib/context-generator.js +7 -4
- package/{detectors → src/lib/detectors}/config-detector.js +223 -223
- package/{detectors → src/lib/detectors}/conversation-analyzer.js +163 -163
- package/{detectors → src/lib/detectors}/index.js +84 -84
- package/{detectors → src/lib/detectors}/standards-generator.js +275 -275
- package/src/lib/hook-executor.js +2 -1
- package/src/lib/stack-resolver.js +148 -0
- package/src/lib/standards-context-injector.js +4 -3
- package/src/lib/state-manager.js +21 -4
- package/src/lib/team-orchestrator.js +2 -1
- package/src/lib/troubleshoot-grep.js +13 -3
- package/src/lib/validation-runner.js +2 -1
- package/src/utils/file-copier.js +3 -1
- package/{content → stacks/blazor-azure}/.azure/README.md +293 -293
- package/{content → stacks/blazor-azure}/.azure/docs/azure-devops-setup.md +454 -454
- package/{content → stacks/blazor-azure}/.azure/docs/branch-strategy.md +398 -398
- package/{content → stacks/blazor-azure}/.azure/docs/local-development.md +515 -515
- package/{content → stacks/blazor-azure}/.azure/pipelines/pipeline-variables.yml +34 -34
- package/{content → stacks/blazor-azure}/.azure/pipelines/prod-pipeline.yml +319 -319
- package/{content → stacks/blazor-azure}/.azure/pipelines/staging-pipeline.yml +234 -234
- package/{content → stacks/blazor-azure}/.azure/pipelines/templates/build-dotnet.yml +75 -75
- package/{content → stacks/blazor-azure}/.azure/pipelines/templates/deploy-app-service.yml +94 -94
- package/{content → stacks/blazor-azure}/.azure/pipelines/templates/deploy-container-app.yml +120 -120
- package/{content → stacks/blazor-azure}/.azure/pipelines/templates/infra-deploy.yml +90 -90
- package/{content → stacks/blazor-azure}/.claude/commands/morph-archive.md +79 -79
- package/{content → stacks/blazor-azure}/.claude/commands/morph-deploy.md +529 -529
- package/{content → stacks/blazor-azure}/.claude/commands/morph-infra.md +209 -209
- package/{content → stacks/blazor-azure}/.claude/commands/morph-troubleshoot.md +1 -1
- package/{content → stacks/blazor-azure}/.claude/settings.local.json +15 -15
- package/{content → stacks/blazor-azure}/.claude/skills/level-1-workflows/phase-setup.md +1 -1
- package/{content/.claude/skills/specialists → stacks/blazor-azure/.claude/skills/level-2-domains/architecture}/prompt-engineer.md +189 -189
- package/{content/.claude/skills/specialists → stacks/blazor-azure/.claude/skills/level-2-domains/architecture}/seo-growth-hacker.md +320 -320
- package/{content/.claude/skills/infra → stacks/blazor-azure/.claude/skills/level-2-domains/infrastructure}/azure-deploy-specialist.md +699 -699
- package/{content → stacks/blazor-azure}/.morph/.morphversion +5 -5
- package/{content → stacks/blazor-azure}/.morph/archive/.gitkeep +25 -25
- package/{content → stacks/blazor-azure}/.morph/config/agents.json +7 -5
- package/{content → stacks/blazor-azure}/.morph/docs/STORY-DRIVEN-DEVELOPMENT.md +392 -392
- package/{content → stacks/blazor-azure}/.morph/docs/workflows/enforcement-pipeline.md +3 -3
- package/{content → stacks/blazor-azure}/.morph/examples/api-nextjs/README.md +241 -241
- package/{content → stacks/blazor-azure}/.morph/examples/api-nextjs/contracts.ts +307 -307
- package/{content → stacks/blazor-azure}/.morph/examples/api-nextjs/spec.md +399 -399
- package/{content → stacks/blazor-azure}/.morph/examples/api-nextjs/tasks.md +168 -168
- package/{content → stacks/blazor-azure}/.morph/examples/micro-saas/README.md +125 -125
- package/{content → stacks/blazor-azure}/.morph/examples/micro-saas/contracts.cs +358 -358
- package/{content → stacks/blazor-azure}/.morph/examples/micro-saas/decisions.md +246 -246
- package/{content → stacks/blazor-azure}/.morph/examples/micro-saas/spec.md +236 -236
- package/{content → stacks/blazor-azure}/.morph/examples/micro-saas/tasks.md +150 -150
- package/{content → stacks/blazor-azure}/.morph/examples/multi-agent/README.md +309 -309
- package/{content → stacks/blazor-azure}/.morph/examples/multi-agent/contracts.cs +433 -433
- package/{content → stacks/blazor-azure}/.morph/examples/multi-agent/spec.md +479 -479
- package/{content → stacks/blazor-azure}/.morph/examples/multi-agent/tasks.md +185 -185
- package/{content → stacks/blazor-azure}/.morph/examples/state-v3.json +188 -188
- package/{content → stacks/blazor-azure}/.morph/features/.gitkeep +25 -25
- package/{content → stacks/blazor-azure}/.morph/hooks/README.md +12 -12
- package/{content → stacks/blazor-azure}/.morph/hooks/pre-commit-all.sh +48 -48
- package/{content → stacks/blazor-azure}/.morph/hooks/pre-commit-specs.sh +49 -49
- package/{content → stacks/blazor-azure}/.morph/hooks/pre-commit-tests.sh +60 -60
- package/{content → stacks/blazor-azure}/.morph/project.md +160 -160
- package/{content → stacks/blazor-azure}/.morph/schemas/agent.schema.json +296 -296
- package/{content → stacks/blazor-azure}/.morph/specs/.gitkeep +20 -20
- package/{content → stacks/blazor-azure}/.morph/standards/agent-teams-workflow.md +2 -2
- package/{content → stacks/blazor-azure}/.morph/standards/coding.md +377 -377
- package/{content → stacks/blazor-azure}/.morph/standards/fluent-ui-setup.md +590 -590
- package/{content → stacks/blazor-azure}/.morph/standards/migration-guide.md +514 -514
- package/{content → stacks/blazor-azure}/.morph/standards/passkeys-auth.md +423 -423
- package/{content → stacks/blazor-azure}/.morph/standards/vector-search-rag.md +536 -536
- package/{content → stacks/blazor-azure}/.morph/state.json +17 -17
- package/{content → stacks/blazor-azure}/.morph/templates/FluentDesignTheme.cs +149 -149
- package/{content → stacks/blazor-azure}/.morph/templates/MudTheme.cs +281 -281
- package/{content → stacks/blazor-azure}/.morph/templates/component.razor +239 -239
- package/{content → stacks/blazor-azure}/.morph/templates/contracts.cs +217 -217
- package/{content → stacks/blazor-azure}/.morph/templates/design-system.css +226 -226
- package/{content → stacks/blazor-azure}/.morph/templates/infra/.dockerignore.example +89 -89
- package/{content → stacks/blazor-azure}/.morph/templates/infra/Dockerfile.example +82 -82
- package/{content → stacks/blazor-azure}/.morph/templates/infra/README.md +286 -286
- package/{content → stacks/blazor-azure}/.morph/templates/infra/app-insights.bicep +63 -63
- package/{content → stacks/blazor-azure}/.morph/templates/infra/app-service.bicep +164 -164
- package/{content → stacks/blazor-azure}/.morph/templates/infra/azure-pipelines-deploy.yml +480 -480
- package/{content → stacks/blazor-azure}/.morph/templates/infra/container-app-env.bicep +49 -49
- package/{content → stacks/blazor-azure}/.morph/templates/infra/container-app.bicep +156 -156
- package/{content → stacks/blazor-azure}/.morph/templates/infra/deploy.ps1 +229 -229
- package/{content → stacks/blazor-azure}/.morph/templates/infra/deploy.sh +208 -208
- package/{content → stacks/blazor-azure}/.morph/templates/infra/key-vault.bicep +91 -91
- package/{content → stacks/blazor-azure}/.morph/templates/infra/main.bicep +189 -189
- package/{content → stacks/blazor-azure}/.morph/templates/infra/parameters.dev.json +29 -29
- package/{content → stacks/blazor-azure}/.morph/templates/infra/parameters.prod.json +29 -29
- package/{content → stacks/blazor-azure}/.morph/templates/infra/parameters.staging.json +29 -29
- package/{content → stacks/blazor-azure}/.morph/templates/infra/sql-database.bicep +103 -103
- package/{content → stacks/blazor-azure}/.morph/templates/infra/storage.bicep +106 -106
- package/{content → stacks/blazor-azure}/.morph/templates/integrations/asaas-client.cs +387 -387
- package/{content → stacks/blazor-azure}/.morph/templates/integrations/asaas-webhook.cs +351 -351
- package/{content → stacks/blazor-azure}/.morph/templates/integrations/azure-identity-config.cs +288 -288
- package/{content → stacks/blazor-azure}/.morph/templates/integrations/clerk-config.cs +258 -258
- package/{content → stacks/blazor-azure}/.morph/templates/job.cs +171 -171
- package/{content → stacks/blazor-azure}/.morph/templates/migration.cs +83 -83
- package/{content → stacks/blazor-azure}/.morph/templates/repository.cs +141 -141
- package/{content → stacks/blazor-azure}/.morph/templates/saas/subscription.cs +347 -347
- package/{content → stacks/blazor-azure}/.morph/templates/saas/tenant.cs +338 -338
- package/{content → stacks/blazor-azure}/.morph/templates/service.cs +139 -139
- package/{content → stacks/blazor-azure}/.morph/templates/sprint-status.yaml +68 -68
- package/{content → stacks/blazor-azure}/.morph/templates/story.md +143 -143
- package/{content → stacks/blazor-azure}/.morph/templates/test.cs +239 -239
- package/{content → stacks/blazor-azure}/.morph/templates/ui-design-system.md +286 -286
- package/{content → stacks/blazor-azure}/.morph/templates/ui-flows.md +336 -336
- package/{content → stacks/blazor-azure}/.morph/templates/ui-mockups.md +133 -133
- package/{content → stacks/blazor-azure}/.morph/test-infra/example.bicep +59 -59
- package/{content → stacks/blazor-azure}/README.md +79 -79
- package/stacks/nextjs-supabase/.claude/skills/level-2-domains/backend/dotnet-supabase.md +244 -0
- package/stacks/nextjs-supabase/.claude/skills/level-2-domains/frontend/nextjs-supabase.md +335 -0
- package/stacks/nextjs-supabase/.claude/skills/level-2-domains/infrastructure/easypanel-deployer.md +189 -0
- package/stacks/nextjs-supabase/.claude/skills/level-2-domains/integrations/supabase-expert.md +170 -0
- package/stacks/nextjs-supabase/.morph/config/agents.json +345 -0
- package/stacks/nextjs-supabase/.morph/config/config.template.json +92 -0
- package/stacks/nextjs-supabase/.morph/docs/easypanel-setup.md +169 -0
- package/stacks/nextjs-supabase/.morph/docs/supabase-mcp-setup.md +247 -0
- package/stacks/nextjs-supabase/.morph/examples/crud-nextjs-supabase/README.md +697 -0
- package/stacks/nextjs-supabase/.morph/examples/crud-nextjs-supabase/spec.md +85 -0
- package/stacks/nextjs-supabase/.morph/examples/crud-nextjs-supabase/tasks.md +86 -0
- package/stacks/nextjs-supabase/.morph/examples/saas-nextjs-supabase/README.md +498 -0
- package/stacks/nextjs-supabase/.morph/examples/saas-nextjs-supabase/decisions.md +121 -0
- package/stacks/nextjs-supabase/.morph/examples/saas-nextjs-supabase/spec.md +138 -0
- package/stacks/nextjs-supabase/.morph/examples/saas-nextjs-supabase/tasks.md +162 -0
- package/stacks/nextjs-supabase/.morph/project.md +168 -0
- package/stacks/nextjs-supabase/.morph/standards/easypanel-deploy.md +191 -0
- package/stacks/nextjs-supabase/.morph/standards/nextjs-patterns.md +193 -0
- package/stacks/nextjs-supabase/.morph/standards/supabase-auth.md +171 -0
- package/stacks/nextjs-supabase/.morph/standards/supabase-pgvector.md +164 -0
- package/stacks/nextjs-supabase/.morph/standards/supabase-rls.md +179 -0
- package/stacks/nextjs-supabase/.morph/standards/supabase-storage.md +148 -0
- package/stacks/nextjs-supabase/.morph/templates/contracts.cs +173 -0
- package/stacks/nextjs-supabase/.morph/templates/contracts.ts +168 -0
- package/stacks/nextjs-supabase/.morph/templates/decisions.md +115 -0
- package/stacks/nextjs-supabase/.morph/templates/dockerfile-api.dockerfile +38 -0
- package/stacks/nextjs-supabase/.morph/templates/dockerfile-web.dockerfile +48 -0
- package/stacks/nextjs-supabase/.morph/templates/proposal.md +145 -0
- package/stacks/nextjs-supabase/.morph/templates/recap.md +134 -0
- package/stacks/nextjs-supabase/.morph/templates/rls-policy.sql +57 -0
- package/stacks/nextjs-supabase/.morph/templates/spec.md +231 -0
- package/stacks/nextjs-supabase/.morph/templates/supabase-migration.sql +100 -0
- package/stacks/nextjs-supabase/.morph/templates/tasks.md +257 -0
- package/stacks/nextjs-supabase/CLAUDE.md +149 -0
- package/stacks/nextjs-supabase/README.md +112 -0
- /package/{detectors → src/lib/detectors}/structure-detector.js +0 -0
- /package/{content → stacks/blazor-azure}/.claude/commands/morph-apply.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/commands/morph-preflight.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/commands/morph-proposal.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/commands/morph-status.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-0-meta/README.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-0-meta/code-review.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-0-meta/morph-checklist.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-0-meta/simulation-checklist.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-1-workflows/README.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-1-workflows/morph-replicate.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-1-workflows/phase-clarify.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-1-workflows/phase-design.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-1-workflows/phase-tasks.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-1-workflows/phase-uiux.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/README.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/ai-agents/ai-system-architect.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/architecture/po-pm-advisor.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/architecture/standards-architect.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/backend/dotnet-senior.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/backend/ef-modeler.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/backend/hangfire-orchestrator.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/backend/ms-agent-expert.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/frontend/blazor-builder.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/frontend/nextjs-expert.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/frontend/ui-ux-designer.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/infrastructure/azure-architect.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/infrastructure/bicep-architect.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/infrastructure/container-specialist.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/infrastructure/devops-engineer.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/integrations/asaas-financial.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/integrations/azure-identity.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/integrations/clerk-auth.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/integrations/resend-email.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/quality/code-analyzer.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-2-domains/quality/testing-specialist.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-3-technologies/README.md +0 -0
- /package/{content → stacks/blazor-azure}/.claude/skills/level-4-patterns/README.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/config/config.template.json +0 -0
- /package/{content → stacks/blazor-azure}/.morph/docs/workflows/design-impl.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/docs/workflows/fast-track.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/docs/workflows/full-morph.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/docs/workflows/standard.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/docs/workflows/ui-refresh.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/examples/scheduled-reports/decisions.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/examples/scheduled-reports/proposal.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/examples/scheduled-reports/spec.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/hooks/pre-commit-agents.sh +0 -0
- /package/{content → stacks/blazor-azure}/.morph/hooks/task-completed.js +0 -0
- /package/{content → stacks/blazor-azure}/.morph/hooks/teammate-idle.js +0 -0
- /package/{content → stacks/blazor-azure}/.morph/schemas/tasks.schema.json +0 -0
- /package/{content → stacks/blazor-azure}/.morph/standards/agent-framework-blazor-ui.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/standards/agent-framework-production.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/standards/agent-framework-setup.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/standards/agent-framework-workflows.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/standards/architecture.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/standards/azure.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/standards/dotnet10-migration.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/CONTEXT-FEATURE.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/CONTEXT.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/agent.cs +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/clarify-questions.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/contracts/Commands.cs +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/contracts/Entities.cs +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/contracts/Queries.cs +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/contracts/README.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/decisions.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/infra/deploy-checklist.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/proposal.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/recap.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/simulation.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/spec.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/state.template.json +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/tasks.md +0 -0
- /package/{content → stacks/blazor-azure}/.morph/templates/ui-components.md +0 -0
- /package/{content → stacks/blazor-azure}/CLAUDE.md +0 -0
|
@@ -1,351 +1,354 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MORPH-SPEC Story Creator
|
|
3
|
-
* Creates self-contained story files with auto-injected Dev Notes
|
|
4
|
-
* Inspired by BMAD Method story-driven development
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import fs from 'fs';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import yaml from 'yaml';
|
|
10
|
-
import ora from 'ora';
|
|
11
|
-
import chalk from 'chalk';
|
|
12
|
-
import { logger } from '../utils/logger.js';
|
|
13
|
-
import { ensureDir, writeFile } from '../utils/file-copier.js';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
'{{
|
|
143
|
-
'{{
|
|
144
|
-
'{{
|
|
145
|
-
'{{
|
|
146
|
-
'{{
|
|
147
|
-
'{{
|
|
148
|
-
'{{
|
|
149
|
-
'{{
|
|
150
|
-
'{{
|
|
151
|
-
'{{
|
|
152
|
-
'{{
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
logger.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
// Read
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
//
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
storyData.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
//
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
logger.
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
//
|
|
259
|
-
await
|
|
260
|
-
|
|
261
|
-
//
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
sprintStatus =
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
sprintStatus.metrics.
|
|
309
|
-
sprintStatus.metrics.
|
|
310
|
-
sprintStatus.metrics.
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
sprintStatus.
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
logger.
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
logger.
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
logger.
|
|
339
|
-
logger.
|
|
340
|
-
|
|
341
|
-
logger.
|
|
342
|
-
logger.dim('
|
|
343
|
-
logger.
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MORPH-SPEC Story Creator
|
|
3
|
+
* Creates self-contained story files with auto-injected Dev Notes
|
|
4
|
+
* Inspired by BMAD Method story-driven development
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import fs from 'fs';
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import yaml from 'yaml';
|
|
10
|
+
import ora from 'ora';
|
|
11
|
+
import chalk from 'chalk';
|
|
12
|
+
import { logger } from '../utils/logger.js';
|
|
13
|
+
import { ensureDir, writeFile } from '../utils/file-copier.js';
|
|
14
|
+
import { resolveTemplatesDir } from '../lib/stack-resolver.js';
|
|
15
|
+
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// Helper Functions
|
|
18
|
+
// ============================================================================
|
|
19
|
+
|
|
20
|
+
function readTemplate(templateName) {
|
|
21
|
+
// Try npm-installed package path first
|
|
22
|
+
const pkgTemplatesDir = resolveTemplatesDir(path.join(process.cwd(), 'node_modules/@polymorphism-tech/morph-spec'));
|
|
23
|
+
const templatePath = path.join(pkgTemplatesDir, templateName);
|
|
24
|
+
|
|
25
|
+
// Fallback to local if in development
|
|
26
|
+
if (!fs.existsSync(templatePath)) {
|
|
27
|
+
const localPath = path.join(resolveTemplatesDir(process.cwd()), templateName);
|
|
28
|
+
if (fs.existsSync(localPath)) {
|
|
29
|
+
return fs.readFileSync(localPath, 'utf-8');
|
|
30
|
+
}
|
|
31
|
+
throw new Error(`Template not found: ${templateName}`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return fs.readFileSync(templatePath, 'utf-8');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function readSpec(featureName) {
|
|
38
|
+
const specPath = path.join(process.cwd(), `.morph/project/outputs/${featureName}/spec.md`);
|
|
39
|
+
const shardedIndexPath = path.join(process.cwd(), `.morph/project/outputs/${featureName}/spec/index.md`);
|
|
40
|
+
|
|
41
|
+
// Try sharded spec first (BMAD pattern)
|
|
42
|
+
if (fs.existsSync(shardedIndexPath)) {
|
|
43
|
+
return { isSharded: true, indexPath: shardedIndexPath };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Fallback to monolithic spec
|
|
47
|
+
if (fs.existsSync(specPath)) {
|
|
48
|
+
return { isSharded: false, content: fs.readFileSync(specPath, 'utf-8') };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
throw new Error(`Spec not found for feature: ${featureName}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function extractContextFromSpec(specContent, sectionHeading) {
|
|
55
|
+
// Extract section content between ## heading and next ##
|
|
56
|
+
const regex = new RegExp(`## ${sectionHeading}\\s*([\\s\\S]*?)(?=\\n## |$)`, 'i');
|
|
57
|
+
const match = specContent.match(regex);
|
|
58
|
+
return match ? match[1].trim() : 'See spec.md for complete context';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function detectPatterns(tasks, specContent) {
|
|
62
|
+
const patterns = {
|
|
63
|
+
hasEntity: tasks.some(t => /entity|model|domain/i.test(t)),
|
|
64
|
+
hasService: tasks.some(t => /service|business|logic/i.test(t)),
|
|
65
|
+
hasComponent: tasks.some(t => /component|razor|blazor|ui/i.test(t)),
|
|
66
|
+
hasRepository: tasks.some(t => /repository|data|persistence/i.test(t)),
|
|
67
|
+
hasJob: tasks.some(t => /job|background|hangfire|scheduled/i.test(t)),
|
|
68
|
+
hasAI: tasks.some(t => /agent|ai|llm|semantic|rag/i.test(t)),
|
|
69
|
+
hasAzure: tasks.some(t => /bicep|azure|infra|deploy/i.test(t)),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return patterns;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function injectDevNotes(patterns, storyData) {
|
|
76
|
+
const notes = [];
|
|
77
|
+
|
|
78
|
+
// Entity pattern
|
|
79
|
+
if (patterns.hasEntity) {
|
|
80
|
+
notes.push('Use Primary Constructor (.NET 10 feature)');
|
|
81
|
+
notes.push('Follow entity pattern: .morph/project/standards/coding.md#entity-pattern');
|
|
82
|
+
notes.push('Navigation properties: configure in DbContext with Fluent API');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Service pattern
|
|
86
|
+
if (patterns.hasService) {
|
|
87
|
+
notes.push('Service layer: implement interface-first (IXService → XService)');
|
|
88
|
+
notes.push('Dependency injection: register in Program.cs as Scoped');
|
|
89
|
+
notes.push('Error handling: use Result<T> pattern from standards/architecture.md');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Blazor component
|
|
93
|
+
if (patterns.hasComponent) {
|
|
94
|
+
notes.push('UI Library: Fluent UI Blazor (see .morph/project/standards/ui.md)');
|
|
95
|
+
notes.push('Design System: use CSS variables from wwwroot/css/design-system.css');
|
|
96
|
+
notes.push('State management: @inject for services, [Parameter] for props');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Repository pattern
|
|
100
|
+
if (patterns.hasRepository) {
|
|
101
|
+
notes.push('Repository pattern: IRepository<T> generic base');
|
|
102
|
+
notes.push('EF Core: use AsNoTracking() for read-only queries');
|
|
103
|
+
notes.push('Transactions: wrap in DbContext.Database.BeginTransactionAsync()');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Background job
|
|
107
|
+
if (patterns.hasJob) {
|
|
108
|
+
notes.push('Hangfire: implement IJob interface, register in HangfireConfig.cs');
|
|
109
|
+
notes.push('Retry policy: use [AutomaticRetry(Attempts = 3)]');
|
|
110
|
+
notes.push('Logging: inject ILogger<TJob> for monitoring');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// AI/Agent
|
|
114
|
+
if (patterns.hasAI) {
|
|
115
|
+
notes.push('Microsoft Agent Framework: use AgentBuilder (not Semantic Kernel)');
|
|
116
|
+
notes.push('Prompts: store in /prompts/{agent-name}.md');
|
|
117
|
+
notes.push('Vector search: use EF Core 10 Vector Search (see standards/vector-search-rag.md)');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Azure/IaC
|
|
121
|
+
if (patterns.hasAzure) {
|
|
122
|
+
notes.push('Infrastructure as Code: ALWAYS use Bicep (never portal)');
|
|
123
|
+
notes.push('Cost validation: run morph-spec cost before commit');
|
|
124
|
+
notes.push('Deployment: Azure Container Apps (not App Service)');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Add spec reference
|
|
128
|
+
if (storyData.specShard) {
|
|
129
|
+
notes.push(`Spec reference: .morph/project/outputs/${storyData.featureName}/spec/${storyData.specShard}.md`);
|
|
130
|
+
} else {
|
|
131
|
+
notes.push(`Spec reference: .morph/project/outputs/${storyData.featureName}/spec.md`);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return notes;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function renderStory(template, data) {
|
|
138
|
+
let rendered = template;
|
|
139
|
+
|
|
140
|
+
// Simple placeholder replacement (non-Mustache for simplicity)
|
|
141
|
+
const replacements = {
|
|
142
|
+
'{{STORY_ID}}': data.storyId || 'STORY-XXX',
|
|
143
|
+
'{{STORY_TITLE}}': data.storyTitle || 'Story Title',
|
|
144
|
+
'{{FEATURE_NAME}}': data.featureName || 'feature-name',
|
|
145
|
+
'{{FEATURE_NAME_TITLE}}': data.featureNameTitle || 'Feature Name',
|
|
146
|
+
'{{EPIC_NAME}}': data.epicName || 'Epic Name',
|
|
147
|
+
'{{DATE}}': new Date().toISOString().split('T')[0],
|
|
148
|
+
'{{STORY_CONTEXT}}': data.context || 'Context not provided',
|
|
149
|
+
'{{SPEC_SHARD}}': data.specShard || 'spec',
|
|
150
|
+
'{{EFFORT}}': data.effort || '1 day',
|
|
151
|
+
'{{CODING_PATTERN}}': data.codingPattern || 'general',
|
|
152
|
+
'{{ARCH_PATTERN}}': data.archPattern || 'clean-architecture',
|
|
153
|
+
'{{STATUS}}': 'Ready',
|
|
154
|
+
'{{CREATED_DATE}}': new Date().toISOString().split('T')[0],
|
|
155
|
+
'{{ADDITIONAL_NOTES}}': data.additionalNotes || '',
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
for (const [placeholder, value] of Object.entries(replacements)) {
|
|
159
|
+
rendered = rendered.replaceAll(placeholder, value);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Handle arrays (tasks, dev notes, acceptance criteria)
|
|
163
|
+
if (data.tasks && data.tasks.length > 0) {
|
|
164
|
+
const tasksSection = data.tasks.map(t => `- [ ] ${t}`).join('\n');
|
|
165
|
+
rendered = rendered.replace(/{{#TASKS}}[\s\S]*?{{\/TASKS}}/g, tasksSection);
|
|
166
|
+
} else {
|
|
167
|
+
rendered = rendered.replace(/{{#TASKS}}[\s\S]*?{{\/TASKS}}/g, '- [ ] Task 1\n- [ ] Task 2');
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (data.devNotes && data.devNotes.length > 0) {
|
|
171
|
+
const devNotesSection = data.devNotes.map(n => `- ${n}`).join('\n');
|
|
172
|
+
rendered = rendered.replace(/{{#DEV_NOTES}}[\s\S]*?{{\/DEV_NOTES}}/g, devNotesSection);
|
|
173
|
+
} else {
|
|
174
|
+
rendered = rendered.replace(/{{#DEV_NOTES}}[\s\S]*?{{\/DEV_NOTES}}/g, '- Follow standards in .morph/project/standards/');
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (data.acceptanceCriteria && data.acceptanceCriteria.length > 0) {
|
|
178
|
+
const acSection = data.acceptanceCriteria.map(ac =>
|
|
179
|
+
`- [ ] **GIVEN** ${ac.given} **WHEN** ${ac.when} **THEN** ${ac.then}`
|
|
180
|
+
).join('\n');
|
|
181
|
+
rendered = rendered.replace(/{{#ACCEPTANCE_CRITERIA}}[\s\S]*?{{\/ACCEPTANCE_CRITERIA}}/g, acSection);
|
|
182
|
+
} else {
|
|
183
|
+
rendered = rendered.replace(/{{#ACCEPTANCE_CRITERIA}}[\s\S]*?{{\/ACCEPTANCE_CRITERIA}}/g,
|
|
184
|
+
'- [ ] **GIVEN** [condition] **WHEN** [action] **THEN** [result]');
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Clean up remaining Mustache sections (empty arrays)
|
|
188
|
+
rendered = rendered.replace(/{{#\w+}}[\s\S]*?{{\/\w+}}/g, '');
|
|
189
|
+
|
|
190
|
+
return rendered;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function toTitleCase(str) {
|
|
194
|
+
return str
|
|
195
|
+
.split('-')
|
|
196
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
197
|
+
.join(' ');
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// ============================================================================
|
|
201
|
+
// Command Function
|
|
202
|
+
// ============================================================================
|
|
203
|
+
|
|
204
|
+
export async function createStoryCommand(feature, storyId, options) {
|
|
205
|
+
logger.header('MORPH-SPEC Story Creator');
|
|
206
|
+
logger.dim(`Feature: ${feature}`);
|
|
207
|
+
logger.dim(`Story ID: ${storyId}`);
|
|
208
|
+
logger.blank();
|
|
209
|
+
|
|
210
|
+
const spinner = ora('Creating story...').start();
|
|
211
|
+
|
|
212
|
+
try {
|
|
213
|
+
// Read template
|
|
214
|
+
const template = readTemplate('story.md');
|
|
215
|
+
|
|
216
|
+
// Read spec (detect if sharded)
|
|
217
|
+
const spec = readSpec(feature);
|
|
218
|
+
|
|
219
|
+
// Build story data
|
|
220
|
+
const storyData = {
|
|
221
|
+
featureName: feature,
|
|
222
|
+
featureNameTitle: toTitleCase(feature),
|
|
223
|
+
storyId,
|
|
224
|
+
storyTitle: options.title || 'Story Title',
|
|
225
|
+
epicName: options.epic || toTitleCase(feature),
|
|
226
|
+
context: options.context || (spec.isSharded
|
|
227
|
+
? 'See sharded spec for complete context'
|
|
228
|
+
: extractContextFromSpec(spec.content, 'Overview')),
|
|
229
|
+
specShard: spec.isSharded ? 'index' : null,
|
|
230
|
+
tasks: options.tasks ? options.tasks.split(',').map(t => t.trim()) : ['Task 1', 'Task 2'],
|
|
231
|
+
effort: '1 day',
|
|
232
|
+
additionalNotes: '',
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// Detect patterns and inject Dev Notes
|
|
236
|
+
const patterns = detectPatterns(storyData.tasks, spec.content || '');
|
|
237
|
+
storyData.devNotes = injectDevNotes(patterns, storyData);
|
|
238
|
+
|
|
239
|
+
// Default acceptance criteria
|
|
240
|
+
storyData.acceptanceCriteria = [
|
|
241
|
+
{ given: '[condition]', when: '[action]', then: '[expected result]' },
|
|
242
|
+
];
|
|
243
|
+
|
|
244
|
+
// Render story
|
|
245
|
+
const renderedStory = renderStory(template, storyData);
|
|
246
|
+
|
|
247
|
+
// Output
|
|
248
|
+
const outputDir = path.join(process.cwd(), `.morph/project/outputs/${feature}/stories`);
|
|
249
|
+
const outputPath = path.join(outputDir, `${storyId}.md`);
|
|
250
|
+
|
|
251
|
+
if (options.dryRun) {
|
|
252
|
+
spinner.info('Dry run - preview only');
|
|
253
|
+
logger.blank();
|
|
254
|
+
console.log(renderedStory);
|
|
255
|
+
logger.blank();
|
|
256
|
+
logger.dim(`Would be written to: ${outputPath}`);
|
|
257
|
+
} else {
|
|
258
|
+
// Ensure directory exists
|
|
259
|
+
await ensureDir(outputDir);
|
|
260
|
+
|
|
261
|
+
// Write file
|
|
262
|
+
await writeFile(outputPath, renderedStory);
|
|
263
|
+
|
|
264
|
+
// ============================================================================
|
|
265
|
+
// Update sprint-status.yaml (create if doesn't exist)
|
|
266
|
+
// ============================================================================
|
|
267
|
+
const sprintStatusPath = path.join(process.cwd(), `.morph/project/outputs/${feature}/sprint-status.yaml`);
|
|
268
|
+
let sprintStatus;
|
|
269
|
+
|
|
270
|
+
if (fs.existsSync(sprintStatusPath)) {
|
|
271
|
+
// Load existing
|
|
272
|
+
const content = fs.readFileSync(sprintStatusPath, 'utf-8');
|
|
273
|
+
sprintStatus = yaml.parse(content);
|
|
274
|
+
} else {
|
|
275
|
+
// Create new
|
|
276
|
+
sprintStatus = {
|
|
277
|
+
feature: feature,
|
|
278
|
+
epic: options.epic || toTitleCase(feature),
|
|
279
|
+
created: new Date().toISOString().split('T')[0],
|
|
280
|
+
updated: new Date().toISOString().split('T')[0],
|
|
281
|
+
stories: [],
|
|
282
|
+
metrics: {
|
|
283
|
+
total_stories: 0,
|
|
284
|
+
ready: 0,
|
|
285
|
+
in_progress: 0,
|
|
286
|
+
ready_for_qa: 0,
|
|
287
|
+
done: 0,
|
|
288
|
+
completion_percent: 0
|
|
289
|
+
},
|
|
290
|
+
current: null,
|
|
291
|
+
next: null
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Add new story to sprint-status
|
|
296
|
+
sprintStatus.stories.push({
|
|
297
|
+
id: storyId,
|
|
298
|
+
title: storyData.storyTitle,
|
|
299
|
+
file: `stories/${storyId}.md`,
|
|
300
|
+
status: 'ready',
|
|
301
|
+
created: new Date().toISOString().split('T')[0],
|
|
302
|
+
assigned: null,
|
|
303
|
+
started: null,
|
|
304
|
+
completed: null
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
// Update metrics
|
|
308
|
+
sprintStatus.metrics.total_stories = sprintStatus.stories.length;
|
|
309
|
+
sprintStatus.metrics.ready = sprintStatus.stories.filter(s => s.status === 'ready').length;
|
|
310
|
+
sprintStatus.metrics.in_progress = sprintStatus.stories.filter(s => s.status === 'in_progress').length;
|
|
311
|
+
sprintStatus.metrics.ready_for_qa = sprintStatus.stories.filter(s => s.status === 'ready_for_qa').length;
|
|
312
|
+
sprintStatus.metrics.done = sprintStatus.stories.filter(s => s.status === 'done').length;
|
|
313
|
+
sprintStatus.metrics.completion_percent = sprintStatus.stories.length > 0
|
|
314
|
+
? Math.round((sprintStatus.metrics.done / sprintStatus.stories.length) * 100)
|
|
315
|
+
: 0;
|
|
316
|
+
sprintStatus.updated = new Date().toISOString().split('T')[0];
|
|
317
|
+
|
|
318
|
+
// Set next story if null
|
|
319
|
+
if (!sprintStatus.next) {
|
|
320
|
+
sprintStatus.next = {
|
|
321
|
+
story_id: storyId,
|
|
322
|
+
recommendation: `Story ${storyId} is ready for development`
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Write sprint-status.yaml
|
|
327
|
+
const yamlContent = yaml.stringify(sprintStatus);
|
|
328
|
+
fs.writeFileSync(sprintStatusPath, yamlContent);
|
|
329
|
+
|
|
330
|
+
spinner.succeed('Story created!');
|
|
331
|
+
logger.blank();
|
|
332
|
+
|
|
333
|
+
logger.success(`Story file: ${chalk.cyan(outputPath)}`);
|
|
334
|
+
logger.success(`Updated: ${chalk.cyan('sprint-status.yaml')}`);
|
|
335
|
+
logger.blank();
|
|
336
|
+
|
|
337
|
+
logger.header('Dev Notes Auto-Injected:');
|
|
338
|
+
storyData.devNotes.forEach(note => logger.dim(` - ${note}`));
|
|
339
|
+
logger.blank();
|
|
340
|
+
|
|
341
|
+
logger.header('Next Steps:');
|
|
342
|
+
logger.dim(' 1. Review and customize story file');
|
|
343
|
+
logger.dim(' 2. Run in fresh Claude session: /dev → implement story');
|
|
344
|
+
logger.dim(' 3. Dev adds implementation notes');
|
|
345
|
+
logger.dim(' 4. QA reviews and adds QA notes');
|
|
346
|
+
logger.blank();
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
} catch (error) {
|
|
350
|
+
spinner.fail('Failed to create story');
|
|
351
|
+
logger.error(error.message);
|
|
352
|
+
process.exit(1);
|
|
353
|
+
}
|
|
354
|
+
}
|