design-clone 2.1.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -34
- package/SKILL.md +69 -45
- package/bin/cli.js +22 -4
- package/bin/commands/clone-site.js +31 -171
- package/bin/commands/help.js +19 -6
- package/bin/commands/init.js +9 -86
- package/bin/commands/uninstall.js +105 -0
- package/bin/commands/update.js +70 -0
- package/bin/commands/verify.js +7 -14
- package/bin/utils/paths.js +28 -0
- package/bin/utils/validate.js +2 -22
- package/bin/utils/version.js +23 -0
- package/docs/code-standards.md +789 -0
- package/docs/codebase-summary.md +533 -286
- package/docs/index.md +74 -0
- package/docs/project-overview-pdr.md +797 -0
- package/docs/system-architecture.md +718 -0
- package/package.json +14 -17
- package/src/ai/prompts/design-tokens/basic.md +80 -0
- package/src/ai/prompts/design-tokens/section-with-css.md +41 -0
- package/src/ai/prompts/design-tokens/section.md +48 -0
- package/src/ai/prompts/design-tokens/with-css.md +87 -0
- package/src/ai/prompts/structure-analysis/basic.md +55 -0
- package/src/ai/prompts/structure-analysis/with-context.md +59 -0
- package/src/ai/prompts/structure-analysis/with-dimensions.md +63 -0
- package/src/ai/prompts/structure-analysis/with-hierarchy.md +73 -0
- package/src/ai/prompts/ux-audit/aggregation.md +42 -0
- package/src/ai/prompts/ux-audit/desktop.md +92 -0
- package/src/ai/prompts/ux-audit/mobile.md +93 -0
- package/src/ai/prompts/ux-audit/tablet.md +92 -0
- package/src/core/animation/animation-extractor-ast.js +183 -0
- package/src/core/animation/animation-extractor-output.js +152 -0
- package/src/core/animation/animation-extractor.js +178 -0
- package/src/core/animation/state-capture-detection.js +200 -0
- package/src/core/animation/state-capture.js +193 -0
- package/src/core/capture/browser-context-pool.js +96 -0
- package/src/core/capture/multi-page-screenshot-page.js +110 -0
- package/src/core/capture/multi-page-screenshot.js +208 -0
- package/src/core/capture/screenshot-extraction.js +186 -0
- package/src/core/capture/screenshot-helpers.js +175 -0
- package/src/core/capture/screenshot-orchestrator.js +174 -0
- package/src/core/capture/screenshot-viewport.js +93 -0
- package/src/core/capture/screenshot.js +192 -0
- package/src/core/content/content-counter-dom.js +191 -0
- package/src/core/content/content-counter.js +76 -0
- package/src/core/css/breakpoint-detector.js +66 -0
- package/src/core/css/chromium-defaults.json +23 -0
- package/src/core/css/computed-style-extractor.js +102 -0
- package/src/core/css/css-chunker.js +103 -0
- package/src/core/css/filter-css-dead-code.js +120 -0
- package/src/core/css/filter-css-html-analyzer.js +110 -0
- package/src/core/css/filter-css-selector-matcher.js +172 -0
- package/src/core/css/filter-css.js +206 -0
- package/src/core/css/merge-css-atrule-processor.js +158 -0
- package/src/core/css/merge-css-file-io.js +68 -0
- package/src/core/css/merge-css.js +148 -0
- package/src/core/detection/framework-detector-routing.js +68 -0
- package/src/core/detection/framework-detector-signals.js +65 -0
- package/src/core/detection/framework-detector.js +198 -0
- package/src/core/dimension/dimension-extractor-card-detector.js +82 -0
- package/src/core/dimension/dimension-extractor.js +317 -0
- package/src/core/dimension/dimension-output-ai-summary.js +111 -0
- package/src/core/dimension/dimension-output.js +173 -0
- package/src/core/dimension/dom-tree-analyzer-tree-builders.js +95 -0
- package/src/core/dimension/dom-tree-analyzer.js +191 -0
- package/src/core/discovery/app-state-snapshot-capture.js +195 -0
- package/src/core/discovery/app-state-snapshot-utils.js +178 -0
- package/src/core/discovery/app-state-snapshot.js +131 -0
- package/src/core/discovery/discover-pages-routes.js +84 -0
- package/src/core/discovery/discover-pages-utils.js +177 -0
- package/src/core/discovery/discover-pages.js +191 -0
- package/src/core/html/html-extractor-inline-styler.js +70 -0
- package/src/core/html/html-extractor.js +147 -0
- package/src/core/html/semantic-enhancer-mappings.js +200 -0
- package/src/core/html/semantic-enhancer-page.js +148 -0
- package/src/core/html/semantic-enhancer.js +135 -0
- package/src/core/links/rewrite-links-css-rewriter.js +53 -0
- package/src/core/links/rewrite-links.js +173 -0
- package/src/core/media/asset-validator.js +118 -0
- package/src/core/media/extract-assets-downloader.js +187 -0
- package/src/core/media/extract-assets-page-scraper.js +115 -0
- package/src/core/media/extract-assets.js +159 -0
- package/src/core/media/video-capture-convert.js +200 -0
- package/src/core/media/video-capture.js +201 -0
- package/src/core/{lazy-loader.js → page-prep/lazy-loader.js} +37 -39
- package/src/core/section/section-cropper-helpers.js +43 -0
- package/src/core/{section-cropper.js → section/section-cropper.js} +11 -88
- package/src/core/section/section-detector-strategies.js +139 -0
- package/src/core/section/section-detector-utils.js +100 -0
- package/src/core/section/section-detector.js +88 -0
- package/src/core/tests/test-section-cropper.js +2 -2
- package/src/core/tests/test-section-detector.js +2 -2
- package/src/post-process/enhance-assets.js +29 -4
- package/src/post-process/fetch-images-unsplash-client.js +123 -0
- package/src/post-process/fetch-images.js +60 -263
- package/src/post-process/inject-gosnap.js +88 -0
- package/src/post-process/inject-icons-svg-replacer.js +76 -0
- package/src/post-process/inject-icons.js +47 -200
- package/src/route-discoverers/base-discoverer-utils.js +137 -0
- package/src/route-discoverers/base-discoverer.js +29 -118
- package/src/route-discoverers/index.js +1 -1
- package/src/shared/config.js +38 -0
- package/src/shared/error-codes.js +31 -0
- package/src/shared/viewports.js +46 -0
- package/src/utils/browser.js +0 -7
- package/src/utils/helpers.js +4 -0
- package/src/utils/log.js +12 -0
- package/src/utils/playwright-loader.js +76 -0
- package/src/utils/playwright.js +3 -69
- package/src/utils/progress.js +32 -0
- package/src/verification/generate-audit-report-css-fixes.js +52 -0
- package/src/verification/generate-audit-report-sections.js +158 -0
- package/src/verification/generate-audit-report.js +5 -281
- package/src/verification/quality-scorer.js +92 -0
- package/src/verification/verify-footer-checks.js +103 -0
- package/src/verification/verify-footer-helpers.js +178 -0
- package/src/verification/verify-footer.js +23 -381
- package/src/verification/verify-header-checks.js +104 -0
- package/src/verification/verify-header-helpers.js +156 -0
- package/src/verification/verify-header.js +23 -365
- package/src/verification/verify-layout-report.js +101 -0
- package/src/verification/verify-layout.js +13 -259
- package/src/verification/verify-menu-checks.js +104 -0
- package/src/verification/verify-menu-helpers.js +112 -0
- package/src/verification/verify-menu.js +17 -285
- package/src/verification/verify-slider-checks.js +115 -0
- package/src/verification/verify-slider-constants.js +65 -0
- package/src/verification/verify-slider-helpers.js +164 -0
- package/src/verification/verify-slider.js +23 -414
- package/.env.example +0 -14
- package/docs/basic-clone.md +0 -63
- package/docs/cli-reference.md +0 -316
- package/docs/design-clone-architecture.md +0 -492
- package/docs/pixel-perfect.md +0 -117
- package/docs/project-roadmap.md +0 -382
- package/docs/troubleshooting.md +0 -170
- package/requirements.txt +0 -5
- package/src/ai/__pycache__/analyze-structure.cpython-313.pyc +0 -0
- package/src/ai/__pycache__/extract-design-tokens.cpython-313.pyc +0 -0
- package/src/ai/analyze-structure.py +0 -375
- package/src/ai/extract-design-tokens.py +0 -782
- package/src/ai/prompts/__init__.py +0 -2
- package/src/ai/prompts/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/ai/prompts/__pycache__/design_tokens.cpython-313.pyc +0 -0
- package/src/ai/prompts/__pycache__/structure_analysis.cpython-313.pyc +0 -0
- package/src/ai/prompts/__pycache__/ux_audit.cpython-313.pyc +0 -0
- package/src/ai/prompts/design_tokens.py +0 -316
- package/src/ai/prompts/structure_analysis.py +0 -592
- package/src/ai/prompts/ux_audit.py +0 -198
- package/src/ai/ux-audit.js +0 -596
- package/src/core/animation-extractor.js +0 -526
- package/src/core/app-state-snapshot.js +0 -511
- package/src/core/content-counter.js +0 -342
- package/src/core/design-tokens.js +0 -103
- package/src/core/dimension-extractor.js +0 -438
- package/src/core/dimension-output.js +0 -305
- package/src/core/discover-pages.js +0 -542
- package/src/core/dom-tree-analyzer.js +0 -298
- package/src/core/extract-assets.js +0 -468
- package/src/core/filter-css.js +0 -499
- package/src/core/framework-detector.js +0 -538
- package/src/core/html-extractor.js +0 -212
- package/src/core/merge-css.js +0 -407
- package/src/core/multi-page-screenshot.js +0 -380
- package/src/core/rewrite-links.js +0 -226
- package/src/core/screenshot.js +0 -701
- package/src/core/section-detector.js +0 -386
- package/src/core/semantic-enhancer.js +0 -492
- package/src/core/state-capture.js +0 -598
- package/src/core/video-capture.js +0 -546
- package/src/utils/__init__.py +0 -16
- package/src/utils/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/utils/__pycache__/env.cpython-313.pyc +0 -0
- package/src/utils/env.py +0 -134
- /package/src/core/{css-extractor.js → css/css-extractor.js} +0 -0
- /package/src/core/{cookie-handler.js → page-prep/cookie-handler.js} +0 -0
- /package/src/core/{page-readiness.js → page-prep/page-readiness.js} +0 -0
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="logo.svg" alt="design-clone" width="120" height="120">
|
|
2
|
+
<img src="./assets/images/logo.svg" alt="design-clone" width="120" height="120">
|
|
3
3
|
<h1>Design Clone</h1>
|
|
4
|
-
<p><strong>Clone website designs with multi-viewport screenshots, HTML/CSS extraction, and
|
|
4
|
+
<p><strong>Clone website designs with multi-viewport screenshots, HTML/CSS extraction, and AI-powered design analysis.</strong></p>
|
|
5
5
|
<p>
|
|
6
6
|
<a href="https://www.npmjs.com/package/design-clone"><img src="https://img.shields.io/npm/v/design-clone" alt="npm"></a>
|
|
7
7
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
- **Multi-viewport screenshots**: Desktop (1920px), Tablet (768px), Mobile (375px)
|
|
17
17
|
- **HTML/CSS extraction**: Clean source files with unused CSS removal
|
|
18
18
|
- **Hover state capture**: Screenshots and CSS for interactive element states (phase 2)
|
|
19
|
-
- **AI structure analysis**:
|
|
19
|
+
- **AI structure analysis**: Built-in design analysis via Claude Code (no API key needed)
|
|
20
20
|
- **Asset extraction**: Downloads images, fonts, icons
|
|
21
21
|
- **Menu verification**: Tests responsive navigation functionality
|
|
22
22
|
|
|
@@ -36,7 +36,6 @@ git clone https://github.com/bienhoang/design-clone.git
|
|
|
36
36
|
cp -r design-clone ~/.claude/skills/design-clone
|
|
37
37
|
cd ~/.claude/skills/design-clone
|
|
38
38
|
npm install
|
|
39
|
-
pip install -r requirements.txt
|
|
40
39
|
```
|
|
41
40
|
|
|
42
41
|
### Verify Installation
|
|
@@ -73,7 +72,7 @@ Basic design capture:
|
|
|
73
72
|
Full pixel-perfect clone:
|
|
74
73
|
- All basic clone features
|
|
75
74
|
- Asset extraction (images, fonts, icons)
|
|
76
|
-
- AI structure analysis (
|
|
75
|
+
- AI structure analysis (built-in, no API key needed)
|
|
77
76
|
- Menu verification
|
|
78
77
|
- Design token extraction
|
|
79
78
|
|
|
@@ -90,7 +89,7 @@ cloned-design/
|
|
|
90
89
|
├── animations.css # Extracted @keyframes definitions
|
|
91
90
|
├── animation-tokens.json # Animation metadata (keyframes, transitions, timings)
|
|
92
91
|
├── hover.css # Generated :hover CSS rules (with --capture-hover)
|
|
93
|
-
├── structure.md # AI analysis (
|
|
92
|
+
├── structure.md # AI analysis (built-in)
|
|
94
93
|
├── tokens.json # Extracted design tokens
|
|
95
94
|
├── hover-states/ # Hover state captures (with --capture-hover)
|
|
96
95
|
│ ├── hover-N-normal.png # Element before hover
|
|
@@ -102,29 +101,20 @@ cloned-design/
|
|
|
102
101
|
└── icons/
|
|
103
102
|
```
|
|
104
103
|
|
|
105
|
-
## Environment Variables
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
# Optional: enables AI structure analysis
|
|
109
|
-
GEMINI_API_KEY=your-api-key
|
|
110
|
-
|
|
111
|
-
# Add to ~/.claude/.env for persistent config
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
Get your API key at: https://aistudio.google.com/apikey
|
|
115
|
-
|
|
116
104
|
## Requirements
|
|
117
105
|
|
|
118
106
|
- Node.js 18+
|
|
119
|
-
-
|
|
120
|
-
- Playwright (auto-installed with browsers)
|
|
107
|
+
- Playwright + Chromium (auto-installed with `npm install`)
|
|
121
108
|
|
|
122
109
|
## CLI Commands
|
|
123
110
|
|
|
124
111
|
```bash
|
|
125
|
-
design-clone init [--force]
|
|
126
|
-
design-clone verify
|
|
127
|
-
design-clone
|
|
112
|
+
design-clone init [--force] # Install skill to ~/.claude/skills/
|
|
113
|
+
design-clone verify # Check installation status
|
|
114
|
+
design-clone update [--force] # Update to latest version
|
|
115
|
+
design-clone uninstall [--yes] # Remove skill installation
|
|
116
|
+
design-clone --version # Show version
|
|
117
|
+
design-clone help # Show usage help
|
|
128
118
|
```
|
|
129
119
|
|
|
130
120
|
## Troubleshooting
|
|
@@ -142,21 +132,10 @@ sudo apt install chromium-browser
|
|
|
142
132
|
export CHROME_PATH="/path/to/chrome"
|
|
143
133
|
```
|
|
144
134
|
|
|
145
|
-
### Python dependencies fail
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
pip install google-genai
|
|
149
|
-
# Or with Python 3
|
|
150
|
-
pip3 install -r requirements.txt
|
|
151
|
-
```
|
|
152
|
-
|
|
153
135
|
### Playwright issues
|
|
154
136
|
|
|
155
137
|
```bash
|
|
156
|
-
# Install
|
|
157
|
-
npm install playwright
|
|
158
|
-
|
|
159
|
-
# Install browsers
|
|
138
|
+
# Install browsers (if not auto-installed)
|
|
160
139
|
npx playwright install chromium
|
|
161
140
|
|
|
162
141
|
# For Docker/CI environments
|
package/SKILL.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: design-clone
|
|
3
|
-
description: Clone website designs via multi-viewport screenshots, HTML/CSS extraction, and
|
|
3
|
+
description: Clone website designs via multi-viewport screenshots, HTML/CSS extraction, and built-in AI analysis. Generates production HTML/CSS with Font Awesome icons, direct Unsplash images, and Japanese design principles. Commands - design:clone (basic), design:clone-px (pixel-perfect).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Design Clone Skill
|
|
7
7
|
|
|
8
|
-
Clone website designs with multi-viewport screenshots, HTML/CSS extraction, CSS filtering, and
|
|
8
|
+
Clone website designs with multi-viewport screenshots, HTML/CSS extraction, CSS filtering, and built-in AI structure analysis.
|
|
9
9
|
|
|
10
10
|
## Features
|
|
11
11
|
|
|
@@ -14,21 +14,18 @@ Clone website designs with multi-viewport screenshots, HTML/CSS extraction, CSS
|
|
|
14
14
|
- **Japanese Design Principles** - Ma, Kanso, Shibui, Seijaku for elegant designs
|
|
15
15
|
- **Multi-viewport Screenshots** - Desktop, tablet, mobile captures
|
|
16
16
|
- **Hover State Capture** - Interactive element screenshots and :hover CSS generation
|
|
17
|
-
- **
|
|
17
|
+
- **Built-in AI Analysis** - Design token extraction via Claude Code vision
|
|
18
18
|
- **ui-ux-pro-max Quality Check** - Accessibility, hover states, contrast validation
|
|
19
19
|
|
|
20
20
|
## Prerequisites
|
|
21
21
|
|
|
22
22
|
- Node.js 18+ with npm
|
|
23
|
-
- Python 3.9+ (for AI analysis)
|
|
24
23
|
- Chrome/Chromium browser
|
|
25
24
|
|
|
26
25
|
## Quick Setup
|
|
27
26
|
|
|
28
27
|
```bash
|
|
29
28
|
npm install
|
|
30
|
-
pip install -r requirements.txt
|
|
31
|
-
# Optional: Set GEMINI_API_KEY in .env for AI analysis
|
|
32
29
|
```
|
|
33
30
|
|
|
34
31
|
## Project Structure
|
|
@@ -44,17 +41,18 @@ design-clone/
|
|
|
44
41
|
│ │ ├── screenshot.js # Multi-viewport screenshots
|
|
45
42
|
│ │ ├── filter-css.js # CSS filtering
|
|
46
43
|
│ │ └── extract-assets.js
|
|
47
|
-
│ ├── ai/ # AI analysis
|
|
48
|
-
│ │
|
|
49
|
-
│ │
|
|
44
|
+
│ ├── ai/ # AI analysis prompt templates
|
|
45
|
+
│ │ └── prompts/ # Markdown prompts for Claude Code vision
|
|
46
|
+
│ │ ├── structure-analysis/
|
|
47
|
+
│ │ ├── design-tokens/
|
|
48
|
+
│ │ └── ux-audit/
|
|
50
49
|
│ ├── verification/ # Verification scripts
|
|
51
50
|
│ │ ├── verify-menu.js
|
|
52
51
|
│ │ └── verify-layout.js
|
|
53
52
|
│ ├── utils/ # Shared utilities
|
|
54
53
|
│ │ ├── browser.js
|
|
55
54
|
│ │ ├── puppeteer.js
|
|
56
|
-
│ │
|
|
57
|
-
│ │ └── env.py
|
|
55
|
+
│ │ └── env.js
|
|
58
56
|
│ └── post-process/ # Post-processing
|
|
59
57
|
│ ├── fetch-images.js
|
|
60
58
|
│ ├── inject-icons.js
|
|
@@ -78,14 +76,14 @@ Basic design capture with Font Awesome icons and Unsplash images.
|
|
|
78
76
|
**Workflow:**
|
|
79
77
|
```bash
|
|
80
78
|
# Step 1: Capture screenshots + HTML/CSS
|
|
81
|
-
node src/core/screenshot.js \
|
|
79
|
+
node src/core/capture/screenshot.js \
|
|
82
80
|
--url "URL" \
|
|
83
81
|
--output ./output \
|
|
84
82
|
--extract-html \
|
|
85
83
|
--extract-css
|
|
86
84
|
|
|
87
85
|
# Step 2: Filter unused CSS
|
|
88
|
-
node src/core/filter-css.js \
|
|
86
|
+
node src/core/css/filter-css.js \
|
|
89
87
|
--html ./output/source.html \
|
|
90
88
|
--css ./output/source-raw.css \
|
|
91
89
|
--output ./output/source.css
|
|
@@ -107,7 +105,7 @@ python3 $HOME/.claude/skills/ui-ux-pro-max/scripts/search.py "animation hover" -
|
|
|
107
105
|
|
|
108
106
|
### design:clone-site
|
|
109
107
|
|
|
110
|
-
Multi-page
|
|
108
|
+
Multi-page screenshot capture for Claude Code vision to generate new HTML/CSS.
|
|
111
109
|
|
|
112
110
|
```bash
|
|
113
111
|
/design:clone-site https://example.com
|
|
@@ -136,18 +134,13 @@ cloned-designs/{timestamp}-{domain}/
|
|
|
136
134
|
│ ├── desktop/*.png
|
|
137
135
|
│ ├── tablet/*.png
|
|
138
136
|
│ └── mobile/*.png
|
|
139
|
-
├──
|
|
140
|
-
|
|
141
|
-
│ ├── about.html
|
|
142
|
-
│ └── contact.html
|
|
143
|
-
├── styles.css # Merged + deduplicated CSS
|
|
144
|
-
└── manifest.json # Page metadata + mapping
|
|
137
|
+
├── manifest.json # Page metadata + screenshot paths
|
|
138
|
+
└── capture-results.json
|
|
145
139
|
```
|
|
146
140
|
|
|
147
141
|
**Features:**
|
|
148
142
|
- Auto-discovers pages from navigation (SPA-aware)
|
|
149
|
-
-
|
|
150
|
-
- Working internal links
|
|
143
|
+
- Multi-viewport screenshots (desktop, tablet, mobile)
|
|
151
144
|
- Progress reporting
|
|
152
145
|
- Graceful error handling (continues on page failures)
|
|
153
146
|
|
|
@@ -161,7 +154,7 @@ Pixel-perfect clone with full asset extraction and AI analysis.
|
|
|
161
154
|
|
|
162
155
|
```bash
|
|
163
156
|
# Step 1: Capture + Extract
|
|
164
|
-
node src/core/screenshot.js \
|
|
157
|
+
node src/core/capture/screenshot.js \
|
|
165
158
|
--url "URL" \
|
|
166
159
|
--output ./output \
|
|
167
160
|
--extract-html --extract-css \
|
|
@@ -169,27 +162,57 @@ node src/core/screenshot.js \
|
|
|
169
162
|
--full-page
|
|
170
163
|
|
|
171
164
|
# Step 2: Filter CSS
|
|
172
|
-
node src/core/filter-css.js \
|
|
165
|
+
node src/core/css/filter-css.js \
|
|
173
166
|
--html ./output/source.html \
|
|
174
167
|
--css ./output/source-raw.css \
|
|
175
168
|
--output ./output/source.css
|
|
176
169
|
|
|
177
170
|
# Step 3: Extract Assets (images, fonts, icons)
|
|
178
|
-
node src/core/extract-assets.js \
|
|
171
|
+
node src/core/media/extract-assets.js \
|
|
179
172
|
--url "URL" \
|
|
180
173
|
--output ./output
|
|
181
174
|
|
|
182
|
-
# Step 4: AI Structure Analysis (
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
#
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
175
|
+
# Step 4: AI Structure Analysis (built-in Claude Code vision)
|
|
176
|
+
# Select prompt based on available context (highest accuracy first):
|
|
177
|
+
# - If dom-hierarchy.json AND dimensions-summary.json exist:
|
|
178
|
+
# Read src/ai/prompts/structure-analysis/with-hierarchy.md
|
|
179
|
+
# Read output/dom-hierarchy.json
|
|
180
|
+
# Read output/dimensions-summary.json
|
|
181
|
+
# - Else if dimensions-summary.json exists:
|
|
182
|
+
# Read src/ai/prompts/structure-analysis/with-dimensions.md
|
|
183
|
+
# Read output/dimensions-summary.json
|
|
184
|
+
# - Else if source.html AND source.css exist:
|
|
185
|
+
# Read src/ai/prompts/structure-analysis/with-context.md
|
|
186
|
+
# Read output/source.html (first 100KB)
|
|
187
|
+
# Read output/source.css (first 100KB)
|
|
188
|
+
# - Else:
|
|
189
|
+
# Read src/ai/prompts/structure-analysis/basic.md
|
|
190
|
+
#
|
|
191
|
+
# Then: Read output/desktop.png (Claude vision analyzes the screenshot)
|
|
192
|
+
# If content-summary.md exists: Read output/content-summary.md
|
|
193
|
+
# Analyze following prompt instructions
|
|
194
|
+
# Write result to output/structure.md
|
|
195
|
+
|
|
196
|
+
# Step 5: Extract Design Tokens (built-in Claude Code vision)
|
|
197
|
+
# Select prompt:
|
|
198
|
+
# - If source.css exists:
|
|
199
|
+
# Read src/ai/prompts/design-tokens/with-css.md
|
|
200
|
+
# Read output/source.css (first 15KB)
|
|
201
|
+
# - Else:
|
|
202
|
+
# Read src/ai/prompts/design-tokens/basic.md
|
|
203
|
+
#
|
|
204
|
+
# Read output/desktop.png, output/tablet.png, output/mobile.png
|
|
205
|
+
# Analyze following prompt instructions
|
|
206
|
+
# Write JSON result to output/design-tokens.json
|
|
207
|
+
# Generate CSS custom properties and write to output/tokens.css
|
|
208
|
+
#
|
|
209
|
+
# Token CSS generation rules:
|
|
210
|
+
# - Map colors to --color-* variables
|
|
211
|
+
# - Map typography to --font-*, --font-size-*, --font-weight-*, --line-height-*
|
|
212
|
+
# - Map spacing to --space-* variables
|
|
213
|
+
# - Map border-radius to --radius-* variables
|
|
214
|
+
# - Map shadows to --shadow-* variables
|
|
215
|
+
# - Use :root {} selector
|
|
193
216
|
|
|
194
217
|
# Step 6: Verify Menu
|
|
195
218
|
node src/verification/verify-menu.js \
|
|
@@ -267,7 +290,7 @@ After generating HTML/CSS, verify these items using `ui-ux-pro-max` skill:
|
|
|
267
290
|
Automatically extracts @keyframes and transition properties when using `--extract-css`:
|
|
268
291
|
|
|
269
292
|
```bash
|
|
270
|
-
node src/core/screenshot.js --url https://example.com --output ./out --extract-css true
|
|
293
|
+
node src/core/capture/screenshot.js --url https://example.com --output ./out --extract-css true
|
|
271
294
|
```
|
|
272
295
|
|
|
273
296
|
**Output:**
|
|
@@ -279,7 +302,7 @@ node src/core/screenshot.js --url https://example.com --output ./out --extract-c
|
|
|
279
302
|
Capture interactive element hover states:
|
|
280
303
|
|
|
281
304
|
```bash
|
|
282
|
-
node src/core/screenshot.js --url https://example.com --output ./out --capture-hover
|
|
305
|
+
node src/core/capture/screenshot.js --url https://example.com --output ./out --capture-hover
|
|
283
306
|
```
|
|
284
307
|
|
|
285
308
|
**Output:**
|
|
@@ -297,16 +320,16 @@ Record scroll preview video (opt-in due to 3-5x capture time increase):
|
|
|
297
320
|
|
|
298
321
|
```bash
|
|
299
322
|
# WebM (native, no extra deps)
|
|
300
|
-
node src/core/screenshot.js --url https://example.com --output ./out --video
|
|
323
|
+
node src/core/capture/screenshot.js --url https://example.com --output ./out --video
|
|
301
324
|
|
|
302
325
|
# MP4 (requires ffmpeg)
|
|
303
|
-
node src/core/screenshot.js --url https://example.com --output ./out --video --video-format mp4
|
|
326
|
+
node src/core/capture/screenshot.js --url https://example.com --output ./out --video --video-format mp4
|
|
304
327
|
|
|
305
328
|
# GIF (requires ffmpeg)
|
|
306
|
-
node src/core/screenshot.js --url https://example.com --output ./out --video --video-format gif
|
|
329
|
+
node src/core/capture/screenshot.js --url https://example.com --output ./out --video --video-format gif
|
|
307
330
|
|
|
308
331
|
# Custom duration (default: 12000ms)
|
|
309
|
-
node src/core/screenshot.js --url https://example.com --output ./out --video --video-duration 8000
|
|
332
|
+
node src/core/capture/screenshot.js --url https://example.com --output ./out --video --video-duration 8000
|
|
310
333
|
```
|
|
311
334
|
|
|
312
335
|
**Output:**
|
|
@@ -332,7 +355,7 @@ npm install fluent-ffmpeg @ffmpeg-installer/ffmpeg
|
|
|
332
355
|
Create `.env` file (see `.env.example`):
|
|
333
356
|
|
|
334
357
|
```bash
|
|
335
|
-
|
|
358
|
+
# No API keys required for AI analysis (uses Claude Code built-in vision)
|
|
336
359
|
```
|
|
337
360
|
|
|
338
361
|
## Script Reference
|
|
@@ -350,8 +373,9 @@ GEMINI_API_KEY=your-key # Optional: enables AI structure analysis
|
|
|
350
373
|
| merge-css.js | src/core/ | Merge + deduplicate CSS |
|
|
351
374
|
| rewrite-links.js | src/core/ | Rewrite internal links |
|
|
352
375
|
| clone-site.js | bin/commands/ | Multi-page clone CLI |
|
|
353
|
-
|
|
|
354
|
-
|
|
|
376
|
+
| prompts/structure-analysis/*.md | src/ai/ | AI structure analysis prompts (Claude Code vision) |
|
|
377
|
+
| prompts/design-tokens/*.md | src/ai/ | Design token extraction prompts (Claude Code vision) |
|
|
378
|
+
| prompts/ux-audit/*.md | src/ai/ | UX audit prompts (Claude Code vision) |
|
|
355
379
|
| verify-menu.js | src/verification/ | Validate navigation structure |
|
|
356
380
|
| verify-layout.js | src/verification/ | Verify layout consistency |
|
|
357
381
|
| fetch-images.js | src/post-process/ | Fetch and optimize images |
|
package/bin/cli.js
CHANGED
|
@@ -3,15 +3,21 @@
|
|
|
3
3
|
* Design Clone Skill CLI
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* design-clone init [--force]
|
|
7
|
-
* design-clone verify
|
|
8
|
-
* design-clone
|
|
9
|
-
* design-clone
|
|
6
|
+
* design-clone init [--force] Install skill to ~/.claude/skills/
|
|
7
|
+
* design-clone verify Check installation status
|
|
8
|
+
* design-clone update [--force] Update to latest version
|
|
9
|
+
* design-clone uninstall [--yes] Remove skill installation
|
|
10
|
+
* design-clone clone-site <url> Clone multiple pages
|
|
11
|
+
* design-clone help Show help
|
|
12
|
+
* design-clone --version Show version
|
|
10
13
|
*/
|
|
11
14
|
|
|
12
15
|
import { init } from './commands/init.js';
|
|
13
16
|
import { verify } from './commands/verify.js';
|
|
14
17
|
import { help } from './commands/help.js';
|
|
18
|
+
import { uninstall } from './commands/uninstall.js';
|
|
19
|
+
import { update } from './commands/update.js';
|
|
20
|
+
import { getVersion } from './utils/version.js';
|
|
15
21
|
import { cloneSite, parseArgs as parseCloneSiteArgs, showHelp as showCloneSiteHelp } from './commands/clone-site.js';
|
|
16
22
|
|
|
17
23
|
const [,, command, ...args] = process.argv;
|
|
@@ -41,6 +47,18 @@ async function main() {
|
|
|
41
47
|
console.log(JSON.stringify(result, null, 2));
|
|
42
48
|
}
|
|
43
49
|
break;
|
|
50
|
+
case 'uninstall':
|
|
51
|
+
case 'remove':
|
|
52
|
+
await uninstall(args);
|
|
53
|
+
break;
|
|
54
|
+
case 'update':
|
|
55
|
+
case 'upgrade':
|
|
56
|
+
await update(args);
|
|
57
|
+
break;
|
|
58
|
+
case '--version':
|
|
59
|
+
case '-v':
|
|
60
|
+
console.log(`design-clone v${getVersion()}`);
|
|
61
|
+
break;
|
|
44
62
|
case 'help':
|
|
45
63
|
case '--help':
|
|
46
64
|
case '-h':
|