use anyhow::Result;
use clap::{Parser, Subcommand};
mod auth;
mod config;
mod engines;
mod skill;
#[derive(Parser)]
#[command(name = "webmaster", about = "Unified CLI for search engine webmaster tools")]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
Auth {
engine: String,
},
#[command(name = "submit-sitemap")]
SubmitSitemap {
sitemap_url: String,
#[arg(short, long)]
site: Option<String>,
#[arg(short, long, default_value = "all")]
engine: String,
},
#[command(name = "list-sitemaps")]
ListSitemaps {
#[arg(short, long)]
site: Option<String>,
#[arg(short, long, default_value = "all")]
engine: String,
},
Skill {
#[command(subcommand)]
command: SkillCommands,
},
#[command(name = "audit-docs")]
AuditDocs,
}
#[derive(Subcommand)]
enum SkillCommands {
Install,
Check,
Uninstall,
}
fn main() -> Result<()> {
let cli = Cli::parse();
match cli.command {
Commands::Auth { engine } => {
engines::auth(&engine)?;
}
Commands::SubmitSitemap {
sitemap_url,
site,
engine,
} => {
engines::submit_sitemap(&engine, &sitemap_url, site.as_deref())?;
}
Commands::ListSitemaps { site, engine } => {
engines::list_sitemaps(&engine, site.as_deref())?;
}
Commands::Skill { command } => match command {
SkillCommands::Install => skill::install()?,
SkillCommands::Check => skill::check()?,
SkillCommands::Uninstall => skill::uninstall()?,
},
Commands::AuditDocs => {
agent_kit::audit::run(&agent_kit::audit::AuditConfig::agent_doc(), None)?;
}
}
Ok(())
}