@cloudkinetix/bmad-enhanced
Version:
Cloud-Kinetix enhanced fork of BMAD-METHOD - Breakthrough Method of Agile AI-driven Development with robust versioning and unified validation.
732 lines (604 loc) • 24.9 kB
Markdown
# GitLab Integration Bridge Utility
## Cross-Pack Integration Coordination for GitLab CI/CD
This utility handles intelligent coordination between the GitLab CI/CD expansion pack and other BMAD expansion packs, providing seamless integration patterns and data flow orchestration.
## Core Integration Functions
### Auto-Detection of Integration Opportunities
#### Detect Available Expansion Packs
```bash
# Detect which other expansion packs are installed and active
detect_expansion_packs() {
echo "Detecting Available Expansion Packs..."
echo "======================================"
local JIRA_AVAILABLE=false
local PARALLEL_DEV_AVAILABLE=false
local LLM_AGENT_DEV_AVAILABLE=false
local INFRASTRUCTURE_DEVOPS_AVAILABLE=false
# Check for JIRA integration
if [ -f ".bmad-core/agents/jira.md" ] || command -v bmad-enhanced >/dev/null 2>&1; then
JIRA_AVAILABLE=true
echo "✅ JIRA Integration Pack: Available"
else
echo "⚪ JIRA Integration Pack: Not detected"
fi
# Check for parallel development
if [ -f ".bmad-core/commands/parallel-dev.md" ] || [ -d ".bmad-core/agents" ]; then
PARALLEL_DEV_AVAILABLE=true
echo "✅ Parallel Development Pack: Available"
else
echo "⚪ Parallel Development Pack: Not detected"
fi
# Check for LLM agent development
if [ -f ".bmad-core/agents/llm-architect.md" ]; then
LLM_AGENT_DEV_AVAILABLE=true
echo "✅ LLM Agent Development Pack: Available"
else
echo "⚪ LLM Agent Development Pack: Not detected"
fi
# Check for infrastructure DevOps
if [ -f ".bmad-core/agents/infra-devops-platform.md" ] || [ -f ".bmad-core/checklists/infrastructure-checklist.md" ]; then
INFRASTRUCTURE_DEVOPS_AVAILABLE=true
echo "✅ Infrastructure DevOps Pack: Available"
else
echo "⚪ Infrastructure DevOps Pack: Not detected"
fi
# Return status for programmatic use
echo ""
echo "Integration Capabilities:"
echo "JIRA_INTEGRATION=$JIRA_AVAILABLE"
echo "PARALLEL_DEV_INTEGRATION=$PARALLEL_DEV_AVAILABLE"
echo "LLM_AGENT_DEV_INTEGRATION=$LLM_AGENT_DEV_AVAILABLE"
echo "INFRASTRUCTURE_DEVOPS_INTEGRATION=$INFRASTRUCTURE_DEVOPS_AVAILABLE"
# Export for use by other functions
export JIRA_INTEGRATION=$JIRA_AVAILABLE
export PARALLEL_DEV_INTEGRATION=$PARALLEL_DEV_AVAILABLE
export LLM_AGENT_DEV_INTEGRATION=$LLM_AGENT_DEV_AVAILABLE
export INFRASTRUCTURE_DEVOPS_INTEGRATION=$INFRASTRUCTURE_DEVOPS_AVAILABLE
}
```
#### Auto-Detect Integration Context
```bash
# Automatically detect current context and integration opportunities
auto_detect_integration_context() {
echo "Auto-Detecting Integration Context..."
echo "===================================="
# Detect current branch and commit context
local CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
local RECENT_COMMIT=$(git log --oneline -1 2>/dev/null || echo "no commits")
echo "Current Branch: $CURRENT_BRANCH"
echo "Recent Commit: $RECENT_COMMIT"
# Check for JIRA issue references in commit messages
local JIRA_ISSUES=$(echo "$RECENT_COMMIT" | grep -oE '[A-Z]+-[0-9]+' || echo "")
if [ -n "$JIRA_ISSUES" ]; then
echo "🎯 Detected JIRA Issues: $JIRA_ISSUES"
export DETECTED_JIRA_ISSUES="$JIRA_ISSUES"
fi
# Check for worktrees (parallel development)
local WORKTREE_COUNT=$(git worktree list 2>/dev/null | wc -l || echo "1")
if [ "$WORKTREE_COUNT" -gt 1 ]; then
echo "🔀 Multiple worktrees detected: $WORKTREE_COUNT"
export PARALLEL_DEV_ACTIVE=true
else
export PARALLEL_DEV_ACTIVE=false
fi
# Check for AI-related development patterns
if find . -name "*.md" -exec grep -l "agent\|AI\|prompt" {} \; 2>/dev/null | head -1 >/dev/null; then
echo "🤖 AI development patterns detected"
export AI_DEV_CONTEXT=true
else
export AI_DEV_CONTEXT=false
fi
# Check for infrastructure-as-code patterns
if [ -f "terraform.tf" ] || [ -f "Dockerfile" ] || [ -f "docker-compose.yml" ] || [ -f ".github/workflows/deploy.yml" ] || find . -name "*.tf" -o -name "*.bicep" -o -name "*.arm" 2>/dev/null | head -1 >/dev/null; then
echo "🏗️ Infrastructure-as-code patterns detected"
export INFRASTRUCTURE_CONTEXT=true
else
export INFRASTRUCTURE_CONTEXT=false
fi
}
```
## JIRA Integration Bridge
### CI Status to JIRA Sync
```bash
# Sync CI status to JIRA issues with intelligent context
sync_ci_status_to_jira() {
local branch=${1:-$(git branch --show-current)}
local force_sync=${2:-false}
if [ "$JIRA_INTEGRATION" != "true" ]; then
echo "JIRA integration not available - skipping sync"
return 1
fi
echo "Syncing CI Status to JIRA..."
echo "============================"
# Get current pipeline status
local PIPELINE_DATA=$(glab ci get --output json --branch "$branch" 2>/dev/null)
if [ $? -eq 0 ] && [ "$PIPELINE_DATA" != "" ]; then
local STATUS=$(echo "$PIPELINE_DATA" | jq -r '.status')
local WEB_URL=$(echo "$PIPELINE_DATA" | jq -r '.web_url')
local DURATION=$(echo "$PIPELINE_DATA" | jq -r '.duration // 0')
# Get JIRA issues from commit messages or environment
local JIRA_ISSUES="${DETECTED_JIRA_ISSUES:-}"
if [ -z "$JIRA_ISSUES" ]; then
# Try to extract from recent commits
JIRA_ISSUES=$(git log --oneline -10 | grep -oE '[A-Z]+-[0-9]+' | sort -u | tr '\n' ' ')
fi
if [ -n "$JIRA_ISSUES" ]; then
echo "🎯 Updating JIRA issues: $JIRA_ISSUES"
# Format CI status for JIRA
local JIRA_COMMENT="h3. 🔄 CI/CD Pipeline Update
*Branch:* $branch
*Status:* $(status_to_emoji "$STATUS") $STATUS
*Duration:* $(format_duration "$DURATION")
*Pipeline:* [View Pipeline|$WEB_URL]
*Updated:* $(date)
"
# Add job details if failed
if [ "$STATUS" = "failed" ]; then
local FAILED_JOBS=$(echo "$PIPELINE_DATA" | jq -r '.jobs[] | select(.status == "failed") | .name' | tr '\n' ', ')
JIRA_COMMENT="${JIRA_COMMENT}*Failed Jobs:* $FAILED_JOBS
"
fi
echo "JIRA Comment Format:"
echo "$JIRA_COMMENT"
# Note: Actual JIRA API calls would be handled by the JIRA agent
echo "✅ JIRA sync prepared - use jira agent for actual update"
# Return formatted data for use by JIRA agent
echo "JIRA_SYNC_DATA={\"issues\":\"$JIRA_ISSUES\",\"status\":\"$STATUS\",\"comment\":\"$JIRA_COMMENT\"}"
else
echo "⚪ No JIRA issues detected in commits - skipping sync"
fi
else
echo "❌ No pipeline data available for JIRA sync"
fi
}
```
### JIRA Issue Status Update
```bash
# Update JIRA issue status based on CI results
update_jira_issue_status() {
local jira_issue="$1"
local ci_status="$2"
if [ "$JIRA_INTEGRATION" != "true" ]; then
echo "JIRA integration not available"
return 1
fi
echo "Updating JIRA Issue Status..."
echo "=============================="
case "$ci_status" in
"success")
echo "🎯 $jira_issue: CI passed - suggest transition to 'Ready for Review'"
;;
"failed")
echo "🚨 $jira_issue: CI failed - suggest transition to 'In Development' with failure notes"
;;
"running")
echo "🔄 $jira_issue: CI in progress - update with running status"
;;
*)
echo "ℹ️ $jira_issue: CI status '$ci_status' - informational update"
;;
esac
# Prepare transition recommendations
echo "JIRA_TRANSITION_RECOMMENDATION={\"issue\":\"$jira_issue\",\"ci_status\":\"$ci_status\",\"suggested_transition\":\"auto\",\"add_comment\":true}"
}
```
## Parallel Development Integration Bridge
### Multi-Worktree CI Coordination
```bash
# Coordinate CI status across multiple worktrees
coordinate_parallel_ci() {
if [ "$PARALLEL_DEV_INTEGRATION" != "true" ]; then
echo "Parallel development integration not available"
return 1
fi
echo "Coordinating Parallel Development CI..."
echo "======================================"
# Get all worktrees
git worktree list | while read worktree_info; do
local WORKTREE_PATH=$(echo "$worktree_info" | awk '{print $1}')
local BRANCH=$(echo "$worktree_info" | awk '{print $3}' | tr -d '[]')
if [ -n "$BRANCH" ] && [ "$BRANCH" != "detached" ]; then
echo ""
echo "Analyzing worktree: $WORKTREE_PATH"
echo "Branch: $BRANCH"
# Get CI status for this branch
local STATUS=$(glab ci get --output json --branch "$BRANCH" 2>/dev/null | jq -r '.status // "no-pipeline"')
local EMOJI=$(status_to_emoji "$STATUS")
echo "CI Status: $EMOJI $STATUS"
# Check merge readiness
case "$STATUS" in
"success")
echo "✅ Merge ready: CI passing"
;;
"failed")
echo "❌ Merge blocked: CI failing"
# Get failure details
local FAILED_JOBS=$(glab ci get --output json --branch "$BRANCH" 2>/dev/null | jq -r '.jobs[] | select(.status == "failed") | .name' | wc -l)
echo " Failed jobs: $FAILED_JOBS"
;;
"running")
echo "🔄 Merge pending: CI in progress"
;;
"no-pipeline")
echo "⚪ No CI configured for this branch"
;;
esac
# Add to coordination summary
echo "PARALLEL_CI_STATUS_{$BRANCH}=$STATUS"
fi
done
echo ""
echo "🔀 Parallel Development Coordination Summary:"
echo " Use this data to make informed merge decisions"
echo " Consider CI status in parallel workflow planning"
}
```
### Aggregate CI Health Across Worktrees
```bash
# Generate aggregate CI health report for parallel development
aggregate_parallel_ci_health() {
echo "Aggregate CI Health Report"
echo "========================="
local TOTAL_WORKTREES=0
local PASSING_WORKTREES=0
local FAILING_WORKTREES=0
local PENDING_WORKTREES=0
local NO_CI_WORKTREES=0
git worktree list | while read worktree_info; do
local BRANCH=$(echo "$worktree_info" | awk '{print $3}' | tr -d '[]')
if [ -n "$BRANCH" ] && [ "$BRANCH" != "detached" ]; then
TOTAL_WORKTREES=$((TOTAL_WORKTREES + 1))
local STATUS=$(glab ci get --output json --branch "$BRANCH" 2>/dev/null | jq -r '.status // "no-pipeline"')
case "$STATUS" in
"success") PASSING_WORKTREES=$((PASSING_WORKTREES + 1)) ;;
"failed") FAILING_WORKTREES=$((FAILING_WORKTREES + 1)) ;;
"running") PENDING_WORKTREES=$((PENDING_WORKTREES + 1)) ;;
"no-pipeline") NO_CI_WORKTREES=$((NO_CI_WORKTREES + 1)) ;;
esac
fi
done
echo "Worktree Summary:"
echo " Total: $TOTAL_WORKTREES"
echo " ✅ Passing: $PASSING_WORKTREES"
echo " ❌ Failing: $FAILING_WORKTREES"
echo " 🔄 Pending: $PENDING_WORKTREES"
echo " ⚪ No CI: $NO_CI_WORKTREES"
# Calculate health percentage
if [ "$TOTAL_WORKTREES" -gt 0 ]; then
local HEALTH_PERCENTAGE=$((PASSING_WORKTREES * 100 / TOTAL_WORKTREES))
echo ""
echo "Overall CI Health: $HEALTH_PERCENTAGE%"
if [ "$HEALTH_PERCENTAGE" -gt 80 ]; then
echo "🎯 Status: Excellent - Ready for integration"
elif [ "$HEALTH_PERCENTAGE" -gt 60 ]; then
echo "👍 Status: Good - Minor issues to resolve"
else
echo "⚠️ Status: Needs attention - Multiple CI issues"
fi
fi
}
```
## Infrastructure DevOps Integration Bridge
### Infrastructure Pipeline Monitoring
```bash
# Monitor CI/CD pipelines for infrastructure-as-code deployments
monitor_infrastructure_pipelines() {
if [ "$INFRASTRUCTURE_DEVOPS_INTEGRATION" != "true" ]; then
echo "Infrastructure DevOps integration not available"
return 1
fi
echo "Infrastructure Pipeline Monitoring"
echo "================================="
# Check for IaC-related pipeline jobs
local PIPELINE_DATA=$(glab ci get --output json 2>/dev/null)
if [ $? -eq 0 ] && [ "$PIPELINE_DATA" != "" ]; then
# Look for infrastructure-related jobs
local INFRA_JOBS=$(echo "$PIPELINE_DATA" | jq -r '.jobs[] | select(.name | test("terraform|deploy|infra|provision|infrastructure")) | .name' || echo "")
if [ -n "$INFRA_JOBS" ]; then
echo "🏗️ Infrastructure CI/CD jobs detected:"
echo "$INFRA_JOBS" | while read job; do
local JOB_STATUS=$(echo "$PIPELINE_DATA" | jq -r ".jobs[] | select(.name == \"$job\") | .status")
local JOB_STAGE=$(echo "$PIPELINE_DATA" | jq -r ".jobs[] | select(.name == \"$job\") | .stage")
echo " - $job [$JOB_STAGE]: $JOB_STATUS"
done
echo ""
echo "Infrastructure Deployment Status:"
# Check for deployment-specific patterns
local DEPLOY_STATUS=$(echo "$INFRA_JOBS" | grep -i deploy | head -1)
if [ -n "$DEPLOY_STATUS" ]; then
local DEPLOY_JOB_STATUS=$(echo "$PIPELINE_DATA" | jq -r ".jobs[] | select(.name | test(\"deploy\"; \"i\")) | .status" | head -1)
case "$DEPLOY_JOB_STATUS" in
"success")
echo "✅ Infrastructure deployment successful"
echo " 💡 Infrastructure checklist validation recommended"
;;
"failed")
echo "❌ Infrastructure deployment failed"
echo " 🔧 Infrastructure troubleshooting required"
;;
"running")
echo "🔄 Infrastructure deployment in progress"
echo " ⏳ Monitor for completion before validation"
;;
esac
fi
else
echo "ℹ️ No infrastructure-specific CI jobs detected"
if [ "$INFRASTRUCTURE_CONTEXT" = "true" ]; then
echo " 💡 Consider adding infrastructure CI validation"
echo " 📋 Infrastructure checklist can be validated manually"
fi
fi
fi
}
```
### Infrastructure Checklist Integration
```bash
# Enhance infrastructure checklist validation with CI data
enhance_infrastructure_checklist() {
if [ "$INFRASTRUCTURE_DEVOPS_INTEGRATION" != "true" ]; then
echo "Infrastructure DevOps integration not available"
return 1
fi
echo "Infrastructure Checklist Enhancement"
echo "==================================="
# Get current CI status
local CI_STATUS=$(glab ci get --output json 2>/dev/null | jq -r '.status // "unknown"')
local PIPELINE_URL=$(glab ci get --output json 2>/dev/null | jq -r '.web_url // ""')
echo "📋 Section 8: CI/CD & Deployment Enhancement"
echo "--------------------------------------------"
# Provide real-time CI data for checklist validation
case "$CI_STATUS" in
"success")
echo "✅ CI/CD Pipeline Status: PASSING"
echo " ✓ Pipeline security scanning: $(check_security_jobs)"
echo " ✓ Deployment validation: $(check_deployment_jobs)"
echo " ✓ Pipeline notifications: $(check_notification_config)"
echo " 📊 Pipeline: $PIPELINE_URL"
;;
"failed")
echo "❌ CI/CD Pipeline Status: FAILING"
echo " ⚠️ Failed jobs need resolution before infrastructure validation"
echo " 🔧 Run 'analyze-pipeline-failures' for detailed analysis"
echo " 📊 Pipeline: $PIPELINE_URL"
;;
"running")
echo "🔄 CI/CD Pipeline Status: IN PROGRESS"
echo " ⏳ Wait for completion before final checklist validation"
echo " 📊 Pipeline: $PIPELINE_URL"
;;
*)
echo "⚪ CI/CD Pipeline Status: UNKNOWN"
echo " ℹ️ Manual checklist validation required"
;;
esac
echo ""
echo "🔧 Infrastructure CI Recommendations:"
# Check infrastructure context
if [ "$INFRASTRUCTURE_CONTEXT" = "true" ]; then
echo " ✅ Infrastructure-as-code detected"
echo " 💡 Ensure IaC validation in CI pipeline"
echo " 🔒 Verify security scanning for infrastructure code"
echo " 📊 Monitor infrastructure deployment jobs"
else
echo " ℹ️ No infrastructure-as-code patterns detected"
echo " 💡 Consider implementing IaC for infrastructure management"
fi
return 0
}
# Helper functions for checklist enhancement
check_security_jobs() {
local SECURITY_JOBS=$(glab ci get --output json 2>/dev/null | jq -r '.jobs[] | select(.name | test("security|scan|lint")) | .status' | grep -c "success" || echo "0")
if [ "$SECURITY_JOBS" -gt 0 ]; then
echo "PASSED ($SECURITY_JOBS jobs)"
else
echo "NEEDS REVIEW"
fi
}
check_deployment_jobs() {
local DEPLOY_JOBS=$(glab ci get --output json 2>/dev/null | jq -r '.jobs[] | select(.name | test("deploy|provision")) | .status' | grep -c "success" || echo "0")
if [ "$DEPLOY_JOBS" -gt 0 ]; then
echo "PASSED ($DEPLOY_JOBS jobs)"
else
echo "NEEDS REVIEW"
fi
}
check_notification_config() {
# Check if notifications are configured (this would be project-specific)
echo "NEEDS MANUAL VERIFICATION"
}
```
### Infrastructure Health Integration
```bash
# Generate infrastructure-aware CI health report
generate_infrastructure_ci_health() {
echo "Infrastructure CI Health Report"
echo "=============================="
# Standard CI health metrics
local PIPELINE_STATUS=$(glab ci get --output json 2>/dev/null | jq -r '.status // "unknown"')
local SUCCESS_RATE=$(glab ci list --per-page 10 --output json 2>/dev/null | jq -r '[.[] | select(.status == "success")] | length' || echo "0")
local TOTAL_PIPELINES=$(glab ci list --per-page 10 --output json 2>/dev/null | jq -r 'length' || echo "1")
if [ "$TOTAL_PIPELINES" -gt 0 ]; then
local HEALTH_PERCENTAGE=$((SUCCESS_RATE * 100 / TOTAL_PIPELINES))
else
local HEALTH_PERCENTAGE=0
fi
echo "📊 Overall CI Health: $HEALTH_PERCENTAGE%"
echo "🔄 Current Status: $PIPELINE_STATUS"
# Infrastructure-specific health metrics
if [ "$INFRASTRUCTURE_DEVOPS_INTEGRATION" = "true" ]; then
echo ""
echo "🏗️ Infrastructure-Specific Metrics:"
# Check infrastructure job success rates
local INFRA_SUCCESS=$(glab ci list --per-page 10 --output json 2>/dev/null | jq -r '[.[] | select(.status == "success") | .jobs[] | select(.name | test("terraform|deploy|infra|provision"))] | length' || echo "0")
local INFRA_TOTAL=$(glab ci list --per-page 10 --output json 2>/dev/null | jq -r '[.[] | .jobs[] | select(.name | test("terraform|deploy|infra|provision"))] | length' || echo "1")
if [ "$INFRA_TOTAL" -gt 0 ]; then
local INFRA_HEALTH=$((INFRA_SUCCESS * 100 / INFRA_TOTAL))
echo " 🎯 Infrastructure Job Success Rate: $INFRA_HEALTH%"
if [ "$INFRA_HEALTH" -gt 80 ]; then
echo " ✅ Infrastructure CI health is excellent"
echo " 💡 Ready for infrastructure checklist validation"
elif [ "$INFRA_HEALTH" -gt 60 ]; then
echo " ⚠️ Infrastructure CI health needs attention"
echo " 🔧 Review infrastructure job failures"
else
echo " 🚨 Infrastructure CI health is critical"
echo " 🚨 Infrastructure checklist validation not recommended"
fi
else
echo " ℹ️ No infrastructure-specific jobs detected"
echo " 💡 Consider adding infrastructure validation to CI"
fi
# Integration recommendations
echo ""
echo "🔗 Integration Recommendations:"
echo " 📋 Use 'validate-infrastructure-ci' for comprehensive validation"
echo " 🏗️ Run infrastructure checklist after successful deployments"
echo " 🔄 Monitor infrastructure pipeline health continuously"
fi
}
```
## AI Agent Development Integration
### AI Development Context CI
```bash
# Provide CI context for AI agent development workflows
analyze_ai_dev_ci_context() {
if [ "$AI_AGENT_DEV_INTEGRATION" != "true" ]; then
echo "AI Agent Development integration not available"
return 1
fi
echo "AI Development CI Context Analysis"
echo "================================="
# Check for AI-related CI patterns
local PIPELINE_DATA=$(glab ci get --output json 2>/dev/null)
if [ $? -eq 0 ] && [ "$PIPELINE_DATA" != "" ]; then
# Look for AI/ML specific job patterns
local AI_JOBS=$(echo "$PIPELINE_DATA" | jq -r '.jobs[] | select(.name | test("test|lint|deploy|build")) | .name' | grep -E "test|quality" || echo "")
if [ -n "$AI_JOBS" ]; then
echo "🤖 AI-relevant CI jobs detected:"
echo "$AI_JOBS" | while read job; do
local JOB_STATUS=$(echo "$PIPELINE_DATA" | jq -r ".jobs[] | select(.name == \"$job\") | .status")
echo " - $job: $JOB_STATUS"
done
echo ""
echo "AI Development Recommendations:"
echo " - Ensure agent quality checks are passing"
echo " - Verify prompt testing in CI pipeline"
echo " - Check agent deployment readiness"
fi
fi
}
```
## Integration Orchestration
### Comprehensive Integration Status
```bash
# Generate comprehensive integration status across all packs
generate_integration_status() {
echo "====================================="
echo "COMPREHENSIVE INTEGRATION STATUS"
echo "====================================="
echo "Timestamp: $(date)"
echo ""
# Detect available integrations
detect_expansion_packs
echo ""
# Auto-detect context
auto_detect_integration_context
echo ""
# JIRA Integration Status
if [ "$JIRA_INTEGRATION" = "true" ]; then
echo "🎯 JIRA Integration Status:"
sync_ci_status_to_jira $(git branch --show-current) false
echo ""
fi
# Parallel Development Status
if [ "$PARALLEL_DEV_INTEGRATION" = "true" ]; then
echo "🔀 Parallel Development Status:"
coordinate_parallel_ci
echo ""
fi
# AI Agent Development Status
if [ "$AI_AGENT_DEV_INTEGRATION" = "true" ]; then
echo "🤖 AI Development Status:"
analyze_ai_dev_ci_context
echo ""
fi
# Infrastructure DevOps Status
if [ "$INFRASTRUCTURE_DEVOPS_INTEGRATION" = "true" ]; then
echo "🏗️ Infrastructure DevOps Status:"
monitor_infrastructure_pipelines
generate_infrastructure_ci_health
echo ""
fi
echo "====================================="
echo "END INTEGRATION STATUS"
echo "====================================="
}
```
### Smart Integration Recommendations
```bash
# Provide intelligent recommendations for integration actions
recommend_integration_actions() {
echo "Smart Integration Recommendations"
echo "==============================="
local CURRENT_CI_STATUS=$(glab ci get --output json 2>/dev/null | jq -r '.status // "unknown"')
case "$CURRENT_CI_STATUS" in
"success")
echo "✅ CI Success - Recommended Actions:"
if [ "$JIRA_INTEGRATION" = "true" ] && [ -n "$DETECTED_JIRA_ISSUES" ]; then
echo " 🎯 Update JIRA issues with success status"
echo " 🎯 Consider transitioning JIRA issues to 'Ready for Review'"
fi
if [ "$PARALLEL_DEV_INTEGRATION" = "true" ]; then
echo " 🔀 This branch is ready for merge coordination"
echo " 🔀 Check other worktree CI status before integration"
fi
if [ "$INFRASTRUCTURE_DEVOPS_INTEGRATION" = "true" ] && [ "$INFRASTRUCTURE_CONTEXT" = "true" ]; then
echo " 🏗️ Infrastructure deployment successful - run checklist validation"
echo " 📋 Use 'validate-infrastructure-ci' for comprehensive review"
fi
;;
"failed")
echo "❌ CI Failed - Recommended Actions:"
if [ "$JIRA_INTEGRATION" = "true" ] && [ -n "$DETECTED_JIRA_ISSUES" ]; then
echo " 🚨 Update JIRA issues with failure details"
echo " 🚨 Consider creating bug reports for CI failures"
fi
if [ "$PARALLEL_DEV_INTEGRATION" = "true" ]; then
echo " ⚠️ This branch blocks parallel development merge"
echo " 🔧 Focus on fixing CI before coordinating with other work"
fi
if [ "$INFRASTRUCTURE_DEVOPS_INTEGRATION" = "true" ] && [ "$INFRASTRUCTURE_CONTEXT" = "true" ]; then
echo " 🚨 Infrastructure deployment failed - critical issue"
echo " 🔧 Use 'analyze-pipeline-failures' to debug infrastructure issues"
echo " ⚠️ Do not proceed with infrastructure checklist until CI is fixed"
fi
;;
"running")
echo "🔄 CI Running - Monitoring Recommendations:"
echo " 👀 Monitor for completion before taking integration actions"
if [ "$PARALLEL_DEV_INTEGRATION" = "true" ]; then
echo " 🔀 Other worktrees can continue independent development"
fi
;;
esac
}
```
## Usage Examples
```bash
# Detect available integrations
detect_expansion_packs
# Generate comprehensive status
generate_integration_status
# Sync CI status to JIRA
sync_ci_status_to_jira main
# Coordinate parallel development
coordinate_parallel_ci
# Get smart recommendations
recommend_integration_actions
```
## Integration Notes
- **Automatic Detection**: Functions automatically detect available expansion packs
- **Context Awareness**: Intelligent context detection for optimal integration
- **Non-Interactive**: All functions designed for autonomous operation
- **Error Handling**: Graceful handling of missing integrations
- **Extensible**: Easy to add new integration patterns