Skip to content

Commit eff873e

Browse files
authored
Refactor agent selection logic in InstallCommand (#394)
Signed-off-by: Pushpak Chhajed <[email protected]>
1 parent b93476f commit eff873e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Console/InstallCommand.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,20 @@ protected function selectTargetAgents(): Collection
353353
return collect();
354354
}
355355

356+
$defaults = $this->config->getAgents();
357+
358+
if ($this->selectedTargetMcpClient->isNotEmpty()) {
359+
$defaults = $this->selectedTargetMcpClient
360+
->filter(fn (McpClient $client): bool => $client instanceof Agent)
361+
->map(fn (McpClient $client): string => $client->name())
362+
->values()
363+
->toArray();
364+
}
365+
356366
return $this->selectCodeEnvironments(
357367
Agent::class,
358368
sprintf('Which agents need AI guidelines for %s?', $this->projectName),
359-
$this->config->getAgents(),
369+
$defaults,
360370
);
361371
}
362372

0 commit comments

Comments
 (0)