feature: Console Replay Simulator

This commit is contained in:
voltsrage
2026-06-19 15:22:14 +08:00
parent 835311dffc
commit abc781c9c0
50 changed files with 11158 additions and 612 deletions
@@ -0,0 +1,37 @@
using System.CommandLine;
public static class ValidateCommand
{
public static Command Create()
{
var fileArg = new Argument<FileInfo>("scenario-file", "Path to the scenario JSON file");
var command = new Command("validate", "Validate a scenario file without replaying")
{
fileArg
};
command.SetHandler((FileInfo file) =>
{
var scenario = ScenarioLoader.Load(file.FullName);
var errors = ScenarioValidator.Validate(scenario);
if (errors.Count == 0)
{
SimulatorConsole.Success($"✓ {file.Name} is valid");
SimulatorConsole.Info($" {scenario.Events.Count} events over " +
$"{scenario.Events.Last().OffsetMinutes} minutes");
SimulatorConsole.Info($" Patient: {scenario.Patient.FirstName} " +
$"{scenario.Patient.LastName}");
SimulatorConsole.Info($" Tags: {string.Join(", ", scenario.Scenario.Tags ?? new())}");
}
else
{
SimulatorConsole.Error($"✗ {file.Name} has {errors.Count} error(s):");
foreach (var err in errors)
SimulatorConsole.Error($" • {err}");
}
}, fileArg);
return command;
}
}