From 1b57ae9c6673f50285f90828805e1b20ffd8987c Mon Sep 17 00:00:00 2001 From: Maple Codex Date: Sun, 15 Feb 2026 00:39:34 +0800 Subject: [PATCH] fix(create-story): restore validate-workflow executor and conditional checklist handling --- .../create-story/checklist.md | 10 +- .../create-story/instructions.xml | 14 +- src/core/tasks/validate-workflow.xml | 135 ++++++++++++++++++ 3 files changed, 147 insertions(+), 12 deletions(-) create mode 100644 src/core/tasks/validate-workflow.xml diff --git a/src/bmm/workflows/4-implementation/create-story/checklist.md b/src/bmm/workflows/4-implementation/create-story/checklist.md index 6fc678994..1fe7c2d5c 100644 --- a/src/bmm/workflows/4-implementation/create-story/checklist.md +++ b/src/bmm/workflows/4-implementation/create-story/checklist.md @@ -51,7 +51,7 @@ This is a COMPETITION to create the **ULTIMATE story context** that makes LLM de - **Story file**: The story file to review and improve - **Workflow variables**: From workflow.yaml (implementation_artifacts, epics_file, etc.) - **Source documents**: Epics, architecture, etc. (discovered or provided) -- **Validation framework**: `validate-workflow.xml` (handles checklist execution) +- **Validation framework**: `validate-workflow.xml` (handles checklist execution and report generation) --- @@ -64,8 +64,12 @@ You will systematically re-do the entire story creation process, but with a crit 1. **Load the workflow configuration**: `{installed_path}/workflow.yaml` for variable inclusion 2. **Load the story file**: `{story_file_path}` (provided by user or discovered) 3. **Load validation framework**: `{project-root}/_bmad/core/tasks/validate-workflow.xml` -4. **Extract metadata**: epic_num, story_num, story_key, story_title from story file -5. **Resolve all workflow variables**: implementation_artifacts, epics_file, architecture_file, etc. +4. **Resolve variables deterministically**: + - Parse workflow.yaml key/value pairs + - For any value matching `{config_source}:key`, load the referenced config file and resolve `key` + - Resolve system path variables (for example `{project-root}`, `{installed_path}`) in every path value + - If any required variable remains unresolved, stop and request explicit user input before continuing +5. **Extract metadata**: epic_num, story_num, story_key, story_title from story file 6. **Understand current status**: What story implementation guidance is currently provided? **Note:** If running in fresh context, user should provide the story file path being reviewed. If running from create-story workflow, the validation framework will automatically discover the checklist and story file. diff --git a/src/bmm/workflows/4-implementation/create-story/instructions.xml b/src/bmm/workflows/4-implementation/create-story/instructions.xml index f9433371f..2f67a9004 100644 --- a/src/bmm/workflows/4-implementation/create-story/instructions.xml +++ b/src/bmm/workflows/4-implementation/create-story/instructions.xml @@ -280,16 +280,12 @@ testing_requirements - - previous_story_intelligence - + If previous story learnings are unavailable (for example this is story 1 in epic), set previous_story_intelligence to an explicit N/A note with reason + previous_story_intelligence - - git_intelligence_summary - + If git analysis is unavailable or not relevant, set git_intelligence_summary to an explicit N/A note with reason + git_intelligence_summary @@ -311,7 +307,7 @@ - Validate against checklist at {installed_path}/checklist.md using _bmad/core/tasks/validate-workflow.xml + Validate against checklist at {installed_path}/checklist.md using _bmad/core/tasks/validate-workflow.xml and target file {default_output_file} Save story document unconditionally diff --git a/src/core/tasks/validate-workflow.xml b/src/core/tasks/validate-workflow.xml new file mode 100644 index 000000000..7d6edccec --- /dev/null +++ b/src/core/tasks/validate-workflow.xml @@ -0,0 +1,135 @@ + + + Validate a generated document against checklist requirements with deterministic variable resolution and produce an actionable pass/fail report + + + + + + + + + + MANDATORY: Execute ALL steps in order. Do not skip any checklist item. + Always read COMPLETE files; do not sample with offsets. + Every non-N/A judgment must include concrete evidence from the document. + If a required path cannot be resolved, stop and ask for explicit user input. + Be strict and objective: no assumptions without evidence. + + + + + Load workflow yaml from input {workflow} + Resolve variables in this order: + 1) load config_source file if present + 2) resolve all {config_source}:key references + 3) resolve system path variables ({project-root}, {installed_path}) + 4) resolve system-generated values (date) + + Determine checklist path in priority order: + - explicit input {checklist} + - workflow.yaml field "validation" + - sibling file checklist.md in workflow directory + + Determine document path in priority order: + - explicit input {document} + - resolved variable {story_file} if present + - resolved variable {default_output_file} if present + + Try fuzzy discovery in implementation_artifacts: pick most likely recent .md output and state this inference explicitly + Ask user: "Which document should I validate?" and WAIT + + + + Load full checklist content + Load full target document content + Extract story metadata when available (epic_num, story_num, story_id) from document title or filename for conditional checks + Parse checklist into sections and atomic validation items + Mark items containing terms like "critical", "must", "required", "blocking" as critical checks + HALT with error: "Checklist is empty or unparsable" + + + + For every checklist item, evaluate one of: PASS, PARTIAL, FAIL, N/A + For each item: + - restate requirement in one short sentence + - if item contains explicit condition (for example "If story_num > 1") and condition is false, mark N/A with the exact reason + - locate explicit evidence in document (include line references when possible) + - consider implied coverage only when explicit text is absent + - assign verdict and rationale + - if PARTIAL/FAIL, describe impact and a concrete fix + + DO NOT SKIP ANY ITEM OR SECTION + + + + Set report path: + - use explicit input {report} when provided + - else save to target document folder as validation-report-{timestamp}.md + + Write report with the format below + + + # Validation Report + + - Document: {document} + - Checklist: {checklist} + - Workflow: {workflow} + - Date: {timestamp} + + ## Summary + - Overall pass rate: {pass_count}/{applicable_count} ({pass_percent}%) + - Critical failures: {critical_fail_count} + - Critical partials: {critical_partial_count} + - Gate decision: {PASS|FAIL} + + ## Section Results + ### {Section Name} + - PASS: {count} + - PARTIAL: {count} + - FAIL: {count} + - N/A: {count} + + For each checklist item: + - [MARK] {item} + - Evidence: {quote or line reference} + - Analysis: {why mark is correct} + - Action (if PARTIAL/FAIL): {specific remediation} + + ## Must Fix Before Proceeding + - {all critical FAIL items} + + ## Should Improve + - {all non-critical FAIL and PARTIAL items} + + ## Final Recommendation + 1. {highest-priority fix} + 2. {second-priority fix} + 3. {third-priority fix} + + + + + Present concise summary with counts and gate decision + Provide report path + State clearly that workflow should not proceed until fixes are applied + HALT and wait for user direction + + + + + HALT if workflow file cannot be loaded + HALT if checklist file cannot be loaded + HALT if target document cannot be determined after user prompt + HALT if any checklist section is skipped + + + + Never skip checklist items + Every PASS/PARTIAL/FAIL must have evidence + Use deterministic variable resolution before asking the user + Always save a validation report file + +