Skip to content

Conversation

@KCW89
Copy link

@KCW89 KCW89 commented Jan 8, 2026

Summary

Fixes a bash strict mode compatibility bug in the ralph-wiggum plugin that causes the script to crash when invoked without arguments.

Problem

The setup-ralph-loop.sh script uses set -euo pipefail for strict error handling. When invoked without arguments (e.g., /ralph-loop --help or just /ralph-loop), the PROMPT_PARTS array remains empty.

Accessing an empty array with ${PROMPT_PARTS[*]} on line 113 triggers bash's unbound variable error under set -u:

PROMPT_PARTS[*]: unbound variable

This prevents the script from reaching the helpful "No prompt provided" error message.

Solution

Use bash's default value syntax ${PROMPT_PARTS[*]:-} which provides an empty string when the array is unset/empty, satisfying strict mode while allowing the script to continue to proper validation.

Changes

-# Join all prompt parts with spaces
-PROMPT="${PROMPT_PARTS[*]}"
+# Join all prompt parts with spaces (handle empty array with set -u)
+PROMPT="${PROMPT_PARTS[*]:-}"

Testing

  • /ralph-loop without args - now shows helpful usage message instead of crashing
  • /ralph-loop --help - displays help documentation correctly
  • /ralph-loop <task> - works as expected (unchanged behavior)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant