mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-07 05:56:41 +02:00
refactor: replace broken file:// polling with {{DESIGN_SHOTGUN_LOOP}}
plan-design-review and design-consultation templates previously used
$B goto file:// + $B eval polling for the comparison board feedback loop.
This was broken (browse blocks file:// URLs). Both templates now use
{{DESIGN_SHOTGUN_LOOP}} which serves via HTTP, handles regeneration in
the same browser tab, and falls back to AskUserQuestion.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -205,69 +205,15 @@ $D check --image "$_DESIGN_DIR/variant-A.png" --brief "<the original brief>"
|
||||
|
||||
Flag any variants that fail the quality check. Offer to regenerate failures.
|
||||
|
||||
Create a comparison board and open it for review:
|
||||
Show each variant inline (Read tool on each PNG) so the user sees them immediately.
|
||||
|
||||
```bash
|
||||
$D compare --images "$_DESIGN_DIR/variant-A.png,$_DESIGN_DIR/variant-B.png,$_DESIGN_DIR/variant-C.png" --output "$_DESIGN_DIR/design-board.html"
|
||||
```
|
||||
Tell the user: "I've generated design directions. Take a look at the variants above,
|
||||
then use the comparison board that just opened in your browser to pick your favorite,
|
||||
rate the others, remix elements, and click Submit when you're done."
|
||||
|
||||
Open the comparison board for the user. If `$B` is available (BROWSE_READY was printed
|
||||
during setup), use it. Otherwise fall back to `open` which works on macOS:
|
||||
{{DESIGN_SHOTGUN_LOOP}}
|
||||
|
||||
```bash
|
||||
if [ -x "$B" ]; then
|
||||
$B goto "file://$_DESIGN_DIR/design-board.html"
|
||||
else
|
||||
open "$_DESIGN_DIR/design-board.html"
|
||||
fi
|
||||
```
|
||||
|
||||
Tell the user: "I've generated design directions and opened the comparison board. Pick your favorite, rate the others, and click Submit when you're done."
|
||||
|
||||
**Poll for user feedback from the comparison board.**
|
||||
|
||||
The comparison board has a Submit button that writes structured JSON to hidden DOM
|
||||
elements. Poll for the user's submission:
|
||||
|
||||
```bash
|
||||
$B eval document.getElementById('status').textContent
|
||||
```
|
||||
|
||||
- If empty: user hasn't submitted yet. Wait 10 seconds and poll again.
|
||||
- If `"submitted"`: read the feedback below.
|
||||
- If `"regenerate"`: user wants new variants. Read the regeneration request from
|
||||
`feedback-result`, generate new variants with the updated brief using `$D variants`
|
||||
or `$D iterate`, update the comparison board, and resume polling.
|
||||
|
||||
When status is `"submitted"`, read the structured feedback:
|
||||
|
||||
```bash
|
||||
$B eval document.getElementById('feedback-result').textContent
|
||||
```
|
||||
|
||||
This returns JSON like:
|
||||
```json
|
||||
{
|
||||
"preferred": "A",
|
||||
"ratings": { "A": 4, "B": 3, "C": 2 },
|
||||
"comments": { "A": "Love the spacing", "B": "Too busy", "C": "Wrong mood" },
|
||||
"overall": "Go with A, make the CTA bigger",
|
||||
"regenerated": false
|
||||
}
|
||||
```
|
||||
|
||||
**If `$B` is not available** (BROWSE_NOT_AVAILABLE): the board was opened with `open`
|
||||
and you cannot poll the DOM. In this case, send a text message asking the user to
|
||||
describe their choice (which variant, what to change). Do NOT use AskUserQuestion —
|
||||
their feedback may combine elements across variants. Wait for free-form response.
|
||||
|
||||
Note which direction was approved — this becomes the visual reference for all subsequent review passes.
|
||||
|
||||
After the user picks a direction, write an `approved.json` to record the choice:
|
||||
|
||||
```bash
|
||||
echo '{"approved_variant":"<VARIANT>","feedback":"<USER_FEEDBACK>","date":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","screen":"<SCREEN_NAME>","branch":"'$(git branch --show-current 2>/dev/null)'"}' > "$_DESIGN_DIR/approved.json"
|
||||
```
|
||||
Note which direction was approved. This becomes the visual reference for all subsequent review passes.
|
||||
|
||||
**Multiple variants/screens:** If the user asked for multiple variants (e.g., "5 versions of the homepage"), generate ALL as separate variant sets with their own comparison boards. Each screen/variant set gets its own subdirectory under `designs/`. Complete all mockup generation and user selection before starting review passes.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user