@kandiforge/kandi-cli 9.1.0 → 9.2.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/package.json +2 -9
- package/scripts/install.js +39 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kandiforge/kandi-cli",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"description": "AI-assisted software development CLI with interactive chat and 26 built-in tools",
|
|
5
5
|
"author": "KandiForge",
|
|
6
6
|
"license": "Proprietary",
|
|
@@ -37,12 +37,5 @@
|
|
|
37
37
|
],
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=14.0.0"
|
|
40
|
-
}
|
|
41
|
-
"os": [
|
|
42
|
-
"darwin"
|
|
43
|
-
],
|
|
44
|
-
"cpu": [
|
|
45
|
-
"x64",
|
|
46
|
-
"arm64"
|
|
47
|
-
]
|
|
40
|
+
}
|
|
48
41
|
}
|
package/scripts/install.js
CHANGED
|
@@ -6,7 +6,7 @@ const https = require('https');
|
|
|
6
6
|
const { execSync } = require('child_process');
|
|
7
7
|
const crypto = require('crypto');
|
|
8
8
|
|
|
9
|
-
const RELEASE_VERSION = '9.
|
|
9
|
+
const RELEASE_VERSION = '9.2.0';
|
|
10
10
|
const DISTRIBUTION_REPO = 'KandiForge/distribution';
|
|
11
11
|
const BINARIES_PATH = 'kandi-cli/binaries';
|
|
12
12
|
|
|
@@ -72,39 +72,54 @@ async function install() {
|
|
|
72
72
|
try {
|
|
73
73
|
const arch = getArch();
|
|
74
74
|
const platform = process.platform;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
|
|
76
|
+
// Determine file name based on platform
|
|
77
|
+
let fileName, extractCmd, binaryName;
|
|
78
|
+
if (platform === 'darwin') {
|
|
79
|
+
fileName = `kandi-cli-v${RELEASE_VERSION}-macos-universal.tar.gz`;
|
|
80
|
+
extractCmd = `tar -xzf`;
|
|
81
|
+
binaryName = 'kandi';
|
|
82
|
+
} else if (platform === 'linux') {
|
|
83
|
+
fileName = `kandi-cli-v${RELEASE_VERSION}-linux-x64.tar.gz`;
|
|
84
|
+
extractCmd = `tar -xzf`;
|
|
85
|
+
binaryName = 'kandi';
|
|
86
|
+
} else if (platform === 'win32') {
|
|
87
|
+
fileName = `kandi-cli-v${RELEASE_VERSION}-windows-x64.zip`;
|
|
88
|
+
extractCmd = `unzip -o`;
|
|
89
|
+
binaryName = 'kandi.exe';
|
|
90
|
+
} else {
|
|
91
|
+
throw new Error(`Platform ${platform} is not supported. Supported: macOS, Linux, Windows`);
|
|
78
92
|
}
|
|
79
|
-
|
|
93
|
+
|
|
80
94
|
// Download URL for the binary (from public distribution repo)
|
|
81
|
-
const fileName = `kandi-cli-v${RELEASE_VERSION}-macos-universal.tar.gz`;
|
|
82
95
|
const downloadUrl = `https://raw.githubusercontent.com/${DISTRIBUTION_REPO}/main/${BINARIES_PATH}/${fileName}`;
|
|
83
|
-
|
|
96
|
+
|
|
84
97
|
const binDir = path.join(__dirname, '..', 'bin');
|
|
85
98
|
const tempFile = path.join(binDir, fileName);
|
|
86
|
-
|
|
99
|
+
|
|
87
100
|
// Create bin directory if it doesn't exist
|
|
88
101
|
if (!fs.existsSync(binDir)) {
|
|
89
102
|
fs.mkdirSync(binDir, { recursive: true });
|
|
90
103
|
}
|
|
91
|
-
|
|
92
|
-
// Download the release
|
|
104
|
+
|
|
105
|
+
// Download the release archive
|
|
93
106
|
console.log(`Installing Kandi CLI v${RELEASE_VERSION} for ${platform} ${arch}...`);
|
|
94
107
|
await downloadFile(downloadUrl, tempFile);
|
|
95
|
-
|
|
108
|
+
|
|
96
109
|
// Extract the binary
|
|
97
110
|
console.log('Extracting binary...');
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
111
|
+
// Use appropriate flag based on archive type: -C for tar, -d for unzip
|
|
112
|
+
const destFlag = platform === 'win32' ? '-d' : '-C';
|
|
113
|
+
execSync(`${extractCmd} "${tempFile}" ${destFlag} "${binDir}"`, { stdio: 'inherit' });
|
|
114
|
+
|
|
115
|
+
// Clean up archive
|
|
101
116
|
fs.unlinkSync(tempFile);
|
|
102
|
-
|
|
103
|
-
// The
|
|
117
|
+
|
|
118
|
+
// The archive extracts to kandi-cli-v{version}/kandi[.exe]
|
|
104
119
|
const extractedDir = path.join(binDir, `kandi-cli-v${RELEASE_VERSION}`);
|
|
105
|
-
const extractedPath = path.join(extractedDir,
|
|
106
|
-
const binaryPath = path.join(binDir, 'kandi-bin');
|
|
107
|
-
|
|
120
|
+
const extractedPath = path.join(extractedDir, binaryName);
|
|
121
|
+
const binaryPath = path.join(binDir, 'kandi-bin' + (platform === 'win32' ? '.exe' : ''));
|
|
122
|
+
|
|
108
123
|
// Move the extracted binary to the correct location
|
|
109
124
|
if (fs.existsSync(extractedPath)) {
|
|
110
125
|
fs.renameSync(extractedPath, binaryPath);
|
|
@@ -113,9 +128,11 @@ async function install() {
|
|
|
113
128
|
} else {
|
|
114
129
|
throw new Error(`Binary not found at expected location: ${extractedPath}`);
|
|
115
130
|
}
|
|
116
|
-
|
|
117
|
-
// Make binary executable
|
|
118
|
-
|
|
131
|
+
|
|
132
|
+
// Make binary executable (Unix only)
|
|
133
|
+
if (platform !== 'win32') {
|
|
134
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
135
|
+
}
|
|
119
136
|
|
|
120
137
|
console.log('✅ Kandi CLI installed successfully!');
|
|
121
138
|
console.log(`Binary location: ${binaryPath}`);
|