Site Copy: Install, Source and Security | FunnelSlayer

Site Copy

Published by flavoflav in source-site-copy-skill

No known issues5 installs

What this skill does

>-

Add Site Copy to your agent

Review the source and files first. When you are ready, copy the prompt instruction or use the CLI command supported by your environment.

Install with a prompt

Paste this into a compatible coding agent:

add this skill "site-copy" from https://github.com/flavoflav/source-site-copy-skill

Install with the CLI

Run this command in a controlled environment after reviewing the repository:

npx skills add https://github.com/flavoflav/source-site-copy-skill --skill site-copy

Skill instructions

Site Copy into Acquia Source

Copy $ARGUMENTS into Acquia Source: build it as Canvas components and pages inside the local Nebula project, verify parity in Workbench, push to Source.

The score, defined once

PARITY_TARGET = 97 on the content-masked score printed by scripts/parity.sh (mean absolute difference over the ink mask, 0–100). That one function produces the page score, the blank control, the self control, the reproducibility ceiling and the Step 5 component gate. Nothing else is a score: not odiff's changed-pixel count at any threshold or flag, not a percentage read off a diff image, not a rubric.

A page passes when all six hold: (1) latest ledger entry ≥ PARITY_TARGET, (2) that entry's controls passed — self > 99.9 and score − blank ≥ 10; the blank floor is recorded beside every score and never thresholded, because it is arithmetic set by ink darkness and coverage (6 on a stark page, 33–40 on a light photo-heavy one), (3) heightDeltaPct within ±10%, (4) layout ledger clean, (5) render assertions pass, (6) the side-by-side was opened and every functional delta is resolved. Do not chase points past the bar: 97→99 buys anti-aliasing and sub-pixel drift editors never see. Do not claim a pass the ledger does not support.

Build from recon/spec/, never from a screenshot alone. Past runs plateaued at 65–88% because every padding, container width, gap, type size and image crop was guessed from pictures; Step 7 paid for all of them at once. Step 1.5 measures those numbers off the live DOM, Steps 2–3 derive the catalog and tokens from the measurements, Step 5 proves each component numerically conformant before it replicates. Step 7 confirms; it does not construct.

Every gotcha from past runs lives in references/lessons.md, tagged [rule] or [observed — verify]. Where a lesson and a measurement disagree, the measurement wins; report the contradiction.

The pipeline at a glance

Each stage produces named files the next stage reads, and each has a gate that must pass before the next starts. Scripts do the mechanical work; the model decides, reviews and writes code.

StageCommand / activityProducesGate
0 identity & pre-flightglossary check, selftest.sh, sitemap.py, one round of questions, Source MCP gaterecon/project.json, pages.json, urls-all.jsonSELFTEST OK; push contract confirmed
1 capturenav_capture.sh, capture_all.sh 3nav.json, footer-nav.json, spec/, raw/, html/, render/, screens/spec_verify.py on every page
1.5 deriverecon_derive.shfonts.json, tokens.json, catalog-proposal.json, census.json, parity.json._ceilingfonts self-hosted or recorded as ceilings; ceiling ≥ target
2 catalogcensus + proposal + screenshots → decisionscomponents.md, catalog.json, bands.jsonevery entry has Spec lines from recon/spec/
3 tokensname the histogram; prose rules; preflight resetstokens-named.json, src/global.cssno raw values in components; prose_verify.py
4 mediaaria2c → exiftool → vips → create_media (Source)public/media/, media.json, media-target-ids.jsonuploaded = validated; hero aspects asserted
4b/4c Source datamenus (entity links), content typessource-pages.json, menus.json, nodesmenus published and serving
5 componentsone component per band type, navigation firstsrc/components/*spec_conform clean, parity ≥ 90, ≤ 2 nav components
6 pagespagelib.py + bands.py build scripts; regions or per-page chromeregions/*.json, pages/*.json, navmap.jsoncanvas validate, path_contract.py
7 diff loopcapture_all.sh --wb, measure.sh, look, diagnose, fix, hash-gated re-diffparity.json, recon/diffs/*six pass gates; stopping rules
8 push & reportcomponents via CLI, pages via MCP, MID passSource pages live, SITE_COPY_REPORT.mdreport generated from the ledger

Three names, three things (read before pre-flight)

These are used precisely everywhere below. Past runs stalled on "Canvas vs Nebula" questions because they were treated as alternatives; they are not.

NameWhat it isWhere it appears in this skill
NebulaThe scaffolding script and the local project directory it creates. site-copy is invoked from inside a Nebula project: canvas.config.json, src/components/*/component.yml, pages/, regions/, src/global.css, and the Workbench dev server (npm run dev → canvas-workbench). The nebula-* skills describe this directory's conventions.every local step: capture, build, preview, measure
WorkbenchThe local preview server inside the Nebula project. It renders the components and page specs and is the build side of every diff. Nothing on Workbench is visible to anyone else.Steps 5–7
CanvasThe visual editor inside Source. What you build are Canvas code components (component.yml + React) and Canvas page/region layouts. The canvas CLI validates locally and pushes components to Canvas; pages and regions on Source are authored through Source MCP.component contract, validation, push
SourceAcquia Source, the remote CMS that hosts Canvas, media, menus, content types and the live site. The only remote target this skill has.Steps 4, 4b, 4c, 8

Pre-flight identity check. canvas.config.json + src/components/ + a dev script that runs canvas-workbench = you are inside a Nebula project. If any is missing, stop and ask the user to scaffold one with the Nebula script and re-run from inside it; never scaffold speculatively and never write components anywhere else.

Two flags go into recon/project.json:

FlagSignalEffect
regionscanvas.config has regionsDir and layoutPath renders <Region name=…>Chrome (navigation, footer) is authored once in regions/*.json (Step 6) when the census finds one chrome family, never inlined per page.
remotesource when CANVAS_SITE_URL (.env, .env.local, shell, MCP config) ends with .cms.acquia.site or the user names Acquia Source; workbench-only when the user scoped the run to a local copysource: media, menus, content types and pages go to Source through Source MCP and components through the narrow CLI contract (Step 8). workbench-only: nothing leaves the machine; Steps 4b, 4c and 8's push are skipped and reported as such. Getting this wrong later destroys local work.

Step 0 — Load skills lazily

Mandatory now: local-power-tools. Its mapping table is a hard rule during site-copy: htmlq/beautifulsoup4 for HTML extraction, aria2c for every multi-URL download, exiftool to validate images before upload, vips for all image conversion, yt-dlp+ffmpeg for video, sd for literal rewrites across pages/*.json, ast-grep for structural code refactors, yq for component.yml, odiff for the diff mask, difft for reviewing passes, scc for report counts, shellcheck on any shell you author. Read its SKILL.md in full; if it is missing, stop and tell the user.

agent-browser loads at Step 1a, the only step where you drive it by hand (hover, snapshot). Every other browser interaction in this skill is inside scripts/capture.sh and scripts/nav_capture.sh, so the full skill text is not needed before then. agent-browser ≥ 0.27 also ships version-matched docs: agent-browser skills get core.

Everything else loads at the step that first needs it. A resumed run does not re-read skills for steps already done.

Load atSkillWhy
Step 1.5references/step-1-structural-spec.mdthe spec extractor, histogram, fingerprint and conformance scripts
Step 2canvas-design-decompositioncatalog from the structural spec + screenshots
Step 3canvas-styling-conventionstoken vocabulary
Step 4bcanvas-navigation-components; acquia-source-navigation-menus (Source only)nav data patterns; menu creation via MCP
Step 4ccanvas-content-templates + references/step-4c-content-types.md + references/content-type-migration.mdonly if the user opted into content types
Step 5canvas-component-definition, canvas-component-metadata, canvas-component-composability, canvas-component-utils, canvas-data-fetching, canvas-workbench, canvas-source-lessons-learned; nebula-component-creation, nebula-component-validation (this directory's conventions)the Canvas component contract; cross-project error reference
Step 6canvas-page-definition, canvas-regions; acquia-source-canvas-pages (Source; if not installed, Step 8's MCP contract below is self-contained — proceed); nebula-workbench-pages, nebula-node-page-scaffold (this directory's conventions)page and region specs
Step 7references/step-7-measurement.md; nebula-visual-verification (optional)the measurement pipeline
Step 8canvas-component-pushdependency-order retries

If a skill in this table is missing when its step arrives and its content is not duplicated here, stop and tell the user which one.

Two overrides this skill makes to the generic Canvas skills, stated here so they survive contact with a decomposition-minded agent:

  1. Navigation is one component. canvas-design-decomposition and canvas-component-composability are decomposition-first; for the header, utility strip, sub-nav, section band, mega menu, mobile drawer and footer-nav cluster they are overridden. Every seam between nav components is a place for a spacing, caret-reservation or prop-passthrough bug, and those bugs are invisible to the parity metric until they move a row: on one run 7 nav components cost 23% of all commits. Step 5 has the gate.
  2. Chrome is measured, not assumed singular. Step 2.0's census decides whether there is one header/footer or several before regions are used.

Step 0.5 — Pre-flight

  1. Scripts and self-test. Copy the skill's scripts/ folder into the project's scripts/ and run scripts/selftest.sh. It lints every script and scores three known-answer images through parity.sh (blank ≈ 0, self = 100, shifted in between, alpha-safe). It must print SELFTEST OK; if it lists a missing tool, install it before Step 1. Never retype scripts from a listing.
  2. Git baseline. git status clean, or ask the user to commit or stash. Authoring on top of uncommitted work loses it at the next sync command.
  3. Commit checkpoints, by pathspec. After each batch: git commit -m "wip: site-copy <stage>" -- <paths you own>. Never git add -A or a bare git commit when more than one agent works the tree: the index is shared, so it sweeps other agents' in-flight edits into the wrong commit (three times on one run; one instance cost 8.6 points and 5.6% of page height). Git is the only recovery path from a destructive canvas pull, so commit often, but only what you own (ownership table in Step 7).
  4. Page inventory, before the questions. python3 scripts/sitemap.py <url> reads sitemap.xml (one request, every URL) and writes recon/urls-all.json grouped by path prefix plus a capped recon/pages.json. Repeated prefixes (/blog/… ×17) are the content-type candidates. If there is no sitemap it falls back to recon/nav.json, so run it again after Step 1a.
  5. One round of questions, one AskUserQuestion call (plain text if the tool is unavailable), then wait:
    • Push contract. "We are inside a Nebula project{ with regions}. The target is {Acquia Source | Workbench only — nothing is pushed}. On Source I will push components only via canvas push --yes --include-pages false --include-content-templates false and never run --include-pages, canvas reconcile-media or canvas pull against Source. Pages and media go through Source MCP. Confirm?"
    • Content types. List the repeated prefixes from urls-all.json with counts and ask which become Drupal content types; one-off pages stay static. Record in recon/content-types.json. The editor workflow is the user's call.
    • Component library (Canvas). "Use the Acquia Source Component Library (https://github.com/flavoflav/source-components) as the base? It installs 65 primitives into src/components so the work is restyling, not deriving." Record in recon/component-library.json.
  6. Source MCP gate (remote = source). The Source MCP server's tools are named create_media, create_canvas_page, batch_add_components_to_page, publish_canvas_page, create_menu, create_menu_item, publish_auto_saves, list_entities, and for Step 4c create_content_type, batch_add_fields_to_content_type, batch_create_nodes; the mcp__<server>__ prefix is assigned by the harness and varies, so match on the bare name. If they are absent, stop and ask the user to connect the server; do not go past Step 3 without it. Verify the binding: list_entities(entity_type="node", limit=1) and check canonicalUrl matches the site the user is working on; if not, the session is bound to a sibling install and the user must re-auth before any write (re-auth is a harness action you cannot trigger).
  7. Library install (if yes). npx drupal-source-components in the project root. Verify: ls src/components | wc -l reports the library count, src/global.css carries the four ramps (white, black, gray, primary). npm run code:fix && npx canvas validate must pass as installed. Write recon/library-index.json (one entry per component: machineName, family, slots, purpose from its component.yml) — Step 2 joins the catalog against it. Commit as its own checkpoint. Downstream: catalog entries gain a Base: line; tokens are translated onto the library ramps (set data-theme="light" first if the site is light; the library ships dark); library components are restyled in place, never forked; unused ones are removed before push.

Step 1 — Capture

Nothing here is a model task except reviewing nav.json. Run the scripts; read what they print.

1a — Navigation (main + footer), first

Load agent-browser now. Then:

scripts/nav_capture.sh <home-url>

It applies the capture contract, extracts every header nav root, hovers each root that has a panel and re-reads the panel's links while open (megamenu children are often populated only on hover), screenshots default / each panel / scrolled / footer / mobile closed / mobile open into recon/screens/, and writes recon/nav.json and recon/footer-nav.json with menuMachineName main-nav / footer-nav. Both become Drupal menus on Source (Step 4b) and the specs for the navigation and footer components (Step 5). Review nav.json against the _nav-*.png screenshots: the heuristics find roots, panels and footer columns; you confirm kind (link / dropdown / megamenu), column headings, the CTA and the locale switcher. Fix by hand with jq; the file is the seed for real menus, so it must be right. Legal, social and newsletter items are footer chrome, not menu children.

1b — Pages

recon/pages.json already exists from Step 0.5 (sitemap) — re-run scripts/sitemap.py now if it fell back to nav.json. Cap at 12 pages for the visual clone (--all for a full crawl); content-type bundles are captured in Step 4c, not here. Each entry carries a group for parallel capture.

1c — Everything else, in one parallel pass

scripts/capture_all.sh 3

Three agent-browser sessions, every page at 1440 desktop and 375 mobile, each through scripts/capture.sh: viewport = target + scrollbar at DPR 1, overlay chrome stripped, animations frozen, carousels pinned, fonts loaded, scroll-through then back to top, clientWidth asserted, spec extracted in the same DOM state as the screenshot, screenshot cropped to target. Per page it writes recon/spec/<slug>.<bp>.json (the structural spec), recon/raw/<slug>.json (images, background images, hero poster, root custom properties, copy, band geometry), recon/html/<slug>.html (post-hydration DOM for bs4), recon/render/<slug>.<bp>.json (render assertions + loaded fonts) and recon/screens/<bp>/<slug>.png. It ends by running spec_verify.py on every desktop spec; a partial spec is the most expensive failure in this skill because nothing downstream can detect it, so a failed gate stops the run. Never re-fetch a page with raw HTTP for analysis: that returns the pre-hydration shell.

Tuning capture on a big site (2 vs 3 sessions, networkidle vs load) is measured with hyperfine, not eyeballed. Add --review to a capture.sh call to also take a DPR-2 capture into recon/screens/review/ for the eye; it is never fed to the scorer.

1.5 — Derive everything from the capture (one command)

Read references/step-1-structural-spec.md once, then:

scripts/recon_derive.sh <home-url>

It extracts fonts, @font-face sources, breakpoints and stylesheets; fetches and self-hosts every font file it can into public/fonts/ and records the ones it cannot as known ceilings in recon/parity.json (Typekit, licensed CDN, local() only) — tell the user now, not on diff pass four; runs tokens_histogram.py (measured tokens with counts), fingerprint.py (structural component proposal), classify.py (the census, Step 2.0), and ceiling.sh on the first page (live captured twice under the identical contract and scored against itself, with the ink polarity pinned for the whole run). Read the console summaries. A ceiling below PARITY_TARGET means the target is unreachable on this site; say so to the user before anything is built, and either the bar moves or the capture gets fixed. Verify: every page has both spec files, vipsheader -f width on a desktop screenshot prints 1440. Commit: wip: site-copy capture.


Step 2.0 — Read the census

recon_derive.sh already ran scripts/classify.py (re-run it with --label <class-prefix> when the CMS stamps a block-type class you want as a human-readable label; grouping stays structural). Per-page decomposition alone misses what repeats across pages and what differs in the chrome; on one run this step took the second batch from 17 to 8.4 passes per page. recon/census.json carries four load-bearing answers — the first two drive decisions whenever the run covers more than 3 pages:

  1. Page families, clustered on measured header and footer heights, never on class names. One site served two headers and two footers under one shared footer class name; trusting the class shipped the wrong footer and added +576px desktop, +47% of page height, to every page of the second family. If the census finds more than one family, regions are global in Canvas (one RegionsProvider for the whole app, no per-page override) and chrome moves into the page specs — Step 6 names the cutover.
  2. Band census — every content block across all pages, typed by structural fingerprint (class-agnostic, so a Tailwind build and a Drupal theme census the same way), with counts and page lists. This is the shared component catalogue: build one component per band type before any page is built (the component wave), so page agents assemble from proven parts instead of re-deriving them.
  3. Renders-nothing list — band types that are 0px tall on live must not become a node.
  4. Heroes from <picture><source srcset> per breakpoint, plus a HERO TRAP warning when the runtime img.src differs from the desktop source (Step 4).

Identify third-party embeds (calendars, social timelines, maps, video walls) now; they become hold_height entries in the band map below.

Step 2 — Decompose into a component catalog

Decomposition is structure-first (recon/catalog-proposal.json) and visually confirmed (screenshots). The fingerprint groups say what actually repeats and which style keys vary between repeats; screenshots catch what shape cannot (a decorative background, a pseudo-element divider). Screenshots alone over-split and under-catch, which is why the proposal comes first. Load canvas-design-decomposition and walk the ranked table against the screenshots, merging groups that differ by one optional child into one component with an optional prop.

ClassDefinition
Commonon every page (navigation, footer, breadcrumb)
Sharedon 2+ pages but not all
Uniqueon < 25% of pages

Most important rule in this skill: two blocks that look similar are one component with variants, not two components. Fewer components, more variants, higher fidelity, faster build. Navigation is always its own top-level common component.

Write recon/components.md, one entry per component, exactly this shape:

## heroBanner
- **Class:** common
- **Appears on:** home, about, services
- **Screenshot refs:** ./recon/screens/desktop/home.png (0–720px), ./recon/screens/desktop/about.png (0–560px)
- **Fingerprint:** section[box[h1 p a*] img]  (catalog-proposal.json group 2)
- **Variants:** with-image-right, with-image-left, text-only-centered
- **Props sketch:** eyebrow, title, body, image, primaryCta, secondaryCta, alignment
- **Base:** heroSplit (Source Component Library) | new        ← only when the library was installed
- **Spec (desktop 1440):** section pad 120/0/96/0 · bg #0b1220 · container maxW 1200 · 2-col grid 1fr/1fr gap 64 · h1 type/display (Inter 56/64 w700 #fff) · body type/body-lg mt 24 · cta row gap 16 mt 40 · button pad 12/24 radius 999 bg #0b5fff · image 560×420 fit cover radius 16
- **Spec (mobile 375):** section pad 64/20/64/20 · 1 col gap 32 · h1 36/44 · image full-width 4:3
- **Notes:** image is decorative when alignment=centered

The two Spec lines are mandatory; every number is read from recon/spec/<slug>.<bp>.json at the instance's section index and the type roles are the names given in Step 3. The props sketch is derived from the Spec lines, not written first. A Base: line matches by structure, not look: a library component with the right slots and skeleton is the base even when its colours and spacing are wrong, because those are fixed in CSS in Step 5.

Write the same catalog to recon/catalog.json: {"heroBanner": {"class": "common", "pages": [...], "regions": {"home": [0, 720], ...}}}. pages drives the hash-gated re-diff; regions is the y-span per page copied from the instance's y0/y1 in catalog-proposal.json. name_bands.py joins dirty bands against it, so it is load-bearing.

On sites with stable semantic classes (a Drupal theme, hand-written CSS) python3 scripts/decompose_signatures.py gives a second opinion from recon/html/*.html; skip it on Tailwind, CSS Modules or styled-components sites where every element has a unique class set. fingerprint.py under-resolves on deeply nested CMS markup (5–6 groups for a 16-component site on one run), so on that markup the screenshots do more of the reconciling.

Sanity: > 15 components for a normal marketing site is over-split; two names that could describe one thing merge; two proposal groups differing by one optional child merge; an entry without Spec lines read from recon/spec/ is not finished.

The band map — recon/bands.json (the catalog, keyed the way pages are built)

Now that components have names, map every census band type to one of them: {"<bandKey>": {"component", "variant", "props": <canonical skeleton>, "slots", "provenBy": null}} plus gapRecipes and spacerSteps derived from the census gap histogram, and a hold_height entry per third-party embed with its measured heights per breakpoint. provenBy is filled in Step 6 with the first build script that ships the band working. scripts/bands.py consumes the map (band(), gap() that raises on an unknown gap instead of guessing, lift() for HTML→prose with one attribute policy, hold_height()). Two pages with the same live band type produce the same node shape: one band key, N content sets, never N designs. This file is what lets several page agents build from one catalogue instead of re-deriving it.


Step 3 — Name the measured tokens

recon/tokens.json exists with a usage count on every value. This step names entries and translates them into the Workbench token files per canvas-styling-conventions; it does not invent values.

  • Type roles from the examples map: display, h1, h2, h3, body-lg, body, small, eyebrow, button. A combination used once or twice is a per-component override.
  • Spacing scale = the double-digit-count values. Do not round; a 56px rhythm is 56. The spacer component's steps come from the bandGaps histogram (measured inter-band gaps), not from a design-system scale: a 16/32/64/96/128 scale rounded a 60px CMS rhythm to 64 and drifted 44px into the footer on an 11-spacer page.
  • Containers from the top containers entry; Workbench breakpoints from the top two or three recon/breakpoints.json conditions so responsive behaviour flips at the same widths.
  • Colours: backgrounds are area-weighted, so the band colours outrank a hundred badge tints. Name those; low-weight tints are component overrides.
  • Fonts: every family in recon/fonts.json self-hosted from public/fonts/ with matching @font-face weights, or a recorded ceiling. The font @import is the first line of global.css — CSS drops any @import that follows a non-import at-rule, and Tailwind 4's @plugin is one. Verify with document.fonts in the preview, not by reading the file.

Write recon/tokens-named.json; leave the histogram untouched so counts stay auditable. Every component consumes tokens. No hardcoded hex, px or rem in any component: a raw value with a real count in the histogram is a missing token; a one-off is a commented override naming the live element.

Two consumption rules, or the tokens silently vanish. cn() is tailwind-merge and it classifies any unrecognised text-<word> as a colour, so cn('text-body', 'text-primary-500') drops one of the pair, silently, in both directions; three builders hit this independently.

  1. Consume a size token as text-[length:var(--text-x)] with an explicit leading-[var(--text-x--line-height)], never as text-x.
  2. Never give a colour token and a size token the same name (--color-banner and --text-banner both emit text-banner; the colour wins).

Typography: one prose rule set, plugin if the host resolves it, hand-written if not

All flowing rich text renders under one .prose rule set; never hand-roll per-band paragraph/heading/list spacing. Prefer @tailwindcss/typography: install it, register it in global.css after the font import (@import "tailwindcss"; @plugin "@tailwindcss/typography";), then test that it emitted anything:

agent-browser --session t eval '[...document.styleSheets].flatMap(s=>{try{return[...s.cssRules]}catch{return[]}}).filter(r=>/\.prose/.test(r.selectorText||"")).length'

Run it against the rendered preview (inside the iframe when the harness has one). Zero means the host does not resolve project plugins — Workbench (the Nebula dev server) builds the global stylesheet through its own Tailwind instance and this was verified at zero rules with both @plugin quoting styles — so uninstall it and hand-write .prose in global.css from the measured type roles. Either way, tune to the Step 3 tokens so a bare prose block matches live, apply prose (usually prose max-w-none) to every article body and every dangerouslySetInnerHTML block, and verify every declaration against live with python3 scripts/prose_verify.py <slug> on a prose-heavy page once the build side is captured: it compares the most common computed value per text role (p, li, h2, h3, a, img) on both sides and prints each mismatch. A hand-written .prose shipped five wrong values on one run, each compounding down the page. When live computes normal, ship normal — a line-height measured from one link-bearing row was wrong for every plain row.

With the plugin, reset the three defaults that reliably fight measured values (20–40 points per prose page on a verified run):

prose-p:mt-0        /* plugin ships p{margin-top:1.25em}=20px; wins the collapse against a measured 16px and compounds +4px per paragraph */
prose-li:pl-0       /* plugin ships li{padding-left:.375em}; narrows the measure enough to re-wrap long items, changing page height */
[--tw-prose-bullets:var(--color-ink)]   /* default marker grey registers as no ink */

Set them as utilities, never !important, so real inline styles in the source body still win. Diagnostic: a prose page whose height delta is positive and grows with paragraph count is the plugin's margins, not your spacing. Short UI strings (buttons, nav items, badges) are not prose.

Preflight is not the live baseline

Live renders on UA defaults; the build renders on Tailwind preflight. Deleting a rule does not bring the UA default back — preflight has already zeroed it. When live relies on a UA default, restate the UA value explicitly. The three known collisions:

preflight rulewhat it did on a real runrestate as
ol, ul { margin: 0; padding: 0 }a list lost its indent, four entries re-wrapped, page grewul, ol { padding-left: 40px; margin: 1em 0 } (or the measured values)
img { max-width: 100% }would have scaled prose images live renders at intrinsic size, ~1000px on one mobile page.prose img { max-width: none } where live does
* { border-style: solid } (0 width)made every div a non-wrapper to the spec extractor: phantom EXTRA nodes in every conformance runfixed in spec_extract.js (it now keys on border width); still put border-none on structural wrappers you add

Step 4 — Images: scan, download, validate, convert, upload

Scan → aria2c → exiftool → vips → Source MCP create_media. No CLI media commands. Remote workbench-only: stop after the convert step; the local files under public/media/ are what Workbench serves.

The Canvas CLI's media upload endpoint (/canvas/api/v0/media/image/upload) 503s in bursts on Source for every source format. Never canvas reconcile-media or --include-pages against Source.

  1. Scan. Consolidate recon/raw/*.json (imgs, bgImgs, heroPoster) into recon/media.json: [{"src","alt","w","h","pages":[…],"role":"hero|content|icon|logo|bg|misc"}], deduped by basename. For any <img> inside a <picture>, the runtime img.src is the wrong source: at a mobile-ish viewport or before layout settles it resolves to the mobile crop (100% wrong-hero rate on one run, 768×1280 portrait for a 1366×348 banner). Take hero candidates from recon/census.json pages[].heroes (the <source srcset> per breakpoint, written by recon_derive.sh), keep both derivatives as separate props (imageDesktop, imageMobile), and pin derivative names so scan order cannot hand the bare stem to the wrong raster (<stem>--desktop.jpg, <stem>--mobile.jpg).
  2. Download in one parallel run: build recon/media-urls.txt (URL line + out=<role>/<basename> line) from media.json, then aria2c -j 16 -d public/media -i recon/media-urls.txt --max-tries=3 --retry-wait=2.
  3. Validate: exiftool -FileType -ImageWidth -ImageHeight -T -r public/media/ > recon/media-validation.tsv. HTML/TXT/- = failed download → validated: false, listed in recon/missing-images.md. Format ≠ extension → convert. Before any hero prop is written, assert its aspect: a portrait file (ImageHeight > ImageWidth) on a desktop banner is the wrong derivative; fail, do not build.
  4. Convert with vips: vips copy logo.svg logo.png (Source rejects SVG), vips copy hero.webp hero.jpg[Q=85] (many media:image bundles accept only jpg/png/gif). Re-run exiftool after converting.
  5. Upload (Source only). Per validated file: create_media(bundle:"image", name, filename, metadata:{alt}) → {target_id, upload_url}; curl -X PUT "<upload_url>" -H "Content-Type: application/octet-stream" --data-binary @<file> → 2xx. Collect 15–20 create_media results, then 10-way parallel PUTs. Write recon/media-target-ids.json keyed by both original URL and local path after every batch — tokens expire after ~15 minutes and you must resume without replaying. Spot-check 3–5 MIDs with list_entities; uploaded count must equal validated count.

Videos. agent-browser already read the resolved currentSrc / manifest URL in Step 1 (never point yt-dlp at a page URL); yt-dlp -o 'public/media/video/%(title)s.%(ext)s' '<url>'; ffprobe -v quiet -print_json -show_format -show_streams for the bundle decision; ffmpeg -ss 1 -i <file> -frames:v 1 <poster>.jpg only when the page declared no poster. Posters go through the same validate → upload path.

Where each image form is used (this table is the whole rule)

WhereFormWhy
pages/*.json, regions/*.json, mocks.json{"src": "/media/<role>/<file>", "alt", "width", "height"} — local path, object formcanvas validate rejects a bare MID on an image prop; Workbench serves public/
component.yml examples for image propsa fully-qualified URL at the real aspect (https://placehold.co/1200x800) or omittedCanvas's own lint requires a full URL there; remember Step 5's examples rule
Source MCP page/region assembly (Step 8)scalar MID integer (backgroundImage: 371) looked up in recon/media-target-ids.jsonSource resolves it to the full media reference
Node fields (Step 4c){"target_id": <mid>}entity reference

No https:// CDN URLs and no data: URIs in page or region JSON: grep -rE '"src": *"(https?:|data:)' pages/ regions/ must print nothing.


Step 4b — Menus on Source (main + footer) via MCP, before the components that consume them

Remote = source: mandatory. Remote = workbench-only: skip the MCP calls, but the components still take menuMachineName and fall back to itemsJson / FALLBACK_LINKS so they work when a menu exists. If the menus don't exist when a page first renders, the JSON:API call returns empty and the component falls through to its placeholder, destroying parity for the whole diff loop. Reference: acquia-source-navigation-menus.

  1. Create the menus from menuMachineName in recon/nav.json and recon/footer-nav.json: create_menu(id="main-nav", label="Main Navigation"), create_menu(id="footer-nav", label="Footer Navigation"). Lowercase, ≤ 32 chars, and not main/footer (reserved on many installs).
  2. Create the page shells first, then link to the entity. internal:/path stores the alias; when an editor changes the alias the menu link breaks or points at a stale path, because it was never bound to the entity. So for every in-build page, call create_canvas_page(title, path) now (an empty shell; Step 8 fills it), record {slug, entity_type, id} in recon/source-pages.json, and link with entity:<entity_type>/<id> (entity:node/<nid> for content-type nodes, the Canvas page entity type and id the create call returns for Canvas pages). Drupal then resolves through the alias system at render time and inherits redirects. Use internal:/path only for targets with no entity in this build, route:<nolink> for panel parents without a destination, https://… for external.
  3. Top-level items: create_menu_item(menu_name, title, link, weight, expanded=true) for each nav.json.items[] and each footer column heading. Capture each returned uuid.
  4. Children: same call with parent="menu_link_content:<parent-uuid>", weight increasing in source order.
  5. Publish: new items are draft auto-saves. ReadMcpResourceTool(uri="canvas://auto-saves") → [{autosave_key, data_hash}] → one publish_auto_saves(autosaves=[…]). If the server reports no resource support, publish from the Drupal UI (Structure → Menus) and note it in the report.
  6. Persist recon/menus.json (title, uuid, id, children per menu).

Verify before Step 5: every menu item that targets a page in this build is an entity: link (zero alias-form links to in-build pages), every top-level item and child is published, and <source-host>/api/menu_items/main-nav (the prefix is /api/ on Canvas, read it from drupalSettings.canvasData.v0.jsonapiSettings.apiPrefix) returns a populated linkset.


Step 4c — Content types (only the bundles the user opted into)

Repeatable list content (blog posts, case studies, products, team bios) becomes Drupal content types so editors manage instances and one React component renders any node via JSON:API + SWR. One-off pages stay in pages/*.json. The user decided which in Step 0.5; recon/content-types.json is the source of truth.

Per bundle: (1) field list from 2–3 example pages; (2) create_content_type + one batch_add_fields_to_content_type (workflow ID is install-specific — read /admin/config/workflow/workflows); (3) two-stage scrape: browser dumps resolved HTML, scripts/extract_<bundle>.py (bs4, offline, re-runnable) extracts {title, subtitle, hero, author, publishedDate, bodyHtml, inlineImages}; (4) heroes to jpg → create_media → PUT, MID map saved per batch; (5) batch_create_nodes in chunks of ~8 with path.alias; (6) one component per bundle: slug prop → bare collection fetch (no ?include=), per-media second fetch, absolute URLs from drupalSettings.canvasData.v0.baseUrl, hero as background-image, body via dangerouslySetInnerHTML in prose, forgiving matcher; (7) optional content template auto-binding slug from path.alias (deploy via admin UI; CLI push of templates is blocked on Source).

Workflow and decisions: references/step-4c-content-types.md. Code and failure log: references/content-type-migration.md. Read the workflow file before starting.


Step 5 — Build components as primitives

Order: navigation → footer → other common → shared → unique. Library-based entries are restyled in place from their Base: line (classes, variants, spacing, type; prop and slot contracts untouched); new entries are authored per canvas-component-definition and canvas-component-metadata (and nebula-component-creation, this directory's convention).

Architecture contract (what "clean" means here)

  • One folder per component: src/components/<machineName>/component.yml + index.jsx, nothing else shared by import except src/lib/ helpers. One component per census band type; a look-alike is a variant (variant enum prop mapped through CVA), never a second component.
  • Content via props, structure via slots. Repeatable children (cards, columns, list items) are a parent slot plus a child component, so editors add and reorder them in Canvas. Single images are Canvas image-schema objects. No hardcoded copy, no examples on content-carrying props.
  • Design via tokens only. Every colour, size, spacing and radius resolves to a global.css token from Step 3; a one-off value carries a comment naming the live element it came from.
  • Fetching is confined to the navigation and footer (menus by menuMachineName) and to content-type components (Step 4c). Every other component is pure render.
  • Built from its Spec lines, not the screenshot (look at the screenshot to understand the design, read the spec to build it). Responsive behaviour comes from the mobile spec and the measured breakpoints, not guesses.
  • Every gate below runs per component before it is used on a page. A component bug caught here is one file; caught in Step 7 it is every consuming page.

examples are production content on Source

Canvas fills any prop absent from a component instance with examples[0], and an explicit "" is stored by dropping the prop, so it comes back on the next write. On a real client site that put Jamie Lee, 5 min read, Acme and placehold.co images on live pages. Write examples only for labels that are correct everywhere they appear, or as real values from the site being copied; omit them on every prop that carries per-instance content. Props listed in required: need one and are always set explicitly, so theirs are safe. Audit before the first push:

grep -rn "examples:" -A2 src/components/*/component.yml

Prop discipline (lint-clean from the start)

Prop ID = exact camelCase of title (itemsHtml ↔ Items Html; never Items (HTML)). Check the tree with yq, never grep on YAML:

for f in src/components/*/component.yml; do
  yq -r '.props.properties | to_entries[] | "\(.key) \(.value.title)"' "$f" | while read -r id title; do
    expected=$(echo "$title" | awk '{gsub(/[^a-zA-Z0-9 ]/,""); for(i=1;i<=NF;i++) printf (i==1?tolower(substr($i,1,1)):toupper(substr($i,1,1))) substr($i,2)}')
    [ "$id" = "$expected" ] || echo "MISMATCH $f: id=$id title=\"$title\" (expected $expected)"
  done
done

Renames that leak across components are fixed structurally with ast-grep --update-all plus a yq -i edit per component.yml. npm run code:fix before npx canvas validate (keep the project's ESLint authoritative; do not swap in biome). watchexec -e jsx,yml -- sh -c 'npm run code:fix && npx canvas validate' keeps validation running during long fix passes. Only text/html is a valid contentMediaType; for JSON-shaped strings omit it entirely (the failure surfaces at push, not validate).

Numeric conformance gate (per component, before pixels)

Render the component in Workbench's component preview with the same props as a live instance (real copy, real images — per canvas-workbench, the component's mock carries them), capture it with scripts/capture.sh wb-c <component> <preview-url> desktop --wb (or --harness), then:

python3 scripts/spec_conform.py recon/spec/home.desktop.json recon/spec/<component>.wb.desktop.json --section <i> --tol 2

Exit 0 → pixel gate. Non-zero → the output is the fix list, shallowest first (MISSING/EXTRA, then SIZE, then BOX/TYPE/LAYOUT/COLOR); fix the top finding, re-run. Repeat at 375 against the .mobile.json spec. An intended deviation from live goes in the catalog entry's Notes so Step 7 does not rediscover it.

Component parity gate (≥ 90, one pass, same scorer)

A component bug found in Step 7 has already replicated into every consuming page. Cut the live band with the y-span from recon/catalog.json, crop both to the shorter, score with the scorer, and run the blank control once so the number means something:

vips crop recon/screens/desktop/home.png /tmp/ref.png 0 <y0> 1440 <h>
H=$(( $(vipsheader -f height recon/screens/wb/<component>.png) < <h> ? $(vipsheader -f height recon/screens/wb/<component>.png) : <h> ))
vips crop /tmp/ref.png /tmp/ref-n.png 0 0 1440 "$H"; vips crop recon/screens/wb/<component>.png /tmp/wb-n.png 0 0 1440 "$H"
vips black /tmp/c.v 1440 "$H" --bands 3 && vips linear /tmp/c.v /tmp/blank.png "0 0 0" "255 255 255"
scripts/parity.sh /tmp/ref-n.png /tmp/wb-n.png; scripts/parity.sh /tmp/ref-n.png /tmp/blank.png   # score, floor

Gate at ≥ 90 with a ≥ 10 margin over the floor. Below that is a structural miss (layout, variant, token): fix it now, before Step 6.

Navigation component (required, and exactly one)

One navigation component and at most one presentational child. Utility strip, sub-nav, section band, mega menu, mobile drawer: variants or data shapes inside it, never sibling components. This overrides the decomposition skills (Step 0). Gate, before Step 6:

[ "$(ls src/components | grep -ciE 'nav|menu|header')" -le 2 ] || echo "FAIL: navigation is decomposed - fold it back into one component"

Own folder, wired to the main-nav menu by menuMachineName (primary), then itemsJson (extra megamenu structure the Drupal model cannot carry), then FALLBACK_LINKS (never a blank preview). Links resolve through one seam, resolveHref(item, env): on Source the menu item already carries the entity-bound URL; in Workbench a live href is mapped to the local page path through recon/navmap.json (written by scripts/path_contract.py) and anything not in the build keeps pointing at the live site. Switching environments must never require a component rewrite. Must cover: logo, top-level items with kind: link | dropdown | megamenu, hover-open panels with hover intent (click on touch, Escape and outside click close), multi-column megamenus, sticky/scroll transition per nav.json, mobile drawer with accordion sections, keyboard navigation, ARIA (aria-haspopup, aria-expanded, aria-current; no role="menubar" on <nav>).

props:
  properties:
    menuMachineName: { title: Menu Machine Name, type: string, examples: [main-nav] }
    itemsJson:       { title: Items Json, type: string }   # no contentMediaType; parsed in the component

sortMenu returns a tree — parents carry _hasSubmenu and _children. Mapping every entry to a link collapses every megamenu (this has happened on multiple runs). Walk it:

import { useMemo } from 'react';
import useSWR from 'swr';
import { JsonApiClient, sortMenu } from 'drupal-canvas';
const client = new JsonApiClient();

const Navigation = ({ menuMachineName, itemsJson }) => {
  const machineName = (menuMachineName || '').trim();
  const { data, error } = useSWR(machineName ? ['menu_items', machineName] : null, ([t, id]) => client.getResource(t, id));
  const items = useMemo(() => {
    if (machineName && data && !error) {
      const sorted = Array.from(sortMenu(data));
      if (sorted.length) return sorted.map((e) => e._hasSubmenu && e._children?.length
        ? { label: e.title, kind: 'megamenu', columns: [{ links: e._children.map((c) => ({ label: c.title, href: c.href || c.url || '#' })) }] }
        : { label: e.title, kind: 'link', href: e.href || e.url || '#' });
    }
    const parsed = parseItems(itemsJson);          // 2. authored structure
    return parsed.length ? parsed : FALLBACK_LINKS; // 3. Workbench never blank
  }, [machineName, data, error, itemsJson]);
  // ... render ...
};

Hover-gap: absolutely-positioned panels do not trigger the parent's onMouseEnter, so put the gap inside the panel wrapper as transparent padding and clear the close timer on panel enter. Longer timeouts mask the bug.

Footer component (required, menu-driven)

Same wiring to footer-nav: top-level entries render as column headings, _children as column links. legalLinksHtml, socialLinksHtml, newsletterHeading, newsletterCta, copyright, countryLabel are plain props — chrome, not menu content. Same fallback chain (menu → columnsJson → FALLBACK_COLUMNS).

After every 3–4 components: npm run code:fix && npx canvas validate, fix immediately, commit. Do not advance until every component passes.


Step 6 — Assemble regions and pages

Generate specs with scripts/pagelib.py, never by hand: node(component, props, slots) + emit() produce an elements map in the required order — a parent must precede every child it references from a slot, or validation fails with references unknown or out-of-order parent. img(src, alt, w, h) yields the local object form from recon/media.json; write_page() / write_region() serialise.

  1. Regions first — only when the census found one chrome family. regions/header.json holds the navigation component (menuMachineName: "main-nav"); regions/footer.json holds footer (menuMachineName: "footer-nav", chrome props). layout.jsx renders them on every page; page JSON then contains only main content. Per canvas-regions. Regions are global: one RegionsProvider per app, no per-page override. Cutover procedure when the census finds >1 family (do it before the first page, never mid-run): empty regions/*.json, remove the <Region> calls from layout.jsx, add the family's header and footer as the first and last nodes in every page spec through bands.py (band('header-A'), band('footer-B')), and record chrome: "per-page" in recon/project.json. Doing this late means editing every build script at once.
  2. Pages per canvas-page-definition (nebula-workbench-pages for this directory): one build script per page, scripts/build_<slug>.py, that imports bands.py and emits pages/<slug>.json — regenerate, never hand-edit. Bands in live-site order from recon/bands.json (fill provenBy on first use), real content via props, itemsJson only when the megamenu needs structure the Drupal menu cannot represent. Homepage first, then the two most representative pages, then the rest. Path contract: the page's path is the href the navigation uses for it, verified mechanically.
  3. Third-party embeds (calendars, social timelines, maps, video walls): never fabricate a substitute — one probed worse than white. hold_height(desktop, mobile) emits a placeholder component that holds the measured height and draws nothing, keeping every band below it on its live y; record it as a known residual in recon/diffs/<slug>.md. Build the placeholder component once (an empty div with responsive heights) when the census lists any embed.
  4. After every 3 pages: npx canvas validate && python3 scripts/path_contract.py, commit by pathspec. path_contract.py fails on any page whose declared path differs from the nav's href (one run declared /about-us against a nav that pointed at /about, found after the build) and writes recon/navmap.json for the nav's resolveHref.

Literal after-the-fact fixes across generated specs use sd across pages/*.json regions/*.json, not sed; structural fixes regenerate through the templater.


Step 6.5 — Host-harness pre-flight (once, before the first diff)

The preview harness is not the site; both of these look like your build being wrong.

  1. Assets, by content-type and byte count, never status code. An SPA harness answers 200 for every path: curl -s -o /dev/null -w '%{content_type} %{size_download}\n' <preview-origin>/media/<real-image> must print image/jpeg <bytes>, not text/html 757. Fix the static mount before diffing anything.
  2. Preview URL pattern. Read document.querySelector('iframe').src in the Workbench tab for one page. If it is a real URL, record its template in recon/project.json as previewUrl (e.g. http://localhost:5176/preview/{slug}) — that is the build side, opened directly. If it is about:srcdoc, record the Workbench page URL template and use --harness.
  3. Harness box model. Workbench injects style="padding: 1rem" on <main> (sections measure 1408 instead of 1440). scripts/flatten_iframe.js neutralises it at capture time. An artefact the harness adds is removed in the capture, never compensated for in layout or component code — that hack would ship to production.

Step 7 — Visual diff loop

Machine-first, not machine-only: scripts normalise, score, localise and rank; the model diagnoses root causes, writes fixes, and looks at the side-by-side every pass. Read references/step-7-measurement.md before the first pass.

Before the first pass

The ceiling is already in recon/parity.json._ceiling from Step 1.5 (re-run scripts/ceiling.sh <slug> <live-url> 1440 if the capture contract changed since). Confirm it is above PARITY_TARGET; if the fonts list in parity.json.knownCeilings is not empty, set per-page ceilings now for the pages those fonts dominate (stopping rules below) instead of discovering them on pass 30.

Capture both sides, in parallel, then measure in batch

scripts/capture_all.sh 3 --wb "$(jq -r .previewUrl recon/project.json)"            # directly openable preview document
scripts/capture_all.sh 3 --wb "$(jq -r .previewUrl recon/project.json)" --harness  # when the iframe is srcdoc
for s in $(jq -r '.[].slug' recon/pages.json); do scripts/measure.sh "$s" 1440 <pass>; done
for s in home <rep1> <rep2>; do scripts/measure.sh "$s" 375 <pass>; done

Land all screenshots for the pass first, then run measure.sh as one local loop; never interleave screenshot → diff → screenshot. Nav interaction states (each panel open, mobile drawer, scrolled) are captured with scripts/nav_capture.sh <preview-home-url> wbnav --wb (writes recon/screens/wb/_nav-*.png and recon/nav.wb.json, never the live files) and diffed by eye against the live _nav-*.png into recon/diffs/_nav.md; they are functional deltas.

measure.sh per page: width assertion → layout ledger (spec_conform.py --sections-only, first finding names the cascade) → render assertions (band count, backgrounds, visible images, duplicates, fonts, h1) → content-rendered check (content_check.py: every text prop in the page spec must appear in the build's rendered text; a variant that never reads its body prop rendered a 1584px band with 1384px of content missing and "nothing to score") → crop to the shorter → controls through parity.sh with the ink polarity pinned by ceiling.sh (auto-detect flips between passes when the page mean sits near 128; pinned once, scores stay comparable) → score → odiff mask only → diff_bands.py + name_bands.py → two side-by-sides (a 700px overview and a full-resolution one under recon/screens/review/) → locked ledger append → stopping rules. A pass whose controls fail records nothing.

Diagnose in this order, nothing else

  1. Look first. Open recon/screens/review/<slug>-<bp>-sbs-full.png and write two or three sentences in recon/diffs/<slug>.md saying what you see, band by band: a missing block, a wrong ground, wrong order, a component that rendered none of its text. The image answers what is wrong in one glance; the numbers below answer by how much. A score alone never closes a page; this read-out is part of the pass gate.
  2. Layout ledger (recon/layout/<slug>.<bp>.ledger.txt): clear every section-count and height mismatch, top-most first. A count mismatch is a Step 6 page bug.
  3. Render assertions and content check (…render.txt, …content.txt): a wrong band ground, an invisible image, a duplicated asset, a missing font, a prop that never rendered. Pixels cannot see these.
  4. Ink check: scripts/ink.py <live.png> <wb.png> <x> <y> <w> <h> on the top dirty band. A mask of edge-outlined glyphs is an offset, not styling; fix the spacing above the element by the printed delta.
  5. Full spec_conform.py (no --sections-only) on the page: named property on a named element, shallowest first. A component-level finding is fixed in the component, not on the page.
  6. Only then recon/diffs/<slug>-<bp>-regions.json, top components first. Write findings to recon/diffs/<slug>.md, scoped to the flagged bands; never walk a page top to bottom.

Fix globally before locally: a delta in the same component on 3+ pages, or in every section of one page, is a token or global.css bug. Probe before you edit: inject the candidate CSS at capture time, re-score, report the delta (practices 81.43 → 99.77 with .prose > p{margin-top:0}); this is how a component change is justified, especially when another agent owns the file. Coupled fixes probe together: two deltas on the same axis can show a regression for a correct fix when probed alone.

Per pass

  1. Apply every functional fix; review with difft (GIT_EXTERNAL_DIFF=difft git diff) before re-shooting.
  2. git commit -m "wip: site-copy diff pass <n>" -- <owned paths> && git tag sitecopy-pass-<n> — pathspec, never -A (Step 0.5).
  3. Hash-gate the re-diff:
    PREV=$(git describe --tags --match 'sitecopy-pass-*' --abbrev=0 HEAD~1); CHANGED=$(git diff --name-only "$PREV" HEAD)
    echo "$CHANGED" | grep -qE '^src/global\.css|tokens|tailwind|postcss|fonts/|^regions/|^src/layout' && echo FULL   # global blast radius
    echo "$CHANGED" | grep -oE '^src/components/[^/]+' | sort -u    # else: consuming pages via catalog.json "pages"
    
    Re-capture and re-measure only pages that consume a changed component; untouched pages keep their ledger scores. Nav states re-capture only when navigation or footer changed. One full re-diff of everything runs exactly once, as the final verification before Step 8.
  4. A page passes on the six gates above. Otherwise loop.

Stopping rules (mechanical — measure.sh prints them)

  • Per-page ceiling. An unobtainable asset (a licensed font with no file, a third-party embed, an unreproducible widget) caps the page. Record it the moment it is known: jq '.ceilings["<slug>"]={value:<n>,reason:"<why>"}' recon/parity.json. measure.sh prints STOP when a score is within 2 points of the page's ceiling; do not run another pass. One run spent 36 passes on a homepage capped by a Typekit font, and recorded the cap in prose after the passes were spent.
  • Plateau. Two consecutive passes each improving by less than 0.5 → PLATEAU: stop patching, open the full-resolution side-by-side, name the structural cause (missing block, wrong variant, wrong order, unobtainable asset), fix that or set a ceiling, and write the residual to recon/diffs/<slug>.md. Passes 10–13 of one page moved 70.20 → 70.23 → 70.20 → 70.23 with nothing telling the agent to stop.

Running with a fleet

When more than one agent works the tree, ownership is explicit or work is lost. Copy this table into recon/BRIEF.md and fill it in:

ownermay write
chrome agentsrc/components/navigation/**, src/components/footer/**, regions/**
components agentsrc/components/<the folders it is told to own>
page agent <slug>pages/<slug>.json, recon/diffs/<slug>*, scripts/build_<slug>.py
leadsrc/global.css, src/layout.jsx, recon/bands.json, recon/catalog.json, recon/BRIEF.md, SITE_COPY_REPORT.md

Rules: commit only by pathspec; never checkout/reset a file you do not own; a page agent that finds a component or global-CSS bug does not fix it — it writes the finding to recon/diffs/<slug>.md with a probe result (inject the candidate CSS at capture time, re-score, report before → after) and reports up. The probe is what makes the report actionable: two page agents independently probed the same three wrong .prose rules and handed back numbers, which is how a 17-point global fix landed once.

Anti-patterns that sink the loop

Scoring with anything but parity.sh · reporting a score without its controls · capturing at DPR 2 · diffing before the layout ledger · reading the diff image before spec_conform.py · discovering in Step 7 that a component was built from the screenshot (a Step 5 failure: fix against its spec, re-run its gates) · gating the re-diff on src/components/ only · chasing a typography delta whose font is a recorded ceiling · skipping the determinism pass on either side · never opening the side-by-side · marking functional deltas "minor" · building a new component where a variant was missing · fixing the homepage and assuming the rest inherit · skipping mobile or nav-state diffs · claiming a pass the ledger does not support · chasing points past PARITY_TARGET.


Step 8 — Validate, push, report

Commit first: git commit -m "feat: site-copy complete pre-push" -- <owned paths> (a single-agent run may stage everything; a fleet never does). Then npm run code:fix && npx canvas validate must succeed for every component, region and page (nebula-component-validation for this directory).

Acquia Source (remote = source)

The CLI contract is narrow on purpose.

Allowed: npx canvas push --yes --include-pages false --include-content-templates false (components only; --include-pages defaults on, so pass false explicitly) · npx canvas validate · npx canvas login. Forbidden: canvas push --include-pages (page validation fails with elements.<uuid>.type: Invalid input and Source ships back empty pages) · canvas reconcile-media (the 503ing upload endpoint) · canvas pull with uncommitted work (deletes local components, reverts global.css).

  1. Push components; retry dependency-order failures per canvas-component-push. Push only the library components the pages consume plus your new ones; report the split.
  2. Menus exist and are published from Step 4b; every image has a MID in recon/media-target-ids.json from Step 4.
  3. Pages via Source MCP, per acquia-source-canvas-pages where installed. The page shells already exist from Step 4b (recon/source-pages.json holds their ids; the menus link to them); create a shell only for a page that has none. Per page: one batch_add_components_to_page per page with the full element array in order (12× fewer round-trips against a 15-minute token). component_id is the js.-prefixed machine name; props go in the same call; image props take the scalar MID; JSON-string props with inline image URLs are rewritten to /media/<mid>; slots use temp_id on the parent and parent_instance_id + slot on children, parent first. Batches are all-or-nothing: fix every flagged prop and retry the batch. Then publish_canvas_page(page_id). Save recon/source-pages.json after each page.
  4. Regions: set_page_region_layout writes a draft; publishing needs publish_auto_saves with a data_hash from canvas://auto-saves. If the server has no resource support, publish the region from the Drupal admin UI and say so in the report.
  5. After any later canvas push that touches pages, image props reset to the local object form and render null on Source. Re-run the MID pass with update_component_props for every image prop (25 props on one run). Script it from recon/media-target-ids.json.
  6. pages/*.json and regions/*.json remain the Workbench preview and the local source of truth; they are never pushed to Source.

A self-hosted Drupal Canvas that is not Acquia Source is outside this skill's push contract; if the user names one, stop and agree the sync commands with them before running any.

If the user did not explicitly ask for a push, stop and ask before any sync command.

Report

Write SITE_COPY_REPORT.md. The pages table is generated from the ledger, never hand-assembled:

jq -r 'to_entries[] | select(.key | startswith("_") | not) | [.key, (.value | last.parity), (.value | last.blank), (.value | last.self), (.value | last.heightDeltaPct), (.value | length), (.value | last.knownCeiling // "")] | @tsv' recon/parity.json

Sections: project shape and target · ceiling · pages (parity, blank floor, margin, height delta, passes; desktop and mobile) · components (common / shared / unique; N from library (restyled) / N new; scc --by-file src/components/) · tokens · media (downloaded, uploaded, MIDs) · navigation and menus (items, states resolved, menus published and serving) · content types · pages and regions on Source (published, MID pass done, region publish path) · pages below PARITY_TARGET with the reason. If any page is below the bar, the skill is not done; the hash gate means only those pages re-enter Step 7.


Definition of done

  • recon/project.json written before any authoring; push contract confirmed by the user.
  • Git clean, commits at every batch boundary, nothing uncommitted at any sync command.
  • scripts/selftest.sh passed; ceiling recorded; every page in recon/pages.json has a final ledger entry that passes all six gates; one full re-diff ran last.
  • Every page has a Step 1.5 spec at both breakpoints; every catalog entry has Spec lines read from it; every component passed spec_conform.py at 1440 and 375 and the ≥ 90 component gate before it replicated.
  • Runs over 3 pages: recon/census.json and recon/bands.json exist and the component wave preceded page assembly; chrome families were clustered on measurements; the navigation gate (≤ 2 nav components) and path_contract.py pass; every page's recon/diffs/<slug>.md carries a written read-out of its full-resolution side-by-side; hand-written prose rules pass prose_verify.py.
  • Navigation implements every interaction the live site has; navigation and footer read main-nav / footer-nav by menuMachineName; chrome lives in regions/ where the project has them.
  • Every component validates clean; all content prop-driven; all design token-driven with every token traceable to recon/tokens.json; no content-carrying examples.
  • Source: components pushed via the narrow CLI contract; pages assembled and published via MCP with scalar MIDs; menus created before components; content-type bundles exist with published nodes and one SWR component each.
  • The report reflects the ledger, including the blank floors and any known ceilings.

Trigger phrases

"Copy [url] into Workbench" · "Recreate [url] in Source" · "Site copy of [url]" · "Rebuild [url] as Source components" · "Clone [url] into Workbench" · "Match [url]'s design in Source" · "Import all blog posts / case studies from [url] into Source" · "Migrate [url]'s content into Drupal content types" · any request to recreate a live URL's design as Source components or to bring its repeatable content into Drupal content types rendered via SWR.

Files included

  • SKILL.md
  • local-power-tools.skill
  • agent-browser.skill
  • local-power-tools-install.sh
  • README.md
  • references/step-4c-content-types.md
  • references/lessons.md
  • references/step-7-measurement.md
  • references/step-1-structural-spec.md
  • scripts/bands.py
  • references/content-type-migration.md
  • scripts/capture_all.sh
  • scripts/capture.sh
  • scripts/ceiling.sh
  • scripts/css_extract.js
  • scripts/decompose_signatures.py
  • scripts/content_check.py
  • scripts/diff_bands.py
  • scripts/fingerprint.py
  • scripts/classify.py
  • scripts/extract_blog.py
  • scripts/flatten_iframe.js
  • scripts/ink.py
  • scripts/measure.sh
  • scripts/pagelib.py
  • scripts/nav_capture.sh
  • scripts/nav_extract.js
  • scripts/name_bands.py
  • scripts/parity.sh
  • scripts/path_contract.py
  • scripts/recon_derive.sh
  • scripts/prose_verify.py
  • scripts/raw_extract.js
  • scripts/render_assert.js
  • scripts/scrollthrough.js
  • scripts/selftest.sh
  • scripts/sitemap.py
  • scripts/spec_verify.py
  • scripts/spec_conform.py
  • scripts/spec_extract.js
  • scripts/tokens_histogram.py
  • site-copy.skill

More skills