diff --git a/tools/ralph/Dockerfile b/tools/ralph/Dockerfile index f273f5028..1f68db060 100644 --- a/tools/ralph/Dockerfile +++ b/tools/ralph/Dockerfile @@ -73,4 +73,4 @@ ENV PATH="/app/labs/tools/ralph/bin:$PATH" # If you want to run ralph normally without the smoketest, then replace with: # CMD ["/bin/sh", "-c", "/app/start-servers.sh & sleep infinity"] # Note: Directories are pre-created by run_smoketest.sh to ensure correct ownership -CMD ["/bin/sh", "-c", "/app/start-servers.sh & sleep 5 && /app/labs/tools/ralph/bin/ralph-smoketest.sh > /app/smoketest/${RALPH_ID}/ralph.log 2>&1"] +CMD ["/bin/bash", "-c", "/app/start-servers.sh & sleep 5 && TIMEFORMAT='%R'; { time /app/labs/tools/ralph/bin/ralph-smoketest.sh > /app/smoketest/${RALPH_ID}/ralph.log 2>&1 ; } 2> /app/smoketest/${RALPH_ID}/TIMING_SECONDS.txt"] diff --git a/tools/ralph/README.md b/tools/ralph/README.md index 2ee036a65..501ac731d 100644 --- a/tools/ralph/README.md +++ b/tools/ralph/README.md @@ -37,7 +37,7 @@ variable. **Option 1: Use the automated script (recommended)** -Run multiple smoketests in parallel (currently configured for tasks 1-8): +Run multiple smoketests in parallel (currently configured for tasks 1-9): ```bash ./tools/ralph/bin/run_smoketest.sh @@ -113,6 +113,7 @@ Results are available on the host machine in - `ralph.log` - Complete log of Ralph's execution (stdout and stderr) - `SCORE.txt` - Contains SUCCESS, PARTIAL, or FAILURE - `RESULTS.md` - Summary of work including test results +- `TIMING_SECONDS.txt` - Total execution time in seconds (decimal format) - Pattern files (created directly in this directory for automatic cleanup) No need to copy files from the container - the bind mount makes results diff --git a/tools/ralph/SMOKETEST_PROMPT.md b/tools/ralph/SMOKETEST_PROMPT.md index 93650e7d9..b0696f921 100644 --- a/tools/ralph/SMOKETEST_PROMPT.md +++ b/tools/ralph/SMOKETEST_PROMPT.md @@ -1,31 +1,25 @@ # Smoketest Ralph General Prompt -Goal: implement the unchecked item from `./tools/ralph/TASKS.md` that matches -your assigned RALPH_ID +Goal: implement the task below -1. Open `/app/labs/tools/ralph/TASKS.md` and find the task numbered with your - RALPH_ID. + -2. If your assigned task is already checked `[x]`, exit with a message saying - the task is already complete. - -3. Use Claude Skills "pattern-dev" to work on the task that corresponds to your - RALPH_ID number. +1. Use Claude Skills "pattern-dev" to work on the task above. IMPORTANT: - Create your pattern files directly in /app/smoketest/${RALPH_ID}/ - Use space name "ralph${RALPH_ID}" (e.g., ralph1, ralph2, ralph3) to avoid conflicts with other parallel smoketests -4. Format with `deno fmt` for the changed files. +2. Format with `deno fmt` for the changed files. -5. Once tests pass, deploy it locally using +3. Once tests pass, deploy it locally using `/app/labs/docs/common/PATTERN_DEV_DEPLOY.md` for info on how to deploy. It should deploy to http://localhost:8000. Servers are already running. Remember to use space name "ralph${RALPH_ID}" when deploying. -6. Once it is deployed locally, test your work using Playwright MCP tools +4. Once it is deployed locally, test your work using Playwright MCP tools directly. IMPORTANT: Use the MCP tools (like `mcp__playwright__browser_navigate`, @@ -43,19 +37,19 @@ your assigned RALPH_ID - Verify behavior matches task requirements - Take final screenshot showing successful interactions -7. Create a summary of your work in /app/smoketest/${RALPH_ID}/RESULTS.md +5. Create a summary of your work in /app/smoketest/${RALPH_ID}/RESULTS.md Include: - What pattern you implemented - Test results (deno test output) - Playwright test results and what you tested - Any issues or limitations -8. Create /app/smoketest/${RALPH_ID}/SCORE.txt with one of the following values +6. Create /app/smoketest/${RALPH_ID}/SCORE.txt with one of the following values based on your results: - SUCCESS: All tests pass, pattern works as expected - PARTIAL: Some tests pass, pattern partially works - FAILURE: Tests fail or pattern doesn't work -9. Exit +7. Exit Please begin. diff --git a/tools/ralph/TASKS.md b/tools/ralph/TASKS.md index 227fbffb9..0109d1a2e 100644 --- a/tools/ralph/TASKS.md +++ b/tools/ralph/TASKS.md @@ -5,7 +5,13 @@ - Data: Current count value - Features: Increment, decrement, reset to zero -2. [ ] Shopping List with sort-by-category and budget tracking. These should be +2. [ ] Dice Roller + - Components: Roll button + Result display showing dice emoji and number + - Data: Current dice value (1-6) + - Features: Click button to roll dice, display random result (1-6) with 🎲 + emoji + +3. [ ] Shopping List with sort-by-category and budget tracking. These should be 3 different patterns (shopping list, category list, and budget tracker) and a final pattern that combines them together and acts as a launcher. - Components: Shopping list (item input + checkboxes + clear button) + @@ -16,38 +22,38 @@ - Features: Add/remove items, assign categories, track prices, sort by category, view budget totals, check off purchased items -3. [ ] Calendar +4. [ ] Calendar - Components: Month view with day cells + Event list displayed in calendar + Day editor (opens when clicking a day) - Data: Events with date, time, description - Features: View one month at a time, click day to edit its event list, events shown in calendar UI -4. [ ] Fitness Workout Planner +5. [ ] Fitness Workout Planner - Components: Exercise routine builder + Set/rep counter + Progress chart - Data: Exercises with sets, reps, weight - Features: Track personal records, show strength gains over time -5. [ ] Lunch Voter +6. [ ] Lunch Voter - Components: Restaurant list + Voting buttons + Vote tally display + Add/remove restaurant form - Data: Restaurants with vote counts - Features: Add/remove restaurants, vote for favorites, see most popular choice -6. [ ] Study Schedule with Focus Timer +7. [ ] Study Schedule with Focus Timer - Components: Study task list + Time block scheduler + Pomodoro timer + Break reminders - Data: Study topics, estimated duration, completion status - Features: Schedule study sessions, track time spent, enforce breaks -7. [ ] Travel Itinerary with Budget Tracker +8. [ ] Travel Itinerary with Budget Tracker - Components: Activity scheduler + Day-by-day timeline + Expense tracker + Budget dashboard - Data: Activities with time, location, cost - Features: Plan entire trip, track expenses by category, budget warnings -8. [ ] Contact Manager with Birthday Reminders +9. [ ] Contact Manager with Birthday Reminders - Components: Contact list + Upcoming birthdays view + Gift idea notes + Calendar integration - Data: Contacts with birthdays, gift history diff --git a/tools/ralph/bin/ralph-smoketest.sh b/tools/ralph/bin/ralph-smoketest.sh index fb5d6333a..168167007 100755 --- a/tools/ralph/bin/ralph-smoketest.sh +++ b/tools/ralph/bin/ralph-smoketest.sh @@ -28,17 +28,42 @@ done # llm command to summarize changes LLM="./tools/ralph/bin/llm.sh" -{ printf "Your RALPH_ID is %s.\n\n" "$RALPH_ID"; cat ./tools/ralph/SMOKETEST_PROMPT.md; } | \ +# Extract task for this RALPH_ID from TASKS.md +TASK=$(awk -v id="$RALPH_ID" ' +/^[0-9]+\. \[ \]/ { + task_num = substr($1, 1, length($1)-1) + if (task_num == id) { + found = 1 + # Strip the "N. [ ] " prefix from first line + sub(/^[0-9]+\. \[ \] /, "") + print + next + } +} +found && /^[0-9]+\. \[ \]/ { + exit +} +found { + print +} +' ./tools/ralph/TASKS.md) + +# If no task found, provide default message +if [ -z "$TASK" ]; then + TASK="You have no task, just exit" +fi + +# Replace in prompt and pipe to claude +{ + printf "Your RALPH_ID is %s.\n\n" "$RALPH_ID" + awk -v task="$TASK" '{ + if ($0 ~ //) { + print task + } else { + print $0 + } + }' ./tools/ralph/SMOKETEST_PROMPT.md +} | \ claude --print --dangerously-skip-permissions \ --verbose --output-format=stream-json 2>&1 | \ tee -a ./tools/ralph/logs/ralph-claude.log - -# Auto-stash changes if any exist -if [[ -n "$(git status --porcelain)" ]]; then - git add -A - - # Generate commit message from staged changes - commit_msg=$(git diff --staged | $LLM "Summarize these changes into a short one-line description, output just that one line") - - git stash push -m "$commit_msg" -fi diff --git a/tools/ralph/bin/run_smoketest.sh b/tools/ralph/bin/run_smoketest.sh index d0461c3c3..dc7b8b317 100755 --- a/tools/ralph/bin/run_smoketest.sh +++ b/tools/ralph/bin/run_smoketest.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Ralph IDs to run smoketests for -RALPH_IDS="1 2 3 4 5 6 7 8" +RALPH_IDS="1 2 3 4 5 6 7 8 9" # Get the directory where this script is located SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"