Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Laravel\Boost\Contracts\McpClient;
use Laravel\Boost\Install\Cli\DisplayHelper;
use Laravel\Boost\Install\CodeEnvironment\CodeEnvironment;
use Laravel\Boost\Install\CodeEnvironment\PhpStorm;
use Laravel\Boost\Install\CodeEnvironmentsDetector;
use Laravel\Boost\Install\GuidelineComposer;
use Laravel\Boost\Install\GuidelineConfig;
Expand Down Expand Up @@ -592,6 +593,11 @@ protected function installMcpServerConfig(): void
);

foreach ($this->selectedTargetMcpClient as $mcpClient) {
if ($mcpClient instanceof PhpStorm) {
$mcpClient->selectedAsAgent = $this->selectedTargetAgents
->contains(fn ($agent): bool => $agent instanceof PhpStorm);
}

$ideName = $mcpClient->mcpClientName();
$ideDisplay = str_pad((string) $ideName, $longestIdeName);
$this->output->write(" {$ideDisplay}... ");
Expand Down
6 changes: 6 additions & 0 deletions src/Install/CodeEnvironment/PhpStorm.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class PhpStorm extends CodeEnvironment implements Agent, McpClient
{
public bool $useAbsolutePathForMcp = true;

public bool $selectedAsAgent = false;

public function name(): string
{
return 'phpstorm';
Expand Down Expand Up @@ -60,6 +62,10 @@ public function agentName(): string

public function mcpConfigPath(): string
{
if (! $this->selectedAsAgent) {
return '.idea/mcp.json';
}

return '.junie/mcp/mcp.json';
}

Expand Down
14 changes: 14 additions & 0 deletions tests/Unit/Install/CodeEnvironment/PhpStormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,17 @@

expect($phpstorm->guidelinesPath())->toBe('.idea/guidelines.md');
});

test('mcpConfigPath returns idea path when not selected as agent', function (): void {
$phpstorm = new PhpStorm($this->strategyFactory);
$phpstorm->selectedAsAgent = false;

expect($phpstorm->mcpConfigPath())->toBe('.idea/mcp.json');
});

test('mcpConfigPath returns junie path when selected as agent', function (): void {
$phpstorm = new PhpStorm($this->strategyFactory);
$phpstorm->selectedAsAgent = true;

expect($phpstorm->mcpConfigPath())->toBe('.junie/mcp/mcp.json');
});