name: integrated-development-flow
title: Integrated Development Workflow with GitLab CI/CD
description: Complete development workflow integrating GitLab CI/CD with JIRA tracking, parallel development coordination, and BMAD development methodology

agents:
  - glab
  - jira
  - dev
  - pm
  - architect
  - infra-devops-platform

metadata:
  estimated_duration: "1-5 days (varies by feature complexity)"
  complexity: "medium-high"
  prerequisites:
    - JIRA integration configured
    - GitLab CI/CD pipeline functional
    - Parallel development setup (if applicable)
    - BMAD development workflow established
    - Infrastructure DevOps pack (optional, for infrastructure projects)
  success_metrics:
    - Feature delivered with CI validation
    - JIRA issues properly tracked and updated
    - No integration conflicts
    - Quality gates satisfied
    - Infrastructure validation completed (if applicable)

phases:
  planning_and_initiation:
    title: "Planning and Development Initiation"
    description: "Initialize development work with JIRA integration and CI/CD preparation"
    estimated_duration: "1-4 hours"
    agents: ["pm", "jira", "architect", "infra-devops-platform"]
    tasks:
      - create-jira-workflow-plan
      - create-gitlab-workflow-plan
      - validate-infrastructure-ci
    decision_points:
      - development_approach:
          question: "What development approach is most appropriate for this work?"
          options:
            single_branch: "Standard single-branch development"
            parallel_development: "Multi-worktree parallel development"
            collaborative: "Multi-developer collaborative approach"
      - complexity_assessment:
          question: "What is the complexity level of this development work?"
          options:
            simple: "Simple feature with minimal dependencies"
            moderate: "Standard feature with some integration points"
            complex: "Complex feature requiring architectural consideration"
            infrastructure: "Infrastructure-focused development requiring DevOps validation"
    success_criteria:
      - JIRA issues created and properly configured
      - Development approach determined
      - CI/CD requirements understood
      - Team assignments finalized
      - Infrastructure context assessed (if applicable)
    outputs:
      - jira_issue_tracking_setup
      - development_plan
      - ci_cd_requirements
      - team_assignments
      - infrastructure_validation_plan

  development_environment_setup:
    title: "Development Environment and CI Preparation"
    description: "Set up development environment with CI/CD integration and branch management"
    estimated_duration: "30-90 minutes"
    dependencies: ["planning_and_initiation"]
    agents: ["dev", "glab", "infra-devops-platform"]
    tasks:
      - coordinate-parallel-ci
      - debug-ci-configuration
      - monitor-pipeline-status
      - validate-infrastructure-ci
    decision_points:
      - branch_strategy:
          question: "What branching strategy should be used?"
          options:
            feature_branch: "Single feature branch development"
            worktree_parallel: "Parallel worktree development"
            collaborative_branch: "Shared feature branch with coordination"
    success_criteria:
      - Development branches created and configured
      - CI/CD pipeline validated for new branches
      - Parallel development coordination established (if applicable)
      - Development environment ready
      - Infrastructure CI validation configured (if applicable)
    outputs:
      - branch_configuration
      - ci_pipeline_validation
      - development_environment_status
      - infrastructure_ci_status

  development_execution:
    title: "Feature Development with Continuous Integration"
    description: "Execute development work with continuous CI/CD validation and JIRA progress tracking"
    estimated_duration: "0.5-3 days"
    dependencies: ["development_environment_setup"]
    agents: ["dev", "glab", "jira", "infra-devops-platform"]
    tasks:
      - monitor-pipeline-status
      - sync-ci-status-to-jira
      - coordinate-parallel-ci
      - validate-infrastructure-ci
    checkpoints:
      - initial_implementation:
          description: "Core feature implementation completed"
          validation: "Basic functionality implemented and CI passing"
      - integration_testing:
          description: "Integration testing completed"
          validation: "Feature integrates properly with existing system"
      - quality_validation:
          description: "Code quality checks passed"
          validation: "All quality gates satisfied"
      - infrastructure_validation:
          description: "Infrastructure changes validated (if applicable)"
          validation: "Infrastructure CI health confirmed and checklist items addressed"
    decision_points:
      - ci_failure_response:
          question: "How should CI failures be handled during development?"
          options:
            immediate_fix: "Stop development and fix CI issues immediately"
            batch_fix: "Continue development and fix CI issues in batches"
            parallel_investigation: "Investigate CI issues in parallel with development"
      - integration_conflict_resolution:
          question: "How should integration conflicts be resolved?"
          options:
            rebase_approach: "Rebase branch to resolve conflicts"
            merge_coordination: "Coordinate merge with other development streams"
            architectural_review: "Escalate to architectural review"
      - infrastructure_validation_approach:
          question: "How should infrastructure validation be handled?"
          options:
            continuous: "Continuous infrastructure CI validation during development"
            milestone: "Infrastructure validation at key development milestones"
            pre_deployment: "Infrastructure validation only before deployment"
    success_criteria:
      - Feature development completed according to requirements
      - All CI/CD checks passing consistently
      - JIRA issues updated with progress
      - No blocking integration conflicts
      - Infrastructure validation completed (if applicable)
    outputs:
      - implemented_feature
      - ci_validation_results
      - jira_progress_updates
      - integration_status
      - infrastructure_validation_results

  cross_pack_coordination:
    title: "Cross-Pack Integration and Coordination"
    description: "Coordinate with parallel development streams and validate cross-pack integrations"
    estimated_duration: "30-120 minutes"
    dependencies: ["development_execution"]
    agents: ["glab", "jira", "pm", "infra-devops-platform"]
    tasks:
      - coordinate-parallel-ci
      - sync-ci-status-to-jira
      - generate-ci-health-report
      - validate-infrastructure-ci
    decision_points:
      - coordination_scope:
          question: "What level of coordination is needed with other development streams?"
          options:
            minimal: "Basic CI status coordination only"
            standard: "Full parallel development coordination"
            comprehensive: "End-to-end integration validation"
      - integration_timing:
          question: "When should cross-pack integrations be validated?"
          options:
            pre_merge: "Validate before any merge activities"
            staged_integration: "Validate in stages during merge process"
            post_merge: "Validate after merge completion"
    success_criteria:
      - Parallel development streams coordinated
      - JIRA integration fully synchronized
      - Cross-pack compatibility validated
      - Integration health confirmed
      - Infrastructure DevOps integration validated (if applicable)
    outputs:
      - coordination_status_report
      - integration_validation_results
      - cross_pack_compatibility_confirmation
      - infrastructure_integration_status

  quality_assurance_and_testing:
    title: "Comprehensive Quality Assurance"
    description: "Execute comprehensive testing with CI/CD automation and quality gate validation"
    estimated_duration: "2-8 hours"
    dependencies: ["cross_pack_coordination"]
    agents: ["dev", "glab", "qa", "infra-devops-platform"]
    tasks:
      - monitor-pipeline-status
      - analyze-pipeline-failures
      - generate-ci-health-report
      - validate-infrastructure-ci
    decision_points:
      - testing_comprehensiveness:
          question: "What level of testing is appropriate for this feature?"
          options:
            basic: "Unit tests and basic integration tests"
            standard: "Comprehensive test suite including integration tests"
            extensive: "Full end-to-end testing with performance validation"
      - quality_gate_strictness:
          question: "How strict should quality gates be for this release?"
          options:
            standard: "Apply standard quality thresholds"
            strict: "Apply elevated quality standards"
            relaxed: "Use relaxed standards for experimental features"
    success_criteria:
      - All automated tests passing
      - Quality gates satisfied
      - Performance within acceptable limits
      - No critical issues identified
      - Infrastructure quality gates satisfied (if applicable)
    outputs:
      - comprehensive_test_results
      - quality_gate_validation
      - performance_assessment
      - infrastructure_quality_validation

  integration_and_deployment_preparation:
    title: "Integration Preparation and Deployment Readiness"
    description: "Prepare for integration with final validation and deployment coordination"
    estimated_duration: "1-3 hours"
    dependencies: ["quality_assurance_and_testing"]
    agents: ["glab", "dev", "pm", "infra-devops-platform"]
    tasks:
      - coordinate-parallel-ci
      - sync-ci-status-to-jira
      - create-gitlab-workflow-plan
      - validate-infrastructure-ci
    decision_points:
      - deployment_strategy:
          question: "What deployment strategy should be used?"
          options:
            direct_merge: "Direct merge to main branch"
            staged_deployment: "Staged deployment through multiple environments"
            canary_deployment: "Canary deployment with gradual rollout"
      - rollback_preparation:
          question: "What rollback strategy should be prepared?"
          options:
            automated_rollback: "Automated rollback triggers prepared"
            manual_rollback: "Manual rollback procedures documented"
            no_rollback: "No rollback preparation needed"
    success_criteria:
      - Deployment strategy finalized
      - All integration points validated
      - Rollback procedures prepared
      - Stakeholder approval obtained
      - Infrastructure deployment readiness confirmed (if applicable)
    outputs:
      - deployment_readiness_confirmation
      - integration_validation_summary
      - rollback_procedures
      - infrastructure_deployment_validation

  completion_and_documentation:
    title: "Workflow Completion and Documentation"
    description: "Finalize development workflow with comprehensive documentation and knowledge transfer"
    estimated_duration: "30-90 minutes"
    dependencies: ["integration_and_deployment_preparation"]
    agents: ["pm", "jira", "glab"]
    tasks:
      - sync-ci-status-to-jira
      - generate-ci-health-report
    decision_points:
      - documentation_scope:
          question: "What level of documentation is needed for this development work?"
          options:
            minimal: "Basic feature documentation and JIRA updates"
            standard: "Comprehensive documentation including technical details"
            extensive: "Full documentation with architectural decisions and lessons learned"
    success_criteria:
      - All JIRA issues properly closed
      - Technical documentation completed
      - Knowledge transfer completed
      - Lessons learned documented
    outputs:
      - final_jira_status_update
      - technical_documentation
      - lessons_learned_report
      - knowledge_transfer_summary

checkpoints:
  - phase: planning_and_initiation
    checkpoint: planning_complete
    validation: "Development plan approved and JIRA issues configured"
  - phase: development_environment_setup
    checkpoint: environment_ready
    validation: "Development environment configured with working CI/CD"
  - phase: development_execution
    checkpoint: feature_implemented
    validation: "Feature development completed with CI validation"
  - phase: cross_pack_coordination
    checkpoint: integrations_coordinated
    validation: "All cross-pack integrations validated and coordinated"
  - phase: quality_assurance_and_testing
    checkpoint: quality_validated
    validation: "All quality gates passed and testing completed"
  - phase: integration_and_deployment_preparation
    checkpoint: deployment_ready
    validation: "Feature ready for deployment with all validations complete"
  - phase: completion_and_documentation
    checkpoint: workflow_complete
    validation: "Development workflow completed with full documentation"

quality_gates:
  - gate: ci_pipeline_health
    criteria: "CI pipeline success rate > 90% during development"
    phase: development_execution
    blocking: true
  - gate: jira_synchronization
    criteria: "All JIRA issues properly tracked and synchronized"
    phase: cross_pack_coordination
    blocking: false
  - gate: parallel_development_coordination
    criteria: "No conflicts with parallel development streams"
    phase: cross_pack_coordination
    blocking: true
  - gate: comprehensive_testing
    criteria: "All test categories pass with required coverage"
    phase: quality_assurance_and_testing
    blocking: true
  - gate: integration_validation
    criteria: "All integration points validated successfully"
    phase: integration_and_deployment_preparation
    blocking: true
  - gate: infrastructure_validation
    criteria: "Infrastructure CI health >= 80% and checklist validation completed (if applicable)"
    phase: quality_assurance_and_testing
    blocking: false

integration_patterns:
  jira_workflow_integration:
    - phase: planning_and_initiation
      pattern: "Create and configure JIRA issues for development tracking"
    - phase: development_execution
      pattern: "Continuous sync of CI status to JIRA with automated updates"
    - phase: completion_and_documentation
      pattern: "Final JIRA issue closure with comprehensive status updates"
  
  parallel_development_integration:
    - phase: development_environment_setup
      pattern: "Establish parallel development coordination mechanisms"
    - phase: cross_pack_coordination
      pattern: "Coordinate CI status across all parallel development streams"
    - phase: integration_and_deployment_preparation
      pattern: "Validate integration compatibility across parallel work"
  
  ci_cd_automation_integration:
    - phase: development_environment_setup
      pattern: "Validate CI/CD configuration for new development branches"
    - phase: development_execution
      pattern: "Continuous CI/CD monitoring with automated failure detection"
    - phase: quality_assurance_and_testing
      pattern: "Comprehensive CI/CD-driven testing and validation"
  
  infrastructure_devops_integration:
    - phase: planning_and_initiation
      pattern: "Assess infrastructure context and validate CI configuration"
    - phase: development_environment_setup
      pattern: "Configure infrastructure CI validation for development branches"
    - phase: development_execution
      pattern: "Continuous infrastructure CI monitoring with checklist validation"
    - phase: quality_assurance_and_testing
      pattern: "Comprehensive infrastructure validation including deployment readiness"
    - phase: integration_and_deployment_preparation
      pattern: "Final infrastructure deployment validation and checklist completion"

escalation_procedures:
  ci_pipeline_failure:
    trigger: "CI pipeline failure blocking development progress"
    escalation: "Immediate gitlab-ci-debugging workflow initiation"
    timeline: "Within 30 minutes"
  
  integration_conflict:
    trigger: "Unresolvable integration conflict detected"
    escalation: "Architectural review with senior team members"
    timeline: "Within 2 hours"
  
  quality_gate_failure:
    trigger: "Critical quality gate failure"
    escalation: "QA team leader and development lead involvement"
    timeline: "Within 1 hour"
  
  jira_synchronization_failure:
    trigger: "JIRA integration breakdown"
    escalation: "Project management and integration specialist involvement"
    timeline: "Within 4 hours"
  
  infrastructure_validation_failure:
    trigger: "Critical infrastructure validation failure"
    escalation: "Infrastructure DevOps specialist and architectural review"
    timeline: "Within 2 hours"

success_patterns:
  simple_feature_development:
    typical_flow: ["planning(1h)", "setup(30m)", "development(4-8h)", "testing(2h)", "deployment(1h)"]
    key_characteristics: "Single developer, minimal dependencies, standard CI/CD"
    optimization_opportunities: "Automated testing, streamlined CI pipeline"
  
  complex_feature_development:
    typical_flow: ["planning(4h)", "setup(90m)", "development(1-3d)", "coordination(2h)", "testing(4-8h)", "deployment(3h)"]
    key_characteristics: "Multiple developers, architectural changes, extensive testing"
    optimization_opportunities: "Parallel development, enhanced coordination, staged testing"
  
  parallel_collaborative_development:
    typical_flow: ["planning(2h)", "setup(60m)", "development(1-2d)", "coordination(4h)", "testing(6h)", "deployment(2h)"]
    key_characteristics: "Multiple parallel streams, cross-team coordination, integration complexity"
    optimization_opportunities: "Advanced coordination tools, automated conflict detection, continuous integration"

risk_mitigation:
  - risk: "CI pipeline blocking development progress"
    mitigation: "Parallel CI investigation and rapid failure resolution procedures"
    monitoring: "Continuous CI health monitoring with automated alerts"
  
  - risk: "Integration conflicts between parallel development streams"
    mitigation: "Regular coordination checkpoints and automated conflict detection"
    monitoring: "Cross-stream CI status monitoring and early warning systems"
  
  - risk: "JIRA synchronization failures causing tracking issues"
    mitigation: "Redundant tracking mechanisms and manual fallback procedures"
    monitoring: "Integration health monitoring with notification systems"
  
  - risk: "Quality gate failures late in development cycle"
    mitigation: "Early and continuous quality validation throughout development"
    monitoring: "Progressive quality gate checking with trend analysis"
  
  - risk: "Infrastructure deployment failures blocking release"
    mitigation: "Continuous infrastructure CI validation and early checklist completion"
    monitoring: "Infrastructure health monitoring with deployment readiness tracking"

tools_and_resources:
  required_tools:
    - GitLab CLI (glab)
    - JIRA (via ck-jira-integration)
    - Git with worktree support
    - CI/CD pipeline access
    - Infrastructure DevOps pack (for infrastructure projects)
  
  recommended_tools:
    - IDE with GitLab integration
    - JIRA integration plugins
    - Parallel development coordination tools
    - Automated testing frameworks
  
  external_dependencies:
    - GitLab repository with CI/CD enabled
    - JIRA project with proper permissions
    - Development environment access
    - Testing environment availability

workflow_optimization_recommendations:
  performance_optimization:
    - "Implement pipeline caching for dependency management"
    - "Use parallel job execution for independent test suites"
    - "Optimize Docker image sizes for faster pipeline execution"
  
  integration_optimization:
    - "Establish automated JIRA status sync triggers"
    - "Implement cross-stream CI coordination automation"
    - "Create integration health dashboards for visibility"
  
  quality_optimization:
    - "Implement progressive quality gates throughout development"
    - "Establish automated rollback triggers for quality failures"
    - "Create comprehensive testing automation with CI/CD integration"
  
  infrastructure_optimization:
    - "Implement continuous infrastructure CI validation during development"
    - "Establish infrastructure checklist automation with live CI data"
    - "Create infrastructure deployment readiness dashboards"