@atlashub/smartstack-cli 4.62.0 → 4.63.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
@@ -127429,6 +127429,49 @@ var import_cli_table34 = __toESM(require_cli_table3());
127429
127429
  var import_child_process8 = require("child_process");
127430
127430
  var import_fs_extra13 = __toESM(require_lib());
127431
127431
  var import_path13 = require("path");
127432
+ function detectPackageManager() {
127433
+ const tryCmd = (cmd) => {
127434
+ try {
127435
+ (0, import_child_process8.execSync)(`${cmd} --version`, { encoding: "utf-8", timeout: 5e3, stdio: "pipe" });
127436
+ return true;
127437
+ } catch {
127438
+ return false;
127439
+ }
127440
+ };
127441
+ if (process.platform === "win32" && tryCmd("winget")) return "winget";
127442
+ if (process.platform === "darwin" && tryCmd("brew")) return "brew";
127443
+ if (process.platform === "linux") {
127444
+ if (tryCmd("apt")) return "apt";
127445
+ if (tryCmd("dnf")) return "dnf";
127446
+ if (tryCmd("pacman")) return "pacman";
127447
+ }
127448
+ return null;
127449
+ }
127450
+ function getInstallCmd(pm, info) {
127451
+ if (!pm) return void 0;
127452
+ return info[pm];
127453
+ }
127454
+ function getContainerEngineStatus() {
127455
+ try {
127456
+ const dockerVer = (0, import_child_process8.execSync)("docker --version", { encoding: "utf-8", timeout: 5e3, stdio: "pipe" }).trim();
127457
+ const dockerInfo = (() => {
127458
+ try {
127459
+ (0, import_child_process8.execSync)("docker info", { encoding: "utf-8", timeout: 1e4, stdio: "pipe" });
127460
+ return true;
127461
+ } catch {
127462
+ return false;
127463
+ }
127464
+ })();
127465
+ return { name: "Docker", version: dockerVer.replace("Docker version ", "").split(",")[0], running: dockerInfo };
127466
+ } catch {
127467
+ }
127468
+ 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 };
127471
+ } catch {
127472
+ }
127473
+ return null;
127474
+ }
127432
127475
  function getNodeVersion() {
127433
127476
  return process.version;
127434
127477
  }
@@ -127468,9 +127511,10 @@ function getNpmVersion() {
127468
127511
  return null;
127469
127512
  }
127470
127513
  }
127471
- var doctorCommand = new Command("doctor").description("Run diagnostics and check SmartStack health").option("--json", "Output as JSON").option("-v, --verbose", "Show detailed information").action(async (options) => {
127514
+ var doctorCommand = new Command("doctor").description("Run diagnostics and check SmartStack health").option("--json", "Output as JSON").option("-v, --verbose", "Show detailed information").option("--fix", "Auto-install missing tools using system package manager").action(async (options) => {
127472
127515
  const diagnostics = [];
127473
127516
  const pkg2 = JSON.parse(await import_fs_extra13.default.readFile((0, import_path13.join)(__dirname, "..", "package.json"), "utf-8"));
127517
+ const pm = options.fix ? detectPackageManager() : null;
127474
127518
  if (!options.json) {
127475
127519
  console.log(source_default.cyan(`
127476
127520
  \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
@@ -127559,7 +127603,14 @@ var doctorCommand = new Command("doctor").description("Run diagnostics and check
127559
127603
  name: "Git",
127560
127604
  status: gitVersion ? "ok" : "error",
127561
127605
  message: gitVersion || "Not installed",
127562
- fix: !gitVersion ? "Install Git: https://git-scm.com/" : void 0
127606
+ fix: !gitVersion ? "Install Git: https://git-scm.com/" : void 0,
127607
+ installCmd: !gitVersion ? getInstallCmd(pm, {
127608
+ winget: "winget install -e --id Git.Git",
127609
+ brew: "brew install git",
127610
+ apt: "sudo apt install -y git",
127611
+ dnf: "sudo dnf install -y git",
127612
+ pacman: "sudo pacman -S --noconfirm git"
127613
+ }) : void 0
127563
127614
  });
127564
127615
  const dotnetVersion = getDotNetVersion();
127565
127616
  diagnostics.push({
@@ -127567,8 +127618,51 @@ var doctorCommand = new Command("doctor").description("Run diagnostics and check
127567
127618
  status: dotnetVersion ? "ok" : "warning",
127568
127619
  message: dotnetVersion || "Not installed",
127569
127620
  details: !dotnetVersion ? "Required for .NET projects" : void 0,
127570
- fix: !dotnetVersion ? "Install .NET SDK: https://dotnet.microsoft.com/" : void 0
127621
+ fix: !dotnetVersion ? "Install .NET SDK: https://dotnet.microsoft.com/" : void 0,
127622
+ installCmd: !dotnetVersion ? getInstallCmd(pm, {
127623
+ winget: "winget install -e --id Microsoft.DotNet.SDK.9",
127624
+ brew: "brew install dotnet",
127625
+ apt: "sudo apt install -y dotnet-sdk-9.0",
127626
+ dnf: "sudo dnf install -y dotnet-sdk-9.0"
127627
+ }) : void 0
127571
127628
  });
127629
+ const containerEngine = getContainerEngineStatus();
127630
+ if (containerEngine && containerEngine.running) {
127631
+ diagnostics.push({
127632
+ name: "Container Engine",
127633
+ status: "ok",
127634
+ message: `${containerEngine.name} ${containerEngine.version}`
127635
+ });
127636
+ } else if (containerEngine && !containerEngine.running) {
127637
+ diagnostics.push({
127638
+ name: "Container Engine",
127639
+ 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
+ })
127649
+ });
127650
+ } else {
127651
+ diagnostics.push({
127652
+ name: "Container Engine",
127653
+ status: "warning",
127654
+ message: "Not installed (Docker or Podman)",
127655
+ details: "Required for ss docker commands",
127656
+ fix: "Install Docker Desktop or Podman",
127657
+ installCmd: getInstallCmd(pm, {
127658
+ winget: "winget install -e --id RedHat.Podman",
127659
+ brew: "brew install podman",
127660
+ apt: "sudo apt install -y podman",
127661
+ dnf: "sudo dnf install -y podman",
127662
+ pacman: "sudo pacman -S --noconfirm podman"
127663
+ })
127664
+ });
127665
+ }
127572
127666
  const claudeInstalled = isClaudeCodeInstalled();
127573
127667
  const claudeVersion = getClaudeCodeVersion();
127574
127668
  diagnostics.push({
@@ -127701,12 +127795,48 @@ ${source_default.gray(item.details)}`;
127701
127795
  if (errorCount > 0) console.log(` ${source_default.red("\u2717")} ${errorCount} Errors`);
127702
127796
  console.log();
127703
127797
  const itemsWithFixes = diagnostics.filter((d) => d.fix && (d.status === "error" || d.status === "warning"));
127704
- if (itemsWithFixes.length > 0) {
127798
+ if (itemsWithFixes.length > 0 && !options.fix) {
127705
127799
  console.log(source_default.bold("Recommended fixes:"));
127706
127800
  for (const item of itemsWithFixes) {
127707
127801
  console.log(` ${item.name}: ${source_default.cyan(item.fix)}`);
127708
127802
  }
127709
127803
  console.log();
127804
+ const fixableCount = diagnostics.filter((d) => d.installCmd).length;
127805
+ if (fixableCount > 0) {
127806
+ console.log(source_default.gray(` Tip: Run ${source_default.cyan("ss doctor --fix")} to auto-install ${fixableCount} missing tool(s)`));
127807
+ console.log();
127808
+ }
127809
+ }
127810
+ if (options.fix) {
127811
+ const fixable = diagnostics.filter((d) => d.installCmd && (d.status === "error" || d.status === "warning"));
127812
+ if (fixable.length === 0) {
127813
+ console.log(source_default.green("Nothing to fix \u2014 all installable tools are present."));
127814
+ console.log();
127815
+ } else if (!pm) {
127816
+ logger.error("No supported package manager found (winget, brew, apt, dnf, pacman).");
127817
+ console.log(` Please install the missing tools manually.`);
127818
+ console.log();
127819
+ } else {
127820
+ console.log(source_default.bold(`Auto-fix using ${source_default.cyan(pm)}:`));
127821
+ console.log();
127822
+ let fixed = 0;
127823
+ for (const item of fixable) {
127824
+ console.log(` ${source_default.yellow("Installing")} ${item.name}: ${source_default.gray(item.installCmd)}`);
127825
+ try {
127826
+ (0, import_child_process8.execSync)(item.installCmd, { encoding: "utf-8", stdio: "inherit", timeout: 3e5 });
127827
+ console.log(` ${source_default.green("\u2713")} ${item.name} installed`);
127828
+ fixed++;
127829
+ } catch {
127830
+ console.log(` ${source_default.red("\u2717")} ${item.name} install failed \u2014 try manually: ${source_default.cyan(item.installCmd)}`);
127831
+ }
127832
+ console.log();
127833
+ }
127834
+ console.log(source_default.bold(`Fixed: ${fixed}/${fixable.length}`));
127835
+ if (fixed > 0) {
127836
+ console.log(source_default.gray(" Restart your terminal, then run ss doctor to verify."));
127837
+ }
127838
+ console.log();
127839
+ }
127710
127840
  }
127711
127841
  if (errorCount === 0) {
127712
127842
  logger.box([