bmad-fh 6.0.0-alpha.23
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/.coderabbit.yaml +40 -0
- package/.githooks/post-checkout +129 -0
- package/.githooks/pre-commit +63 -0
- package/.githooks/pre-push +135 -0
- package/.github/CODE_OF_CONDUCT.md +128 -0
- package/.github/FUNDING.yaml +15 -0
- package/.github/ISSUE_TEMPLATE/config.yaml +8 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
- package/.github/ISSUE_TEMPLATE/issue.md +32 -0
- package/.github/scripts/discord-helpers.sh +34 -0
- package/.github/workflows/bundle-latest.yaml +330 -0
- package/.github/workflows/discord.yaml +90 -0
- package/.github/workflows/docs.yaml +63 -0
- package/.github/workflows/manual-release.yaml +190 -0
- package/.github/workflows/publish-multi-artifact.yaml +50 -0
- package/.github/workflows/quality.yaml +115 -0
- package/.husky/pre-commit +20 -0
- package/.markdownlint-cli2.yaml +41 -0
- package/.nvmrc +1 -0
- package/.prettierignore +9 -0
- package/.vscode/settings.json +97 -0
- package/CHANGELOG.md +1394 -0
- package/CNAME +1 -0
- package/CONTRIBUTING.md +306 -0
- package/CONTRIBUTORS.md +32 -0
- package/LICENSE +30 -0
- package/README.md +126 -0
- package/SECURITY.md +85 -0
- package/TRADEMARK.md +55 -0
- package/Wordmark.png +0 -0
- package/banner-bmad-method.png +0 -0
- package/docs/404.md +9 -0
- package/docs/_README_WORKFLOW_DIAGRAMS.md +40 -0
- package/docs/_STYLE_GUIDE.md +367 -0
- package/docs/_archive/customize-workflows.md +30 -0
- package/docs/_archive/getting-started-bmadv4.md +247 -0
- package/docs/_archive/vendor-workflows.md +52 -0
- package/docs/downloads.md +72 -0
- package/docs/explanation/agents/barry-quick-flow.md +328 -0
- package/docs/explanation/agents/index.md +19 -0
- package/docs/explanation/architecture/four-phases.md +107 -0
- package/docs/explanation/architecture/preventing-agent-conflicts.md +111 -0
- package/docs/explanation/architecture/why-solutioning-matters.md +75 -0
- package/docs/explanation/bmm/index.md +131 -0
- package/docs/explanation/core/index.md +18 -0
- package/docs/explanation/core-concepts/agent-roles.md +179 -0
- package/docs/explanation/core-concepts/index.md +35 -0
- package/docs/explanation/core-concepts/what-are-agents.md +97 -0
- package/docs/explanation/core-concepts/what-are-modules.md +85 -0
- package/docs/explanation/core-concepts/what-are-workflows.md +204 -0
- package/docs/explanation/faq/brownfield-faq.md +73 -0
- package/docs/explanation/faq/getting-started-faq.md +67 -0
- package/docs/explanation/faq/implementation-faq.md +52 -0
- package/docs/explanation/faq/index.md +16 -0
- package/docs/explanation/faq/levels-and-tracks-faq.md +52 -0
- package/docs/explanation/faq/planning-faq.md +41 -0
- package/docs/explanation/faq/tools-faq.md +277 -0
- package/docs/explanation/faq/workflows-faq.md +61 -0
- package/docs/explanation/features/advanced-elicitation.md +95 -0
- package/docs/explanation/features/brainstorming-techniques.md +92 -0
- package/docs/explanation/features/party-mode.md +95 -0
- package/docs/explanation/features/quick-flow.md +149 -0
- package/docs/explanation/features/tea-overview.md +410 -0
- package/docs/explanation/features/web-bundles.md +34 -0
- package/docs/explanation/philosophy/facilitation-over-generation.md +333 -0
- package/docs/explanation/philosophy/testing-as-engineering.md +112 -0
- package/docs/explanation/tea/engagement-models.md +710 -0
- package/docs/explanation/tea/fixture-architecture.md +457 -0
- package/docs/explanation/tea/knowledge-base-system.md +554 -0
- package/docs/explanation/tea/network-first-patterns.md +853 -0
- package/docs/explanation/tea/risk-based-testing.md +586 -0
- package/docs/explanation/tea/test-quality-standards.md +907 -0
- package/docs/how-to/brownfield/add-feature-to-existing.md +74 -0
- package/docs/how-to/brownfield/document-existing-project.md +66 -0
- package/docs/how-to/brownfield/index.md +84 -0
- package/docs/how-to/brownfield/quick-fix-in-brownfield.md +77 -0
- package/docs/how-to/brownfield/use-tea-for-enterprise.md +526 -0
- package/docs/how-to/brownfield/use-tea-with-existing-tests.md +577 -0
- package/docs/how-to/customization/customize-agents.md +212 -0
- package/docs/how-to/customization/enable-tea-mcp-enhancements.md +424 -0
- package/docs/how-to/customization/index.md +23 -0
- package/docs/how-to/customization/integrate-playwright-utils.md +813 -0
- package/docs/how-to/customization/shard-large-documents.md +101 -0
- package/docs/how-to/get-answers-about-bmad.md +102 -0
- package/docs/how-to/installation/index.md +12 -0
- package/docs/how-to/installation/install-bmad.md +111 -0
- package/docs/how-to/installation/install-custom-modules.md +118 -0
- package/docs/how-to/installation/upgrade-to-v6.md +131 -0
- package/docs/how-to/workflows/bmgd-quick-flow.md +156 -0
- package/docs/how-to/workflows/conduct-research.md +97 -0
- package/docs/how-to/workflows/create-architecture.md +119 -0
- package/docs/how-to/workflows/create-epics-and-stories.md +109 -0
- package/docs/how-to/workflows/create-prd.md +91 -0
- package/docs/how-to/workflows/create-product-brief.md +94 -0
- package/docs/how-to/workflows/create-story.md +102 -0
- package/docs/how-to/workflows/create-ux-design.md +100 -0
- package/docs/how-to/workflows/implement-story.md +97 -0
- package/docs/how-to/workflows/quick-spec.md +122 -0
- package/docs/how-to/workflows/run-atdd.md +436 -0
- package/docs/how-to/workflows/run-automate.md +653 -0
- package/docs/how-to/workflows/run-brainstorming-session.md +73 -0
- package/docs/how-to/workflows/run-code-review.md +89 -0
- package/docs/how-to/workflows/run-implementation-readiness.md +125 -0
- package/docs/how-to/workflows/run-nfr-assess.md +679 -0
- package/docs/how-to/workflows/run-sprint-planning.md +94 -0
- package/docs/how-to/workflows/run-test-design.md +98 -0
- package/docs/how-to/workflows/run-test-review.md +605 -0
- package/docs/how-to/workflows/run-trace.md +883 -0
- package/docs/how-to/workflows/setup-ci.md +712 -0
- package/docs/how-to/workflows/setup-party-mode.md +89 -0
- package/docs/how-to/workflows/setup-test-framework.md +98 -0
- package/docs/index.md +63 -0
- package/docs/migration-guide.md +365 -0
- package/docs/multi-scope-guide.md +379 -0
- package/docs/plans/multi-scope-parallel-artifacts-plan.md +695 -0
- package/docs/reference/agents/index.md +109 -0
- package/docs/reference/configuration/core-tasks.md +67 -0
- package/docs/reference/configuration/global-config.md +28 -0
- package/docs/reference/glossary/index.md +159 -0
- package/docs/reference/tea/commands.md +254 -0
- package/docs/reference/tea/configuration.md +678 -0
- package/docs/reference/tea/knowledge-base.md +340 -0
- package/docs/reference/workflows/core-workflows.md +32 -0
- package/docs/reference/workflows/document-project.md +73 -0
- package/docs/reference/workflows/index.md +12 -0
- package/docs/tutorials/getting-started/getting-started-bmadv6.md +246 -0
- package/docs/tutorials/getting-started/images/workflow-method-greenfield.excalidraw +5034 -0
- package/docs/tutorials/getting-started/images/workflow-method-greenfield.svg +4 -0
- package/docs/tutorials/getting-started/images/workflow-overview.jpg +0 -0
- package/docs/tutorials/getting-started/tea-lite-quickstart.md +444 -0
- package/docs/tutorials/getting-started/workflow-overview.jpg +0 -0
- package/eslint.config.mjs +152 -0
- package/package.json +117 -0
- package/prettier.config.mjs +32 -0
- package/src/bmm/_module-installer/installer.js +48 -0
- package/src/bmm/_module-installer/platform-specifics/claude-code.js +35 -0
- package/src/bmm/_module-installer/platform-specifics/windsurf.js +32 -0
- package/src/bmm/agents/analyst.agent.yaml +41 -0
- package/src/bmm/agents/architect.agent.yaml +33 -0
- package/src/bmm/agents/dev.agent.yaml +38 -0
- package/src/bmm/agents/pm.agent.yaml +51 -0
- package/src/bmm/agents/quick-flow-solo-dev.agent.yaml +32 -0
- package/src/bmm/agents/sm.agent.yaml +47 -0
- package/src/bmm/agents/tea.agent.yaml +68 -0
- package/src/bmm/agents/tech-writer/tech-writer-sidecar/documentation-standards.md +224 -0
- package/src/bmm/agents/tech-writer/tech-writer.agent.yaml +49 -0
- package/src/bmm/agents/ux-designer.agent.yaml +30 -0
- package/src/bmm/data/README.md +29 -0
- package/src/bmm/data/project-context-template.md +40 -0
- package/src/bmm/module.yaml +64 -0
- package/src/bmm/sub-modules/claude-code/config.yaml +4 -0
- package/src/bmm/sub-modules/claude-code/injections.yaml +242 -0
- package/src/bmm/sub-modules/claude-code/readme.md +87 -0
- package/src/bmm/teams/default-party.csv +21 -0
- package/src/bmm/teams/team-fullstack.yaml +12 -0
- package/src/bmm/testarch/knowledge/api-request.md +442 -0
- package/src/bmm/testarch/knowledge/api-testing-patterns.md +843 -0
- package/src/bmm/testarch/knowledge/auth-session.md +552 -0
- package/src/bmm/testarch/knowledge/burn-in.md +273 -0
- package/src/bmm/testarch/knowledge/ci-burn-in.md +675 -0
- package/src/bmm/testarch/knowledge/component-tdd.md +486 -0
- package/src/bmm/testarch/knowledge/contract-testing.md +957 -0
- package/src/bmm/testarch/knowledge/data-factories.md +500 -0
- package/src/bmm/testarch/knowledge/email-auth.md +721 -0
- package/src/bmm/testarch/knowledge/error-handling.md +725 -0
- package/src/bmm/testarch/knowledge/feature-flags.md +750 -0
- package/src/bmm/testarch/knowledge/file-utils.md +463 -0
- package/src/bmm/testarch/knowledge/fixture-architecture.md +401 -0
- package/src/bmm/testarch/knowledge/fixtures-composition.md +382 -0
- package/src/bmm/testarch/knowledge/intercept-network-call.md +430 -0
- package/src/bmm/testarch/knowledge/log.md +429 -0
- package/src/bmm/testarch/knowledge/network-error-monitor.md +405 -0
- package/src/bmm/testarch/knowledge/network-first.md +486 -0
- package/src/bmm/testarch/knowledge/network-recorder.md +527 -0
- package/src/bmm/testarch/knowledge/nfr-criteria.md +670 -0
- package/src/bmm/testarch/knowledge/overview.md +286 -0
- package/src/bmm/testarch/knowledge/playwright-config.md +730 -0
- package/src/bmm/testarch/knowledge/probability-impact.md +601 -0
- package/src/bmm/testarch/knowledge/recurse.md +421 -0
- package/src/bmm/testarch/knowledge/risk-governance.md +615 -0
- package/src/bmm/testarch/knowledge/selective-testing.md +732 -0
- package/src/bmm/testarch/knowledge/selector-resilience.md +527 -0
- package/src/bmm/testarch/knowledge/test-healing-patterns.md +644 -0
- package/src/bmm/testarch/knowledge/test-levels-framework.md +473 -0
- package/src/bmm/testarch/knowledge/test-priorities-matrix.md +373 -0
- package/src/bmm/testarch/knowledge/test-quality.md +664 -0
- package/src/bmm/testarch/knowledge/timing-debugging.md +372 -0
- package/src/bmm/testarch/knowledge/visual-debugging.md +524 -0
- package/src/bmm/testarch/tea-index.csv +34 -0
- package/src/bmm/workflows/1-analysis/create-product-brief/product-brief.template.md +10 -0
- package/src/bmm/workflows/1-analysis/create-product-brief/steps/step-01-init.md +177 -0
- package/src/bmm/workflows/1-analysis/create-product-brief/steps/step-01b-continue.md +161 -0
- package/src/bmm/workflows/1-analysis/create-product-brief/steps/step-02-vision.md +199 -0
- package/src/bmm/workflows/1-analysis/create-product-brief/steps/step-03-users.md +202 -0
- package/src/bmm/workflows/1-analysis/create-product-brief/steps/step-04-metrics.md +205 -0
- package/src/bmm/workflows/1-analysis/create-product-brief/steps/step-05-scope.md +219 -0
- package/src/bmm/workflows/1-analysis/create-product-brief/steps/step-06-complete.md +194 -0
- package/src/bmm/workflows/1-analysis/create-product-brief/workflow.md +58 -0
- package/src/bmm/workflows/1-analysis/research/domain-steps/step-01-init.md +137 -0
- package/src/bmm/workflows/1-analysis/research/domain-steps/step-02-domain-analysis.md +229 -0
- package/src/bmm/workflows/1-analysis/research/domain-steps/step-03-competitive-landscape.md +238 -0
- package/src/bmm/workflows/1-analysis/research/domain-steps/step-04-regulatory-focus.md +206 -0
- package/src/bmm/workflows/1-analysis/research/domain-steps/step-05-technical-trends.md +234 -0
- package/src/bmm/workflows/1-analysis/research/domain-steps/step-06-research-synthesis.md +443 -0
- package/src/bmm/workflows/1-analysis/research/market-steps/step-01-init.md +182 -0
- package/src/bmm/workflows/1-analysis/research/market-steps/step-02-customer-behavior.md +237 -0
- package/src/bmm/workflows/1-analysis/research/market-steps/step-02-customer-insights.md +200 -0
- package/src/bmm/workflows/1-analysis/research/market-steps/step-03-customer-pain-points.md +249 -0
- package/src/bmm/workflows/1-analysis/research/market-steps/step-04-customer-decisions.md +259 -0
- package/src/bmm/workflows/1-analysis/research/market-steps/step-05-competitive-analysis.md +177 -0
- package/src/bmm/workflows/1-analysis/research/market-steps/step-06-research-completion.md +475 -0
- package/src/bmm/workflows/1-analysis/research/research.template.md +29 -0
- package/src/bmm/workflows/1-analysis/research/technical-steps/step-01-init.md +137 -0
- package/src/bmm/workflows/1-analysis/research/technical-steps/step-02-technical-overview.md +239 -0
- package/src/bmm/workflows/1-analysis/research/technical-steps/step-03-integration-patterns.md +248 -0
- package/src/bmm/workflows/1-analysis/research/technical-steps/step-04-architectural-patterns.md +202 -0
- package/src/bmm/workflows/1-analysis/research/technical-steps/step-05-implementation-research.md +239 -0
- package/src/bmm/workflows/1-analysis/research/technical-steps/step-06-research-synthesis.md +486 -0
- package/src/bmm/workflows/1-analysis/research/workflow.md +173 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-01-init.md +135 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-01b-continue.md +127 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-02-discovery.md +190 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-03-core-experience.md +216 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-04-emotional-response.md +219 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-05-inspiration.md +234 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-06-design-system.md +252 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-07-defining-experience.md +254 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-08-visual-foundation.md +224 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-09-design-directions.md +224 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-10-user-journeys.md +241 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-11-component-strategy.md +248 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-12-ux-patterns.md +237 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-13-responsive-accessibility.md +264 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-14-complete.md +228 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/ux-design-template.md +13 -0
- package/src/bmm/workflows/2-plan-workflows/create-ux-design/workflow.md +43 -0
- package/src/bmm/workflows/2-plan-workflows/prd/data/domain-complexity.csv +13 -0
- package/src/bmm/workflows/2-plan-workflows/prd/data/prd-purpose.md +197 -0
- package/src/bmm/workflows/2-plan-workflows/prd/data/project-types.csv +11 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-c/step-01-init.md +191 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-c/step-01b-continue.md +153 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-c/step-02-discovery.md +224 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-c/step-03-success.md +226 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-c/step-04-journeys.md +213 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-c/step-05-domain.md +207 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-c/step-06-innovation.md +226 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-c/step-07-project-type.md +237 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-c/step-08-scoping.md +228 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-c/step-09-functional.md +231 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-c/step-10-nonfunctional.md +242 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-c/step-11-polish.md +217 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-c/step-12-complete.md +180 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-e/step-e-01-discovery.md +247 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-e/step-e-01b-legacy-conversion.md +208 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-e/step-e-02-review.md +249 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-e/step-e-03-edit.md +253 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-e/step-e-04-complete.md +168 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-v/step-v-01-discovery.md +218 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-v/step-v-02-format-detection.md +191 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-v/step-v-02b-parity-check.md +209 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-v/step-v-03-density-validation.md +174 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-v/step-v-04-brief-coverage-validation.md +214 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-v/step-v-05-measurability-validation.md +228 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-v/step-v-06-traceability-validation.md +217 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-v/step-v-07-implementation-leakage-validation.md +205 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-v/step-v-08-domain-compliance-validation.md +243 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-v/step-v-09-project-type-validation.md +263 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-v/step-v-10-smart-validation.md +209 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-v/step-v-11-holistic-quality-validation.md +264 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-v/step-v-12-completeness-validation.md +242 -0
- package/src/bmm/workflows/2-plan-workflows/prd/steps-v/step-v-13-report-complete.md +232 -0
- package/src/bmm/workflows/2-plan-workflows/prd/templates/prd-template.md +10 -0
- package/src/bmm/workflows/2-plan-workflows/prd/validation-report-prd-workflow.md +433 -0
- package/src/bmm/workflows/2-plan-workflows/prd/workflow.md +150 -0
- package/src/bmm/workflows/3-solutioning/check-implementation-readiness/steps/step-01-document-discovery.md +190 -0
- package/src/bmm/workflows/3-solutioning/check-implementation-readiness/steps/step-02-prd-analysis.md +178 -0
- package/src/bmm/workflows/3-solutioning/check-implementation-readiness/steps/step-03-epic-coverage-validation.md +179 -0
- package/src/bmm/workflows/3-solutioning/check-implementation-readiness/steps/step-04-ux-alignment.md +139 -0
- package/src/bmm/workflows/3-solutioning/check-implementation-readiness/steps/step-05-epic-quality-review.md +252 -0
- package/src/bmm/workflows/3-solutioning/check-implementation-readiness/steps/step-06-final-assessment.md +133 -0
- package/src/bmm/workflows/3-solutioning/check-implementation-readiness/templates/readiness-report-template.md +4 -0
- package/src/bmm/workflows/3-solutioning/check-implementation-readiness/workflow.md +55 -0
- package/src/bmm/workflows/3-solutioning/create-architecture/architecture-decision-template.md +12 -0
- package/src/bmm/workflows/3-solutioning/create-architecture/data/domain-complexity.csv +11 -0
- package/src/bmm/workflows/3-solutioning/create-architecture/data/project-types.csv +7 -0
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-01-init.md +153 -0
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-01b-continue.md +164 -0
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-02-context.md +224 -0
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-03-starter.md +331 -0
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-04-decisions.md +318 -0
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-05-patterns.md +359 -0
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-06-structure.md +379 -0
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-07-validation.md +359 -0
- package/src/bmm/workflows/3-solutioning/create-architecture/steps/step-08-complete.md +352 -0
- package/src/bmm/workflows/3-solutioning/create-architecture/workflow.md +50 -0
- package/src/bmm/workflows/3-solutioning/create-epics-and-stories/steps/step-01-validate-prerequisites.md +259 -0
- package/src/bmm/workflows/3-solutioning/create-epics-and-stories/steps/step-02-design-epics.md +233 -0
- package/src/bmm/workflows/3-solutioning/create-epics-and-stories/steps/step-03-create-stories.md +272 -0
- package/src/bmm/workflows/3-solutioning/create-epics-and-stories/steps/step-04-final-validation.md +145 -0
- package/src/bmm/workflows/3-solutioning/create-epics-and-stories/templates/epics-template.md +57 -0
- package/src/bmm/workflows/3-solutioning/create-epics-and-stories/workflow.md +59 -0
- package/src/bmm/workflows/4-implementation/code-review/checklist.md +23 -0
- package/src/bmm/workflows/4-implementation/code-review/instructions.xml +227 -0
- package/src/bmm/workflows/4-implementation/code-review/workflow.yaml +51 -0
- package/src/bmm/workflows/4-implementation/correct-course/checklist.md +288 -0
- package/src/bmm/workflows/4-implementation/correct-course/instructions.md +206 -0
- package/src/bmm/workflows/4-implementation/correct-course/workflow.yaml +60 -0
- package/src/bmm/workflows/4-implementation/create-story/checklist.md +358 -0
- package/src/bmm/workflows/4-implementation/create-story/instructions.xml +345 -0
- package/src/bmm/workflows/4-implementation/create-story/template.md +49 -0
- package/src/bmm/workflows/4-implementation/create-story/workflow.yaml +61 -0
- package/src/bmm/workflows/4-implementation/dev-story/checklist.md +80 -0
- package/src/bmm/workflows/4-implementation/dev-story/instructions.xml +410 -0
- package/src/bmm/workflows/4-implementation/dev-story/workflow.yaml +27 -0
- package/src/bmm/workflows/4-implementation/retrospective/instructions.md +1443 -0
- package/src/bmm/workflows/4-implementation/retrospective/workflow.yaml +58 -0
- package/src/bmm/workflows/4-implementation/sprint-planning/checklist.md +33 -0
- package/src/bmm/workflows/4-implementation/sprint-planning/instructions.md +225 -0
- package/src/bmm/workflows/4-implementation/sprint-planning/sprint-status-template.yaml +55 -0
- package/src/bmm/workflows/4-implementation/sprint-planning/workflow.yaml +54 -0
- package/src/bmm/workflows/4-implementation/sprint-status/instructions.md +229 -0
- package/src/bmm/workflows/4-implementation/sprint-status/workflow.yaml +36 -0
- package/src/bmm/workflows/bmad-quick-flow/quick-dev/steps/step-01-mode-detection.md +156 -0
- package/src/bmm/workflows/bmad-quick-flow/quick-dev/steps/step-02-context-gathering.md +120 -0
- package/src/bmm/workflows/bmad-quick-flow/quick-dev/steps/step-03-execute.md +113 -0
- package/src/bmm/workflows/bmad-quick-flow/quick-dev/steps/step-04-self-check.md +113 -0
- package/src/bmm/workflows/bmad-quick-flow/quick-dev/steps/step-05-adversarial-review.md +106 -0
- package/src/bmm/workflows/bmad-quick-flow/quick-dev/steps/step-06-resolve-findings.md +140 -0
- package/src/bmm/workflows/bmad-quick-flow/quick-dev/workflow.md +52 -0
- package/src/bmm/workflows/bmad-quick-flow/quick-spec/steps/step-01-understand.md +189 -0
- package/src/bmm/workflows/bmad-quick-flow/quick-spec/steps/step-02-investigate.md +144 -0
- package/src/bmm/workflows/bmad-quick-flow/quick-spec/steps/step-03-generate.md +128 -0
- package/src/bmm/workflows/bmad-quick-flow/quick-spec/steps/step-04-review.md +191 -0
- package/src/bmm/workflows/bmad-quick-flow/quick-spec/tech-spec-template.md +74 -0
- package/src/bmm/workflows/bmad-quick-flow/quick-spec/workflow.md +79 -0
- package/src/bmm/workflows/document-project/checklist.md +245 -0
- package/src/bmm/workflows/document-project/documentation-requirements.csv +12 -0
- package/src/bmm/workflows/document-project/instructions.md +221 -0
- package/src/bmm/workflows/document-project/templates/deep-dive-template.md +345 -0
- package/src/bmm/workflows/document-project/templates/index-template.md +169 -0
- package/src/bmm/workflows/document-project/templates/project-overview-template.md +103 -0
- package/src/bmm/workflows/document-project/templates/project-scan-report-schema.json +160 -0
- package/src/bmm/workflows/document-project/templates/source-tree-template.md +135 -0
- package/src/bmm/workflows/document-project/workflow.yaml +30 -0
- package/src/bmm/workflows/document-project/workflows/deep-dive-instructions.md +298 -0
- package/src/bmm/workflows/document-project/workflows/deep-dive.yaml +31 -0
- package/src/bmm/workflows/document-project/workflows/full-scan-instructions.md +1106 -0
- package/src/bmm/workflows/document-project/workflows/full-scan.yaml +31 -0
- package/src/bmm/workflows/excalidraw-diagrams/_shared/excalidraw-library.json +90 -0
- package/src/bmm/workflows/excalidraw-diagrams/_shared/excalidraw-templates.yaml +127 -0
- package/src/bmm/workflows/excalidraw-diagrams/create-dataflow/checklist.md +39 -0
- package/src/bmm/workflows/excalidraw-diagrams/create-dataflow/instructions.md +130 -0
- package/src/bmm/workflows/excalidraw-diagrams/create-dataflow/workflow.yaml +27 -0
- package/src/bmm/workflows/excalidraw-diagrams/create-diagram/checklist.md +43 -0
- package/src/bmm/workflows/excalidraw-diagrams/create-diagram/instructions.md +141 -0
- package/src/bmm/workflows/excalidraw-diagrams/create-diagram/workflow.yaml +27 -0
- package/src/bmm/workflows/excalidraw-diagrams/create-flowchart/checklist.md +49 -0
- package/src/bmm/workflows/excalidraw-diagrams/create-flowchart/instructions.md +241 -0
- package/src/bmm/workflows/excalidraw-diagrams/create-flowchart/workflow.yaml +27 -0
- package/src/bmm/workflows/excalidraw-diagrams/create-wireframe/checklist.md +38 -0
- package/src/bmm/workflows/excalidraw-diagrams/create-wireframe/instructions.md +133 -0
- package/src/bmm/workflows/excalidraw-diagrams/create-wireframe/workflow.yaml +27 -0
- package/src/bmm/workflows/generate-project-context/project-context-template.md +21 -0
- package/src/bmm/workflows/generate-project-context/steps/step-01-discover.md +184 -0
- package/src/bmm/workflows/generate-project-context/steps/step-02-generate.md +318 -0
- package/src/bmm/workflows/generate-project-context/steps/step-03-complete.md +278 -0
- package/src/bmm/workflows/generate-project-context/workflow.md +49 -0
- package/src/bmm/workflows/testarch/atdd/atdd-checklist-template.md +364 -0
- package/src/bmm/workflows/testarch/atdd/checklist.md +374 -0
- package/src/bmm/workflows/testarch/atdd/instructions.md +806 -0
- package/src/bmm/workflows/testarch/atdd/workflow.yaml +47 -0
- package/src/bmm/workflows/testarch/automate/checklist.md +582 -0
- package/src/bmm/workflows/testarch/automate/instructions.md +1324 -0
- package/src/bmm/workflows/testarch/automate/workflow.yaml +54 -0
- package/src/bmm/workflows/testarch/ci/checklist.md +248 -0
- package/src/bmm/workflows/testarch/ci/github-actions-template.yaml +198 -0
- package/src/bmm/workflows/testarch/ci/gitlab-ci-template.yaml +149 -0
- package/src/bmm/workflows/testarch/ci/instructions.md +536 -0
- package/src/bmm/workflows/testarch/ci/workflow.yaml +47 -0
- package/src/bmm/workflows/testarch/framework/checklist.md +321 -0
- package/src/bmm/workflows/testarch/framework/instructions.md +481 -0
- package/src/bmm/workflows/testarch/framework/workflow.yaml +49 -0
- package/src/bmm/workflows/testarch/nfr-assess/checklist.md +407 -0
- package/src/bmm/workflows/testarch/nfr-assess/instructions.md +722 -0
- package/src/bmm/workflows/testarch/nfr-assess/nfr-report-template.md +445 -0
- package/src/bmm/workflows/testarch/nfr-assess/workflow.yaml +49 -0
- package/src/bmm/workflows/testarch/test-design/checklist.md +235 -0
- package/src/bmm/workflows/testarch/test-design/instructions.md +788 -0
- package/src/bmm/workflows/testarch/test-design/test-design-template.md +294 -0
- package/src/bmm/workflows/testarch/test-design/workflow.yaml +56 -0
- package/src/bmm/workflows/testarch/test-review/checklist.md +472 -0
- package/src/bmm/workflows/testarch/test-review/instructions.md +628 -0
- package/src/bmm/workflows/testarch/test-review/test-review-template.md +390 -0
- package/src/bmm/workflows/testarch/test-review/workflow.yaml +48 -0
- package/src/bmm/workflows/testarch/trace/checklist.md +655 -0
- package/src/bmm/workflows/testarch/trace/instructions.md +1047 -0
- package/src/bmm/workflows/testarch/trace/trace-template.md +675 -0
- package/src/bmm/workflows/testarch/trace/workflow.yaml +57 -0
- package/src/bmm/workflows/workflow-status/init/instructions.md +346 -0
- package/src/bmm/workflows/workflow-status/init/workflow.yaml +30 -0
- package/src/bmm/workflows/workflow-status/instructions.md +397 -0
- package/src/bmm/workflows/workflow-status/paths/enterprise-brownfield.yaml +103 -0
- package/src/bmm/workflows/workflow-status/paths/enterprise-greenfield.yaml +100 -0
- package/src/bmm/workflows/workflow-status/paths/method-brownfield.yaml +103 -0
- package/src/bmm/workflows/workflow-status/paths/method-greenfield.yaml +100 -0
- package/src/bmm/workflows/workflow-status/project-levels.yaml +59 -0
- package/src/bmm/workflows/workflow-status/workflow-status-template.yaml +24 -0
- package/src/bmm/workflows/workflow-status/workflow.yaml +32 -0
- package/src/core/_module-installer/installer.js +60 -0
- package/src/core/agents/bmad-master.agent.yaml +30 -0
- package/src/core/lib/scope/artifact-resolver.js +298 -0
- package/src/core/lib/scope/event-logger.js +411 -0
- package/src/core/lib/scope/index.js +30 -0
- package/src/core/lib/scope/scope-context.js +307 -0
- package/src/core/lib/scope/scope-initializer.js +458 -0
- package/src/core/lib/scope/scope-manager.js +512 -0
- package/src/core/lib/scope/scope-migrator.js +442 -0
- package/src/core/lib/scope/scope-sync.js +489 -0
- package/src/core/lib/scope/scope-validator.js +299 -0
- package/src/core/lib/scope/state-lock.js +342 -0
- package/src/core/module.yaml +53 -0
- package/src/core/resources/excalidraw/README.md +160 -0
- package/src/core/resources/excalidraw/excalidraw-helpers.md +127 -0
- package/src/core/resources/excalidraw/library-loader.md +50 -0
- package/src/core/resources/excalidraw/validate-json-instructions.md +79 -0
- package/src/core/tasks/editorial-review-prose.xml +91 -0
- package/src/core/tasks/editorial-review-structure.xml +198 -0
- package/src/core/tasks/index-docs.xml +65 -0
- package/src/core/tasks/review-adversarial-general.xml +46 -0
- package/src/core/tasks/shard-doc.xml +109 -0
- package/src/core/tasks/workflow.xml +277 -0
- package/src/core/workflows/advanced-elicitation/methods.csv +51 -0
- package/src/core/workflows/advanced-elicitation/workflow.xml +117 -0
- package/src/core/workflows/brainstorming/brain-methods.csv +62 -0
- package/src/core/workflows/brainstorming/steps/step-01-session-setup.md +197 -0
- package/src/core/workflows/brainstorming/steps/step-01b-continue.md +122 -0
- package/src/core/workflows/brainstorming/steps/step-02a-user-selected.md +225 -0
- package/src/core/workflows/brainstorming/steps/step-02b-ai-recommended.md +237 -0
- package/src/core/workflows/brainstorming/steps/step-02c-random-selection.md +209 -0
- package/src/core/workflows/brainstorming/steps/step-02d-progressive-flow.md +264 -0
- package/src/core/workflows/brainstorming/steps/step-03-technique-execution.md +399 -0
- package/src/core/workflows/brainstorming/steps/step-04-idea-organization.md +303 -0
- package/src/core/workflows/brainstorming/template.md +15 -0
- package/src/core/workflows/brainstorming/workflow.md +58 -0
- package/src/core/workflows/party-mode/steps/step-01-agent-loading.md +138 -0
- package/src/core/workflows/party-mode/steps/step-02-discussion-orchestration.md +187 -0
- package/src/core/workflows/party-mode/steps/step-03-graceful-exit.md +157 -0
- package/src/core/workflows/party-mode/workflow.md +194 -0
- package/src/utility/agent-components/activation-rules.txt +6 -0
- package/src/utility/agent-components/activation-steps.txt +28 -0
- package/src/utility/agent-components/agent-command-header.md +1 -0
- package/src/utility/agent-components/agent.customize.template.yaml +41 -0
- package/src/utility/agent-components/handler-action.txt +4 -0
- package/src/utility/agent-components/handler-data.txt +5 -0
- package/src/utility/agent-components/handler-exec.txt +19 -0
- package/src/utility/agent-components/handler-multi.txt +14 -0
- package/src/utility/agent-components/handler-tmpl.txt +5 -0
- package/src/utility/agent-components/handler-validate-workflow.txt +7 -0
- package/src/utility/agent-components/handler-workflow.txt +10 -0
- package/src/utility/agent-components/menu-handlers.txt +6 -0
- package/test/README.md +295 -0
- package/test/fixtures/agent-schema/invalid/critical-actions/actions-as-string.agent.yaml +27 -0
- package/test/fixtures/agent-schema/invalid/critical-actions/empty-string-in-actions.agent.yaml +30 -0
- package/test/fixtures/agent-schema/invalid/menu/empty-menu.agent.yaml +22 -0
- package/test/fixtures/agent-schema/invalid/menu/missing-menu.agent.yaml +20 -0
- package/test/fixtures/agent-schema/invalid/menu-commands/empty-command-target.agent.yaml +25 -0
- package/test/fixtures/agent-schema/invalid/menu-commands/no-command-target.agent.yaml +24 -0
- package/test/fixtures/agent-schema/invalid/menu-triggers/camel-case.agent.yaml +25 -0
- package/test/fixtures/agent-schema/invalid/menu-triggers/compound-invalid-format.agent.yaml +25 -0
- package/test/fixtures/agent-schema/invalid/menu-triggers/compound-mismatched-kebab.agent.yaml +25 -0
- package/test/fixtures/agent-schema/invalid/menu-triggers/duplicate-triggers.agent.yaml +31 -0
- package/test/fixtures/agent-schema/invalid/menu-triggers/empty-trigger.agent.yaml +25 -0
- package/test/fixtures/agent-schema/invalid/menu-triggers/leading-asterisk.agent.yaml +25 -0
- package/test/fixtures/agent-schema/invalid/menu-triggers/snake-case.agent.yaml +25 -0
- package/test/fixtures/agent-schema/invalid/menu-triggers/trigger-with-spaces.agent.yaml +25 -0
- package/test/fixtures/agent-schema/invalid/metadata/empty-module-string.agent.yaml +26 -0
- package/test/fixtures/agent-schema/invalid/metadata/empty-name.agent.yaml +24 -0
- package/test/fixtures/agent-schema/invalid/metadata/extra-metadata-fields.agent.yaml +27 -0
- package/test/fixtures/agent-schema/invalid/metadata/missing-id.agent.yaml +23 -0
- package/test/fixtures/agent-schema/invalid/persona/empty-principles-array.agent.yaml +24 -0
- package/test/fixtures/agent-schema/invalid/persona/empty-string-in-principles.agent.yaml +27 -0
- package/test/fixtures/agent-schema/invalid/persona/extra-persona-fields.agent.yaml +27 -0
- package/test/fixtures/agent-schema/invalid/persona/missing-role.agent.yaml +24 -0
- package/test/fixtures/agent-schema/invalid/prompts/empty-content.agent.yaml +29 -0
- package/test/fixtures/agent-schema/invalid/prompts/extra-prompt-fields.agent.yaml +31 -0
- package/test/fixtures/agent-schema/invalid/prompts/missing-content.agent.yaml +28 -0
- package/test/fixtures/agent-schema/invalid/prompts/missing-id.agent.yaml +28 -0
- package/test/fixtures/agent-schema/invalid/top-level/empty-file.agent.yaml +5 -0
- package/test/fixtures/agent-schema/invalid/top-level/extra-top-level-keys.agent.yaml +28 -0
- package/test/fixtures/agent-schema/invalid/top-level/missing-agent-key.agent.yaml +11 -0
- package/test/fixtures/agent-schema/invalid/yaml-errors/invalid-indentation.agent.yaml +19 -0
- package/test/fixtures/agent-schema/invalid/yaml-errors/malformed-yaml.agent.yaml +18 -0
- package/test/fixtures/agent-schema/valid/critical-actions/empty-critical-actions.agent.yaml +24 -0
- package/test/fixtures/agent-schema/valid/critical-actions/no-critical-actions.agent.yaml +22 -0
- package/test/fixtures/agent-schema/valid/critical-actions/valid-critical-actions.agent.yaml +27 -0
- package/test/fixtures/agent-schema/valid/menu/multiple-menu-items.agent.yaml +31 -0
- package/test/fixtures/agent-schema/valid/menu/single-menu-item.agent.yaml +22 -0
- package/test/fixtures/agent-schema/valid/menu-commands/all-command-types.agent.yaml +38 -0
- package/test/fixtures/agent-schema/valid/menu-commands/multiple-commands.agent.yaml +24 -0
- package/test/fixtures/agent-schema/valid/menu-triggers/compound-triggers.agent.yaml +31 -0
- package/test/fixtures/agent-schema/valid/menu-triggers/kebab-case-triggers.agent.yaml +34 -0
- package/test/fixtures/agent-schema/valid/metadata/core-agent-with-module.agent.yaml +24 -0
- package/test/fixtures/agent-schema/valid/metadata/empty-module-name-in-path.agent.yaml +24 -0
- package/test/fixtures/agent-schema/valid/metadata/malformed-path-treated-as-core.agent.yaml +24 -0
- package/test/fixtures/agent-schema/valid/metadata/module-agent-correct.agent.yaml +24 -0
- package/test/fixtures/agent-schema/valid/metadata/module-agent-missing-module.agent.yaml +23 -0
- package/test/fixtures/agent-schema/valid/metadata/wrong-module-value.agent.yaml +24 -0
- package/test/fixtures/agent-schema/valid/persona/complete-persona.agent.yaml +24 -0
- package/test/fixtures/agent-schema/valid/prompts/empty-prompts.agent.yaml +24 -0
- package/test/fixtures/agent-schema/valid/prompts/no-prompts.agent.yaml +22 -0
- package/test/fixtures/agent-schema/valid/prompts/valid-prompts-minimal.agent.yaml +28 -0
- package/test/fixtures/agent-schema/valid/prompts/valid-prompts-with-description.agent.yaml +30 -0
- package/test/fixtures/agent-schema/valid/top-level/minimal-core-agent.agent.yaml +24 -0
- package/test/test-agent-schema.js +387 -0
- package/test/test-cli-integration.sh +159 -0
- package/test/test-installation-components.js +214 -0
- package/test/test-scope-e2e.js +450 -0
- package/test/test-scope-system.js +787 -0
- package/test/unit-test-schema.js +133 -0
- package/tools/bmad-npx-wrapper.js +38 -0
- package/tools/build-docs.js +577 -0
- package/tools/cli/README.md +7 -0
- package/tools/cli/bmad-cli.js +58 -0
- package/tools/cli/commands/install.js +87 -0
- package/tools/cli/commands/scope.js +474 -0
- package/tools/cli/external-official-modules.yaml +41 -0
- package/tools/cli/installers/install-messages.yaml +58 -0
- package/tools/cli/installers/lib/core/config-collector.js +1079 -0
- package/tools/cli/installers/lib/core/custom-module-cache.js +259 -0
- package/tools/cli/installers/lib/core/dependency-resolver.js +739 -0
- package/tools/cli/installers/lib/core/detector.js +223 -0
- package/tools/cli/installers/lib/core/ide-config-manager.js +156 -0
- package/tools/cli/installers/lib/core/installer.js +2585 -0
- package/tools/cli/installers/lib/core/manifest-generator.js +963 -0
- package/tools/cli/installers/lib/core/manifest.js +590 -0
- package/tools/cli/installers/lib/custom/handler.js +363 -0
- package/tools/cli/installers/lib/ide/_base-ide.js +654 -0
- package/tools/cli/installers/lib/ide/antigravity.js +486 -0
- package/tools/cli/installers/lib/ide/auggie.js +244 -0
- package/tools/cli/installers/lib/ide/claude-code.js +487 -0
- package/tools/cli/installers/lib/ide/cline.js +269 -0
- package/tools/cli/installers/lib/ide/codex.js +375 -0
- package/tools/cli/installers/lib/ide/crush.js +300 -0
- package/tools/cli/installers/lib/ide/cursor.js +169 -0
- package/tools/cli/installers/lib/ide/gemini.js +301 -0
- package/tools/cli/installers/lib/ide/github-copilot.js +383 -0
- package/tools/cli/installers/lib/ide/iflow.js +191 -0
- package/tools/cli/installers/lib/ide/kilo.js +250 -0
- package/tools/cli/installers/lib/ide/kiro-cli.js +326 -0
- package/tools/cli/installers/lib/ide/manager.js +244 -0
- package/tools/cli/installers/lib/ide/opencode.js +257 -0
- package/tools/cli/installers/lib/ide/qwen.js +372 -0
- package/tools/cli/installers/lib/ide/roo.js +270 -0
- package/tools/cli/installers/lib/ide/rovo-dev.js +290 -0
- package/tools/cli/installers/lib/ide/shared/agent-command-generator.js +96 -0
- package/tools/cli/installers/lib/ide/shared/bmad-artifacts.js +158 -0
- package/tools/cli/installers/lib/ide/shared/module-injections.js +136 -0
- package/tools/cli/installers/lib/ide/shared/task-tool-command-generator.js +119 -0
- package/tools/cli/installers/lib/ide/shared/workflow-command-generator.js +242 -0
- package/tools/cli/installers/lib/ide/templates/agent-command-template.md +29 -0
- package/tools/cli/installers/lib/ide/templates/gemini-agent-command.toml +14 -0
- package/tools/cli/installers/lib/ide/templates/gemini-task-command.toml +12 -0
- package/tools/cli/installers/lib/ide/templates/workflow-command-template.md +30 -0
- package/tools/cli/installers/lib/ide/templates/workflow-commander.md +45 -0
- package/tools/cli/installers/lib/ide/trae.js +313 -0
- package/tools/cli/installers/lib/ide/windsurf.js +258 -0
- package/tools/cli/installers/lib/message-loader.js +85 -0
- package/tools/cli/installers/lib/modules/external-manager.js +133 -0
- package/tools/cli/installers/lib/modules/manager.js +1362 -0
- package/tools/cli/lib/activation-builder.js +163 -0
- package/tools/cli/lib/agent/compiler.js +522 -0
- package/tools/cli/lib/agent/installer.js +716 -0
- package/tools/cli/lib/agent/template-engine.js +152 -0
- package/tools/cli/lib/agent-analyzer.js +109 -0
- package/tools/cli/lib/agent-party-generator.js +194 -0
- package/tools/cli/lib/cli-utils.js +227 -0
- package/tools/cli/lib/config.js +213 -0
- package/tools/cli/lib/file-ops.js +204 -0
- package/tools/cli/lib/platform-codes.js +116 -0
- package/tools/cli/lib/project-root.js +77 -0
- package/tools/cli/lib/prompts.js +433 -0
- package/tools/cli/lib/ui.js +1591 -0
- package/tools/cli/lib/xml-handler.js +177 -0
- package/tools/cli/lib/xml-to-markdown.js +82 -0
- package/tools/cli/lib/yaml-format.js +245 -0
- package/tools/cli/lib/yaml-xml-builder.js +587 -0
- package/tools/cli/scripts/migrate-workflows.js +281 -0
- package/tools/docs/BUNDLE_DISTRIBUTION_SETUP.md +95 -0
- package/tools/docs/index.md +2 -0
- package/tools/fix-doc-links.js +288 -0
- package/tools/flattener/aggregate.js +76 -0
- package/tools/flattener/binary.js +80 -0
- package/tools/flattener/discovery.js +71 -0
- package/tools/flattener/files.js +35 -0
- package/tools/flattener/ignoreRules.js +172 -0
- package/tools/flattener/main.js +483 -0
- package/tools/flattener/projectRoot.js +201 -0
- package/tools/flattener/prompts.js +44 -0
- package/tools/flattener/stats.helpers.js +368 -0
- package/tools/flattener/stats.js +75 -0
- package/tools/flattener/test-matrix.js +409 -0
- package/tools/flattener/xml.js +82 -0
- package/tools/format-workflow-md.js +263 -0
- package/tools/lib/xml-utils.js +13 -0
- package/tools/maintainer/review-pr-README.md +55 -0
- package/tools/maintainer/review-pr.md +242 -0
- package/tools/migrate-custom-module-paths.js +124 -0
- package/tools/platform-codes.yaml +157 -0
- package/tools/schema/agent.js +493 -0
- package/tools/validate-agent-schema.js +110 -0
- package/tools/validate-doc-links.js +363 -0
- package/tools/validate-svg-changes.sh +356 -0
- package/website/README.md +76 -0
- package/website/astro.config.mjs +228 -0
- package/website/public/favicon.ico +0 -0
- package/website/public/img/bmad-dark.png +0 -0
- package/website/public/img/bmad-light.png +0 -0
- package/website/public/img/logo.svg +4 -0
- package/website/public/robots.txt +37 -0
- package/website/src/components/Banner.astro +59 -0
- package/website/src/components/Header.astro +121 -0
- package/website/src/components/MobileMenuFooter.astro +53 -0
- package/website/src/content/config.ts +6 -0
- package/website/src/lib/site-url.js +25 -0
- package/website/src/rehype-markdown-links.js +102 -0
- package/website/src/styles/custom.css +485 -0
|
@@ -0,0 +1,2585 @@
|
|
|
1
|
+
const path = require('node:path');
|
|
2
|
+
const fs = require('fs-extra');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const ora = require('ora');
|
|
5
|
+
const { Detector } = require('./detector');
|
|
6
|
+
const { Manifest } = require('./manifest');
|
|
7
|
+
const { ModuleManager } = require('../modules/manager');
|
|
8
|
+
const { IdeManager } = require('../ide/manager');
|
|
9
|
+
const { FileOps } = require('../../../lib/file-ops');
|
|
10
|
+
const { Config } = require('../../../lib/config');
|
|
11
|
+
const { XmlHandler } = require('../../../lib/xml-handler');
|
|
12
|
+
const { DependencyResolver } = require('./dependency-resolver');
|
|
13
|
+
const { ConfigCollector } = require('./config-collector');
|
|
14
|
+
const { getProjectRoot, getSourcePath, getModulePath } = require('../../../lib/project-root');
|
|
15
|
+
const { CLIUtils } = require('../../../lib/cli-utils');
|
|
16
|
+
const { ManifestGenerator } = require('./manifest-generator');
|
|
17
|
+
const { IdeConfigManager } = require('./ide-config-manager');
|
|
18
|
+
const { CustomHandler } = require('../custom/handler');
|
|
19
|
+
const prompts = require('../../../lib/prompts');
|
|
20
|
+
|
|
21
|
+
// BMAD installation folder name - this is constant and should never change
|
|
22
|
+
const BMAD_FOLDER_NAME = '_bmad';
|
|
23
|
+
|
|
24
|
+
class Installer {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.detector = new Detector();
|
|
27
|
+
this.manifest = new Manifest();
|
|
28
|
+
this.moduleManager = new ModuleManager();
|
|
29
|
+
this.ideManager = new IdeManager();
|
|
30
|
+
this.fileOps = new FileOps();
|
|
31
|
+
this.config = new Config();
|
|
32
|
+
this.xmlHandler = new XmlHandler();
|
|
33
|
+
this.dependencyResolver = new DependencyResolver();
|
|
34
|
+
this.configCollector = new ConfigCollector();
|
|
35
|
+
this.ideConfigManager = new IdeConfigManager();
|
|
36
|
+
this.installedFiles = new Set(); // Track all installed files
|
|
37
|
+
this.bmadFolderName = BMAD_FOLDER_NAME;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Find the bmad installation directory in a project
|
|
42
|
+
* Always uses the standard _bmad folder name
|
|
43
|
+
* Also checks for legacy _cfg folder for migration
|
|
44
|
+
* @param {string} projectDir - Project directory
|
|
45
|
+
* @returns {Promise<Object>} { bmadDir: string, hasLegacyCfg: boolean }
|
|
46
|
+
*/
|
|
47
|
+
async findBmadDir(projectDir) {
|
|
48
|
+
const bmadDir = path.join(projectDir, BMAD_FOLDER_NAME);
|
|
49
|
+
|
|
50
|
+
// Check if project directory exists
|
|
51
|
+
if (!(await fs.pathExists(projectDir))) {
|
|
52
|
+
// Project doesn't exist yet, return default
|
|
53
|
+
return { bmadDir, hasLegacyCfg: false };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Check for legacy _cfg folder if bmad directory exists
|
|
57
|
+
let hasLegacyCfg = false;
|
|
58
|
+
if (await fs.pathExists(bmadDir)) {
|
|
59
|
+
const legacyCfgPath = path.join(bmadDir, '_cfg');
|
|
60
|
+
if (await fs.pathExists(legacyCfgPath)) {
|
|
61
|
+
hasLegacyCfg = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return { bmadDir, hasLegacyCfg };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @function copyFileWithPlaceholderReplacement
|
|
70
|
+
* @intent Copy files from BMAD source to installation directory with dynamic content transformation
|
|
71
|
+
* @why Enables installation-time customization: _bmad replacement
|
|
72
|
+
* @param {string} sourcePath - Absolute path to source file in BMAD repository
|
|
73
|
+
* @param {string} targetPath - Absolute path to destination file in user's project
|
|
74
|
+
* @param {string} bmadFolderName - User's chosen bmad folder name (default: 'bmad')
|
|
75
|
+
* @returns {Promise<void>} Resolves when file copy and transformation complete
|
|
76
|
+
* @sideeffects Writes transformed file to targetPath, creates parent directories if needed
|
|
77
|
+
* @edgecases Binary files bypass transformation, falls back to raw copy if UTF-8 read fails
|
|
78
|
+
* @calledby installCore(), installModule(), IDE installers during file vendoring
|
|
79
|
+
* @calls fs.readFile(), fs.writeFile(), fs.copy()
|
|
80
|
+
*
|
|
81
|
+
|
|
82
|
+
*
|
|
83
|
+
* 3. Document marker in instructions.md (if applicable)
|
|
84
|
+
*/
|
|
85
|
+
async copyFileWithPlaceholderReplacement(sourcePath, targetPath) {
|
|
86
|
+
// List of text file extensions that should have placeholder replacement
|
|
87
|
+
const textExtensions = ['.md', '.yaml', '.yml', '.txt', '.json', '.js', '.ts', '.html', '.css', '.sh', '.bat', '.csv', '.xml'];
|
|
88
|
+
const ext = path.extname(sourcePath).toLowerCase();
|
|
89
|
+
|
|
90
|
+
// Check if this is a text file that might contain placeholders
|
|
91
|
+
if (textExtensions.includes(ext)) {
|
|
92
|
+
try {
|
|
93
|
+
// Read the file content
|
|
94
|
+
let content = await fs.readFile(sourcePath, 'utf8');
|
|
95
|
+
|
|
96
|
+
// Write to target with replaced content
|
|
97
|
+
await fs.ensureDir(path.dirname(targetPath));
|
|
98
|
+
await fs.writeFile(targetPath, content, 'utf8');
|
|
99
|
+
} catch {
|
|
100
|
+
// If reading as text fails (might be binary despite extension), fall back to regular copy
|
|
101
|
+
await fs.copy(sourcePath, targetPath, { overwrite: true });
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
// Binary file or other file type - just copy directly
|
|
105
|
+
await fs.copy(sourcePath, targetPath, { overwrite: true });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Collect Tool/IDE configurations after module configuration
|
|
111
|
+
* @param {string} projectDir - Project directory
|
|
112
|
+
* @param {Array} selectedModules - Selected modules from configuration
|
|
113
|
+
* @param {boolean} isFullReinstall - Whether this is a full reinstall
|
|
114
|
+
* @param {Array} previousIdes - Previously configured IDEs (for reinstalls)
|
|
115
|
+
* @param {Array} preSelectedIdes - Pre-selected IDEs from early prompt (optional)
|
|
116
|
+
* @returns {Object} Tool/IDE selection and configurations
|
|
117
|
+
*/
|
|
118
|
+
async collectToolConfigurations(projectDir, selectedModules, isFullReinstall = false, previousIdes = [], preSelectedIdes = null) {
|
|
119
|
+
// Use pre-selected IDEs if provided, otherwise prompt
|
|
120
|
+
let toolConfig;
|
|
121
|
+
if (preSelectedIdes === null) {
|
|
122
|
+
// Fallback: prompt for tool selection (backwards compatibility)
|
|
123
|
+
const { UI } = require('../../../lib/ui');
|
|
124
|
+
const ui = new UI();
|
|
125
|
+
toolConfig = await ui.promptToolSelection(projectDir);
|
|
126
|
+
} else {
|
|
127
|
+
// IDEs were already selected during initial prompts
|
|
128
|
+
toolConfig = {
|
|
129
|
+
ides: preSelectedIdes,
|
|
130
|
+
skipIde: !preSelectedIdes || preSelectedIdes.length === 0,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Check for already configured IDEs
|
|
135
|
+
const { Detector } = require('./detector');
|
|
136
|
+
const detector = new Detector();
|
|
137
|
+
const bmadDir = path.join(projectDir, BMAD_FOLDER_NAME);
|
|
138
|
+
|
|
139
|
+
// During full reinstall, use the saved previous IDEs since bmad dir was deleted
|
|
140
|
+
// Otherwise detect from existing installation
|
|
141
|
+
let previouslyConfiguredIdes;
|
|
142
|
+
if (isFullReinstall) {
|
|
143
|
+
// During reinstall, treat all IDEs as new (need configuration)
|
|
144
|
+
previouslyConfiguredIdes = [];
|
|
145
|
+
} else {
|
|
146
|
+
const existingInstall = await detector.detect(bmadDir);
|
|
147
|
+
previouslyConfiguredIdes = existingInstall.ides || [];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Load saved IDE configurations for already-configured IDEs
|
|
151
|
+
const savedIdeConfigs = await this.ideConfigManager.loadAllIdeConfigs(bmadDir);
|
|
152
|
+
|
|
153
|
+
// Collect IDE-specific configurations if any were selected
|
|
154
|
+
const ideConfigurations = {};
|
|
155
|
+
|
|
156
|
+
// First, add saved configs for already-configured IDEs
|
|
157
|
+
for (const ide of toolConfig.ides || []) {
|
|
158
|
+
if (previouslyConfiguredIdes.includes(ide) && savedIdeConfigs[ide]) {
|
|
159
|
+
ideConfigurations[ide] = savedIdeConfigs[ide];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (!toolConfig.skipIde && toolConfig.ides && toolConfig.ides.length > 0) {
|
|
164
|
+
// Determine which IDEs are newly selected (not previously configured)
|
|
165
|
+
const newlySelectedIdes = toolConfig.ides.filter((ide) => !previouslyConfiguredIdes.includes(ide));
|
|
166
|
+
|
|
167
|
+
if (newlySelectedIdes.length > 0) {
|
|
168
|
+
console.log('\n'); // Add spacing before IDE questions
|
|
169
|
+
|
|
170
|
+
for (const ide of newlySelectedIdes) {
|
|
171
|
+
// List of IDEs that have interactive prompts
|
|
172
|
+
//TODO: Why is this here, hardcoding this list here is bad, fix me!
|
|
173
|
+
const needsPrompts = ['claude-code', 'github-copilot', 'roo', 'cline', 'auggie', 'codex', 'qwen', 'gemini', 'rovo-dev'].includes(
|
|
174
|
+
ide,
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
if (needsPrompts) {
|
|
178
|
+
// Get IDE handler and collect configuration
|
|
179
|
+
try {
|
|
180
|
+
// Dynamically load the IDE setup module
|
|
181
|
+
const ideModule = require(`../ide/${ide}`);
|
|
182
|
+
|
|
183
|
+
// Get the setup class (handle different export formats)
|
|
184
|
+
let SetupClass;
|
|
185
|
+
const className =
|
|
186
|
+
ide
|
|
187
|
+
.split('-')
|
|
188
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
189
|
+
.join('') + 'Setup';
|
|
190
|
+
|
|
191
|
+
if (ideModule[className]) {
|
|
192
|
+
SetupClass = ideModule[className];
|
|
193
|
+
} else if (ideModule.default) {
|
|
194
|
+
SetupClass = ideModule.default;
|
|
195
|
+
} else {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const ideSetup = new SetupClass();
|
|
200
|
+
|
|
201
|
+
// Check if this IDE has a collectConfiguration method
|
|
202
|
+
if (typeof ideSetup.collectConfiguration === 'function') {
|
|
203
|
+
console.log(chalk.cyan(`\nConfiguring ${ide}...`));
|
|
204
|
+
ideConfigurations[ide] = await ideSetup.collectConfiguration({
|
|
205
|
+
selectedModules: selectedModules || [],
|
|
206
|
+
projectDir,
|
|
207
|
+
bmadDir,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
} catch {
|
|
211
|
+
// IDE doesn't have a setup file or collectConfiguration method
|
|
212
|
+
console.warn(chalk.yellow(`Warning: Could not load configuration for ${ide}`));
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Log which IDEs are already configured and being kept
|
|
219
|
+
const keptIdes = toolConfig.ides.filter((ide) => previouslyConfiguredIdes.includes(ide));
|
|
220
|
+
if (keptIdes.length > 0) {
|
|
221
|
+
console.log(chalk.dim(`\nKeeping existing configuration for: ${keptIdes.join(', ')}`));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return {
|
|
226
|
+
ides: toolConfig.ides,
|
|
227
|
+
skipIde: toolConfig.skipIde,
|
|
228
|
+
configurations: ideConfigurations,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Main installation method
|
|
234
|
+
* @param {Object} config - Installation configuration
|
|
235
|
+
* @param {string} config.directory - Target directory
|
|
236
|
+
* @param {boolean} config.installCore - Whether to install core
|
|
237
|
+
* @param {string[]} config.modules - Modules to install
|
|
238
|
+
* @param {string[]} config.ides - IDEs to configure
|
|
239
|
+
* @param {boolean} config.skipIde - Skip IDE configuration
|
|
240
|
+
*/
|
|
241
|
+
async install(originalConfig) {
|
|
242
|
+
// Clone config to avoid mutating the caller's object
|
|
243
|
+
const config = { ...originalConfig };
|
|
244
|
+
|
|
245
|
+
// Check if core config was already collected in UI
|
|
246
|
+
const hasCoreConfig = config.coreConfig && Object.keys(config.coreConfig).length > 0;
|
|
247
|
+
|
|
248
|
+
// Only display logo if core config wasn't already collected (meaning we're not continuing from UI)
|
|
249
|
+
if (!hasCoreConfig) {
|
|
250
|
+
// Display BMAD logo
|
|
251
|
+
CLIUtils.displayLogo();
|
|
252
|
+
|
|
253
|
+
// Display welcome message
|
|
254
|
+
CLIUtils.displaySection('BMad™ Installation', 'Version ' + require(path.join(getProjectRoot(), 'package.json')).version);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Note: Legacy V4 detection now happens earlier in UI.promptInstall()
|
|
258
|
+
// before any config collection, so we don't need to check again here
|
|
259
|
+
|
|
260
|
+
const projectDir = path.resolve(config.directory);
|
|
261
|
+
|
|
262
|
+
// If core config was pre-collected (from interactive mode), use it
|
|
263
|
+
if (config.coreConfig && Object.keys(config.coreConfig).length > 0) {
|
|
264
|
+
this.configCollector.collectedConfig.core = config.coreConfig;
|
|
265
|
+
// Also store in allAnswers for cross-referencing
|
|
266
|
+
this.configCollector.allAnswers = {};
|
|
267
|
+
for (const [key, value] of Object.entries(config.coreConfig)) {
|
|
268
|
+
this.configCollector.allAnswers[`core_${key}`] = value;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Collect configurations for modules (skip if quick update already collected them)
|
|
273
|
+
let moduleConfigs;
|
|
274
|
+
let customModulePaths = new Map();
|
|
275
|
+
|
|
276
|
+
if (config._quickUpdate) {
|
|
277
|
+
// Quick update already collected all configs, use them directly
|
|
278
|
+
moduleConfigs = this.configCollector.collectedConfig;
|
|
279
|
+
|
|
280
|
+
// For quick update, populate customModulePaths from _customModuleSources
|
|
281
|
+
if (config._customModuleSources) {
|
|
282
|
+
for (const [moduleId, customInfo] of config._customModuleSources) {
|
|
283
|
+
customModulePaths.set(moduleId, customInfo.sourcePath);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
} else {
|
|
287
|
+
// For regular updates (modify flow), check manifest for custom module sources
|
|
288
|
+
if (config._isUpdate && config._existingInstall && config._existingInstall.customModules) {
|
|
289
|
+
for (const customModule of config._existingInstall.customModules) {
|
|
290
|
+
// Ensure we have an absolute sourcePath
|
|
291
|
+
let absoluteSourcePath = customModule.sourcePath;
|
|
292
|
+
|
|
293
|
+
// Check if sourcePath is a cache-relative path (starts with _config)
|
|
294
|
+
if (absoluteSourcePath && absoluteSourcePath.startsWith('_config')) {
|
|
295
|
+
// Convert cache-relative path to absolute path
|
|
296
|
+
absoluteSourcePath = path.join(bmadDir, absoluteSourcePath);
|
|
297
|
+
}
|
|
298
|
+
// If no sourcePath but we have relativePath, convert it
|
|
299
|
+
else if (!absoluteSourcePath && customModule.relativePath) {
|
|
300
|
+
// relativePath is relative to the project root (parent of bmad dir)
|
|
301
|
+
absoluteSourcePath = path.resolve(projectDir, customModule.relativePath);
|
|
302
|
+
}
|
|
303
|
+
// Ensure sourcePath is absolute for anything else
|
|
304
|
+
else if (absoluteSourcePath && !path.isAbsolute(absoluteSourcePath)) {
|
|
305
|
+
absoluteSourcePath = path.resolve(absoluteSourcePath);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (absoluteSourcePath) {
|
|
309
|
+
customModulePaths.set(customModule.id, absoluteSourcePath);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// Build custom module paths map from customContent
|
|
315
|
+
|
|
316
|
+
// Handle selectedFiles (from existing install path or manual directory input)
|
|
317
|
+
if (config.customContent && config.customContent.selected && config.customContent.selectedFiles) {
|
|
318
|
+
const customHandler = new CustomHandler();
|
|
319
|
+
for (const customFile of config.customContent.selectedFiles) {
|
|
320
|
+
const customInfo = await customHandler.getCustomInfo(customFile, path.resolve(config.directory));
|
|
321
|
+
if (customInfo && customInfo.id) {
|
|
322
|
+
customModulePaths.set(customInfo.id, customInfo.path);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// Handle new custom content sources from UI
|
|
328
|
+
if (config.customContent && config.customContent.sources) {
|
|
329
|
+
for (const source of config.customContent.sources) {
|
|
330
|
+
customModulePaths.set(source.id, source.path);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// Handle cachedModules (from new install path where modules are cached)
|
|
335
|
+
// Only include modules that were actually selected for installation
|
|
336
|
+
if (config.customContent && config.customContent.cachedModules) {
|
|
337
|
+
// Get selected cached module IDs (if available)
|
|
338
|
+
const selectedCachedIds = config.customContent.selectedCachedModules || [];
|
|
339
|
+
// If no selection info, include all cached modules (for backward compatibility)
|
|
340
|
+
const shouldIncludeAll = selectedCachedIds.length === 0 && config.customContent.selected;
|
|
341
|
+
|
|
342
|
+
for (const cachedModule of config.customContent.cachedModules) {
|
|
343
|
+
// For cached modules, the path is the cachePath which contains the module.yaml
|
|
344
|
+
if (
|
|
345
|
+
cachedModule.id &&
|
|
346
|
+
cachedModule.cachePath && // Include if selected or if we should include all
|
|
347
|
+
(shouldIncludeAll || selectedCachedIds.includes(cachedModule.id))
|
|
348
|
+
) {
|
|
349
|
+
customModulePaths.set(cachedModule.id, cachedModule.cachePath);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// Get list of all modules including custom modules
|
|
355
|
+
// Order: core first, then official modules, then custom modules
|
|
356
|
+
const allModulesForConfig = ['core'];
|
|
357
|
+
|
|
358
|
+
// Add official modules (excluding core and any custom modules)
|
|
359
|
+
const officialModules = (config.modules || []).filter((m) => m !== 'core' && !customModulePaths.has(m));
|
|
360
|
+
allModulesForConfig.push(...officialModules);
|
|
361
|
+
|
|
362
|
+
// Add custom modules at the end
|
|
363
|
+
for (const [moduleId] of customModulePaths) {
|
|
364
|
+
if (!allModulesForConfig.includes(moduleId)) {
|
|
365
|
+
allModulesForConfig.push(moduleId);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// Check if core was already collected in UI
|
|
370
|
+
if (config.coreConfig && Object.keys(config.coreConfig).length > 0) {
|
|
371
|
+
// Core already collected, skip it in config collection
|
|
372
|
+
const modulesWithoutCore = allModulesForConfig.filter((m) => m !== 'core');
|
|
373
|
+
moduleConfigs = await this.configCollector.collectAllConfigurations(modulesWithoutCore, path.resolve(config.directory), {
|
|
374
|
+
customModulePaths,
|
|
375
|
+
});
|
|
376
|
+
} else {
|
|
377
|
+
// Core not collected yet, include it
|
|
378
|
+
moduleConfigs = await this.configCollector.collectAllConfigurations(allModulesForConfig, path.resolve(config.directory), {
|
|
379
|
+
customModulePaths,
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// Set bmad folder name on module manager and IDE manager for placeholder replacement
|
|
385
|
+
this.moduleManager.setBmadFolderName(BMAD_FOLDER_NAME);
|
|
386
|
+
this.moduleManager.setCoreConfig(moduleConfigs.core || {});
|
|
387
|
+
this.moduleManager.setCustomModulePaths(customModulePaths);
|
|
388
|
+
this.ideManager.setBmadFolderName(BMAD_FOLDER_NAME);
|
|
389
|
+
|
|
390
|
+
// Tool selection will be collected after we determine if it's a reinstall/update/new install
|
|
391
|
+
|
|
392
|
+
const spinner = ora('Preparing installation...').start();
|
|
393
|
+
|
|
394
|
+
try {
|
|
395
|
+
// Resolve target directory (path.resolve handles platform differences)
|
|
396
|
+
const projectDir = path.resolve(config.directory);
|
|
397
|
+
|
|
398
|
+
// Always use the standard _bmad folder name
|
|
399
|
+
const bmadDir = path.join(projectDir, BMAD_FOLDER_NAME);
|
|
400
|
+
|
|
401
|
+
// Create a project directory if it doesn't exist (user already confirmed)
|
|
402
|
+
if (!(await fs.pathExists(projectDir))) {
|
|
403
|
+
spinner.text = 'Creating installation directory...';
|
|
404
|
+
try {
|
|
405
|
+
// fs.ensureDir handles platform-specific directory creation
|
|
406
|
+
// It will recursively create all necessary parent directories
|
|
407
|
+
await fs.ensureDir(projectDir);
|
|
408
|
+
} catch (error) {
|
|
409
|
+
spinner.fail('Failed to create installation directory');
|
|
410
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
411
|
+
// More detailed error for common issues
|
|
412
|
+
if (error.code === 'EACCES') {
|
|
413
|
+
console.error(chalk.red('Permission denied. Check parent directory permissions.'));
|
|
414
|
+
} else if (error.code === 'ENOSPC') {
|
|
415
|
+
console.error(chalk.red('No space left on device.'));
|
|
416
|
+
}
|
|
417
|
+
throw new Error(`Cannot create directory: ${projectDir}`);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// Check existing installation
|
|
422
|
+
spinner.text = 'Checking for existing installation...';
|
|
423
|
+
const existingInstall = await this.detector.detect(bmadDir);
|
|
424
|
+
|
|
425
|
+
if (existingInstall.installed && !config.force && !config._quickUpdate) {
|
|
426
|
+
spinner.stop();
|
|
427
|
+
|
|
428
|
+
// Check if user already decided what to do (from early menu in ui.js)
|
|
429
|
+
let action = null;
|
|
430
|
+
if (config.actionType === 'update') {
|
|
431
|
+
action = 'update';
|
|
432
|
+
} else {
|
|
433
|
+
// Fallback: Ask the user (backwards compatibility for other code paths)
|
|
434
|
+
console.log(chalk.yellow('\n⚠️ Existing BMAD installation detected'));
|
|
435
|
+
console.log(chalk.dim(` Location: ${bmadDir}`));
|
|
436
|
+
console.log(chalk.dim(` Version: ${existingInstall.version}`));
|
|
437
|
+
|
|
438
|
+
const promptResult = await this.promptUpdateAction();
|
|
439
|
+
action = promptResult.action;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (action === 'update') {
|
|
443
|
+
// Store that we're updating for later processing
|
|
444
|
+
config._isUpdate = true;
|
|
445
|
+
config._existingInstall = existingInstall;
|
|
446
|
+
|
|
447
|
+
// Detect modules that were previously installed but are NOT in the new selection (to be removed)
|
|
448
|
+
const previouslyInstalledModules = new Set(existingInstall.modules.map((m) => m.id));
|
|
449
|
+
const newlySelectedModules = new Set(config.modules || []);
|
|
450
|
+
|
|
451
|
+
// Find modules to remove (installed but not in new selection)
|
|
452
|
+
// Exclude 'core' from being removable
|
|
453
|
+
const modulesToRemove = [...previouslyInstalledModules].filter((m) => !newlySelectedModules.has(m) && m !== 'core');
|
|
454
|
+
|
|
455
|
+
// If there are modules to remove, ask for confirmation
|
|
456
|
+
if (modulesToRemove.length > 0) {
|
|
457
|
+
const prompts = require('../../../lib/prompts');
|
|
458
|
+
spinner.stop();
|
|
459
|
+
|
|
460
|
+
console.log('');
|
|
461
|
+
console.log(chalk.yellow.bold('⚠️ Modules to be removed:'));
|
|
462
|
+
for (const moduleId of modulesToRemove) {
|
|
463
|
+
const moduleInfo = existingInstall.modules.find((m) => m.id === moduleId);
|
|
464
|
+
const displayName = moduleInfo?.name || moduleId;
|
|
465
|
+
const modulePath = path.join(bmadDir, moduleId);
|
|
466
|
+
console.log(chalk.red(` - ${displayName} (${modulePath})`));
|
|
467
|
+
}
|
|
468
|
+
console.log('');
|
|
469
|
+
|
|
470
|
+
const confirmRemoval = await prompts.confirm({
|
|
471
|
+
message: `Remove ${modulesToRemove.length} module(s) from BMAD installation?`,
|
|
472
|
+
default: false,
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
if (confirmRemoval) {
|
|
476
|
+
// Remove module folders
|
|
477
|
+
for (const moduleId of modulesToRemove) {
|
|
478
|
+
const modulePath = path.join(bmadDir, moduleId);
|
|
479
|
+
try {
|
|
480
|
+
if (await fs.pathExists(modulePath)) {
|
|
481
|
+
await fs.remove(modulePath);
|
|
482
|
+
console.log(chalk.dim(` ✓ Removed: ${moduleId}`));
|
|
483
|
+
}
|
|
484
|
+
} catch (error) {
|
|
485
|
+
console.warn(chalk.yellow(` Warning: Failed to remove ${moduleId}: ${error.message}`));
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
console.log(chalk.green(` ✓ Removed ${modulesToRemove.length} module(s)`));
|
|
489
|
+
} else {
|
|
490
|
+
console.log(chalk.dim(' → Module removal cancelled'));
|
|
491
|
+
// Add the modules back to the selection since user cancelled removal
|
|
492
|
+
for (const moduleId of modulesToRemove) {
|
|
493
|
+
if (!config.modules) config.modules = [];
|
|
494
|
+
config.modules.push(moduleId);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
spinner.start('Preparing update...');
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// Detect custom and modified files BEFORE updating (compare current files vs files-manifest.csv)
|
|
502
|
+
const existingFilesManifest = await this.readFilesManifest(bmadDir);
|
|
503
|
+
const { customFiles, modifiedFiles } = await this.detectCustomFiles(bmadDir, existingFilesManifest);
|
|
504
|
+
|
|
505
|
+
config._customFiles = customFiles;
|
|
506
|
+
config._modifiedFiles = modifiedFiles;
|
|
507
|
+
|
|
508
|
+
// Preserve existing core configuration during updates
|
|
509
|
+
// Read the current core config.yaml to maintain user's settings
|
|
510
|
+
const coreConfigPath = path.join(bmadDir, 'core', 'config.yaml');
|
|
511
|
+
if ((await fs.pathExists(coreConfigPath)) && (!config.coreConfig || Object.keys(config.coreConfig).length === 0)) {
|
|
512
|
+
try {
|
|
513
|
+
const yaml = require('yaml');
|
|
514
|
+
const coreConfigContent = await fs.readFile(coreConfigPath, 'utf8');
|
|
515
|
+
const existingCoreConfig = yaml.parse(coreConfigContent);
|
|
516
|
+
|
|
517
|
+
// Store in config.coreConfig so it's preserved through the installation
|
|
518
|
+
config.coreConfig = existingCoreConfig;
|
|
519
|
+
|
|
520
|
+
// Also store in configCollector for use during config collection
|
|
521
|
+
this.configCollector.collectedConfig.core = existingCoreConfig;
|
|
522
|
+
} catch (error) {
|
|
523
|
+
console.warn(chalk.yellow(`Warning: Could not read existing core config: ${error.message}`));
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// Also check cache directory for custom modules (like quick update does)
|
|
528
|
+
const cacheDir = path.join(bmadDir, '_config', 'custom');
|
|
529
|
+
if (await fs.pathExists(cacheDir)) {
|
|
530
|
+
const cachedModules = await fs.readdir(cacheDir, { withFileTypes: true });
|
|
531
|
+
|
|
532
|
+
for (const cachedModule of cachedModules) {
|
|
533
|
+
if (cachedModule.isDirectory()) {
|
|
534
|
+
const moduleId = cachedModule.name;
|
|
535
|
+
|
|
536
|
+
// Skip if we already have this module from manifest
|
|
537
|
+
if (customModulePaths.has(moduleId)) {
|
|
538
|
+
continue;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// Check if this is an external official module - skip cache for those
|
|
542
|
+
const isExternal = await this.moduleManager.isExternalModule(moduleId);
|
|
543
|
+
if (isExternal) {
|
|
544
|
+
// External modules are handled via cloneExternalModule, not from cache
|
|
545
|
+
continue;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const cachedPath = path.join(cacheDir, moduleId);
|
|
549
|
+
|
|
550
|
+
// Check if this is actually a custom module (has module.yaml)
|
|
551
|
+
const moduleYamlPath = path.join(cachedPath, 'module.yaml');
|
|
552
|
+
if (await fs.pathExists(moduleYamlPath)) {
|
|
553
|
+
customModulePaths.set(moduleId, cachedPath);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// Update module manager with the new custom module paths from cache
|
|
559
|
+
this.moduleManager.setCustomModulePaths(customModulePaths);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// If there are custom files, back them up temporarily
|
|
563
|
+
if (customFiles.length > 0) {
|
|
564
|
+
const tempBackupDir = path.join(projectDir, '_bmad-custom-backup-temp');
|
|
565
|
+
await fs.ensureDir(tempBackupDir);
|
|
566
|
+
|
|
567
|
+
spinner.start(`Backing up ${customFiles.length} custom files...`);
|
|
568
|
+
for (const customFile of customFiles) {
|
|
569
|
+
const relativePath = path.relative(bmadDir, customFile);
|
|
570
|
+
const backupPath = path.join(tempBackupDir, relativePath);
|
|
571
|
+
await fs.ensureDir(path.dirname(backupPath));
|
|
572
|
+
await fs.copy(customFile, backupPath);
|
|
573
|
+
}
|
|
574
|
+
spinner.succeed(`Backed up ${customFiles.length} custom files`);
|
|
575
|
+
|
|
576
|
+
config._tempBackupDir = tempBackupDir;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// For modified files, back them up to temp directory (will be restored as .bak files after install)
|
|
580
|
+
if (modifiedFiles.length > 0) {
|
|
581
|
+
const tempModifiedBackupDir = path.join(projectDir, '_bmad-modified-backup-temp');
|
|
582
|
+
await fs.ensureDir(tempModifiedBackupDir);
|
|
583
|
+
|
|
584
|
+
spinner.start(`Backing up ${modifiedFiles.length} modified files...`);
|
|
585
|
+
for (const modifiedFile of modifiedFiles) {
|
|
586
|
+
const relativePath = path.relative(bmadDir, modifiedFile.path);
|
|
587
|
+
const tempBackupPath = path.join(tempModifiedBackupDir, relativePath);
|
|
588
|
+
await fs.ensureDir(path.dirname(tempBackupPath));
|
|
589
|
+
await fs.copy(modifiedFile.path, tempBackupPath, { overwrite: true });
|
|
590
|
+
}
|
|
591
|
+
spinner.succeed(`Backed up ${modifiedFiles.length} modified files`);
|
|
592
|
+
|
|
593
|
+
config._tempModifiedBackupDir = tempModifiedBackupDir;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
} else if (existingInstall.installed && config._quickUpdate) {
|
|
597
|
+
// Quick update mode - automatically treat as update without prompting
|
|
598
|
+
spinner.text = 'Preparing quick update...';
|
|
599
|
+
config._isUpdate = true;
|
|
600
|
+
config._existingInstall = existingInstall;
|
|
601
|
+
|
|
602
|
+
// Detect custom and modified files BEFORE updating
|
|
603
|
+
const existingFilesManifest = await this.readFilesManifest(bmadDir);
|
|
604
|
+
const { customFiles, modifiedFiles } = await this.detectCustomFiles(bmadDir, existingFilesManifest);
|
|
605
|
+
|
|
606
|
+
config._customFiles = customFiles;
|
|
607
|
+
config._modifiedFiles = modifiedFiles;
|
|
608
|
+
|
|
609
|
+
// Also check cache directory for custom modules (like quick update does)
|
|
610
|
+
const cacheDir = path.join(bmadDir, '_config', 'custom');
|
|
611
|
+
if (await fs.pathExists(cacheDir)) {
|
|
612
|
+
const cachedModules = await fs.readdir(cacheDir, { withFileTypes: true });
|
|
613
|
+
|
|
614
|
+
for (const cachedModule of cachedModules) {
|
|
615
|
+
if (cachedModule.isDirectory()) {
|
|
616
|
+
const moduleId = cachedModule.name;
|
|
617
|
+
|
|
618
|
+
// Skip if we already have this module from manifest
|
|
619
|
+
if (customModulePaths.has(moduleId)) {
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// Check if this is an external official module - skip cache for those
|
|
624
|
+
const isExternal = await this.moduleManager.isExternalModule(moduleId);
|
|
625
|
+
if (isExternal) {
|
|
626
|
+
// External modules are handled via cloneExternalModule, not from cache
|
|
627
|
+
continue;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
const cachedPath = path.join(cacheDir, moduleId);
|
|
631
|
+
|
|
632
|
+
// Check if this is actually a custom module (has module.yaml)
|
|
633
|
+
const moduleYamlPath = path.join(cachedPath, 'module.yaml');
|
|
634
|
+
if (await fs.pathExists(moduleYamlPath)) {
|
|
635
|
+
customModulePaths.set(moduleId, cachedPath);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// Update module manager with the new custom module paths from cache
|
|
641
|
+
this.moduleManager.setCustomModulePaths(customModulePaths);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// Back up custom files
|
|
645
|
+
if (customFiles.length > 0) {
|
|
646
|
+
const tempBackupDir = path.join(projectDir, '_bmad-custom-backup-temp');
|
|
647
|
+
await fs.ensureDir(tempBackupDir);
|
|
648
|
+
|
|
649
|
+
spinner.start(`Backing up ${customFiles.length} custom files...`);
|
|
650
|
+
for (const customFile of customFiles) {
|
|
651
|
+
const relativePath = path.relative(bmadDir, customFile);
|
|
652
|
+
const backupPath = path.join(tempBackupDir, relativePath);
|
|
653
|
+
await fs.ensureDir(path.dirname(backupPath));
|
|
654
|
+
await fs.copy(customFile, backupPath);
|
|
655
|
+
}
|
|
656
|
+
spinner.succeed(`Backed up ${customFiles.length} custom files`);
|
|
657
|
+
config._tempBackupDir = tempBackupDir;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
// Back up modified files
|
|
661
|
+
if (modifiedFiles.length > 0) {
|
|
662
|
+
const tempModifiedBackupDir = path.join(projectDir, '_bmad-modified-backup-temp');
|
|
663
|
+
await fs.ensureDir(tempModifiedBackupDir);
|
|
664
|
+
|
|
665
|
+
spinner.start(`Backing up ${modifiedFiles.length} modified files...`);
|
|
666
|
+
for (const modifiedFile of modifiedFiles) {
|
|
667
|
+
const relativePath = path.relative(bmadDir, modifiedFile.path);
|
|
668
|
+
const tempBackupPath = path.join(tempModifiedBackupDir, relativePath);
|
|
669
|
+
await fs.ensureDir(path.dirname(tempBackupPath));
|
|
670
|
+
await fs.copy(modifiedFile.path, tempBackupPath, { overwrite: true });
|
|
671
|
+
}
|
|
672
|
+
spinner.succeed(`Backed up ${modifiedFiles.length} modified files`);
|
|
673
|
+
config._tempModifiedBackupDir = tempModifiedBackupDir;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// Now collect tool configurations after we know if it's a reinstall
|
|
678
|
+
// Skip for quick update since we already have the IDE list
|
|
679
|
+
spinner.stop();
|
|
680
|
+
let toolSelection;
|
|
681
|
+
if (config._quickUpdate) {
|
|
682
|
+
// Quick update already has IDEs configured, use saved configurations
|
|
683
|
+
const preConfiguredIdes = {};
|
|
684
|
+
const savedIdeConfigs = config._savedIdeConfigs || {};
|
|
685
|
+
|
|
686
|
+
for (const ide of config.ides || []) {
|
|
687
|
+
// Use saved config if available, otherwise mark as already configured (legacy)
|
|
688
|
+
if (savedIdeConfigs[ide]) {
|
|
689
|
+
preConfiguredIdes[ide] = savedIdeConfigs[ide];
|
|
690
|
+
} else {
|
|
691
|
+
preConfiguredIdes[ide] = { _alreadyConfigured: true };
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
toolSelection = {
|
|
695
|
+
ides: config.ides || [],
|
|
696
|
+
skipIde: !config.ides || config.ides.length === 0,
|
|
697
|
+
configurations: preConfiguredIdes,
|
|
698
|
+
};
|
|
699
|
+
} else {
|
|
700
|
+
// Pass pre-selected IDEs from early prompt (if available)
|
|
701
|
+
// This allows IDE selection to happen before file copying, improving UX
|
|
702
|
+
const preSelectedIdes = config.ides && config.ides.length > 0 ? config.ides : null;
|
|
703
|
+
toolSelection = await this.collectToolConfigurations(
|
|
704
|
+
path.resolve(config.directory),
|
|
705
|
+
config.modules,
|
|
706
|
+
config._isFullReinstall || false,
|
|
707
|
+
config._previouslyConfiguredIdes || [],
|
|
708
|
+
preSelectedIdes,
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
// Merge tool selection into config (for both quick update and regular flow)
|
|
713
|
+
config.ides = toolSelection.ides;
|
|
714
|
+
config.skipIde = toolSelection.skipIde;
|
|
715
|
+
const ideConfigurations = toolSelection.configurations;
|
|
716
|
+
|
|
717
|
+
// Add spacing after prompts before installation progress
|
|
718
|
+
console.log('');
|
|
719
|
+
|
|
720
|
+
if (spinner.isSpinning) {
|
|
721
|
+
spinner.text = 'Continuing installation...';
|
|
722
|
+
} else {
|
|
723
|
+
spinner.start('Continuing installation...');
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// Create bmad directory structure
|
|
727
|
+
spinner.text = 'Creating directory structure...';
|
|
728
|
+
await this.createDirectoryStructure(bmadDir);
|
|
729
|
+
|
|
730
|
+
// Cache custom modules if any
|
|
731
|
+
if (customModulePaths && customModulePaths.size > 0) {
|
|
732
|
+
spinner.text = 'Caching custom modules...';
|
|
733
|
+
const { CustomModuleCache } = require('./custom-module-cache');
|
|
734
|
+
const customCache = new CustomModuleCache(bmadDir);
|
|
735
|
+
|
|
736
|
+
for (const [moduleId, sourcePath] of customModulePaths) {
|
|
737
|
+
const cachedInfo = await customCache.cacheModule(moduleId, sourcePath, {
|
|
738
|
+
sourcePath: sourcePath, // Store original path for updates
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
// Update the customModulePaths to use the cached location
|
|
742
|
+
customModulePaths.set(moduleId, cachedInfo.cachePath);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
// Update module manager with the cached paths
|
|
746
|
+
this.moduleManager.setCustomModulePaths(customModulePaths);
|
|
747
|
+
spinner.succeed('Custom modules cached');
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
const projectRoot = getProjectRoot();
|
|
751
|
+
|
|
752
|
+
// Step 1: Install core module first (if requested)
|
|
753
|
+
if (config.installCore) {
|
|
754
|
+
spinner.start('Installing BMAD core...');
|
|
755
|
+
await this.installCoreWithDependencies(bmadDir, { core: {} });
|
|
756
|
+
spinner.succeed('Core installed');
|
|
757
|
+
|
|
758
|
+
// Generate core config file
|
|
759
|
+
await this.generateModuleConfigs(bmadDir, { core: config.coreConfig || {} });
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
// Custom content is already handled in UI before module selection
|
|
763
|
+
let finalCustomContent = config.customContent;
|
|
764
|
+
|
|
765
|
+
// Step 3: Prepare modules list including cached custom modules
|
|
766
|
+
let allModules = [...(config.modules || [])];
|
|
767
|
+
|
|
768
|
+
// During quick update, we might have custom module sources from the manifest
|
|
769
|
+
if (config._customModuleSources) {
|
|
770
|
+
// Add custom modules from stored sources
|
|
771
|
+
for (const [moduleId, customInfo] of config._customModuleSources) {
|
|
772
|
+
if (!allModules.includes(moduleId) && (await fs.pathExists(customInfo.sourcePath))) {
|
|
773
|
+
allModules.push(moduleId);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
// Add cached custom modules
|
|
779
|
+
if (finalCustomContent && finalCustomContent.cachedModules) {
|
|
780
|
+
for (const cachedModule of finalCustomContent.cachedModules) {
|
|
781
|
+
if (!allModules.includes(cachedModule.id)) {
|
|
782
|
+
allModules.push(cachedModule.id);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
// Regular custom content from user input (non-cached)
|
|
788
|
+
if (finalCustomContent && finalCustomContent.selected && finalCustomContent.selectedFiles) {
|
|
789
|
+
// Add custom modules to the installation list
|
|
790
|
+
const customHandler = new CustomHandler();
|
|
791
|
+
for (const customFile of finalCustomContent.selectedFiles) {
|
|
792
|
+
const customInfo = await customHandler.getCustomInfo(customFile, projectDir);
|
|
793
|
+
if (customInfo && customInfo.id) {
|
|
794
|
+
allModules.push(customInfo.id);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// Don't include core again if already installed
|
|
800
|
+
if (config.installCore) {
|
|
801
|
+
allModules = allModules.filter((m) => m !== 'core');
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
const modulesToInstall = allModules;
|
|
805
|
+
|
|
806
|
+
// For dependency resolution, we only need regular modules (not custom modules)
|
|
807
|
+
// Custom modules are already installed in _bmad and don't need dependency resolution from source
|
|
808
|
+
const regularModulesForResolution = allModules.filter((module) => {
|
|
809
|
+
// Check if this is a custom module
|
|
810
|
+
const isCustom =
|
|
811
|
+
customModulePaths.has(module) ||
|
|
812
|
+
(finalCustomContent && finalCustomContent.cachedModules && finalCustomContent.cachedModules.some((cm) => cm.id === module)) ||
|
|
813
|
+
(finalCustomContent &&
|
|
814
|
+
finalCustomContent.selected &&
|
|
815
|
+
finalCustomContent.selectedFiles &&
|
|
816
|
+
finalCustomContent.selectedFiles.some((f) => f.includes(module)));
|
|
817
|
+
return !isCustom;
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
// For dependency resolution, we need to pass the project root
|
|
821
|
+
// Create a temporary module manager that knows about custom content locations
|
|
822
|
+
const tempModuleManager = new ModuleManager({
|
|
823
|
+
bmadDir: bmadDir, // Pass bmadDir so we can check cache
|
|
824
|
+
});
|
|
825
|
+
|
|
826
|
+
const resolution = await this.dependencyResolver.resolve(projectRoot, regularModulesForResolution, {
|
|
827
|
+
verbose: config.verbose,
|
|
828
|
+
moduleManager: tempModuleManager,
|
|
829
|
+
});
|
|
830
|
+
|
|
831
|
+
spinner.succeed('Dependencies resolved');
|
|
832
|
+
|
|
833
|
+
// Install modules with their dependencies
|
|
834
|
+
if (allModules && allModules.length > 0) {
|
|
835
|
+
const installedModuleNames = new Set();
|
|
836
|
+
|
|
837
|
+
for (const moduleName of allModules) {
|
|
838
|
+
// Skip if already installed
|
|
839
|
+
if (installedModuleNames.has(moduleName)) {
|
|
840
|
+
continue;
|
|
841
|
+
}
|
|
842
|
+
installedModuleNames.add(moduleName);
|
|
843
|
+
|
|
844
|
+
// Show appropriate message based on whether this is a quick update
|
|
845
|
+
const isQuickUpdate = config._quickUpdate || false;
|
|
846
|
+
spinner.start(`${isQuickUpdate ? 'Updating' : 'Installing'} module: ${moduleName}...`);
|
|
847
|
+
|
|
848
|
+
// Check if this is a custom module
|
|
849
|
+
let isCustomModule = false;
|
|
850
|
+
let customInfo = null;
|
|
851
|
+
let useCache = false;
|
|
852
|
+
|
|
853
|
+
// First check if we have a cached version
|
|
854
|
+
if (finalCustomContent && finalCustomContent.cachedModules) {
|
|
855
|
+
const cachedModule = finalCustomContent.cachedModules.find((m) => m.id === moduleName);
|
|
856
|
+
if (cachedModule) {
|
|
857
|
+
isCustomModule = true;
|
|
858
|
+
customInfo = {
|
|
859
|
+
id: moduleName,
|
|
860
|
+
path: cachedModule.cachePath,
|
|
861
|
+
config: {},
|
|
862
|
+
};
|
|
863
|
+
useCache = true;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
// Then check if we have custom module sources from the manifest (for quick update)
|
|
868
|
+
if (!isCustomModule && config._customModuleSources && config._customModuleSources.has(moduleName)) {
|
|
869
|
+
customInfo = config._customModuleSources.get(moduleName);
|
|
870
|
+
isCustomModule = true;
|
|
871
|
+
|
|
872
|
+
// Check if this is a cached module (source path starts with _config)
|
|
873
|
+
if (
|
|
874
|
+
customInfo.sourcePath &&
|
|
875
|
+
(customInfo.sourcePath.startsWith('_config') || customInfo.sourcePath.includes('_config/custom'))
|
|
876
|
+
) {
|
|
877
|
+
useCache = true;
|
|
878
|
+
// Make sure we have the right path structure
|
|
879
|
+
if (!customInfo.path) {
|
|
880
|
+
customInfo.path = customInfo.sourcePath;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
// Finally check regular custom content
|
|
886
|
+
if (!isCustomModule && finalCustomContent && finalCustomContent.selected && finalCustomContent.selectedFiles) {
|
|
887
|
+
const customHandler = new CustomHandler();
|
|
888
|
+
for (const customFile of finalCustomContent.selectedFiles) {
|
|
889
|
+
const info = await customHandler.getCustomInfo(customFile, projectDir);
|
|
890
|
+
if (info && info.id === moduleName) {
|
|
891
|
+
isCustomModule = true;
|
|
892
|
+
customInfo = info;
|
|
893
|
+
break;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
if (isCustomModule && customInfo) {
|
|
899
|
+
// Custom modules are now installed via ModuleManager just like standard modules
|
|
900
|
+
// The custom module path should already be in customModulePaths from earlier setup
|
|
901
|
+
if (!customModulePaths.has(moduleName) && customInfo.path) {
|
|
902
|
+
customModulePaths.set(moduleName, customInfo.path);
|
|
903
|
+
this.moduleManager.setCustomModulePaths(customModulePaths);
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
const collectedModuleConfig = moduleConfigs[moduleName] || {};
|
|
907
|
+
|
|
908
|
+
// Use ModuleManager to install the custom module
|
|
909
|
+
await this.moduleManager.install(
|
|
910
|
+
moduleName,
|
|
911
|
+
bmadDir,
|
|
912
|
+
(filePath) => {
|
|
913
|
+
this.installedFiles.add(filePath);
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
isCustom: true,
|
|
917
|
+
moduleConfig: collectedModuleConfig,
|
|
918
|
+
isQuickUpdate: config._quickUpdate || false,
|
|
919
|
+
installer: this,
|
|
920
|
+
},
|
|
921
|
+
);
|
|
922
|
+
|
|
923
|
+
// Create module config (include collected config from module.yaml prompts)
|
|
924
|
+
await this.generateModuleConfigs(bmadDir, {
|
|
925
|
+
[moduleName]: { ...config.coreConfig, ...customInfo.config, ...collectedModuleConfig },
|
|
926
|
+
});
|
|
927
|
+
} else {
|
|
928
|
+
// Regular module installation
|
|
929
|
+
// Special case for core module
|
|
930
|
+
if (moduleName === 'core') {
|
|
931
|
+
await this.installCoreWithDependencies(bmadDir, resolution.byModule[moduleName]);
|
|
932
|
+
} else {
|
|
933
|
+
await this.installModuleWithDependencies(moduleName, bmadDir, resolution.byModule[moduleName]);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
spinner.succeed(`Module ${isQuickUpdate ? 'updated' : 'installed'}: ${moduleName}`);
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
// Install partial modules (only dependencies)
|
|
941
|
+
for (const [module, files] of Object.entries(resolution.byModule)) {
|
|
942
|
+
if (!allModules.includes(module) && module !== 'core') {
|
|
943
|
+
const totalFiles =
|
|
944
|
+
files.agents.length +
|
|
945
|
+
files.tasks.length +
|
|
946
|
+
files.tools.length +
|
|
947
|
+
files.templates.length +
|
|
948
|
+
files.data.length +
|
|
949
|
+
files.other.length;
|
|
950
|
+
if (totalFiles > 0) {
|
|
951
|
+
spinner.start(`Installing ${module} dependencies...`);
|
|
952
|
+
await this.installPartialModule(module, bmadDir, files);
|
|
953
|
+
spinner.succeed(`${module} dependencies installed`);
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
// All content is now installed as modules - no separate custom content handling needed
|
|
960
|
+
|
|
961
|
+
// Generate clean config.yaml files for each installed module
|
|
962
|
+
spinner.start('Generating module configurations...');
|
|
963
|
+
await this.generateModuleConfigs(bmadDir, moduleConfigs);
|
|
964
|
+
spinner.succeed('Module configurations generated');
|
|
965
|
+
|
|
966
|
+
// Create agent configuration files
|
|
967
|
+
// Note: Legacy createAgentConfigs removed - using YAML customize system instead
|
|
968
|
+
// Customize templates are now created in processAgentFiles when building YAML agents
|
|
969
|
+
|
|
970
|
+
// Pre-register manifest files that will be created (except files-manifest.csv to avoid recursion)
|
|
971
|
+
const cfgDir = path.join(bmadDir, '_config');
|
|
972
|
+
this.installedFiles.add(path.join(cfgDir, 'manifest.yaml'));
|
|
973
|
+
this.installedFiles.add(path.join(cfgDir, 'workflow-manifest.csv'));
|
|
974
|
+
this.installedFiles.add(path.join(cfgDir, 'agent-manifest.csv'));
|
|
975
|
+
this.installedFiles.add(path.join(cfgDir, 'task-manifest.csv'));
|
|
976
|
+
|
|
977
|
+
// Generate CSV manifests for workflows, agents, tasks AND ALL FILES with hashes BEFORE IDE setup
|
|
978
|
+
spinner.start('Generating workflow and agent manifests...');
|
|
979
|
+
const manifestGen = new ManifestGenerator();
|
|
980
|
+
|
|
981
|
+
// For quick update, we need ALL installed modules in the manifest
|
|
982
|
+
// Not just the ones being updated
|
|
983
|
+
const allModulesForManifest = config._quickUpdate
|
|
984
|
+
? config._existingModules || allModules || []
|
|
985
|
+
: config._preserveModules
|
|
986
|
+
? [...allModules, ...config._preserveModules]
|
|
987
|
+
: allModules || [];
|
|
988
|
+
|
|
989
|
+
// For regular installs (including when called from quick update), use what we have
|
|
990
|
+
let modulesForCsvPreserve;
|
|
991
|
+
if (config._quickUpdate) {
|
|
992
|
+
// Quick update - use existing modules or fall back to modules being updated
|
|
993
|
+
modulesForCsvPreserve = config._existingModules || allModules || [];
|
|
994
|
+
} else {
|
|
995
|
+
// Regular install - use the modules we're installing plus any preserved ones
|
|
996
|
+
modulesForCsvPreserve = config._preserveModules ? [...allModules, ...config._preserveModules] : allModules;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
const manifestStats = await manifestGen.generateManifests(bmadDir, allModulesForManifest, [...this.installedFiles], {
|
|
1000
|
+
ides: config.ides || [],
|
|
1001
|
+
preservedModules: modulesForCsvPreserve, // Scan these from installed bmad/ dir
|
|
1002
|
+
});
|
|
1003
|
+
|
|
1004
|
+
// Custom modules are now included in the main modules list - no separate tracking needed
|
|
1005
|
+
|
|
1006
|
+
spinner.succeed(
|
|
1007
|
+
`Manifests generated: ${manifestStats.workflows} workflows, ${manifestStats.agents} agents, ${manifestStats.tasks} tasks, ${manifestStats.tools} tools, ${manifestStats.files} files`,
|
|
1008
|
+
);
|
|
1009
|
+
|
|
1010
|
+
// Configure IDEs and copy documentation
|
|
1011
|
+
if (!config.skipIde && config.ides && config.ides.length > 0) {
|
|
1012
|
+
// Filter out any undefined/null values from the IDE list
|
|
1013
|
+
const validIdes = config.ides.filter((ide) => ide && typeof ide === 'string');
|
|
1014
|
+
|
|
1015
|
+
if (validIdes.length === 0) {
|
|
1016
|
+
console.log(chalk.yellow('⚠️ No valid IDEs selected. Skipping IDE configuration.'));
|
|
1017
|
+
} else {
|
|
1018
|
+
// Check if any IDE might need prompting (no pre-collected config)
|
|
1019
|
+
const needsPrompting = validIdes.some((ide) => !ideConfigurations[ide]);
|
|
1020
|
+
|
|
1021
|
+
if (!needsPrompting) {
|
|
1022
|
+
spinner.start('Configuring IDEs...');
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
// Temporarily suppress console output if not verbose
|
|
1026
|
+
const originalLog = console.log;
|
|
1027
|
+
if (!config.verbose) {
|
|
1028
|
+
console.log = () => {};
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
for (const ide of validIdes) {
|
|
1032
|
+
// Only show spinner if we have pre-collected config (no prompts expected)
|
|
1033
|
+
if (ideConfigurations[ide] && !needsPrompting) {
|
|
1034
|
+
spinner.text = `Configuring ${ide}...`;
|
|
1035
|
+
} else if (!ideConfigurations[ide]) {
|
|
1036
|
+
// Stop spinner before prompting
|
|
1037
|
+
if (spinner.isSpinning) {
|
|
1038
|
+
spinner.stop();
|
|
1039
|
+
}
|
|
1040
|
+
console.log(chalk.cyan(`\nConfiguring ${ide}...`));
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
// Pass pre-collected configuration to avoid re-prompting
|
|
1044
|
+
await this.ideManager.setup(ide, projectDir, bmadDir, {
|
|
1045
|
+
selectedModules: allModules || [],
|
|
1046
|
+
preCollectedConfig: ideConfigurations[ide] || null,
|
|
1047
|
+
verbose: config.verbose,
|
|
1048
|
+
});
|
|
1049
|
+
|
|
1050
|
+
// Save IDE configuration for future updates
|
|
1051
|
+
if (ideConfigurations[ide] && !ideConfigurations[ide]._alreadyConfigured) {
|
|
1052
|
+
await this.ideConfigManager.saveIdeConfig(bmadDir, ide, ideConfigurations[ide]);
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
// Restart spinner if we stopped it
|
|
1056
|
+
if (!ideConfigurations[ide] && !spinner.isSpinning) {
|
|
1057
|
+
spinner.start('Configuring IDEs...');
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
// Restore console.log
|
|
1062
|
+
console.log = originalLog;
|
|
1063
|
+
|
|
1064
|
+
if (spinner.isSpinning) {
|
|
1065
|
+
spinner.succeed(`Configured: ${validIdes.join(', ')}`);
|
|
1066
|
+
} else {
|
|
1067
|
+
console.log(chalk.green(`✓ Configured: ${validIdes.join(', ')}`));
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
// Run module-specific installers after IDE setup
|
|
1073
|
+
spinner.start('Running module-specific installers...');
|
|
1074
|
+
|
|
1075
|
+
// Create a conditional logger based on verbose mode
|
|
1076
|
+
const verboseMode = process.env.BMAD_VERBOSE_INSTALL === 'true' || config.verbose;
|
|
1077
|
+
const moduleLogger = {
|
|
1078
|
+
log: (msg) => (verboseMode ? console.log(msg) : {}), // Only log in verbose mode
|
|
1079
|
+
error: (msg) => console.error(msg), // Always show errors
|
|
1080
|
+
warn: (msg) => console.warn(msg), // Always show warnings
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
// Run core module installer if core was installed
|
|
1084
|
+
if (config.installCore || resolution.byModule.core) {
|
|
1085
|
+
spinner.text = 'Running core module installer...';
|
|
1086
|
+
|
|
1087
|
+
await this.moduleManager.runModuleInstaller('core', bmadDir, {
|
|
1088
|
+
installedIDEs: config.ides || [],
|
|
1089
|
+
moduleConfig: moduleConfigs.core || {},
|
|
1090
|
+
coreConfig: moduleConfigs.core || {},
|
|
1091
|
+
logger: moduleLogger,
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
// Run installers for user-selected modules
|
|
1096
|
+
if (config.modules && config.modules.length > 0) {
|
|
1097
|
+
for (const moduleName of config.modules) {
|
|
1098
|
+
spinner.text = `Running ${moduleName} module installer...`;
|
|
1099
|
+
|
|
1100
|
+
// Pass installed IDEs and module config to module installer
|
|
1101
|
+
await this.moduleManager.runModuleInstaller(moduleName, bmadDir, {
|
|
1102
|
+
installedIDEs: config.ides || [],
|
|
1103
|
+
moduleConfig: moduleConfigs[moduleName] || {},
|
|
1104
|
+
coreConfig: moduleConfigs.core || {},
|
|
1105
|
+
logger: moduleLogger,
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
spinner.succeed('Module-specific installers completed');
|
|
1111
|
+
|
|
1112
|
+
// Note: Manifest files are already created by ManifestGenerator above
|
|
1113
|
+
// No need to create legacy manifest.csv anymore
|
|
1114
|
+
|
|
1115
|
+
// If this was an update, restore custom files
|
|
1116
|
+
let customFiles = [];
|
|
1117
|
+
let modifiedFiles = [];
|
|
1118
|
+
if (config._isUpdate) {
|
|
1119
|
+
if (config._customFiles && config._customFiles.length > 0) {
|
|
1120
|
+
spinner.start(`Restoring ${config._customFiles.length} custom files...`);
|
|
1121
|
+
|
|
1122
|
+
for (const originalPath of config._customFiles) {
|
|
1123
|
+
const relativePath = path.relative(bmadDir, originalPath);
|
|
1124
|
+
const backupPath = path.join(config._tempBackupDir, relativePath);
|
|
1125
|
+
|
|
1126
|
+
if (await fs.pathExists(backupPath)) {
|
|
1127
|
+
await fs.ensureDir(path.dirname(originalPath));
|
|
1128
|
+
await fs.copy(backupPath, originalPath, { overwrite: true });
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
// Clean up temp backup
|
|
1133
|
+
if (config._tempBackupDir && (await fs.pathExists(config._tempBackupDir))) {
|
|
1134
|
+
await fs.remove(config._tempBackupDir);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
spinner.succeed(`Restored ${config._customFiles.length} custom files`);
|
|
1138
|
+
customFiles = config._customFiles;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
if (config._modifiedFiles && config._modifiedFiles.length > 0) {
|
|
1142
|
+
modifiedFiles = config._modifiedFiles;
|
|
1143
|
+
|
|
1144
|
+
// Restore modified files as .bak files
|
|
1145
|
+
if (config._tempModifiedBackupDir && (await fs.pathExists(config._tempModifiedBackupDir))) {
|
|
1146
|
+
spinner.start(`Restoring ${modifiedFiles.length} modified files as .bak...`);
|
|
1147
|
+
|
|
1148
|
+
for (const modifiedFile of modifiedFiles) {
|
|
1149
|
+
const relativePath = path.relative(bmadDir, modifiedFile.path);
|
|
1150
|
+
const tempBackupPath = path.join(config._tempModifiedBackupDir, relativePath);
|
|
1151
|
+
const bakPath = modifiedFile.path + '.bak';
|
|
1152
|
+
|
|
1153
|
+
if (await fs.pathExists(tempBackupPath)) {
|
|
1154
|
+
await fs.ensureDir(path.dirname(bakPath));
|
|
1155
|
+
await fs.copy(tempBackupPath, bakPath, { overwrite: true });
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
// Clean up temp backup
|
|
1160
|
+
await fs.remove(config._tempModifiedBackupDir);
|
|
1161
|
+
|
|
1162
|
+
spinner.succeed(`Restored ${modifiedFiles.length} modified files as .bak`);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
spinner.stop();
|
|
1168
|
+
|
|
1169
|
+
// Report custom and modified files if any were found
|
|
1170
|
+
if (customFiles.length > 0) {
|
|
1171
|
+
console.log(chalk.cyan(`\n📁 Custom files preserved: ${customFiles.length}`));
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
if (modifiedFiles.length > 0) {
|
|
1175
|
+
console.log(chalk.yellow(`\n⚠️ User modified files detected: ${modifiedFiles.length}`));
|
|
1176
|
+
console.log(
|
|
1177
|
+
chalk.dim(
|
|
1178
|
+
'\nThese user modified files have been updated with the new version, search the project for .bak files that had your customizations.',
|
|
1179
|
+
),
|
|
1180
|
+
);
|
|
1181
|
+
console.log(chalk.dim('Remove these .bak files it no longer needed\n'));
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
// Display completion message
|
|
1185
|
+
const { UI } = require('../../../lib/ui');
|
|
1186
|
+
const ui = new UI();
|
|
1187
|
+
ui.showInstallSummary({
|
|
1188
|
+
path: bmadDir,
|
|
1189
|
+
modules: config.modules,
|
|
1190
|
+
ides: config.ides,
|
|
1191
|
+
customFiles: customFiles.length > 0 ? customFiles : undefined,
|
|
1192
|
+
});
|
|
1193
|
+
|
|
1194
|
+
return {
|
|
1195
|
+
success: true,
|
|
1196
|
+
path: bmadDir,
|
|
1197
|
+
modules: config.modules,
|
|
1198
|
+
ides: config.ides,
|
|
1199
|
+
projectDir: projectDir,
|
|
1200
|
+
};
|
|
1201
|
+
} catch (error) {
|
|
1202
|
+
spinner.fail('Installation failed');
|
|
1203
|
+
throw error;
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* Update existing installation
|
|
1209
|
+
*/
|
|
1210
|
+
async update(config) {
|
|
1211
|
+
const spinner = ora('Checking installation...').start();
|
|
1212
|
+
|
|
1213
|
+
try {
|
|
1214
|
+
const projectDir = path.resolve(config.directory);
|
|
1215
|
+
const { bmadDir } = await this.findBmadDir(projectDir);
|
|
1216
|
+
const existingInstall = await this.detector.detect(bmadDir);
|
|
1217
|
+
|
|
1218
|
+
if (!existingInstall.installed) {
|
|
1219
|
+
spinner.fail('No BMAD installation found');
|
|
1220
|
+
throw new Error(`No BMAD installation found at ${bmadDir}`);
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
spinner.text = 'Analyzing update requirements...';
|
|
1224
|
+
|
|
1225
|
+
// Compare versions and determine what needs updating
|
|
1226
|
+
const currentVersion = existingInstall.version;
|
|
1227
|
+
const newVersion = require(path.join(getProjectRoot(), 'package.json')).version;
|
|
1228
|
+
|
|
1229
|
+
// Check for custom modules with missing sources before update
|
|
1230
|
+
const customModuleSources = new Map();
|
|
1231
|
+
|
|
1232
|
+
// Check manifest for backward compatibility
|
|
1233
|
+
if (existingInstall.customModules) {
|
|
1234
|
+
for (const customModule of existingInstall.customModules) {
|
|
1235
|
+
customModuleSources.set(customModule.id, customModule);
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
// Also check cache directory
|
|
1240
|
+
const cacheDir = path.join(bmadDir, '_config', 'custom');
|
|
1241
|
+
if (await fs.pathExists(cacheDir)) {
|
|
1242
|
+
const cachedModules = await fs.readdir(cacheDir, { withFileTypes: true });
|
|
1243
|
+
|
|
1244
|
+
for (const cachedModule of cachedModules) {
|
|
1245
|
+
if (cachedModule.isDirectory()) {
|
|
1246
|
+
const moduleId = cachedModule.name;
|
|
1247
|
+
|
|
1248
|
+
// Skip if we already have this module
|
|
1249
|
+
if (customModuleSources.has(moduleId)) {
|
|
1250
|
+
continue;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
// Check if this is an external official module - skip cache for those
|
|
1254
|
+
const isExternal = await this.moduleManager.isExternalModule(moduleId);
|
|
1255
|
+
if (isExternal) {
|
|
1256
|
+
// External modules are handled via cloneExternalModule, not from cache
|
|
1257
|
+
continue;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
const cachedPath = path.join(cacheDir, moduleId);
|
|
1261
|
+
|
|
1262
|
+
// Check if this is actually a custom module (has module.yaml)
|
|
1263
|
+
const moduleYamlPath = path.join(cachedPath, 'module.yaml');
|
|
1264
|
+
if (await fs.pathExists(moduleYamlPath)) {
|
|
1265
|
+
customModuleSources.set(moduleId, {
|
|
1266
|
+
id: moduleId,
|
|
1267
|
+
name: moduleId,
|
|
1268
|
+
sourcePath: path.join('_config', 'custom', moduleId), // Relative path
|
|
1269
|
+
cached: true,
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
if (customModuleSources.size > 0) {
|
|
1277
|
+
spinner.stop();
|
|
1278
|
+
console.log(chalk.yellow('\nChecking custom module sources before update...'));
|
|
1279
|
+
|
|
1280
|
+
const projectRoot = getProjectRoot();
|
|
1281
|
+
await this.handleMissingCustomSources(
|
|
1282
|
+
customModuleSources,
|
|
1283
|
+
bmadDir,
|
|
1284
|
+
projectRoot,
|
|
1285
|
+
'update',
|
|
1286
|
+
existingInstall.modules.map((m) => m.id),
|
|
1287
|
+
);
|
|
1288
|
+
|
|
1289
|
+
spinner.start('Preparing update...');
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
if (config.dryRun) {
|
|
1293
|
+
spinner.stop();
|
|
1294
|
+
console.log(chalk.cyan('\n🔍 Update Preview (Dry Run)\n'));
|
|
1295
|
+
console.log(chalk.bold('Current version:'), currentVersion);
|
|
1296
|
+
console.log(chalk.bold('New version:'), newVersion);
|
|
1297
|
+
console.log(chalk.bold('Core:'), existingInstall.hasCore ? 'Will be updated' : 'Not installed');
|
|
1298
|
+
|
|
1299
|
+
if (existingInstall.modules.length > 0) {
|
|
1300
|
+
console.log(chalk.bold('\nModules to update:'));
|
|
1301
|
+
for (const mod of existingInstall.modules) {
|
|
1302
|
+
console.log(` - ${mod.id}`);
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
// Perform actual update
|
|
1309
|
+
if (existingInstall.hasCore) {
|
|
1310
|
+
spinner.text = 'Updating core...';
|
|
1311
|
+
await this.updateCore(bmadDir, config.force);
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
for (const module of existingInstall.modules) {
|
|
1315
|
+
spinner.text = `Updating module: ${module.id}...`;
|
|
1316
|
+
await this.moduleManager.update(module.id, bmadDir, config.force);
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
// Update manifest
|
|
1320
|
+
spinner.text = 'Updating manifest...';
|
|
1321
|
+
await this.manifest.update(bmadDir, {
|
|
1322
|
+
version: newVersion,
|
|
1323
|
+
updateDate: new Date().toISOString(),
|
|
1324
|
+
});
|
|
1325
|
+
|
|
1326
|
+
spinner.succeed('Update complete');
|
|
1327
|
+
return { success: true };
|
|
1328
|
+
} catch (error) {
|
|
1329
|
+
spinner.fail('Update failed');
|
|
1330
|
+
throw error;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
* Get installation status
|
|
1336
|
+
*/
|
|
1337
|
+
async getStatus(directory) {
|
|
1338
|
+
const projectDir = path.resolve(directory);
|
|
1339
|
+
const { bmadDir } = await this.findBmadDir(projectDir);
|
|
1340
|
+
return await this.detector.detect(bmadDir);
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* Get available modules
|
|
1345
|
+
*/
|
|
1346
|
+
async getAvailableModules() {
|
|
1347
|
+
return await this.moduleManager.listAvailable();
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* Uninstall BMAD
|
|
1352
|
+
*/
|
|
1353
|
+
async uninstall(directory) {
|
|
1354
|
+
const projectDir = path.resolve(directory);
|
|
1355
|
+
const { bmadDir } = await this.findBmadDir(projectDir);
|
|
1356
|
+
|
|
1357
|
+
if (await fs.pathExists(bmadDir)) {
|
|
1358
|
+
await fs.remove(bmadDir);
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
// Clean up IDE configurations
|
|
1362
|
+
await this.ideManager.cleanup(projectDir);
|
|
1363
|
+
|
|
1364
|
+
return { success: true };
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
/**
|
|
1368
|
+
* Private: Create directory structure
|
|
1369
|
+
*/
|
|
1370
|
+
async createDirectoryStructure(bmadDir) {
|
|
1371
|
+
await fs.ensureDir(bmadDir);
|
|
1372
|
+
await fs.ensureDir(path.join(bmadDir, '_config'));
|
|
1373
|
+
await fs.ensureDir(path.join(bmadDir, '_config', 'agents'));
|
|
1374
|
+
await fs.ensureDir(path.join(bmadDir, '_config', 'custom'));
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
/**
|
|
1378
|
+
* Generate clean config.yaml files for each installed module
|
|
1379
|
+
* @param {string} bmadDir - BMAD installation directory
|
|
1380
|
+
* @param {Object} moduleConfigs - Collected configuration values
|
|
1381
|
+
*/
|
|
1382
|
+
async generateModuleConfigs(bmadDir, moduleConfigs) {
|
|
1383
|
+
const yaml = require('yaml');
|
|
1384
|
+
|
|
1385
|
+
// Extract core config values to share with other modules
|
|
1386
|
+
const coreConfig = moduleConfigs.core || {};
|
|
1387
|
+
|
|
1388
|
+
// Get all installed module directories
|
|
1389
|
+
const entries = await fs.readdir(bmadDir, { withFileTypes: true });
|
|
1390
|
+
const installedModules = entries
|
|
1391
|
+
.filter((entry) => entry.isDirectory() && entry.name !== '_config' && entry.name !== 'docs')
|
|
1392
|
+
.map((entry) => entry.name);
|
|
1393
|
+
|
|
1394
|
+
// Generate config.yaml for each installed module
|
|
1395
|
+
for (const moduleName of installedModules) {
|
|
1396
|
+
const modulePath = path.join(bmadDir, moduleName);
|
|
1397
|
+
|
|
1398
|
+
// Get module-specific config or use empty object if none
|
|
1399
|
+
const config = moduleConfigs[moduleName] || {};
|
|
1400
|
+
|
|
1401
|
+
if (await fs.pathExists(modulePath)) {
|
|
1402
|
+
const configPath = path.join(modulePath, 'config.yaml');
|
|
1403
|
+
|
|
1404
|
+
// Create header
|
|
1405
|
+
const packageJson = require(path.join(getProjectRoot(), 'package.json'));
|
|
1406
|
+
const header = `# ${moduleName.toUpperCase()} Module Configuration
|
|
1407
|
+
# Generated by BMAD installer
|
|
1408
|
+
# Version: ${packageJson.version}
|
|
1409
|
+
# Date: ${new Date().toISOString()}
|
|
1410
|
+
|
|
1411
|
+
`;
|
|
1412
|
+
|
|
1413
|
+
// For non-core modules, add core config values directly
|
|
1414
|
+
let finalConfig = { ...config };
|
|
1415
|
+
let coreSection = '';
|
|
1416
|
+
|
|
1417
|
+
if (moduleName !== 'core' && coreConfig && Object.keys(coreConfig).length > 0) {
|
|
1418
|
+
// Add core values directly to the module config
|
|
1419
|
+
// These will be available for reference in the module
|
|
1420
|
+
finalConfig = {
|
|
1421
|
+
...config,
|
|
1422
|
+
...coreConfig, // Spread core config values directly into the module config
|
|
1423
|
+
};
|
|
1424
|
+
|
|
1425
|
+
// Create a comment section to identify core values
|
|
1426
|
+
coreSection = '\n# Core Configuration Values\n';
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
// Clean the config to remove any non-serializable values (like functions)
|
|
1430
|
+
const cleanConfig = structuredClone(finalConfig);
|
|
1431
|
+
|
|
1432
|
+
// Convert config to YAML
|
|
1433
|
+
let yamlContent = yaml.stringify(cleanConfig, {
|
|
1434
|
+
indent: 2,
|
|
1435
|
+
lineWidth: 0,
|
|
1436
|
+
minContentWidth: 0,
|
|
1437
|
+
});
|
|
1438
|
+
|
|
1439
|
+
// If we have core values, reorganize the YAML to group them with their comment
|
|
1440
|
+
if (coreSection && moduleName !== 'core') {
|
|
1441
|
+
// Split the YAML into lines
|
|
1442
|
+
const lines = yamlContent.split('\n');
|
|
1443
|
+
const moduleConfigLines = [];
|
|
1444
|
+
const coreConfigLines = [];
|
|
1445
|
+
|
|
1446
|
+
// Separate module-specific and core config lines
|
|
1447
|
+
for (const line of lines) {
|
|
1448
|
+
const key = line.split(':')[0].trim();
|
|
1449
|
+
if (Object.prototype.hasOwnProperty.call(coreConfig, key)) {
|
|
1450
|
+
coreConfigLines.push(line);
|
|
1451
|
+
} else {
|
|
1452
|
+
moduleConfigLines.push(line);
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
// Rebuild YAML with module config first, then core config with comment
|
|
1457
|
+
yamlContent = moduleConfigLines.join('\n');
|
|
1458
|
+
if (coreConfigLines.length > 0) {
|
|
1459
|
+
yamlContent += coreSection + coreConfigLines.join('\n');
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
// Write the clean config file with POSIX-compliant final newline
|
|
1464
|
+
const content = header + yamlContent;
|
|
1465
|
+
await fs.writeFile(configPath, content.endsWith('\n') ? content : content + '\n', 'utf8');
|
|
1466
|
+
|
|
1467
|
+
// Track the config file in installedFiles
|
|
1468
|
+
this.installedFiles.add(configPath);
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
/**
|
|
1474
|
+
* Install core with resolved dependencies
|
|
1475
|
+
* @param {string} bmadDir - BMAD installation directory
|
|
1476
|
+
* @param {Object} coreFiles - Core files to install
|
|
1477
|
+
*/
|
|
1478
|
+
async installCoreWithDependencies(bmadDir, coreFiles) {
|
|
1479
|
+
const sourcePath = getModulePath('core');
|
|
1480
|
+
const targetPath = path.join(bmadDir, 'core');
|
|
1481
|
+
await this.installCore(bmadDir);
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
/**
|
|
1485
|
+
* Install module with resolved dependencies
|
|
1486
|
+
* @param {string} moduleName - Module name
|
|
1487
|
+
* @param {string} bmadDir - BMAD installation directory
|
|
1488
|
+
* @param {Object} moduleFiles - Module files to install
|
|
1489
|
+
*/
|
|
1490
|
+
async installModuleWithDependencies(moduleName, bmadDir, moduleFiles) {
|
|
1491
|
+
// Get module configuration for conditional installation
|
|
1492
|
+
const moduleConfig = this.configCollector.collectedConfig[moduleName] || {};
|
|
1493
|
+
|
|
1494
|
+
// Use existing module manager for full installation with file tracking
|
|
1495
|
+
// Note: Module-specific installers are called separately after IDE setup
|
|
1496
|
+
await this.moduleManager.install(
|
|
1497
|
+
moduleName,
|
|
1498
|
+
bmadDir,
|
|
1499
|
+
(filePath) => {
|
|
1500
|
+
this.installedFiles.add(filePath);
|
|
1501
|
+
},
|
|
1502
|
+
{
|
|
1503
|
+
skipModuleInstaller: true, // We'll run it later after IDE setup
|
|
1504
|
+
moduleConfig: moduleConfig, // Pass module config for conditional filtering
|
|
1505
|
+
installer: this,
|
|
1506
|
+
},
|
|
1507
|
+
);
|
|
1508
|
+
|
|
1509
|
+
// Process agent files to build YAML agents and create customize templates
|
|
1510
|
+
const modulePath = path.join(bmadDir, moduleName);
|
|
1511
|
+
await this.processAgentFiles(modulePath, moduleName);
|
|
1512
|
+
|
|
1513
|
+
// Dependencies are already included in full module install
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
/**
|
|
1517
|
+
* Install partial module (only dependencies needed by other modules)
|
|
1518
|
+
*/
|
|
1519
|
+
async installPartialModule(moduleName, bmadDir, files) {
|
|
1520
|
+
const sourceBase = getModulePath(moduleName);
|
|
1521
|
+
const targetBase = path.join(bmadDir, moduleName);
|
|
1522
|
+
|
|
1523
|
+
// Create module directory
|
|
1524
|
+
await fs.ensureDir(targetBase);
|
|
1525
|
+
|
|
1526
|
+
// Copy only the required dependency files
|
|
1527
|
+
if (files.agents && files.agents.length > 0) {
|
|
1528
|
+
const agentsDir = path.join(targetBase, 'agents');
|
|
1529
|
+
await fs.ensureDir(agentsDir);
|
|
1530
|
+
|
|
1531
|
+
for (const agentPath of files.agents) {
|
|
1532
|
+
const fileName = path.basename(agentPath);
|
|
1533
|
+
const sourcePath = path.join(sourceBase, 'agents', fileName);
|
|
1534
|
+
const targetPath = path.join(agentsDir, fileName);
|
|
1535
|
+
|
|
1536
|
+
if (await fs.pathExists(sourcePath)) {
|
|
1537
|
+
await this.copyFileWithPlaceholderReplacement(sourcePath, targetPath);
|
|
1538
|
+
this.installedFiles.add(targetPath);
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
if (files.tasks && files.tasks.length > 0) {
|
|
1544
|
+
const tasksDir = path.join(targetBase, 'tasks');
|
|
1545
|
+
await fs.ensureDir(tasksDir);
|
|
1546
|
+
|
|
1547
|
+
for (const taskPath of files.tasks) {
|
|
1548
|
+
const fileName = path.basename(taskPath);
|
|
1549
|
+
const sourcePath = path.join(sourceBase, 'tasks', fileName);
|
|
1550
|
+
const targetPath = path.join(tasksDir, fileName);
|
|
1551
|
+
|
|
1552
|
+
if (await fs.pathExists(sourcePath)) {
|
|
1553
|
+
await this.copyFileWithPlaceholderReplacement(sourcePath, targetPath);
|
|
1554
|
+
this.installedFiles.add(targetPath);
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
if (files.tools && files.tools.length > 0) {
|
|
1560
|
+
const toolsDir = path.join(targetBase, 'tools');
|
|
1561
|
+
await fs.ensureDir(toolsDir);
|
|
1562
|
+
|
|
1563
|
+
for (const toolPath of files.tools) {
|
|
1564
|
+
const fileName = path.basename(toolPath);
|
|
1565
|
+
const sourcePath = path.join(sourceBase, 'tools', fileName);
|
|
1566
|
+
const targetPath = path.join(toolsDir, fileName);
|
|
1567
|
+
|
|
1568
|
+
if (await fs.pathExists(sourcePath)) {
|
|
1569
|
+
await this.copyFileWithPlaceholderReplacement(sourcePath, targetPath);
|
|
1570
|
+
this.installedFiles.add(targetPath);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
if (files.templates && files.templates.length > 0) {
|
|
1576
|
+
const templatesDir = path.join(targetBase, 'templates');
|
|
1577
|
+
await fs.ensureDir(templatesDir);
|
|
1578
|
+
|
|
1579
|
+
for (const templatePath of files.templates) {
|
|
1580
|
+
const fileName = path.basename(templatePath);
|
|
1581
|
+
const sourcePath = path.join(sourceBase, 'templates', fileName);
|
|
1582
|
+
const targetPath = path.join(templatesDir, fileName);
|
|
1583
|
+
|
|
1584
|
+
if (await fs.pathExists(sourcePath)) {
|
|
1585
|
+
await this.copyFileWithPlaceholderReplacement(sourcePath, targetPath);
|
|
1586
|
+
this.installedFiles.add(targetPath);
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
if (files.data && files.data.length > 0) {
|
|
1592
|
+
for (const dataPath of files.data) {
|
|
1593
|
+
// Preserve directory structure for data files
|
|
1594
|
+
const relative = path.relative(sourceBase, dataPath);
|
|
1595
|
+
const targetPath = path.join(targetBase, relative);
|
|
1596
|
+
|
|
1597
|
+
await fs.ensureDir(path.dirname(targetPath));
|
|
1598
|
+
|
|
1599
|
+
if (await fs.pathExists(dataPath)) {
|
|
1600
|
+
await this.copyFileWithPlaceholderReplacement(dataPath, targetPath);
|
|
1601
|
+
this.installedFiles.add(targetPath);
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
// Create a marker file to indicate this is a partial installation
|
|
1607
|
+
const markerPath = path.join(targetBase, '.partial');
|
|
1608
|
+
await fs.writeFile(
|
|
1609
|
+
markerPath,
|
|
1610
|
+
`This module contains only dependencies required by other modules.\nInstalled: ${new Date().toISOString()}\n`,
|
|
1611
|
+
);
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* Private: Install core
|
|
1616
|
+
* @param {string} bmadDir - BMAD installation directory
|
|
1617
|
+
*/
|
|
1618
|
+
async installCore(bmadDir) {
|
|
1619
|
+
const sourcePath = getModulePath('core');
|
|
1620
|
+
const targetPath = path.join(bmadDir, 'core');
|
|
1621
|
+
|
|
1622
|
+
// Copy core files (skip .agent.yaml files like modules do)
|
|
1623
|
+
await this.copyCoreFiles(sourcePath, targetPath);
|
|
1624
|
+
|
|
1625
|
+
// Compile agents using the same compiler as modules
|
|
1626
|
+
const { ModuleManager } = require('../modules/manager');
|
|
1627
|
+
const moduleManager = new ModuleManager();
|
|
1628
|
+
await moduleManager.compileModuleAgents(sourcePath, targetPath, 'core', bmadDir, this);
|
|
1629
|
+
|
|
1630
|
+
// Process agent files to inject activation block
|
|
1631
|
+
await this.processAgentFiles(targetPath, 'core');
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
/**
|
|
1635
|
+
* Copy core files (similar to copyModuleWithFiltering but for core)
|
|
1636
|
+
* @param {string} sourcePath - Source path
|
|
1637
|
+
* @param {string} targetPath - Target path
|
|
1638
|
+
*/
|
|
1639
|
+
async copyCoreFiles(sourcePath, targetPath) {
|
|
1640
|
+
// Get all files in source
|
|
1641
|
+
const files = await this.getFileList(sourcePath);
|
|
1642
|
+
|
|
1643
|
+
for (const file of files) {
|
|
1644
|
+
// Skip sub-modules directory - these are IDE-specific and handled separately
|
|
1645
|
+
if (file.startsWith('sub-modules/')) {
|
|
1646
|
+
continue;
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
// Skip sidecar directories - they are handled separately during agent compilation
|
|
1650
|
+
if (
|
|
1651
|
+
path
|
|
1652
|
+
.dirname(file)
|
|
1653
|
+
.split('/')
|
|
1654
|
+
.some((dir) => dir.toLowerCase().includes('sidecar'))
|
|
1655
|
+
) {
|
|
1656
|
+
continue;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
// Skip _module-installer directory - it's only needed at install time
|
|
1660
|
+
if (file.startsWith('_module-installer/') || file === 'module.yaml') {
|
|
1661
|
+
continue;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
// Skip config.yaml templates - we'll generate clean ones with actual values
|
|
1665
|
+
if (file === 'config.yaml' || file.endsWith('/config.yaml') || file === 'custom.yaml' || file.endsWith('/custom.yaml')) {
|
|
1666
|
+
continue;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
// Skip .agent.yaml files - they will be compiled separately
|
|
1670
|
+
if (file.endsWith('.agent.yaml')) {
|
|
1671
|
+
continue;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
const sourceFile = path.join(sourcePath, file);
|
|
1675
|
+
const targetFile = path.join(targetPath, file);
|
|
1676
|
+
|
|
1677
|
+
// Check if this is an agent file
|
|
1678
|
+
if (file.startsWith('agents/') && file.endsWith('.md')) {
|
|
1679
|
+
// Read the file to check for localskip
|
|
1680
|
+
const content = await fs.readFile(sourceFile, 'utf8');
|
|
1681
|
+
|
|
1682
|
+
// Check for localskip="true" in the agent tag
|
|
1683
|
+
const agentMatch = content.match(/<agent[^>]*\slocalskip="true"[^>]*>/);
|
|
1684
|
+
if (agentMatch) {
|
|
1685
|
+
console.log(chalk.dim(` Skipping web-only agent: ${path.basename(file)}`));
|
|
1686
|
+
continue; // Skip this agent
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
// Copy the file with placeholder replacement
|
|
1691
|
+
await fs.ensureDir(path.dirname(targetFile));
|
|
1692
|
+
await this.copyFileWithPlaceholderReplacement(sourceFile, targetFile);
|
|
1693
|
+
|
|
1694
|
+
// Track the installed file
|
|
1695
|
+
this.installedFiles.add(targetFile);
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
/**
|
|
1700
|
+
* Get list of all files in a directory recursively
|
|
1701
|
+
* @param {string} dir - Directory path
|
|
1702
|
+
* @param {string} baseDir - Base directory for relative paths
|
|
1703
|
+
* @returns {Array} List of relative file paths
|
|
1704
|
+
*/
|
|
1705
|
+
async getFileList(dir, baseDir = dir) {
|
|
1706
|
+
const files = [];
|
|
1707
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
1708
|
+
|
|
1709
|
+
for (const entry of entries) {
|
|
1710
|
+
const fullPath = path.join(dir, entry.name);
|
|
1711
|
+
|
|
1712
|
+
if (entry.isDirectory()) {
|
|
1713
|
+
// Skip _module-installer directories
|
|
1714
|
+
if (entry.name === '_module-installer') {
|
|
1715
|
+
continue;
|
|
1716
|
+
}
|
|
1717
|
+
const subFiles = await this.getFileList(fullPath, baseDir);
|
|
1718
|
+
files.push(...subFiles);
|
|
1719
|
+
} else {
|
|
1720
|
+
files.push(path.relative(baseDir, fullPath));
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
return files;
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
/**
|
|
1728
|
+
* Process agent files to build YAML agents and inject activation blocks
|
|
1729
|
+
* @param {string} modulePath - Path to module in bmad/ installation
|
|
1730
|
+
* @param {string} moduleName - Module name
|
|
1731
|
+
*/
|
|
1732
|
+
async processAgentFiles(modulePath, moduleName) {
|
|
1733
|
+
const agentsPath = path.join(modulePath, 'agents');
|
|
1734
|
+
|
|
1735
|
+
// Check if agents directory exists
|
|
1736
|
+
if (!(await fs.pathExists(agentsPath))) {
|
|
1737
|
+
return; // No agents to process
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
// Determine project directory (parent of bmad/ directory)
|
|
1741
|
+
const bmadDir = path.dirname(modulePath);
|
|
1742
|
+
const cfgAgentsDir = path.join(bmadDir, '_config', 'agents');
|
|
1743
|
+
|
|
1744
|
+
// Ensure _config/agents directory exists
|
|
1745
|
+
await fs.ensureDir(cfgAgentsDir);
|
|
1746
|
+
|
|
1747
|
+
// Get all agent files
|
|
1748
|
+
const agentFiles = await fs.readdir(agentsPath);
|
|
1749
|
+
|
|
1750
|
+
for (const agentFile of agentFiles) {
|
|
1751
|
+
// Skip .agent.yaml files - they should already be compiled by compileModuleAgents
|
|
1752
|
+
if (agentFile.endsWith('.agent.yaml')) {
|
|
1753
|
+
continue;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
// Only process .md files (already compiled from YAML)
|
|
1757
|
+
if (!agentFile.endsWith('.md')) {
|
|
1758
|
+
continue;
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
const agentName = agentFile.replace('.md', '');
|
|
1762
|
+
const mdPath = path.join(agentsPath, agentFile);
|
|
1763
|
+
const customizePath = path.join(cfgAgentsDir, `${moduleName}-${agentName}.customize.yaml`);
|
|
1764
|
+
|
|
1765
|
+
// For .md files that are already compiled, we don't need to do much
|
|
1766
|
+
// Just ensure the customize template exists
|
|
1767
|
+
if (!(await fs.pathExists(customizePath))) {
|
|
1768
|
+
const genericTemplatePath = getSourcePath('utility', 'agent-components', 'agent.customize.template.yaml');
|
|
1769
|
+
if (await fs.pathExists(genericTemplatePath)) {
|
|
1770
|
+
await this.copyFileWithPlaceholderReplacement(genericTemplatePath, customizePath);
|
|
1771
|
+
if (process.env.BMAD_VERBOSE_INSTALL === 'true') {
|
|
1772
|
+
console.log(chalk.dim(` Created customize: ${moduleName}-${agentName}.customize.yaml`));
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
/**
|
|
1780
|
+
* Private: Update core
|
|
1781
|
+
*/
|
|
1782
|
+
async updateCore(bmadDir, force = false) {
|
|
1783
|
+
const sourcePath = getModulePath('core');
|
|
1784
|
+
const targetPath = path.join(bmadDir, 'core');
|
|
1785
|
+
|
|
1786
|
+
if (force) {
|
|
1787
|
+
await fs.remove(targetPath);
|
|
1788
|
+
await this.installCore(bmadDir);
|
|
1789
|
+
} else {
|
|
1790
|
+
// Selective update - preserve user modifications
|
|
1791
|
+
await this.fileOps.syncDirectory(sourcePath, targetPath);
|
|
1792
|
+
|
|
1793
|
+
// Recompile agents (#1133)
|
|
1794
|
+
const { ModuleManager } = require('../modules/manager');
|
|
1795
|
+
const moduleManager = new ModuleManager();
|
|
1796
|
+
await moduleManager.compileModuleAgents(sourcePath, targetPath, 'core', bmadDir, this);
|
|
1797
|
+
await this.processAgentFiles(targetPath, 'core');
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
/**
|
|
1802
|
+
* Quick update method - preserves all settings and only prompts for new config fields
|
|
1803
|
+
* @param {Object} config - Configuration with directory
|
|
1804
|
+
* @returns {Object} Update result
|
|
1805
|
+
*/
|
|
1806
|
+
async quickUpdate(config) {
|
|
1807
|
+
const ora = require('ora');
|
|
1808
|
+
const spinner = ora('Starting quick update...').start();
|
|
1809
|
+
|
|
1810
|
+
try {
|
|
1811
|
+
const projectDir = path.resolve(config.directory);
|
|
1812
|
+
const { bmadDir } = await this.findBmadDir(projectDir);
|
|
1813
|
+
|
|
1814
|
+
// Check if bmad directory exists
|
|
1815
|
+
if (!(await fs.pathExists(bmadDir))) {
|
|
1816
|
+
spinner.fail('No BMAD installation found');
|
|
1817
|
+
throw new Error(`BMAD not installed at ${bmadDir}. Use regular install for first-time setup.`);
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
spinner.text = 'Detecting installed modules and configuration...';
|
|
1821
|
+
|
|
1822
|
+
// Detect existing installation
|
|
1823
|
+
const existingInstall = await this.detector.detect(bmadDir);
|
|
1824
|
+
const installedModules = existingInstall.modules.map((m) => m.id);
|
|
1825
|
+
const configuredIdes = existingInstall.ides || [];
|
|
1826
|
+
const projectRoot = path.dirname(bmadDir);
|
|
1827
|
+
|
|
1828
|
+
// Get custom module sources from cache
|
|
1829
|
+
const customModuleSources = new Map();
|
|
1830
|
+
const cacheDir = path.join(bmadDir, '_config', 'custom');
|
|
1831
|
+
if (await fs.pathExists(cacheDir)) {
|
|
1832
|
+
const cachedModules = await fs.readdir(cacheDir, { withFileTypes: true });
|
|
1833
|
+
|
|
1834
|
+
for (const cachedModule of cachedModules) {
|
|
1835
|
+
if (cachedModule.isDirectory()) {
|
|
1836
|
+
const moduleId = cachedModule.name;
|
|
1837
|
+
|
|
1838
|
+
// Skip if we already have this module from manifest
|
|
1839
|
+
if (customModuleSources.has(moduleId)) {
|
|
1840
|
+
continue;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
// Check if this is an external official module - skip cache for those
|
|
1844
|
+
const isExternal = await this.moduleManager.isExternalModule(moduleId);
|
|
1845
|
+
if (isExternal) {
|
|
1846
|
+
// External modules are handled via cloneExternalModule, not from cache
|
|
1847
|
+
continue;
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
const cachedPath = path.join(cacheDir, moduleId);
|
|
1851
|
+
|
|
1852
|
+
// Check if this is actually a custom module (has module.yaml)
|
|
1853
|
+
const moduleYamlPath = path.join(cachedPath, 'module.yaml');
|
|
1854
|
+
if (await fs.pathExists(moduleYamlPath)) {
|
|
1855
|
+
// For quick update, we always rebuild from cache
|
|
1856
|
+
customModuleSources.set(moduleId, {
|
|
1857
|
+
id: moduleId,
|
|
1858
|
+
name: moduleId, // We'll read the actual name if needed
|
|
1859
|
+
sourcePath: cachedPath,
|
|
1860
|
+
cached: true, // Flag to indicate this is from cache
|
|
1861
|
+
});
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
// Load saved IDE configurations
|
|
1868
|
+
const savedIdeConfigs = await this.ideConfigManager.loadAllIdeConfigs(bmadDir);
|
|
1869
|
+
|
|
1870
|
+
// Get available modules (what we have source for)
|
|
1871
|
+
const availableModulesData = await this.moduleManager.listAvailable();
|
|
1872
|
+
const availableModules = [...availableModulesData.modules, ...availableModulesData.customModules];
|
|
1873
|
+
|
|
1874
|
+
// Add external official modules to available modules
|
|
1875
|
+
// These can always be obtained by cloning from their remote URLs
|
|
1876
|
+
const { ExternalModuleManager } = require('../modules/external-manager');
|
|
1877
|
+
const externalManager = new ExternalModuleManager();
|
|
1878
|
+
const externalModules = await externalManager.listAvailable();
|
|
1879
|
+
for (const externalModule of externalModules) {
|
|
1880
|
+
// Only add if not already in the list and is installed
|
|
1881
|
+
if (installedModules.includes(externalModule.code) && !availableModules.some((m) => m.id === externalModule.code)) {
|
|
1882
|
+
availableModules.push({
|
|
1883
|
+
id: externalModule.code,
|
|
1884
|
+
name: externalModule.name,
|
|
1885
|
+
isExternal: true,
|
|
1886
|
+
fromExternal: true,
|
|
1887
|
+
});
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
// Add custom modules from manifest if their sources exist
|
|
1892
|
+
for (const [moduleId, customModule] of customModuleSources) {
|
|
1893
|
+
// Use the absolute sourcePath
|
|
1894
|
+
const sourcePath = customModule.sourcePath;
|
|
1895
|
+
|
|
1896
|
+
// Check if source exists at the recorded path
|
|
1897
|
+
if (
|
|
1898
|
+
sourcePath &&
|
|
1899
|
+
(await fs.pathExists(sourcePath)) && // Add to available modules if not already there
|
|
1900
|
+
!availableModules.some((m) => m.id === moduleId)
|
|
1901
|
+
) {
|
|
1902
|
+
availableModules.push({
|
|
1903
|
+
id: moduleId,
|
|
1904
|
+
name: customModule.name || moduleId,
|
|
1905
|
+
path: sourcePath,
|
|
1906
|
+
isCustom: true,
|
|
1907
|
+
fromManifest: true,
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
// Handle missing custom module sources using shared method
|
|
1913
|
+
const customModuleResult = await this.handleMissingCustomSources(
|
|
1914
|
+
customModuleSources,
|
|
1915
|
+
bmadDir,
|
|
1916
|
+
projectRoot,
|
|
1917
|
+
'update',
|
|
1918
|
+
installedModules,
|
|
1919
|
+
);
|
|
1920
|
+
|
|
1921
|
+
const { validCustomModules, keptModulesWithoutSources } = customModuleResult;
|
|
1922
|
+
|
|
1923
|
+
const customModulesFromManifest = validCustomModules.map((m) => ({
|
|
1924
|
+
...m,
|
|
1925
|
+
isCustom: true,
|
|
1926
|
+
hasUpdate: true,
|
|
1927
|
+
}));
|
|
1928
|
+
|
|
1929
|
+
const allAvailableModules = [...availableModules, ...customModulesFromManifest];
|
|
1930
|
+
const availableModuleIds = new Set(allAvailableModules.map((m) => m.id));
|
|
1931
|
+
|
|
1932
|
+
// Core module is special - never include it in update flow
|
|
1933
|
+
const nonCoreInstalledModules = installedModules.filter((id) => id !== 'core');
|
|
1934
|
+
|
|
1935
|
+
// Only update modules that are BOTH installed AND available (we have source for)
|
|
1936
|
+
const modulesToUpdate = nonCoreInstalledModules.filter((id) => availableModuleIds.has(id));
|
|
1937
|
+
const skippedModules = nonCoreInstalledModules.filter((id) => !availableModuleIds.has(id));
|
|
1938
|
+
|
|
1939
|
+
// Add custom modules that were kept without sources to the skipped modules
|
|
1940
|
+
// This ensures their agents are preserved in the manifest
|
|
1941
|
+
for (const keptModule of keptModulesWithoutSources) {
|
|
1942
|
+
if (!skippedModules.includes(keptModule)) {
|
|
1943
|
+
skippedModules.push(keptModule);
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
spinner.succeed(`Found ${modulesToUpdate.length} module(s) to update and ${configuredIdes.length} configured tool(s)`);
|
|
1948
|
+
|
|
1949
|
+
if (skippedModules.length > 0) {
|
|
1950
|
+
console.log(chalk.yellow(`⚠️ Skipping ${skippedModules.length} module(s) - no source available: ${skippedModules.join(', ')}`));
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
// Load existing configs and collect new fields (if any)
|
|
1954
|
+
console.log(chalk.cyan('\n📋 Checking for new configuration options...'));
|
|
1955
|
+
await this.configCollector.loadExistingConfig(projectDir);
|
|
1956
|
+
|
|
1957
|
+
let promptedForNewFields = false;
|
|
1958
|
+
|
|
1959
|
+
// Check core config for new fields
|
|
1960
|
+
const corePrompted = await this.configCollector.collectModuleConfigQuick('core', projectDir, true);
|
|
1961
|
+
if (corePrompted) {
|
|
1962
|
+
promptedForNewFields = true;
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
// Check each module we're updating for new fields (NOT skipped modules)
|
|
1966
|
+
for (const moduleName of modulesToUpdate) {
|
|
1967
|
+
const modulePrompted = await this.configCollector.collectModuleConfigQuick(moduleName, projectDir, true);
|
|
1968
|
+
if (modulePrompted) {
|
|
1969
|
+
promptedForNewFields = true;
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
if (!promptedForNewFields) {
|
|
1974
|
+
console.log(chalk.green('✓ All configuration is up to date, no new options to configure'));
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
// Add metadata
|
|
1978
|
+
this.configCollector.collectedConfig._meta = {
|
|
1979
|
+
version: require(path.join(getProjectRoot(), 'package.json')).version,
|
|
1980
|
+
installDate: new Date().toISOString(),
|
|
1981
|
+
lastModified: new Date().toISOString(),
|
|
1982
|
+
};
|
|
1983
|
+
|
|
1984
|
+
// Build the config object for the installer
|
|
1985
|
+
const installConfig = {
|
|
1986
|
+
directory: projectDir,
|
|
1987
|
+
installCore: true,
|
|
1988
|
+
modules: modulesToUpdate, // Only update modules we have source for
|
|
1989
|
+
ides: configuredIdes,
|
|
1990
|
+
skipIde: configuredIdes.length === 0,
|
|
1991
|
+
coreConfig: this.configCollector.collectedConfig.core,
|
|
1992
|
+
actionType: 'install', // Use regular install flow
|
|
1993
|
+
_quickUpdate: true, // Flag to skip certain prompts
|
|
1994
|
+
_preserveModules: skippedModules, // Preserve these in manifest even though we didn't update them
|
|
1995
|
+
_savedIdeConfigs: savedIdeConfigs, // Pass saved IDE configs to installer
|
|
1996
|
+
_customModuleSources: customModuleSources, // Pass custom module sources for updates
|
|
1997
|
+
_existingModules: installedModules, // Pass all installed modules for manifest generation
|
|
1998
|
+
};
|
|
1999
|
+
|
|
2000
|
+
// Call the standard install method
|
|
2001
|
+
const result = await this.install(installConfig);
|
|
2002
|
+
|
|
2003
|
+
// Only succeed the spinner if it's still spinning
|
|
2004
|
+
// (install method might have stopped it if folder name changed)
|
|
2005
|
+
if (spinner.isSpinning) {
|
|
2006
|
+
spinner.succeed('Quick update complete!');
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
return {
|
|
2010
|
+
success: true,
|
|
2011
|
+
moduleCount: modulesToUpdate.length + 1, // +1 for core
|
|
2012
|
+
hadNewFields: promptedForNewFields,
|
|
2013
|
+
modules: ['core', ...modulesToUpdate],
|
|
2014
|
+
skippedModules: skippedModules,
|
|
2015
|
+
ides: configuredIdes,
|
|
2016
|
+
};
|
|
2017
|
+
} catch (error) {
|
|
2018
|
+
spinner.fail('Quick update failed');
|
|
2019
|
+
throw error;
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
/**
|
|
2024
|
+
* Compile agents with customizations only
|
|
2025
|
+
* @param {Object} config - Configuration with directory
|
|
2026
|
+
* @returns {Object} Compilation result
|
|
2027
|
+
*/
|
|
2028
|
+
async compileAgents(config) {
|
|
2029
|
+
const ora = require('ora');
|
|
2030
|
+
const chalk = require('chalk');
|
|
2031
|
+
const { ModuleManager } = require('../modules/manager');
|
|
2032
|
+
const { getSourcePath } = require('../../../lib/project-root');
|
|
2033
|
+
|
|
2034
|
+
const spinner = ora('Recompiling agents with customizations...').start();
|
|
2035
|
+
|
|
2036
|
+
try {
|
|
2037
|
+
const projectDir = path.resolve(config.directory);
|
|
2038
|
+
const { bmadDir } = await this.findBmadDir(projectDir);
|
|
2039
|
+
|
|
2040
|
+
// Check if bmad directory exists
|
|
2041
|
+
if (!(await fs.pathExists(bmadDir))) {
|
|
2042
|
+
spinner.fail('No BMAD installation found');
|
|
2043
|
+
throw new Error(`BMAD not installed at ${bmadDir}. Use regular install for first-time setup.`);
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
// Detect existing installation
|
|
2047
|
+
const existingInstall = await this.detector.detect(bmadDir);
|
|
2048
|
+
const installedModules = existingInstall.modules.map((m) => m.id);
|
|
2049
|
+
|
|
2050
|
+
// Initialize module manager
|
|
2051
|
+
const moduleManager = new ModuleManager();
|
|
2052
|
+
moduleManager.setBmadFolderName(path.basename(bmadDir));
|
|
2053
|
+
|
|
2054
|
+
let totalAgentCount = 0;
|
|
2055
|
+
|
|
2056
|
+
// Get custom module sources from cache
|
|
2057
|
+
const customModuleSources = new Map();
|
|
2058
|
+
const cacheDir = path.join(bmadDir, '_config', 'custom');
|
|
2059
|
+
if (await fs.pathExists(cacheDir)) {
|
|
2060
|
+
const cachedModules = await fs.readdir(cacheDir, { withFileTypes: true });
|
|
2061
|
+
|
|
2062
|
+
for (const cachedModule of cachedModules) {
|
|
2063
|
+
if (cachedModule.isDirectory()) {
|
|
2064
|
+
const moduleId = cachedModule.name;
|
|
2065
|
+
const cachedPath = path.join(cacheDir, moduleId);
|
|
2066
|
+
const moduleYamlPath = path.join(cachedPath, 'module.yaml');
|
|
2067
|
+
|
|
2068
|
+
// Check if this is actually a custom module
|
|
2069
|
+
if (await fs.pathExists(moduleYamlPath)) {
|
|
2070
|
+
// Check if this is an external official module - skip cache for those
|
|
2071
|
+
const isExternal = await this.moduleManager.isExternalModule(moduleId);
|
|
2072
|
+
if (isExternal) {
|
|
2073
|
+
// External modules are handled via cloneExternalModule, not from cache
|
|
2074
|
+
continue;
|
|
2075
|
+
}
|
|
2076
|
+
customModuleSources.set(moduleId, cachedPath);
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
// Process each installed module
|
|
2083
|
+
for (const moduleId of installedModules) {
|
|
2084
|
+
spinner.text = `Recompiling agents in ${moduleId}...`;
|
|
2085
|
+
|
|
2086
|
+
// Get source path
|
|
2087
|
+
let sourcePath;
|
|
2088
|
+
if (moduleId === 'core') {
|
|
2089
|
+
sourcePath = getSourcePath('core');
|
|
2090
|
+
} else {
|
|
2091
|
+
// First check if it's in the custom cache
|
|
2092
|
+
if (customModuleSources.has(moduleId)) {
|
|
2093
|
+
sourcePath = customModuleSources.get(moduleId);
|
|
2094
|
+
} else {
|
|
2095
|
+
sourcePath = await moduleManager.findModuleSource(moduleId);
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
if (!sourcePath) {
|
|
2100
|
+
console.log(chalk.yellow(` Warning: Source not found for module ${moduleId}, skipping...`));
|
|
2101
|
+
continue;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
const targetPath = path.join(bmadDir, moduleId);
|
|
2105
|
+
|
|
2106
|
+
// Compile agents for this module
|
|
2107
|
+
await moduleManager.compileModuleAgents(sourcePath, targetPath, moduleId, bmadDir, this);
|
|
2108
|
+
|
|
2109
|
+
// Count agents (rough estimate based on files)
|
|
2110
|
+
const agentsPath = path.join(targetPath, 'agents');
|
|
2111
|
+
if (await fs.pathExists(agentsPath)) {
|
|
2112
|
+
const agentFiles = await fs.readdir(agentsPath);
|
|
2113
|
+
const agentCount = agentFiles.filter((f) => f.endsWith('.md')).length;
|
|
2114
|
+
totalAgentCount += agentCount;
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
spinner.succeed('Agent recompilation complete!');
|
|
2119
|
+
|
|
2120
|
+
return {
|
|
2121
|
+
success: true,
|
|
2122
|
+
agentCount: totalAgentCount,
|
|
2123
|
+
modules: installedModules,
|
|
2124
|
+
};
|
|
2125
|
+
} catch (error) {
|
|
2126
|
+
spinner.fail('Agent recompilation failed');
|
|
2127
|
+
throw error;
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
/**
|
|
2132
|
+
* Private: Prompt for update action
|
|
2133
|
+
*/
|
|
2134
|
+
async promptUpdateAction() {
|
|
2135
|
+
const action = await prompts.select({
|
|
2136
|
+
message: 'What would you like to do?',
|
|
2137
|
+
choices: [{ name: 'Update existing installation', value: 'update' }],
|
|
2138
|
+
});
|
|
2139
|
+
return { action };
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
/**
|
|
2143
|
+
* Handle legacy BMAD v4 detection with simple warning
|
|
2144
|
+
* @param {string} _projectDir - Project directory (unused in simplified version)
|
|
2145
|
+
* @param {Object} _legacyV4 - Legacy V4 detection result (unused in simplified version)
|
|
2146
|
+
*/
|
|
2147
|
+
async handleLegacyV4Migration(_projectDir, _legacyV4) {
|
|
2148
|
+
console.log('');
|
|
2149
|
+
console.log(chalk.yellow.bold('⚠️ Legacy BMAD v4 detected'));
|
|
2150
|
+
console.log(chalk.yellow('─'.repeat(80)));
|
|
2151
|
+
console.log(chalk.yellow('Found .bmad-method folder from BMAD v4 installation.'));
|
|
2152
|
+
console.log('');
|
|
2153
|
+
|
|
2154
|
+
console.log(chalk.dim('Before continuing with installation, we recommend:'));
|
|
2155
|
+
console.log(chalk.dim(' 1. Remove the .bmad-method folder, OR'));
|
|
2156
|
+
console.log(chalk.dim(' 2. Back it up by renaming it to another name (e.g., bmad-method-backup)'));
|
|
2157
|
+
console.log('');
|
|
2158
|
+
|
|
2159
|
+
console.log(chalk.dim('If your v4 installation set up rules or commands, you should remove those as well.'));
|
|
2160
|
+
console.log('');
|
|
2161
|
+
|
|
2162
|
+
const proceed = await prompts.select({
|
|
2163
|
+
message: 'What would you like to do?',
|
|
2164
|
+
choices: [
|
|
2165
|
+
{
|
|
2166
|
+
name: 'Exit and clean up manually (recommended)',
|
|
2167
|
+
value: 'exit',
|
|
2168
|
+
hint: 'Exit installation',
|
|
2169
|
+
},
|
|
2170
|
+
{
|
|
2171
|
+
name: 'Continue with installation anyway',
|
|
2172
|
+
value: 'continue',
|
|
2173
|
+
hint: 'Continue',
|
|
2174
|
+
},
|
|
2175
|
+
],
|
|
2176
|
+
default: 'exit',
|
|
2177
|
+
});
|
|
2178
|
+
|
|
2179
|
+
if (proceed === 'exit') {
|
|
2180
|
+
console.log('');
|
|
2181
|
+
console.log(chalk.cyan('Please remove the .bmad-method folder and any v4 rules/commands,'));
|
|
2182
|
+
console.log(chalk.cyan('then run the installer again.'));
|
|
2183
|
+
console.log('');
|
|
2184
|
+
process.exit(0);
|
|
2185
|
+
}
|
|
2186
|
+
|
|
2187
|
+
console.log('');
|
|
2188
|
+
console.log(chalk.yellow('⚠️ Proceeding with installation despite legacy v4 folder'));
|
|
2189
|
+
console.log('');
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
/**
|
|
2193
|
+
* Read files-manifest.csv
|
|
2194
|
+
* @param {string} bmadDir - BMAD installation directory
|
|
2195
|
+
* @returns {Array} Array of file entries from files-manifest.csv
|
|
2196
|
+
*/
|
|
2197
|
+
async readFilesManifest(bmadDir) {
|
|
2198
|
+
const filesManifestPath = path.join(bmadDir, '_config', 'files-manifest.csv');
|
|
2199
|
+
if (!(await fs.pathExists(filesManifestPath))) {
|
|
2200
|
+
return [];
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
try {
|
|
2204
|
+
const content = await fs.readFile(filesManifestPath, 'utf8');
|
|
2205
|
+
const lines = content.split('\n');
|
|
2206
|
+
const files = [];
|
|
2207
|
+
|
|
2208
|
+
for (let i = 1; i < lines.length; i++) {
|
|
2209
|
+
// Skip header
|
|
2210
|
+
const line = lines[i].trim();
|
|
2211
|
+
if (!line) continue;
|
|
2212
|
+
|
|
2213
|
+
// Parse CSV line properly handling quoted values
|
|
2214
|
+
const parts = [];
|
|
2215
|
+
let current = '';
|
|
2216
|
+
let inQuotes = false;
|
|
2217
|
+
|
|
2218
|
+
for (const char of line) {
|
|
2219
|
+
if (char === '"') {
|
|
2220
|
+
inQuotes = !inQuotes;
|
|
2221
|
+
} else if (char === ',' && !inQuotes) {
|
|
2222
|
+
parts.push(current);
|
|
2223
|
+
current = '';
|
|
2224
|
+
} else {
|
|
2225
|
+
current += char;
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
parts.push(current); // Add last part
|
|
2229
|
+
|
|
2230
|
+
if (parts.length >= 4) {
|
|
2231
|
+
files.push({
|
|
2232
|
+
type: parts[0],
|
|
2233
|
+
name: parts[1],
|
|
2234
|
+
module: parts[2],
|
|
2235
|
+
path: parts[3],
|
|
2236
|
+
hash: parts[4] || null, // Hash may not exist in old manifests
|
|
2237
|
+
});
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
return files;
|
|
2242
|
+
} catch (error) {
|
|
2243
|
+
console.warn('Warning: Could not read files-manifest.csv:', error.message);
|
|
2244
|
+
return [];
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
|
|
2248
|
+
/**
|
|
2249
|
+
* Detect custom and modified files
|
|
2250
|
+
* @param {string} bmadDir - BMAD installation directory
|
|
2251
|
+
* @param {Array} existingFilesManifest - Previous files from files-manifest.csv
|
|
2252
|
+
* @returns {Object} Object with customFiles and modifiedFiles arrays
|
|
2253
|
+
*/
|
|
2254
|
+
async detectCustomFiles(bmadDir, existingFilesManifest) {
|
|
2255
|
+
const customFiles = [];
|
|
2256
|
+
const modifiedFiles = [];
|
|
2257
|
+
|
|
2258
|
+
// Memory is always in _bmad/_memory
|
|
2259
|
+
const bmadMemoryPath = '_memory';
|
|
2260
|
+
|
|
2261
|
+
// Check if the manifest has hashes - if not, we can't detect modifications
|
|
2262
|
+
let manifestHasHashes = false;
|
|
2263
|
+
if (existingFilesManifest && existingFilesManifest.length > 0) {
|
|
2264
|
+
manifestHasHashes = existingFilesManifest.some((f) => f.hash);
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
// Build map of previously installed files from files-manifest.csv with their hashes
|
|
2268
|
+
const installedFilesMap = new Map();
|
|
2269
|
+
for (const fileEntry of existingFilesManifest) {
|
|
2270
|
+
if (fileEntry.path) {
|
|
2271
|
+
const absolutePath = path.join(bmadDir, fileEntry.path);
|
|
2272
|
+
installedFilesMap.set(path.normalize(absolutePath), {
|
|
2273
|
+
hash: fileEntry.hash,
|
|
2274
|
+
relativePath: fileEntry.path,
|
|
2275
|
+
});
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
// Recursively scan bmadDir for all files
|
|
2280
|
+
const scanDirectory = async (dir) => {
|
|
2281
|
+
try {
|
|
2282
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
2283
|
+
for (const entry of entries) {
|
|
2284
|
+
const fullPath = path.join(dir, entry.name);
|
|
2285
|
+
|
|
2286
|
+
if (entry.isDirectory()) {
|
|
2287
|
+
// Skip certain directories
|
|
2288
|
+
if (entry.name === 'node_modules' || entry.name === '.git') {
|
|
2289
|
+
continue;
|
|
2290
|
+
}
|
|
2291
|
+
await scanDirectory(fullPath);
|
|
2292
|
+
} else if (entry.isFile()) {
|
|
2293
|
+
const normalizedPath = path.normalize(fullPath);
|
|
2294
|
+
const fileInfo = installedFilesMap.get(normalizedPath);
|
|
2295
|
+
|
|
2296
|
+
// Skip certain system files that are auto-generated
|
|
2297
|
+
const relativePath = path.relative(bmadDir, fullPath);
|
|
2298
|
+
const fileName = path.basename(fullPath);
|
|
2299
|
+
|
|
2300
|
+
// Skip _config directory EXCEPT for modified agent customizations
|
|
2301
|
+
if (relativePath.startsWith('_config/') || relativePath.startsWith('_config\\')) {
|
|
2302
|
+
// Special handling for .customize.yaml files - only preserve if modified
|
|
2303
|
+
if (relativePath.includes('/agents/') && fileName.endsWith('.customize.yaml')) {
|
|
2304
|
+
// Check if the customization file has been modified from manifest
|
|
2305
|
+
const manifestPath = path.join(bmadDir, '_config', 'manifest.yaml');
|
|
2306
|
+
if (await fs.pathExists(manifestPath)) {
|
|
2307
|
+
const crypto = require('node:crypto');
|
|
2308
|
+
const currentContent = await fs.readFile(fullPath, 'utf8');
|
|
2309
|
+
const currentHash = crypto.createHash('sha256').update(currentContent).digest('hex');
|
|
2310
|
+
|
|
2311
|
+
const yaml = require('yaml');
|
|
2312
|
+
const manifestContent = await fs.readFile(manifestPath, 'utf8');
|
|
2313
|
+
const manifestData = yaml.parse(manifestContent);
|
|
2314
|
+
const originalHash = manifestData.agentCustomizations?.[relativePath];
|
|
2315
|
+
|
|
2316
|
+
// Only add to customFiles if hash differs (user modified)
|
|
2317
|
+
if (originalHash && currentHash !== originalHash) {
|
|
2318
|
+
customFiles.push(fullPath);
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
continue;
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
if (relativePath.startsWith(bmadMemoryPath + '/') && path.dirname(relativePath).includes('-sidecar')) {
|
|
2326
|
+
continue;
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
// Skip config.yaml files - these are regenerated on each install/update
|
|
2330
|
+
if (fileName === 'config.yaml') {
|
|
2331
|
+
continue;
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
if (!fileInfo) {
|
|
2335
|
+
// File not in manifest = custom file
|
|
2336
|
+
// EXCEPT: Agent .md files in module folders are generated files, not custom
|
|
2337
|
+
// Only treat .md files under _config/agents/ as custom
|
|
2338
|
+
if (!(fileName.endsWith('.md') && relativePath.includes('/agents/') && !relativePath.startsWith('_config/'))) {
|
|
2339
|
+
customFiles.push(fullPath);
|
|
2340
|
+
}
|
|
2341
|
+
} else if (manifestHasHashes && fileInfo.hash) {
|
|
2342
|
+
// File in manifest with hash - check if it was modified
|
|
2343
|
+
const currentHash = await this.manifest.calculateFileHash(fullPath);
|
|
2344
|
+
if (currentHash && currentHash !== fileInfo.hash) {
|
|
2345
|
+
// Hash changed = file was modified
|
|
2346
|
+
modifiedFiles.push({
|
|
2347
|
+
path: fullPath,
|
|
2348
|
+
relativePath: fileInfo.relativePath,
|
|
2349
|
+
});
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
} catch {
|
|
2355
|
+
// Ignore errors scanning directories
|
|
2356
|
+
}
|
|
2357
|
+
};
|
|
2358
|
+
|
|
2359
|
+
await scanDirectory(bmadDir);
|
|
2360
|
+
return { customFiles, modifiedFiles };
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
/**
|
|
2364
|
+
* Handle missing custom module sources interactively
|
|
2365
|
+
* @param {Map} customModuleSources - Map of custom module ID to info
|
|
2366
|
+
* @param {string} bmadDir - BMAD directory
|
|
2367
|
+
* @param {string} projectRoot - Project root directory
|
|
2368
|
+
* @param {string} operation - Current operation ('update', 'compile', etc.)
|
|
2369
|
+
* @param {Array} installedModules - Array of installed module IDs (will be modified)
|
|
2370
|
+
* @returns {Object} Object with validCustomModules array and keptModulesWithoutSources array
|
|
2371
|
+
*/
|
|
2372
|
+
async handleMissingCustomSources(customModuleSources, bmadDir, projectRoot, operation, installedModules) {
|
|
2373
|
+
const validCustomModules = [];
|
|
2374
|
+
const keptModulesWithoutSources = []; // Track modules kept without sources
|
|
2375
|
+
const customModulesWithMissingSources = [];
|
|
2376
|
+
|
|
2377
|
+
// Check which sources exist
|
|
2378
|
+
for (const [moduleId, customInfo] of customModuleSources) {
|
|
2379
|
+
if (await fs.pathExists(customInfo.sourcePath)) {
|
|
2380
|
+
validCustomModules.push({
|
|
2381
|
+
id: moduleId,
|
|
2382
|
+
name: customInfo.name,
|
|
2383
|
+
path: customInfo.sourcePath,
|
|
2384
|
+
info: customInfo,
|
|
2385
|
+
});
|
|
2386
|
+
} else {
|
|
2387
|
+
// For cached modules that are missing, we just skip them without prompting
|
|
2388
|
+
if (customInfo.cached) {
|
|
2389
|
+
// Skip cached modules without prompting
|
|
2390
|
+
keptModulesWithoutSources.push({
|
|
2391
|
+
id: moduleId,
|
|
2392
|
+
name: customInfo.name,
|
|
2393
|
+
cached: true,
|
|
2394
|
+
});
|
|
2395
|
+
} else {
|
|
2396
|
+
customModulesWithMissingSources.push({
|
|
2397
|
+
id: moduleId,
|
|
2398
|
+
name: customInfo.name,
|
|
2399
|
+
sourcePath: customInfo.sourcePath,
|
|
2400
|
+
relativePath: customInfo.relativePath,
|
|
2401
|
+
info: customInfo,
|
|
2402
|
+
});
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
// If no missing sources, return immediately
|
|
2408
|
+
if (customModulesWithMissingSources.length === 0) {
|
|
2409
|
+
return {
|
|
2410
|
+
validCustomModules,
|
|
2411
|
+
keptModulesWithoutSources: [],
|
|
2412
|
+
};
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2415
|
+
// Stop any spinner for interactive prompts
|
|
2416
|
+
const currentSpinner = ora();
|
|
2417
|
+
if (currentSpinner.isSpinning) {
|
|
2418
|
+
currentSpinner.stop();
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
console.log(chalk.yellow(`\n⚠️ Found ${customModulesWithMissingSources.length} custom module(s) with missing sources:`));
|
|
2422
|
+
|
|
2423
|
+
let keptCount = 0;
|
|
2424
|
+
let updatedCount = 0;
|
|
2425
|
+
let removedCount = 0;
|
|
2426
|
+
|
|
2427
|
+
for (const missing of customModulesWithMissingSources) {
|
|
2428
|
+
console.log(chalk.dim(` • ${missing.name} (${missing.id})`));
|
|
2429
|
+
console.log(chalk.dim(` Original source: ${missing.relativePath}`));
|
|
2430
|
+
console.log(chalk.dim(` Full path: ${missing.sourcePath}`));
|
|
2431
|
+
|
|
2432
|
+
const choices = [
|
|
2433
|
+
{
|
|
2434
|
+
name: 'Keep installed (will not be processed)',
|
|
2435
|
+
value: 'keep',
|
|
2436
|
+
hint: 'Keep',
|
|
2437
|
+
},
|
|
2438
|
+
{
|
|
2439
|
+
name: 'Specify new source location',
|
|
2440
|
+
value: 'update',
|
|
2441
|
+
hint: 'Update',
|
|
2442
|
+
},
|
|
2443
|
+
];
|
|
2444
|
+
|
|
2445
|
+
// Only add remove option if not just compiling agents
|
|
2446
|
+
if (operation !== 'compile-agents') {
|
|
2447
|
+
choices.push({
|
|
2448
|
+
name: '⚠️ REMOVE module completely (destructive!)',
|
|
2449
|
+
value: 'remove',
|
|
2450
|
+
hint: 'Remove',
|
|
2451
|
+
});
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
const action = await prompts.select({
|
|
2455
|
+
message: `How would you like to handle "${missing.name}"?`,
|
|
2456
|
+
choices,
|
|
2457
|
+
});
|
|
2458
|
+
|
|
2459
|
+
switch (action) {
|
|
2460
|
+
case 'update': {
|
|
2461
|
+
// Use sync validation because @clack/prompts doesn't support async validate
|
|
2462
|
+
const newSourcePath = await prompts.text({
|
|
2463
|
+
message: 'Enter the new path to the custom module:',
|
|
2464
|
+
default: missing.sourcePath,
|
|
2465
|
+
validate: (input) => {
|
|
2466
|
+
if (!input || input.trim() === '') {
|
|
2467
|
+
return 'Please enter a path';
|
|
2468
|
+
}
|
|
2469
|
+
const expandedPath = path.resolve(input.trim());
|
|
2470
|
+
if (!fs.pathExistsSync(expandedPath)) {
|
|
2471
|
+
return 'Path does not exist';
|
|
2472
|
+
}
|
|
2473
|
+
// Check if it looks like a valid module
|
|
2474
|
+
const moduleYamlPath = path.join(expandedPath, 'module.yaml');
|
|
2475
|
+
const agentsPath = path.join(expandedPath, 'agents');
|
|
2476
|
+
const workflowsPath = path.join(expandedPath, 'workflows');
|
|
2477
|
+
|
|
2478
|
+
if (!fs.pathExistsSync(moduleYamlPath) && !fs.pathExistsSync(agentsPath) && !fs.pathExistsSync(workflowsPath)) {
|
|
2479
|
+
return 'Path does not appear to contain a valid custom module';
|
|
2480
|
+
}
|
|
2481
|
+
return; // clack expects undefined for valid input
|
|
2482
|
+
},
|
|
2483
|
+
});
|
|
2484
|
+
|
|
2485
|
+
// Update the source in manifest
|
|
2486
|
+
const resolvedPath = path.resolve(newSourcePath.trim());
|
|
2487
|
+
missing.info.sourcePath = resolvedPath;
|
|
2488
|
+
// Remove relativePath - we only store absolute sourcePath now
|
|
2489
|
+
delete missing.info.relativePath;
|
|
2490
|
+
await this.manifest.addCustomModule(bmadDir, missing.info);
|
|
2491
|
+
|
|
2492
|
+
validCustomModules.push({
|
|
2493
|
+
id: missing.id,
|
|
2494
|
+
name: missing.name,
|
|
2495
|
+
path: resolvedPath,
|
|
2496
|
+
info: missing.info,
|
|
2497
|
+
});
|
|
2498
|
+
|
|
2499
|
+
updatedCount++;
|
|
2500
|
+
console.log(chalk.green(`✓ Updated source location`));
|
|
2501
|
+
|
|
2502
|
+
break;
|
|
2503
|
+
}
|
|
2504
|
+
case 'remove': {
|
|
2505
|
+
// Extra confirmation for destructive remove
|
|
2506
|
+
console.log(chalk.red.bold(`\n⚠️ WARNING: This will PERMANENTLY DELETE "${missing.name}" and all its files!`));
|
|
2507
|
+
console.log(chalk.red(` Module location: ${path.join(bmadDir, missing.id)}`));
|
|
2508
|
+
|
|
2509
|
+
const confirmDelete = await prompts.confirm({
|
|
2510
|
+
message: chalk.red.bold('Are you absolutely sure you want to delete this module?'),
|
|
2511
|
+
default: false,
|
|
2512
|
+
});
|
|
2513
|
+
|
|
2514
|
+
if (confirmDelete) {
|
|
2515
|
+
const typedConfirm = await prompts.text({
|
|
2516
|
+
message: chalk.red.bold('Type "DELETE" to confirm permanent deletion:'),
|
|
2517
|
+
validate: (input) => {
|
|
2518
|
+
if (input !== 'DELETE') {
|
|
2519
|
+
return chalk.red('You must type "DELETE" exactly to proceed');
|
|
2520
|
+
}
|
|
2521
|
+
return; // clack expects undefined for valid input
|
|
2522
|
+
},
|
|
2523
|
+
});
|
|
2524
|
+
|
|
2525
|
+
if (typedConfirm === 'DELETE') {
|
|
2526
|
+
// Remove the module from filesystem and manifest
|
|
2527
|
+
const modulePath = path.join(bmadDir, missing.id);
|
|
2528
|
+
if (await fs.pathExists(modulePath)) {
|
|
2529
|
+
const fsExtra = require('fs-extra');
|
|
2530
|
+
await fsExtra.remove(modulePath);
|
|
2531
|
+
console.log(chalk.yellow(` ✓ Deleted module directory: ${path.relative(projectRoot, modulePath)}`));
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
await this.manifest.removeModule(bmadDir, missing.id);
|
|
2535
|
+
await this.manifest.removeCustomModule(bmadDir, missing.id);
|
|
2536
|
+
console.log(chalk.yellow(` ✓ Removed from manifest`));
|
|
2537
|
+
|
|
2538
|
+
// Also remove from installedModules list
|
|
2539
|
+
if (installedModules && installedModules.includes(missing.id)) {
|
|
2540
|
+
const index = installedModules.indexOf(missing.id);
|
|
2541
|
+
if (index !== -1) {
|
|
2542
|
+
installedModules.splice(index, 1);
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
removedCount++;
|
|
2547
|
+
console.log(chalk.red.bold(`✓ "${missing.name}" has been permanently removed`));
|
|
2548
|
+
} else {
|
|
2549
|
+
console.log(chalk.dim(' Removal cancelled - module will be kept'));
|
|
2550
|
+
keptCount++;
|
|
2551
|
+
}
|
|
2552
|
+
} else {
|
|
2553
|
+
console.log(chalk.dim(' Removal cancelled - module will be kept'));
|
|
2554
|
+
keptCount++;
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
break;
|
|
2558
|
+
}
|
|
2559
|
+
case 'keep': {
|
|
2560
|
+
keptCount++;
|
|
2561
|
+
keptModulesWithoutSources.push(missing.id);
|
|
2562
|
+
console.log(chalk.dim(` Module will be kept as-is`));
|
|
2563
|
+
|
|
2564
|
+
break;
|
|
2565
|
+
}
|
|
2566
|
+
// No default
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
// Show summary
|
|
2571
|
+
if (keptCount > 0 || updatedCount > 0 || removedCount > 0) {
|
|
2572
|
+
console.log(chalk.dim(`\nSummary for custom modules with missing sources:`));
|
|
2573
|
+
if (keptCount > 0) console.log(chalk.dim(` • ${keptCount} module(s) kept as-is`));
|
|
2574
|
+
if (updatedCount > 0) console.log(chalk.dim(` • ${updatedCount} module(s) updated with new sources`));
|
|
2575
|
+
if (removedCount > 0) console.log(chalk.red(` • ${removedCount} module(s) permanently deleted`));
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
return {
|
|
2579
|
+
validCustomModules,
|
|
2580
|
+
keptModulesWithoutSources,
|
|
2581
|
+
};
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
module.exports = { Installer };
|