< Summary

Information
Class: Orchestrator.Program
Assembly: Orchestrator
File(s): /home/runner/work/KicktippAi/KicktippAi/src/Orchestrator/Program.cs
Line coverage
100%
Covered lines: 141
Uncovered lines: 0
Coverable lines: 141
Total lines: 180
Line coverage: 100%
Branch coverage
100%
Covered branches: 8
Total branches: 8
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Main()100%22100%

File(s)

/home/runner/work/KicktippAi/KicktippAi/src/Orchestrator/Program.cs

#LineLine coverage
 1using Microsoft.Extensions.DependencyInjection;
 2using Spectre.Console;
 3using Spectre.Console.Cli;
 4using Orchestrator.Commands.Operations.Matchday;
 5using Orchestrator.Commands.Operations.RandomMatch;
 6using Orchestrator.Commands.Operations.Bonus;
 7using Orchestrator.Commands.Operations.CollectContext;
 8using Orchestrator.Commands.Operations.Verify;
 9using Orchestrator.Commands.Observability.AnalyzeMatch;
 10using Orchestrator.Commands.Observability.ContextChanges;
 11using Orchestrator.Commands.Observability.Cost;
 12using Orchestrator.Commands.Observability.ExportExperimentDataset;
 13using Orchestrator.Commands.Observability.ExportExperimentItem;
 14using Orchestrator.Commands.Observability.ReconstructPrompt;
 15using Orchestrator.Commands.Utility.UploadKpi;
 16using Orchestrator.Commands.Utility.UploadTransfers;
 17using Orchestrator.Commands.Utility.ListKpi;
 18using Orchestrator.Commands.Utility.Snapshots;
 19using Orchestrator.Infrastructure;
 20
 21namespace Orchestrator;
 22
 23public class Program
 24{
 25    public static async Task<int> Main(string[] args)
 26    {
 27        // Load environment variables once at startup
 128        var startupLogger = LoggingConfiguration.CreateLogger<Program>();
 129        EnvironmentHelper.LoadEnvironmentVariables(startupLogger);
 30
 31        // Dependency Injection setup follows Spectre.Console.Cli patterns:
 32        // - Tutorial: https://github.com/spectreconsole/website/blob/main/Spectre.Docs/Content/cli/tutorials/dependency
 33        // - Testing: https://github.com/spectreconsole/website/blob/main/Spectre.Docs/Content/cli/how-to/testing-comman
 134        var services = new ServiceCollection();
 35
 36        // Register IAnsiConsole for dependency injection into commands
 137        services.AddSingleton<IAnsiConsole>(AnsiConsole.Console);
 38
 39        // Register all command services (factories and shared infrastructure)
 140        services.AddAllCommandServices();
 41
 142        var registrar = new TypeRegistrar(services);
 143        var app = new CommandApp(registrar);
 44
 145        app.Configure(config =>
 146        {
 147            config.SetApplicationName("Orchestrator");
 148            config.SetApplicationVersion("1.0.0");
 149
 150            config.AddCommand<MatchdayCommand>("matchday")
 151                .WithDescription("Generate predictions for the current matchday")
 152                .WithExample("matchday", "gpt-4o-2024-08-06", "--community", "ehonda-test-buli");
 153
 154            config.AddCommand<RandomMatchCommand>("random-match")
 155                .WithDescription("Generate a prediction for a random match from the current matchday (useful for testing
 156                .WithExample("random-match", "gpt-5-nano", "--community", "ehonda-test-buli");
 157
 158            config.AddBranch("analyze-match", analyzeMatch =>
 159            {
 160                analyzeMatch.SetDescription("Analyze prediction distributions for a single match without persisting resu
 161
 162                analyzeMatch.AddCommand<AnalyzeMatchDetailedCommand>("detailed")
 163                    .WithDescription("Detailed analysis with justification output and live estimates")
 164                    .WithExample(
 165                        "analyze-match",
 166                        "detailed",
 167                        "gpt-5-nano",
 168                        "--community-context",
 169                        "ehonda-test-buli",
 170                        "--home",
 171                        "FC Bayern München",
 172                        "--away",
 173                        "RB Leipzig",
 174                        "--matchday",
 175                        "1",
 176                        "--runs",
 177                        "5");
 178
 179                analyzeMatch.AddCommand<AnalyzeMatchComparisonCommand>("comparison")
 180                    .WithDescription("Compare predictions generated with and without justification")
 181                    .WithExample(
 182                        "analyze-match",
 183                        "comparison",
 184                        "gpt-5-nano",
 185                        "--community-context",
 186                        "ehonda-test-buli",
 187                        "--home",
 188                        "FC Bayern München",
 189                        "--away",
 190                        "RB Leipzig",
 191                        "--matchday",
 192                        "1",
 193                        "--runs",
 194                        "5");
 195            });
 196
 197            config.AddCommand<BonusCommand>("bonus")
 198                .WithDescription("Generate bonus predictions")
 199                .WithExample("bonus", "gpt-4o-2024-08-06", "--community", "ehonda-test-buli");
 1100
 1101            config.AddBranch<CollectContextSettings>("collect-context", collectContext =>
 1102            {
 1103                collectContext.SetDescription("Collect context documents and store them in database");
 1104                collectContext.AddCommand<CollectContextKicktippCommand>("kicktipp")
 1105                    .WithDescription("Collect context from Kicktipp")
 1106                    .WithExample("collect-context", "kicktipp", "--community", "ehonda-test-buli", "--community-context"
 1107            });
 1108
 1109            config.AddCommand<VerifyMatchdayCommand>("verify")
 1110                .WithDescription("Verify that database predictions have been successfully posted to Kicktipp")
 1111                .WithExample("verify", "--community", "ehonda-test-buli");
 1112
 1113            config.AddCommand<VerifyBonusCommand>("verify-bonus")
 1114                .WithDescription("Verify that database bonus predictions are valid and complete")
 1115                .WithExample("verify-bonus", "--community", "ehonda-test-buli");
 1116
 1117            config.AddCommand<UploadKpiCommand>("upload-kpi")
 1118                .WithDescription("Upload a KPI context document to Firebase")
 1119                .WithExample("upload-kpi", "team-data", "--community", "ehonda-test-buli");
 1120
 1121            config.AddCommand<UploadTransfersCommand>("upload-transfers")
 1122                .WithDescription("Upload a transfers context document to Firebase (team transfers CSV)")
 1123                .WithExample("upload-transfers", "fcb", "--community-context", "ehonda-test-buli");
 1124
 1125            config.AddCommand<ListKpiCommand>("list-kpi")
 1126                .WithDescription("List KPI context documents from Firebase")
 1127                .WithExample("list-kpi", "--community", "ehonda-test-buli");
 1128
 1129            config.AddCommand<ContextChangesCommand>("context-changes")
 1130                .WithDescription("Show changes between latest and previous versions of context documents")
 1131                .WithExample("context-changes", "--community-context", "ehonda-test-buli", "--count", "5")
 1132                .WithExample("context-changes", "--community-context", "ehonda-test-buli", "--seed", "42");
 1133
 1134            config.AddCommand<ReconstructPromptCommand>("reconstruct-prompt")
 1135                .WithDescription("Reconstruct the historical prompt inputs for a stored match prediction")
 1136                .WithExample("reconstruct-prompt", "o4-mini", "--community-context", "pes-squad", "--home", "VfB Stuttga
 1137                .WithExample("reconstruct-prompt", "o4-mini", "--community-context", "pes-squad", "--home", "VfB Stuttga
 1138                .WithExample("reconstruct-prompt", "o4-mini", "--community-context", "pes-squad", "--home", "VfB Stuttga
 1139
 1140            config.AddCommand<ExportExperimentItemCommand>("export-experiment-item")
 1141                .WithDescription("Export a single historical match experiment item for runner testing")
 1142                .WithExample("export-experiment-item", "o4-mini", "--community-context", "pes-squad", "--home", "VfB Stu
 1143                .WithExample("export-experiment-item", "o4-mini", "--community-context", "pes-squad", "--home", "VfB Stu
 1144                .WithExample("export-experiment-item", "o4-mini", "--community-context", "pes-squad", "--home", "VfB Stu
 1145
 1146            config.AddCommand<ExportExperimentDatasetCommand>("export-experiment-dataset")
 1147                .WithDescription("Export the canonical hosted Langfuse dataset artifact for completed historical matches
 1148                .WithExample("export-experiment-dataset", "--community-context", "pes-squad")
 1149                .WithExample("export-experiment-dataset", "--community-context", "pes-squad", "--matchdays", "1,2,3", "-
 1150
 1151            config.AddCommand<CostCommand>("cost")
 1152                .WithDescription("Calculate aggregate costs for predictions")
 1153                .WithExample("cost", "--all")
 1154                .WithExample("cost", "--matchdays", "1,2,3")
 1155                .WithExample("cost", "--models", "gpt-4o,o1-mini", "--bonus");
 1156
 1157            config.AddBranch("snapshots", snapshots =>
 1158            {
 1159                snapshots.SetDescription("Generate and encrypt HTML snapshots from Kicktipp for test fixtures");
 1160
 1161                snapshots.AddCommand<SnapshotsFetchCommand>("fetch")
 1162                    .WithDescription("Fetch HTML snapshots from Kicktipp")
 1163                    .WithExample("snapshots", "fetch", "--community", "ehonda-test-buli")
 1164                    .WithExample("snapshots", "fetch", "--community", "ehonda-test-buli", "--output", "my-snapshots");
 1165
 1166                snapshots.AddCommand<SnapshotsEncryptCommand>("encrypt")
 1167                    .WithDescription("Encrypt HTML snapshots for safe committing")
 1168                    .WithExample("snapshots", "encrypt")
 1169                    .WithExample("snapshots", "encrypt", "--input", "my-snapshots", "--output", "tests/KicktippIntegrati
 1170
 1171                snapshots.AddCommand<SnapshotsAllCommand>("all")
 1172                    .WithDescription("Fetch and encrypt snapshots in one step")
 1173                    .WithExample("snapshots", "all", "--community", "ehonda-test-buli")
 1174                    .WithExample("snapshots", "all", "--community", "ehonda-test-buli", "--keep-originals");
 1175            });
 1176        });
 177
 1178        return await app.RunAsync(args);
 1179    }
 180}

Methods/Properties

Main()