-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Bug
Running /ralph-loop:ralph-loop without a prompt argument crashes with:
setup-ralph-loop.sh: line 113: PROMPT_PARTS[*]: unbound variable
Root Cause
The script uses set -euo pipefail (line 6), which includes -u (treat unbound variables as errors). When no positional arguments are passed, PROMPT_PARTS remains an empty array initialized on line 9:
PROMPT_PARTS=()On line 113, the expansion ${PROMPT_PARTS[*]} triggers the unbound variable error because bash's set -u treats empty arrays as unbound:
PROMPT="${PROMPT_PARTS[*]}"This crashes before the helpful usage message on lines 116–127 can be displayed.
Expected Behavior
Running /ralph-loop:ralph-loop without arguments should display the usage instructions:
❌ Error: No prompt provided
Ralph needs a task description to work on.
Examples:
/ralph-loop Build a REST API for todos
/ralph-loop Fix the auth bug --max-iterations 20
...
Suggested Fix
Replace line 113 with a safe expansion that handles empty arrays:
PROMPT="${PROMPT_PARTS[*]:-}"The :- default value syntax prevents the unbound variable error while still allowing the empty check on line 116 to work correctly.
Environment
- macOS (Darwin 25.3.0)
- bash with
set -euo pipefail - Plugin version:
d5c15b861cd2(commitd5c15b861cd23e3102215c26020368ad5134dc47)