diff --git a/plugins/ralph-wiggum/commands/cancel-ralph.md b/plugins/ralph-wiggum/commands/cancel-ralph.md index 82130b3e..c2f7d2ea 100644 --- a/plugins/ralph-wiggum/commands/cancel-ralph.md +++ b/plugins/ralph-wiggum/commands/cancel-ralph.md @@ -1,26 +1,15 @@ --- description: "Cancel active Ralph Wiggum loop" -allowed-tools: ["Bash"] +allowed-tools: ["Bash(${CLAUDE_PLUGIN_ROOT}/scripts/cancel-ralph-loop.sh)"] hide-from-slash-command-tool: "true" --- -# Cancel Ralph +# Cancel Ralph Loop + +Execute the cancel script to stop the Ralph loop: ```! -if [[ -f .claude/ralph-loop.local.md ]]; then - ITERATION=$(grep '^iteration:' .claude/ralph-loop.local.md | sed 's/iteration: *//') - echo "FOUND_LOOP=true" - echo "ITERATION=$ITERATION" -else - echo "FOUND_LOOP=false" -fi +"${CLAUDE_PLUGIN_ROOT}/scripts/cancel-ralph-loop.sh" ``` -Check the output above: - -1. **If FOUND_LOOP=false**: - - Say "No active Ralph loop found." - -2. **If FOUND_LOOP=true**: - - Use Bash: `rm .claude/ralph-loop.local.md` - - Report: "Cancelled Ralph loop (was at iteration N)" where N is the ITERATION value from above. +The Ralph loop has been cancelled. You can now exit normally or start a new loop. diff --git a/plugins/ralph-wiggum/scripts/cancel-ralph-loop.sh b/plugins/ralph-wiggum/scripts/cancel-ralph-loop.sh new file mode 100755 index 00000000..0402f699 --- /dev/null +++ b/plugins/ralph-wiggum/scripts/cancel-ralph-loop.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Cancel Ralph Wiggum Loop Script +# Removes the ralph-loop state file to stop the loop + +RALPH_STATE_FILE=".claude/ralph-loop.local.md" + +if [[ -f "$RALPH_STATE_FILE" ]]; then + # Extract iteration count before deleting + ITERATION=$(grep '^iteration:' "$RALPH_STATE_FILE" | sed 's/iteration: *//') + + # Remove the state file + rm "$RALPH_STATE_FILE" + + echo "✅ Ralph loop cancelled (was at iteration $ITERATION)" +else + echo "ℹ️ No active Ralph loop found." +fi