From df0737e55afeb5c01eb39909605970d1d3a73ffc Mon Sep 17 00:00:00 2001 From: Melodi <62381002+Melodi17@users.noreply.github.com> Date: Sun, 13 Sep 2026 13:22:20 +1000 Subject: refactor: cleanup; feat: connection to agent --- src/marlin.core/models/meta/Recipe.cs | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/marlin.core/models/meta/Recipe.cs (limited to 'src/marlin.core/models/meta/Recipe.cs') diff --git a/src/marlin.core/models/meta/Recipe.cs b/src/marlin.core/models/meta/Recipe.cs new file mode 100644 index 0000000..33ed814 --- /dev/null +++ b/src/marlin.core/models/meta/Recipe.cs @@ -0,0 +1,36 @@ +namespace marlin.core.models.meta; + +public class Recipe +{ + public Recipe(string id) + { + this.Id = id; + } + + public string Id { get; } + public string Name { get; set; } + + public string? RunsOnId { get; set; } + public List RequireIds { get; set; } = []; + public Dictionary Steps { get; set; } = new(); + public Dictionary Parameters { get; set; } = new(); + public Dictionary Environment { get; set; } = new(); + + public RequirementSet? GetRunsOn(Workflow workflow) => + this.RunsOnId != null ? workflow.Requirements[this.RunsOnId] : null; + + public IEnumerable GetRequires(Workflow workflow) => + this.RequireIds.Select(id => workflow.Recipes[id]); + + public Dictionary CreateArguments() + { + Dictionary args = new(); + foreach (var parameter in this.Parameters) + args.Add(parameter.Key, parameter.Value); + + foreach (var environment in this.Environment) + args.Add($"env.{environment.Key}", environment.Value); + + return args; + } +} -- cgit v1.3.1