web-clone
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill: web-clone
Skill: web-clone
Two honestly-different jobs. Pick the mode first.
| Mode | Output | Use when | Engine |
|---|---|---|---|
| snapshot | ONE self-contained | archive / faithful copy / "lưu y hệt offline" | builtin inliner · SingleFile CLI · monolith |
| reconstruct | clean Next.js + Tailwind codebase (editable) | "rebuild as code I can edit" / "clone giao diện thành code" | the ai-website-cloner-template pipeline |
Mode + engine live in ( — the live-capture engine
and reconstruct fidelity are the quarantined unknowns).
harness/web-clone.config.yamlverified:false两个本质不同且明确区分的任务。先选择模式。
| 模式 | 输出 | 使用场景 | 引擎 |
|---|---|---|---|
| snapshot | 一个自包含的 | 归档 / 忠实副本 / “原样离线保存” | 内置 inliner · SingleFile CLI · monolith |
| reconstruct | 干净、可编辑的 Next.js + Tailwind 代码库 | “重建为我可编辑的代码” / “把界面克隆成代码” | ai-website-cloner-template 流程 |
模式和 engine 均在 中配置(——实时捕获 engine 和 reconstruct 保真度均属于隔离待验证的不确定项)。
harness/web-clone.config.yamlverified:falseWHAT
WHAT
Purpose và context
用途与上下文
- Purpose: clone một website theo một trong hai mode trung thực khác nhau — SNAPSHOT (bản offline tự chứa, đúng byte) hoặc RECONSTRUCT (dựng lại thành codebase Next.js/Tailwind sửa được).
- Trigger (when to use): user muốn "clone this site", copy design/UI + interactions của một trang, mirror a layout, save offline, hoặc rebuild site thành code sửa được.
- Non-goals: không cam kết pixel+behavior hoàn hảo; không clone để republish site người khác; không phải page → markdown text (đó là ).
/web-crawl
- 用途: 根据两种本质不同且明确区分的模式之一克隆网站——SNAPSHOT(自包含、字节完全一致的离线副本)或 RECONSTRUCT(重建为可编辑的 Next.js/Tailwind 代码库)。
- 触发条件(何时使用): 用户希望“clone this site”、复制页面的设计/UI + 交互、镜像布局、保存为离线文件,或将网站重建为可编辑代码。
- 非目标: 不承诺像素和行为完全一致;不克隆网站用于再次发布他人的站点;不用于将页面转换为 Markdown 文本(那属于 )。
/web-crawl
Mental model
心智模型
URL hoặc page.html → chọn mode → snapshot: engine (builtin inliner · SingleFile CLI · monolith) → clone.htmlreconstruct: recon → foundation → component spec → parallel builders → assembly → visual-QA diff → Next.js codebaseharness/web-clone.config.yamlverified:falseURL 或 page.html → 选择 mode → snapshot:engine(builtin inliner · SingleFile CLI · monolith)→ clone.htmlreconstruct:recon → foundation → component spec → parallel builders → assembly → visual-QA diff → Next.js codebaseharness/web-clone.config.yamlverified:falseInput và output contract
输入与输出约定
| Field | Required? | Ý nghĩa | |
|---|---|---|---|
| In | mode | có | snapshot hoặc reconstruct — chọn trước |
| In | page.html local hoặc URL live | có | local → builtin inliner offline; live → cần engine |
| In | engine trong config | khi snapshot live | |
| Out | | mode snapshot | một file tự chứa HTML+CSS+JS+ảnh |
| Out | codebase Next.js + Tailwind | mode reconstruct | component spec |
| 字段 | 是否必填 | 含义 | |
|---|---|---|---|
| 输入 | mode | 是 | snapshot 或 reconstruct——需事先选择 |
| 输入 | 本地 page.html 或实时 URL | 是 | 本地 → 使用内置 inliner 离线处理;实时 → 需要 engine |
| 输入 | config 中的 engine | snapshot live 时必填 | |
| 输出 | | mode 为 snapshot | 一个自包含 HTML+CSS+JS+图片的文件 |
| 输出 | Next.js + Tailwind 代码库 | mode 为 reconstruct | 可构建的组件规格 |
Rules và capabilities
规则与能力
- RULE-01 (MUST): State the mode + be honest: snapshot builtin = LOCAL resources only; faithful live capture needs an engine; reconstruct fidelity depends on extraction quality — never claim pixel+behavior perfection.
- RULE-02 (MUST): Respect copyright / Terms — clone for reference/offline/learning, not to republish someone's site.
- RULE-03 (MUST): Self-test (snapshot core): .
python3 harness/scripts/web-clone.py --self-test - Capabilities: đọc trang (file local hoặc tải live qua engine đã cấu hình); điều khiển trình duyệt để recon; dispatch builder song song; ghi file clone/codebase cục bộ.
- RULE-01(MUST):说明 mode 并保持诚实:snapshot 内置模式 = 仅支持 LOCAL 资源;忠实的实时捕获需要 engine;reconstruct 的保真度取决于提取质量——绝不能声称像素和行为完全一致。
- RULE-02(MUST):遵守 copyright / Terms——克隆仅可用于参考、离线保存或学习,不得用于再次发布他人的网站。
- RULE-03(MUST):执行 snapshot 核心自测:。
python3 harness/scripts/web-clone.py --self-test - 能力:读取页面(本地文件或通过已配置的 engine 下载实时页面);控制浏览器进行 recon;并行 dispatch builder;将 clone/codebase 写入本地。
Failure boundaries
失败边界
- Live URL mà engine chưa cấu hình → builtin chỉ inline tài nguyên LOCAL → partial, nói rõ.
- JS interactions ở mọi engine snapshot = best-effort → không claim đầy đủ hành vi.
- Reconstruct: builder hoặc
npx tsc --noEmitđỏ → failed cho merge đó, sửa rồi chạy lại.npm run build - Mục đích republish vi phạm copyright/Terms → cancelled.
- 实时 URL 尚未配置 engine → 内置模式只能 inline 本地资源 → partial,需如实说明。
- 所有 snapshot engine 中的 JS 交互均为 best-effort → 不得声称行为完整。
- Reconstruct:builder 执行 或
npx tsc --noEmit失败 → 该次合并判定为 failed,修复后重新运行。npm run build - 目的在于再次发布且违反 copyright/Terms → cancelled。
HOW
HOW
Main workflow
主流程
| Step | Type | Inputs | Action | Outputs/exit | Failure/next |
|---|---|---|---|---|---|
| W01 | judgment | yêu cầu user | Chọn mode (bảng mode ở trên) + nói rõ giới hạn trung thực | mode | lưu offline → B01; code sửa được → B02 |
| W02 | deterministic | — | Self-test lõi snapshot | rc 0 | đỏ → dừng, báo |
| W03 | effect | mode | Chạy nhánh mode A (snapshot) hoặc B (reconstruct) | | xem nhánh |
| W04 | judgment | output | Báo kết quả + phần best-effort (JS interactions, fidelity) | báo cáo trung thực | — |
Chi tiết từng bước (nguồn chân lý cho W03, theo mode):
| Step | Type | Inputs | Action | Outputs/exit | Failure/next |
|---|---|---|---|---|---|
| W01 | 判断 | 用户需求 | 选择 mode(使用上方的模式表)并如实说明限制 | mode | 保存离线 → B01;生成可编辑代码 → B02 |
| W02 | 确定性 | — | 对 snapshot 核心执行自测: | rc 0 | 失败 → 停止并报告 |
| W03 | 副作用 | mode | 运行模式 A(snapshot)或模式 B(reconstruct) | | 参见对应分支 |
| W04 | 判断 | output | 报告结果以及 best-effort 部分(JS 交互、保真度) | 如实报告 | — |
每个步骤的详细信息如下(W03 的执行依据,按模式划分):
Mode A — snapshot (faithful 1-file copy)
模式 A——snapshot(忠实的单文件副本)
- Local page already downloaded: offline, no key —
(inlines local
python3 harness/scripts/web-clone.py inline <page.html> --out clone.htmlCSS,<link>JS, images as data-URI → one file).<script src> - Live URL, faithful: set (
engine: singlefile-cli, keeps scripts) ornpm i -g single-file-cli(Rust), thenmonolith.web-clone.py url "<URL>" --out clone.html - JS interactions = best-effort across all snapshot engines (the quarantined unknown).
- 本地页面已下载: 离线,无需 key——
(将本地
python3 harness/scripts/web-clone.py inline <page.html> --out clone.htmlCSS、<link>JS 和图片以 data-URI 形式内联 → 单个文件)。<script src> - 实时 URL,忠实捕获: 设置 (
engine: singlefile-cli,保留 scripts) 或npm i -g single-file-cli(Rust),然后运行monolith。web-clone.py url "<URL>" --out clone.html - JS 交互 = best-effort,适用于所有 snapshot engine(隔离待验证的不确定项)。
Mode B — reconstruct (→ editable Next.js, the ai-website-cloner-template method)
模式 B——reconstruct(转换为可编辑的 Next.js,采用 ai-website-cloner-template 方法)
This is NOT a byte-copy — it reverse-engineers the page into a fresh, clean codebase. Method
(distilled from JCodesMore's , ~6k★; see Related):
ai-website-cloner-template- Reconnaissance — browser-MCP/Computer-Use: full-page screenshots @desktop 1440 + mobile 390; extract global design tokens (fonts, colors, favicons); sweep scroll/click/hover to find every interactive behavior; map page topology.
- Foundation — fonts,
layout.tsxcolor tokens + animations, TS interfaces, inline SVGs → React icon components, Node asset-download script →globals.css.public/ - Component spec & dispatch — per section: read EXACT values (never estimate) → write
getComputedStyle()(the builder contract: DOM, computed styles, state transitions, verbatim content, asset paths, breakpoints) → dispatch parallel builder subagents (one per sub-component for complex sections; ≤~150 lines spec each).docs/research/components/<name>.spec.md - Assembly — import components into ; wire scroll-snap / Lenis / IntersectionObserver.
app/page.tsx - Visual-QA diff — compare clone vs original @desktop+mobile, test every interactive state, fix
discrepancies by re-extracting. Builders verify ; main
npx tsc --noEmitper merge.npm run build
Stack: Next.js + TypeScript + Tailwind v4 + shadcn/ui. Dispatch builders via overstack
or the Agent tool.
/orchestration这不是字节级复制——它会将页面逆向工程为全新、干净的代码库。方法如下:
(提炼自 JCodesMore 的 ,约 6k★;参见“相关”部分)
ai-website-cloner-template- Reconnaissance——browser-MCP/Computer-Use:分别以 desktop 1440 和 mobile 390 生成整页截图;提取全局 design tokens(字体、颜色、favicon);遍历 scroll/click/hover 以找出所有交互行为;映射页面拓扑结构。
- Foundation——在 中设置字体,在
layout.tsx中定义颜色 tokens 与动画,编写 TS interfaces,将 inline SVG 转换为 React 图标组件,并创建用于把资源下载到globals.css的 Node 资源下载脚本。public/ - Component spec 与 dispatch——针对每个 section:读取准确的 值(绝不估算)→ 编写
getComputedStyle()(builder 约定:DOM、computed styles、state transitions、逐字内容、资源路径、breakpoints)→ dispatch parallel builder subagents(复杂 section 可为每个子组件分派一个;每份规格约不超过 150 行)。docs/research/components/<name>.spec.md - Assembly——将组件导入 ;连接 scroll-snap / Lenis / IntersectionObserver。
app/page.tsx - Visual-QA diff——在 desktop+mobile 下比较 clone 与 original,测试每一种交互状态,并通过重新提取信息修复差异。Builders 验证 ;每次 merge 后,主流程运行
npx tsc --noEmit。npm run build
技术栈:Next.js + TypeScript + Tailwind v4 + shadcn/ui。通过 overstack 的 或 Agent 工具 dispatch builders。
/orchestrationBranches
分支
| ID | Kind | Guard | Hành vi | Skip / failure | Rejoin |
|---|---|---|---|---|---|
| B01 | user_optional | mode = snapshot | Mode A: page local → | engine chưa có → chỉ tài nguyên local, báo partial | W04 |
| B02 | user_optional | mode = reconstruct | Mode B 5 pha, builder song song qua | build đỏ → re-extract, sửa | W04 |
| B03 | capability_optional | live capture trung thực cần engine ngoài | set | không cài → builtin | B01 |
| ID | Kind | Guard | 行为 | 跳过或失败处理 | 汇合点 |
|---|---|---|---|---|---|
| B01 | user_optional | mode = snapshot | 模式 A:本地 page → | engine 不可用 → 仅使用本地资源并报告 partial | W04 |
| B02 | user_optional | mode = reconstruct | 模式 B 的 5 个阶段,通过 | build 失败 → 重新提取并修复 | W04 |
| B03 | capability_optional | 忠实的实时捕获需要外部 engine | 在 | 未安装 → 使用内置模式 | B01 |
Validation và stopping
验证与停止条件
Tất định: ; builders , main mỗi lần merge. Cần review: visual-QA diff clone vs gốc @desktop+mobile và mọi trạng thái tương tác. Dừng khi output có và giới hạn đã nói rõ; không lặp re-extract vô hạn — báo phần còn lệch.
python3 harness/scripts/web-clone.py --self-testnpx tsc --noEmitnpm run build确定性验证:运行 ;builders 运行 ;每次 merge 后主项目运行 。需要人工 review:在 desktop+mobile 下执行 clone 与原页面的 visual-QA diff,并检查所有交互状态。当 output 已生成且限制已明确说明时停止;不要无限重复 re-extract——应报告仍然存在的偏差。
python3 harness/scripts/web-clone.py --self-testnpx tsc --noEmitnpm run buildExamples
示例
- Positive: "lưu y hệt offline trang này" với đã tải →
page.html→ một file mở offline được, CSS/JS/ảnh inline data-URI.python3 harness/scripts/web-clone.py inline page.html --out clone.html - Boundary/failure: đưa URL live nhưng config chưa đặt engine → chỉ inline được tài nguyên local, báo partial và gợi ý ; tương tác JS ghi rõ best-effort, không claim hoàn hảo.
npm i -g single-file-cli
- 正向示例: 对已下载的 提出“原样离线保存此页面” →
page.html→ 生成一个可离线打开的单文件,其中 CSS、JS 和图片均通过 data-URI 内联。python3 harness/scripts/web-clone.py inline page.html --out clone.html - 边界或失败示例: 提供实时 URL,但 config 中尚未设置 engine → 只能 inline 本地资源,应报告 partial,并建议运行 ;同时明确说明 JS 交互为 best-effort,不能声称完全一致。
npm i -g single-file-cli
Related
相关
- +
harness/scripts/web-clone.py(engine/mode adapter).harness/web-clone.config.yaml - Reconstruct method: (the 5-phase pipeline above).
github.com/JCodesMore/ai-website-cloner-template - Snapshot engines: SingleFile (), monolith.
github.com/gildas-lormeau/SingleFile - (page → markdown text),
/web-crawl+/computer-use(recon + parallel builders)./orchestration
- +
harness/scripts/web-clone.py(engine/mode adapter)。harness/web-clone.config.yaml - Reconstruct 方法:(上述五阶段流程)。
github.com/JCodesMore/ai-website-cloner-template - Snapshot engines:SingleFile()、monolith。
github.com/gildas-lormeau/SingleFile - (页面 → Markdown 文本)、
/web-crawl+/computer-use(recon + 并行 builders)。/orchestration