An agent skill for building premium, immersive, scroll-driven websites. Works with Codex, Claude Code, and other coding agents. Also available as a Claude Code plugin.
JavaScript accessibilityagent-skillsai-web-designanthropicclaude-codeclaude-code-plugincreative-codingdesign-systemfrontendinteraction-designlanding-pagescroll-animationscrollytellingtypographyweb-design
v0.2.0: make the skill portable, and sync upstream engine work
Nate Herk82e6853f1d66
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex 6324527..b18d2e0 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-plugin/marketplace.json@@ -10,7 +10,7 @@"name": "scrollcraft","source": "./plugins/scrollcraft","description": "Build a premium, scroll-driven interactive landing page: scroll becomes the timeline, video scrubs under the wheel, and the page verifies itself by screenshotting its own scroll.",- "version": "0.1.0",+ "version": "0.2.0","author": {"name": "Nate Herk"}diff --git a/EXAMPLES.md b/EXAMPLES.mdindex af435af..8f8d730 100644--- a/EXAMPLES.md+++ b/EXAMPLES.md@@ -269,3 +269,37 @@ this one inherits.Rows are append-only. A build that has been superseded stays in the table,because the space it occupies is still occupied.++---++## `lane` — PERKFORM, second variation++| Build | Grammar | Nav treatment | Hero device | Act-sequence shape | Close pattern | Signature move | World | Port |+|---|---|---|---|---|---|---|---|---|+| `lane` | **Rhythmic cutlist with a held overture.** Nine full-height hard-cut sections behind one act that pins. Shares the grammar cell with `airfield` and differs from it on the other five dimensions | **Two vertical Pulse Rails, one per margin, that merge into one.** Left COFFEE, right PROTEIN, each stamping named ticks as the acts that own them pass; a centred wordmark crowns them. No bar, no readout, no CTA in chrome. The rails are the only navigation and the ticks are its links | **A title alone, then a film.** Opens on a bare Roast Black ground with the `h1` centred at poster scale and nothing else on screen. As the reader scrolls, the title travels to the left column and settles while a ten-second locked-off clip fades up behind it and runs on a held stage across 3.5vh. No corner anchor, no kinetic split, no greet-over-footage: the type gets the first screen to itself | `pin(4.2) > flow x8` + one bespoke close, **10 sections / 9 engine acts, 12.91vh** (13.7vh at 390px). **Exactly one pinned act, and it is the first**: everything after act one is unpinned, under 1.4vh, with no `dwell`, no `pan` and no `scrub` device anywhere. Four clips scrubbed by page-local code, three of them simultaneously in one act, and two measured across their section's full height so a held stage keeps advancing as it leaves. Authored silence at 0.66vh directly before the peak | **The lane terminates in the ask.** The merged lane runs down into a bordered, blurred plate and stops in it: kicker, ask, one field, one button. Behind it a macro lid clip scrubs across the reachable range of the final section and arrives on its condensation frame. No gesture, no spotlight, no magnet, no fade-out | **The two-drink collapse.** Two chrome rails accumulate separately for two thirds of the page, then scroll drives them together: the ticks interleave into one column and the pair lands as the white Center Lane of the can. One rail carries the rest of the page. Distinct from `vesper-v2` (one horizontal time axis), `descent` (one depth gauge), `maison` (tokens that travel and stack), `pigment` (pointer deposits), `orrery` (markers that freeze), `airfield` (flipping characters), `phase` (pointer bloom) | Photoreal beverage campaign. **Six grounds, five hues**: Roast Black `#15110F`, Oat Cream `#F5EBDD`, Roast Brown `#3B241B`, Voltage Lime `#C8FF3D`, plus the three flavour colours as full-bleed plates. Archivo Black and Inter | 4512 |++Claimed by `lane`, so also now taken:++- **Nav:** margin chrome that is a *pair* and terminates by becoming one thing.+ Also the first nav whose items are the page's own argument rather than its+ sections.+- **Hero:** a staged overture. Title alone on a bare ground, then the title+ travels aside as the film fades up under it and runs on a held stage. The+ first screen of this page has no media on it at all.+- **Act shape:** exactly one pinned act, and it is act one. Worth knowing why+ the pin came back: an unpinned frame gives a clip 2vh of `--sc-p` at most, and+ a reader outruns ten seconds of footage inside that in one flick. If a page+ wants a film that plays out, the stage has to hold; the cutlist's 1.4vh cap+ and a ten-second shot cannot both be satisfied. The cap still governs acts two+ through ten.+- **Close:** an ask plate on a scrubbed macro, deliberately gestureless. Recorded+ because the build tried the alternative first and it failed a real reader: a+ pull-tab the visitor had to work out is the wrong ending for a landing page.+- **Signature move:** two chrome elements merging into one. Nobody else may take+ convergence-of-persistent-chrome as their bespoke move.+- **Palette:** six grounds and five hues, which is the furthest any row has gone+ from the one-canvas-plus-one-accent reflex.++What it shares, and what the next build has to avoid because of it: the+**rhythmic cutlist** grammar (with `airfield`) and **Archivo** as a display face+(with `maison`).diff --git a/README.md b/README.mdindex b7c1922..44c694b 100644--- a/README.md+++ b/README.md@@ -14,9 +14,8 @@ scroll position, waits for the playhead to settle, and reports dead scroll, cuesthat never reach full opacity, and text contrast measured on the composited pageat the brightest frame under each line.-> **Status: private and pre-release (v0.1.0).** It works, and it has produced-> twelve finished sites. It is not yet portable to someone else's machine. See-> [Known gaps](#known-gaps) before handing it to anyone.+> **Status: private, v0.2.0.** It works, it has produced twelve finished sites,+> and as of this version it is portable: nothing assumes the author's machine.---@@ -37,40 +36,50 @@ To work on the skill itself without installing:claude --plugin-dir ./plugins/scrollcraft```-## Requirements+## First run-| Requirement | Why | Notes |-| --- | --- | --- |-| Node 18+ | every script | |-| **A full ffmpeg build** | encoding clips for scrubbing, extracting posters and seam frames | A stripped ffmpeg (some toolchains ship one with ~50 filters) fails in ways that read as syntax errors. Set `SCROLLCRAFT_FFMPEG` to override. |-| `playwright-core` + Chrome | the verification harness | `npm i playwright-core` in the build folder |-| `KIE_AI_API_KEY` | **only** if generating imagery | See `.env.example`. Bring-your-own-assets builds need no key and no spend. |+```bash+node scripts/doctor.mjs # preflight: tells you exactly what is missing+node scripts/workspace.mjs --ensure # creates your workspace and an empty registry+```-## What is in here+`doctor` is worth running before anything else. The three most common setup+faults all surface later as misleading errors otherwise: a stripped ffmpeg+reports a missing filter as a syntax error in your command, a missing webp muxer+reports as a bad filename, and `playwright-core` resolves from the wrong+directory.-```-plugins/scrollcraft/-├── SKILL.md the procedure: interview, grammar, score, build, verify-├── references/-│ ├── uniqueness.md eight page grammars, the signature move, the fingerprint gate-│ ├── feel.md the feeling curve, the engineered peak, the feel check-│ ├── devices.md the nine scroll devices and the cue contract-│ ├── worldflight.md continuous-world mode: one fixed stage, no seams-│ ├── worlds.md art direction, and the style-preamble method-│ ├── taste.md the taste floor: spacing, type, colour, depth, motion-│ ├── assets.md generation, camera moves, encoding for scrubbing-│ ├── verify.md the harness, and what it cannot tell you-│ └── template.html a starting skeleton, not a layout-├── engine/ scrollcraft.js + .css. The mechanism. Never edited per project.-└── scripts/ kie.mjs, encode.sh, serve.mjs, shoot.mjs-```+## The workspace++Your builds and your fingerprint registry live in one directory, resolved rather+than assumed. First hit wins:-`CHANGELOG.md` inside the plugin is worth reading on its own. It records what-broke on each build and the rule that came out of it, rather than a feature list.+1. `SCROLLCRAFT_HOME`+2. the nearest `.scrollcraft.json` walking up from the current directory:+ ```json+ { "workspace": "path/to/wherever/you/keep/builds" }+ ```+3. `<project root>/scrollcraft`, where the project root is the nearest ancestor+ holding a `.git`-`EXAMPLES.md` at the repo root is the fingerprint registry for the twelve builds-made so far: the grammar, nav, hero, act shape, close and signature move of-each. It is a record of shapes that are taken.+So a build lands in `<workspace>/builds/<name>/` and your registry is+`<workspace>/FINGERPRINTS.md`. If you already keep builds somewhere, point a+`.scrollcraft.json` at it and nothing moves.++**Your registry starts empty, and that is correct.** The fingerprint gate exists+to stop you repeating *yourself*. Your first build has nothing to clear; every+build after it does. `EXAMPLES.md` in this repo is the author's twelve-row+table, included so you can see what a filled registry looks like and which+shapes tend to collide. It is illustration, not constraint.++## Requirements++| Requirement | Why | Notes |+| --- | --- | --- |+| Node 18+ | every script | |+| **A full ffmpeg build** | encoding clips for scrubbing, extracting posters and seam frames | A stripped ffmpeg (some toolchains ship one with ~50 filters) fails in ways that read as syntax errors. `doctor` finds a real build if one exists; `SCROLLCRAFT_FFMPEG` overrides. |+| `playwright-core` + Chrome | the verification harness | `npm i playwright-core` **in the build folder** |+| `KIE_AI_API_KEY` | **only** if generating imagery | See `.env.example`. A build from your own photos and footage needs no key and no spend, and it is a first-class route. |## The one rule that matters most@@ -82,22 +91,16 @@ built on one looks the same.## Known gaps-Honest list of what stops this being handed to a student today.--1. **Paths assume the author's repo.** Nine references across `SKILL.md`,- `uniqueness.md`, `feel.md` and `worldflight.md` point at- `OtherWorlds/Ultimate Websites/`. The fingerprint gate and the worked- worldflight rig both dead-end elsewhere.-2. **The fingerprint registry is personal.** `EXAMPLES.md` lists builds by one- author. A new user should be gated against *their own* builds, starting from- an empty registry, or they are blocked from grammars they have never used.-3. **No preflight.** There is no `doctor` script. Missing ffmpeg filters, an- unset API key and a missing Chrome all currently fail deep inside a run with- messages that point at the wrong cause.-4. **Cost is not surfaced early enough.** Generation spends real money. The- bring-your-own-assets path works and should be documented as a first-class- route rather than a footnote.-5. **No licence yet.** See below.+Fixed in v0.2.0: hardcoded author paths, the shared fingerprint registry, the+missing preflight, and the unshipped worldflight rig.++Still open:++1. **No licence yet.** See below.+2. **Windows-first path guesses.** `doctor` and `encode.sh` look for ffmpeg in+ WinGet, Homebrew and `/usr/local` locations. Other setups need+ `SCROLLCRAFT_FFMPEG`.+3. **Not tested on macOS or Linux.** Every build so far ran on Windows.## Licencediff --git a/plugins/scrollcraft/.claude-plugin/plugin.json b/plugins/scrollcraft/.claude-plugin/plugin.jsonindex 5e48155..b9f3d74 100644--- a/plugins/scrollcraft/.claude-plugin/plugin.json+++ b/plugins/scrollcraft/.claude-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "scrollcraft","description": "Build a premium, scroll-driven interactive landing page for any business. Interviews the human first, picks a page grammar and a signature move so no two builds share a skeleton, generates or grades the assets, writes real semantic HTML on a token-driven design floor, and verifies the result by screenshotting its own scroll.",- "version": "0.1.0",+ "version": "0.2.0","author": {"name": "Nate Herk"},diff --git a/plugins/scrollcraft/CHANGELOG.md b/plugins/scrollcraft/CHANGELOG.mdindex 436fe98..c4f426c 100644--- a/plugins/scrollcraft/CHANGELOG.md+++ b/plugins/scrollcraft/CHANGELOG.md@@ -395,3 +395,92 @@ Also recorded: changing any weight moves every leg boundary, so every`data-sc-window` must be recomputed and then re-checked against the frame it wastuned to. `orrery`'s labels were re-verified on screen at Kyoto and Erg Chebbiafter the repace.++---++## Clip time is not cue time (the frozen-clip class)++Reported from a real read of `agency` / Fallowbank: "scenes are moving with a+scroll, but then they stop and then the whole site starts to move, so now we're+seeing an image that's still."++A pinned stage is on screen for one viewport **before** its pinned travel starts+and one viewport **after** it ends. Act progress `p` is 0 across the whole entry+slide and 1 across the whole exit slide, so a clip driven by `p` is parked on its+first frame while the stage slides in and on its last frame while it slides out.+The reader scrubs a film, the film stops, and the page then slides a still+photograph past them.++**What changed**++- **The engine now maps clip time across the stage's entire visible life by+ default**, with both ends clamped to scroll that actually exists so a hero at+ document top still starts on frame one and an act near the bottom still reaches+ its last frame. Cues still use `p`, because cues belong to the pin.+ `data-sc-clip-map="travel"` is the opt-out. The old `data-sc-runout` opt-in is+ accepted and ignored: it addressed only the exit half, and it was opt-in, which+ is why three of four builds carrying a scrub act shipped frozen anyway.+- **`shoot.mjs` samples each scrub act's entry and exit slides.** It previously+ sampled pinned acts only at `top + (h - vh) * p`, which never visits either+ slide. That sampling gap is the whole reason this survived four builds of+ verification: the defect lived precisely where the harness never looked.+- **New FROZEN CLIP finding**, graded against stage visibility rather than act+ progress. First/last-frame holds always report; mid-clip holds only report once+ they outlast a plausible `dwell` settle. Skipped under reduced motion.++**Validated, not assumed.** The detector was proven to discriminate before being+trusted: it fires on a clip deliberately opted out with `data-sc-clip-map="travel"`+and stays silent on the clip beside it in the same page.++**Do not pair this with a shorter dwell.** Dwell moves fast at the edges and+settles in the middle, which is exactly the shape the new mapping wants: fast+motion on the two slides, the settle inside the pin where the copy lands.++**Also found, unrelated and pre-existing:** `nateherk`'s hero paragraph fails+contrast from `y=0` (1.01:1, dark ink over dark foliage in the sky clip). The new+slide sampling surfaced it; the old engine fails it identically, so it is not a+regression from this change.++## 2026-08-22, portability pass (v0.2.0)++The skill assumed one person's repo layout. Five references pointed at+`OtherWorlds/Ultimate Websites/`, so the fingerprint gate and the worked+worldflight rig dead-ended on every other machine. Packaging it as a plugin made+that a real defect rather than a note.++The fix is **not** a second templatised copy of the skill. Two copies drift, and+this one proved it inside a day: five files diverged between the working skill+and its published copy within an hour of the first push. There is one skill, and+it resolves its paths instead of assuming them.++- **`scripts/workspace.mjs`.** Resolves the workspace that holds builds and the+ registry: `SCROLLCRAFT_HOME`, then the nearest `.scrollcraft.json` walking up,+ then `<project root>/scrollcraft`. `--ensure` creates it and seeds an empty+ registry. Builds are `<workspace>/builds/<name>/`, the registry is+ `<workspace>/FINGERPRINTS.md`, and neither is hardcoded anywhere any more.+- **The registry is per-user and starts empty.** The gate exists to stop you+ repeating *yourself*, so a new user's first build has nothing to clear and+ every build after it does. Gating a newcomer against somebody else's twelve+ rows would block them out of grammars they have never used, which is the+ opposite of the point. `templates/FINGERPRINTS.md` is the seed; the author's+ twelve-row table ships separately as `EXAMPLES.md`, explicitly as+ illustration rather than constraint.+- **`scripts/doctor.mjs`.** Preflight, run before the interview. Checks node, a+ full ffmpeg build, playwright, Chrome, the API key and the resolved workspace,+ and separates required failures from optional ones. It exists because the+ three most common setup faults all surface later as misleading errors: a+ stripped ffmpeg reports a missing filter as a syntax error, a missing webp+ muxer reports as a bad filename, and playwright resolves from the wrong+ directory. On the author's machine it correctly picks the 585-filter build+ over the stripped one first on PATH.+- **`scripts/worldflight-assert.mjs` now ships with the skill.** It was+ URL-driven and generic all along, sitting in a lab folder nobody else had.+ Run it against any worldflight page before the contact sheet.+- **The API key is documented as optional in the right place.** Generation costs+ real money; a build from the user's own photos and footage needs no key and no+ spend, and that is now stated as a first-class route in Bootstrap rather than+ implied.++Nothing moved on the author's machine: a two-line `.scrollcraft.json` at the+project root points the workspace at the existing `OtherWorlds/Ultimate+Websites`, so twelve builds and the live registry resolve exactly as before.diff --git a/plugins/scrollcraft/SKILL.md b/plugins/scrollcraft/SKILL.mdindex 6130b64..2f89155 100644--- a/plugins/scrollcraft/SKILL.md+++ b/plugins/scrollcraft/SKILL.md@@ -103,7 +103,7 @@ Keep it short. Eight questions, asked in one pass:generation cost; the answer decides what gets graded and encoded versusgenerated. "Nothing" is a fine answer and means a fully generated world.-Write the answers into `builds/<name>/BRIEF.md` before any act planning, in+Write the answers into `<workspace>/builds/<name>/BRIEF.md` before any act planning, intheir words, not paraphrased into marketing prose. Everything downstream readsfrom that file.@@ -128,14 +128,51 @@ self-authored brief is a fallback, never the plan.## BootstrapEnvironment, not a stage of the work. Do it once the interview is answered and-before Step 1. Check, and say plainly which are missing rather than working-around them silently:+before Step 1.-1. `node --version` (18+) and `ffmpeg -version`.-2. `KIE_AI_API_KEY` in the project-root `.env`. Confirm balance:- `node <skill>/scripts/kie.mjs probe`. A still costs cents, a 5s clip costs+**Run the preflight rather than checking by hand.** It knows the failure modes+that otherwise surface later as misleading errors, chiefly a stripped ffmpeg+that reports a missing filter as a syntax error in your command:++```bash+node <skill>/scripts/doctor.mjs+```++It reports node, a full ffmpeg build, playwright and Chrome, the API key, and+the resolved workspace. Required failures exit non-zero. Say plainly which items+are missing rather than working around them silently.++### The workspace++Builds and the fingerprint registry live in one directory, and **it is resolved,+never assumed**:++```bash+node <skill>/scripts/workspace.mjs --ensure # prints it, creates it, seeds the registry+```++Resolution order, first hit wins:++1. `SCROLLCRAFT_HOME`+2. the nearest `.scrollcraft.json` walking up from the cwd, `{ "workspace": "..." }`+3. `<project root>/scrollcraft`, where the project root is the nearest ancestor+ holding a `.git`++So a build folder is `<workspace>/builds/<name>/` and the registry is+`<workspace>/FINGERPRINTS.md`. The registry starts **empty**: the gate exists to+stop you repeating yourself, so your first build has nothing to clear.++If you already keep builds somewhere else, drop a `.scrollcraft.json` at your+project root pointing at it and nothing moves.++### The rest++1. `KIE_AI_API_KEY`, **only if you are generating assets.** A build from the+ user's own photos and footage needs no key and no spend, and that is a+ first-class route, not a fallback. Confirm balance with+ `node <skill>/scripts/kie.mjs probe`. A still costs cents and a 5s clip costsmore; a six-act page with two clips is a small spend, not a large one.-3. A brand kit if one exists (colours, logo, type, existing product shots). If+2. A brand kit if one exists (colours, logo, type, existing product shots). Ifthe brand has a folder in this repo, read it before generating anything, andobey its hard rules. A brand that forbids invented numbers means no statcounters, however good they look.@@ -195,8 +232,9 @@ grammar; they are not decided separately.alone, coded in the page, not a parameter change to a kit device. Question 5 ofthe interview is the seed. The engine stays untouched.-**Run the fingerprint gate.** Read-`OtherWorlds/Ultimate Websites/FINGERPRINTS.md`. The planned build must differ+**Run the fingerprint gate.** Read your registry at+`<workspace>/FINGERPRINTS.md` (see **The workspace** in Bootstrap; run+`node <skill>/scripts/workspace.mjs` to print the path). The planned build must differfrom **every** existing row on at least 4 of 6 dimensions: grammar, navtreatment, hero device, act-sequence shape, close pattern, signature move. Fouragainst each row individually. If it fails, change the plan, not the log.@@ -360,7 +398,7 @@ generated, what you verified with screenshots, and anything you could notverify. Say if the brief was self-authored rather than interviewed. Give thelocal URL. Keep it brief; the page is the deliverable.-Then append the build's row to `OtherWorlds/Ultimate Websites/FINGERPRINTS.md`.+Then append the build's row to `<workspace>/FINGERPRINTS.md`.Changes to the skill itself, and the build findings that drove them, are loggedin [CHANGELOG.md](CHANGELOG.md).diff --git a/plugins/scrollcraft/engine/scrollcraft.js b/plugins/scrollcraft/engine/scrollcraft.jsindex c6fccc1..3642830 100644--- a/plugins/scrollcraft/engine/scrollcraft.js+++ b/plugins/scrollcraft/engine/scrollcraft.js@@ -15,12 +15,19 @@<section data-sc-act="pin" data-sc-span="2.5"> ... </section>data-sc-act scrub | pin | pan | flow (default: flow)- data-sc-runout on a pinned act. Measures its scrub clip against the act's- full height instead of its pinned travel, so the last frame- lands as the stage clears the top of the viewport rather than- one viewport-height earlier. Without it the clip finishes- while the stage is still fully on screen and the reader- scrolls a whole screen of frozen frame to get past it.+ data-sc-clip-map="travel" opts a pinned act OUT of full-life clip mapping.+ By DEFAULT a scrub clip is mapped across the stage's entire+ on-screen life, not across its pinned travel, because a pinned+ stage is visible for a viewport BEFORE the pin begins (sliding+ up into view) and a viewport AFTER it ends (sliding off the+ top). Mapped to pinned travel, the clip sits on its first+ frame through the whole entry and its last frame through the+ whole exit: the reader watches a still photograph while the+ page moves. Pair it with data-sc-dwell, which moves quickly at+ the edges and settles in the middle, so the fast motion lands+ on the two slides and the settle lands inside the pin where+ the copy is. data-sc-runout is accepted and ignored; it named+ the old opt-in for the exit half of this.data-sc-span viewport-heights of scroll this act owns. Pinned devices only(scrub/pin/pan). Default 1.5. The engine sets the outerheight and sticks the first .sc-stage / [data-sc-stage] child.@@ -316,7 +323,7 @@pinned: pinned,span: parseFloat(el.getAttribute('data-sc-span')) || (pinned ? 1.5 : 0),dwell: parseFloat(el.getAttribute('data-sc-dwell')) || 0,- runout: pinned && el.hasAttribute('data-sc-runout'),+ clipTravel: pinned && el.getAttribute('data-sc-clip-map') === 'travel',p: 0, raw: 0, top: 0, height: 0, live: false,cues: [], parallax: [], reveals: [], counts: [],video: null, seq: null, rail: null@@ -748,6 +755,7 @@function read() {y = scrollY || pageYOffset;var driftA = null, driftB = null, driftT = 0;+ var maxY = Math.max((document.documentElement.scrollHeight || 0) - vh, 1);for (var i = 0; i < acts.length; i++) {var a = acts[i];@@ -761,16 +769,23 @@a.raw = raw;a.p = a.dwell ? dwell(raw, a.dwell) : raw;- // Clip progress can outrun cue progress. A pinned stage is still fully- // on screen when raw hits 1, and stays on screen for one more viewport- // of scroll while it slides off the top; a clip driven by `p` spends all- // of that as a still frame. `runout` measures the clip against the act's- // whole height instead, which puts the last frame exactly where the- // stage leaves the viewport. Cues keep using `p`, so copy still lands- // and clears inside the pin.+ // Clip time is NOT cue time. Cues belong to the pin, so they keep using+ // `p`. The clip belongs to the stage, and the stage is on screen for one+ // viewport before the pin starts and one after it ends. Driving the clip+ // from `p` therefore parks it on frame one for the whole entry slide and+ // on its last frame for the whole exit slide, which is a still+ // photograph moving up the screen under the reader's hand.+ //+ // So map the clip across the stage's entire visible life instead. Both+ // ends are clamped to scroll that actually exists: an act at the top of+ // the document has no entry slide and must still start on frame one, and+ // an act near the bottom must still reach its last frame while the page+ // can still scroll.a.vp = a.p;- if (a.runout) {- var vraw = clamp01((y - a.top) / Math.max(a.height, 1));+ if (a.pinned && !a.clipTravel) {+ var startY = a.top - Math.min(vh, a.top);+ var endY = Math.min(a.top + a.height, maxY);+ var vraw = clamp01((y - startY) / Math.max(endY - startY, 1));a.vp = a.dwell ? dwell(vraw, a.dwell) : vraw;}a.live = (y > a.top - vh * 1.25) && (y < a.top + a.height + vh * 1.25);diff --git a/plugins/scrollcraft/references/devices.md b/plugins/scrollcraft/references/devices.mdindex 59a72d5..5832c0b 100644--- a/plugins/scrollcraft/references/devices.md+++ b/plugins/scrollcraft/references/devices.md@@ -52,6 +52,38 @@ so spend it on the open.**At most two scrub acts per page.** The third one is no longer a surprise, andit is the heaviest thing on the page.+### Clip time is not cue time++The single most damaging bug this device has, and it is invisible in every+screenshot taken one at a time.++A pinned stage is on screen for **one viewport before** its pinned travel begins,+sliding up into view, and **one viewport after** it ends, sliding off the top.+The act's progress `p` is 0 through the whole entry and 1 through the whole exit.+So a clip driven by `p` sits frozen on its first frame while it slides in, and+frozen on its last frame while it slides out. The reader has been scrubbing a+film with their hand, the film stops, and then the whole page slides a still+photograph past them. It reads as the site breaking, and it is the fastest way to+make an expensive page feel cheap.++The engine therefore maps the clip across the stage's **entire visible life**, not+across its pinned travel, and this is the **default**. Both ends are clamped to+scroll that actually exists, so a hero at the top of the document still starts on+frame one and an act near the bottom still reaches its last frame. Cues keep+using `p`, because cues belong to the pin.++**Pair it with `data-sc-dwell`.** Dwell moves quickly at the edges and settles in+the middle, which is exactly the shape this mapping wants: the fast motion lands+on the two slides, and the settle lands inside the pin where the copy is. The two+were built for each other.++`data-sc-clip-map="travel"` restores the old pinned-travel mapping. There is+almost no reason to reach for it, and reaching for it reintroduces the freeze.++The harness checks this now (see [verify.md](verify.md)), so a frozen clip fails+verification instead of shipping. Do not rely on noticing it by eye: every+individual frame of a frozen clip looks completely correct.+### The playhead is lerpedScroll never writes `currentTime`. It writes a target, and a standalone rAF loopdiff --git a/plugins/scrollcraft/references/feel.md b/plugins/scrollcraft/references/feel.mdindex 072e6d8..a95f973 100644--- a/plugins/scrollcraft/references/feel.md+++ b/plugins/scrollcraft/references/feel.md@@ -149,7 +149,7 @@ decoration. Merge them, or cut the one that is not the peak.The test is also the fastest fingerprint check available. If the sentence wouldbe true of an existing build in-`OtherWorlds/Ultimate Websites/FINGERPRINTS.md`, the page is not new yet.+`<workspace>/FINGERPRINTS.md`, the page is not new yet.---diff --git a/plugins/scrollcraft/references/uniqueness.md b/plugins/scrollcraft/references/uniqueness.mdindex bd98678..cec9b00 100644--- a/plugins/scrollcraft/references/uniqueness.md+++ b/plugins/scrollcraft/references/uniqueness.md@@ -399,7 +399,15 @@ the filmic default in §2, one level down.## 4. The fingerprint gate-The registry lives at `OtherWorlds/Ultimate Websites/FINGERPRINTS.md`.+The registry lives at `<workspace>/FINGERPRINTS.md`, where `<workspace>` is+whatever `node <skill>/scripts/workspace.mjs` prints. It is per-user and it+starts empty: the gate is about not repeating **yourself**, so your first build+has nothing to clear and every build after it does.++A worked twelve-row registry ships as `EXAMPLES.md` in the scrollcraft+repository. Read it to see what a filled table looks like and which shapes tend+to collide. It is illustration, not constraint: those are somebody else's+builds and they do not gate yours.**Before building:** read it. Every row is a shape that is now taken.diff --git a/plugins/scrollcraft/references/verify.md b/plugins/scrollcraft/references/verify.mdindex dd2e3a0..70eea44 100644--- a/plugins/scrollcraft/references/verify.md+++ b/plugins/scrollcraft/references/verify.md@@ -54,6 +54,26 @@ resolved hold, set `data-sc-verify-hold="true"` only while the hold is active.Reduced-motion fixed stages may use the same attribute for deliberately stableframes, which still require manual contact-sheet review.+**FROZEN CLIP** — a scrub stage is on screen, the reader is scrolling, and the+clip's playhead is not moving. Dead scroll cannot see this, because the stage+itself *is* moving: a still photograph is sliding up the page, which is the+worst-looking failure this kit can produce and the one that most reliably makes+a page feel broken.++The harness samples each scrub act's **entry and exit slides**, not only its+pinned travel. That gap is why this went undetected for four builds: a pinned+act's samples were taken at `top + (h - vh) * p`, which never visits the viewport+of scroll on either side where the stage is visible and the clip is parked. A+hold on the first or last frame is always reported. A hold in the middle is only+reported once it outlasts any plausible `data-sc-dwell` settle, since that settle+is a deliberate effect. The check is skipped under reduced motion, where no clip+is ever fetched on purpose.++The fix is almost never per-page: the engine maps clip time across the stage's+whole visible life by default. A page that reports this has usually opted out+with `data-sc-clip-map="travel"`, or is running an engine copy from before that+default existed. See [devices.md §1](devices.md).+**CUES THAT NEVER PEAK** — an element that never reaches full opacity anywhere.Usually a cue window too narrow for its act, or ramps that eat the whole window.Widen the window or set explicit ramps. A kinetic heading is read through its@@ -271,6 +291,7 @@ until it was measured.| An inverted section rendering its old ink, graded in the wrong direction | `--sc-ink` redefined on the subtree without restating `color`. See taste.md || A ground colour arriving a section late | `drift` on a page of short acts; several are part-way through at once. Paint grounds per section. See devices.md §10 || Every cue and reveal in a quiet act snapping 0 to 1 | A pinned act at `data-sc-span` ≤ 1, which is one pixel of travel. Minimum useful pinned span is ~1.2 |+| A clip that scrubs beautifully, stops, and then slides up the page as a still photograph | The clip was mapped to the act's pinned travel, which is 0 through the entire entry slide and 1 through the entire exit slide. The engine now maps clip time across the stage's whole visible life by default. See devices.md §1 || A custom fixed stage passing while its first screens do nothing | The page used `flow` markers, which are intentionally excluded from ordinary dead-scroll checks, but published no `data-sc-verify-state`. Report the actual rendered state and declare only genuine resolved holds |The first three are invisible to every check except looking at rendered output.diff --git a/plugins/scrollcraft/references/worldflight.md b/plugins/scrollcraft/references/worldflight.mdindex 7bee8ca..5ac0d95 100644--- a/plugins/scrollcraft/references/worldflight.md+++ b/plugins/scrollcraft/references/worldflight.md@@ -335,7 +335,15 @@ node scripts/shoot.mjs --url http://localhost:45XX --out lab/<name>-shots --per-node scripts/shoot.mjs --url http://localhost:45XX --out lab/<name>-reduced --reduced-motion```-A worked rig lives at `OtherWorlds/Ultimate Websites/lab/worldflight-rig/`, with-its mechanical assertions in `lab/worldflight-assert.mjs`: spacer height, fixed-stage, nothing in flow, lerp convergence and non-overshoot, seam monotonicity,-the copy transform cap, and the reduced-motion contract.+The mechanical assertions ship with the skill as+`scripts/worldflight-assert.mjs` and run against **any** worldflight page, not a+special rig: spacer height, fixed stage, nothing in document flow, lerp+convergence and non-overshoot, seam monotonicity, the copy transform cap, and+the reduced-motion contract.++```bash+node <skill>/scripts/worldflight-assert.mjs --url http://localhost:45XX+```++Run it against your own build before the contact sheet. It answers "does the+mode actually hold" in a way a screenshot cannot.diff --git a/plugins/scrollcraft/scripts/doctor.mjs b/plugins/scrollcraft/scripts/doctor.mjsnew file mode 100644index 0000000..5b9488e--- /dev/null+++ b/plugins/scrollcraft/scripts/doctor.mjs@@ -0,0 +1,166 @@+#!/usr/bin/env node+/**+ * Preflight. Run this BEFORE the interview, not after the first failure.+ *+ * node scripts/doctor.mjs check everything+ * node scripts/doctor.mjs --probe also spend one API call to read the balance+ *+ * Every check that can fail deep inside a build with a misleading message is+ * checked here with an honest one. The three that actually bite:+ *+ * - a STRIPPED ffmpeg on PATH. It carries ~50 filters and silently lacks+ * scale, fps, psnr and the webp muxer, then fails with "No option name+ * near ..." or "Unable to choose an output format", both of which read as+ * a mistake in your command rather than a missing feature.+ * - no KIE_AI_API_KEY, which only matters if you are generating assets.+ * - playwright-core resolving from the wrong directory. It is required from+ * the BUILD folder, not from the skill.+ */++import fs from "node:fs";+import path from "node:path";+import { execFileSync } from "node:child_process";+import { createRequire } from "node:module";+import { fileURLToPath } from "node:url";+import { paths } from "./workspace.mjs";++const HERE = path.dirname(fileURLToPath(import.meta.url));+const rows = [];+const add = (sev, name, ok, detail, fix) => rows.push({ sev, name, ok, detail, fix });++const run = (cmd, args) => {+ try {+ return execFileSync(cmd, args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] });+ } catch {+ return null;+ }+};++// ---------------------------------------------------------------- node ----+const major = Number(process.versions.node.split(".")[0]);+add("required", "node", major >= 18, `v${process.versions.node}`,+ "Install Node 18 or newer.");++// -------------------------------------------------------------- ffmpeg ----+function globWinGet() {+ const home = process.env.USERPROFILE || process.env.HOME || "";+ const base = path.join(home, "AppData/Local/Microsoft/WinGet/Packages");+ if (!fs.existsSync(base)) return [];+ const out = [];+ for (const d of fs.readdirSync(base)) {+ if (!/^Gyan\.FFmpeg/i.test(d)) continue;+ const inner = path.join(base, d);+ for (const e of fs.readdirSync(inner)) {+ const p = path.join(inner, e, "bin/ffmpeg.exe");+ if (fs.existsSync(p)) out.push(p);+ }+ }+ return out;+}++const candidates = [+ process.env.SCROLLCRAFT_FFMPEG,+ "ffmpeg",+ ...globWinGet(),+ "/usr/local/bin/ffmpeg",+ "/opt/homebrew/bin/ffmpeg",+ "/usr/bin/ffmpeg",+].filter(Boolean);++let ffmpeg = null, filterCount = 0;+for (const c of candidates) {+ const out = run(c, ["-hide_banner", "-filters"]);+ if (!out) continue;+ const n = out.split("\n").length;+ if (n > filterCount) { filterCount = n; ffmpeg = c; }+ if (n > 200) break;+}+add("required", "ffmpeg (full build)", filterCount > 200,+ ffmpeg ? `${ffmpeg} (${filterCount} filters)` : "not found",+ "A stripped ffmpeg lacks scale/fps/psnr and the webp muxer. Install a full build (Windows: winget install Gyan.FFmpeg) or set SCROLLCRAFT_FFMPEG to one.");++if (ffmpeg && filterCount > 200) {+ const enc = run(ffmpeg, ["-hide_banner", "-encoders"]) || "";+ add("optional", " └ libwebp encoder", /libwebp/.test(enc),+ /libwebp/.test(enc) ? "present" : "missing",+ "Posters fall back to JPEG. Not fatal, just heavier.");+}++// ---------------------------------------------------------- playwright ----+let pw = false, pwWhere = "";+try {+ createRequire(path.join(process.cwd(), "package.json"))("playwright-core");+ pw = true; pwWhere = "resolves from cwd";+} catch {+ try {+ createRequire(path.join(HERE, "package.json"))("playwright-core");+ pw = true; pwWhere = "resolves from the skill, but NOT from cwd";+ } catch { pwWhere = "not installed"; }+}+add("verify", "playwright-core", pw, pwWhere,+ "Run `npm i playwright-core` inside the build folder. Only needed for the verification pass.");++const chrome = [+ process.env.SCROLLCRAFT_CHROME,+ "C:/Program Files/Google/Chrome/Application/chrome.exe",+ "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",+ "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",+ "/usr/bin/google-chrome",+].find((p) => p && fs.existsSync(p));+add("verify", "Chrome", Boolean(chrome), chrome || "not found",+ "Install Chrome, or set SCROLLCRAFT_CHROME to an executable.");++// ------------------------------------------------------------- kie key ----+function findKey() {+ if (process.env.KIE_AI_API_KEY) return "env";+ let dir = process.cwd();+ for (let i = 0; i < 8; i++) {+ const p = path.join(dir, ".env");+ if (fs.existsSync(p) && /^\s*KIE_AI_API_KEY\s*=\s*\S+/m.test(fs.readFileSync(p, "utf8"))) return p;+ const up = path.dirname(dir);+ if (up === dir) break;+ dir = up;+ }+ return null;+}+const keyWhere = findKey();+add("optional", "KIE_AI_API_KEY", Boolean(keyWhere), keyWhere || "not set",+ "Only needed to GENERATE imagery. Building from your own photos and footage needs no key and no spend. Copy .env.example to .env to set one.");++// ----------------------------------------------------------- workspace ----+let ws = null;+try {+ ws = paths();+ add("required", "workspace", true, `${ws.workspace}\n via ${ws.via}`, "");+ add("optional", " └ registry", fs.existsSync(ws.fingerprints),+ fs.existsSync(ws.fingerprints) ? "present" : "not created yet",+ "Run `node scripts/workspace.mjs --ensure` to create it.");+} catch (e) {+ add("required", "workspace", false, e.message, "Fix or delete the offending .scrollcraft.json.");+}++// -------------------------------------------------------------- report ----+const mark = (r) => (r.ok ? "\u001b[32m ok \u001b[0m" : r.sev === "required" ? "\u001b[31mFAIL\u001b[0m" : "\u001b[33mwarn\u001b[0m");+console.log("\nscrollcraft preflight\n");+for (const r of rows) {+ console.log(` [${mark(r)}] ${r.name.padEnd(22)} ${r.detail}`);+ if (!r.ok && r.fix) console.log(` ${"\u001b[2m"}${r.fix}${"\u001b[0m"}`);+}++const hardFails = rows.filter((r) => !r.ok && r.sev === "required");+const softFails = rows.filter((r) => !r.ok && r.sev !== "required");+console.log("");+if (hardFails.length) {+ console.log(`\u001b[31m${hardFails.length} required check(s) failed. Fix these before building.\u001b[0m\n`);+ process.exit(1);+}+console.log(softFails.length+ ? `\u001b[33mReady, with ${softFails.length} optional item(s) missing (see above).\u001b[0m\n`+ : "\u001b[32mReady.\u001b[0m\n");++if (process.argv.includes("--probe") && keyWhere) {+ const { execFileSync: x } = await import("node:child_process");+ try {+ console.log("credit: " + x(process.execPath, [path.join(HERE, "kie.mjs"), "probe"], { encoding: "utf8" }).trim().replace(/^credit:\s*/, ""));+ } catch (e) { console.log("balance probe failed: " + e.message); }+}diff --git a/plugins/scrollcraft/scripts/shoot.mjs b/plugins/scrollcraft/scripts/shoot.mjsindex ca529ba..cf60762 100644--- a/plugins/scrollcraft/scripts/shoot.mjs+++ b/plugins/scrollcraft/scripts/shoot.mjs@@ -186,6 +186,22 @@ const positions = WORLD ? await page.evaluate((perSeg) => {const p = 0.02 + f * 0.96;out.push(Math.round(pinned ? top + (h - innerHeight) * p : top - innerHeight + (h + innerHeight) * p));});+ // A pinned stage is on screen for a viewport BEFORE its pinned travel begins+ // and a viewport AFTER it ends, and the loop above samples only inside the+ // travel. Those two slides are exactly where a clip mapped to pinned+ // progress sits frozen on its first or last frame, so not sampling them is+ // why a frozen clip could pass this harness. Sample them.+ if (el.dataset.scAct === "scrub") {+ // `v` is the fraction of the viewport the stage covers at that position.+ // Sample the part of each slide where the stage is still MOSTLY on screen,+ // because that is where a frozen frame is conspicuous, and because the+ // frozen-clip check needs consecutive samples that are both well past its+ // visibility gate before it will call anything.+ [0.6, 0.75, 0.9].forEach((v) => {+ out.push(Math.round(top - innerHeight * (1 - v))); // sliding in+ out.push(Math.round(top + h - innerHeight * v)); // sliding out+ });+ }});const max = document.body.scrollHeight - innerHeight;out.push(max);@@ -237,6 +253,14 @@ for (let i = 0; i < positions.length; i++) {painted: (v.closest("[data-sc-act]") ?? v).classList.contains("sc-has-clip"),t: +(v.currentTime || 0).toFixed(2),dur: +(v.duration || 0).toFixed(2),+ // How much of the viewport this clip's stage actually covers. A frozen+ // playhead only matters while the reader can see the stage.+ vis: (() => {+ const st = v.closest("[data-sc-stage]") || v.parentElement;+ if (!st) return 0;+ const b = st.getBoundingClientRect();+ return +(Math.max(0, Math.min(b.bottom, innerHeight) - Math.max(b.top, 0)) / innerHeight).toFixed(3);+ })(),}));// Rails and wipes move without changing any cue or clip time, so without// these a panning section reads as dead scroll.@@ -483,6 +507,51 @@ console.log(dead.length ? `\nDEAD SCROLL between: ${dead.join(", ")}`: WORLD && REDUCED ? "\ndead-scroll check skipped: reduced motion holds each leg on one still frame by design": "\nno dead scroll detected");+// FROZEN CLIP. The reader is scrolling, a scrub stage is on screen, and its+// playhead is not moving: a still photograph sliding up the page. Dead scroll+// cannot see this, because the stage IS moving, which is the whole problem.+//+// A hold on the first or last frame is always a defect. A hold in the middle+// can be an intentional `dwell` settle, so it only counts once it outlasts one.+// Skipped under reduced motion, where no clip is ever fetched on purpose.+if (!REDUCED) {+ const nClips = report[0]?.clips?.length || 0;+ const VIS = 0.55, EPS = 0.012, MIN = doc.vh * 0.15;+ const frozen = [];+ for (let c = 0; c < nClips; c++) {+ let run = null;+ const flush = () => {+ if (!run) return;+ const kind = run.t < 0.05 ? "entry" : (run.dur && run.t > run.dur - 0.08 ? "exit" : "mid");+ const need = kind === "mid" ? doc.vh * 0.5 : MIN;+ if (run.to - run.from >= need) frozen.push({ c, kind, ...run });+ run = null;+ };+ for (let i = 1; i < report.length; i++) {+ const a = report[i - 1].clips?.[c], b = report[i].clips?.[c];+ if (!a || !b) { flush(); continue; }+ const seen = a.vis >= VIS && b.vis >= VIS;+ const stuck = Math.abs(b.t - a.t) < EPS;+ if (seen && stuck && b.painted) {+ if (!run) run = { from: report[i - 1].y, to: report[i].y, t: b.t, dur: b.dur };+ else run.to = report[i].y;+ } else flush();+ }+ flush();+ }+ if (frozen.length) {+ console.log("\nFROZEN CLIP (still image while the page moves):\n " + frozen.map((f) => {+ const px = f.to - f.from;+ const where = f.kind === "entry" ? "held on its FIRST frame while the stage slides in"+ : f.kind === "exit" ? "held on its LAST frame while the stage slides out"+ : `held mid-clip at ${f.t.toFixed(2)}s, longer than a dwell settle`;+ return `clip ${f.c}: ${px}px (${(px / doc.vh).toFixed(2)} viewports) ${where}`;+ }).join("\n ") + "\n Fix: let the clip map across the stage's whole visible life. That is the\n engine default; data-sc-clip-map=\"travel\" turns it off. See devices.md.");+ } else if (nClips) {+ console.log(`all ${nClips} scrub clip(s) keep moving whenever they are on screen`);+ }+}+// Worldflight findings. A leg that never reaches full opacity is a weight or a// seam that is wrong: the reader is shown a permanent dissolve between two// clips and never the leg itself. A leg stuck on its poster is a clip thatdiff --git a/plugins/scrollcraft/scripts/workspace.mjs b/plugins/scrollcraft/scripts/workspace.mjsnew file mode 100644index 0000000..e9481d6--- /dev/null+++ b/plugins/scrollcraft/scripts/workspace.mjs@@ -0,0 +1,106 @@+#!/usr/bin/env node+/**+ * Resolve the scrollcraft workspace: the one directory that holds this user's+ * builds and their fingerprint registry.+ *+ * The skill used to hardcode one author's repo layout, which meant the+ * fingerprint gate dead-ended on every other machine. Nothing is hardcoded now.+ * Resolution order, first hit wins:+ *+ * 1. SCROLLCRAFT_HOME env var, absolute or relative to cwd+ * 2. .scrollcraft.json nearest one walking up from cwd,+ * { "workspace": "some/path" } relative to+ * the file that declares it+ * 3. <project root>/scrollcraft project root = nearest ancestor with .git,+ * otherwise cwd+ *+ * USAGE+ * node scripts/workspace.mjs print the workspace path+ * node scripts/workspace.mjs --json print every resolved path+ * node scripts/workspace.mjs --ensure create it and seed the registry+ */++import fs from "node:fs";+import path from "node:path";+import { fileURLToPath } from "node:url";++const HERE = path.dirname(fileURLToPath(import.meta.url));+const SKILL = path.resolve(HERE, "..");++function findUp(startDir, predicate) {+ let dir = path.resolve(startDir);+ for (let i = 0; i < 12; i++) {+ const hit = predicate(dir);+ if (hit) return { dir, hit };+ const up = path.dirname(dir);+ if (up === dir) break;+ dir = up;+ }+ return null;+}++export function resolveWorkspace(cwd = process.cwd()) {+ if (process.env.SCROLLCRAFT_HOME) {+ return { root: path.resolve(cwd, process.env.SCROLLCRAFT_HOME), via: "SCROLLCRAFT_HOME" };+ }++ const cfg = findUp(cwd, (d) => {+ const p = path.join(d, ".scrollcraft.json");+ return fs.existsSync(p) ? p : null;+ });+ if (cfg) {+ let parsed = {};+ try {+ parsed = JSON.parse(fs.readFileSync(cfg.hit, "utf8"));+ } catch (e) {+ throw new Error(`.scrollcraft.json is not valid JSON: ${cfg.hit}\n ${e.message}`);+ }+ if (parsed.workspace) {+ return { root: path.resolve(cfg.dir, parsed.workspace), via: cfg.hit };+ }+ }++ const git = findUp(cwd, (d) => (fs.existsSync(path.join(d, ".git")) ? d : null));+ const base = git ? git.hit : path.resolve(cwd);+ return { root: path.join(base, "scrollcraft"), via: git ? "project root (.git)" : "cwd" };+}++export function paths(cwd = process.cwd()) {+ const { root, via } = resolveWorkspace(cwd);+ return {+ via,+ workspace: root,+ builds: path.join(root, "builds"),+ lab: path.join(root, "lab"),+ fingerprints: path.join(root, "FINGERPRINTS.md"),+ };+}++export function ensure(cwd = process.cwd()) {+ const p = paths(cwd);+ fs.mkdirSync(p.builds, { recursive: true });+ fs.mkdirSync(p.lab, { recursive: true });+ let seeded = false;+ if (!fs.existsSync(p.fingerprints)) {+ const seed = path.join(SKILL, "templates", "FINGERPRINTS.md");+ fs.copyFileSync(seed, p.fingerprints);+ seeded = true;+ }+ return { ...p, seeded };+}++// ------------------------------------------------------------------- cli ----+if (process.argv[1] && path.resolve(process.argv[1]) === path.resolve(fileURLToPath(import.meta.url))) {+ const argv = process.argv.slice(2);+ const p = argv.includes("--ensure") ? ensure() : paths();+ if (argv.includes("--json")) {+ console.log(JSON.stringify(p, null, 2));+ } else if (argv.includes("--ensure")) {+ console.log(p.workspace);+ console.error(` builds ${p.builds}`);+ console.error(` registry ${p.fingerprints}${p.seeded ? " (seeded, empty)" : " (already present)"}`);+ console.error(` resolved via ${p.via}`);+ } else {+ console.log(p.workspace);+ }+}diff --git a/plugins/scrollcraft/scripts/worldflight-assert.mjs b/plugins/scrollcraft/scripts/worldflight-assert.mjsnew file mode 100644index 0000000..b106818--- /dev/null+++ b/plugins/scrollcraft/scripts/worldflight-assert.mjs@@ -0,0 +1,261 @@+#!/usr/bin/env node+/**+ * Worldflight rig assertions. Not a contact sheet: these are the mechanical+ * claims the mode makes, checked one at a time.+ *+ * node lab/worldflight-assert.mjs --url http://localhost:4520+ */+import fs from "node:fs";+import path from "node:path";+import { createRequire } from "node:module";+const { chromium } = createRequire(path.join(process.cwd(), "package.json"))("playwright-core");++const argv = process.argv.slice(2);+const arg = (n, d) => { const i = argv.indexOf(n); return i > -1 && argv[i + 1] ? argv[i + 1] : d; };+const URL = arg("--url", "http://localhost:4520");++const CHROME = [+ process.env.SCROLLCRAFT_CHROME,+ "C:/Program Files/Google/Chrome/Application/chrome.exe",+ "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",+].find((p) => p && fs.existsSync(p));++let pass = 0, fail = 0;+const ok = (name, cond, note = "") => {+ if (cond) { pass++; console.log(` PASS ${name}${note ? " " + note : ""}`); }+ else { fail++; console.log(` FAIL ${name}${note ? " " + note : ""}`); }+};++const browser = await chromium.launch({ executablePath: CHROME, headless: true });++// ============================================================ desktop ======+{+ const page = await browser.newPage({ viewport: { width: 1440, height: 900 }, deviceScaleFactor: 1 });+ const errs = [];+ page.on("console", (m) => { if (m.type() === "error") errs.push(m.text()); });+ page.on("pageerror", (e) => errs.push(String(e)));+ await page.goto(URL, { waitUntil: "domcontentloaded" });+ await page.waitForSelector("html.sc-ready", { timeout: 15000 });+ await page.evaluate(() => document.fonts.ready);+ await page.waitForTimeout(900);++ const geom = await page.evaluate(() => {+ const segs = [...document.querySelectorAll("[data-sc-segment]")];+ const total = segs.reduce((s, el) => s + (parseFloat(el.dataset.scW) || 1.3), 0);+ const spacer = document.querySelector("[data-sc-spacer]");+ const stage = document.querySelector("[data-sc-world]");+ return {+ vh: innerHeight, total,+ weights: segs.map((el) => parseFloat(el.dataset.scW) || 1.3),+ spacerH: spacer.getBoundingClientRect().height,+ wantH: Math.round((total + 1) * innerHeight),+ docH: document.body.scrollHeight,+ stagePos: getComputedStyle(stage).position,+ stageRect: (({ top, left, width, height }) => ({ top, left, width, height }))(stage.getBoundingClientRect()),+ copyPos: getComputedStyle(document.querySelector("[data-sc-world-copy]")).position,+ seam: parseFloat(document.querySelector('[data-sc-mode="worldflight"]').dataset.scSeam),+ };+ });+ console.log(`\nDESKTOP vh=${geom.vh} weights=[${geom.weights}] total=${geom.total}vh`);++ ok("spacer height = (sum weights + 1) x vh",+ Math.abs(geom.spacerH - geom.wantH) <= 1, `got ${Math.round(geom.spacerH)}px want ${geom.wantH}px`);+ ok("document scroll height is the spacer",+ Math.abs(geom.docH - geom.wantH) <= 2, `doc ${geom.docH}px`);+ ok("stage is position:fixed and fills the viewport",+ geom.stagePos === "fixed" && geom.stageRect.height === geom.vh && geom.stageRect.top === 0);+ ok("copy layer is position:fixed", geom.copyPos === "fixed");++ // Nothing in flow but the spacer: at any scroll position, the only static or+ // relative element that extends past the fold is the spacer and its ancestors.+ const flow = await page.evaluate(() => {+ const bad = [];+ document.querySelectorAll("body *").forEach((el) => {+ const cs = getComputedStyle(el);+ if (cs.position === "fixed" || cs.position === "absolute") return;+ if (el.hasAttribute("data-sc-spacer") || el.hasAttribute("data-sc-mode")) return;+ const r = el.getBoundingClientRect();+ if (r.height > 4 && r.bottom > innerHeight + 4) {+ bad.push(el.tagName + "." + (el.className || "").toString().slice(0, 30));+ }+ });+ return bad;+ });+ ok("nothing in document flow but the spacer", flow.length === 0, flow.join(", "));++ // ---- lerp convergence, inside one leg ----------------------------------+ const seg0 = geom.weights[0];+ const A = Math.round(0.10 * seg0 * geom.vh);+ const B = Math.round(0.85 * seg0 * geom.vh);+ await page.evaluate((y) => scrollTo({ top: y, behavior: "instant" }), A);+ await page.waitForTimeout(1400);++ const trace = await page.evaluate(({ y }) => new Promise((res) => {+ const v = document.querySelectorAll("[data-sc-segment] video")[0];+ const clip = window.__sc.clips.find((c) => c.el === v);+ const s = [];+ scrollTo({ top: y, behavior: "instant" });+ let n = 0;+ (function f() {+ s.push(+v.currentTime.toFixed(4));+ if (++n < 70) requestAnimationFrame(f);+ else res({ s, target: clip.target * (v.duration || 1), dur: v.duration, lerp: clip.lerp });+ })();+ }), { y: B });++ const seq = trace.s;+ const start = seq[0], end = seq[seq.length - 1];+ const distinct = [...new Set(seq)];+ const monotone = seq.every((v, i) => i === 0 || v >= seq[i - 1] - 1e-6);+ const overshoot = Math.max(...seq) - trace.target;+ console.log(` playhead ${start.toFixed(3)}s -> ${end.toFixed(3)}s target ${trace.target.toFixed(3)}s lerp ${trace.lerp} ${distinct.length} distinct values`);+ ok("playhead is lerped, not written 1:1", distinct.length >= 4, `${distinct.length} distinct steps across 70 frames`);+ ok("playhead is strictly monotone toward its target", monotone);+ ok("playhead does not overshoot", overshoot <= 0.02, `max excess ${overshoot.toFixed(4)}s`);+ ok("playhead converges on the target", Math.abs(end - trace.target) < 0.05,+ `residual ${Math.abs(end - trace.target).toFixed(4)}s`);+ ok("lerp rate is the 0.18 default", Math.abs(trace.lerp - 0.18) < 1e-9);++ // ---- deadband: no seek thrash while the page is still -------------------+ await page.waitForTimeout(900);+ const seeks = await page.evaluate(() => new Promise((res) => {+ let n = 0;+ const vs = [...document.querySelectorAll("video")];+ const h = () => n++;+ vs.forEach((v) => v.addEventListener("seeked", h));+ setTimeout(() => { vs.forEach((v) => v.removeEventListener("seeked", h)); res(n); }, 1000);+ }));+ ok("deadband holds: no seeks over 1s of stillness", seeks === 0, `${seeks} seeked events`);++ // ---- crossfade band ----------------------------------------------------+ const boundary = seg0 * geom.vh;+ const half = (geom.seam / 2) * geom.vh;+ const band = [];+ for (let i = 0; i < 5; i++) {+ const y = Math.round(boundary - half + (2 * half) * (i / 4));+ await page.evaluate((y) => scrollTo({ top: y, behavior: "instant" }), y);+ await page.waitForTimeout(120);+ band.push(await page.evaluate(() => {+ const segs = [...document.querySelectorAll("[data-sc-segment]")];+ return segs.map((s) => +(parseFloat(getComputedStyle(s).opacity) || 0).toFixed(4));+ }));+ }+ const incoming = band.map((b) => b[1]);+ const outgoing = band.map((b) => b[0]);+ console.log(` seam band incoming=[${incoming}] outgoing=[${outgoing}]`);+ ok("incoming leg opacity is strictly monotone across the seam",+ incoming.every((v, i) => i === 0 || v > incoming[i - 1]));+ ok("incoming leg starts at 0 and ends at 1", incoming[0] <= 0.02 && incoming[4] >= 0.98);+ // The outgoing leg must hold at full strength for the whole dissolve and only+ // release once the incoming one covers it completely. A crossfade where BOTH+ // sides are partly transparent shows the page ground through the middle of+ // the seam, which is the flash this mode exists to remove.+ ok("outgoing leg holds full opacity while the incoming one is still arriving",+ incoming.every((v, i) => v >= 0.999 || outgoing[i] >= 0.999), `[${outgoing}]`);+ ok("outgoing leg only releases once it is fully covered",+ outgoing[4] === 0 && incoming[4] >= 0.999);++ // ---- copy transform cap ------------------------------------------------+ const maxT = [];+ for (let i = 0; i <= 12; i++) {+ const y = Math.round((geom.docH - geom.vh) * (i / 12));+ await page.evaluate((y) => scrollTo({ top: y, behavior: "instant" }), y);+ await page.waitForTimeout(60);+ maxT.push(await page.evaluate(() => {+ let m = 0;+ document.querySelectorAll("[data-sc-copy]").forEach((el) => {+ const t = new DOMMatrixReadOnly(getComputedStyle(el).transform);+ m = Math.max(m, Math.abs(t.m42), Math.abs(t.m41));+ });+ return +m.toFixed(2);+ }));+ }+ const worstT = Math.max(...maxT);+ ok("copy never translates past 4vh", worstT <= geom.vh * 0.04 + 1,+ `worst ${worstT}px, cap ${(geom.vh * 0.04).toFixed(0)}px`);++ // ---- every leg reaches full opacity, every clip leaves its poster -------+ const reach = {};+ for (let i = 0; i <= 24; i++) {+ const y = Math.round((geom.docH - geom.vh) * (i / 24));+ await page.evaluate((y) => scrollTo({ top: y, behavior: "instant" }), y);+ await page.waitForTimeout(260);+ const s = await page.evaluate(() => [...document.querySelectorAll("[data-sc-segment]")].map((el, i) => ({+ i, op: parseFloat(getComputedStyle(el).opacity) || 0,+ painted: el.classList.contains("sc-has-clip"),+ })));+ s.forEach((x) => {+ reach[x.i] = reach[x.i] || { op: 0, painted: false };+ reach[x.i].op = Math.max(reach[x.i].op, x.op);+ reach[x.i].painted = reach[x.i].painted || x.painted;+ });+ }+ ok("every leg reaches full opacity",+ Object.values(reach).every((r) => r.op >= 0.99),+ Object.entries(reach).map(([i, r]) => `${i}:${r.op.toFixed(2)}`).join(" "));+ ok("every leg paints a real frame (no clip stuck on poster)",+ Object.values(reach).every((r) => r.painted),+ Object.entries(reach).map(([i, r]) => `${i}:${r.painted ? "clip" : "POSTER"}`).join(" "));++ ok("no console errors", errs.length === 0, errs.slice(0, 3).join(" | "));+ await page.close();+}++// ==================================================== reduced motion =======+{+ const page = await browser.newPage({+ viewport: { width: 1440, height: 900 }, deviceScaleFactor: 1, reducedMotion: "reduce",+ });+ const media = [];+ page.on("request", (r) => { if (/\.(mp4|webm)(\?|$)/.test(r.url())) media.push(r.url()); });+ await page.goto(URL, { waitUntil: "domcontentloaded" });+ await page.waitForSelector("html.sc-ready", { timeout: 15000 });+ await page.waitForTimeout(800);+ console.log("\nREDUCED MOTION");++ const rmSeen = { legs: {}, copy: {} };+ for (let i = 0; i <= 20; i++) {+ const h = await page.evaluate(() => document.body.scrollHeight - innerHeight);+ await page.evaluate((y) => scrollTo({ top: y, behavior: "instant" }), Math.round(h * (i / 20)));+ await page.waitForTimeout(90);+ const s = await page.evaluate(() => ({+ legs: [...document.querySelectorAll("[data-sc-segment]")].map((el) => ({+ op: parseFloat(getComputedStyle(el).opacity) || 0,+ poster: (() => { const p = el.querySelector(".sc-world__poster"); return p ? getComputedStyle(p).transform : "none"; })(),+ })),+ copy: [...document.querySelectorAll("[data-sc-copy]")].map((el) => ({+ t: (el.textContent || "").trim().replace(/\s+/g, " ").slice(0, 24),+ op: parseFloat(getComputedStyle(el).opacity) || 0,+ tf: getComputedStyle(el).transform,+ })),+ }));+ s.legs.forEach((l, k) => {+ rmSeen.legs[k] = rmSeen.legs[k] || { op: 0, tf: new Set() };+ rmSeen.legs[k].op = Math.max(rmSeen.legs[k].op, l.op);+ rmSeen.legs[k].tf.add(l.poster);+ });+ s.copy.forEach((c) => {+ rmSeen.copy[c.t] = rmSeen.copy[c.t] || { op: 0, tf: new Set() };+ rmSeen.copy[c.t].op = Math.max(rmSeen.copy[c.t].op, c.op);+ rmSeen.copy[c.t].tf.add(c.tf);+ });+ }+ await page.waitForTimeout(500);++ ok("no clip is ever fetched", media.length === 0, media.join(", "));+ ok("every leg's poster still reaches full opacity",+ Object.values(rmSeen.legs).every((l) => l.op >= 0.99),+ Object.entries(rmSeen.legs).map(([i, l]) => `${i}:${l.op.toFixed(2)}`).join(" "));+ ok("no poster transform",+ Object.values(rmSeen.legs).every((l) => [...l.tf].every((t) => t === "none")));+ ok("every copy block still reaches full opacity",+ Object.values(rmSeen.copy).every((c) => c.op >= 0.99),+ Object.entries(rmSeen.copy).map(([t, c]) => `${c.op.toFixed(2)} "${t}"`).join(" | "));+ ok("no copy transform",+ Object.values(rmSeen.copy).every((c) => [...c.tf].every((t) => t === "none")));+ await page.close();+}++await browser.close();+console.log(`\n${pass} passed, ${fail} failed`);+process.exit(fail ? 1 : 0);diff --git a/plugins/scrollcraft/templates/FINGERPRINTS.md b/plugins/scrollcraft/templates/FINGERPRINTS.mdnew file mode 100644index 0000000..cdd898e--- /dev/null+++ b/plugins/scrollcraft/templates/FINGERPRINTS.md@@ -0,0 +1,65 @@+# Fingerprints++Every site you build with **scrollcraft** gets one row here, appended after it+ships. The registry exists so your next build can prove it is a different page+rather than a re-skin of one you already made.++This file is **yours**. It starts empty on purpose: the gate is about not+repeating *yourself*, so it has nothing to say until you have built something.++The rules and the gate live in the skill's+`references/uniqueness.md`. Short version:++**A new build must differ from EVERY row below on at least 4 of the 6+dimensions.** Four against each row individually, not four on average across the+table. If a planned build fails, change the plan. Never edit a row to make room+for it.++The six dimensions are: **grammar**, **nav treatment**, **hero device**,+**act-sequence shape**, **close pattern**, **signature move**.++Dimension 6 is free, because a signature move is unique by definition. So the+gate really asks for three more out of the remaining five, and a build that+changes only grammar and world will fail it.++---++## The registry++| Build | Grammar | Nav treatment | Hero device | Act-sequence shape | Close pattern | Signature move | World | Port |+|---|---|---|---|---|---|---|---|---|++*(empty: your first build has nothing to clear, so build whatever the interview+points at. From the second onwards, this table is the constraint.)*++---++## What is taken++Add a bullet here whenever a build claims something a later build should avoid+reusing: a grammar, a nav treatment, a close pattern, a signature move, an+act-count-and-length band. The shared columns are what the next build inherits+as a constraint, so writing them down is the whole point.++Nothing is taken yet.++---++## Appending a row++After shipping, add one line to the table and one bullet to **What is taken** if+the build claimed something new. Fill every column. Say what the build shares+with existing rows.++Rows are append-only. A build that has been superseded stays in the table,+because the space it occupies is still occupied.++---++## Worked example++The skill's author kept a registry of twelve builds across eight page grammars.+If you want to see what a filled-in table looks like, and which shapes tend to+collide, read `EXAMPLES.md` in the scrollcraft repository. Treat it as+illustration only: those rows are somebody else's builds and they do **not**+constrain yours.