snow-flow 8.30.21 → 8.30.22

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
  "name": "snow-flow",
3
- "version": "8.30.21",
3
+ "version": "8.30.22",
4
4
  "description": "ServiceNow development with SnowCode - 75+ LLM providers (Claude, GPT, Gemini, Llama, Mistral, DeepSeek, Groq, Ollama) • 393 Optimized Tools • 2 MCP Servers • Multi-agent orchestration • Use ANY AI coding assistant (ML tools moved to Enterprise)",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
@@ -52,8 +52,10 @@
52
52
  "test:unified": "node dist/mcp/servicenow-mcp-unified/scripts/validate-tools.js",
53
53
  "test:integration": "npm run build && node dist/tests/integration-test.js",
54
54
  "update-deps": "node scripts/update-dependencies.js",
55
+ "check-binaries": "node scripts/check-binary-updates.js",
56
+ "update-binaries": "node scripts/check-binary-updates.js --auto-update",
55
57
  "postbuild-disabled": "npm run setup-mcp",
56
- "postinstall": "patch-package && node scripts/postinstall.js || true",
58
+ "postinstall": "patch-package && node scripts/postinstall.js && node scripts/check-binary-updates.js --silent || true",
57
59
  "version": "node scripts/update-version.js && npm run build && git add src/version.ts",
58
60
  "postversion": "git push temp main && git push temp --tags"
59
61
  },
@@ -0,0 +1,169 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Check for and install updated snow-code binary packages
5
+ * Runs at runtime to ensure users always have the latest binaries
6
+ */
7
+
8
+ const { execSync } = require('child_process');
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+
12
+ const BINARY_PACKAGES = [
13
+ '@groeimetai/snow-code-darwin-arm64',
14
+ '@groeimetai/snow-code-darwin-x64',
15
+ '@groeimetai/snow-code-linux-arm64',
16
+ '@groeimetai/snow-code-linux-x64',
17
+ '@groeimetai/snow-code-windows-x64'
18
+ ];
19
+
20
+ async function getLatestVersionFromNPM(packageName) {
21
+ try {
22
+ const version = execSync(`npm view ${packageName} version 2>/dev/null`, {
23
+ encoding: 'utf8',
24
+ stdio: ['pipe', 'pipe', 'ignore'] // Suppress stderr
25
+ }).trim();
26
+ return version || null;
27
+ } catch (error) {
28
+ return null;
29
+ }
30
+ }
31
+
32
+ async function getInstalledVersion(packageName) {
33
+ try {
34
+ const packageJsonPath = path.join(__dirname, '..', 'node_modules', packageName, 'package.json');
35
+ if (!fs.existsSync(packageJsonPath)) {
36
+ return null;
37
+ }
38
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
39
+ return packageJson.version;
40
+ } catch (error) {
41
+ return null;
42
+ }
43
+ }
44
+
45
+ async function checkBinaryUpdates(options = {}) {
46
+ const { silent = false, autoUpdate = false } = options;
47
+
48
+ if (!silent) {
49
+ console.log('🔍 Checking for snow-code binary updates...\n');
50
+ }
51
+
52
+ const updates = [];
53
+ const errors = [];
54
+
55
+ for (const packageName of BINARY_PACKAGES) {
56
+ try {
57
+ const [latest, installed] = await Promise.all([
58
+ getLatestVersionFromNPM(packageName),
59
+ getInstalledVersion(packageName)
60
+ ]);
61
+
62
+ if (!latest) {
63
+ if (!silent) {
64
+ console.log(`⚠️ ${packageName}: Not available on npm`);
65
+ }
66
+ continue;
67
+ }
68
+
69
+ if (!installed) {
70
+ if (!silent) {
71
+ console.log(`📦 ${packageName}: Not installed (latest: ${latest})`);
72
+ }
73
+ updates.push({ package: packageName, from: null, to: latest });
74
+ continue;
75
+ }
76
+
77
+ if (installed !== latest) {
78
+ if (!silent) {
79
+ console.log(`🔄 ${packageName}: ${installed} → ${latest}`);
80
+ }
81
+ updates.push({ package: packageName, from: installed, to: latest });
82
+ } else {
83
+ if (!silent) {
84
+ console.log(`✅ ${packageName}: ${installed} (up to date)`);
85
+ }
86
+ }
87
+ } catch (error) {
88
+ errors.push({ package: packageName, error: error.message });
89
+ if (!silent) {
90
+ console.log(`❌ ${packageName}: Error checking version`);
91
+ }
92
+ }
93
+ }
94
+
95
+ console.log('');
96
+
97
+ if (updates.length === 0) {
98
+ if (!silent) {
99
+ console.log('✨ All binaries are up to date!\n');
100
+ }
101
+ return { updates: [], errors, updated: false };
102
+ }
103
+
104
+ if (!silent) {
105
+ console.log(`📥 Found ${updates.length} update(s) available\n`);
106
+ }
107
+
108
+ if (autoUpdate) {
109
+ if (!silent) {
110
+ console.log('⚡ Auto-updating binaries...\n');
111
+ }
112
+
113
+ for (const { package: packageName, to } of updates) {
114
+ try {
115
+ if (!silent) {
116
+ console.log(` Installing ${packageName}@${to}...`);
117
+ }
118
+ execSync(`npm install --no-save --prefer-offline ${packageName}@${to}`, {
119
+ encoding: 'utf8',
120
+ stdio: silent ? 'ignore' : 'inherit'
121
+ });
122
+ } catch (error) {
123
+ errors.push({ package: packageName, error: error.message });
124
+ if (!silent) {
125
+ console.log(` ❌ Failed to install ${packageName}`);
126
+ }
127
+ }
128
+ }
129
+
130
+ if (!silent) {
131
+ console.log('\n✅ Binary updates completed!\n');
132
+ }
133
+ return { updates, errors, updated: true };
134
+ }
135
+
136
+ // If not auto-updating, show instructions
137
+ if (!silent) {
138
+ console.log('To update binaries, run:\n');
139
+ console.log(' npm run update-binaries\n');
140
+ console.log('Or manually:');
141
+ for (const { package: packageName, to } of updates) {
142
+ console.log(` npm install ${packageName}@${to}`);
143
+ }
144
+ console.log('');
145
+ }
146
+
147
+ return { updates, errors, updated: false };
148
+ }
149
+
150
+ // CLI interface
151
+ if (require.main === module) {
152
+ const args = process.argv.slice(2);
153
+ const silent = args.includes('--silent') || args.includes('-s');
154
+ const autoUpdate = args.includes('--auto-update') || args.includes('-u');
155
+
156
+ checkBinaryUpdates({ silent, autoUpdate })
157
+ .then(result => {
158
+ if (result.errors.length > 0 && !silent) {
159
+ console.log(`⚠️ ${result.errors.length} error(s) occurred during check`);
160
+ }
161
+ process.exit(0);
162
+ })
163
+ .catch(error => {
164
+ console.error('❌ Failed to check binary updates:', error.message);
165
+ process.exit(1);
166
+ });
167
+ }
168
+
169
+ module.exports = { checkBinaryUpdates };