Skip to content

config: add project purpose and browser logs watcher options to boost.php and organnise config in laravel style #10

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 6 commits into from
Aug 10, 2025
Merged
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
14 changes: 12 additions & 2 deletions config/boost.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
declare(strict_types=1);

return [
'project_purpose' => null,
'browser_logs' => true,

/*
|--------------------------------------------------------------------------
| Boost Browser Logs Watcher Switch
|--------------------------------------------------------------------------
|
| The following option may be used to enable or disable browser logs watcher
| functionality which simply provides a single and convenient way to
| enable or disable browser logs functionality in Boost.
*/

'browser_logs_watcher' => env('BOOST_BROWSER_LOGS_WATCHER', true),
];
2 changes: 1 addition & 1 deletion pint.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"phpdoc_align": {
"align": "left",
"spacing": {
"param": 2
"param": 1
}
},
"phpdoc_indent": true,
Expand Down
12 changes: 6 additions & 6 deletions src/BoostServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private function registerRoutes(): void
level: $this->mapJsTypeToPsr3Level($log['type']),
message: $this->buildLogMessageFromData($log['data']),
context: [
'url' => $log['url'],
'url' => $log['url'],
'user_agent' => $log['userAgent'] ?: null,
'timestamp' => $log['timestamp'] ?: now()->toIso8601String(),
]
Expand All @@ -133,8 +133,8 @@ private function registerRoutes(): void

return response()->json(['status' => 'logged']);
})
->name('boost.browser-logs')
->withoutMiddleware(VerifyCsrfToken::class);
->name('boost.browser-logs')
->withoutMiddleware(VerifyCsrfToken::class);
}

/**
Expand Down Expand Up @@ -174,13 +174,13 @@ protected function registerBrowserLogger(): void
}

/**
* Register a Blade directive for the browser logger script
* Register a Blade directive for the browser logger script.
*
* @param BladeCompiler $bladeCompiler
*/
protected function registerBladeDirectives(BladeCompiler $bladeCompiler): void
{
$bladeCompiler->directive('boostJs', fn() => '<?php echo \\Laravel\\Boost\\Services\\BrowserLogger::getScript(); ?>');
$bladeCompiler->directive('boostJs', fn () => '<?php echo \\Laravel\\Boost\\Services\\BrowserLogger::getScript(); ?>');
}

private function mapJsTypeToPsr3Level(string $type): string
Expand All @@ -198,7 +198,7 @@ private function mapJsTypeToPsr3Level(string $type): string

private function hookIntoResponses(Router $router): void
{
if (config('boost.browser_logs', true) === false) {
if (! config('boost.browser_logs_watcher', true)) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Concerns/MakesHttpRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function get(string $url): Response
}

/**
* @param array<string, mixed> $json
* @param array<string, mixed> $json
*/
public function json(string $url, array $json): Response
{
Expand Down
4 changes: 2 additions & 2 deletions src/Contracts/Ide.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ interface Ide
// Things to note: supports relative (absolute path required)? global mcp only? Prefer local file, but if global only we have to add the project name to the server name

/**
* @param array<int, string> $args
* @param array<string, string> $env
* @param array<int, string> $args
* @param array<string, string> $env
*/
public function installMcp(string $key, string $command, array $args = [], array $env = []): bool;
}
4 changes: 2 additions & 2 deletions src/Install/Agents/FileMcpIde.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public function mcpPath(): string
}

/**
* @param array<int, string> $args
* @param array<string, string> $env
* @param array<int, string> $args
* @param array<string, string> $env
*/
public function installMcp(string $key, string $command, array $args = [], array $env = []): bool
{
Expand Down
4 changes: 2 additions & 2 deletions src/Install/Agents/ShellMcpIde.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ abstract class ShellMcpIde implements Ide
protected string $shellCommand = 'echo "{command} {args} {env}"';

/**
* @param array<int, string> $args
* @param array<string, string> $env
* @param array<int, string> $args
* @param array<string, string> $env
*/
public function installMcp(string $key, string $command, array $args = [], array $env = []): bool
{
Expand Down
8 changes: 4 additions & 4 deletions src/Install/ApplicationDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function detectInProject(string $basePath): array
/**
* Check if an application is installed based on its configuration.
*
* @param array<string, string|array<string>> $config
* @param array<string, string|array<string>> $config
*/
protected function isAppInstalled(array $config, string $platform): bool
{
Expand Down Expand Up @@ -219,7 +219,7 @@ protected function isAppInstalled(array $config, string $platform): bool
/**
* Check if an application is used in the current project.
*
* @param array<string, string|array<string>> $config
* @param array<string, string|array<string>> $config
*/
protected function isAppUsedInProject(array $config, string $basePath): bool
{
Expand Down Expand Up @@ -297,7 +297,7 @@ protected function getPlatform(): string
/**
* Add custom detection configuration for an application.
*
* @param array<string, array<string, string|array<string>>> $config
* @param array<string, array<string, string|array<string>>> $config
*/
public function addDetectionConfig(string $app, array $config, ?string $platform = null): void
{
Expand All @@ -314,7 +314,7 @@ public function addDetectionConfig(string $app, array $config, ?string $platform
/**
* Add custom project detection configuration for an application.
*
* @param array<string, string|array<string>> $config
* @param array<string, string|array<string>> $config
*/
public function addProjectDetectionConfig(string $app, array $config): void
{
Expand Down
4 changes: 2 additions & 2 deletions src/Install/Cli/DisplayHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class DisplayHelper
{
/**
* @param array<int, array<int|string, mixed>> $data
* @param array<int, array<int|string, mixed>> $data
*/
public static function datatable(array $data, int $cols = 80): void
{
Expand Down Expand Up @@ -96,7 +96,7 @@ public static function datatable(array $data, int $cols = 80): void
}

/**
* @param array<int, string> $items
* @param array<int, string> $items
*/
public static function grid(array $items, int $cols = 80): void
{
Expand Down
8 changes: 4 additions & 4 deletions src/Mcp/ToolExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct()
/**
* Execute a tool with the given arguments.
*
* @param array<string, mixed> $arguments
* @param array<string, mixed> $arguments
*/
public function execute(string $toolClass, array $arguments = []): ToolResult
{
Expand All @@ -37,7 +37,7 @@ public function execute(string $toolClass, array $arguments = []): ToolResult
/**
* Execute tool in a separate process for isolation.
*
* @param array<string, mixed> $arguments
* @param array<string, mixed> $arguments
*/
protected function executeInProcess(string $toolClass, array $arguments): ToolResult
{
Expand Down Expand Up @@ -80,7 +80,7 @@ protected function executeInProcess(string $toolClass, array $arguments): ToolRe
/**
* Execute tool inline (current process).
*
* @param array<string, mixed> $arguments
* @param array<string, mixed> $arguments
*/
protected function executeInline(string $toolClass, array $arguments): ToolResult
{
Expand Down Expand Up @@ -117,7 +117,7 @@ protected function getTimeout(): int
/**
* Reconstruct a ToolResult from JSON data.
*
* @param array<string, mixed> $data
* @param array<string, mixed> $data
*/
protected function reconstructToolResult(array $data): ToolResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mcp/Tools/ApplicationInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string> $arguments
* @param array<string> $arguments
*/
public function handle(array $arguments): ToolResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mcp/Tools/BrowserLogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string> $arguments
* @param array<string> $arguments
*/
public function handle(array $arguments): ToolResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mcp/Tools/DatabaseConnections.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string> $arguments
* @param array<string> $arguments
*/
public function handle(array $arguments): ToolResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mcp/Tools/DatabaseQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string> $arguments
* @param array<string> $arguments
*/
public function handle(array $arguments): ToolResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mcp/Tools/DatabaseSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string> $arguments
* @param array<string> $arguments
*/
public function handle(array $arguments): ToolResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mcp/Tools/GetAbsoluteUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string> $arguments
* @param array<string> $arguments
*/
public function handle(array $arguments): ToolResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mcp/Tools/GetConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string> $arguments
* @param array<string> $arguments
*/
public function handle(array $arguments): ToolResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mcp/Tools/LastError.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string> $arguments
* @param array<string> $arguments
*/
public function handle(array $arguments): ToolResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mcp/Tools/ListArtisanCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string> $arguments
* @param array<string> $arguments
*/
public function handle(array $arguments): ToolResult
{
Expand Down
4 changes: 2 additions & 2 deletions src/Mcp/Tools/ListAvailableConfigKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string> $arguments
* @param array<string> $arguments
*/
public function handle(array $arguments): ToolResult
{
Expand All @@ -39,7 +39,7 @@ public function handle(array $arguments): ToolResult
/**
* Flatten a multi-dimensional config array into dot notation keys.
*
* @param array<int|string, string|array<int|string, string>> $array
* @param array<int|string, string|array<int|string, string>> $array
* @return array<int|string, int|string>
*/
private function flattenToDotNotation(array $array, string $prefix = ''): array
Expand Down
2 changes: 1 addition & 1 deletion src/Mcp/Tools/ListAvailableEnvVars.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string> $arguments
* @param array<string> $arguments
*/
public function handle(array $arguments): ToolResult
{
Expand Down
4 changes: 2 additions & 2 deletions src/Mcp/Tools/ListRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string> $arguments
* @param array<string> $arguments
*/
public function handle(array $arguments): ToolResult
{
Expand Down Expand Up @@ -79,7 +79,7 @@ public function handle(array $arguments): ToolResult
}

/**
* @param array<string|bool> $options
* @param array<string|bool> $options
*/
private function artisan(string $command, array $options = []): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mcp/Tools/ReadLogEntries.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string> $arguments
* @param array<string> $arguments
*/
public function handle(array $arguments): ToolResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mcp/Tools/ReportFeedback.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string, string> $arguments
* @param array<string, string> $arguments
*/
public function handle(array $arguments): ToolResult|Generator
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mcp/Tools/SearchDocs.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string, mixed> $arguments
* @param array<string, mixed> $arguments
*/
public function handle(array $arguments): ToolResult|Generator
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mcp/Tools/Tinker.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function schema(ToolInputSchema $schema): ToolInputSchema
}

/**
* @param array<string|int> $arguments
* @param array<string|int> $arguments
*/
public function handle(array $arguments): ToolResult
{
Expand Down
Loading