From 11a912e4d49fd84e4ca7b2c720fe92575f786c5b Mon Sep 17 00:00:00 2001 From: allenjiang Date: Mon, 29 Jun 2026 22:46:23 +0800 Subject: [PATCH] refactor: enhance UX for missing build tools prompt --- .../DependencyInstaller/PrescanSystemDependencies.php | 2 +- src/SelfManage/BuildTools/CheckAllBuildTools.php | 2 +- test/unit/SelfManage/BuildTools/CheckAllBuildToolsTest.php | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/DependencyResolver/DependencyInstaller/PrescanSystemDependencies.php b/src/DependencyResolver/DependencyInstaller/PrescanSystemDependencies.php index b4bd0f23..9d120f8e 100644 --- a/src/DependencyResolver/DependencyInstaller/PrescanSystemDependencies.php +++ b/src/DependencyResolver/DependencyInstaller/PrescanSystemDependencies.php @@ -99,7 +99,7 @@ static function (DependencyStatus $dependencyStatus): bool { $this->io->write(sprintf('Need to install missing system dependencies: %s', $proposedInstallCommand)); if ($this->io->isInteractive() && ! $autoInstallIfMissing) { - if (! $this->io->askConfirmation('Would you like to install them now?', false)) { + if (! $this->io->askConfirmation('Would you like to install them now? [y/N]', false)) { $this->io->write('Ok, but things might not work. Just so you know.'); return; diff --git a/src/SelfManage/BuildTools/CheckAllBuildTools.php b/src/SelfManage/BuildTools/CheckAllBuildTools.php index 7d342848..72870c11 100644 --- a/src/SelfManage/BuildTools/CheckAllBuildTools.php +++ b/src/SelfManage/BuildTools/CheckAllBuildTools.php @@ -171,7 +171,7 @@ public function check(IOInterface $io, PackageManager|null $packageManager, Targ $io->write('The following command will be run: ' . $proposedInstallCommand, verbosity: IOInterface::VERBOSE); if ($io->isInteractive() && ! $autoInstallIfMissing) { - if (! $io->askConfirmation('Would you like to install them now?', false)) { + if (! $io->askConfirmation('Would you like to install them now? [y/N]', false)) { $io->write('Ok, but things might not work. Just so you know.'); return; diff --git a/test/unit/SelfManage/BuildTools/CheckAllBuildToolsTest.php b/test/unit/SelfManage/BuildTools/CheckAllBuildToolsTest.php index c8e89f40..ecd756d3 100644 --- a/test/unit/SelfManage/BuildTools/CheckAllBuildToolsTest.php +++ b/test/unit/SelfManage/BuildTools/CheckAllBuildToolsTest.php @@ -79,6 +79,7 @@ public function testCheckInstallsMissingToolWhenPromptedInInteractiveMode(): voi $outputString = $io->getOutput(); self::assertStringContainsString('Checking if all build tools are installed.', $outputString); self::assertStringContainsString('The following build tools are missing: bloop', $outputString); + self::assertStringContainsString('Would you like to install them now? [y/N]', $outputString); self::assertStringContainsString('The following command will be run: echo "fake installing coreutils"', $outputString); self::assertStringContainsString('Missing build tools have been installed.', $outputString); }