Skip to content
This repository was archived by the owner on Nov 30, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions app/Middleware/AnnouncesAbandonment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace App\Middleware;

use App\Middleware\Concerns\SkipsInternalCommands;
use App\Prompts\Renderer;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface;

class AnnouncesAbandonment implements CommandMiddleware
{
use SkipsInternalCommands;

public const MESSAGE = <<<'TXT'
<comment>laravel/cloud-cli is abandoned and will no longer receive updates.</comment>
Install its replacement with <info>npm install -g @laravel/cloud-cli</info> or <info>brew install laravel/tap/cloud</info>.
Your saved tokens carry over. Learn more: https://www.npmjs.com/package/@laravel/cloud-cli

TXT;

public function handle($command, callable $next)
{
// JSON errors go to stderr, so the notice would corrupt them for machine readers.
if (! $this->isInternalCommand($command) && ! Renderer::$suppressOutput) {
$this->output()->writeln(self::MESSAGE);
}

return $next();
}

protected function output(): OutputInterface
{
return (new ConsoleOutput)->getErrorOutput();
}
}
2 changes: 2 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Providers;

use App\Middleware\AnnouncesAbandonment;
use App\Middleware\CommandMiddlewareManager;
use App\Middleware\OffersSkillsInstall;
use App\Middleware\RequiresAuthToken;
Expand Down Expand Up @@ -82,6 +83,7 @@ protected function registerCommandMiddleware(): void
$manager = $this->app->make(CommandMiddlewareManager::class);

$manager->register(SuppressOutputIfJson::class);
$manager->register(AnnouncesAbandonment::class);
$manager->register(RequiresAuthToken::class);
$manager->register(OffersSkillsInstall::class);

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
],
"homepage": "https://cloud.laravel.com",
"type": "project",
"abandoned": "https://www.npmjs.com/package/@laravel/cloud-cli",
"license": "MIT",
"support": {
"issues": "https://github.com/laravel/cloud-cli/issues",
Expand Down
8 changes: 4 additions & 4 deletions skills/deploying-to-cloud/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
---
# Deploying with Laravel Cloud

Use the [Laravel Cloud documentation](https://cloud.laravel.com/docs/llms.txt) for detailed, current feature behavior. Use the Cloud CLI for Cloud operations rather than guessing dashboard or API workflows. Install it in the project and invoke it as `./vendor/bin/cloud` by default; use a globally installed `cloud` command only as a fallback. Commands below are written as `cloud` for brevity; run them as `./vendor/bin/cloud` unless falling back to the global installation.
Use the [Laravel Cloud documentation](https://cloud.laravel.com/docs/llms.txt) for detailed, current feature behavior. Use the Cloud CLI for Cloud operations rather than guessing dashboard or API workflows. Install it globally from npm and invoke it as `cloud`.

## Application Setup

Expand Down Expand Up @@ -57,11 +57,11 @@ Use the [Laravel Cloud documentation](https://cloud.laravel.com/docs/llms.txt) f
### Setup

```shell
composer require --dev laravel/cloud-cli
./vendor/bin/cloud auth -n
npm install -g @laravel/cloud-cli
cloud auth -n
```

If a project-local installation is not available, install the CLI globally with `composer global require laravel/cloud-cli` and invoke it as `cloud`.
To run a single command without installing, as in a CI job, use `npx @laravel/cloud-cli <command>`. The Composer package `laravel/cloud-cli` is abandoned; if a project still requires it, replace it with the npm package.

`cloud auth` opens a browser. If a browser is unavailable, set `LARAVEL_CLOUD_TOKEN` in the environment. It overrides any saved token and writes nothing to disk. To save a token instead, run `cloud auth:token --add --token=<token> -n` or pipe it with `echo "$TOKEN" | cloud auth:token --add -n`.

Expand Down
49 changes: 49 additions & 0 deletions tests/Feature/AnnouncesAbandonmentTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

use App\Middleware\AnnouncesAbandonment;
use App\Prompts\Renderer;
use Symfony\Component\Console\Output\BufferedOutput;

afterEach(function () {
Renderer::$suppressOutput = false;
});

function abandonmentMiddleware(BufferedOutput $output): AnnouncesAbandonment
{
$middleware = Mockery::mock(AnnouncesAbandonment::class)->makePartial();
$middleware->shouldAllowMockingProtectedMethods();
$middleware->shouldReceive('output')->andReturn($output);

return $middleware;
}

it('points users to the npm package', function () {
$output = new BufferedOutput;
$called = false;

abandonmentMiddleware($output)->handle('application:list', function () use (&$called) {
$called = true;
});

expect($called)->toBeTrue()
->and($output->fetch())
->toContain('laravel/cloud-cli is abandoned')
->toContain('npm install -g @laravel/cloud-cli');
});

it('stays quiet for internal commands', function () {
$output = new BufferedOutput;

abandonmentMiddleware($output)->handle('_complete', fn () => null);

expect($output->fetch())->toBe('');
});

it('stays quiet when output is JSON', function () {
Renderer::$suppressOutput = true;
$output = new BufferedOutput;

abandonmentMiddleware($output)->handle('application:list', fn () => null);

expect($output->fetch())->toBe('');
});