fix(scripts): make install.sh / build.sh work on stock macOS

Stock macOS ships bash 3.2 (frozen 2007 due to GPLv3) and BSD find.
Both scripts used `mapfile` (bash 4+) and `find -printf` (GNU only),
so a fresh Mac user running `bash scripts/install.sh` died on line 11
before copying anything. Replace with a portable shell glob — same
sort order, no `find` dependency, works on bash 3.2 and 4+.

Verified on git-bash: 16 skills discovered, install dry-run copies all,
`build.sh` produces a valid archive.

See .wiki/concepts/install-portability.md for the full gotcha.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-28 20:41:11 +03:00
parent 72022fc1dc
commit 074cbe9065
7 changed files with 128 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
# mac-support-scripts
## Goal
Make `scripts/install.sh` and `scripts/build.sh` work on stock macOS (BSD find, bash 3.2). Currently both use `mapfile` (bash 4+) and `find -printf` (GNU-only) — fatal on a fresh Mac. Without the fix, the README's "Linux / macOS (bash)" quick-start is a lie.
## Key files
- `scripts/install.sh:11``mapfile -t names < <(find ... -printf ...)`
- `scripts/build.sh:18` — same pattern
- `README.md:30-38` — claims macOS bash quick-start works
- `.wiki/concepts/build-notes.md` — companion concept page; add a sibling for the install-script portability gotcha
## Decisions log
- 2026-04-28: Replace `mapfile` + `find -printf` with shell glob (`for d in "$SRC"/*/`). Reason: works in bash 3.2 (stock macOS) and avoids a `find` flavor dependency. Alternative — require `bash 4+` via `#!/usr/bin/env bash` + version check — rejected: pushes the burden onto Mac users, who would need `brew install bash` for a 30-line script.
- 2026-04-28: Don't drop the `set -euo pipefail` line — POSIX-ish bash supports it from 3.x.
- 2026-04-28: Final — patched both scripts; verified on git-bash (`bash -n` clean, install dry-run installs all 16 skills sorted alphabetically into temp dir, `build.sh active-platform` produces a valid `.skill` archive); wrote `.wiki/concepts/install-portability.md`; index + log updated; dist/ unchanged (smoke-rebuild was byte-identical so no dist churn).
## Open questions
- [ ] None — done.
## Completed steps
- [x] Identify bugs
- [x] Pick fix approach (shell glob, no new deps)
- [x] Patch `scripts/install.sh`
- [x] Patch `scripts/build.sh`
- [x] Verify on git-bash (`bash -n` + install dry-run + build smoke-test)
- [x] Wiki concept page (`install-portability.md`) + index + log
- [x] Commit
## Notes
- `basename` is in POSIX, fine on Mac.
- Empty `skills/` would have `"$SRC"/*/` literal under bash 3.2 without `nullglob`. Guard with `[ -d "$d" ] || continue` — works without `shopt`.