snow-flow 9.0.119 → 9.0.121

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "9.0.119",
3
+ "version": "9.0.121",
4
4
  "name": "snow-flow",
5
5
  "description": "Snow-Flow - AI-powered ServiceNow development CLI with 410+ MCP tools",
6
6
  "type": "module",
package/postinstall.cjs CHANGED
@@ -31,13 +31,25 @@ function getVersion() {
31
31
  function getBinaryVersion() {
32
32
  try {
33
33
  if (!fs.existsSync(binaryPath)) return null;
34
- const result = execSync(`"${binaryPath}" --version`, { encoding: 'utf8', stdio: 'pipe' });
34
+ const result = execSync(`"${binaryPath}" --version`, { encoding: 'utf8', stdio: 'pipe', timeout: 5000 });
35
35
  return result.trim();
36
36
  } catch {
37
37
  return null;
38
38
  }
39
39
  }
40
40
 
41
+ // Verify binary is executable on this platform (catches architecture mismatches)
42
+ function verifyBinaryWorks() {
43
+ try {
44
+ if (!fs.existsSync(binaryPath)) return false;
45
+ execSync(`"${binaryPath}" --version`, { encoding: 'utf8', stdio: 'pipe', timeout: 5000 });
46
+ return true;
47
+ } catch {
48
+ // Binary exists but can't execute (wrong architecture, corrupted, etc.)
49
+ return false;
50
+ }
51
+ }
52
+
41
53
  // Follow redirects and download file
42
54
  function download(url) {
43
55
  return new Promise((resolve, reject) => {
@@ -154,11 +166,19 @@ async function downloadMcpServers() {
154
166
  async function main() {
155
167
  const packageVersion = getVersion();
156
168
  const binaryVersion = getBinaryVersion();
169
+ const binaryWorks = verifyBinaryWorks();
157
170
 
158
- // Download binary if missing or version mismatch
171
+ // Download binary if missing, incompatible, or version mismatch
159
172
  if (!fs.existsSync(binaryPath)) {
160
173
  console.log('Binary not found, downloading...');
161
174
  await downloadBinary();
175
+ } else if (!binaryWorks) {
176
+ // Binary exists but can't execute (wrong architecture, corrupted, etc.)
177
+ console.log('Binary incompatible with this platform, downloading correct version...');
178
+ try {
179
+ fs.unlinkSync(binaryPath);
180
+ } catch {}
181
+ await downloadBinary();
162
182
  } else if (packageVersion && binaryVersion && packageVersion !== binaryVersion) {
163
183
  console.log(`Version mismatch: binary is ${binaryVersion}, package is ${packageVersion}`);
164
184
  console.log('Downloading correct version...');
package/bin/snow-code DELETED
Binary file