omp packages

@blackbelt-technology/frontend-mockup-loop0.12.0

Pi extension + skill for a ground→contract→mockup→test→fix→learn frontend design loop. Ships a live mockup server tool, a Playwright breakpoint-screenshot tool, and a design-contract scaffolder. Works in any React/Tailwind/shadcn project.

GitHub Actions Published 6 hours ago MIT ~217 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

@blackbelt-technology/frontend-mockup-loop

A pi package — extension + skill — for a disciplined frontend design loop:

GROUND → CONTRACT → MOCKUP → TEST → FIX → PROMOTE → LEARN

It exists to defeat distributional convergence: an undirected agent regresses to the statistical mean (generic Inter font, purple gradient, centered hero). The fix — deliberate direction, a consistent token system, and a screenshot feedback loop — is what this loop enforces.

Generic: works in any React/Tailwind/shadcn (or plain HTML) project.

Install

pi install npm:@blackbelt-technology/frontend-mockup-loop
# or try without installing:
pi -e npm:@blackbelt-technology/frontend-mockup-loop

This registers:

  • Skill frontend-mockup-loop — the 7-step workflow (load via /skill:frontend-mockup-loop).
  • Tools the agent can call:
    Tool Purpose
    serve_mockup Serve a mockup dir (inside the session cwd) over HTTP, loopback-only by default; pass lan:true to also listen on the LAN (phone check). Returns token URLs (http://localhost:<port>/<token>/). Zero deps. Breaking: root-relative links like /style.css no longer resolve under the token prefix — use relative links (style.css).
    score_mockup Capture full-page screenshots at mobile/tablet/desktop widths via Playwright; returns paths + a scoring rubric. With system, uses that preset's boolean rubric.
    init_ui_contract Scaffold a token-referencing ui-contract.md consistency control plane. With system, write that preset's DTCG token contract.
    list_design_systems Enumerate the selectable design-system presets.
    validate_mockup Run the layered validation pipeline for a system (L1+L2 gates, L3+L4 advisory); returns { gates, advisory, pass }.
    serve_mock_site Start the project's live-component mock site through the project's own launcher with its inherited build config (port 5299, localhost only unless lan). Show the URL to the user.
  • Command /mockup-loop — print the loop and point at the skill.
  • Bins mock-decide (records a page decision; the only writer), mock-capture (HTTP traffic → redacted fixtures), mock-check (headless script loops), mock-video (one loop to .webm).

Live-component mock site

For React projects, mocks render the app's real components instead of hand-built HTML. One directory per mock page, mockups/<yyyy-mm-dd-slug>/mock.tsx:

import { Fix, Issue, type Mock } from "mock-site/kit";
const mock: Mock = { title: "Settings - save bar", category: "Settings", frames: [
  { title: "Settings - desktop",
    current: <Issue n={1} tip="Save hidden below the fold"><Settings {...today} /></Issue>,
    proposed: <Fix n={1} tip="Sticky save bar"><Settings {...next} /></Fix> },
] };
export default mock;
  • Exact environment: the site inherits the app's own build config (aliases, plugins, css, define) through the project's launcher — declared in package.json "mockSite": { "launcher", "config" } or detected. No mirrored config; mockups/mock-site.config.ts is an optional options object.
  • Current | Proposed (or New) panes; phone: true renders a real 375px iframe; surroundings wraps both panes in the same real app shell.
  • Numbered rings (Issue red, Fix green) circle the elements that change.
  • Fixtures: a per-pane factory answers the app's HTTP / WebSocket traffic in-page; unanswered requests are listed as missing fixtures. mock-capture records real traffic, redacted, refusing on secrets.
  • Scripts: real click / type / hover steps on the real components with a visible pointer, looped; mock-check proves them, mock-video records them.
  • Decisions are read-only in the site; the agent records them with mock-decide accept|reject <ref> "why" into mockups/<id>/decision.json.
  • Every page, frame, side, ring and step has a link: #<id>/<frame>/<side>/<ring|step-k>.
  • Themes come from the options (first = default; system follows the OS).

Setup and the full authoring rules: references/live-mock-site.md. Install it in the project too (npm i -D @blackbelt-technology/frontend-mockup-loop) so the site can load it; pi install only gives pi the tools. Needs vite and react / react-dom in the project (optional peers); fixtures need @mswjs/interceptors, scripts @testing-library/user-event (optional peers, loaded only by those panes).

Selectable design systems

The loop runs design-system agnostic by default. Pass --system <id> (the tools' system param) to target a specific system. v1 presets:

id system platform substrate
shadcn shadcn/ui + Tailwind web HTML + Tailwind
mui Material UI web HTML
material-3 Material Design 3 web HTML
fluent-2 Fluent 2 web HTML
apple-hig Apple HIG iOS HTML approximation → SwiftUI on promote
  • init_ui_contract{system:"shadcn"} writes the shadcn DTCG contract from a bundled offline snapshot (presets-data/<id>/); no system still writes the generic blank template (back-compat).
  • validate_mockup{system,dir} gates on L1 (token-lint) + L2 (axe + WCAG contrast) and scores on L3 (named-system auditor) + L4 (boolean rubric).
  • Apple HIG ships a hand-authored rule pack (presets-data/apple-hig/rules.md); rendered as an HTML approximation in-loop, SwiftUI emitted only on PROMOTE.

Dependency posture

  • Bundled (hard deps): @axe-core/playwright + eslint-plugin-tailwindcss (shadcn L1). WCAG contrast math is inline (no extra dep).
  • Optional (shelled out only if installed, else skipped + noted): hig-doctor, material3-mcp, MUI/Fluent eslint plugins, lumo.
  • score_mockup uses Playwright if present — enable breakpoint capture with npm i -D playwright && npx playwright install chromium; without it, score_mockup returns the rubric plus manual-capture guidance. A missing pinned browser build falls back to the cached builds, newest first.

Refreshing snapshots

Bundled token snapshots (presets-data/<id>/contract.tokens.json) are versioned with the package and lag upstream. init_ui_contract{system,refresh:true} re-fetches the upstream source before writing. Upstream sources per preset:

preset upstream source
shadcn shadcn CSS variables (default theme) → DTCG
mui @mui/material createTheme() defaults → DTCG
material-3 Material 3 --md-sys-* baseline tokens → DTCG
fluent-2 @fluentui/tokens webLightTheme → DTCG
apple-hig hand-authored rule pack (no upstream token JSON)

Expert UX designer mode

The skill acts as an expert UX designer: every decision is grounded in an externally documented, public-facing design rule (Nielsen's 10 heuristics, Laws of UX, Gestalt, WCAG 2.2, GOV.UK/USWDS/Material patterns) — never invented. The full citable rule corpus is bundled at references/ux-best-practices.md: the source hierarchy (licensing-safe), universal laws, per-component pattern rules, the 5-step expert evaluation protocol, and a 22-item checkable rubric seed used by score_mockup / validate_mockup.

The design contract

ui-contract.md is the single source of truth for cross-screen consistency: color ramps, spacing/type scales, radius, elevation, motion, component invariants — every value references a design token, never a raw hex/px. init_ui_contract scaffolds it; you fill it from the real tokens captured in the GROUND step.

License

MIT