From 34935036021f4be1aa9ea3489137e645c42b8bc0 Mon Sep 17 00:00:00 2001 From: Solomon Date: Thu, 9 Oct 2025 12:37:22 +0100 Subject: [PATCH] Reduce npx platform-specific unzip issues (#973) --- npx-cli/bin/cli.js | 22 +++++++++++++++++----- npx-cli/package.json | 3 +++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/npx-cli/bin/cli.js b/npx-cli/bin/cli.js index 7d919fcb..1d3125de 100755 --- a/npx-cli/bin/cli.js +++ b/npx-cli/bin/cli.js @@ -1,6 +1,7 @@ #!/usr/bin/env node const { execSync, spawn } = require("child_process"); +const AdmZip = require("adm-zip"); const path = require("path"); const fs = require("fs"); @@ -88,11 +89,22 @@ function extractAndRun(baseName, launch) { } // extract - const unzipCmd = - platform === "win32" - ? `powershell -Command "Expand-Archive -Path '${zipPath}' -DestinationPath '${extractDir}' -Force"` - : `unzip -qq -o "${zipPath}" -d "${extractDir}"`; - execSync(unzipCmd, { stdio: "inherit" }); + try { + const zip = new AdmZip(zipPath); + zip.extractAllTo(extractDir, true); + } catch (err) { + console.error("❌ Failed to extract vibe-kanban archive:", err.message); + if (process.env.VIBE_KANBAN_DEBUG) { + console.error(err.stack); + } + process.exit(1); + } + + if (!fs.existsSync(binPath)) { + console.error(`❌ Extracted binary not found at: ${binPath}`); + console.error("This usually indicates a corrupt download. Please reinstall the package."); + process.exit(1); + } // perms & launch if (platform !== "win32") { diff --git a/npx-cli/package.json b/npx-cli/package.json index c3982134..384de7ca 100644 --- a/npx-cli/package.json +++ b/npx-cli/package.json @@ -10,6 +10,9 @@ "author": "bloop", "license": "", "description": "NPX wrapper around vibe-kanban and vibe-kanban-mcp", + "dependencies": { + "adm-zip": "^0.5.16" + }, "files": [ "dist", "bin"