diff --git a/.cursor/rules/04-exceptions.mdc b/.cursor/rules/04-exceptions.mdc index 15c3c8dd..0ccce49c 100644 --- a/.cursor/rules/04-exceptions.mdc +++ b/.cursor/rules/04-exceptions.mdc @@ -106,7 +106,7 @@ Traits mixed into Commands ARE Command layer. Display errors directly without re ```php // ✅ CORRECT - Display exception directly, no prefix -protected function getServerInfo(ServerDTO $server): array|int +protected function serverInfo(ServerDTO $server): array|int { try { $result = $this->executePlaybook($server, 'server-info', 'Gathering...'); diff --git a/app/Console/Server/ServerAddCommand.php b/app/Console/Server/ServerAddCommand.php index 3de7e308..3dfc921c 100644 --- a/app/Console/Server/ServerAddCommand.php +++ b/app/Console/Server/ServerAddCommand.php @@ -87,7 +87,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int // Get server info (verifies SSH connection and validates distribution & permissions) // ---- - $info = $this->getServerInfo($server); + $info = $this->serverInfo($server); if (is_int($info)) { return $info; diff --git a/app/Console/Server/ServerDeleteCommand.php b/app/Console/Server/ServerDeleteCommand.php index fda81738..52c0622c 100644 --- a/app/Console/Server/ServerDeleteCommand.php +++ b/app/Console/Server/ServerDeleteCommand.php @@ -181,10 +181,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->yay("Server '{$server->name}' deleted from inventory"); if (!$destroyed) { + $this->io->warning('Your server may still be running and incurring costs!'); $this->io->writeln([ '', - 'Your server may still be running and incurring costs:', - ' • Double-check with your cloud provider to ensure it is fully terminated.', + 'Check with your cloud provider to ensure it is fully terminated.', '', ]); } diff --git a/app/Console/Server/ServerInfoCommand.php b/app/Console/Server/ServerInfoCommand.php index 8c60000c..bdf2fc81 100644 --- a/app/Console/Server/ServerInfoCommand.php +++ b/app/Console/Server/ServerInfoCommand.php @@ -59,7 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int // Get server info (verifies SSH connection and validates distribution & permissions) // ---- - $info = $this->getServerInfo($server); + $info = $this->serverInfo($server); if (is_int($info)) { return $info; diff --git a/app/Console/Server/ServerInstallCommand.php b/app/Console/Server/ServerInstallCommand.php index 8fd63b0c..ee0cc13f 100644 --- a/app/Console/Server/ServerInstallCommand.php +++ b/app/Console/Server/ServerInstallCommand.php @@ -63,7 +63,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int // Get server info (verifies SSH connection and validates distribution & permissions) // ---- - $info = $this->getServerInfo($server); + $info = $this->serverInfo($server); if (is_int($info)) { return $info; diff --git a/app/Console/Server/ServerInstallPhpCommand.php b/app/Console/Server/ServerInstallPhpCommand.php index dd75802b..4ad6d73b 100644 --- a/app/Console/Server/ServerInstallPhpCommand.php +++ b/app/Console/Server/ServerInstallPhpCommand.php @@ -61,7 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int // Get server info (verifies SSH connection and validates distribution & permissions) // ---- - $info = $this->getServerInfo($server); + $info = $this->serverInfo($server); if (is_int($info)) { return $info; diff --git a/app/Console/Server/ServerLogsCommand.php b/app/Console/Server/ServerLogsCommand.php index 26e43032..d091f281 100644 --- a/app/Console/Server/ServerLogsCommand.php +++ b/app/Console/Server/ServerLogsCommand.php @@ -65,7 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int // Get server info (verifies SSH connection and validates distribution & permissions) // ---- - $info = $this->getServerInfo($server); + $info = $this->serverInfo($server); if (is_int($info)) { return $info; diff --git a/app/Console/Server/ServerProvisionDigitalOceanCommand.php b/app/Console/Server/ServerProvisionDigitalOceanCommand.php index 5b02425c..dbcc678c 100644 --- a/app/Console/Server/ServerProvisionDigitalOceanCommand.php +++ b/app/Console/Server/ServerProvisionDigitalOceanCommand.php @@ -165,7 +165,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->displayServerDeets($server); // Get server info (verifies SSH connection and validates distribution & permissions) - $info = $this->getServerInfo($server); + $info = $this->serverInfo($server); if (is_int($info)) { throw new \RuntimeException('Failed to validate server distribution'); diff --git a/app/Traits/ServersTrait.php b/app/Traits/ServersTrait.php index 84810491..3c2bde07 100644 --- a/app/Traits/ServersTrait.php +++ b/app/Traits/ServersTrait.php @@ -16,7 +16,7 @@ * Reusable server things. * * Requires classes using this trait to have IOService, ServerRepository, SSHService, and SiteRepository properties. - * Also requires PlaybooksTrait for getServerInfo() method. + * Also requires PlaybooksTrait for serverInfo() method. * * @property IOService $io * @property ServerRepository $servers @@ -44,7 +44,7 @@ trait ServersTrait * @param ServerDTO $server Server to get information for * @return array|int Returns parsed server info or failure code on failure */ - protected function getServerInfo(ServerDTO $server): array|int + protected function serverInfo(ServerDTO $server): array|int { $info = $this->executePlaybook( $server, @@ -264,12 +264,10 @@ protected function displayServerInfo(array $info): void } } - if (count($phpItems) === 0) { - $phpItems[] = 'No PHP installed'; + if (count($phpItems) > 0) { + $this->io->displayDeets(['PHP' => $phpItems]); + $this->io->writeln(''); } - - $this->io->displayDeets(['PHP' => $phpItems]); - $this->io->writeln(''); } // Display PHP-FPM information if available (multiple versions) @@ -392,7 +390,7 @@ private function formatUptime(int $seconds): string * Automatically sets first PHP install as default, otherwise prompts user. * * @param ServerDTO $server Server to install PHP on - * @param array $info Server information from getServerInfo() + * @param array $info Server information from serverInfo() * @return array{status: int, php_version: string, php_default: bool}|int Returns array with status and values, or int on failure */ protected function installPhp(ServerDTO $server, array $info): array|int