Skip to content

refactor: rename methods in InstallCommand for better readability and consistency #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 11, 2025
Merged
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
35 changes: 16 additions & 19 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@

private function enact(): void
{
if ($this->installingGuidelines() && ! empty($this->selectedTargetAgents)) {
if ($this->shouldInstallAiGuidelines() && ! empty($this->selectedTargetAgents)) {
$this->enactGuidelines();
}

usleep(750000);

if (($this->installingMcp() || $this->installingHerdMcp()) && $this->selectedTargetIdes->isNotEmpty()) {
if (($this->shouldInstallMcp() || $this->shouldInstallHerdMcp()) && $this->selectedTargetIdes->isNotEmpty()) {
$this->enactMcpServers();
}
}
Expand Down Expand Up @@ -171,11 +171,11 @@

// Guidelines installed (prefix: g)
$guidelines = [];
if ($this->installingGuidelines()) {
if ($this->shouldInstallAiGuidelines()) {
$guidelines[] = 'g:ai';
}

if ($this->installingStyleGuidelines()) {
if ($this->shouldInstallStyleGuidelines()) {
$guidelines[] = 'g:style';
}

Expand All @@ -191,7 +191,7 @@
$paddingLength = (int) (floor(($this->terminal->cols() - mb_strlen($text.$label)) / 2)) - 2;

echo "\033[42m\033[2K".str_repeat(' ', $paddingLength); // Make the entire line have a green background
echo $this->black($this->bold($text.$link)).$this->reset().PHP_EOL;

Check failure on line 194 in src/Console/InstallCommand.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Method Laravel\Boost\Console\InstallCommand::reset() invoked with 0 parameters, 1 required.
}

private function hyperlink(string $label, string $url): string
Expand Down Expand Up @@ -229,21 +229,20 @@
*/
private function selectBoostFeatures(): Collection
{
$defaultToInstallOptions = ['mcp_server', 'ai_guidelines'];
$toInstallOptions = [
$defaultInstallOptions = ['mcp_server', 'ai_guidelines'];
$installOptions = [
'mcp_server' => 'Boost MCP Server',
'ai_guidelines' => 'Package AI Guidelines (i.e. Framework, Inertia, Pest)',
// 'style_guidelines' => 'Laravel Style AI Guidelines',
];

if ($this->herd->isMcpAvailable()) {
$toInstallOptions['herd_mcp'] = 'Herd MCP Server';
$installOptions['herd_mcp'] = 'Herd MCP Server';
}

return collect(multiselect(
label: 'What shall we install?',
options: $toInstallOptions,
default: $defaultToInstallOptions,
options: $installOptions,
default: $defaultInstallOptions,
required: true,
));
}
Expand Down Expand Up @@ -299,7 +298,7 @@
private function selectTargetIdes(): Collection
{
$ides = [];
if (! $this->installingMcp() && ! $this->installingHerdMcp()) {

Check failure on line 301 in src/Console/InstallCommand.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Call to an undefined method Laravel\Boost\Console\InstallCommand::installingMcp().

Check failure on line 301 in src/Console/InstallCommand.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Call to an undefined method Laravel\Boost\Console\InstallCommand::installingHerdMcp().
return collect();
}

Expand Down Expand Up @@ -353,7 +352,7 @@
private function selectTargetAgents(): Collection
{
$agents = [];
if (! $this->installingGuidelines()) {

Check failure on line 355 in src/Console/InstallCommand.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Call to an undefined method Laravel\Boost\Console\InstallCommand::installingGuidelines().
return collect();
}

Expand Down Expand Up @@ -401,7 +400,7 @@

protected function enactGuidelines(): void
{
if (! $this->installingGuidelines()) {
if (! $this->shouldInstallAiGuidelines()) {
return;
}

Expand All @@ -413,7 +412,7 @@

$guidelineConfig = new GuidelineConfig;
$guidelineConfig->enforceTests = $this->enforceTests;
$guidelineConfig->laravelStyle = $this->installingStyleGuidelines();

Check failure on line 415 in src/Console/InstallCommand.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Call to an undefined method Laravel\Boost\Console\InstallCommand::installingStyleGuidelines().
$guidelineConfig->caresAboutLocalization = $this->detectLocalization();
$guidelineConfig->hasAnApi = false;

Expand Down Expand Up @@ -459,24 +458,22 @@
}
}

protected function installingGuidelines(): bool
private function shouldInstallAiGuidelines(): bool
{
return $this->selectedBoostFeatures->contains('ai_guidelines');
}

protected function installingStyleGuidelines(): bool
private function shouldInstallStyleGuidelines(): bool
{
return false;

return $this->selectedBoostFeatures->contains('style_guidelines');
}

protected function installingMcp(): bool
private function shouldInstallMcp(): bool
{
return $this->selectedBoostFeatures->contains('mcp_server');
}

protected function installingHerdMcp(): bool
private function shouldInstallHerdMcp(): bool
{
return $this->selectedBoostFeatures->contains('herd_mcp');
}
Expand Down Expand Up @@ -545,7 +542,7 @@
$results = [];

// Install Laravel Boost MCP if enabled
if ($this->installingMcp()) {
if ($this->shouldInstallMcp()) {
try {
$result = $ide->installMcp('laravel-boost', 'php', ['./artisan', 'boost:mcp']);

Expand All @@ -562,7 +559,7 @@
}

// Install Herd MCP if enabled
if ($this->installingHerdMcp()) {
if ($this->shouldInstallHerdMcp()) {
try {
$result = $ide->installMcp(
key: 'herd',
Expand Down
Loading