From 997868f81544374985bfa5feb2b531654da6f1b5 Mon Sep 17 00:00:00 2001 From: Tyler Butler Date: Tue, 2 Jun 2026 08:57:15 -0700 Subject: [PATCH] fix: make ci-readiness-check.sh compatible with bash 3.2 macOS ships bash 3.2, which lacks associative arrays (declare -A) and mapfile/readarray (bash 4+ features). Replace the associative-array package dedup with a newline-delimited string deduplicated via sort -u, and replace mapfile with a while-read loop. --- .../ci-readiness-check/ci-readiness-check.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.claude/skills/ci-readiness-check/ci-readiness-check.sh b/.claude/skills/ci-readiness-check/ci-readiness-check.sh index dcd03cead7de..9a6988613d53 100755 --- a/.claude/skills/ci-readiness-check/ci-readiness-check.sh +++ b/.claude/skills/ci-readiness-check/ci-readiness-check.sh @@ -87,27 +87,28 @@ fi # For each changed file, walk up the directory tree to find the nearest # package.json (skipping the repo root's package.json). This maps each file -# to the monorepo package it belongs to. An associative array deduplicates. -declare -A CHANGED_PACKAGES_MAP=() +# to the monorepo package it belongs to. Collected into a newline-delimited +# string, then sorted and deduplicated with `sort -u` (bash 3.2 compatible — +# macOS ships bash 3.2, which lacks associative arrays and `mapfile`). +CHANGED_PACKAGES_LIST="" while IFS= read -r file; do d="$(dirname "${REPO_ROOT}/${file}")" while [ "${d}" != "${REPO_ROOT}" ] && [ "${d}" != "/" ]; do if [ -f "${d}/package.json" ] && [ "${d}" != "${REPO_ROOT}" ]; then rel="${d#"${REPO_ROOT}"/}" - CHANGED_PACKAGES_MAP["${rel}"]=1 + CHANGED_PACKAGES_LIST="${CHANGED_PACKAGES_LIST}${rel}"$'\n' break fi d="$(dirname "${d}")" done done <<< "${CHANGED_FILES}" -# Convert the associative array keys into a sorted regular array. +# Convert the collected list into a sorted, deduplicated regular array. PACKAGES=() -if [ ${#CHANGED_PACKAGES_MAP[@]} -gt 0 ]; then - for pkg in "${!CHANGED_PACKAGES_MAP[@]}"; do - PACKAGES+=("${pkg}") - done - mapfile -t PACKAGES < <(printf '%s\n' "${PACKAGES[@]}" | sort) +if [ -n "${CHANGED_PACKAGES_LIST}" ]; then + while IFS= read -r pkg; do + [ -n "${pkg}" ] && PACKAGES+=("${pkg}") + done <<< "$(printf '%s' "${CHANGED_PACKAGES_LIST}" | sort -u)" fi # If no changed files mapped to a package (e.g., only root config changed),