MoonBit-native recipe scaling, allergen-safe substitution and pantry shopping planner
moon add WB-ai-nb/pantrycalcWB-ai-nb/pantrycalc@0.1.4test {
let plan = @pantrycalc.example_plan()
inspect(plan.verdict, content="shopping-needed")
inspect(plan.allergen_hit_count, content="0")
}moon run src/cmd/main
moon run src/examples/basicPantryCalc ready
package=WB-ai-nb/pantrycalc
pantrycalc=shopping-needed
rotation-lines=
mealprep=zero-waste-prioritymoon version --all
moon check --deny-warn
moon check --target all --deny-warn
moon build
moon test --deny-warn
moon fmt --check
moon info
moon doc
moon run src/cmd/main
moon run src/examples/basic
moon package --listfn DietProfile::DietProfile(avoid_allergens? : Array[String], prefer_tags? : Array[String], dislike_tags? : Array[String], max_total_cost_cents? : Int, max_total_kcal? : Int, min_total_protein_g? : Int) -> DietProfilefn Ingredient::Ingredient(name? : String, group? : String, quantity? : Quantity, nutrition? : Nutrition, cost_cents? : Int, allergens? : Array[String], tags? : Array[String]) -> Ingredientfn MealPrepOption::MealPrepOption(recipe_title? : String, servings? : Int, verdict? : String, plan_score? : Int, rotation_score? : Int, expiring_used_count? : Int, expiring_unused_count? : Int, shopping_cost_cents? : Int, total_protein_g? : Int, score? : Int, reason? : String) -> MealPrepOptionpub(all) struct MealPrepPlan {
days : Int
window_days : Int
options : Array[MealPrepOption]
best : MealPrepOption
verdict : String
score : Int
} derive(Eq, Debug)fn MealPrepPlan::MealPrepPlan(days? : Int, window_days? : Int, options? : Array[MealPrepOption], best? : MealPrepOption, verdict? : String, score? : Int) -> MealPrepPlanfn PantryItem::PantryItem(name? : String, quantity? : Quantity, expires_in_days? : Int, opened? : Bool, preferred? : Bool) -> PantryItempub(all) struct PantryPlan {
verdict : String
recipe_title : String
servings : Int
total_cost_cents : Int
total_kcal : Int
total_protein_g : Int
allergen_hit_count : Int
missing_count : Int
substitution_count : Int
shopping : Array[ShoppingLine]
substitutions : Array[Substitution]
warnings : Array[PantryWarning]
} derive(Eq, Debug)fn PantryPlan::PantryPlan(verdict? : String, recipe_title? : String, servings? : Int, total_cost_cents? : Int, total_kcal? : Int, total_protein_g? : Int, allergen_hit_count? : Int, missing_count? : Int, substitution_count? : Int, shopping? : Array[ShoppingLine], substitutions? : Array[Substitution], warnings? : Array[PantryWarning]) -> PantryPlanfn PantryWarning::PantryWarning(code? : String, message? : String, severity? : String) -> PantryWarningfn RotationLine::RotationLine(name? : String, required? : Quantity, available? : Quantity, use_first? : Quantity, buy? : Quantity, priority? : Int, reason? : String) -> RotationLinefn ShoppingLine::ShoppingLine(name? : String, needed? : Quantity, available? : Quantity, buy? : Quantity, estimated_cost_cents? : Int) -> ShoppingLinepub(all) struct Substitution {
source : String
target : Ingredient
ratio_percent : Int
reason : String
removes_allergens : Array[String]
adds_tags : Array[String]
} derive(Eq, Debug)fn Substitution::Substitution(source? : String, target? : Ingredient, ratio_percent? : Int, reason? : String, removes_allergens? : Array[String], adds_tags? : Array[String]) -> Substitutionfn adapt_recipe(recipe : Recipe, profile : DietProfile, substitutions : Array[Substitution]) -> Recipefn expiring_not_in_recipe(recipe : Recipe, pantry : Array[PantryItem], window_days : Int) -> Array[PantryWarning]fn ingredient(name : String, group : String, amount : Int, unit : MeasureUnit, kcal : Int, protein_g : Int, fat_g : Int, carb_g : Int, cost_cents : Int, allergens? : Array[String], tags? : Array[String]) -> Ingredientfn meal_prep_option(recipe : Recipe, servings : Int, profile : DietProfile, pantry : Array[PantryItem], substitutions : Array[Substitution], window_days : Int) -> MealPrepOptionfn meal_prep_rankings(recipes : Array[Recipe], servings : Int, profile : DietProfile, pantry : Array[PantryItem], substitutions : Array[Substitution], window_days : Int) -> Array[MealPrepOption]fn plan_recipe(recipe : Recipe, servings : Int, profile : DietProfile, pantry : Array[PantryItem], substitutions : Array[Substitution]) -> PantryPlanfn used_substitutions(recipe : Recipe, profile : DietProfile, substitutions : Array[Substitution]) -> Array[Substitution]fn zero_waste_meal_prep(recipes : Array[Recipe], servings : Int, profile : DietProfile, pantry : Array[PantryItem], substitutions : Array[Substitution], days : Int, window_days : Int) -> MealPrepPlanInstall
Download zipMoonBit-native recipe scaling, allergen-safe substitution and pantry shopping planner