fix(cli): preload project autoloader in bin#10
Merged
markshust merged 4 commits intomarko-php:developfrom Apr 5, 2026
Merged
Conversation
The release script and its tests referenced a macOS-specific Homebrew
PHP path. This replaces it with `${PHP_BIN:-php}` so any contributor
can override via env var or rely on their PATH.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a CLI bootstrap issue where running marko could fail with "
Error: Class "Marko\Core\Command\Output" not found.The root cause was that the bin script could construct and run CliKernel before the project's own autoloader was loaded. Since CliKernel depends on project classes from marko/core, those classes were not always available at startup. The fix updates packages/cli/bin/marko to resolve the project root first and preload the project vendor/autoload.php before booting the kernel.
The PR also updates
packages/cli/tests/BinMarkoTest.phpso the test suite reflects the new bootstrap flow, including coverage for ProjectFinder usage, conditional project autoloader loading, and the direct inline kernel execution path. The CLI package tests pass with this change.tests/IntegrationVerificationTest.php
The
tests/IntegrationVerificationTest.phpchanges were made to make the integration test portable and truly isolated.The test previously assumed a macOS-specific PHP path and also deleted the live project vendor/ directory while Pest was still running from it. That caused failures on non-macOS systems and runtime fatals like Class "Pest\Panic" not found. The fix switches to PHP_BINARY so the current interpreter is used on any OS, and runs the destructive Composer workflow in a temporary copy of the repo so the active test process is never corrupted.
packages/dev-server/tests/Command/DevDownCommandTest.php
The
packages/dev-server/tests/Command/DevDownCommandTest.phpchanges make the dev:down process-group test resilient to normal Unix process cleanup timing. The original test asserted that the process group disappeared immediately after sending the stop signal, but on Linux the terminated parent can briefly remain as a zombie until it is reaped, causing the group to still appear alive.The test was updated to proc_close() the spawned parent before the final assertion and to add a short retry loop when checking isProcessGroupRunning(). This keeps the intent of the test the same while avoiding a false failure caused by process reaping timing rather than shutdown behavior.
bin/release.sh, tests/ReleaseScriptTest.php, .claude/release-process.md
Removed the hardcoded macOS Homebrew PHP path (
/opt/homebrew/Cellar/php/8.5.1_2/bin/php) from the release script, its test, and release process docs. The release script now uses${PHP_BIN:-php}, allowing contributors to either set aPHP_BINenv var or rely onphpbeing on their PATH. The PHP 8.5+ version check still runs and will abort with a helpful message if the wrong version is found.Type of Change
Related Issues
Closes #8
Checklist
./vendor/bin/pest --parallel)./vendor/bin/phpcs)