use clap::Subcommand;
#[derive(Subcommand)]
#[command(rename_all = "verbatim")]
pub enum GetCommand {
#[command(name = "get")]
Get,
}
#[derive(Subcommand)]
#[command(rename_all = "verbatim")]
pub enum Commands {
#[command(name = "list")]
List,
Agent {
#[command(subcommand)]
command: GetCommand,
},
AgentBase {
#[command(subcommand)]
command: GetCommand,
},
Continuation {
#[command(subcommand)]
command: GetCommand,
},
OutputMode {
#[command(subcommand)]
command: GetCommand,
},
Provider {
#[command(subcommand)]
command: GetCommand,
},
ProviderQuantization {
#[command(subcommand)]
command: GetCommand,
},
Reasoning {
#[command(subcommand)]
command: GetCommand,
},
ReasoningEffort {
#[command(subcommand)]
command: GetCommand,
},
ReasoningSummaryVerbosity {
#[command(subcommand)]
command: GetCommand,
},
Stop {
#[command(subcommand)]
command: GetCommand,
},
Upstream {
#[command(subcommand)]
command: GetCommand,
},
Verbosity {
#[command(subcommand)]
command: GetCommand,
},
}
impl Commands {
pub async fn handle(self, handle: &objectiveai_cli_sdk::output::Handle) -> Result<(), crate::error::Error> {
match self {
Commands::List => {
const NAMES: &[&str] = &["Agent", "AgentBase", "Continuation", "OutputMode", "Provider", "ProviderQuantization", "Reasoning", "ReasoningEffort", "ReasoningSummaryVerbosity", "Stop", "Upstream", "Verbosity"];
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schemas>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schemas {
schemas: NAMES.iter().map(|s| s.to_string()).collect(),
},
},
).emit(handle).await;
Ok(())
}
Commands::Agent { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/agent.openrouter.Agent.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::AgentBase { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/agent.openrouter.AgentBase.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::Continuation { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/agent.openrouter.Continuation.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::OutputMode { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/agent.openrouter.OutputMode.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::Provider { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/agent.openrouter.Provider.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::ProviderQuantization { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/agent.openrouter.ProviderQuantization.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::Reasoning { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/agent.openrouter.Reasoning.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::ReasoningEffort { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/agent.openrouter.ReasoningEffort.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::ReasoningSummaryVerbosity { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/agent.openrouter.ReasoningSummaryVerbosity.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::Stop { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/agent.openrouter.Stop.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::Upstream { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/agent.openrouter.Upstream.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::Verbosity { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/agent.openrouter.Verbosity.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
}
}
}