diff --git a/packages/cli/package.json b/packages/cli/package.json index 8b2c002aa..a9b9e0fbc 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@openrouter/spawn", - "version": "1.0.27", + "version": "1.0.28", "type": "module", "bin": { "spawn": "cli.js" diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 0892969e7..8f09decbe 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -959,12 +959,12 @@ async function main(): Promise { // fast_provision experiment: if the user did NOT pass --beta or --fast, // bucket them on the PostHog `fast_provision` flag. The `test` variant - // turns on images by default; control behaves as before. + // turns on images + docker by default; control behaves as before. // Exposure is captured for both variants so PostHog can compute conversion. if (!userOptedIntoBeta) { const variant = getFeatureFlag("fast_provision", "control"); if (variant === "test") { - betaFeatures.push("images"); + betaFeatures.push("images", "docker"); } } diff --git a/packages/cli/src/local/local.ts b/packages/cli/src/local/local.ts index 4183bff53..bfa5d5f4e 100644 --- a/packages/cli/src/local/local.ts +++ b/packages/cli/src/local/local.ts @@ -460,7 +460,6 @@ export async function ensureDocker(): Promise { process.exit(1); } } else { - logStep("Docker not found — installing docker.io..."); const hasSudo = Bun.spawnSync( [ @@ -475,12 +474,32 @@ export async function ensureDocker(): Promise { ], }, ).exitCode === 0; - const prefix = hasSudo ? "sudo " : ""; + const hasApt = + Bun.spawnSync( + [ + "which", + "apt-get", + ], + { + stdio: [ + "ignore", + "ignore", + "ignore", + ], + }, + ).exitCode === 0; + // Prefer apt-get on Debian/Ubuntu (small, fast, distro-trusted). + // Fall back to Docker's convenience script for Fedora/Arch/Alpine/etc. + const installLabel = hasApt ? "docker.io" : "via get.docker.com"; + logStep(`Docker not found — installing ${installLabel}...`); + const installCmd = hasApt + ? `${hasSudo ? "sudo " : ""}apt-get update -qq && ${hasSudo ? "sudo " : ""}apt-get install -y -qq docker.io` + : `curl -fsSL https://get.docker.com | ${hasSudo ? "sudo sh" : "sh"}`; const result = Bun.spawnSync( [ "bash", "-c", - `${prefix}apt-get update -qq && ${prefix}apt-get install -y -qq docker.io`, + installCmd, ], { stdio: [ @@ -491,7 +510,8 @@ export async function ensureDocker(): Promise { }, ); if (result.exitCode !== 0) { - logInfo("Auto-install failed. Install Docker manually: sudo apt-get install docker.io"); + const manualHint = hasApt ? "sudo apt-get install docker.io" : "https://docs.docker.com/engine/install/"; + logInfo(`Auto-install failed. Install Docker manually: ${manualHint}`); process.exit(1); } }