From 5acd8f661ff367ed7612023938134867500f3284 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Sun, 22 Feb 2026 08:39:38 -0800 Subject: [PATCH] Move build/dev/generate/publish under plugin command --- crates-cli/yaak-cli/src/cli.rs | 34 +++++++++++++++------- crates-cli/yaak-cli/src/commands/plugin.rs | 11 ++++++- crates-cli/yaak-cli/src/main.rs | 5 +--- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/crates-cli/yaak-cli/src/cli.rs b/crates-cli/yaak-cli/src/cli.rs index 164e1e8c..5edf43d8 100644 --- a/crates-cli/yaak-cli/src/cli.rs +++ b/crates-cli/yaak-cli/src/cli.rs @@ -26,17 +26,8 @@ pub enum Commands { /// Authentication commands Auth(AuthArgs), - /// Transpile code into a runnable plugin bundle - Build(PluginPathArg), - - /// Build plugin bundle continuously when the filesystem changes - Dev(PluginPathArg), - - /// Generate a "Hello World" Yaak plugin - Generate(GenerateArgs), - - /// Publish a Yaak plugin version to the plugin registry - Publish(PluginPathArg), + /// Plugin development and publishing commands + Plugin(PluginArgs), /// Send a request, folder, or workspace by ID Send(SendArgs), @@ -339,6 +330,27 @@ pub enum AuthCommands { Whoami, } +#[derive(Args)] +pub struct PluginArgs { + #[command(subcommand)] + pub command: PluginCommands, +} + +#[derive(Subcommand)] +pub enum PluginCommands { + /// Transpile code into a runnable plugin bundle + Build(PluginPathArg), + + /// Build plugin bundle continuously when the filesystem changes + Dev(PluginPathArg), + + /// Generate a "Hello World" Yaak plugin + Generate(GenerateArgs), + + /// Publish a Yaak plugin version to the plugin registry + Publish(PluginPathArg), +} + #[derive(Args, Clone)] pub struct PluginPathArg { /// Path to plugin directory (defaults to current working directory) diff --git a/crates-cli/yaak-cli/src/commands/plugin.rs b/crates-cli/yaak-cli/src/commands/plugin.rs index f08dda8b..d6638480 100644 --- a/crates-cli/yaak-cli/src/commands/plugin.rs +++ b/crates-cli/yaak-cli/src/commands/plugin.rs @@ -1,4 +1,4 @@ -use crate::cli::{GenerateArgs, PluginPathArg}; +use crate::cli::{GenerateArgs, PluginArgs, PluginCommands, PluginPathArg}; use crate::ui; use keyring::Entry; use rand::Rng; @@ -57,6 +57,15 @@ pub async fn run_build(args: PluginPathArg) -> i32 { } } +pub async fn run(args: PluginArgs) -> i32 { + match args.command { + PluginCommands::Build(args) => run_build(args).await, + PluginCommands::Dev(args) => run_dev(args).await, + PluginCommands::Generate(args) => run_generate(args).await, + PluginCommands::Publish(args) => run_publish(args).await, + } +} + pub async fn run_dev(args: PluginPathArg) -> i32 { match dev(args).await { Ok(()) => 0, diff --git a/crates-cli/yaak-cli/src/main.rs b/crates-cli/yaak-cli/src/main.rs index 32fde0be..48b1f66b 100644 --- a/crates-cli/yaak-cli/src/main.rs +++ b/crates-cli/yaak-cli/src/main.rs @@ -48,10 +48,7 @@ async fn main() { let exit_code = match command { Commands::Auth(args) => commands::auth::run(args).await, - Commands::Build(args) => commands::plugin::run_build(args).await, - Commands::Dev(args) => commands::plugin::run_dev(args).await, - Commands::Generate(args) => commands::plugin::run_generate(args).await, - Commands::Publish(args) => commands::plugin::run_publish(args).await, + Commands::Plugin(args) => commands::plugin::run(args).await, Commands::Send(args) => { commands::send::run( context.as_ref().expect("context initialized for send"),