From 4e3f2aaf365aeba332101fb5ceab6ca22271cb12 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 2 Nov 2026 04:15:44 +0000 Subject: [PATCH 1/4] fix(vibe-coding-mad-libs): match preview wording to show_preview outcomes and fix the form's review issues --- .../skills/start-challenge/SKILL.md | 11 +- challenges/vibe-coding-mad-libs/README.md | 6 +- .../vibe-coding-mad-libs/challenge.json | 2 +- challenges/vibe-coding-mad-libs/dice.mjs | 48 +++++ challenges/vibe-coding-mad-libs/intro.md | 5 +- challenges/vibe-coding-mad-libs/mad-libs.mjs | 84 ++++++-- .../skills/start-challenge/SKILL.md | 36 ++-- test/vibe-coding-mad-libs.test.mjs | 195 ++++++++++++++++-- 8 files changed, 334 insertions(+), 53 deletions(-) create mode 100644 challenges/vibe-coding-mad-libs/dice.mjs diff --git a/challenges/birdsbirdbirds/skills/start-challenge/SKILL.md b/challenges/birdsbirdbirds/skills/start-challenge/SKILL.md index 8f7a871..6eb4649 100644 --- a/challenges/birdsbirdbirds/skills/start-challenge/SKILL.md +++ b/challenges/birdsbirdbirds/skills/start-challenge/SKILL.md @@ -38,8 +38,11 @@ only because someone asks: its condition must hold. Open the drawing page right away, as your first action once the challenge starts (after `session_info`, when you have it): call `show_preview` with -`http://127.0.0.1:4322/` without asking first. Without `show_preview`, give -them that URL to open right away. +`http://127.0.0.1:4322/` without asking first. When its `outcome` is +`offered`, tell them to click Open preview to see the drawing page; nothing +is open yet, so never say it is. When it is `navigated`, say the page is +showing in Chrome beside the station. Without `show_preview`, or when it +fails, give them that URL to open right away. When you resume with `draw-bird` not yet complete, first use `bash` to check whether `bird.png` exists in the current directory: a save made just before @@ -111,8 +114,8 @@ checker or edit it. When it passes, report `animate`. The drawing page switches to the sky on its own once a valid `bird.json` exists. Tell the participant to look at it (call `show_preview` again if the -page was closed). They can press "Draw again" to redraw; if they do, start -again at step 1. +page was closed, and on `offered` tell them to click Open preview). They +can press "Draw again" to redraw; if they do, start again at step 1. Ask how the flight looks and offer one tweak, such as faster, higher, or more wobbly. If they want it, edit `bird.json`, rerun the checker, and let diff --git a/challenges/vibe-coding-mad-libs/README.md b/challenges/vibe-coding-mad-libs/README.md index b915591..11b8b05 100644 --- a/challenges/vibe-coding-mad-libs/README.md +++ b/challenges/vibe-coding-mad-libs/README.md @@ -2,14 +2,16 @@ A 10-minute terminal challenge. The participant fills four Mad Libs blanks, Theme, Subject, Audience, and Style, by inventing answers or rolling physical -dice against [`dice-sheet.md`](dice-sheet.md). Pi builds a self-contained +dice and looking each roll up in the form's Roll dice view, which shows the +tables in [`dice-sheet.md`](dice-sheet.md). Pi builds a self-contained `index.html` from the sentence, shows it in Chrome beside the station, and then makes one change the participant asks for. | File | Role | | --- | --- | -| `mad-libs.mjs` | Pi extension: the four-blank form and `/mad-libs` | +| `mad-libs.mjs` | Pi extension: the four-blank form, its Roll dice view, and `/mad-libs` | | `prompt.mjs` | Assembles and checks the sentence | +| `dice.mjs` | Parses `dice-sheet.md` into the Roll dice tables | | `preview.mjs` | Serves `index.html` on `http://127.0.0.1:4321/` with live reload | | `install` | Installs the Pi packages the extension imports | | `setup`, `cleanup` | Copy the dice sheet and start the preview; stop it | diff --git a/challenges/vibe-coding-mad-libs/challenge.json b/challenges/vibe-coding-mad-libs/challenge.json index 55df3bc..f9572a4 100644 --- a/challenges/vibe-coding-mad-libs/challenge.json +++ b/challenges/vibe-coding-mad-libs/challenge.json @@ -16,7 +16,7 @@ { "id": "fill-prompt", "title": "Fill in your prompt", - "hint": "Fill the four blanks. Invent answers, or roll dice and ask Pi to show dice-sheet.md.", + "hint": "Fill the four blanks. Invent answers, or roll dice and look them up with the form's Roll dice.", "done_when": "The participant sent a prompt naming a kind of app, a subject, an audience, and a style, with no blank left unfilled." }, { diff --git a/challenges/vibe-coding-mad-libs/dice.mjs b/challenges/vibe-coding-mad-libs/dice.mjs new file mode 100644 index 0000000..5dcceb3 --- /dev/null +++ b/challenges/vibe-coding-mad-libs/dice.mjs @@ -0,0 +1,48 @@ +// The optional dice tables, parsed from dice-sheet.md: the one copy the form +// shows and setup gives the workspace. + +import { readFileSync } from 'node:fs' + +import { FIELDS } from './prompt.mjs' + +const DICE_SHEET = new URL('./dice-sheet.md', import.meta.url) + +const TABLE_HEADING = /^## (\w+) \(d(\d+)\)$/ +const TABLE_ROW = /^\| (\d+) \| (.+?) \|$/ + +/** + * Parses a dice sheet's `##