feat: enhance prerequisite validation to return detailed results

This commit is contained in:
Andras Bacsai
2025-11-21 13:14:48 +01:00
parent 01957f2752
commit 29135e00ba
7 changed files with 95 additions and 21 deletions

View File

@@ -322,13 +322,14 @@ class Index extends Component
try {
// Check prerequisites
$prerequisitesInstalled = $this->createdServer->validatePrerequisites();
if (! $prerequisitesInstalled) {
$validationResult = $this->createdServer->validatePrerequisites();
if (! $validationResult['success']) {
$this->createdServer->installPrerequisites();
// Recheck after installation
$prerequisitesInstalled = $this->createdServer->validatePrerequisites();
if (! $prerequisitesInstalled) {
throw new \Exception('Prerequisites (git, curl, jq) could not be installed. Please install them manually.');
$validationResult = $this->createdServer->validatePrerequisites();
if (! $validationResult['success']) {
$missingCommands = implode(', ', $validationResult['missing']);
throw new \Exception("Prerequisites ({$missingCommands}) could not be installed. Please install them manually.");
}
}
} catch (\Throwable $e) {