Skip to content

Commit 1bd69aa

Browse files
committed
feat: remove Zed & make phpstorm MCP absolute
1 parent 2388076 commit 1bd69aa

File tree

6 files changed

+20
-101
lines changed

6 files changed

+20
-101
lines changed

src/Console/InstallCommand.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -317,21 +317,12 @@ private function selectCodeEnvironments(string $contractClass, string $label): C
317317
return collect();
318318
}
319319

320-
$options = $availableEnvironments
321-
->filter(function (CodeEnvironment $environment) {
322-
// We only show Zed if it's actually installed
323-
if ($environment->name() === 'zed' && ! in_array('zed', $this->systemInstalledCodeEnvironments)) {
324-
return false;
325-
}
326-
327-
return true;
328-
})
329-
->mapWithKeys(function (CodeEnvironment $environment) use ($config) {
330-
$displayMethod = $config['displayMethod'];
331-
$displayText = $environment->{$displayMethod}();
320+
$options = $availableEnvironments->mapWithKeys(function (CodeEnvironment $environment) use ($config) {
321+
$displayMethod = $config['displayMethod'];
322+
$displayText = $environment->{$displayMethod}();
332323

333-
return [get_class($environment) => $displayText];
334-
})->sort();
324+
return [get_class($environment) => $displayText];
325+
})->sort();
335326

336327
$detectedClasses = [];
337328
$installedEnvNames = array_unique(array_merge(
@@ -341,7 +332,7 @@ private function selectCodeEnvironments(string $contractClass, string $label): C
341332

342333
foreach ($installedEnvNames as $envKey) {
343334
$matchingEnv = $availableEnvironments->first(fn (CodeEnvironment $env) => strtolower($envKey) === strtolower($env->name()));
344-
if ($matchingEnv && ($options->contains($matchingEnv->displayName() || $options->contains($matchingEnv->agentName())))) {
335+
if ($matchingEnv) {
345336
$detectedClasses[] = get_class($matchingEnv);
346337
}
347338
}
@@ -479,7 +470,8 @@ private function installMcpServerConfig(): void
479470

480471
if ($this->shouldInstallMcp()) {
481472
try {
482-
$result = $mcpClient->installMcp('laravel-boost', 'php', ['./artisan', 'boost:mcp']);
473+
$artisan = $mcpClient->absolute ? base_path('artisan') : './artisan';
474+
$result = $mcpClient->installMcp('laravel-boost', 'php', [$artisan, 'boost:mcp']);
483475

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

src/Install/CodeEnvironment/CodeEnvironment.php

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
abstract class CodeEnvironment
1717
{
18-
public function __construct(protected readonly DetectionStrategyFactory $strategyFactory)
19-
{
20-
}
18+
public bool $absolute = false;
19+
20+
public function __construct(protected readonly DetectionStrategyFactory $strategyFactory) {}
2121

2222
abstract public function name(): string;
2323

@@ -36,7 +36,6 @@ public function mcpClientName(): ?string
3636
/**
3737
* Get the detection configuration for system-wide installation detection.
3838
*
39-
* @param Platform $platform
4039
* @return array{paths?: string[], command?: string, files?: string[]}
4140
*/
4241
abstract public function systemDetectionConfig(Platform $platform): array;
@@ -102,17 +101,14 @@ public function mcpConfigKey(): string
102101
/**
103102
* Install MCP server using the appropriate strategy.
104103
*
105-
* @param string $key
106-
* @param string $command
107104
* @param array<int, string> $args
108105
* @param array<string, string> $env
109-
* @return bool
110106
*
111107
* @throws FileNotFoundException
112108
*/
113109
public function installMcp(string $key, string $command, array $args = [], array $env = []): bool
114110
{
115-
return match($this->mcpInstallationStrategy()) {
111+
return match ($this->mcpInstallationStrategy()) {
116112
McpInstallationStrategy::SHELL => $this->installShellMcp($key, $command, $args, $env),
117113
McpInstallationStrategy::FILE => $this->installFileMcp($key, $command, $args, $env),
118114
McpInstallationStrategy::NONE => false
@@ -122,11 +118,8 @@ public function installMcp(string $key, string $command, array $args = [], array
122118
/**
123119
* Install MCP server using a shell command strategy.
124120
*
125-
* @param string $key
126-
* @param string $command
127121
* @param array<int, string> $args
128122
* @param array<string, string> $env
129-
* @return bool
130123
*/
131124
protected function installShellMcp(string $key, string $command, array $args = [], array $env = []): bool
132125
{
@@ -163,11 +156,8 @@ protected function installShellMcp(string $key, string $command, array $args = [
163156
/**
164157
* Install MCP server using a file-based configuration strategy.
165158
*
166-
* @param string $key
167-
* @param string $command
168159
* @param array<int, string> $args
169160
* @param array<string, string> $env
170-
* @return bool
171161
*
172162
* @throws FileNotFoundException
173163
*/

src/Install/CodeEnvironment/PhpStorm.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
class PhpStorm extends CodeEnvironment implements Agent, McpClient
1212
{
13+
public bool $absolute = true;
14+
1315
public function name(): string
1416
{
1517
return 'phpstorm';

src/Install/CodeEnvironment/Zed.php

Lines changed: 0 additions & 60 deletions
This file was deleted.

src/Install/CodeEnvironmentsDetector.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Laravel\Boost\Install\CodeEnvironment\Cursor;
1313
use Laravel\Boost\Install\CodeEnvironment\PhpStorm;
1414
use Laravel\Boost\Install\CodeEnvironment\VSCode;
15-
use Laravel\Boost\Install\CodeEnvironment\Zed;
1615
use Laravel\Boost\Install\Enums\Platform;
1716

1817
class CodeEnvironmentsDetector
@@ -23,14 +22,12 @@ class CodeEnvironmentsDetector
2322
'vscode' => VSCode::class,
2423
'cursor' => Cursor::class,
2524
'claudecode' => ClaudeCode::class,
26-
'zed' => Zed::class,
2725
'copilot' => Copilot::class,
2826
];
2927

3028
public function __construct(
3129
private readonly Container $container
32-
) {
33-
}
30+
) {}
3431

3532
/**
3633
* Detect installed applications on the current platform.

tests/Unit/Install/CodeEnvironmentsDetectorTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Laravel\Boost\Install\Enums\Platform;
88

99
beforeEach(function () {
10-
$this->container = new \Illuminate\Container\Container();
10+
$this->container = new \Illuminate\Container\Container;
1111
$this->detector = new CodeEnvironmentsDetector($this->container);
1212
});
1313

@@ -35,12 +35,11 @@
3535
$otherProgram->shouldReceive('name')->andReturn('other');
3636

3737
// Bind mocked programs to container
38-
$container = new \Illuminate\Container\Container();
38+
$container = new \Illuminate\Container\Container;
3939
$container->bind(\Laravel\Boost\Install\CodeEnvironment\PhpStorm::class, fn () => $program1);
4040
$container->bind(\Laravel\Boost\Install\CodeEnvironment\VSCode::class, fn () => $program2);
4141
$container->bind(\Laravel\Boost\Install\CodeEnvironment\Cursor::class, fn () => $program3);
4242
$container->bind(\Laravel\Boost\Install\CodeEnvironment\ClaudeCode::class, fn () => $otherProgram);
43-
$container->bind(\Laravel\Boost\Install\CodeEnvironment\Zed::class, fn () => $otherProgram);
4443
$container->bind(\Laravel\Boost\Install\CodeEnvironment\Copilot::class, fn () => $otherProgram);
4544

4645
$detector = new CodeEnvironmentsDetector($container);
@@ -60,12 +59,11 @@
6059
$otherProgram->shouldReceive('name')->andReturn('other');
6160

6261
// Bind mocked program to container
63-
$container = new \Illuminate\Container\Container();
62+
$container = new \Illuminate\Container\Container;
6463
$container->bind(\Laravel\Boost\Install\CodeEnvironment\PhpStorm::class, fn () => $program1);
6564
$container->bind(\Laravel\Boost\Install\CodeEnvironment\VSCode::class, fn () => $otherProgram);
6665
$container->bind(\Laravel\Boost\Install\CodeEnvironment\Cursor::class, fn () => $otherProgram);
6766
$container->bind(\Laravel\Boost\Install\CodeEnvironment\ClaudeCode::class, fn () => $otherProgram);
68-
$container->bind(\Laravel\Boost\Install\CodeEnvironment\Zed::class, fn () => $otherProgram);
6967
$container->bind(\Laravel\Boost\Install\CodeEnvironment\Copilot::class, fn () => $otherProgram);
7068

7169
$detector = new CodeEnvironmentsDetector($container);
@@ -90,7 +88,7 @@
9088
$program3->shouldReceive('name')->andReturn('claudecode');
9189

9290
// Bind mocked programs to container
93-
$container = new \Illuminate\Container\Container();
91+
$container = new \Illuminate\Container\Container;
9492
$container->bind(\Laravel\Boost\Install\CodeEnvironment\VSCode::class, fn () => $program1);
9593
$container->bind(\Laravel\Boost\Install\CodeEnvironment\PhpStorm::class, fn () => $program2);
9694
$container->bind(\Laravel\Boost\Install\CodeEnvironment\ClaudeCode::class, fn () => $program3);
@@ -109,7 +107,7 @@
109107
$program1->shouldReceive('name')->andReturn('vscode');
110108

111109
// Bind mocked program to container
112-
$container = new \Illuminate\Container\Container();
110+
$container = new \Illuminate\Container\Container;
113111
$container->bind(\Laravel\Boost\Install\CodeEnvironment\VSCode::class, fn () => $program1);
114112

115113
$detector = new CodeEnvironmentsDetector($container);

0 commit comments

Comments
 (0)