chore: Used common function to list recipes in local machine (#4974)

This commit is contained in:
Lifei Zhou
2025-10-06 13:16:50 +11:00
committed by GitHub
parent bcbfef07a7
commit 0df1e0704b
11 changed files with 235 additions and 275 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ use std::sync::Arc;
use axum::routing::get;
use axum::{extract::State, http::StatusCode, routing::post, Json, Router};
use goose::recipe::recipe_library;
use goose::recipe::local_recipes;
use goose::recipe::Recipe;
use goose::recipe_deeplink;
use goose::session::SessionManager;
@@ -324,7 +324,7 @@ async fn save_recipe(
None => None,
};
match recipe_library::save_recipe_to_file(request.recipe, request.is_global, file_path) {
match local_recipes::save_recipe_to_file(request.recipe, request.is_global, file_path) {
Ok(_) => Ok(StatusCode::NO_CONTENT),
Err(e) => Err(ErrorResponse {
message: e.to_string(),
@@ -5,7 +5,7 @@ use std::path::PathBuf;
use anyhow::Result;
use goose::recipe::recipe_library::list_all_recipes_from_library;
use goose::recipe::local_recipes::list_local_recipes;
use goose::recipe::Recipe;
use std::path::Path;
@@ -29,7 +29,7 @@ fn short_id_from_path(path: &str) -> String {
}
pub fn get_all_recipes_manifests() -> Result<Vec<RecipeManifestWithPath>> {
let recipes_with_path = list_all_recipes_from_library()?;
let recipes_with_path = list_local_recipes()?;
let mut recipe_manifests_with_path = Vec::new();
for (file_path, recipe) in recipes_with_path {
let Ok(last_modified) = fs::metadata(file_path.clone())