From 930ee29f28cbfef904591c39da57156b20e7333f Mon Sep 17 00:00:00 2001 From: James Hunt <10615884+thetwopct@users.noreply.github.com> Date: Sun, 16 Mar 2025 18:06:39 +0100 Subject: [PATCH] Require a prompt Signed-off-by: James Hunt <10615884+thetwopct@users.noreply.github.com> --- src/AiCommand.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/AiCommand.php b/src/AiCommand.php index 28f0c2f..6cee853 100644 --- a/src/AiCommand.php +++ b/src/AiCommand.php @@ -2,10 +2,10 @@ namespace WP_CLI\AiCommand; +use WP_CLI; use WP_CLI\AiCommand\ToolRepository\CollectionToolRepository; use WP_CLI\AiCommand\Tools\FileTools; use WP_CLI\AiCommand\Tools\URLTools; -use WP_CLI; use WP_CLI_Command; use WP_Community_Events; use WP_Error; @@ -56,6 +56,11 @@ public function __construct( * @param array $assoc_args Associative array of associative arguments. */ public function __invoke( $args, $assoc_args ) { + + if (empty($args) || !is_array($args)) { + WP_CLI::error( 'Please supply a prompt. Try "create a post".' ); + } + $this->register_tools($this->server); $this->register_resources($this->server);