@kandiforge/kandi-cli 8.0.1 → 9.0.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/bin/kandi +32 -1
- package/package.json +1 -1
- package/scripts/install.js +5 -4
package/bin/kandi
CHANGED
|
@@ -1 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
// Path to the actual binary (will be downloaded during install)
|
|
8
|
+
const binaryPath = path.join(__dirname, 'kandi-bin');
|
|
9
|
+
|
|
10
|
+
// Check if binary exists
|
|
11
|
+
if (!fs.existsSync(binaryPath)) {
|
|
12
|
+
console.error('Error: Kandi CLI binary not found.');
|
|
13
|
+
console.error('Please reinstall the package: npm install -g @kandiforge/kandi-cli');
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Spawn the binary with all arguments
|
|
18
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
19
|
+
stdio: 'inherit',
|
|
20
|
+
env: process.env
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Handle exit
|
|
24
|
+
child.on('exit', (code) => {
|
|
25
|
+
process.exit(code || 0);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Handle errors
|
|
29
|
+
child.on('error', (err) => {
|
|
30
|
+
console.error('Failed to start Kandi CLI:', err.message);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
});
|
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -6,8 +6,9 @@ const https = require('https');
|
|
|
6
6
|
const { execSync } = require('child_process');
|
|
7
7
|
const crypto = require('crypto');
|
|
8
8
|
|
|
9
|
-
const RELEASE_VERSION = '
|
|
10
|
-
const
|
|
9
|
+
const RELEASE_VERSION = '9.0.0';
|
|
10
|
+
const DISTRIBUTION_REPO = 'KandiForge/distribution';
|
|
11
|
+
const BINARIES_PATH = 'kandi-cli/binaries';
|
|
11
12
|
|
|
12
13
|
function getArch() {
|
|
13
14
|
const arch = process.arch;
|
|
@@ -76,9 +77,9 @@ async function install() {
|
|
|
76
77
|
throw new Error(`Platform ${platform} is not supported. Only macOS is supported.`);
|
|
77
78
|
}
|
|
78
79
|
|
|
79
|
-
// Download URL for the binary
|
|
80
|
+
// Download URL for the binary (from public distribution repo)
|
|
80
81
|
const fileName = `kandi-cli-v${RELEASE_VERSION}-macos-universal.tar.gz`;
|
|
81
|
-
const downloadUrl = `https://
|
|
82
|
+
const downloadUrl = `https://raw.githubusercontent.com/${DISTRIBUTION_REPO}/main/${BINARIES_PATH}/${fileName}`;
|
|
82
83
|
|
|
83
84
|
const binDir = path.join(__dirname, '..', 'bin');
|
|
84
85
|
const tempFile = path.join(binDir, fileName);
|