@@ -538,6 +538,212 @@ def workflow_recommend(
538538 )
539539
540540
541+ # =============================================================================
542+ # ORCHESTRATE SUBCOMMAND GROUP (Meta-Orchestration v4.0)
543+ # =============================================================================
544+
545+ orchestrate_app = typer .Typer (help = "Meta-orchestration workflows (v4.0)" )
546+ app .add_typer (orchestrate_app , name = "orchestrate" )
547+
548+
549+ @orchestrate_app .command ("health-check" )
550+ def orchestrate_health_check (
551+ mode : str = typer .Option ("daily" , "--mode" , "-m" , help = "Check mode: daily, weekly, release" ),
552+ project_root : Path = typer .Option (Path ("." ), "--project-root" , "-p" , help = "Project root path" ),
553+ json_output : bool = typer .Option (False , "--json" , help = "Output as JSON" ),
554+ ):
555+ """Run orchestrated health check with adaptive agent teams.
556+
557+ Modes:
558+ daily: Quick parallel check (3 agents: Security, Coverage, Quality)
559+ weekly: Comprehensive parallel (5 agents: adds Performance, Docs)
560+ release: Deep refinement (6 agents: adds Architecture)
561+ """
562+ import asyncio
563+
564+ from empathy_os .workflows .orchestrated_health_check import OrchestratedHealthCheckWorkflow
565+
566+ async def run_health_check ():
567+ workflow = OrchestratedHealthCheckWorkflow (mode = mode )
568+ report = await workflow .execute (project_root = str (project_root ))
569+
570+ if json_output :
571+ import json
572+
573+ console .print (json .dumps (report .to_dict (), indent = 2 ))
574+ else :
575+ # Beautiful console output
576+ console .print ("\n [bold cyan]🏥 HEALTH CHECK REPORT[/bold cyan]" )
577+ console .print ("=" * 60 )
578+
579+ # Health score with color coding
580+ score_color = (
581+ "green"
582+ if report .overall_health_score >= 80
583+ else "yellow" if report .overall_health_score >= 60 else "red"
584+ )
585+ console .print (
586+ f"\n [bold { score_color } ]Health Score: { report .overall_health_score } /100 (Grade: { report .grade } )[/bold { score_color } ]"
587+ )
588+ console .print (f"[dim]Trend: { report .trend } [/dim]" )
589+ console .print (f"[dim]Duration: { report .execution_time :.2f} s[/dim]" )
590+
591+ # Issues
592+ if report .issues :
593+ console .print (f"\n [bold red]⚠️ Issues Found ({ len (report .issues )} ):[/bold red]" )
594+ for issue in report .issues [:5 ]:
595+ console .print (f" • { issue } " )
596+
597+ # Recommendations
598+ if report .recommendations :
599+ console .print ("\n [bold yellow]💡 Recommendations:[/bold yellow]" )
600+ for i , rec in enumerate (report .recommendations [:5 ], 1 ):
601+ console .print (f" { i } . { rec } " )
602+
603+ console .print ("\n " + "=" * 60 )
604+
605+ return report
606+
607+ try :
608+ asyncio .run (run_health_check ())
609+ except Exception as e :
610+ console .print (f"[bold red]Error:[/bold red] { e } " )
611+ raise typer .Exit (code = 1 )
612+
613+
614+ @orchestrate_app .command ("release-prep" )
615+ def orchestrate_release_prep (
616+ project_root : Path = typer .Option (Path ("." ), "--project-root" , "-p" , help = "Project root path" ),
617+ min_coverage : float = typer .Option (80.0 , "--min-coverage" , help = "Minimum test coverage %" ),
618+ min_quality : float = typer .Option (7.0 , "--min-quality" , help = "Minimum quality score (0-10)" ),
619+ max_critical : int = typer .Option (0 , "--max-critical" , help = "Max critical issues allowed" ),
620+ json_output : bool = typer .Option (False , "--json" , help = "Output as JSON" ),
621+ ):
622+ """Run orchestrated release preparation with parallel validation.
623+
624+ Runs 4 agents in parallel:
625+ - Security Auditor (vulnerability scan)
626+ - Test Coverage Analyzer (gap analysis)
627+ - Code Quality Reviewer (best practices)
628+ - Documentation Writer (completeness check)
629+ """
630+ import asyncio
631+
632+ from empathy_os .workflows .orchestrated_release_prep import OrchestratedReleasePrepWorkflow
633+
634+ async def run_release_prep ():
635+ workflow = OrchestratedReleasePrepWorkflow (
636+ quality_gates = {
637+ "min_coverage" : min_coverage ,
638+ "min_quality_score" : min_quality ,
639+ "max_critical_issues" : max_critical ,
640+ }
641+ )
642+ report = await workflow .execute (path = str (project_root ))
643+
644+ if json_output :
645+ import json
646+
647+ console .print (json .dumps (report .to_dict (), indent = 2 ))
648+ else :
649+ console .print ("\n [bold cyan]📋 RELEASE PREPARATION REPORT[/bold cyan]" )
650+ console .print ("=" * 60 )
651+
652+ approval_color = "green" if report .approved else "red"
653+ approval_emoji = "✅" if report .approved else "❌"
654+ console .print (
655+ f"\n [bold { approval_color } ]{ approval_emoji } { 'APPROVED' if report .approved else 'NOT APPROVED' } [/bold { approval_color } ]"
656+ )
657+ console .print (f"[dim]Confidence: { report .confidence } [/dim]" )
658+ console .print (f"[dim]Duration: { report .total_duration :.2f} s[/dim]" )
659+
660+ # Quality gates
661+ console .print ("\n [bold]Quality Gates:[/bold]" )
662+ for gate in report .quality_gates :
663+ gate_emoji = "✅" if gate .passed else "❌"
664+ console .print (
665+ f" { gate_emoji } { gate .name } : { gate .actual :.1f} (threshold: { gate .threshold :.1f} )"
666+ )
667+
668+ # Blockers
669+ if report .blockers :
670+ console .print ("\n [bold red]🚫 Blockers:[/bold red]" )
671+ for blocker in report .blockers :
672+ console .print (f" • { blocker } " )
673+
674+ # Warnings
675+ if report .warnings :
676+ console .print ("\n [bold yellow]⚠️ Warnings:[/bold yellow]" )
677+ for warning in report .warnings :
678+ console .print (f" • { warning } " )
679+
680+ console .print ("\n " + "=" * 60 )
681+
682+ return report
683+
684+ try :
685+ asyncio .run (run_release_prep ())
686+ except Exception as e :
687+ console .print (f"[bold red]Error:[/bold red] { e } " )
688+ raise typer .Exit (code = 1 )
689+
690+
691+ @orchestrate_app .command ("test-coverage" )
692+ def orchestrate_test_coverage (
693+ project_root : Path = typer .Option (Path ("." ), "--project-root" , "-p" , help = "Project root path" ),
694+ target : float = typer .Option (90.0 , "--target" , "-t" , help = "Target coverage percentage" ),
695+ json_output : bool = typer .Option (False , "--json" , help = "Output as JSON" ),
696+ ):
697+ """Run orchestrated test coverage boost with sequential stages.
698+
699+ Runs 3 stages sequentially:
700+ 1. Coverage Analyzer → Identify gaps
701+ 2. Test Generator → Create tests
702+ 3. Test Validator → Verify coverage
703+ """
704+ import asyncio
705+
706+ from empathy_os .workflows .test_coverage_boost import TestCoverageBoostWorkflow
707+
708+ async def run_test_coverage ():
709+ workflow = TestCoverageBoostWorkflow (target_coverage = target )
710+ report = await workflow .execute (project_root = str (project_root ))
711+
712+ if json_output :
713+ import json
714+
715+ console .print (json .dumps (report .to_dict (), indent = 2 ))
716+ else :
717+ console .print ("\n [bold cyan]🧪 TEST COVERAGE BOOST REPORT[/bold cyan]" )
718+ console .print ("=" * 60 )
719+
720+ success_color = "green" if report .success else "red"
721+ success_emoji = "✅" if report .success else "❌"
722+ console .print (
723+ f"\n [bold { success_color } ]{ success_emoji } { 'SUCCESS' if report .success else 'FAILED' } [/bold { success_color } ]"
724+ )
725+ console .print (f"[dim]Initial: { report .initial_coverage :.1f} %[/dim]" )
726+ console .print (f"[dim]Final: { report .final_coverage :.1f} %[/dim]" )
727+ console .print (f"[dim]Improvement: +{ report .improvement :.1f} %[/dim]" )
728+ console .print (f"[dim]Duration: { report .total_duration :.2f} s[/dim]" )
729+
730+ # Stage results
731+ console .print ("\n [bold]Stage Results:[/bold]" )
732+ for i , stage in enumerate (report .stage_results , 1 ):
733+ stage_emoji = "✅" if stage ["success" ] else "❌"
734+ console .print (f" { stage_emoji } Stage { i } : { stage .get ('description' , 'N/A' )} " )
735+
736+ console .print ("\n " + "=" * 60 )
737+
738+ return report
739+
740+ try :
741+ asyncio .run (run_test_coverage ())
742+ except Exception as e :
743+ console .print (f"[bold red]Error:[/bold red] { e } " )
744+ raise typer .Exit (code = 1 )
745+
746+
541747# =============================================================================
542748# TELEMETRY SUBCOMMAND GROUP
543749# =============================================================================
0 commit comments