snow-flow 9.0.23 → 9.0.25
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 +1 -1
- package/postinstall.cjs +24 -1
package/package.json
CHANGED
package/postinstall.cjs
CHANGED
|
@@ -27,6 +27,17 @@ function getVersion() {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
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' });
|
|
35
|
+
return result.trim();
|
|
36
|
+
} catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
30
41
|
// Follow redirects and download file
|
|
31
42
|
function download(url) {
|
|
32
43
|
return new Promise((resolve, reject) => {
|
|
@@ -141,8 +152,20 @@ async function downloadMcpServers() {
|
|
|
141
152
|
}
|
|
142
153
|
|
|
143
154
|
async function main() {
|
|
144
|
-
|
|
155
|
+
const packageVersion = getVersion();
|
|
156
|
+
const binaryVersion = getBinaryVersion();
|
|
157
|
+
|
|
158
|
+
// Download binary if missing or version mismatch
|
|
145
159
|
if (!fs.existsSync(binaryPath)) {
|
|
160
|
+
console.log('Binary not found, downloading...');
|
|
161
|
+
await downloadBinary();
|
|
162
|
+
} else if (packageVersion && binaryVersion && packageVersion !== binaryVersion) {
|
|
163
|
+
console.log(`Version mismatch: binary is ${binaryVersion}, package is ${packageVersion}`);
|
|
164
|
+
console.log('Downloading correct version...');
|
|
165
|
+
// Remove old binary first
|
|
166
|
+
try {
|
|
167
|
+
fs.unlinkSync(binaryPath);
|
|
168
|
+
} catch {}
|
|
146
169
|
await downloadBinary();
|
|
147
170
|
} else {
|
|
148
171
|
// Make sure it's executable
|