Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/ralph/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
3 changes: 2 additions & 1 deletion tools/ralph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
24 changes: 9 additions & 15 deletions tools/ralph/SMOKETEST_PROMPT.md
Original file line number Diff line number Diff line change
@@ -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.
<SMOKETEST_TASK>

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`,
Expand All @@ -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.
20 changes: 13 additions & 7 deletions tools/ralph/TASKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) +
Expand All @@ -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
Expand Down
47 changes: 36 additions & 11 deletions tools/ralph/bin/ralph-smoketest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <SMOKETEST_TASK> in prompt and pipe to claude
{
printf "Your RALPH_ID is %s.\n\n" "$RALPH_ID"
awk -v task="$TASK" '{
if ($0 ~ /<SMOKETEST_TASK>/) {
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
2 changes: 1 addition & 1 deletion tools/ralph/bin/run_smoketest.sh
Original file line number Diff line number Diff line change
@@ -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)"
Expand Down