Skip to content

Commit ce2d8e4

Browse files
committed
refactor: rename collections in InstallCommand for clarity and consistency
1 parent d3da2b2 commit ce2d8e4

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

src/Console/InstallCommand.php

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ class InstallCommand extends Command
4242
private Terminal $terminal;
4343

4444
/** @var Collection<int, Agent> */
45-
private Collection $agentsToInstallTo;
45+
private Collection $selectedTargetAgents;
4646

4747
/** @var Collection<int, Ide> */
48-
private Collection $idesToInstallTo;
48+
private Collection $selectedTargetIdes;
4949

50-
private Collection $boostToInstall;
50+
/** @var Collection<int, string> */
51+
private Collection $selectedBoostFeatures;
5152

5253
private string $projectName;
5354

@@ -86,8 +87,8 @@ private function bootstrapBoost(CodeEnvironmentsDetector $codeEnvironmentsDetect
8687
$this->greenTick = $this->green('');
8788
$this->redCross = $this->red('');
8889

89-
$this->agentsToInstallTo = collect();
90-
$this->idesToInstallTo = collect();
90+
$this->selectedTargetAgents = collect();
91+
$this->selectedTargetIdes = collect();
9192

9293
$this->projectName = basename(base_path());
9394
}
@@ -121,21 +122,21 @@ private function discoverEnvironment(): void
121122

122123
private function collectInstallationPreference(): void
123124
{
124-
$this->boostToInstall = $this->selectBoostFeatures();
125+
$this->selectedBoostFeatures = $this->selectBoostFeatures();
125126
$this->enforceTests = $this->determineTestEnforcement(ask: false);
126-
$this->idesToInstallTo = $this->selectTargetIdes();
127-
$this->agentsToInstallTo = $this->selectTargetAgents();
127+
$this->selectedTargetIdes = $this->selectTargetIdes();
128+
$this->selectedTargetAgents = $this->selectTargetAgents();
128129
}
129130

130131
private function enact(): void
131132
{
132-
if ($this->installingGuidelines() && ! empty($this->agentsToInstallTo)) {
133+
if ($this->installingGuidelines() && ! empty($this->selectedTargetAgents)) {
133134
$this->enactGuidelines();
134135
}
135136

136137
usleep(750000);
137138

138-
if (($this->installingMcp() || $this->installingHerdMcp()) && $this->idesToInstallTo->isNotEmpty()) {
139+
if (($this->installingMcp() || $this->installingHerdMcp()) && $this->selectedTargetIdes->isNotEmpty()) {
139140
$this->enactMcpServers();
140141
}
141142
}
@@ -168,9 +169,9 @@ private function outro(): void
168169
// Build install data - CSV format with type prefixes
169170
$data = [];
170171

171-
$ideNames = $this->idesToInstallTo->map(fn ($ide) => 'i:'.class_basename($ide))->toArray();
172-
$agentNames = $this->agentsToInstallTo->map(fn ($agent) => 'a:'.class_basename($agent))->toArray();
173-
$boostFeatures = $this->boostToInstall->map(fn ($feature) => 'b:'.$feature)->toArray();
172+
$ideNames = $this->selectedTargetIdes->map(fn ($ide) => 'i:'.class_basename($ide))->toArray();
173+
$agentNames = $this->selectedTargetAgents->map(fn ($agent) => 'a:'.class_basename($agent))->toArray();
174+
$boostFeatures = $this->selectedBoostFeatures->map(fn ($feature) => 'b:'.$feature)->toArray();
174175

175176
// Guidelines installed (prefix: g)
176177
$guidelines = [];
@@ -219,7 +220,7 @@ protected function determineTestEnforcement(bool $ask = true): bool
219220
->name('*.php')
220221
->count() > 6;
221222

222-
if (! $hasMinimumTests && ! $ask) {
223+
if (! $hasMinimumTests && $ask) {
223224
$hasMinimumTests = select(
224225
label: 'Should AI always create tests?',
225226
options: ['Yes', 'No'],
@@ -412,7 +413,7 @@ protected function enactGuidelines(): void
412413
return;
413414
}
414415

415-
if ($this->agentsToInstallTo->isEmpty()) {
416+
if ($this->selectedTargetAgents->isEmpty()) {
416417
$this->info('No agents selected for guideline installation.');
417418

418419
return;
@@ -436,8 +437,8 @@ protected function enactGuidelines(): void
436437
$failed = [];
437438
$composedAiGuidelines = $composer->compose();
438439

439-
$longestAgentName = max(1, ...$this->agentsToInstallTo->map(fn ($agent) => Str::length(class_basename($agent)))->toArray());
440-
foreach ($this->agentsToInstallTo as $agent) {
440+
$longestAgentName = max(1, ...$this->selectedTargetAgents->map(fn ($agent) => Str::length(class_basename($agent)))->toArray());
441+
foreach ($this->selectedTargetAgents as $agent) {
441442
$agentName = class_basename($agent);
442443
$displayAgentName = str_pad($agentName, $longestAgentName, ' ', STR_PAD_RIGHT);
443444
$this->output->write(" {$displayAgentName}... ");
@@ -468,22 +469,22 @@ protected function enactGuidelines(): void
468469

469470
protected function installingGuidelines(): bool
470471
{
471-
return $this->boostToInstall->contains('ai_guidelines');
472+
return $this->selectedBoostFeatures->contains('ai_guidelines');
472473
}
473474

474475
protected function installingStyleGuidelines(): bool
475476
{
476-
return $this->boostToInstall->contains('style_guidelines');
477+
return $this->selectedBoostFeatures->contains('style_guidelines');
477478
}
478479

479480
protected function installingMcp(): bool
480481
{
481-
return $this->boostToInstall->contains('mcp_server');
482+
return $this->selectedBoostFeatures->contains('mcp_server');
482483
}
483484

484485
protected function installingHerdMcp(): bool
485486
{
486-
return $this->boostToInstall->contains('herd_mcp');
487+
return $this->selectedBoostFeatures->contains('herd_mcp');
487488
}
488489

489490
protected function publishAndUpdateConfig(): void
@@ -541,9 +542,9 @@ protected function enactMcpServers(): void
541542
usleep(750000);
542543

543544
$failed = [];
544-
$longestIdeName = max(1, ...$this->idesToInstallTo->map(fn ($ide) => Str::length(class_basename($ide)))->toArray());
545+
$longestIdeName = max(1, ...$this->selectedTargetIdes->map(fn ($ide) => Str::length(class_basename($ide)))->toArray());
545546

546-
foreach ($this->idesToInstallTo as $ide) {
547+
foreach ($this->selectedTargetIdes as $ide) {
547548
$ideName = class_basename($ide);
548549
$ideDisplay = str_pad($ideName, $longestIdeName, ' ', STR_PAD_RIGHT);
549550
$this->output->write(" {$ideDisplay}... ");

0 commit comments

Comments
 (0)