xypriss 9.14.21 → 9.14.23

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/dist/index.d.ts CHANGED
@@ -5319,23 +5319,16 @@ declare class EnvApi implements IEnvApi {
5319
5319
  */
5320
5320
  user(): string;
5321
5321
  /**
5322
- * Returns the internal store, throwing {@link EnvStoreError} if it has not
5323
- * yet been initialised.
5322
+ * Resolves the authorized project root for the current caller using native V8 C++ CallSites.
5324
5323
  *
5325
- * SECURITY: This is the single point of store access. Every read and write
5326
- * method must go through here — never access `globalThis[XY_ENV_STORE_KEY]`
5327
- * directly outside this method.
5328
- *
5329
- * Eliminating the `?? process.env` fallback is intentional. A silent
5330
- * fallback to `process.env` during the bootstrap race window would bypass
5331
- * the Shield and leak values without any warning. A thrown error is
5332
- * immediately visible during development and integration testing.
5324
+ * SECURITY POLICY:
5325
+ * - If the caller originates from an undeclared `node_modules/` dependency or dynamic `eval` / `new Function`,
5326
+ * `callerInfo.isUntrusted` is true and this method returns `null` (NEVER falling back to `this.runner.getRoot()`).
5327
+ * - Zero secrets are stored in JavaScript RAM; all queries go through `this.runner.runSync("env", ...)` (`libSynapx`).
5333
5328
  *
5334
5329
  * @internal
5335
- * @throws {EnvStoreError}
5336
5330
  */
5337
- private requireStoreMap;
5338
- private getStoreForCaller;
5331
+ private resolveAuthorizedRoot;
5339
5332
  /**
5340
5333
  * Asserts that `key` is a valid environment variable name.
5341
5334
  *
@@ -15572,7 +15565,7 @@ declare function normalizeXtrsRules(config: any): XtrsParsedRule[];
15572
15565
  */
15573
15566
  declare function identifyProjectRoot(filePath: string): string | undefined;
15574
15567
  /**
15575
- * Retrieves the project root of the code currently executing by analyzing the stack trace.
15568
+ * Retrieves the project root of the code currently executing by analyzing the native V8 call stack.
15576
15569
  */
15577
15570
  declare function getCallerProjectRoot(): string | undefined;
15578
15571
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xypriss",
3
- "version": "9.14.21",
3
+ "version": "9.14.23",
4
4
  "description": "XyPriss is a high-performance, TypeScript-first hyper-system web framework powered by a native Go core (XHSC), featuring robust multi-tenant sandboxing, secure native file streaming, and zero Express dependencies.",
5
5
  "author": {
6
6
  "DEV.to": "https://dev.to/nehonix",
@@ -8,6 +8,7 @@
8
8
 
9
9
  import fs from "fs";
10
10
  import path from "path";
11
+ import crypto from "crypto";
11
12
  import { fileURLToPath } from "url";
12
13
  import https from "https";
13
14
  import zlib from "node:zlib";
@@ -105,8 +106,11 @@ function getPlatformBinary() {
105
106
  platform,
106
107
  arch,
107
108
  url: `https://github.com/${REPO}/releases/latest/download/${archiveName}`,
109
+ rawUrl: `https://github.com/${REPO}/releases/latest/download/${binaryName}`,
108
110
  fallbackUrl: `${CDN_BASE_URL}/${archiveName}`,
111
+ rawFallbackUrl: `${CDN_BASE_URL}/${binaryName}`,
109
112
  localPath: path.join(BIN_DIR, binaryName),
113
+ tmpPath: path.join(BIN_DIR, `${binaryName}.tmp`),
110
114
  genericPath: path.join(BIN_DIR, `xems${ext}`),
111
115
  };
112
116
  }
@@ -246,6 +250,112 @@ function downloadFile(url, dest, isGz = true) {
246
250
  });
247
251
  }
248
252
 
253
+ // ─────────────────────────────────────────────
254
+ // Binary Integrity Verification
255
+ // ─────────────────────────────────────────────
256
+
257
+ const MIN_XEMS_SIZE = 2 * 1024 * 1024; // 2 MB minimum for XEMS binary
258
+
259
+ /**
260
+ * Verifies the structural & cryptographic integrity of a native binary.
261
+ */
262
+ function verifyBinaryIntegrity(filePath, osName, archName) {
263
+ if (!fs.existsSync(filePath)) {
264
+ return { valid: false, reason: "File does not exist" };
265
+ }
266
+
267
+ const stat = fs.statSync(filePath);
268
+ if (stat.size < MIN_XEMS_SIZE) {
269
+ return {
270
+ valid: false,
271
+ reason: `File too small (${formatBytes(stat.size)} < ${formatBytes(MIN_XEMS_SIZE)})`,
272
+ };
273
+ }
274
+
275
+ const fd = fs.openSync(filePath, "r");
276
+ const header = Buffer.alloc(512);
277
+ let bytesRead = 0;
278
+ try {
279
+ bytesRead = fs.readSync(fd, header, 0, header.length, 0);
280
+ } finally {
281
+ fs.closeSync(fd);
282
+ }
283
+
284
+ if (bytesRead < 64) {
285
+ return { valid: false, reason: "Truncated binary header" };
286
+ }
287
+
288
+ if (header[0] === 0x1f && header[1] === 0x8b) {
289
+ return { valid: false, reason: "Binary is still gzip-compressed" };
290
+ }
291
+
292
+ let formatLabel = "";
293
+ if (osName === "linux") {
294
+ if (
295
+ header[0] !== 0x7f ||
296
+ header[1] !== 0x45 ||
297
+ header[2] !== 0x4c ||
298
+ header[3] !== 0x46
299
+ ) {
300
+ return { valid: false, reason: "Invalid ELF magic header" };
301
+ }
302
+ if (header[4] !== 2) {
303
+ return { valid: false, reason: "Expected 64-bit ELF class" };
304
+ }
305
+ const eMachine = header.readUInt16LE(18);
306
+ const expectedMachine = archName === "arm64" ? 0xb7 : 0x3e;
307
+ if (eMachine !== expectedMachine) {
308
+ return {
309
+ valid: false,
310
+ reason: `ELF architecture mismatch (got 0x${eMachine.toString(16)}, expected 0x${expectedMachine.toString(16)})`,
311
+ };
312
+ }
313
+ formatLabel = `ELF64/${archName}`;
314
+ } else if (osName === "darwin") {
315
+ const magic = header.readUInt32BE(0);
316
+ const validMachO =
317
+ magic === 0xcffaedfe ||
318
+ magic === 0xfeedfacf ||
319
+ magic === 0xcafebabe ||
320
+ magic === 0xbebafeca;
321
+ if (!validMachO) {
322
+ return {
323
+ valid: false,
324
+ reason: `Invalid Mach-O magic header (0x${magic.toString(16)})`,
325
+ };
326
+ }
327
+ formatLabel = `Mach-O/${archName}`;
328
+ } else if (osName === "win32") {
329
+ if (header[0] !== 0x4d || header[1] !== 0x5a) {
330
+ return { valid: false, reason: "Invalid PE MZ header" };
331
+ }
332
+ const peOffset = header.readUInt32LE(0x3c);
333
+ if (peOffset > 0 && peOffset + 6 <= bytesRead) {
334
+ if (
335
+ header[peOffset] !== 0x50 ||
336
+ header[peOffset + 1] !== 0x45 ||
337
+ header[peOffset + 2] !== 0x00 ||
338
+ header[peOffset + 3] !== 0x00
339
+ ) {
340
+ return { valid: false, reason: "Invalid PE signature" };
341
+ }
342
+ }
343
+ formatLabel = `PE32+/${archName}`;
344
+ }
345
+
346
+ const hash = crypto.createHash("sha256");
347
+ const data = fs.readFileSync(filePath);
348
+ hash.update(data);
349
+ const sha256 = hash.digest("hex");
350
+
351
+ return {
352
+ valid: true,
353
+ size: stat.size,
354
+ format: formatLabel,
355
+ sha256,
356
+ };
357
+ }
358
+
249
359
  // ─────────────────────────────────────────────
250
360
  // Main Installer
251
361
  // ─────────────────────────────────────────────
@@ -276,32 +386,110 @@ async function installXems() {
276
386
  log.info(
277
387
  `Platform : ${c.yellow}${info.platform}${c.reset} ${c.gray}(${info.arch})${c.reset}`,
278
388
  );
279
- log.info(`Binary : ${c.yellow}${info.binaryName}${c.reset}`);
389
+ log.info(`Binary : ${c.yellow}${info.binaryName} ${c.dim}(via ${info.archiveName})${c.reset}`);
280
390
  log.info(`Target : ${c.yellow}${BIN_DIR}${c.reset}`);
281
391
  log.blank();
282
392
 
283
- // Skip if already installed
284
- if (fs.existsSync(info.genericPath)) {
285
- log.success(`XEMS is already installed → ${info.genericPath}`);
286
- log.blank();
287
- return;
393
+ // Skip if already installed and passes integrity verification
394
+ const checkTarget = fs.existsSync(info.genericPath)
395
+ ? info.genericPath
396
+ : fs.existsSync(info.localPath)
397
+ ? info.localPath
398
+ : null;
399
+ if (checkTarget) {
400
+ try {
401
+ const integrity = verifyBinaryIntegrity(
402
+ checkTarget,
403
+ info.platform,
404
+ info.arch,
405
+ );
406
+ if (integrity.valid) {
407
+ if (info.platform !== "win32") {
408
+ try { fs.chmodSync(checkTarget, 0o755); } catch {}
409
+ }
410
+ if (!fs.existsSync(info.genericPath)) {
411
+ if (info.platform === "win32") {
412
+ fs.copyFileSync(info.localPath, info.genericPath);
413
+ } else {
414
+ fs.symlinkSync(
415
+ path.basename(info.localPath),
416
+ info.genericPath,
417
+ );
418
+ }
419
+ }
420
+ log.info(
421
+ `Integrity : ${c.green}✔ Verified${c.reset} ${c.gray}(${integrity.format}, ${formatBytes(integrity.size)}, sha256:${integrity.sha256.slice(0, 12)}…)${c.reset}`,
422
+ );
423
+ log.success(`XEMS is already installed → ${info.genericPath}`);
424
+ log.blank();
425
+ return;
426
+ } else {
427
+ log.warn(
428
+ `Existing binary failed integrity check (${integrity.reason}), re-downloading…`,
429
+ );
430
+ try { fs.unlinkSync(info.genericPath); } catch {}
431
+ try { fs.unlinkSync(info.localPath); } catch {}
432
+ }
433
+ } catch {
434
+ // Re-download on verification error
435
+ }
288
436
  }
289
437
 
290
- // Attempt GitHub download, then fallback CDN
438
+ // Attempt GitHub download (.gz then raw), then fallback CDN (.gz then raw)
291
439
  log.step("Downloading XEMS binary…");
292
440
  try {
293
- try {
294
- log.link("GitHub", info.url);
295
- await downloadFile(info.url, info.localPath);
296
- log.success("Downloaded from GitHub.");
297
- } catch (githubErr) {
298
- log.warn(`GitHub download failed: ${githubErr.message}`);
299
- log.step("Retrying with fallback CDN…");
300
- log.link("CDN", info.fallbackUrl);
301
- await downloadFile(info.fallbackUrl, info.localPath);
302
- log.success("Downloaded from fallback CDN.");
441
+ if (fs.existsSync(info.tmpPath)) {
442
+ try { fs.unlinkSync(info.tmpPath); } catch {}
303
443
  }
304
444
 
445
+ const sources = [
446
+ { label: "GitHub (.gz)", url: info.url, isGz: true },
447
+ { label: "GitHub (raw)", url: info.rawUrl, isGz: false },
448
+ { label: "CDN (.gz)", url: info.fallbackUrl, isGz: true },
449
+ { label: "CDN (raw)", url: info.rawFallbackUrl, isGz: false },
450
+ ];
451
+
452
+ let downloaded = false;
453
+ let lastErr = null;
454
+ for (const src of sources) {
455
+ try {
456
+ log.link(src.label, src.url);
457
+ await downloadFile(src.url, info.tmpPath, src.isGz);
458
+ log.success(`Downloaded from ${src.label}.`);
459
+ downloaded = true;
460
+ break;
461
+ } catch (err) {
462
+ lastErr = err;
463
+ log.warn(`${src.label} download failed: ${err.message}`);
464
+ }
465
+ }
466
+
467
+ if (!downloaded) {
468
+ throw lastErr || new Error("All download sources failed");
469
+ }
470
+
471
+ // Verify downloaded binary integrity before committing
472
+ log.step("Verifying binary integrity…");
473
+ const integrity = verifyBinaryIntegrity(
474
+ info.tmpPath,
475
+ info.platform,
476
+ info.arch,
477
+ );
478
+ if (!integrity.valid) {
479
+ try { fs.unlinkSync(info.tmpPath); } catch {}
480
+ throw new Error(`Binary integrity check failed: ${integrity.reason}`);
481
+ }
482
+
483
+ log.info(
484
+ `Integrity : ${c.green}✔ Verified${c.reset} ${c.gray}(${integrity.format}, ${formatBytes(integrity.size)}, sha256:${integrity.sha256.slice(0, 16)}…)${c.reset}`,
485
+ );
486
+
487
+ // Atomic promotion from .tmp to final target
488
+ if (fs.existsSync(info.localPath)) {
489
+ try { fs.unlinkSync(info.localPath); } catch {}
490
+ }
491
+ fs.renameSync(info.tmpPath, info.localPath);
492
+
305
493
  // Set executable bit on Unix
306
494
  if (process.platform !== "win32") {
307
495
  fs.chmodSync(info.localPath, 0o755);
@@ -324,8 +512,15 @@ async function installXems() {
324
512
  `XEMS successfully installed at: ${c.bold}${info.genericPath}${c.reset}`,
325
513
  );
326
514
  } catch (err) {
515
+ if (fs.existsSync(info.tmpPath)) {
516
+ try { fs.unlinkSync(info.tmpPath); } catch {}
517
+ }
327
518
  log.blank();
328
519
  log.error(`XEMS installation failed: ${err.message}`);
520
+ log.blank();
521
+ log.divider();
522
+ log.blank();
523
+ throw err;
329
524
  }
330
525
 
331
526
  log.blank();
@@ -8,6 +8,7 @@
8
8
 
9
9
  import fs from "fs";
10
10
  import path from "path";
11
+ import crypto from "crypto";
11
12
  import { platform, arch } from "os";
12
13
  import https from "https";
13
14
  import zlib from "node:zlib";
@@ -216,6 +217,122 @@ function downloadFile(url, dest, isGz = false) {
216
217
  });
217
218
  }
218
219
 
220
+ // ─────────────────────────────────────────────
221
+ // Binary Integrity Verification
222
+ // ─────────────────────────────────────────────
223
+
224
+ const MIN_XHSC_SIZE = 10 * 1024 * 1024; // 10 MB minimum for stripped/garbled XHSC binary
225
+
226
+ /**
227
+ * Verifies the structural & cryptographic integrity of a native binary.
228
+ * Checks:
229
+ * 1. File existence and minimum size bounds
230
+ * 2. Native OS executable header magic (ELF64 / Mach-O 64 / PE32+)
231
+ * 3. Target CPU architecture field in header
232
+ * 4. Computes SHA-256 digest of the binary
233
+ */
234
+ function verifyBinaryIntegrity(filePath, osName, archName) {
235
+ if (!fs.existsSync(filePath)) {
236
+ return { valid: false, reason: "File does not exist" };
237
+ }
238
+
239
+ const stat = fs.statSync(filePath);
240
+ if (stat.size < MIN_XHSC_SIZE) {
241
+ return {
242
+ valid: false,
243
+ reason: `File too small (${formatBytes(stat.size)} < ${formatBytes(MIN_XHSC_SIZE)})`,
244
+ };
245
+ }
246
+
247
+ const fd = fs.openSync(filePath, "r");
248
+ const header = Buffer.alloc(512);
249
+ let bytesRead = 0;
250
+ try {
251
+ bytesRead = fs.readSync(fd, header, 0, header.length, 0);
252
+ } finally {
253
+ fs.closeSync(fd);
254
+ }
255
+
256
+ if (bytesRead < 64) {
257
+ return { valid: false, reason: "Truncated binary header" };
258
+ }
259
+
260
+ // Reject unextracted gzip or HTML error pages
261
+ if (header[0] === 0x1f && header[1] === 0x8b) {
262
+ return { valid: false, reason: "Binary is still gzip-compressed" };
263
+ }
264
+
265
+ let formatLabel = "";
266
+ if (osName === "linux") {
267
+ // ELF magic: 0x7F 'E' 'L' 'F'
268
+ if (
269
+ header[0] !== 0x7f ||
270
+ header[1] !== 0x45 ||
271
+ header[2] !== 0x4c ||
272
+ header[3] !== 0x46
273
+ ) {
274
+ return { valid: false, reason: "Invalid ELF magic header" };
275
+ }
276
+ if (header[4] !== 2) {
277
+ return { valid: false, reason: "Expected 64-bit ELF class" };
278
+ }
279
+ const eMachine = header.readUInt16LE(18);
280
+ const expectedMachine = archName === "arm64" ? 0xb7 : 0x3e;
281
+ if (eMachine !== expectedMachine) {
282
+ return {
283
+ valid: false,
284
+ reason: `ELF architecture mismatch (got 0x${eMachine.toString(16)}, expected 0x${expectedMachine.toString(16)})`,
285
+ };
286
+ }
287
+ formatLabel = `ELF64/${archName}`;
288
+ } else if (osName === "darwin") {
289
+ // Mach-O 64-bit (0xCFFAEDFE LE / 0xFEEDFACF BE) or Universal (0xCAFEBABE / 0xBEBAFECA)
290
+ const magic = header.readUInt32BE(0);
291
+ const validMachO =
292
+ magic === 0xcffaedfe ||
293
+ magic === 0xfeedfacf ||
294
+ magic === 0xcafebabe ||
295
+ magic === 0xbebafeca;
296
+ if (!validMachO) {
297
+ return {
298
+ valid: false,
299
+ reason: `Invalid Mach-O magic header (0x${magic.toString(16)})`,
300
+ };
301
+ }
302
+ formatLabel = `Mach-O/${archName}`;
303
+ } else if (osName === "win32") {
304
+ // PE MZ header: 'M' 'Z' (0x4D 0x5A)
305
+ if (header[0] !== 0x4d || header[1] !== 0x5a) {
306
+ return { valid: false, reason: "Invalid PE MZ header" };
307
+ }
308
+ const peOffset = header.readUInt32LE(0x3c);
309
+ if (peOffset > 0 && peOffset + 6 <= bytesRead) {
310
+ if (
311
+ header[peOffset] !== 0x50 ||
312
+ header[peOffset + 1] !== 0x45 ||
313
+ header[peOffset + 2] !== 0x00 ||
314
+ header[peOffset + 3] !== 0x00
315
+ ) {
316
+ return { valid: false, reason: "Invalid PE signature" };
317
+ }
318
+ }
319
+ formatLabel = `PE32+/${archName}`;
320
+ }
321
+
322
+ // Compute SHA-256 digest
323
+ const hash = crypto.createHash("sha256");
324
+ const data = fs.readFileSync(filePath);
325
+ hash.update(data);
326
+ const sha256 = hash.digest("hex");
327
+
328
+ return {
329
+ valid: true,
330
+ size: stat.size,
331
+ format: formatLabel,
332
+ sha256,
333
+ };
334
+ }
335
+
219
336
  // ─────────────────────────────────────────────
220
337
  // Main Installer
221
338
  // ─────────────────────────────────────────────
@@ -255,7 +372,9 @@ async function installXHSC() {
255
372
  const binaryFileName = `${BIN_NAME}-${binaryTarget}${ext}`;
256
373
  const gzFileName = `${binaryFileName}.gz`;
257
374
  const gzUrl = `https://github.com/${REPO}/releases/latest/download/${gzFileName}`;
375
+ const rawUrl = `https://github.com/${REPO}/releases/latest/download/${binaryFileName}`;
258
376
  const localPath = join(BIN_DIR, binaryFileName);
377
+ const tmpPath = `${localPath}.tmp`;
259
378
  const genericPath = join(BIN_DIR, `${BIN_NAME}${ext}`);
260
379
 
261
380
  log.info(
@@ -265,13 +384,23 @@ async function installXHSC() {
265
384
  log.info(`Target : ${c.yellow}${BIN_DIR}${c.reset}`);
266
385
  log.blank();
267
386
 
268
- // Skip if already installed and healthy
269
- const checkTarget = fs.existsSync(genericPath) ? genericPath : (fs.existsSync(localPath) ? localPath : null);
387
+ // Skip if already installed and passes integrity verification
388
+ const checkTarget = fs.existsSync(genericPath)
389
+ ? genericPath
390
+ : fs.existsSync(localPath)
391
+ ? localPath
392
+ : null;
270
393
  if (checkTarget) {
271
394
  try {
272
- const stat = fs.statSync(checkTarget);
273
- if (stat.size > 30 * 1024 * 1024) {
274
- // Ensure generic alias exists
395
+ const integrity = verifyBinaryIntegrity(
396
+ checkTarget,
397
+ osName,
398
+ archName,
399
+ );
400
+ if (integrity.valid) {
401
+ if (osName !== "win32") {
402
+ try { fs.chmodSync(checkTarget, 0o755); } catch {}
403
+ }
275
404
  if (!fs.existsSync(genericPath)) {
276
405
  if (osName === "win32") {
277
406
  fs.copyFileSync(localPath, genericPath);
@@ -279,25 +408,58 @@ async function installXHSC() {
279
408
  fs.symlinkSync(basename(localPath), genericPath);
280
409
  }
281
410
  }
411
+ log.info(
412
+ `Integrity : ${c.green}✔ Verified${c.reset} ${c.gray}(${integrity.format}, ${formatBytes(integrity.size)}, sha256:${integrity.sha256.slice(0, 12)}…)${c.reset}`,
413
+ );
282
414
  log.success(`XHSC is already installed → ${genericPath}`);
283
415
  log.blank();
284
416
  return;
285
417
  } else {
286
- log.warn(`Existing binary is corrupted or incomplete (${formatBytes(stat.size)}), re-downloading…`);
418
+ log.warn(
419
+ `Existing binary failed integrity check (${integrity.reason}), re-downloading…`,
420
+ );
287
421
  try { fs.unlinkSync(genericPath); } catch {}
288
422
  try { fs.unlinkSync(localPath); } catch {}
289
423
  }
290
424
  } catch {
291
- // Re-download on stat error
425
+ // Re-download on verification error
292
426
  }
293
427
  }
294
428
 
295
- // Download exclusively compressed .gz archive
429
+ // Download compressed .gz archive to temporary file, fallback to raw if needed
296
430
  log.step("Downloading compressed XHSC binary (.gz)…");
297
431
  log.link("GitHub", gzUrl);
298
432
 
299
433
  try {
300
- await downloadFile(gzUrl, localPath, true);
434
+ if (fs.existsSync(tmpPath)) {
435
+ try { fs.unlinkSync(tmpPath); } catch {}
436
+ }
437
+
438
+ try {
439
+ await downloadFile(gzUrl, tmpPath, true);
440
+ } catch (gzErr) {
441
+ log.warn(`Compressed archive download failed (${gzErr.message}), trying raw binary…`);
442
+ log.link("GitHub (raw)", rawUrl);
443
+ await downloadFile(rawUrl, tmpPath, false);
444
+ }
445
+
446
+ // Verify downloaded binary integrity before committing
447
+ log.step("Verifying binary integrity…");
448
+ const integrity = verifyBinaryIntegrity(tmpPath, osName, archName);
449
+ if (!integrity.valid) {
450
+ try { fs.unlinkSync(tmpPath); } catch {}
451
+ throw new Error(`Binary integrity check failed: ${integrity.reason}`);
452
+ }
453
+
454
+ log.info(
455
+ `Integrity : ${c.green}✔ Verified${c.reset} ${c.gray}(${integrity.format}, ${formatBytes(integrity.size)}, sha256:${integrity.sha256.slice(0, 16)}…)${c.reset}`,
456
+ );
457
+
458
+ // Atomic promotion from .tmp to final target
459
+ if (fs.existsSync(localPath)) {
460
+ try { fs.unlinkSync(localPath); } catch {}
461
+ }
462
+ fs.renameSync(tmpPath, localPath);
301
463
 
302
464
  // Set executable bit on Unix
303
465
  if (osName !== "win32") {
@@ -320,8 +482,15 @@ async function installXHSC() {
320
482
  `XHSC successfully installed at: ${c.bold}${genericPath}${c.reset}`,
321
483
  );
322
484
  } catch (err) {
485
+ if (fs.existsSync(tmpPath)) {
486
+ try { fs.unlinkSync(tmpPath); } catch {}
487
+ }
323
488
  log.blank();
324
489
  log.error(`XHSC installation failed: ${err.message}`);
490
+ log.blank();
491
+ log.divider();
492
+ log.blank();
493
+ throw err;
325
494
  }
326
495
 
327
496
  log.blank();