From 0f37258d5c3d50cb7e0ddfd9d8faec3c5d99ecb2 Mon Sep 17 00:00:00 2001 From: sno Date: Tue, 17 Feb 2026 19:37:06 +0100 Subject: [PATCH 1/7] feat: add monorepo support with dynamic project context --- .github/copilot-instructions.md | 60 +++++++++++++++++++ src/bmm/module-help.csv | 1 + .../0-context/set-project/workflow.md | 36 +++++++++++ .../create-product-brief/workflow.md | 7 ++- .../research/workflow-domain-research.md | 10 +++- .../research/workflow-market-research.md | 10 +++- .../research/workflow-technical-research.md | 9 +++ .../create-prd/workflow-create-prd.md | 7 ++- .../create-prd/workflow-edit-prd.md | 6 +- .../create-prd/workflow-validate-prd.md | 7 ++- .../create-ux-design/workflow.md | 9 ++- .../create-architecture/workflow.md | 9 ++- .../code-review/instructions.xml | 6 ++ .../create-story/instructions.xml | 5 ++ .../dev-story/instructions.xml | 7 ++- .../retrospective/instructions.md | 12 +++- .../sprint-planning/instructions.md | 12 +++- .../sprint-status/instructions.md | 9 +++ .../bmad-quick-flow/quick-dev/workflow.md | 9 ++- .../bmad-quick-flow/quick-spec/workflow.md | 8 ++- .../generate-project-context/workflow.md | 9 ++- .../advanced-elicitation/workflow.xml | 5 ++ src/core/workflows/brainstorming/workflow.md | 9 ++- src/core/workflows/party-mode/workflow.md | 9 ++- 24 files changed, 252 insertions(+), 19 deletions(-) create mode 100644 .github/copilot-instructions.md create mode 100644 src/bmm/workflows/0-context/set-project/workflow.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 000000000..7a70892e8 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,60 @@ + + +# BMAD Method — Project Instructions + +## Project Configuration + +- **Project**: snowmain1 +- **User**: Sergey +- **Communication Language**: English +- **Document Output Language**: English +- **User Skill Level**: expert +- **Output Folder**: {project-root}/\_bmad-output/{context} (Dynamic) +- **Planning Artifacts**: {project-root}/\_bmad-output/{context}/planning-artifacts +- **Implementation Artifacts**: {project-root}/\_bmad-output/{context}/implementation-artifacts +- **Project Knowledge**: {project-root}/docs + +## BMAD Runtime Structure + +- **Agent definitions**: `_bmad/bmm/agents/` (BMM module) and `_bmad/core/agents/` (core) +- **Workflow definitions**: `_bmad/bmm/workflows/` (organized by phase) +- **Core tasks**: `_bmad/core/tasks/` (help, editorial review, indexing, sharding, adversarial review) +- **Core workflows**: `_bmad/core/workflows/` (brainstorming, party-mode, advanced-elicitation) +- **Workflow engine**: `_bmad/core/tasks/workflow.xml` (executes YAML-based workflows) +- **Module configuration**: `_bmad/bmm/config.yaml` +- **Core configuration**: `_bmad/core/config.yaml` +- **Agent manifest**: `_bmad/_config/agent-manifest.csv` +- **Workflow manifest**: `_bmad/_config/workflow-manifest.csv` +- **Help manifest**: `_bmad/_config/bmad-help.csv` +- **Agent memory**: `_bmad/_memory/` + +## Key Conventions + +- Always load `_bmad/bmm/config.yaml` before any agent activation or workflow execution +- Store all config fields as session variables: `{user_name}`, `{communication_language}`, `{output_folder}`, `{planning_artifacts}`, `{implementation_artifacts}`, `{project_knowledge}` +- MD-based workflows execute directly — load and follow the `.md` file +- YAML-based workflows require the workflow engine — load `workflow.xml` first, then pass the `.yaml` config +- Follow step-based workflow execution: load steps JIT, never multiple at once +- Save outputs after EACH step when using the workflow engine +- The `{project-root}` variable resolves to the workspace root at runtime + +## Available Agents + +| Agent | Persona | Title | Capabilities | +| ------------------- | ----------- | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| bmad-master | BMad Master | BMad Master Executor, Knowledge Custodian, and Workflow Orchestrator | runtime resource management, workflow orchestration, task execution, knowledge custodian | +| analyst | Mary | Business Analyst | market research, competitive analysis, requirements elicitation, domain expertise | +| architect | Winston | Architect | distributed systems, cloud infrastructure, API design, scalable patterns | +| dev | Amelia | Developer Agent | story execution, test-driven development, code implementation | +| pm | John | Product Manager | PRD creation, requirements discovery, stakeholder alignment, user interviews | +| qa | Quinn | QA Engineer | test automation, API testing, E2E testing, coverage analysis | +| quick-flow-solo-dev | Barry | Quick Flow Solo Dev | rapid spec creation, lean implementation, minimum ceremony | +| sm | Bob | Scrum Master | sprint planning, story preparation, agile ceremonies, backlog management | +| tech-writer | Paige | Technical Writer | documentation, Mermaid diagrams, standards compliance, concept explanation | +| ux-designer | Sally | UX Designer | user research, interaction design, UI patterns, experience strategy | + +## Slash Commands + +Type `/bmad-` in Copilot Chat to see all available BMAD workflows and agent activators. Agents are also available in the agents dropdown. + + 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..6715a1462 100644 --- a/src/bmm/workflows/1-analysis/create-product-brief/workflow.md +++ b/src/bmm/workflows/1-analysis/create-product-brief/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`, `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..923e2a0b7 100644 --- a/src/bmm/workflows/1-analysis/research/workflow-domain-research.md +++ b/src/bmm/workflows/1-analysis/research/workflow-domain-research.md @@ -15,7 +15,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..c4f30d36c 100644 --- a/src/bmm/workflows/1-analysis/research/workflow-market-research.md +++ b/src/bmm/workflows/1-analysis/research/workflow-market-research.md @@ -15,7 +15,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..dbc58b0e9 100644 --- a/src/bmm/workflows/1-analysis/research/workflow-technical-research.md +++ b/src/bmm/workflows/1-analysis/research/workflow-technical-research.md @@ -15,6 +15,15 @@ description: Conduct technical research covering technology evaluation, architec ## CONFIGURATION +### 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: - `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-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/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/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/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/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/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` From 1237eeb375a8eb815c106a5e629919cfd53dd40f Mon Sep 17 00:00:00 2001 From: sno Date: Tue, 17 Feb 2026 19:46:14 +0100 Subject: [PATCH 2/7] feat: fix missing monorepo context logic and add validation tests --- package.json | 1 + .../workflow.md | 9 +- .../create-epics-and-stories/workflow.md | 7 +- .../correct-course/instructions.md | 8 ++ .../document-project/instructions.md | 9 ++ .../workflows/deep-dive-instructions.md | 10 +- .../workflows/full-scan-instructions.md | 10 ++ src/bmm/workflows/qa/automate/instructions.md | 9 ++ test/test-monorepo-validation.js | 129 ++++++++++++++++++ 9 files changed, 187 insertions(+), 5 deletions(-) create mode 100644 test/test-monorepo-validation.js 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/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-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/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/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/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/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); +}); From 855a4b36957cff35aa60959bb38f5602d6a450f8 Mon Sep 17 00:00:00 2001 From: sno Date: Tue, 17 Feb 2026 21:58:59 +0100 Subject: [PATCH 3/7] feat: enhance installer copilot instructions for monorepo support --- .github/copilot-instructions.md | 60 ------------------- .../cli/installers/lib/ide/github-copilot.js | 6 +- 2 files changed, 3 insertions(+), 63 deletions(-) delete mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md deleted file mode 100644 index 7a70892e8..000000000 --- a/.github/copilot-instructions.md +++ /dev/null @@ -1,60 +0,0 @@ - - -# BMAD Method — Project Instructions - -## Project Configuration - -- **Project**: snowmain1 -- **User**: Sergey -- **Communication Language**: English -- **Document Output Language**: English -- **User Skill Level**: expert -- **Output Folder**: {project-root}/\_bmad-output/{context} (Dynamic) -- **Planning Artifacts**: {project-root}/\_bmad-output/{context}/planning-artifacts -- **Implementation Artifacts**: {project-root}/\_bmad-output/{context}/implementation-artifacts -- **Project Knowledge**: {project-root}/docs - -## BMAD Runtime Structure - -- **Agent definitions**: `_bmad/bmm/agents/` (BMM module) and `_bmad/core/agents/` (core) -- **Workflow definitions**: `_bmad/bmm/workflows/` (organized by phase) -- **Core tasks**: `_bmad/core/tasks/` (help, editorial review, indexing, sharding, adversarial review) -- **Core workflows**: `_bmad/core/workflows/` (brainstorming, party-mode, advanced-elicitation) -- **Workflow engine**: `_bmad/core/tasks/workflow.xml` (executes YAML-based workflows) -- **Module configuration**: `_bmad/bmm/config.yaml` -- **Core configuration**: `_bmad/core/config.yaml` -- **Agent manifest**: `_bmad/_config/agent-manifest.csv` -- **Workflow manifest**: `_bmad/_config/workflow-manifest.csv` -- **Help manifest**: `_bmad/_config/bmad-help.csv` -- **Agent memory**: `_bmad/_memory/` - -## Key Conventions - -- Always load `_bmad/bmm/config.yaml` before any agent activation or workflow execution -- Store all config fields as session variables: `{user_name}`, `{communication_language}`, `{output_folder}`, `{planning_artifacts}`, `{implementation_artifacts}`, `{project_knowledge}` -- MD-based workflows execute directly — load and follow the `.md` file -- YAML-based workflows require the workflow engine — load `workflow.xml` first, then pass the `.yaml` config -- Follow step-based workflow execution: load steps JIT, never multiple at once -- Save outputs after EACH step when using the workflow engine -- The `{project-root}` variable resolves to the workspace root at runtime - -## Available Agents - -| Agent | Persona | Title | Capabilities | -| ------------------- | ----------- | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| bmad-master | BMad Master | BMad Master Executor, Knowledge Custodian, and Workflow Orchestrator | runtime resource management, workflow orchestration, task execution, knowledge custodian | -| analyst | Mary | Business Analyst | market research, competitive analysis, requirements elicitation, domain expertise | -| architect | Winston | Architect | distributed systems, cloud infrastructure, API design, scalable patterns | -| dev | Amelia | Developer Agent | story execution, test-driven development, code implementation | -| pm | John | Product Manager | PRD creation, requirements discovery, stakeholder alignment, user interviews | -| qa | Quinn | QA Engineer | test automation, API testing, E2E testing, coverage analysis | -| quick-flow-solo-dev | Barry | Quick Flow Solo Dev | rapid spec creation, lean implementation, minimum ceremony | -| sm | Bob | Scrum Master | sprint planning, story preparation, agile ceremonies, backlog management | -| tech-writer | Paige | Technical Writer | documentation, Mermaid diagrams, standards compliance, concept explanation | -| ux-designer | Sally | UX Designer | user research, interaction design, UI patterns, experience strategy | - -## Slash Commands - -Type `/bmad-` in Copilot Chat to see all available BMAD workflows and agent activators. Agents are also available in the agents dropdown. - - 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 From a023178c0c392b31bf676642542677d77879646f Mon Sep 17 00:00:00 2001 From: sno Date: Tue, 17 Feb 2026 22:02:39 +0100 Subject: [PATCH 4/7] fix: add missing main_config frontmatter to analysis workflows --- src/bmm/workflows/1-analysis/create-product-brief/workflow.md | 1 + .../workflows/1-analysis/research/workflow-domain-research.md | 1 + .../workflows/1-analysis/research/workflow-market-research.md | 1 + .../1-analysis/research/workflow-technical-research.md | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) 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 6715a1462..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 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 923e2a0b7..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 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 c4f30d36c..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 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 dbc58b0e9..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 @@ -24,7 +25,6 @@ Load and read full config from {main_config} and resolve basic variables. 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`, `output_folder`, `planning_artifacts`, `user_name` - `communication_language`, `document_output_language`, `user_skill_level` - `date` as a system-generated value From 5ae2cad5a339f6fd4e41730101087040a2134194 Mon Sep 17 00:00:00 2001 From: sno Date: Wed, 18 Feb 2026 09:28:17 +0100 Subject: [PATCH 5/7] fix: ensure absolute path resolution for monorepo context checks --- src/bmm/workflows/0-context/set-project/workflow.md | 4 ++-- src/bmm/workflows/1-analysis/create-product-brief/workflow.md | 2 +- .../workflows/1-analysis/research/workflow-domain-research.md | 2 +- .../1-analysis/research/workflow-technical-research.md | 2 +- .../2-plan-workflows/create-prd/workflow-create-prd.md | 2 +- .../2-plan-workflows/create-prd/workflow-edit-prd.md | 2 +- .../2-plan-workflows/create-prd/workflow-validate-prd.md | 2 +- .../workflows/3-solutioning/create-architecture/workflow.md | 2 +- .../3-solutioning/create-epics-and-stories/workflow.md | 2 +- .../workflows/4-implementation/code-review/instructions.xml | 2 +- .../workflows/4-implementation/retrospective/instructions.md | 2 +- .../4-implementation/sprint-planning/instructions.md | 2 +- .../workflows/4-implementation/sprint-status/instructions.md | 2 +- src/bmm/workflows/document-project/instructions.md | 2 +- .../document-project/workflows/deep-dive-instructions.md | 2 +- .../document-project/workflows/full-scan-instructions.md | 2 +- src/bmm/workflows/generate-project-context/workflow.md | 2 +- src/bmm/workflows/qa/automate/instructions.md | 2 +- src/core/workflows/brainstorming/workflow.md | 2 +- src/core/workflows/party-mode/workflow.md | 2 +- 20 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/bmm/workflows/0-context/set-project/workflow.md b/src/bmm/workflows/0-context/set-project/workflow.md index 8424c18b0..738d8c0ca 100644 --- a/src/bmm/workflows/0-context/set-project/workflow.md +++ b/src/bmm/workflows/0-context/set-project/workflow.md @@ -24,11 +24,11 @@ Load and read full config from {main_config} and resolve basic variables. 2. **Wait for Input.** 3. **Process Input:** - **Case: CLEAR**: - - Delete file: `_bmad/.current_project` + - Delete file: `{project-root}/_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 `` + - Write file: `{project-root}/_bmad/.current_project` with content `` - Output: "✅ Project context set to: ``. Artifacts will go to `_bmad-output//`." ### 3. Verification 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 58bff4d44..c5764d4ff 100644 --- a/src/bmm/workflows/1-analysis/create-product-brief/workflow.md +++ b/src/bmm/workflows/1-analysis/create-product-brief/workflow.md @@ -52,7 +52,7 @@ This uses **step-file architecture** for disciplined execution: Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project` exists. +1. Check if `{project-root}/_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}` 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 453afa496..58cf01f4e 100644 --- a/src/bmm/workflows/1-analysis/research/workflow-domain-research.md +++ b/src/bmm/workflows/1-analysis/research/workflow-domain-research.md @@ -21,7 +21,7 @@ main_config: '{project-root}/_bmad/bmm/config.yaml' Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project` exists. +1. Check if `{project-root}/_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}` 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 9b03fbe54..6e03f7af1 100644 --- a/src/bmm/workflows/1-analysis/research/workflow-technical-research.md +++ b/src/bmm/workflows/1-analysis/research/workflow-technical-research.md @@ -21,7 +21,7 @@ main_config: '{project-root}/_bmad/bmm/config.yaml' Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project` exists. +1. Check if `{project-root}/_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}` 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 6c846d7ea..8b50a309d 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 @@ -51,7 +51,7 @@ This uses **step-file architecture** for disciplined execution: Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project` exists. +1. Check if `{project-root}/_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}` 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 3ba6b3c2f..ada593f90 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 @@ -51,7 +51,7 @@ This uses **step-file architecture** for disciplined execution: Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project` exists. +1. Check if `{project-root}/_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` 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 03045b967..8e09bb612 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 @@ -51,7 +51,7 @@ This uses **step-file architecture** for disciplined execution: Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project` exists. +1. Check if `{project-root}/_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}` diff --git a/src/bmm/workflows/3-solutioning/create-architecture/workflow.md b/src/bmm/workflows/3-solutioning/create-architecture/workflow.md index 201c04cac..ceff8cb7e 100644 --- a/src/bmm/workflows/3-solutioning/create-architecture/workflow.md +++ b/src/bmm/workflows/3-solutioning/create-architecture/workflow.md @@ -30,7 +30,7 @@ This uses **micro-file architecture** for disciplined execution: Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project` exists. +1. Check if `{project-root}/_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}` 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 389eb6b7e..3d42212ec 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 @@ -51,7 +51,7 @@ This uses **step-file architecture** for disciplined execution: Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project` exists. +1. Check if `{project-root}/_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}` diff --git a/src/bmm/workflows/4-implementation/code-review/instructions.xml b/src/bmm/workflows/4-implementation/code-review/instructions.xml index 4be776b58..19902a093 100644 --- a/src/bmm/workflows/4-implementation/code-review/instructions.xml +++ b/src/bmm/workflows/4-implementation/code-review/instructions.xml @@ -16,7 +16,7 @@ - + Read content as project_suffix Override output_folder to {project-root}/_bmad-output/{project_suffix} diff --git a/src/bmm/workflows/4-implementation/retrospective/instructions.md b/src/bmm/workflows/4-implementation/retrospective/instructions.md index b824096ca..6fa97edca 100644 --- a/src/bmm/workflows/4-implementation/retrospective/instructions.md +++ b/src/bmm/workflows/4-implementation/retrospective/instructions.md @@ -8,7 +8,7 @@ Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project exists`. +1. Check if `{project-root}/_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}` diff --git a/src/bmm/workflows/4-implementation/sprint-planning/instructions.md b/src/bmm/workflows/4-implementation/sprint-planning/instructions.md index 666125a42..2fbd0c1da 100644 --- a/src/bmm/workflows/4-implementation/sprint-planning/instructions.md +++ b/src/bmm/workflows/4-implementation/sprint-planning/instructions.md @@ -9,7 +9,7 @@ Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project exists`. +1. Check if `{project-root}/_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}` diff --git a/src/bmm/workflows/4-implementation/sprint-status/instructions.md b/src/bmm/workflows/4-implementation/sprint-status/instructions.md index 1ba831de4..fc589a22a 100644 --- a/src/bmm/workflows/4-implementation/sprint-status/instructions.md +++ b/src/bmm/workflows/4-implementation/sprint-status/instructions.md @@ -7,7 +7,7 @@ Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project exists`. +1. Check if `{project-root}/_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 diff --git a/src/bmm/workflows/document-project/instructions.md b/src/bmm/workflows/document-project/instructions.md index a81289012..35fcc290d 100644 --- a/src/bmm/workflows/document-project/instructions.md +++ b/src/bmm/workflows/document-project/instructions.md @@ -84,7 +84,7 @@ Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project exists`. +1. Check if `{project-root}/_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}` 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 85b9e2887..d0d1dd6d4 100644 --- a/src/bmm/workflows/document-project/workflows/deep-dive-instructions.md +++ b/src/bmm/workflows/document-project/workflows/deep-dive-instructions.md @@ -255,7 +255,7 @@ Detailed exhaustive analysis of specific areas: Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project exists`. +1. Check if `{project-root}/_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 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 b55ac3b77..e43435bd2 100644 --- a/src/bmm/workflows/document-project/workflows/full-scan-instructions.md +++ b/src/bmm/workflows/document-project/workflows/full-scan-instructions.md @@ -100,7 +100,7 @@ Your choice [1/2/3]: Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project exists`. +1. Check if `{project-root}/_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.) diff --git a/src/bmm/workflows/generate-project-context/workflow.md b/src/bmm/workflows/generate-project-context/workflow.md index 05644360b..88b8e8270 100644 --- a/src/bmm/workflows/generate-project-context/workflow.md +++ b/src/bmm/workflows/generate-project-context/workflow.md @@ -30,7 +30,7 @@ This uses **micro-file architecture** for disciplined execution: Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project exists`. +1. Check if `{project-root}/_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}` diff --git a/src/bmm/workflows/qa/automate/instructions.md b/src/bmm/workflows/qa/automate/instructions.md index dd0c91877..91ee2f771 100644 --- a/src/bmm/workflows/qa/automate/instructions.md +++ b/src/bmm/workflows/qa/automate/instructions.md @@ -23,7 +23,7 @@ Check project for existing test framework: Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project exists`. +1. Check if `{project-root}/_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}` diff --git a/src/core/workflows/brainstorming/workflow.md b/src/core/workflows/brainstorming/workflow.md index e6aab4c14..f93ceb6d2 100644 --- a/src/core/workflows/brainstorming/workflow.md +++ b/src/core/workflows/brainstorming/workflow.md @@ -37,7 +37,7 @@ This uses **micro-file architecture** for disciplined execution: Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project` exists. +1. Check if `{project-root}/_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}` diff --git a/src/core/workflows/party-mode/workflow.md b/src/core/workflows/party-mode/workflow.md index f30e0d7df..da61fb165 100644 --- a/src/core/workflows/party-mode/workflow.md +++ b/src/core/workflows/party-mode/workflow.md @@ -30,7 +30,7 @@ This uses **micro-file architecture** with **sequential conversation orchestrati Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project` exists. +1. Check if `{project-root}/_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}` From 21685f23f311e9973b8bab62da2817829b4e19c2 Mon Sep 17 00:00:00 2001 From: sno Date: Wed, 18 Feb 2026 09:39:39 +0100 Subject: [PATCH 6/7] fix: enhance monorepo support with robust path resolution, input sanitization, and documentation fixes --- .../research/workflow-market-research.md | 2 +- .../create-ux-design/workflow.md | 2 +- .../workflow.md | 2 +- .../code-review/instructions.xml | 10 +++++++++ .../correct-course/instructions.md | 2 +- .../create-story/instructions.xml | 14 +++++++++++- .../dev-story/instructions.xml | 12 +++++++++- .../bmad-quick-flow/quick-dev/workflow.md | 2 +- .../bmad-quick-flow/quick-spec/workflow.md | 2 +- .../workflows/deep-dive-instructions.md | 22 +++++++++++++++---- .../advanced-elicitation/workflow.xml | 12 +++++++++- 11 files changed, 69 insertions(+), 13 deletions(-) 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 9c48ac12b..937a98c4d 100644 --- a/src/bmm/workflows/1-analysis/research/workflow-market-research.md +++ b/src/bmm/workflows/1-analysis/research/workflow-market-research.md @@ -21,7 +21,7 @@ main_config: '{project-root}/_bmad/bmm/config.yaml' Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project exists`. +1. Check if `{project-root}/_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}` 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 9f1e8f4fa..5b5be72c4 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 @@ -27,7 +27,7 @@ This uses **micro-file architecture** for disciplined execution: Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project exists`. +1. Check if `{project-root}/_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}` 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 c00edab53..dad036735 100644 --- a/src/bmm/workflows/3-solutioning/check-implementation-readiness/workflow.md +++ b/src/bmm/workflows/3-solutioning/check-implementation-readiness/workflow.md @@ -47,7 +47,7 @@ description: 'Critical validation workflow that assesses PRD, Architecture, and Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project exists`. +1. Check if `{project-root}/_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}` diff --git a/src/bmm/workflows/4-implementation/code-review/instructions.xml b/src/bmm/workflows/4-implementation/code-review/instructions.xml index 19902a093..becdbc943 100644 --- a/src/bmm/workflows/4-implementation/code-review/instructions.xml +++ b/src/bmm/workflows/4-implementation/code-review/instructions.xml @@ -18,6 +18,16 @@ Read content as project_suffix + + Trim whitespace and newlines from project_suffix + + 🚫 Security Error: Invalid project context path detected. + HALT + + + 🚫 Error: Project context must only contain alphanumeric characters, dots, dashes, or underscores. + HALT + Override output_folder to {project-root}/_bmad-output/{project_suffix} diff --git a/src/bmm/workflows/4-implementation/correct-course/instructions.md b/src/bmm/workflows/4-implementation/correct-course/instructions.md index 9556de401..58d00c658 100644 --- a/src/bmm/workflows/4-implementation/correct-course/instructions.md +++ b/src/bmm/workflows/4-implementation/correct-course/instructions.md @@ -45,7 +45,7 @@ Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project exists`. +1. Check if `{project-root}/_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 diff --git a/src/bmm/workflows/4-implementation/create-story/instructions.xml b/src/bmm/workflows/4-implementation/create-story/instructions.xml index b06b4c29e..fe543108f 100644 --- a/src/bmm/workflows/4-implementation/create-story/instructions.xml +++ b/src/bmm/workflows/4-implementation/create-story/instructions.xml @@ -18,9 +18,21 @@ 🎯 ZERO USER INTERVENTION: Process should be fully automated except for initial epic/story selection or missing documents - + Read content as project_suffix + + Trim whitespace and newlines from project_suffix + + 🚫 Security Error: Invalid project context path detected. + HALT + + + 🚫 Error: Project context must only contain alphanumeric characters, dots, dashes, or underscores. + HALT + Override output_folder to {project-root}/_bmad-output/{project_suffix} + Set {default_output_file} = {output_folder}/{story_key}.md + Output "Monorepo context detected. Output redirected to: {default_output_file}" diff --git a/src/bmm/workflows/4-implementation/dev-story/instructions.xml b/src/bmm/workflows/4-implementation/dev-story/instructions.xml index e0e4e7857..b36935782 100644 --- a/src/bmm/workflows/4-implementation/dev-story/instructions.xml +++ b/src/bmm/workflows/4-implementation/dev-story/instructions.xml @@ -13,8 +13,18 @@ User skill level ({user_skill_level}) affects conversation style ONLY, not code updates. - + Read content as project_suffix + + Trim whitespace and newlines from project_suffix + + 🚫 Security Error: Invalid project context path detected. + HALT + + + 🚫 Error: Project context must only contain alphanumeric characters, dots, dashes, or underscores. + HALT + Override output_folder to {project-root}/_bmad-output/{project_suffix} 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 73f1feee2..f156f4b4e 100644 --- a/src/bmm/workflows/bmad-quick-flow/quick-dev/workflow.md +++ b/src/bmm/workflows/bmad-quick-flow/quick-dev/workflow.md @@ -28,7 +28,7 @@ This uses **step-file architecture** for focused execution: Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project exists`. +1. Check if `{project-root}/_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}` 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 08146d91c..08afd36b1 100644 --- a/src/bmm/workflows/bmad-quick-flow/quick-spec/workflow.md +++ b/src/bmm/workflows/bmad-quick-flow/quick-spec/workflow.md @@ -69,7 +69,7 @@ This uses **step-file architecture** for disciplined execution: Load and read full config from {main_config} and resolve basic variables. **Monorepo Context Check:** -1. Check if `_bmad/.current_project exists`. +1. Check if `{project-root}/_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}` 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 d0d1dd6d4..17b7768d9 100644 --- a/src/bmm/workflows/document-project/workflows/deep-dive-instructions.md +++ b/src/bmm/workflows/document-project/workflows/deep-dive-instructions.md @@ -11,6 +11,23 @@ Load existing project structure from index.md and project-parts.json (if exists) Load source tree analysis to understand available areas + + Read content as project_suffix + + Trim whitespace and newlines from project_suffix + + 🚫 Security Error: Invalid project context path detected. + HALT + + + 🚫 Error: Project context must only contain alphanumeric characters, dots, dashes, or underscores. + HALT + + Override output_folder to {project-root}/_bmad-output/{project_suffix} + Override project_knowledge to {project-root}/_bmad-output/{project_suffix} + Output "Monorepo context detected. Writing deep-dive artifacts to: {project_knowledge}" + + Analyze existing documentation to suggest deep-dive options @@ -254,10 +271,7 @@ Detailed exhaustive analysis of specific areas: Load and read full config from {main_config} and resolve basic variables. -**Monorepo Context Check:** -1. Check if `{project-root}/_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/core/workflows/advanced-elicitation/workflow.xml b/src/core/workflows/advanced-elicitation/workflow.xml index 985ac0bc3..0f8ed3be7 100644 --- a/src/core/workflows/advanced-elicitation/workflow.xml +++ b/src/core/workflows/advanced-elicitation/workflow.xml @@ -20,8 +20,18 @@ - + Read content as project_suffix + + Trim whitespace and newlines from project_suffix + + 🚫 Security Error: Invalid project context path detected. + HALT + + + 🚫 Error: Project context must only contain alphanumeric characters, dots, dashes, or underscores. + HALT + Override output_folder to {project-root}/_bmad-output/{project_suffix} From 6df9369cd064a4f94ec6b7bae99a620f3f64638f Mon Sep 17 00:00:00 2001 From: sno Date: Wed, 18 Feb 2026 10:02:39 +0100 Subject: [PATCH 7/7] fix(workflows): improve monorepo context handling and sanitization - Re-derive dependent paths in retrospective workflow after monorepo override - Add max length validation for project_suffix in dev-story - Fix premature output path computation in create-story workflow --- .../create-story/instructions.xml | 35 ++++++++++--------- .../dev-story/instructions.xml | 4 +++ .../retrospective/instructions.md | 3 ++ 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/bmm/workflows/4-implementation/create-story/instructions.xml b/src/bmm/workflows/4-implementation/create-story/instructions.xml index fe543108f..279585a7a 100644 --- a/src/bmm/workflows/4-implementation/create-story/instructions.xml +++ b/src/bmm/workflows/4-implementation/create-story/instructions.xml @@ -31,8 +31,7 @@ HALT Override output_folder to {project-root}/_bmad-output/{project_suffix} - Set {default_output_file} = {output_folder}/{story_key}.md - Output "Monorepo context detected. Output redirected to: {default_output_file}" + Output "Monorepo context detected. Output folder redirected to: {output_folder}" @@ -277,48 +276,52 @@ 📝 CREATE ULTIMATE STORY FILE - The developer's master implementation guide! + + Set {target_story_file} = {output_folder}/{story_key}.md + Output "Generating story file at: {target_story_file}" + Initialize from template.md: - {default_output_file} - story_header + {target_story_file} + story_header story_requirements + file="{target_story_file}">story_requirements - - developer_context_section **DEV AGENT GUARDRAILS:** + + developer_context_section **DEV AGENT GUARDRAILS:** technical_requirements - architecture_compliance + architecture_compliance library_framework_requirements - + file="{target_story_file}">library_framework_requirements + file_structure_requirements - testing_requirements + testing_requirements - previous_story_intelligence + previous_story_intelligence - git_intelligence_summary + git_intelligence_summary - latest_tech_information + latest_tech_information project_context_reference + file="{target_story_file}">project_context_reference - + story_completion_status diff --git a/src/bmm/workflows/4-implementation/dev-story/instructions.xml b/src/bmm/workflows/4-implementation/dev-story/instructions.xml index b36935782..4767e9624 100644 --- a/src/bmm/workflows/4-implementation/dev-story/instructions.xml +++ b/src/bmm/workflows/4-implementation/dev-story/instructions.xml @@ -25,6 +25,10 @@ 🚫 Error: Project context must only contain alphanumeric characters, dots, dashes, or underscores. HALT + + 🚫 Error: Project context name is too long (max 100 characters). + HALT + Override output_folder to {project-root}/_bmad-output/{project_suffix} diff --git a/src/bmm/workflows/4-implementation/retrospective/instructions.md b/src/bmm/workflows/4-implementation/retrospective/instructions.md index 6fa97edca..fd1f7d52e 100644 --- a/src/bmm/workflows/4-implementation/retrospective/instructions.md +++ b/src/bmm/workflows/4-implementation/retrospective/instructions.md @@ -11,6 +11,9 @@ Load and read full config from {main_config} and resolve basic variables. 1. Check if `{project-root}/_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}` +3. Re-derive dependent path variables to reflect the new `output_folder`: + - `implementation_artifacts`: `{output_folder}/implementation` + - `planning_artifacts`: `{output_folder}/planning` Communicate all responses in {communication_language} and language MUST be tailored to {user_skill_level} Generate all documents in {document_output_language}