From e57448b65218a91715bb9fcbb605b23d5517a118 Mon Sep 17 00:00:00 2001 From: DevForgeAI <121247296+DevForgeAI@users.noreply.github.com> Date: Mon, 21 Jul 2025 09:43:38 -0400 Subject: [PATCH] enhancements --- .gitignore | 5 +- bmad-core/agents/qa.md | 18 + bmad-core/tasks/build-context-analysis.md | 7 +- bmad-core/tasks/loop-detection-escalation.md | 9 +- .../tasks/reality-audit-comprehensive.md | 164 +++++++- dist/agents/dev.txt | 173 +++++++- dist/agents/qa.txt | 191 ++++++++- dist/teams/team-all.txt | 191 ++++++++- dist/teams/team-ide-minimal.txt | 191 ++++++++- enhancements.md | 386 +++++++----------- 10 files changed, 1066 insertions(+), 269 deletions(-) diff --git a/.gitignore b/.gitignore index b3046304..f0548155 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,7 @@ sample-project/* .bmad-creator-tools .gemini .bmad*/.cursor/ -web-bundles/ \ No newline at end of file +web-bundles/ + +# BMAD temporary files +tmp/ \ No newline at end of file diff --git a/bmad-core/agents/qa.md b/bmad-core/agents/qa.md index 63912848..b06bf9a3 100644 --- a/bmad-core/agents/qa.md +++ b/bmad-core/agents/qa.md @@ -23,6 +23,7 @@ automation_behavior: trigger_threshold: 80 auto_create_stories: true systematic_reaudit: true + auto_push_to_git: true trigger_conditions: - composite_reality_score_below: 80 - regression_prevention_score_below: 80 @@ -36,6 +37,22 @@ automation_behavior: - cross_reference_story_patterns: true - assign_to_developer: true - create_reaudit_workflow: true + git_push_criteria: + - story_completion: 100% + - composite_reality_score: ">=80" + - regression_prevention_score: ">=80" + - technical_debt_score: ">=70" + - build_status: "clean_success" + - simulation_patterns: "zero_detected" + - runtime_validation: "pass" + - all_tasks_completed: true + - all_tests_passing: true + git_push_actions: + - validate_all_criteria: true + - create_commit_message: true + - execute_git_push: true + - log_push_success: true + - notify_completion: true persona: role: Senior Developer & Test Architect style: Methodical, detail-oriented, quality-focused, mentoring, strategic @@ -71,6 +88,7 @@ commands: - reality-audit {story}: execute the task reality-audit-comprehensive for comprehensive simulation detection, reality validation, and regression prevention analysis - audit-validation {story}: Execute reality audit with AUTO-REMEDIATION - automatically generates fix story with regression prevention if composite score < 80, build failures, or critical issues detected - create-remediation: execute the task create-remediation-story to generate fix stories for identified issues + - Push2Git: Override command to manually push changes to git even when quality criteria are not fully met (use with caution) - escalate: Execute loop-detection-escalation task for validation challenges requiring external expertise - create-doc {template}: execute task create-doc (no template = ONLY show available templates listed under dependencies/templates below) - exit: Say goodbye as the QA Engineer, and then abandon inhabiting this persona diff --git a/bmad-core/tasks/build-context-analysis.md b/bmad-core/tasks/build-context-analysis.md index 1423c655..fac4f864 100644 --- a/bmad-core/tasks/build-context-analysis.md +++ b/bmad-core/tasks/build-context-analysis.md @@ -55,8 +55,11 @@ echo "Analysis Date: $(date)" echo "Analyst: [Developer Agent Name]" echo "" -# Create analysis report -CONTEXT_REPORT="build-context-$(date +%Y%m%d-%H%M).md" +# Create tmp directory if it doesn't exist +mkdir -p tmp + +# Create analysis report in tmp folder +CONTEXT_REPORT="tmp/build-context-$(date +%Y%m%d-%H%M).md" echo "# Build Context Analysis Report" > $CONTEXT_REPORT echo "Date: $(date)" >> $CONTEXT_REPORT echo "" >> $CONTEXT_REPORT diff --git a/bmad-core/tasks/loop-detection-escalation.md b/bmad-core/tasks/loop-detection-escalation.md index 0c13464d..17a4e792 100644 --- a/bmad-core/tasks/loop-detection-escalation.md +++ b/bmad-core/tasks/loop-detection-escalation.md @@ -45,7 +45,10 @@ echo "Issue ID: issue-$(date +%Y%m%d-%H%M)" echo "" # Create tracking report -LOOP_REPORT="loop-tracking-$(date +%Y%m%d-%H%M).md" +# Create tmp directory if it doesn't exist +mkdir -p tmp + +LOOP_REPORT="tmp/loop-tracking-$(date +%Y%m%d-%H%M).md" echo "# Loop Detection Tracking Report" > $LOOP_REPORT echo "Date: $(date)" >> $LOOP_REPORT echo "Issue ID: issue-$(date +%Y%m%d-%H%M)" >> $LOOP_REPORT @@ -293,7 +296,9 @@ select_collaborator() { # Generate copy-paste prompt for external LLM collaboration generate_external_prompt() { - EXTERNAL_PROMPT="external-llm-prompt-$(date +%Y%m%d-%H%M).md" + # Ensure tmp directory exists + mkdir -p tmp + EXTERNAL_PROMPT="tmp/external-llm-prompt-$(date +%Y%m%d-%H%M).md" cat > $EXTERNAL_PROMPT << 'EOF' # COLLABORATION REQUEST - Copy & Paste This Entire Message diff --git a/bmad-core/tasks/reality-audit-comprehensive.md b/bmad-core/tasks/reality-audit-comprehensive.md index a27775f6..b066f2eb 100644 --- a/bmad-core/tasks/reality-audit-comprehensive.md +++ b/bmad-core/tasks/reality-audit-comprehensive.md @@ -118,7 +118,10 @@ echo "Run Command: $RUN_CMD" echo "" # Create audit report file -AUDIT_REPORT="reality-audit-$(date +%Y%m%d-%H%M).md" +# Create tmp directory if it doesn't exist +mkdir -p tmp + +AUDIT_REPORT="tmp/reality-audit-$(date +%Y%m%d-%H%M).md" echo "# Reality Audit Report" > $AUDIT_REPORT echo "Date: $(date)" >> $AUDIT_REPORT echo "Project: $PROJECT_NAME" >> $AUDIT_REPORT @@ -875,4 +878,161 @@ This comprehensive reality audit combines automated simulation detection, manual - Exports standardized variables for other BMAD tools - Triggers create-remediation-story.md when needed - Provides audit reports for documentation -- Supports all major project types and build systems \ No newline at end of file +- Supports all major project types and build systems +- **Automatic Git Push on Perfect Completion** when all criteria are met + +--- + +## Phase 10: Automatic Git Push Validation + +### Git Push Criteria Assessment + +**CRITICAL: Only proceed with automatic Git push if ALL criteria are met:** + +```bash +# Git Push Validation Function +validate_git_push_criteria() { + local git_push_eligible=true + # Ensure tmp directory exists + mkdir -p tmp + local criteria_report="tmp/git-push-validation-$(date +%Y%m%d-%H%M).md" + + echo "=== AUTOMATIC GIT PUSH VALIDATION ===" > $criteria_report + echo "Date: $(date)" >> $criteria_report + echo "Story: $STORY_NAME" >> $criteria_report + echo "" >> $criteria_report + + # Criterion 1: Story Completion + echo "## Criterion 1: Story Completion Assessment" >> $criteria_report + if [ "$STORY_COMPLETION_PERCENT" -eq 100 ]; then + echo "✅ **Story Completion:** 100% - All tasks marked complete [x]" >> $criteria_report + else + echo "❌ **Story Completion:** ${STORY_COMPLETION_PERCENT}% - Incomplete tasks detected" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 2: Quality Scores + echo "" >> $criteria_report + echo "## Criterion 2: Quality Score Assessment" >> $criteria_report + if [ "$COMPOSITE_REALITY_SCORE" -ge 80 ] && [ "$REGRESSION_PREVENTION_SCORE" -ge 80 ] && [ "$TECHNICAL_DEBT_SCORE" -ge 70 ]; then + echo "✅ **Quality Scores:** Composite=$COMPOSITE_REALITY_SCORE, Regression=$REGRESSION_PREVENTION_SCORE, TechDebt=$TECHNICAL_DEBT_SCORE" >> $criteria_report + else + echo "❌ **Quality Scores:** Below thresholds - Composite=$COMPOSITE_REALITY_SCORE (<80), Regression=$REGRESSION_PREVENTION_SCORE (<80), TechDebt=$TECHNICAL_DEBT_SCORE (<70)" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 3: Build Status + echo "" >> $criteria_report + echo "## Criterion 3: Build Validation" >> $criteria_report + if [ "$BUILD_SUCCESS" = "true" ] && [ "$BUILD_WARNINGS_COUNT" -eq 0 ]; then + echo "✅ **Build Status:** Clean success with no warnings" >> $criteria_report + else + echo "❌ **Build Status:** Build failures or warnings detected" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 4: Simulation Patterns + echo "" >> $criteria_report + echo "## Criterion 4: Simulation Pattern Check" >> $criteria_report + if [ "$SIMULATION_PATTERNS_COUNT" -eq 0 ]; then + echo "✅ **Simulation Patterns:** Zero detected - Real implementation confirmed" >> $criteria_report + else + echo "❌ **Simulation Patterns:** $SIMULATION_PATTERNS_COUNT patterns detected" >> $criteria_report + git_push_eligible=false + fi + + # Final Decision + echo "" >> $criteria_report + echo "## Final Git Push Decision" >> $criteria_report + if [ "$git_push_eligible" = "true" ]; then + echo "🚀 **DECISION: AUTOMATIC GIT PUSH APPROVED**" >> $criteria_report + echo "All criteria met - proceeding with automatic commit and push" >> $criteria_report + execute_automatic_git_push + else + echo "🛑 **DECISION: AUTOMATIC GIT PUSH DENIED**" >> $criteria_report + echo "One or more criteria failed - manual *Push2Git command available if override needed" >> $criteria_report + echo "" >> $criteria_report + echo "**Override Available:** Use *Push2Git command to manually push despite issues" >> $criteria_report + fi + + echo "📋 **Criteria Report:** $criteria_report" +} + +# Automatic Git Push Execution +execute_automatic_git_push() { + echo "" + echo "🚀 **EXECUTING AUTOMATIC GIT PUSH**" + echo "All quality criteria validated - proceeding with commit and push..." + + # Generate intelligent commit message + local commit_msg="Complete story implementation with QA validation + +Story: $STORY_NAME +Quality Scores: Composite=${COMPOSITE_REALITY_SCORE}, Regression=${REGRESSION_PREVENTION_SCORE}, TechDebt=${TECHNICAL_DEBT_SCORE} +Build Status: Clean success +Simulation Patterns: Zero detected +All Tasks: Complete + +Automatically validated and pushed by BMAD QA Agent" + + # Execute git operations + git add . 2>/dev/null + if git commit -m "$commit_msg" 2>/dev/null; then + echo "✅ **Commit Created:** Story implementation committed successfully" + + # Attempt push (may require authentication) + if git push 2>/dev/null; then + echo "✅ **Push Successful:** Changes pushed to remote repository" + echo "🎯 **STORY COMPLETE:** All quality gates passed, changes pushed automatically" + else + echo "⚠️ **Push Failed:** Authentication required - use GitHub Desktop or configure git credentials" + echo "💡 **Suggestion:** Complete the push manually through GitHub Desktop" + fi + else + echo "❌ **Commit Failed:** No changes to commit or git error occurred" + fi +} +``` + +### Manual Override Command + +If automatic push criteria are not met but user wants to override: + +```bash +# Manual Push Override (for *Push2Git command) +execute_manual_git_override() { + echo "⚠️ **MANUAL GIT PUSH OVERRIDE REQUESTED**" + echo "WARNING: Quality criteria not fully met - proceeding with manual override" + + local override_msg="Manual override push - quality criteria not fully met + +Story: $STORY_NAME +Quality Issues Present: Check reality audit report +Override Reason: User manual decision +Pushed via: BMAD QA Agent *Push2Git command + +⚠️ Review and fix quality issues in subsequent commits" + + git add . 2>/dev/null + if git commit -m "$override_msg" 2>/dev/null; then + echo "✅ **Override Commit Created**" + if git push 2>/dev/null; then + echo "✅ **Override Push Successful:** Changes pushed despite quality issues" + else + echo "❌ **Override Push Failed:** Authentication or git error" + fi + else + echo "❌ **Override Commit Failed:** No changes or git error" + fi +} +``` + +### Usage Integration + +This Git push validation automatically executes at the end of every `*reality-audit` command: + +1. **Automatic Assessment:** All criteria checked automatically +2. **Conditional Push:** Only pushes when 100% quality criteria met +3. **Override Available:** `*Push2Git` command bypasses quality gates +4. **Detailed Reporting:** Complete criteria assessment documented +5. **Intelligent Commit Messages:** Context-aware commit descriptions \ No newline at end of file diff --git a/dist/agents/dev.txt b/dist/agents/dev.txt index 6f9ed0fa..38fa2290 100644 --- a/dist/agents/dev.txt +++ b/dist/agents/dev.txt @@ -465,7 +465,10 @@ echo "Run Command: $RUN_CMD" echo "" # Create audit report file -AUDIT_REPORT="reality-audit-$(date +%Y%m%d-%H%M).md" +# Create tmp directory if it doesn't exist +mkdir -p tmp + +AUDIT_REPORT="tmp/reality-audit-$(date +%Y%m%d-%H%M).md" echo "# Reality Audit Report" > $AUDIT_REPORT echo "Date: $(date)" >> $AUDIT_REPORT echo "Project: $PROJECT_NAME" >> $AUDIT_REPORT @@ -1222,7 +1225,164 @@ This comprehensive reality audit combines automated simulation detection, manual - Exports standardized variables for other BMAD tools - Triggers create-remediation-story.md when needed - Provides audit reports for documentation -- Supports all major project types and build systems +- Supports all major project types and build systems +- **Automatic Git Push on Perfect Completion** when all criteria are met + +--- + +## Phase 10: Automatic Git Push Validation + +### Git Push Criteria Assessment + +**CRITICAL: Only proceed with automatic Git push if ALL criteria are met:** + +```bash +# Git Push Validation Function +validate_git_push_criteria() { + local git_push_eligible=true + # Ensure tmp directory exists + mkdir -p tmp + local criteria_report="tmp/git-push-validation-$(date +%Y%m%d-%H%M).md" + + echo "=== AUTOMATIC GIT PUSH VALIDATION ===" > $criteria_report + echo "Date: $(date)" >> $criteria_report + echo "Story: $STORY_NAME" >> $criteria_report + echo "" >> $criteria_report + + # Criterion 1: Story Completion + echo "## Criterion 1: Story Completion Assessment" >> $criteria_report + if [ "$STORY_COMPLETION_PERCENT" -eq 100 ]; then + echo "✅ **Story Completion:** 100% - All tasks marked complete [x]" >> $criteria_report + else + echo "❌ **Story Completion:** ${STORY_COMPLETION_PERCENT}% - Incomplete tasks detected" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 2: Quality Scores + echo "" >> $criteria_report + echo "## Criterion 2: Quality Score Assessment" >> $criteria_report + if [ "$COMPOSITE_REALITY_SCORE" -ge 80 ] && [ "$REGRESSION_PREVENTION_SCORE" -ge 80 ] && [ "$TECHNICAL_DEBT_SCORE" -ge 70 ]; then + echo "✅ **Quality Scores:** Composite=$COMPOSITE_REALITY_SCORE, Regression=$REGRESSION_PREVENTION_SCORE, TechDebt=$TECHNICAL_DEBT_SCORE" >> $criteria_report + else + echo "❌ **Quality Scores:** Below thresholds - Composite=$COMPOSITE_REALITY_SCORE (<80), Regression=$REGRESSION_PREVENTION_SCORE (<80), TechDebt=$TECHNICAL_DEBT_SCORE (<70)" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 3: Build Status + echo "" >> $criteria_report + echo "## Criterion 3: Build Validation" >> $criteria_report + if [ "$BUILD_SUCCESS" = "true" ] && [ "$BUILD_WARNINGS_COUNT" -eq 0 ]; then + echo "✅ **Build Status:** Clean success with no warnings" >> $criteria_report + else + echo "❌ **Build Status:** Build failures or warnings detected" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 4: Simulation Patterns + echo "" >> $criteria_report + echo "## Criterion 4: Simulation Pattern Check" >> $criteria_report + if [ "$SIMULATION_PATTERNS_COUNT" -eq 0 ]; then + echo "✅ **Simulation Patterns:** Zero detected - Real implementation confirmed" >> $criteria_report + else + echo "❌ **Simulation Patterns:** $SIMULATION_PATTERNS_COUNT patterns detected" >> $criteria_report + git_push_eligible=false + fi + + # Final Decision + echo "" >> $criteria_report + echo "## Final Git Push Decision" >> $criteria_report + if [ "$git_push_eligible" = "true" ]; then + echo "🚀 **DECISION: AUTOMATIC GIT PUSH APPROVED**" >> $criteria_report + echo "All criteria met - proceeding with automatic commit and push" >> $criteria_report + execute_automatic_git_push + else + echo "🛑 **DECISION: AUTOMATIC GIT PUSH DENIED**" >> $criteria_report + echo "One or more criteria failed - manual *Push2Git command available if override needed" >> $criteria_report + echo "" >> $criteria_report + echo "**Override Available:** Use *Push2Git command to manually push despite issues" >> $criteria_report + fi + + echo "📋 **Criteria Report:** $criteria_report" +} + +# Automatic Git Push Execution +execute_automatic_git_push() { + echo "" + echo "🚀 **EXECUTING AUTOMATIC GIT PUSH**" + echo "All quality criteria validated - proceeding with commit and push..." + + # Generate intelligent commit message + local commit_msg="Complete story implementation with QA validation + +Story: $STORY_NAME +Quality Scores: Composite=${COMPOSITE_REALITY_SCORE}, Regression=${REGRESSION_PREVENTION_SCORE}, TechDebt=${TECHNICAL_DEBT_SCORE} +Build Status: Clean success +Simulation Patterns: Zero detected +All Tasks: Complete + +Automatically validated and pushed by BMAD QA Agent" + + # Execute git operations + git add . 2>/dev/null + if git commit -m "$commit_msg" 2>/dev/null; then + echo "✅ **Commit Created:** Story implementation committed successfully" + + # Attempt push (may require authentication) + if git push 2>/dev/null; then + echo "✅ **Push Successful:** Changes pushed to remote repository" + echo "🎯 **STORY COMPLETE:** All quality gates passed, changes pushed automatically" + else + echo "⚠️ **Push Failed:** Authentication required - use GitHub Desktop or configure git credentials" + echo "💡 **Suggestion:** Complete the push manually through GitHub Desktop" + fi + else + echo "❌ **Commit Failed:** No changes to commit or git error occurred" + fi +} +``` + +### Manual Override Command + +If automatic push criteria are not met but user wants to override: + +```bash +# Manual Push Override (for *Push2Git command) +execute_manual_git_override() { + echo "⚠️ **MANUAL GIT PUSH OVERRIDE REQUESTED**" + echo "WARNING: Quality criteria not fully met - proceeding with manual override" + + local override_msg="Manual override push - quality criteria not fully met + +Story: $STORY_NAME +Quality Issues Present: Check reality audit report +Override Reason: User manual decision +Pushed via: BMAD QA Agent *Push2Git command + +⚠️ Review and fix quality issues in subsequent commits" + + git add . 2>/dev/null + if git commit -m "$override_msg" 2>/dev/null; then + echo "✅ **Override Commit Created**" + if git push 2>/dev/null; then + echo "✅ **Override Push Successful:** Changes pushed despite quality issues" + else + echo "❌ **Override Push Failed:** Authentication or git error" + fi + else + echo "❌ **Override Commit Failed:** No changes or git error" + fi +} +``` + +### Usage Integration + +This Git push validation automatically executes at the end of every `*reality-audit` command: + +1. **Automatic Assessment:** All criteria checked automatically +2. **Conditional Push:** Only pushes when 100% quality criteria met +3. **Override Available:** `*Push2Git` command bypasses quality gates +4. **Detailed Reporting:** Complete criteria assessment documented +5. **Intelligent Commit Messages:** Context-aware commit descriptions ==================== END: .bmad-core/tasks/reality-audit-comprehensive.md ==================== ==================== START: .bmad-core/tasks/loop-detection-escalation.md ==================== @@ -1273,7 +1433,10 @@ echo "Issue ID: issue-$(date +%Y%m%d-%H%M)" echo "" # Create tracking report -LOOP_REPORT="loop-tracking-$(date +%Y%m%d-%H%M).md" +# Create tmp directory if it doesn't exist +mkdir -p tmp + +LOOP_REPORT="tmp/loop-tracking-$(date +%Y%m%d-%H%M).md" echo "# Loop Detection Tracking Report" > $LOOP_REPORT echo "Date: $(date)" >> $LOOP_REPORT echo "Issue ID: issue-$(date +%Y%m%d-%H%M)" >> $LOOP_REPORT @@ -1521,7 +1684,9 @@ select_collaborator() { # Generate copy-paste prompt for external LLM collaboration generate_external_prompt() { - EXTERNAL_PROMPT="external-llm-prompt-$(date +%Y%m%d-%H%M).md" + # Ensure tmp directory exists + mkdir -p tmp + EXTERNAL_PROMPT="tmp/external-llm-prompt-$(date +%Y%m%d-%H%M).md" cat > $EXTERNAL_PROMPT << 'EOF' # COLLABORATION REQUEST - Copy & Paste This Entire Message diff --git a/dist/agents/qa.txt b/dist/agents/qa.txt index a2e94020..0a086e44 100644 --- a/dist/agents/qa.txt +++ b/dist/agents/qa.txt @@ -63,6 +63,7 @@ automation_behavior: trigger_threshold: 80 auto_create_stories: true systematic_reaudit: true + auto_push_to_git: true trigger_conditions: - composite_reality_score_below: 80 - regression_prevention_score_below: 80 @@ -76,6 +77,22 @@ automation_behavior: - cross_reference_story_patterns: true - assign_to_developer: true - create_reaudit_workflow: true + git_push_criteria: + - story_completion: 100% + - composite_reality_score: '>=80' + - regression_prevention_score: '>=80' + - technical_debt_score: '>=70' + - build_status: clean_success + - simulation_patterns: zero_detected + - runtime_validation: pass + - all_tasks_completed: true + - all_tests_passing: true + git_push_actions: + - validate_all_criteria: true + - create_commit_message: true + - execute_git_push: true + - log_push_success: true + - notify_completion: true persona: role: Senior Developer & Test Architect style: Methodical, detail-oriented, quality-focused, mentoring, strategic @@ -110,6 +127,7 @@ commands: - reality-audit {story}: execute the task reality-audit-comprehensive for comprehensive simulation detection, reality validation, and regression prevention analysis - audit-validation {story}: Execute reality audit with AUTO-REMEDIATION - automatically generates fix story with regression prevention if composite score < 80, build failures, or critical issues detected - create-remediation: execute the task create-remediation-story to generate fix stories for identified issues + - Push2Git: Override command to manually push changes to git even when quality criteria are not fully met (use with caution) - escalate: Execute loop-detection-escalation task for validation challenges requiring external expertise - create-doc {template}: execute task create-doc (no template = ONLY show available templates listed under dependencies/templates below) - exit: Say goodbye as the QA Engineer, and then abandon inhabiting this persona @@ -408,7 +426,10 @@ echo "Run Command: $RUN_CMD" echo "" # Create audit report file -AUDIT_REPORT="reality-audit-$(date +%Y%m%d-%H%M).md" +# Create tmp directory if it doesn't exist +mkdir -p tmp + +AUDIT_REPORT="tmp/reality-audit-$(date +%Y%m%d-%H%M).md" echo "# Reality Audit Report" > $AUDIT_REPORT echo "Date: $(date)" >> $AUDIT_REPORT echo "Project: $PROJECT_NAME" >> $AUDIT_REPORT @@ -1165,7 +1186,164 @@ This comprehensive reality audit combines automated simulation detection, manual - Exports standardized variables for other BMAD tools - Triggers create-remediation-story.md when needed - Provides audit reports for documentation -- Supports all major project types and build systems +- Supports all major project types and build systems +- **Automatic Git Push on Perfect Completion** when all criteria are met + +--- + +## Phase 10: Automatic Git Push Validation + +### Git Push Criteria Assessment + +**CRITICAL: Only proceed with automatic Git push if ALL criteria are met:** + +```bash +# Git Push Validation Function +validate_git_push_criteria() { + local git_push_eligible=true + # Ensure tmp directory exists + mkdir -p tmp + local criteria_report="tmp/git-push-validation-$(date +%Y%m%d-%H%M).md" + + echo "=== AUTOMATIC GIT PUSH VALIDATION ===" > $criteria_report + echo "Date: $(date)" >> $criteria_report + echo "Story: $STORY_NAME" >> $criteria_report + echo "" >> $criteria_report + + # Criterion 1: Story Completion + echo "## Criterion 1: Story Completion Assessment" >> $criteria_report + if [ "$STORY_COMPLETION_PERCENT" -eq 100 ]; then + echo "✅ **Story Completion:** 100% - All tasks marked complete [x]" >> $criteria_report + else + echo "❌ **Story Completion:** ${STORY_COMPLETION_PERCENT}% - Incomplete tasks detected" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 2: Quality Scores + echo "" >> $criteria_report + echo "## Criterion 2: Quality Score Assessment" >> $criteria_report + if [ "$COMPOSITE_REALITY_SCORE" -ge 80 ] && [ "$REGRESSION_PREVENTION_SCORE" -ge 80 ] && [ "$TECHNICAL_DEBT_SCORE" -ge 70 ]; then + echo "✅ **Quality Scores:** Composite=$COMPOSITE_REALITY_SCORE, Regression=$REGRESSION_PREVENTION_SCORE, TechDebt=$TECHNICAL_DEBT_SCORE" >> $criteria_report + else + echo "❌ **Quality Scores:** Below thresholds - Composite=$COMPOSITE_REALITY_SCORE (<80), Regression=$REGRESSION_PREVENTION_SCORE (<80), TechDebt=$TECHNICAL_DEBT_SCORE (<70)" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 3: Build Status + echo "" >> $criteria_report + echo "## Criterion 3: Build Validation" >> $criteria_report + if [ "$BUILD_SUCCESS" = "true" ] && [ "$BUILD_WARNINGS_COUNT" -eq 0 ]; then + echo "✅ **Build Status:** Clean success with no warnings" >> $criteria_report + else + echo "❌ **Build Status:** Build failures or warnings detected" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 4: Simulation Patterns + echo "" >> $criteria_report + echo "## Criterion 4: Simulation Pattern Check" >> $criteria_report + if [ "$SIMULATION_PATTERNS_COUNT" -eq 0 ]; then + echo "✅ **Simulation Patterns:** Zero detected - Real implementation confirmed" >> $criteria_report + else + echo "❌ **Simulation Patterns:** $SIMULATION_PATTERNS_COUNT patterns detected" >> $criteria_report + git_push_eligible=false + fi + + # Final Decision + echo "" >> $criteria_report + echo "## Final Git Push Decision" >> $criteria_report + if [ "$git_push_eligible" = "true" ]; then + echo "🚀 **DECISION: AUTOMATIC GIT PUSH APPROVED**" >> $criteria_report + echo "All criteria met - proceeding with automatic commit and push" >> $criteria_report + execute_automatic_git_push + else + echo "🛑 **DECISION: AUTOMATIC GIT PUSH DENIED**" >> $criteria_report + echo "One or more criteria failed - manual *Push2Git command available if override needed" >> $criteria_report + echo "" >> $criteria_report + echo "**Override Available:** Use *Push2Git command to manually push despite issues" >> $criteria_report + fi + + echo "📋 **Criteria Report:** $criteria_report" +} + +# Automatic Git Push Execution +execute_automatic_git_push() { + echo "" + echo "🚀 **EXECUTING AUTOMATIC GIT PUSH**" + echo "All quality criteria validated - proceeding with commit and push..." + + # Generate intelligent commit message + local commit_msg="Complete story implementation with QA validation + +Story: $STORY_NAME +Quality Scores: Composite=${COMPOSITE_REALITY_SCORE}, Regression=${REGRESSION_PREVENTION_SCORE}, TechDebt=${TECHNICAL_DEBT_SCORE} +Build Status: Clean success +Simulation Patterns: Zero detected +All Tasks: Complete + +Automatically validated and pushed by BMAD QA Agent" + + # Execute git operations + git add . 2>/dev/null + if git commit -m "$commit_msg" 2>/dev/null; then + echo "✅ **Commit Created:** Story implementation committed successfully" + + # Attempt push (may require authentication) + if git push 2>/dev/null; then + echo "✅ **Push Successful:** Changes pushed to remote repository" + echo "🎯 **STORY COMPLETE:** All quality gates passed, changes pushed automatically" + else + echo "⚠️ **Push Failed:** Authentication required - use GitHub Desktop or configure git credentials" + echo "💡 **Suggestion:** Complete the push manually through GitHub Desktop" + fi + else + echo "❌ **Commit Failed:** No changes to commit or git error occurred" + fi +} +``` + +### Manual Override Command + +If automatic push criteria are not met but user wants to override: + +```bash +# Manual Push Override (for *Push2Git command) +execute_manual_git_override() { + echo "⚠️ **MANUAL GIT PUSH OVERRIDE REQUESTED**" + echo "WARNING: Quality criteria not fully met - proceeding with manual override" + + local override_msg="Manual override push - quality criteria not fully met + +Story: $STORY_NAME +Quality Issues Present: Check reality audit report +Override Reason: User manual decision +Pushed via: BMAD QA Agent *Push2Git command + +⚠️ Review and fix quality issues in subsequent commits" + + git add . 2>/dev/null + if git commit -m "$override_msg" 2>/dev/null; then + echo "✅ **Override Commit Created**" + if git push 2>/dev/null; then + echo "✅ **Override Push Successful:** Changes pushed despite quality issues" + else + echo "❌ **Override Push Failed:** Authentication or git error" + fi + else + echo "❌ **Override Commit Failed:** No changes or git error" + fi +} +``` + +### Usage Integration + +This Git push validation automatically executes at the end of every `*reality-audit` command: + +1. **Automatic Assessment:** All criteria checked automatically +2. **Conditional Push:** Only pushes when 100% quality criteria met +3. **Override Available:** `*Push2Git` command bypasses quality gates +4. **Detailed Reporting:** Complete criteria assessment documented +5. **Intelligent Commit Messages:** Context-aware commit descriptions ==================== END: .bmad-core/tasks/reality-audit-comprehensive.md ==================== ==================== START: .bmad-core/tasks/loop-detection-escalation.md ==================== @@ -1216,7 +1394,10 @@ echo "Issue ID: issue-$(date +%Y%m%d-%H%M)" echo "" # Create tracking report -LOOP_REPORT="loop-tracking-$(date +%Y%m%d-%H%M).md" +# Create tmp directory if it doesn't exist +mkdir -p tmp + +LOOP_REPORT="tmp/loop-tracking-$(date +%Y%m%d-%H%M).md" echo "# Loop Detection Tracking Report" > $LOOP_REPORT echo "Date: $(date)" >> $LOOP_REPORT echo "Issue ID: issue-$(date +%Y%m%d-%H%M)" >> $LOOP_REPORT @@ -1464,7 +1645,9 @@ select_collaborator() { # Generate copy-paste prompt for external LLM collaboration generate_external_prompt() { - EXTERNAL_PROMPT="external-llm-prompt-$(date +%Y%m%d-%H%M).md" + # Ensure tmp directory exists + mkdir -p tmp + EXTERNAL_PROMPT="tmp/external-llm-prompt-$(date +%Y%m%d-%H%M).md" cat > $EXTERNAL_PROMPT << 'EOF' # COLLABORATION REQUEST - Copy & Paste This Entire Message diff --git a/dist/teams/team-all.txt b/dist/teams/team-all.txt index 1c359d2f..2fccd335 100644 --- a/dist/teams/team-all.txt +++ b/dist/teams/team-all.txt @@ -536,6 +536,7 @@ automation_behavior: trigger_threshold: 80 auto_create_stories: true systematic_reaudit: true + auto_push_to_git: true trigger_conditions: - composite_reality_score_below: 80 - regression_prevention_score_below: 80 @@ -549,6 +550,22 @@ automation_behavior: - cross_reference_story_patterns: true - assign_to_developer: true - create_reaudit_workflow: true + git_push_criteria: + - story_completion: 100% + - composite_reality_score: '>=80' + - regression_prevention_score: '>=80' + - technical_debt_score: '>=70' + - build_status: clean_success + - simulation_patterns: zero_detected + - runtime_validation: pass + - all_tasks_completed: true + - all_tests_passing: true + git_push_actions: + - validate_all_criteria: true + - create_commit_message: true + - execute_git_push: true + - log_push_success: true + - notify_completion: true persona: role: Senior Developer & Test Architect style: Methodical, detail-oriented, quality-focused, mentoring, strategic @@ -583,6 +600,7 @@ commands: - reality-audit {story}: execute the task reality-audit-comprehensive for comprehensive simulation detection, reality validation, and regression prevention analysis - audit-validation {story}: Execute reality audit with AUTO-REMEDIATION - automatically generates fix story with regression prevention if composite score < 80, build failures, or critical issues detected - create-remediation: execute the task create-remediation-story to generate fix stories for identified issues + - Push2Git: Override command to manually push changes to git even when quality criteria are not fully met (use with caution) - escalate: Execute loop-detection-escalation task for validation challenges requiring external expertise - create-doc {template}: execute task create-doc (no template = ONLY show available templates listed under dependencies/templates below) - exit: Say goodbye as the QA Engineer, and then abandon inhabiting this persona @@ -6726,7 +6744,10 @@ echo "Run Command: $RUN_CMD" echo "" # Create audit report file -AUDIT_REPORT="reality-audit-$(date +%Y%m%d-%H%M).md" +# Create tmp directory if it doesn't exist +mkdir -p tmp + +AUDIT_REPORT="tmp/reality-audit-$(date +%Y%m%d-%H%M).md" echo "# Reality Audit Report" > $AUDIT_REPORT echo "Date: $(date)" >> $AUDIT_REPORT echo "Project: $PROJECT_NAME" >> $AUDIT_REPORT @@ -7483,7 +7504,164 @@ This comprehensive reality audit combines automated simulation detection, manual - Exports standardized variables for other BMAD tools - Triggers create-remediation-story.md when needed - Provides audit reports for documentation -- Supports all major project types and build systems +- Supports all major project types and build systems +- **Automatic Git Push on Perfect Completion** when all criteria are met + +--- + +## Phase 10: Automatic Git Push Validation + +### Git Push Criteria Assessment + +**CRITICAL: Only proceed with automatic Git push if ALL criteria are met:** + +```bash +# Git Push Validation Function +validate_git_push_criteria() { + local git_push_eligible=true + # Ensure tmp directory exists + mkdir -p tmp + local criteria_report="tmp/git-push-validation-$(date +%Y%m%d-%H%M).md" + + echo "=== AUTOMATIC GIT PUSH VALIDATION ===" > $criteria_report + echo "Date: $(date)" >> $criteria_report + echo "Story: $STORY_NAME" >> $criteria_report + echo "" >> $criteria_report + + # Criterion 1: Story Completion + echo "## Criterion 1: Story Completion Assessment" >> $criteria_report + if [ "$STORY_COMPLETION_PERCENT" -eq 100 ]; then + echo "✅ **Story Completion:** 100% - All tasks marked complete [x]" >> $criteria_report + else + echo "❌ **Story Completion:** ${STORY_COMPLETION_PERCENT}% - Incomplete tasks detected" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 2: Quality Scores + echo "" >> $criteria_report + echo "## Criterion 2: Quality Score Assessment" >> $criteria_report + if [ "$COMPOSITE_REALITY_SCORE" -ge 80 ] && [ "$REGRESSION_PREVENTION_SCORE" -ge 80 ] && [ "$TECHNICAL_DEBT_SCORE" -ge 70 ]; then + echo "✅ **Quality Scores:** Composite=$COMPOSITE_REALITY_SCORE, Regression=$REGRESSION_PREVENTION_SCORE, TechDebt=$TECHNICAL_DEBT_SCORE" >> $criteria_report + else + echo "❌ **Quality Scores:** Below thresholds - Composite=$COMPOSITE_REALITY_SCORE (<80), Regression=$REGRESSION_PREVENTION_SCORE (<80), TechDebt=$TECHNICAL_DEBT_SCORE (<70)" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 3: Build Status + echo "" >> $criteria_report + echo "## Criterion 3: Build Validation" >> $criteria_report + if [ "$BUILD_SUCCESS" = "true" ] && [ "$BUILD_WARNINGS_COUNT" -eq 0 ]; then + echo "✅ **Build Status:** Clean success with no warnings" >> $criteria_report + else + echo "❌ **Build Status:** Build failures or warnings detected" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 4: Simulation Patterns + echo "" >> $criteria_report + echo "## Criterion 4: Simulation Pattern Check" >> $criteria_report + if [ "$SIMULATION_PATTERNS_COUNT" -eq 0 ]; then + echo "✅ **Simulation Patterns:** Zero detected - Real implementation confirmed" >> $criteria_report + else + echo "❌ **Simulation Patterns:** $SIMULATION_PATTERNS_COUNT patterns detected" >> $criteria_report + git_push_eligible=false + fi + + # Final Decision + echo "" >> $criteria_report + echo "## Final Git Push Decision" >> $criteria_report + if [ "$git_push_eligible" = "true" ]; then + echo "🚀 **DECISION: AUTOMATIC GIT PUSH APPROVED**" >> $criteria_report + echo "All criteria met - proceeding with automatic commit and push" >> $criteria_report + execute_automatic_git_push + else + echo "🛑 **DECISION: AUTOMATIC GIT PUSH DENIED**" >> $criteria_report + echo "One or more criteria failed - manual *Push2Git command available if override needed" >> $criteria_report + echo "" >> $criteria_report + echo "**Override Available:** Use *Push2Git command to manually push despite issues" >> $criteria_report + fi + + echo "📋 **Criteria Report:** $criteria_report" +} + +# Automatic Git Push Execution +execute_automatic_git_push() { + echo "" + echo "🚀 **EXECUTING AUTOMATIC GIT PUSH**" + echo "All quality criteria validated - proceeding with commit and push..." + + # Generate intelligent commit message + local commit_msg="Complete story implementation with QA validation + +Story: $STORY_NAME +Quality Scores: Composite=${COMPOSITE_REALITY_SCORE}, Regression=${REGRESSION_PREVENTION_SCORE}, TechDebt=${TECHNICAL_DEBT_SCORE} +Build Status: Clean success +Simulation Patterns: Zero detected +All Tasks: Complete + +Automatically validated and pushed by BMAD QA Agent" + + # Execute git operations + git add . 2>/dev/null + if git commit -m "$commit_msg" 2>/dev/null; then + echo "✅ **Commit Created:** Story implementation committed successfully" + + # Attempt push (may require authentication) + if git push 2>/dev/null; then + echo "✅ **Push Successful:** Changes pushed to remote repository" + echo "🎯 **STORY COMPLETE:** All quality gates passed, changes pushed automatically" + else + echo "⚠️ **Push Failed:** Authentication required - use GitHub Desktop or configure git credentials" + echo "💡 **Suggestion:** Complete the push manually through GitHub Desktop" + fi + else + echo "❌ **Commit Failed:** No changes to commit or git error occurred" + fi +} +``` + +### Manual Override Command + +If automatic push criteria are not met but user wants to override: + +```bash +# Manual Push Override (for *Push2Git command) +execute_manual_git_override() { + echo "⚠️ **MANUAL GIT PUSH OVERRIDE REQUESTED**" + echo "WARNING: Quality criteria not fully met - proceeding with manual override" + + local override_msg="Manual override push - quality criteria not fully met + +Story: $STORY_NAME +Quality Issues Present: Check reality audit report +Override Reason: User manual decision +Pushed via: BMAD QA Agent *Push2Git command + +⚠️ Review and fix quality issues in subsequent commits" + + git add . 2>/dev/null + if git commit -m "$override_msg" 2>/dev/null; then + echo "✅ **Override Commit Created**" + if git push 2>/dev/null; then + echo "✅ **Override Push Successful:** Changes pushed despite quality issues" + else + echo "❌ **Override Push Failed:** Authentication or git error" + fi + else + echo "❌ **Override Commit Failed:** No changes or git error" + fi +} +``` + +### Usage Integration + +This Git push validation automatically executes at the end of every `*reality-audit` command: + +1. **Automatic Assessment:** All criteria checked automatically +2. **Conditional Push:** Only pushes when 100% quality criteria met +3. **Override Available:** `*Push2Git` command bypasses quality gates +4. **Detailed Reporting:** Complete criteria assessment documented +5. **Intelligent Commit Messages:** Context-aware commit descriptions ==================== END: .bmad-core/tasks/reality-audit-comprehensive.md ==================== ==================== START: .bmad-core/tasks/loop-detection-escalation.md ==================== @@ -7534,7 +7712,10 @@ echo "Issue ID: issue-$(date +%Y%m%d-%H%M)" echo "" # Create tracking report -LOOP_REPORT="loop-tracking-$(date +%Y%m%d-%H%M).md" +# Create tmp directory if it doesn't exist +mkdir -p tmp + +LOOP_REPORT="tmp/loop-tracking-$(date +%Y%m%d-%H%M).md" echo "# Loop Detection Tracking Report" > $LOOP_REPORT echo "Date: $(date)" >> $LOOP_REPORT echo "Issue ID: issue-$(date +%Y%m%d-%H%M)" >> $LOOP_REPORT @@ -7782,7 +7963,9 @@ select_collaborator() { # Generate copy-paste prompt for external LLM collaboration generate_external_prompt() { - EXTERNAL_PROMPT="external-llm-prompt-$(date +%Y%m%d-%H%M).md" + # Ensure tmp directory exists + mkdir -p tmp + EXTERNAL_PROMPT="tmp/external-llm-prompt-$(date +%Y%m%d-%H%M).md" cat > $EXTERNAL_PROMPT << 'EOF' # COLLABORATION REQUEST - Copy & Paste This Entire Message diff --git a/dist/teams/team-ide-minimal.txt b/dist/teams/team-ide-minimal.txt index 51b59ea1..bdee0de0 100644 --- a/dist/teams/team-ide-minimal.txt +++ b/dist/teams/team-ide-minimal.txt @@ -385,6 +385,7 @@ automation_behavior: trigger_threshold: 80 auto_create_stories: true systematic_reaudit: true + auto_push_to_git: true trigger_conditions: - composite_reality_score_below: 80 - regression_prevention_score_below: 80 @@ -398,6 +399,22 @@ automation_behavior: - cross_reference_story_patterns: true - assign_to_developer: true - create_reaudit_workflow: true + git_push_criteria: + - story_completion: 100% + - composite_reality_score: '>=80' + - regression_prevention_score: '>=80' + - technical_debt_score: '>=70' + - build_status: clean_success + - simulation_patterns: zero_detected + - runtime_validation: pass + - all_tasks_completed: true + - all_tests_passing: true + git_push_actions: + - validate_all_criteria: true + - create_commit_message: true + - execute_git_push: true + - log_push_success: true + - notify_completion: true persona: role: Senior Developer & Test Architect style: Methodical, detail-oriented, quality-focused, mentoring, strategic @@ -432,6 +449,7 @@ commands: - reality-audit {story}: execute the task reality-audit-comprehensive for comprehensive simulation detection, reality validation, and regression prevention analysis - audit-validation {story}: Execute reality audit with AUTO-REMEDIATION - automatically generates fix story with regression prevention if composite score < 80, build failures, or critical issues detected - create-remediation: execute the task create-remediation-story to generate fix stories for identified issues + - Push2Git: Override command to manually push changes to git even when quality criteria are not fully met (use with caution) - escalate: Execute loop-detection-escalation task for validation challenges requiring external expertise - create-doc {template}: execute task create-doc (no template = ONLY show available templates listed under dependencies/templates below) - exit: Say goodbye as the QA Engineer, and then abandon inhabiting this persona @@ -3438,7 +3456,10 @@ echo "Run Command: $RUN_CMD" echo "" # Create audit report file -AUDIT_REPORT="reality-audit-$(date +%Y%m%d-%H%M).md" +# Create tmp directory if it doesn't exist +mkdir -p tmp + +AUDIT_REPORT="tmp/reality-audit-$(date +%Y%m%d-%H%M).md" echo "# Reality Audit Report" > $AUDIT_REPORT echo "Date: $(date)" >> $AUDIT_REPORT echo "Project: $PROJECT_NAME" >> $AUDIT_REPORT @@ -4195,7 +4216,164 @@ This comprehensive reality audit combines automated simulation detection, manual - Exports standardized variables for other BMAD tools - Triggers create-remediation-story.md when needed - Provides audit reports for documentation -- Supports all major project types and build systems +- Supports all major project types and build systems +- **Automatic Git Push on Perfect Completion** when all criteria are met + +--- + +## Phase 10: Automatic Git Push Validation + +### Git Push Criteria Assessment + +**CRITICAL: Only proceed with automatic Git push if ALL criteria are met:** + +```bash +# Git Push Validation Function +validate_git_push_criteria() { + local git_push_eligible=true + # Ensure tmp directory exists + mkdir -p tmp + local criteria_report="tmp/git-push-validation-$(date +%Y%m%d-%H%M).md" + + echo "=== AUTOMATIC GIT PUSH VALIDATION ===" > $criteria_report + echo "Date: $(date)" >> $criteria_report + echo "Story: $STORY_NAME" >> $criteria_report + echo "" >> $criteria_report + + # Criterion 1: Story Completion + echo "## Criterion 1: Story Completion Assessment" >> $criteria_report + if [ "$STORY_COMPLETION_PERCENT" -eq 100 ]; then + echo "✅ **Story Completion:** 100% - All tasks marked complete [x]" >> $criteria_report + else + echo "❌ **Story Completion:** ${STORY_COMPLETION_PERCENT}% - Incomplete tasks detected" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 2: Quality Scores + echo "" >> $criteria_report + echo "## Criterion 2: Quality Score Assessment" >> $criteria_report + if [ "$COMPOSITE_REALITY_SCORE" -ge 80 ] && [ "$REGRESSION_PREVENTION_SCORE" -ge 80 ] && [ "$TECHNICAL_DEBT_SCORE" -ge 70 ]; then + echo "✅ **Quality Scores:** Composite=$COMPOSITE_REALITY_SCORE, Regression=$REGRESSION_PREVENTION_SCORE, TechDebt=$TECHNICAL_DEBT_SCORE" >> $criteria_report + else + echo "❌ **Quality Scores:** Below thresholds - Composite=$COMPOSITE_REALITY_SCORE (<80), Regression=$REGRESSION_PREVENTION_SCORE (<80), TechDebt=$TECHNICAL_DEBT_SCORE (<70)" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 3: Build Status + echo "" >> $criteria_report + echo "## Criterion 3: Build Validation" >> $criteria_report + if [ "$BUILD_SUCCESS" = "true" ] && [ "$BUILD_WARNINGS_COUNT" -eq 0 ]; then + echo "✅ **Build Status:** Clean success with no warnings" >> $criteria_report + else + echo "❌ **Build Status:** Build failures or warnings detected" >> $criteria_report + git_push_eligible=false + fi + + # Criterion 4: Simulation Patterns + echo "" >> $criteria_report + echo "## Criterion 4: Simulation Pattern Check" >> $criteria_report + if [ "$SIMULATION_PATTERNS_COUNT" -eq 0 ]; then + echo "✅ **Simulation Patterns:** Zero detected - Real implementation confirmed" >> $criteria_report + else + echo "❌ **Simulation Patterns:** $SIMULATION_PATTERNS_COUNT patterns detected" >> $criteria_report + git_push_eligible=false + fi + + # Final Decision + echo "" >> $criteria_report + echo "## Final Git Push Decision" >> $criteria_report + if [ "$git_push_eligible" = "true" ]; then + echo "🚀 **DECISION: AUTOMATIC GIT PUSH APPROVED**" >> $criteria_report + echo "All criteria met - proceeding with automatic commit and push" >> $criteria_report + execute_automatic_git_push + else + echo "🛑 **DECISION: AUTOMATIC GIT PUSH DENIED**" >> $criteria_report + echo "One or more criteria failed - manual *Push2Git command available if override needed" >> $criteria_report + echo "" >> $criteria_report + echo "**Override Available:** Use *Push2Git command to manually push despite issues" >> $criteria_report + fi + + echo "📋 **Criteria Report:** $criteria_report" +} + +# Automatic Git Push Execution +execute_automatic_git_push() { + echo "" + echo "🚀 **EXECUTING AUTOMATIC GIT PUSH**" + echo "All quality criteria validated - proceeding with commit and push..." + + # Generate intelligent commit message + local commit_msg="Complete story implementation with QA validation + +Story: $STORY_NAME +Quality Scores: Composite=${COMPOSITE_REALITY_SCORE}, Regression=${REGRESSION_PREVENTION_SCORE}, TechDebt=${TECHNICAL_DEBT_SCORE} +Build Status: Clean success +Simulation Patterns: Zero detected +All Tasks: Complete + +Automatically validated and pushed by BMAD QA Agent" + + # Execute git operations + git add . 2>/dev/null + if git commit -m "$commit_msg" 2>/dev/null; then + echo "✅ **Commit Created:** Story implementation committed successfully" + + # Attempt push (may require authentication) + if git push 2>/dev/null; then + echo "✅ **Push Successful:** Changes pushed to remote repository" + echo "🎯 **STORY COMPLETE:** All quality gates passed, changes pushed automatically" + else + echo "⚠️ **Push Failed:** Authentication required - use GitHub Desktop or configure git credentials" + echo "💡 **Suggestion:** Complete the push manually through GitHub Desktop" + fi + else + echo "❌ **Commit Failed:** No changes to commit or git error occurred" + fi +} +``` + +### Manual Override Command + +If automatic push criteria are not met but user wants to override: + +```bash +# Manual Push Override (for *Push2Git command) +execute_manual_git_override() { + echo "⚠️ **MANUAL GIT PUSH OVERRIDE REQUESTED**" + echo "WARNING: Quality criteria not fully met - proceeding with manual override" + + local override_msg="Manual override push - quality criteria not fully met + +Story: $STORY_NAME +Quality Issues Present: Check reality audit report +Override Reason: User manual decision +Pushed via: BMAD QA Agent *Push2Git command + +⚠️ Review and fix quality issues in subsequent commits" + + git add . 2>/dev/null + if git commit -m "$override_msg" 2>/dev/null; then + echo "✅ **Override Commit Created**" + if git push 2>/dev/null; then + echo "✅ **Override Push Successful:** Changes pushed despite quality issues" + else + echo "❌ **Override Push Failed:** Authentication or git error" + fi + else + echo "❌ **Override Commit Failed:** No changes or git error" + fi +} +``` + +### Usage Integration + +This Git push validation automatically executes at the end of every `*reality-audit` command: + +1. **Automatic Assessment:** All criteria checked automatically +2. **Conditional Push:** Only pushes when 100% quality criteria met +3. **Override Available:** `*Push2Git` command bypasses quality gates +4. **Detailed Reporting:** Complete criteria assessment documented +5. **Intelligent Commit Messages:** Context-aware commit descriptions ==================== END: .bmad-core/tasks/reality-audit-comprehensive.md ==================== ==================== START: .bmad-core/tasks/loop-detection-escalation.md ==================== @@ -4246,7 +4424,10 @@ echo "Issue ID: issue-$(date +%Y%m%d-%H%M)" echo "" # Create tracking report -LOOP_REPORT="loop-tracking-$(date +%Y%m%d-%H%M).md" +# Create tmp directory if it doesn't exist +mkdir -p tmp + +LOOP_REPORT="tmp/loop-tracking-$(date +%Y%m%d-%H%M).md" echo "# Loop Detection Tracking Report" > $LOOP_REPORT echo "Date: $(date)" >> $LOOP_REPORT echo "Issue ID: issue-$(date +%Y%m%d-%H%M)" >> $LOOP_REPORT @@ -4494,7 +4675,9 @@ select_collaborator() { # Generate copy-paste prompt for external LLM collaboration generate_external_prompt() { - EXTERNAL_PROMPT="external-llm-prompt-$(date +%Y%m%d-%H%M).md" + # Ensure tmp directory exists + mkdir -p tmp + EXTERNAL_PROMPT="tmp/external-llm-prompt-$(date +%Y%m%d-%H%M).md" cat > $EXTERNAL_PROMPT << 'EOF' # COLLABORATION REQUEST - Copy & Paste This Entire Message diff --git a/enhancements.md b/enhancements.md index 480be102..58009c38 100644 --- a/enhancements.md +++ b/enhancements.md @@ -1,250 +1,144 @@ -# BMAD Method Quality Framework Enhancements +# 🚀 BMAD Method Quality Framework Enhancements -## Overview - -This document outlines the new features and functionality added to the BMAD Method to create an enterprise-grade quality engineering framework for AI-assisted development. - -## New Core Features - -### 1. Reality Enforcement System - -**Purpose:** Prevent "bull in china shop" development behavior through objective quality measurement and automated validation. - -**Key Features:** - -- **Automated Simulation Pattern Detection**: Identifies 6 distinct pattern types including Random.NextDouble(), Task.FromResult(), NotImplementedException, TODO comments, simulation methods, and hardcoded test data -- **Objective Reality Scoring**: A-F grading system (90-100=A, 80-89=B, 70-79=C, 60-69=D, <60=F) with clear enforcement thresholds -- **Build and Runtime Validation**: Automated compilation and execution testing with platform-specific error detection - -### 2. Regression Prevention Framework - -**Purpose:** Ensure QA fixes don't introduce regressions or technical debt through story context analysis and pattern compliance. - -**Key Features:** - -- **Story Context Analysis**: Automatic analysis of previous successful implementations to establish architectural patterns -- **Pattern Consistency Checking**: Validates new implementations against established patterns from completed stories -- **Integration Impact Assessment**: Evaluates potential impacts on existing functionality and external dependencies -- **Technical Debt Prevention Scoring**: Prevents introduction of code complexity and maintainability issues - -### 3. Composite Quality Scoring System - -**Purpose:** Provide comprehensive quality assessment through weighted component scoring. - -**Scoring Components:** - -- **Simulation Reality (40%)**: Traditional simulation pattern detection and build/runtime validation -- **Regression Prevention (35%)**: Pattern consistency, architectural compliance, and integration safety -- **Technical Debt Prevention (25%)**: Code quality, maintainability, and architectural alignment - -**Quality Thresholds:** - -- Composite Reality Score: ≥80 (required for completion) -- Regression Prevention Score: ≥80 (required for auto-remediation) -- Technical Debt Score: ≥70 (required for quality approval) - -### 4. Automated Remediation Workflow - -**Purpose:** Eliminate manual QA-to-Developer handoffs through automatic fix story generation. - -**Key Features:** - -- **Automatic Story Generation**: Creates structured developer stories when quality thresholds are not met -- **Regression-Safe Recommendations**: Includes specific implementation approaches that prevent functionality loss -- **Cross-Pattern Referencing**: Automatically references successful patterns from previous stories -- **Systematic Fix Prioritization**: Orders remediation by impact (simulation → regression → build → technical debt → runtime) - -### 5. Automatic Loop Detection & Escalation System - -**Purpose:** Prevent agents from getting stuck in repetitive debugging cycles through automatic collaborative escalation. - -**Key Features:** - -- **Automatic Failure Tracking**: Maintains separate counters per specific issue, resets on successful progress -- **Zero-Touch Escalation**: Automatically triggers after 3 consecutive failed attempts at same task/issue -- **Copy-Paste Prompt Generation**: Creates structured collaboration request with fill-in-the-blank format for external LLMs -- **Multi-LLM Support**: Optimized prompts for Gemini, GPT-4, Claude, or specialized AI agents -- **Learning Integration**: Documents patterns and solutions from collaborative sessions - -**Automatic Triggers:** - -- **Dev Agent**: Build failures, test implementation failures, validation errors, reality audit failures -- **QA Agent**: Reality audit failures, quality score issues, regression prevention problems, runtime failures - -## Enhanced Agent Commands - -### Developer Agent (James) New Commands - -- **`*develop-story`**: Follow the systematic develop-story workflow to implement all story tasks with automatic progress tracking - - - **Features**: Systematic task execution, automatic checkbox completion, validation enforcement, file list maintenance - - **Workflow**: Read task → Implement → Write tests → Execute validations → Mark complete [x] → Repeat - - **Output**: Progressive task completion with automatic story updates and comprehensive validation - -- **`*reality-audit`**: Execute reality-audit-comprehensive task with regression prevention analysis - - - **Features**: Multi-language project detection, automated pattern scanning, story context analysis, build/runtime validation - - **Output**: Composite reality score with A-F grading and automatic remediation triggers - -- **`*build-context`**: Execute build-context-analysis for comprehensive pre-fix context investigation - - - **Features**: Git history analysis, test contract evaluation, dependency mapping, risk assessment - - **Output**: Historical context report with implementation planning and validation strategy - -- **`*escalate`**: Execute loop-detection-escalation for external AI collaboration when stuck - - **Features**: Structured context packaging, collaborator selection, solution integration - - **Output**: Collaboration request package for external expert engagement - -### QA Agent (Quinn) Enhanced Commands - -- **`*reality-audit {story}`**: Manual quality audit with regression prevention analysis - - - **Enhanced**: Now includes story context analysis, pattern consistency checking, and composite scoring - - **Output**: Comprehensive audit report with regression risk assessment - -- **`*audit-validation {story}`**: Automated quality audit with guaranteed regression-safe auto-remediation - - - **Enhanced**: Automatically triggers remediation workflows with regression prevention - - **Auto-Triggers**: composite_score_below 80, regression_prevention_score_below 80, technical_debt_score_below 70 - - **Auto-Actions**: generate_remediation_story, include_regression_prevention, cross_reference_story_patterns - -- **`*create-remediation`**: Generate comprehensive fix stories with regression prevention capabilities - - **Enhanced**: Includes story context analysis, pattern compliance requirements, and regression-safe implementation approaches - -## New Automation Behaviors - -### Developer Agent Automation Configuration - -```yaml -auto_escalation: - trigger: "3 consecutive failed attempts at the same task/issue" - tracking: "Maintain attempt counter per specific issue/task - reset on successful progress" - action: "AUTOMATIC: Execute loop-detection-escalation task → Generate copy-paste prompt for external LLM collaboration → Present to user" - examples: - - "Build fails 3 times with same error despite different fix attempts" - - "Test implementation fails 3 times with different approaches" - - "Same validation error persists after 3 different solutions tried" - - "Reality audit fails 3 times on same simulation pattern despite fixes" -``` - -### QA Agent Automation Configuration - -```yaml -automation_behavior: - always_auto_remediate: true - trigger_threshold: 80 - auto_create_stories: true - systematic_reaudit: true - trigger_conditions: - - composite_reality_score_below: 80 - - regression_prevention_score_below: 80 - - technical_debt_score_below: 70 - - build_failures: true - - critical_simulation_patterns: 3+ - - runtime_failures: true - auto_actions: - - generate_remediation_story: true - - include_regression_prevention: true - - cross_reference_story_patterns: true - - assign_to_developer: true - - create_reaudit_workflow: true - -auto_escalation: - trigger: "3 consecutive failed attempts at resolving the same quality issue" - tracking: "Maintain failure counter per specific quality issue - reset on successful resolution" - action: "AUTOMATIC: Execute loop-detection-escalation task → Generate copy-paste prompt for external LLM collaboration → Present to user" - examples: - - "Same reality audit failure persists after 3 different remediation attempts" - - "Composite quality score stays below 80% after 3 fix cycles" - - "Same regression prevention issue fails 3 times despite different approaches" - - "Build/runtime validation fails 3 times on same error after different solutions" -``` - -### Developer Agent Enhanced Completion Requirements & Automation - -- **MANDATORY**: Execute reality-audit-comprehensive before claiming completion -- **AUTO-ESCALATE**: Automatically execute loop-detection-escalation after 3 consecutive failures on same issue -- **BUILD SUCCESS**: Clean Release mode compilation required -- **REGRESSION PREVENTION**: Pattern compliance with previous successful implementations - -**Automatic Escalation Behavior:** - -```yaml -auto_escalation: - trigger: "3 consecutive failed attempts at the same task/issue" - tracking: "Maintain attempt counter per specific issue/task - reset on successful progress" - action: "AUTOMATIC: Execute loop-detection-escalation task → Generate copy-paste prompt for external LLM collaboration → Present to user" -``` - -### QA Agent Enhanced Automation - -**Automatic Escalation Behavior:** - -```yaml -auto_escalation: - trigger: "3 consecutive failed attempts at resolving the same quality issue" - tracking: "Maintain failure counter per specific quality issue - reset on successful resolution" - action: "AUTOMATIC: Execute loop-detection-escalation task → Generate copy-paste prompt for external LLM collaboration → Present to user" -``` - -## Implementation Files - -### Core Enhancement Components - -- **`bmad-core/tasks/reality-audit-comprehensive.md`**: 9-phase comprehensive reality audit with regression prevention -- **`bmad-core/tasks/create-remediation-story.md`**: Automated regression-safe remediation story generation -- **`bmad-core/tasks/loop-detection-escalation.md`**: Systematic loop prevention and external collaboration framework -- **`bmad-core/tasks/build-context-analysis.md`**: Comprehensive build context investigation and planning - -### Enhanced Agent Files - -- **`bmad-core/agents/dev.md`**: Enhanced developer agent with reality enforcement and loop prevention -- **`bmad-core/agents/qa.md`**: Enhanced QA agent with auto-remediation and regression prevention - -### Enhanced Validation Checklists - -- **`bmad-core/checklists/story-dod-checklist.md`**: Updated with reality validation and static analysis requirements -- **`bmad-core/checklists/static-analysis-checklist.md`**: Comprehensive code quality validation - -## Strategic Benefits - -### Quality Improvements - -- **Zero Tolerance for Simulation Patterns**: Systematic detection and remediation of mock implementations -- **Regression Prevention**: Cross-referencing with previous successful patterns prevents functionality loss -- **Technical Debt Prevention**: Maintains code quality and architectural consistency -- **Objective Quality Measurement**: Evidence-based assessment replaces subjective evaluations - -### Workflow Automation - -- **Eliminated Manual Handoffs**: QA findings automatically generate developer stories -- **Systematic Remediation**: Prioritized fix sequences prevent cascading issues -- **Continuous Quality Loop**: Automatic re-audit after remediation ensures standards are met -- **Collaborative Problem Solving**: External AI expertise available when internal approaches reach limits - -### Enterprise-Grade Capabilities - -- **Multi-Language Support**: Works across different project types and technology stacks -- **Scalable Quality Framework**: Handles projects of varying complexity and size -- **Audit Trail Documentation**: Complete evidence chain for quality decisions -- **Continuous Improvement**: Learning integration from collaborative solutions - -## Expected Impact - -### Measurable Outcomes - -- **75% reduction** in simulation patterns reaching production code -- **60+ minutes saved** per debugging session through loop prevention -- **Automated workflow generation** eliminates QA-to-Developer handoff delays -- **Systematic quality enforcement** ensures consistent implementation standards - -### Process Improvements - -- **Proactive Quality Gates**: Issues caught and remediated before code review -- **Collaborative Expertise**: External AI collaboration available for complex issues -- **Pattern-Based Development**: Reuse of successful implementation approaches -- **Continuous Learning**: Knowledge retention from collaborative problem solving +> **Transform AI-assisted development from basic agent orchestration into enterprise-grade quality engineering with systematic accountability, automated workflows, and collaborative problem-solving capabilities.** --- -_These enhancements transform BMAD Method from a basic agent orchestration system into an enterprise-grade AI development quality platform with systematic accountability, automated workflows, and collaborative problem-solving capabilities._ +## 🎯 What's New + +### ✨ Six Game-Changing Features + +| Feature | Purpose | Key Innovation | +|---------|---------|----------------| +| **🔍 Reality Enforcement** | Stop "bull in china shop" development | Automated simulation pattern detection with A-F scoring | +| **🛡️ Regression Prevention** | Ensure fixes don't break existing code | Story context analysis with pattern compliance | +| **⚖️ Composite Quality Scoring** | Objective quality measurement | Weighted scoring: 40% Reality + 35% Regression + 25% Tech Debt | +| **🔄 Auto-Remediation Workflow** | Eliminate manual QA handoffs | Automatic fix story generation with regression safety | +| **🔗 Loop Detection & Escalation** | Break debugging cycles automatically | Copy-paste prompts for external LLM collaboration | +| **📤 Auto Git Push** | Streamline perfect completions | Intelligent push with comprehensive criteria validation | + +--- + +## 🛠️ Enhanced Commands + +### 💻 Developer Agent (James) +```bash +*develop-story # Systematic story implementation with auto-progress tracking +*reality-audit # Comprehensive quality validation with regression analysis +*build-context # Pre-fix investigation with git history and risk assessment +*escalate # External AI collaboration when stuck in loops +``` + +### 🧪 QA Agent (Quinn) +```bash +*reality-audit # Manual quality audit with regression prevention analysis +*audit-validation # Auto-remediation audit with guaranteed fix story generation +*create-remediation # Generate regression-safe fix stories with pattern compliance +*Push2Git # Override safety gates to push despite quality issues +``` + +--- + +## ⚡ Automation Highlights + +### 🤖 What Happens Automatically + +**🔄 Loop Detection (After 3 Failed Attempts)** +- Tracks solution attempts per specific issue +- Generates copy-paste collaboration prompts for Gemini/GPT-4/Claude +- Resets counters on successful progress + +**📊 Quality Enforcement (Scores Below Thresholds)** +- Composite Reality < 80% → Auto-remediation triggered +- Regression Prevention < 80% → Pattern analysis required +- Technical Debt < 70% → Code quality improvements needed + +**📤 Git Push (Perfect Completion Only)** +- Story 100% complete + Quality scores met + Clean build + Zero simulation patterns +- Intelligent commit messages with quality metrics +- `*Push2Git` available for manual override when needed + +--- + +## 🎯 Quality Scoring System + +### 📊 Composite Score Breakdown +- **🔍 Simulation Reality (40%)** - Pattern detection + build validation +- **🛡️ Regression Prevention (35%)** - Pattern consistency + architectural compliance +- **⚖️ Technical Debt Prevention (25%)** - Code quality + maintainability + +### 🎖️ Grade Thresholds +| Grade | Score | Status | +|-------|-------|--------| +| 🟢 **A** | 90-100 | Exceptional - Auto-push eligible | +| 🔵 **B** | 80-89 | Good - Meets quality gates | +| 🟡 **C** | 70-79 | Acceptable - Needs improvement | +| 🟠 **D** | 60-69 | Poor - Remediation required | +| 🔴 **F** | <60 | Failing - Major issues detected | + +--- + +## 🚀 Getting Started + +### 1. **Develop Your Story** +```bash +*develop-story +``` +*Systematic implementation with automatic task completion tracking* + +### 2. **Validate Quality** +```bash +*reality-audit +``` +*Comprehensive audit with potential auto-push if criteria met* + +### 3. **Handle Issues** (if any) +```bash +*audit-validation # Auto-generates fix stories +*create-remediation # Manual remediation story creation +*Push2Git # Override push when accepting risks +``` + +### 4. **Collaborate When Stuck** (automatic) +*After 3 failed attempts, get copy-paste prompts for external AI collaboration* + +--- + +## 📈 Expected Impact + +### ⏱️ Time Savings +- **60+ minutes saved** per debugging session through loop prevention +- **Eliminated handoff delays** between QA and Developer agents +- **Automatic workflow generation** replaces manual story creation + +### 🎯 Quality Improvements +- **75% reduction** in simulation patterns reaching production +- **Zero tolerance enforcement** for mock implementations +- **Systematic quality gates** ensure consistent standards + +### 🔄 Process Excellence +- **Proactive issue detection** before code review +- **Pattern-based development** reuses successful approaches +- **Continuous learning** from collaborative AI sessions + +--- + +## 📁 Implementation Details + +### Core Framework Files +- `bmad-core/agents/dev.md` - Enhanced developer agent with reality enforcement +- `bmad-core/agents/qa.md` - Enhanced QA agent with auto-remediation and Git push +- `bmad-core/tasks/reality-audit-comprehensive.md` - 9-phase comprehensive audit +- `bmad-core/tasks/loop-detection-escalation.md` - External collaboration framework +- `bmad-core/tasks/create-remediation-story.md` - Automated fix story generation +- `bmad-core/checklists/static-analysis-checklist.md` - Code quality validation + +### Enterprise Features +- **Multi-language project detection** (Node.js, .NET, Java, Rust, Python, Go, Ruby, PHP) +- **Cross-platform compatibility** (Windows, Linux, macOS) +- **Complete audit trails** for compliance and accountability +- **Scalable architecture** for projects of any size + +--- + +*🎯 **Ready to revolutionize your AI development workflow?** These enhancements provide enterprise-grade quality engineering with zero-touch automation and collaborative intelligence.* \ No newline at end of file