agentify-client
Version:
Secure connection client for exposing local REST APIs, self-hosted LLMs, and development sites to the web instantly
57 lines (48 loc) • 1.69 kB
JavaScript
const fs = require('fs');
const path = require('path');
const os = require('os');
const platform = os.platform();
const arch = os.arch();
console.log(`Detecting system: ${platform} ${arch}`);
// Map platform and arch to binary path
const binaryMap = {
'darwin': {
'arm64': 'downloads/macos/arm64/agentify-macos-arm64',
'x64': 'downloads/macos/intel/agentify-macos-intel'
},
'linux': {
'x64': 'downloads/linux/x64/agentify-linux-x64'
},
'win32': {
'x64': 'downloads/windows/agentify-link.exe'
}
};
const binaryPath = binaryMap[platform]?.[arch];
if (!binaryPath) {
console.error(`❌ Unsupported platform: ${platform} ${arch}`);
console.error('Please visit https://agentifyops.com for manual installation instructions.');
process.exit(1);
}
const sourcePath = path.join(__dirname, '..', binaryPath);
const targetDir = path.join(__dirname, '..', 'bin');
const targetName = platform === 'win32' ? 'agentify.exe' : 'agentify';
const targetPath = path.join(targetDir, targetName);
try {
// Ensure bin directory exists
if (!fs.existsSync(targetDir)) {
fs.mkdirSync(targetDir, { recursive: true });
}
// Check if source binary exists
if (!fs.existsSync(sourcePath)) {
throw new Error(`Binary not found at ${sourcePath}`);
}
// Copy binary to bin directory
fs.copyFileSync(sourcePath, targetPath);
fs.chmodSync(targetPath, '755');
console.log(`✅ Successfully installed agentify binary for ${platform} ${arch}`);
} catch (error) {
console.error(`❌ Installation failed: ${error.message}`);
console.error('Please visit https://agentifyops.com for manual installation instructions.');
process.exit(1);
}