feat: add cli execution plans

This commit is contained in:
Evandro Fonseca Junior committed 2026-03-26 19:05:40 -03:00
1 parent 501d39933f
commit 921cead9fd
5 files changed
+94 -10

No files matched your search

+53 -2
View File
@@ -233,8 +233,59 @@ fn render_command_summary(cli: &Cli) -> String {
}
fn plan_command(cli: &Cli) -> CommandPlan {
CommandPlan::SummaryOnly {
command: command_summary(&cli.command),
match &cli.command {
Commands::Status => CommandPlan::ProbeStatus {
server: cli.server.clone(),
api_key_present: cli.api_key.is_some(),
format: cli.format,
},
Commands::Models(models) => match &models.command {
ModelsSubcommand::Scan => CommandPlan::ScanModels {
models_dir: cli.models_dir.clone(),
},
ModelsSubcommand::Load(args) => CommandPlan::LoadModel {
models_dir: cli.models_dir.clone(),
model: args.model.clone(),
alias: args.alias.clone(),
},
_ => CommandPlan::SummaryOnly {
command: command_summary(&cli.command),
},
},
Commands::Auth(auth) => match &auth.command {
AuthSubcommand::Enable(args) => CommandPlan::ConfigureAuth {
mode: args.mode,
api_key: args.api_key.clone(),
},
_ => CommandPlan::SummaryOnly {
command: command_summary(&cli.command),
},
},
Commands::Config(config) => match &config.command {
ConfigSubcommand::Set(args) => CommandPlan::SetConfig {
key: args.key.clone(),
value: args.value.clone(),
},
_ => CommandPlan::SummaryOnly {
command: command_summary(&cli.command),
},
},
Commands::Bench(bench) => match &bench.command {
BenchSubcommand::Throughput(args) => CommandPlan::RunThroughputBench {
server: cli.server.clone(),
api_key_present: cli.api_key.is_some(),
samples: args.samples,
prompt_tokens: args.prompt_tokens,
completion_tokens: args.completion_tokens,
},
_ => CommandPlan::SummaryOnly {
command: command_summary(&cli.command),
},
},
Commands::Logs(args) => CommandPlan::ReadLogs { lines: args.lines },
Commands::Doctor => CommandPlan::SummaryOnly {
command: command_summary(&cli.command),
},
}
}