@kandiforge/spectacle 0.3.42 → 0.3.43

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/.gitkeep ADDED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kandiforge/spectacle",
3
- "version": "0.3.42",
3
+ "version": "0.3.43",
4
4
  "description": "Spectacle server and CLI tools for KandiForge ecosystem",
5
5
  "author": "Abstract Class Consulting Inc.",
6
6
  "license": "PROPRIETARY",
@@ -20,19 +20,6 @@
20
20
  "kandiforge",
21
21
  "development"
22
22
  ],
23
- "bin": {
24
- "spectacle": "./bin/spectacle",
25
- "kandi-spectacle": "./bin/kandi-spectacle",
26
- "kandi-plan": "./bin/kandi-plan",
27
- "kandi-gpt": "./bin/kandi-gpt",
28
- "kandi-run": "./bin/kandi-run",
29
- "kandi-test": "./bin/kandi-test",
30
- "kandi-deploy": "./bin/kandi-deploy",
31
- "kandi-secure": "./bin/kandi-secure",
32
- "kandi-forge": "./bin/kandi-forge",
33
- "supersmall": "./bin/supersmall",
34
- "kandi-supersmall": "./bin/kandi-supersmall"
35
- },
36
23
  "scripts": {
37
24
  "postinstall": "node scripts/install.js",
38
25
  "test": "echo \"No tests configured\""
@@ -4,12 +4,9 @@ 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);
10
7
 
11
8
  // This version MUST match package.json
12
- const RELEASE_VERSION = '0.3.42';
9
+ const RELEASE_VERSION = '0.3.43';
13
10
  const GITHUB_REPO = 'KandiForge/distribution';
14
11
 
15
12
  function downloadFile(url, destPath) {
@@ -46,12 +43,10 @@ function downloadFile(url, destPath) {
46
43
  }
47
44
 
48
45
  /**
49
- * Extract ZIP file using Node.js (no external dependencies)
50
- * Falls back to PowerShell on Windows if needed
46
+ * Extract ZIP file using PowerShell on Windows
51
47
  */
52
48
  function extractZip(zipPath, destDir) {
53
49
  try {
54
- // Try using PowerShell on Windows (built-in, no external dependencies)
55
50
  const psCommand = `powershell -Command "Expand-Archive -Path '${zipPath}' -DestinationPath '${destDir}' -Force"`;
56
51
  execSync(psCommand, { stdio: 'inherit' });
57
52
  } catch (error) {
@@ -62,29 +57,40 @@ function extractZip(zipPath, destDir) {
62
57
  async function install() {
63
58
  try {
64
59
  const platform = process.platform;
65
- const arch = process.arch;
66
60
 
67
- // Determine file name based on platform
68
- // Binary names must match what spectacle-release.yml packages
69
- let fileName, isZip;
70
- const binaries = platform === 'win32'
71
- ? ['kandi-spectacle.exe', 'kandi-plan.exe', 'kandi-gpt.exe', 'kandi-run.exe', 'kandi-test.exe', 'kandi-deploy.exe', 'kandi-secure.exe', 'kandi-forge.exe', 'kandi-supersmall.exe']
72
- : ['kandi-spectacle', 'kandi-plan', 'kandi-gpt', 'kandi-run', 'kandi-test', 'kandi-deploy', 'kandi-secure', 'kandi-forge', 'kandi-supersmall'];
61
+ // Determine archive name and binary extension based on platform
62
+ let fileName, isZip, ext;
73
63
 
74
64
  if (platform === 'darwin') {
75
65
  fileName = `spectacle-v${RELEASE_VERSION}-macos-universal.tar.gz`;
76
66
  isZip = false;
67
+ ext = '';
77
68
  } else if (platform === 'linux') {
78
69
  fileName = `spectacle-v${RELEASE_VERSION}-linux-x64.tar.gz`;
79
70
  isZip = false;
71
+ ext = '';
80
72
  } else if (platform === 'win32') {
81
73
  fileName = `spectacle-v${RELEASE_VERSION}-windows-x64.zip`;
82
74
  isZip = true;
75
+ ext = '.exe';
83
76
  } else {
84
77
  throw new Error(`Platform ${platform} is not supported. Supported: macOS, Linux, Windows`);
85
78
  }
86
79
 
87
- // Download URL from GitHub release assets (public even for private repos)
80
+ // Binary names (same for all platforms, extension added based on platform)
81
+ const binaryNames = [
82
+ 'kandi-spectacle',
83
+ 'kandi-plan',
84
+ 'kandi-gpt',
85
+ 'kandi-run',
86
+ 'kandi-test',
87
+ 'kandi-deploy',
88
+ 'kandi-secure',
89
+ 'kandi-forge',
90
+ 'kandi-supersmall'
91
+ ];
92
+
93
+ // Download URL from GitHub release assets
88
94
  const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/spectacle-v${RELEASE_VERSION}/${fileName}`;
89
95
 
90
96
  const binDir = path.join(__dirname, '..', 'bin');
@@ -95,76 +101,76 @@ async function install() {
95
101
  fs.mkdirSync(binDir, { recursive: true });
96
102
  }
97
103
 
104
+ // Clean bin directory - remove any existing binaries to avoid mixing platforms
105
+ console.log('Cleaning bin directory...');
106
+ const existingFiles = fs.readdirSync(binDir);
107
+ for (const file of existingFiles) {
108
+ // Skip .gitkeep or other dotfiles
109
+ if (file.startsWith('.')) continue;
110
+ const filePath = path.join(binDir, file);
111
+ try {
112
+ fs.unlinkSync(filePath);
113
+ } catch (e) {
114
+ console.warn(`Warning: Could not remove ${file}: ${e.message}`);
115
+ }
116
+ }
117
+
98
118
  // Download the release archive
99
- console.log(`Installing Spectacle v${RELEASE_VERSION} for ${platform} ${arch}...`);
119
+ console.log(`Installing Spectacle v${RELEASE_VERSION} for ${platform}...`);
100
120
  await downloadFile(downloadUrl, tempFile);
101
121
 
102
- // Extract the binary
103
- console.log('Extracting binary...');
122
+ // Extract the archive
123
+ console.log('Extracting binaries...');
104
124
  if (isZip) {
105
- // Use PowerShell on Windows (built-in, no external dependencies)
106
125
  extractZip(tempFile, binDir);
107
126
  } else {
108
- // Use tar on macOS/Linux
109
127
  execSync(`tar -xzf "${tempFile}" -C "${binDir}"`, { stdio: 'inherit' });
110
128
  }
111
129
 
112
130
  // Clean up archive
113
131
  fs.unlinkSync(tempFile);
114
132
 
115
- // The archive extracts to spectacle-v{version}/[all binaries][.exe]
133
+ // The archive extracts to spectacle-v{version}/
116
134
  const extractedDir = path.join(binDir, `spectacle-v${RELEASE_VERSION}`);
117
135
 
118
- // Move all binaries to the correct location
119
- // Add -bin suffix so wrapper scripts can call them (wrapper: kandi-plan, binary: kandi-plan-bin)
136
+ // Move binaries to bin directory with correct names
120
137
  const installedBinaries = [];
121
- for (const binaryName of binaries) {
122
- const extractedPath = path.join(extractedDir, binaryName);
123
-
124
- // Add -bin suffix for the actual binary (wrapper scripts expect this)
125
- const baseName = binaryName.replace('.exe', '');
126
- const destName = `${baseName}-bin${platform === 'win32' ? '.exe' : ''}`;
127
- const binaryPath = path.join(binDir, destName);
138
+ for (const baseName of binaryNames) {
139
+ const srcName = `${baseName}${ext}`;
140
+ const extractedPath = path.join(extractedDir, srcName);
141
+ const destPath = path.join(binDir, srcName);
128
142
 
129
143
  if (fs.existsSync(extractedPath)) {
130
- fs.renameSync(extractedPath, binaryPath);
144
+ fs.renameSync(extractedPath, destPath);
131
145
 
132
146
  // Make binary executable (Unix only)
133
147
  if (platform !== 'win32') {
134
- fs.chmodSync(binaryPath, 0o755);
148
+ fs.chmodSync(destPath, 0o755);
135
149
  }
136
150
 
137
- installedBinaries.push({ name: baseName, path: binaryPath });
151
+ installedBinaries.push({ name: baseName, path: destPath });
138
152
  } else {
139
- console.warn(`Warning: ${binaryName} not found in archive at ${extractedPath}`);
153
+ console.warn(`Warning: ${srcName} not found in archive`);
140
154
  }
141
155
  }
142
156
 
143
157
  // Clean up the extracted directory
144
158
  if (fs.existsSync(extractedDir)) {
145
- fs.rmdirSync(extractedDir, { recursive: true });
159
+ fs.rmSync(extractedDir, { recursive: true });
146
160
  }
147
161
 
148
162
  if (installedBinaries.length === 0) {
149
163
  throw new Error('No binaries were found in the archive');
150
164
  }
151
165
 
152
- console.log('Spectacle installed successfully!');
153
- console.log('\nInstalled binaries:');
166
+ console.log('Spectacle installed successfully!');
167
+ console.log(`\nInstalled ${installedBinaries.length} binaries:`);
154
168
  for (const binary of installedBinaries) {
155
- console.log(` - ${binary.name}: ${binary.path}`);
169
+ console.log(` - ${path.basename(binary.path)}`);
156
170
  }
157
- console.log('\nTo get started, run:');
158
- console.log(' spectacle --help # Main server');
159
- console.log(' kandi-plan --help # GitHub Issues & project management');
160
- console.log(' kandi-gpt --help # Local AI inference');
161
- console.log(' kandi-deploy --help # Deployment management');
162
- console.log(' kandi-secure --help # Security scanning');
163
- console.log(' kandi-forge --help # AI-powered development CLI');
164
- console.log(' supersmall --help # Context optimization');
165
171
 
166
172
  } catch (error) {
167
- console.error('Installation failed:', error.message);
173
+ console.error('Installation failed:', error.message);
168
174
  console.error('\nPlease report this issue at: https://github.com/KandiForge/apps/issues');
169
175
  process.exit(1);
170
176
  }
package/bin/kandi-deploy 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-deploy-bin.exe' : 'kandi-deploy-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-deploy binary:', err.message);
24
- process.exit(1);
25
- });
Binary file
package/bin/kandi-forge 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-forge-bin.exe' : 'kandi-forge-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-forge binary:', err.message);
24
- process.exit(1);
25
- });
Binary file
package/bin/kandi-gpt 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-gpt-bin.exe' : 'kandi-gpt-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-gpt binary:', err.message);
24
- process.exit(1);
25
- });
package/bin/kandi-gpt-bin DELETED
Binary file
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
- });
Binary file
package/bin/kandi-run 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-run-bin.exe' : 'kandi-run-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-run binary:', err.message);
24
- process.exit(1);
25
- });
package/bin/kandi-run-bin DELETED
Binary file
package/bin/kandi-secure 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-secure-bin.exe' : 'kandi-secure-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-secure binary:', err.message);
24
- process.exit(1);
25
- });
Binary file
@@ -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-spectacle-bin.exe' : 'kandi-spectacle-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-spectacle binary:', err.message);
24
- process.exit(1);
25
- });
Binary file
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const { spawn } = require('child_process');
4
- const path = require('path');
5
- const fs = require('fs');
6
-
7
- // Determine binary name based on platform
8
- // Handle both naming conventions (kandi-supersmall-bin from install.js, supersmall-bin from release workflow)
9
- const ext = process.platform === 'win32' ? '.exe' : '';
10
- const primaryBinary = path.join(__dirname, `kandi-supersmall-bin${ext}`);
11
- const fallbackBinary = path.join(__dirname, `supersmall-bin${ext}`);
12
- const binaryPath = fs.existsSync(primaryBinary) ? primaryBinary : fallbackBinary;
13
-
14
- // Spawn the binary with all arguments
15
- const child = spawn(binaryPath, process.argv.slice(2), {
16
- stdio: 'inherit',
17
- env: process.env
18
- });
19
-
20
- // Forward exit code
21
- child.on('exit', (code) => {
22
- process.exit(code || 0);
23
- });
24
-
25
- // Handle errors
26
- child.on('error', (err) => {
27
- console.error('Failed to start kandi-supersmall binary:', err.message);
28
- process.exit(1);
29
- });
Binary file
package/bin/kandi-test 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-test-bin.exe' : 'kandi-test-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-test binary:', err.message);
24
- process.exit(1);
25
- });
Binary file
package/bin/spectacle 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-spectacle-bin.exe' : 'kandi-spectacle-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 spectacle binary:', err.message);
24
- process.exit(1);
25
- });
package/bin/supersmall 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' ? 'supersmall-bin.exe' : 'supersmall-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 supersmall binary:', err.message);
24
- process.exit(1);
25
- });
Binary file