mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-22 12:50:50 +02:00
feat(design): {{DESIGN_DETECTOR}} wired into design-review, ship review-lite, review army, design-html
The user-installed impeccable engine becomes a deterministic pre-pass in four
skills, through one resolver with three renders: {{DESIGN_DETECTOR}} (the probe
block and how to read every sentinel), {{DESIGN_DETECTOR:phase0}} (design-
review's mechanical scan), {{DESIGN_DETECTOR:gate}} (design-html's bounded slop
gate). Every rendered invocation is `bun --no-env-file run <bin>/gstack-design-
detect.ts ... --host <host>` and every scan ends with the DETECT_EXIT_CODE echo
so exit 2 (findings) never aborts a block.
design-review: probe in Setup; Phase 0 picks DOM mode (URL target) or source
mode (diff-aware, no URL) once; source mode scans the changed frontend files in
Setup, DOM mode never reads source (Rule 4). Phase 3 gains a DOM-dump step per
page: both browser engines load the shared script from lib/dom-dump.js (Aside
splices it into a double-quoted repl script; the fallback engine copies it into
a temp dir for `$B eval --out --raw`), the dump is size-capped, run through
gstack-redact (a HIGH finding skips the page), and persisted under
$REPORT_DIR/dom/$RUN_ID/; one scan runs after the last page, labeled "static
scan of the rendered DOM; cross-origin CSS not resolved". REPORT_DIR honors
GSTACK_HOME so the wrapper's allow-list and the report dir agree; RUN_ID is set
once in Setup. design-baseline.json is schemaVersion 2 with runId, targetSet,
base, and a detector block (mode, engine, byRule, byPage), written temp+rename
with a per-run copy; Regression Output diffs ids only when mode and target set
match, caveats an engine change, and calls live-page count deltas advisory.
Phase 7 hands deferred detector findings to the `handoff=` command the scan
printed; Phase 9 recomputes the same way and deletes the dumps unless
--keep-dom; Phase 10 reports `Detector: N → M`.
ship review-lite gains step 0 (probe, `scan --changed <base>`, tier buckets,
detector + checklist dedupe, advisory and ignored never count) and a
`detector` count in its log payload; the PR body gets a Detector line (rule
ids and counts only). The Review Army Design specialist runs the mechanical
pass at the top of review/design-checklist.md, which now carries it. design-
html probes after DESIGN_SETUP and runs the one-pass gate before screenshots.
lib/dom-dump.js is generated by gen-skill-docs from lib/dom-dump-script.ts
(Claude host, --out-dir aware, dry-run freshness) and pinned byte-equal, so the
prose never carries the script. The contract gains DETECT_JSON, DOM_DUMP_OK,
and the self-describing set; its test now checks both directions.
Budget: design-review eager 25.6K → 28.5K. The plan's target was +2.5K; after
the levers it named (ids-only detector rules, no inline script, trimmed prose)
it lands at +2.87K, and the remainder is doctrine and detector wiring, so the
ceiling moves to the captured 31,319 for design-review only (the full capture
would also have loosened 21 ceilings this branch never touched; those stay).
design-html skeleton re-baselined to 54,000 (measured 53,592). Codex and
Factory ship goldens refreshed (review-lite step 0 and the PR-body line render
inline there).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
3867dae355
commit
3522073ef0
@@ -88,15 +88,22 @@ If `DESIGN_READY`: during the fix loop, you can generate "target mockups" showin
|
||||
|
||||
If `DESIGN_NOT_AVAILABLE`: skip mockup generation — the fix loop works without it.
|
||||
|
||||
{{DESIGN_DETECTOR}}
|
||||
|
||||
**Create output directories:**
|
||||
|
||||
```bash
|
||||
eval "$(~/.claude/skills/gstack/bin/gstack-slug 2>/dev/null)"
|
||||
REPORT_DIR="$HOME/.gstack/projects/$SLUG/designs/design-audit-$(date +%Y%m%d)"
|
||||
mkdir -p "$REPORT_DIR/screenshots"
|
||||
echo "REPORT_DIR: $REPORT_DIR"
|
||||
REPORT_DIR="${GSTACK_HOME:-$HOME/.gstack}/projects/$SLUG/designs/design-audit-$(date +%Y%m%d)"
|
||||
RUN_ID="$(date +%H%M%S)-$$"
|
||||
mkdir -p "$REPORT_DIR/screenshots" "$REPORT_DIR/dom/$RUN_ID"
|
||||
echo "REPORT_DIR: $REPORT_DIR"; echo "RUN_ID: $RUN_ID"
|
||||
```
|
||||
|
||||
Remember `RUN_ID` and restate it literally in later blocks (each bash block is a fresh shell). DOM dumps land in `$REPORT_DIR/dom/$RUN_ID/`; nothing from earlier runs is touched.
|
||||
|
||||
{{DESIGN_DETECTOR:phase0}}
|
||||
|
||||
---
|
||||
|
||||
{{LEARNINGS_SEARCH}}
|
||||
@@ -145,6 +152,8 @@ Sort all discovered findings by impact, then decide which to fix:
|
||||
|
||||
Mark findings that cannot be fixed from source code (e.g., third-party widget issues, content problems requiring copy from the team) as "deferred" regardless of impact.
|
||||
|
||||
Detector findings carry their `[rule-id]`; a deferred one ends with its `handoff=` command when `IMPECCABLE_SKILL: present` (Phase 0 lists them), and nothing when the detector did not run.
|
||||
|
||||
---
|
||||
|
||||
## Phase 8: Fix Loop
|
||||
@@ -261,7 +270,8 @@ After all fixes are applied:
|
||||
1. Re-run the design audit on all affected pages
|
||||
2. If target mockups were generated during the fix loop AND `DESIGN_READY`: run `$D verify --mockup "$REPORT_DIR/screenshots/finding-NNN-target.png" --screenshot "$REPORT_DIR/screenshots/finding-NNN-after.png"` to compare the fix result against the target. Include pass/fail in the report.
|
||||
3. Compute final design score and AI slop score
|
||||
4. **If final scores are WORSE than baseline:** WARN prominently — something regressed
|
||||
4. Recompute the detector count the same way Phase 0 scanned: DOM mode re-dumps the affected pages after reload into `$REPORT_DIR/dom/$RUN_ID/` and rescans; source mode rescans the files you touched. Then delete `$REPORT_DIR/dom/$RUN_ID/` unless the user passed `--keep-dom`.
|
||||
5. **If final scores are WORSE than baseline:** WARN prominently — something regressed
|
||||
|
||||
---
|
||||
|
||||
@@ -289,6 +299,7 @@ Write a one-line summary to `~/.gstack/projects/{slug}/{user}-{branch}-design-au
|
||||
- Deferred findings
|
||||
- Design score delta: baseline → final
|
||||
- AI slop score delta: baseline → final
|
||||
- Detector: N → M (counted findings; "not installed" or "off" when it did not run)
|
||||
|
||||
**PR Summary:** Include a one-line summary suitable for PR descriptions:
|
||||
> "Design review found N issues, fixed M. Design score X → Y, AI slop score X → Y."
|
||||
|
||||
Reference in New Issue
Block a user