agentic-loop 3.12.3 → 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
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"
|
|
@@ -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
|