feature: Console Replay Simulator
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using System.CommandLine;
|
||||
|
||||
public static class DryRunCommand
|
||||
{
|
||||
public static Command Create()
|
||||
{
|
||||
var fileArg = new Argument<FileInfo>("scenario-file", "Path to the scenario JSON file");
|
||||
var command = new Command("dry-run", "Print event timeline without calling the API")
|
||||
{
|
||||
fileArg
|
||||
};
|
||||
|
||||
command.SetHandler(async (FileInfo file) =>
|
||||
{
|
||||
var scenario = ScenarioLoader.Load(file.FullName);
|
||||
var errors = ScenarioValidator.Validate(scenario);
|
||||
if (errors.Count > 0)
|
||||
{
|
||||
SimulatorConsole.Error($"Scenario validation failed with {errors.Count} error(s):");
|
||||
foreach (var err in errors) SimulatorConsole.Error($" • {err}");
|
||||
return;
|
||||
}
|
||||
|
||||
var engine = new ReplayEngine(client: null!, poller: null);
|
||||
await engine.RunAsync(scenario, new ReplayOptions(DryRun: true));
|
||||
}, fileArg);
|
||||
|
||||
return command;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user