Hello folks
I have been using Tinkerwell for a while, but it’s stopped working since upgrading Sage. All I get from the console is “ERROR Command “cli” is not defined.”
I’m using a Bedrock/Tinkerwell driver that I found on Github - which had been working fine before.
Inside application.log
I get this:
[2023-02-17 14:22:02] development.ERROR: Command "cli" is not defined. {"exception":"[object] (Symfony\\Component\\Console\\Exception\\CommandNotFoundException(code: 0): Command \"cli\" is not defined. at /home/vagrant/web/my-site/site/web/app/themes/my-theme/vendor/symfony/console/Application.php:694)
[stacktrace]
#0 /home/vagrant/web/my-site/site/web/app/themes/my-theme/vendor/symfony/console/Application.php(259): Symfony\\Component\\Console\\Application->find()
#1 /home/vagrant/web/my-site/site/web/app/themes/my-theme/vendor/symfony/console/Application.php(171): Symfony\\Component\\Console\\Application->doRun()
#2 /home/vagrant/web/my-site/site/web/app/themes/my-theme/vendor/illuminate/console/Application.php(102): Symfony\\Component\\Console\\Application->run()
#3 /home/vagrant/web/my-site/site/web/app/themes/my-theme/vendor/roots/acorn/src/Illuminate/Foundation/Console/Kernel.php(155): Illuminate\\Console\\Application->run()
#4 /home/vagrant/web/my-site/site/web/app/themes/my-theme/vendor/roots/acorn/src/Roots/Acorn/Bootloader.php(150): Illuminate\\Foundation\\Console\\Kernel->handle()
#5 /home/vagrant/web/my-site/site/web/app/themes/my-theme/vendor/roots/acorn/src/Roots/Acorn/Bootloader.php(110): Roots\\Acorn\\Bootloader->bootConsole()
#6 /home/vagrant/web/my-site/site/web/app/themes/my-theme/functions.php(33): Roots\\Acorn\\Bootloader->boot()
#7 /home/vagrant/web/my-site/site/web/wp/wp-settings.php(585): include('...')
#8 /home/vagrant/web/my-site/site/.tinkerwell/BedrockTinkerwellDriver.php(18): require('...')
#9 phar:///tmp/vagrant_tinker.phar/src/Concerns/DriverAware.php(11): BedrockTinkerwellDriver->bootstrap()
#10 phar:///tmp/vagrant_tinker.phar/src/Actions/CliAction.php(27): _PhpScoperc223a629f245\\Tinkerwell\\Actions\\CliAction->detectDriver()
#11 phar:///tmp/vagrant_tinker.phar/src/ActionInvoker.php(37): _PhpScoperc223a629f245\\Tinkerwell\\Actions\\CliAction->__construct()
#12 phar:///tmp/vagrant_tinker.phar/src/ActionInvoker.php(18): _PhpScoperc223a629f245\\Tinkerwell\\ActionInvoker->setUpAction()
#13 phar:///tmp/vagrant_tinker.phar/index.php(25): _PhpScoperc223a629f245\\Tinkerwell\\ActionInvoker->execute()
#14 /tmp/vagrant_tinker.phar(12): require('...')
#15 {main}
"}
Looking at the Roots Bootloader, it seems that inside boot()
we have
if ($app->runningInConsole()) {
$this->enableHttpsInConsole();
return class_exists('WP_CLI') ? $this->bootWpCli($app) : $this->bootConsole($app);
}
It seems that Tinkerwell is detected as a console as that conditional passes.
Within that if
statement, class_exists('WP_CLI')
returns false, so bootConsole()
is run. But it’s at that point it looks to me that it might be interfering with Tinkerwell by trying to boot a Symfony Console and accepting arguments.
protected function bootConsole(ApplicationContract $app)
{
$kernel = $app->make(\Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new \Symfony\Component\Console\Input\ArgvInput(),
new \Symfony\Component\Console\Output\ConsoleOutput()
);
$kernel->terminate($input, $status);
exit($status);
}
If I block this method from running, Tinkerwell works.
Is there a way to do this programmatically/in a more permanent way?
Thanks in advance!