@kandiforge/kandi-cli 9.0.1 → 9.1.1

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.
Files changed (2) hide show
  1. package/package.json +2 -9
  2. package/scripts/install.js +37 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kandiforge/kandi-cli",
3
- "version": "9.0.1",
3
+ "version": "9.1.1",
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
  }
@@ -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.0.1';
9
+ const RELEASE_VERSION = '9.1.0';
10
10
  const DISTRIBUTION_REPO = 'KandiForge/distribution';
11
11
  const BINARIES_PATH = 'kandi-cli/binaries';
12
12
 
@@ -72,39 +72,52 @@ async function install() {
72
72
  try {
73
73
  const arch = getArch();
74
74
  const platform = process.platform;
75
-
76
- if (platform !== 'darwin') {
77
- throw new Error(`Platform ${platform} is not supported. Only macOS is supported.`);
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 tarball
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
- execSync(`tar -xzf "${tempFile}" -C "${binDir}"`, { stdio: 'inherit' });
99
-
100
- // Clean up tarball
111
+ execSync(`${extractCmd} "${tempFile}" -C "${binDir}"`, { stdio: 'inherit' });
112
+
113
+ // Clean up archive
101
114
  fs.unlinkSync(tempFile);
102
-
103
- // The tarball extracts to kandi-cli-v{version}/kandi
115
+
116
+ // The archive extracts to kandi-cli-v{version}/kandi[.exe]
104
117
  const extractedDir = path.join(binDir, `kandi-cli-v${RELEASE_VERSION}`);
105
- const extractedPath = path.join(extractedDir, 'kandi');
106
- const binaryPath = path.join(binDir, 'kandi-bin');
107
-
118
+ const extractedPath = path.join(extractedDir, binaryName);
119
+ const binaryPath = path.join(binDir, 'kandi-bin' + (platform === 'win32' ? '.exe' : ''));
120
+
108
121
  // Move the extracted binary to the correct location
109
122
  if (fs.existsSync(extractedPath)) {
110
123
  fs.renameSync(extractedPath, binaryPath);
@@ -113,9 +126,11 @@ async function install() {
113
126
  } else {
114
127
  throw new Error(`Binary not found at expected location: ${extractedPath}`);
115
128
  }
116
-
117
- // Make binary executable
118
- fs.chmodSync(binaryPath, 0o755);
129
+
130
+ // Make binary executable (Unix only)
131
+ if (platform !== 'win32') {
132
+ fs.chmodSync(binaryPath, 0o755);
133
+ }
119
134
 
120
135
  console.log('✅ Kandi CLI installed successfully!');
121
136
  console.log(`Binary location: ${binaryPath}`);