@trueclone/cli 0.2.0 → 0.4.0-rc.1
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.
- package/README.md +27 -32
- package/bin/trueclone.mjs +28 -19
- package/package.json +2 -1
- package/scripts/capture.mjs +239 -9
- package/scripts/curves.mjs +44 -7
- package/scripts/detail.mjs +19 -6
- package/scripts/diff.mjs +4 -2
- package/scripts/drift.mjs +55 -0
- package/scripts/explain.mjs +87 -0
- package/scripts/hovers.mjs +144 -43
- package/scripts/interact.mjs +35 -5
- package/scripts/lib.mjs +77 -29
- package/scripts/load.mjs +106 -0
- package/scripts/next.mjs +158 -28
- package/scripts/owned.mjs +66 -0
- package/scripts/report.mjs +83 -17
- package/scripts/reveals.mjs +178 -80
- package/scripts/review.mjs +149 -0
- package/scripts/score.mjs +74 -9
- package/scripts/scripts-evidence.mjs +116 -0
- package/scripts/seed.mjs +420 -56
- package/scripts/states.mjs +38 -5
- package/scripts/tiles.mjs +33 -17
- package/scripts/understand.mjs +231 -0
- package/scripts/viewport-fit.mjs +198 -0
- package/skill/SKILL.md +119 -116
package/skill/SKILL.md
CHANGED
|
@@ -1,158 +1,161 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: trueclone
|
|
3
|
-
description: Build
|
|
3
|
+
description: Build the exact same website from its URL - HTML/CSS/JS clone and Next.js + Tailwind + shadcn app, identical at every screen size, plus DESIGN.md and a shadcn globals.css - and prove it with layout, scroll, canvas, motion, hover, interaction, style and load checks at seed and held-out screen sizes, and a frame-by-frame visual review. Use when the user gives a URL and asks to clone, replicate, rebuild or migrate a site or page, or to extract its design system.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Build
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
# Build the same website, at every screen size
|
|
7
|
+
|
|
8
|
+
The goal: the user opens the clone on localhost on any device, at any window size, and it looks and behaves exactly
|
|
9
|
+
like the original. Not at three widths: at every width. Accuracy comes first, time second, scores third: a score is
|
|
10
|
+
an instrument; when it and your eyes disagree, your eyes win and you say so in `notes.md` (Findings).
|
|
11
|
+
|
|
12
|
+
Everything for a site lives in `sites/<name>/` (gitignored, local): `clone/` (the source of truth), `next/` (the
|
|
13
|
+
Next.js app generated from it), `notes.md` (your record, a contract), `REPORT.md` (the deliverable). Run every step as
|
|
14
|
+
`npx trueclone <step> <name>` from the project folder (`npx trueclone help` lists them).
|
|
15
|
+
|
|
16
|
+
## The rules
|
|
17
|
+
|
|
18
|
+
1. **Structure comes from the seed; behaviour is code.** The seed gives the site's markup, stylesheets, media and
|
|
19
|
+
every value that is the same at every size or a plain function of the screen size. Everything a script does
|
|
20
|
+
(layout it computes, scenes it builds, motion, hover, state, canvases) you re-implement in `clone/script.js`,
|
|
21
|
+
**porting the site's own rule** from `reference/scripts/` (`INDEX.md` ranks the scripts by what actually ran and
|
|
22
|
+
points every event listener at file:line). Read the algorithm; write your own code; never paste the site's code.
|
|
23
|
+
2. **Every screen size.** Your code computes from the live viewport, the way the site's does (`innerWidth`,
|
|
24
|
+
`innerHeight`, element boxes, `resize`, the site's own breakpoints). Never put a pixel value you measured or
|
|
25
|
+
recorded at one size into the clone. Elements marked `data-tc-script-owned` (and `reference/script-owned.json`) hold
|
|
26
|
+
values the site computes that no simple function of the screen size explains: they are yours to compute.
|
|
27
|
+
3. **Never edit generated files.** `clone/index.html` is seed output. What a clone needs on top goes in
|
|
28
|
+
`clone/patches/` (see Build). A fix that needs the generated markup changed is a tool defect: write it in Findings.
|
|
29
|
+
4. **Look, don't just score.** `npx trueclone review <name>` shows reference and clone side by side at a size the
|
|
30
|
+
clone was never built from, at load, at every section, with the pointer on a control. You give every frame a
|
|
31
|
+
verdict in `notes.md`. A frame that differs is open, whatever the numbers say.
|
|
32
|
+
5. **Done means done.** Every check passes at every scored size, the held-out sizes included; every review frame is
|
|
33
|
+
"same"; an accepted difference is only for the last points of a check already ≥ 95 and names an evidence file.
|
|
34
|
+
There is no pass limit: keep fixing until that holds or every remaining gap is proven a tool defect in Findings.
|
|
35
|
+
6. **Exact mode only with permission.** `template` (default) is for anyone's site: placeholder text and media, the
|
|
36
|
+
original's structure and behaviour. `exact` copies the site's own text and media and refuses to run without
|
|
37
|
+
`--permission "<who authorised it>"`; never use it on a site the user doesn't own or have permission for. Never get
|
|
38
|
+
past bot checks, logins or paywalls. No tracking scripts; forms submit nowhere; `noindex`.
|
|
25
39
|
|
|
26
40
|
## 1. Capture
|
|
27
41
|
|
|
28
42
|
```powershell
|
|
29
43
|
npx trueclone capture <url> [name] [--hide "<cookie banner / popup selectors>"] [--mode exact --permission "<owner>"]
|
|
30
|
-
npx trueclone states <name>
|
|
31
|
-
npx trueclone motion <name>
|
|
32
|
-
npx trueclone spec <name>
|
|
44
|
+
npx trueclone states <name> # scroll states at every scored size (reference/states/)
|
|
45
|
+
npx trueclone motion <name> # the animation runtime: ScrollTriggers, timelines, tweens, loops, Lenis/Swiper, CSS
|
|
46
|
+
npx trueclone spec <name> # measured boxes and styles per size
|
|
33
47
|
```
|
|
34
48
|
|
|
35
|
-
`
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
- `
|
|
53
|
-
- `
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
`states`, `motion` and `spec` only read the reference: run them one after another in the background while you read.
|
|
50
|
+
Capture shoots five sizes: the seed sizes 390×844, 768×1024, 1440×900 (the clone is built from these) and the
|
|
51
|
+
held-out 1280×720 and 1920×1080 (scored, never used to build). It also reads inline styles at extra sizes inside each
|
|
52
|
+
of the site's breakpoint ranges, and saves every script that ran (`reference/scripts/`). If the page is blank or
|
|
53
|
+
blocked, capture through your own Chrome over CDP (`--cdp`); never get around a bot check.
|
|
54
|
+
|
|
55
|
+
## 2. Understand
|
|
56
|
+
|
|
57
|
+
Write `notes.md` (the seed creates it; its sections are a contract): **Stack**, **Behaviours** (one line each:
|
|
58
|
+
element, trigger, property, range, timing, *and the file:line of the rule in reference/scripts/*), **Own-code map**,
|
|
59
|
+
**Findings**, **Accepted differences**, **Unknowns**, **Review**.
|
|
60
|
+
|
|
61
|
+
- `reference/scripts/INDEX.md`: the scripts by what ran, readable copies of minified ones, every listener's handler.
|
|
62
|
+
This is where a scene's algorithm is: a grid computed from the viewport, a spring, a pin length, a hover panel.
|
|
63
|
+
- `reference/script-owned.json`: every value the site's scripts set that no function of the screen size explains,
|
|
64
|
+
with its samples at many sizes (random, content-fitted, state- or scroll-driven); `reference/inline-styles.json`
|
|
65
|
+
`scriptQueries`: the widths the scripts themselves switch at (`matchMedia`).
|
|
66
|
+
- `reference/motion.<size>.md`: ScrollTriggers, tweens, easings, pins, as the runtime reports them.
|
|
67
|
+
- `reference/states/<size>.summary.json`: reveals, parallax, pinned and fixed elements; `npx trueclone tiles <name>`
|
|
68
|
+
cuts the full-page shots into readable screens.
|
|
69
|
+
- For a part no script reading explains (a bundled physics rule, a shader, WASM), REA is bundled:
|
|
70
|
+
`npx trueclone rea --help`. Rarely needed.
|
|
57
71
|
|
|
58
72
|
## 3. Design system
|
|
59
73
|
|
|
60
74
|
```powershell
|
|
61
|
-
npx trueclone design <name>
|
|
62
|
-
npx trueclone design <name> --redraft # fresh draft in design-tokens.draft.json (never overwrites your edits)
|
|
75
|
+
npx trueclone design <name> # design-tokens.json -> DESIGN.md (must lint with 0 errors), globals.css, clone/tokens.css
|
|
63
76
|
```
|
|
64
77
|
|
|
65
|
-
Review the draft
|
|
66
|
-
|
|
67
|
-
## 4. Build (`clone/`)
|
|
78
|
+
Review the draft (role names, notes, anything `origin: generated`) and re-run after every edit.
|
|
68
79
|
|
|
69
|
-
|
|
80
|
+
## 4. Build
|
|
70
81
|
|
|
71
82
|
```powershell
|
|
72
|
-
npx trueclone reveals <name> #
|
|
73
|
-
npx trueclone widgets <name> #
|
|
74
|
-
npx trueclone seed <name> # clone/ from the script-free mirror
|
|
83
|
+
npx trueclone reveals <name> # one-shot scroll reveals and scroll class changes, recorded at the seed sizes
|
|
84
|
+
npx trueclone widgets <name> # every tab and menu state (template mode replays them)
|
|
85
|
+
npx trueclone seed <name> # clone/ from the script-free mirror
|
|
75
86
|
```
|
|
76
87
|
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
- **
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
88
|
+
What the seed gives you, and what it leaves to you:
|
|
89
|
+
- the original's markup, stylesheets and media (template mode: lorem text of the same laid-out width, same-size
|
|
90
|
+
placeholders), open shadow roots as declarative shadow DOM, missing media fetched;
|
|
91
|
+
- **inline values a script set, as functions of the screen size** (`calc()` in `--tc-vw`/`vh`, or `max()`/`min()` for
|
|
92
|
+
cover/contain, per range of the site's and its scripts' breakpoints) when one fits every captured size; a property
|
|
93
|
+
that fits at no size or only at some is removed everywhere and marked `data-tc-script-owned`;
|
|
94
|
+
- **pins** as a sticky element in a spacer whose tail is the pin length (`--tc-pin`, a function of the viewport when
|
|
95
|
+
the site's is);
|
|
96
|
+
- one-shot reveals and scroll class changes replayed by `trueclone-reveals.js` at the visitor's size; **scroll-linked
|
|
97
|
+
curves (parallax, scrubbed fades) are not replayed**: their samples are evidence in `reference/reveals.<size>.json`,
|
|
98
|
+
and you write the rule;
|
|
99
|
+
- the boot contract: `<html class="tc-boot">` until your scripts have run; `--hide-until-boot "<selectors>"` keeps
|
|
100
|
+
regions your script builds invisible meanwhile; `tcBoot.hold()` / `tcBoot.release()` for an intro that waits.
|
|
101
|
+
|
|
102
|
+
Then `clone/script.js`, scene by scene from `notes.md` Behaviours: find the rule in `reference/scripts/`, port it,
|
|
103
|
+
compute everything from the viewport. When your script drives an element the seed's player also drives, hand it
|
|
104
|
+
over: remove its `data-tc-reveal` / `data-tc-class` mark at the top of `script.js`. After each build round,
|
|
105
|
+
`npx trueclone owned <name>` lists the sections your script rebuilds (hide those until boot if the original hides them).
|
|
106
|
+
|
|
107
|
+
`clone/patches/` (applied on every seed, or alone in a second with `npx trueclone seed <name> --patches`):
|
|
108
|
+
`head-*.html` before `</head>`, `*.css` linked after the site's stylesheets, `body-*.html` before `script.js`
|
|
109
|
+
(vendored libraries, a hand-over prelude), `*.js` deferred before `script.js`. Vendor libraries at the site's versions.
|
|
110
|
+
|
|
111
|
+
Copy the reference's CSS mechanism, not its look: `npx trueclone rules <name> "<selector>"` (add `--clone` for yours).
|
|
112
|
+
Canvases are scored: rebuild the drawing from the site's scene code with its parameters (exact mode) or as your own
|
|
113
|
+
scene with the same composition (template mode); never drop one.
|
|
102
114
|
|
|
103
115
|
## 5. Verify
|
|
104
116
|
|
|
105
117
|
```powershell
|
|
106
|
-
npx trueclone score <name>
|
|
107
|
-
npx trueclone score <name>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
The steps, if you need one alone:
|
|
111
|
-
|
|
112
|
-
```powershell
|
|
113
|
-
npx trueclone diff <name> [--structure] # layout: full page, frozen (structure = text and media masked)
|
|
114
|
-
npx trueclone states <name> --clone [--structure] # scroll states: the reference's scroll positions replayed on the clone
|
|
115
|
-
npx trueclone curves <name> --draft # motion-map.draft.json from the inventory: fill in clone selectors, save as motion-map.json
|
|
116
|
-
npx trueclone curves <name> [--viewport tablet] # motion: property curves (scroll- and time-driven), reference vs clone
|
|
117
|
-
npx trueclone interact <name> --draft # interactions.draft.json: fill in TODOs, save as interactions.json
|
|
118
|
-
npx trueclone interact <name> # interactions: click/hover/drag/key scenarios + expectChange (geometry, text, state attributes, canvas pixels)
|
|
119
|
-
npx trueclone detail <name> --viewport all # styles at matching points: font, size, weight, line height, colour, boxes
|
|
120
|
-
npx trueclone hovers <name> # hover effects present on the reference but missing on the clone
|
|
118
|
+
npx trueclone score <name> # every check at every scored size, then REPORT.md
|
|
119
|
+
npx trueclone score <name> --only layout,states --viewport wide # after a fix: the checks it can move, where
|
|
120
|
+
npx trueclone explain <name> <y | "section label"> --viewport wide # one place: what every check saw + a crop
|
|
121
|
+
npx trueclone review <name> --size wide # side by side by eye; then laptop, tablet, mobile
|
|
121
122
|
```
|
|
122
123
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
- motion on (many originals ignore `prefers-reduced-motion`, and a clone that honours it lays out differently);
|
|
131
|
-
- both sides measured the same way: a hit test at the same point and scroll position, so sticky and pinned content is compared in place and an identical page scores 100%;
|
|
132
|
-
- through `pointer-events: none` overlays, and never on content the browser doesn't paint (closed `<details>`);
|
|
133
|
-
- colours written by scroll-scrubbed JS show up as in-between values: that is a motion difference, so check the motion inventory.
|
|
124
|
+
The checks: layout (full page, structure), scroll states (every half screen, scrolled with the wheel), canvases (what
|
|
125
|
+
each scene draws), motion curves, detail (styles at matching points), hovers (every control and every element with a
|
|
126
|
+
hover listener: the region after the hover must match), interactions (`interactions.json`: the change must happen on
|
|
127
|
+
both sides and end in the same state), load (0.25-4 s after navigation, cold cache, same network). Unstable probes
|
|
128
|
+
(random motion, timing) are measured twice on the reference and excluded; do not chase a number inside the noise.
|
|
129
|
+
Unchanged checks are not re-measured (`--fresh` forces it). `drift` opens every full score: if the live site changed
|
|
130
|
+
since the capture, the live-measured checks are marked stale; re-capture before trusting them.
|
|
134
131
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
- content that a component mounts only while in view (marked `data-tc-viewmount` by capture) can't appear in a full-page still on either side: layout paints its box the same on both and reports the count; the scroll-state check, with a real viewport, scores it;
|
|
138
|
-
- endless animations (marquees, rotating borders) are frozen on their first frame on both sides before every state screenshot: their phase depends on load time, not on the clone.
|
|
132
|
+
Fix in this order: anything the review shows, the held-out sizes, page height drift, the worst layout section, the
|
|
133
|
+
worst state step, canvases, interactions, load, then detail and hovers. Fix the cause; never tune a number to a score.
|
|
139
134
|
|
|
140
|
-
|
|
135
|
+
**Review verdicts** in `notes.md` under `## Review`, one per frame of `compare/review/<size>/index.md`:
|
|
136
|
+
`- 03-section-2 wide: same` or `- 07-section-4-hover wide: differs: the panel opens on the wrong card`.
|
|
137
|
+
**Accepted differences**: `- <check> <size> <where>: <why>; evidence: compare/explain/wide-5200.png`, only for a check
|
|
138
|
+
already ≥ 95.
|
|
141
139
|
|
|
142
140
|
## 6. Next.js (after the HTML clone passes)
|
|
143
141
|
|
|
144
142
|
```powershell
|
|
145
|
-
npx trueclone next <name> --verify # generates
|
|
143
|
+
npx trueclone next <name> --verify # generates next/, builds, serves and scores it into REPORT.next.md
|
|
146
144
|
```
|
|
147
145
|
|
|
148
|
-
The HTML clone stays the source of truth: change `clone/`, then regenerate.
|
|
146
|
+
The HTML clone stays the source of truth: change `clone/`, then regenerate. One component per section, the clone's
|
|
147
|
+
scripts preloaded and run at hydration, the site's stylesheets after the shadcn theme in the site's cascade-layer order,
|
|
148
|
+
`components.json` for `npx shadcn add`. Done when its report matches the HTML clone's within a point everywhere.
|
|
149
149
|
|
|
150
150
|
## 7. Report
|
|
151
151
|
|
|
152
|
-
`
|
|
152
|
+
`REPORT.md` (and `REPORT.next.md`) is the deliverable: mode and permission, every check at every size, the review,
|
|
153
|
+
open frames, accepted differences with evidence, Findings, what to fix first, and what was not copied (server
|
|
154
|
+
behaviour, tracking, each data/API call). Hand it over with the clone.
|
|
153
155
|
|
|
154
156
|
## Honest limits
|
|
155
157
|
|
|
156
|
-
- Server-side behaviour is never visible from outside: databases, accounts, payments, search. The clone reproduces
|
|
157
|
-
|
|
158
|
-
-
|
|
158
|
+
- Server-side behaviour is never visible from outside: databases, accounts, payments, search. The clone reproduces
|
|
159
|
+
the client; data calls are listed in the report.
|
|
160
|
+
- A live site is never pixel-identical twice: rotating content, A/B tests and font hinting vary; that is what the
|
|
161
|
+
unstable-probe and noise handling is for, not a licence to stop.
|