SuperAPI AI Directory

website-rebuild

Coding & development

View repository

Updated 11-12 16:17

About this skill

Website Rebuild (1:1 replica of an award-winning creative site)

Rebuild an award-winning creative website (WebGL / scroll narrative / portfolio site) as an independently runnable project with verifiable fidelity, using aforensic approach. Not a "looks similar" imitation—but a line-by-line port that takes the source site's bundle as the sole specification and closes with quantitative acceptance gates.

This methodology was distilled from six consecutive hands-on projects (production time converging from 6.5 weeks to 1 day), then continuously backfilled by 22 full replicas + 5 dead-site archive rescues, and calibrated for scope of applicability through boundary-probing tests on 43 sites (see the repository README "Websites Already Verified" for the list).

Prerequisites and Authorization ⛔ Must Read

This skill is intended forlearning and research purposes, providing faithful replicas for studying how award-winning creative sites are implemented. It applies to websites that youown, are authorized for, or that are publicly accessible and permit learning-by-copying. It is not a tool for unauthorized collection of protected content, circumvention of access controls, or commercial misappropriation of others' work.

Observe the following boundaries during execution:

  • Respect the target site's rules: comply with its robots.txt, terms of service, and copyright; keep crawling low-frequency and single-session, and do not place abnormal load on the target site. ⛔ robots.txt is a per-path permission statement, not a site-wide switch—evaluate URL by URL (select group → longest match → no match means allowed);do not judge "the whole site is forbidden" merely because any Disallow line exists(almost every commercial site has /cart、/checkout、/admin for Disallow); prohibitions must be classified by behavior category, andonly prohibitions targeting "crawling" affect mirror scope, while prohibitions targeting transactions only mean "don't click checkout". ⭐ "Can't understand / can't be sure" does not equal "forbidden": escalate to the user rather than stopping work, and never unilaterally narrow the crawl scope. For how to read it, see references/legal-and-deploy.md §0.3。
  • Do not touch protected boundaries: do not collect content that requires a logged-in state, paywall, or authorization to access; this skill only handles anonymously and publicly accessible resources. If the target site explicitly prohibits such copying, stop and inform the user—for what counts as "explicitly prohibited", see legal-and-deploy.md §0.3.6, the four hard-coded thresholds; all other uncertainty goes to escalation, not to stopping work。
  • Output is private by default: default to noindex and no public deployment. Before any public release, complete per-asset copyright verification and prominently label it as an "unofficial replica" with attribution to the original author (see references/legal-and-deploy.md)。

⛔ Legal judgment belongs to the user; the skill only gathers evidence and presents it(three rules, in force throughout):

  1. The decision rests with the user: the skill collects facts (per-asset attribution, license status, third-party rights holders, whether the source site is still operating, third-party identifiers in the output), lists options and their respective risk boundaries, and gives recommendations with reasons; whenever "can it be made public / deployed / redistributed / shown externally" is involved,it must be explicitly returned to the user via "User Input Tools" below, and the agent must not draw its own legal conclusion and then proceed.
  2. Follow safe defaults until the user makes an explicit decision: private repository + noindex + no public deployment + no redistribution. When writing to the user, explain that this is thedefault action("I won't send it out until you decide"),not a legal conclusion already made by the agent—the two have completely different lines of responsibility. The agent can only default to the conservative side; moving to the public side requires an explicit decision from the user.
  3. ⛔ Legal considerations must not reduce mirror completeness or the coverage of the gates: the mirror is the evidentiary foundation,completeness is a technical invariant(the four-pass method, closure gates, and GAP=0 all rest on it). Failure to capture may only havetechnical reasons(not a file / not provided by the server / requires authorization or login state / explicitly prohibited by the origin site), and all must be logged;must notleave holes for legal reasons such as "it won't be public anyway" or "we shouldn't store an extra copy" [objectarchive] (empirical:references/case-studies/skill.md"Prerequisites and Authorization"). Legal decisions apply tohow the output is used, not to whether the evidentiary foundation is complete.

Scope of Application ⛔ Required Reading

Home ground (Class A): sites where content is statically hosted and signing behavior (animation/interaction) is entirely stored in client-side static assets—imperative WebGL/Canvas scenes, GSAP timelines, baked data files (GLB/.buf/.riv), minified or unobfuscated bundles. The vast majority of Awwwards-style creative sites fall into this category.

Conditionally supported (Class B): the pipeline holds but requires additional scenario handling (Shopify platform-layer stripping, third-party bucket assets, runtime API snapshots, SSG payload expansion). The current version of the guide covers most Class B scenarios; when encountering uncovered ones, the risks must be made explicit to the user.

Explicitly declined (Class C/D):

  • C1 (doable since v0.3: reconstructive reverse engineering): the server component source is indeed not delivered, butits complete output (the flight stream) is inlined in each page's HTML and is a spec sheet that can be reconciled against. Route: flight-decode to establish the coordinate system → reconstruct a buildable Next project (client-side components translated verbatim per C2, server components inferred from the flight tree as explicitly registered inferences) → verify-flight semantic gate closure (module id global bijection; empirical:references/case-studies/skill.md"Scope of Application"). ⚠ C1's L2/L3 merge—the first artifact is "human-written source code + gate-proven equivalence". See the full process in references/rsc-reconstruction.md。
  • C2 (doable, run as Class A): ⭐ the authoring style is declarative butthe source is delivered(R3F / Theatre / Vue SFC compiled output).The slicer doesn't care about paradigm—it slices bytes. The renderer serves from the mirror as a platform layer (empirical:references/case-studies/skill.md"Scope of Application"). ⛔ The discriminator is not the library name, but "whether the client holds the behavior source" (scope-and-fingerprint.md §4.0.1)。
  • D: the behavior subject is on the server (CMS content sites, e-commerce cart/inventory, A/B experiment bucketing, personalization hydration)—the client has no portable target, and deterministic acceptance has no baseline.

Class X (salvageable): the original site no longer exists (domain changed hands / reclaimed by the platform / path removed / replaced in place), but the Internet Archive often has captures—scripts/wayback-mirror.mjs from the CDX index byanchor + time windowselect a coherent moment, capture the id_ original bytes into astandard mirror(downstream gates work as-is), and log holes as established facts into wayback-holes.txt(For the reading method and workflow, see references/archival-rescue.md). ⭐ Rescue output is astandard mirror—Class X can complete the entire L3 process (evidence:references/case-studies/skill.md"Scope of Application"). ⛔ "Only when CDX has no coverage is it truly undoable" is read at the asset layer, not at the site level: the IA crawler does not execute JS; for sites driven by manifests/concatenation, the code layer can be covered 100% while the rendered layer is zero (evidence:references/case-studies/skill.md"Scope of Application")—Step 0 first performs layered coverage reconnaissance (derivation + CDX prefix queries) to predict the rescue depth; see archival-rescue.md §1.9. The measured disappearance rate of past award-winning sites is about 29%—this is also why "mirror at the first opportunity" is the first discipline of this skill.

The level is determined by the Step 0 fingerprint reconnaissance; for the complete decision tree, see references/scope-and-fingerprint.md。When refusing, explain the reason and state which category the site belongs to, and do not force a run.

User Input Tools

When a question needs to be asked to the user (confirming scope,legal decisions, external dependency decisions): prefer the built-in question tool of the current runtime (e.g., AskUserQuestion); if there is none, output a numbered question list and let the user reply with numbers. When multiple questions can be combined, ask them all at once. Write legal questions in the five-part format of legal-and-deploy.md §0.1: facts / what cannot be determined / options / the risk boundary of each option / recommendation and current default action.

Constitution (six disciplines, in effect throughout)

The following six are called "constitutional-level" in the six source projects; violating any one of them will be repaid as bugs in later stages:

  1. The mirror is sacred and must not be polluted:mirror/ : disk files are never modified; all localization adaptations (CDN rewriting, external-link stubs) are performed dynamically in the service-layer response.
  2. Source-site code is the sole arbiter; do not fix based on appearance: for every change, first find the owning line number in the bundle/CSS/mirror HTML, then implement it. Do not tune visuals, motion, or interaction by eye.
  3. Everything the source site has must be present; nothing the source site lacks may be added: do not invent compensatory CSS/JS. Better to look unlike it at first than to invent rules—self-invented patches will turn into bugs once the mechanisms are aligned.
  4. Copy bugs / dead code / odd constructs verbatim; do not fix them: every odd construct in minified code may be the behavior itself. A "well-intentioned fix" of a no-op bug once caused a transition crash (evidence in porting-discipline.md).
  5. Intentional deviations must be registered: clearly state "what the source site does / what we do / why / under what conditions to reconsider".Any unregistered difference is treated as a bug。
  6. Code and documentation in the same commit: commit each milestone as a pair (Port xxx + Update rebuild plan: xxx); the log must always contain output / acceptance / lessons / next breakpoint (with line numbers).

⭐ The boundary of Discipline 3 at M(n+1):src/ is an explicitly registered derivative, not an assertion about the source site, soin src/ renaming, splitting modules, and writing comments do not count as "invention"—Discipline 3 constrains "inventing behavior to make it look like the source", not "making code that has been proven equivalent more readable". But two hard boundaries do not move:① Structural rewrites are prohibited by default(merging duplicates, extracting common functions, changing algorithms—they make equivalence undecidable);② Speculation in comments must be labeled as speculation, and guesses in reverse-engineering notes must not be written as declarative sentences.port/ and mirror/ Still not a single byte may be touched. See references/readable-source.md §3.4 and §5.

Workflow

Progress Checklist

[ ] Step 0  指纹侦察与范围门 ⛔(判级 A/B/C/D/X;C/D/X 拒绝或引导,不进入下一步)
[ ] Step 1  开工评级(架构证否、分项难度打星、工期预估、与用户确认范围 + 终点 L1/L2/L3)
[ ] M0      镜像取证 ⛔(BFS 爬虫 + CDP 补录 + manifest 账本;GAP=0)
[ ] M0.5    镜像断网跑通 ⛔(零 404 / 零控制台错误 / 零外联;serve.mjs 伺服)← L1 镜像存档 终点
[ ] M1      逆向建坐标系 ⛔(_pretty 钉版本展开;engine-notes 先于任何代码;技术栈钉死;REBUILD_PLAN 建立)
[ ] M2+     严格溯源移植(依赖序里程碑推进;先竖切一条端到端链路;每里程碑冷启动实测 + CLEAN 门)
[ ] M(n-1)  对拍验收(按 verification-gates.md 决策树选门型;根因修复,不调参糊平)
[ ] M(n)    收口 ⛔(冷头评审 / 模块清单对账;版权取证 + 呈交用户决定——公开部署前必须完成)← L2 工程化复刻 终点
[ ] M(n+1)  源码化(port/ → src/:拆模块、去混淆重命名、补注释、自包含)← L3 源码化 终点

⛔ = blocking gate: the next phase must not begin until the acceptance criteria are met.

Marker conventions (common to all documents): ⛔ hard rule, violation = bug · ⛔⛔ hard rule that has already exacted a high price in real practice · ⭐ validated practice · ⭐⭐ counterintuitive but data-confirmed practice · ⚠ pitfall / boundary · 【code】= empirically sourced project (corresponds to README "Sites already validated").

Flow

Step 0 — Fingerprint reconnaissance and scope gate. Load references/scope-and-fingerprint.md, run the probing protocol against the URL given by the user (GET down to path granularity, final URL identity, dual-fetch diff, species/era verification, initial bundle check), and output the grade and the basis. Continue for classes A/B; for classes C/D/X, explain to the user and then stop or guide them.

Step 1 — Kickoff grading. Load references/recon-and-rating.md. Falsify architectural assumptions first (dependency tables lie), rate the difficulty of each item with stars (assets/3D/scroll choreography/private formats/platform layer), and confirm with the user the reproduction scope (whole site or specified pages) and expectations.

⭐ Have the user choose the endpoint in the same question(three-level ladder; ask with the grading conclusion and tiered cost estimates in hand, do not just list options bare):

Endpoint Question answered Stops at Typical use
L1 Mirror archive What it looks like M0.5 Archiving, offline appreciation (award-winning sites have an annual disappearance rate of about 29%)
L2 Engineered reproduction What it is doing M(n) A deployable, verifiable 1:1 (including copyright evidence and deployment assessment)
L3 Source-code conversion How it does it M(n+1) Researching and learning implementation techniques

The ladder is monotonic; choosing lower costs nothing: each level is a prefix of the next, and mirror discipline guarantees that the time-sensitive part is always completed first — choose L1 today, and you can resume anytime later if you want to upgrade (explain this to the user)."Take it and make it my own project" (scaffolding) is not a phase of this skill— when the user asks, point them to references/beyond-the-rebuild.md for handoff; that is their engineering, and the skill stops at "the truth a human can read".

M0 / M0.5 — Mirror forensics. Load references/mirroring.md. Use scripts/mirror-site.mjs BFS crawling + scripts/netcapture.mjs real-browser supplementary capture, register sha256 per file in the manifest,redirect: manual discipline, and decide item by item on external dependencies.scripts/verify-mirror.mjs isthe mirror's own gate(five assertions, run before the offline gate — all downstream gates ask "does it render?", and a wrong mirror can turn them all green;an HTTP 200 is not evidence that "you got that resource")。scripts/serve.mjs serves the mirror, offline acceptance.This step is always done first— the original site may disappear or be redesigned at any time; the mirror is the sole evidence baseline for the whole project, and also the reference server for all subsequent comparison checks.

M1 — Reverse-engineering to build a coordinate system. Load references/reverse-engineering.md。⛔ The first action is to determine the bundle form(flat concatenation / modular bundling / multiple chunks), then choose tools — the layered table scans top-level declarations, whereas the number of top-level declarations in webpack-bundled output is 0, and boundaries and dependency edges are given by the bundler (use scripts/module-map.mjs; empirical evidence:references/case-studies/skill.md「Workflow / Flow — M1」). If the container cannot be identified, FATAL,falling back to the layer table is forbidden(§0.5)。scripts/beautify-bundle.mjs(js-beautify pinned to 1.15.1), expand the bundle to _pretty/, and from then on line numbers are the sole traceability coordinate system for the whole project. First write docs/engine-notes.md(template:assets/templates/engine-notes.md), then write any code. Pin exact versions of the tech stack from the bundle evidence. For data-driven animation, first dump the numerical ledger. Establish REBUILD_PLAN.md(template:assets/templates/rebuild-plan.md)。

M2+ — strict traceable porting. Load references/porting-discipline.md, and load the corresponding scenario guide according to the branch routing table. Annotate the source line-number range at the top of each ported file; extract GLSL/magic numbers/data verbatim; extract data assets into the repository via script rather than copying by hand.

M(n-1) — differential acceptance. Load references/verification-gates.md and references/determinism.md; only load references/gate-failure-modes.mdagain when a gate goes red or residuals need classification; do not read it at the start. Site-wide renderingbreadthuses scripts/sweep-routes.mjs(one browser for all routes, per-route 0 errors/0 failures/0 external links + interaction hooks and per-route collection); single-routedepthonly uses probe.mjs— ⛔ do not hand-roll a loop that starts Chrome per route; cost is counted by browser launches, and concurrent probes will reap each other's orphans. ⚠ before attributing residuals, first establish the self-comparison bandwidth(pixelcompare --self, ≥4 runs per side, run interleaved) — any residual without a bandwidth is UNCLASSIFIED, and UNCLASSIFIED is a failure, not a pass. Gate type selection: if there is an SSR/static HTML artifact, first build a byte gate → for DOM static scenarios, freeze entropy sources and go byte-equal → for live scenarios (WebGL/video/random phase), downgrade to quantitative metrics + noise classification → for data-driven animation, add a numerical probe gate → the CLEAN gate is the fallback throughout. Before deciding there is a timing bug, first calibrate the probe (references/environment-traps.md)。

M(n) — closing. Cold-head review: check the landing spot of each top-level class/module in the bundle list one by one (functional tests cannot catch whole-block omissions; only checklist-style verification can). Load references/legal-and-deploy.md to complete copyrightevidence collectionand present the decisionto the user— before the user decides, follow the safe default (private + noindex + not deployed); before making it public, you must collect evidence per asset and prominently label it as an unofficial reproduction.

M(n+1) — source-ification. Load references/readable-source.md. Up to M(n), the artifacthas been proven correct but is unreadable to humans(evidence:references/case-studies/skill.md「Workflow / Flow — M(n+1)」). This stage rewrites port/ into src/: split into modules → safely deobfuscate and rename within scope → add tiered comments → copy assets to make it self-contained. ⛔ the split granularity is not a free choice— the declaration order of a flat script is its evaluation order, and granularity is determined by three hard constraints (mutual references / evaluation order / import bindings are not assignable);first produce a partition plan for review, then split; when encountering a giant module,first measure the benefit curve of "lazily binding a few trailing singletons" before deciding(switching the module system costs the entire toolchain just to get the same granularity; evidence:references/case-studies/skill.md「Workflow / Flow — M(n+1)」)。⭐ the judgment "this cannot be done" is extremely unreliable(evidence:references/case-studies/skill.md「Workflow / Flow — M(n+1)」) — first suspect the tool that measures it, then suspect the object (readable-source.md §3.1–3.1.3)。⛔ non-negotiable precondition: there must first be an all-green gate. A refactor without a judge is blind editing; with the judge from meanAbsDiff 0.00 , every step can be proven dead —this is the best condition a refactor can have, and also the reason it must come last. All existing gates are reused as-is (the target is switched to the src/ build artifacts,tolerances must not be loosened), plus a symbol-mapping gate and a self-containment gate. ⛔ Structural rewrites (merging duplicates, extracting shared functions, changing algorithms) areforbidden by default— they degrade the gates from "proving equivalence" to "not having detected non-equivalence". ⭐ Discipline 4 remains in effect at this stage: you can read it now, and the urge to say "this is obviously a bug" will be stronger than at any other stage, and yet it may still be the behavior itself.

⭐ Containerless scope-hoisted artifacts (Vite/esbuild, sites delivered layer by layer verbatim) take another path: no rewriting, just cut— concatenative decomposition (scripts/census-bundles.mjs produces the chunk graph and coordinates → scripts/slice-esm.mjs cuts it into semantically named parts per declarations, concatenating them in order to equal the original byte-for-byte → scripts/verify-reassembly.mjs one pass settles it; when byte equivalence holds, the verdicts of all runtime gates transfer for free). The execution side is unchanged, and the browser keeps running the original chunk. See readable-source.md §3.0.6。

branch routing table

The Step 1 reconnaissance results determine which scenario guides to load (on demand, do not load all of them):

Reconnaissance finding Load
Next.js App Router / RSC(self.__next_f flight stream) — C1 refactor-style reverse engineering references/rsc-reconstruction.md
WebGL / Canvas scenarios (three.js, in-house engines, GLSL) references/webgl-scenes.md
GSAP / baked animation data / CSS variable animations / in-house input state machines references/animation-recovery.md
Proprietary binary formats (.buf / .sog / VAT / GLB timelines / .riv) references/binary-formats.md
Shopify stores (fingerprints see cdn/shop、Shopify.theme、cdn.shopify.com) references/shopify-platform.md
Sanity CMS (fingerprints see cdn.sanity.io/images/<projectId>/、*.api.sanity.io, whole finished pieces in the payload _key/_type/_ref) — ⛔ grading looks at when the content was baked, not the CMS name, and auto=format assets return different bytes based on Accept negotiation references/sanity-platform.md
A gate is red, or pixel / numeric residuals need to be classified (true differences vs methodological noise) references/gate-failure-modes.md
Test case design for numeric gates / cross-side gates / capture baselines; checklist-style verification of M(n) references/gate-case-design.md
Inline serialized payloads (flight / __NUXT__ / devalue data islands) or Strategy A shell construction references/payload-gates.md
DOM-layer strategy selection (mandatory for all sites; Webflow exports / static single pages / framework SSR branches differ, plus the orthogonal constraint that "the DOM is read by the 3D engine as a coordinate source") references/dom-shell-strategies.md
Large-volume assets (hundreds-of-MB media / licensed fonts) references/asset-management.md
Headless probing behaves anomalously / suspected environment issue references/environment-traps.md

Step Summary

Stage Key actions Blocking gate acceptance Deliverables
Step 0 Fingerprint detection and grading Grading is clear and has been communicated to the user Grading conclusion and basis
Step 1 Disproof + rating + scope confirmation User confirmation Difficulty rating table, scope consensus
M0/M0.5 Mirror + ledger + offline run-through verify-mirror all five green; GAP=0; zero 404s / zero errors / zero external connections mirror/(read-only), manifest,serve.mjs reference server
M1 Unpack the bundle, reverse-engineering notes, pin the stack engine-notes complete; version pinning table complete _pretty/、docs/engine-notes.md、REBUILD_PLAN.md
M2+ Provenance-based porting, paired milestone commits Per-milestone cold-start real-world test + CLEAN gate green Source code with line-numbered comments, three registries rolling-updated
M(n-1) Cross-check acceptance All selected gate types green or all differences registered Verification scripts + cross-check artifacts checked in (docs/compare/)
M(n) Cold-head review + copyright forensics + submission to user Checklist reconciliation with zero gaps; user has made deployment decision (maintain safe default if pending) Audit records, DEPLOY.md
M(n+1) Split modules + deobfuscate + annotate + self-contained All existing gates green andtolerances not relaxed; symbol gate bijective with zero orphans; self-contained gate (copy out, disconnect network, build) passes src/(readable engineering),docs/rename-map.json、src/README.md

Script Directory

Node 22+, paths relative to this skill directory. Every script recognizes --help(print header usage + flag list) and --version(skill version),any unknown flag is always FATAL(lib/cli.mjs). This table lists only one-line purposes;for flags and full specs see the scripts themselves:node scripts/<x>.mjs --help(header comments are the spec, in Chinese; since v0.3.21 the README no longer restates them); for which script to choose, stage, provenance, and maturity see scripts/README.md index and tools/README.md; design evidence see references/case-studies/scripts.md。

⭐⭐ Dependency discipline is divided by stage, not by directory: before sourcing, the entire pipeline has zero dependencies.

Step 0 → M(n): nothing installed throughout;the replica project only obtains devDependencies at M(n+1)(scope-safe renaming requires a real parser).scripts/(zero dependencies) and tools/(devDeps allowed) are merely the directory projection of this stage line—the criterion lives scripts/, the refactorers for the sourcing stage live tools/。

⛔ No gate may import any tool(verification-gates.md §2.1.2)—the checker cannot be the producer.

⭐ What if an earlier stage needs a real parser? Use an external tool, do not import. beautify-bundle.mjs(js-beautify) and module-map.mjs(acorn) are both spawn a singlepinned-version npx, the scripts themselves remain zero-dependency and independently auditable. ⛔ Do not change to a hand-written lexer(evidence:references/case-studies/skill.md「Script Directory」)。bracket matching on a token stream is exact; bracket matching on text is a guess about strings/regexes/comments.

⚠ This line wasdiscovered only after being violated(evidence:references/case-studies/skill.md「Script Directory」)。a rule written only in documentation, with nothing checking it, quietly fails.

Script Purpose Usage stage
scripts/fingerprint.mjs Zero-dependency equivalent of the Step 0 probing protocol: liveness / redirect endpoint / dual-fetch diff / tech fingerprint / initial bundle check + Sanity evidence collection (collects evidence only, no grading) Step 0
scripts/mirror-site.mjs BFS crawler mirror: asset allowlist,redirect:manual, three ledgers (including sha256) accumulated across runs, off-host survey;--scope pages only, not assets M0 first pass
scripts/netcapture.mjs Real-browser CDP capture, reconcile and backfill runtime resources (CDN sites must pass --hosts) M0 second pass
scripts/verify-mirror.mjs The mirror's own gates: mapping injectivity / ledger sha256 / authenticity (magic number + challenge page) / closure / sampled origin fetch, run before the offline gate Before M0 closeout
scripts/gapfill-video.mjs HLS/DASH streaming ladder backfill (master → rendition → segment) M0 (when streaming is present)
scripts/reconcile-gaps.mjs Runtime gap reconciliation: backfill the netcapture GAP lines + the byte-derived full set into the mirror one by one; request-header ladder + browser-style image Accept M0 (sites with many runtime resources)
scripts/wayback-mirror.mjs X-class rescue: pick a coherent moment from CDX by anchor + time window, capture the id_ original bytes into a standard mirror, holes registered in wayback-holes.txt M0 (X-class)
scripts/serve.mjs Zero-dependency static server and reference server: MIME / Range / service-layer rewriting / redirect replay;--fallback-root fallback chain,--stub-ext-hosts stubs,--stub-json PATH::FILE endpoint stubs (respond per the origin JSON contract, print on first hit),--rewrite registered replacement; unknown flags fail loudly Throughout, from M0.5
scripts/probe.mjs CDP headless probe: console / exceptions / network CLEAN verdict fed into CI,--no-external zero external connections,--walk full scroll sweep Every commit from M0.5
scripts/sweep-routes.mjs Render-breadth gate: one browser for all routes, per route 0 errors / 0 failures / 0 external connections + interaction hooks; do not hand-roll launching Chrome per route From M0.5 (multi-route sites)
scripts/verify-offline.mjs The static half of the zero-external-connection gate: enumerate every external absolute URL in the output and adjudicate each one Every commit from M0.5
scripts/verify-payload.mjs SSG payload gate: inline serialized data blocks (Nuxt / flight) evaluated and expanded, then structurally compared From M0.5 (when SSG payload is present)
scripts/verify-nextdata.mjs pages router payload gate:__NEXT_DATA__ and /_next/data/*.json one-sided self-consistency + two-sided deep comparison From M0.5 (pages router sites)
scripts/verify-lenprefix.mjs Length-prefixed payload gate: advance line by line through the flight stream by T<hex> byte count; after rewriting, the landing point must still be the start of a line From M0.5 (when flight payload is present)
scripts/flight-decode.mjs C1 coordinate system: decode each page's flight stream into a module reference table / preloads / element tree / JSX outline M1(C1)
scripts/beautify-bundle.mjs js-beautify@1.15.1 pinned to expand the bundle into _pretty/, token-stream self-check after formatting, name-collision assertions M1
scripts/module-map.mjs Layering table for modularized bundles (spawn pinned acorn): recognize webpack containers and Turbopack flat lists, FATAL if unrecognized, coverage guard M1 (modularized build output)
scripts/census-bundles.mjs Chunk-level coordinate ledger for container-free output (sha256 / line count / ESM edges), the first step of concatenation-style decomposition M1 (scope-hoisted output)
scripts/dump-timelines.mjs Dump GLB animation curves into a JSON numeric ledger M1 (when data-driven animation is present)
scripts/closure.mjs Compute the transitive dependency closure from seed modules, the sole basis for vertical slicing; unknown seed FATAL + did-you-mean M2+ (modularized build output)
scripts/slice-modules.mjs Slice verbatim per module id; bytes outside containers (preamble / epilogue) carried over verbatim,--check re-slicing must be byte-identical M2+ (modularized build output)
scripts/extract-source.mjs Byte slicer: slice by pinned line-number ranges _pretty/ assembles into the generated file, sha256 guard + --check M2+ (verbatim porting phase)
scripts/emit-webpack-chunk.mjs Verbatim re-emission of multi-chunk webpack sites: split into parts along module-map boundaries and reassemble in the source site's container shape,--check byte-for-byte M2+ (multi-chunk webpack sites)
scripts/slice-esm.mjs Splice-style decomposition slicer: splits an ESM chunk into semantically named parts by declaration, concatenating in order to equal the original byte-for-byte M2+ / M(n+1) (scope-hoisted output)
scripts/verify-reassembly.mjs Reassembly gate: per-part sha + in-order concatenation sha + --against triple comparison against the live original M2+ / M(n+1) (scope-hoisted output)
scripts/build-site.mjs Strategy A build layer: generates from the mirror per the shell-config.mjs transformation table site/, per-entry hit lower bound + --check M2+ (Strategy A)
scripts/verify-shell.mjs Shell byte gate: per-document patience diff, every diff hunk must be replay-explainable by the transformation table (no builder import) M2+ (Strategy A)
scripts/verify-tokens.mjs Token-stream equivalence gate: typeset / re-emitted artifact ≟ source-site original token-by-token equal; always run when delivered as _pretty bytes M2+ (every commit when delivering typeset bytes)
scripts/verify-refs-served.mjs Reference reachability gate: every resource reference in the output bytes is queried against the server one by one (no re-implemented parser) Every commit from M2+
scripts/verify-routes.mjs Route / redirect / status-code contract gate M2+
scripts/verify-ssr.mjs SSR / DOM byte-for-byte gate M2+ (built first when SSR output exists)
scripts/verify-tween.mjs Vertical-slice numeric gate: feed the same keyframe spec to both sides, compare tween values and easing curves point by point M2+ (when a tween / timeline engine exists)
scripts/harvest-cases.mjs Adopt cases from the source site's live engine (harvest.config.mjs), produce only the A side M2+ (when the source-site engine is reachable)
scripts/verify-harvest.mjs B side of the collection baseline: each identity matches exactly one on the port side, recover names by behavior M2+ (when a collection baseline exists)
scripts/verify-crossside.mjs Cross-side gate: feed the same input serially to the mirror and the port and compare entry by entry (crossside.config.mjs), identical URL is an immediate FATAL M2+ (when the source site has a directly callable seam)
scripts/pixelcompare.mjs Quantified pixel comparison: self-compare bandwidth --self, state alignment --ready / --after-ready / --chunk, arrival wait --hold*、--freeze-css; non-empty-frame precondition; jpeg for large viewports M(n-1)
scripts/pixel-walk.mjs Checkpoint cruise: run the pixel gate once at each of N scroll positions, scroll twice, report duplicate frames cell by cell, first --self measure bandwidth M(n-1)
scripts/side-by-side.mjs Side-by-side composite of both sides' screenshots (comparison artifact kept as evidence) M(n-1)
scripts/frame-census.mjs Screenshot census: color count and dominant-color ratio, proving the frame has content M(n-1)
scripts/probe-shim.js Deterministic drive shim: takes over rAF / timer / clock / Math.random / IntersectionObserver, manually pumped to any t, injected at the same position on both sides M(n-1)
scripts/verify-flight.mjs C1 semantic gate: build-output flight tree ≟ mirror flight tree, module ids globally bijective, with its own parser M(n-1)(C1)
scripts/cold-audit-modules.mjs M(n) cold-head inventory (modular output): per-module reconciliation + computed-require scan, must report n/N examined M(n) (modular bundle output)
scripts/cold-audit-decls.mjs M(n) cold-head roll-call (flat output): depth-0 declarations judged one by one as cited / override / named / UNKNOWN M(n) (flat artifact)
scripts/verify-module-map.mjs M(n+1) equivalence gate (modularized artifact): one module per file and byte/token-level identical to the bundler M(n+1) (modularized bundle artifact)
scripts/verify-symbols.mjs Symbol mapping gate:port/ each top-level declaration in src/ has exactly one counterpart (read rename-map.json) M(n+1) (flat artifact)
scripts/verify-fresh.mjs Freshness gate:src/ → dist/ → site/ whether in sync; timestamps are not the criterion M(n+1) (every time there is a build step)
scripts/verify-standalone.mjs Self-contained gate:src/ copy to a temp directory → disconnect network → install → build → CLEAN and zero external connections M(n+1)
scripts/verify-zerodep.mjs Dependency boundary gate:scripts/ only node: / relative imports allowed, and no gate imports tools/ each time a script is added
scripts/lib/urlpath.mjs The single url → local path mapping (query-aware), shared by crawler / packet capture / server / gates lib
scripts/lib/extract-refs.mjs The single asset reference extractor (five notations × raw / decoded two passes), shared by crawler and closure gate lib
scripts/lib/negotiate.mjs Content negotiation Accept policy (browser-identical image Accept) + Sanity evidence extraction lib
scripts/lib/ports.mjs Port allocation and instance identity (21000 + slot×1000 + lane×10 + side), occupied means loud failure lib
scripts/lib/chrome.mjs Headless browser lifecycle: process group reaping + orphan self-check + CDP payload hard cap constants lib
scripts/lib/png.mjs Zero-dependency PNG encode/decode lib
scripts/lib/tokens.mjs Token stream reading (acorn pinned spawn) + first-divergence localization lib
scripts/lib/cli.mjs The single argv contract:--help / --version / unknown flag FATAL,EXIT exit code table lib
scripts/lib/hash.mjs The single sha256 spelling (string / Buffer / streaming file) lib
scripts/lib/ledger.mjs The single read/write implementation of the mirror's three ledgers (manifest / inventory / redirects) + LEDGER_FILES lib
scripts/lib/cdp.mjs The single CDP client: per-call timeout, loud failure on disconnect, event subscription lib
tools/name-modules.mjs Module naming: name content-hash ids by tier 0–4 evidence and record the basis; keep the id when there is no evidence M(n+1) (modularized bundle artifact)
tools/accept-names.mjs Naming acceptance step: by default only accept tier-1 (export names declared by the bundler), keep ids for the rest M(n+1)
tools/modules-to-src.mjs Generate per module according to the accepted names src/modules/(scope-safe renamer) M(n+1) (modularized bundle artifact)
tools/sourcify-chunk.mjs M(n+1) driver for multi-chunk sites: run name-modules → accept-names → modules-to-src → verify-module-map per chunk M(n+1) (multi-chunk site)
tools/group-parts.mjs Fold slice-esm parts into directories by domain (group only by classy evidence) M(n+1) (scope-hoisted artifact)
tools/make-standalone.mjs Deliverable generation: copy assets per the ledger, generate package.json / verify-bytes;--mirror a,b fallback chain M(n+1)
tools/flight-to-mdx.mjs Reconstruct MDX / page skeletons from the flight tree M2+ (C1 refactor project)
tools/assemble-static.mjs Flatten the next build artifact into a static tree for serving by serve.mjs (both sides of the pixel gate go through serve) M(n-1) (C1 refactor project)
tools/harvest-optimized-images.mjs Fill in next/image optimizer artifacts (prefer mirrored bytes, fall back to the local optimizer) M(n-1) (C1 refactor project)
tools/verify-fresh-next.mjs The Next form of verify-fresh: src → next build → assemble-static chain reconstructs the comparison bytes (provided generateBuildId is pinned) M(n+1) (C1 reconstruction project)

Replicate the project directory structure

Three staged artifacts,one-way dependency, read as "evidence → port → source":

<site>-rebuild/
├── mirror/               # ① 只读证据:源站 URL 空间的字节级还原。永不修改
│   └── _pretty/          #    beautify 展开产物 + 再生成说明 README
├── port/                 # ② 逐字移植:机器读,extract-source --check 守着字节一致。永不手改
│   └── _gen/             #    切片器产物(行号头指回 mirror/_pretty/)
├── src/                  # ③ 人写的工程:可读、可改、自包含(复制到任何地方都能跑)
│   ├── package.json      #    ⛔ 自己的 package.json——自包含门要把它复制出去单独跑
│   ├── assets/           #    资产在这里(③ 阶段必须复制,见 readable-source.md §2)
│   └── README.md         #    怎么跑 / 坐标系怎么读 / 哪些注释是我们写的
├── docs/
│   ├── engine-notes.md   # 逆向笔记(事实/怪癖/复刻结论三段式)
│   ├── rename-map.json   # ③ 阶段符号映射(port 位置 → 旧名 → 新名 → 依据档位)
│   └── compare/          # 对拍产物留证
├── REBUILD_PLAN.md       # §0 纪律 / 阶段计划 / §6 偏差表 / §Q 怪癖表 / §7 里程碑日志
├── mirror-manifest.json  # 镜像账本(sha256 逐文件)
├── scripts/              # 判据与前置工序:零依赖,从本 skill 拷入
└── tools/                # 重构器:③ 阶段专用,允许 devDependencies(见下)

⛔ src/ if the behavior is found to be wrong, the answer lies in port/ or mirror/, not in src/。 "fixing it in place" turns a porting bug into an untraceable local patch,and the gate will turn green— this is discipline 2 in the form of the three-stage coordinate system.port/ in src/ is not deleted after being built; it is the other end of the equivalence.

⭐ Dependency boundary by stage:Zero dependencies before source-ification— the project only has devDependencies at M(n+1).scripts/(criteria and prerequisite steps) zero dependencies; when necessary, spawn a pinned-version npx;tools/(source-ification reconstructor) devDependencies are allowed. No gate may import any reconstructor. Guarded by scripts/verify-zerodep.mjs .

References

Load on demand (determined by Step 0/1 and the branch routing table), do not read everything at the start:

Notes

  • copyright red lines: This skill is a reproduction for learning purposes. Outputs are private + noindex by default (a safe default, not a legal conclusion); before public deployment, per-asset copyright evidence must be completed, the decision handed back to the user, and the work prominently labeled as an unofficial reproduction with attribution to the original author. The biggest risk is legal, not technical—butlegal judgments are made by the user and are never used to reduce mirror completeness or the coverage of gates。
  • Schedule expectations: With a mature methodology, a single-page creative site takes 1-3 days (dozens of commits); a multi-scene WebGL portfolio site takes weeks. When giving estimates to the user, refer to the difficulty rating in Step 1.
  • When comparison fails, suspect the environment first: Background throttling, HMR ghost modules, probe clocks, and missing headless fonts can all masquerade as code bugs. Before judging it a source code problem, go through the calibration checklist in environment-traps.md.
  • When encountering scenarios not covered by this skill (Category B gaps), explicitly tell the user "there is no established guide for this part; proceed according to general discipline," and record the new experience in the project documentation—it is input for the next version of the skill.