Imporve CLI

This commit is contained in:
Louis Knight-Webb
2025-06-20 21:05:30 +01:00
parent cfcbf76fbc
commit 11327ab346
2 changed files with 28 additions and 18 deletions

View File

@@ -1,39 +1,49 @@
#!/usr/bin/env node
const { execSync } = require('child_process');
const path = require('path');
const fs = require('fs');
const { execSync } = require("child_process");
const path = require("path");
const fs = require("fs");
// Check if system is app-darwin-arm64
const platform = process.platform;
const arch = process.arch;
if (platform !== 'darwin' || arch !== 'arm64') {
console.error('❌ This package only supports macOS ARM64 (Apple Silicon) systems.');
if (platform !== "darwin" || arch !== "arm64") {
console.error(
"❌ This package only supports macOS ARM64 (Apple Silicon) systems."
);
console.error(`Current system: ${platform}-${arch}`);
process.exit(1);
}
try {
const zipPath = path.join(__dirname, '..', 'dist', 'app-darwin-arm64', 'vibe-kanban.zip');
const extractDir = path.join(__dirname, '..', 'dist', 'app-darwin-arm64');
const extractDir = path.join(__dirname, "..", "dist", "app-darwin-arm64");
const zipName = "vibe-kanban.zip";
const zipPath = path.join(extractDir, zipName);
// Check if zip file exists
if (!fs.existsSync(zipPath)) {
console.error('❌ vibe-kanban.zip not found at:', zipPath);
console.error("❌ vibe-kanban.zip not found at:", zipPath);
process.exit(1);
}
// Clean out any previous extraction (but keep the zip)
console.log("🧹 Cleaning up old files…");
fs.readdirSync(extractDir).forEach((name) => {
if (name !== zipName) {
fs.rmSync(path.join(extractDir, name), { recursive: true, force: true });
}
});
// Unzip the file
console.log('📦 Extracting vibe-kanban...');
execSync(`unzip -o "${zipPath}" -d "${extractDir}"`, { stdio: 'inherit' });
console.log("📦 Extracting vibe-kanban...");
execSync(`unzip -o "${zipPath}" -d "${extractDir}"`, { stdio: "inherit" });
// Execute the binary
const binaryPath = path.join(extractDir, 'vibe-kanban');
console.log('🚀 Launching vibe-kanban...');
execSync(`"${binaryPath}"`, { stdio: 'inherit' });
const binaryPath = path.join(extractDir, "vibe-kanban");
console.log("🚀 Launching vibe-kanban...");
execSync(`"${binaryPath}"`, { stdio: "inherit" });
} catch (error) {
console.error('❌ Error running vibe-kanban:', error.message);
console.error("❌ Error running vibe-kanban:", error.message);
process.exit(1);
}

View File

@@ -1,7 +1,7 @@
{
"name": "vibe-kanban",
"private": false,
"version": "0.0.6",
"version": "0.0.9",
"main": "index.js",
"bin": {
"my-npx-cli": "bin/cli.js"