mirror of
https://github.com/bmadcode/BMAD-METHOD.git
synced 2025-12-29 16:14:59 +00:00
workflows consistent method to update status file
This commit is contained in:
@@ -126,6 +126,84 @@ With the new service call:
|
||||
|
||||
## Available Modes
|
||||
|
||||
### `update` Mode ⭐ NEW - Centralized Status Updates
|
||||
|
||||
- **Purpose**: Centralized status file updates - **NO MORE manual template-output hackery!**
|
||||
- **Parameters**: `action` + action-specific params
|
||||
- **Returns**: `success`, action-specific outputs
|
||||
|
||||
#### Available Actions:
|
||||
|
||||
**1. complete_workflow** - Mark workflow done, advance to next in path
|
||||
|
||||
```xml
|
||||
<invoke-workflow path="{project-root}/bmad/bmm/workflows/workflow-status">
|
||||
<param>mode: update</param>
|
||||
<param>action: complete_workflow</param>
|
||||
<param>workflow_name: prd</param>
|
||||
<param>populate_stories_from: {output_folder}/bmm-epics.md</param> <!-- optional -->
|
||||
</invoke-workflow>
|
||||
|
||||
<check if="success == true">
|
||||
<output>PRD complete! Next: {{next_workflow}} ({{next_agent}} agent)</output>
|
||||
</check>
|
||||
```
|
||||
|
||||
**2. populate_stories** - Load story queue from epics.md
|
||||
|
||||
```xml
|
||||
<invoke-workflow path="{project-root}/bmad/bmm/workflows/workflow-status">
|
||||
<param>mode: update</param>
|
||||
<param>action: populate_stories</param>
|
||||
<param>epics_file: {output_folder}/bmm-epics.md</param>
|
||||
</invoke-workflow>
|
||||
|
||||
<check if="success == true">
|
||||
<output>Loaded {{total_stories}} stories. First: {{first_story}}</output>
|
||||
</check>
|
||||
```
|
||||
|
||||
**3. start_story** - Move TODO → IN PROGRESS
|
||||
|
||||
```xml
|
||||
<invoke-workflow path="{project-root}/bmad/bmm/workflows/workflow-status">
|
||||
<param>mode: update</param>
|
||||
<param>action: start_story</param>
|
||||
</invoke-workflow>
|
||||
|
||||
<check if="success == true">
|
||||
<output>Started: {{in_progress_story}}. Next TODO: {{next_todo}}</output>
|
||||
</check>
|
||||
```
|
||||
|
||||
**4. complete_story** - Move IN PROGRESS → DONE, advance queue
|
||||
|
||||
```xml
|
||||
<invoke-workflow path="{project-root}/bmad/bmm/workflows/workflow-status">
|
||||
<param>mode: update</param>
|
||||
<param>action: complete_story</param>
|
||||
</invoke-workflow>
|
||||
|
||||
<check if="success == true">
|
||||
<output>Completed: {{completed_story}}. {{stories_remaining}} remaining.</output>
|
||||
<check if="all_complete == true">
|
||||
<output>🎉 All stories complete!</output>
|
||||
</check>
|
||||
</check>
|
||||
```
|
||||
|
||||
**5. set_current_workflow** - Manual override (rarely needed)
|
||||
|
||||
```xml
|
||||
<invoke-workflow path="{project-root}/bmad/bmm/workflows/workflow-status">
|
||||
<param>mode: update</param>
|
||||
<param>action: set_current_workflow</param>
|
||||
<param>workflow_name: tech-spec</param>
|
||||
</invoke-workflow>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `validate` Mode
|
||||
|
||||
- **Purpose**: Check if this workflow should run
|
||||
@@ -167,11 +245,73 @@ With the new service call:
|
||||
3. Gradually migrate others as they're updated
|
||||
4. Old workflows continue to work unchanged
|
||||
|
||||
## Before & After: The Power of Update Mode
|
||||
|
||||
### OLD WAY (PRD workflow) - 40+ lines of pollution:
|
||||
|
||||
```xml
|
||||
<step n="10" goal="Update status and complete">
|
||||
<action>Load {{status_file_path}}</action>
|
||||
|
||||
<template-output file="{{status_file_path}}">current_workflow</template-output>
|
||||
<action>Set to: "prd - Complete"</action>
|
||||
|
||||
<template-output file="{{status_file_path}}">phase_2_complete</template-output>
|
||||
<action>Set to: true</action>
|
||||
|
||||
<template-output file="{{status_file_path}}">decisions_log</template-output>
|
||||
<action>Add entry: "- **{{date}}**: Completed PRD workflow..."</action>
|
||||
|
||||
<action>Populate STORIES_SEQUENCE from epics.md story list</action>
|
||||
<action>Count total stories and update story counts</action>
|
||||
|
||||
<action>Save {{status_file_path}}</action>
|
||||
</step>
|
||||
```
|
||||
|
||||
### NEW WAY - 6 clean lines:
|
||||
|
||||
```xml
|
||||
<step n="10" goal="Mark PRD complete">
|
||||
<invoke-workflow path="{project-root}/bmad/bmm/workflows/workflow-status">
|
||||
<param>mode: update</param>
|
||||
<param>action: complete_workflow</param>
|
||||
<param>workflow_name: prd</param>
|
||||
<param>populate_stories_from: {output_folder}/bmm-epics.md</param>
|
||||
</invoke-workflow>
|
||||
|
||||
<output>PRD complete! Next: {{next_workflow}}</output>
|
||||
</step>
|
||||
```
|
||||
|
||||
**Benefits:**
|
||||
|
||||
- ✅ No manual file manipulation
|
||||
- ✅ No template-output pollution
|
||||
- ✅ Centralized logic handles path navigation
|
||||
- ✅ Story population happens automatically
|
||||
- ✅ Status file stays clean (just key-value pairs)
|
||||
|
||||
---
|
||||
|
||||
## Migration Priority
|
||||
|
||||
**High Priority (Complex Status Updates):**
|
||||
|
||||
1. Phase 2: prd, gdd, tech-spec - populate stories + complete workflow
|
||||
2. Phase 4: story-approved, story-ready - complex queue management
|
||||
|
||||
**Medium Priority (Simple Completions):** 3. Phase 1: product-brief, brainstorm-project, research 4. Phase 3: solution-architecture, tech-spec
|
||||
|
||||
**Low Priority (Minimal/No Updates):** 5. Phase 4: create-story, dev-story - mostly just read status
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
To integrate into your workflow:
|
||||
To migrate a workflow:
|
||||
|
||||
1. Replace your Step 0 with appropriate service call
|
||||
2. Remove duplicate status checking logic
|
||||
3. Use returned values for workflow decisions
|
||||
4. Update status file at completion (if status_exists == true)
|
||||
1. **Step 0**: Keep `validate` or `data` mode calls (for reading)
|
||||
2. **Final Step**: Replace all `template-output` with single `update` mode call
|
||||
3. **Test**: Verify status file stays clean (no prose pollution)
|
||||
4. **Delete**: Remove 30-100 lines of status manipulation code 🎉
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<critical>The workflow execution engine is governed by: {project-root}/bmad/core/tasks/workflow.xml</critical>
|
||||
<critical>You MUST have already loaded and processed: {project-root}/bmad/bmm/workflows/workflow-status/workflow.yaml</critical>
|
||||
<critical>This workflow operates in multiple modes: interactive (default), validate, data, init-check</critical>
|
||||
<critical>This workflow operates in multiple modes: interactive (default), validate, data, init-check, update</critical>
|
||||
<critical>Other workflows can call this as a service to avoid duplicating status logic</critical>
|
||||
|
||||
<workflow>
|
||||
@@ -26,6 +26,10 @@
|
||||
<check if="mode == init-check">
|
||||
<action>Jump to Step 30 for simple init check</action>
|
||||
</check>
|
||||
|
||||
<check if="mode == update">
|
||||
<action>Jump to Step 40 for status update service</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="1" goal="Check for status file">
|
||||
@@ -263,4 +267,226 @@ Your choice:</ask>
|
||||
<action>Return immediately to calling workflow</action>
|
||||
</step>
|
||||
|
||||
<step n="40" goal="Update mode - Centralized status file updates">
|
||||
<action>Read {output_folder}/bmm-workflow-status.md</action>
|
||||
|
||||
<check if="status file not found">
|
||||
<template-output>success = false</template-output>
|
||||
<template-output>error = "No status file found. Cannot update."</template-output>
|
||||
<action>Return to calling workflow</action>
|
||||
</check>
|
||||
|
||||
<check if="status file found">
|
||||
<action>Parse all current values from status file</action>
|
||||
<action>Load workflow path file from WORKFLOW_PATH field</action>
|
||||
<action>Check {{action}} parameter to determine update type</action>
|
||||
|
||||
<!-- ============================================= -->
|
||||
<!-- ACTION: complete_workflow -->
|
||||
<!-- ============================================= -->
|
||||
<check if="action == complete_workflow">
|
||||
<action>Get {{workflow_name}} parameter (required)</action>
|
||||
|
||||
<action>Mark workflow complete:</action>
|
||||
- Update CURRENT_WORKFLOW to "{{workflow_name}} - Complete"
|
||||
|
||||
<action>Find {{workflow_name}} in loaded path YAML</action>
|
||||
<action>Determine next workflow from path sequence</action>
|
||||
|
||||
<action>Update Next Action fields:</action>
|
||||
- NEXT_ACTION: Description from next workflow in path
|
||||
- NEXT_COMMAND: Command for next workflow
|
||||
- NEXT_AGENT: Agent for next workflow
|
||||
- CURRENT_WORKFLOW: Set to next workflow name (or "Complete" if no more)
|
||||
- CURRENT_AGENT: Set to next agent
|
||||
|
||||
<action>Check if phase complete:</action>
|
||||
- If {{workflow_name}} is last required workflow in current phase
|
||||
- Update PHASE_X_COMPLETE to true
|
||||
- Update CURRENT_PHASE to next phase (if applicable)
|
||||
|
||||
<check if="populate_stories_from parameter provided">
|
||||
<action>Trigger story population (see populate_stories action below)</action>
|
||||
</check>
|
||||
|
||||
<action>Update LAST_UPDATED to {{date}}</action>
|
||||
<action>Save status file</action>
|
||||
|
||||
<template-output>success = true</template-output>
|
||||
<template-output>next_workflow = {{determined next workflow}}</template-output>
|
||||
<template-output>next_agent = {{determined next agent}}</template-output>
|
||||
<template-output>phase_complete = {{true/false}}</template-output>
|
||||
|
||||
</check>
|
||||
|
||||
<!-- ============================================= -->
|
||||
<!-- ACTION: populate_stories -->
|
||||
<!-- ============================================= -->
|
||||
<check if="action == populate_stories">
|
||||
<action>Get {{epics_file}} parameter (required - path to epics.md)</action>
|
||||
|
||||
<action>Read {{epics_file}} completely</action>
|
||||
<action>Parse all story definitions from epic sections</action>
|
||||
<action>Extract story IDs in sequential order (e.g., story-1.1, story-1.2, story-2.1...)</action>
|
||||
<action>Extract story titles for each ID</action>
|
||||
|
||||
<action>Build ordered story list:</action>
|
||||
- Format: JSON array or comma-separated
|
||||
- Example: ["story-1.1", "story-1.2", "story-1.3", "story-2.1"]
|
||||
|
||||
<action>Update status file:</action>
|
||||
- STORIES_SEQUENCE: {{ordered_story_list}}
|
||||
- TODO_STORY: {{first_story_id}}
|
||||
- TODO_TITLE: {{first_story_title}}
|
||||
- IN_PROGRESS_STORY: (empty)
|
||||
- IN_PROGRESS_TITLE: (empty)
|
||||
- STORIES_DONE: []
|
||||
|
||||
<action>Update LAST_UPDATED to {{date}}</action>
|
||||
<action>Save status file</action>
|
||||
|
||||
<template-output>success = true</template-output>
|
||||
<template-output>total_stories = {{count}}</template-output>
|
||||
<template-output>first_story = {{first_story_id}}</template-output>
|
||||
|
||||
</check>
|
||||
|
||||
<!-- ============================================= -->
|
||||
<!-- ACTION: start_story (TODO → IN PROGRESS) -->
|
||||
<!-- ============================================= -->
|
||||
<check if="action == start_story">
|
||||
<action>Get current TODO_STORY from status file</action>
|
||||
|
||||
<check if="TODO_STORY is empty">
|
||||
<template-output>success = false</template-output>
|
||||
<template-output>error = "No TODO story to start"</template-output>
|
||||
<action>Return to calling workflow</action>
|
||||
</check>
|
||||
|
||||
<action>Move TODO → IN PROGRESS:</action>
|
||||
- IN_PROGRESS_STORY: {{current TODO_STORY}}
|
||||
- IN_PROGRESS_TITLE: {{current TODO_TITLE}}
|
||||
|
||||
<action>Find next story in STORIES_SEQUENCE after current TODO_STORY</action>
|
||||
|
||||
<check if="next story found">
|
||||
<action>Move next story to TODO:</action>
|
||||
- TODO_STORY: {{next_story_id}}
|
||||
- TODO_TITLE: {{next_story_title}}
|
||||
</check>
|
||||
|
||||
<check if="no next story">
|
||||
<action>Clear TODO:</action>
|
||||
- TODO_STORY: (empty)
|
||||
- TODO_TITLE: (empty)
|
||||
</check>
|
||||
|
||||
<action>Update NEXT_ACTION and NEXT_COMMAND:</action>
|
||||
- NEXT_ACTION: "Implement story {{IN_PROGRESS_STORY}}"
|
||||
- NEXT_COMMAND: "dev-story"
|
||||
- NEXT_AGENT: "dev"
|
||||
|
||||
<action>Update LAST_UPDATED to {{date}}</action>
|
||||
<action>Save status file</action>
|
||||
|
||||
<template-output>success = true</template-output>
|
||||
<template-output>in_progress_story = {{IN_PROGRESS_STORY}}</template-output>
|
||||
<template-output>next_todo = {{TODO_STORY or empty}}</template-output>
|
||||
|
||||
</check>
|
||||
|
||||
<!-- ============================================= -->
|
||||
<!-- ACTION: complete_story (IN PROGRESS → DONE) -->
|
||||
<!-- ============================================= -->
|
||||
<check if="action == complete_story">
|
||||
<action>Get current IN_PROGRESS_STORY from status file</action>
|
||||
|
||||
<check if="IN_PROGRESS_STORY is empty">
|
||||
<template-output>success = false</template-output>
|
||||
<template-output>error = "No IN PROGRESS story to complete"</template-output>
|
||||
<action>Return to calling workflow</action>
|
||||
</check>
|
||||
|
||||
<action>Move IN PROGRESS → DONE:</action>
|
||||
- Add {{IN_PROGRESS_STORY}} to STORIES_DONE list
|
||||
|
||||
<action>Move TODO → IN PROGRESS:</action>
|
||||
- IN_PROGRESS_STORY: {{current TODO_STORY}}
|
||||
- IN_PROGRESS_TITLE: {{current TODO_TITLE}}
|
||||
|
||||
<action>Find next story in STORIES_SEQUENCE after current TODO_STORY</action>
|
||||
|
||||
<check if="next story found">
|
||||
<action>Move next story to TODO:</action>
|
||||
- TODO_STORY: {{next_story_id}}
|
||||
- TODO_TITLE: {{next_story_title}}
|
||||
</check>
|
||||
|
||||
<check if="no next story">
|
||||
<action>Clear TODO:</action>
|
||||
- TODO_STORY: (empty)
|
||||
- TODO_TITLE: (empty)
|
||||
</check>
|
||||
|
||||
<check if="all stories complete (STORIES_DONE == STORIES_SEQUENCE)">
|
||||
<action>Mark Phase 4 complete:</action>
|
||||
- PHASE_4_COMPLETE: true
|
||||
- CURRENT_WORKFLOW: "Complete"
|
||||
- NEXT_ACTION: "All stories complete!"
|
||||
- NEXT_COMMAND: (empty)
|
||||
</check>
|
||||
|
||||
<check if="stories remain">
|
||||
<action>Update NEXT_ACTION:</action>
|
||||
- If IN_PROGRESS_STORY exists: "Implement story {{IN_PROGRESS_STORY}}"
|
||||
- If only TODO_STORY exists: "Draft story {{TODO_STORY}}"
|
||||
- NEXT_COMMAND: "dev-story" or "create-story"
|
||||
</check>
|
||||
|
||||
<action>Update LAST_UPDATED to {{date}}</action>
|
||||
<action>Save status file</action>
|
||||
|
||||
<template-output>success = true</template-output>
|
||||
<template-output>completed_story = {{completed_story_id}}</template-output>
|
||||
<template-output>stories_remaining = {{count}}</template-output>
|
||||
<template-output>all_complete = {{true/false}}</template-output>
|
||||
|
||||
</check>
|
||||
|
||||
<!-- ============================================= -->
|
||||
<!-- ACTION: set_current_workflow (manual override) -->
|
||||
<!-- ============================================= -->
|
||||
<check if="action == set_current_workflow">
|
||||
<action>Get {{workflow_name}} parameter (required)</action>
|
||||
<action>Get {{agent_name}} parameter (optional)</action>
|
||||
|
||||
<action>Update current workflow:</action>
|
||||
- CURRENT_WORKFLOW: {{workflow_name}}
|
||||
- CURRENT_AGENT: {{agent_name or infer from path}}
|
||||
|
||||
<action>Find {{workflow_name}} in path to determine next:</action>
|
||||
- NEXT_ACTION: Next workflow description
|
||||
- NEXT_COMMAND: Next workflow command
|
||||
- NEXT_AGENT: Next workflow agent
|
||||
|
||||
<action>Update LAST_UPDATED to {{date}}</action>
|
||||
<action>Save status file</action>
|
||||
|
||||
<template-output>success = true</template-output>
|
||||
|
||||
</check>
|
||||
|
||||
<!-- ============================================= -->
|
||||
<!-- Unknown action -->
|
||||
<!-- ============================================= -->
|
||||
<check if="action not recognized">
|
||||
<template-output>success = false</template-output>
|
||||
<template-output>error = "Unknown action: {{action}}. Valid actions: complete_workflow, populate_stories, start_story, complete_story, set_current_workflow"</template-output>
|
||||
</check>
|
||||
|
||||
</check>
|
||||
|
||||
<action>Return control to calling workflow with template outputs</action>
|
||||
</step>
|
||||
|
||||
</workflow>
|
||||
|
||||
Reference in New Issue
Block a user