@wavilikhin/ralph-wiggum 0.1.17 → 0.1.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavilikhin/ralph-wiggum",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "Autonomous coding loop for OpenCode - one task, one commit, fresh context per iteration",
5
5
  "type": "module",
6
6
  "bin": {
@@ -30,4 +30,4 @@
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  }
33
- }
33
+ }
@@ -18,6 +18,7 @@ MODEL="${RALPH_MODEL:-anthropic/claude-opus-4-20250514}"
18
18
  VARIANT=""
19
19
  VERBOSE=false
20
20
  LIVE=false
21
+ STRICT=false
21
22
  OPENCODE_ARGS=()
22
23
 
23
24
  # All ralph files are in .ralph/
@@ -118,6 +119,7 @@ print_usage() {
118
119
  echo " --variant NAME Variant name for opencode"
119
120
  echo " --verbose Save per-iteration logs (.ralph/logs/ralph_iter_N.log)"
120
121
  echo " --live Stream opencode output to terminal (requires --verbose)"
122
+ echo " --strict Exit on any iteration anomaly (multiple commits, no commit, dirty tree)"
121
123
  echo " --help Show this help"
122
124
  echo ""
123
125
  echo "Environment variables:"
@@ -211,6 +213,10 @@ while [[ $# -gt 0 ]]; do
211
213
  LIVE=true
212
214
  shift
213
215
  ;;
216
+ --strict)
217
+ STRICT=true
218
+ shift
219
+ ;;
214
220
  --help|-h)
215
221
  print_usage
216
222
  exit 0
@@ -243,6 +249,7 @@ echo -e " ${DIM}Max iterations:${NC} $MAX_ITERATIONS"
243
249
  echo -e " ${DIM}Model:${NC} $MODEL"
244
250
  echo -e " ${DIM}Verbose:${NC} $VERBOSE"
245
251
  echo -e " ${DIM}Live output:${NC} $LIVE"
252
+ echo -e " ${DIM}Strict mode:${NC} $STRICT"
246
253
  echo -e " ${DIM}Repo root:${NC} $REPO_ROOT"
247
254
  [[ -n "$VARIANT" ]] && echo -e " ${DIM}Variant:${NC} $VARIANT"
248
255
  echo ""
@@ -338,7 +345,12 @@ for i in $(seq 1 "$MAX_ITERATIONS"); do
338
345
  log_error "opencode exited with code $EXIT_CODE"
339
346
  log_error "Check log: $ITER_LOG_FILE"
340
347
  log_iteration_end "$i" "FAILED" "opencode error" "$ITER_DURATION" "$OPENCODE_DURATION"
341
- exit 1
348
+ if [[ "$STRICT" == true ]]; then
349
+ exit 1
350
+ fi
351
+ log_warn "Continuing despite error (use --strict to exit on errors)"
352
+ echo ""
353
+ continue
342
354
  fi
343
355
 
344
356
  if echo "$OUTPUT" | grep -q '<promise>COMPLETE</promise>'; then
@@ -355,26 +367,42 @@ for i in $(seq 1 "$MAX_ITERATIONS"); do
355
367
  log_info "HEAD after: ${DIM}${AFTER_HEAD:0:8}${NC}"
356
368
 
357
369
  if [[ "$BEFORE_HEAD" == "$AFTER_HEAD" ]]; then
358
- log_error "No commit was created in this iteration!"
359
- log_error "The agent must create exactly one commit per iteration."
360
- log_error "Check log: $ITER_LOG_FILE"
361
- log_iteration_end "$i" "FAILED" "no commit created" "$ITER_DURATION" "$OPENCODE_DURATION"
362
- exit 1
370
+ log_warn "No commit was created in this iteration."
371
+ log_iteration_end "$i" "WARN" "no commit created" "$ITER_DURATION" "$OPENCODE_DURATION"
372
+ if [[ "$STRICT" == true ]]; then
373
+ log_error "Exiting due to --strict mode"
374
+ exit 1
375
+ fi
376
+ echo ""
377
+ continue
363
378
  fi
364
379
 
365
380
  COMMIT_COUNT=$(git rev-list --count "$BEFORE_HEAD".."$AFTER_HEAD")
366
381
  if [[ "$COMMIT_COUNT" -ne 1 ]]; then
367
- log_error "Expected 1 commit, but $COMMIT_COUNT were created!"
368
- log_iteration_end "$i" "FAILED" "multiple commits" "$ITER_DURATION" "$OPENCODE_DURATION"
369
- exit 1
382
+ log_warn "Expected 1 commit, but $COMMIT_COUNT were created."
383
+ log_iteration_end "$i" "WARN" "$COMMIT_COUNT commits" "$ITER_DURATION" "$OPENCODE_DURATION"
384
+ if [[ "$STRICT" == true ]]; then
385
+ log_error "Exiting due to --strict mode"
386
+ exit 1
387
+ fi
388
+ # Still show the commits that were made
389
+ COMMIT_MSG=$(git log -1 --format='%s')
390
+ log_info "Latest commit: $COMMIT_MSG"
391
+ echo ""
392
+ continue
370
393
  fi
371
394
 
372
395
  if [[ -n "$(git status --porcelain)" ]]; then
373
- log_error "Working tree is not clean after iteration!"
396
+ log_warn "Working tree is not clean after iteration."
374
397
  echo ""
375
398
  git status --short
376
- log_iteration_end "$i" "FAILED" "dirty working tree" "$ITER_DURATION" "$OPENCODE_DURATION"
377
- exit 1
399
+ log_iteration_end "$i" "WARN" "dirty working tree" "$ITER_DURATION" "$OPENCODE_DURATION"
400
+ if [[ "$STRICT" == true ]]; then
401
+ log_error "Exiting due to --strict mode"
402
+ exit 1
403
+ fi
404
+ echo ""
405
+ continue
378
406
  fi
379
407
 
380
408
  COMMIT_MSG=$(git log -1 --format='%s')