diff --git a/crates/goose/src/recipe/local_recipes.rs b/crates/goose/src/recipe/local_recipes.rs index bf3083cd1548..3e2deb6b062b 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)