Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions plugins/ralph-wiggum/scripts/setup-ralph-loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ ARGUMENTS:
PROMPT... Initial prompt to start the loop (can be multiple words without quotes)

OPTIONS:
--max-iterations <n> Maximum iterations before auto-stop (default: unlimited)
--completion-promise '<text>' Promise phrase (USE QUOTES for multi-word)
-h, --help Show this help message
-m, --max-iterations <n> Maximum iterations before auto-stop (default: unlimited)
-p, --completion-promise '<text>' Promise phrase (USE QUOTES for multi-word)
-h, --help Show this help message

DESCRIPTION:
Starts a Ralph Wiggum loop in your CURRENT session. The stop hook prevents
Expand All @@ -40,10 +40,10 @@ DESCRIPTION:
- Learning how Ralph works

EXAMPLES:
/ralph-loop Build a todo API --completion-promise 'DONE' --max-iterations 20
/ralph-loop --max-iterations 10 Fix the auth bug
/ralph-loop Build a todo API -p 'DONE' -m 20
/ralph-loop -m 10 Fix the auth bug
/ralph-loop Refactor cache layer (runs forever)
/ralph-loop --completion-promise 'TASK COMPLETE' Create a REST API
/ralph-loop -p 'TASK COMPLETE' Create a REST API

STOPPING:
Only by reaching --max-iterations or detecting --completion-promise
Expand All @@ -58,42 +58,42 @@ MONITORING:
HELP_EOF
exit 0
;;
--max-iterations)
-m|--max-iterations)
if [[ -z "${2:-}" ]]; then
echo "❌ Error: --max-iterations requires a number argument" >&2
echo "❌ Error: -m/--max-iterations requires a number argument" >&2
echo "" >&2
echo " Valid examples:" >&2
echo " --max-iterations 10" >&2
echo " -m 10" >&2
echo " --max-iterations 50" >&2
echo " --max-iterations 0 (unlimited)" >&2
echo " -m 0 (unlimited)" >&2
echo "" >&2
echo " You provided: --max-iterations (with no number)" >&2
echo " You provided: -m/--max-iterations (with no number)" >&2
exit 1
fi
if ! [[ "$2" =~ ^[0-9]+$ ]]; then
echo "❌ Error: --max-iterations must be a positive integer or 0, got: $2" >&2
echo "❌ Error: -m/--max-iterations must be a positive integer or 0, got: $2" >&2
echo "" >&2
echo " Valid examples:" >&2
echo " --max-iterations 10" >&2
echo " -m 10" >&2
echo " --max-iterations 50" >&2
echo " --max-iterations 0 (unlimited)" >&2
echo " -m 0 (unlimited)" >&2
echo "" >&2
echo " Invalid: decimals (10.5), negative numbers (-5), text" >&2
exit 1
fi
MAX_ITERATIONS="$2"
shift 2
;;
--completion-promise)
-p|--completion-promise)
if [[ -z "${2:-}" ]]; then
echo "❌ Error: --completion-promise requires a text argument" >&2
echo "❌ Error: -p/--completion-promise requires a text argument" >&2
echo "" >&2
echo " Valid examples:" >&2
echo " --completion-promise 'DONE'" >&2
echo " -p 'DONE'" >&2
echo " --completion-promise 'TASK COMPLETE'" >&2
echo " --completion-promise 'All tests passing'" >&2
echo " -p 'All tests passing'" >&2
echo "" >&2
echo " You provided: --completion-promise (with no text)" >&2
echo " You provided: -p/--completion-promise (with no text)" >&2
echo "" >&2
echo " Note: Multi-word promises must be quoted!" >&2
exit 1
Expand All @@ -120,8 +120,8 @@ if [[ -z "$PROMPT" ]]; then
echo "" >&2
echo " Examples:" >&2
echo " /ralph-loop Build a REST API for todos" >&2
echo " /ralph-loop Fix the auth bug --max-iterations 20" >&2
echo " /ralph-loop --completion-promise 'DONE' Refactor code" >&2
echo " /ralph-loop Fix the auth bug -m 20" >&2
echo " /ralph-loop -p 'DONE' Refactor code" >&2
echo "" >&2
echo " For all options: /ralph-loop --help" >&2
exit 1
Expand Down