diff --git a/package.json b/package.json index cd02e3746..8166acb2d 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "test": "npm run test:schemas && npm run test:refs && npm run test:install && npm run validate:schemas && npm run lint && npm run lint:md && npm run format:check", "test:coverage": "c8 --reporter=text --reporter=html npm run test:schemas", "test:install": "node test/test-installation-components.js", + "test:monorepo": "node test/test-monorepo-validation.js", "test:refs": "node test/test-file-refs-csv.js", "test:schemas": "node test/test-agent-schema.js", "validate:refs": "node tools/validate-file-refs.js", diff --git a/src/bmm/module-help.csv b/src/bmm/module-help.csv index 635bb8a81..a77860a06 100644 --- a/src/bmm/module-help.csv +++ b/src/bmm/module-help.csv @@ -28,4 +28,5 @@ bmm,4-implementation,Create Story,CS,30,_bmad/bmm/workflows/4-implementation/cre bmm,4-implementation,Dev Story,DS,40,_bmad/bmm/workflows/4-implementation/dev-story/workflow.yaml,bmad-bmm-dev-story,true,dev,Create Mode,"Story cycle: Execute story implementation tasks and tests then CR then back to DS if fixes needed",,, bmm,4-implementation,Code Review,CR,50,_bmad/bmm/workflows/4-implementation/code-review/workflow.yaml,bmad-bmm-code-review,false,dev,Create Mode,"Story cycle: If issues back to DS if approved then next CS or ER if epic complete",,, bmm,4-implementation,QA Automation Test,QA,45,_bmad/bmm/workflows/qa/automate/workflow.yaml,bmad-bmm-qa-automate,false,qa,Create Mode,"Generate automated API and E2E tests for implemented code using the project's existing test framework (detects existing well known in use test frameworks). Use after implementation to add test coverage. NOT for code review or story validation - use CR for that.",implementation_artifacts,"test suite", +bmm,anytime,Set Project,SPJ,05,_bmad/bmm/workflows/0-context/set-project/workflow.md,bmad-set-project,false,bmad-master,Anytime,"Set or clear the current project context for monorepo support.",_bmad,.current_project, bmm,4-implementation,Retrospective,ER,60,_bmad/bmm/workflows/4-implementation/retrospective/workflow.yaml,bmad-bmm-retrospective,false,sm,Create Mode,"Optional at epic end: Review completed work lessons learned and next epic or if major issues consider CC",implementation_artifacts,retrospective, diff --git a/src/bmm/workflows/0-context/set-project/workflow.md b/src/bmm/workflows/0-context/set-project/workflow.md new file mode 100644 index 000000000..8424c18b0 --- /dev/null +++ b/src/bmm/workflows/0-context/set-project/workflow.md @@ -0,0 +1,36 @@ +--- +name: set-project +description: Set the current project context for monorepo support +main_config: '{project-root}/_bmad/bmm/config.yaml' +--- + +# Set Project Context + +**Goal:** Configure the active project path for BMAD artifacts. + +**Your Role:** Configuration Assistant. + +## WORKFLOW ARCHITECTURE + +This is a single-step workflow that updates a local state file. + +### 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +### 2. Context Management + +1. **Ask User:** "Please enter the **project name** or path relative to `_bmad-output/` (e.g. `project-name` or `libs/auth-lib`). Enter `CLEAR` to reset to root." +2. **Wait for Input.** +3. **Process Input:** + - **Case: CLEAR**: + - Delete file: `_bmad/.current_project` + - Output: "✅ Project context cleared. Artifacts will go to root `_bmad-output/`." + - **Case: Path Provided**: + - **Sanitize:** Remove leading `/` or `_bmad-output/` if present in the input. + - Write file: `_bmad/.current_project` with content `` + - Output: "✅ Project context set to: ``. Artifacts will go to `_bmad-output//`." + +### 3. Verification + +- Display the full resolved output path for confirmation. diff --git a/src/bmm/workflows/1-analysis/create-product-brief/workflow.md b/src/bmm/workflows/1-analysis/create-product-brief/workflow.md index 9d5e83f19..58bff4d44 100644 --- a/src/bmm/workflows/1-analysis/create-product-brief/workflow.md +++ b/src/bmm/workflows/1-analysis/create-product-brief/workflow.md @@ -1,6 +1,7 @@ --- name: create-product-brief description: Create comprehensive product briefs through collaborative step-by-step discovery as creative Business Analyst working with the user as peers. +main_config: '{project-root}/_bmad/bmm/config.yaml' --- # Product Brief Workflow @@ -48,7 +49,12 @@ This uses **step-file architecture** for disciplined execution: ### 1. Configuration Loading -Load and read full config from {project-root}/_bmad/bmm/config.yaml and resolve: +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project` exists. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - `project_name`, `output_folder`, `planning_artifacts`, `user_name`, `communication_language`, `document_output_language`, `user_skill_level` diff --git a/src/bmm/workflows/1-analysis/research/workflow-domain-research.md b/src/bmm/workflows/1-analysis/research/workflow-domain-research.md index 91fcbaa9a..453afa496 100644 --- a/src/bmm/workflows/1-analysis/research/workflow-domain-research.md +++ b/src/bmm/workflows/1-analysis/research/workflow-domain-research.md @@ -1,6 +1,7 @@ --- name: domain-research description: Conduct domain research covering industry analysis, regulations, technology trends, and ecosystem dynamics using current web data and verified sources. +main_config: '{project-root}/_bmad/bmm/config.yaml' --- # Domain Research Workflow @@ -15,7 +16,15 @@ description: Conduct domain research covering industry analysis, regulations, te ## CONFIGURATION -Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve: +### 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project` exists. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` + - `project_name`, `output_folder`, `planning_artifacts`, `user_name` - `communication_language`, `document_output_language`, `user_skill_level` - `date` as a system-generated value diff --git a/src/bmm/workflows/1-analysis/research/workflow-market-research.md b/src/bmm/workflows/1-analysis/research/workflow-market-research.md index 5669e6f24..9c48ac12b 100644 --- a/src/bmm/workflows/1-analysis/research/workflow-market-research.md +++ b/src/bmm/workflows/1-analysis/research/workflow-market-research.md @@ -1,6 +1,7 @@ --- name: market-research description: Conduct market research covering market size, growth, competition, and customer insights using current web data and verified sources. +main_config: '{project-root}/_bmad/bmm/config.yaml' --- # Market Research Workflow @@ -15,7 +16,15 @@ description: Conduct market research covering market size, growth, competition, ## CONFIGURATION -Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve: +### 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project exists`. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` + - `project_name`, `output_folder`, `planning_artifacts`, `user_name` - `communication_language`, `document_output_language`, `user_skill_level` - `date` as a system-generated value diff --git a/src/bmm/workflows/1-analysis/research/workflow-technical-research.md b/src/bmm/workflows/1-analysis/research/workflow-technical-research.md index 2ac5420ce..9b03fbe54 100644 --- a/src/bmm/workflows/1-analysis/research/workflow-technical-research.md +++ b/src/bmm/workflows/1-analysis/research/workflow-technical-research.md @@ -1,6 +1,7 @@ --- name: technical-research description: Conduct technical research covering technology evaluation, architecture decisions, and implementation approaches using current web data and verified sources. +main_config: '{project-root}/_bmad/bmm/config.yaml' --- # Technical Research Workflow @@ -15,7 +16,15 @@ description: Conduct technical research covering technology evaluation, architec ## CONFIGURATION -Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve: +### 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project` exists. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` + - `project_name`, `output_folder`, `planning_artifacts`, `user_name` - `communication_language`, `document_output_language`, `user_skill_level` - `date` as a system-generated value diff --git a/src/bmm/workflows/2-plan-workflows/create-prd/workflow-create-prd.md b/src/bmm/workflows/2-plan-workflows/create-prd/workflow-create-prd.md index 7d10ec3ed..6c846d7ea 100644 --- a/src/bmm/workflows/2-plan-workflows/create-prd/workflow-create-prd.md +++ b/src/bmm/workflows/2-plan-workflows/create-prd/workflow-create-prd.md @@ -48,7 +48,12 @@ This uses **step-file architecture** for disciplined execution: ### 1. Configuration Loading -Load and read full config from {main_config} and resolve: +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project` exists. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - `project_name`, `output_folder`, `planning_artifacts`, `user_name` - `communication_language`, `document_output_language`, `user_skill_level` diff --git a/src/bmm/workflows/2-plan-workflows/create-prd/workflow-edit-prd.md b/src/bmm/workflows/2-plan-workflows/create-prd/workflow-edit-prd.md index 5cb05af53..3ba6b3c2f 100644 --- a/src/bmm/workflows/2-plan-workflows/create-prd/workflow-edit-prd.md +++ b/src/bmm/workflows/2-plan-workflows/create-prd/workflow-edit-prd.md @@ -48,8 +48,12 @@ This uses **step-file architecture** for disciplined execution: ### 1. Configuration Loading -Load and read full config from {main_config} and resolve: +Load and read full config from {main_config} and resolve basic variables. +**Monorepo Context Check:** +1. Check if `_bmad/.current_project` exists. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - `project_name`, `output_folder`, `planning_artifacts`, `user_name` - `communication_language`, `document_output_language`, `user_skill_level` - `date` as system-generated current datetime diff --git a/src/bmm/workflows/2-plan-workflows/create-prd/workflow-validate-prd.md b/src/bmm/workflows/2-plan-workflows/create-prd/workflow-validate-prd.md index e21745139..03045b967 100644 --- a/src/bmm/workflows/2-plan-workflows/create-prd/workflow-validate-prd.md +++ b/src/bmm/workflows/2-plan-workflows/create-prd/workflow-validate-prd.md @@ -48,7 +48,12 @@ This uses **step-file architecture** for disciplined execution: ### 1. Configuration Loading -Load and read full config from {main_config} and resolve: +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project` exists. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - `project_name`, `output_folder`, `planning_artifacts`, `user_name` - `communication_language`, `document_output_language`, `user_skill_level` diff --git a/src/bmm/workflows/2-plan-workflows/create-ux-design/workflow.md b/src/bmm/workflows/2-plan-workflows/create-ux-design/workflow.md index 4af87c39a..9f1e8f4fa 100644 --- a/src/bmm/workflows/2-plan-workflows/create-ux-design/workflow.md +++ b/src/bmm/workflows/2-plan-workflows/create-ux-design/workflow.md @@ -22,9 +22,14 @@ This uses **micro-file architecture** for disciplined execution: ## INITIALIZATION -### Configuration Loading +### 1. Configuration Loading -Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve: +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project exists`. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - `project_name`, `output_folder`, `planning_artifacts`, `user_name` - `communication_language`, `document_output_language`, `user_skill_level` diff --git a/src/bmm/workflows/3-solutioning/check-implementation-readiness/workflow.md b/src/bmm/workflows/3-solutioning/check-implementation-readiness/workflow.md index 49d2afab9..c00edab53 100644 --- a/src/bmm/workflows/3-solutioning/check-implementation-readiness/workflow.md +++ b/src/bmm/workflows/3-solutioning/check-implementation-readiness/workflow.md @@ -42,9 +42,14 @@ description: 'Critical validation workflow that assesses PRD, Architecture, and ## INITIALIZATION SEQUENCE -### 1. Module Configuration Loading +### 1. Configuration Loading -Load and read full config from {project-root}/_bmad/bmm/config.yaml and resolve: +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project exists`. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - `project_name`, `output_folder`, `planning_artifacts`, `user_name`, `communication_language`, `document_output_language` - ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}` diff --git a/src/bmm/workflows/3-solutioning/create-architecture/workflow.md b/src/bmm/workflows/3-solutioning/create-architecture/workflow.md index b75b4a46c..201c04cac 100644 --- a/src/bmm/workflows/3-solutioning/create-architecture/workflow.md +++ b/src/bmm/workflows/3-solutioning/create-architecture/workflow.md @@ -25,7 +25,14 @@ This uses **micro-file architecture** for disciplined execution: ## INITIALIZATION -### Configuration Loading +### 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project` exists. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve: diff --git a/src/bmm/workflows/3-solutioning/create-epics-and-stories/workflow.md b/src/bmm/workflows/3-solutioning/create-epics-and-stories/workflow.md index a0e232ab8..389eb6b7e 100644 --- a/src/bmm/workflows/3-solutioning/create-epics-and-stories/workflow.md +++ b/src/bmm/workflows/3-solutioning/create-epics-and-stories/workflow.md @@ -48,7 +48,12 @@ This uses **step-file architecture** for disciplined execution: ### 1. Configuration Loading -Load and read full config from {project-root}/_bmad/bmm/config.yaml and resolve: +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project` exists. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - `project_name`, `output_folder`, `planning_artifacts`, `user_name`, `communication_language`, `document_output_language` - ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}` diff --git a/src/bmm/workflows/4-implementation/code-review/instructions.xml b/src/bmm/workflows/4-implementation/code-review/instructions.xml index e5649559d..4be776b58 100644 --- a/src/bmm/workflows/4-implementation/code-review/instructions.xml +++ b/src/bmm/workflows/4-implementation/code-review/instructions.xml @@ -16,6 +16,11 @@ + + Read content as project_suffix + Override output_folder to {project-root}/_bmad-output/{project_suffix} + + Use provided {{story_path}} or ask user which story file to review Read COMPLETE story file Set {{story_key}} = extracted key from filename (e.g., "1-2-user-authentication.md" → "1-2-user-authentication") or story @@ -41,6 +46,7 @@ Load {project_context} for coding standards (if exists) + diff --git a/src/bmm/workflows/4-implementation/correct-course/instructions.md b/src/bmm/workflows/4-implementation/correct-course/instructions.md index bbe2c21e0..9556de401 100644 --- a/src/bmm/workflows/4-implementation/correct-course/instructions.md +++ b/src/bmm/workflows/4-implementation/correct-course/instructions.md @@ -40,6 +40,14 @@ - [x] Done - Item completed successfully - [N/A] Skip - Item not applicable to this change - [!] Action-needed - Item requires attention or follow-up +### 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project exists`. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` Maintain running notes of findings and impacts discovered Present checklist progress after each major section diff --git a/src/bmm/workflows/4-implementation/create-story/instructions.xml b/src/bmm/workflows/4-implementation/create-story/instructions.xml index f9433371f..b06b4c29e 100644 --- a/src/bmm/workflows/4-implementation/create-story/instructions.xml +++ b/src/bmm/workflows/4-implementation/create-story/instructions.xml @@ -18,6 +18,11 @@ 🎯 ZERO USER INTERVENTION: Process should be fully automated except for initial epic/story selection or missing documents + + Read content as project_suffix + Override output_folder to {project-root}/_bmad-output/{project_suffix} + + Parse user-provided story path: extract epic_num, story_num, story_title from format like "1-2-user-auth" Set {{epic_num}}, {{story_num}}, {{story_key}} from user input diff --git a/src/bmm/workflows/4-implementation/dev-story/instructions.xml b/src/bmm/workflows/4-implementation/dev-story/instructions.xml index 3c4989f39..e0e4e7857 100644 --- a/src/bmm/workflows/4-implementation/dev-story/instructions.xml +++ b/src/bmm/workflows/4-implementation/dev-story/instructions.xml @@ -13,6 +13,11 @@ User skill level ({user_skill_level}) affects conversation style ONLY, not code updates. + + Read content as project_suffix + Override output_folder to {project-root}/_bmad-output/{project_suffix} + + Use {{story_path}} directly Read COMPLETE story file @@ -376,8 +381,6 @@ Communicate to {user_name} that story implementation is complete and ready for review Summarize key accomplishments: story ID, story key, title, key changes made, tests added, files modified - Provide the story file path and current status (now "review") - Based on {user_skill_level}, ask if user needs any explanations about: - What was implemented and how it works - Why certain technical decisions were made diff --git a/src/bmm/workflows/4-implementation/retrospective/instructions.md b/src/bmm/workflows/4-implementation/retrospective/instructions.md index 018ef6ee3..b824096ca 100644 --- a/src/bmm/workflows/4-implementation/retrospective/instructions.md +++ b/src/bmm/workflows/4-implementation/retrospective/instructions.md @@ -1,7 +1,17 @@ # Retrospective - Epic Completion Review Instructions The workflow execution engine is governed by: {project-root}/_bmad/core/tasks/workflow.xml -You MUST have already loaded and processed: {project-root}/_bmad/bmm/workflows/4-implementation/retrospective/workflow.yaml +You MUST have already loaded and processed: {installed_path}/workflow.yaml + +## 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project exists`. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` + Communicate all responses in {communication_language} and language MUST be tailored to {user_skill_level} Generate all documents in {document_output_language} ⚠️ ABSOLUTELY NO TIME ESTIMATES - NEVER mention hours, days, weeks, months, or ANY time-based predictions. AI has fundamentally changed development speed - what once took teams weeks/months can now be done by one person in hours. DO NOT give ANY time estimates whatsoever. diff --git a/src/bmm/workflows/4-implementation/sprint-planning/instructions.md b/src/bmm/workflows/4-implementation/sprint-planning/instructions.md index 316d2fec3..666125a42 100644 --- a/src/bmm/workflows/4-implementation/sprint-planning/instructions.md +++ b/src/bmm/workflows/4-implementation/sprint-planning/instructions.md @@ -3,7 +3,17 @@ The workflow execution engine is governed by: {project-root}/_bmad/core/tasks/workflow.xml You MUST have already loaded and processed: {project-root}/_bmad/bmm/workflows/4-implementation/sprint-planning/workflow.yaml -## 📚 Document Discovery - Full Epic Loading +## 📚 Document Discovery +### 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project exists`. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` + +- Full Epic Loading **Strategy**: Sprint planning needs ALL epics and stories to build complete status tracking. diff --git a/src/bmm/workflows/4-implementation/sprint-status/instructions.md b/src/bmm/workflows/4-implementation/sprint-status/instructions.md index 4182e1f25..1ba831de4 100644 --- a/src/bmm/workflows/4-implementation/sprint-status/instructions.md +++ b/src/bmm/workflows/4-implementation/sprint-status/instructions.md @@ -1,6 +1,15 @@ # Sprint Status - Multi-Mode Service The workflow execution engine is governed by: {project-root}/_bmad/core/tasks/workflow.xml + +## 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project exists`. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` You MUST have already loaded and processed: {project-root}/_bmad/bmm/workflows/4-implementation/sprint-status/workflow.yaml Modes: interactive (default), validate, data ⚠️ ABSOLUTELY NO TIME ESTIMATES. Do NOT mention hours, days, weeks, or timelines. diff --git a/src/bmm/workflows/bmad-quick-flow/quick-dev/workflow.md b/src/bmm/workflows/bmad-quick-flow/quick-dev/workflow.md index 8c6a1902b..73f1feee2 100644 --- a/src/bmm/workflows/bmad-quick-flow/quick-dev/workflow.md +++ b/src/bmm/workflows/bmad-quick-flow/quick-dev/workflow.md @@ -23,7 +23,14 @@ This uses **step-file architecture** for focused execution: ## INITIALIZATION -### Configuration Loading +### 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project exists`. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve: diff --git a/src/bmm/workflows/bmad-quick-flow/quick-spec/workflow.md b/src/bmm/workflows/bmad-quick-flow/quick-spec/workflow.md index cc4fdf221..08146d91c 100644 --- a/src/bmm/workflows/bmad-quick-flow/quick-spec/workflow.md +++ b/src/bmm/workflows/bmad-quick-flow/quick-spec/workflow.md @@ -66,8 +66,14 @@ This uses **step-file architecture** for disciplined execution: ### 1. Configuration Loading -Load and read full config from `{main_config}` and resolve: +Load and read full config from {main_config} and resolve basic variables. +**Monorepo Context Check:** +1. Check if `_bmad/.current_project exists`. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` + +Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve: - `project_name`, `planning_artifacts`, `implementation_artifacts`, `user_name` - `communication_language`, `document_output_language`, `user_skill_level` - `date` as system-generated current datetime diff --git a/src/bmm/workflows/document-project/instructions.md b/src/bmm/workflows/document-project/instructions.md index 0354be610..a81289012 100644 --- a/src/bmm/workflows/document-project/instructions.md +++ b/src/bmm/workflows/document-project/instructions.md @@ -79,6 +79,15 @@ +## 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project exists`. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` + Check if {project_knowledge}/index.md exists diff --git a/src/bmm/workflows/document-project/workflows/deep-dive-instructions.md b/src/bmm/workflows/document-project/workflows/deep-dive-instructions.md index 637621c4c..85b9e2887 100644 --- a/src/bmm/workflows/document-project/workflows/deep-dive-instructions.md +++ b/src/bmm/workflows/document-project/workflows/deep-dive-instructions.md @@ -250,8 +250,14 @@ Detailed exhaustive analysis of specific areas: - Complete file inventory with all exports - Dependency graph and data flow -- Integration points and API contracts -- Testing analysis and coverage +### 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project exists`. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - Related code and reuse opportunities - Implementation guidance diff --git a/src/bmm/workflows/document-project/workflows/full-scan-instructions.md b/src/bmm/workflows/document-project/workflows/full-scan-instructions.md index 8a3621d21..b55ac3b77 100644 --- a/src/bmm/workflows/document-project/workflows/full-scan-instructions.md +++ b/src/bmm/workflows/document-project/workflows/full-scan-instructions.md @@ -95,6 +95,16 @@ Your choice [1/2/3]: - Best for: Quick project overview, initial understanding - File reading: Minimal (configs, README, package.json, etc.) +## 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project exists`. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` +json, etc.) + **2. Deep Scan** (10-30 minutes) - Reads files in critical directories based on project type diff --git a/src/bmm/workflows/generate-project-context/workflow.md b/src/bmm/workflows/generate-project-context/workflow.md index 3f626d65f..05644360b 100644 --- a/src/bmm/workflows/generate-project-context/workflow.md +++ b/src/bmm/workflows/generate-project-context/workflow.md @@ -25,7 +25,14 @@ This uses **micro-file architecture** for disciplined execution: ## INITIALIZATION -### Configuration Loading +### 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project exists`. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve: diff --git a/src/bmm/workflows/qa/automate/instructions.md b/src/bmm/workflows/qa/automate/instructions.md index 03653337f..dd0c91877 100644 --- a/src/bmm/workflows/qa/automate/instructions.md +++ b/src/bmm/workflows/qa/automate/instructions.md @@ -18,6 +18,15 @@ Check project for existing test framework: - Search online for current recommended test framework for that stack - Suggest the meta framework and use it (or ask user to confirm) +### 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project exists`. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` + ### Step 1: Identify Features Ask user what to test: diff --git a/src/core/workflows/advanced-elicitation/workflow.xml b/src/core/workflows/advanced-elicitation/workflow.xml index ea7395e41..985ac0bc3 100644 --- a/src/core/workflows/advanced-elicitation/workflow.xml +++ b/src/core/workflows/advanced-elicitation/workflow.xml @@ -20,6 +20,11 @@ + + Read content as project_suffix + Override output_folder to {project-root}/_bmad-output/{project_suffix} + + Load and read {{methods}} and {{agent-party}} diff --git a/src/core/workflows/brainstorming/workflow.md b/src/core/workflows/brainstorming/workflow.md index 3190c983c..e6aab4c14 100644 --- a/src/core/workflows/brainstorming/workflow.md +++ b/src/core/workflows/brainstorming/workflow.md @@ -32,7 +32,14 @@ This uses **micro-file architecture** for disciplined execution: ## INITIALIZATION -### Configuration Loading +### 1. Configuration Loading + +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project` exists. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` Load config from `{project-root}/_bmad/core/config.yaml` and resolve: diff --git a/src/core/workflows/party-mode/workflow.md b/src/core/workflows/party-mode/workflow.md index eaec3c931..f30e0d7df 100644 --- a/src/core/workflows/party-mode/workflow.md +++ b/src/core/workflows/party-mode/workflow.md @@ -25,9 +25,14 @@ This uses **micro-file architecture** with **sequential conversation orchestrati ## INITIALIZATION -### Configuration Loading +### 1. Configuration Loading -Load config from `{project-root}/_bmad/core/config.yaml` and resolve: +Load and read full config from {main_config} and resolve basic variables. + +**Monorepo Context Check:** +1. Check if `_bmad/.current_project` exists. +2. If it exists, read its content as `{project_suffix}` and override output folder: + - `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - `project_name`, `output_folder`, `user_name` - `communication_language`, `document_output_language`, `user_skill_level` diff --git a/test/test-monorepo-validation.js b/test/test-monorepo-validation.js new file mode 100644 index 000000000..bab840708 --- /dev/null +++ b/test/test-monorepo-validation.js @@ -0,0 +1,129 @@ +/** + * Monorepo Support Validation Tests + * + * Verifies that: + * 1. The set-project workflow is correctly registered. + * 2. All core and BMM workflows contain the monorepo context logic. + */ + +const fs = require('fs-extra'); +const path = require('node:path'); +const glob = require('glob'); + +// ANSI colors +const colors = { + reset: '\u001B[0m', + green: '\u001B[32m', + red: '\u001B[31m', + yellow: '\u001B[33m', + cyan: '\u001B[36m', + dim: '\u001B[2m', +}; + +let passed = 0; +let failed = 0; + +function assert(condition, testName, errorMessage = '') { + if (condition) { + console.log(`${colors.green}✓${colors.reset} ${testName}`); + passed++; + } else { + console.log(`${colors.red}✗${colors.reset} ${testName}`); + if (errorMessage) { + console.log(` ${colors.dim}${errorMessage}${colors.reset}`); + } + failed++; + } +} + +async function runTests() { + console.log(`${colors.cyan}========================================`); + console.log('Monorepo Support Validation Tests'); + console.log(`========================================${colors.reset}\n`); + + const projectRoot = path.join(__dirname, '..'); + + // 1. Verify set-project registration + console.log(`${colors.yellow}Test Suite 1: Workflow Registration${colors.reset}\n`); + try { + const csvPath = path.join(projectRoot, 'src/bmm/module-help.csv'); + const content = await fs.readFile(csvPath, 'utf8'); + assert(content.includes('set-project'), 'set-project workflow is registered in module-help.csv'); + } catch (error) { + assert(false, 'Registration check failed', error.message); + } + + console.log(''); + + // 2. Verify context logic in workflows + console.log(`${colors.yellow}Test Suite 2: Workflow Context Logic${colors.reset}\n`); + + const workflowFiles = glob.sync('src/{core,bmm}/workflows/**/*.{md,xml}', { cwd: projectRoot }); + + // Workflows that MUST have the check + const requiredWorkflows = [ + 'brainstorming', + 'party-mode', + 'create-product-brief', + 'create-prd', + 'create-architecture', + 'code-review', + 'create-story', + 'dev-story', + 'set-project', // Should not have the check itself, but let's exclude it + ]; + + for (const file of workflowFiles) { + const basename = path.basename(path.dirname(file)); + if (basename === 'set-project' || basename === '0-context') continue; + + const content = await fs.readFile(path.join(projectRoot, file), 'utf8'); + const isXml = file.endsWith('.xml'); + + if (isXml) { + assert(content.includes('_bmad/.current_project'), `XML workflow contains context check: ${file}`); + } else { + // Only check Markdown files that look like main workflow/instruction files + const filename = path.basename(file); + if (filename.includes('workflow') || filename.includes('instructions')) { + assert(content.includes('_bmad/.current_project'), `Markdown workflow contains context check: ${file}`); + } + } + } + + console.log(''); + + // 3. Verify set-project implementation + console.log(`${colors.yellow}Test Suite 3: set-project Implementation${colors.reset}\n`); + try { + const setProjectPath = path.join(projectRoot, 'src/bmm/workflows/0-context/set-project/workflow.md'); + const exists = await fs.pathExists(setProjectPath); + assert(exists, 'set-project workflow file exists'); + if (exists) { + const content = await fs.readFile(setProjectPath, 'utf8'); + assert(content.includes('_bmad/.current_project'), 'set-project implementation manages .current_project'); + } + } catch (error) { + assert(false, 'set-project check failed', error.message); + } + + console.log('\n'); + console.log(`${colors.cyan}========================================`); + console.log('Test Results:'); + console.log(` Passed: ${colors.green}${passed}${colors.reset}`); + console.log(` Failed: ${colors.red}${failed}${colors.reset}`); + console.log(`========================================${colors.reset}\n`); + + if (failed === 0) { + console.log(`${colors.green}✨ All monorepo validation tests passed!${colors.reset}\n`); + process.exit(0); + } else { + console.log(`${colors.red}❌ Some monorepo validation tests failed${colors.reset}\n`); + process.exit(1); + } +} + +runTests().catch((error) => { + console.error(error); + process.exit(1); +}); diff --git a/tools/cli/installers/lib/ide/github-copilot.js b/tools/cli/installers/lib/ide/github-copilot.js index 033e8d627..082cd1543 100644 --- a/tools/cli/installers/lib/ide/github-copilot.js +++ b/tools/cli/installers/lib/ide/github-copilot.js @@ -437,9 +437,9 @@ tools: ${toolsStr} - **Communication Language**: ${configVars.communication_language || '{{communication_language}}'} - **Document Output Language**: ${configVars.document_output_language || '{{document_output_language}}'} - **User Skill Level**: ${configVars.user_skill_level || '{{user_skill_level}}'} -- **Output Folder**: ${configVars.output_folder || '{{output_folder}}'} -- **Planning Artifacts**: ${configVars.planning_artifacts || '{{planning_artifacts}}'} -- **Implementation Artifacts**: ${configVars.implementation_artifacts || '{{implementation_artifacts}}'} +- **Output Folder**: ${configVars.output_folder || '{{output_folder}}'}/{context} (Dynamic) +- **Planning Artifacts**: ${configVars.planning_artifacts || '{{planning_artifacts}}'}/{context} (Dynamic) +- **Implementation Artifacts**: ${configVars.implementation_artifacts || '{{implementation_artifacts}}'}/{context} (Dynamic) - **Project Knowledge**: ${configVars.project_knowledge || '{{project_knowledge}}'} ## BMAD Runtime Structure