make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); use App\Services\Freenode\Pipeline; try { $action = $argv[1] ?? 'status'; $store = Pipeline::store(); $result = match ($action) { 'prepare' => Pipeline::prepare(), 'publish' => $store->publishPrepared(), 'rollback' => $store->activate($argv[2] ?? ($store->previous()['id'] ?? 'missing')), 'status' => ['engine' => config('freenode.engine'), 'current' => $store->current(), 'previous' => $store->previous()], default => throw new RuntimeException('unknown_action'), }; if (isset($result['files'])) $result['files'] = count($result['files']); echo json_encode($result, JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR)."\n"; } catch (Throwable $e) { // Do not print native-core output, node configurations or traces. fwrite(STDERR, 'Freenode operation failed: '.get_class($e).' '.substr($e->getMessage(), 0, 160)."\n"); exit(1); }