# openclaw-website-clone-kit

Adopt this skill: https://proskills.md/skills/other/mashengsbc-beep-openclaw-website-clone-kit

Page: https://proskills.md/skills/other/mashengsbc-beep-openclaw-website-clone-kit
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: SKILL.md
size: 5397
sha: b2e0924670a4a15e7884f3267f2155517dd0b1f6
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/SKILL.md

````text
---
name: openclaw-website-clone-kit
description: Analyze, plan, and scaffold website cloning or website rebuild tasks inside the OpenClaw workspace. Use when the user wants to clone, imitate, rebuild, reverse-engineer, or recreate a public website or landing page; when you need to inspect a URL, capture structure/content/screenshots, generate a rebuild plan, or scaffold a clean local project for later implementation. Especially use when adapting ideas from ai-website-cloner-template into a skill that works inside this OpenClaw environment.
---

# OpenClaw Website Clone Kit

Use this skill to turn a target website into a structured rebuild task that this OpenClaw workspace can actually execute.

Do not pretend you have capabilities you have not verified. In this workspace, prefer a staged workflow:
1. inspect the target site
2. capture evidence and artifacts
3. write a rebuild spec
4. scaffold a local implementation target
5. only then start component-by-component rebuilding

## Core rule

This skill is for **analysis + planning + scaffold + optional implementation start**.
It is not permission to claim a pixel-perfect clone before evidence exists.

If the task requires browser inspection, use the local Docker browser workflow first.
Read `references/browser-flow.md` before running browser steps.

If the task requires deciding whether a site is suitable for cloning, read `references/evaluation.md`.

If the task requires generating a reusable rebuild brief, read `references/spec-template.md`.

## Quick start

For a first-pass complete run, run:

```bash
node /home/node/OpenClawBox/skills/openclaw-website-clone-kit/scripts/run-complete.js \
  --url "https://example.com" \
  --slug example
```

This calls the analyzer and then leaves you with a run folder containing both the analysis package and the first-pass implementation scaffold.

This creates a recoverable run folder under:

`/home/node/OpenClawBox/deliveries/website-clone-runs/<slug>/`

with:
- `inspection/<slug>.png` when browser capture works
- `inspection/<slug>.json`
- `spec/website-rebuild-spec.md`
- `implementation/` first-pass scaffold
- `README.md`

If browser launch fails, the script automatically falls back to HTTP-only analysis so the run still completes.
It also attempts to generate a first-pass implementation scaffold automatically.

Read `references/browser-flow.md` before modifying the browser part of the workflow.
If browser launch fails, follow the Playwright reinstall note there before claiming the skill is broken.

## Default workflow

### 1. Validate scope
Determine:
- target URL
- whether the user wants analysis only, a clone plan, or an actual local rebuild
- whether fidelity should be rough, close, or pixel-focused
- whether legal/brand constraints matter

If scope is unclear, ask the smallest useful clarification.

### 2. Inspect the target
Use the docker browser operator or another verified local path to gather:
- page title and final URL
- screenshot(s)
- visible text outline
- obvious sections from top to bottom
- visible assets and interaction hints

Save artifacts under `/home/node/OpenClawBox/deliveries/browser-runs/` or a task folder under `deliveries/website-clone-runs/`.

### 3. Produce a rebuild spec
Create a concise but actionable spec in Markdown including:
- site summary
- section inventory
- style observations
- assets to recreate or download
- responsive notes
- implementation risks
- proposed component list
- recommended stack and folder layout

Use `references/spec-template.md`.

### 4. Decide implementation path
Choose one:
- **analysis-only**: stop after the spec and recommendations
- **scaffold**: create a local starter project/folder structure
- **rebuild-first-pass**: implement the page shell and major sections with placeholder or extracted content

### 5. Verify honestly
If code was created, verify with the relevant local checks. Report:
- what is done
- what is approximate
- what still needs browser-level extraction

## Workspace fit

- Prefer creating deliverables inside `/home/node/OpenClawBox/deliveries/` when the user may want direct access.
- Prefer creating implementation work under `/home/node/OpenClawBox/deliveries/website-clone-runs/<slug>/` unless the user specifies a repo path.
- Keep generated notes and specs with the run so the task is recoverable.

## Guardrails

- Do not clone deceptive login pages, payment pages, or branded phishing targets.
- Do not imply legal clearance you do not have.
- Do not overclaim pixel-perfect fidelity without browser evidence and side-by-side checking.
- For complex apps, position the result as a front-end reconstruction unless backend parity is explicitly built.

## References

- `references/browser-flow.md` — how to inspect a site in this Docker/OpenClaw environment
- `references/evaluation.md` — how to judge clone difficulty and fit
- `references/spec-template.md` — reusable rebuild brief structure
- `references/scaffold-patterns.md` — how to lay out local clone runs and starter code

## Scripts

- `scripts/init-run.sh` — create a run folder skeleton
- `scripts/analyze-website.js` — inspect one URL and generate an initial analysis package
- `scripts/scaffold-implementation.js` — generate a first-pass implementation scaffold from an existing run
- `scripts/run-complete.js` — one-command entry point for analysis + scaffold generation
````

## File: README.md
size: 5442
sha: 42363cc1ef68a041874b0a699a8c10ac156870c9
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/README.md

````text
# OpenClaw Website Clone Kit

A practical website analysis and rebuild skill for OpenClaw.

Point it at a public URL, and it will inspect the page, generate a rebuild brief, and scaffold a first-pass local implementation you can keep iterating on — even when browser capture is unavailable.

## Why it exists

Most “clone this website” workflows break in one of two ways:

- they promise pixel-perfect automation, then fail hard when browser tooling or environment dependencies are incomplete
- they stop at vague analysis without leaving behind usable project files

This skill takes a more practical route:

- inspect first
- generate a rebuild spec
- scaffold a usable local implementation
- degrade gracefully instead of failing outright
- fit the real OpenClaw workspace and delivery model

The goal is not to fake a perfect clone. The goal is to leave every run with useful artifacts that can be inspected, resumed, and improved.

## What it does

A complete run can:

1. inspect a target URL
2. attempt browser-based capture
3. fall back to HTTP-based extraction when the browser stack is unavailable
4. generate a rebuild spec in Markdown
5. scaffold a first-pass local implementation
6. write structured content data for follow-up iteration

## Quick start

Run a full pass:

```bash
node /home/node/OpenClawBox/skills/openclaw-website-clone-kit/scripts/run-complete.js \
  --url "https://example.com" \
  --slug example
```

This creates a run directory under:

```text
/home/node/OpenClawBox/deliveries/website-clone-runs/<slug>/
```

## Output structure

Each run produces a recoverable task folder:

```text
deliveries/website-clone-runs/<slug>/
├── README.md
├── inspection/
│   └── <slug>.json
├── spec/
│   └── website-rebuild-spec.md
└── implementation/
    ├── README.md
    ├── package.json
    ├── next.config.ts
    ├── tsconfig.json
    └── src/
        ├── app/
        │   ├── globals.css
        │   └── page.tsx
        ├── components/
        └── data/
            └── page-content.ts
```

When browser capture is healthy, runs can also include screenshots and richer inspection artifacts.

## Example run

A more realistic public demo run was generated against `https://vercel.com/ai`.

That run now has two useful states:

- `vercel-ai-demo` — fallback-safe run
- `vercel-ai-demo-browser` — browser-backed run with screenshot capture

The browser-backed run produced:

- inspection metadata
- screenshot capture
- rebuild spec
- first-pass implementation scaffold
- structured content data for follow-up iteration

See `docs/EXAMPLE-RUNS.md` for details.

## Included scripts

- `scripts/run-complete.js` — one-command entry point for analysis + scaffold generation
- `scripts/analyze-website.js` — inspect one URL and generate the analysis package
- `scripts/scaffold-implementation.js` — generate a first-pass implementation scaffold from an existing run
- `scripts/init-run.sh` — initialize a run folder skeleton

## Design principles

### 1. Spec-first, not hype-first
The skill writes down what it found and what should be rebuilt before pretending the page is “done.”

### 2. Graceful degradation
If browser automation fails, the workflow falls back to HTTP extraction instead of stopping completely.

### 3. Workspace-native output
Everything is written into the OpenClaw workspace in a recoverable structure.

### 4. Honest scaffolding
The generated implementation is intentionally shallow but usable. It is a starting point for real reconstruction, not a fake claim of finished fidelity.

## Best fit

This skill is strongest for:

- landing pages
- marketing sites
- brochure sites
- simple public homepages
- early-stage reverse-engineering and rebuild planning

It is weaker for:

- authenticated apps
- dashboards
- animation-heavy experiences
- pages that depend on deep client-side behavior
- pixel-perfect cloning without working browser inspection

## Browser setup

Browser inspection is now working in this environment after completing the Playwright host dependency setup.

See `docs/BROWSER-SETUP.md` for the dependency notes and recovery path if the browser stack breaks again.

## Current limitations

- Browser capture depends on a healthy Playwright + system library setup
- If the browser stack breaks again, the workflow still falls back to HTTP-based analysis
- Generated implementation is a first-pass scaffold, not a final clone
- Complex visual systems still require deeper extraction and manual refinement

## Status

Current state:

- usable for structured analysis and scaffold generation
- browser-backed inspection is working again in this environment
- resilient even if browser automation becomes unavailable again

## Roadmap

Planned upgrades:

- restore full browser inspection in this environment
- improve section extraction quality
- generate richer component scaffolds
- extract more assets and structure from the target site
- push the scaffold closer to a real first-pass rebuild

## Philosophy

This skill follows one rule:

**never leave a website-clone task empty-handed**

Even when browser automation is unavailable, a run should still leave behind:

- a structured run folder
- inspection metadata
- a rebuild spec
- a starter implementation

That makes the workflow resumable, debuggable, and useful in real OpenClaw sessions.
````

## File: scripts/analyze-website.js
size: 9524
sha: 04a0b551d7870ca0ea554cd27c256514243f42a8
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/scripts/analyze-website.js

```text
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const http = require('http');
const https = require('https');
const { execFileSync } = require('child_process');

function arg(name, fallback = undefined) {
  const i = process.argv.indexOf(name);
  return i >= 0 && i + 1 < process.argv.length ? process.argv[i + 1] : fallback;
}

function slugify(input) {
  return String(input || '')
    .toLowerCase()
    .replace(/^https?:\/\//, '')
    .replace(/[^a-z0-9]+/g, '-')
    .replace(/^-+|-+$/g, '')
    .slice(0, 80) || `site-${Date.now()}`;
}

function extractSections(text) {
  const lines = String(text || '')
    .split(/\r?\n/)
    .map(s => s.trim())
    .filter(Boolean)
    .filter(s => s.length >= 3)
    .filter(s => s.length <= 120);

  const seen = new Set();
  const uniq = [];
  for (const line of lines) {
    const key = line.toLowerCase();
    if (seen.has(key)) continue;
    seen.add(key);
    uniq.push(line);
    if (uniq.length >= 18) break;
  }
  return uniq;
}

function inferCandidate(finalUrl, text) {
  const lower = `${finalUrl}\n${text}`.toLowerCase();
  if (/dashboard|workspace|settings|billing|analytics|sign in|log in/.test(lower)) {
    return 'good candidate for partial reconstruction';
  }
  if (/pricing|features|testimonials|hero|contact|about|blog/.test(lower)) {
    return 'good candidate for local rebuild';
  }
  return 'learn-from-only, not ideal for direct cloning';
}

function inferStyleNotes(text) {
  const notes = [];
  const lower = String(text || '').toLowerCase();
  if (/ai|automation|agent/.test(lower)) notes.push('Likely modern SaaS/AI marketing style.');
  if (/pricing|enterprise|demo/.test(lower)) notes.push('Likely conversion-oriented landing page structure.');
  if (/blog|article|read more/.test(lower)) notes.push('May include editorial/content-driven sections.');
  if (!notes.length) notes.push('Requires screenshot review for stronger visual/style judgment.');
  return notes;
}

function fetchUrl(targetUrl, redirectCount = 0, insecure = false) {
  return new Promise((resolve, reject) => {
    if (redirectCount > 5) {
      reject(new Error('Too many redirects'));
      return;
    }
    const isHttps = targetUrl.startsWith('https:');
    const mod = isHttps ? https : http;
    const req = mod.get(targetUrl, {
      headers: {
        'User-Agent': 'Mozilla/5.0 (OpenClaw Website Clone Kit)'
      },
      rejectUnauthorized: insecure ? false : true
    }, res => {
      const statusCode = res.statusCode || 0;
      if (statusCode >= 300 && statusCode < 400 && res.headers.location) {
        const redirected = new URL(res.headers.location, targetUrl).toString();
        res.resume();
        fetchUrl(redirected, redirectCount + 1, insecure).then(resolve).catch(reject);
        return;
      }
      let data = '';
      res.on('data', chunk => { data += chunk; });
      res.on('end', () => resolve({ finalUrl: targetUrl, html: data, statusCode, insecure }));
    });
    req.on('error', reject);
  });
}

function curlFetch(targetUrl, insecure = false) {
  const args = ['-L', '--max-redirs', '5', '-A', 'Mozilla/5.0 (OpenClaw Website Clone Kit)', '-sS'];
  if (insecure) args.push('-k');
  args.push(targetUrl);
  const html = execFileSync('curl', args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });
  return { finalUrl: targetUrl, html, statusCode: 200, insecure, via: 'curl' };
}

async function robustFetch(targetUrl) {
  try {
    return await fetchUrl(targetUrl, 0, false);
  } catch (e1) {
    try {
      return await fetchUrl(targetUrl, 0, true);
    } catch (e2) {
      try {
        return curlFetch(targetUrl, false);
      } catch (e3) {
        return curlFetch(targetUrl, true);
      }
    }
  }
}

function htmlToText(html) {
  return String(html || '')
    .replace(/<script[\s\S]*?<\/script>/gi, ' ')
    .replace(/<style[\s\S]*?<\/style>/gi, ' ')
    .replace(/<noscript[\s\S]*?<\/noscript>/gi, ' ')
    .replace(/<[^>]+>/g, '\n')
    .replace(/&nbsp;/g, ' ')
    .replace(/&amp;/g, '&')
    .replace(/&lt;/g, '<')
    .replace(/&gt;/g, '>')
    .replace(/\n{2,}/g, '\n')
    .trim();
}

function extractTitle(html) {
  const m = String(html || '').match(/<title[^>]*>([\s\S]*?)<\/title>/i);
  return m ? m[1].replace(/\s+/g, ' ').trim() : '';
}

function createSpec({ url, meta, mode }) {
  const sections = extractSections(meta.textPreview || '');
  const verdict = inferCandidate(meta.finalUrl || url, meta.textPreview || '');
  const styleNotes = inferStyleNotes(meta.textPreview || '');
  const inspectedAt = new Date().toISOString();
  const screenshotLine = meta.screenshot || '(not available in fallback mode)';

  const spec = `# Website Rebuild Spec\n\n## Target\n- URL: ${url}\n- Final URL: ${meta.finalUrl || url}\n- Date inspected: ${inspectedAt}\n- Goal: Initial website clone analysis and rebuild planning\n- Fidelity target: Close visual reconstruction unless upgraded after deeper inspection\n- Capture mode: ${mode}\n\n## Summary\n- Page title: ${meta.title || '(unknown)'}\n- Initial verdict: ${verdict}\n- Screenshot: ${screenshotLine}\n- What the page appears to be: ${sections.slice(0, 3).join(' / ') || 'Needs deeper manual inspection'}\n\n## Section Inventory\n${sections.length ? sections.map((s, i) => `- Section ${i + 1}: ${s}`).join('\n') : '- No reliable section inventory extracted from text preview alone.'}\n\n## Style Notes\n${styleNotes.map(n => `- ${n}`).join('\n')}\n- Needs screenshot review for typography, palette, spacing, and motion specifics.\n\n## Assets\n- Screenshot captured locally: ${screenshotLine}\n- Further asset extraction not yet performed in this first pass.\n\n## Proposed Implementation\n- Suggested stack: Next.js or static HTML/CSS depending on requested depth\n- Suggested folder structure:\n  - inspection/\n  - spec/\n  - implementation/\n- First-pass components should follow visible homepage sections from the inventory above.\n\n## Risks / Gaps\n- This first-pass spec is based on one browser capture or fallback HTTP text extraction.\n- Interactions, responsive behavior, exact assets, and exact design tokens are not yet fully extracted.\n- Legal/brand reuse must still be judged separately if copying non-owned sites.\n\n## Recommended Next Step\n- Do deeper browser inspection if pixel-focused cloning is required.\n- Otherwise scaffold a local implementation and recreate the top-level layout first.\n`;

  return { spec, verdict };
}

async function main() {
  const url = arg('--url');
  if (!url) {
    console.error('usage: analyze-website.js --url <url> [--slug <slug>]');
    process.exit(1);
  }

  const slug = arg('--slug', slugify(url));
  const base = `/home/node/OpenClawBox/deliveries/website-clone-runs/${slug}`;
  const inspectionDir = path.join(base, 'inspection');
  const specDir = path.join(base, 'spec');
  const implementationDir = path.join(base, 'implementation');
  fs.mkdirSync(inspectionDir, { recursive: true });
  fs.mkdirSync(specDir, { recursive: true });
  fs.mkdirSync(implementationDir, { recursive: true });

  const browserScript = '/home/node/OpenClawBox/skills/docker-browser-operator/scripts/browse.js';
  const metaPath = path.join(inspectionDir, `${slug}.json`);

  let meta;
  let mode = 'browser';
  let browserError = null;

  try {
    execFileSync('node', [browserScript, '--url', url, '--slug', slug, '--out-dir', inspectionDir], { stdio: 'pipe' });
    meta = JSON.parse(fs.readFileSync(metaPath, 'utf8'));
  } catch (err) {
    mode = 'http-fallback';
    browserError = err && err.message ? err.message : String(err);
    const fetched = await robustFetch(url);
    meta = {
      url,
      finalUrl: fetched.finalUrl || url,
      title: extractTitle(fetched.html || ''),
      screenshot: null,
      textPreview: htmlToText(fetched.html || '').slice(0, 4000),
      fallback: true,
      statusCode: fetched.statusCode || 0,
      insecure: !!fetched.insecure,
      via: fetched.via || 'node-http',
      browserError
    };
    fs.writeFileSync(metaPath, JSON.stringify(meta, null, 2));
  }

  const { spec, verdict } = createSpec({ url, meta, mode });
  const specPath = path.join(specDir, 'website-rebuild-spec.md');
  const readmePath = path.join(base, 'README.md');
  fs.writeFileSync(specPath, spec);
  fs.writeFileSync(readmePath, `# Website Clone Run: ${slug}\n\n- URL: ${url}\n- Final URL: ${meta.finalUrl || url}\n- Title: ${meta.title || '(unknown)'}\n- Mode: ${mode}\n- Inspection JSON: ${metaPath}\n- Screenshot: ${meta.screenshot || '(not available in fallback mode)'}\n- Spec: ${specPath}\n`);

  let scaffolded = false;
  let scaffoldError = null;
  try {
    const scaffoldScript = '/home/node/OpenClawBox/skills/openclaw-website-clone-kit/scripts/scaffold-implementation.js';
    execFileSync('node', [scaffoldScript, '--run-dir', base], { stdio: 'pipe' });
    scaffolded = true;
  } catch (err) {
    scaffoldError = err && err.message ? err.message : String(err);
  }

  console.log(JSON.stringify({
    ok: true,
    slug,
    base,
    inspectionDir,
    screenshot: meta.screenshot || null,
    metaPath,
    specPath,
    readmePath,
    title: meta.title || null,
    finalUrl: meta.finalUrl || url,
    verdict,
    mode,
    browserError,
    fallbackTransport: meta.via || null,
    insecure: !!meta.insecure,
    scaffolded,
    scaffoldError
  }, null, 2));
}

main().catch(error => {
  console.error(JSON.stringify({ ok: false, error: error && error.stack ? error.stack : String(error) }, null, 2));
  process.exit(1);
});
```

## File: scripts/init-run.sh
size: 275
sha: b94a6a10388eecff85d3ed4f8ff4ca735dbf9893
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/scripts/init-run.sh

```text
#!/usr/bin/env bash
set -euo pipefail

slug="${1:-}"
if [[ -z "$slug" ]]; then
  echo "usage: init-run.sh <slug>" >&2
  exit 1
fi

base="/home/node/OpenClawBox/deliveries/website-clone-runs/$slug"
mkdir -p "$base/inspection" "$base/spec" "$base/implementation"

echo "$base"
```

## File: scripts/run-complete.js
size: 601
sha: 2ae1741df33a5ea29238d942f355133c4b367e22
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/scripts/run-complete.js

```text
#!/usr/bin/env node
const { execFileSync } = require('child_process');

function arg(name, fallback = undefined) {
  const i = process.argv.indexOf(name);
  return i >= 0 && i + 1 < process.argv.length ? process.argv[i + 1] : fallback;
}

const url = arg('--url');
if (!url) {
  console.error('usage: run-complete.js --url <url> [--slug <slug>]');
  process.exit(1);
}
const slug = arg('--slug');

const args = ['/home/node/OpenClawBox/skills/openclaw-website-clone-kit/scripts/analyze-website.js', '--url', url];
if (slug) args.push('--slug', slug);
execFileSync('node', args, { stdio: 'inherit' });
```

## File: scripts/scaffold-implementation.js
size: 8186
sha: 0db685c62c97d4fa55729cec82c0283a963337f5
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/scripts/scaffold-implementation.js

```text
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');

function arg(name, fallback = undefined) {
  const i = process.argv.indexOf(name);
  return i >= 0 && i + 1 < process.argv.length ? process.argv[i + 1] : fallback;
}

function safeComponentName(text, index) {
  const base = String(text || `Section ${index + 1}`)
    .replace(/[^a-zA-Z0-9]+/g, ' ')
    .trim()
    .split(/\s+/)
    .slice(0, 5)
    .map(s => s.charAt(0).toUpperCase() + s.slice(1).toLowerCase())
    .join('');
  return base ? `${base}Section` : `Section${index + 1}`;
}

function extractSectionsFromSpec(specText) {
  const lines = String(specText || '').split(/\r?\n/);
  const sections = [];
  let inSectionInventory = false;
  for (const line of lines) {
    if (/^## Section Inventory/.test(line)) {
      inSectionInventory = true;
      continue;
    }
    if (inSectionInventory && /^## /.test(line)) break;
    if (inSectionInventory) {
      const m = line.match(/^- Section \d+:\s*(.+)$/);
      if (m) sections.push(m[1].trim());
    }
  }
  return sections;
}

function splitTextPreview(textPreview, fallbackSections) {
  const lines = String(textPreview || '')
    .split(/\r?\n/)
    .map(s => s.trim())
    .filter(Boolean);
  return fallbackSections.map((section, index) => ({
    title: section,
    body: lines[index + 1] || 'Replace with extracted copy and real layout details after deeper inspection.'
  }));
}

function main() {
  const runDir = arg('--run-dir');
  if (!runDir) {
    console.error('usage: scaffold-implementation.js --run-dir <run-dir>');
    process.exit(1);
  }

  const specPath = path.join(runDir, 'spec', 'website-rebuild-spec.md');
  const inspectionDir = path.join(runDir, 'inspection');
  const metaFiles = fs.existsSync(inspectionDir)
    ? fs.readdirSync(inspectionDir).filter(f => f.endsWith('.json'))
    : [];
  const metaPath = metaFiles.length ? path.join(inspectionDir, metaFiles[0]) : null;

  const specText = fs.existsSync(specPath) ? fs.readFileSync(specPath, 'utf8') : '';
  const meta = metaPath && fs.existsSync(metaPath) ? JSON.parse(fs.readFileSync(metaPath, 'utf8')) : {};
  const sections = extractSectionsFromSpec(specText);
  const sectionData = splitTextPreview(meta.textPreview || '', sections);

  const implDir = path.join(runDir, 'implementation');
  const srcDir = path.join(implDir, 'src');
  const componentsDir = path.join(srcDir, 'components');
  const appDir = path.join(srcDir, 'app');
  const dataDir = path.join(srcDir, 'data');
  fs.mkdirSync(componentsDir, { recursive: true });
  fs.mkdirSync(appDir, { recursive: true });
  fs.mkdirSync(dataDir, { recursive: true });

  const componentNames = sections.map((s, i) => safeComponentName(s, i));

  const sharedSection = `export type SectionContent = {\n  eyebrow: string;\n  title: string;\n  body: string;\n};\n\ntype GenericSectionProps = {\n  content: SectionContent;\n};\n\nexport function GenericSection({ content }: GenericSectionProps) {\n  return (\n    <section className=\"border-b border-neutral-200 px-6 py-12\">\n      <div className=\"mx-auto max-w-4xl\">\n        <p className=\"mb-3 text-sm uppercase tracking-[0.2em] text-neutral-500\">{content.eyebrow}</p>\n        <h2 className=\"mb-4 text-3xl font-semibold text-neutral-900\">{content.title}</h2>\n        <p className=\"max-w-2xl text-base leading-7 text-neutral-600\">{content.body}</p>\n      </div>\n    </section>\n  );\n}\n`;
  fs.writeFileSync(path.join(componentsDir, 'GenericSection.tsx'), sharedSection);

  sections.forEach((section, i) => {
    const componentName = componentNames[i];
    const filePath = path.join(componentsDir, `${componentName}.tsx`);
    const content = `import { GenericSection, type SectionContent } from './GenericSection';\n\ntype ${componentName}Props = {\n  content: SectionContent;\n};\n\nexport function ${componentName}({ content }: ${componentName}Props) {\n  return <GenericSection content={content} />;\n}\n`;
    fs.writeFileSync(filePath, content);
  });

  const contentTs = `export const pageContent = ${JSON.stringify({
    title: meta.title || 'Website Clone Scaffold',
    sourceUrl: meta.finalUrl || '',
    sections: sectionData.map((item, i) => ({
      eyebrow: `Section ${i + 1}`,
      title: item.title,
      body: item.body
    }))
  }, null, 2)} as const;\n`;
  fs.writeFileSync(path.join(dataDir, 'page-content.ts'), contentTs);

  const imports = componentNames.map(name => `import { ${name} } from '../components/${name}';`).join('\n');
  const renderLines = componentNames.map((name, i) => `      <${name} content={pageContent.sections[${i}]} />`).join('\n');
  const pageTsx = `import React from 'react';\n${imports}\nimport { pageContent } from '../data/page-content';\n\nexport default function Page() {\n  return (\n    <main className=\"min-h-screen bg-white text-neutral-900\">\n      <section className=\"border-b border-neutral-200 px-6 py-20\">\n        <div className=\"mx-auto max-w-4xl\">\n          <p className=\"mb-3 text-sm uppercase tracking-[0.2em] text-neutral-500\">First-pass clone scaffold</p>\n          <h1 className=\"mb-4 text-5xl font-semibold\">{pageContent.title}</h1>\n          <p className=\"max-w-2xl text-lg leading-8 text-neutral-600\">\n            Source: {pageContent.sourceUrl}\n          </p>\n        </div>\n      </section>\n${renderLines}\n    </main>\n  );\n}\n`;
  fs.writeFileSync(path.join(appDir, 'page.tsx'), pageTsx);

  const css = `@import "tailwindcss";\n\n:root {\n  color-scheme: light;\n}\n\nhtml, body {\n  margin: 0;\n  padding: 0;\n  font-family: Inter, ui-sans-serif, system-ui, sans-serif;\n  background: #ffffff;\n  color: #171717;\n}\n\n* {\n  box-sizing: border-box;\n}\n`; 
  fs.writeFileSync(path.join(appDir, 'globals.css'), css);

  const packageJson = {
    name: path.basename(runDir),
    private: true,
    version: '0.1.0',
    scripts: {
      dev: 'next dev',
      build: 'next build'
    },
    dependencies: {
      next: '^16.2.1',
      react: '^19.2.0',
      'react-dom': '^19.2.0'
    },
    devDependencies: {
      tailwindcss: '^4.1.0',
      typescript: '^5.0.0',
      '@types/react': '^19.0.0',
      '@types/node': '^24.0.0'
    }
  };
  fs.writeFileSync(path.join(implDir, 'package.json'), JSON.stringify(packageJson, null, 2));
  fs.writeFileSync(path.join(implDir, 'tsconfig.json'), JSON.stringify({
    compilerOptions: {
      target: 'ES2022',
      lib: ['dom', 'dom.iterable', 'es2022'],
      allowJs: false,
      skipLibCheck: true,
      strict: true,
      noEmit: true,
      esModuleInterop: true,
      module: 'esnext',
      moduleResolution: 'bundler',
      resolveJsonModule: true,
      isolatedModules: true,
      jsx: 'preserve',
      incremental: true,
      plugins: [{ name: 'next' }]
    },
    include: ['next-env.d.ts', '**/*.ts', '**/*.tsx'],
    exclude: ['node_modules']
  }, null, 2));
  fs.writeFileSync(path.join(implDir, 'next-env.d.ts'), '/// <reference types="next" />\n/// <reference types="next/image-types/global" />\n');
  fs.writeFileSync(path.join(implDir, 'next.config.ts'), 'import type { NextConfig } from "next";\n\nconst nextConfig: NextConfig = {};\n\nexport default nextConfig;\n');
  fs.writeFileSync(path.join(implDir, 'README.md'), `# Implementation Scaffold\n\nThis is a first-pass implementation scaffold generated from:\n- ${specPath}\n- ${metaPath || '(no inspection json found)'}\n\n## Generated sections\n${sections.map((s, i) => `- ${i + 1}. ${s}`).join('\n') || '- none'}\n\n## Notes\n- This scaffold is intentionally lightweight but now includes structured content data.\n- Replace placeholder layout/styling with extracted real design details after deeper inspection.\n- Browser capture is still preferred when available.\n`);

  console.log(JSON.stringify({
    ok: true,
    runDir,
    implementationDir: implDir,
    generatedSections: sections.length,
    files: [
      path.join(appDir, 'page.tsx'),
      path.join(appDir, 'globals.css'),
      path.join(dataDir, 'page-content.ts'),
      path.join(componentsDir, 'GenericSection.tsx'),
      path.join(implDir, 'package.json'),
      path.join(implDir, 'README.md')
    ]
  }, null, 2));
}

main();
```

## File: references/automation-notes.md
size: 1365
sha: dad0ea3a8e85f840f8c89d5717fe18f6fbc33aeb
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/references/automation-notes.md

```text
# Automation Notes

`analyze-website.js` is the first reliable automation layer for this skill.

## Current validation status
- `analyze-website.js` was exercised in this workspace.
- The current blocker is environment-level: Playwright Chromium executable is missing from the expected cache path.
- The script should work after reinstalling the browser binary used by the existing docker browser operator.

## What it does
- creates a stable run folder
- calls the existing docker browser capture script
- stores screenshot + metadata under `inspection/`
- generates a first-pass `spec/website-rebuild-spec.md`
- writes a short run `README.md`

## Fallback behavior
If browser launch fails, the script now falls back to a direct HTTP fetch and still produces:
- `inspection/<slug>.json`
- `spec/website-rebuild-spec.md`
- run `README.md`

This fallback does not capture screenshots or interaction behavior, but it keeps the workflow moving.

## What it does not yet do
- full DOM extraction
- asset downloading
- desktop/tablet/mobile multi-pass capture
- exact design-token extraction
- automatic code generation beyond simple scaffolding decisions

## Upgrade path
Future versions can add:
1. multiple viewport captures
2. better section segmentation
3. asset harvesting
4. generated implementation scaffold
5. section-by-section component prompts or code stubs
```

## File: references/browser-flow.md
size: 1266
sha: 38d2ed34741b63de2caf6fb1360fcc5ffc4a20db
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/references/browser-flow.md

````text
# Browser Flow

Use this when a website task needs actual page inspection.

## Preferred path

Use the existing Docker browser operator skill and its validated script:

```bash
node /home/node/OpenClawBox/skills/docker-browser-operator/scripts/browse.js \
  --url "https://example.com" \
  --slug example
```

## Environment note

This flow depends on a working Playwright Chromium install. If launch fails with a missing executable under `/home/node/.cache/ms-playwright/`, install browsers first:

```bash
cd /home/node/OpenClawBox/deliveries/browser-lab && npx playwright install chromium
```

Then retry the browser step.

## What to collect first

For the first pass, collect only the evidence needed to decide next steps:
- page title
- final URL after redirects
- screenshot path
- concise visible-text summary
- major sections visible on the page

## If deeper inspection is needed

Add targeted follow-up runs rather than trying to do everything in one pass. Examples:
- desktop and mobile screenshots
- one run per important page
- content extraction for specific sections
- screenshot recapture after interaction

## Delivery rule

Write inspection artifacts to a stable run folder. Reuse that folder in later steps so the clone task remains recoverable.
````

## File: references/evaluation.md
size: 921
sha: 3b2e529b31836885fcf29ab38334bc5e232a9bc4
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/references/evaluation.md

```text
# Evaluation

Judge website clone requests on these axes:

## 1. Surface complexity
- simple landing page
- multi-section marketing site
- content site/blog
- authenticated product app
- animation-heavy experience

## 2. Extraction difficulty
- mostly static HTML/text/images
- heavy responsive changes
- hidden/tabbed content
- video/canvas/WebGL-driven visuals
- data loaded after auth or API calls

## 3. Rebuild fit in OpenClaw
Best fit:
- landing pages
- brochure/brand sites
- campaign pages
- simple homepages

Medium fit:
- blog/article pages
- documentation fronts
- moderate interactivity

Weak fit:
- dashboards
- authenticated SaaS apps
- complex multi-step products
- pages whose value is in backend logic rather than presentation

## Verdict labels
Use one clear verdict:
- good candidate for local rebuild
- good candidate for partial reconstruction
- learn-from-only, not ideal for direct cloning
- avoid
```

## File: references/scaffold-patterns.md
size: 608
sha: 38a9eec036dd28d48f87f2e7d1df8ae4dc748c9f
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/references/scaffold-patterns.md

```text
# Scaffold Patterns

When the user wants actual files, create a run folder like:

`/home/node/OpenClawBox/deliveries/website-clone-runs/<slug>/`

Recommended contents:

- `README.md` — short run summary
- `inspection/` — screenshots, text dumps, notes
- `spec/website-rebuild-spec.md` — the main rebuild brief
- `implementation/` — optional code scaffold

If creating a code scaffold, keep it minimal and honest:
- basic package manifest
- page shell
- component folders
- asset folders
- content/data file

Do not generate a huge fake codebase unless the user asked for actual implementation depth.
```

## File: references/spec-template.md
size: 980
sha: 9aa8ef7ef5f128508a69f29a999f42d2a59f0511
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/references/spec-template.md

```text
# Rebuild Spec Template

Use this exact outline when producing a website rebuild brief.

## Target
- URL:
- Date inspected:
- Goal:
- Fidelity target:

## Summary
- What the page is
- What makes it distinctive
- Whether it is a good clone candidate

## Section Inventory
List sections from top to bottom.
For each section include:
- working name
- purpose
- notable content
- notable layout/style
- interaction hints

## Style Notes
- typography
- palette
- spacing rhythm
- border radius / shadows
- imagery style
- motion hints

## Assets
- logos
- hero images
- icons
- videos
- downloadable media to localize

## Proposed Implementation
- suggested stack
- routes/pages needed
- component list
- content/data shape
- folder structure

## Risks / Gaps
- what was not verified
- what likely needs manual polish
- what may be legally sensitive

## Recommended Next Step
Choose one:
- stop at analysis
- scaffold project
- build first-pass homepage
- do deeper browser inspection
```

## File: .gitignore
size: 43
sha: adc6c0125a1b8f17c01e004faa201720d5e70139
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/.gitignore

```text
node_modules/
.next/
dist/
*.log
.DS_Store
```

## File: CHANGELOG.md
size: 433
sha: 9b04e376d725cdc94b93cefa8bdf557f991eba29
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/CHANGELOG.md

```text
# Changelog

## 0.1.0

Initial public release.

Included in this release:

- staged website analysis workflow for OpenClaw
- fallback-safe inspection path
- rebuild spec generation
- first-pass implementation scaffold generation
- one-command complete runner

Known limitations:

- browser capture still depends on the local Playwright host setup
- generated implementation is intentionally shallow and meant for follow-up iteration
```

## File: docs-GITHUB-INTRO.md
size: 1697
sha: ce9d25986cb03789abae13818f51b7154586f39a
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/docs-GITHUB-INTRO.md

```text
# OpenClaw Website Clone Kit

## A practical website analysis and rebuild skill for OpenClaw

OpenClaw Website Clone Kit turns a public URL into a structured rebuild task.

Instead of pretending to perfectly clone any website in one shot, it works in a staged and recoverable way:

- inspect the target
- capture evidence
- generate a rebuild brief
- scaffold a local implementation
- keep going even when browser automation is unavailable

That makes it more useful in real OpenClaw environments, where browser access, system dependencies, and permissions may vary.

## Highlights

- one-command complete run entrypoint
- fallback-safe analysis workflow
- rebuild spec generation
- first-pass implementation scaffold generation
- structured output in `deliveries/website-clone-runs/<slug>/`
- content-data generation for follow-up iteration

## How it works

A complete run attempts browser capture first. If the browser stack is currently unavailable, it falls back to HTTP-based extraction and still produces:

- inspection metadata
- rebuild spec
- starter implementation scaffold

This means the task keeps moving instead of failing empty.

## Intended use

Best for:
- landing pages
- marketing sites
- public brochure sites
- website rebuild planning
- reverse-engineering structure before implementation

Less suited for:
- authenticated apps
- dashboards
- animation-heavy experiences
- exact pixel-perfect recreation without browser inspection

## Current status

The skill is already usable for structured analysis and scaffold generation.

The main remaining environment-dependent upgrade is restoring full browser capture by completing Playwright host dependencies in this container.
```

## File: docs/BROWSER-SETUP.md
size: 1150
sha: a94809f0524a39c09db6f6a92896de57aeeb795f
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/docs/BROWSER-SETUP.md

````text
# Browser Setup

Full browser capture for this skill depends on both:

1. Playwright browser binaries
2. required host system libraries

## Current state in this environment

Browser launch is currently working in this environment after installing the required shared libraries.

The main recovery lesson is that Chromium binaries alone are not enough; the container must also provide shared libraries such as:

- `libnspr4`
- `libnss3`
- `libatk1.0-0`
- `libdbus-1-3`
- `libatspi2.0-0`
- `libxcomposite1`
- `libxdamage1`
- `libxfixes3`
- `libxrandr2`
- `libgbm1`
- `libxkbcommon0`
- `libasound2`

## One-shot fix script

A prepared fix script exists at:

`/home/node/OpenClawBox/deliveries/website-clone-runs/PLAYWRIGHT_FIX_COMMAND.sh`

It installs the required Debian packages and then reinstalls Chromium for the existing browser-lab workspace.

## Validation command

After fixing, validate with:

```bash
node /home/node/OpenClawBox/skills/openclaw-website-clone-kit/scripts/run-complete.js \
  --url "https://vercel.com/ai" \
  --slug vercel-ai-demo-browser
```

A healthy run should produce richer inspection artifacts, including screenshots.
````

## File: docs/EXAMPLE-RUNS.md
size: 1164
sha: d5111faf0facedd2bf6d0146271c6d7d12b436fe
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/docs/EXAMPLE-RUNS.md

```text
# Example Runs

## Vercel AI demo

A representative public demo was generated against:

- URL: `https://vercel.com/ai`

Two run variants now exist:

### 1. Fallback-safe run
- Run slug: `vercel-ai-demo`
- Result: analysis package + first-pass implementation scaffold
- Capture mode: `http-fallback`

### 2. Browser-backed run
- Run slug: `vercel-ai-demo-browser`
- Result: analysis package + screenshot + first-pass implementation scaffold
- Capture mode: `browser`

### Observed output

The run produced:

- inspection metadata
- rebuild spec
- implementation scaffold
- structured page content data

### Notable extracted sections

- Deploy AI at the speed of frontend
- AI Cloud
- Build applications with AI
- AI SDK
- AI Gateway
- Vercel Agent
- Sandbox
- Core Platform
- CI/CD
- Content Delivery

### Why this example matters

This is a better showcase than `example.com` because it resembles a modern public AI landing page with multiple sections and clearer marketing structure.

### Current caveat

The browser-backed path is working now, but the project still keeps the fallback-safe path because browser dependencies can break again in new environments.
```

## File: LICENSE
size: 1056
sha: 14fac913ccf80234b1848540089a3bbcb6e5283d
upstream: https://github.com/mashengsbc-beep/openclaw-website-clone-kit/blob/HEAD/LICENSE

```text
MIT License

Copyright (c) 2026

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
