From 61066748d92ac6931d42bd65151175dc9b661de7 Mon Sep 17 00:00:00 2001 From: JonPurvis Date: Sun, 15 Nov 2026 02:17:43 +0000 Subject: [PATCH] fix the skills install prompt hanging --- app/Middleware/OffersSkillsInstall.php | 14 ++++++++++--- tests/Feature/OffersSkillsInstallTest.php | 24 ++++++++++++++++++++++- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/app/Middleware/OffersSkillsInstall.php b/app/Middleware/OffersSkillsInstall.php index 9bedc56a..a91419ad 100644 --- a/app/Middleware/OffersSkillsInstall.php +++ b/app/Middleware/OffersSkillsInstall.php @@ -10,6 +10,7 @@ use App\Support\DetectsNonInteractiveEnvironments; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\File; +use Symfony\Component\Console\Output\ConsoleOutput; use function Laravel\Prompts\confirm; use function Laravel\Prompts\info; @@ -66,7 +67,7 @@ public function handle($command, callable $next) ); if ($install) { - $this->runInstall(); + $this->runInstall($detectedAgents); } else { $this->showDeclineHint(); } @@ -74,9 +75,16 @@ public function handle($command, callable $next) return $next(); } - protected function runInstall(): void + /** + * @param array $agents + */ + protected function runInstall(array $agents): void { - Artisan::call(SkillsInstall::class); + // A bare Artisan::call buffers output, then waits on a prompt the user cannot see. + Artisan::call(SkillsInstall::class, [ + '--global' => true, + '--agent' => $agents, + ], new ConsoleOutput); } protected function showDeclineHint(): void diff --git a/tests/Feature/OffersSkillsInstallTest.php b/tests/Feature/OffersSkillsInstallTest.php index a96568b2..69c183d6 100644 --- a/tests/Feature/OffersSkillsInstallTest.php +++ b/tests/Feature/OffersSkillsInstallTest.php @@ -1,9 +1,12 @@ mockConfig = Mockery::mock(ConfigRepository::class); @@ -95,12 +98,31 @@ function partialMiddleware(array $overrides = []): OffersSkillsInstall ->once(); $middleware = partialMiddleware(); - $middleware->shouldReceive('runInstall')->once(); + $middleware->shouldReceive('runInstall')->once()->with(['claude']); $middleware->shouldReceive('showDeclineHint')->never(); expect(runMiddleware($middleware))->toBeTrue(); }); +it('installs the detected agents on the terminal when the user confirms', function () { + Prompt::fake([Key::ENTER]); + + $this->mockConfig->shouldReceive('get')->with('skills_install_prompted_at')->andReturn(null); + $this->mockConfig->shouldReceive('set') + ->with('skills_install_prompted_at', Mockery::type('string')) + ->once(); + + Artisan::shouldReceive('call') + ->once() + ->with( + SkillsInstall::class, + ['--global' => true, '--agent' => ['claude']], + Mockery::type(ConsoleOutput::class), + ); + + expect(runMiddleware(partialMiddleware()))->toBeTrue(); +}); + it('records the choice without installing when the user declines', function () { Prompt::fake([Key::TAB, Key::ENTER]);