#[derive(Debug, Clone, clap::Args)]
#[group(id = "agent")]
#[remain::sorted]
#[rustfmt::skip]
pub(crate) struct AgentOptions {
#[command(flatten)]
pub(crate) config: AgentConfig
}
impl<T> AsRef<T> for AgentOptions
where
AgentConfig: AsRef<T>,
{
fn as_ref(&self) -> &T {
self.config.as_ref()
}
}
#[derive(Debug, Clone, clap::Args)]
#[group(id = "agent.config")]
#[remain::sorted]
#[rustfmt::skip]
pub(crate) struct AgentConfig {
#[command(flatten)]
pub(crate) file: AgentConfigFile,
}
impl<T> AsRef<T> for AgentConfig
where
AgentConfigFile: AsRef<T>,
{
fn as_ref(&self) -> &T {
self.file.as_ref()
}
}
#[derive(Debug, Clone, clap::Args)]
#[group(id = "agent.config.file")]
#[remain::sorted]
#[rustfmt::skip]
pub(crate) struct AgentConfigFile {
#[arg(
env = "AGENT_CONFIG_FILE",
long = "agent-config-file",
id = "agent.config.file.path",
value_name = "PATH",
default_value = "agent.json",
help_heading = "Agent Options",
help = "path for agent config file"
)]
pub(crate) path: camino::Utf8PathBuf,
}
impl From<camino::Utf8PathBuf> for AgentConfigFile {
fn from(path: camino::Utf8PathBuf) -> Self {
Self { path }
}
}
impl From<AgentConfigFile> for camino::Utf8PathBuf {
fn from(value: AgentConfigFile) -> Self {
let AgentConfigFile { path } = value;
path
}
}
impl AsRef<camino::Utf8Path> for AgentConfigFile {
fn as_ref(&self) -> &camino::Utf8Path {
self.path.as_path()
}
}
impl AsRef<std::path::Path> for AgentConfigFile {
fn as_ref(&self) -> &std::path::Path {
self.path.as_std_path()
}
}
impl From<AgentConfigFile> for bsky_sdk::agent::config::FileStore {
fn from(value: AgentConfigFile) -> Self {
Self::new(value)
}
}