snow-flow 9.0.1 → 9.0.3

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.
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+ const { execSync, spawn } = require('child_process');
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const os = require('os');
6
+
7
+ const platform = os.platform() === 'win32' ? 'windows' : os.platform();
8
+ const arch = os.arch();
9
+
10
+ // Map architecture names
11
+ const archMap = {
12
+ 'arm64': 'arm64',
13
+ 'x64': 'x64',
14
+ 'x86_64': 'x64'
15
+ };
16
+
17
+ const mappedArch = archMap[arch] || 'x64';
18
+ const packageName = `snow-flow-${platform}-${mappedArch}`;
19
+
20
+ // Search for binary in node_modules
21
+ function findBinary() {
22
+ let dir = __dirname;
23
+
24
+ // Walk up looking for node_modules
25
+ while (dir !== path.dirname(dir)) {
26
+ // Check in sibling node_modules (for global install)
27
+ const globalPath = path.join(path.dirname(dir), 'node_modules', packageName, 'bin', platform === 'windows' ? 'snow-code.exe' : 'snow-code');
28
+ if (fs.existsSync(globalPath)) {
29
+ return globalPath;
30
+ }
31
+
32
+ // Check in parent's node_modules
33
+ const localPath = path.join(dir, 'node_modules', packageName, 'bin', platform === 'windows' ? 'snow-code.exe' : 'snow-code');
34
+ if (fs.existsSync(localPath)) {
35
+ return localPath;
36
+ }
37
+
38
+ dir = path.dirname(dir);
39
+ }
40
+
41
+ return null;
42
+ }
43
+
44
+ const binaryPath = findBinary();
45
+
46
+ if (!binaryPath) {
47
+ console.error(`Error: Could not find snow-flow binary for ${platform}-${mappedArch}`);
48
+ console.error(`Expected package: ${packageName}`);
49
+ console.error('');
50
+ console.error('Try reinstalling: npm install -g snow-flow');
51
+ process.exit(1);
52
+ }
53
+
54
+ // Execute the binary
55
+ const child = spawn(binaryPath, process.argv.slice(2), {
56
+ stdio: 'inherit',
57
+ env: process.env
58
+ });
59
+
60
+ child.on('exit', (code) => {
61
+ process.exit(code || 0);
62
+ });
63
+
64
+ child.on('error', (err) => {
65
+ console.error(`Failed to start snow-flow: ${err.message}`);
66
+ process.exit(1);
67
+ });
@@ -0,0 +1,58 @@
1
+ @echo off
2
+ setlocal enabledelayedexpansion
3
+
4
+ if defined OPENCODE_BIN_PATH (
5
+ set "resolved=%OPENCODE_BIN_PATH%"
6
+ goto :execute
7
+ )
8
+
9
+ rem Get the directory of this script
10
+ set "script_dir=%~dp0"
11
+ set "script_dir=%script_dir:~0,-1%"
12
+
13
+ rem Detect platform and architecture
14
+ set "platform=windows"
15
+
16
+ rem Detect architecture
17
+ if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
18
+ set "arch=x64"
19
+ ) else if "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
20
+ set "arch=arm64"
21
+ ) else if "%PROCESSOR_ARCHITECTURE%"=="x86" (
22
+ set "arch=x86"
23
+ ) else (
24
+ set "arch=x64"
25
+ )
26
+
27
+ set "name=opencode-!platform!-!arch!"
28
+ set "binary=opencode.exe"
29
+
30
+ rem Search for the binary starting from script location
31
+ set "resolved="
32
+ set "current_dir=%script_dir%"
33
+
34
+ :search_loop
35
+ set "candidate=%current_dir%\node_modules\%name%\bin\%binary%"
36
+ if exist "%candidate%" (
37
+ set "resolved=%candidate%"
38
+ goto :execute
39
+ )
40
+
41
+ rem Move up one directory
42
+ for %%i in ("%current_dir%") do set "parent_dir=%%~dpi"
43
+ set "parent_dir=%parent_dir:~0,-1%"
44
+
45
+ rem Check if we've reached the root
46
+ if "%current_dir%"=="%parent_dir%" goto :not_found
47
+ set "current_dir=%parent_dir%"
48
+ goto :search_loop
49
+
50
+ :not_found
51
+ echo It seems that your package manager failed to install the right version of the opencode CLI for your platform. You can try manually installing the "%name%" package >&2
52
+ exit /b 1
53
+
54
+ :execute
55
+ rem Execute the binary with all arguments in the same console window
56
+ rem Use start /b /wait to ensure it runs in the current shell context for all shells
57
+ start /b /wait "" "%resolved%" %*
58
+ exit /b %ERRORLEVEL%
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "9.0.1",
3
+ "version": "9.0.3",
4
4
  "name": "snow-flow",
5
5
  "description": "Snow-Flow - AI-powered ServiceNow development CLI with 410+ MCP tools",
6
6
  "type": "module",
@@ -33,8 +33,9 @@
33
33
  "release:major": "npm version major -m 'chore: Bump version to %s' && git push --no-verify && git push --tags --no-verify"
34
34
  },
35
35
  "bin": {
36
- "snow-code": "./bin/snow-code",
37
- "snowcode": "./bin/snowcode"
36
+ "snow-flow": "./bin/snow-code.js",
37
+ "snow-code": "./bin/snow-code.js",
38
+ "snowcode": "./bin/snow-code.js"
38
39
  },
39
40
  "exports": {
40
41
  "./*": "./src/*.ts"
package/bin/snow-code DELETED
Binary file