snow-flow-test 9.0.135-test.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.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # js
2
+
3
+ To install dependencies:
4
+
5
+ ```bash
6
+ bun install
7
+ ```
8
+
9
+ To run:
10
+
11
+ ```bash
12
+ bun run index.ts
13
+ ```
14
+
15
+ This project was created using `bun init` in bun v1.2.12. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ const { 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() === 'arm64' ? 'arm64' : 'x64';
9
+
10
+ const binaryName = platform === 'windows' ? 'snow-code.exe' : 'snow-code';
11
+ const packageDir = path.dirname(__dirname);
12
+ const binaryPath = path.join(packageDir, 'bin', binaryName);
13
+
14
+ if (!fs.existsSync(binaryPath)) {
15
+ console.error('Error: snow-flow binary not found.');
16
+ console.error('');
17
+ console.error('The binary should have been downloaded during installation.');
18
+ console.error('Try reinstalling: npm install -g snow-flow');
19
+ console.error('');
20
+ console.error(`Expected binary at: ${binaryPath}`);
21
+ process.exit(1);
22
+ }
23
+
24
+ // Execute the binary
25
+ const child = spawn(binaryPath, process.argv.slice(2), {
26
+ stdio: 'inherit',
27
+ env: process.env
28
+ });
29
+
30
+ child.on('exit', (code) => {
31
+ process.exit(code || 0);
32
+ });
33
+
34
+ child.on('error', (err) => {
35
+ console.error(`Failed to start snow-flow: ${err.message}`);
36
+ process.exit(1);
37
+ });
package/package.json ADDED
@@ -0,0 +1,114 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/package.json",
3
+ "version": "9.0.135-test.1",
4
+ "name": "snow-flow-test",
5
+ "description": "Snow-Flow - AI-powered ServiceNow development CLI with 410+ MCP tools",
6
+ "type": "module",
7
+ "author": "Snow-Flow Team",
8
+ "license": "Apache-2.0",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/groeimetai/snow-flow.git",
12
+ "directory": "packages/snowcode"
13
+ },
14
+ "homepage": "https://github.com/groeimetai/snow-flow",
15
+ "keywords": [
16
+ "servicenow",
17
+ "ai",
18
+ "cli",
19
+ "mcp",
20
+ "development",
21
+ "automation"
22
+ ],
23
+ "scripts": {
24
+ "typecheck": "tsgo --noEmit",
25
+ "test": "bun test",
26
+ "build": "bun script/build.ts",
27
+ "dev": "bun run ./src/index.ts",
28
+ "postinstall": "node postinstall.cjs || true",
29
+ "prepublishOnly": "bun script/resolve-catalog.ts",
30
+ "release": "npm version patch -m 'chore: Bump version to %s' && git push --no-verify && git push --tags --no-verify",
31
+ "release:patch": "npm version patch -m 'chore: Bump version to %s' && git push --no-verify && git push --tags --no-verify",
32
+ "release:minor": "npm version minor -m 'chore: Bump version to %s' && git push --no-verify && git push --tags --no-verify",
33
+ "release:major": "npm version major -m 'chore: Bump version to %s' && git push --no-verify && git push --tags --no-verify"
34
+ },
35
+ "bin": {
36
+ "snow-flow-test": "./bin/snow-code.cjs",
37
+ "snow-code-test": "./bin/snow-code.cjs",
38
+ "snowcode-test": "./bin/snow-code.cjs"
39
+ },
40
+ "exports": {
41
+ "./*": "./src/*.ts"
42
+ },
43
+ "devDependencies": {
44
+ "@groeimetai/snow-flow-script": "workspace:*",
45
+ "@groeimetai/snow-flow-sdk": "workspace:*",
46
+ "@groeimetai/snow-flow-plugin": "workspace:*",
47
+ "@ai-sdk/amazon-bedrock": "^4.0.10",
48
+ "@ai-sdk/google-vertex": "^4.0.9",
49
+ "@octokit/webhooks-types": "7.6.1",
50
+ "@parcel/watcher-darwin-arm64": "2.5.1",
51
+ "@parcel/watcher-darwin-x64": "2.5.1",
52
+ "@parcel/watcher-linux-arm64-glibc": "2.5.1",
53
+ "@parcel/watcher-linux-x64-glibc": "2.5.1",
54
+ "@parcel/watcher-win32-x64": "2.5.1",
55
+ "@standard-schema/spec": "1.0.0",
56
+ "@tsconfig/bun": "1.0.9",
57
+ "@types/bun": "1.3.0",
58
+ "@types/json-schema": "7.0.15",
59
+ "@types/turndown": "5.0.5",
60
+ "@types/yargs": "17.0.33",
61
+ "openapi-types": "12.1.3",
62
+ "typescript": "5.8.2",
63
+ "@typescript/native-preview": "7.0.0-dev.20251014.1",
64
+ "vscode-languageserver-types": "3.17.5",
65
+ "zod-to-json-schema": "3.24.5"
66
+ },
67
+ "dependencies": {
68
+ "@actions/core": "1.11.1",
69
+ "@actions/github": "6.0.1",
70
+ "@agentclientprotocol/sdk": "0.4.9",
71
+ "@ai-sdk/anthropic": "^3.0.8",
72
+ "@ai-sdk/google": "^3.0.5",
73
+ "@ai-sdk/mcp": "^1.0.5",
74
+ "@ai-sdk/openai": "^3.0.7",
75
+ "@ai-sdk/provider": "^3.0.2",
76
+ "@clack/prompts": "1.0.0-alpha.1",
77
+ "@hono/standard-validator": "0.1.5",
78
+ "@hono/zod-validator": "0.7.4",
79
+ "@modelcontextprotocol/sdk": "1.15.1",
80
+ "@octokit/graphql": "9.0.2",
81
+ "@octokit/rest": "22.0.0",
82
+ "@openauthjs/openauth": "^0.4.3",
83
+ "@parcel/watcher": "2.5.1",
84
+ "@pierre/precision-diffs": "0.0.2-alpha.1-1",
85
+ "@standard-community/standard-json": "0.3.1",
86
+ "@standard-community/standard-openapi": "0.2.4",
87
+ "@standard-schema/spec": "1.0.0",
88
+ "@zip.js/zip.js": "2.7.62",
89
+ "ai": "^6.0.16",
90
+ "axios": "1.7.9",
91
+ "chokidar": "4.0.3",
92
+ "decimal.js": "10.5.0",
93
+ "diff": "8.0.2",
94
+ "fuzzysort": "3.1.0",
95
+ "gray-matter": "4.0.3",
96
+ "hono": "4.10.2",
97
+ "hono-openapi": "1.0.7",
98
+ "ignore": "7.0.5",
99
+ "jsonc-parser": "3.3.1",
100
+ "minimatch": "10.0.3",
101
+ "open": "10.1.2",
102
+ "remeda": "2.26.0",
103
+ "tree-sitter-bash": "0.25.0",
104
+ "tsx": "4.20.6",
105
+ "turndown": "7.2.0",
106
+ "ulid": "3.0.1",
107
+ "vscode-jsonrpc": "8.2.1",
108
+ "web-tree-sitter": "0.25.9",
109
+ "xdg-basedir": "5.1.0",
110
+ "yargs": "17.7.2",
111
+ "zod": "3.25.76",
112
+ "zod-to-json-schema": "3.24.5"
113
+ }
114
+ }
@@ -0,0 +1,207 @@
1
+ #!/usr/bin/env node
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const os = require('os');
5
+ const https = require('https');
6
+ const { execSync } = require('child_process');
7
+ const zlib = require('zlib');
8
+
9
+ const platform = os.platform() === 'win32' ? 'windows' : os.platform();
10
+ const arch = os.arch() === 'arm64' ? 'arm64' : 'x64';
11
+
12
+ const binaryName = platform === 'windows' ? 'snow-code.exe' : 'snow-code';
13
+ const packageDir = __dirname;
14
+ const binDir = path.join(packageDir, 'bin');
15
+ const binaryPath = path.join(binDir, binaryName);
16
+ const distDir = path.join(packageDir, 'dist');
17
+ const mcpDir = path.join(distDir, 'mcp');
18
+ const mcpIndexPath = path.join(mcpDir, 'enterprise-proxy', 'index.js');
19
+
20
+ // Get version from package.json
21
+ function getVersion() {
22
+ try {
23
+ const pkg = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), 'utf8'));
24
+ return pkg.version;
25
+ } catch {
26
+ return null;
27
+ }
28
+ }
29
+
30
+ // Get version from installed binary
31
+ function getBinaryVersion() {
32
+ try {
33
+ if (!fs.existsSync(binaryPath)) return null;
34
+ const result = execSync(`"${binaryPath}" --version`, { encoding: 'utf8', stdio: 'pipe', timeout: 5000 });
35
+ return result.trim();
36
+ } catch {
37
+ return null;
38
+ }
39
+ }
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
+
53
+ // Follow redirects and download file
54
+ function download(url) {
55
+ return new Promise((resolve, reject) => {
56
+ const request = https.get(url, { headers: { 'User-Agent': 'snow-flow-installer' } }, (response) => {
57
+ if (response.statusCode === 302 || response.statusCode === 301) {
58
+ download(response.headers.location).then(resolve).catch(reject);
59
+ return;
60
+ }
61
+ if (response.statusCode !== 200) {
62
+ reject(new Error(`Failed to download: HTTP ${response.statusCode}`));
63
+ return;
64
+ }
65
+
66
+ const chunks = [];
67
+ response.on('data', chunk => chunks.push(chunk));
68
+ response.on('end', () => resolve(Buffer.concat(chunks)));
69
+ response.on('error', reject);
70
+ });
71
+ request.on('error', reject);
72
+ });
73
+ }
74
+
75
+ async function downloadBinary() {
76
+ const version = getVersion();
77
+ if (!version) {
78
+ console.log('Could not determine version, skipping binary download');
79
+ return false;
80
+ }
81
+
82
+ const assetName = `snow-flow-${platform}-${arch}`;
83
+ const tarballName = `${assetName}.tar.gz`;
84
+ const releaseUrl = `https://github.com/groeimetai/snow-flow/releases/download/v${version}/${tarballName}`;
85
+
86
+ console.log(`Downloading snow-flow binary for ${platform}-${arch}...`);
87
+ console.log(`URL: ${releaseUrl}`);
88
+
89
+ try {
90
+ // Download the tarball
91
+ const tarballData = await download(releaseUrl);
92
+
93
+ // Create temp file
94
+ const tmpDir = os.tmpdir();
95
+ const tarballPath = path.join(tmpDir, tarballName);
96
+ fs.writeFileSync(tarballPath, tarballData);
97
+
98
+ // Ensure bin directory exists
99
+ if (!fs.existsSync(binDir)) {
100
+ fs.mkdirSync(binDir, { recursive: true });
101
+ }
102
+
103
+ // Extract using tar command
104
+ console.log('Extracting binary...');
105
+ execSync(`tar -xzf "${tarballPath}" -C "${binDir}" --strip-components=1`, { stdio: 'pipe' });
106
+
107
+ // Clean up
108
+ fs.unlinkSync(tarballPath);
109
+
110
+ // Make executable on non-Windows
111
+ if (platform !== 'windows' && fs.existsSync(binaryPath)) {
112
+ fs.chmodSync(binaryPath, 0o755);
113
+ }
114
+
115
+ console.log('✅ Binary installed successfully!');
116
+ return true;
117
+ } catch (error) {
118
+ console.log(`Note: Could not download pre-built binary (${error.message})`);
119
+ console.log('You may need to build from source or check your network connection.');
120
+ return false;
121
+ }
122
+ }
123
+
124
+ async function downloadMcpServers() {
125
+ const version = getVersion();
126
+ if (!version) {
127
+ console.log('Could not determine version, skipping MCP download');
128
+ return false;
129
+ }
130
+
131
+ const tarballName = 'snow-flow-mcp.tar.gz';
132
+ const releaseUrl = `https://github.com/groeimetai/snow-flow/releases/download/v${version}/${tarballName}`;
133
+
134
+ console.log('Downloading MCP servers...');
135
+
136
+ try {
137
+ // Download the tarball
138
+ const tarballData = await download(releaseUrl);
139
+
140
+ // Create temp file
141
+ const tmpDir = os.tmpdir();
142
+ const tarballPath = path.join(tmpDir, tarballName);
143
+ fs.writeFileSync(tarballPath, tarballData);
144
+
145
+ // Ensure dist directory exists
146
+ if (!fs.existsSync(distDir)) {
147
+ fs.mkdirSync(distDir, { recursive: true });
148
+ }
149
+
150
+ // Extract MCP servers
151
+ console.log('Extracting MCP servers...');
152
+ execSync(`tar -xzf "${tarballPath}" -C "${distDir}"`, { stdio: 'pipe' });
153
+
154
+ // Clean up
155
+ fs.unlinkSync(tarballPath);
156
+
157
+ console.log('✅ MCP servers installed successfully!');
158
+ return true;
159
+ } catch (error) {
160
+ console.log(`Note: Could not download MCP servers (${error.message})`);
161
+ console.log('Enterprise features may not be available.');
162
+ return false;
163
+ }
164
+ }
165
+
166
+ async function main() {
167
+ const packageVersion = getVersion();
168
+ const binaryVersion = getBinaryVersion();
169
+ const binaryWorks = verifyBinaryWorks();
170
+
171
+ // Download binary if missing, incompatible, or version mismatch
172
+ if (!fs.existsSync(binaryPath)) {
173
+ console.log('Binary not found, downloading...');
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();
182
+ } else if (packageVersion && binaryVersion && packageVersion !== binaryVersion) {
183
+ console.log(`Version mismatch: binary is ${binaryVersion}, package is ${packageVersion}`);
184
+ console.log('Downloading correct version...');
185
+ // Remove old binary first
186
+ try {
187
+ fs.unlinkSync(binaryPath);
188
+ } catch {}
189
+ await downloadBinary();
190
+ } else {
191
+ // Make sure it's executable
192
+ if (platform !== 'windows') {
193
+ try {
194
+ fs.chmodSync(binaryPath, 0o755);
195
+ } catch {}
196
+ }
197
+ }
198
+
199
+ // Download MCP servers if needed
200
+ if (!fs.existsSync(mcpIndexPath)) {
201
+ await downloadMcpServers();
202
+ }
203
+ }
204
+
205
+ main().catch(err => {
206
+ console.log(`Postinstall failed: ${err.message}`);
207
+ });