@qoder-ai/qodercli
Advanced tools
+16
-12
| { | ||
| "name": "@qoder-ai/qodercli", | ||
| "version": "0.1.0", | ||
| "version": "0.1.1", | ||
| "description": "qodercli - npm installer", | ||
@@ -32,2 +32,6 @@ "private": false, | ||
| }, | ||
| "dependencies": { | ||
| "adm-zip": "^0.5.10", | ||
| "tar": "^4.4.19" | ||
| }, | ||
| "os": [ | ||
@@ -44,3 +48,3 @@ "darwin", | ||
| "binaries": { | ||
| "version": "0.1.0", | ||
| "version": "0.1.1", | ||
| "files": [ | ||
@@ -50,4 +54,4 @@ { | ||
| "arch": "amd64", | ||
| "url": "https://download.qoder.com/qodercli/releases/0.1.0/qodercli_0.1.0_linux_amd64.tar.gz", | ||
| "sha256": "9ef4c98ed6eb69fd166452bb00e854bfccce4b7287bae6ba9b86f4dd5f96ce9d" | ||
| "url": "https://download.qoder.com/qodercli/releases/0.1.1/qodercli_0.1.1_linux_amd64.tar.gz", | ||
| "sha256": "9a476f87a856e7a9530c2b91484f929c412905bacb34d61631fab535898af1d7" | ||
| }, | ||
@@ -57,4 +61,4 @@ { | ||
| "arch": "arm64", | ||
| "url": "https://download.qoder.com/qodercli/releases/0.1.0/qodercli_0.1.0_linux_arm64.tar.gz", | ||
| "sha256": "a93d6fa4e3a7aedc37dd120d03c2f1b3da7b9d57984fda40538a0387a73fa871" | ||
| "url": "https://download.qoder.com/qodercli/releases/0.1.1/qodercli_0.1.1_linux_arm64.tar.gz", | ||
| "sha256": "79067bd5fdee0234b46c096c95a884dad53961f58d32e913d11c42b314ec1fe4" | ||
| }, | ||
@@ -64,4 +68,4 @@ { | ||
| "arch": "amd64", | ||
| "url": "https://download.qoder.com/qodercli/releases/0.1.0/qodercli_0.1.0_darwin_amd64.zip", | ||
| "sha256": "4c2f974b8cd48e2c58ffb361f74c6dfea03a2066a5a0fe04c547aa935107d6b7" | ||
| "url": "https://download.qoder.com/qodercli/releases/0.1.1/qodercli_0.1.1_darwin_amd64.zip", | ||
| "sha256": "f8ca8a28a204dd57c345568c5378d19633c1c9ae1a3df981e06dd91551b0d683" | ||
| }, | ||
@@ -71,4 +75,4 @@ { | ||
| "arch": "arm64", | ||
| "url": "https://download.qoder.com/qodercli/releases/0.1.0/qodercli_0.1.0_darwin_arm64.zip", | ||
| "sha256": "61ab1ccc72fd1ab4b6432ba6eef78b7ae7823277d429ad3377b9a342696f19d4" | ||
| "url": "https://download.qoder.com/qodercli/releases/0.1.1/qodercli_0.1.1_darwin_arm64.zip", | ||
| "sha256": "22449dde853ec8d5c2d5a926b9176b9594af99d8b49c28fb3bfbbbadeba74f7f" | ||
| }, | ||
@@ -78,4 +82,4 @@ { | ||
| "arch": "amd64", | ||
| "url": "https://download.qoder.com/qodercli/releases/0.1.0/qodercli_0.1.0_windows_amd64.zip", | ||
| "sha256": "bdd8d3392c9f7f85360091d8dddeb1b94c7eae8e68870f7044b2d90d2ba4f193" | ||
| "url": "https://download.qoder.com/qodercli/releases/0.1.1/qodercli_0.1.1_windows_amd64.zip", | ||
| "sha256": "1042b02e5e2542b308edd3c0bec312b7fd4efa28805b9766de7fa2e717fdbfd4" | ||
| } | ||
@@ -82,0 +86,0 @@ ] |
+96
-25
@@ -110,3 +110,15 @@ #!/usr/bin/env node | ||
| fs.renameSync(extractedBinary[0], this.binPath); | ||
| // Try rename first (efficient), fallback to copy+delete if cross-device | ||
| try { | ||
| fs.renameSync(extractedBinary[0], this.binPath); | ||
| } catch (error) { | ||
| if (error.code === 'EXDEV') { | ||
| // Cross-device link not permitted, use copy+delete fallback | ||
| console.log('Cross-device link detected, using copy+delete method...'); | ||
| fs.copyFileSync(extractedBinary[0], this.binPath); | ||
| fs.unlinkSync(extractedBinary[0]); | ||
| } else { | ||
| throw error; | ||
| } | ||
| } | ||
@@ -139,34 +151,85 @@ // Set executable permission | ||
| if (filename.endsWith('.zip')) { | ||
| // Extract ZIP file | ||
| if (process.platform === 'win32') { | ||
| // Windows: Use PowerShell | ||
| try { | ||
| execSync(`powershell -command "Expand-Archive -Path '${archivePath}' -DestinationPath '${extractDir}' -Force"`, { | ||
| stdio: 'pipe' | ||
| }); | ||
| } catch (error) { | ||
| throw new Error(`ZIP extraction failed: ${error.message}. Please ensure PowerShell is available.`); | ||
| // Extract ZIP file using Node.js packages first | ||
| let extracted = false; | ||
| // Method 1: Use adm-zip package (preferred) | ||
| try { | ||
| const AdmZip = require('adm-zip'); | ||
| const zip = new AdmZip(archivePath); | ||
| zip.extractAllTo(extractDir, true); | ||
| extracted = true; | ||
| console.log('ZIP extracted using Node.js adm-zip package'); | ||
| } catch (error) { | ||
| console.log('adm-zip extraction failed, trying system commands...', error.message); | ||
| } | ||
| // Method 2: System command fallbacks | ||
| if (!extracted) { | ||
| if (process.platform === 'win32') { | ||
| // Windows: Try PowerShell then 7-Zip | ||
| try { | ||
| execSync(`powershell -command "Expand-Archive -Path '${archivePath}' -DestinationPath '${extractDir}' -Force"`, { | ||
| stdio: 'pipe' | ||
| }); | ||
| extracted = true; | ||
| } catch (error) { | ||
| try { | ||
| execSync(`7z x "${archivePath}" -o"${extractDir}" -y`, { | ||
| stdio: 'pipe' | ||
| }); | ||
| extracted = true; | ||
| } catch (error2) { | ||
| // Will fail below | ||
| } | ||
| } | ||
| } else { | ||
| // Unix: Use unzip command | ||
| try { | ||
| execSync(`unzip -o "${archivePath}" -d "${extractDir}"`, { | ||
| stdio: 'pipe' | ||
| }); | ||
| extracted = true; | ||
| } catch (error) { | ||
| // Will fail below | ||
| } | ||
| } | ||
| } else { | ||
| // Unix: Use unzip command | ||
| } | ||
| if (!extracted) { | ||
| const platform = process.platform === 'win32' ? 'Windows' : 'Unix'; | ||
| throw new Error(`ZIP extraction failed on ${platform}. Please ensure extraction tools are available.`); | ||
| } | ||
| } else { | ||
| // Extract tar.gz file using Node.js tar package first | ||
| let extracted = false; | ||
| // Method 1: Use tar package (preferred) | ||
| try { | ||
| const tar = require('tar'); | ||
| // tar v4.x uses different API than v6.x | ||
| await tar.extract({ | ||
| file: archivePath, | ||
| cwd: extractDir | ||
| }); | ||
| extracted = true; | ||
| console.log('tar.gz extracted using Node.js tar package'); | ||
| } catch (error) { | ||
| console.log('Node.js tar extraction failed, trying system tar command...', error.message); | ||
| } | ||
| // Method 2: System tar command fallback | ||
| if (!extracted) { | ||
| try { | ||
| execSync(`unzip -o "${archivePath}" -d "${extractDir}"`, { | ||
| execSync(`tar -xzf "${archivePath}" -C "${extractDir}"`, { | ||
| stdio: 'pipe' | ||
| }); | ||
| extracted = true; | ||
| } catch (error) { | ||
| throw new Error('ZIP extraction failed. Please ensure unzip command is installed.'); | ||
| throw new Error('tar.gz extraction failed. Please ensure tar command is installed.'); | ||
| } | ||
| } | ||
| } else { | ||
| // Extract tar.gz file | ||
| try { | ||
| execSync(`tar -xzf "${archivePath}" -C "${extractDir}"`, { | ||
| stdio: 'pipe' | ||
| }); | ||
| } catch (error) { | ||
| throw new Error('tar.gz extraction failed. Please ensure tar command is installed.'); | ||
| } | ||
| } | ||
| } | ||
| calculateSha256(filePath) { | ||
@@ -339,6 +402,14 @@ const fileBuffer = fs.readFileSync(filePath); | ||
| if (require.main === module) { | ||
| const installer = new QoderInstaller(); | ||
| installer.install(); | ||
| try { | ||
| const installer = new QoderInstaller(); | ||
| installer.install(); | ||
| } catch (error) { | ||
| console.error('❌ Failed to initialize installer:', error.message); | ||
| console.error('This might be due to Node.js version compatibility issues.'); | ||
| console.error(`Current Node.js version: ${process.version}`); | ||
| console.error('Required Node.js version: >=14'); | ||
| process.exit(1); | ||
| } | ||
| } | ||
| module.exports = QoderInstaller; |
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
18929
17.51%350
22.81%2
-33.33%2
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added