@atlashub/smartstack-cli 4.63.0 → 4.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -127451,6 +127451,23 @@ function getInstallCmd(pm, info) {
127451
127451
  if (!pm) return void 0;
127452
127452
  return info[pm];
127453
127453
  }
127454
+ function resolvePodmanCmd() {
127455
+ try {
127456
+ (0, import_child_process8.execSync)("podman --version", { encoding: "utf-8", timeout: 5e3, stdio: "pipe" });
127457
+ return "podman";
127458
+ } catch {
127459
+ }
127460
+ if (process.platform === "win32") {
127461
+ const knownPaths = [
127462
+ "C:\\Program Files\\RedHat\\Podman\\podman.exe",
127463
+ (0, import_path13.join)(process.env.LOCALAPPDATA || "", "RedHat", "Podman", "podman.exe")
127464
+ ];
127465
+ for (const p of knownPaths) {
127466
+ if (require("fs").existsSync(p)) return `"${p}"`;
127467
+ }
127468
+ }
127469
+ return "podman";
127470
+ }
127454
127471
  function getContainerEngineStatus() {
127455
127472
  try {
127456
127473
  const dockerVer = (0, import_child_process8.execSync)("docker --version", { encoding: "utf-8", timeout: 5e3, stdio: "pipe" }).trim();
@@ -127466,8 +127483,17 @@ function getContainerEngineStatus() {
127466
127483
  } catch {
127467
127484
  }
127468
127485
  try {
127469
- const podmanVer = (0, import_child_process8.execSync)("podman --version", { encoding: "utf-8", timeout: 5e3, stdio: "pipe" }).trim();
127470
- return { name: "Podman", version: podmanVer.replace("podman version ", ""), running: true };
127486
+ const podmanCmd = resolvePodmanCmd();
127487
+ const podmanVer = (0, import_child_process8.execSync)(`${podmanCmd} --version`, { encoding: "utf-8", timeout: 5e3, stdio: "pipe" }).trim();
127488
+ const podmanRunning = (() => {
127489
+ try {
127490
+ (0, import_child_process8.execSync)(`${podmanCmd} info`, { encoding: "utf-8", timeout: 1e4, stdio: "pipe" });
127491
+ return true;
127492
+ } catch {
127493
+ return false;
127494
+ }
127495
+ })();
127496
+ return { name: "Podman", version: podmanVer.replace("podman version ", ""), running: podmanRunning };
127471
127497
  } catch {
127472
127498
  }
127473
127499
  return null;
@@ -127634,18 +127660,12 @@ var doctorCommand = new Command("doctor").description("Run diagnostics and check
127634
127660
  message: `${containerEngine.name} ${containerEngine.version}`
127635
127661
  });
127636
127662
  } else if (containerEngine && !containerEngine.running) {
127663
+ const isPodman = containerEngine.name === "Podman";
127637
127664
  diagnostics.push({
127638
127665
  name: "Container Engine",
127639
127666
  status: "warning",
127640
- message: `${containerEngine.name} installed but daemon not running`,
127641
- fix: "Start Docker Desktop, or install Podman (daemonless)",
127642
- installCmd: getInstallCmd(pm, {
127643
- winget: "winget install -e --id RedHat.Podman",
127644
- brew: "brew install podman",
127645
- apt: "sudo apt install -y podman",
127646
- dnf: "sudo dnf install -y podman",
127647
- pacman: "sudo pacman -S --noconfirm podman"
127648
- })
127667
+ message: `${containerEngine.name} installed but ${isPodman ? "machine" : "daemon"} not running`,
127668
+ fix: isPodman ? "Run: podman machine init && podman machine start" : "Start Docker Desktop, or run: podman machine init && podman machine start"
127649
127669
  });
127650
127670
  } else {
127651
127671
  diagnostics.push({
@@ -127679,7 +127699,8 @@ var doctorCommand = new Command("doctor").description("Run diagnostics and check
127679
127699
  status: server.installed ? "ok" : "error",
127680
127700
  message: server.installed ? "Available" : "Not installed",
127681
127701
  details: server.description,
127682
- fix: !server.installed ? server.installCommand : void 0
127702
+ fix: !server.installed ? server.installCommand : void 0,
127703
+ installCmd: !server.installed ? server.installCommand : void 0
127683
127704
  });
127684
127705
  }
127685
127706
  } else {
@@ -127826,8 +127847,17 @@ ${source_default.gray(item.details)}`;
127826
127847
  (0, import_child_process8.execSync)(item.installCmd, { encoding: "utf-8", stdio: "inherit", timeout: 3e5 });
127827
127848
  console.log(` ${source_default.green("\u2713")} ${item.name} installed`);
127828
127849
  fixed++;
127829
- } catch {
127830
- console.log(` ${source_default.red("\u2717")} ${item.name} install failed \u2014 try manually: ${source_default.cyan(item.installCmd)}`);
127850
+ } catch (err) {
127851
+ const stderr = err.stderr || "";
127852
+ const stdout = err.stdout || "";
127853
+ const output = stderr + stdout;
127854
+ const alreadyInstalled = /already installed|déjà.*install|no applicable update|introuvable/i.test(output);
127855
+ if (alreadyInstalled) {
127856
+ console.log(` ${source_default.green("\u2713")} ${item.name} already installed (restart terminal if not detected)`);
127857
+ fixed++;
127858
+ } else {
127859
+ console.log(` ${source_default.red("\u2717")} ${item.name} install failed \u2014 try manually: ${source_default.cyan(item.installCmd)}`);
127860
+ }
127831
127861
  }
127832
127862
  console.log();
127833
127863
  }
@@ -130101,29 +130131,60 @@ tmuxCommand.command("status").description("Show WSL development environment stat
130101
130131
  var import_child_process12 = require("child_process");
130102
130132
  var import_path18 = require("path");
130103
130133
  var import_fs_extra16 = __toESM(require_lib());
130134
+ function resolveEngineCmd(name) {
130135
+ try {
130136
+ const result = (0, import_child_process12.spawnSync)(name, ["--version"], {
130137
+ encoding: "utf-8",
130138
+ shell: true,
130139
+ timeout: 5e3,
130140
+ stdio: "pipe"
130141
+ });
130142
+ if (result.status === 0) return name;
130143
+ } catch {
130144
+ }
130145
+ if (process.platform === "win32" && name === "podman") {
130146
+ const knownPaths = [
130147
+ "C:\\Program Files\\RedHat\\Podman\\podman.exe",
130148
+ (0, import_path18.join)(process.env.LOCALAPPDATA || "", "RedHat", "Podman", "podman.exe")
130149
+ ];
130150
+ for (const p of knownPaths) {
130151
+ if (import_fs_extra16.default.existsSync(p)) {
130152
+ try {
130153
+ const result = (0, import_child_process12.spawnSync)(`"${p}"`, ["--version"], {
130154
+ encoding: "utf-8",
130155
+ shell: true,
130156
+ timeout: 5e3,
130157
+ stdio: "pipe"
130158
+ });
130159
+ if (result.status === 0) return `"${p}"`;
130160
+ } catch {
130161
+ }
130162
+ }
130163
+ }
130164
+ }
130165
+ return name;
130166
+ }
130104
130167
  function checkEngine(name) {
130168
+ const cmd = resolveEngineCmd(name);
130105
130169
  try {
130106
- const version2 = (0, import_child_process12.spawnSync)(name, ["--version"], {
130170
+ const version2 = (0, import_child_process12.spawnSync)(cmd, ["--version"], {
130107
130171
  encoding: "utf-8",
130108
130172
  shell: true,
130109
130173
  timeout: 5e3,
130110
130174
  stdio: "pipe"
130111
130175
  });
130112
130176
  if (version2.status !== 0) {
130113
- return { name, installed: false, running: false };
130114
- }
130115
- if (name === "podman") {
130116
- return { name, installed: true, running: true };
130177
+ return { name, installed: false, running: false, cmd };
130117
130178
  }
130118
- const info = (0, import_child_process12.spawnSync)(name, ["info"], {
130179
+ const info = (0, import_child_process12.spawnSync)(cmd, ["info"], {
130119
130180
  encoding: "utf-8",
130120
130181
  shell: true,
130121
130182
  timeout: 1e4,
130122
130183
  stdio: "pipe"
130123
130184
  });
130124
- return { name, installed: true, running: info.status === 0 };
130185
+ return { name, installed: true, running: info.status === 0, cmd };
130125
130186
  } catch {
130126
- return { name, installed: false, running: false };
130187
+ return { name, installed: false, running: false, cmd };
130127
130188
  }
130128
130189
  }
130129
130190
  function detectEngine() {
@@ -130134,11 +130195,24 @@ function detectEngine() {
130134
130195
  logger.info(`Using ${source_default.cyan("Podman")} (Docker not found or not running)`);
130135
130196
  return podman;
130136
130197
  }
130198
+ if (podman.installed && !podman.running) {
130199
+ logger.error("Podman is installed but the machine is not running.");
130200
+ console.log();
130201
+ console.log(` Initialize and start the Podman machine:`);
130202
+ console.log(` ${source_default.cyan("podman machine init")} (first time only)`);
130203
+ console.log(` ${source_default.cyan("podman machine start")}`);
130204
+ if (docker.installed) {
130205
+ console.log();
130206
+ console.log(` Or start Docker Desktop instead.`);
130207
+ }
130208
+ console.log();
130209
+ return null;
130210
+ }
130137
130211
  if (docker.installed && !docker.running) {
130138
- logger.error("Docker is installed but the daemon is not running, and Podman is not available.");
130212
+ logger.error("Docker is installed but the daemon is not running.");
130139
130213
  console.log();
130140
- console.log(` Option 1: Start Docker Desktop and wait for it to be ready`);
130141
- console.log(` Option 2: Install Podman (daemonless): ${source_default.cyan("https://podman.io/docs/installation")}`);
130214
+ console.log(` Start Docker Desktop and wait for it to be ready.`);
130215
+ console.log(` Or install Podman: ${source_default.cyan("https://podman.io/docs/installation")}`);
130142
130216
  console.log();
130143
130217
  return null;
130144
130218
  }
@@ -130174,7 +130248,7 @@ function requireComposeFile() {
130174
130248
  return composePath;
130175
130249
  }
130176
130250
  function runCompose(engine, composePath, args) {
130177
- const result = (0, import_child_process12.spawnSync)(engine.name, ["compose", "-f", composePath, ...args], {
130251
+ const result = (0, import_child_process12.spawnSync)(engine.cmd, ["compose", "-f", composePath, ...args], {
130178
130252
  encoding: "utf-8",
130179
130253
  shell: true,
130180
130254
  stdio: "inherit",