From d2f4658d93b940cee94e0fccb0ddf48b88036e15 Mon Sep 17 00:00:00 2001 From: Douwe Osinga Date: Thu, 23 Oct 2025 14:19:01 -0400 Subject: [PATCH] Create recipe dir on save (#5337) Co-authored-by: Douwe Osinga --- crates/goose/src/recipe/local_recipes.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/goose/src/recipe/local_recipes.rs b/crates/goose/src/recipe/local_recipes.rs index bf3083cd15..3e2deb6b06 100644 --- a/crates/goose/src/recipe/local_recipes.rs +++ b/crates/goose/src/recipe/local_recipes.rs @@ -177,6 +177,10 @@ pub fn save_recipe_to_file(recipe: Recipe, file_path: Option) -> anyhow None => generate_recipe_filename(&recipe.title, &recipe_library_dir), }; + if let Some(parent) = file_path_value.parent() { + fs::create_dir_all(parent)?; + } + let yaml_content = serde_yaml::to_string(&recipe)?; fs::write(&file_path_value, yaml_content)?; Ok(file_path_value)