From 8a8ad2e47bca8c026abc833a179ece96fe45d603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Say=C3=A3o=20Lobato=20Abreu?= Date: Tue, 28 Apr 2026 19:11:40 -0300 Subject: [PATCH 1/3] fix: suppress logo for raw changelog output commands --- CHANGELOG.md | 8 +++--- src/Console/DevTools.php | 52 ++++++++++++++++++++++++++++++---- tests/Console/DevToolsTest.php | 45 +++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6b180812..39e012c56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,15 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -### Fixed - -- Show the DevTools ASCII logo by default on all top-level command executions, while adding a `--no-logo` global option and automatically suppressing the banner for `--json` / `--pretty-json` invocations (including automatic forwarding of `--no-logo` to internal DevTools subprocesses) to avoid banner repetition in orchestrated command queues (#277) - ### Added - Add a configurable DevTools generated artifact workspace through `--workspace-dir` and `FAST_FORWARD_WORKSPACE_DIR`, keeping explicit output/cache command options authoritative (#274) - Add a standalone DevTools `self-update` command plus global `--working-dir` and `--auto-update` binary options for local or global installations (#272) +### Fixed + +- Show the DevTools ASCII logo by default on all top-level command executions, while adding a `--no-logo` global option and automatically suppressing the banner for `--json` / `--pretty-json` invocations (including automatic forwarding of `--no-logo` to internal DevTools subprocesses) to avoid banner repetition in orchestrated command queues (#277) + ## [1.23.0] - 2026-04-26 ### Added diff --git a/src/Console/DevTools.php b/src/Console/DevTools.php index 607e10265..c34ac35b5 100644 --- a/src/Console/DevTools.php +++ b/src/Console/DevTools.php @@ -57,6 +57,16 @@ final class DevTools extends Application LOGO; + /** + * Commands that require raw output and therefore must not render the logo. + * + * @var list + */ + private const array RAW_OUTPUT_COMMANDS = [ + 'changelog:next-version', + 'changelog:show', + ]; + /** * @var ContainerInterface holds the static container instance for global access within the DevTools context */ @@ -139,11 +149,7 @@ protected function getDefaultInputDefinition(): InputDefinition #[Override] public function doRun(InputInterface $input, OutputInterface $output): int { - $noLogo = (bool) $input->getParameterOption('--no-logo', null, true) - || (bool) $input->hasParameterOption('--json', true) - || (bool) $input->hasParameterOption('--pretty-json', true); - - if (! $noLogo) { + if ($this->shouldRenderLogo($input)) { $output->writeln(self::LOGO); } @@ -156,7 +162,7 @@ public function doRun(InputInterface $input, OutputInterface $output): int return Command::FAILURE; } - if (! $noLogo && ! $this->isSelfUpdateCommand($input)) { + if ($this->shouldRenderLogo($input) && ! $this->isSelfUpdateCommand($input)) { $this->runAutoUpdateWhenRequested($input, $output); $this->versionCheckNotifier->notify($output); } @@ -243,6 +249,40 @@ private function runAutoUpdateWhenRequested(InputInterface $input, OutputInterfa } } + /** + * Determines whether the startup logo should be rendered for this invocation. + * + * @param InputInterface $input the application input + */ + private function shouldRenderLogo(InputInterface $input): bool + { + if ((bool) $input->getParameterOption('--no-logo', null, true)) { + return false; + } + + if ((bool) $input->hasParameterOption('--json', true) || (bool) $input->hasParameterOption('--pretty-json', true)) { + return false; + } + + return ! $this->isRawOutputCommand($input); + } + + /** + * Checks whether the current command is designed for raw output mode. + * + * @param InputInterface $input the application input + */ + private function isRawOutputCommand(InputInterface $input): bool + { + $commandName = $input->getFirstArgument(); + + if (! is_string($commandName)) { + return false; + } + + return \in_array($commandName, self::RAW_OUTPUT_COMMANDS, true); + } + /** * Detects whether the current invocation targets the self-update command. * diff --git a/tests/Console/DevToolsTest.php b/tests/Console/DevToolsTest.php index e649b9e9d..84651552c 100644 --- a/tests/Console/DevToolsTest.php +++ b/tests/Console/DevToolsTest.php @@ -49,6 +49,7 @@ use Override; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestWith; use PHPUnit\Framework\Attributes\UsesClass; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; @@ -362,6 +363,50 @@ protected function configure(): void self::assertStringNotContainsString('_____', $output->fetch()); } + /** + * @return void + */ + #[Test] + #[TestWith(['changelog:show'])] + #[TestWith(['changelog:next-version'])] + public function doRunWillNotRenderLogoWhenRawOutputCommandIsRequested(string $commandName): void + { + $command = new class extends Command { + public function __construct() + { + parent::__construct('placeholder'); + $this->setCode(static fn(InputInterface $input, OutputInterface $output): int => Command::SUCCESS); + } + }; + + $command->setName($commandName); + + $this->commandLoader->has($commandName) + ->willReturn(true) + ->shouldBeCalledOnce(); + $this->commandLoader->get($commandName) + ->willReturn($command) + ->shouldBeCalledOnce(); + + $input = new ArrayInput([ + 'command' => $commandName, + ]); + + $output = new BufferedOutput(); + + $this->environment->get('FAST_FORWARD_AUTO_UPDATE', '') + ->willReturn(''); + $this->workingDirectorySwitcher->switchTo(null) + ->shouldBeCalledOnce(); + $this->versionCheckNotifier->notify($output) + ->shouldNotBeCalled(); + + $result = $this->invokeDoRun($input, $output); + + self::assertSame(Command::SUCCESS, $result); + self::assertStringNotContainsString('_____', $output->fetch()); + } + /** * @return void */ From e9302212e2a5771a58773e8b530f29976b80c3bf Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 28 Apr 2026 22:15:04 +0000 Subject: [PATCH 2/3] Update wiki submodule pointer for PR #280 --- .github/wiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/wiki b/.github/wiki index 4782e8591..7a7e28507 160000 --- a/.github/wiki +++ b/.github/wiki @@ -1 +1 @@ -Subproject commit 4782e85916e367116b8278df8be71c784a2785f5 +Subproject commit 7a7e28507f30615ee494efde03393924b6dfb04a From 406691eb92c519039081a5ebb42fc6b841ff9c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Say=C3=A3o=20Lobato=20Abreu?= Date: Tue, 28 Apr 2026 19:19:06 -0300 Subject: [PATCH 3/3] fix: update changelog to reflect logo suppression for raw output commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Felipe Sayão Lobato Abreu --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39e012c56..7fcd5d78b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,10 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add a configurable DevTools generated artifact workspace through `--workspace-dir` and `FAST_FORWARD_WORKSPACE_DIR`, keeping explicit output/cache command options authoritative (#274) - Add a standalone DevTools `self-update` command plus global `--working-dir` and `--auto-update` binary options for local or global installations (#272) +- Show the DevTools ASCII logo by default on all top-level command executions, while adding a `--no-logo` global option and automatically suppressing the banner for `--json` / `--pretty-json` invocations (including automatic forwarding of `--no-logo` to internal DevTools subprocesses) to avoid banner repetition in orchestrated command queues (#277) ### Fixed -- Show the DevTools ASCII logo by default on all top-level command executions, while adding a `--no-logo` global option and automatically suppressing the banner for `--json` / `--pretty-json` invocations (including automatic forwarding of `--no-logo` to internal DevTools subprocesses) to avoid banner repetition in orchestrated command queues (#277) +- Prevent DevTools from breaking changelog workflows by keeping raw output clean for `changelog:show` and `changelog:next-version` (suppressing the startup ASCII logo when these commands run without explicit `--json`/`--pretty-json`) (#280) ## [1.23.0] - 2026-04-26