diff --git a/config/boost.php b/config/boost.php index 21eb7656..be91834c 100644 --- a/config/boost.php +++ b/config/boost.php @@ -46,6 +46,7 @@ 'composer' => env('BOOST_COMPOSER_EXECUTABLE_PATH'), 'npm' => env('BOOST_NPM_EXECUTABLE_PATH'), 'vendor_bin' => env('BOOST_VENDOR_BIN_EXECUTABLE_PATH'), + 'current_directory' => env('BOOST_CURRENT_DIRECTORY_EXECUTABLE_PATH', base_path()), ], ]; diff --git a/src/Install/Agents/Codex.php b/src/Install/Agents/Codex.php index 69795adc..7bf5b069 100644 --- a/src/Install/Agents/Codex.php +++ b/src/Install/Agents/Codex.php @@ -77,7 +77,7 @@ public function mcpServerConfig(string $command, array $args = [], array $env = return collect([ 'command' => $command, 'args' => $args, - 'cwd' => base_path(), + 'cwd' => config('boost.executable_paths.current_directory', base_path()), 'env' => $env, ])->filter(fn ($value): bool => ! in_array($value, [[], null, ''], true)) ->toArray(); diff --git a/src/Install/SkillWriter.php b/src/Install/SkillWriter.php index eaade3ea..a7fbd5c1 100644 --- a/src/Install/SkillWriter.php +++ b/src/Install/SkillWriter.php @@ -316,7 +316,7 @@ protected function directoryContainsBladeFiles(string $path): bool ); foreach ($files as $file) { - if ($file->isFile() && str_ends_with($file->getFilename(), '.blade.php')) { + if ($file->isFile() && str_ends_with((string) $file->getFilename(), '.blade.php')) { return true; } } diff --git a/tests/Unit/Install/Agents/CodexTest.php b/tests/Unit/Install/Agents/CodexTest.php index fb433a63..6aa4f9b0 100644 --- a/tests/Unit/Install/Agents/CodexTest.php +++ b/tests/Unit/Install/Agents/CodexTest.php @@ -54,7 +54,19 @@ expect($config)->toHaveKey('command', 'php') ->toHaveKey('args', ['artisan', 'boost:mcp']) - ->toHaveKey('cwd'); + ->toHaveKey('cwd', base_path()); +}); + +test('builds MCP server config with config "boost.executable_paths.current_directory" override', function (): void { + config()->set('boost.executable_paths.current_directory', '/Users/developer/projects/app'); + + $codex = new Codex($this->strategyFactory); + + $config = $codex->mcpServerConfig('php', ['artisan', 'boost:mcp']); + + expect($config)->toHaveKey('command', 'php') + ->toHaveKey('args', ['artisan', 'boost:mcp']) + ->toHaveKey('cwd', '/Users/developer/projects/app'); }); test('builds MCP server config with env when provided', function (): void {