agentic-loop 3.2.5 → 3.2.7
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 +113 -85
- package/ralph/verify.sh +6 -1
package/package.json
CHANGED
package/ralph/verify/lint.sh
CHANGED
|
@@ -48,117 +48,133 @@ 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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
|
115
92
|
print_error "failed"
|
|
116
93
|
echo ""
|
|
117
|
-
echo "
|
|
118
|
-
|
|
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/^/ /'
|
|
119
98
|
{
|
|
120
99
|
echo ""
|
|
121
|
-
echo "
|
|
122
|
-
echo "$
|
|
100
|
+
echo "Lint errors in $api_dir:"
|
|
101
|
+
echo "$lint_output"
|
|
123
102
|
} >> "$lint_log"
|
|
124
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 . 2>&1); then
|
|
118
|
+
print_success "passed"
|
|
125
119
|
else
|
|
126
|
-
|
|
120
|
+
# Check if it's real errors or just warnings
|
|
121
|
+
if echo "$eslint_output" | grep -qE "✖ [0-9]+ problems? \([1-9][0-9]* errors?"; 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
|
+
# Warnings only - pass without showing them
|
|
134
|
+
local warning_count
|
|
135
|
+
warning_count=$(echo "$eslint_output" | grep -oE "[0-9]+ warnings?" | head -1 | grep -oE "[0-9]+" || echo "0")
|
|
136
|
+
print_success "passed ($warning_count warnings)"
|
|
137
|
+
fi
|
|
127
138
|
fi
|
|
128
139
|
fi
|
|
129
140
|
fi
|
|
130
|
-
fi
|
|
131
141
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
142
|
+
# Check frontend directories (monorepo support)
|
|
143
|
+
local fe_dirs
|
|
144
|
+
fe_dirs=$(get_frontend_dirs)
|
|
135
145
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
146
|
+
while IFS= read -r fe_dir; do
|
|
147
|
+
[[ -z "$fe_dir" ]] && continue
|
|
148
|
+
[[ ! -f "$fe_dir/package.json" ]] && continue
|
|
149
|
+
grep -q '"eslint"' "$fe_dir/package.json" 2>/dev/null || continue
|
|
140
150
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
|
151
|
+
echo -n " ESLint check ($fe_dir)... "
|
|
152
|
+
local eslint_output
|
|
153
|
+
if eslint_output=$(cd "$fe_dir" && npx eslint . 2>&1); then
|
|
154
|
+
print_success "passed"
|
|
157
155
|
else
|
|
158
|
-
|
|
156
|
+
if echo "$eslint_output" | grep -qE "✖ [0-9]+ problems? \([1-9][0-9]* errors?"; then
|
|
157
|
+
print_error "failed"
|
|
158
|
+
echo ""
|
|
159
|
+
echo " ESLint errors in $fe_dir:"
|
|
160
|
+
echo "$eslint_output" | tail -"$MAX_LINT_ERROR_LINES" | sed 's/^/ /'
|
|
161
|
+
{
|
|
162
|
+
echo ""
|
|
163
|
+
echo "ESLint errors in $fe_dir:"
|
|
164
|
+
echo "$eslint_output"
|
|
165
|
+
} >> "$lint_log"
|
|
166
|
+
failed=1
|
|
167
|
+
else
|
|
168
|
+
# Warnings only - pass without showing them
|
|
169
|
+
local warning_count
|
|
170
|
+
warning_count=$(echo "$eslint_output" | grep -oE "[0-9]+ warnings?" | head -1 | grep -oE "[0-9]+" || echo "0")
|
|
171
|
+
print_success "passed ($warning_count warnings)"
|
|
172
|
+
fi
|
|
159
173
|
fi
|
|
160
|
-
|
|
161
|
-
|
|
174
|
+
done <<< "$fe_dirs"
|
|
175
|
+
else
|
|
176
|
+
echo " ESLint check... skipped (backend story)"
|
|
177
|
+
fi
|
|
162
178
|
|
|
163
179
|
return $failed
|
|
164
180
|
}
|
|
@@ -438,29 +454,41 @@ check_enabled() {
|
|
|
438
454
|
[[ "$value" == "true" ]]
|
|
439
455
|
}
|
|
440
456
|
|
|
441
|
-
# Run all checks based on config.json flags
|
|
457
|
+
# Run all checks based on config.json flags and story type
|
|
458
|
+
# Usage: run_configured_checks [story_type]
|
|
459
|
+
# story_type: "backend", "frontend", or "general" (default)
|
|
442
460
|
run_configured_checks() {
|
|
461
|
+
local story_type="${1:-general}"
|
|
462
|
+
|
|
443
463
|
# ALWAYS run auto-fix (harmless, just formats code)
|
|
444
464
|
run_auto_fix
|
|
445
465
|
|
|
446
|
-
# Lint check
|
|
466
|
+
# Lint check - skip irrelevant checks based on story type
|
|
447
467
|
if check_enabled "lint"; then
|
|
448
|
-
if ! verify_lint; then
|
|
468
|
+
if ! verify_lint "$story_type"; then
|
|
449
469
|
return 1
|
|
450
470
|
fi
|
|
451
471
|
fi
|
|
452
472
|
|
|
453
|
-
# TypeScript type checking
|
|
473
|
+
# TypeScript type checking - skip for backend-only stories
|
|
454
474
|
if check_enabled "typecheck"; then
|
|
455
|
-
if
|
|
456
|
-
|
|
475
|
+
if [[ "$story_type" == "backend" ]]; then
|
|
476
|
+
echo " TypeScript typecheck... skipped (backend story)"
|
|
477
|
+
else
|
|
478
|
+
if ! verify_typescript; then
|
|
479
|
+
return 1
|
|
480
|
+
fi
|
|
457
481
|
fi
|
|
458
482
|
fi
|
|
459
483
|
|
|
460
|
-
# Build verification
|
|
484
|
+
# Build verification - skip frontend build for backend stories
|
|
461
485
|
if check_enabled "build"; then
|
|
462
|
-
if
|
|
463
|
-
|
|
486
|
+
if [[ "$story_type" == "backend" ]]; then
|
|
487
|
+
echo " npm build... skipped (backend story)"
|
|
488
|
+
else
|
|
489
|
+
if ! verify_build; then
|
|
490
|
+
return 1
|
|
491
|
+
fi
|
|
464
492
|
fi
|
|
465
493
|
if ! verify_go; then
|
|
466
494
|
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
|
|