@kandiforge/spectacle 0.3.28 → 0.3.30

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.
Binary file
Binary file
package/bin/kandi-gpt-bin CHANGED
Binary file
Binary file
package/bin/kandi-run-bin CHANGED
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kandiforge/spectacle",
3
- "version": "0.3.28",
3
+ "version": "0.3.30",
4
4
  "description": "Spectacle server and CLI tools for KandiForge ecosystem",
5
5
  "author": "Abstract Class Consulting Inc.",
6
6
  "license": "PROPRIETARY",
@@ -4,9 +4,12 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const https = require('https');
6
6
  const { execSync } = require('child_process');
7
+ const { promisify } = require('util');
8
+ const stream = require('stream');
9
+ const pipeline = promisify(stream.pipeline);
7
10
 
8
11
  // This version MUST match package.json
9
- const RELEASE_VERSION = '0.3.28';
12
+ const RELEASE_VERSION = '0.3.30';
10
13
  const GITHUB_REPO = 'KandiForge/distribution';
11
14
 
12
15
  function downloadFile(url, destPath) {
@@ -42,26 +45,40 @@ function downloadFile(url, destPath) {
42
45
  });
43
46
  }
44
47
 
48
+ /**
49
+ * Extract ZIP file using Node.js (no external dependencies)
50
+ * Falls back to PowerShell on Windows if needed
51
+ */
52
+ function extractZip(zipPath, destDir) {
53
+ try {
54
+ // Try using PowerShell on Windows (built-in, no external dependencies)
55
+ const psCommand = `powershell -Command "Expand-Archive -Path '${zipPath}' -DestinationPath '${destDir}' -Force"`;
56
+ execSync(psCommand, { stdio: 'inherit' });
57
+ } catch (error) {
58
+ throw new Error(`Failed to extract ZIP file: ${error.message}`);
59
+ }
60
+ }
61
+
45
62
  async function install() {
46
63
  try {
47
64
  const platform = process.platform;
48
65
  const arch = process.arch;
49
66
 
50
67
  // Determine file name based on platform
51
- let fileName, extractCmd;
68
+ let fileName, isZip;
52
69
  const binaries = platform === 'win32'
53
- ? ['spectacle.exe', 'kandi-plan.exe', 'kandi-gpt.exe', 'kandi-deploy.exe', 'kandi-secure.exe', 'kandi-forge.exe', 'supersmall.exe']
54
- : ['spectacle', 'kandi-plan', 'kandi-gpt', 'kandi-deploy', 'kandi-secure', 'kandi-forge', 'supersmall'];
70
+ ? ['kandi-spectacle.exe', 'kandi-plan.exe', 'kandi-gpt.exe', 'kandi-deploy.exe', 'kandi-secure.exe', 'kandi-forge.exe', 'supersmall.exe']
71
+ : ['kandi-spectacle', 'kandi-plan', 'kandi-gpt', 'kandi-deploy', 'kandi-secure', 'kandi-forge', 'supersmall'];
55
72
 
56
73
  if (platform === 'darwin') {
57
74
  fileName = `spectacle-v${RELEASE_VERSION}-macos-universal.tar.gz`;
58
- extractCmd = `tar -xzf`;
75
+ isZip = false;
59
76
  } else if (platform === 'linux') {
60
77
  fileName = `spectacle-v${RELEASE_VERSION}-linux-x64.tar.gz`;
61
- extractCmd = `tar -xzf`;
78
+ isZip = false;
62
79
  } else if (platform === 'win32') {
63
80
  fileName = `spectacle-v${RELEASE_VERSION}-windows-x64.zip`;
64
- extractCmd = `unzip -o`;
81
+ isZip = true;
65
82
  } else {
66
83
  throw new Error(`Platform ${platform} is not supported. Supported: macOS, Linux, Windows`);
67
84
  }
@@ -83,9 +100,13 @@ async function install() {
83
100
 
84
101
  // Extract the binary
85
102
  console.log('Extracting binary...');
86
- // Use appropriate flag based on archive type: -C for tar, -d for unzip
87
- const destFlag = platform === 'win32' ? '-d' : '-C';
88
- execSync(`${extractCmd} "${tempFile}" ${destFlag} "${binDir}"`, { stdio: 'inherit' });
103
+ if (isZip) {
104
+ // Use PowerShell on Windows (built-in, no external dependencies)
105
+ extractZip(tempFile, binDir);
106
+ } else {
107
+ // Use tar on macOS/Linux
108
+ execSync(`tar -xzf "${tempFile}" -C "${binDir}"`, { stdio: 'inherit' });
109
+ }
89
110
 
90
111
  // Clean up archive
91
112
  fs.unlinkSync(tempFile);
package/bin/kandi-plan DELETED
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const { spawn } = require('child_process');
4
- const path = require('path');
5
-
6
- // Determine binary name based on platform
7
- const binaryName = process.platform === 'win32' ? 'kandi-plan-bin.exe' : 'kandi-plan-bin';
8
- const binaryPath = path.join(__dirname, binaryName);
9
-
10
- // Spawn the binary with all arguments
11
- const child = spawn(binaryPath, process.argv.slice(2), {
12
- stdio: 'inherit',
13
- env: process.env
14
- });
15
-
16
- // Forward exit code
17
- child.on('exit', (code) => {
18
- process.exit(code || 0);
19
- });
20
-
21
- // Handle errors
22
- child.on('error', (err) => {
23
- console.error('Failed to start kandi-plan binary:', err.message);
24
- process.exit(1);
25
- });