agentic-loop 3.2.5 → 3.2.6
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 +1 -1
- package/ralph/verify/lint.sh +105 -83
- package/ralph/verify.sh +6 -1
package/package.json
CHANGED
package/ralph/verify/lint.sh
CHANGED
|
@@ -48,77 +48,116 @@ run_auto_fix() {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
# Verify lint passes after auto-fix (catch remaining errors that need manual fix)
|
|
51
|
+
# Usage: verify_lint [story_type]
|
|
51
52
|
verify_lint() {
|
|
53
|
+
local story_type="${1:-general}"
|
|
52
54
|
local failed=0
|
|
53
55
|
local lint_log="$RALPH_DIR/last_lint_failure.log"
|
|
54
56
|
|
|
55
57
|
# Clear previous lint failure log
|
|
56
58
|
rm -f "$lint_log"
|
|
57
59
|
|
|
58
|
-
# Python: ruff lint check
|
|
59
|
-
if
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
else
|
|
64
|
-
print_error "failed"
|
|
65
|
-
echo ""
|
|
66
|
-
echo " Lint errors (auto-fix couldn't resolve - Claude should fix these):"
|
|
67
|
-
local lint_output
|
|
68
|
-
lint_output=$(ruff check . 2>/dev/null | head -"$MAX_LINT_ERROR_LINES")
|
|
69
|
-
echo "$lint_output" | sed 's/^/ /'
|
|
70
|
-
{
|
|
71
|
-
echo "Lint errors in root directory:"
|
|
72
|
-
echo "$lint_output"
|
|
73
|
-
} >> "$lint_log"
|
|
74
|
-
failed=1
|
|
75
|
-
fi
|
|
76
|
-
fi
|
|
77
|
-
|
|
78
|
-
# Check for monorepo backend directories
|
|
79
|
-
local api_dirs
|
|
80
|
-
api_dirs=$(get_backend_dirs)
|
|
81
|
-
|
|
82
|
-
while IFS= read -r api_dir; do
|
|
83
|
-
[[ -z "$api_dir" ]] && continue
|
|
84
|
-
if [[ -f "$api_dir/pyproject.toml" || -f "$api_dir/ruff.toml" ]]; then
|
|
85
|
-
echo -n " Ruff lint check ($api_dir)... "
|
|
86
|
-
if (cd "$api_dir" && ruff check . --quiet 2>/dev/null); then
|
|
60
|
+
# Python: ruff lint check (skip for frontend-only stories)
|
|
61
|
+
if [[ "$story_type" != "frontend" ]]; then
|
|
62
|
+
if command -v ruff &>/dev/null && [[ -f "pyproject.toml" || -f "ruff.toml" ]]; then
|
|
63
|
+
echo -n " Ruff lint check... "
|
|
64
|
+
if ruff check . --quiet 2>/dev/null; then
|
|
87
65
|
print_success "passed"
|
|
88
66
|
else
|
|
89
67
|
print_error "failed"
|
|
90
68
|
echo ""
|
|
91
|
-
echo " Lint errors
|
|
69
|
+
echo " Lint errors (auto-fix couldn't resolve - Claude should fix these):"
|
|
92
70
|
local lint_output
|
|
93
|
-
lint_output=$(
|
|
71
|
+
lint_output=$(ruff check . 2>/dev/null | head -"$MAX_LINT_ERROR_LINES")
|
|
94
72
|
echo "$lint_output" | sed 's/^/ /'
|
|
95
73
|
{
|
|
96
|
-
echo ""
|
|
97
|
-
echo "Lint errors in $api_dir:"
|
|
74
|
+
echo "Lint errors in root directory:"
|
|
98
75
|
echo "$lint_output"
|
|
99
76
|
} >> "$lint_log"
|
|
100
77
|
failed=1
|
|
101
78
|
fi
|
|
102
79
|
fi
|
|
103
|
-
done <<< "$api_dirs"
|
|
104
80
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
81
|
+
# Check for monorepo backend directories
|
|
82
|
+
local api_dirs
|
|
83
|
+
api_dirs=$(get_backend_dirs)
|
|
84
|
+
|
|
85
|
+
while IFS= read -r api_dir; do
|
|
86
|
+
[[ -z "$api_dir" ]] && continue
|
|
87
|
+
if [[ -f "$api_dir/pyproject.toml" || -f "$api_dir/ruff.toml" ]]; then
|
|
88
|
+
echo -n " Ruff lint check ($api_dir)... "
|
|
89
|
+
if (cd "$api_dir" && ruff check . --quiet 2>/dev/null); then
|
|
90
|
+
print_success "passed"
|
|
91
|
+
else
|
|
92
|
+
print_error "failed"
|
|
93
|
+
echo ""
|
|
94
|
+
echo " Lint errors in $api_dir (auto-fix couldn't resolve - Claude should fix these):"
|
|
95
|
+
local lint_output
|
|
96
|
+
lint_output=$(cd "$api_dir" && ruff check . 2>/dev/null | head -"$MAX_LINT_ERROR_LINES")
|
|
97
|
+
echo "$lint_output" | sed 's/^/ /'
|
|
98
|
+
{
|
|
99
|
+
echo ""
|
|
100
|
+
echo "Lint errors in $api_dir:"
|
|
101
|
+
echo "$lint_output"
|
|
102
|
+
} >> "$lint_log"
|
|
103
|
+
failed=1
|
|
104
|
+
fi
|
|
105
|
+
fi
|
|
106
|
+
done <<< "$api_dirs"
|
|
107
|
+
else
|
|
108
|
+
echo " Ruff lint check... skipped (frontend story)"
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
# JavaScript/TypeScript: ESLint check (skip for backend-only stories)
|
|
112
|
+
if [[ "$story_type" != "backend" ]]; then
|
|
113
|
+
if [[ -f "package.json" ]] && command -v npx &>/dev/null; then
|
|
114
|
+
if grep -q '"eslint"' package.json 2>/dev/null || [[ -f ".eslintrc.js" ]] || [[ -f "eslint.config.js" ]]; then
|
|
115
|
+
echo -n " ESLint check... "
|
|
116
|
+
local eslint_output
|
|
117
|
+
if eslint_output=$(npx eslint . --max-warnings 0 2>&1); then
|
|
118
|
+
print_success "passed"
|
|
119
|
+
else
|
|
120
|
+
# Check if it's real errors or just warnings
|
|
121
|
+
if echo "$eslint_output" | grep -qE "✖ [0-9]+ problems? \([1-9]"; then
|
|
122
|
+
print_error "failed"
|
|
123
|
+
echo ""
|
|
124
|
+
echo " ESLint errors:"
|
|
125
|
+
echo "$eslint_output" | tail -"$MAX_LINT_ERROR_LINES" | sed 's/^/ /'
|
|
126
|
+
{
|
|
127
|
+
echo ""
|
|
128
|
+
echo "ESLint errors in root:"
|
|
129
|
+
echo "$eslint_output"
|
|
130
|
+
} >> "$lint_log"
|
|
131
|
+
failed=1
|
|
132
|
+
else
|
|
133
|
+
print_success "passed (warnings only)"
|
|
134
|
+
fi
|
|
135
|
+
fi
|
|
136
|
+
fi
|
|
137
|
+
fi
|
|
138
|
+
|
|
139
|
+
# Check frontend directories (monorepo support)
|
|
140
|
+
local fe_dirs
|
|
141
|
+
fe_dirs=$(get_frontend_dirs)
|
|
142
|
+
|
|
143
|
+
while IFS= read -r fe_dir; do
|
|
144
|
+
[[ -z "$fe_dir" ]] && continue
|
|
145
|
+
[[ ! -f "$fe_dir/package.json" ]] && continue
|
|
146
|
+
grep -q '"eslint"' "$fe_dir/package.json" 2>/dev/null || continue
|
|
147
|
+
|
|
148
|
+
echo -n " ESLint check ($fe_dir)... "
|
|
109
149
|
local eslint_output
|
|
110
|
-
if eslint_output=$(npx eslint . --max-warnings 0 2>&1); then
|
|
150
|
+
if eslint_output=$(cd "$fe_dir" && npx eslint . --max-warnings 0 2>&1); then
|
|
111
151
|
print_success "passed"
|
|
112
152
|
else
|
|
113
|
-
# Check if it's real errors or just warnings
|
|
114
153
|
if echo "$eslint_output" | grep -qE "✖ [0-9]+ problems? \([1-9]"; then
|
|
115
154
|
print_error "failed"
|
|
116
155
|
echo ""
|
|
117
|
-
echo " ESLint errors:"
|
|
156
|
+
echo " ESLint errors in $fe_dir:"
|
|
118
157
|
echo "$eslint_output" | tail -"$MAX_LINT_ERROR_LINES" | sed 's/^/ /'
|
|
119
158
|
{
|
|
120
159
|
echo ""
|
|
121
|
-
echo "ESLint errors in
|
|
160
|
+
echo "ESLint errors in $fe_dir:"
|
|
122
161
|
echo "$eslint_output"
|
|
123
162
|
} >> "$lint_log"
|
|
124
163
|
failed=1
|
|
@@ -126,40 +165,11 @@ verify_lint() {
|
|
|
126
165
|
print_success "passed (warnings only)"
|
|
127
166
|
fi
|
|
128
167
|
fi
|
|
129
|
-
|
|
168
|
+
done <<< "$fe_dirs"
|
|
169
|
+
else
|
|
170
|
+
echo " ESLint check... skipped (backend story)"
|
|
130
171
|
fi
|
|
131
172
|
|
|
132
|
-
# Check frontend directories (monorepo support)
|
|
133
|
-
local fe_dirs
|
|
134
|
-
fe_dirs=$(get_frontend_dirs)
|
|
135
|
-
|
|
136
|
-
while IFS= read -r fe_dir; do
|
|
137
|
-
[[ -z "$fe_dir" ]] && continue
|
|
138
|
-
[[ ! -f "$fe_dir/package.json" ]] && continue
|
|
139
|
-
grep -q '"eslint"' "$fe_dir/package.json" 2>/dev/null || continue
|
|
140
|
-
|
|
141
|
-
echo -n " ESLint check ($fe_dir)... "
|
|
142
|
-
local eslint_output
|
|
143
|
-
if eslint_output=$(cd "$fe_dir" && npx eslint . --max-warnings 0 2>&1); then
|
|
144
|
-
print_success "passed"
|
|
145
|
-
else
|
|
146
|
-
if echo "$eslint_output" | grep -qE "✖ [0-9]+ problems? \([1-9]"; then
|
|
147
|
-
print_error "failed"
|
|
148
|
-
echo ""
|
|
149
|
-
echo " ESLint errors in $fe_dir:"
|
|
150
|
-
echo "$eslint_output" | tail -"$MAX_LINT_ERROR_LINES" | sed 's/^/ /'
|
|
151
|
-
{
|
|
152
|
-
echo ""
|
|
153
|
-
echo "ESLint errors in $fe_dir:"
|
|
154
|
-
echo "$eslint_output"
|
|
155
|
-
} >> "$lint_log"
|
|
156
|
-
failed=1
|
|
157
|
-
else
|
|
158
|
-
print_success "passed (warnings only)"
|
|
159
|
-
fi
|
|
160
|
-
fi
|
|
161
|
-
done <<< "$fe_dirs"
|
|
162
|
-
|
|
163
173
|
return $failed
|
|
164
174
|
}
|
|
165
175
|
|
|
@@ -438,29 +448,41 @@ check_enabled() {
|
|
|
438
448
|
[[ "$value" == "true" ]]
|
|
439
449
|
}
|
|
440
450
|
|
|
441
|
-
# Run all checks based on config.json flags
|
|
451
|
+
# Run all checks based on config.json flags and story type
|
|
452
|
+
# Usage: run_configured_checks [story_type]
|
|
453
|
+
# story_type: "backend", "frontend", or "general" (default)
|
|
442
454
|
run_configured_checks() {
|
|
455
|
+
local story_type="${1:-general}"
|
|
456
|
+
|
|
443
457
|
# ALWAYS run auto-fix (harmless, just formats code)
|
|
444
458
|
run_auto_fix
|
|
445
459
|
|
|
446
|
-
# Lint check
|
|
460
|
+
# Lint check - skip irrelevant checks based on story type
|
|
447
461
|
if check_enabled "lint"; then
|
|
448
|
-
if ! verify_lint; then
|
|
462
|
+
if ! verify_lint "$story_type"; then
|
|
449
463
|
return 1
|
|
450
464
|
fi
|
|
451
465
|
fi
|
|
452
466
|
|
|
453
|
-
# TypeScript type checking
|
|
467
|
+
# TypeScript type checking - skip for backend-only stories
|
|
454
468
|
if check_enabled "typecheck"; then
|
|
455
|
-
if
|
|
456
|
-
|
|
469
|
+
if [[ "$story_type" == "backend" ]]; then
|
|
470
|
+
echo " TypeScript typecheck... skipped (backend story)"
|
|
471
|
+
else
|
|
472
|
+
if ! verify_typescript; then
|
|
473
|
+
return 1
|
|
474
|
+
fi
|
|
457
475
|
fi
|
|
458
476
|
fi
|
|
459
477
|
|
|
460
|
-
# Build verification
|
|
478
|
+
# Build verification - skip frontend build for backend stories
|
|
461
479
|
if check_enabled "build"; then
|
|
462
|
-
if
|
|
463
|
-
|
|
480
|
+
if [[ "$story_type" == "backend" ]]; then
|
|
481
|
+
echo " npm build... skipped (backend story)"
|
|
482
|
+
else
|
|
483
|
+
if ! verify_build; then
|
|
484
|
+
return 1
|
|
485
|
+
fi
|
|
464
486
|
fi
|
|
465
487
|
if ! verify_go; then
|
|
466
488
|
return 1
|
package/ralph/verify.sh
CHANGED
|
@@ -17,13 +17,18 @@ run_verification() {
|
|
|
17
17
|
print_info "=== Verification: $story ==="
|
|
18
18
|
echo ""
|
|
19
19
|
|
|
20
|
+
# Get story type for targeted checks
|
|
21
|
+
local story_type
|
|
22
|
+
story_type=$(jq -r --arg id "$story" '.stories[] | select(.id==$id) | .type // "general"' "$RALPH_DIR/prd.json" 2>/dev/null)
|
|
23
|
+
export RALPH_STORY_TYPE="$story_type"
|
|
24
|
+
|
|
20
25
|
local failed=0
|
|
21
26
|
|
|
22
27
|
# ========================================
|
|
23
28
|
# STEP 1: Run lint checks
|
|
24
29
|
# ========================================
|
|
25
30
|
echo " [1/3] Running lint checks..."
|
|
26
|
-
if ! run_configured_checks; then
|
|
31
|
+
if ! run_configured_checks "$story_type"; then
|
|
27
32
|
failed=1
|
|
28
33
|
fi
|
|
29
34
|
|