@lopatin You’d be better off hooking into Artisan events and throwing an error if someone tries to run unwanted commands in production, rather than creating commands that call commands:
public function handle(CommandStarting $event): void
{
if ($this->app->environment('production')) {
$disabledCommands = [
'artisan:fresh',
];
if (in_array($event->command, $disabledCommands)) {
throw new RuntimeException(
message: sprintf('Cannot run command [%s] in production.', $command),
);
}
}
}