From 6d36ae15eb7dc1b140860a099341172cf7ca51aa Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 9 Oct 2026 17:55:28 +0400 Subject: [PATCH 1/4] feat: support RoadRunner v3 - Require spiral/roadrunner-worker ^3.7 (RoadRunner v3). - Sort releases so that 3.x is newer than the calendar 2023.x-2025.x releases (they sort between 2.x and 3.x). Pre-releases now sort below their stable release. - Take the default --filter constraint from the installed spiral/roadrunner metapackage ("3.*", "2025.*", ...) and fall back to "3.*" instead of the spiral/roadrunner-worker major. - Generate the AMQP section in the v3 named-connection format. Co-Authored-By: Claude Opus 5.5 (1M context) --- composer.json | 3 +- src/Command/VersionFilterOption.php | 2 +- src/Configuration/Section/Amqp.php | 5 ++- src/Environment/RoadRunnerVersion.php | 45 +++++++++++++++++++++++++++ src/Repository/ReleasesCollection.php | 13 +++++--- src/VersionsCommand.php | 4 +-- 6 files changed, 63 insertions(+), 9 deletions(-) create mode 100644 src/Environment/RoadRunnerVersion.php diff --git a/composer.json b/composer.json index f98144a..3653dcf 100644 --- a/composer.json +++ b/composer.json @@ -31,8 +31,9 @@ "require": { "php": ">=8.1", "ext-json": "*", + "composer-runtime-api": "^2.0", "composer/semver": "^3.4", - "spiral/roadrunner-worker": "^2 || ^3", + "spiral/roadrunner-worker": "^3.7", "spiral/tokenizer": "^2.13 || ^3.15", "symfony/console": "^5.3 || ^6.0 || ^7.0 || ^8.0", "symfony/http-client": "^4.4.51 || ^5.4.49 || ^6.4.17 || ^7.2 || ^8.0", diff --git a/src/Command/VersionFilterOption.php b/src/Command/VersionFilterOption.php index d823ef1..bb7bb99 100644 --- a/src/Command/VersionFilterOption.php +++ b/src/Command/VersionFilterOption.php @@ -15,7 +15,7 @@ use Spiral\RoadRunner\Console\Repository\ReleaseInterface; use Spiral\RoadRunner\Console\Repository\ReleasesCollection; use Spiral\RoadRunner\Console\Repository\RepositoryInterface; -use Spiral\RoadRunner\Version as RoadRunnerVersion; +use Spiral\RoadRunner\Console\Environment\RoadRunnerVersion; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Style\StyleInterface; diff --git a/src/Configuration/Section/Amqp.php b/src/Configuration/Section/Amqp.php index 162b8be..64d5429 100644 --- a/src/Configuration/Section/Amqp.php +++ b/src/Configuration/Section/Amqp.php @@ -17,7 +17,10 @@ public function render(): array { return [ self::NAME => [ - 'addr' => 'amqp://guest:guest@127.0.0.1:5672/', + // Jobs pipelines refer to this connection name via `config.connection` + 'default' => [ + 'addr' => 'amqp://guest:guest@127.0.0.1:5672/', + ], ], ]; } diff --git a/src/Environment/RoadRunnerVersion.php b/src/Environment/RoadRunnerVersion.php new file mode 100644 index 0000000..a567149 --- /dev/null +++ b/src/Environment/RoadRunnerVersion.php @@ -0,0 +1,45 @@ +.…" to sort + * them after every 2.x and before every 3.x release. + */ private function comparisonVersionString(ReleaseInterface $release): string { - $stability = $release->getStability(); - $weight = Stability::toInt($stability); - - return \str_replace('-' . $stability, '.' . $weight . '.', $release->getVersion()); + return (string) \preg_replace('/^(20\d{2}\.)/', '2.$1', $release->getName()); } } diff --git a/src/VersionsCommand.php b/src/VersionsCommand.php index 7521c51..026746b 100644 --- a/src/VersionsCommand.php +++ b/src/VersionsCommand.php @@ -17,7 +17,7 @@ use Spiral\RoadRunner\Console\Command\VersionFilterOption; use Spiral\RoadRunner\Console\Repository\ReleaseInterface; use Spiral\RoadRunner\Console\Environment\Stability; -use Spiral\RoadRunner\Version; +use Spiral\RoadRunner\Console\Environment\RoadRunnerVersion; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\StyleInterface; @@ -89,7 +89,7 @@ private function compatibilityToString(ReleaseInterface $release, InputInterface $template = ' ✖ (reason: %s)'; // Validate version - if (! $release->satisfies(Version::constraint())) { + if (! $release->satisfies(RoadRunnerVersion::constraint())) { return \sprintf($template, 'incompatible version'); } From 216ca97551aa5da9df26e2409476d7b4f97aa342 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 9 Oct 2026 13:55:57 +0000 Subject: [PATCH 2/4] style(php-cs-fixer): fix coding standards --- bin/rr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/rr b/bin/rr index 73bf5b9..3b5907e 100644 --- a/bin/rr +++ b/bin/rr @@ -68,7 +68,7 @@ require RR_COMPOSER_INSTALL; $app = new Symfony\Component\Console\Application('RoadRunner CLI', Version::current()); -if (method_exists($app, 'addCommand')) { +if (\method_exists($app, 'addCommand')) { $app->addCommand(new GetBinaryCommand()); $app->addCommand(new VersionsCommand()); $app->addCommand(new DownloadProtocBinaryCommand()); From 8ecd9dfb58c730b63e0a2e166351f306eef5c010 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Sat, 10 Oct 2026 01:25:52 +0400 Subject: [PATCH 3/4] test: align tests with the RoadRunner v3 version handling The commands now take their default constraint from RoadRunnerVersion, and the new sortByVersion() orders pre-releases below their final release, so the test skipped for #58 runs again. A test pins the calendar releases between 2.x and 3.x. Assisted-By: Claude Opus 5.5 --- tests/Unit/Command/VersionFilterOptionTest.php | 4 ++-- tests/Unit/Repository/ReleasesCollectionTest.php | 12 ++++++++++-- tests/Unit/VersionsCommandTest.php | 11 ++--------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/tests/Unit/Command/VersionFilterOptionTest.php b/tests/Unit/Command/VersionFilterOptionTest.php index df174ab..1a0b115 100644 --- a/tests/Unit/Command/VersionFilterOptionTest.php +++ b/tests/Unit/Command/VersionFilterOptionTest.php @@ -5,10 +5,10 @@ namespace Spiral\RoadRunner\Console\Tests\Unit\Command; use Spiral\RoadRunner\Console\Command\VersionFilterOption; +use Spiral\RoadRunner\Console\Environment\RoadRunnerVersion; use Spiral\RoadRunner\Console\Tests\Unit\Stub\InMemoryRepository; use Spiral\RoadRunner\Console\Tests\Unit\Stub\OptionHost; use Spiral\RoadRunner\Console\Tests\Unit\Stub\Releases; -use Spiral\RoadRunner\Version; use Testo\Assert; use Testo\Expect; use Testo\Test; @@ -22,7 +22,7 @@ public function defaultsToInstalledRoadRunnerConstraint(): void $option = new VersionFilterOption($host->command); $input = $host->input(); - Assert::same($option->get($input, $host->io($input)), Version::constraint()); + Assert::same($option->get($input, $host->io($input)), RoadRunnerVersion::constraint()); } public function findReturnsMatchingReleasesNewestFirst(): void diff --git a/tests/Unit/Repository/ReleasesCollectionTest.php b/tests/Unit/Repository/ReleasesCollectionTest.php index fcccc46..cca4acb 100644 --- a/tests/Unit/Repository/ReleasesCollectionTest.php +++ b/tests/Unit/Repository/ReleasesCollectionTest.php @@ -9,7 +9,6 @@ use Spiral\RoadRunner\Console\Tests\Unit\Stub\Releases; use Testo\Assert; use Testo\Data\DataSet; -use Testo\Skip; use Testo\Test; #[Test] @@ -73,7 +72,6 @@ public function sortByVersionPutsReleaseCandidateBelowFinalRelease(): void ); } - #[Skip('Bug: sortByVersion() replaces "-beta"/"-alpha"/"-RC" with a numeric weight, so v2024.1.0-beta.1 compares as 2024.1.0.2.1 and sorts above v2024.1.0')] public function sortByVersionPutsPreReleasesBelowFinalRelease(): void { $releases = Releases::collection('v2024.1.0-alpha.1', 'v2024.1.0', 'v2024.1.0-beta.1', 'v2024.1.0-rc.1'); @@ -84,6 +82,16 @@ public function sortByVersionPutsPreReleasesBelowFinalRelease(): void ); } + public function sortByVersionPutsCalendarReleasesBetweenV2AndV3(): void + { + $releases = Releases::collection('v2025.1.15', 'v2.12.3', 'v3.0.0', 'v2023.3.0', 'v3.0.0-rc.1'); + + Assert::same( + Releases::versions($releases->sortByVersion()), + ['v3.0.0', 'v3.0.0-rc.1', 'v2025.1.15', 'v2023.3.0', 'v2.12.3'], + ); + } + public function stableKeepsOnlyStableReleases(): void { $releases = Releases::collection('v2024.1.0-rc.1', 'v2024.1.0', 'v2024.1.0-beta.1'); diff --git a/tests/Unit/VersionsCommandTest.php b/tests/Unit/VersionsCommandTest.php index 55e52a4..ada0f33 100644 --- a/tests/Unit/VersionsCommandTest.php +++ b/tests/Unit/VersionsCommandTest.php @@ -4,15 +4,14 @@ namespace Spiral\RoadRunner\Console\Tests\Unit; +use Spiral\RoadRunner\Console\Environment\RoadRunnerVersion; use Spiral\RoadRunner\Console\Repository\ReleaseInterface; use Spiral\RoadRunner\Console\Repository\RepositoryInterface; use Spiral\RoadRunner\Console\Tests\Unit\Stub\InMemoryRepository; use Spiral\RoadRunner\Console\Tests\Unit\Stub\Releases; use Spiral\RoadRunner\Console\VersionsCommand; -use Spiral\RoadRunner\Version; use Symfony\Component\Console\Tester\CommandTester; use Testo\Assert; -use Testo\Core\Exception\SkipTest; use Testo\Test; #[Test] @@ -59,10 +58,6 @@ public function explainsMissingAssembly(): void public function marksIncompatibleVersions(): void { - if (Version::constraint() === '*') { - throw new SkipTest('Every version is compatible when RoadRunner is installed from a branch'); - } - $display = self::run( ['--os' => 'linux', '--arch' => 'amd64'], Releases::release('v1.9.0', ['roadrunner-1.9.0-linux-amd64.tar.gz']), @@ -91,9 +86,7 @@ public function filtersByStabilityAndVersion(): void */ private static function compatibleMajor(): string { - $constraint = Version::constraint(); - - return $constraint === '*' ? '2024' : \substr($constraint, 0, -2); + return \substr(RoadRunnerVersion::constraint(), 0, -2); } /** From 71a84a00ea7d093cb8074853672f3e0a6c600b2b Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Sat, 10 Oct 2026 16:30:08 +0400 Subject: [PATCH 4/4] feat: rename the package to roadrunner/cli build: depend on roadrunner/worker chore: polish composer.json metadata The package replaces spiral/roadrunner-cli with self.version, so packages that still require spiral/roadrunner-cli are satisfied by roadrunner/cli and both names never get installed together. Namespaces stay unchanged. Assisted-By: Claude Opus 5.5 --- .github/.release-please-config.json | 2 +- README.md | 10 +++++----- composer.json | 28 +++++++++++++++++++-------- src/Environment/RoadRunnerVersion.php | 2 +- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/.release-please-config.json b/.github/.release-please-config.json index d691f2b..cdc91c9 100644 --- a/.github/.release-please-config.json +++ b/.github/.release-please-config.json @@ -3,7 +3,7 @@ "release-type": "php", "packages": { ".": { - "package-name": "spiral/roadrunner-cli", + "package-name": "roadrunner/cli", "changelog-path": "/CHANGELOG.md" } }, diff --git a/README.md b/README.md index 3f2f1b2..855c5a5 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,13 @@ This package provides the `rr` console command for PHP projects that run on [Roa ### Installation ```bash -composer require spiral/roadrunner-cli +composer require roadrunner/cli ``` -[![PHP](https://img.shields.io/packagist/php-v/spiral/roadrunner-cli.svg?style=flat-square&logo=php)](https://packagist.org/packages/spiral/roadrunner-cli) -[![Latest Version on Packagist](https://img.shields.io/packagist/v/spiral/roadrunner-cli.svg?style=flat-square&logo=packagist)](https://packagist.org/packages/spiral/roadrunner-cli) -[![License](https://img.shields.io/packagist/l/spiral/roadrunner-cli.svg?style=flat-square)](LICENSE) -[![Total Downloads](https://img.shields.io/packagist/dt/spiral/roadrunner-cli.svg?style=flat-square)](https://packagist.org/packages/spiral/roadrunner-cli/stats) +[![PHP](https://img.shields.io/packagist/php-v/roadrunner/cli.svg?style=flat-square&logo=php)](https://packagist.org/packages/roadrunner/cli) +[![Latest Version on Packagist](https://img.shields.io/packagist/v/roadrunner/cli.svg?style=flat-square&logo=packagist)](https://packagist.org/packages/roadrunner/cli) +[![License](https://img.shields.io/packagist/l/roadrunner/cli.svg?style=flat-square)](LICENSE) +[![Total Downloads](https://img.shields.io/packagist/dt/roadrunner/cli.svg?style=flat-square)](https://packagist.org/packages/roadrunner/cli/stats) ### Getting the RoadRunner binary diff --git a/composer.json b/composer.json index e56667f..e2de837 100644 --- a/composer.json +++ b/composer.json @@ -1,25 +1,34 @@ { - "name": "spiral/roadrunner-cli", + "name": "roadrunner/cli", "type": "library", - "description": "RoadRunner: Command Line Interface", + "description": "RoadRunner command-line tool: downloads the RoadRunner binary and generates its configuration", + "keywords": [ + "roadrunner", + "cli", + "console", + "installer", + "binary", + "download" + ], "license": "MIT", "authors": [ { - "name": "Anton Titov (wolfy-j)", - "email": "wolfy-j@spiralscout.com" + "name": "Anton Titov", + "homepage": "https://github.com/wolfy-j" }, { "name": "RoadRunner Community", - "homepage": "https://github.com/spiral/roadrunner/graphs/contributors" + "homepage": "https://github.com/roadrunner-server/roadrunner/graphs/contributors" } ], "bin": [ "bin/rr" ], - "homepage": "https://roadrunner.dev", + "homepage": "https://roadrunner.dev/", "support": { - "docs": "https://docs.roadrunner.dev", + "docs": "https://docs.roadrunner.dev/docs/general/install", "issues": "https://github.com/roadrunner-server/roadrunner/issues", + "source": "https://github.com/roadrunner-php/cli", "chat": "https://discord.gg/V6EK4he" }, "funding": [ @@ -33,7 +42,7 @@ "ext-json": "*", "composer-runtime-api": "^2.0", "composer/semver": "^3.4", - "spiral/roadrunner-worker": "^3.7", + "roadrunner/worker": "^3.8", "spiral/tokenizer": "^2.13 || ^3.15", "symfony/console": "^5.3 || ^6.0 || ^7.0 || ^8.0", "symfony/http-client": "^4.4.51 || ^5.4.49 || ^6.4.17 || ^7.2 || ^8.0", @@ -46,6 +55,9 @@ "testo/testo": "^0.10.55", "vimeo/psalm": "^6 || ^7" }, + "replace": { + "spiral/roadrunner-cli": "self.version" + }, "autoload": { "psr-4": { "Spiral\\RoadRunner\\Console\\": "src" diff --git a/src/Environment/RoadRunnerVersion.php b/src/Environment/RoadRunnerVersion.php index a567149..4a3eb46 100644 --- a/src/Environment/RoadRunnerVersion.php +++ b/src/Environment/RoadRunnerVersion.php @@ -27,7 +27,7 @@ final class RoadRunnerVersion * spiral/roadrunner metapackage, e.g. "3.*" or "2025.*". * * Not delegated to {@see \Spiral\RoadRunner\Version::constraint()}: without the metapackage - * it falls back to the spiral/roadrunner-worker version, whose major is unrelated to the binary's. + * it falls back to the roadrunner/worker version, whose major is unrelated to the binary's. */ public static function constraint(): string {