multiclone 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +31 -42
  2. package/commands/multiclone.md +5 -10
  3. package/dist/adapters/cli.js +10 -1
  4. package/dist/adapters/cli.js.map +1 -1
  5. package/dist/capture/capture.js +189 -80
  6. package/dist/capture/capture.js.map +1 -1
  7. package/dist/capture/collectors/coverage.js +20 -18
  8. package/dist/capture/collectors/coverage.js.map +1 -1
  9. package/dist/capture/collectors/index.js +11 -0
  10. package/dist/capture/collectors/index.js.map +1 -1
  11. package/dist/capture/collectors/interactions.js +129 -130
  12. package/dist/capture/collectors/interactions.js.map +1 -1
  13. package/dist/capture/collectors/motion.js +14 -9
  14. package/dist/capture/collectors/motion.js.map +1 -1
  15. package/dist/capture/collectors/probes.js +3 -2
  16. package/dist/capture/collectors/probes.js.map +1 -1
  17. package/dist/capture/collectors/shots.js +38 -18
  18. package/dist/capture/collectors/shots.js.map +1 -1
  19. package/dist/capture/context.js +5 -0
  20. package/dist/capture/context.js.map +1 -1
  21. package/dist/compare/session.js +22 -16
  22. package/dist/compare/session.js.map +1 -1
  23. package/dist/compare/shoot.js +27 -9
  24. package/dist/compare/shoot.js.map +1 -1
  25. package/dist/contracts/catalog.js +5 -0
  26. package/dist/contracts/catalog.js.map +1 -1
  27. package/dist/contracts/tools/capture.js +22 -6
  28. package/dist/contracts/tools/capture.js.map +1 -1
  29. package/dist/contracts/tools/method.js +10 -6
  30. package/dist/contracts/tools/method.js.map +1 -1
  31. package/dist/contracts/tools/session.js +195 -0
  32. package/dist/contracts/tools/session.js.map +1 -0
  33. package/dist/core/page.js +39 -18
  34. package/dist/core/page.js.map +1 -1
  35. package/dist/domain/snapshot.js +1 -1
  36. package/dist/domain/snapshot.js.map +1 -1
  37. package/dist/project/assets.js +25 -4
  38. package/dist/project/assets.js.map +1 -1
  39. package/dist/project/draft.js +860 -0
  40. package/dist/project/draft.js.map +1 -0
  41. package/dist/project/method.js +4 -2
  42. package/dist/project/method.js.map +1 -1
  43. package/dist/project/scaffold.js +23 -21
  44. package/dist/project/scaffold.js.map +1 -1
  45. package/dist/session/discover.js +53 -0
  46. package/dist/session/discover.js.map +1 -0
  47. package/dist/session/proc.js +113 -0
  48. package/dist/session/proc.js.map +1 -0
  49. package/dist/session/progress.js +83 -0
  50. package/dist/session/progress.js.map +1 -0
  51. package/dist/session/session.js +450 -0
  52. package/dist/session/session.js.map +1 -0
  53. package/dist/session/state.js +47 -0
  54. package/dist/session/state.js.map +1 -0
  55. package/dist/version.js +1 -1
  56. package/install.sh +29 -0
  57. package/package.json +3 -2
  58. package/skills/multiclone/SKILL.md +38 -17
  59. package/templates/react-vite/src/app/App.tsx +6 -1
  60. package/templates/react-vite/src/app/Page.tsx +9 -2
  61. package/templates/react-vite/src/app/routes.ts +7 -0
  62. package/templates/react-vite/src/styles/draft.css +1 -0
  63. package/templates/react-vite/src/styles/index.css +1 -0
@@ -7,29 +7,50 @@ description: Clone a website from a link into a clean React + Vite + TypeScript
7
7
 
8
8
  The goal is a rebuild that a visitor can't tell apart from the original at any scroll position, on desktop and on mobile, including the intro, the scroll motion and the hover states. It must be clean, typed React that a senior engineer would be happy to own, not a pile of the original's minified code.
9
9
 
10
- The method has five stages. Do not skip the measuring: the difference between a lookalike and a clone is the compare loop at the end.
10
+ ## Fast path (use this)
11
+
12
+ 1. **Ask the scope first**, in one short question: just the landing page, specific pages (which ones), or the whole site. Don't start before the user answers.
13
+ 2. **Start:** `multiclone start <url> --scope landing|pages|site [--pages /pricing,/about]`. It returns in seconds with a **progress link** (for example `http://127.0.0.1:4300/`). Give that link to the user straight away: it shows live progress and then the clone itself.
14
+ 3. **Wait for the draft:** `multiclone status --wait draft`. In about 2–3 minutes the session has a quick capture (desktop and mobile in parallel), a React project with the captured fonts, tokens and media, a **first draft** (one component and CSS module per section with the real text, links, images and video), the clone running on localhost and an offline copy of the original. Status lists all the links.
15
+ 4. **Polish, don't rewrite.** The draft is in `<workspace>/clone/src/sections/<page>/`. Compare each section with its crop in `captures/<page>/sections/<id>/`, fix layout, make it responsive and clean, add the motion and hovers. Keep the dev server running; it hot-reloads.
16
+ 5. **Deep data arrives in the background.** Other pages (scope pages/site) and the deep pass (motion map, hovers, clicks, coverage, source maps, in `captures/<page>-full`) finish while you work. Check with `multiclone status`. Use the deep capture for motion and hovers when it's done.
17
+ 6. **Compare and fix** (stage 5 below), then hand over. `multiclone stop` ends the servers; the files stay.
18
+
19
+ Run `start` again to resume after a crash or restart: finished captures are reused and drafted pages are never overwritten.
20
+
21
+ Every command prints a short summary; details live in files. Read big things with `inspect` instead of opening whole files.
22
+
23
+ ## The stages in detail
24
+
25
+ The fast path runs stages 1 and 3 and a first pass of 4 for you. Use the tools below directly for anything it doesn't cover, or when you need more control.
11
26
 
12
27
  1. **Capture** the original (one call also analyses it into section bundles).
13
28
  2. **Understand** the page from `REPORT.md` and the section bundles.
14
29
  3. **Scaffold** the project from the capture: fonts, tokens, media and the mock API come along.
15
- 4. **Rebuild** it section by section, tagging elements with the `data-mc-*` markers.
30
+ 4. **Rebuild** (or polish the draft) section by section, tagging elements with the `data-mc-*` markers.
16
31
  5. **Compare and fix** until it is close, then hand over the localhost link.
17
32
 
18
- ## Tools
33
+ Do not skip the measuring: the difference between a lookalike and a clone is the compare loop at the end.
19
34
 
20
- The multiclone MCP server provides these tools (it runs with `npx -y multiclone mcp`). Without MCP, run the same tools from the terminal: `npx multiclone <command>`, and `npx multiclone <command> --help` lists the flags. Every tool returns a short text summary; big data stays on disk and is read with `inspect`.
35
+ ## Tools
21
36
 
22
- | Tool | What it does |
23
- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
24
- | `capture` | Real Chrome loads the page per viewport, dismisses consent banners, scrolls like a visitor and records the network, every script and its source maps, the computed-style DOM snapshot, fonts, storage, the intro filmstrip, the scroll motion map, runtime animation libraries, WebGL shaders, event listeners, hover/focus/click states and CSS breakpoints. Then it runs `analyze`. |
25
- | `analyze` | Rebuilds the derived files from a capture in an isolated worker: section bundles, design tokens, prettified code split into app and vendor, animation calls found in the code, and `REPORT.md`. |
26
- | `inspect` | Pages through anything in a capture by facet: `summary`, `section`, `dom`, `styles`, `network`, `motion`, `animations`, `runtime`, `interactions`, `code`, `fonts`, `tokens`. Use `selector`, `viewport`, `query`, `offset` and `limit` to keep pages small. |
27
- | `serve_mirror` | Serves a capture offline on localhost. `live` mode runs the original scripts with the captured storage seeded, so the animations work. `snapshot` mode serves the frozen DOM. Captured API calls become a mock API under `/__mc/api`. |
28
- | `scaffold` | Creates the strict React 19 + Vite + TS starter. With `capture` it installs the captured fonts, `tokens.css`, the media files and a dev proxy to the mock API. |
29
- | `assets` | Copies captured media into `public/media/<host>/…` and writes `src/content/asset-map.json` (scaffold with `capture` already does this). |
30
- | `shoot` | Screenshots at exact scroll offsets with real mouse-wheel scrolling, so Lenis and GSAP move. A `probe` JS expression runs after each scroll: element rects, CSS variables, computed styles. |
31
- | `compare` | Compares the clone with the original per viewport: frames, sections aligned by `data-mc-section`, structure, scroll motion by `data-mc-track`, hovers by `data-mc-hover`, and the intro with `intro`. Writes an HTML report and returns the worst sections and frames. |
32
- | `doctor` | Checks Node, Chrome and headless WebGL. |
37
+ Run them from the terminal: `multiclone <command>`, and `multiclone <command> --help` lists the flags (use `npx multiclone` if it isn't installed globally). The same tools are available over MCP (`multiclone mcp`) for agents that prefer it.
38
+
39
+ | Tool | What it does |
40
+ | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
41
+ | `start` | The fast path above: background session with quick capture, project, first draft, live clone, offline original, other pages and the deep pass. Returns the progress link. |
42
+ | `status` | Where the session is, with all links. `--wait draft`, `--wait pages` or `--wait deep` blocks until that point. |
43
+ | `stop` | Stops the session's servers. Files stay. |
44
+ | `draft` | Turns a capture into section components inside a scaffolded project (`start` runs it for you). |
45
+ | `capture` | Real Chrome loads the page per viewport, dismisses consent banners, scrolls like a visitor and records the network, every script and its source maps, the computed-style DOM snapshot, fonts, storage, the intro filmstrip, the scroll motion map, runtime animation libraries, WebGL shaders, event listeners, hover/focus/click states and CSS breakpoints. `--depth quick` keeps only what a draft needs (1–2 minutes). Then it runs `analyze`. |
46
+ | `analyze` | Rebuilds the derived files from a capture in an isolated worker: section bundles, design tokens, prettified code split into app and vendor, animation calls found in the code, and `REPORT.md`. |
47
+ | `inspect` | Pages through anything in a capture by facet: `summary`, `section`, `dom`, `styles`, `network`, `motion`, `animations`, `runtime`, `interactions`, `code`, `fonts`, `tokens`. Use `selector`, `viewport`, `query`, `offset` and `limit` to keep pages small. |
48
+ | `serve_mirror` | Serves a capture offline on localhost. `live` mode runs the original scripts with the captured storage seeded, so the animations work. `snapshot` mode serves the frozen DOM. Captured API calls become a mock API under `/__mc/api`. |
49
+ | `scaffold` | Creates the strict React 19 + Vite + TS starter. With `capture` it installs the captured fonts, `tokens.css`, the media files and a dev proxy to the mock API. |
50
+ | `assets` | Copies captured media into `public/media/<host>/…` and writes `src/content/asset-map.json` (scaffold with `capture` already does this). |
51
+ | `shoot` | Screenshots at exact scroll offsets, scrolling like a visitor so Lenis and GSAP move. A `probe` JS expression runs after each scroll: element rects, CSS variables, computed styles. A slow page or a failed shot becomes a warning, not a failure. |
52
+ | `compare` | Compares the clone with the original per viewport: frames, sections aligned by `data-mc-section`, structure, scroll motion by `data-mc-track`, hovers by `data-mc-hover`, and the intro with `intro`. Writes an HTML report and returns the worst sections and frames. |
53
+ | `doctor` | Checks Node, Chrome and headless WebGL. |
33
54
 
34
55
  The capture folder layout is documented in [references/capture-format.md](references/capture-format.md).
35
56
 
@@ -67,7 +88,7 @@ Before coding, write a short plan: the sections and their components, the techni
67
88
  Work top to bottom, one section bundle at a time. For pages with many sections, hand independent sections to a sub-agent using the `section-builder` brief ([agents/section-builder.md](../../agents/section-builder.md)), one section each, after the shell is in place.
68
89
 
69
90
  1. **Shell first:** fonts, tokens, header, footer, smooth scroll and any global background.
70
- 2. **Then each section:** read its `section.md`, rebuild it as one component under `src/components/sections/`, and look at it next to its crop before moving on.
91
+ 2. **Then each section:** read its `section.md`. If a draft exists (`src/sections/<page>/<Name>/`), polish it in place: turn repeated markup into data plus a map, rename classes to meaningful names, replace fixed widths with responsive layout, and delete wrappers that only existed for the original's framework. Otherwise rebuild it as one component under `src/sections/<page>/`. Look at it next to its crop before moving on.
71
92
  3. **Tag for compare** with the helpers in `@/lib/mc`:
72
93
  - `<section {...mcSection('03-pricing')}>` with the section id;
73
94
  - `{...mcTrack(id)}` on every element listed in the section's `motion.json`;
@@ -84,7 +105,7 @@ Run `npm run check` whenever a section is done.
84
105
 
85
106
  The full playbook is in [references/fidelity.md](references/fidelity.md).
86
107
 
87
- 1. Serve the capture with `serve_mirror` (`live`) as the stable original, and run the clone's dev server.
108
+ 1. Serve the capture with `serve_mirror` (`live`) as the stable original (a `start` session already serves it), and run the clone. For long compare runs prefer `npm run build && npm run preview` over the dev server: it loads much faster and is what ships.
88
109
  2. Run `compare` with `original` set to the **capture folder** and `clone` to the dev URL. The capture gives compare its sections, tracks and hovers; it shoots the mirror for pixels. Add `intro: true` when the page has an intro animation.
89
110
  3. Fix in this order: missing sections, page height, the worst section, untagged tracks and hovers, then the worst frames. Open the images yourself: the score guides, it doesn't judge.
90
111
  4. Measure with `shoot` and a `probe` on both sides instead of guessing.
@@ -1,10 +1,15 @@
1
1
  import { SmoothScroll } from '@/providers/SmoothScroll';
2
2
  import { Page } from '@/app/Page';
3
+ import { routes } from '@/app/routes';
4
+
5
+ // Links are plain anchors (full page loads), so the route is read once per load.
6
+ const path = window.location.pathname.replace(/\/+$/, '') || '/';
7
+ const Current = routes[path] ?? Page;
3
8
 
4
9
  export function App() {
5
10
  return (
6
11
  <SmoothScroll>
7
- <Page />
12
+ <Current />
8
13
  </SmoothScroll>
9
14
  );
10
15
  }
@@ -1,4 +1,11 @@
1
- /** Rebuilt sections go here, top to bottom, following the outline in the capture's REPORT.md. */
1
+ /**
2
+ * Fallback page. `multiclone draft` writes real pages to src/pages and sections to src/sections,
3
+ * then lists them in src/app/routes.ts.
4
+ */
2
5
  export function Page() {
3
- return <main id="main" />;
6
+ return (
7
+ <main id="main" style={{ padding: '4rem', fontFamily: 'system-ui, sans-serif' }}>
8
+ <p>multiclone is capturing the page. The first draft appears here in a minute or two.</p>
9
+ </main>
10
+ );
4
11
  }
@@ -0,0 +1,7 @@
1
+ import type { ComponentType } from 'react';
2
+ import { Page } from '@/app/Page';
3
+
4
+ /** Path → page component. `multiclone draft` regenerates this file for every drafted page. */
5
+ export const routes: Partial<Record<string, ComponentType>> = {
6
+ '/': Page,
7
+ };
@@ -0,0 +1 @@
1
+ /* Filled by `multiclone draft`: element reset and page-level styles of the original. */
@@ -1,3 +1,4 @@
1
1
  @import './fonts.css';
2
2
  @import './tokens.css';
3
3
  @import './base.css';
4
+ @import './draft.css';