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
This commit is contained in:
sno 2026-02-18 10:02:39 +01:00
parent 21685f23f3
commit 6df9369cd0
3 changed files with 26 additions and 16 deletions

View File

@ -31,8 +31,7 @@
<action>HALT</action> <action>HALT</action>
</check> </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 folder redirected to: {output_folder}"</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">
@ -277,48 +276,52 @@
<step n="5" goal="Create comprehensive story file"> <step n="5" goal="Create comprehensive story file">
<critical>📝 CREATE ULTIMATE STORY FILE - The developer's master implementation guide!</critical> <critical>📝 CREATE ULTIMATE STORY FILE - The developer's master implementation guide!</critical>
<!-- Recompute output file path with correct output_folder and story_key -->
<action>Set {target_story_file} = {output_folder}/{story_key}.md</action>
<action>Output "Generating story file at: {target_story_file}"</action>
<action>Initialize from template.md: <action>Initialize from template.md:
{default_output_file}</action> {target_story_file}</action>
<template-output file="{default_output_file}">story_header</template-output> <template-output file="{target_story_file}">story_header</template-output>
<!-- Story foundation from epics analysis --> <!-- Story foundation from epics analysis -->
<template-output <template-output
file="{default_output_file}">story_requirements</template-output> file="{target_story_file}">story_requirements</template-output>
<!-- Developer context section - MOST IMPORTANT PART --> <!-- Developer context section - MOST IMPORTANT PART -->
<template-output file="{default_output_file}"> <template-output file="{target_story_file}">
developer_context_section</template-output> **DEV AGENT GUARDRAILS:** <template-output file="{default_output_file}"> developer_context_section</template-output> **DEV AGENT GUARDRAILS:** <template-output file="{target_story_file}">
technical_requirements</template-output> technical_requirements</template-output>
<template-output file="{default_output_file}">architecture_compliance</template-output> <template-output file="{target_story_file}">architecture_compliance</template-output>
<template-output <template-output
file="{default_output_file}">library_framework_requirements</template-output> file="{target_story_file}">library_framework_requirements</template-output>
<template-output file="{default_output_file}"> <template-output file="{target_story_file}">
file_structure_requirements</template-output> file_structure_requirements</template-output>
<template-output file="{default_output_file}">testing_requirements</template-output> <template-output file="{target_story_file}">testing_requirements</template-output>
<!-- Previous story intelligence --> <!-- Previous story intelligence -->
<check <check
if="previous story learnings available"> if="previous story learnings available">
<template-output file="{default_output_file}">previous_story_intelligence</template-output> <template-output file="{target_story_file}">previous_story_intelligence</template-output>
</check> </check>
<!-- Git intelligence --> <!-- Git intelligence -->
<check <check
if="git analysis completed"> if="git analysis completed">
<template-output file="{default_output_file}">git_intelligence_summary</template-output> <template-output file="{target_story_file}">git_intelligence_summary</template-output>
</check> </check>
<!-- Latest technical specifics --> <!-- Latest technical specifics -->
<check if="web research completed"> <check if="web research completed">
<template-output file="{default_output_file}">latest_tech_information</template-output> <template-output file="{target_story_file}">latest_tech_information</template-output>
</check> </check>
<!-- Project context reference --> <!-- Project context reference -->
<template-output <template-output
file="{default_output_file}">project_context_reference</template-output> file="{target_story_file}">project_context_reference</template-output>
<!-- Final status update --> <!-- Final status update -->
<template-output file="{default_output_file}"> <template-output file="{target_story_file}">
story_completion_status</template-output> story_completion_status</template-output>
<!-- CRITICAL: Set status to ready-for-dev --> <!-- CRITICAL: Set status to ready-for-dev -->

View File

@ -25,6 +25,10 @@
<output>🚫 Error: Project context must only contain alphanumeric characters, dots, dashes, or underscores.</output> <output>🚫 Error: Project context must only contain alphanumeric characters, dots, dashes, or underscores.</output>
<action>HALT</action> <action>HALT</action>
</check> </check>
<check if="project_suffix.length > 100">
<output>🚫 Error: Project context name is too long (max 100 characters).</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

@ -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. 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}`
3. Re-derive dependent path variables to reflect the new `output_folder`:
- `implementation_artifacts`: `{output_folder}/implementation`
- `planning_artifacts`: `{output_folder}/planning`
<critical>Communicate all responses in {communication_language} and language MUST be tailored to {user_skill_level}</critical> <critical>Communicate all responses in {communication_language} and language MUST be tailored to {user_skill_level}</critical>
<critical>Generate all documents in {document_output_language}</critical> <critical>Generate all documents in {document_output_language}</critical>