* fix(#381): make gsd_run launcher reachable in fresh-shell-per-block runtimes On runtimes that execute each fenced bash block in a separate shell process (e.g. Claude Code — documented behavior: each Bash command is a separate process; inline shell functions and exported vars do not persist between calls), the once-per-file gsd_run() function was undefined in every block after the preamble block, and the call was swallowed by `2>/dev/null || echo "{}"` into silent empty state. Fix (budget-neutral session-level resolution): - Ship gsd-core/bin/gsd_run, a POSIX sh wrapper that symlink-resolves its own location and execs the co-located gsd-tools.cjs. Exposed on PATH via the npm `bin` field (global installs) and shipped to local installs via the recursive gsd-core/ copy. - The per-file launcher preamble now appends `export PATH='<bindir>':"$PATH"` to the file named by $CLAUDE_ENV_FILE (Claude Code's documented env-persistence mechanism) so later fresh-shell blocks resolve gsd_run from PATH. Guarded as a strict no-op when CLAUDE_ENV_FILE is unset; the inline gsd_run() definition remains the fallback for all other runtimes. The single-quoted dir neutralizes shell metacharacters at source time. - Propagated via scripts/sync-runtime-launcher.cjs to all launcher-using files. - XL workflow byte budget 93000 -> 93200 (the ~130B clause pushes plan-phase.md to 93135; legitimate content growth, ratchet-up per #717). Regression tests (I)/(J) in runtime-launcher-parity.test.cjs cover wrapper delegation and end-to-end PATH persistence (sourcing the env file with a space-bearing install path). Known limitation: an install path containing a literal single-quote yields a malformed env-file line and falls back to the status quo (no regression); rare on sanitized home directories. Closes #381 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs(#381): add changeset for gsd_run fresh-shell reachability fix Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * test(#381): scope test (J) bare-PATH execution to POSIX (Windows Git Bash exec bit) Windows Git Bash (msys2) does not honor Node's chmod exec bit for PATH-executing extension-less scripts, so the bare `gsd_run` command lookup failed there even though the env-file PATH persistence was correct. The env-file content assertions (the fix's actual cross-platform logic) still run on every platform; only the final source-and-execute sub-step is gated to non-win32. Global installs on Windows are covered by npm's generated bin shim. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
21 lines
849 B
Bash
Executable File
21 lines
849 B
Bash
Executable File
#!/usr/bin/env sh
|
|
# gsd_run — standalone launcher so workflow bash blocks can invoke the GSD tools
|
|
# in a fresh shell. Claude Code (and similar runtimes) runs each fenced bash block
|
|
# in a separate process, so an inline gsd_run() function defined in an earlier
|
|
# block is undefined in later ones (issue #381). This executable is shipped beside
|
|
# gsd-tools.cjs in gsd-core/bin/ and exposed on PATH via the npm "bin" field and
|
|
# the per-file preamble's CLAUDE_ENV_FILE export, so later blocks resolve it.
|
|
# It resolves its own real location (following symlinks) and delegates to gsd-tools.cjs.
|
|
set -e
|
|
src="$0"
|
|
while [ -h "$src" ]; do
|
|
dir="$(cd -P "$(dirname "$src")" && pwd)"
|
|
src="$(readlink "$src")"
|
|
case "$src" in
|
|
/*) ;;
|
|
*) src="$dir/$src" ;;
|
|
esac
|
|
done
|
|
dir="$(cd -P "$(dirname "$src")" && pwd)"
|
|
exec node "$dir/gsd-tools.cjs" "$@"
|