From aa5c45d78d0e5fd6dbb280ba39d6e615c5c2ad10 Mon Sep 17 00:00:00 2001 From: Karun Agarwal Date: Tue, 27 Jan 2026 13:45:17 +0530 Subject: [PATCH] fix(build): use Node.js for cross-platform file hashing in bundle script The bundle-a2ui.sh script was using shasum which is not available on Windows (Git Bash), causing CI failures. Replace with a Node.js-based hash computation script that works on all platforms. Fixes Windows CI build failures with "shasum: command not found". Co-Authored-By: Claude Sonnet 4.5 (1M context) --- scripts/bundle-a2ui.sh | 5 ++--- scripts/compute-file-hash.mjs | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100755 scripts/compute-file-hash.mjs diff --git a/scripts/bundle-a2ui.sh b/scripts/bundle-a2ui.sh index a1cf7ff2b..8c7d05fd0 100755 --- a/scripts/bundle-a2ui.sh +++ b/scripts/bundle-a2ui.sh @@ -30,11 +30,10 @@ collect_files() { } compute_hash() { + # Use Node.js for cross-platform hash computation (works on Windows, macOS, Linux) collect_files \ | LC_ALL=C sort -z \ - | xargs -0 shasum -a 256 \ - | shasum -a 256 \ - | awk '{print $1}' + | xargs -0 node "$ROOT_DIR/scripts/compute-file-hash.mjs" } current_hash="$(compute_hash)" diff --git a/scripts/compute-file-hash.mjs b/scripts/compute-file-hash.mjs new file mode 100755 index 000000000..3cdeff176 --- /dev/null +++ b/scripts/compute-file-hash.mjs @@ -0,0 +1,19 @@ +#!/usr/bin/env node +import { createHash } from "node:crypto"; +import { readFileSync } from "node:fs"; + +// Compute SHA-256 hash of all input files (cross-platform) +const files = process.argv.slice(2); +const hash = createHash("sha256"); + +for (const file of files) { + try { + const content = readFileSync(file); + hash.update(content); + } catch (err) { + // Skip files that don't exist or can't be read + process.stderr.write(`Warning: Could not read ${file}: ${err.message}\n`); + } +} + +console.log(hash.digest("hex"));