agentic-loop 3.18.2 → 3.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/ralph.sh +6 -0
- package/package.json +1 -1
- package/ralph/init.sh +2 -0
- package/ralph/loop.sh +30 -3
package/bin/ralph.sh
CHANGED
|
@@ -142,6 +142,12 @@ main() {
|
|
|
142
142
|
echo "Stop signal sent. Ralph will stop after current story completes."
|
|
143
143
|
echo "(Use Ctrl+C to force stop immediately)"
|
|
144
144
|
;;
|
|
145
|
+
skip)
|
|
146
|
+
# Signal the loop to skip the current story and move to the next one
|
|
147
|
+
mkdir -p "$RALPH_DIR"
|
|
148
|
+
touch "$RALPH_DIR/.skip"
|
|
149
|
+
echo "Skip signal sent. Ralph will skip the current story when Claude finishes."
|
|
150
|
+
;;
|
|
145
151
|
status)
|
|
146
152
|
ralph_status "$@"
|
|
147
153
|
;;
|
package/package.json
CHANGED
package/ralph/init.sh
CHANGED
|
@@ -744,6 +744,8 @@ Commands:
|
|
|
744
744
|
run Run autonomous loop until all stories pass
|
|
745
745
|
run --max <n> Run with max iterations (default: 20)
|
|
746
746
|
run --fast Skip code review for faster iterations
|
|
747
|
+
stop Stop loop after current story finishes
|
|
748
|
+
skip Skip the current story, move to next
|
|
747
749
|
status Show current feature and story status
|
|
748
750
|
check Run verification checks only
|
|
749
751
|
verify <story-id> Verify a specific story
|
package/ralph/loop.sh
CHANGED
|
@@ -391,9 +391,9 @@ PATTERN: <pattern>"
|
|
|
391
391
|
}
|
|
392
392
|
|
|
393
393
|
run_loop() {
|
|
394
|
-
# Trap Ctrl+C
|
|
395
|
-
#
|
|
396
|
-
trap 'echo ""; print_warning "Ctrl+C received — stopping loop..."; trap - INT; kill -INT $$' INT
|
|
394
|
+
# Trap Ctrl+C to stop the loop cleanly.
|
|
395
|
+
# Creates .stop file so the loop exits at the next iteration check, then kills children.
|
|
396
|
+
trap 'echo ""; print_warning "Ctrl+C received — stopping loop..."; touch "$RALPH_DIR/.stop"; trap - INT; kill -INT $$' INT
|
|
397
397
|
|
|
398
398
|
local max_iterations="$DEFAULT_MAX_ITERATIONS"
|
|
399
399
|
local specific_story=""
|
|
@@ -752,6 +752,33 @@ run_loop() {
|
|
|
752
752
|
|
|
753
753
|
rm -f "$claude_output_log"
|
|
754
754
|
|
|
755
|
+
# Check for skip signal (user ran `ralph skip` while Claude was running)
|
|
756
|
+
if [[ -f "$RALPH_DIR/.skip" ]]; then
|
|
757
|
+
rm -f "$RALPH_DIR/.skip"
|
|
758
|
+
print_warning "Skip signal received — skipping $story"
|
|
759
|
+
log_progress "$story" "SKIPPED" "User requested skip"
|
|
760
|
+
skipped_stories+=("$story")
|
|
761
|
+
jq --arg id "$story" '(.stories[] | select(.id==$id)) |= . + {skipped: true, skipReason: "user skipped"}' \
|
|
762
|
+
"$RALPH_DIR/prd.json" > "$RALPH_DIR/prd.json.tmp" && mv "$RALPH_DIR/prd.json.tmp" "$RALPH_DIR/prd.json"
|
|
763
|
+
last_story=""
|
|
764
|
+
consecutive_failures=0
|
|
765
|
+
consecutive_timeouts=0
|
|
766
|
+
session_started=false
|
|
767
|
+
rm -f "$prompt_file"
|
|
768
|
+
continue
|
|
769
|
+
fi
|
|
770
|
+
|
|
771
|
+
# Check for stop signal (user ran `ralph stop` or Ctrl+C while Claude was running)
|
|
772
|
+
if [[ -f "$RALPH_DIR/.stop" ]]; then
|
|
773
|
+
rm -f "$RALPH_DIR/.stop" "$prompt_file"
|
|
774
|
+
print_warning "Stop signal received. Exiting gracefully."
|
|
775
|
+
local passed failed
|
|
776
|
+
passed=$(jq '[.stories[] | select(.passes==true)] | length' "$RALPH_DIR/prd.json" 2>/dev/null || echo "0")
|
|
777
|
+
failed=$(jq '[.stories[] | select(.passes==false)] | length' "$RALPH_DIR/prd.json" 2>/dev/null || echo "0")
|
|
778
|
+
send_notification "🛑 Ralph stopped: $passed passed, $failed remaining"
|
|
779
|
+
return 0
|
|
780
|
+
fi
|
|
781
|
+
|
|
755
782
|
if [[ $claude_exit_code -ne 0 ]]; then
|
|
756
783
|
((consecutive_timeouts++))
|
|
757
784
|
print_warning "Claude session ended (timeout or error) - timeout $consecutive_timeouts/$max_timeouts"
|