fix: ChatBubble crash and DeepSeek API compatibility

- Fix ChatBubble to handle non-string content with String() wrapper
- Fix API route to use generateText for non-streaming requests
- Add @ai-sdk/openai-compatible for non-OpenAI providers (DeepSeek, etc.)
- Use Chat Completions API instead of Responses API for compatible providers
- Update ChatBubble tests and fix component exports to kebab-case
- Remove stale PascalCase ChatBubble.tsx file
This commit is contained in:
Max
2026-01-26 16:55:05 +07:00
parent 6b113e0392
commit e9e6fadb1d
544 changed files with 113077 additions and 427 deletions

View File

@@ -0,0 +1,237 @@
---
name: 'step-e-01-assess-workflow'
description: 'Load target workflow, check compliance, check for validation report, offer validation if needed'
# File References
nextStepFile: './step-e-02-discover-edits.md'
editPlan: '{bmb_creations_output_folder}/edit-plan-{workflow_name}.md'
validationWorkflow: '../steps-v/step-01-validate.md'
conversionStep: '../steps-c/step-00-conversion.md'
---
# Edit Step 1: Assess Workflow
## STEP GOAL:
Load the target workflow, check if it follows BMAD step-file architecture, check for existing validation report, and offer to run validation if needed.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- 📖 CRITICAL: Read the complete step file before taking any action
- 📋 YOU ARE A FACILITATOR, not an autonomous editor
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Step-Specific Rules:
- 🎯 Focus ONLY on assessment - no editing yet
- 🚫 FORBIDDEN to proceed without loading workflow completely
- 💬 Explain findings clearly and get user confirmation
- 🚪 ROUTE non-compliant workflows to create flow
## EXECUTION PROTOCOLS:
- 🎯 Load and analyze target workflow
- 💾 Create edit plan document
- 📖 Check for validation report
- 🚫 FORBIDDEN to proceed without user confirmation
## CONTEXT BOUNDARIES:
- User provides workflow path from workflow.md routing
- Focus: Assessment and routing
- This is NOT about making changes yet
## MANDATORY SEQUENCE
**CRITICAL:** Follow this sequence exactly. Do not skip or shortcut.
### 1. Get Workflow Path
From the user input provided by workflow.md routing, extract:
- `targetWorkflowPath` - path to workflow.md file
- `workflowName` - derived from path
**If path was not provided:**
"Which workflow would you like to edit? Please provide the path to the workflow.md file."
### 2. Load Workflow Completely
**Load these files:**
1. `{targetWorkflowPath}/workflow.md` - Must exist - if the user indicates is something else, ask if this is a conversion to the compliant v6 format
2. Check for step folders: `steps*`
3. Check for `data/` folder
4. Check for `templates/` folder
### 3. Compliance Check
**Determine if workflow is BMAD-compliant:**
**Compliant workflow has:**
- ✅ workflow.md file exists at root
- ✅ At least one step folder exists (steps-c/, steps-v/, or steps-e/)
- ✅ Step files use markdown format (.md)
- ✅ workflow.md has frontmatter (name, description)
**Non-compliant workflow:**
- ❌ No workflow.md file
- ❌ Has workflow.yaml or instructions.md (legacy format)
- ❌ No step folders
- ❌ Step files are not markdown
### 4. Route Based on Compliance
**IF NON-COMPLIANT:**
"**Workflow Assessment Result: Non-Compliant Format**
I found that this workflow does not follow BMAD step-file architecture:
- [Describe what was found - e.g., legacy format, missing workflow.md, etc.]
**Recommendation:** This workflow should be converted using the create workflow process. The create workflow can use your existing workflow as input discovery material to build a new compliant workflow.
**Would you like to:**
1. **[C]onvert to Compliant Workflow** - Use existing workflow as input to build compliant version
2. **[E]xplore manual conversion** - I can explain what needs to change
3. **[X] Exit** - Cancel this operation
#### Menu Handling Logic:
- IF C: Route to create workflow conversion mode → Load {conversionStep} with sourceWorkflowPath set to {targetWorkflowPath}
- IF E: Explain conversion requirements, then redisplay menu
- IF X: Exit with guidance
- IF Any other: help user, then redisplay menu"
**IF COMPLIANT:**
"**Workflow Assessment Result: Compliant Format**
This workflow follows BMAD step-file architecture:
- ✅ workflow.md found
- ✅ Step folders: [list which ones exist]
- ✅ Data folder: [yes/no]
- ✅ Templates folder: [yes/no]"
Continue to step 5.
### 5. Check for Validation Report
**Look for validation report:**
- Check `{targetWorkflowPath}/validation-report-{workflow_name}.md`
- Check if report exists and read completion status
**IF NO VALIDATION REPORT EXISTS:**
"This workflow has not been validated yet.
**Recommendation:** Running validation first can help identify issues before editing. Would you like to:
1. **[V]alidate first** - Run comprehensive validation, then proceed with edits
2. **[S]kip validation** - Proceed directly to editing
#### Menu Handling Logic:
- IF V: Load, read entirely, then execute {validationWorkflow}. After validation completes, return to this step and proceed to step 6.
- IF S: Proceed directly to step 6 (Discover Edits)
- IF Any other: help user, then redisplay menu"
**IF VALIDATION REPORT EXISTS:**
Read the validation report and note:
- Overall status (COMPLETE/INCOMPLETE)
- Critical issues count
- Warning issues count
"**Existing Validation Report Found:**
- Status: [status]
- Critical Issues: [count]
- Warnings: [count]
I'll keep this report in mind during editing."
Continue to step 6.
### 6. Create Edit Plan Document
**Initialize edit plan:**
```markdown
---
mode: edit
targetWorkflowPath: '{targetWorkflowPath}'
workflowName: '{workflow_name}'
editSessionDate: '{current-date}'
stepsCompleted:
- step-e-01-assess-workflow.md
hasValidationReport: [true/false]
validationStatus: [from report if exists]
---
# Edit Plan: {workflow_name}
## Workflow Snapshot
**Path:** {targetWorkflowPath}
**Format:** BMAD Compliant ✅
**Step Folders:** [list found]
## Validation Status
[If report exists: summary of validation status]
[If no report: No validation run yet]
---
## Edit Goals
*To be populated in next step*
---
## Edits Applied
*To track changes made*
```
Write to `{editPlan}`.
### 7. Present MENU OPTIONS
Display: "**Assessment Complete. Select an Option:** [C] Continue to Discovery"
#### Menu Handling Logic:
- IF C: Update editPlan, then load, read entire file, then execute {nextStepFile}
- IF Any other: help user respond, then redisplay menu
## CRITICAL STEP COMPLETION NOTE
ONLY WHEN user selects [C] and edit plan is created, will you then load and read fully `{nextStepFile}` to execute and begin edit discovery.
---
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
### ✅ SUCCESS:
- Workflow loaded completely
- Compliance status determined
- Non-compliant workflows routed to create flow
- Edit plan document created
- Validation report checked
- User confirmed to proceed
### ❌ SYSTEM FAILURE:
- Not loading workflow completely
- Misclassifying non-compliant workflow as compliant
- Not routing non-compliant to create flow
- Not checking for validation report
- Not creating edit plan
**Master Rule:** Assessment must be thorough. Non-compliant workflows MUST be routed to create flow. Always check for validation report before editing.

View File

@@ -0,0 +1,248 @@
---
name: 'step-e-02-discover-edits'
description: 'Discover what user wants to change - fix validation issues, make changes, or both'
# File References
nextStepFile: './step-e-03-fix-validation.md'
directEditStep: './step-e-04-direct-edit.md'
editPlan: '{bmb_creations_output_folder}/edit-plan-{workflow_name}.md'
targetWorkflowPath: '{targetWorkflowPath}'
validationReport: '{targetWorkflowPath}/validation-report-{workflow_name}.md'
---
# Edit Step 2: Discover Edits
## STEP GOAL:
Discover what the user wants to do: fix validation issues, make specific changes, or both. Document edit goals in the edit plan.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- 🛑 NEVER assume what edits are needed
- 📖 CRITICAL: Read the complete step file before taking any action
- 📋 YOU ARE A FACILITATOR, not an autonomous editor
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Step-Specific Rules:
- 🎯 Focus ONLY on understanding edit goals
- 🚫 FORBIDDEN to make any modifications yet
- 💬 Ask clarifying questions
- 🚪 CATEGORIZE edits by type
## EXECUTION PROTOCOLS:
- 🎯 Guide discovery conversation
- 💾 Document edit goals in edit plan
- 📖 Determine which next step to load
- 🚫 FORBIDDEN to proceed without user confirmation
## CONTEXT BOUNDARIES:
- Edit plan from previous step provides context
- Validation report (if exists) provides issues to fix
- Focus: What does user want to change?
- This is discovery, not implementation
## MANDATORY SEQUENCE
**CRITICAL:** Follow this sequence exactly. Do not skip or shortcut.
### 1. Read Edit Plan Context
**Load the editPlan file:**
Read `{editPlan}` to understand the workflow context and validation status.
### 2. Determine Discovery Approach
**IF validation report exists AND has issues:**
Present fix-or-change options (step 3a)
**ELSE (no validation report or no issues):**
Present direct change options (step 3b)
---
### 3a. Discovery With Validation Issues
**IF validation report exists with issues:**
"**I found an existing validation report for this workflow.**
**Validation Summary:**
- Status: {status from report}
- Critical Issues: {count}
- Warnings: {count}
**What would you like to do?**
**[F]ix Validation Issues** - Systematically fix issues found in validation
**[C]hange Something** - Make a specific change (add feature, modify step, etc.)
**[B]oth** - Fix validation issues, then make a change
**[R]eview Report** - See detailed validation findings first
#### Menu Handling Logic:
- IF F: Proceed to [Document Fix Goals](#4-document-fix-goals), then route to {nextStepFile}
- IF C: Proceed to [Document Change Goals](#3b-discovery-for-direct-change)
- IF B: Document both fix and change goals, then route to {nextStepFile} for fixes first
- IF R: Present key findings from validation report, then redisplay this menu
- IF Any other: help user, then redisplay menu"
---
### 3b. Discovery For Direct Change
**IF no validation report or no issues:**
"**What would you like to change about this workflow?**
I can help you modify:
**[W]orkflow.md** - Goal, role, initialization, routing
**[S]tep Files** - Add, remove, or modify steps
**[D]ata Files** - Add or modify reference data in data/ folder
**[T]emplates** - Add or modify output templates
**[M]ultiple** - Changes across multiple areas
**[O]ther** - Something else
Which areas would you like to edit?"
#### For Each Selected Category:
**If Workflow.md selected:**
- "What aspects need change?"
- Goal or description?
- Role definition?
- Architecture principles?
- Initialization/routing?
**If Step Files selected:**
- "What type of step changes?"
- Add new step?
- Remove existing step?
- Modify step content?
- Reorder steps?
**If Data Files selected:**
- "What data changes?"
- Add new data file?
- Modify existing data?
- Add/remove data entries?
**If Templates selected:**
- "What template changes?"
- Add new template?
- Modify template structure?
- Change variable references?"
**If Multiple selected:**
- Walk through each area systematically
**If Other selected:**
- "Describe what you'd like to change..."
---
### 4. Document Fix Goals (For Validation Issues)
**Append to editPlan:**
```markdown
## Edit Goals
### Fix Validation Issues
**Priority: High** - These issues prevent compliance
**Critical Issues to Fix:**
- [ ] {issue from validation report}
- [ ] {issue from validation report}
**Warnings to Address:**
- [ ] {warning from validation report}
- [ ] {warning from validation report}
```
---
### 5. Document Change Goals
**Append to editPlan:**
```markdown
### Direct Changes
**Category:** [workflow.md / step files / data / templates / other]
**Changes Requested:**
- [ ] {specific change description}
- [ ] {specific change description}
**Rationale:**
{user's explanation of why this change is needed}
```
---
### 6. Confirm and Route
**Present summary for confirmation:**
"**Here's what I heard you want to do:**
{Summarize all edit goals clearly}
**Did I capture everything correctly?**
- [C] Yes, continue
- [M] Modify the plan
- [X] Cancel"
#### Menu Handling Logic:
- IF C: Update editPlan stepsCompleted, then route based on goals:
- **If Fix goals only**: Load, read entirely, then execute {nextStepFile} (fix-validation)
- **If Change goals only**: Load, read entirely, then execute {directEditStep}
- **If Both**: Load, read entirely, then execute {nextStepFile} (fix first, then direct edit after)
- IF M: Return to relevant discovery section
- IF X: Exit with explanation
- IF Any other: help user, then redisplay menu
### 7. Present MENU OPTIONS (Final)
Display: "**Edit Goals Confirmed. Select an Option:** [C] Continue to Edits"
#### Menu Handling Logic:
- IF C: Save editPlan with confirmed goals, then load appropriate next step based on [Route Based on Goals](#6-confirm-and-route)
- IF Any other: help user respond, then redisplay menu
## CRITICAL STEP COMPLETION NOTE
ONLY WHEN user confirms goals and routing is determined, will you then load and read fully the appropriate next step file to execute.
---
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
### ✅ SUCCESS:
- Edit goals clearly documented
- User confirmed the plan
- Routing determined (fix vs direct vs both)
- Edit plan updated with goals
- Appropriate next step selected
### ❌ SYSTEM FAILURE:
- Not documenting edit goals
- Routing to wrong next step
- Not getting user confirmation
- Missing changes user mentioned
**Master Rule:** Discovery must be thorough. Document all goals. Route correctly based on whether fixes, changes, or both are needed.

View File

@@ -0,0 +1,252 @@
---
name: 'step-e-03-fix-validation'
description: 'Systematically fix validation issues from validation report'
# File References
nextStepFile: './step-e-05-apply-edit.md'
editPlan: '{bmb_creations_output_folder}/edit-plan-{workflow_name}.md'
targetWorkflowPath: '{targetWorkflowPath}'
validationReport: '{targetWorkflowPath}/validation-report-{workflow_name}.md'
# Standards References
architecture: '../data/architecture.md'
stepFileRules: '../data/step-file-rules.md'
frontmatterStandards: '../data/frontmatter-standards.md'
menuHandlingStandards: '../data/menu-handling-standards.md'
outputFormatStandards: '../data/output-format-standards.md'
stepTypePatterns: '../data/step-type-patterns.md'
---
# Edit Step 3: Fix Validation Issues
## STEP GOAL:
Systematically fix all issues identified in the validation report, working through each issue with user approval and loading relevant standards.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- 🛑 NEVER make changes without user approval
- 📖 CRITICAL: Read the complete step file before taking any action
- 📋 YOU ARE A FACILITATOR, not an autonomous editor
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Step-Specific Rules:
- 🎯 Focus on fixing validation issues systematically
- 🚫 FORBIDDEN to skip issues or fix without approval
- 💬 Explain each issue and proposed fix
- 📋 Load relevant standards for each fix type
## EXECUTION PROTOCOLS:
- 🎯 Work through issues systematically
- 💾 Document each fix in edit plan
- 📖 Load appropriate standards for each issue type
- 🚫 FORBIDDEN to proceed without user approval for each fix
## CONTEXT BOUNDARIES:
- Validation report provides list of issues
- Edit plan documents fix goals
- Focus: Fix each issue with standards adherence
- This is systematic remediation, not creative editing
## MANDATORY SEQUENCE
**CRITICAL:** Follow this sequence exactly. Do not skip or shortcut.
### 1. Read Context Files
**Load these files first:**
1. `{editPlan}` - Review fix goals
2. `{validationReport}` - Get full list of issues
### 2. Organize Issues by Type
**From validation report, categorize issues:**
| Issue Type | Standard File | Count |
|------------|---------------|-------|
| workflow.md violations | {architecture} | |
| Step file structure | {stepFileRules} | |
| Frontmatter issues | {frontmatterStandards} | |
| Menu handling | {menuHandlingStandards} | |
| Output format | {outputFormatStandards} | |
| Step type issues | {stepTypePatterns} | |
### 3. Work Through Issues Systematically
**For EACH issue in order of severity (Critical → Warning):**
#### A. Load Relevant Standard
**Before proposing fix, load the relevant standard file:**
- If workflow.md issue → Load {architecture}
- If step file issue → Load {stepFileRules}
- If frontmatter issue → Load {frontmatterStandards}
- If menu issue → Load {menuHandlingStandards}
- If output issue → Load {outputFormatStandards}
- If step type issue → Load {stepTypePatterns}
#### B. Explain the Issue
"**Issue: [{issue type}] {file}:{location if applicable}**
**What the validation found:**
{Quote the validation finding}
**Why this is a problem:**
{Explain the impact based on the standard}
**Standard reference:**
{Cite the specific standard from the loaded file}"
#### C. Propose Fix
"**Proposed fix:**
{Specific change needed}
**This will:**
- ✅ Fix the compliance issue
- ✅ Align with: {specific standard}
- ⚠️ Potential impact: {any side effects}
**Should I apply this fix?**"
#### D. Get User Approval
Wait for user response:
- **Yes/Y** - Apply the fix
- **No/N** - Skip this issue (document why)
- **Modify** - User suggests alternative approach
- **Explain** - Provide more detail
#### E. Apply Fix (If Approved)
**Load the target file, make the change:**
```markdown
**Applying fix to: {file}**
**Before:**
{show relevant section}
**After:**
{show modified section}
**Fix applied.** ✅"
```
**Update editPlan:**
```markdown
### Fixes Applied
**[{issue type}]** {file}
- ✅ Fixed: {description}
- Standard: {standard reference}
- User approved: Yes
```
### 4. Handle Skip/Modify Responses
**IF user skips an issue:**
"**Issue skipped.**
Documenting in edit plan:
- [{issue type}] {file} - SKIPPED per user request
- Reason: {user's reason if provided}
**Note:** This issue will remain in the validation report.
Continue to next issue?"
**IF user wants to modify the fix:**
Discuss alternative approach, get agreement, then apply modified fix.
### 5. After All Issues Complete
**Present summary:**
"**Validation Fix Summary:**
**Total Issues Found:** {count}
**Fixed:** {count}
**Skipped:** {count}
**Modified:** {count}
**Remaining Issues:** {list any skipped or remaining warnings}
**Files Modified:**
- {file1}
- {file2}
- etc."
### 6. Check for Direct Edit Goals
**Load editPlan and check:**
**IF edit plan includes direct change goals (beyond validation fixes):**
"Your edit plan also includes direct changes. After we apply these validation fixes, we'll proceed to those changes."
Update editPlan frontmatter:
```yaml
validationFixesComplete: true
```
Then route to {nextStepFile} for direct edits.
**ELSE (no direct changes - validation fixes only):**
"Validation fixes are complete! Would you like to:
1. **[R]e-run validation** - Verify all fixes are working
2. **[C]omplete** - Finish editing with these fixes
3. **[M]ake additional changes** - Add more edits"
#### Menu Handling Logic:
- IF R: Run validation workflow, then return to this step
- IF C: Route to step-e-07-complete.md
- IF M: Route to step-e-02-discover-edits.md
- IF Any other: help user, then redisplay menu
### 7. Present MENU OPTIONS (If Proceeding)
Display: "**Validation Fixes Applied. Select an Option:** [C] Continue"
#### Menu Handling Logic:
- IF C: Update editPlan stepsCompleted, then load, read entirely, then execute appropriate next step
- IF Any other: help user respond, then redisplay menu
## CRITICAL STEP COMPLETION NOTE
ONLY WHEN all validation issues are addressed (fixed, skipped, or documented) and user confirms, will you then route to the appropriate next step.
---
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
### ✅ SUCCESS:
- All issues presented to user systematically
- Relevant standards loaded for each issue
- User approval obtained for each fix
- Fixes applied correctly
- Edit plan updated with all changes
- Files properly modified
### ❌ SYSTEM FAILURE:
- Skipping issues without user approval
- Not loading relevant standards
- Making changes without user confirmation
- Not documenting fixes in edit plan
- Applying fixes incorrectly
**Master Rule:** Work through issues systematically. Load standards for each issue type. Get explicit approval before applying any fix.

View File

@@ -0,0 +1,275 @@
---
name: 'step-e-04-direct-edit'
description: 'Apply direct user-requested changes to workflow'
# File References
nextStepFile: './step-e-05-apply-edit.md'
editPlan: '{bmb_creations_output_folder}/edit-plan-{workflow_name}.md'
targetWorkflowPath: '{targetWorkflowPath}'
# Standards References
architecture: '../data/architecture.md'
stepFileRules: '../data/step-file-rules.md'
frontmatterStandards: '../data/frontmatter-standards.md'
menuHandlingStandards: '../data/menu-handling-standards.md'
outputFormatStandards: '../data/output-format-standards.md'
stepTypePatterns: '../data/step-type-patterns.md'
workflowTypeCriteria: '../data/workflow-type-criteria.md'
inputDiscoveryStandards: '../data/input-discovery-standards.md'
csvDataFileStandards: '../data/csv-data-file-standards.md'
intentVsPrescriptive: '../data/intent-vs-prescriptive-spectrum.md'
---
# Edit Step 4: Direct Edit
## STEP GOAL:
Apply direct user-requested changes to the workflow, loading relevant standards and checking for non-compliance during editing.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- 🛑 NEVER make changes without user approval
- 📖 CRITICAL: Read the complete step file before taking any action
- 📋 YOU ARE A FACILITATOR, not an autonomous editor
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Step-Specific Rules:
- 🎯 Focus on user-requested changes
- 🚫 FORBIDDEN to make changes without approval
- 💬 Check for non-compliance while editing
- 📋 Load relevant standards for each change type
## EXECUTION PROTOCOLS:
- 🎯 Work through each requested change
- 💾 Document each change in edit plan
- 📖 Load appropriate standards for each change type
- 🚫 IF non-compliance found: offer to fix before proceeding
## CONTEXT BOUNDARIES:
- Edit plan contains direct change goals
- Focus: Apply user's requested changes
- Must check for compliance issues during edits
## MANDATORY SEQUENCE
**CRITICAL:** Follow this sequence exactly. Do not skip or shortcut.
### 1. Read Edit Plan
**Load the editPlan:**
Read `{editPlan}` to review direct change goals from step 2.
### 2. For Each Direct Change Goal
**Work through each change systematically:**
#### A. Identify Change Type and Load Standards
**For workflow.md changes:**
- Load {architecture}
**For step file changes:**
- Load {stepFileRules}
- Load {stepTypePatterns}
- Load {intentVsPrescriptive}
**For frontmatter changes:**
- Load {frontmatterStandards}
**For menu changes:**
- Load {menuHandlingStandards}
**For output/template changes:**
- Load {outputFormatStandards}
**For data file changes:**
- Load {csvDataFileStandards}
**For workflow type changes:**
- Load {workflowTypeCriteria}
**For discovery/input changes:**
- Load {inputDiscoveryStandards}
#### B. Load Target File and Check Compliance
**Load the file to be edited and review against standards:**
"**Loading: {filename}**
**Standard: {standard file loaded}**
**Checking file against standards before making your change...**"
**IF NON-COMPLIANCE FOUND:**
"**⚠️ Compliance Issue Detected**
Before I apply your change, I noticed this file is not fully compliant with {standard}:
**Issue:** {describe the non-compliance}
**This could cause:** {explain impact}
**Should I fix this compliance issue before applying your change?**
1. **[F]ix first** - Fix compliance, then apply your change
2. **[C]ontinue anyway** - Apply your change without fixing
3. **[E]xplain more** - More details about the issue
#### Menu Handling Logic:
- IF F: Fix compliance first, then proceed to apply change
- IF C: Document user accepted risk, proceed with change
- IF E: Provide more details, then redisplay menu
- IF Any other: help user, then redisplay menu"
**IF COMPLIANT:**
"**File is compliant.** Proceeding with your change."
#### C. Present Current State and Proposed Change
"**Current state of: {filename}**
{show relevant section}
**Your requested change:**
{summarize the change from edit plan}
**Proposed modification:**
{show how the change will be made}
**Should I apply this change?**"
Wait for user approval.
#### D. Apply Change (If Approved)
**Load the file, make the change:**
```markdown
**Applying change to: {filename}**
**Before:**
{show relevant section}
**After:**
{show modified section}
**Change applied.** ✅"
```
**Update editPlan:**
```markdown
### Direct Changes Applied
**[{change type}]** {filename}
- ✅ Changed: {description}
- User approved: Yes
- Compliance check: Passed/Fixed/Accepted risk
```
### 3. Handle Common Change Patterns
#### Adding a New Step
1. Load {stepFileRules}, {stepTypePatterns}, {intentVsPrescriptive}
2. Check existing step numbering
3. Determine appropriate step type
4. Create step file with proper structure
5. Update nextStepFile references in adjacent steps
6. Verify menu handling compliance
#### Removing a Step
1. Load {architecture}
2. Check if step is referenced by other steps
3. Update nextStepFile in previous step
4. Confirm with user about impact
5. Remove step file
6. Verify no broken references
#### Modifying workflow.md
1. Load {architecture}
2. Check for progressive disclosure compliance (no step listings!)
3. Update goal/role/routing as requested
4. Ensure last section is routing
5. Verify frontmatter completeness
#### Adding/Modifying Data Files
1. Load {csvDataFileStandards}
2. Check file size (warn if >500 lines)
3. Verify CSV format if applicable
4. Ensure proper headers
5. Update step frontmatter references
#### Adding/Modifying Templates
1. Load {outputFormatStandards}
2. Determine template type
3. Ensure variable consistency
4. Update step frontmatter references
### 4. After All Changes Complete
**Present summary:**
"**Direct Edit Summary:**
**Total Changes Requested:** {count}
**Applied:** {count}
**Skipped:** {count}
**Modified:** {count}
**Compliance Issues Found During Editing:** {count}
- Fixed: {count}
- User accepted risk: {count}
**Files Modified:**
- {file1}
- {file2}
- etc."
### 5. Present MENU OPTIONS
Display: "**Direct Edits Applied. Select an Option:** [C] Continue"
#### Menu Handling Logic:
- IF C: Update editPlan stepsCompleted, then load, read entirely, then execute {nextStepFile}
- IF Any other: help user respond, then redisplay menu
## CRITICAL STEP COMPLETION NOTE
ONLY WHEN all direct changes are applied (or documented) and user confirms, will you then load and read fully `{nextStepFile}` to execute.
---
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
### ✅ SUCCESS:
- All requested changes presented to user
- Relevant standards loaded for each change
- Compliance checked before each change
- User approval obtained for each change
- Non-compliance found and offered fix
- Changes applied correctly
- Edit plan updated
### ❌ SYSTEM FAILURE:
- Not loading relevant standards
- Not checking compliance before editing
- Making changes without user approval
- Missing non-compliance issues
- Not documenting changes
**Master Rule:** Load standards for each change type. Check compliance BEFORE applying changes. Offer to fix non-compliance when found.

View File

@@ -0,0 +1,154 @@
---
name: 'step-e-05-apply-edit'
description: 'Offer validation after edits, complete or continue editing'
# File References
nextStepFile: './step-e-06-validate-after.md'
completeStep: './step-e-07-complete.md'
editPlan: '{bmb_creations_output_folder}/edit-plan-{workflow_name}.md'
targetWorkflowPath: '{targetWorkflowPath}'
validationWorkflow: '../steps-v/step-01-validate.md'
---
# Edit Step 5: Post-Edit Options
## STEP GOAL:
Present options after edits are applied: run validation, make more edits, or complete.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- 📖 CRITICAL: Read the complete step file before taking any action
- 📋 YOU ARE A FACILITATOR, not an autonomous editor
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Step-Specific Rules:
- 🎯 Focus on next steps after edits
- 💬 Present clear options
- 🚪 Route based on user choice
## EXECUTION PROTOCOLS:
- 🎯 Present post-edit options
- 💾 Update edit plan if needed
- 📖 Route to appropriate next step
## CONTEXT BOUNDARIES:
- Edits have been applied (validation fixes, direct changes, or both)
- Focus: What's next?
- This is a routing step
## MANDATORY SEQUENCE
**CRITICAL:** Follow this sequence exactly. Do not skip or shortcut.
### 1. Read Edit Plan
**Load the editPlan:**
Read `{editPlan}` to understand what edits were applied.
### 2. Present Edit Summary
"**Edit Session Summary:**
**Workflow:** {workflow_name}
**Path:** {targetWorkflowPath}
**Edits Applied:**
{Summarize from edit plan}
**Files Modified:**
{List files changed}
**Compliance Status:**
{Any compliance issues found and fixed}
---
**What would you like to do next?**
**[V]alidate** - Run comprehensive validation to verify all changes
**[M]ore edits** - Make additional changes
**[C]omplete** - Finish editing (without validation)
**[R]eview changes** - See detailed change log"
### 3. Menu Handling Logic
- **IF V:** Load, read entirely, then execute {validationWorkflow}. After validation completes, return to this step.
- **IF M:** Route to step-e-02-discover-edits.md for more changes
- **IF C:** Load, read entirely, then execute {completeStep}
- **IF R:** Present detailed edit log from editPlan, then redisplay this menu
- **IF Any other:** help user respond, then redisplay menu
### 4. Update Edit Plan (If Completing Without Validation)
**IF user selects [C] Complete:**
Update editPlan frontmatter:
```yaml
completionDate: '{current-date}'
validationAfterEdit: skipped
completionStatus: complete_without_validation
```
Document in editPlan:
```markdown
## Completion
**Completed:** {current-date}
**Validation:** Skipped per user request
**Recommendation:** Run validation before using workflow in production
```
### 5. Handle Validation Return
**IF validation was run and completed:**
Load and review validation report. Present findings:
"**Validation Complete:**
**Overall Status:** {status}
**New Issues:** {count}
**Remaining Issues:** {count}
**Would you like to:**
1. **[F]ix new issues** - Return to fix-validation step
2. **[M]ore edits** - Make additional changes
3. **[C]omplete** - Finish with current validation status"
#### Menu Handling Logic:
- IF F: Route to step-e-03-fix-validation.md
- IF M: Route to step-e-02-discover-edits.md
- IF C: Load, read entirely, then execute {completeStep}
- IF Any other: help user, then redisplay menu
## CRITICAL STEP COMPLETION NOTE
This is a routing step. Route user to appropriate next step based on their choice. Always offer validation before completing.
---
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
### ✅ SUCCESS:
- Edit summary presented clearly
- All options explained
- User routed to appropriate next step
- Validation offered before completion
- Edit plan updated if completing
### ❌ SYSTEM FAILURE:
- Not offering validation
- Routing to wrong step
- Not updating edit plan when completing
**Master Rule:** Always offer validation after edits. Route correctly based on user choice.

View File

@@ -0,0 +1,190 @@
---
name: 'step-e-06-validate-after'
description: 'Run validation after edits and present results'
# File References
nextStepFile: './step-e-07-complete.md'
fixStep: './step-e-03-fix-validation.md'
editPlan: '{bmb_creations_output_folder}/edit-plan-{workflow_name}.md'
targetWorkflowPath: '{targetWorkflowPath}'
validationWorkflow: '../steps-v/step-01-validate.md'
validationReport: '{targetWorkflowPath}/validation-report-{workflow_name}.md'
---
# Edit Step 6: Validate After Edit
## STEP GOAL:
Run validation workflow after edits are complete, present results, and offer next steps.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- 📖 CRITICAL: Read the complete step file before taking any action
- 📋 YOU ARE A FACILITATOR, not an autonomous editor
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Step-Specific Rules:
- 🎯 Focus on running validation and presenting results
- 💬 Explain validation outcomes clearly
- 🚪 Route based on validation results
## EXECUTION PROTOCOLS:
- 🎯 Execute validation workflow
- 💾 Present results to user
- 📖 Offer next steps based on findings
## CONTEXT BOUNDARIES:
- Edits have been applied
- Focus: Verify quality after edits
- This is quality assurance step
## MANDATORY SEQUENCE
**CRITICAL:** Follow this sequence exactly. Do not skip or shortcut.
### 1. Read Edit Plan
**Load the editPlan:**
Read `{editPlan}` to understand what edits were applied.
### 2. Execute Validation Workflow
"**Running comprehensive validation on your edited workflow...**
**Target:** {targetWorkflowPath}
**Validation scope:** Full workflow compliance check
This may take a few moments..."
**Load, read entirely, then execute:** {validationWorkflow}
### 3. Review Validation Results
**After validation completes, load the validation report:**
Read `{validationReport}` and extract:
- Overall status
- Critical issues count
- Warning issues count
- New issues vs pre-existing issues
### 4. Present Validation Results
"**Validation Complete!**
**Overall Assessment:** [PASS/PARTIAL/FAIL]
**Summary:**
| Category | Before Edits | After Edits | Change |
|----------|--------------|-------------|--------|
| Critical Issues | {count} | {count} | {delta} |
| Warnings | {count} | {count} | {delta} |
| Compliance Score | {score} | {score} | {delta} |
---
**New Issues Found:** {count}
**Issues Fixed:** {count}
**Remaining Issues:** {count}
---
**What would you like to do?**"
### 5. Menu Options Based on Results
**IF NEW CRITICAL ISSUES FOUND:**
"**[F]ix new issues** - Return to fix-validation step to address new critical issues
**[R]eview report** - See detailed validation findings
**[C]omplete anyway** - Finish editing with remaining issues (not recommended)"
#### Menu Handling Logic:
- IF F: Load, read entirely, then execute {fixStep}
- IF R: Present detailed findings from validation report, then redisplay this menu
- IF C: Warn user, then if confirmed, load, read entirely, then execute {nextStepFile}
- IF Any other: help user, then redisplay menu
**IF NO NEW CRITICAL ISSUES (warnings OK):**
"**[R]eview report** - See detailed validation findings
**[C]omplete** - Finish editing - workflow looks good!
**[M]ore edits** - Make additional changes"
#### Menu Handling Logic (Issues Found):
- IF R: Present detailed findings from validation report, then redisplay this menu
- IF C: Load, read entirely, then execute {nextStepFile}
- IF M: Route to step-e-02-discover-edits.md
- IF Any other: help user, then redisplay menu
**IF FULL PASS (no issues):**
"**🎉 Excellent! Your workflow is fully compliant!**
**[C]omplete** - Finish editing
**[R]eview report** - See validation details
**[M]ore edits** - Make additional changes"
#### Menu Handling Logic (Full Pass):
- IF C: Load, read entirely, then execute {nextStepFile}
- IF R: Present validation summary, then redisplay this menu
- IF M: Route to step-e-02-discover-edits.md
- IF Any other: help user, then redisplay menu
### 6. Update Edit Plan
**Before routing to complete:**
Update editPlan frontmatter:
```yaml
completionDate: '{current-date}'
validationAfterEdit: complete
finalValidationStatus: {status from validation report}
remainingCriticalIssues: {count}
remainingWarnings: {count}
```
Document in editPlan:
```markdown
## Final Validation
**Validation Date:** {current-date}
**Status:** {status}
**Issues After Editing:**
- Critical: {count}
- Warnings: {count}
**Recommendation:** {if issues remain, suggest next steps}
```
## CRITICAL STEP COMPLETION NOTE
ALWAYS present validation results clearly. Route based on severity of findings. Update edit plan with final validation status before completing.
---
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
### ✅ SUCCESS:
- Validation workflow executed
- Results presented clearly with before/after comparison
- User routed appropriately based on findings
- Edit plan updated with final status
### ❌ SYSTEM FAILURE:
- Not running validation
- Not presenting results clearly
- Routing to complete with critical issues without warning
- Not updating edit plan
**Master Rule:** Always run validation after edits. Present clear before/after comparison. Warn user about remaining issues.

View File

@@ -0,0 +1,206 @@
---
name: 'step-e-07-complete'
description: 'Complete the edit session with summary and next steps'
# File References
editPlan: '{bmb_creations_output_folder}/edit-plan-{workflow_name}.md'
targetWorkflowPath: '{targetWorkflowPath}'
validationReport: '{targetWorkflowPath}/validation-report-{workflow_name}.md'
---
# Edit Step 7: Complete
## STEP GOAL:
Complete the edit session with a comprehensive summary of changes made and provide next steps guidance.
## MANDATORY EXECUTION RULES (READ FIRST):
### Universal Rules:
- 📖 CRITICAL: Read the complete step file before taking any action
- 📋 YOU ARE A FACILITATOR, not an autonomous editor
- ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
### Step-Specific Rules:
- 🎯 Focus on summary and completion
- 💬 Present clear change summary
- 🚫 No more edits at this stage
## EXECUTION PROTOCOLS:
- 🎯 Generate comprehensive summary
- 💾 Finalize edit plan document
- 📖 Provide next steps guidance
## CONTEXT BOUNDARIES:
- All edits are complete
- Focus: Summary and closure
- This is the final step
## MANDATORY SEQUENCE
**CRITICAL:** Follow this sequence exactly. Do not skip or shortcut.
### 1. Read Edit Plan and Validation Report
**Load both files:**
1. `{editPlan}` - Full edit session history
2. `{validationReport}` - Final validation status (if exists)
### 2. Generate Completion Summary
"**━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━**
# Edit Session Complete
**Workflow:** {workflow_name}
**Path:** {targetWorkflowPath}
**Session Date:** {editSessionDate}
---
## Changes Made
**Validation Fixes Applied:** {count}
{list from edit plan}
**Direct Changes Applied:** {count}
{list from edit plan}
**Files Modified:**
{List all files that were changed}
---
## Final Validation Status
**Status:** {status from report or 'Not run'}
**Issues:**
- Critical: {count}
- Warnings: {count}
---
## Edit Session Summary
Your workflow has been successfully edited. Here's what was accomplished:
{Summarize the transformation in 2-3 sentences}
**━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━**"
### 3. Update Edit Plan with Completion
**Append final completion section to editPlan:**
```markdown
## Completion Summary
**Completed:** {current-date}
**Session Duration:** {from start to end}
**Total Edits:** {count}
- Validation Fixes: {count}
- Direct Changes: {count}
**Files Modified:** {count}
**Final Validation Status:** {status}
**Workflow is ready for:** {use/testing/production with caveats}
```
### 4. Provide Next Steps Guidance
"**Next Steps for Your Workflow:**
1. **Test the workflow** - Run through the workflow end-to-end to verify changes
2. **Get user feedback** - If this is for others, have them test it
3. **Monitor for issues** - Watch for any problems in actual use
4. **Re-validate periodically** - Run validation again after future changes
**Resources:**
- Edit this workflow again: Edit workflow mode
- Run validation: Validate workflow mode
- Build new workflow: Create workflow mode
---
**Thank you for using BMAD Workflow Creator!**
Your edit session for **{workflow_name}** is complete. ✅"
### 5. Final Confirmation
"**Edit Session Complete.**
**[F]inish** - End the edit session
**[S]ave summary** - Save a copy of the edit summary to your output folder
**[R]eview** - Review the full edit plan one more time"
#### Menu Handling Logic:
- IF F: End the session
- IF S: Save edit summary to output folder, then end
- IF R: Display full edit plan, then redisplay this menu
- IF Any other: help user, then redisplay menu
### 6. Save Summary (If Requested)
**IF user selects [S]ave summary:**
Create summary file at `{output_folder}/workflow-edit-summary-{workflow_name}-{date}.md`:
```markdown
# Workflow Edit Summary
**Workflow:** {workflow_name}
**Path:** {targetWorkflowPath}
**Edit Date:** {current-date}
## Changes Made
{All changes from edit plan}
## Files Modified
{List with paths}
## Validation Status
{Final validation results}
## Next Steps
{Recommendations}
```
"**Summary saved to:** {output_folder}/workflow-edit-summary-{workflow_name}-{date}.md"
## CRITICAL STEP COMPLETION NOTE
This is the final step. Ensure edit plan is complete, summary is presented, and user has all information needed. End session gracefully.
---
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
### ✅ SUCCESS:
- Comprehensive summary presented
- All changes documented clearly
- Edit plan finalized
- Next steps guidance provided
- Session ended gracefully
### ❌ SYSTEM FAILURE:
- Not summarizing all changes
- Missing files from change list
- Not providing next steps
- Ending without user confirmation
**Master Rule:** Provide complete summary of all changes. Document everything. Give clear next steps. End on a positive note.