Skip to content

Commit afec83a

Browse files
committed
fix: detect if project uses sail
1 parent 13f317b commit afec83a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Console/InstallCommand.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class InstallCommand extends Command
3434
{
3535
use Colors;
3636

37+
private const SAIL_PATH = 'vendor/bin/sail';
38+
3739
private CodeEnvironmentsDetector $codeEnvironmentsDetector;
3840

3941
private Herd $herd;
@@ -462,6 +464,8 @@ private function installMcpServerConfig(): void
462464
)->toArray()
463465
);
464466

467+
$projectUsesSail = file_exists(base_path(self::SAIL_PATH));
468+
465469
/** @var CodeEnvironment $mcpClient */
466470
foreach ($this->selectedTargetMcpClient as $mcpClient) {
467471
$ideName = $mcpClient->mcpClientName();
@@ -471,8 +475,14 @@ private function installMcpServerConfig(): void
471475

472476
if ($this->shouldInstallMcp()) {
473477
try {
474-
$artisan = $mcpClient->useAbsolutePathForMcp ? base_path('artisan') : './artisan';
475-
$result = $mcpClient->installMcp('laravel-boost', 'php', [$artisan, 'boost:mcp']);
478+
if ($projectUsesSail) {
479+
$command = $mcpClient->useAbsolutePathForMcp ? base_path(self::SAIL_PATH) : self::SAIL_PATH;
480+
$artisan = 'artisan';
481+
} else {
482+
$command = 'php';
483+
$artisan = $mcpClient->useAbsolutePathForMcp ? base_path('artisan') : './artisan';
484+
}
485+
$result = $mcpClient->installMcp('laravel-boost', $command, [$artisan, 'boost:mcp']);
476486

477487
if ($result) {
478488
$results[] = $this->greenTick.' Boost';

0 commit comments

Comments
 (0)