feat: support configurable way to retrieve recipes via github (#2400)
This commit is contained in:
+24
-21
@@ -146,19 +146,21 @@ pub enum BenchCommand {
|
||||
#[derive(Subcommand)]
|
||||
enum RecipeCommand {
|
||||
/// Validate a recipe file
|
||||
#[command(about = "Validate a recipe file")]
|
||||
#[command(about = "Validate a recipe")]
|
||||
Validate {
|
||||
/// Path to the recipe file to validate
|
||||
#[arg(help = "Path to the recipe file to validate")]
|
||||
file: String,
|
||||
/// Recipe name to get recipe file to validate
|
||||
#[arg(help = "recipe name to get recipe file or full path to the recipe file to validate")]
|
||||
recipe_name: String,
|
||||
},
|
||||
|
||||
/// Generate a deeplink for a recipe file
|
||||
#[command(about = "Generate a deeplink for a recipe file")]
|
||||
#[command(about = "Generate a deeplink for a recipe")]
|
||||
Deeplink {
|
||||
/// Path to the recipe file
|
||||
#[arg(help = "Path to the recipe file")]
|
||||
file: String,
|
||||
/// Recipe name to get recipe file to generate deeplink
|
||||
#[arg(
|
||||
help = "recipe name to get recipe file or full path to the recipe file to generate deeplink"
|
||||
)]
|
||||
recipe_name: String,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -266,13 +268,13 @@ enum Command {
|
||||
)]
|
||||
input_text: Option<String>,
|
||||
|
||||
/// Path to recipe.yaml file
|
||||
/// Recipe name or full path to the recipe file
|
||||
#[arg(
|
||||
short = None,
|
||||
long = "recipe",
|
||||
value_name = "FILE",
|
||||
help = "Path to recipe.yaml file",
|
||||
long_help = "Path to a recipe.yaml file that defines a custom agent configuration",
|
||||
value_name = "RECIPE_NAME or FULL_PATH_TO_RECIPE_FILE",
|
||||
help = "Recipe name to get recipe file or the full path of the recipe file",
|
||||
long_help = "Recipe name to get recipe file or the full path of the recipe file that defines a custom agent configuration",
|
||||
conflicts_with = "instructions",
|
||||
conflicts_with = "input_text"
|
||||
)]
|
||||
@@ -496,11 +498,12 @@ pub async fn cli() -> Result<()> {
|
||||
extensions_override: None,
|
||||
additional_system_prompt: None,
|
||||
},
|
||||
(_, _, Some(file)) => {
|
||||
let recipe = load_recipe(&file, true, Some(params)).unwrap_or_else(|err| {
|
||||
eprintln!("{}: {}", console::style("Error").red().bold(), err);
|
||||
std::process::exit(1);
|
||||
});
|
||||
(_, _, Some(recipe_name)) => {
|
||||
let recipe =
|
||||
load_recipe(&recipe_name, true, Some(params)).unwrap_or_else(|err| {
|
||||
eprintln!("{}: {}", console::style("Error").red().bold(), err);
|
||||
std::process::exit(1);
|
||||
});
|
||||
InputConfig {
|
||||
contents: recipe.prompt,
|
||||
extensions_override: recipe.extensions,
|
||||
@@ -568,11 +571,11 @@ pub async fn cli() -> Result<()> {
|
||||
}
|
||||
Some(Command::Recipe { command }) => {
|
||||
match command {
|
||||
RecipeCommand::Validate { file } => {
|
||||
handle_validate(file)?;
|
||||
RecipeCommand::Validate { recipe_name } => {
|
||||
handle_validate(&recipe_name)?;
|
||||
}
|
||||
RecipeCommand::Deeplink { file } => {
|
||||
handle_deeplink(file)?;
|
||||
RecipeCommand::Deeplink { recipe_name } => {
|
||||
handle_deeplink(&recipe_name)?;
|
||||
}
|
||||
}
|
||||
return Ok(());
|
||||
|
||||
Reference in New Issue
Block a user