thrivekit 2.0.21 → 2.0.22
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/init.sh +1 -0
- package/ralph/loop.sh +10 -4
- package/ralph/verify.sh +74 -30
package/package.json
CHANGED
package/ralph/init.sh
CHANGED
|
@@ -482,6 +482,7 @@ Commands:
|
|
|
482
482
|
prd --file <file> Generate PRD from file
|
|
483
483
|
run Run autonomous loop until all stories pass
|
|
484
484
|
run --max <n> Run with max iterations (default: 20)
|
|
485
|
+
run --fast Skip code review for faster iterations
|
|
485
486
|
status Show current feature and story status
|
|
486
487
|
check Run verification checks only
|
|
487
488
|
verify <story-id> Verify a specific story
|
package/ralph/loop.sh
CHANGED
|
@@ -99,6 +99,7 @@ preflight_checks() {
|
|
|
99
99
|
run_loop() {
|
|
100
100
|
local max_iterations="$DEFAULT_MAX_ITERATIONS"
|
|
101
101
|
local specific_story=""
|
|
102
|
+
local fast_mode=false
|
|
102
103
|
|
|
103
104
|
# Parse arguments
|
|
104
105
|
while [[ $# -gt 0 ]]; do
|
|
@@ -111,12 +112,19 @@ run_loop() {
|
|
|
111
112
|
specific_story="$2"
|
|
112
113
|
shift 2
|
|
113
114
|
;;
|
|
115
|
+
--fast)
|
|
116
|
+
fast_mode=true
|
|
117
|
+
shift
|
|
118
|
+
;;
|
|
114
119
|
*)
|
|
115
120
|
shift
|
|
116
121
|
;;
|
|
117
122
|
esac
|
|
118
123
|
done
|
|
119
124
|
|
|
125
|
+
# Export for use in verification
|
|
126
|
+
export RALPH_FAST_MODE="$fast_mode"
|
|
127
|
+
|
|
120
128
|
# Validate prerequisites
|
|
121
129
|
check_dependencies
|
|
122
130
|
|
|
@@ -236,10 +244,8 @@ run_loop() {
|
|
|
236
244
|
continue
|
|
237
245
|
fi
|
|
238
246
|
|
|
239
|
-
#
|
|
240
|
-
|
|
241
|
-
print_warning "Retry $consecutive_failures/$max_story_retries for $story (waiting ${backoff}s...)"
|
|
242
|
-
sleep "$backoff"
|
|
247
|
+
# Quick retry - no delay needed (Claude API isn't rate-limited)
|
|
248
|
+
print_warning "Retry $consecutive_failures/$max_story_retries for $story"
|
|
243
249
|
else
|
|
244
250
|
consecutive_failures=1
|
|
245
251
|
last_story="$story"
|
package/ralph/verify.sh
CHANGED
|
@@ -38,15 +38,25 @@ run_verification() {
|
|
|
38
38
|
print_info "=== Verification: $story ==="
|
|
39
39
|
echo ""
|
|
40
40
|
|
|
41
|
-
#
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
# Clear old failure logs (so smart-skip logic uses fresh state)
|
|
42
|
+
rm -f "$RALPH_DIR/last_precommit_failure.log" \
|
|
43
|
+
"$RALPH_DIR/last_test_failure.log" \
|
|
44
|
+
"$RALPH_DIR/last_review_failure.json" 2>/dev/null
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
# Check for fast mode
|
|
47
|
+
local fast_mode="${RALPH_FAST_MODE:-false}"
|
|
48
|
+
if [[ "$fast_mode" == "true" ]]; then
|
|
49
|
+
echo " (fast mode - skipping code review)"
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# Determine story type (single jq call for all story info)
|
|
53
|
+
local story_json
|
|
54
|
+
story_json=$(jq --arg id "$story" '.stories[] | select(.id==$id)' "$RALPH_DIR/prd.json" 2>/dev/null)
|
|
47
55
|
|
|
48
|
-
local has_api_endpoints
|
|
49
|
-
|
|
56
|
+
local story_type has_test_url has_api_endpoints
|
|
57
|
+
story_type=$(echo "$story_json" | jq -r '.type // "frontend"')
|
|
58
|
+
has_test_url=$(echo "$story_json" | jq -r '.testUrl // empty')
|
|
59
|
+
has_api_endpoints=$(echo "$story_json" | jq -r '.apiEndpoints[0] // empty')
|
|
50
60
|
|
|
51
61
|
# Auto-detect type if not specified
|
|
52
62
|
if [[ -n "$has_api_endpoints" && -z "$has_test_url" ]]; then
|
|
@@ -54,52 +64,86 @@ run_verification() {
|
|
|
54
64
|
fi
|
|
55
65
|
|
|
56
66
|
local failed=0
|
|
67
|
+
local lint_failed=0
|
|
68
|
+
local test_failed=0
|
|
57
69
|
|
|
58
70
|
# ========================================
|
|
59
|
-
# STEP 1: Code review (
|
|
71
|
+
# STEP 1: Code review (skip in fast mode or if last failure was lint/test)
|
|
60
72
|
# ========================================
|
|
61
|
-
|
|
62
|
-
if
|
|
63
|
-
|
|
73
|
+
local skip_review=false
|
|
74
|
+
if [[ "$fast_mode" == "true" ]]; then
|
|
75
|
+
skip_review=true
|
|
76
|
+
elif [[ -f "$RALPH_DIR/last_precommit_failure.log" ]] || [[ -f "$RALPH_DIR/last_test_failure.log" ]]; then
|
|
77
|
+
# Skip review if last failure was lint/test - review won't help
|
|
78
|
+
skip_review=true
|
|
79
|
+
echo " [1/5] Skipping code review (last failure was lint/test)"
|
|
64
80
|
fi
|
|
65
81
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if [[ $failed -eq 0 ]]; then
|
|
70
|
-
echo ""
|
|
71
|
-
echo " [2/6] Running configured checks..."
|
|
72
|
-
if ! run_configured_checks; then
|
|
82
|
+
if [[ "$skip_review" == "false" ]]; then
|
|
83
|
+
echo " [1/5] Running code review..."
|
|
84
|
+
if ! run_code_review "$story"; then
|
|
73
85
|
failed=1
|
|
74
86
|
fi
|
|
75
87
|
fi
|
|
76
88
|
|
|
77
89
|
# ========================================
|
|
78
|
-
# STEP 3: Run
|
|
90
|
+
# STEP 2+3: Run lint and tests IN PARALLEL
|
|
79
91
|
# ========================================
|
|
80
92
|
if [[ $failed -eq 0 ]]; then
|
|
81
93
|
echo ""
|
|
82
|
-
echo " [
|
|
83
|
-
|
|
94
|
+
echo " [2/5] Running lint + tests (parallel)..."
|
|
95
|
+
|
|
96
|
+
# Create temp files for results
|
|
97
|
+
local lint_log test_log
|
|
98
|
+
lint_log=$(mktemp)
|
|
99
|
+
test_log=$(mktemp)
|
|
100
|
+
|
|
101
|
+
# Run lint in background
|
|
102
|
+
(run_configured_checks > "$lint_log" 2>&1; echo $? > "${lint_log}.exit") &
|
|
103
|
+
local lint_pid=$!
|
|
104
|
+
|
|
105
|
+
# Run tests in background
|
|
106
|
+
(run_unit_tests > "$test_log" 2>&1; echo $? > "${test_log}.exit") &
|
|
107
|
+
local test_pid=$!
|
|
108
|
+
|
|
109
|
+
# Wait for both
|
|
110
|
+
wait $lint_pid 2>/dev/null
|
|
111
|
+
wait $test_pid 2>/dev/null
|
|
112
|
+
|
|
113
|
+
# Check results
|
|
114
|
+
lint_failed=$(cat "${lint_log}.exit" 2>/dev/null || echo "1")
|
|
115
|
+
test_failed=$(cat "${test_log}.exit" 2>/dev/null || echo "1")
|
|
116
|
+
|
|
117
|
+
# Show lint output
|
|
118
|
+
echo " Lint:"
|
|
119
|
+
cat "$lint_log" | sed 's/^/ /'
|
|
120
|
+
|
|
121
|
+
# Show test output
|
|
122
|
+
echo " Tests:"
|
|
123
|
+
cat "$test_log" | sed 's/^/ /'
|
|
124
|
+
|
|
125
|
+
# Cleanup
|
|
126
|
+
rm -f "$lint_log" "${lint_log}.exit" "$test_log" "${test_log}.exit"
|
|
127
|
+
|
|
128
|
+
if [[ "$lint_failed" != "0" ]] || [[ "$test_failed" != "0" ]]; then
|
|
84
129
|
failed=1
|
|
85
130
|
fi
|
|
86
131
|
fi
|
|
87
132
|
|
|
88
133
|
# ========================================
|
|
89
|
-
# STEP
|
|
134
|
+
# STEP 3: Run Playwright tests (frontend) or API tests (backend)
|
|
90
135
|
# ========================================
|
|
91
136
|
if [[ $failed -eq 0 ]]; then
|
|
92
137
|
echo ""
|
|
93
138
|
if [[ "$story_type" == "backend" ]]; then
|
|
94
|
-
echo " [
|
|
139
|
+
echo " [3/5] Running API tests..."
|
|
95
140
|
if ! run_api_validation "$story"; then
|
|
96
141
|
failed=1
|
|
97
142
|
elif ! run_api_error_tests "$story"; then
|
|
98
|
-
# Only run error tests if validation passed
|
|
99
143
|
failed=1
|
|
100
144
|
fi
|
|
101
145
|
else
|
|
102
|
-
echo " [
|
|
146
|
+
echo " [3/5] Running Playwright tests..."
|
|
103
147
|
if ! run_playwright_tests "$story"; then
|
|
104
148
|
failed=1
|
|
105
149
|
fi
|
|
@@ -107,17 +151,17 @@ run_verification() {
|
|
|
107
151
|
fi
|
|
108
152
|
|
|
109
153
|
# ========================================
|
|
110
|
-
# STEP
|
|
154
|
+
# STEP 4: Run browser validation (frontend) or API validation (backend)
|
|
111
155
|
# ========================================
|
|
112
156
|
if [[ $failed -eq 0 ]]; then
|
|
113
157
|
echo ""
|
|
114
158
|
if [[ "$story_type" == "backend" ]]; then
|
|
115
|
-
echo " [5
|
|
159
|
+
echo " [4/5] Running API validation..."
|
|
116
160
|
if ! run_api_tests "$story"; then
|
|
117
161
|
failed=1
|
|
118
162
|
fi
|
|
119
163
|
else
|
|
120
|
-
echo " [5
|
|
164
|
+
echo " [4/5] Running browser validation..."
|
|
121
165
|
if ! run_browser_validation "$story"; then
|
|
122
166
|
failed=1
|
|
123
167
|
fi
|
|
@@ -125,11 +169,11 @@ run_verification() {
|
|
|
125
169
|
fi
|
|
126
170
|
|
|
127
171
|
# ========================================
|
|
128
|
-
# STEP
|
|
172
|
+
# STEP 5: Run PRD test steps
|
|
129
173
|
# ========================================
|
|
130
174
|
if [[ $failed -eq 0 ]]; then
|
|
131
175
|
echo ""
|
|
132
|
-
echo " [
|
|
176
|
+
echo " [5/5] Running PRD test steps..."
|
|
133
177
|
if ! verify_prd_criteria "$story"; then
|
|
134
178
|
failed=1
|
|
135
179
|
fi
|