launchframe 0.4.5 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@ argument-hint: "<url> \"<saas-idea>\""
13
13
  1. **Reference URL(s)** — Every `http://` or `https://` token (clone each site; use `docs/research/<hostname>/` when there are multiple).
14
14
  2. **SaaS idea** — All remaining text that is not a URL (often quoted): product pitch for hero and key marketing lines.
15
15
 
16
- You are a **foreman walking the job site** — write specs per section, dispatch builders in parallel where possible, merge, QA. Not a shallow inspect-then-guess flow.
16
+ You are a **foreman walking the job site** — write specs per section, dispatch builders in parallel where possible, **dispatch verification subagents** after assembly to audit images / DOM / CSS / motion, merge their findings, then QA. Not a shallow inspect-then-guess flow.
17
17
 
18
18
  ## Step 0 — Persist Launchframe inputs
19
19
 
@@ -33,7 +33,7 @@ After structure and styles match the reference, apply the **SaaS idea** to hero,
33
33
 
34
34
  The target page(s) are the URL(s) you parsed in Pre-Flight. Clone exactly what's visible at each URL. Unless the user specifies otherwise, use these defaults:
35
35
 
36
- - **Fidelity level:** Pixel-perfect — exact match in colors, spacing, typography, animations
36
+ - **Fidelity level:** Pixel-perfect — exact match in colors, spacing, typography, animations, **image presentation**, **DOM structure**, and **authored CSS intent** (computed values must match after extraction)
37
37
  - **In scope:** Visual layout and styling, component structure and interactions, responsive design, mock data for demo purposes
38
38
  - **Out of scope:** Real backend / database, authentication, real-time features, SEO optimization, accessibility audit
39
39
  - **Customization:** Structure and visuals — pure emulation of the reference. **Marketing copy** — apply the parsed **SaaS idea** where hero/headlines/CTAs are interchangeable (see “SaaS copy overlay” above); do not invent a different product than the user’s idea.
@@ -43,8 +43,8 @@ If the user provides additional instructions (specific fidelity level, customiza
43
43
 
44
44
  ## Pre-Flight
45
45
 
46
- 1. **Browser automation is required.** Check for available browser MCP tools (Chrome MCP, Playwright MCP, Browserbase MCP, Puppeteer MCP, etc.). Use whichever is available — if multiple exist, **prefer Chrome DevTools MCP** for inspection: it maps to the same engine the user sees and preserves **computed `animation` / `transition` / scroll-driven** values accurately. If none are detected, ask the user which browser tool they have and how to connect it. This skill cannot work without browser automation. **Pixel-perfect MCP:** every extract and QA pass must follow **Browser MCP: pixel-perfect capture** (Phase 1) locked viewports, **verbatim** `getComputedStyle` strings (including fractional `px`, `rem`, `oklch`/`rgba`), and **geometry** from `getBoundingClientRect()` where layout matters. **Motion parity:** every pass must treat **motion as first-class** — same **durations, delays, easings (`cubic-bezier` / steps), iteration counts, fill modes, directions, keyframe percentages, and scroll/view-timeline bindings** as the live site, not “similarmotion.
47
- 2. **Parse arguments** — extract every `http://` / `https://` URL token (there may be several). **SaaS idea** = the remaining non-URL text (trim outer quotes). Normalize and validate each URL; if any are invalid, or the SaaS idea is missing, ask the user once. For each valid URL, verify it is accessible via your browser MCP tool.
46
+ 1. **Real browser automation is required.** Check for browser MCP tools (Chrome DevTools MCP first, then Playwright MCP, Browserbase MCP, Puppeteer MCP, etc.). **Prefer Chrome DevTools MCP** when it is connected: run **`evaluate_script` / in-page `evaluate`** on the live tab so motion is measured from the same rendering pipeline users see (`getComputedStyle`, Web Animations API, stylesheet keyframes where readable). If multiple tools are available, still use **Chrome MCP for reconnaissance and motion extraction**; other tools are fine for screenshots or navigation if needed. If no browser MCP is detected, ask the user once how to connect Chrome DevTools MCP (or another tool) this skill cannot run blind. **Motion is first-class:** durations, delays, easings, keyframe curves, scroll/view timelines, and interaction triggers must be **copied from live measurements**, not invented from adjectives like smoothor “snappy.”
47
+ 2. **Parse arguments** — extract every `http://` / `https://` URL token (there may be several). **SaaS idea** = the remaining non-URL text (trim outer quotes). Normalize and validate each URL; if any are invalid, or the SaaS idea is missing, ask the user once. For each valid URL, verify it is accessible via **Chrome MCP** (preferred) or your connected browser tool.
48
48
  3. Verify the base project builds: `npm run build`. The Next.js + shadcn/ui + Tailwind v4 scaffold should already be in place. If not, tell the user to set it up first.
49
49
  4. Create the output directories if they don't exist: `docs/research/`, `docs/research/components/`, `docs/design-references/`, `scripts/`. For multiple clones, also prepare per-site folders like `docs/research/<hostname>/` and `docs/design-references/<hostname>/`.
50
50
  5. When working with multiple sites in one command, optionally confirm whether to run them in parallel (recommended, if resources allow) or sequentially to avoid overload.
@@ -57,12 +57,30 @@ These are the truths that separate a successful clone from a "close enough" mess
57
57
 
58
58
  When you traverse the DOM and the Network panel, do **not** treat all nodes equally. Work in this **priority order** so the clone feels like the original, not a wireframe:
59
59
 
60
- 1. **Images (raster + video stills)**Enumerate `<img>`, `<picture>`, responsive `srcset`, `data-*` lazy URLs, **computed `background-image`** on the element and parents (including pseudo-elements), mask images, `<video poster>`, hero media. **Scrape:** download binary assets to `public/images/` (or `public/videos/`) with stable paths referenced in specs. **Create** a replacement PNG/WebP/SVG only when the asset is blocked (CORS, auth cookie, 403), ephemeral, or impossible to URL-fetch — use a high-DPI screenshot crop, traced artwork, or CSS gradient approximation, and mark `ASSET_SOURCE: generated` in the component spec with a short reason.
60
+ 1. **Images (raster + video stills) — HTML, files, and CSS together** Enumeration is not enough: the clone must match **how** each asset is mounted and styled.
61
+ - **Markup parity:** Preserve `<picture>` / `<source>` **order**, **`media` / `type`** attributes, and **`sizes`** where the reference uses them; preserve **`srcset`** descriptor patterns (w/x qualifiers) on `<img>` or **equivalent** `next/image` `sizes` + `srcSet` (document the mapping in the spec). Copy **`loading`**, **`decoding`**, **`fetchpriority`**, **`alt`**, **`role`/`aria-*`** when they affect layout or LCP. **`width` / `height`** (or intrinsic aspect + CSS `aspect-ratio`) must stop layout shift the same way as the reference; note **`width`/`height` attributes vs CSS** if both exist.
62
+ - **Box + painting:** Extract and reproduce **`object-fit`**, **`object-position`**, **parent `overflow`**, **clipping `border-radius`**, **masks**, **`filter`**, and **`mix-blend-mode`** on the same stacking context as the live node. **`background-image`** on the element or **`::before` / `::after`** must use the **same** cover/contain behavior, **position**, **size**, **repeat**, and **attachment** (record pseudo-elements explicitly in the spec).
63
+ - **Files:** Download real bytes to `public/images/` (or videos/posters). **Provenance** in spec: URL hash or byte size so verifiers can confirm the correct asset. No “similar” stock swaps unless marked **substitute** per Scope Defaults.
61
64
  2. **SVGs & iconography** — Inline `<svg>`, sprite `symbol` defs, **SVG used as masks/filters**, icon fonts (prefer path extraction). Convert to `@/components/icons.tsx` (or section-local components) with meaningful names. Prioritize crisp edges and correct `viewBox` over shrinking bundle size during emulation.
62
- 3. **Motion & animation** — CSS `@keyframes`, `animation`, `animation-timeline` / `view-timeline` / `animation-range`, `transition`, `transform`, `transform-origin`, will-change; JS-driven motion (carousel timing, IntersectionObserver reveals); libraries (GSAP, Framer, Lottie JSON, Lenis). Capture **numbers** (ms, `cubic-bezier()`, `steps()`, stagger, scroll thresholds, **named keyframe blocks**), not adjectives — paste **verbatim** `cssText` for relevant `@keyframes` into specs when obtainable. Include **reduced-motion** (`matchMedia('(prefers-reduced-motion: reduce)'))` behavior if present.
65
+ 3. **Motion & animation (Chrome MCP)** Treat this like color and spacing: **numeric fidelity**. In Chrome MCP, evaluate scripts against the live page to capture:
66
+ - Full **`animation`** shorthand plus **`animation-*` longhands** (`animation-name`, `-duration`, `-delay`, `-timing-function`, `-iteration-count`, `-direction`, `-fill-mode`, `-play-state`, **`animation-timeline`** / scroll timelines)
67
+ - Full **`transition`** shorthand plus **`transition-*` longhands**, and **`transform`** / **`will-change`** as applied during and after motion
68
+ - **Author `@keyframes`** — walk `document.styleSheets` / `cssRules` and copy `CSSKeyframesRule` bodies **where the browser exposes them** (same-origin stylesheets). For cross-origin CSS that throws on access, use DevTools **Sources** or fetch the CSS URL and paste the `@keyframes` into the spec — do not guess intermediate keyframe percentages
69
+ - **Web Animations API** — for each moving node, `element.getAnimations({ subtree: false })` and record each effect’s timing (`duration`, `delay`, `easing`, `iterations`, `direction`, `fill`)
70
+ - **Scroll-driven behavior** — exact scroll thresholds (px or intersection ratios), `scroll-snap-*`, and libraries (**Lenis**, **Locomotive Scroll**, etc.) with the same init/wrapper classes the reference uses
71
+ - **`prefers-reduced-motion`** — note whether the site alters or disables motion (evaluate `matchMedia('(prefers-reduced-motion: reduce)')` and compare to a forced reduced-motion emulation if DevTools allows)
72
+ Run the **Phase 1 motion audit script** and merge findings into `docs/research/BEHAVIORS.md`. Capture **numbers** (`ms`, `cubic-bezier(...)`, stagger offsets), not adjectives.
63
73
 
64
74
  Only after the above are accounted for should you spend cycle time on minor text or non-visual refactors. A perfect grid with missing hero art and dead animation still fails the clone.
65
75
 
76
+ ### 0b. HTML / DOM structure (layout tree, not “vibes”)
77
+
78
+ **Exact** means the **visible layout tree** matches: **section order**, **sibling order**, **wrapper depth** (decorative `div`s, flex rows, grid shells), and **key hooks** (sticky wrappers, scroll containers). React may rename tags **only** if roles/landmarks still reflect the same outline and **computed layout** is unchanged — do not collapse three nested wrappers into one unless the spec proves they are redundant in the reference. Specs must include a short **DOM outline** (indentation sketch or bullet tree) for complex sections so builders and **Phase 6 verifiers** can diff structure.
79
+
80
+ ### 0c. CSS fidelity (authored + computed)
81
+
82
+ Tailwind utilities are fine **only** as a transport for **measured** values. Every critical rule must trace back to **`getComputedStyle()`** (or authored sheet text) from Chrome MCP: **no “close” token swaps** (`rounded-lg` when the radius is `10px`, `gap-4` when gap is `18px`) unless values compile to the same pixel output. Prefer arbitrary values (`max-w-[872px]`, `rounded-[10px]`) when shadcn defaults don’t land on the measured number. **Pseudo-elements** and **custom properties** used by the reference must appear in the clone with the same cascade intent.
83
+
66
84
  ### 1. Completeness Beats Speed
67
85
 
68
86
  Every builder agent must receive **everything** it needs to do its job perfectly: screenshot, exact CSS values, downloaded assets with local paths, real text content, component structure. If a builder has to guess anything — a color, a font size, a padding value — you have failed at extraction. Take the extra minute to extract one more property rather than shipping an incomplete brief.
@@ -152,48 +170,11 @@ Navigate to the target URL with browser MCP.
152
170
 
153
171
  Follow **§0 (Visual crawl priority)** during the entire reconnaissance pass: images and backgrounds → SVGs/icons → motion/animations — before spending time on secondary copy tweaks.
154
172
 
155
- ### Multi-pass DOM reconnaissance (mandatory)
156
-
157
- **A single scroll is not enough.** You must run the live page **multiple full cycles** in browser MCP — each time walking the **DOM**, the **asset graph**, and the **motion flow** — until what you write in specs is **exactly** what the reference does, not a remembered approximation.
158
-
159
- **Minimum passes** (run **Pass 1–4 at 1440px first**; **repeat Pass 1–3 at 768px and 390px** wherever layout or node order differs; reconciliation can be width-specific):
160
-
161
- 1. **Structure pass (DOM, top → bottom):** Traverse from **`document.body`** in **depth-first order** (or section-by-section using regions you will later name in `PAGE_TOPOLOGY.md`). For every node that affects layout or visible content, record **tag**, **selector hint** (stable `id` / first meaningful classes), **`childNodes` order** (siblings matter — flex/grid gaps and wrappers are not optional), landmarks, and **which element is the scroll container** (`overflow` / `overscroll-behavior`). Produce a **literal hierarchy** in `docs/research/DOM_SKETCH.md` (whole page or per-section files under `docs/research/`) so builders cannot silently reorder or collapse wrapper divs. **Include “invisible” structure** (spacers, gradient overlays, absolutely positioned siblings).
162
- 2. **Asset pass (images & layered media):** **Second full traversal** focused on §0 priority 1–2: every `<img>`, `<picture>` / `srcset`, `<video>` / `poster`, computed **`background-image`** on the element **and** ancestors, CSS masks, inline SVG / sprites. Cross-check with the Network panel. Every URL must end up **downloaded to `public/`** with a documented path, or marked **blocked / generated** with a substitute and reason.
163
- 3. **Motion & flow pass:** **Third full journey** — slow scroll **top to bottom**, then **scroll again** (different speed) to catch lazy-mounted nodes, staggered `IntersectionObserver` reveals, and scroll-snapped stops. Run **`motionAudit`** (below) **per major section root** after scrolling that section into view. **Re-do click/hover sweeps** here while sampling `getComputedStyle` so **transitions and keyframe-driven flow** match the reference’s **order and timing**, not a generic fade-in.
164
- 4. **Reconciliation pass:** **Fourth pass** — read `DOM_SKETCH.md`, `BEHAVIORS.md`, asset inventory, and `MOTION.md` together; list **gaps** (missing wrapper, second image layer, unnamed animation, wrong child order). For every gap, return to the site and **repeat Pass 1–3** for that subtree until the spec is closed.
165
-
166
- **Hard rule:** Every fact in a component spec must trace to **which pass** produced it. If you “kind of remember” a structure from an earlier visit, **run the page again** — do not guess.
167
-
168
173
  ### Screenshots
169
174
  - Take **full-page screenshots** at desktop (1440px) and mobile (390px) viewports
170
175
  - Save to `docs/design-references/` with descriptive names
171
176
  - These are your master reference — builders will receive section-specific crops/screenshots later
172
177
 
173
- ### Browser MCP: pixel-perfect capture
174
-
175
- MCP-driven inspection must be **pixel-perfect**, not “close.” Apply this on **every** reconnaissance width and again in Phase 5.
176
-
177
- - **Viewport lock:** Resize the MCP-controlled window to exact **CSS widths** used for this project: **1440**, **768**, and **390** px (height large enough to avoid accidental mobile chrome quirks). After each resize, record **`window.innerWidth`**, **`document.documentElement.clientWidth`**, and **`devicePixelRatio`** (run the snippet below). Extraction and QA **use the same widths** so diffs are valid.
178
- - **Zoom:** Ensure **browser zoom is 100%** (not 90%/110%). Zoom breaks `px` parity and screenshots.
179
- - **Computed styles are verbatim:** When copying from `getComputedStyle()`, paste **exact returned strings** — including **fractional** lengths (`12.8px`), **negative** values, **`oklch()`/`lch()`/`rgba()`**, `letter-spacing`, `line-height`, `border`/`outline`, and **`calc()`**/`min()` that the cascade resolves to. **Do not round** for “clean” tokens (no `~16px`; no swapping `0.875rem` for `14px` unless the computed value truly equals that).
180
- - **Geometry:** When alignment, gutters, or sticky offsets matter, record **`getBoundingClientRect()`** (`x`, `y`, `width`, `height`) at the relevant scroll position and width — not only padding/margin strings. Fixed/sticky layers need **viewport-relative** positions.
181
- - **Pseudos & layers:** Extract **`::before` / `::after`** (and other pseudos the reference uses) with `getComputedStyle(el, '::before')` etc.; they often hold gradients, borders, or icons that define the pixel look.
182
- - **Anti-aliasing & text:** Prefer **real Chrome** via MCP so **font rasterization** matches; load the **same font files/weights** in Next.js as on the reference. Note `font-feature-settings` / `font-variation-settings` / `-webkit-font-smoothing` if non-default.
183
- - **Screenshots vs. DOM:** Screenshots are for **diffing**; the **spec values** still come from **computed style + rect**, not from eyeballing pixels.
184
-
185
- **Viewport diagnostic** (run via browser MCP after each resize):
186
-
187
- ```javascript
188
- JSON.stringify({
189
- innerWidth: window.innerWidth,
190
- clientWidth: document.documentElement.clientWidth,
191
- clientHeight: document.documentElement.clientHeight,
192
- devicePixelRatio: window.devicePixelRatio,
193
- scrollY: window.scrollY
194
- });
195
- ```
196
-
197
178
  ### Global Extraction
198
179
  Extract these from the page before doing anything else:
199
180
 
@@ -209,7 +190,7 @@ Extract these from the page before doing anything else:
209
190
 
210
191
  This is a dedicated pass AFTER screenshots and BEFORE anything else. Its purpose is to discover every behavior on the page — many of which are invisible in a static screenshot.
211
192
 
212
- **Scroll sweep:** Scroll the page slowly from top to bottom via browser MCP. At each section, pause and observe:
193
+ **Scroll sweep:** Scroll the page slowly from top to bottom via **Chrome MCP** (real wheel / scroll in the live tab). At each section, pause and observe:
213
194
  - Does the header change appearance? Record the scroll position where it triggers.
214
195
  - Do elements animate into view? Record which ones and the animation type.
215
196
  - Does a sidebar or tab indicator auto-switch as you scroll? Record the mechanism.
@@ -225,7 +206,7 @@ This is a dedicated pass AFTER screenshots and BEFORE anything else. Its purpose
225
206
  - Buttons, cards, links, images, nav items
226
207
  - Record what changes: color, scale, shadow, underline, opacity
227
208
 
228
- **Responsive sweep:** Test at 3 viewport widths via browser MCP:
209
+ **Responsive sweep:** Test at 3 viewport widths via **Chrome MCP**:
229
210
  - Desktop: 1440px
230
211
  - Tablet: 768px
231
212
  - Mobile: 390px
@@ -233,106 +214,78 @@ This is a dedicated pass AFTER screenshots and BEFORE anything else. Its purpose
233
214
 
234
215
  Save all findings to `docs/research/BEHAVIORS.md`. This is your behavior bible — reference it when writing every component spec.
235
216
 
236
- ### Chrome MCP: precise motion & animation extraction
237
-
238
- Use **evaluate script** (or equivalent) in Chrome MCP **during** the scroll/click/hover sweeps so you capture **live computed values**, not guesses from DevTools screenshots alone.
239
-
240
- **Rules:**
217
+ ### Motion & animation — Chrome MCP numeric audit (mandatory)
241
218
 
242
- - **No hand-waving** if the reference uses `0.45s cubic-bezier(0.4, 0, 0.2, 1)`, the spec and implementation use that exact string (or equivalent in Tailwind only when it truly matches).
243
- - **`@keyframes` source of truth** — for each animated element, record `getComputedStyle(el).animationName` and resolve the **full `@keyframes` rule** from stylesheets when allowed. Many sites inline CSS or use same-origin sheets: iterate `document.styleSheets` / `cssRules` inside `try/catch`; for **cross-origin** sheets that throw on `cssRules`, copy the rule from the **Network** response or **Sources** panel in Chrome and paste into `docs/research/MOTION.md` / the component spec. Never substitute a different easing or keyframe shape “because it looks close.”
244
- - **Scroll-driven animations** — for `animation-timeline: view()` / named timelines, capture **`view-timeline` / `scroll-timeline` on ancestors**, `animation-range`, `scroll-padding` / snap containers, and **which scroll container** is the timeline root (often `html`, sometimes a nested `overflow-y: auto` div).
245
- - **Before/after pairs** — for scroll- or hover-driven motion, capture computed `transform`, `opacity`, and longhand `animation-*` / `transition-*` **in both states** (see §7) and the **exact trigger** (px, ratio, or event).
246
- - **Libraries** — if Lenis/GSAP/Framer is present, document **version/hooks** from `package` on the page or script URLs, class hooks (e.g. `.lenis`), and any **inline style** the library sets at rest vs. mid-animation (sample via computed style after the interaction).
247
- - **Deliverable** — maintain `docs/research/MOTION.md`: page-level keyframes inventory, global scroll/smooth-scroll setup, and per-section pointers into component specs. Large pages may scope the audit script to a **section root selector** to avoid noise.
248
-
249
- **Motion audit script** (run via Chrome MCP; optional `rootSelector` limits to a subtree):
219
+ After the interaction sweeps, run this **once per URL** inside **Chrome DevTools MCP** (page evaluation / `evaluate_script`) and append the JSON under `## Motion audit (Chrome MCP)` in `docs/research/BEHAVIORS.md`. Re-run targeted evaluations on a section container selector if the capped sample misses hero, nav, or carousel motion.
250
220
 
251
221
  ```javascript
252
- (function motionAudit(rootSelector) {
253
- const root = rootSelector ? document.querySelector(rootSelector) : document.body;
254
- if (!root) return JSON.stringify({ error: 'root not found: ' + rootSelector });
255
-
256
- function safeRules(sheet) {
257
- try {
258
- return [...sheet.cssRules];
259
- } catch {
260
- return [];
261
- }
262
- }
263
-
264
- const walkKeyframes = (rules, out) => {
265
- for (const rule of rules) {
266
- if (rule.type === CSSRule.KEYFRAMES_RULE) {
267
- out.push({ name: rule.name, cssText: rule.cssText });
268
- } else if (rule.type === CSSRule.MEDIA_RULE && rule.cssRules) {
269
- walkKeyframes(rule.cssRules, out);
270
- }
271
- }
222
+ // Motion audit — run via Chrome MCP evaluate_script on the target URL
223
+ (function motionAudit() {
224
+ const props = [
225
+ 'animation', 'animationName', 'animationDuration', 'animationDelay',
226
+ 'animationTimingFunction', 'animationIterationCount', 'animationDirection',
227
+ 'animationFillMode', 'animationPlayState', 'animationTimeline',
228
+ 'transition', 'transitionProperty', 'transitionDuration',
229
+ 'transitionTimingFunction', 'transitionDelay',
230
+ 'transform', 'willChange'
231
+ ];
232
+ const animated = [...document.querySelectorAll('*')].filter((el) => {
233
+ const cs = getComputedStyle(el);
234
+ return (
235
+ (cs.animationName && cs.animationName !== 'none') ||
236
+ (cs.transitionProperty && cs.transitionProperty !== 'none' && cs.transitionProperty !== 'all')
237
+ );
238
+ });
239
+ const label = (el) => {
240
+ const tag = el.tagName.toLowerCase();
241
+ const id = el.id ? '#' + el.id : '';
242
+ const cls = el.className && typeof el.className === 'string'
243
+ ? '.' + el.className.trim().split(/\s+/).filter(Boolean).slice(0, 4).join('.')
244
+ : '';
245
+ return tag + id + cls;
272
246
  };
273
-
274
- const keyframes = [];
275
- for (const sheet of document.styleSheets) {
276
- walkKeyframes(safeRules(sheet), keyframes);
277
- }
278
-
279
- const animated = [];
280
- const scope = root.querySelectorAll('*');
281
- for (const el of scope) {
247
+ const samples = animated.slice(0, 100).map((el) => {
282
248
  const cs = getComputedStyle(el);
283
- const animName = cs.animationName;
284
- const hasAnim = animName && animName !== 'none';
285
- const transDurs = (cs.transitionDuration || '')
286
- .split(',')
287
- .map((s) => s.trim())
288
- .filter(Boolean);
289
- const hasTrans =
290
- cs.transitionProperty &&
291
- cs.transitionProperty !== 'none' &&
292
- transDurs.some((d) => d !== '0s');
293
- if (!hasAnim && !hasTrans) continue;
294
-
295
- animated.push({
296
- hint: el.tagName.toLowerCase() + (el.className
297
- ? '.' + String(el.className).trim().split(/\s+/).slice(0, 4).join('.')
298
- : ''),
299
- animation: cs.animation,
300
- animationName: cs.animationName,
301
- animationDuration: cs.animationDuration,
302
- animationTimingFunction: cs.animationTimingFunction,
303
- animationDelay: cs.animationDelay,
304
- animationIterationCount: cs.animationIterationCount,
305
- animationDirection: cs.animationDirection,
306
- animationFillMode: cs.animationFillMode,
307
- animationPlayState: cs.animationPlayState,
308
- animationTimeline: cs.animationTimeline,
309
- animationRange: cs.animationRange,
310
- transition: cs.transition,
311
- transitionProperty: cs.transitionProperty,
312
- transitionDuration: cs.transitionDuration,
313
- transitionTimingFunction: cs.transitionTimingFunction,
314
- transitionDelay: cs.transitionDelay,
315
- transform: cs.transform,
316
- transformOrigin: cs.transformOrigin,
317
- opacity: cs.opacity,
318
- willChange: cs.willChange,
319
- viewTimelineName: cs.viewTimelineName,
320
- scrollTimelineName: cs.scrollTimelineName
249
+ const row = { path: label(el) };
250
+ props.forEach((p) => { row[p] = cs[p]; });
251
+ try {
252
+ row.webAnimations = el.getAnimations({ subtree: false }).map((a) => {
253
+ const t = a.effect && typeof a.effect.getTiming === 'function' ? a.effect.getTiming() : null;
254
+ return { playState: a.playState, currentTime: a.currentTime, timing: t };
255
+ });
256
+ } catch (e) {
257
+ row.webAnimationsError = String(e);
258
+ }
259
+ return row;
260
+ });
261
+ let keyframes = [];
262
+ try {
263
+ [...document.styleSheets].forEach((sheet, i) => {
264
+ let rules;
265
+ try { rules = sheet.cssRules; } catch { return; }
266
+ if (!rules) return;
267
+ [...rules].forEach((rule) => {
268
+ if (rule.type === CSSRule.KEYFRAMES_RULE) {
269
+ keyframes.push({ sheetIndex: i, name: rule.name, cssText: rule.cssText });
270
+ }
271
+ });
321
272
  });
273
+ } catch (e) {
274
+ keyframes = [{ error: String(e), hint: 'Cross-origin stylesheets block cssRules — copy @keyframes from DevTools or fetched CSS.' }];
322
275
  }
323
-
324
- return JSON.stringify(
325
- {
326
- prefersReducedMotion: window.matchMedia('(prefers-reduced-motion: reduce)').matches,
327
- keyframes,
328
- animatedElements: animated
329
- },
330
- null,
331
- 2
332
- );
333
- })(''); // Pass section selector string, e.g. 'section.hero', instead of ''
276
+ return JSON.stringify({
277
+ url: location.href,
278
+ prefersReducedMotion: matchMedia('(prefers-reduced-motion: reduce)').matches,
279
+ animatedElementCount: animated.length,
280
+ sampledElements: samples.length,
281
+ samples,
282
+ keyframesRules: keyframes
283
+ }, null, 2);
284
+ })();
334
285
  ```
335
286
 
287
+ **Implementation rule:** Component specs and React/CSS must match these **measured** values. If the audit omits an element (cap 100), run a second pass scoped to that section’s root selector.
288
+
336
289
  ### Page Topology
337
290
  Map out every distinct section of the page from top to bottom. Give each a working name. Document:
338
291
  - Their visual order
@@ -423,8 +376,7 @@ For each section, use browser MCP to extract everything:
423
376
  'borderRadius','border','borderTop','borderBottom','borderLeft','borderRight',
424
377
  'boxShadow','overflow','overflowX','overflowY',
425
378
  'position','top','right','bottom','left','zIndex',
426
- 'opacity','transform','transformOrigin','transition','transitionProperty','transitionDuration','transitionTimingFunction','transitionDelay',
427
- 'animation','animationName','animationDuration','animationTimingFunction','animationDelay','animationIterationCount','animationDirection','animationFillMode','animationPlayState','animationTimeline','animationRange','viewTimelineName','scrollTimelineName','cursor',
379
+ 'opacity','transform','transition','cursor',
428
380
  'objectFit','objectPosition','mixBlendMode','filter','backdropFilter',
429
381
  'whiteSpace','textOverflow','WebkitLineClamp'
430
382
  ];
@@ -503,15 +455,6 @@ For each section (or sub-component, if you're breaking it up), create a spec fil
503
455
  ### <Child element N>
504
456
  ...
505
457
 
506
- ## Motion & animation (exact — from Chrome MCP `getComputedStyle` + stylesheet rules)
507
-
508
- - **Keyframe names in use:** ...
509
- - **Full `@keyframes` blocks** (paste `cssText` or equivalent); note **cross-origin** gaps and how you filled them
510
- - **Per-element:** shorthand/longhand `animation` and `transition` values **verbatim** for resting state
511
- - **Scroll/view timelines:** timeline name, range, scroll container, snap/observer thresholds
512
- - **Libraries:** Lenis / GSAP / Framer / Lottie — hooks, init pattern, timing copied from reference
513
- - **`prefers-reduced-motion`:** matched behavior on the reference
514
-
515
458
  ## States & Behaviors
516
459
 
517
460
  ### <Behavior name, e.g., "Scroll-triggered floating mode">
@@ -594,34 +537,48 @@ After all sections are built and merged, wire everything together in `src/app/pa
594
537
 
595
538
  After assembly, do NOT declare the clone complete. Take side-by-side comparison screenshots:
596
539
 
597
- 1. **Pixel-perfect comparison setup:** Match **Browser MCP: pixel-perfect capture** same **CSS widths** (**1440**, **768**, **390**), **100% zoom**, and record `innerWidth`/`clientWidth`/`devicePixelRatio` on both reference and clone. Then open original and clone side-by-side or take paired screenshots at those widths.
540
+ 1. Open the original site and your clone side-by-side (or take screenshots at the same viewport widths) using **Chrome MCP** on both if possible
598
541
  2. Compare section by section, top to bottom, at desktop (1440px)
599
- 3. Compare at tablet (768px) and again at mobile (390px)
542
+ 3. Compare again at mobile (390px)
600
543
  4. For each discrepancy found:
601
544
  - Check the component spec file — was the value extracted correctly?
602
545
  - If the spec was wrong: re-extract from browser MCP, update the spec, fix the component
603
546
  - If the spec was right but the builder got it wrong: fix the component to match the spec
604
547
  5. Test all interactive behaviors: scroll through the page, click every button/tab, hover over interactive elements
605
- 6. **Motion QA (Chrome MCP again if needed):** For every animated or transitioned element, re-run `getComputedStyle` on the reference vs. the clone at the **same scroll position / interaction state** and compare **`animation-*`, `transition-*`, `transform`, `opacity`** longhands durations and easings must match character-for-character where the cascade specifies them. Re-record any `@keyframes` the reference still exposes so the clone can be patched until timings align.
606
- 7. Verify smooth scroll feels right, header transitions work, tab switching works, stagger and scroll-driven reveals match the reference
548
+ 6. **Motion QA:** Re-run the **motion audit script** (or per-element `getAnimations`) on the reference and spot-check the clone in devtools **durations, delays, and easing curves must match** (e.g. 320ms vs 300ms is a failure). Re-scroll hero and sticky headers; carousels and scroll-driven sections must trigger at the same thresholds documented in `BEHAVIORS.md`
549
+
550
+ Only after this visual QA pass is the clone ready for **subagent verification**.
551
+
552
+ ## Phase 6: Subagent verification pass (mandatory)
553
+
554
+ Foreman self-review is insufficient — **dispatch independent checker agents** (subagents) after Phase 5 to audit the whole surface. Prefer **parallel** runs with **narrow rubrics**. When using multi-agent setups, follow **`AGENTS.md`**: give each subagent its **own git worktree/branch**, then merge after all reports are triaged.
555
+
556
+ **Minimum four verification passes** (one subagent each, or one agent run sequentially if the host limits parallelism):
557
+
558
+ 1. **Images & media** — List every image/video poster referenced from `src/` (components, `app/`). Confirm **files exist** under `public/` with **correct paths**; compare presentation to specs: **`picture`/`source` behavior**, **`sizes` / responsive behavior**, **`object-fit` / `object-position`**, dimensions/aspect-ratio, **parent overflow and radius**, **`background-image`** and **pseudo-elements**. Flag wrong crops, missing layers, or lazy `next/image` `fill` misuse.
559
+ 2. **HTML / DOM structure** — Diff **PAGE_TOPOLOGY.md** + component specs against the React tree: **section order**, **wrapper count**, **sibling order**, scroll/sticky containers. Any flattened structure that changes stacking or scroll must be **FAIL** until fixed.
560
+ 3. **CSS parity** — Spot-check **hero, nav, first fold, footer** (and any section flagged risky) against spec CSS: tokens in **`globals.css`**, arbitrary Tailwind vs measured px, **keyframes** presence. Run **`npm run lint`** and **`npm run typecheck`** inside the verification worktree; failures = **FAIL** until green.
561
+ 4. **Motion & interaction** — Re-walk **`docs/research/BEHAVIORS.md`** and motion audit JSON: headers, carousels, scroll-driven UI, smooth-scroll libs. Phase 5 motion QA must be **confirmed**, not assumed.
607
562
 
608
- Only after this visual + motion QA pass is the clone complete.
563
+ Each subagent returns **`PASS` or `FAIL`**, a **bullet list** of issues with **`file:line`** pointers, and **suggested fixes**. The foreman **resolves or explicitly documents** every `FAIL` (deferred items listed in the completion report under **Known gaps**). **Do not** declare Launchframe complete until all subagents **`PASS`** or gaps are accepted by the user context.
609
564
 
610
565
  ## Pre-Dispatch Checklist
611
566
 
612
567
  Before dispatching ANY builder agent, verify you can check every box. If you can't, go back and extract more.
613
568
 
614
- - [ ] **Multi-pass DOM reconnaissance:** structure (`DOM_SKETCH.md`) + asset sweep + motion/flow sweeps + reconciliation; repeated at **768 / 390** when layout or DOM order differs from 1440
569
+ - [ ] **Image markup + styling** captured in spec: `picture`/`source`/`sizes`/`srcset` (or documented `next/image` mapping), `object-fit`/`object-position`, clipping parents, pseudo-element backgrounds if any
570
+ - [ ] **DOM outline** included for non-trivial sections (wrappers, order)
615
571
  - [ ] Spec file written to `docs/research/components/<name>.spec.md` with ALL sections filled
616
- - [ ] Every CSS value in the spec is from `getComputedStyle()`, not estimated — **verbatim**, including fractional px and color functions
617
- - [ ] **MCP pixel-perfect pass:** viewports **1440 / 768 / 390**, **100% zoom**, viewport diagnostic recorded; **`getBoundingClientRect()`** and **`::before`/`::after`** captured where they affect layout or visuals
572
+ - [ ] Every CSS value in the spec is from `getComputedStyle()`, not estimated
618
573
  - [ ] Interaction model is identified and documented (static / click / scroll / time)
619
574
  - [ ] For stateful components: every state's content and styles are captured
620
575
  - [ ] For scroll-driven components: trigger threshold, before/after styles, and transition are recorded
621
576
  - [ ] For hover states: before/after values and transition timing are recorded
622
- - [ ] Motion: relevant `@keyframes` captured (or cross-origin gap documented with manual paste), `docs/research/MOTION.md` updated, component specs include **exact** `animation*` / `transition*` / timeline fields from Chrome MCP
577
+ - [ ] **Motion audit JSON** from Chrome MCP is in `docs/research/BEHAVIORS.md` (`## Motion audit (Chrome MCP)`); follow-up passes exist for any capped/missed selectors
578
+ - [ ] Relevant **`@keyframes`** from the reference appear in `globals.css` or module CSS **verbatim** (or equivalent WAAPI) — not hand-waved
579
+ - [ ] Elements that move via **Web Animations API** have timing cross-checked with `getAnimations` output from Chrome MCP
623
580
  - [ ] All images in the section are identified (including overlays and layered compositions)
624
- - [ ] Responsive behavior is documented for **1440 / 768 / 390**
581
+ - [ ] Responsive behavior is documented for at least desktop and mobile
625
582
  - [ ] Text content is verbatim from the site, not paraphrased
626
583
  - [ ] The builder prompt is under ~150 lines of spec; if over, the section needs to be split
627
584
 
@@ -639,20 +596,20 @@ These are lessons from previous failed clones — each one cost hours of rework:
639
596
  - **Don't skip asset extraction.** Without real images, videos, and fonts, the clone will always look fake regardless of how perfect the CSS is.
640
597
  - **Don't give a builder agent too much scope.** If you're writing a builder prompt and it's getting long because the section is complex, that's a signal to break it into smaller tasks.
641
598
  - **Don't bundle unrelated sections into one agent.** A CTA section and a footer are different components with different designs — don't hand them both to one agent and hope for the best.
642
- - **Don't round or “clean up” extracted values** for Tailwind guesses: `12.8px` stays `12.8px` in the spec unless the clone uses an exactly equivalent value.
643
- - **Don't mix zoom levels or viewport widths** between reference extraction and QA — you will false-fail or false-pass pixel diffs.
644
599
  - **Don't skip responsive extraction.** If you only inspect at desktop width, the clone will break at tablet and mobile. Test at 1440, 768, and 390 during extraction.
645
600
  - **Don't forget smooth scroll libraries.** Check for Lenis (`.lenis` class), Locomotive Scroll, or similar. Default browser scrolling feels noticeably different and the user will spot it immediately.
601
+ - **Don't collapse responsive image markup.** Dropping `<picture>` / `<source media="…">` or `sizes` so “one JPEG is enough” changes which URL loads and breaks fidelity — mirror the reference’s responsive strategy.
602
+ - **Don't guess motion.** If `transition-duration` is 280ms with `cubic-bezier(0.4, 0, 0.2, 1)`, the clone must use those exact values from Chrome MCP — not "about 0.3s ease."
646
603
  - **Don't dispatch builders without a spec file.** The spec file forces exhaustive extraction and creates an auditable artifact. Skipping it means the builder gets whatever you can fit in a prompt from memory.
647
604
 
648
605
  ## Completion
649
606
 
650
607
  When done, report:
651
- - Multi-pass reconnaissance status (`docs/research/DOM_SKETCH.md` present; passes at **1440 / 768 / 390** as needed)
652
608
  - Total sections built
653
609
  - Total components created
654
610
  - Total spec files written (should match components)
655
611
  - Total assets downloaded (images, videos, SVGs, fonts)
656
612
  - Build status (`npm run build` result)
657
613
  - Visual QA results (any remaining discrepancies)
614
+ - **Subagent verification:** which audit passes ran (images / DOM / CSS / motion), **PASS/FAIL** each, and link or paste issue lists; unresolved items under **Known gaps**
658
615
  - Any known gaps or limitations