fix: enhance monorepo support with robust path resolution, input sanitization, and documentation fixes

This commit is contained in:
sno 2026-02-18 09:39:39 +01:00
parent 5ae2cad5a3
commit 21685f23f3
11 changed files with 69 additions and 13 deletions

View File

@ -21,7 +21,7 @@ main_config: '{project-root}/_bmad/bmm/config.yaml'
Load and read full config from {main_config} and resolve basic variables. Load and read full config from {main_config} and resolve basic variables.
**Monorepo Context Check:** **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: 2. If it exists, read its content as `{project_suffix}` and override output folder:
- `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - `output_folder`: `{project-root}/_bmad-output/{project_suffix}`

View File

@ -27,7 +27,7 @@ This uses **micro-file architecture** for disciplined execution:
Load and read full config from {main_config} and resolve basic variables. Load and read full config from {main_config} and resolve basic variables.
**Monorepo Context Check:** **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: 2. If it exists, read its content as `{project_suffix}` and override output folder:
- `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - `output_folder`: `{project-root}/_bmad-output/{project_suffix}`

View File

@ -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. Load and read full config from {main_config} and resolve basic variables.
**Monorepo Context Check:** **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: 2. If it exists, read its content as `{project_suffix}` and override output folder:
- `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - `output_folder`: `{project-root}/_bmad-output/{project_suffix}`

View File

@ -18,6 +18,16 @@
<step n="1" goal="Load story and discover changes"> <step n="1" goal="Load story and discover changes">
<check if="{project-root}/_bmad/.current_project exists"> <check if="{project-root}/_bmad/.current_project exists">
<action>Read content as project_suffix</action> <action>Read content as project_suffix</action>
<!-- Sanitization and Validation -->
<action>Trim whitespace and newlines from project_suffix</action>
<check if="project_suffix contains '..' or starts with '/' or starts with '\'">
<output>🚫 Security Error: Invalid project context path detected.</output>
<action>HALT</action>
</check>
<check if="project_suffix matches regex '[^a-zA-Z0-9._-]|^\s*$'">
<output>🚫 Error: Project context must only contain alphanumeric characters, dots, dashes, or underscores.</output>
<action>HALT</action>
</check>
<action>Override output_folder to {project-root}/_bmad-output/{project_suffix}</action> <action>Override output_folder to {project-root}/_bmad-output/{project_suffix}</action>
</check> </check>

View File

@ -45,7 +45,7 @@
Load and read full config from {main_config} and resolve basic variables. Load and read full config from {main_config} and resolve basic variables.
**Monorepo Context Check:** **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: 2. If it exists, read its content as `{project_suffix}` and override output folder:
- `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - `output_folder`: `{project-root}/_bmad-output/{project_suffix}`
<action>Maintain running notes of findings and impacts discovered</action> <action>Maintain running notes of findings and impacts discovered</action>

View File

@ -18,9 +18,21 @@
<critical>🎯 ZERO USER INTERVENTION: Process should be fully automated except for initial epic/story selection or missing documents</critical> <critical>🎯 ZERO USER INTERVENTION: Process should be fully automated except for initial epic/story selection or missing documents</critical>
<step n="1" goal="Determine target story"> <step n="1" goal="Determine target story">
<check if="_bmad/.current_project exists"> <check if="{project-root}/_bmad/.current_project exists">
<action>Read content as project_suffix</action> <action>Read content as project_suffix</action>
<!-- Sanitization and Validation -->
<action>Trim whitespace and newlines from project_suffix</action>
<check if="project_suffix contains '..' or starts with '/' or starts with '\'">
<output>🚫 Security Error: Invalid project context path detected.</output>
<action>HALT</action>
</check>
<check if="project_suffix matches regex '[^a-zA-Z0-9._-]|^\s*$'">
<output>🚫 Error: Project context must only contain alphanumeric characters, dots, dashes, or underscores.</output>
<action>HALT</action>
</check>
<action>Override output_folder to {project-root}/_bmad-output/{project_suffix}</action> <action>Override output_folder to {project-root}/_bmad-output/{project_suffix}</action>
<action>Set {default_output_file} = {output_folder}/{story_key}.md</action>
<action>Output "Monorepo context detected. Output redirected to: {default_output_file}"</action>
</check> </check>
<check if="{{story_path}} is provided by user or user provided the epic and story number such as 2-4 or 1.6 or epic 1 story 5"> <check if="{{story_path}} is provided by user or user provided the epic and story number such as 2-4 or 1.6 or epic 1 story 5">

View File

@ -13,8 +13,18 @@
<critical>User skill level ({user_skill_level}) affects conversation style ONLY, not code updates.</critical> <critical>User skill level ({user_skill_level}) affects conversation style ONLY, not code updates.</critical>
<step n="1" goal="Find next ready story and load it" tag="sprint-status"> <step n="1" goal="Find next ready story and load it" tag="sprint-status">
<check if="_bmad/.current_project exists"> <check if="{project-root}/_bmad/.current_project exists">
<action>Read content as project_suffix</action> <action>Read content as project_suffix</action>
<!-- Sanitization and Validation -->
<action>Trim whitespace and newlines from project_suffix</action>
<check if="project_suffix contains '..' or starts with '/' or starts with '\'">
<output>🚫 Security Error: Invalid project context path detected.</output>
<action>HALT</action>
</check>
<check if="project_suffix matches regex '[^a-zA-Z0-9._-]|^\s*$'">
<output>🚫 Error: Project context must only contain alphanumeric characters, dots, dashes, or underscores.</output>
<action>HALT</action>
</check>
<action>Override output_folder to {project-root}/_bmad-output/{project_suffix}</action> <action>Override output_folder to {project-root}/_bmad-output/{project_suffix}</action>
</check> </check>

View File

@ -28,7 +28,7 @@ This uses **step-file architecture** for focused execution:
Load and read full config from {main_config} and resolve basic variables. Load and read full config from {main_config} and resolve basic variables.
**Monorepo Context Check:** **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: 2. If it exists, read its content as `{project_suffix}` and override output folder:
- `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - `output_folder`: `{project-root}/_bmad-output/{project_suffix}`

View File

@ -69,7 +69,7 @@ This uses **step-file architecture** for disciplined execution:
Load and read full config from {main_config} and resolve basic variables. Load and read full config from {main_config} and resolve basic variables.
**Monorepo Context Check:** **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: 2. If it exists, read its content as `{project_suffix}` and override output folder:
- `output_folder`: `{project-root}/_bmad-output/{project_suffix}` - `output_folder`: `{project-root}/_bmad-output/{project_suffix}`

View File

@ -11,6 +11,23 @@
<action>Load existing project structure from index.md and project-parts.json (if exists)</action> <action>Load existing project structure from index.md and project-parts.json (if exists)</action>
<action>Load source tree analysis to understand available areas</action> <action>Load source tree analysis to understand available areas</action>
<check if="{project-root}/_bmad/.current_project exists">
<action>Read content as project_suffix</action>
<!-- Sanitization and Validation -->
<action>Trim whitespace and newlines from project_suffix</action>
<check if="project_suffix contains '..' or starts with '/' or starts with '\'">
<output>🚫 Security Error: Invalid project context path detected.</output>
<action>HALT</action>
</check>
<check if="project_suffix matches regex '[^a-zA-Z0-9._-]|^\s*$'">
<output>🚫 Error: Project context must only contain alphanumeric characters, dots, dashes, or underscores.</output>
<action>HALT</action>
</check>
<action>Override output_folder to {project-root}/_bmad-output/{project_suffix}</action>
<action>Override project_knowledge to {project-root}/_bmad-output/{project_suffix}</action>
<action>Output "Monorepo context detected. Writing deep-dive artifacts to: {project_knowledge}"</action>
</check>
<step n="13a" goal="Identify area for deep-dive"> <step n="13a" goal="Identify area for deep-dive">
<action>Analyze existing documentation to suggest deep-dive options</action> <action>Analyze existing documentation to suggest deep-dive options</action>
@ -254,10 +271,7 @@ Detailed exhaustive analysis of specific areas:
Load and read full config from {main_config} and resolve basic variables. 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 - Related code and reuse opportunities
- Implementation guidance - Implementation guidance

View File

@ -20,8 +20,18 @@
<flow> <flow>
<step n="1" title="Method Registry Loading"> <step n="1" title="Method Registry Loading">
<check if="_bmad/.current_project exists"> <check if="{project-root}/_bmad/.current_project exists">
<action>Read content as project_suffix</action> <action>Read content as project_suffix</action>
<!-- Sanitization and Validation -->
<action>Trim whitespace and newlines from project_suffix</action>
<check if="project_suffix contains '..' or starts with '/' or starts with '\'">
<output>🚫 Security Error: Invalid project context path detected.</output>
<action>HALT</action>
</check>
<check if="project_suffix matches regex '[^a-zA-Z0-9._-]|^\s*$'">
<output>🚫 Error: Project context must only contain alphanumeric characters, dots, dashes, or underscores.</output>
<action>HALT</action>
</check>
<action>Override output_folder to {project-root}/_bmad-output/{project_suffix}</action> <action>Override output_folder to {project-root}/_bmad-output/{project_suffix}</action>
</check> </check>