@muggleai/mcp 1.0.6 → 1.0.7
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/scripts/postinstall.mjs +33 -6
package/package.json
CHANGED
package/scripts/postinstall.mjs
CHANGED
|
@@ -150,10 +150,17 @@ async function downloadElectronApp() {
|
|
|
150
150
|
mkdirSync(versionDir, { recursive: true });
|
|
151
151
|
|
|
152
152
|
// Download using fetch
|
|
153
|
+
console.log("Fetching...");
|
|
153
154
|
const response = await fetch(downloadUrl);
|
|
154
155
|
if (!response.ok) {
|
|
155
|
-
|
|
156
|
+
const errorBody = await response.text().catch(() => "");
|
|
157
|
+
throw new Error(
|
|
158
|
+
`Download failed: ${response.status} ${response.statusText}\n` +
|
|
159
|
+
`URL: ${downloadUrl}\n` +
|
|
160
|
+
`Response body: ${errorBody.substring(0, 500)}`
|
|
161
|
+
);
|
|
156
162
|
}
|
|
163
|
+
console.log(`Response OK (${response.status}), downloading ${response.headers.get("content-length") || "unknown"} bytes...`);
|
|
157
164
|
|
|
158
165
|
const tempFile = join(versionDir, binaryName);
|
|
159
166
|
const fileStream = createWriteStream(tempFile);
|
|
@@ -199,9 +206,26 @@ async function downloadElectronApp() {
|
|
|
199
206
|
|
|
200
207
|
console.log(`Electron app installed to ${versionDir}`);
|
|
201
208
|
} catch (error) {
|
|
202
|
-
console.
|
|
203
|
-
console.
|
|
204
|
-
console.
|
|
209
|
+
console.error("\n========================================");
|
|
210
|
+
console.error("ERROR: Failed to download Electron app");
|
|
211
|
+
console.error("========================================\n");
|
|
212
|
+
console.error("Error message:", error.message);
|
|
213
|
+
console.error("\nFull error details:");
|
|
214
|
+
console.error(error.stack || error);
|
|
215
|
+
console.error("\nDebug info:");
|
|
216
|
+
console.error(" - Platform:", platform());
|
|
217
|
+
console.error(" - Architecture:", process.arch);
|
|
218
|
+
console.error(" - Node version:", process.version);
|
|
219
|
+
try {
|
|
220
|
+
const packageJson = require("../package.json");
|
|
221
|
+
const config = packageJson.muggleConfig || {};
|
|
222
|
+
console.error(" - Electron app version:", config.electronAppVersion || "unknown");
|
|
223
|
+
console.error(" - Download URL:", `${config.downloadBaseUrl}/v${config.electronAppVersion}/${getBinaryName()}`);
|
|
224
|
+
} catch {
|
|
225
|
+
console.error(" - Could not read package.json config");
|
|
226
|
+
}
|
|
227
|
+
console.error("\nYou can manually download it later using: muggle-mcp setup");
|
|
228
|
+
console.error("Or set ELECTRON_APP_PATH to point to an existing installation.\n");
|
|
205
229
|
}
|
|
206
230
|
}
|
|
207
231
|
|
|
@@ -216,9 +240,12 @@ async function extractZip(zipPath, destDir) {
|
|
|
216
240
|
? `powershell -command "Expand-Archive -Path '${zipPath}' -DestinationPath '${destDir}' -Force"`
|
|
217
241
|
: `unzip -o "${zipPath}" -d "${destDir}"`;
|
|
218
242
|
|
|
219
|
-
exec(cmd, (error) => {
|
|
243
|
+
exec(cmd, (error, stdout, stderr) => {
|
|
220
244
|
if (error) {
|
|
221
|
-
|
|
245
|
+
console.error("Extraction command failed:", cmd);
|
|
246
|
+
console.error("stdout:", stdout);
|
|
247
|
+
console.error("stderr:", stderr);
|
|
248
|
+
reject(new Error(`Extraction failed: ${error.message}\nstderr: ${stderr}`));
|
|
222
249
|
} else {
|
|
223
250
|
resolve();
|
|
224
251
|
}
|