Clone any website into a pixel-accurate Next.js app with AI — Playwright-measured extraction (no eyeballing), spec-gated parallel builder agents, and scored pixel-diff QA at phone/tablet/desktop. Works with Claude Code, Cursor, Copilot + 9 more.
JavaScript aiai-agentsclaudeclaude-codecursornextjspixel-perfectplaywrightscreenshot-to-codetailwindcssweb-cloningwebsite-cloner
feat: close the portability, setup, and packaging gaps (v0.2.0)
Mahanaicoach007a54d9bd01
diff --git a/.aider.conf.yml b/.aider.conf.ymlnew file mode 100644index 0000000..aa2f4f1--- /dev/null+++ b/.aider.conf.yml@@ -0,0 +1,2 @@+read:+ - AGENTS.mddiff --git a/.amazonq/cli-agents/clone-website.json b/.amazonq/cli-agents/clone-website.jsonnew file mode 100644index 0000000..49404b9--- /dev/null+++ b/.amazonq/cli-agents/clone-website.json@@ -0,0 +1,9 @@+{+ "name": "clone-website",+ "description": "Reverse-engineer and clone a full multi-page website as a pixel-accurate Next.js replica",+ "prompt": "# Clone Website\n\nReverse-engineer and rebuild **the target URL (plus any extra instructions) provided by the user** as a pixel-accurate, multi-page Next.js clone.\n\nYou are a **foreman walking the job site**: scripts do the measuring, you do the judgment, specs are the contract, builder agents do the construction, and the pixel-diff score decides when you're done. Extraction and construction overlap — dispatch builders as soon as a section's spec passes lint, then keep extracting.\n\n## Resume Check (ALWAYS FIRST)\n\n```bash\nnode scripts/manifest.mjs status\n```\n\nIf a manifest exists, this is a **resumed run**: skip everything already done (`node scripts/manifest.mjs next` tells you where to continue). If not, this is a fresh run — start at Phase 0.\n\n## Scope Defaults\n\n- **Fidelity:** pixel-accurate — colors, spacing, typography, animations, interactions\n- **In scope:** every confirmed page, visual layout, component structure, interactions, responsive behavior (phone 390 / iPad 768 / PC 1440), real content and assets\n- **Out of scope:** real backend, auth, databases, forms that actually submit (mock them)\n- **Content goes in `src/data/*.ts`** — components take props; page files wire data to components. This keeps the clone restylable later (see `/restyle`).\n\nUser-provided instructions override these defaults.\n\n## Tooling\n\nThe scripts do the mechanical work — **use them instead of hand-measuring via browser MCP**:\n\n| Script | Purpose |\n|---|---|\n| **`node scripts/extract/page.mjs <url> [--no-site-files]`** | **THE WORKHORSE — one call, 3 page loads total.** Auto-detects sections, then produces `tokens.json` + `css.json` (skip on later pages with `--no-site-files`), `assets.json` + downloads to `public/`, `responsive.json` (all 3 viewports), a full computed-style walk per section (`sections/<name>.json`), and full-page **and** per-section screenshots at phone/iPad/PC. Accepts explicit `--selector \"css\" --name x` pairs to override detection. Everything is measured from the SAME page state, so numbers, walks and screenshots can never disagree |\n| `node scripts/extract/crawl.mjs <url> [--max 25]` | Discover pages (sitemap + nav links) → `docs/research/<host>/sitemap.json` |\n| `node scripts/extract/section.mjs <url> --selector \"css\" [--name x] --state scroll:600\\|click:sel\\|hover:sel [--viewport pc\\|ipad\\|phone]` | **State captures** (page.mjs covers the default state). Captures a second state and diffs them (element styles *and* `::before`/`::after`), waiting for the section's real transition duration. `--selector`/`--name` repeat — one page load for all |\n| `node scripts/extract/probe.mjs <url> --selector \"css\" [--selector \"css2\"] [--props a,b,c]` / `probe.mjs --route </r>` | Exact computed values for specific selectors at all 3 viewports, as a markdown table with a **varies** column — paste straight into a spec's Responsive section. **`--route` probes EVERY registered section of a page in one call (3 loads total, plus a `probe-<section>.json` per section) — never probe section-by-section** |\n| `node scripts/extract/screenshot.mjs <url> [--selector css --name x ...]` | Extra screenshots at phone/iPad/PC (page.mjs already shot everything once). `--selector`/`--name` repeat — one call, 3 loads, N sections |\n| `node scripts/extract/tokens.mjs` / `css.mjs` / `assets.mjs` / `responsive.mjs` | Single-purpose re-runs of one page.mjs output when something needs refreshing |\n| `node scripts/diff.mjs --original <url> --clone <url> [--selector css] --viewport all [--threshold 95]` | Scored pixel diff, original vs clone. **`--viewport all` scores pc+ipad+phone in one call**, and the per-viewport **band breakdown names the y-range where the mismatch lives** — read it before guessing at causes. **Batched sweep: `--route </r>` (or repeated `--section name=css`) scores every section of a page from ONE load per side per viewport.** Original-side shots are cached 24h, so fix-iteration re-diffs only re-render the clone (`--fresh-original` to override) |\n| `node scripts/lint-spec.mjs <spec.md\\|dir>` | Mechanical spec-completeness gate — must pass before ANY builder dispatch |\n| `node scripts/manifest.mjs <cmd>` | Pipeline state: init / add-page / add-section / set / status / next |\n\nBrowser MCP (Chrome MCP, Playwright MCP — if available) is for **judgment work only**: watching how the page behaves while scrolling, exploring what's clickable, understanding an animation. Numbers always come from the scripts. If no browser MCP is available, the scripts alone are sufficient — use extra `screenshot.mjs` and `section.mjs --state` calls to observe behavior.\n\nThe scripts are plain Node CLIs — any coding agent can run them. Playwright's Chromium auto-installs on the first script run (or run `npm run setup` once). If your tool has no subagent/worktree support, skip the dispatch mechanics and build each section yourself, sequentially, from the same lint-passing specs — every quality gate still applies.\n\n## Guiding Principles\n\n1. **Completeness beats speed.** A builder that has to guess a color, font size, or padding value means extraction failed. Extract one more property rather than ship an incomplete spec.\n2. **Small tasks, perfect results.** One focused component per builder. Spec body over 150 lines = split the section (lint-spec enforces this).\n3. **Real content, real assets.** Actual text via the section walker, actual files via `assets.mjs`. Watch for **layered images** — a hero that looks like one image is often background + overlay + foreground; `assets.json` records sibling counts and z-index for exactly this reason.\n4. **Foundation first.** Tokens, fonts, types, icons, and shared chrome (header/footer) before any page section.\n5. **Extract how it looks AND how it behaves.** Every interactive element needs before/after states with exact values — `section.mjs --state` produces the diff mechanically.\n6. **Identify the interaction model before building.** Scroll-driven vs click-driven confusion is the most expensive mistake in cloning — a wrong call means a rewrite, not a CSS fix. Scroll first without clicking and watch; only then click. Record the model in the spec frontmatter.\n7. **Responsive is measured, never guessed — at all three widths.** Fill every spec's Responsive section from `responsive.json` + `probe.mjs`, with real numbers for phone AND iPad AND pc. Never write \"iPad: same as desktop\": most production sites step their root font-size at breakpoints, so *every* padding, margin, and font size changes even when the layout looks identical. A spec that only nails desktop produces a clone that scores ~98% at 1440px and ~91% at 390px. `lint-spec.mjs` rejects vague responsive sections.\n\n8. **The extraction JSON is ground truth; the spec is a summary of it.** If a builder finds the spec disagreeing with `sections/<name>.json` or `responsive.json`, the JSON wins — say so explicitly in every builder prompt and have the builder report the discrepancy so you can correct the spec.\n9. **Spec files are the contract.** No spec → no builder. lint-spec must pass → then dispatch.\n10. **The build must always compile.** Builders verify `npx tsc --noEmit`; you verify `npm run typecheck && npm run lint` after every merge. Full `npm run build` runs only at checkpoints (Phase 0, end of Phase 2, once mid-way through Phase 3, Phase 4, completion) — it takes 30–60s and running it per merge serializes otherwise-parallel builders.\n11. **The manifest is updated at every stage transition.** That's what makes the run resumable.\n\n## Phase 0 — Crawl & Scope\n\n1. Verify the base builds: `npm run build`.\n2. `node scripts/extract/crawl.mjs <url> --max 25`\n3. Show the user the discovered pages (route + source). **Ask which to clone** — recommend: start page + nav pages, skip legal/utility pages unless asked. Default cap ~10.\n4. Initialize state:\n ```bash\n node scripts/manifest.mjs init <url>\n node scripts/manifest.mjs add-page --url <url> --route / # per confirmed page\n ```\n\n## Phase 1 — Recon (one page.mjs call per page)\n\n1. **First page:** `node scripts/extract/page.mjs <start-url>` — produces tokens, css, assets+downloads, responsive signatures, per-section walks, and every screenshot in one shot (3 page loads).\n2. **Every other confirmed page:** `node scripts/extract/page.mjs <url> --no-site-files` (tokens/css are site-wide; everything else is per-page). Downloads dedupe across pages automatically — files already in `public/` are skipped.\n3. **Review the detected sections** in each run's stdout summary (name, selector, pc height, headline responsive change). Detection is a heuristic: if a \"section\" is really two, or two are really one, re-run with explicit `--selector \"css\" --name x` pairs. Section names become spec/component names — rename `section-3` style fallbacks to something meaningful via `--name`.\n4. **Interaction sweep** (judgment work — browser MCP if available): scroll each page slowly top to bottom. Does the header change? Do elements animate in? Auto-switching tabs? Scroll-snap? Smooth-scroll lib (`tokens.json` flags `.lenis`/Locomotive)? Then click every tab/pill/accordion and note what changes. Then hover. `css.json`'s `interactiveStates` lists every :hover/:focus rule the stylesheet defines — use it as the checklist of what to probe. Record findings in `docs/research/<host>/BEHAVIORS.md`.\n5. **Shared chrome detection:** compare screenshots across pages — header/nav/footer that repeat become SHARED components (`SiteHeader`, `SiteFooter`), extracted once from the page where they're most complete.\n\n**Per page — topology:** map every distinct section top to bottom with a working name, its selector, its interaction model (static / click-driven / scroll-driven / hover-driven / time-driven / mixed), and layer notes (sticky? overlay? z-index?). Save `docs/research/<host>/PAGE_TOPOLOGY.md`, then register each section:\n```bash\nnode scripts/manifest.mjs add-section --route / --name hero --selector \"section.hero\"\n```\n\n## Phase 2 — Foundation (sequential, you do it yourself)\n\n1. **Fonts** in `src/app/layout.tsx` via `next/font/google` or `next/font/local` (downloaded fonts are in `public/fonts/`) — families/weights from `tokens.json`\n2. **`globals.css`**: map the target's palette onto the shadcn `:root` token names; add custom properties for colors that don't map; add global keyframes, scroll-snap, smooth-scroll setup found in recon\n3. **TypeScript interfaces** in `src/types/` for the content structures you observed\n4. **Icons**: convert the deduplicated `inlineSvgs` from `assets.json` into named components in `src/components/icons.tsx` (named by function: `LogoIcon`, `ArrowRightIcon`…)\n5. **SEO**: favicons/OG from `public/seo/` wired into `layout.tsx` metadata\n6. Verify `npm run build`, then build **shared chrome** (header/footer) first — full spec → lint → builder cycle like any section, since every page depends on them.\n\n## Phase 3 — Per-Section Loop (extract → spec → lint → dispatch → merge)\n\nWork through `manifest.mjs next` until no sections remain. For each section:\n\n### 3a. Extract\n\n**The default state is already extracted** — Phase 1's page.mjs run wrote\n`sections/<name>.json`, `responsive.json`, and all screenshots.\n\n**First time you enter Phase 3 for a page, probe ALL its sections in ONE call** (3\npage loads total instead of 3 per section — never probe section-by-section):\n\n```bash\nnode scripts/extract/probe.mjs --route <r> # every registered section + probe-<section>.json each\n# add key children in the same call when a spec will need them:\nnode scripts/extract/probe.mjs --route <r> --selector \"<sel> h2\" --selector \"<sel> .card\"\n```\n\nSlice the per-section tables into each spec's Responsive section as you write it.\nPer section, only one thing remains:\n\n```bash\n# Per discovered behavior — one call per state (batch selectors sharing a trigger):\nnode scripts/extract/section.mjs <page-url> --selector \"<sel>\" --name <name>-hover --state hover:\".card\"\nnode scripts/extract/section.mjs <page-url> --selector \"<sel>\" --name <name>-scrolled --state scroll:600\n# per tab/pill state: --state click:\".tab-2\" etc. EVERY state, not just the default.\n```\nState captures wait for the section's actual transition duration, so a slow fade is\nrecorded at its end value, not mid-flight — check `settleMs` in the output if a diff\nlooks wrong. The `diff` array covers `::before`/`::after` too, which is where hover\noverlays usually live. Cross-check discovered behaviors against `css.json`'s\n`interactiveStates` — a :hover rule in the stylesheet with no captured state means\nthe extraction is not done.\n\nMark: `manifest.mjs set --route <r> --section <name> --stage extracted`\n\n### 3b. Write the spec — `docs/research/components/<route-slug>/<name>.spec.md`\n\n```markdown\n---\ncomponent: HeroSection\ntarget: src/components/HeroSection.tsx\npage: /\nscreenshot: docs/design-references/<host>/<name>-pc.png\ninteraction_model: static | click-driven | scroll-driven | hover-driven | time-driven | mixed\nstates: default, hover, scrolled…\nassets: public/images/x.webp, icons:ArrowRightIcon\nresponsive: phone, ipad, pc\n---\n\n# <Component> Specification\n\n## DOM Structure\n<hierarchy from the section walker — what contains what>\n\n## Computed Styles\n<exact values from sections/<name>.json, per element. Never estimated.>\n\n## States & Behaviors\n<per behavior: Trigger / State A / State B / Transition — from the --state diffs.\n Include the implementation approach (CSS transition, IntersectionObserver, etc.)>\n\n## Per-State Content\n<for tabbed/stateful sections: full content per state. \"N/A — static\" otherwise>\n\n## Assets\n<local public/ paths + icon components used. Note layered compositions explicitly.>\n\n## Text Content\n<verbatim from the walker output — never paraphrased>\n\n## Responsive Behavior\n<from responsive.json: real column counts and changes at 390 / 768 / 1440 + breakpoint>\n```\n\n### 3c. Lint gate\n```bash\nnode scripts/lint-spec.mjs docs/research/components/<route-slug>/<name>.spec.md\n```\nFails → extract more. Passes → `manifest.mjs set … --stage specd` and dispatch.\n\n### 3d. Dispatch builder agent (worktree)\n\nEvery builder receives IN ITS PROMPT (never \"go read the file\"):\n- The **full spec file contents inline**\n- The screenshot paths (all 3 viewports)\n- Shared imports available: `cn()`, `icons.tsx` components, shadcn `ui/` primitives, types from `src/types/`\n- The target file path, and the data file to create in `src/data/` if the section has content collections\n- The rule: verify `npx tsc --noEmit` passes before finishing\n- **The ground-truth rule:** \"`docs/research/<host>/sections/<name>.json` and `responsive.json` are ground truth. If this spec contradicts them, follow the JSON and report the discrepancy.\" Builders reliably catch spec errors this way — treat their reports as corrections to make to the spec file.\n\nComplex section (3+ distinct sub-components) → one builder per sub-component + one for the wrapper, sub-components first. **Don't wait** — while builders run, extract the next section.\n\n### 3e. Merge\nAs builders finish: merge worktree → `npm run typecheck && npm run lint` → fix errors immediately → `manifest.mjs set … --stage merged`. tsc catches the cross-worktree breaks (imports, prop types) that per-merge builds used to catch, in a fraction of the time.\n\n**Once, after roughly half the page's sections are merged: run a full `npm run build` checkpoint.** It catches build-only failures (server/client component violations, route exports, metadata) while they're still cheap to bisect. Don't build after every merge.\n\n## Phase 4 — Page Assembly\n\nPer page: create `src/app/<route>/page.tsx` importing its section components with data from `src/data/`, plus page-level behaviors (scroll-snap, observers, smooth scroll). Shared chrome mounts in `layout.tsx` or a route group layout. Wire internal nav links to the cloned routes. `npm run build` must pass.\n\n## Phase 5 — Scored QA Loop\n\nStart the clone: `npm run dev` (background). Then **score the whole page's sections in ONE batched call** (one load per side per viewport instead of one per section):\n\n```bash\nnode scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --route <r> --viewport all\nnode scripts/manifest.mjs set --route <r> --section <name> --score pc=<match> # per section × viewport\n```\n\n**Fix iterations stay single-section** — the original-side shots captured by the sweep are cached, so a re-diff only re-renders the clone:\n\n```bash\nnode scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --selector \"<sel>\" --viewport all --name <name>\n```\n\n- **Pass = ≥95% on all three viewports** → `--stage qa_passed`\n- Below 95% → **read the band breakdown first**: it names the y-range where the mismatch lives, so you inspect that band of the diff image in `docs/research/qa/` instead of eyeballing the whole section. Then check the spec (wrong extraction → re-extract and fix; right spec, wrong build → fix component), re-diff\n- A large height mismatch reported by diff.mjs = missing content or wrong spacing — fix before pixel-tweaking\n- Max 3 fix iterations per section, then record the gap honestly and move on\n- **Text-heavy sections at phone width often plateau at 90–95%** when the target's font isn't available on Google Fonts (e.g. Source Sans Pro → Source Sans 3). Different metrics = different wrap points = unavoidable pixel drift. Confirm the layout matches, note the substitution, and accept it.\n- **A score that's high at pc but low at ipad/phone is always a responsive-spec problem**, not a styling bug. Re-run `probe.mjs` on the section and fill in the values the spec was missing.\n- Finally, test behaviors manually: scroll, click every tab, hover — screenshots can't verify motion; you must\n\nWhole-page diffs (`--selector` omitted) at all 3 viewports close out each page.\n\n## What NOT to Do\n\n- **Don't build click-tabs when the original is scroll-driven** (or vice versa). Scroll first, watch, then click. Wrong model = rewrite.\n- **Don't extract only the default state.** Every tab clicked, every hover captured, header at scroll 0 AND past the trigger.\n- **Don't miss layered/overlay images** — check `siblingImgs` and z-index hints in `assets.json`.\n- **Don't build HTML mockups of things that are actually `<video>`, Lottie, or canvas.** Check first.\n- **Don't approximate (\"looks like text-lg\").** Use the walker's exact computed values; use arbitrary values (`text-[17px]`) when Tailwind's scale doesn't match.\n- **Don't dispatch a builder without a lint-passing spec.** No exceptions — that's the whole quality model.\n- **Don't reference docs from builder prompts** — spec contents go inline.\n- **Don't skip the manifest updates.** An untracked run can't resume.\n- **Don't hardcode content in components.** Content → `src/data/`, components take props.\n- **Don't write \"same as desktop\" in a Responsive section.** Root font-size steps at breakpoints on most real sites, so every number changes. Run `probe.mjs` and write the real values for all three widths — lint-spec now rejects vague responsive sections.\n- **Don't forget `::before` / `::after`.** They carry hero overlays, heading underline bars, and icon glyphs. `section.mjs` captures them under a `pseudo` key — if a spec has none and the screenshot shows decorations, extraction was incomplete.\n- **Don't trust the spec over the extraction JSON.** Specs are hand-written summaries and drift; `sections/*.json` is machine-measured.\n- **Don't declare done without QA scores.** \"Looks right\" is not a number.\n\n## Completion Report\n\n- Pages cloned (routes) · sections built · spec files written (must match section count)\n- Assets downloaded (from `assets.json` download log, including failures)\n- Final QA score table per section × viewport (from `manifest.mjs status`)\n- `npm run build` result\n- Known gaps and any section that couldn't reach 95%\n- Suggest next step: `/restyle` to rebrand the clone with your own identity",+ "fileContext": [+ "AGENTS.md",+ "docs/research/**"+ ]+}diff --git a/.amazonq/cli-agents/restyle.json b/.amazonq/cli-agents/restyle.jsonnew file mode 100644index 0000000..4004c64--- /dev/null+++ b/.amazonq/cli-agents/restyle.json@@ -0,0 +1,10 @@+{+ "name": "restyle",+ "description": "Rebrand a cloned website with your own colors, fonts, logo, and copy while keeping the layout pixel-intact",+ "prompt": "# Restyle\n\nTurn the cloned site into **the user's site**: their brand, their words, their logo — on top of the cloned structure. Layout, spacing, animations, and interactions stay untouched. That separation works because the clone pipeline keeps all content in `src/data/*.ts` and all brand tokens in `globals.css` — you swap those layers only.\n\nHonor any extra instructions the user provided when invoking this command.\n\n## Step 1 — Read the brand\n\nRead `BRAND.md` at the repo root. If it's missing or has unfilled `TODO` fields, ask the user for what's missing (max 3 questions at a time). Never ask for secrets in chat — anything sensitive belongs in env files, not BRAND.md.\n\nIf the user has brand assets (logo files, product screenshots), ask them to drop the files into `public/brand/` and tell you the filenames.\n\n## Step 2 — Take \"before\" screenshots\n\n```bash\nnpm run dev # background\nnode scripts/extract/screenshot.mjs http://localhost:3000 --name before-restyle\n```\nThese are your regression reference: after restyling, layout must still match them structurally.\n\n## Step 3 — Swap the brand layers (in this order)\n\n1. **Colors** — `src/app/globals.css`: replace the cloned palette in `:root` / `.dark` with the brand colors from BRAND.md. Keep the same token *names* so no component changes. Preserve relative contrast: if the original had a dark section, keep it dark in the new palette.\n2. **Fonts** — `src/app/layout.tsx`: swap `next/font` families to the brand fonts. Keep the size/weight structure the clone extracted — only families change.\n3. **Logo & icons** — replace `LogoIcon` in `src/components/icons.tsx` (or the logo `<img>` asset) with the brand logo from `public/brand/`. Keep the rendered dimensions of the original logo so the header layout doesn't shift.\n4. **Favicons & SEO** — regenerate `public/seo/` (favicon, apple-touch-icon, OG image if provided), update `layout.tsx` metadata: title, description, OG tags — from BRAND.md positioning.\n5. **Copy** — rewrite every string in `src/data/*.ts` for the brand: same structure, same approximate length (±20% — long copy breaks cloned layouts), brand voice from BRAND.md. Headlines sell the user's offer, not the original company's. Placeholder patterns like testimonials get realistic brand-appropriate content clearly marked as placeholders unless BRAND.md provides real ones.\n6. **Images** — where the clone shows the original company's product shots, swap in files from `public/brand/` if provided; otherwise leave the cloned image and list it in the report as \"needs replacement\".\n\n## Step 4 — Verify\n\n1. `npm run build` — must pass\n2. `node scripts/extract/screenshot.mjs http://localhost:3000 --name after-restyle`\n3. Compare before/after at all 3 viewports: layout identical, only brand layers changed. Overflowing text = shorten the copy, never change the layout.\n4. Check every page route, not just `/`.\n\n## Report\n\n- What was swapped (colors, fonts, logo, favicon, N copy blocks across M data files)\n- Images still showing the original site's content (need user-provided replacements)\n- Any copy that had to be shortened/lengthened to fit\n- Anything in BRAND.md still marked TODO",+ "fileContext": [+ "AGENTS.md",+ "BRAND.md",+ "docs/research/**"+ ]+}diff --git a/.amazonq/rules/project.md b/.amazonq/rules/project.mdnew file mode 100644index 0000000..91a49ee--- /dev/null+++ b/.amazonq/rules/project.md@@ -0,0 +1,69 @@+<!-- GENERATED from AGENTS.md by scripts/sync-skills.mjs — edit the source,+ then run: node scripts/sync-skills.mjs -->++# site-cloner++Template for cloning any multi-page website into this Next.js codebase, then rebranding it as your own. Two commands drive everything: `/clone-website <url>` and `/restyle`.++## Tech Stack++- **Next.js 16** — App Router, React 19, TypeScript strict+- **Tailwind CSS v4** + shadcn/ui (base-ui primitives), oklch tokens in `src/app/globals.css`+- **Lucide React** icons (replaced by extracted SVGs in `src/components/icons.tsx` during cloning)+- **Playwright** (devDependency) powers all extraction/QA scripts++## Commands++- `npm run dev` / `npm run build` / `npm run lint` / `npm run typecheck`+- `npm run check` — lint + typecheck + build (must pass before any commit)++## Architecture Rules++- **Content lives in `src/data/*.ts`, never hardcoded in components.** Components take props. This is what makes `/restyle` possible — copy swaps without touching layout.+- Pages: `src/app/<route>/page.tsx` wires data → components. Shared header/footer mount in layouts.+- `docs/research/` holds extraction artifacts (JSON, specs, manifest) — auditable, never hand-edited except spec files.+- `docs/research/manifest.json` is the pipeline state. Update it at every stage transition; check it first on any clone-related task (`node scripts/manifest.mjs status`).+- Specs (`docs/research/components/**/*.spec.md`) must pass `node scripts/lint-spec.mjs` before any builder agent is dispatched.+- All extraction numbers come from `scripts/` (computed styles, real column counts, pixel diffs) — never estimated by eye.++## Code Style++- TypeScript strict, no `any`+- Named exports, PascalCase components, camelCase utils+- Tailwind utility classes; arbitrary values (`text-[17px]`) when the extracted value doesn't match Tailwind's scale+- 2-space indentation++## Skills / Commands++Two workflows, each with a single source of truth in `.claude/skills/<name>/SKILL.md`:++| Command | Purpose |+|---|---|+| `/clone-website <url>` | Crawl, extract, spec, build, and pixel-diff QA a full multi-page clone |+| `/restyle` | Swap colors, fonts, logo, and copy for your brand — layout stays intact |++Where your tool finds them (all generated from the same source):++- **Claude Code:** `.claude/skills/<name>/SKILL.md`+- **Codex CLI:** `.codex/skills/<name>/SKILL.md`+- **GitHub Copilot coding agent:** `.github/skills/<name>/SKILL.md`+- **Cursor:** `.cursor/commands/<name>.md`+- **Windsurf:** `.windsurf/workflows/<name>.md`+- **Gemini CLI:** `.gemini/commands/<name>.toml`+- **OpenCode:** `.opencode/commands/<name>.md`+- **Continue:** `.continue/commands/<name>.md`+- **Augment Code:** `.augment/commands/<name>.md`+- **Amazon Q Developer CLI:** `.amazonq/cli-agents/<name>.json`+- **Cline / Roo Code, Aider, anything else:** open `.claude/skills/<name>/SKILL.md` and follow it as a prompt.++The extraction scripts are plain Node CLIs any agent can run; Chromium auto-installs on first use (or `npm run setup`). No subagent support in your tool? Build sections sequentially from the same lint-passing specs.++## Ethics++Clone sites you own or have permission to rebuild (platform migration, lost source, learning). Never for phishing, impersonation, or passing off someone's design as your own.++## Keeping Agent Configs in Sync++- `.claude/skills/*/SKILL.md` and this file (`AGENTS.md`) are the only sources of truth for per-tool configs.+- After editing either, run `node scripts/sync-skills.mjs` to regenerate every per-tool copy.+- Generated files are committed; CI runs `node scripts/sync-skills.mjs --check` and fails if any are stale.diff --git a/.augment/commands/clone-website.md b/.augment/commands/clone-website.mdnew file mode 100644index 0000000..13a9135--- /dev/null+++ b/.augment/commands/clone-website.md@@ -0,0 +1,249 @@+---+description: "Reverse-engineer and clone a full multi-page website as a pixel-accurate Next.js replica"+argument-hint: "<url> [extra instructions]"+---+<!-- GENERATED from .claude/skills/clone-website/SKILL.md by scripts/sync-skills.mjs — edit the source,+ then run: node scripts/sync-skills.mjs -->++# Clone Website++Reverse-engineer and rebuild **$ARGUMENTS** as a pixel-accurate, multi-page Next.js clone.++You are a **foreman walking the job site**: scripts do the measuring, you do the judgment, specs are the contract, builder agents do the construction, and the pixel-diff score decides when you're done. Extraction and construction overlap — dispatch builders as soon as a section's spec passes lint, then keep extracting.++## Resume Check (ALWAYS FIRST)++```bash+node scripts/manifest.mjs status+```++If a manifest exists, this is a **resumed run**: skip everything already done (`node scripts/manifest.mjs next` tells you where to continue). If not, this is a fresh run — start at Phase 0.++## Scope Defaults++- **Fidelity:** pixel-accurate — colors, spacing, typography, animations, interactions+- **In scope:** every confirmed page, visual layout, component structure, interactions, responsive behavior (phone 390 / iPad 768 / PC 1440), real content and assets+- **Out of scope:** real backend, auth, databases, forms that actually submit (mock them)+- **Content goes in `src/data/*.ts`** — components take props; page files wire data to components. This keeps the clone restylable later (see `/restyle`).++User-provided instructions override these defaults.++## Tooling++The scripts do the mechanical work — **use them instead of hand-measuring via browser MCP**:++| Script | Purpose |+|---|---|+| **`node scripts/extract/page.mjs <url> [--no-site-files]`** | **THE WORKHORSE — one call, 3 page loads total.** Auto-detects sections, then produces `tokens.json` + `css.json` (skip on later pages with `--no-site-files`), `assets.json` + downloads to `public/`, `responsive.json` (all 3 viewports), a full computed-style walk per section (`sections/<name>.json`), and full-page **and** per-section screenshots at phone/iPad/PC. Accepts explicit `--selector "css" --name x` pairs to override detection. Everything is measured from the SAME page state, so numbers, walks and screenshots can never disagree |+| `node scripts/extract/crawl.mjs <url> [--max 25]` | Discover pages (sitemap + nav links) → `docs/research/<host>/sitemap.json` |+| `node scripts/extract/section.mjs <url> --selector "css" [--name x] --state scroll:600\|click:sel\|hover:sel [--viewport pc\|ipad\|phone]` | **State captures** (page.mjs covers the default state). Captures a second state and diffs them (element styles *and* `::before`/`::after`), waiting for the section's real transition duration. `--selector`/`--name` repeat — one page load for all |+| `node scripts/extract/probe.mjs <url> --selector "css" [--selector "css2"] [--props a,b,c]` / `probe.mjs --route </r>` | Exact computed values for specific selectors at all 3 viewports, as a markdown table with a **varies** column — paste straight into a spec's Responsive section. **`--route` probes EVERY registered section of a page in one call (3 loads total, plus a `probe-<section>.json` per section) — never probe section-by-section** |+| `node scripts/extract/screenshot.mjs <url> [--selector css --name x ...]` | Extra screenshots at phone/iPad/PC (page.mjs already shot everything once). `--selector`/`--name` repeat — one call, 3 loads, N sections |+| `node scripts/extract/tokens.mjs` / `css.mjs` / `assets.mjs` / `responsive.mjs` | Single-purpose re-runs of one page.mjs output when something needs refreshing |+| `node scripts/diff.mjs --original <url> --clone <url> [--selector css] --viewport all [--threshold 95]` | Scored pixel diff, original vs clone. **`--viewport all` scores pc+ipad+phone in one call**, and the per-viewport **band breakdown names the y-range where the mismatch lives** — read it before guessing at causes. **Batched sweep: `--route </r>` (or repeated `--section name=css`) scores every section of a page from ONE load per side per viewport.** Original-side shots are cached 24h, so fix-iteration re-diffs only re-render the clone (`--fresh-original` to override) |+| `node scripts/lint-spec.mjs <spec.md\|dir>` | Mechanical spec-completeness gate — must pass before ANY builder dispatch |+| `node scripts/manifest.mjs <cmd>` | Pipeline state: init / add-page / add-section / set / status / next |++Browser MCP (Chrome MCP, Playwright MCP — if available) is for **judgment work only**: watching how the page behaves while scrolling, exploring what's clickable, understanding an animation. Numbers always come from the scripts. If no browser MCP is available, the scripts alone are sufficient — use extra `screenshot.mjs` and `section.mjs --state` calls to observe behavior.++The scripts are plain Node CLIs — any coding agent can run them. Playwright's Chromium auto-installs on the first script run (or run `npm run setup` once). If your tool has no subagent/worktree support, skip the dispatch mechanics and build each section yourself, sequentially, from the same lint-passing specs — every quality gate still applies.++## Guiding Principles++1. **Completeness beats speed.** A builder that has to guess a color, font size, or padding value means extraction failed. Extract one more property rather than ship an incomplete spec.+2. **Small tasks, perfect results.** One focused component per builder. Spec body over 150 lines = split the section (lint-spec enforces this).+3. **Real content, real assets.** Actual text via the section walker, actual files via `assets.mjs`. Watch for **layered images** — a hero that looks like one image is often background + overlay + foreground; `assets.json` records sibling counts and z-index for exactly this reason.+4. **Foundation first.** Tokens, fonts, types, icons, and shared chrome (header/footer) before any page section.+5. **Extract how it looks AND how it behaves.** Every interactive element needs before/after states with exact values — `section.mjs --state` produces the diff mechanically.+6. **Identify the interaction model before building.** Scroll-driven vs click-driven confusion is the most expensive mistake in cloning — a wrong call means a rewrite, not a CSS fix. Scroll first without clicking and watch; only then click. Record the model in the spec frontmatter.+7. **Responsive is measured, never guessed — at all three widths.** Fill every spec's Responsive section from `responsive.json` + `probe.mjs`, with real numbers for phone AND iPad AND pc. Never write "iPad: same as desktop": most production sites step their root font-size at breakpoints, so *every* padding, margin, and font size changes even when the layout looks identical. A spec that only nails desktop produces a clone that scores ~98% at 1440px and ~91% at 390px. `lint-spec.mjs` rejects vague responsive sections.++8. **The extraction JSON is ground truth; the spec is a summary of it.** If a builder finds the spec disagreeing with `sections/<name>.json` or `responsive.json`, the JSON wins — say so explicitly in every builder prompt and have the builder report the discrepancy so you can correct the spec.+9. **Spec files are the contract.** No spec → no builder. lint-spec must pass → then dispatch.+10. **The build must always compile.** Builders verify `npx tsc --noEmit`; you verify `npm run typecheck && npm run lint` after every merge. Full `npm run build` runs only at checkpoints (Phase 0, end of Phase 2, once mid-way through Phase 3, Phase 4, completion) — it takes 30–60s and running it per merge serializes otherwise-parallel builders.+11. **The manifest is updated at every stage transition.** That's what makes the run resumable.++## Phase 0 — Crawl & Scope++1. Verify the base builds: `npm run build`.+2. `node scripts/extract/crawl.mjs <url> --max 25`+3. Show the user the discovered pages (route + source). **Ask which to clone** — recommend: start page + nav pages, skip legal/utility pages unless asked. Default cap ~10.+4. Initialize state:+ ```bash+ node scripts/manifest.mjs init <url>+ node scripts/manifest.mjs add-page --url <url> --route / # per confirmed page+ ```++## Phase 1 — Recon (one page.mjs call per page)++1. **First page:** `node scripts/extract/page.mjs <start-url>` — produces tokens, css, assets+downloads, responsive signatures, per-section walks, and every screenshot in one shot (3 page loads).+2. **Every other confirmed page:** `node scripts/extract/page.mjs <url> --no-site-files` (tokens/css are site-wide; everything else is per-page). Downloads dedupe across pages automatically — files already in `public/` are skipped.+3. **Review the detected sections** in each run's stdout summary (name, selector, pc height, headline responsive change). Detection is a heuristic: if a "section" is really two, or two are really one, re-run with explicit `--selector "css" --name x` pairs. Section names become spec/component names — rename `section-3` style fallbacks to something meaningful via `--name`.+4. **Interaction sweep** (judgment work — browser MCP if available): scroll each page slowly top to bottom. Does the header change? Do elements animate in? Auto-switching tabs? Scroll-snap? Smooth-scroll lib (`tokens.json` flags `.lenis`/Locomotive)? Then click every tab/pill/accordion and note what changes. Then hover. `css.json`'s `interactiveStates` lists every :hover/:focus rule the stylesheet defines — use it as the checklist of what to probe. Record findings in `docs/research/<host>/BEHAVIORS.md`.+5. **Shared chrome detection:** compare screenshots across pages — header/nav/footer that repeat become SHARED components (`SiteHeader`, `SiteFooter`), extracted once from the page where they're most complete.++**Per page — topology:** map every distinct section top to bottom with a working name, its selector, its interaction model (static / click-driven / scroll-driven / hover-driven / time-driven / mixed), and layer notes (sticky? overlay? z-index?). Save `docs/research/<host>/PAGE_TOPOLOGY.md`, then register each section:+```bash+node scripts/manifest.mjs add-section --route / --name hero --selector "section.hero"+```++## Phase 2 — Foundation (sequential, you do it yourself)++1. **Fonts** in `src/app/layout.tsx` via `next/font/google` or `next/font/local` (downloaded fonts are in `public/fonts/`) — families/weights from `tokens.json`+2. **`globals.css`**: map the target's palette onto the shadcn `:root` token names; add custom properties for colors that don't map; add global keyframes, scroll-snap, smooth-scroll setup found in recon+3. **TypeScript interfaces** in `src/types/` for the content structures you observed+4. **Icons**: convert the deduplicated `inlineSvgs` from `assets.json` into named components in `src/components/icons.tsx` (named by function: `LogoIcon`, `ArrowRightIcon`…)+5. **SEO**: favicons/OG from `public/seo/` wired into `layout.tsx` metadata+6. Verify `npm run build`, then build **shared chrome** (header/footer) first — full spec → lint → builder cycle like any section, since every page depends on them.++## Phase 3 — Per-Section Loop (extract → spec → lint → dispatch → merge)++Work through `manifest.mjs next` until no sections remain. For each section:++### 3a. Extract++**The default state is already extracted** — Phase 1's page.mjs run wrote+`sections/<name>.json`, `responsive.json`, and all screenshots.++**First time you enter Phase 3 for a page, probe ALL its sections in ONE call** (3+page loads total instead of 3 per section — never probe section-by-section):++```bash+node scripts/extract/probe.mjs --route <r> # every registered section + probe-<section>.json each+# add key children in the same call when a spec will need them:+node scripts/extract/probe.mjs --route <r> --selector "<sel> h2" --selector "<sel> .card"+```++Slice the per-section tables into each spec's Responsive section as you write it.+Per section, only one thing remains:++```bash+# Per discovered behavior — one call per state (batch selectors sharing a trigger):+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-hover --state hover:".card"+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-scrolled --state scroll:600+# per tab/pill state: --state click:".tab-2" etc. EVERY state, not just the default.+```+State captures wait for the section's actual transition duration, so a slow fade is+recorded at its end value, not mid-flight — check `settleMs` in the output if a diff+looks wrong. The `diff` array covers `::before`/`::after` too, which is where hover+overlays usually live. Cross-check discovered behaviors against `css.json`'s+`interactiveStates` — a :hover rule in the stylesheet with no captured state means+the extraction is not done.++Mark: `manifest.mjs set --route <r> --section <name> --stage extracted`++### 3b. Write the spec — `docs/research/components/<route-slug>/<name>.spec.md`++```markdown+---+component: HeroSection+target: src/components/HeroSection.tsx+page: /+screenshot: docs/design-references/<host>/<name>-pc.png+interaction_model: static | click-driven | scroll-driven | hover-driven | time-driven | mixed+states: default, hover, scrolled…+assets: public/images/x.webp, icons:ArrowRightIcon+responsive: phone, ipad, pc+---++# <Component> Specification++## DOM Structure+<hierarchy from the section walker — what contains what>++## Computed Styles+<exact values from sections/<name>.json, per element. Never estimated.>++## States & Behaviors+<per behavior: Trigger / State A / State B / Transition — from the --state diffs.+ Include the implementation approach (CSS transition, IntersectionObserver, etc.)>++## Per-State Content+<for tabbed/stateful sections: full content per state. "N/A — static" otherwise>++## Assets+<local public/ paths + icon components used. Note layered compositions explicitly.>++## Text Content+<verbatim from the walker output — never paraphrased>++## Responsive Behavior+<from responsive.json: real column counts and changes at 390 / 768 / 1440 + breakpoint>+```++### 3c. Lint gate+```bash+node scripts/lint-spec.mjs docs/research/components/<route-slug>/<name>.spec.md+```+Fails → extract more. Passes → `manifest.mjs set … --stage specd` and dispatch.++### 3d. Dispatch builder agent (worktree)++Every builder receives IN ITS PROMPT (never "go read the file"):+- The **full spec file contents inline**+- The screenshot paths (all 3 viewports)+- Shared imports available: `cn()`, `icons.tsx` components, shadcn `ui/` primitives, types from `src/types/`+- The target file path, and the data file to create in `src/data/` if the section has content collections+- The rule: verify `npx tsc --noEmit` passes before finishing+- **The ground-truth rule:** "`docs/research/<host>/sections/<name>.json` and `responsive.json` are ground truth. If this spec contradicts them, follow the JSON and report the discrepancy." Builders reliably catch spec errors this way — treat their reports as corrections to make to the spec file.++Complex section (3+ distinct sub-components) → one builder per sub-component + one for the wrapper, sub-components first. **Don't wait** — while builders run, extract the next section.++### 3e. Merge+As builders finish: merge worktree → `npm run typecheck && npm run lint` → fix errors immediately → `manifest.mjs set … --stage merged`. tsc catches the cross-worktree breaks (imports, prop types) that per-merge builds used to catch, in a fraction of the time.++**Once, after roughly half the page's sections are merged: run a full `npm run build` checkpoint.** It catches build-only failures (server/client component violations, route exports, metadata) while they're still cheap to bisect. Don't build after every merge.++## Phase 4 — Page Assembly++Per page: create `src/app/<route>/page.tsx` importing its section components with data from `src/data/`, plus page-level behaviors (scroll-snap, observers, smooth scroll). Shared chrome mounts in `layout.tsx` or a route group layout. Wire internal nav links to the cloned routes. `npm run build` must pass.++## Phase 5 — Scored QA Loop++Start the clone: `npm run dev` (background). Then **score the whole page's sections in ONE batched call** (one load per side per viewport instead of one per section):++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --route <r> --viewport all+node scripts/manifest.mjs set --route <r> --section <name> --score pc=<match> # per section × viewport+```++**Fix iterations stay single-section** — the original-side shots captured by the sweep are cached, so a re-diff only re-renders the clone:++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --selector "<sel>" --viewport all --name <name>+```++- **Pass = ≥95% on all three viewports** → `--stage qa_passed`+- Below 95% → **read the band breakdown first**: it names the y-range where the mismatch lives, so you inspect that band of the diff image in `docs/research/qa/` instead of eyeballing the whole section. Then check the spec (wrong extraction → re-extract and fix; right spec, wrong build → fix component), re-diff+- A large height mismatch reported by diff.mjs = missing content or wrong spacing — fix before pixel-tweaking+- Max 3 fix iterations per section, then record the gap honestly and move on+- **Text-heavy sections at phone width often plateau at 90–95%** when the target's font isn't available on Google Fonts (e.g. Source Sans Pro → Source Sans 3). Different metrics = different wrap points = unavoidable pixel drift. Confirm the layout matches, note the substitution, and accept it.+- **A score that's high at pc but low at ipad/phone is always a responsive-spec problem**, not a styling bug. Re-run `probe.mjs` on the section and fill in the values the spec was missing.+- Finally, test behaviors manually: scroll, click every tab, hover — screenshots can't verify motion; you must++Whole-page diffs (`--selector` omitted) at all 3 viewports close out each page.++## What NOT to Do++- **Don't build click-tabs when the original is scroll-driven** (or vice versa). Scroll first, watch, then click. Wrong model = rewrite.+- **Don't extract only the default state.** Every tab clicked, every hover captured, header at scroll 0 AND past the trigger.+- **Don't miss layered/overlay images** — check `siblingImgs` and z-index hints in `assets.json`.+- **Don't build HTML mockups of things that are actually `<video>`, Lottie, or canvas.** Check first.+- **Don't approximate ("looks like text-lg").** Use the walker's exact computed values; use arbitrary values (`text-[17px]`) when Tailwind's scale doesn't match.+- **Don't dispatch a builder without a lint-passing spec.** No exceptions — that's the whole quality model.+- **Don't reference docs from builder prompts** — spec contents go inline.+- **Don't skip the manifest updates.** An untracked run can't resume.+- **Don't hardcode content in components.** Content → `src/data/`, components take props.+- **Don't write "same as desktop" in a Responsive section.** Root font-size steps at breakpoints on most real sites, so every number changes. Run `probe.mjs` and write the real values for all three widths — lint-spec now rejects vague responsive sections.+- **Don't forget `::before` / `::after`.** They carry hero overlays, heading underline bars, and icon glyphs. `section.mjs` captures them under a `pseudo` key — if a spec has none and the screenshot shows decorations, extraction was incomplete.+- **Don't trust the spec over the extraction JSON.** Specs are hand-written summaries and drift; `sections/*.json` is machine-measured.+- **Don't declare done without QA scores.** "Looks right" is not a number.++## Completion Report++- Pages cloned (routes) · sections built · spec files written (must match section count)+- Assets downloaded (from `assets.json` download log, including failures)+- Final QA score table per section × viewport (from `manifest.mjs status`)+- `npm run build` result+- Known gaps and any section that couldn't reach 95%+- Suggest next step: `/restyle` to rebrand the clone with your own identitydiff --git a/.augment/commands/restyle.md b/.augment/commands/restyle.mdnew file mode 100644index 0000000..9b4a69c--- /dev/null+++ b/.augment/commands/restyle.md@@ -0,0 +1,49 @@+---+description: "Rebrand a cloned website with your own colors, fonts, logo, and copy while keeping the layout pixel-intact"+argument-hint: "[extra instructions, e.g. 'keep their copy, only swap colors']"+---+<!-- GENERATED from .claude/skills/restyle/SKILL.md by scripts/sync-skills.mjs — edit the source,+ then run: node scripts/sync-skills.mjs -->++# Restyle++Turn the cloned site into **the user's site**: their brand, their words, their logo — on top of the cloned structure. Layout, spacing, animations, and interactions stay untouched. That separation works because the clone pipeline keeps all content in `src/data/*.ts` and all brand tokens in `globals.css` — you swap those layers only.++$ARGUMENTS++## Step 1 — Read the brand++Read `BRAND.md` at the repo root. If it's missing or has unfilled `TODO` fields, ask the user for what's missing (max 3 questions at a time). Never ask for secrets in chat — anything sensitive belongs in env files, not BRAND.md.++If the user has brand assets (logo files, product screenshots), ask them to drop the files into `public/brand/` and tell you the filenames.++## Step 2 — Take "before" screenshots++```bash+npm run dev # background+node scripts/extract/screenshot.mjs http://localhost:3000 --name before-restyle+```+These are your regression reference: after restyling, layout must still match them structurally.++## Step 3 — Swap the brand layers (in this order)++1. **Colors** — `src/app/globals.css`: replace the cloned palette in `:root` / `.dark` with the brand colors from BRAND.md. Keep the same token *names* so no component changes. Preserve relative contrast: if the original had a dark section, keep it dark in the new palette.+2. **Fonts** — `src/app/layout.tsx`: swap `next/font` families to the brand fonts. Keep the size/weight structure the clone extracted — only families change.+3. **Logo & icons** — replace `LogoIcon` in `src/components/icons.tsx` (or the logo `<img>` asset) with the brand logo from `public/brand/`. Keep the rendered dimensions of the original logo so the header layout doesn't shift.+4. **Favicons & SEO** — regenerate `public/seo/` (favicon, apple-touch-icon, OG image if provided), update `layout.tsx` metadata: title, description, OG tags — from BRAND.md positioning.+5. **Copy** — rewrite every string in `src/data/*.ts` for the brand: same structure, same approximate length (±20% — long copy breaks cloned layouts), brand voice from BRAND.md. Headlines sell the user's offer, not the original company's. Placeholder patterns like testimonials get realistic brand-appropriate content clearly marked as placeholders unless BRAND.md provides real ones.+6. **Images** — where the clone shows the original company's product shots, swap in files from `public/brand/` if provided; otherwise leave the cloned image and list it in the report as "needs replacement".++## Step 4 — Verify++1. `npm run build` — must pass+2. `node scripts/extract/screenshot.mjs http://localhost:3000 --name after-restyle`+3. Compare before/after at all 3 viewports: layout identical, only brand layers changed. Overflowing text = shorten the copy, never change the layout.+4. Check every page route, not just `/`.++## Report++- What was swapped (colors, fonts, logo, favicon, N copy blocks across M data files)+- Images still showing the original site's content (need user-provided replacements)+- Any copy that had to be shortened/lengthened to fit+- Anything in BRAND.md still marked TODOdiff --git a/.claude/skills/clone-website/SKILL.md b/.claude/skills/clone-website/SKILL.mdindex 6c562c5..fbdaa84 100644--- a/.claude/skills/clone-website/SKILL.md+++ b/.claude/skills/clone-website/SKILL.md@@ -46,6 +46,8 @@ The scripts do the mechanical work — **use them instead of hand-measuring viaBrowser MCP (Chrome MCP, Playwright MCP — if available) is for **judgment work only**: watching how the page behaves while scrolling, exploring what's clickable, understanding an animation. Numbers always come from the scripts. If no browser MCP is available, the scripts alone are sufficient — use extra `screenshot.mjs` and `section.mjs --state` calls to observe behavior.+The scripts are plain Node CLIs — any coding agent can run them. Playwright's Chromium auto-installs on the first script run (or run `npm run setup` once). If your tool has no subagent/worktree support, skip the dispatch mechanics and build each section yourself, sequentially, from the same lint-passing specs — every quality gate still applies.+## Guiding Principles1. **Completeness beats speed.** A builder that has to guess a color, font size, or padding value means extraction failed. Extract one more property rather than ship an incomplete spec.diff --git a/.clinerules b/.clinerulesnew file mode 100644index 0000000..91a49ee--- /dev/null+++ b/.clinerules@@ -0,0 +1,69 @@+<!-- GENERATED from AGENTS.md by scripts/sync-skills.mjs — edit the source,+ then run: node scripts/sync-skills.mjs -->++# site-cloner++Template for cloning any multi-page website into this Next.js codebase, then rebranding it as your own. Two commands drive everything: `/clone-website <url>` and `/restyle`.++## Tech Stack++- **Next.js 16** — App Router, React 19, TypeScript strict+- **Tailwind CSS v4** + shadcn/ui (base-ui primitives), oklch tokens in `src/app/globals.css`+- **Lucide React** icons (replaced by extracted SVGs in `src/components/icons.tsx` during cloning)+- **Playwright** (devDependency) powers all extraction/QA scripts++## Commands++- `npm run dev` / `npm run build` / `npm run lint` / `npm run typecheck`+- `npm run check` — lint + typecheck + build (must pass before any commit)++## Architecture Rules++- **Content lives in `src/data/*.ts`, never hardcoded in components.** Components take props. This is what makes `/restyle` possible — copy swaps without touching layout.+- Pages: `src/app/<route>/page.tsx` wires data → components. Shared header/footer mount in layouts.+- `docs/research/` holds extraction artifacts (JSON, specs, manifest) — auditable, never hand-edited except spec files.+- `docs/research/manifest.json` is the pipeline state. Update it at every stage transition; check it first on any clone-related task (`node scripts/manifest.mjs status`).+- Specs (`docs/research/components/**/*.spec.md`) must pass `node scripts/lint-spec.mjs` before any builder agent is dispatched.+- All extraction numbers come from `scripts/` (computed styles, real column counts, pixel diffs) — never estimated by eye.++## Code Style++- TypeScript strict, no `any`+- Named exports, PascalCase components, camelCase utils+- Tailwind utility classes; arbitrary values (`text-[17px]`) when the extracted value doesn't match Tailwind's scale+- 2-space indentation++## Skills / Commands++Two workflows, each with a single source of truth in `.claude/skills/<name>/SKILL.md`:++| Command | Purpose |+|---|---|+| `/clone-website <url>` | Crawl, extract, spec, build, and pixel-diff QA a full multi-page clone |+| `/restyle` | Swap colors, fonts, logo, and copy for your brand — layout stays intact |++Where your tool finds them (all generated from the same source):++- **Claude Code:** `.claude/skills/<name>/SKILL.md`+- **Codex CLI:** `.codex/skills/<name>/SKILL.md`+- **GitHub Copilot coding agent:** `.github/skills/<name>/SKILL.md`+- **Cursor:** `.cursor/commands/<name>.md`+- **Windsurf:** `.windsurf/workflows/<name>.md`+- **Gemini CLI:** `.gemini/commands/<name>.toml`+- **OpenCode:** `.opencode/commands/<name>.md`+- **Continue:** `.continue/commands/<name>.md`+- **Augment Code:** `.augment/commands/<name>.md`+- **Amazon Q Developer CLI:** `.amazonq/cli-agents/<name>.json`+- **Cline / Roo Code, Aider, anything else:** open `.claude/skills/<name>/SKILL.md` and follow it as a prompt.++The extraction scripts are plain Node CLIs any agent can run; Chromium auto-installs on first use (or `npm run setup`). No subagent support in your tool? Build sections sequentially from the same lint-passing specs.++## Ethics++Clone sites you own or have permission to rebuild (platform migration, lost source, learning). Never for phishing, impersonation, or passing off someone's design as your own.++## Keeping Agent Configs in Sync++- `.claude/skills/*/SKILL.md` and this file (`AGENTS.md`) are the only sources of truth for per-tool configs.+- After editing either, run `node scripts/sync-skills.mjs` to regenerate every per-tool copy.+- Generated files are committed; CI runs `node scripts/sync-skills.mjs --check` and fails if any are stale.diff --git a/.codex/skills/clone-website/SKILL.md b/.codex/skills/clone-website/SKILL.mdnew file mode 100644index 0000000..fbdaa84--- /dev/null+++ b/.codex/skills/clone-website/SKILL.md@@ -0,0 +1,249 @@+---+name: clone-website+description: Reverse-engineer and clone a full multi-page website into this Next.js codebase — crawls pages, runs scripted extraction (tokens, assets, computed styles, responsive layout at phone/iPad/PC), writes auditable component specs, dispatches parallel builder agents in worktrees, and loops a scored pixel-diff QA until every section passes. Use whenever the user wants to clone, replicate, rebuild, reverse-engineer, or copy any website. Resumable — safe to re-run after an interruption.+argument-hint: "<url> [extra instructions]"+user-invocable: true+---++# Clone Website++Reverse-engineer and rebuild **$ARGUMENTS** as a pixel-accurate, multi-page Next.js clone.++You are a **foreman walking the job site**: scripts do the measuring, you do the judgment, specs are the contract, builder agents do the construction, and the pixel-diff score decides when you're done. Extraction and construction overlap — dispatch builders as soon as a section's spec passes lint, then keep extracting.++## Resume Check (ALWAYS FIRST)++```bash+node scripts/manifest.mjs status+```++If a manifest exists, this is a **resumed run**: skip everything already done (`node scripts/manifest.mjs next` tells you where to continue). If not, this is a fresh run — start at Phase 0.++## Scope Defaults++- **Fidelity:** pixel-accurate — colors, spacing, typography, animations, interactions+- **In scope:** every confirmed page, visual layout, component structure, interactions, responsive behavior (phone 390 / iPad 768 / PC 1440), real content and assets+- **Out of scope:** real backend, auth, databases, forms that actually submit (mock them)+- **Content goes in `src/data/*.ts`** — components take props; page files wire data to components. This keeps the clone restylable later (see `/restyle`).++User-provided instructions override these defaults.++## Tooling++The scripts do the mechanical work — **use them instead of hand-measuring via browser MCP**:++| Script | Purpose |+|---|---|+| **`node scripts/extract/page.mjs <url> [--no-site-files]`** | **THE WORKHORSE — one call, 3 page loads total.** Auto-detects sections, then produces `tokens.json` + `css.json` (skip on later pages with `--no-site-files`), `assets.json` + downloads to `public/`, `responsive.json` (all 3 viewports), a full computed-style walk per section (`sections/<name>.json`), and full-page **and** per-section screenshots at phone/iPad/PC. Accepts explicit `--selector "css" --name x` pairs to override detection. Everything is measured from the SAME page state, so numbers, walks and screenshots can never disagree |+| `node scripts/extract/crawl.mjs <url> [--max 25]` | Discover pages (sitemap + nav links) → `docs/research/<host>/sitemap.json` |+| `node scripts/extract/section.mjs <url> --selector "css" [--name x] --state scroll:600\|click:sel\|hover:sel [--viewport pc\|ipad\|phone]` | **State captures** (page.mjs covers the default state). Captures a second state and diffs them (element styles *and* `::before`/`::after`), waiting for the section's real transition duration. `--selector`/`--name` repeat — one page load for all |+| `node scripts/extract/probe.mjs <url> --selector "css" [--selector "css2"] [--props a,b,c]` / `probe.mjs --route </r>` | Exact computed values for specific selectors at all 3 viewports, as a markdown table with a **varies** column — paste straight into a spec's Responsive section. **`--route` probes EVERY registered section of a page in one call (3 loads total, plus a `probe-<section>.json` per section) — never probe section-by-section** |+| `node scripts/extract/screenshot.mjs <url> [--selector css --name x ...]` | Extra screenshots at phone/iPad/PC (page.mjs already shot everything once). `--selector`/`--name` repeat — one call, 3 loads, N sections |+| `node scripts/extract/tokens.mjs` / `css.mjs` / `assets.mjs` / `responsive.mjs` | Single-purpose re-runs of one page.mjs output when something needs refreshing |+| `node scripts/diff.mjs --original <url> --clone <url> [--selector css] --viewport all [--threshold 95]` | Scored pixel diff, original vs clone. **`--viewport all` scores pc+ipad+phone in one call**, and the per-viewport **band breakdown names the y-range where the mismatch lives** — read it before guessing at causes. **Batched sweep: `--route </r>` (or repeated `--section name=css`) scores every section of a page from ONE load per side per viewport.** Original-side shots are cached 24h, so fix-iteration re-diffs only re-render the clone (`--fresh-original` to override) |+| `node scripts/lint-spec.mjs <spec.md\|dir>` | Mechanical spec-completeness gate — must pass before ANY builder dispatch |+| `node scripts/manifest.mjs <cmd>` | Pipeline state: init / add-page / add-section / set / status / next |++Browser MCP (Chrome MCP, Playwright MCP — if available) is for **judgment work only**: watching how the page behaves while scrolling, exploring what's clickable, understanding an animation. Numbers always come from the scripts. If no browser MCP is available, the scripts alone are sufficient — use extra `screenshot.mjs` and `section.mjs --state` calls to observe behavior.++The scripts are plain Node CLIs — any coding agent can run them. Playwright's Chromium auto-installs on the first script run (or run `npm run setup` once). If your tool has no subagent/worktree support, skip the dispatch mechanics and build each section yourself, sequentially, from the same lint-passing specs — every quality gate still applies.++## Guiding Principles++1. **Completeness beats speed.** A builder that has to guess a color, font size, or padding value means extraction failed. Extract one more property rather than ship an incomplete spec.+2. **Small tasks, perfect results.** One focused component per builder. Spec body over 150 lines = split the section (lint-spec enforces this).+3. **Real content, real assets.** Actual text via the section walker, actual files via `assets.mjs`. Watch for **layered images** — a hero that looks like one image is often background + overlay + foreground; `assets.json` records sibling counts and z-index for exactly this reason.+4. **Foundation first.** Tokens, fonts, types, icons, and shared chrome (header/footer) before any page section.+5. **Extract how it looks AND how it behaves.** Every interactive element needs before/after states with exact values — `section.mjs --state` produces the diff mechanically.+6. **Identify the interaction model before building.** Scroll-driven vs click-driven confusion is the most expensive mistake in cloning — a wrong call means a rewrite, not a CSS fix. Scroll first without clicking and watch; only then click. Record the model in the spec frontmatter.+7. **Responsive is measured, never guessed — at all three widths.** Fill every spec's Responsive section from `responsive.json` + `probe.mjs`, with real numbers for phone AND iPad AND pc. Never write "iPad: same as desktop": most production sites step their root font-size at breakpoints, so *every* padding, margin, and font size changes even when the layout looks identical. A spec that only nails desktop produces a clone that scores ~98% at 1440px and ~91% at 390px. `lint-spec.mjs` rejects vague responsive sections.++8. **The extraction JSON is ground truth; the spec is a summary of it.** If a builder finds the spec disagreeing with `sections/<name>.json` or `responsive.json`, the JSON wins — say so explicitly in every builder prompt and have the builder report the discrepancy so you can correct the spec.+9. **Spec files are the contract.** No spec → no builder. lint-spec must pass → then dispatch.+10. **The build must always compile.** Builders verify `npx tsc --noEmit`; you verify `npm run typecheck && npm run lint` after every merge. Full `npm run build` runs only at checkpoints (Phase 0, end of Phase 2, once mid-way through Phase 3, Phase 4, completion) — it takes 30–60s and running it per merge serializes otherwise-parallel builders.+11. **The manifest is updated at every stage transition.** That's what makes the run resumable.++## Phase 0 — Crawl & Scope++1. Verify the base builds: `npm run build`.+2. `node scripts/extract/crawl.mjs <url> --max 25`+3. Show the user the discovered pages (route + source). **Ask which to clone** — recommend: start page + nav pages, skip legal/utility pages unless asked. Default cap ~10.+4. Initialize state:+ ```bash+ node scripts/manifest.mjs init <url>+ node scripts/manifest.mjs add-page --url <url> --route / # per confirmed page+ ```++## Phase 1 — Recon (one page.mjs call per page)++1. **First page:** `node scripts/extract/page.mjs <start-url>` — produces tokens, css, assets+downloads, responsive signatures, per-section walks, and every screenshot in one shot (3 page loads).+2. **Every other confirmed page:** `node scripts/extract/page.mjs <url> --no-site-files` (tokens/css are site-wide; everything else is per-page). Downloads dedupe across pages automatically — files already in `public/` are skipped.+3. **Review the detected sections** in each run's stdout summary (name, selector, pc height, headline responsive change). Detection is a heuristic: if a "section" is really two, or two are really one, re-run with explicit `--selector "css" --name x` pairs. Section names become spec/component names — rename `section-3` style fallbacks to something meaningful via `--name`.+4. **Interaction sweep** (judgment work — browser MCP if available): scroll each page slowly top to bottom. Does the header change? Do elements animate in? Auto-switching tabs? Scroll-snap? Smooth-scroll lib (`tokens.json` flags `.lenis`/Locomotive)? Then click every tab/pill/accordion and note what changes. Then hover. `css.json`'s `interactiveStates` lists every :hover/:focus rule the stylesheet defines — use it as the checklist of what to probe. Record findings in `docs/research/<host>/BEHAVIORS.md`.+5. **Shared chrome detection:** compare screenshots across pages — header/nav/footer that repeat become SHARED components (`SiteHeader`, `SiteFooter`), extracted once from the page where they're most complete.++**Per page — topology:** map every distinct section top to bottom with a working name, its selector, its interaction model (static / click-driven / scroll-driven / hover-driven / time-driven / mixed), and layer notes (sticky? overlay? z-index?). Save `docs/research/<host>/PAGE_TOPOLOGY.md`, then register each section:+```bash+node scripts/manifest.mjs add-section --route / --name hero --selector "section.hero"+```++## Phase 2 — Foundation (sequential, you do it yourself)++1. **Fonts** in `src/app/layout.tsx` via `next/font/google` or `next/font/local` (downloaded fonts are in `public/fonts/`) — families/weights from `tokens.json`+2. **`globals.css`**: map the target's palette onto the shadcn `:root` token names; add custom properties for colors that don't map; add global keyframes, scroll-snap, smooth-scroll setup found in recon+3. **TypeScript interfaces** in `src/types/` for the content structures you observed+4. **Icons**: convert the deduplicated `inlineSvgs` from `assets.json` into named components in `src/components/icons.tsx` (named by function: `LogoIcon`, `ArrowRightIcon`…)+5. **SEO**: favicons/OG from `public/seo/` wired into `layout.tsx` metadata+6. Verify `npm run build`, then build **shared chrome** (header/footer) first — full spec → lint → builder cycle like any section, since every page depends on them.++## Phase 3 — Per-Section Loop (extract → spec → lint → dispatch → merge)++Work through `manifest.mjs next` until no sections remain. For each section:++### 3a. Extract++**The default state is already extracted** — Phase 1's page.mjs run wrote+`sections/<name>.json`, `responsive.json`, and all screenshots.++**First time you enter Phase 3 for a page, probe ALL its sections in ONE call** (3+page loads total instead of 3 per section — never probe section-by-section):++```bash+node scripts/extract/probe.mjs --route <r> # every registered section + probe-<section>.json each+# add key children in the same call when a spec will need them:+node scripts/extract/probe.mjs --route <r> --selector "<sel> h2" --selector "<sel> .card"+```++Slice the per-section tables into each spec's Responsive section as you write it.+Per section, only one thing remains:++```bash+# Per discovered behavior — one call per state (batch selectors sharing a trigger):+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-hover --state hover:".card"+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-scrolled --state scroll:600+# per tab/pill state: --state click:".tab-2" etc. EVERY state, not just the default.+```+State captures wait for the section's actual transition duration, so a slow fade is+recorded at its end value, not mid-flight — check `settleMs` in the output if a diff+looks wrong. The `diff` array covers `::before`/`::after` too, which is where hover+overlays usually live. Cross-check discovered behaviors against `css.json`'s+`interactiveStates` — a :hover rule in the stylesheet with no captured state means+the extraction is not done.++Mark: `manifest.mjs set --route <r> --section <name> --stage extracted`++### 3b. Write the spec — `docs/research/components/<route-slug>/<name>.spec.md`++```markdown+---+component: HeroSection+target: src/components/HeroSection.tsx+page: /+screenshot: docs/design-references/<host>/<name>-pc.png+interaction_model: static | click-driven | scroll-driven | hover-driven | time-driven | mixed+states: default, hover, scrolled…+assets: public/images/x.webp, icons:ArrowRightIcon+responsive: phone, ipad, pc+---++# <Component> Specification++## DOM Structure+<hierarchy from the section walker — what contains what>++## Computed Styles+<exact values from sections/<name>.json, per element. Never estimated.>++## States & Behaviors+<per behavior: Trigger / State A / State B / Transition — from the --state diffs.+ Include the implementation approach (CSS transition, IntersectionObserver, etc.)>++## Per-State Content+<for tabbed/stateful sections: full content per state. "N/A — static" otherwise>++## Assets+<local public/ paths + icon components used. Note layered compositions explicitly.>++## Text Content+<verbatim from the walker output — never paraphrased>++## Responsive Behavior+<from responsive.json: real column counts and changes at 390 / 768 / 1440 + breakpoint>+```++### 3c. Lint gate+```bash+node scripts/lint-spec.mjs docs/research/components/<route-slug>/<name>.spec.md+```+Fails → extract more. Passes → `manifest.mjs set … --stage specd` and dispatch.++### 3d. Dispatch builder agent (worktree)++Every builder receives IN ITS PROMPT (never "go read the file"):+- The **full spec file contents inline**+- The screenshot paths (all 3 viewports)+- Shared imports available: `cn()`, `icons.tsx` components, shadcn `ui/` primitives, types from `src/types/`+- The target file path, and the data file to create in `src/data/` if the section has content collections+- The rule: verify `npx tsc --noEmit` passes before finishing+- **The ground-truth rule:** "`docs/research/<host>/sections/<name>.json` and `responsive.json` are ground truth. If this spec contradicts them, follow the JSON and report the discrepancy." Builders reliably catch spec errors this way — treat their reports as corrections to make to the spec file.++Complex section (3+ distinct sub-components) → one builder per sub-component + one for the wrapper, sub-components first. **Don't wait** — while builders run, extract the next section.++### 3e. Merge+As builders finish: merge worktree → `npm run typecheck && npm run lint` → fix errors immediately → `manifest.mjs set … --stage merged`. tsc catches the cross-worktree breaks (imports, prop types) that per-merge builds used to catch, in a fraction of the time.++**Once, after roughly half the page's sections are merged: run a full `npm run build` checkpoint.** It catches build-only failures (server/client component violations, route exports, metadata) while they're still cheap to bisect. Don't build after every merge.++## Phase 4 — Page Assembly++Per page: create `src/app/<route>/page.tsx` importing its section components with data from `src/data/`, plus page-level behaviors (scroll-snap, observers, smooth scroll). Shared chrome mounts in `layout.tsx` or a route group layout. Wire internal nav links to the cloned routes. `npm run build` must pass.++## Phase 5 — Scored QA Loop++Start the clone: `npm run dev` (background). Then **score the whole page's sections in ONE batched call** (one load per side per viewport instead of one per section):++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --route <r> --viewport all+node scripts/manifest.mjs set --route <r> --section <name> --score pc=<match> # per section × viewport+```++**Fix iterations stay single-section** — the original-side shots captured by the sweep are cached, so a re-diff only re-renders the clone:++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --selector "<sel>" --viewport all --name <name>+```++- **Pass = ≥95% on all three viewports** → `--stage qa_passed`+- Below 95% → **read the band breakdown first**: it names the y-range where the mismatch lives, so you inspect that band of the diff image in `docs/research/qa/` instead of eyeballing the whole section. Then check the spec (wrong extraction → re-extract and fix; right spec, wrong build → fix component), re-diff+- A large height mismatch reported by diff.mjs = missing content or wrong spacing — fix before pixel-tweaking+- Max 3 fix iterations per section, then record the gap honestly and move on+- **Text-heavy sections at phone width often plateau at 90–95%** when the target's font isn't available on Google Fonts (e.g. Source Sans Pro → Source Sans 3). Different metrics = different wrap points = unavoidable pixel drift. Confirm the layout matches, note the substitution, and accept it.+- **A score that's high at pc but low at ipad/phone is always a responsive-spec problem**, not a styling bug. Re-run `probe.mjs` on the section and fill in the values the spec was missing.+- Finally, test behaviors manually: scroll, click every tab, hover — screenshots can't verify motion; you must++Whole-page diffs (`--selector` omitted) at all 3 viewports close out each page.++## What NOT to Do++- **Don't build click-tabs when the original is scroll-driven** (or vice versa). Scroll first, watch, then click. Wrong model = rewrite.+- **Don't extract only the default state.** Every tab clicked, every hover captured, header at scroll 0 AND past the trigger.+- **Don't miss layered/overlay images** — check `siblingImgs` and z-index hints in `assets.json`.+- **Don't build HTML mockups of things that are actually `<video>`, Lottie, or canvas.** Check first.+- **Don't approximate ("looks like text-lg").** Use the walker's exact computed values; use arbitrary values (`text-[17px]`) when Tailwind's scale doesn't match.+- **Don't dispatch a builder without a lint-passing spec.** No exceptions — that's the whole quality model.+- **Don't reference docs from builder prompts** — spec contents go inline.+- **Don't skip the manifest updates.** An untracked run can't resume.+- **Don't hardcode content in components.** Content → `src/data/`, components take props.+- **Don't write "same as desktop" in a Responsive section.** Root font-size steps at breakpoints on most real sites, so every number changes. Run `probe.mjs` and write the real values for all three widths — lint-spec now rejects vague responsive sections.+- **Don't forget `::before` / `::after`.** They carry hero overlays, heading underline bars, and icon glyphs. `section.mjs` captures them under a `pseudo` key — if a spec has none and the screenshot shows decorations, extraction was incomplete.+- **Don't trust the spec over the extraction JSON.** Specs are hand-written summaries and drift; `sections/*.json` is machine-measured.+- **Don't declare done without QA scores.** "Looks right" is not a number.++## Completion Report++- Pages cloned (routes) · sections built · spec files written (must match section count)+- Assets downloaded (from `assets.json` download log, including failures)+- Final QA score table per section × viewport (from `manifest.mjs status`)+- `npm run build` result+- Known gaps and any section that couldn't reach 95%+- Suggest next step: `/restyle` to rebrand the clone with your own identitydiff --git a/.codex/skills/restyle/SKILL.md b/.codex/skills/restyle/SKILL.mdnew file mode 100644index 0000000..f679a01--- /dev/null+++ b/.codex/skills/restyle/SKILL.md@@ -0,0 +1,49 @@+---+name: restyle+description: Rebrand a cloned website with your own identity — swaps colors, fonts, logo, favicons, and rewrites all copy for your brand while keeping the cloned layout, spacing, animations, and interactions pixel-intact. Run after /clone-website. Reads BRAND.md at the repo root. Use when the user wants to "make it mine", rebrand, restyle, or customize the clone.+argument-hint: "[extra instructions, e.g. 'keep their copy, only swap colors']"+user-invocable: true+---++# Restyle++Turn the cloned site into **the user's site**: their brand, their words, their logo — on top of the cloned structure. Layout, spacing, animations, and interactions stay untouched. That separation works because the clone pipeline keeps all content in `src/data/*.ts` and all brand tokens in `globals.css` — you swap those layers only.++$ARGUMENTS++## Step 1 — Read the brand++Read `BRAND.md` at the repo root. If it's missing or has unfilled `TODO` fields, ask the user for what's missing (max 3 questions at a time). Never ask for secrets in chat — anything sensitive belongs in env files, not BRAND.md.++If the user has brand assets (logo files, product screenshots), ask them to drop the files into `public/brand/` and tell you the filenames.++## Step 2 — Take "before" screenshots++```bash+npm run dev # background+node scripts/extract/screenshot.mjs http://localhost:3000 --name before-restyle+```+These are your regression reference: after restyling, layout must still match them structurally.++## Step 3 — Swap the brand layers (in this order)++1. **Colors** — `src/app/globals.css`: replace the cloned palette in `:root` / `.dark` with the brand colors from BRAND.md. Keep the same token *names* so no component changes. Preserve relative contrast: if the original had a dark section, keep it dark in the new palette.+2. **Fonts** — `src/app/layout.tsx`: swap `next/font` families to the brand fonts. Keep the size/weight structure the clone extracted — only families change.+3. **Logo & icons** — replace `LogoIcon` in `src/components/icons.tsx` (or the logo `<img>` asset) with the brand logo from `public/brand/`. Keep the rendered dimensions of the original logo so the header layout doesn't shift.+4. **Favicons & SEO** — regenerate `public/seo/` (favicon, apple-touch-icon, OG image if provided), update `layout.tsx` metadata: title, description, OG tags — from BRAND.md positioning.+5. **Copy** — rewrite every string in `src/data/*.ts` for the brand: same structure, same approximate length (±20% — long copy breaks cloned layouts), brand voice from BRAND.md. Headlines sell the user's offer, not the original company's. Placeholder patterns like testimonials get realistic brand-appropriate content clearly marked as placeholders unless BRAND.md provides real ones.+6. **Images** — where the clone shows the original company's product shots, swap in files from `public/brand/` if provided; otherwise leave the cloned image and list it in the report as "needs replacement".++## Step 4 — Verify++1. `npm run build` — must pass+2. `node scripts/extract/screenshot.mjs http://localhost:3000 --name after-restyle`+3. Compare before/after at all 3 viewports: layout identical, only brand layers changed. Overflowing text = shorten the copy, never change the layout.+4. Check every page route, not just `/`.++## Report++- What was swapped (colors, fonts, logo, favicon, N copy blocks across M data files)+- Images still showing the original site's content (need user-provided replacements)+- Any copy that had to be shortened/lengthened to fit+- Anything in BRAND.md still marked TODOdiff --git a/.continue/commands/clone-website.md b/.continue/commands/clone-website.mdnew file mode 100644index 0000000..a6ee17c--- /dev/null+++ b/.continue/commands/clone-website.md@@ -0,0 +1,250 @@+---+name: clone-website+description: "Reverse-engineer and clone a full multi-page website as a pixel-accurate Next.js replica"+invokable: true+---+<!-- GENERATED from .claude/skills/clone-website/SKILL.md by scripts/sync-skills.mjs — edit the source,+ then run: node scripts/sync-skills.mjs -->++# Clone Website++Reverse-engineer and rebuild **$ARGUMENTS** as a pixel-accurate, multi-page Next.js clone.++You are a **foreman walking the job site**: scripts do the measuring, you do the judgment, specs are the contract, builder agents do the construction, and the pixel-diff score decides when you're done. Extraction and construction overlap — dispatch builders as soon as a section's spec passes lint, then keep extracting.++## Resume Check (ALWAYS FIRST)++```bash+node scripts/manifest.mjs status+```++If a manifest exists, this is a **resumed run**: skip everything already done (`node scripts/manifest.mjs next` tells you where to continue). If not, this is a fresh run — start at Phase 0.++## Scope Defaults++- **Fidelity:** pixel-accurate — colors, spacing, typography, animations, interactions+- **In scope:** every confirmed page, visual layout, component structure, interactions, responsive behavior (phone 390 / iPad 768 / PC 1440), real content and assets+- **Out of scope:** real backend, auth, databases, forms that actually submit (mock them)+- **Content goes in `src/data/*.ts`** — components take props; page files wire data to components. This keeps the clone restylable later (see `/restyle`).++User-provided instructions override these defaults.++## Tooling++The scripts do the mechanical work — **use them instead of hand-measuring via browser MCP**:++| Script | Purpose |+|---|---|+| **`node scripts/extract/page.mjs <url> [--no-site-files]`** | **THE WORKHORSE — one call, 3 page loads total.** Auto-detects sections, then produces `tokens.json` + `css.json` (skip on later pages with `--no-site-files`), `assets.json` + downloads to `public/`, `responsive.json` (all 3 viewports), a full computed-style walk per section (`sections/<name>.json`), and full-page **and** per-section screenshots at phone/iPad/PC. Accepts explicit `--selector "css" --name x` pairs to override detection. Everything is measured from the SAME page state, so numbers, walks and screenshots can never disagree |+| `node scripts/extract/crawl.mjs <url> [--max 25]` | Discover pages (sitemap + nav links) → `docs/research/<host>/sitemap.json` |+| `node scripts/extract/section.mjs <url> --selector "css" [--name x] --state scroll:600\|click:sel\|hover:sel [--viewport pc\|ipad\|phone]` | **State captures** (page.mjs covers the default state). Captures a second state and diffs them (element styles *and* `::before`/`::after`), waiting for the section's real transition duration. `--selector`/`--name` repeat — one page load for all |+| `node scripts/extract/probe.mjs <url> --selector "css" [--selector "css2"] [--props a,b,c]` / `probe.mjs --route </r>` | Exact computed values for specific selectors at all 3 viewports, as a markdown table with a **varies** column — paste straight into a spec's Responsive section. **`--route` probes EVERY registered section of a page in one call (3 loads total, plus a `probe-<section>.json` per section) — never probe section-by-section** |+| `node scripts/extract/screenshot.mjs <url> [--selector css --name x ...]` | Extra screenshots at phone/iPad/PC (page.mjs already shot everything once). `--selector`/`--name` repeat — one call, 3 loads, N sections |+| `node scripts/extract/tokens.mjs` / `css.mjs` / `assets.mjs` / `responsive.mjs` | Single-purpose re-runs of one page.mjs output when something needs refreshing |+| `node scripts/diff.mjs --original <url> --clone <url> [--selector css] --viewport all [--threshold 95]` | Scored pixel diff, original vs clone. **`--viewport all` scores pc+ipad+phone in one call**, and the per-viewport **band breakdown names the y-range where the mismatch lives** — read it before guessing at causes. **Batched sweep: `--route </r>` (or repeated `--section name=css`) scores every section of a page from ONE load per side per viewport.** Original-side shots are cached 24h, so fix-iteration re-diffs only re-render the clone (`--fresh-original` to override) |+| `node scripts/lint-spec.mjs <spec.md\|dir>` | Mechanical spec-completeness gate — must pass before ANY builder dispatch |+| `node scripts/manifest.mjs <cmd>` | Pipeline state: init / add-page / add-section / set / status / next |++Browser MCP (Chrome MCP, Playwright MCP — if available) is for **judgment work only**: watching how the page behaves while scrolling, exploring what's clickable, understanding an animation. Numbers always come from the scripts. If no browser MCP is available, the scripts alone are sufficient — use extra `screenshot.mjs` and `section.mjs --state` calls to observe behavior.++The scripts are plain Node CLIs — any coding agent can run them. Playwright's Chromium auto-installs on the first script run (or run `npm run setup` once). If your tool has no subagent/worktree support, skip the dispatch mechanics and build each section yourself, sequentially, from the same lint-passing specs — every quality gate still applies.++## Guiding Principles++1. **Completeness beats speed.** A builder that has to guess a color, font size, or padding value means extraction failed. Extract one more property rather than ship an incomplete spec.+2. **Small tasks, perfect results.** One focused component per builder. Spec body over 150 lines = split the section (lint-spec enforces this).+3. **Real content, real assets.** Actual text via the section walker, actual files via `assets.mjs`. Watch for **layered images** — a hero that looks like one image is often background + overlay + foreground; `assets.json` records sibling counts and z-index for exactly this reason.+4. **Foundation first.** Tokens, fonts, types, icons, and shared chrome (header/footer) before any page section.+5. **Extract how it looks AND how it behaves.** Every interactive element needs before/after states with exact values — `section.mjs --state` produces the diff mechanically.+6. **Identify the interaction model before building.** Scroll-driven vs click-driven confusion is the most expensive mistake in cloning — a wrong call means a rewrite, not a CSS fix. Scroll first without clicking and watch; only then click. Record the model in the spec frontmatter.+7. **Responsive is measured, never guessed — at all three widths.** Fill every spec's Responsive section from `responsive.json` + `probe.mjs`, with real numbers for phone AND iPad AND pc. Never write "iPad: same as desktop": most production sites step their root font-size at breakpoints, so *every* padding, margin, and font size changes even when the layout looks identical. A spec that only nails desktop produces a clone that scores ~98% at 1440px and ~91% at 390px. `lint-spec.mjs` rejects vague responsive sections.++8. **The extraction JSON is ground truth; the spec is a summary of it.** If a builder finds the spec disagreeing with `sections/<name>.json` or `responsive.json`, the JSON wins — say so explicitly in every builder prompt and have the builder report the discrepancy so you can correct the spec.+9. **Spec files are the contract.** No spec → no builder. lint-spec must pass → then dispatch.+10. **The build must always compile.** Builders verify `npx tsc --noEmit`; you verify `npm run typecheck && npm run lint` after every merge. Full `npm run build` runs only at checkpoints (Phase 0, end of Phase 2, once mid-way through Phase 3, Phase 4, completion) — it takes 30–60s and running it per merge serializes otherwise-parallel builders.+11. **The manifest is updated at every stage transition.** That's what makes the run resumable.++## Phase 0 — Crawl & Scope++1. Verify the base builds: `npm run build`.+2. `node scripts/extract/crawl.mjs <url> --max 25`+3. Show the user the discovered pages (route + source). **Ask which to clone** — recommend: start page + nav pages, skip legal/utility pages unless asked. Default cap ~10.+4. Initialize state:+ ```bash+ node scripts/manifest.mjs init <url>+ node scripts/manifest.mjs add-page --url <url> --route / # per confirmed page+ ```++## Phase 1 — Recon (one page.mjs call per page)++1. **First page:** `node scripts/extract/page.mjs <start-url>` — produces tokens, css, assets+downloads, responsive signatures, per-section walks, and every screenshot in one shot (3 page loads).+2. **Every other confirmed page:** `node scripts/extract/page.mjs <url> --no-site-files` (tokens/css are site-wide; everything else is per-page). Downloads dedupe across pages automatically — files already in `public/` are skipped.+3. **Review the detected sections** in each run's stdout summary (name, selector, pc height, headline responsive change). Detection is a heuristic: if a "section" is really two, or two are really one, re-run with explicit `--selector "css" --name x` pairs. Section names become spec/component names — rename `section-3` style fallbacks to something meaningful via `--name`.+4. **Interaction sweep** (judgment work — browser MCP if available): scroll each page slowly top to bottom. Does the header change? Do elements animate in? Auto-switching tabs? Scroll-snap? Smooth-scroll lib (`tokens.json` flags `.lenis`/Locomotive)? Then click every tab/pill/accordion and note what changes. Then hover. `css.json`'s `interactiveStates` lists every :hover/:focus rule the stylesheet defines — use it as the checklist of what to probe. Record findings in `docs/research/<host>/BEHAVIORS.md`.+5. **Shared chrome detection:** compare screenshots across pages — header/nav/footer that repeat become SHARED components (`SiteHeader`, `SiteFooter`), extracted once from the page where they're most complete.++**Per page — topology:** map every distinct section top to bottom with a working name, its selector, its interaction model (static / click-driven / scroll-driven / hover-driven / time-driven / mixed), and layer notes (sticky? overlay? z-index?). Save `docs/research/<host>/PAGE_TOPOLOGY.md`, then register each section:+```bash+node scripts/manifest.mjs add-section --route / --name hero --selector "section.hero"+```++## Phase 2 — Foundation (sequential, you do it yourself)++1. **Fonts** in `src/app/layout.tsx` via `next/font/google` or `next/font/local` (downloaded fonts are in `public/fonts/`) — families/weights from `tokens.json`+2. **`globals.css`**: map the target's palette onto the shadcn `:root` token names; add custom properties for colors that don't map; add global keyframes, scroll-snap, smooth-scroll setup found in recon+3. **TypeScript interfaces** in `src/types/` for the content structures you observed+4. **Icons**: convert the deduplicated `inlineSvgs` from `assets.json` into named components in `src/components/icons.tsx` (named by function: `LogoIcon`, `ArrowRightIcon`…)+5. **SEO**: favicons/OG from `public/seo/` wired into `layout.tsx` metadata+6. Verify `npm run build`, then build **shared chrome** (header/footer) first — full spec → lint → builder cycle like any section, since every page depends on them.++## Phase 3 — Per-Section Loop (extract → spec → lint → dispatch → merge)++Work through `manifest.mjs next` until no sections remain. For each section:++### 3a. Extract++**The default state is already extracted** — Phase 1's page.mjs run wrote+`sections/<name>.json`, `responsive.json`, and all screenshots.++**First time you enter Phase 3 for a page, probe ALL its sections in ONE call** (3+page loads total instead of 3 per section — never probe section-by-section):++```bash+node scripts/extract/probe.mjs --route <r> # every registered section + probe-<section>.json each+# add key children in the same call when a spec will need them:+node scripts/extract/probe.mjs --route <r> --selector "<sel> h2" --selector "<sel> .card"+```++Slice the per-section tables into each spec's Responsive section as you write it.+Per section, only one thing remains:++```bash+# Per discovered behavior — one call per state (batch selectors sharing a trigger):+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-hover --state hover:".card"+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-scrolled --state scroll:600+# per tab/pill state: --state click:".tab-2" etc. EVERY state, not just the default.+```+State captures wait for the section's actual transition duration, so a slow fade is+recorded at its end value, not mid-flight — check `settleMs` in the output if a diff+looks wrong. The `diff` array covers `::before`/`::after` too, which is where hover+overlays usually live. Cross-check discovered behaviors against `css.json`'s+`interactiveStates` — a :hover rule in the stylesheet with no captured state means+the extraction is not done.++Mark: `manifest.mjs set --route <r> --section <name> --stage extracted`++### 3b. Write the spec — `docs/research/components/<route-slug>/<name>.spec.md`++```markdown+---+component: HeroSection+target: src/components/HeroSection.tsx+page: /+screenshot: docs/design-references/<host>/<name>-pc.png+interaction_model: static | click-driven | scroll-driven | hover-driven | time-driven | mixed+states: default, hover, scrolled…+assets: public/images/x.webp, icons:ArrowRightIcon+responsive: phone, ipad, pc+---++# <Component> Specification++## DOM Structure+<hierarchy from the section walker — what contains what>++## Computed Styles+<exact values from sections/<name>.json, per element. Never estimated.>++## States & Behaviors+<per behavior: Trigger / State A / State B / Transition — from the --state diffs.+ Include the implementation approach (CSS transition, IntersectionObserver, etc.)>++## Per-State Content+<for tabbed/stateful sections: full content per state. "N/A — static" otherwise>++## Assets+<local public/ paths + icon components used. Note layered compositions explicitly.>++## Text Content+<verbatim from the walker output — never paraphrased>++## Responsive Behavior+<from responsive.json: real column counts and changes at 390 / 768 / 1440 + breakpoint>+```++### 3c. Lint gate+```bash+node scripts/lint-spec.mjs docs/research/components/<route-slug>/<name>.spec.md+```+Fails → extract more. Passes → `manifest.mjs set … --stage specd` and dispatch.++### 3d. Dispatch builder agent (worktree)++Every builder receives IN ITS PROMPT (never "go read the file"):+- The **full spec file contents inline**+- The screenshot paths (all 3 viewports)+- Shared imports available: `cn()`, `icons.tsx` components, shadcn `ui/` primitives, types from `src/types/`+- The target file path, and the data file to create in `src/data/` if the section has content collections+- The rule: verify `npx tsc --noEmit` passes before finishing+- **The ground-truth rule:** "`docs/research/<host>/sections/<name>.json` and `responsive.json` are ground truth. If this spec contradicts them, follow the JSON and report the discrepancy." Builders reliably catch spec errors this way — treat their reports as corrections to make to the spec file.++Complex section (3+ distinct sub-components) → one builder per sub-component + one for the wrapper, sub-components first. **Don't wait** — while builders run, extract the next section.++### 3e. Merge+As builders finish: merge worktree → `npm run typecheck && npm run lint` → fix errors immediately → `manifest.mjs set … --stage merged`. tsc catches the cross-worktree breaks (imports, prop types) that per-merge builds used to catch, in a fraction of the time.++**Once, after roughly half the page's sections are merged: run a full `npm run build` checkpoint.** It catches build-only failures (server/client component violations, route exports, metadata) while they're still cheap to bisect. Don't build after every merge.++## Phase 4 — Page Assembly++Per page: create `src/app/<route>/page.tsx` importing its section components with data from `src/data/`, plus page-level behaviors (scroll-snap, observers, smooth scroll). Shared chrome mounts in `layout.tsx` or a route group layout. Wire internal nav links to the cloned routes. `npm run build` must pass.++## Phase 5 — Scored QA Loop++Start the clone: `npm run dev` (background). Then **score the whole page's sections in ONE batched call** (one load per side per viewport instead of one per section):++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --route <r> --viewport all+node scripts/manifest.mjs set --route <r> --section <name> --score pc=<match> # per section × viewport+```++**Fix iterations stay single-section** — the original-side shots captured by the sweep are cached, so a re-diff only re-renders the clone:++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --selector "<sel>" --viewport all --name <name>+```++- **Pass = ≥95% on all three viewports** → `--stage qa_passed`+- Below 95% → **read the band breakdown first**: it names the y-range where the mismatch lives, so you inspect that band of the diff image in `docs/research/qa/` instead of eyeballing the whole section. Then check the spec (wrong extraction → re-extract and fix; right spec, wrong build → fix component), re-diff+- A large height mismatch reported by diff.mjs = missing content or wrong spacing — fix before pixel-tweaking+- Max 3 fix iterations per section, then record the gap honestly and move on+- **Text-heavy sections at phone width often plateau at 90–95%** when the target's font isn't available on Google Fonts (e.g. Source Sans Pro → Source Sans 3). Different metrics = different wrap points = unavoidable pixel drift. Confirm the layout matches, note the substitution, and accept it.+- **A score that's high at pc but low at ipad/phone is always a responsive-spec problem**, not a styling bug. Re-run `probe.mjs` on the section and fill in the values the spec was missing.+- Finally, test behaviors manually: scroll, click every tab, hover — screenshots can't verify motion; you must++Whole-page diffs (`--selector` omitted) at all 3 viewports close out each page.++## What NOT to Do++- **Don't build click-tabs when the original is scroll-driven** (or vice versa). Scroll first, watch, then click. Wrong model = rewrite.+- **Don't extract only the default state.** Every tab clicked, every hover captured, header at scroll 0 AND past the trigger.+- **Don't miss layered/overlay images** — check `siblingImgs` and z-index hints in `assets.json`.+- **Don't build HTML mockups of things that are actually `<video>`, Lottie, or canvas.** Check first.+- **Don't approximate ("looks like text-lg").** Use the walker's exact computed values; use arbitrary values (`text-[17px]`) when Tailwind's scale doesn't match.+- **Don't dispatch a builder without a lint-passing spec.** No exceptions — that's the whole quality model.+- **Don't reference docs from builder prompts** — spec contents go inline.+- **Don't skip the manifest updates.** An untracked run can't resume.+- **Don't hardcode content in components.** Content → `src/data/`, components take props.+- **Don't write "same as desktop" in a Responsive section.** Root font-size steps at breakpoints on most real sites, so every number changes. Run `probe.mjs` and write the real values for all three widths — lint-spec now rejects vague responsive sections.+- **Don't forget `::before` / `::after`.** They carry hero overlays, heading underline bars, and icon glyphs. `section.mjs` captures them under a `pseudo` key — if a spec has none and the screenshot shows decorations, extraction was incomplete.+- **Don't trust the spec over the extraction JSON.** Specs are hand-written summaries and drift; `sections/*.json` is machine-measured.+- **Don't declare done without QA scores.** "Looks right" is not a number.++## Completion Report++- Pages cloned (routes) · sections built · spec files written (must match section count)+- Assets downloaded (from `assets.json` download log, including failures)+- Final QA score table per section × viewport (from `manifest.mjs status`)+- `npm run build` result+- Known gaps and any section that couldn't reach 95%+- Suggest next step: `/restyle` to rebrand the clone with your own identitydiff --git a/.continue/commands/restyle.md b/.continue/commands/restyle.mdnew file mode 100644index 0000000..a3193dc--- /dev/null+++ b/.continue/commands/restyle.md@@ -0,0 +1,50 @@+---+name: restyle+description: "Rebrand a cloned website with your own colors, fonts, logo, and copy while keeping the layout pixel-intact"+invokable: true+---+<!-- GENERATED from .claude/skills/restyle/SKILL.md by scripts/sync-skills.mjs — edit the source,+ then run: node scripts/sync-skills.mjs -->++# Restyle++Turn the cloned site into **the user's site**: their brand, their words, their logo — on top of the cloned structure. Layout, spacing, animations, and interactions stay untouched. That separation works because the clone pipeline keeps all content in `src/data/*.ts` and all brand tokens in `globals.css` — you swap those layers only.++$ARGUMENTS++## Step 1 — Read the brand++Read `BRAND.md` at the repo root. If it's missing or has unfilled `TODO` fields, ask the user for what's missing (max 3 questions at a time). Never ask for secrets in chat — anything sensitive belongs in env files, not BRAND.md.++If the user has brand assets (logo files, product screenshots), ask them to drop the files into `public/brand/` and tell you the filenames.++## Step 2 — Take "before" screenshots++```bash+npm run dev # background+node scripts/extract/screenshot.mjs http://localhost:3000 --name before-restyle+```+These are your regression reference: after restyling, layout must still match them structurally.++## Step 3 — Swap the brand layers (in this order)++1. **Colors** — `src/app/globals.css`: replace the cloned palette in `:root` / `.dark` with the brand colors from BRAND.md. Keep the same token *names* so no component changes. Preserve relative contrast: if the original had a dark section, keep it dark in the new palette.+2. **Fonts** — `src/app/layout.tsx`: swap `next/font` families to the brand fonts. Keep the size/weight structure the clone extracted — only families change.+3. **Logo & icons** — replace `LogoIcon` in `src/components/icons.tsx` (or the logo `<img>` asset) with the brand logo from `public/brand/`. Keep the rendered dimensions of the original logo so the header layout doesn't shift.+4. **Favicons & SEO** — regenerate `public/seo/` (favicon, apple-touch-icon, OG image if provided), update `layout.tsx` metadata: title, description, OG tags — from BRAND.md positioning.+5. **Copy** — rewrite every string in `src/data/*.ts` for the brand: same structure, same approximate length (±20% — long copy breaks cloned layouts), brand voice from BRAND.md. Headlines sell the user's offer, not the original company's. Placeholder patterns like testimonials get realistic brand-appropriate content clearly marked as placeholders unless BRAND.md provides real ones.+6. **Images** — where the clone shows the original company's product shots, swap in files from `public/brand/` if provided; otherwise leave the cloned image and list it in the report as "needs replacement".++## Step 4 — Verify++1. `npm run build` — must pass+2. `node scripts/extract/screenshot.mjs http://localhost:3000 --name after-restyle`+3. Compare before/after at all 3 viewports: layout identical, only brand layers changed. Overflowing text = shorten the copy, never change the layout.+4. Check every page route, not just `/`.++## Report++- What was swapped (colors, fonts, logo, favicon, N copy blocks across M data files)+- Images still showing the original site's content (need user-provided replacements)+- Any copy that had to be shortened/lengthened to fit+- Anything in BRAND.md still marked TODOdiff --git a/.continue/rules/project.md b/.continue/rules/project.mdnew file mode 100644index 0000000..6a2ba5b--- /dev/null+++ b/.continue/rules/project.md@@ -0,0 +1,73 @@+---+description: Project conventions for the site-cloner template+alwaysApply: true+---+<!-- GENERATED from AGENTS.md by scripts/sync-skills.mjs — edit the source,+ then run: node scripts/sync-skills.mjs -->++# site-cloner++Template for cloning any multi-page website into this Next.js codebase, then rebranding it as your own. Two commands drive everything: `/clone-website <url>` and `/restyle`.++## Tech Stack++- **Next.js 16** — App Router, React 19, TypeScript strict+- **Tailwind CSS v4** + shadcn/ui (base-ui primitives), oklch tokens in `src/app/globals.css`+- **Lucide React** icons (replaced by extracted SVGs in `src/components/icons.tsx` during cloning)+- **Playwright** (devDependency) powers all extraction/QA scripts++## Commands++- `npm run dev` / `npm run build` / `npm run lint` / `npm run typecheck`+- `npm run check` — lint + typecheck + build (must pass before any commit)++## Architecture Rules++- **Content lives in `src/data/*.ts`, never hardcoded in components.** Components take props. This is what makes `/restyle` possible — copy swaps without touching layout.+- Pages: `src/app/<route>/page.tsx` wires data → components. Shared header/footer mount in layouts.+- `docs/research/` holds extraction artifacts (JSON, specs, manifest) — auditable, never hand-edited except spec files.+- `docs/research/manifest.json` is the pipeline state. Update it at every stage transition; check it first on any clone-related task (`node scripts/manifest.mjs status`).+- Specs (`docs/research/components/**/*.spec.md`) must pass `node scripts/lint-spec.mjs` before any builder agent is dispatched.+- All extraction numbers come from `scripts/` (computed styles, real column counts, pixel diffs) — never estimated by eye.++## Code Style++- TypeScript strict, no `any`+- Named exports, PascalCase components, camelCase utils+- Tailwind utility classes; arbitrary values (`text-[17px]`) when the extracted value doesn't match Tailwind's scale+- 2-space indentation++## Skills / Commands++Two workflows, each with a single source of truth in `.claude/skills/<name>/SKILL.md`:++| Command | Purpose |+|---|---|+| `/clone-website <url>` | Crawl, extract, spec, build, and pixel-diff QA a full multi-page clone |+| `/restyle` | Swap colors, fonts, logo, and copy for your brand — layout stays intact |++Where your tool finds them (all generated from the same source):++- **Claude Code:** `.claude/skills/<name>/SKILL.md`+- **Codex CLI:** `.codex/skills/<name>/SKILL.md`+- **GitHub Copilot coding agent:** `.github/skills/<name>/SKILL.md`+- **Cursor:** `.cursor/commands/<name>.md`+- **Windsurf:** `.windsurf/workflows/<name>.md`+- **Gemini CLI:** `.gemini/commands/<name>.toml`+- **OpenCode:** `.opencode/commands/<name>.md`+- **Continue:** `.continue/commands/<name>.md`+- **Augment Code:** `.augment/commands/<name>.md`+- **Amazon Q Developer CLI:** `.amazonq/cli-agents/<name>.json`+- **Cline / Roo Code, Aider, anything else:** open `.claude/skills/<name>/SKILL.md` and follow it as a prompt.++The extraction scripts are plain Node CLIs any agent can run; Chromium auto-installs on first use (or `npm run setup`). No subagent support in your tool? Build sections sequentially from the same lint-passing specs.++## Ethics++Clone sites you own or have permission to rebuild (platform migration, lost source, learning). Never for phishing, impersonation, or passing off someone's design as your own.++## Keeping Agent Configs in Sync++- `.claude/skills/*/SKILL.md` and this file (`AGENTS.md`) are the only sources of truth for per-tool configs.+- After editing either, run `node scripts/sync-skills.mjs` to regenerate every per-tool copy.+- Generated files are committed; CI runs `node scripts/sync-skills.mjs --check` and fails if any are stale.diff --git a/.cursor/commands/clone-website.md b/.cursor/commands/clone-website.mdnew file mode 100644index 0000000..1c54b02--- /dev/null+++ b/.cursor/commands/clone-website.md@@ -0,0 +1,247 @@+<!-- GENERATED from .claude/skills/clone-website/SKILL.md by scripts/sync-skills.mjs — edit the source,+ then run: node scripts/sync-skills.mjs -->++# Clone Website++> Reverse-engineer and clone a full multi-page website as a pixel-accurate Next.js replica++Reverse-engineer and rebuild **the target URL (plus any extra instructions) provided by the user** as a pixel-accurate, multi-page Next.js clone.++You are a **foreman walking the job site**: scripts do the measuring, you do the judgment, specs are the contract, builder agents do the construction, and the pixel-diff score decides when you're done. Extraction and construction overlap — dispatch builders as soon as a section's spec passes lint, then keep extracting.++## Resume Check (ALWAYS FIRST)++```bash+node scripts/manifest.mjs status+```++If a manifest exists, this is a **resumed run**: skip everything already done (`node scripts/manifest.mjs next` tells you where to continue). If not, this is a fresh run — start at Phase 0.++## Scope Defaults++- **Fidelity:** pixel-accurate — colors, spacing, typography, animations, interactions+- **In scope:** every confirmed page, visual layout, component structure, interactions, responsive behavior (phone 390 / iPad 768 / PC 1440), real content and assets+- **Out of scope:** real backend, auth, databases, forms that actually submit (mock them)+- **Content goes in `src/data/*.ts`** — components take props; page files wire data to components. This keeps the clone restylable later (see `/restyle`).++User-provided instructions override these defaults.++## Tooling++The scripts do the mechanical work — **use them instead of hand-measuring via browser MCP**:++| Script | Purpose |+|---|---|+| **`node scripts/extract/page.mjs <url> [--no-site-files]`** | **THE WORKHORSE — one call, 3 page loads total.** Auto-detects sections, then produces `tokens.json` + `css.json` (skip on later pages with `--no-site-files`), `assets.json` + downloads to `public/`, `responsive.json` (all 3 viewports), a full computed-style walk per section (`sections/<name>.json`), and full-page **and** per-section screenshots at phone/iPad/PC. Accepts explicit `--selector "css" --name x` pairs to override detection. Everything is measured from the SAME page state, so numbers, walks and screenshots can never disagree |+| `node scripts/extract/crawl.mjs <url> [--max 25]` | Discover pages (sitemap + nav links) → `docs/research/<host>/sitemap.json` |+| `node scripts/extract/section.mjs <url> --selector "css" [--name x] --state scroll:600\|click:sel\|hover:sel [--viewport pc\|ipad\|phone]` | **State captures** (page.mjs covers the default state). Captures a second state and diffs them (element styles *and* `::before`/`::after`), waiting for the section's real transition duration. `--selector`/`--name` repeat — one page load for all |+| `node scripts/extract/probe.mjs <url> --selector "css" [--selector "css2"] [--props a,b,c]` / `probe.mjs --route </r>` | Exact computed values for specific selectors at all 3 viewports, as a markdown table with a **varies** column — paste straight into a spec's Responsive section. **`--route` probes EVERY registered section of a page in one call (3 loads total, plus a `probe-<section>.json` per section) — never probe section-by-section** |+| `node scripts/extract/screenshot.mjs <url> [--selector css --name x ...]` | Extra screenshots at phone/iPad/PC (page.mjs already shot everything once). `--selector`/`--name` repeat — one call, 3 loads, N sections |+| `node scripts/extract/tokens.mjs` / `css.mjs` / `assets.mjs` / `responsive.mjs` | Single-purpose re-runs of one page.mjs output when something needs refreshing |+| `node scripts/diff.mjs --original <url> --clone <url> [--selector css] --viewport all [--threshold 95]` | Scored pixel diff, original vs clone. **`--viewport all` scores pc+ipad+phone in one call**, and the per-viewport **band breakdown names the y-range where the mismatch lives** — read it before guessing at causes. **Batched sweep: `--route </r>` (or repeated `--section name=css`) scores every section of a page from ONE load per side per viewport.** Original-side shots are cached 24h, so fix-iteration re-diffs only re-render the clone (`--fresh-original` to override) |+| `node scripts/lint-spec.mjs <spec.md\|dir>` | Mechanical spec-completeness gate — must pass before ANY builder dispatch |+| `node scripts/manifest.mjs <cmd>` | Pipeline state: init / add-page / add-section / set / status / next |++Browser MCP (Chrome MCP, Playwright MCP — if available) is for **judgment work only**: watching how the page behaves while scrolling, exploring what's clickable, understanding an animation. Numbers always come from the scripts. If no browser MCP is available, the scripts alone are sufficient — use extra `screenshot.mjs` and `section.mjs --state` calls to observe behavior.++The scripts are plain Node CLIs — any coding agent can run them. Playwright's Chromium auto-installs on the first script run (or run `npm run setup` once). If your tool has no subagent/worktree support, skip the dispatch mechanics and build each section yourself, sequentially, from the same lint-passing specs — every quality gate still applies.++## Guiding Principles++1. **Completeness beats speed.** A builder that has to guess a color, font size, or padding value means extraction failed. Extract one more property rather than ship an incomplete spec.+2. **Small tasks, perfect results.** One focused component per builder. Spec body over 150 lines = split the section (lint-spec enforces this).+3. **Real content, real assets.** Actual text via the section walker, actual files via `assets.mjs`. Watch for **layered images** — a hero that looks like one image is often background + overlay + foreground; `assets.json` records sibling counts and z-index for exactly this reason.+4. **Foundation first.** Tokens, fonts, types, icons, and shared chrome (header/footer) before any page section.+5. **Extract how it looks AND how it behaves.** Every interactive element needs before/after states with exact values — `section.mjs --state` produces the diff mechanically.+6. **Identify the interaction model before building.** Scroll-driven vs click-driven confusion is the most expensive mistake in cloning — a wrong call means a rewrite, not a CSS fix. Scroll first without clicking and watch; only then click. Record the model in the spec frontmatter.+7. **Responsive is measured, never guessed — at all three widths.** Fill every spec's Responsive section from `responsive.json` + `probe.mjs`, with real numbers for phone AND iPad AND pc. Never write "iPad: same as desktop": most production sites step their root font-size at breakpoints, so *every* padding, margin, and font size changes even when the layout looks identical. A spec that only nails desktop produces a clone that scores ~98% at 1440px and ~91% at 390px. `lint-spec.mjs` rejects vague responsive sections.++8. **The extraction JSON is ground truth; the spec is a summary of it.** If a builder finds the spec disagreeing with `sections/<name>.json` or `responsive.json`, the JSON wins — say so explicitly in every builder prompt and have the builder report the discrepancy so you can correct the spec.+9. **Spec files are the contract.** No spec → no builder. lint-spec must pass → then dispatch.+10. **The build must always compile.** Builders verify `npx tsc --noEmit`; you verify `npm run typecheck && npm run lint` after every merge. Full `npm run build` runs only at checkpoints (Phase 0, end of Phase 2, once mid-way through Phase 3, Phase 4, completion) — it takes 30–60s and running it per merge serializes otherwise-parallel builders.+11. **The manifest is updated at every stage transition.** That's what makes the run resumable.++## Phase 0 — Crawl & Scope++1. Verify the base builds: `npm run build`.+2. `node scripts/extract/crawl.mjs <url> --max 25`+3. Show the user the discovered pages (route + source). **Ask which to clone** — recommend: start page + nav pages, skip legal/utility pages unless asked. Default cap ~10.+4. Initialize state:+ ```bash+ node scripts/manifest.mjs init <url>+ node scripts/manifest.mjs add-page --url <url> --route / # per confirmed page+ ```++## Phase 1 — Recon (one page.mjs call per page)++1. **First page:** `node scripts/extract/page.mjs <start-url>` — produces tokens, css, assets+downloads, responsive signatures, per-section walks, and every screenshot in one shot (3 page loads).+2. **Every other confirmed page:** `node scripts/extract/page.mjs <url> --no-site-files` (tokens/css are site-wide; everything else is per-page). Downloads dedupe across pages automatically — files already in `public/` are skipped.+3. **Review the detected sections** in each run's stdout summary (name, selector, pc height, headline responsive change). Detection is a heuristic: if a "section" is really two, or two are really one, re-run with explicit `--selector "css" --name x` pairs. Section names become spec/component names — rename `section-3` style fallbacks to something meaningful via `--name`.+4. **Interaction sweep** (judgment work — browser MCP if available): scroll each page slowly top to bottom. Does the header change? Do elements animate in? Auto-switching tabs? Scroll-snap? Smooth-scroll lib (`tokens.json` flags `.lenis`/Locomotive)? Then click every tab/pill/accordion and note what changes. Then hover. `css.json`'s `interactiveStates` lists every :hover/:focus rule the stylesheet defines — use it as the checklist of what to probe. Record findings in `docs/research/<host>/BEHAVIORS.md`.+5. **Shared chrome detection:** compare screenshots across pages — header/nav/footer that repeat become SHARED components (`SiteHeader`, `SiteFooter`), extracted once from the page where they're most complete.++**Per page — topology:** map every distinct section top to bottom with a working name, its selector, its interaction model (static / click-driven / scroll-driven / hover-driven / time-driven / mixed), and layer notes (sticky? overlay? z-index?). Save `docs/research/<host>/PAGE_TOPOLOGY.md`, then register each section:+```bash+node scripts/manifest.mjs add-section --route / --name hero --selector "section.hero"+```++## Phase 2 — Foundation (sequential, you do it yourself)++1. **Fonts** in `src/app/layout.tsx` via `next/font/google` or `next/font/local` (downloaded fonts are in `public/fonts/`) — families/weights from `tokens.json`+2. **`globals.css`**: map the target's palette onto the shadcn `:root` token names; add custom properties for colors that don't map; add global keyframes, scroll-snap, smooth-scroll setup found in recon+3. **TypeScript interfaces** in `src/types/` for the content structures you observed+4. **Icons**: convert the deduplicated `inlineSvgs` from `assets.json` into named components in `src/components/icons.tsx` (named by function: `LogoIcon`, `ArrowRightIcon`…)+5. **SEO**: favicons/OG from `public/seo/` wired into `layout.tsx` metadata+6. Verify `npm run build`, then build **shared chrome** (header/footer) first — full spec → lint → builder cycle like any section, since every page depends on them.++## Phase 3 — Per-Section Loop (extract → spec → lint → dispatch → merge)++Work through `manifest.mjs next` until no sections remain. For each section:++### 3a. Extract++**The default state is already extracted** — Phase 1's page.mjs run wrote+`sections/<name>.json`, `responsive.json`, and all screenshots.++**First time you enter Phase 3 for a page, probe ALL its sections in ONE call** (3+page loads total instead of 3 per section — never probe section-by-section):++```bash+node scripts/extract/probe.mjs --route <r> # every registered section + probe-<section>.json each+# add key children in the same call when a spec will need them:+node scripts/extract/probe.mjs --route <r> --selector "<sel> h2" --selector "<sel> .card"+```++Slice the per-section tables into each spec's Responsive section as you write it.+Per section, only one thing remains:++```bash+# Per discovered behavior — one call per state (batch selectors sharing a trigger):+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-hover --state hover:".card"+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-scrolled --state scroll:600+# per tab/pill state: --state click:".tab-2" etc. EVERY state, not just the default.+```+State captures wait for the section's actual transition duration, so a slow fade is+recorded at its end value, not mid-flight — check `settleMs` in the output if a diff+looks wrong. The `diff` array covers `::before`/`::after` too, which is where hover+overlays usually live. Cross-check discovered behaviors against `css.json`'s+`interactiveStates` — a :hover rule in the stylesheet with no captured state means+the extraction is not done.++Mark: `manifest.mjs set --route <r> --section <name> --stage extracted`++### 3b. Write the spec — `docs/research/components/<route-slug>/<name>.spec.md`++```markdown+---+component: HeroSection+target: src/components/HeroSection.tsx+page: /+screenshot: docs/design-references/<host>/<name>-pc.png+interaction_model: static | click-driven | scroll-driven | hover-driven | time-driven | mixed+states: default, hover, scrolled…+assets: public/images/x.webp, icons:ArrowRightIcon+responsive: phone, ipad, pc+---++# <Component> Specification++## DOM Structure+<hierarchy from the section walker — what contains what>++## Computed Styles+<exact values from sections/<name>.json, per element. Never estimated.>++## States & Behaviors+<per behavior: Trigger / State A / State B / Transition — from the --state diffs.+ Include the implementation approach (CSS transition, IntersectionObserver, etc.)>++## Per-State Content+<for tabbed/stateful sections: full content per state. "N/A — static" otherwise>++## Assets+<local public/ paths + icon components used. Note layered compositions explicitly.>++## Text Content+<verbatim from the walker output — never paraphrased>++## Responsive Behavior+<from responsive.json: real column counts and changes at 390 / 768 / 1440 + breakpoint>+```++### 3c. Lint gate+```bash+node scripts/lint-spec.mjs docs/research/components/<route-slug>/<name>.spec.md+```+Fails → extract more. Passes → `manifest.mjs set … --stage specd` and dispatch.++### 3d. Dispatch builder agent (worktree)++Every builder receives IN ITS PROMPT (never "go read the file"):+- The **full spec file contents inline**+- The screenshot paths (all 3 viewports)+- Shared imports available: `cn()`, `icons.tsx` components, shadcn `ui/` primitives, types from `src/types/`+- The target file path, and the data file to create in `src/data/` if the section has content collections+- The rule: verify `npx tsc --noEmit` passes before finishing+- **The ground-truth rule:** "`docs/research/<host>/sections/<name>.json` and `responsive.json` are ground truth. If this spec contradicts them, follow the JSON and report the discrepancy." Builders reliably catch spec errors this way — treat their reports as corrections to make to the spec file.++Complex section (3+ distinct sub-components) → one builder per sub-component + one for the wrapper, sub-components first. **Don't wait** — while builders run, extract the next section.++### 3e. Merge+As builders finish: merge worktree → `npm run typecheck && npm run lint` → fix errors immediately → `manifest.mjs set … --stage merged`. tsc catches the cross-worktree breaks (imports, prop types) that per-merge builds used to catch, in a fraction of the time.++**Once, after roughly half the page's sections are merged: run a full `npm run build` checkpoint.** It catches build-only failures (server/client component violations, route exports, metadata) while they're still cheap to bisect. Don't build after every merge.++## Phase 4 — Page Assembly++Per page: create `src/app/<route>/page.tsx` importing its section components with data from `src/data/`, plus page-level behaviors (scroll-snap, observers, smooth scroll). Shared chrome mounts in `layout.tsx` or a route group layout. Wire internal nav links to the cloned routes. `npm run build` must pass.++## Phase 5 — Scored QA Loop++Start the clone: `npm run dev` (background). Then **score the whole page's sections in ONE batched call** (one load per side per viewport instead of one per section):++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --route <r> --viewport all+node scripts/manifest.mjs set --route <r> --section <name> --score pc=<match> # per section × viewport+```++**Fix iterations stay single-section** — the original-side shots captured by the sweep are cached, so a re-diff only re-renders the clone:++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --selector "<sel>" --viewport all --name <name>+```++- **Pass = ≥95% on all three viewports** → `--stage qa_passed`+- Below 95% → **read the band breakdown first**: it names the y-range where the mismatch lives, so you inspect that band of the diff image in `docs/research/qa/` instead of eyeballing the whole section. Then check the spec (wrong extraction → re-extract and fix; right spec, wrong build → fix component), re-diff+- A large height mismatch reported by diff.mjs = missing content or wrong spacing — fix before pixel-tweaking+- Max 3 fix iterations per section, then record the gap honestly and move on+- **Text-heavy sections at phone width often plateau at 90–95%** when the target's font isn't available on Google Fonts (e.g. Source Sans Pro → Source Sans 3). Different metrics = different wrap points = unavoidable pixel drift. Confirm the layout matches, note the substitution, and accept it.+- **A score that's high at pc but low at ipad/phone is always a responsive-spec problem**, not a styling bug. Re-run `probe.mjs` on the section and fill in the values the spec was missing.+- Finally, test behaviors manually: scroll, click every tab, hover — screenshots can't verify motion; you must++Whole-page diffs (`--selector` omitted) at all 3 viewports close out each page.++## What NOT to Do++- **Don't build click-tabs when the original is scroll-driven** (or vice versa). Scroll first, watch, then click. Wrong model = rewrite.+- **Don't extract only the default state.** Every tab clicked, every hover captured, header at scroll 0 AND past the trigger.+- **Don't miss layered/overlay images** — check `siblingImgs` and z-index hints in `assets.json`.+- **Don't build HTML mockups of things that are actually `<video>`, Lottie, or canvas.** Check first.+- **Don't approximate ("looks like text-lg").** Use the walker's exact computed values; use arbitrary values (`text-[17px]`) when Tailwind's scale doesn't match.+- **Don't dispatch a builder without a lint-passing spec.** No exceptions — that's the whole quality model.+- **Don't reference docs from builder prompts** — spec contents go inline.+- **Don't skip the manifest updates.** An untracked run can't resume.+- **Don't hardcode content in components.** Content → `src/data/`, components take props.+- **Don't write "same as desktop" in a Responsive section.** Root font-size steps at breakpoints on most real sites, so every number changes. Run `probe.mjs` and write the real values for all three widths — lint-spec now rejects vague responsive sections.+- **Don't forget `::before` / `::after`.** They carry hero overlays, heading underline bars, and icon glyphs. `section.mjs` captures them under a `pseudo` key — if a spec has none and the screenshot shows decorations, extraction was incomplete.+- **Don't trust the spec over the extraction JSON.** Specs are hand-written summaries and drift; `sections/*.json` is machine-measured.+- **Don't declare done without QA scores.** "Looks right" is not a number.++## Completion Report++- Pages cloned (routes) · sections built · spec files written (must match section count)+- Assets downloaded (from `assets.json` download log, including failures)+- Final QA score table per section × viewport (from `manifest.mjs status`)+- `npm run build` result+- Known gaps and any section that couldn't reach 95%+- Suggest next step: `/restyle` to rebrand the clone with your own identitydiff --git a/.cursor/commands/restyle.md b/.cursor/commands/restyle.mdnew file mode 100644index 0000000..b973791--- /dev/null+++ b/.cursor/commands/restyle.md@@ -0,0 +1,47 @@+<!-- GENERATED from .claude/skills/restyle/SKILL.md by scripts/sync-skills.mjs — edit the source,+ then run: node scripts/sync-skills.mjs -->++# Restyle++> Rebrand a cloned website with your own colors, fonts, logo, and copy while keeping the layout pixel-intact++Turn the cloned site into **the user's site**: their brand, their words, their logo — on top of the cloned structure. Layout, spacing, animations, and interactions stay untouched. That separation works because the clone pipeline keeps all content in `src/data/*.ts` and all brand tokens in `globals.css` — you swap those layers only.++Honor any extra instructions the user provided when invoking this command.++## Step 1 — Read the brand++Read `BRAND.md` at the repo root. If it's missing or has unfilled `TODO` fields, ask the user for what's missing (max 3 questions at a time). Never ask for secrets in chat — anything sensitive belongs in env files, not BRAND.md.++If the user has brand assets (logo files, product screenshots), ask them to drop the files into `public/brand/` and tell you the filenames.++## Step 2 — Take "before" screenshots++```bash+npm run dev # background+node scripts/extract/screenshot.mjs http://localhost:3000 --name before-restyle+```+These are your regression reference: after restyling, layout must still match them structurally.++## Step 3 — Swap the brand layers (in this order)++1. **Colors** — `src/app/globals.css`: replace the cloned palette in `:root` / `.dark` with the brand colors from BRAND.md. Keep the same token *names* so no component changes. Preserve relative contrast: if the original had a dark section, keep it dark in the new palette.+2. **Fonts** — `src/app/layout.tsx`: swap `next/font` families to the brand fonts. Keep the size/weight structure the clone extracted — only families change.+3. **Logo & icons** — replace `LogoIcon` in `src/components/icons.tsx` (or the logo `<img>` asset) with the brand logo from `public/brand/`. Keep the rendered dimensions of the original logo so the header layout doesn't shift.+4. **Favicons & SEO** — regenerate `public/seo/` (favicon, apple-touch-icon, OG image if provided), update `layout.tsx` metadata: title, description, OG tags — from BRAND.md positioning.+5. **Copy** — rewrite every string in `src/data/*.ts` for the brand: same structure, same approximate length (±20% — long copy breaks cloned layouts), brand voice from BRAND.md. Headlines sell the user's offer, not the original company's. Placeholder patterns like testimonials get realistic brand-appropriate content clearly marked as placeholders unless BRAND.md provides real ones.+6. **Images** — where the clone shows the original company's product shots, swap in files from `public/brand/` if provided; otherwise leave the cloned image and list it in the report as "needs replacement".++## Step 4 — Verify++1. `npm run build` — must pass+2. `node scripts/extract/screenshot.mjs http://localhost:3000 --name after-restyle`+3. Compare before/after at all 3 viewports: layout identical, only brand layers changed. Overflowing text = shorten the copy, never change the layout.+4. Check every page route, not just `/`.++## Report++- What was swapped (colors, fonts, logo, favicon, N copy blocks across M data files)+- Images still showing the original site's content (need user-provided replacements)+- Any copy that had to be shortened/lengthened to fit+- Anything in BRAND.md still marked TODOdiff --git a/.cursor/rules/project.mdc b/.cursor/rules/project.mdcnew file mode 100644index 0000000..5ee6f7c--- /dev/null+++ b/.cursor/rules/project.mdc@@ -0,0 +1,7 @@+---+description: Project conventions — see AGENTS.md for full details+alwaysApply: true+---++This project uses AGENTS.md as the single source of truth for all AI agent instructions.+Cursor reads AGENTS.md automatically — see the project root for complete guidelines.diff --git a/.dockerignore b/.dockerignorenew file mode 100644index 0000000..a9396cd--- /dev/null+++ b/.dockerignore@@ -0,0 +1,70 @@+# Dependencies (reinstalled inside Docker)+node_modules+npm-debug.log*+yarn-debug.log*++# Build output+.next+out+build+dist+*.tsbuildinfo++# Git / GitHub+.git+.gitignore+.github++# Environment files (pass via docker-compose env_file or runtime env vars)+.env+.env.local+.env.*.local++# Editor / OS+.vscode+.idea+.DS_Store+Thumbs.db+*.swp+*.swo++# Agent / AI tool configs (not needed at build or runtime)+.claude+.codex+.cursor+.windsurf+.gemini+.continue+.amazonq+.augment+.opencode+.aider.conf.yml+.clinerules+.windsurfrules+AGENTS.md+CLAUDE.md+GEMINI.md+.github/copilot-instructions.md++# Extraction artifacts and reference material (dev-time only, can be large)+docs/research+docs/design-references+examples++# Extraction/QA scripts (dev container bind-mounts the repo, so it still sees them)+scripts++# NOTE: public/ is intentionally NOT excluded — the cloned site's downloaded+# assets (images, fonts, videos) live there and must ship with the build.++# Docker files themselves+Dockerfile+Dockerfile.dev+docker-compose.yml+.dockerignore++# Repo meta (not needed inside the image)+README.md+CHANGELOG.md+LICENSE+BRAND.mddiff --git a/.gemini/commands/clone-website.toml b/.gemini/commands/clone-website.tomlnew file mode 100644index 0000000..bdac1e7--- /dev/null+++ b/.gemini/commands/clone-website.toml@@ -0,0 +1,250 @@+# GENERATED from .claude/skills/clone-website/SKILL.md by scripts/sync-skills.mjs — edit the source,+# then run: node scripts/sync-skills.mjs++description = "Reverse-engineer and clone a full multi-page website as a pixel-accurate Next.js replica"+name = "clone-website"++prompt = '''+# Clone Website++Reverse-engineer and rebuild **{{args}}** as a pixel-accurate, multi-page Next.js clone.++You are a **foreman walking the job site**: scripts do the measuring, you do the judgment, specs are the contract, builder agents do the construction, and the pixel-diff score decides when you're done. Extraction and construction overlap — dispatch builders as soon as a section's spec passes lint, then keep extracting.++## Resume Check (ALWAYS FIRST)++```bash+node scripts/manifest.mjs status+```++If a manifest exists, this is a **resumed run**: skip everything already done (`node scripts/manifest.mjs next` tells you where to continue). If not, this is a fresh run — start at Phase 0.++## Scope Defaults++- **Fidelity:** pixel-accurate — colors, spacing, typography, animations, interactions+- **In scope:** every confirmed page, visual layout, component structure, interactions, responsive behavior (phone 390 / iPad 768 / PC 1440), real content and assets+- **Out of scope:** real backend, auth, databases, forms that actually submit (mock them)+- **Content goes in `src/data/*.ts`** — components take props; page files wire data to components. This keeps the clone restylable later (see `/restyle`).++User-provided instructions override these defaults.++## Tooling++The scripts do the mechanical work — **use them instead of hand-measuring via browser MCP**:++| Script | Purpose |+|---|---|+| **`node scripts/extract/page.mjs <url> [--no-site-files]`** | **THE WORKHORSE — one call, 3 page loads total.** Auto-detects sections, then produces `tokens.json` + `css.json` (skip on later pages with `--no-site-files`), `assets.json` + downloads to `public/`, `responsive.json` (all 3 viewports), a full computed-style walk per section (`sections/<name>.json`), and full-page **and** per-section screenshots at phone/iPad/PC. Accepts explicit `--selector "css" --name x` pairs to override detection. Everything is measured from the SAME page state, so numbers, walks and screenshots can never disagree |+| `node scripts/extract/crawl.mjs <url> [--max 25]` | Discover pages (sitemap + nav links) → `docs/research/<host>/sitemap.json` |+| `node scripts/extract/section.mjs <url> --selector "css" [--name x] --state scroll:600\|click:sel\|hover:sel [--viewport pc\|ipad\|phone]` | **State captures** (page.mjs covers the default state). Captures a second state and diffs them (element styles *and* `::before`/`::after`), waiting for the section's real transition duration. `--selector`/`--name` repeat — one page load for all |+| `node scripts/extract/probe.mjs <url> --selector "css" [--selector "css2"] [--props a,b,c]` / `probe.mjs --route </r>` | Exact computed values for specific selectors at all 3 viewports, as a markdown table with a **varies** column — paste straight into a spec's Responsive section. **`--route` probes EVERY registered section of a page in one call (3 loads total, plus a `probe-<section>.json` per section) — never probe section-by-section** |+| `node scripts/extract/screenshot.mjs <url> [--selector css --name x ...]` | Extra screenshots at phone/iPad/PC (page.mjs already shot everything once). `--selector`/`--name` repeat — one call, 3 loads, N sections |+| `node scripts/extract/tokens.mjs` / `css.mjs` / `assets.mjs` / `responsive.mjs` | Single-purpose re-runs of one page.mjs output when something needs refreshing |+| `node scripts/diff.mjs --original <url> --clone <url> [--selector css] --viewport all [--threshold 95]` | Scored pixel diff, original vs clone. **`--viewport all` scores pc+ipad+phone in one call**, and the per-viewport **band breakdown names the y-range where the mismatch lives** — read it before guessing at causes. **Batched sweep: `--route </r>` (or repeated `--section name=css`) scores every section of a page from ONE load per side per viewport.** Original-side shots are cached 24h, so fix-iteration re-diffs only re-render the clone (`--fresh-original` to override) |+| `node scripts/lint-spec.mjs <spec.md\|dir>` | Mechanical spec-completeness gate — must pass before ANY builder dispatch |+| `node scripts/manifest.mjs <cmd>` | Pipeline state: init / add-page / add-section / set / status / next |++Browser MCP (Chrome MCP, Playwright MCP — if available) is for **judgment work only**: watching how the page behaves while scrolling, exploring what's clickable, understanding an animation. Numbers always come from the scripts. If no browser MCP is available, the scripts alone are sufficient — use extra `screenshot.mjs` and `section.mjs --state` calls to observe behavior.++The scripts are plain Node CLIs — any coding agent can run them. Playwright's Chromium auto-installs on the first script run (or run `npm run setup` once). If your tool has no subagent/worktree support, skip the dispatch mechanics and build each section yourself, sequentially, from the same lint-passing specs — every quality gate still applies.++## Guiding Principles++1. **Completeness beats speed.** A builder that has to guess a color, font size, or padding value means extraction failed. Extract one more property rather than ship an incomplete spec.+2. **Small tasks, perfect results.** One focused component per builder. Spec body over 150 lines = split the section (lint-spec enforces this).+3. **Real content, real assets.** Actual text via the section walker, actual files via `assets.mjs`. Watch for **layered images** — a hero that looks like one image is often background + overlay + foreground; `assets.json` records sibling counts and z-index for exactly this reason.+4. **Foundation first.** Tokens, fonts, types, icons, and shared chrome (header/footer) before any page section.+5. **Extract how it looks AND how it behaves.** Every interactive element needs before/after states with exact values — `section.mjs --state` produces the diff mechanically.+6. **Identify the interaction model before building.** Scroll-driven vs click-driven confusion is the most expensive mistake in cloning — a wrong call means a rewrite, not a CSS fix. Scroll first without clicking and watch; only then click. Record the model in the spec frontmatter.+7. **Responsive is measured, never guessed — at all three widths.** Fill every spec's Responsive section from `responsive.json` + `probe.mjs`, with real numbers for phone AND iPad AND pc. Never write "iPad: same as desktop": most production sites step their root font-size at breakpoints, so *every* padding, margin, and font size changes even when the layout looks identical. A spec that only nails desktop produces a clone that scores ~98% at 1440px and ~91% at 390px. `lint-spec.mjs` rejects vague responsive sections.++8. **The extraction JSON is ground truth; the spec is a summary of it.** If a builder finds the spec disagreeing with `sections/<name>.json` or `responsive.json`, the JSON wins — say so explicitly in every builder prompt and have the builder report the discrepancy so you can correct the spec.+9. **Spec files are the contract.** No spec → no builder. lint-spec must pass → then dispatch.+10. **The build must always compile.** Builders verify `npx tsc --noEmit`; you verify `npm run typecheck && npm run lint` after every merge. Full `npm run build` runs only at checkpoints (Phase 0, end of Phase 2, once mid-way through Phase 3, Phase 4, completion) — it takes 30–60s and running it per merge serializes otherwise-parallel builders.+11. **The manifest is updated at every stage transition.** That's what makes the run resumable.++## Phase 0 — Crawl & Scope++1. Verify the base builds: `npm run build`.+2. `node scripts/extract/crawl.mjs <url> --max 25`+3. Show the user the discovered pages (route + source). **Ask which to clone** — recommend: start page + nav pages, skip legal/utility pages unless asked. Default cap ~10.+4. Initialize state:+ ```bash+ node scripts/manifest.mjs init <url>+ node scripts/manifest.mjs add-page --url <url> --route / # per confirmed page+ ```++## Phase 1 — Recon (one page.mjs call per page)++1. **First page:** `node scripts/extract/page.mjs <start-url>` — produces tokens, css, assets+downloads, responsive signatures, per-section walks, and every screenshot in one shot (3 page loads).+2. **Every other confirmed page:** `node scripts/extract/page.mjs <url> --no-site-files` (tokens/css are site-wide; everything else is per-page). Downloads dedupe across pages automatically — files already in `public/` are skipped.+3. **Review the detected sections** in each run's stdout summary (name, selector, pc height, headline responsive change). Detection is a heuristic: if a "section" is really two, or two are really one, re-run with explicit `--selector "css" --name x` pairs. Section names become spec/component names — rename `section-3` style fallbacks to something meaningful via `--name`.+4. **Interaction sweep** (judgment work — browser MCP if available): scroll each page slowly top to bottom. Does the header change? Do elements animate in? Auto-switching tabs? Scroll-snap? Smooth-scroll lib (`tokens.json` flags `.lenis`/Locomotive)? Then click every tab/pill/accordion and note what changes. Then hover. `css.json`'s `interactiveStates` lists every :hover/:focus rule the stylesheet defines — use it as the checklist of what to probe. Record findings in `docs/research/<host>/BEHAVIORS.md`.+5. **Shared chrome detection:** compare screenshots across pages — header/nav/footer that repeat become SHARED components (`SiteHeader`, `SiteFooter`), extracted once from the page where they're most complete.++**Per page — topology:** map every distinct section top to bottom with a working name, its selector, its interaction model (static / click-driven / scroll-driven / hover-driven / time-driven / mixed), and layer notes (sticky? overlay? z-index?). Save `docs/research/<host>/PAGE_TOPOLOGY.md`, then register each section:+```bash+node scripts/manifest.mjs add-section --route / --name hero --selector "section.hero"+```++## Phase 2 — Foundation (sequential, you do it yourself)++1. **Fonts** in `src/app/layout.tsx` via `next/font/google` or `next/font/local` (downloaded fonts are in `public/fonts/`) — families/weights from `tokens.json`+2. **`globals.css`**: map the target's palette onto the shadcn `:root` token names; add custom properties for colors that don't map; add global keyframes, scroll-snap, smooth-scroll setup found in recon+3. **TypeScript interfaces** in `src/types/` for the content structures you observed+4. **Icons**: convert the deduplicated `inlineSvgs` from `assets.json` into named components in `src/components/icons.tsx` (named by function: `LogoIcon`, `ArrowRightIcon`…)+5. **SEO**: favicons/OG from `public/seo/` wired into `layout.tsx` metadata+6. Verify `npm run build`, then build **shared chrome** (header/footer) first — full spec → lint → builder cycle like any section, since every page depends on them.++## Phase 3 — Per-Section Loop (extract → spec → lint → dispatch → merge)++Work through `manifest.mjs next` until no sections remain. For each section:++### 3a. Extract++**The default state is already extracted** — Phase 1's page.mjs run wrote+`sections/<name>.json`, `responsive.json`, and all screenshots.++**First time you enter Phase 3 for a page, probe ALL its sections in ONE call** (3+page loads total instead of 3 per section — never probe section-by-section):++```bash+node scripts/extract/probe.mjs --route <r> # every registered section + probe-<section>.json each+# add key children in the same call when a spec will need them:+node scripts/extract/probe.mjs --route <r> --selector "<sel> h2" --selector "<sel> .card"+```++Slice the per-section tables into each spec's Responsive section as you write it.+Per section, only one thing remains:++```bash+# Per discovered behavior — one call per state (batch selectors sharing a trigger):+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-hover --state hover:".card"+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-scrolled --state scroll:600+# per tab/pill state: --state click:".tab-2" etc. EVERY state, not just the default.+```+State captures wait for the section's actual transition duration, so a slow fade is+recorded at its end value, not mid-flight — check `settleMs` in the output if a diff+looks wrong. The `diff` array covers `::before`/`::after` too, which is where hover+overlays usually live. Cross-check discovered behaviors against `css.json`'s+`interactiveStates` — a :hover rule in the stylesheet with no captured state means+the extraction is not done.++Mark: `manifest.mjs set --route <r> --section <name> --stage extracted`++### 3b. Write the spec — `docs/research/components/<route-slug>/<name>.spec.md`++```markdown+---+component: HeroSection+target: src/components/HeroSection.tsx+page: /+screenshot: docs/design-references/<host>/<name>-pc.png+interaction_model: static | click-driven | scroll-driven | hover-driven | time-driven | mixed+states: default, hover, scrolled…+assets: public/images/x.webp, icons:ArrowRightIcon+responsive: phone, ipad, pc+---++# <Component> Specification++## DOM Structure+<hierarchy from the section walker — what contains what>++## Computed Styles+<exact values from sections/<name>.json, per element. Never estimated.>++## States & Behaviors+<per behavior: Trigger / State A / State B / Transition — from the --state diffs.+ Include the implementation approach (CSS transition, IntersectionObserver, etc.)>++## Per-State Content+<for tabbed/stateful sections: full content per state. "N/A — static" otherwise>++## Assets+<local public/ paths + icon components used. Note layered compositions explicitly.>++## Text Content+<verbatim from the walker output — never paraphrased>++## Responsive Behavior+<from responsive.json: real column counts and changes at 390 / 768 / 1440 + breakpoint>+```++### 3c. Lint gate+```bash+node scripts/lint-spec.mjs docs/research/components/<route-slug>/<name>.spec.md+```+Fails → extract more. Passes → `manifest.mjs set … --stage specd` and dispatch.++### 3d. Dispatch builder agent (worktree)++Every builder receives IN ITS PROMPT (never "go read the file"):+- The **full spec file contents inline**+- The screenshot paths (all 3 viewports)+- Shared imports available: `cn()`, `icons.tsx` components, shadcn `ui/` primitives, types from `src/types/`+- The target file path, and the data file to create in `src/data/` if the section has content collections+- The rule: verify `npx tsc --noEmit` passes before finishing+- **The ground-truth rule:** "`docs/research/<host>/sections/<name>.json` and `responsive.json` are ground truth. If this spec contradicts them, follow the JSON and report the discrepancy." Builders reliably catch spec errors this way — treat their reports as corrections to make to the spec file.++Complex section (3+ distinct sub-components) → one builder per sub-component + one for the wrapper, sub-components first. **Don't wait** — while builders run, extract the next section.++### 3e. Merge+As builders finish: merge worktree → `npm run typecheck && npm run lint` → fix errors immediately → `manifest.mjs set … --stage merged`. tsc catches the cross-worktree breaks (imports, prop types) that per-merge builds used to catch, in a fraction of the time.++**Once, after roughly half the page's sections are merged: run a full `npm run build` checkpoint.** It catches build-only failures (server/client component violations, route exports, metadata) while they're still cheap to bisect. Don't build after every merge.++## Phase 4 — Page Assembly++Per page: create `src/app/<route>/page.tsx` importing its section components with data from `src/data/`, plus page-level behaviors (scroll-snap, observers, smooth scroll). Shared chrome mounts in `layout.tsx` or a route group layout. Wire internal nav links to the cloned routes. `npm run build` must pass.++## Phase 5 — Scored QA Loop++Start the clone: `npm run dev` (background). Then **score the whole page's sections in ONE batched call** (one load per side per viewport instead of one per section):++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --route <r> --viewport all+node scripts/manifest.mjs set --route <r> --section <name> --score pc=<match> # per section × viewport+```++**Fix iterations stay single-section** — the original-side shots captured by the sweep are cached, so a re-diff only re-renders the clone:++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --selector "<sel>" --viewport all --name <name>+```++- **Pass = ≥95% on all three viewports** → `--stage qa_passed`+- Below 95% → **read the band breakdown first**: it names the y-range where the mismatch lives, so you inspect that band of the diff image in `docs/research/qa/` instead of eyeballing the whole section. Then check the spec (wrong extraction → re-extract and fix; right spec, wrong build → fix component), re-diff+- A large height mismatch reported by diff.mjs = missing content or wrong spacing — fix before pixel-tweaking+- Max 3 fix iterations per section, then record the gap honestly and move on+- **Text-heavy sections at phone width often plateau at 90–95%** when the target's font isn't available on Google Fonts (e.g. Source Sans Pro → Source Sans 3). Different metrics = different wrap points = unavoidable pixel drift. Confirm the layout matches, note the substitution, and accept it.+- **A score that's high at pc but low at ipad/phone is always a responsive-spec problem**, not a styling bug. Re-run `probe.mjs` on the section and fill in the values the spec was missing.+- Finally, test behaviors manually: scroll, click every tab, hover — screenshots can't verify motion; you must++Whole-page diffs (`--selector` omitted) at all 3 viewports close out each page.++## What NOT to Do++- **Don't build click-tabs when the original is scroll-driven** (or vice versa). Scroll first, watch, then click. Wrong model = rewrite.+- **Don't extract only the default state.** Every tab clicked, every hover captured, header at scroll 0 AND past the trigger.+- **Don't miss layered/overlay images** — check `siblingImgs` and z-index hints in `assets.json`.+- **Don't build HTML mockups of things that are actually `<video>`, Lottie, or canvas.** Check first.+- **Don't approximate ("looks like text-lg").** Use the walker's exact computed values; use arbitrary values (`text-[17px]`) when Tailwind's scale doesn't match.+- **Don't dispatch a builder without a lint-passing spec.** No exceptions — that's the whole quality model.+- **Don't reference docs from builder prompts** — spec contents go inline.+- **Don't skip the manifest updates.** An untracked run can't resume.+- **Don't hardcode content in components.** Content → `src/data/`, components take props.+- **Don't write "same as desktop" in a Responsive section.** Root font-size steps at breakpoints on most real sites, so every number changes. Run `probe.mjs` and write the real values for all three widths — lint-spec now rejects vague responsive sections.+- **Don't forget `::before` / `::after`.** They carry hero overlays, heading underline bars, and icon glyphs. `section.mjs` captures them under a `pseudo` key — if a spec has none and the screenshot shows decorations, extraction was incomplete.+- **Don't trust the spec over the extraction JSON.** Specs are hand-written summaries and drift; `sections/*.json` is machine-measured.+- **Don't declare done without QA scores.** "Looks right" is not a number.++## Completion Report++- Pages cloned (routes) · sections built · spec files written (must match section count)+- Assets downloaded (from `assets.json` download log, including failures)+- Final QA score table per section × viewport (from `manifest.mjs status`)+- `npm run build` result+- Known gaps and any section that couldn't reach 95%+- Suggest next step: `/restyle` to rebrand the clone with your own identity+'''diff --git a/.gemini/commands/restyle.toml b/.gemini/commands/restyle.tomlnew file mode 100644index 0000000..cc3b87f--- /dev/null+++ b/.gemini/commands/restyle.toml@@ -0,0 +1,50 @@+# GENERATED from .claude/skills/restyle/SKILL.md by scripts/sync-skills.mjs — edit the source,+# then run: node scripts/sync-skills.mjs++description = "Rebrand a cloned website with your own colors, fonts, logo, and copy while keeping the layout pixel-intact"+name = "restyle"++prompt = '''+# Restyle++Turn the cloned site into **the user's site**: their brand, their words, their logo — on top of the cloned structure. Layout, spacing, animations, and interactions stay untouched. That separation works because the clone pipeline keeps all content in `src/data/*.ts` and all brand tokens in `globals.css` — you swap those layers only.++{{args}}++## Step 1 — Read the brand++Read `BRAND.md` at the repo root. If it's missing or has unfilled `TODO` fields, ask the user for what's missing (max 3 questions at a time). Never ask for secrets in chat — anything sensitive belongs in env files, not BRAND.md.++If the user has brand assets (logo files, product screenshots), ask them to drop the files into `public/brand/` and tell you the filenames.++## Step 2 — Take "before" screenshots++```bash+npm run dev # background+node scripts/extract/screenshot.mjs http://localhost:3000 --name before-restyle+```+These are your regression reference: after restyling, layout must still match them structurally.++## Step 3 — Swap the brand layers (in this order)++1. **Colors** — `src/app/globals.css`: replace the cloned palette in `:root` / `.dark` with the brand colors from BRAND.md. Keep the same token *names* so no component changes. Preserve relative contrast: if the original had a dark section, keep it dark in the new palette.+2. **Fonts** — `src/app/layout.tsx`: swap `next/font` families to the brand fonts. Keep the size/weight structure the clone extracted — only families change.+3. **Logo & icons** — replace `LogoIcon` in `src/components/icons.tsx` (or the logo `<img>` asset) with the brand logo from `public/brand/`. Keep the rendered dimensions of the original logo so the header layout doesn't shift.+4. **Favicons & SEO** — regenerate `public/seo/` (favicon, apple-touch-icon, OG image if provided), update `layout.tsx` metadata: title, description, OG tags — from BRAND.md positioning.+5. **Copy** — rewrite every string in `src/data/*.ts` for the brand: same structure, same approximate length (±20% — long copy breaks cloned layouts), brand voice from BRAND.md. Headlines sell the user's offer, not the original company's. Placeholder patterns like testimonials get realistic brand-appropriate content clearly marked as placeholders unless BRAND.md provides real ones.+6. **Images** — where the clone shows the original company's product shots, swap in files from `public/brand/` if provided; otherwise leave the cloned image and list it in the report as "needs replacement".++## Step 4 — Verify++1. `npm run build` — must pass+2. `node scripts/extract/screenshot.mjs http://localhost:3000 --name after-restyle`+3. Compare before/after at all 3 viewports: layout identical, only brand layers changed. Overflowing text = shorten the copy, never change the layout.+4. Check every page route, not just `/`.++## Report++- What was swapped (colors, fonts, logo, favicon, N copy blocks across M data files)+- Images still showing the original site's content (need user-provided replacements)+- Any copy that had to be shortened/lengthened to fit+- Anything in BRAND.md still marked TODO+'''diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.ymlnew file mode 100644index 0000000..f6578c9--- /dev/null+++ b/.github/ISSUE_TEMPLATE/bug_report.yml@@ -0,0 +1,111 @@+name: Bug Report+description: Report a bug or unexpected behavior+title: "[Bug]: "+labels: ["bug"]+body:+ - type: markdown+ attributes:+ value: |+ Thanks for reporting a bug! Fill out the form below so we can reproduce and fix it.++ - type: textarea+ id: description+ attributes:+ label: Description+ description: A clear description of what went wrong.+ placeholder: What happened?+ validations:+ required: true++ - type: textarea+ id: reproduction+ attributes:+ label: Steps to Reproduce+ description: Step-by-step instructions to reproduce the behavior.+ placeholder: |+ 1. Run `/clone-website https://example.com`+ 2. Extraction finishes, builder agents start+ 3. See error in terminal...+ validations:+ required: true++ - type: input+ id: target-url+ attributes:+ label: Target URL+ description: The website you were cloning when the bug happened (if applicable).+ placeholder: https://example.com++ - type: dropdown+ id: phase+ attributes:+ label: Script / Phase That Failed+ description: Where in the pipeline did it break?+ options:+ - Crawl / route discovery (crawl.mjs)+ - Page recon / extraction (page.mjs, collectors.mjs)+ - Asset download (assets.mjs)+ - Spec writing / spec lint (lint-spec.mjs)+ - Builder agents (component build)+ - QA / pixel diff (diff.mjs)+ - Restyle (/restyle)+ - Next.js app itself (dev/build/runtime)+ - Docker (build or compose)+ - Other / not sure+ validations:+ required: true++ - type: input+ id: qa-score+ attributes:+ label: QA Score (if relevant)+ description: The score reported by the QA diff, if the bug is about visual accuracy.+ placeholder: e.g. 62/100 on /about at 1440px++ - type: dropdown+ id: agent-tool+ attributes:+ label: Agent Tool Used+ description: Which AI coding tool were you running the skills with?+ options:+ - Claude Code+ - Cursor+ - Windsurf+ - GitHub Copilot+ - Codex CLI+ - Gemini CLI+ - Cline / Roo Code+ - Continue+ - Amazon Q+ - Augment Code+ - OpenCode+ - Aider+ - Other+ validations:+ required: true++ - type: dropdown+ id: os+ attributes:+ label: Operating System+ options:+ - macOS+ - Windows+ - Linux+ validations:+ required: true++ - type: input+ id: node-version+ attributes:+ label: Node.js Version+ description: Run `node -v` to find this.+ placeholder: v22.x.x+ validations:+ required: true++ - type: textarea+ id: additional+ attributes:+ label: Additional Context+ description: Error output, `docs/research/manifest.json` state, screenshots — anything that helps.diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.ymlnew file mode 100644index 0000000..3ba13e0--- /dev/null+++ b/.github/ISSUE_TEMPLATE/config.yml@@ -0,0 +1 @@+blank_issues_enabled: falsediff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.ymlnew file mode 100644index 0000000..9722f33--- /dev/null+++ b/.github/ISSUE_TEMPLATE/feature_request.yml@@ -0,0 +1,52 @@+name: Feature Request+description: Suggest a new feature or improvement+title: "[Feature]: "+labels: ["enhancement"]+body:+ - type: markdown+ attributes:+ value: |+ Thanks for suggesting a feature! Describe the problem first, then your proposed solution.++ - type: textarea+ id: problem+ attributes:+ label: Problem+ description: What problem does this solve? What's missing or frustrating today?+ placeholder: "Cloning breaks down when the target site..."+ validations:+ required: true++ - type: textarea+ id: solution+ attributes:+ label: Proposed Solution+ description: How would you like this to work?+ validations:+ required: true++ - type: textarea+ id: alternatives+ attributes:+ label: Alternatives Considered+ description: Any other approaches you've thought about?++ - type: dropdown+ id: category+ attributes:+ label: Category+ options:+ - Extraction scripts (crawl, recon, assets, CSS)+ - Cloning pipeline / skills (/clone-website, /restyle)+ - QA / pixel diff scoring+ - Agent tool support (Cursor, Copilot, etc.)+ - Docker / deployment+ - Documentation+ - Developer experience+ - Other++ - type: textarea+ id: additional+ attributes:+ label: Additional Context+ description: Example sites, screenshots, links, or any other context.diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.mdnew file mode 100644index 0000000..f4ebdd4--- /dev/null+++ b/.github/PULL_REQUEST_TEMPLATE.md@@ -0,0 +1,8 @@+## Summary++<!-- What does this PR change, and why? -->++## Checklist++- [ ] `npm run check` passes (lint + typecheck + build)+- [ ] If `scripts/` changed: smoke-tested against a real site (name the site and phase in the summary)diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.mdnew file mode 100644index 0000000..91a49ee--- /dev/null+++ b/.github/copilot-instructions.md@@ -0,0 +1,69 @@+<!-- GENERATED from AGENTS.md by scripts/sync-skills.mjs — edit the source,+ then run: node scripts/sync-skills.mjs -->++# site-cloner++Template for cloning any multi-page website into this Next.js codebase, then rebranding it as your own. Two commands drive everything: `/clone-website <url>` and `/restyle`.++## Tech Stack++- **Next.js 16** — App Router, React 19, TypeScript strict+- **Tailwind CSS v4** + shadcn/ui (base-ui primitives), oklch tokens in `src/app/globals.css`+- **Lucide React** icons (replaced by extracted SVGs in `src/components/icons.tsx` during cloning)+- **Playwright** (devDependency) powers all extraction/QA scripts++## Commands++- `npm run dev` / `npm run build` / `npm run lint` / `npm run typecheck`+- `npm run check` — lint + typecheck + build (must pass before any commit)++## Architecture Rules++- **Content lives in `src/data/*.ts`, never hardcoded in components.** Components take props. This is what makes `/restyle` possible — copy swaps without touching layout.+- Pages: `src/app/<route>/page.tsx` wires data → components. Shared header/footer mount in layouts.+- `docs/research/` holds extraction artifacts (JSON, specs, manifest) — auditable, never hand-edited except spec files.+- `docs/research/manifest.json` is the pipeline state. Update it at every stage transition; check it first on any clone-related task (`node scripts/manifest.mjs status`).+- Specs (`docs/research/components/**/*.spec.md`) must pass `node scripts/lint-spec.mjs` before any builder agent is dispatched.+- All extraction numbers come from `scripts/` (computed styles, real column counts, pixel diffs) — never estimated by eye.++## Code Style++- TypeScript strict, no `any`+- Named exports, PascalCase components, camelCase utils+- Tailwind utility classes; arbitrary values (`text-[17px]`) when the extracted value doesn't match Tailwind's scale+- 2-space indentation++## Skills / Commands++Two workflows, each with a single source of truth in `.claude/skills/<name>/SKILL.md`:++| Command | Purpose |+|---|---|+| `/clone-website <url>` | Crawl, extract, spec, build, and pixel-diff QA a full multi-page clone |+| `/restyle` | Swap colors, fonts, logo, and copy for your brand — layout stays intact |++Where your tool finds them (all generated from the same source):++- **Claude Code:** `.claude/skills/<name>/SKILL.md`+- **Codex CLI:** `.codex/skills/<name>/SKILL.md`+- **GitHub Copilot coding agent:** `.github/skills/<name>/SKILL.md`+- **Cursor:** `.cursor/commands/<name>.md`+- **Windsurf:** `.windsurf/workflows/<name>.md`+- **Gemini CLI:** `.gemini/commands/<name>.toml`+- **OpenCode:** `.opencode/commands/<name>.md`+- **Continue:** `.continue/commands/<name>.md`+- **Augment Code:** `.augment/commands/<name>.md`+- **Amazon Q Developer CLI:** `.amazonq/cli-agents/<name>.json`+- **Cline / Roo Code, Aider, anything else:** open `.claude/skills/<name>/SKILL.md` and follow it as a prompt.++The extraction scripts are plain Node CLIs any agent can run; Chromium auto-installs on first use (or `npm run setup`). No subagent support in your tool? Build sections sequentially from the same lint-passing specs.++## Ethics++Clone sites you own or have permission to rebuild (platform migration, lost source, learning). Never for phishing, impersonation, or passing off someone's design as your own.++## Keeping Agent Configs in Sync++- `.claude/skills/*/SKILL.md` and this file (`AGENTS.md`) are the only sources of truth for per-tool configs.+- After editing either, run `node scripts/sync-skills.mjs` to regenerate every per-tool copy.+- Generated files are committed; CI runs `node scripts/sync-skills.mjs --check` and fails if any are stale.diff --git a/.github/skills/clone-website/SKILL.md b/.github/skills/clone-website/SKILL.mdnew file mode 100644index 0000000..fbdaa84--- /dev/null+++ b/.github/skills/clone-website/SKILL.md@@ -0,0 +1,249 @@+---+name: clone-website+description: Reverse-engineer and clone a full multi-page website into this Next.js codebase — crawls pages, runs scripted extraction (tokens, assets, computed styles, responsive layout at phone/iPad/PC), writes auditable component specs, dispatches parallel builder agents in worktrees, and loops a scored pixel-diff QA until every section passes. Use whenever the user wants to clone, replicate, rebuild, reverse-engineer, or copy any website. Resumable — safe to re-run after an interruption.+argument-hint: "<url> [extra instructions]"+user-invocable: true+---++# Clone Website++Reverse-engineer and rebuild **$ARGUMENTS** as a pixel-accurate, multi-page Next.js clone.++You are a **foreman walking the job site**: scripts do the measuring, you do the judgment, specs are the contract, builder agents do the construction, and the pixel-diff score decides when you're done. Extraction and construction overlap — dispatch builders as soon as a section's spec passes lint, then keep extracting.++## Resume Check (ALWAYS FIRST)++```bash+node scripts/manifest.mjs status+```++If a manifest exists, this is a **resumed run**: skip everything already done (`node scripts/manifest.mjs next` tells you where to continue). If not, this is a fresh run — start at Phase 0.++## Scope Defaults++- **Fidelity:** pixel-accurate — colors, spacing, typography, animations, interactions+- **In scope:** every confirmed page, visual layout, component structure, interactions, responsive behavior (phone 390 / iPad 768 / PC 1440), real content and assets+- **Out of scope:** real backend, auth, databases, forms that actually submit (mock them)+- **Content goes in `src/data/*.ts`** — components take props; page files wire data to components. This keeps the clone restylable later (see `/restyle`).++User-provided instructions override these defaults.++## Tooling++The scripts do the mechanical work — **use them instead of hand-measuring via browser MCP**:++| Script | Purpose |+|---|---|+| **`node scripts/extract/page.mjs <url> [--no-site-files]`** | **THE WORKHORSE — one call, 3 page loads total.** Auto-detects sections, then produces `tokens.json` + `css.json` (skip on later pages with `--no-site-files`), `assets.json` + downloads to `public/`, `responsive.json` (all 3 viewports), a full computed-style walk per section (`sections/<name>.json`), and full-page **and** per-section screenshots at phone/iPad/PC. Accepts explicit `--selector "css" --name x` pairs to override detection. Everything is measured from the SAME page state, so numbers, walks and screenshots can never disagree |+| `node scripts/extract/crawl.mjs <url> [--max 25]` | Discover pages (sitemap + nav links) → `docs/research/<host>/sitemap.json` |+| `node scripts/extract/section.mjs <url> --selector "css" [--name x] --state scroll:600\|click:sel\|hover:sel [--viewport pc\|ipad\|phone]` | **State captures** (page.mjs covers the default state). Captures a second state and diffs them (element styles *and* `::before`/`::after`), waiting for the section's real transition duration. `--selector`/`--name` repeat — one page load for all |+| `node scripts/extract/probe.mjs <url> --selector "css" [--selector "css2"] [--props a,b,c]` / `probe.mjs --route </r>` | Exact computed values for specific selectors at all 3 viewports, as a markdown table with a **varies** column — paste straight into a spec's Responsive section. **`--route` probes EVERY registered section of a page in one call (3 loads total, plus a `probe-<section>.json` per section) — never probe section-by-section** |+| `node scripts/extract/screenshot.mjs <url> [--selector css --name x ...]` | Extra screenshots at phone/iPad/PC (page.mjs already shot everything once). `--selector`/`--name` repeat — one call, 3 loads, N sections |+| `node scripts/extract/tokens.mjs` / `css.mjs` / `assets.mjs` / `responsive.mjs` | Single-purpose re-runs of one page.mjs output when something needs refreshing |+| `node scripts/diff.mjs --original <url> --clone <url> [--selector css] --viewport all [--threshold 95]` | Scored pixel diff, original vs clone. **`--viewport all` scores pc+ipad+phone in one call**, and the per-viewport **band breakdown names the y-range where the mismatch lives** — read it before guessing at causes. **Batched sweep: `--route </r>` (or repeated `--section name=css`) scores every section of a page from ONE load per side per viewport.** Original-side shots are cached 24h, so fix-iteration re-diffs only re-render the clone (`--fresh-original` to override) |+| `node scripts/lint-spec.mjs <spec.md\|dir>` | Mechanical spec-completeness gate — must pass before ANY builder dispatch |+| `node scripts/manifest.mjs <cmd>` | Pipeline state: init / add-page / add-section / set / status / next |++Browser MCP (Chrome MCP, Playwright MCP — if available) is for **judgment work only**: watching how the page behaves while scrolling, exploring what's clickable, understanding an animation. Numbers always come from the scripts. If no browser MCP is available, the scripts alone are sufficient — use extra `screenshot.mjs` and `section.mjs --state` calls to observe behavior.++The scripts are plain Node CLIs — any coding agent can run them. Playwright's Chromium auto-installs on the first script run (or run `npm run setup` once). If your tool has no subagent/worktree support, skip the dispatch mechanics and build each section yourself, sequentially, from the same lint-passing specs — every quality gate still applies.++## Guiding Principles++1. **Completeness beats speed.** A builder that has to guess a color, font size, or padding value means extraction failed. Extract one more property rather than ship an incomplete spec.+2. **Small tasks, perfect results.** One focused component per builder. Spec body over 150 lines = split the section (lint-spec enforces this).+3. **Real content, real assets.** Actual text via the section walker, actual files via `assets.mjs`. Watch for **layered images** — a hero that looks like one image is often background + overlay + foreground; `assets.json` records sibling counts and z-index for exactly this reason.+4. **Foundation first.** Tokens, fonts, types, icons, and shared chrome (header/footer) before any page section.+5. **Extract how it looks AND how it behaves.** Every interactive element needs before/after states with exact values — `section.mjs --state` produces the diff mechanically.+6. **Identify the interaction model before building.** Scroll-driven vs click-driven confusion is the most expensive mistake in cloning — a wrong call means a rewrite, not a CSS fix. Scroll first without clicking and watch; only then click. Record the model in the spec frontmatter.+7. **Responsive is measured, never guessed — at all three widths.** Fill every spec's Responsive section from `responsive.json` + `probe.mjs`, with real numbers for phone AND iPad AND pc. Never write "iPad: same as desktop": most production sites step their root font-size at breakpoints, so *every* padding, margin, and font size changes even when the layout looks identical. A spec that only nails desktop produces a clone that scores ~98% at 1440px and ~91% at 390px. `lint-spec.mjs` rejects vague responsive sections.++8. **The extraction JSON is ground truth; the spec is a summary of it.** If a builder finds the spec disagreeing with `sections/<name>.json` or `responsive.json`, the JSON wins — say so explicitly in every builder prompt and have the builder report the discrepancy so you can correct the spec.+9. **Spec files are the contract.** No spec → no builder. lint-spec must pass → then dispatch.+10. **The build must always compile.** Builders verify `npx tsc --noEmit`; you verify `npm run typecheck && npm run lint` after every merge. Full `npm run build` runs only at checkpoints (Phase 0, end of Phase 2, once mid-way through Phase 3, Phase 4, completion) — it takes 30–60s and running it per merge serializes otherwise-parallel builders.+11. **The manifest is updated at every stage transition.** That's what makes the run resumable.++## Phase 0 — Crawl & Scope++1. Verify the base builds: `npm run build`.+2. `node scripts/extract/crawl.mjs <url> --max 25`+3. Show the user the discovered pages (route + source). **Ask which to clone** — recommend: start page + nav pages, skip legal/utility pages unless asked. Default cap ~10.+4. Initialize state:+ ```bash+ node scripts/manifest.mjs init <url>+ node scripts/manifest.mjs add-page --url <url> --route / # per confirmed page+ ```++## Phase 1 — Recon (one page.mjs call per page)++1. **First page:** `node scripts/extract/page.mjs <start-url>` — produces tokens, css, assets+downloads, responsive signatures, per-section walks, and every screenshot in one shot (3 page loads).+2. **Every other confirmed page:** `node scripts/extract/page.mjs <url> --no-site-files` (tokens/css are site-wide; everything else is per-page). Downloads dedupe across pages automatically — files already in `public/` are skipped.+3. **Review the detected sections** in each run's stdout summary (name, selector, pc height, headline responsive change). Detection is a heuristic: if a "section" is really two, or two are really one, re-run with explicit `--selector "css" --name x` pairs. Section names become spec/component names — rename `section-3` style fallbacks to something meaningful via `--name`.+4. **Interaction sweep** (judgment work — browser MCP if available): scroll each page slowly top to bottom. Does the header change? Do elements animate in? Auto-switching tabs? Scroll-snap? Smooth-scroll lib (`tokens.json` flags `.lenis`/Locomotive)? Then click every tab/pill/accordion and note what changes. Then hover. `css.json`'s `interactiveStates` lists every :hover/:focus rule the stylesheet defines — use it as the checklist of what to probe. Record findings in `docs/research/<host>/BEHAVIORS.md`.+5. **Shared chrome detection:** compare screenshots across pages — header/nav/footer that repeat become SHARED components (`SiteHeader`, `SiteFooter`), extracted once from the page where they're most complete.++**Per page — topology:** map every distinct section top to bottom with a working name, its selector, its interaction model (static / click-driven / scroll-driven / hover-driven / time-driven / mixed), and layer notes (sticky? overlay? z-index?). Save `docs/research/<host>/PAGE_TOPOLOGY.md`, then register each section:+```bash+node scripts/manifest.mjs add-section --route / --name hero --selector "section.hero"+```++## Phase 2 — Foundation (sequential, you do it yourself)++1. **Fonts** in `src/app/layout.tsx` via `next/font/google` or `next/font/local` (downloaded fonts are in `public/fonts/`) — families/weights from `tokens.json`+2. **`globals.css`**: map the target's palette onto the shadcn `:root` token names; add custom properties for colors that don't map; add global keyframes, scroll-snap, smooth-scroll setup found in recon+3. **TypeScript interfaces** in `src/types/` for the content structures you observed+4. **Icons**: convert the deduplicated `inlineSvgs` from `assets.json` into named components in `src/components/icons.tsx` (named by function: `LogoIcon`, `ArrowRightIcon`…)+5. **SEO**: favicons/OG from `public/seo/` wired into `layout.tsx` metadata+6. Verify `npm run build`, then build **shared chrome** (header/footer) first — full spec → lint → builder cycle like any section, since every page depends on them.++## Phase 3 — Per-Section Loop (extract → spec → lint → dispatch → merge)++Work through `manifest.mjs next` until no sections remain. For each section:++### 3a. Extract++**The default state is already extracted** — Phase 1's page.mjs run wrote+`sections/<name>.json`, `responsive.json`, and all screenshots.++**First time you enter Phase 3 for a page, probe ALL its sections in ONE call** (3+page loads total instead of 3 per section — never probe section-by-section):++```bash+node scripts/extract/probe.mjs --route <r> # every registered section + probe-<section>.json each+# add key children in the same call when a spec will need them:+node scripts/extract/probe.mjs --route <r> --selector "<sel> h2" --selector "<sel> .card"+```++Slice the per-section tables into each spec's Responsive section as you write it.+Per section, only one thing remains:++```bash+# Per discovered behavior — one call per state (batch selectors sharing a trigger):+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-hover --state hover:".card"+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-scrolled --state scroll:600+# per tab/pill state: --state click:".tab-2" etc. EVERY state, not just the default.+```+State captures wait for the section's actual transition duration, so a slow fade is+recorded at its end value, not mid-flight — check `settleMs` in the output if a diff+looks wrong. The `diff` array covers `::before`/`::after` too, which is where hover+overlays usually live. Cross-check discovered behaviors against `css.json`'s+`interactiveStates` — a :hover rule in the stylesheet with no captured state means+the extraction is not done.++Mark: `manifest.mjs set --route <r> --section <name> --stage extracted`++### 3b. Write the spec — `docs/research/components/<route-slug>/<name>.spec.md`++```markdown+---+component: HeroSection+target: src/components/HeroSection.tsx+page: /+screenshot: docs/design-references/<host>/<name>-pc.png+interaction_model: static | click-driven | scroll-driven | hover-driven | time-driven | mixed+states: default, hover, scrolled…+assets: public/images/x.webp, icons:ArrowRightIcon+responsive: phone, ipad, pc+---++# <Component> Specification++## DOM Structure+<hierarchy from the section walker — what contains what>++## Computed Styles+<exact values from sections/<name>.json, per element. Never estimated.>++## States & Behaviors+<per behavior: Trigger / State A / State B / Transition — from the --state diffs.+ Include the implementation approach (CSS transition, IntersectionObserver, etc.)>++## Per-State Content+<for tabbed/stateful sections: full content per state. "N/A — static" otherwise>++## Assets+<local public/ paths + icon components used. Note layered compositions explicitly.>++## Text Content+<verbatim from the walker output — never paraphrased>++## Responsive Behavior+<from responsive.json: real column counts and changes at 390 / 768 / 1440 + breakpoint>+```++### 3c. Lint gate+```bash+node scripts/lint-spec.mjs docs/research/components/<route-slug>/<name>.spec.md+```+Fails → extract more. Passes → `manifest.mjs set … --stage specd` and dispatch.++### 3d. Dispatch builder agent (worktree)++Every builder receives IN ITS PROMPT (never "go read the file"):+- The **full spec file contents inline**+- The screenshot paths (all 3 viewports)+- Shared imports available: `cn()`, `icons.tsx` components, shadcn `ui/` primitives, types from `src/types/`+- The target file path, and the data file to create in `src/data/` if the section has content collections+- The rule: verify `npx tsc --noEmit` passes before finishing+- **The ground-truth rule:** "`docs/research/<host>/sections/<name>.json` and `responsive.json` are ground truth. If this spec contradicts them, follow the JSON and report the discrepancy." Builders reliably catch spec errors this way — treat their reports as corrections to make to the spec file.++Complex section (3+ distinct sub-components) → one builder per sub-component + one for the wrapper, sub-components first. **Don't wait** — while builders run, extract the next section.++### 3e. Merge+As builders finish: merge worktree → `npm run typecheck && npm run lint` → fix errors immediately → `manifest.mjs set … --stage merged`. tsc catches the cross-worktree breaks (imports, prop types) that per-merge builds used to catch, in a fraction of the time.++**Once, after roughly half the page's sections are merged: run a full `npm run build` checkpoint.** It catches build-only failures (server/client component violations, route exports, metadata) while they're still cheap to bisect. Don't build after every merge.++## Phase 4 — Page Assembly++Per page: create `src/app/<route>/page.tsx` importing its section components with data from `src/data/`, plus page-level behaviors (scroll-snap, observers, smooth scroll). Shared chrome mounts in `layout.tsx` or a route group layout. Wire internal nav links to the cloned routes. `npm run build` must pass.++## Phase 5 — Scored QA Loop++Start the clone: `npm run dev` (background). Then **score the whole page's sections in ONE batched call** (one load per side per viewport instead of one per section):++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --route <r> --viewport all+node scripts/manifest.mjs set --route <r> --section <name> --score pc=<match> # per section × viewport+```++**Fix iterations stay single-section** — the original-side shots captured by the sweep are cached, so a re-diff only re-renders the clone:++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --selector "<sel>" --viewport all --name <name>+```++- **Pass = ≥95% on all three viewports** → `--stage qa_passed`+- Below 95% → **read the band breakdown first**: it names the y-range where the mismatch lives, so you inspect that band of the diff image in `docs/research/qa/` instead of eyeballing the whole section. Then check the spec (wrong extraction → re-extract and fix; right spec, wrong build → fix component), re-diff+- A large height mismatch reported by diff.mjs = missing content or wrong spacing — fix before pixel-tweaking+- Max 3 fix iterations per section, then record the gap honestly and move on+- **Text-heavy sections at phone width often plateau at 90–95%** when the target's font isn't available on Google Fonts (e.g. Source Sans Pro → Source Sans 3). Different metrics = different wrap points = unavoidable pixel drift. Confirm the layout matches, note the substitution, and accept it.+- **A score that's high at pc but low at ipad/phone is always a responsive-spec problem**, not a styling bug. Re-run `probe.mjs` on the section and fill in the values the spec was missing.+- Finally, test behaviors manually: scroll, click every tab, hover — screenshots can't verify motion; you must++Whole-page diffs (`--selector` omitted) at all 3 viewports close out each page.++## What NOT to Do++- **Don't build click-tabs when the original is scroll-driven** (or vice versa). Scroll first, watch, then click. Wrong model = rewrite.+- **Don't extract only the default state.** Every tab clicked, every hover captured, header at scroll 0 AND past the trigger.+- **Don't miss layered/overlay images** — check `siblingImgs` and z-index hints in `assets.json`.+- **Don't build HTML mockups of things that are actually `<video>`, Lottie, or canvas.** Check first.+- **Don't approximate ("looks like text-lg").** Use the walker's exact computed values; use arbitrary values (`text-[17px]`) when Tailwind's scale doesn't match.+- **Don't dispatch a builder without a lint-passing spec.** No exceptions — that's the whole quality model.+- **Don't reference docs from builder prompts** — spec contents go inline.+- **Don't skip the manifest updates.** An untracked run can't resume.+- **Don't hardcode content in components.** Content → `src/data/`, components take props.+- **Don't write "same as desktop" in a Responsive section.** Root font-size steps at breakpoints on most real sites, so every number changes. Run `probe.mjs` and write the real values for all three widths — lint-spec now rejects vague responsive sections.+- **Don't forget `::before` / `::after`.** They carry hero overlays, heading underline bars, and icon glyphs. `section.mjs` captures them under a `pseudo` key — if a spec has none and the screenshot shows decorations, extraction was incomplete.+- **Don't trust the spec over the extraction JSON.** Specs are hand-written summaries and drift; `sections/*.json` is machine-measured.+- **Don't declare done without QA scores.** "Looks right" is not a number.++## Completion Report++- Pages cloned (routes) · sections built · spec files written (must match section count)+- Assets downloaded (from `assets.json` download log, including failures)+- Final QA score table per section × viewport (from `manifest.mjs status`)+- `npm run build` result+- Known gaps and any section that couldn't reach 95%+- Suggest next step: `/restyle` to rebrand the clone with your own identitydiff --git a/.github/skills/restyle/SKILL.md b/.github/skills/restyle/SKILL.mdnew file mode 100644index 0000000..f679a01--- /dev/null+++ b/.github/skills/restyle/SKILL.md@@ -0,0 +1,49 @@+---+name: restyle+description: Rebrand a cloned website with your own identity — swaps colors, fonts, logo, favicons, and rewrites all copy for your brand while keeping the cloned layout, spacing, animations, and interactions pixel-intact. Run after /clone-website. Reads BRAND.md at the repo root. Use when the user wants to "make it mine", rebrand, restyle, or customize the clone.+argument-hint: "[extra instructions, e.g. 'keep their copy, only swap colors']"+user-invocable: true+---++# Restyle++Turn the cloned site into **the user's site**: their brand, their words, their logo — on top of the cloned structure. Layout, spacing, animations, and interactions stay untouched. That separation works because the clone pipeline keeps all content in `src/data/*.ts` and all brand tokens in `globals.css` — you swap those layers only.++$ARGUMENTS++## Step 1 — Read the brand++Read `BRAND.md` at the repo root. If it's missing or has unfilled `TODO` fields, ask the user for what's missing (max 3 questions at a time). Never ask for secrets in chat — anything sensitive belongs in env files, not BRAND.md.++If the user has brand assets (logo files, product screenshots), ask them to drop the files into `public/brand/` and tell you the filenames.++## Step 2 — Take "before" screenshots++```bash+npm run dev # background+node scripts/extract/screenshot.mjs http://localhost:3000 --name before-restyle+```+These are your regression reference: after restyling, layout must still match them structurally.++## Step 3 — Swap the brand layers (in this order)++1. **Colors** — `src/app/globals.css`: replace the cloned palette in `:root` / `.dark` with the brand colors from BRAND.md. Keep the same token *names* so no component changes. Preserve relative contrast: if the original had a dark section, keep it dark in the new palette.+2. **Fonts** — `src/app/layout.tsx`: swap `next/font` families to the brand fonts. Keep the size/weight structure the clone extracted — only families change.+3. **Logo & icons** — replace `LogoIcon` in `src/components/icons.tsx` (or the logo `<img>` asset) with the brand logo from `public/brand/`. Keep the rendered dimensions of the original logo so the header layout doesn't shift.+4. **Favicons & SEO** — regenerate `public/seo/` (favicon, apple-touch-icon, OG image if provided), update `layout.tsx` metadata: title, description, OG tags — from BRAND.md positioning.+5. **Copy** — rewrite every string in `src/data/*.ts` for the brand: same structure, same approximate length (±20% — long copy breaks cloned layouts), brand voice from BRAND.md. Headlines sell the user's offer, not the original company's. Placeholder patterns like testimonials get realistic brand-appropriate content clearly marked as placeholders unless BRAND.md provides real ones.+6. **Images** — where the clone shows the original company's product shots, swap in files from `public/brand/` if provided; otherwise leave the cloned image and list it in the report as "needs replacement".++## Step 4 — Verify++1. `npm run build` — must pass+2. `node scripts/extract/screenshot.mjs http://localhost:3000 --name after-restyle`+3. Compare before/after at all 3 viewports: layout identical, only brand layers changed. Overflowing text = shorten the copy, never change the layout.+4. Check every page route, not just `/`.++## Report++- What was swapped (colors, fonts, logo, favicon, N copy blocks across M data files)+- Images still showing the original site's content (need user-provided replacements)+- Any copy that had to be shortened/lengthened to fit+- Anything in BRAND.md still marked TODOdiff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex ac0b87b..3599d1a 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -14,6 +14,7 @@ jobs:with:node-version: 22cache: npm+ - run: node scripts/sync-skills.mjs --check- run: npm ci- run: npm run lint- run: npm run typecheckdiff --git a/.opencode/commands/clone-website.md b/.opencode/commands/clone-website.mdnew file mode 100644index 0000000..7e9e20c--- /dev/null+++ b/.opencode/commands/clone-website.md@@ -0,0 +1,248 @@+---+description: "Reverse-engineer and clone a full multi-page website as a pixel-accurate Next.js replica"+---+<!-- GENERATED from .claude/skills/clone-website/SKILL.md by scripts/sync-skills.mjs — edit the source,+ then run: node scripts/sync-skills.mjs -->++# Clone Website++Reverse-engineer and rebuild **$ARGUMENTS** as a pixel-accurate, multi-page Next.js clone.++You are a **foreman walking the job site**: scripts do the measuring, you do the judgment, specs are the contract, builder agents do the construction, and the pixel-diff score decides when you're done. Extraction and construction overlap — dispatch builders as soon as a section's spec passes lint, then keep extracting.++## Resume Check (ALWAYS FIRST)++```bash+node scripts/manifest.mjs status+```++If a manifest exists, this is a **resumed run**: skip everything already done (`node scripts/manifest.mjs next` tells you where to continue). If not, this is a fresh run — start at Phase 0.++## Scope Defaults++- **Fidelity:** pixel-accurate — colors, spacing, typography, animations, interactions+- **In scope:** every confirmed page, visual layout, component structure, interactions, responsive behavior (phone 390 / iPad 768 / PC 1440), real content and assets+- **Out of scope:** real backend, auth, databases, forms that actually submit (mock them)+- **Content goes in `src/data/*.ts`** — components take props; page files wire data to components. This keeps the clone restylable later (see `/restyle`).++User-provided instructions override these defaults.++## Tooling++The scripts do the mechanical work — **use them instead of hand-measuring via browser MCP**:++| Script | Purpose |+|---|---|+| **`node scripts/extract/page.mjs <url> [--no-site-files]`** | **THE WORKHORSE — one call, 3 page loads total.** Auto-detects sections, then produces `tokens.json` + `css.json` (skip on later pages with `--no-site-files`), `assets.json` + downloads to `public/`, `responsive.json` (all 3 viewports), a full computed-style walk per section (`sections/<name>.json`), and full-page **and** per-section screenshots at phone/iPad/PC. Accepts explicit `--selector "css" --name x` pairs to override detection. Everything is measured from the SAME page state, so numbers, walks and screenshots can never disagree |+| `node scripts/extract/crawl.mjs <url> [--max 25]` | Discover pages (sitemap + nav links) → `docs/research/<host>/sitemap.json` |+| `node scripts/extract/section.mjs <url> --selector "css" [--name x] --state scroll:600\|click:sel\|hover:sel [--viewport pc\|ipad\|phone]` | **State captures** (page.mjs covers the default state). Captures a second state and diffs them (element styles *and* `::before`/`::after`), waiting for the section's real transition duration. `--selector`/`--name` repeat — one page load for all |+| `node scripts/extract/probe.mjs <url> --selector "css" [--selector "css2"] [--props a,b,c]` / `probe.mjs --route </r>` | Exact computed values for specific selectors at all 3 viewports, as a markdown table with a **varies** column — paste straight into a spec's Responsive section. **`--route` probes EVERY registered section of a page in one call (3 loads total, plus a `probe-<section>.json` per section) — never probe section-by-section** |+| `node scripts/extract/screenshot.mjs <url> [--selector css --name x ...]` | Extra screenshots at phone/iPad/PC (page.mjs already shot everything once). `--selector`/`--name` repeat — one call, 3 loads, N sections |+| `node scripts/extract/tokens.mjs` / `css.mjs` / `assets.mjs` / `responsive.mjs` | Single-purpose re-runs of one page.mjs output when something needs refreshing |+| `node scripts/diff.mjs --original <url> --clone <url> [--selector css] --viewport all [--threshold 95]` | Scored pixel diff, original vs clone. **`--viewport all` scores pc+ipad+phone in one call**, and the per-viewport **band breakdown names the y-range where the mismatch lives** — read it before guessing at causes. **Batched sweep: `--route </r>` (or repeated `--section name=css`) scores every section of a page from ONE load per side per viewport.** Original-side shots are cached 24h, so fix-iteration re-diffs only re-render the clone (`--fresh-original` to override) |+| `node scripts/lint-spec.mjs <spec.md\|dir>` | Mechanical spec-completeness gate — must pass before ANY builder dispatch |+| `node scripts/manifest.mjs <cmd>` | Pipeline state: init / add-page / add-section / set / status / next |++Browser MCP (Chrome MCP, Playwright MCP — if available) is for **judgment work only**: watching how the page behaves while scrolling, exploring what's clickable, understanding an animation. Numbers always come from the scripts. If no browser MCP is available, the scripts alone are sufficient — use extra `screenshot.mjs` and `section.mjs --state` calls to observe behavior.++The scripts are plain Node CLIs — any coding agent can run them. Playwright's Chromium auto-installs on the first script run (or run `npm run setup` once). If your tool has no subagent/worktree support, skip the dispatch mechanics and build each section yourself, sequentially, from the same lint-passing specs — every quality gate still applies.++## Guiding Principles++1. **Completeness beats speed.** A builder that has to guess a color, font size, or padding value means extraction failed. Extract one more property rather than ship an incomplete spec.+2. **Small tasks, perfect results.** One focused component per builder. Spec body over 150 lines = split the section (lint-spec enforces this).+3. **Real content, real assets.** Actual text via the section walker, actual files via `assets.mjs`. Watch for **layered images** — a hero that looks like one image is often background + overlay + foreground; `assets.json` records sibling counts and z-index for exactly this reason.+4. **Foundation first.** Tokens, fonts, types, icons, and shared chrome (header/footer) before any page section.+5. **Extract how it looks AND how it behaves.** Every interactive element needs before/after states with exact values — `section.mjs --state` produces the diff mechanically.+6. **Identify the interaction model before building.** Scroll-driven vs click-driven confusion is the most expensive mistake in cloning — a wrong call means a rewrite, not a CSS fix. Scroll first without clicking and watch; only then click. Record the model in the spec frontmatter.+7. **Responsive is measured, never guessed — at all three widths.** Fill every spec's Responsive section from `responsive.json` + `probe.mjs`, with real numbers for phone AND iPad AND pc. Never write "iPad: same as desktop": most production sites step their root font-size at breakpoints, so *every* padding, margin, and font size changes even when the layout looks identical. A spec that only nails desktop produces a clone that scores ~98% at 1440px and ~91% at 390px. `lint-spec.mjs` rejects vague responsive sections.++8. **The extraction JSON is ground truth; the spec is a summary of it.** If a builder finds the spec disagreeing with `sections/<name>.json` or `responsive.json`, the JSON wins — say so explicitly in every builder prompt and have the builder report the discrepancy so you can correct the spec.+9. **Spec files are the contract.** No spec → no builder. lint-spec must pass → then dispatch.+10. **The build must always compile.** Builders verify `npx tsc --noEmit`; you verify `npm run typecheck && npm run lint` after every merge. Full `npm run build` runs only at checkpoints (Phase 0, end of Phase 2, once mid-way through Phase 3, Phase 4, completion) — it takes 30–60s and running it per merge serializes otherwise-parallel builders.+11. **The manifest is updated at every stage transition.** That's what makes the run resumable.++## Phase 0 — Crawl & Scope++1. Verify the base builds: `npm run build`.+2. `node scripts/extract/crawl.mjs <url> --max 25`+3. Show the user the discovered pages (route + source). **Ask which to clone** — recommend: start page + nav pages, skip legal/utility pages unless asked. Default cap ~10.+4. Initialize state:+ ```bash+ node scripts/manifest.mjs init <url>+ node scripts/manifest.mjs add-page --url <url> --route / # per confirmed page+ ```++## Phase 1 — Recon (one page.mjs call per page)++1. **First page:** `node scripts/extract/page.mjs <start-url>` — produces tokens, css, assets+downloads, responsive signatures, per-section walks, and every screenshot in one shot (3 page loads).+2. **Every other confirmed page:** `node scripts/extract/page.mjs <url> --no-site-files` (tokens/css are site-wide; everything else is per-page). Downloads dedupe across pages automatically — files already in `public/` are skipped.+3. **Review the detected sections** in each run's stdout summary (name, selector, pc height, headline responsive change). Detection is a heuristic: if a "section" is really two, or two are really one, re-run with explicit `--selector "css" --name x` pairs. Section names become spec/component names — rename `section-3` style fallbacks to something meaningful via `--name`.+4. **Interaction sweep** (judgment work — browser MCP if available): scroll each page slowly top to bottom. Does the header change? Do elements animate in? Auto-switching tabs? Scroll-snap? Smooth-scroll lib (`tokens.json` flags `.lenis`/Locomotive)? Then click every tab/pill/accordion and note what changes. Then hover. `css.json`'s `interactiveStates` lists every :hover/:focus rule the stylesheet defines — use it as the checklist of what to probe. Record findings in `docs/research/<host>/BEHAVIORS.md`.+5. **Shared chrome detection:** compare screenshots across pages — header/nav/footer that repeat become SHARED components (`SiteHeader`, `SiteFooter`), extracted once from the page where they're most complete.++**Per page — topology:** map every distinct section top to bottom with a working name, its selector, its interaction model (static / click-driven / scroll-driven / hover-driven / time-driven / mixed), and layer notes (sticky? overlay? z-index?). Save `docs/research/<host>/PAGE_TOPOLOGY.md`, then register each section:+```bash+node scripts/manifest.mjs add-section --route / --name hero --selector "section.hero"+```++## Phase 2 — Foundation (sequential, you do it yourself)++1. **Fonts** in `src/app/layout.tsx` via `next/font/google` or `next/font/local` (downloaded fonts are in `public/fonts/`) — families/weights from `tokens.json`+2. **`globals.css`**: map the target's palette onto the shadcn `:root` token names; add custom properties for colors that don't map; add global keyframes, scroll-snap, smooth-scroll setup found in recon+3. **TypeScript interfaces** in `src/types/` for the content structures you observed+4. **Icons**: convert the deduplicated `inlineSvgs` from `assets.json` into named components in `src/components/icons.tsx` (named by function: `LogoIcon`, `ArrowRightIcon`…)+5. **SEO**: favicons/OG from `public/seo/` wired into `layout.tsx` metadata+6. Verify `npm run build`, then build **shared chrome** (header/footer) first — full spec → lint → builder cycle like any section, since every page depends on them.++## Phase 3 — Per-Section Loop (extract → spec → lint → dispatch → merge)++Work through `manifest.mjs next` until no sections remain. For each section:++### 3a. Extract++**The default state is already extracted** — Phase 1's page.mjs run wrote+`sections/<name>.json`, `responsive.json`, and all screenshots.++**First time you enter Phase 3 for a page, probe ALL its sections in ONE call** (3+page loads total instead of 3 per section — never probe section-by-section):++```bash+node scripts/extract/probe.mjs --route <r> # every registered section + probe-<section>.json each+# add key children in the same call when a spec will need them:+node scripts/extract/probe.mjs --route <r> --selector "<sel> h2" --selector "<sel> .card"+```++Slice the per-section tables into each spec's Responsive section as you write it.+Per section, only one thing remains:++```bash+# Per discovered behavior — one call per state (batch selectors sharing a trigger):+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-hover --state hover:".card"+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-scrolled --state scroll:600+# per tab/pill state: --state click:".tab-2" etc. EVERY state, not just the default.+```+State captures wait for the section's actual transition duration, so a slow fade is+recorded at its end value, not mid-flight — check `settleMs` in the output if a diff+looks wrong. The `diff` array covers `::before`/`::after` too, which is where hover+overlays usually live. Cross-check discovered behaviors against `css.json`'s+`interactiveStates` — a :hover rule in the stylesheet with no captured state means+the extraction is not done.++Mark: `manifest.mjs set --route <r> --section <name> --stage extracted`++### 3b. Write the spec — `docs/research/components/<route-slug>/<name>.spec.md`++```markdown+---+component: HeroSection+target: src/components/HeroSection.tsx+page: /+screenshot: docs/design-references/<host>/<name>-pc.png+interaction_model: static | click-driven | scroll-driven | hover-driven | time-driven | mixed+states: default, hover, scrolled…+assets: public/images/x.webp, icons:ArrowRightIcon+responsive: phone, ipad, pc+---++# <Component> Specification++## DOM Structure+<hierarchy from the section walker — what contains what>++## Computed Styles+<exact values from sections/<name>.json, per element. Never estimated.>++## States & Behaviors+<per behavior: Trigger / State A / State B / Transition — from the --state diffs.+ Include the implementation approach (CSS transition, IntersectionObserver, etc.)>++## Per-State Content+<for tabbed/stateful sections: full content per state. "N/A — static" otherwise>++## Assets+<local public/ paths + icon components used. Note layered compositions explicitly.>++## Text Content+<verbatim from the walker output — never paraphrased>++## Responsive Behavior+<from responsive.json: real column counts and changes at 390 / 768 / 1440 + breakpoint>+```++### 3c. Lint gate+```bash+node scripts/lint-spec.mjs docs/research/components/<route-slug>/<name>.spec.md+```+Fails → extract more. Passes → `manifest.mjs set … --stage specd` and dispatch.++### 3d. Dispatch builder agent (worktree)++Every builder receives IN ITS PROMPT (never "go read the file"):+- The **full spec file contents inline**+- The screenshot paths (all 3 viewports)+- Shared imports available: `cn()`, `icons.tsx` components, shadcn `ui/` primitives, types from `src/types/`+- The target file path, and the data file to create in `src/data/` if the section has content collections+- The rule: verify `npx tsc --noEmit` passes before finishing+- **The ground-truth rule:** "`docs/research/<host>/sections/<name>.json` and `responsive.json` are ground truth. If this spec contradicts them, follow the JSON and report the discrepancy." Builders reliably catch spec errors this way — treat their reports as corrections to make to the spec file.++Complex section (3+ distinct sub-components) → one builder per sub-component + one for the wrapper, sub-components first. **Don't wait** — while builders run, extract the next section.++### 3e. Merge+As builders finish: merge worktree → `npm run typecheck && npm run lint` → fix errors immediately → `manifest.mjs set … --stage merged`. tsc catches the cross-worktree breaks (imports, prop types) that per-merge builds used to catch, in a fraction of the time.++**Once, after roughly half the page's sections are merged: run a full `npm run build` checkpoint.** It catches build-only failures (server/client component violations, route exports, metadata) while they're still cheap to bisect. Don't build after every merge.++## Phase 4 — Page Assembly++Per page: create `src/app/<route>/page.tsx` importing its section components with data from `src/data/`, plus page-level behaviors (scroll-snap, observers, smooth scroll). Shared chrome mounts in `layout.tsx` or a route group layout. Wire internal nav links to the cloned routes. `npm run build` must pass.++## Phase 5 — Scored QA Loop++Start the clone: `npm run dev` (background). Then **score the whole page's sections in ONE batched call** (one load per side per viewport instead of one per section):++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --route <r> --viewport all+node scripts/manifest.mjs set --route <r> --section <name> --score pc=<match> # per section × viewport+```++**Fix iterations stay single-section** — the original-side shots captured by the sweep are cached, so a re-diff only re-renders the clone:++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --selector "<sel>" --viewport all --name <name>+```++- **Pass = ≥95% on all three viewports** → `--stage qa_passed`+- Below 95% → **read the band breakdown first**: it names the y-range where the mismatch lives, so you inspect that band of the diff image in `docs/research/qa/` instead of eyeballing the whole section. Then check the spec (wrong extraction → re-extract and fix; right spec, wrong build → fix component), re-diff+- A large height mismatch reported by diff.mjs = missing content or wrong spacing — fix before pixel-tweaking+- Max 3 fix iterations per section, then record the gap honestly and move on+- **Text-heavy sections at phone width often plateau at 90–95%** when the target's font isn't available on Google Fonts (e.g. Source Sans Pro → Source Sans 3). Different metrics = different wrap points = unavoidable pixel drift. Confirm the layout matches, note the substitution, and accept it.+- **A score that's high at pc but low at ipad/phone is always a responsive-spec problem**, not a styling bug. Re-run `probe.mjs` on the section and fill in the values the spec was missing.+- Finally, test behaviors manually: scroll, click every tab, hover — screenshots can't verify motion; you must++Whole-page diffs (`--selector` omitted) at all 3 viewports close out each page.++## What NOT to Do++- **Don't build click-tabs when the original is scroll-driven** (or vice versa). Scroll first, watch, then click. Wrong model = rewrite.+- **Don't extract only the default state.** Every tab clicked, every hover captured, header at scroll 0 AND past the trigger.+- **Don't miss layered/overlay images** — check `siblingImgs` and z-index hints in `assets.json`.+- **Don't build HTML mockups of things that are actually `<video>`, Lottie, or canvas.** Check first.+- **Don't approximate ("looks like text-lg").** Use the walker's exact computed values; use arbitrary values (`text-[17px]`) when Tailwind's scale doesn't match.+- **Don't dispatch a builder without a lint-passing spec.** No exceptions — that's the whole quality model.+- **Don't reference docs from builder prompts** — spec contents go inline.+- **Don't skip the manifest updates.** An untracked run can't resume.+- **Don't hardcode content in components.** Content → `src/data/`, components take props.+- **Don't write "same as desktop" in a Responsive section.** Root font-size steps at breakpoints on most real sites, so every number changes. Run `probe.mjs` and write the real values for all three widths — lint-spec now rejects vague responsive sections.+- **Don't forget `::before` / `::after`.** They carry hero overlays, heading underline bars, and icon glyphs. `section.mjs` captures them under a `pseudo` key — if a spec has none and the screenshot shows decorations, extraction was incomplete.+- **Don't trust the spec over the extraction JSON.** Specs are hand-written summaries and drift; `sections/*.json` is machine-measured.+- **Don't declare done without QA scores.** "Looks right" is not a number.++## Completion Report++- Pages cloned (routes) · sections built · spec files written (must match section count)+- Assets downloaded (from `assets.json` download log, including failures)+- Final QA score table per section × viewport (from `manifest.mjs status`)+- `npm run build` result+- Known gaps and any section that couldn't reach 95%+- Suggest next step: `/restyle` to rebrand the clone with your own identitydiff --git a/.opencode/commands/restyle.md b/.opencode/commands/restyle.mdnew file mode 100644index 0000000..93e7fdf--- /dev/null+++ b/.opencode/commands/restyle.md@@ -0,0 +1,48 @@+---+description: "Rebrand a cloned website with your own colors, fonts, logo, and copy while keeping the layout pixel-intact"+---+<!-- GENERATED from .claude/skills/restyle/SKILL.md by scripts/sync-skills.mjs — edit the source,+ then run: node scripts/sync-skills.mjs -->++# Restyle++Turn the cloned site into **the user's site**: their brand, their words, their logo — on top of the cloned structure. Layout, spacing, animations, and interactions stay untouched. That separation works because the clone pipeline keeps all content in `src/data/*.ts` and all brand tokens in `globals.css` — you swap those layers only.++$ARGUMENTS++## Step 1 — Read the brand++Read `BRAND.md` at the repo root. If it's missing or has unfilled `TODO` fields, ask the user for what's missing (max 3 questions at a time). Never ask for secrets in chat — anything sensitive belongs in env files, not BRAND.md.++If the user has brand assets (logo files, product screenshots), ask them to drop the files into `public/brand/` and tell you the filenames.++## Step 2 — Take "before" screenshots++```bash+npm run dev # background+node scripts/extract/screenshot.mjs http://localhost:3000 --name before-restyle+```+These are your regression reference: after restyling, layout must still match them structurally.++## Step 3 — Swap the brand layers (in this order)++1. **Colors** — `src/app/globals.css`: replace the cloned palette in `:root` / `.dark` with the brand colors from BRAND.md. Keep the same token *names* so no component changes. Preserve relative contrast: if the original had a dark section, keep it dark in the new palette.+2. **Fonts** — `src/app/layout.tsx`: swap `next/font` families to the brand fonts. Keep the size/weight structure the clone extracted — only families change.+3. **Logo & icons** — replace `LogoIcon` in `src/components/icons.tsx` (or the logo `<img>` asset) with the brand logo from `public/brand/`. Keep the rendered dimensions of the original logo so the header layout doesn't shift.+4. **Favicons & SEO** — regenerate `public/seo/` (favicon, apple-touch-icon, OG image if provided), update `layout.tsx` metadata: title, description, OG tags — from BRAND.md positioning.+5. **Copy** — rewrite every string in `src/data/*.ts` for the brand: same structure, same approximate length (±20% — long copy breaks cloned layouts), brand voice from BRAND.md. Headlines sell the user's offer, not the original company's. Placeholder patterns like testimonials get realistic brand-appropriate content clearly marked as placeholders unless BRAND.md provides real ones.+6. **Images** — where the clone shows the original company's product shots, swap in files from `public/brand/` if provided; otherwise leave the cloned image and list it in the report as "needs replacement".++## Step 4 — Verify++1. `npm run build` — must pass+2. `node scripts/extract/screenshot.mjs http://localhost:3000 --name after-restyle`+3. Compare before/after at all 3 viewports: layout identical, only brand layers changed. Overflowing text = shorten the copy, never change the layout.+4. Check every page route, not just `/`.++## Report++- What was swapped (colors, fonts, logo, favicon, N copy blocks across M data files)+- Images still showing the original site's content (need user-provided replacements)+- Any copy that had to be shortened/lengthened to fit+- Anything in BRAND.md still marked TODOdiff --git a/.windsurf/workflows/clone-website.md b/.windsurf/workflows/clone-website.mdnew file mode 100644index 0000000..f050828--- /dev/null+++ b/.windsurf/workflows/clone-website.md@@ -0,0 +1,245 @@+<!-- GENERATED from .claude/skills/clone-website/SKILL.md by scripts/sync-skills.mjs — edit the source,+ then run: node scripts/sync-skills.mjs -->++# Clone Website++Reverse-engineer and rebuild **the target URL (plus any extra instructions) provided by the user** as a pixel-accurate, multi-page Next.js clone.++You are a **foreman walking the job site**: scripts do the measuring, you do the judgment, specs are the contract, builder agents do the construction, and the pixel-diff score decides when you're done. Extraction and construction overlap — dispatch builders as soon as a section's spec passes lint, then keep extracting.++## Resume Check (ALWAYS FIRST)++```bash+node scripts/manifest.mjs status+```++If a manifest exists, this is a **resumed run**: skip everything already done (`node scripts/manifest.mjs next` tells you where to continue). If not, this is a fresh run — start at Phase 0.++## Scope Defaults++- **Fidelity:** pixel-accurate — colors, spacing, typography, animations, interactions+- **In scope:** every confirmed page, visual layout, component structure, interactions, responsive behavior (phone 390 / iPad 768 / PC 1440), real content and assets+- **Out of scope:** real backend, auth, databases, forms that actually submit (mock them)+- **Content goes in `src/data/*.ts`** — components take props; page files wire data to components. This keeps the clone restylable later (see `/restyle`).++User-provided instructions override these defaults.++## Tooling++The scripts do the mechanical work — **use them instead of hand-measuring via browser MCP**:++| Script | Purpose |+|---|---|+| **`node scripts/extract/page.mjs <url> [--no-site-files]`** | **THE WORKHORSE — one call, 3 page loads total.** Auto-detects sections, then produces `tokens.json` + `css.json` (skip on later pages with `--no-site-files`), `assets.json` + downloads to `public/`, `responsive.json` (all 3 viewports), a full computed-style walk per section (`sections/<name>.json`), and full-page **and** per-section screenshots at phone/iPad/PC. Accepts explicit `--selector "css" --name x` pairs to override detection. Everything is measured from the SAME page state, so numbers, walks and screenshots can never disagree |+| `node scripts/extract/crawl.mjs <url> [--max 25]` | Discover pages (sitemap + nav links) → `docs/research/<host>/sitemap.json` |+| `node scripts/extract/section.mjs <url> --selector "css" [--name x] --state scroll:600\|click:sel\|hover:sel [--viewport pc\|ipad\|phone]` | **State captures** (page.mjs covers the default state). Captures a second state and diffs them (element styles *and* `::before`/`::after`), waiting for the section's real transition duration. `--selector`/`--name` repeat — one page load for all |+| `node scripts/extract/probe.mjs <url> --selector "css" [--selector "css2"] [--props a,b,c]` / `probe.mjs --route </r>` | Exact computed values for specific selectors at all 3 viewports, as a markdown table with a **varies** column — paste straight into a spec's Responsive section. **`--route` probes EVERY registered section of a page in one call (3 loads total, plus a `probe-<section>.json` per section) — never probe section-by-section** |+| `node scripts/extract/screenshot.mjs <url> [--selector css --name x ...]` | Extra screenshots at phone/iPad/PC (page.mjs already shot everything once). `--selector`/`--name` repeat — one call, 3 loads, N sections |+| `node scripts/extract/tokens.mjs` / `css.mjs` / `assets.mjs` / `responsive.mjs` | Single-purpose re-runs of one page.mjs output when something needs refreshing |+| `node scripts/diff.mjs --original <url> --clone <url> [--selector css] --viewport all [--threshold 95]` | Scored pixel diff, original vs clone. **`--viewport all` scores pc+ipad+phone in one call**, and the per-viewport **band breakdown names the y-range where the mismatch lives** — read it before guessing at causes. **Batched sweep: `--route </r>` (or repeated `--section name=css`) scores every section of a page from ONE load per side per viewport.** Original-side shots are cached 24h, so fix-iteration re-diffs only re-render the clone (`--fresh-original` to override) |+| `node scripts/lint-spec.mjs <spec.md\|dir>` | Mechanical spec-completeness gate — must pass before ANY builder dispatch |+| `node scripts/manifest.mjs <cmd>` | Pipeline state: init / add-page / add-section / set / status / next |++Browser MCP (Chrome MCP, Playwright MCP — if available) is for **judgment work only**: watching how the page behaves while scrolling, exploring what's clickable, understanding an animation. Numbers always come from the scripts. If no browser MCP is available, the scripts alone are sufficient — use extra `screenshot.mjs` and `section.mjs --state` calls to observe behavior.++The scripts are plain Node CLIs — any coding agent can run them. Playwright's Chromium auto-installs on the first script run (or run `npm run setup` once). If your tool has no subagent/worktree support, skip the dispatch mechanics and build each section yourself, sequentially, from the same lint-passing specs — every quality gate still applies.++## Guiding Principles++1. **Completeness beats speed.** A builder that has to guess a color, font size, or padding value means extraction failed. Extract one more property rather than ship an incomplete spec.+2. **Small tasks, perfect results.** One focused component per builder. Spec body over 150 lines = split the section (lint-spec enforces this).+3. **Real content, real assets.** Actual text via the section walker, actual files via `assets.mjs`. Watch for **layered images** — a hero that looks like one image is often background + overlay + foreground; `assets.json` records sibling counts and z-index for exactly this reason.+4. **Foundation first.** Tokens, fonts, types, icons, and shared chrome (header/footer) before any page section.+5. **Extract how it looks AND how it behaves.** Every interactive element needs before/after states with exact values — `section.mjs --state` produces the diff mechanically.+6. **Identify the interaction model before building.** Scroll-driven vs click-driven confusion is the most expensive mistake in cloning — a wrong call means a rewrite, not a CSS fix. Scroll first without clicking and watch; only then click. Record the model in the spec frontmatter.+7. **Responsive is measured, never guessed — at all three widths.** Fill every spec's Responsive section from `responsive.json` + `probe.mjs`, with real numbers for phone AND iPad AND pc. Never write "iPad: same as desktop": most production sites step their root font-size at breakpoints, so *every* padding, margin, and font size changes even when the layout looks identical. A spec that only nails desktop produces a clone that scores ~98% at 1440px and ~91% at 390px. `lint-spec.mjs` rejects vague responsive sections.++8. **The extraction JSON is ground truth; the spec is a summary of it.** If a builder finds the spec disagreeing with `sections/<name>.json` or `responsive.json`, the JSON wins — say so explicitly in every builder prompt and have the builder report the discrepancy so you can correct the spec.+9. **Spec files are the contract.** No spec → no builder. lint-spec must pass → then dispatch.+10. **The build must always compile.** Builders verify `npx tsc --noEmit`; you verify `npm run typecheck && npm run lint` after every merge. Full `npm run build` runs only at checkpoints (Phase 0, end of Phase 2, once mid-way through Phase 3, Phase 4, completion) — it takes 30–60s and running it per merge serializes otherwise-parallel builders.+11. **The manifest is updated at every stage transition.** That's what makes the run resumable.++## Phase 0 — Crawl & Scope++1. Verify the base builds: `npm run build`.+2. `node scripts/extract/crawl.mjs <url> --max 25`+3. Show the user the discovered pages (route + source). **Ask which to clone** — recommend: start page + nav pages, skip legal/utility pages unless asked. Default cap ~10.+4. Initialize state:+ ```bash+ node scripts/manifest.mjs init <url>+ node scripts/manifest.mjs add-page --url <url> --route / # per confirmed page+ ```++## Phase 1 — Recon (one page.mjs call per page)++1. **First page:** `node scripts/extract/page.mjs <start-url>` — produces tokens, css, assets+downloads, responsive signatures, per-section walks, and every screenshot in one shot (3 page loads).+2. **Every other confirmed page:** `node scripts/extract/page.mjs <url> --no-site-files` (tokens/css are site-wide; everything else is per-page). Downloads dedupe across pages automatically — files already in `public/` are skipped.+3. **Review the detected sections** in each run's stdout summary (name, selector, pc height, headline responsive change). Detection is a heuristic: if a "section" is really two, or two are really one, re-run with explicit `--selector "css" --name x` pairs. Section names become spec/component names — rename `section-3` style fallbacks to something meaningful via `--name`.+4. **Interaction sweep** (judgment work — browser MCP if available): scroll each page slowly top to bottom. Does the header change? Do elements animate in? Auto-switching tabs? Scroll-snap? Smooth-scroll lib (`tokens.json` flags `.lenis`/Locomotive)? Then click every tab/pill/accordion and note what changes. Then hover. `css.json`'s `interactiveStates` lists every :hover/:focus rule the stylesheet defines — use it as the checklist of what to probe. Record findings in `docs/research/<host>/BEHAVIORS.md`.+5. **Shared chrome detection:** compare screenshots across pages — header/nav/footer that repeat become SHARED components (`SiteHeader`, `SiteFooter`), extracted once from the page where they're most complete.++**Per page — topology:** map every distinct section top to bottom with a working name, its selector, its interaction model (static / click-driven / scroll-driven / hover-driven / time-driven / mixed), and layer notes (sticky? overlay? z-index?). Save `docs/research/<host>/PAGE_TOPOLOGY.md`, then register each section:+```bash+node scripts/manifest.mjs add-section --route / --name hero --selector "section.hero"+```++## Phase 2 — Foundation (sequential, you do it yourself)++1. **Fonts** in `src/app/layout.tsx` via `next/font/google` or `next/font/local` (downloaded fonts are in `public/fonts/`) — families/weights from `tokens.json`+2. **`globals.css`**: map the target's palette onto the shadcn `:root` token names; add custom properties for colors that don't map; add global keyframes, scroll-snap, smooth-scroll setup found in recon+3. **TypeScript interfaces** in `src/types/` for the content structures you observed+4. **Icons**: convert the deduplicated `inlineSvgs` from `assets.json` into named components in `src/components/icons.tsx` (named by function: `LogoIcon`, `ArrowRightIcon`…)+5. **SEO**: favicons/OG from `public/seo/` wired into `layout.tsx` metadata+6. Verify `npm run build`, then build **shared chrome** (header/footer) first — full spec → lint → builder cycle like any section, since every page depends on them.++## Phase 3 — Per-Section Loop (extract → spec → lint → dispatch → merge)++Work through `manifest.mjs next` until no sections remain. For each section:++### 3a. Extract++**The default state is already extracted** — Phase 1's page.mjs run wrote+`sections/<name>.json`, `responsive.json`, and all screenshots.++**First time you enter Phase 3 for a page, probe ALL its sections in ONE call** (3+page loads total instead of 3 per section — never probe section-by-section):++```bash+node scripts/extract/probe.mjs --route <r> # every registered section + probe-<section>.json each+# add key children in the same call when a spec will need them:+node scripts/extract/probe.mjs --route <r> --selector "<sel> h2" --selector "<sel> .card"+```++Slice the per-section tables into each spec's Responsive section as you write it.+Per section, only one thing remains:++```bash+# Per discovered behavior — one call per state (batch selectors sharing a trigger):+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-hover --state hover:".card"+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-scrolled --state scroll:600+# per tab/pill state: --state click:".tab-2" etc. EVERY state, not just the default.+```+State captures wait for the section's actual transition duration, so a slow fade is+recorded at its end value, not mid-flight — check `settleMs` in the output if a diff+looks wrong. The `diff` array covers `::before`/`::after` too, which is where hover+overlays usually live. Cross-check discovered behaviors against `css.json`'s+`interactiveStates` — a :hover rule in the stylesheet with no captured state means+the extraction is not done.++Mark: `manifest.mjs set --route <r> --section <name> --stage extracted`++### 3b. Write the spec — `docs/research/components/<route-slug>/<name>.spec.md`++```markdown+---+component: HeroSection+target: src/components/HeroSection.tsx+page: /+screenshot: docs/design-references/<host>/<name>-pc.png+interaction_model: static | click-driven | scroll-driven | hover-driven | time-driven | mixed+states: default, hover, scrolled…+assets: public/images/x.webp, icons:ArrowRightIcon+responsive: phone, ipad, pc+---++# <Component> Specification++## DOM Structure+<hierarchy from the section walker — what contains what>++## Computed Styles+<exact values from sections/<name>.json, per element. Never estimated.>++## States & Behaviors+<per behavior: Trigger / State A / State B / Transition — from the --state diffs.+ Include the implementation approach (CSS transition, IntersectionObserver, etc.)>++## Per-State Content+<for tabbed/stateful sections: full content per state. "N/A — static" otherwise>++## Assets+<local public/ paths + icon components used. Note layered compositions explicitly.>++## Text Content+<verbatim from the walker output — never paraphrased>++## Responsive Behavior+<from responsive.json: real column counts and changes at 390 / 768 / 1440 + breakpoint>+```++### 3c. Lint gate+```bash+node scripts/lint-spec.mjs docs/research/components/<route-slug>/<name>.spec.md+```+Fails → extract more. Passes → `manifest.mjs set … --stage specd` and dispatch.++### 3d. Dispatch builder agent (worktree)++Every builder receives IN ITS PROMPT (never "go read the file"):+- The **full spec file contents inline**+- The screenshot paths (all 3 viewports)+- Shared imports available: `cn()`, `icons.tsx` components, shadcn `ui/` primitives, types from `src/types/`+- The target file path, and the data file to create in `src/data/` if the section has content collections+- The rule: verify `npx tsc --noEmit` passes before finishing+- **The ground-truth rule:** "`docs/research/<host>/sections/<name>.json` and `responsive.json` are ground truth. If this spec contradicts them, follow the JSON and report the discrepancy." Builders reliably catch spec errors this way — treat their reports as corrections to make to the spec file.++Complex section (3+ distinct sub-components) → one builder per sub-component + one for the wrapper, sub-components first. **Don't wait** — while builders run, extract the next section.++### 3e. Merge+As builders finish: merge worktree → `npm run typecheck && npm run lint` → fix errors immediately → `manifest.mjs set … --stage merged`. tsc catches the cross-worktree breaks (imports, prop types) that per-merge builds used to catch, in a fraction of the time.++**Once, after roughly half the page's sections are merged: run a full `npm run build` checkpoint.** It catches build-only failures (server/client component violations, route exports, metadata) while they're still cheap to bisect. Don't build after every merge.++## Phase 4 — Page Assembly++Per page: create `src/app/<route>/page.tsx` importing its section components with data from `src/data/`, plus page-level behaviors (scroll-snap, observers, smooth scroll). Shared chrome mounts in `layout.tsx` or a route group layout. Wire internal nav links to the cloned routes. `npm run build` must pass.++## Phase 5 — Scored QA Loop++Start the clone: `npm run dev` (background). Then **score the whole page's sections in ONE batched call** (one load per side per viewport instead of one per section):++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --route <r> --viewport all+node scripts/manifest.mjs set --route <r> --section <name> --score pc=<match> # per section × viewport+```++**Fix iterations stay single-section** — the original-side shots captured by the sweep are cached, so a re-diff only re-renders the clone:++```bash+node scripts/diff.mjs --original <orig-page-url> --clone http://localhost:3000<route> --selector "<sel>" --viewport all --name <name>+```++- **Pass = ≥95% on all three viewports** → `--stage qa_passed`+- Below 95% → **read the band breakdown first**: it names the y-range where the mismatch lives, so you inspect that band of the diff image in `docs/research/qa/` instead of eyeballing the whole section. Then check the spec (wrong extraction → re-extract and fix; right spec, wrong build → fix component), re-diff+- A large height mismatch reported by diff.mjs = missing content or wrong spacing — fix before pixel-tweaking+- Max 3 fix iterations per section, then record the gap honestly and move on+- **Text-heavy sections at phone width often plateau at 90–95%** when the target's font isn't available on Google Fonts (e.g. Source Sans Pro → Source Sans 3). Different metrics = different wrap points = unavoidable pixel drift. Confirm the layout matches, note the substitution, and accept it.+- **A score that's high at pc but low at ipad/phone is always a responsive-spec problem**, not a styling bug. Re-run `probe.mjs` on the section and fill in the values the spec was missing.+- Finally, test behaviors manually: scroll, click every tab, hover — screenshots can't verify motion; you must++Whole-page diffs (`--selector` omitted) at all 3 viewports close out each page.++## What NOT to Do++- **Don't build click-tabs when the original is scroll-driven** (or vice versa). Scroll first, watch, then click. Wrong model = rewrite.+- **Don't extract only the default state.** Every tab clicked, every hover captured, header at scroll 0 AND past the trigger.+- **Don't miss layered/overlay images** — check `siblingImgs` and z-index hints in `assets.json`.+- **Don't build HTML mockups of things that are actually `<video>`, Lottie, or canvas.** Check first.+- **Don't approximate ("looks like text-lg").** Use the walker's exact computed values; use arbitrary values (`text-[17px]`) when Tailwind's scale doesn't match.+- **Don't dispatch a builder without a lint-passing spec.** No exceptions — that's the whole quality model.+- **Don't reference docs from builder prompts** — spec contents go inline.+- **Don't skip the manifest updates.** An untracked run can't resume.+- **Don't hardcode content in components.** Content → `src/data/`, components take props.+- **Don't write "same as desktop" in a Responsive section.** Root font-size steps at breakpoints on most real sites, so every number changes. Run `probe.mjs` and write the real values for all three widths — lint-spec now rejects vague responsive sections.+- **Don't forget `::before` / `::after`.** They carry hero overlays, heading underline bars, and icon glyphs. `section.mjs` captures them under a `pseudo` key — if a spec has none and the screenshot shows decorations, extraction was incomplete.+- **Don't trust the spec over the extraction JSON.** Specs are hand-written summaries and drift; `sections/*.json` is machine-measured.+- **Don't declare done without QA scores.** "Looks right" is not a number.++## Completion Report++- Pages cloned (routes) · sections built · spec files written (must match section count)+- Assets downloaded (from `assets.json` download log, including failures)+- Final QA score table per section × viewport (from `manifest.mjs status`)+- `npm run build` result+- Known gaps and any section that couldn't reach 95%+- Suggest next step: `/restyle` to rebrand the clone with your own identitydiff --git a/.windsurf/workflows/restyle.md b/.windsurf/workflows/restyle.mdnew file mode 100644index 0000000..8014877--- /dev/null+++ b/.windsurf/workflows/restyle.md@@ -0,0 +1,45 @@+<!-- GENERATED from .claude/skills/restyle/SKILL.md by scripts/sync-skills.mjs — edit the source,+ then run: node scripts/sync-skills.mjs -->++# Restyle++Turn the cloned site into **the user's site**: their brand, their words, their logo — on top of the cloned structure. Layout, spacing, animations, and interactions stay untouched. That separation works because the clone pipeline keeps all content in `src/data/*.ts` and all brand tokens in `globals.css` — you swap those layers only.++Honor any extra instructions the user provided when invoking this command.++## Step 1 — Read the brand++Read `BRAND.md` at the repo root. If it's missing or has unfilled `TODO` fields, ask the user for what's missing (max 3 questions at a time). Never ask for secrets in chat — anything sensitive belongs in env files, not BRAND.md.++If the user has brand assets (logo files, product screenshots), ask them to drop the files into `public/brand/` and tell you the filenames.++## Step 2 — Take "before" screenshots++```bash+npm run dev # background+node scripts/extract/screenshot.mjs http://localhost:3000 --name before-restyle+```+These are your regression reference: after restyling, layout must still match them structurally.++## Step 3 — Swap the brand layers (in this order)++1. **Colors** — `src/app/globals.css`: replace the cloned palette in `:root` / `.dark` with the brand colors from BRAND.md. Keep the same token *names* so no component changes. Preserve relative contrast: if the original had a dark section, keep it dark in the new palette.+2. **Fonts** — `src/app/layout.tsx`: swap `next/font` families to the brand fonts. Keep the size/weight structure the clone extracted — only families change.+3. **Logo & icons** — replace `LogoIcon` in `src/components/icons.tsx` (or the logo `<img>` asset) with the brand logo from `public/brand/`. Keep the rendered dimensions of the original logo so the header layout doesn't shift.+4. **Favicons & SEO** — regenerate `public/seo/` (favicon, apple-touch-icon, OG image if provided), update `layout.tsx` metadata: title, description, OG tags — from BRAND.md positioning.+5. **Copy** — rewrite every string in `src/data/*.ts` for the brand: same structure, same approximate length (±20% — long copy breaks cloned layouts), brand voice from BRAND.md. Headlines sell the user's offer, not the original company's. Placeholder patterns like testimonials get realistic brand-appropriate content clearly marked as placeholders unless BRAND.md provides real ones.+6. **Images** — where the clone shows the original company's product shots, swap in files from `public/brand/` if provided; otherwise leave the cloned image and list it in the report as "needs replacement".++## Step 4 — Verify++1. `npm run build` — must pass+2. `node scripts/extract/screenshot.mjs http://localhost:3000 --name after-restyle`+3. Compare before/after at all 3 viewports: layout identical, only brand layers changed. Overflowing text = shorten the copy, never change the layout.+4. Check every page route, not just `/`.++## Report++- What was swapped (colors, fonts, logo, favicon, N copy blocks across M data files)+- Images still showing the original site's content (need user-provided replacements)+- Any copy that had to be shortened/lengthened to fit+- Anything in BRAND.md still marked TODOdiff --git a/.windsurfrules b/.windsurfrulesnew file mode 100644index 0000000..dcc3e11--- /dev/null+++ b/.windsurfrules@@ -0,0 +1,2 @@+This project uses AGENTS.md as the single source of truth for all AI agent instructions.+Windsurf reads AGENTS.md automatically — see the project root for complete guidelines.diff --git a/AGENTS.md b/AGENTS.mdnew file mode 100644index 0000000..68473fc--- /dev/null+++ b/AGENTS.md@@ -0,0 +1,66 @@+# site-cloner++Template for cloning any multi-page website into this Next.js codebase, then rebranding it as your own. Two commands drive everything: `/clone-website <url>` and `/restyle`.++## Tech Stack++- **Next.js 16** — App Router, React 19, TypeScript strict+- **Tailwind CSS v4** + shadcn/ui (base-ui primitives), oklch tokens in `src/app/globals.css`+- **Lucide React** icons (replaced by extracted SVGs in `src/components/icons.tsx` during cloning)+- **Playwright** (devDependency) powers all extraction/QA scripts++## Commands++- `npm run dev` / `npm run build` / `npm run lint` / `npm run typecheck`+- `npm run check` — lint + typecheck + build (must pass before any commit)++## Architecture Rules++- **Content lives in `src/data/*.ts`, never hardcoded in components.** Components take props. This is what makes `/restyle` possible — copy swaps without touching layout.+- Pages: `src/app/<route>/page.tsx` wires data → components. Shared header/footer mount in layouts.+- `docs/research/` holds extraction artifacts (JSON, specs, manifest) — auditable, never hand-edited except spec files.+- `docs/research/manifest.json` is the pipeline state. Update it at every stage transition; check it first on any clone-related task (`node scripts/manifest.mjs status`).+- Specs (`docs/research/components/**/*.spec.md`) must pass `node scripts/lint-spec.mjs` before any builder agent is dispatched.+- All extraction numbers come from `scripts/` (computed styles, real column counts, pixel diffs) — never estimated by eye.++## Code Style++- TypeScript strict, no `any`+- Named exports, PascalCase components, camelCase utils+- Tailwind utility classes; arbitrary values (`text-[17px]`) when the extracted value doesn't match Tailwind's scale+- 2-space indentation++## Skills / Commands++Two workflows, each with a single source of truth in `.claude/skills/<name>/SKILL.md`:++| Command | Purpose |+|---|---|+| `/clone-website <url>` | Crawl, extract, spec, build, and pixel-diff QA a full multi-page clone |+| `/restyle` | Swap colors, fonts, logo, and copy for your brand — layout stays intact |++Where your tool finds them (all generated from the same source):++- **Claude Code:** `.claude/skills/<name>/SKILL.md`+- **Codex CLI:** `.codex/skills/<name>/SKILL.md`+- **GitHub Copilot coding agent:** `.github/skills/<name>/SKILL.md`+- **Cursor:** `.cursor/commands/<name>.md`+- **Windsurf:** `.windsurf/workflows/<name>.md`+- **Gemini CLI:** `.gemini/commands/<name>.toml`+- **OpenCode:** `.opencode/commands/<name>.md`+- **Continue:** `.continue/commands/<name>.md`+- **Augment Code:** `.augment/commands/<name>.md`+- **Amazon Q Developer CLI:** `.amazonq/cli-agents/<name>.json`+- **Cline / Roo Code, Aider, anything else:** open `.claude/skills/<name>/SKILL.md` and follow it as a prompt.++The extraction scripts are plain Node CLIs any agent can run; Chromium auto-installs on first use (or `npm run setup`). No subagent support in your tool? Build sections sequentially from the same lint-passing specs.++## Ethics++Clone sites you own or have permission to rebuild (platform migration, lost source, learning). Never for phishing, impersonation, or passing off someone's design as your own.++## Keeping Agent Configs in Sync++- `.claude/skills/*/SKILL.md` and this file (`AGENTS.md`) are the only sources of truth for per-tool configs.+- After editing either, run `node scripts/sync-skills.mjs` to regenerate every per-tool copy.+- Generated files are committed; CI runs `node scripts/sync-skills.mjs --check` and fails if any are stale.diff --git a/CHANGELOG.md b/CHANGELOG.mdnew file mode 100644index 0000000..cde9457--- /dev/null+++ b/CHANGELOG.md@@ -0,0 +1,45 @@+# Changelog++All notable changes to this project will be documented in this file.++The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).++## [0.2.0] - 2026-07-21++### Added++- Multi-tool portability: instruction files and skills for 12 agent tools (Claude Code, Cursor, Windsurf, GitHub Copilot, Codex CLI, Gemini CLI, Cline/Roo Code, Continue, Amazon Q, Augment Code, OpenCode, Aider), regenerated by a sync script+- Docker packaging: multi-stage production `Dockerfile` (Next.js standalone on `node:22-alpine`), Playwright-based `Dockerfile.dev` with Chromium preinstalled, `docker-compose.yml` with prod + dev services, and `.dockerignore`+- Auto-installing Chromium — extraction scripts install the browser on first run, no manual `npx playwright install` step+- Bug report and feature request issue templates, pull request template, and this changelog+- Repository metadata in `package.json` (repository, homepage, bugs)++### Changed++- Performance overhaul of the extraction pipeline:+ - One-shot page recon (`page.mjs`) — full extraction in 3 page loads per page instead of one load per collector+ - Replaced blind `networkidle` waits with a hard cap plus precise settle signals (fonts, images, animation frames) running concurrently+ - Disk-backed response cache shared across scripts, so repeat visits never re-fetch the original site+ - 8-way concurrent asset downloads+ - QA compares all viewports of a page in one call, cropping section shots out of a single full-page capture and caching original-side screenshots+- Precision improvements to extraction and QA:+ - Animations frozen at their end state before screenshots, so diffs measure layout instead of motion+ - Pixel-diff mismatches localized to 10 horizontal bands per section with absolute page coordinates, so builder agents get told exactly where to look+ - Single-pass batched style walker that is pseudo-element-aware (`::before`/`::after` styles captured alongside the owning element)+ - `<canvas>` content captured via `captureStream` on the shared browser instead of being left as a hole++## [0.1.0] - 2026-07-21++### Added++- Initial template: clone any multi-page website into a clean Next.js 16 + Tailwind CSS v4 + shadcn/ui codebase+- Playwright extraction scripts — crawl, computed styles, real CSS rules, design tokens, responsive breakpoints, assets, screenshots (`scripts/extract/`)+- Spec-driven parallel builds: per-component spec files linted by `lint-spec.mjs`, built by parallel agents, tracked in `docs/research/manifest.json`+- Scored visual QA: pixel-diff comparison against the original site (`scripts/diff.mjs`)+- `/clone-website` and `/restyle` skills driving the full pipeline+- Uploadthing example clone in `examples/`+- MIT license++[0.2.0]: https://github.com/Mahanaicoach/site-cloner/compare/v0.1.0...v0.2.0+[0.1.0]: https://github.com/Mahanaicoach/site-cloner/releases/tag/v0.1.0diff --git a/CLAUDE.md b/CLAUDE.mdindex 1217e10..6dbf165 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -7,7 +7,7 @@ Template for cloning any multi-page website into this Next.js codebase, then reb- **Next.js 16** — App Router, React 19, TypeScript strict- **Tailwind CSS v4** + shadcn/ui (base-ui primitives), oklch tokens in `src/app/globals.css`- **Lucide React** icons (replaced by extracted SVGs in `src/components/icons.tsx` during cloning)-- **Playwright** (devDependency) powers all extraction/QA scripts — first run needs `npx playwright install chromium`+- **Playwright** (devDependency) powers all extraction/QA scripts — Chromium auto-installs on the first script run (`npm run setup` to do it explicitly)## Commandsdiff --git a/Dockerfile b/Dockerfilenew file mode 100644index 0000000..e30557d--- /dev/null+++ b/Dockerfile@@ -0,0 +1,73 @@+# Production image for the FINISHED clone only.+# It serves the built Next.js site — no Playwright, no extraction scripts.+# Cloning itself happens in the dev container (see Dockerfile.dev).+#+# Based on https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile++# IMPORTANT: Node.js version maintenance+# This Dockerfile uses node:22-alpine to match the repo's Node 22 baseline+# (package.json "engines" + .nvmrc). Update NODE_VERSION when the baseline changes.+ARG NODE_VERSION=22-alpine++# ============================================+# Stage 1: Install dependencies+# ============================================+FROM node:${NODE_VERSION} AS dependencies++WORKDIR /app++# Copy manifest + lockfile first to leverage Docker layer caching+COPY package.json package-lock.json ./++# Frozen lockfile for reproducible builds; skip Playwright's browser download —+# the production image never runs a browser+RUN --mount=type=cache,target=/root/.npm \+ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm ci --no-audit --no-fund++# ============================================+# Stage 2: Build the Next.js app (standalone output)+# ============================================+FROM node:${NODE_VERSION} AS builder++WORKDIR /app++COPY --from=dependencies /app/node_modules ./node_modules+COPY . .++ENV NODE_ENV=production+ENV NEXT_TELEMETRY_DISABLED=1++# next.config.ts sets output: "standalone", so the build emits a+# self-contained server in .next/standalone+RUN npm run build++# ============================================+# Stage 3: Slim runtime+# ============================================+FROM node:${NODE_VERSION} AS runner++WORKDIR /app++ENV NODE_ENV=production+ENV PORT=3000+ENV HOSTNAME="0.0.0.0"+ENV NEXT_TELEMETRY_DISABLED=1++# public/ holds the cloned site's downloaded assets (images, fonts, videos) —+# it must ship with the runtime image+COPY --from=builder --chown=node:node /app/public ./public++# Correct permissions for the prerender cache+RUN mkdir .next && chown node:node .next++# Output-file-tracing keeps the runtime image small:+# https://nextjs.org/docs/app/api-reference/config/next-config-js/output+COPY --from=builder --chown=node:node /app/.next/standalone ./+COPY --from=builder --chown=node:node /app/.next/static ./.next/static++# Non-root for security+USER node++EXPOSE 3000++CMD ["node", "server.js"]diff --git a/Dockerfile.dev b/Dockerfile.devnew file mode 100644index 0000000..ecb972c--- /dev/null+++ b/Dockerfile.dev@@ -0,0 +1,21 @@+# Dev image: runs `next dev` AND the Playwright extraction/QA scripts.+#+# Base image ships Chromium + all system deps preinstalled (PLAYWRIGHT_BROWSERS_PATH+# is set by the image, so `npx playwright install chromium` is NOT needed here).+# IMPORTANT: keep this tag in sync with the "playwright" version in package.json+# devDependencies — mismatched versions look for missing browser builds.+FROM mcr.microsoft.com/playwright:v1.61.1-noble++WORKDIR /app++COPY package.json package-lock.json ./+RUN npm ci --no-audit --no-fund++# Source files are mounted as a volume at runtime for hot reload++EXPOSE 3000++ENV NODE_ENV=development+ENV NEXT_TELEMETRY_DISABLED=1++CMD ["npm", "run", "dev"]diff --git a/GEMINI.md b/GEMINI.mdnew file mode 100644index 0000000..43c994c--- /dev/null+++ b/GEMINI.md@@ -0,0 +1 @@diff --git a/README.md b/README.mdindex fd2cbf1..cde7efd 100644--- a/README.md+++ b/README.md@@ -11,8 +11,7 @@ Point it at a URL. `/clone-website` crawls the site, measures everything with sc1. Create your own repository from this template (**Use this template** on GitHub), then clone it.2. Install:```bash- npm install- npx playwright install chromium+ npm install # Chromium auto-installs on the first extraction run (or: npm run setup)```3. Start Claude Code (Chrome integration recommended for interaction discovery):```bash@@ -63,25 +62,39 @@ Phase 5 QA loop pixel-diff every section × 3 viewports until ≥95% matchAll plain Playwright — run standalone, no MCP needed:```bash+node scripts/extract/page.mjs <url> # ONE-SHOT recon: tokens, css, assets, responsive,+ # section walks + every screenshot — 3 page loads, ~15snode scripts/extract/crawl.mjs <url> [--max 25] # discover pages-node scripts/extract/tokens.mjs <url> # colors, fonts, CSS vars-node scripts/extract/assets.mjs <url> # download all images/videos/SVGs/fonts-node scripts/extract/section.mjs <url> --selector "x" # computed styles (+ --state for hover/scroll/click diffs)-node scripts/extract/screenshot.mjs <url> # phone/iPad/PC screenshots-node scripts/extract/responsive.mjs <url> # real layout changes across viewports+node scripts/extract/section.mjs <url> --selector "x" --state hover:".card" # hover/scroll/click state diffsnode scripts/extract/probe.mjs <url> --selector "x" # per-viewport value table for specs-node scripts/extract/css.mjs <url> # real :hover/:focus rules + breakpoints from the stylesheetsnode scripts/extract/canvas.mjs <url> # capture <canvas> artwork as video/PNG-node scripts/diff.mjs --original <url> --clone <url> # scored pixel diff+node scripts/extract/tokens.mjs / css.mjs / assets.mjs / responsive.mjs / screenshot.mjs # single-purpose re-runs+node scripts/diff.mjs --original <url> --clone <url> --viewport all # scored pixel diff, all 3 viewports in one+ # call; 10-band breakdown names WHERE it mismatchesnode scripts/lint-spec.mjs docs/research/components # spec completeness gatenode scripts/manifest.mjs status # pipeline state / resume point```+## Supported agents++The two skills are written once in `.claude/skills/` and synced to every other tool's native format (`node scripts/sync-skills.mjs`; CI fails if generated configs go stale):++**Claude Code** (native) · **Cursor** · **Windsurf** · **GitHub Copilot** · **Gemini CLI** · **Amazon Q** · **Codex** · **Cline** · **Continue** · **opencode** · **Augment** · **Aider** — plus a generic [`AGENTS.md`](AGENTS.md) that most other tools pick up automatically.++The extraction scripts are plain Node CLIs, so any agent can run them. Tools without subagent/worktree support build sections sequentially from the same lint-gated specs — every quality gate still applies.++## Docker++```bash+docker compose up dev # dev server on :3000, Playwright preinstalled (extraction works in-container)+docker compose up app # production: slim standalone build of the finished clone+```+## StackNext.js 16 (App Router, React 19, TS strict) · Tailwind CSS v4 · shadcn/ui · Playwright + pixelmatch (dev)-Requires Node 22+.+Requires Node 22+ (auto via `.nvmrc`).## Intended Usediff --git a/docker-compose.yml b/docker-compose.ymlnew file mode 100644index 0000000..628325b--- /dev/null+++ b/docker-compose.yml@@ -0,0 +1,58 @@+services:+ # Production: serves the finished clone (slim standalone build, no Playwright)+ app:+ build:+ context: .+ dockerfile: Dockerfile+ target: runner+ image: site-cloner:latest+ container_name: site-cloner+ restart: unless-stopped+ ports:+ - "${PORT:-3000}:3000"+ environment:+ - NODE_ENV=production+ - NEXT_TELEMETRY_DISABLED=1+ env_file:+ - path: .env.local+ required: false+ - path: .env+ required: false+ healthcheck:+ test: ["CMD-SHELL", "node -e \"fetch('http://localhost:3000/').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]+ interval: 30s+ timeout: 10s+ retries: 3+ start_period: 10s++ # Dev: `next dev` + Playwright Chromium for the extraction/QA scripts.+ # Source is bind-mounted for hot reload; node_modules and .next stay in-container.+ # Both services default to port 3000 — start one at a time+ # (`docker compose up dev` or `docker compose up app`), or set DEV_PORT.+ dev:+ build:+ context: .+ dockerfile: Dockerfile.dev+ image: site-cloner:dev+ container_name: site-cloner-dev+ restart: unless-stopped+ ports:+ - "${DEV_PORT:-3000}:3000"+ environment:+ - NODE_ENV=development+ - NEXT_TELEMETRY_DISABLED=1+ env_file:+ - path: .env.local+ required: false+ - path: .env+ required: false+ volumes:+ - .:/app+ - /app/node_modules+ - /app/.next+ healthcheck:+ test: ["CMD-SHELL", "node -e \"fetch('http://localhost:3000/').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]+ interval: 30s+ timeout: 10s+ retries: 3+ start_period: 15sdiff --git a/package.json b/package.jsonindex 661163b..a3ddd17 100644--- a/package.json+++ b/package.json@@ -1,10 +1,18 @@{"name": "site-cloner",- "version": "0.1.0",+ "version": "0.2.0","private": true,"description": "Clone any multi-page website into a clean Next.js codebase with Claude Code — scripted extraction, spec-driven parallel builds, and scored visual QA","author": "Mahanaicoach","license": "MIT",+ "repository": {+ "type": "git",+ "url": "git+https://github.com/Mahanaicoach/site-cloner.git"+ },+ "homepage": "https://github.com/Mahanaicoach/site-cloner#readme",+ "bugs": {+ "url": "https://github.com/Mahanaicoach/site-cloner/issues"+ },"engines": {"node": ">=22"},@@ -14,7 +22,8 @@"start": "next start","lint": "eslint","typecheck": "tsc --noEmit",- "check": "npm run lint && npm run typecheck && npm run build"+ "check": "npm run lint && npm run typecheck && npm run build",+ "setup": "playwright install chromium"},"dependencies": {"@base-ui/react": "^1.3.0",diff --git a/scripts/extract/page.mjs b/scripts/extract/page.mjsindex 55e45c0..0e6583d 100644--- a/scripts/extract/page.mjs+++ b/scripts/extract/page.mjs@@ -118,8 +118,11 @@ const [signatures, walks, tokens, css, assetsFound] = await Promise.all([const meta = { url, generatedAt: new Date().toISOString() };if (tokens) writeJson(`docs/research/${host}/tokens.json`, { ...meta, ...tokens });if (css) {- const { interactiveCount, blockedCount, ...cssOut } = css;- writeJson(`docs/research/${host}/css.json`, { ...meta, ...cssOut });+ // interactiveCount/blockedCount are stdout-summary fields, not research data+ const cssOut = { ...meta, ...css };+ delete cssOut.interactiveCount;+ delete cssOut.blockedCount;+ writeJson(`docs/research/${host}/css.json`, cssOut);}writeJson(`docs/research/${host}/responsive.json`, {...meta,diff --git a/scripts/lib.mjs b/scripts/lib.mjsindex 6c2f64d..edbf5b8 100644--- a/scripts/lib.mjs+++ b/scripts/lib.mjs@@ -1,6 +1,7 @@// Shared helpers for all extraction/QA scripts.import { chromium } from "playwright";import { PNG } from "pngjs";+import { spawnSync } from "node:child_process";import { mkdirSync, writeFileSync, readFileSync, renameSync } from "node:fs";import { createHash } from "node:crypto";import { dirname, join } from "node:path";@@ -179,8 +180,24 @@ async function enableResponseCache(context) {});}+// Launch Chromium, installing it on the fly if this is a fresh checkout.+// "npx playwright install chromium" as a manual first step is exactly the kind+// of setup friction that makes a template feel broken — the error Playwright+// throws names the fix, so apply it automatically and retry once.+async function launchInstallingIfMissing() {+ try {+ return await chromium.launch({ headless: true });+ } catch (err) {+ if (!/playwright install|Executable doesn't exist/i.test(String(err?.message))) throw err;+ console.error(" Chromium not installed — running `npx playwright install chromium` (one-time)…");+ const r = spawnSync("npx", ["playwright", "install", "chromium"], { stdio: "inherit" });+ if (r.status !== 0) throw err;+ return chromium.launch({ headless: true });+ }+}+export function getBrowser() {- if (!_browserPromise) _browserPromise = chromium.launch({ headless: true });+ if (!_browserPromise) _browserPromise = launchInstallingIfMissing();return _browserPromise;}diff --git a/scripts/sync-skills.mjs b/scripts/sync-skills.mjsnew file mode 100644index 0000000..b3fbfea--- /dev/null+++ b/scripts/sync-skills.mjs@@ -0,0 +1,205 @@+#!/usr/bin/env node+// Skill/rules sync generator — WHY: ~12 AI coding tools each want the same instructions+// in their own folder and format, and hand-maintained copies always drift. The only+// sources of truth are .claude/skills/*/SKILL.md (the two workflows) and AGENTS.md+// (project rules); everything else here is a generated, committed artifact.+//+// Usage: node scripts/sync-skills.mjs regenerate every per-tool file+// node scripts/sync-skills.mjs --check exit 1 listing stale files (CI gate)+//+// Placeholder conventions per tool (mirrors JCodesMore/ai-website-cloner-template):+// Claude/Codex/Copilot skills . . $ARGUMENTS (native, file copied verbatim)+// OpenCode / Augment / Continue . $ARGUMENTS (native, body kept as-is)+// Gemini CLI . . . . . . . . . . {{args}}+// Cursor / Windsurf / Amazon Q . no substitution — $ARGUMENTS becomes prose+import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";+import { dirname, join } from "node:path";+import { fileURLToPath } from "node:url";++const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");+const CHECK = process.argv.includes("--check");++// Per-skill metadata that can't be derived from SKILL.md itself:+// - shortDesc: one-liner for tools whose description field is a single string+// - argsProse: what replaces $ARGUMENTS in tools with no argument substitution+// - fileContext: extra context files for the Amazon Q agent definition+const SKILL_META = {+ "clone-website": {+ shortDesc: "Reverse-engineer and clone a full multi-page website as a pixel-accurate Next.js replica",+ argsProse: "the target URL (plus any extra instructions) provided by the user",+ fileContext: ["AGENTS.md", "docs/research/**"],+ },+ restyle: {+ shortDesc: "Rebrand a cloned website with your own colors, fonts, logo, and copy while keeping the layout pixel-intact",+ argsProse: "Honor any extra instructions the user provided when invoking this command.",+ fileContext: ["AGENTS.md", "BRAND.md", "docs/research/**"],+ },+};++const fail = (msg) => {+ console.error(`Error: ${msg}`);+ process.exit(1);+};++// All outputs are built in memory first so --check can diff without touching disk.+const outputs = new Map(); // relPath -> content+const emit = (relPath, content) => outputs.set(relPath, content);++const header = (source) =>+ `<!-- GENERATED from ${source} by scripts/sync-skills.mjs — edit the source,\n` ++ ` then run: node scripts/sync-skills.mjs -->\n\n`;++// --- Skills: .claude/skills/*/SKILL.md → per-tool command/skill files ---++const skillsDir = join(ROOT, ".claude", "skills");+const skillNames = readdirSync(skillsDir, { withFileTypes: true })+ .filter((e) => e.isDirectory() && existsSync(join(skillsDir, e.name, "SKILL.md")))+ .map((e) => e.name)+ .sort();+if (!skillNames.length) fail("no skills found under .claude/skills/");++for (const name of skillNames) {+ const sourceRel = `.claude/skills/${name}/SKILL.md`;+ const raw = readFileSync(join(ROOT, sourceRel), "utf8").replace(/\r\n/g, "\n");+ const match = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);+ if (!match) fail(`could not parse frontmatter in ${sourceRel}`);++ // Frontmatter is flat key: value lines — a full YAML parser would be a dependency.+ const fm = {};+ for (const line of match[1].split("\n")) {+ const kv = line.match(/^([a-zA-Z-]+):\s*(.*)$/);+ if (kv) fm[kv[1]] = kv[2];+ }+ const body = match[2].replace(/^\n+/, "").replace(/\n*$/, "\n");+ const meta = SKILL_META[name] ?? {};+ const shortDesc = meta.shortDesc ?? (fm.description ?? name).split(". ")[0];+ const argsProse = meta.argsProse ?? "the arguments provided by the user";+ const noArgs = (text) => text.replace(/\$ARGUMENTS/g, argsProse);+ const mark = header(sourceRel);++ // 1. Codex CLI — reads the same SKILL.md format, $ARGUMENTS native. Verbatim copy:+ // a marker comment before the YAML frontmatter would break parsing, so none here.+ emit(`.codex/skills/${name}/SKILL.md`, raw);++ // 2. GitHub Copilot coding agent — same SKILL.md format, verbatim copy.+ emit(`.github/skills/${name}/SKILL.md`, raw);++ // 3. Cursor — plain markdown command, no argument substitution.+ // H1 title (lifted from the body) + description line, then the prose-args body.+ const h1 = body.match(/^# (.+)\n/);+ const title = h1 ? h1[1] : name;+ const afterH1 = h1 ? body.slice(h1[0].length).replace(/^\n+/, "") : body;+ emit(+ `.cursor/commands/${name}.md`,+ `${mark}# ${title}\n\n> ${shortDesc}\n\n${noArgs(afterH1)}`+ );++ // 4. Windsurf — markdown workflow, no argument substitution.+ emit(`.windsurf/workflows/${name}.md`, mark + noArgs(body));++ // 5. Gemini CLI — TOML command, {{args}} placeholder. The body goes in a multi-line+ // literal string ('''), which no escape sequence can break — but it cannot itself+ // contain ''' so guard against that ever appearing in a skill body.+ const geminiBody = body.replace(/\$ARGUMENTS/g, "{{args}}");+ if (geminiBody.includes("'''")) fail(`${sourceRel} contains ''' — breaks Gemini TOML literal string`);+ const tomlStr = (s) => `"${s.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;+ emit(+ `.gemini/commands/${name}.toml`,+ `# GENERATED from ${sourceRel} by scripts/sync-skills.mjs — edit the source,\n` ++ `# then run: node scripts/sync-skills.mjs\n\n` ++ `description = ${tomlStr(shortDesc)}\n` ++ `name = ${tomlStr(name)}\n\n` ++ `prompt = '''\n${geminiBody}'''\n`+ );++ // 6. OpenCode — markdown + YAML frontmatter, $ARGUMENTS works natively.+ emit(+ `.opencode/commands/${name}.md`,+ `---\ndescription: "${shortDesc}"\n---\n${mark}${body}`+ );++ // 7. Augment Code — markdown + YAML frontmatter, keeps the source argument-hint.+ const argHint = fm["argument-hint"] ? `argument-hint: ${fm["argument-hint"]}\n` : "";+ emit(+ `.augment/commands/${name}.md`,+ `---\ndescription: "${shortDesc}"\n${argHint}---\n${mark}${body}`+ );++ // 8. Continue — prompt file with invokable: true.+ emit(+ `.continue/commands/${name}.md`,+ `---\nname: ${name}\ndescription: "${shortDesc}"\ninvokable: true\n---\n${mark}${body}`+ );++ // 9. Amazon Q Developer CLI — JSON agent definition (JSON allows no comment marker).+ emit(+ `.amazonq/cli-agents/${name}.json`,+ JSON.stringify(+ { name, description: shortDesc, prompt: noArgs(body).trim(), fileContext: meta.fileContext ?? ["AGENTS.md"] },+ null,+ 2+ ) + "\n"+ );+}++// --- Rules: AGENTS.md → copies for tools that don't read AGENTS.md natively ---+// (Codex, OpenCode, Cursor, Windsurf, Aider & co. read AGENTS.md or a thin pointer;+// Copilot Chat, Cline/Roo, Continue, and Amazon Q need their own committed copy.)++const agentsPath = join(ROOT, "AGENTS.md");+if (!existsSync(agentsPath)) fail("AGENTS.md not found at repo root");++// Resolve @path imports (Claude Code / Gemini syntax) into inline content so tools+// without import support still get the full text.+const resolveImports = (text) =>+ text+ .split("\n")+ .map((line) => {+ const m = line.match(/^@(.+)$/);+ if (!m) return line;+ const imported = join(ROOT, m[1].trim());+ if (!existsSync(imported)) return `<!-- Import not found: ${m[1].trim()} -->`;+ return readFileSync(imported, "utf8").replace(/\r\n/g, "\n").trimEnd();+ })+ .join("\n");++const rules = resolveImports(readFileSync(agentsPath, "utf8").replace(/\r\n/g, "\n")).replace(/\n*$/, "\n");+const rulesMark = header("AGENTS.md");++emit(".github/copilot-instructions.md", rulesMark + rules);+emit(".clinerules", rulesMark + rules);+emit(+ ".continue/rules/project.md",+ `---\ndescription: Project conventions for the site-cloner template\nalwaysApply: true\n---\n${rulesMark}${rules}`+);+emit(".amazonq/rules/project.md", rulesMark + rules);++// --- Write or check ---++if (CHECK) {+ const stale = [];+ for (const [rel, content] of outputs) {+ let current = null;+ try {+ current = readFileSync(join(ROOT, rel), "utf8");+ } catch {+ // missing file counts as stale+ }+ if (current !== content) stale.push(rel);+ }+ if (stale.length) {+ console.error("Stale generated files — run `node scripts/sync-skills.mjs` and commit:");+ for (const rel of stale) console.error(` ✗ ${rel}`);+ process.exit(1);+ }+ console.log(`✓ All ${outputs.size} generated files are up to date.`);+} else {+ console.log(`Syncing ${skillNames.length} skills + AGENTS.md to all platforms...\n`);+ for (const [rel, content] of outputs) {+ const full = join(ROOT, rel);+ mkdirSync(dirname(full), { recursive: true });+ writeFileSync(full, content, "utf8");+ console.log(` ✓ ${rel}`);+ }+ console.log(`\nDone — ${outputs.size} files generated. Sources: .claude/skills/*/SKILL.md, AGENTS.md.`);+}