agentic-loop 3.12.2 → 3.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-loop",
3
- "version": "3.12.2",
3
+ "version": "3.13.0",
4
4
  "description": "Autonomous AI coding loop - PRD-driven development with Claude Code",
5
5
  "author": "Allie Jones <allie@allthrive.ai>",
6
6
  "license": "MIT",
package/ralph/init.sh CHANGED
@@ -603,6 +603,36 @@ auto_configure_project() {
603
603
  fi
604
604
  fi
605
605
 
606
+ # 8. Detect Python runner (uv/poetry/pipenv) and update test command
607
+ if [[ -f "pyproject.toml" || -f "requirements.txt" ]]; then
608
+ local py_runner=""
609
+ py_runner=$(detect_python_runner ".")
610
+
611
+ if [[ -n "$py_runner" ]]; then
612
+ # Check if commands.test exists and needs updating
613
+ local current_test
614
+ current_test=$(jq -r '.commands.test // ""' "$tmpfile" 2>/dev/null)
615
+
616
+ # Update if test command is bare pytest (no runner prefix)
617
+ if [[ "$current_test" == "pytest"* ]] && [[ "$current_test" != "$py_runner"* ]]; then
618
+ local new_test="${py_runner} ${current_test}"
619
+ jq --arg test "$new_test" '.commands.test = $test' "$tmpfile" > "${tmpfile}.new" && mv "${tmpfile}.new" "$tmpfile"
620
+ echo " Auto-updated commands.test: $new_test"
621
+ updated=true
622
+ fi
623
+
624
+ # Also update commands.dev if it's bare python
625
+ local current_dev
626
+ current_dev=$(jq -r '.commands.dev // ""' "$tmpfile" 2>/dev/null)
627
+ if [[ "$current_dev" == "python "* ]] && [[ "$current_dev" != "$py_runner"* ]]; then
628
+ local new_dev="${py_runner} ${current_dev}"
629
+ jq --arg dev "$new_dev" '.commands.dev = $dev' "$tmpfile" > "${tmpfile}.new" && mv "${tmpfile}.new" "$tmpfile"
630
+ echo " Auto-updated commands.dev: $new_dev"
631
+ updated=true
632
+ fi
633
+ fi
634
+ fi
635
+
606
636
  # Save if updated
607
637
  if [[ "$updated" == "true" ]]; then
608
638
  mv "$tmpfile" "$config"
@@ -284,7 +284,7 @@ _validate_and_fix_stories() {
284
284
  local cnt_no_tests=0 cnt_backend_curl=0 cnt_backend_contract=0
285
285
  local cnt_frontend_tsc=0 cnt_frontend_url=0 cnt_frontend_context=0
286
286
  local cnt_auth_security=0 cnt_list_pagination=0 cnt_prose_steps=0
287
- local cnt_migration_prereq=0 cnt_naming_convention=0
287
+ local cnt_migration_prereq=0 cnt_naming_convention=0 cnt_bare_pytest=0
288
288
 
289
289
  echo " Checking test coverage..."
290
290
 
@@ -331,6 +331,18 @@ _validate_and_fix_stories() {
331
331
  cnt_frontend_tsc=$((cnt_frontend_tsc + 1))
332
332
  fi
333
333
  fi
334
+
335
+ # Check for bare pytest/python in projects using uv/poetry/pipenv
336
+ local py_runner
337
+ py_runner=$(detect_python_runner ".")
338
+ if [[ -n "$py_runner" ]]; then
339
+ # Project uses a Python runner - check for bare pytest/python commands
340
+ # Match: "pytest " at start or after space/semicolon, but not preceded by "run "
341
+ if echo "$test_steps" | grep -qE '(^|[; ])pytest ' && ! echo "$test_steps" | grep -qE "(uv run|poetry run|pipenv run) pytest"; then
342
+ story_issues+="use '$py_runner pytest' not bare 'pytest', "
343
+ cnt_bare_pytest=$((cnt_bare_pytest + 1))
344
+ fi
345
+ fi
334
346
  fi
335
347
 
336
348
  # Check 2: Backend needs apiContract
@@ -434,6 +446,7 @@ _validate_and_fix_stories() {
434
446
  [[ $cnt_list_pagination -gt 0 ]] && echo " ${cnt_list_pagination}x list: add pagination"
435
447
  [[ $cnt_migration_prereq -gt 0 ]] && echo " ${cnt_migration_prereq}x migration: add prerequisites (DB reset)"
436
448
  [[ $cnt_naming_convention -gt 0 ]] && echo " ${cnt_naming_convention}x API consumer: add camelCase transformation note"
449
+ [[ $cnt_bare_pytest -gt 0 ]] && echo " ${cnt_bare_pytest}x use 'uv run pytest' not bare 'pytest'"
437
450
 
438
451
  # Check if Claude is available for auto-fix
439
452
  if command -v claude &>/dev/null; then
@@ -25,12 +25,12 @@
25
25
  },
26
26
 
27
27
  "commands": {
28
- "dev": "python -m ${PROJECT_MODULE}.server",
28
+ "dev": "uv run python -m ${PROJECT_MODULE}.server",
29
29
  "install": "uv pip install -e .",
30
- "lint": "ruff check src/",
31
- "format": "ruff format src/",
32
- "typecheck": "mypy src/",
33
- "test": "pytest",
30
+ "lint": "uv run ruff check src/",
31
+ "format": "uv run ruff format src/",
32
+ "typecheck": "uv run mypy src/",
33
+ "test": "uv run pytest",
34
34
  "seed": "",
35
35
  "resetDb": ""
36
36
  },
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env bash
2
+ # warn-uv-python.sh - Warn about bare pytest/python instead of uv run
3
+ # Hook: PostToolUse matcher: "Bash"
4
+ #
5
+ # Copy to .ralph/hooks/ and Claude Code will warn when bare pytest/python
6
+ # commands are used in projects that should use 'uv run'.
7
+
8
+ set -euo pipefail
9
+
10
+ INPUT=$(cat)
11
+ COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // ""')
12
+
13
+ # Skip if empty
14
+ [[ -z "$COMMAND" ]] && { echo '{"continue": true}'; exit 0; }
15
+
16
+ WARNINGS=""
17
+
18
+ # Check for bare pytest (not preceded by "uv run")
19
+ if echo "$COMMAND" | grep -qE '(^|\s|;|&&|\|)pytest\s' && ! echo "$COMMAND" | grep -qE 'uv run pytest'; then
20
+ WARNINGS="Use 'uv run pytest' instead of bare 'pytest' to ensure correct environment."
21
+ fi
22
+
23
+ # Check for bare python (not preceded by "uv run")
24
+ if echo "$COMMAND" | grep -qE '(^|\s|;|&&|\|)python\s' && ! echo "$COMMAND" | grep -qE 'uv run python'; then
25
+ WARNINGS="${WARNINGS:+$WARNINGS\n}Use 'uv run python' instead of bare 'python' to ensure correct environment."
26
+ fi
27
+
28
+ # Output warning as additional context (non-blocking)
29
+ if [[ -n "$WARNINGS" ]]; then
30
+ jq -n --arg warn "$WARNINGS" '{
31
+ "continue": true,
32
+ "hookSpecificOutput": {
33
+ "additionalContext": $warn
34
+ }
35
+ }'
36
+ else
37
+ echo '{"continue": true}'
38
+ fi