use clap::{Args, Subcommand};
use std::path::PathBuf;
#[derive(Debug, Args)]
#[command(
long_about = "Manage reusable library packs (embedded @zenith/* presets + project-local packs).\n\n\
A pack exports items addressed as <package>#<item>, e.g. `@zenith/flowchart#decision`.\n\
Item kinds:\n \
token — filter or mask token; copy into tokens block, apply with filter=(token)\"id\"\n \
component — reusable node group; materialized as an instance on a page (requires --page)\n \
action — canned tx op sequence; runs a transaction against the target document\n\n\
Embedded @zenith/* packs are built in; project packs live in libraries/*.zen and shadow them.\n\n\
WORKFLOW:\n \
zenith library list # discover packs and items\n \
zenith library show @zenith/filters#sepia # inspect item content before adding\n \
zenith library add @zenith/filters#sepia --into poster.zen"
)]
pub struct LibraryArgs {
#[command(subcommand)]
pub command: LibrarySub,
}
#[derive(Debug, Subcommand)]
pub enum LibrarySub {
List(LibraryListArgs),
Show(LibraryShowArgs),
Add(LibraryAddArgs),
}
#[derive(Debug, Args)]
pub struct LibraryAddArgs {
pub spec: String,
#[arg(long, value_name = "FILE")]
pub into: PathBuf,
#[arg(long, value_name = "ID")]
pub page: Option<String>,
#[arg(long, value_name = "X,Y")]
pub at: Option<String>,
#[arg(long, value_name = "ID")]
pub id: Option<String>,
#[arg(long)]
pub dry_run: bool,
}
#[derive(Debug, Args)]
pub struct LibraryListArgs {
pub path: Option<PathBuf>,
#[arg(long)]
pub json: bool,
}
#[derive(Debug, Args)]
#[command(after_help = "EXAMPLES:\n \
zenith library show @zenith/filters#sepia # inspect a filter token\n \
zenith library show @zenith/flowchart#decision # inspect a component\n \
zenith library show @zenith/brand-kit#apply-2026 --json")]
pub struct LibraryShowArgs {
pub spec: String,
pub path: Option<PathBuf>,
#[arg(long)]
pub json: bool,
}