From ff3e4e323aae21829c84cf41dbc5afa6fd837ff0 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Fri, 22 May 2026 03:18:17 +0000 Subject: [PATCH] fix(cli): support global Composer installs for bin/moko Check $GLOBALS['_composer_autoload_path'] before falling back to project-local vendor/autoload.php, allowing the CLI to work when installed via composer global require. Co-Authored-By: Claude Opus 4.6 (1M context) --- bin/moko | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/moko b/bin/moko index f0f600b..3d6701f 100644 --- a/bin/moko +++ b/bin/moko @@ -68,6 +68,11 @@ declare(strict_types=1); $repoRoot = dirname(__DIR__); $autoloader = $repoRoot . '/vendor/autoload.php'; +// Support global Composer installs (e.g. composer global require) +if (isset($GLOBALS['_composer_autoload_path'])) { + $autoloader = $GLOBALS['_composer_autoload_path']; +} + if (!is_file($autoloader)) { fwrite(STDERR, "Error: vendor/autoload.php not found.\nRun: composer install\n"); exit(2);