From dc25619b702f6d13d5a9730a846e54bbde3edd3e Mon Sep 17 00:00:00 2001 From: Pushpak Chhajed Date: Thu, 18 Dec 2025 20:01:05 +0530 Subject: [PATCH] Refactor agent selection logic in InstallCommand Signed-off-by: Pushpak Chhajed --- src/Console/InstallCommand.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index 6cd9fe02..99c3c4da 100644 --- a/src/Console/InstallCommand.php +++ b/src/Console/InstallCommand.php @@ -353,10 +353,20 @@ protected function selectTargetAgents(): Collection return collect(); } + $defaults = $this->config->getAgents(); + + if ($this->selectedTargetMcpClient->isNotEmpty()) { + $defaults = $this->selectedTargetMcpClient + ->filter(fn (McpClient $client): bool => $client instanceof Agent) + ->map(fn (McpClient $client): string => $client->name()) + ->values() + ->toArray(); + } + return $this->selectCodeEnvironments( Agent::class, sprintf('Which agents need AI guidelines for %s?', $this->projectName), - $this->config->getAgents(), + $defaults, ); }