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/docs/basic-clone.md
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# Basic Clone Workflow
|
|
2
|
-
|
|
3
|
-
Quick website design capture with screenshots and source extraction.
|
|
4
|
-
|
|
5
|
-
## When to Use
|
|
6
|
-
|
|
7
|
-
- Quick design reference/inspiration
|
|
8
|
-
- Simple single-page sites
|
|
9
|
-
- Initial exploration before pixel-perfect clone
|
|
10
|
-
|
|
11
|
-
## Steps
|
|
12
|
-
|
|
13
|
-
### 1. Capture Screenshots + Extract Source
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
node src/core/screenshot.js \
|
|
17
|
-
--url "https://example.com" \
|
|
18
|
-
--output ./cloned-design \
|
|
19
|
-
--extract-html \
|
|
20
|
-
--extract-css
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### 2. Filter Unused CSS (Optional)
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
node src/core/filter-css.js \
|
|
27
|
-
--html ./cloned-design/source.html \
|
|
28
|
-
--css ./cloned-design/source-raw.css \
|
|
29
|
-
--output ./cloned-design/source.css
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Output Files
|
|
33
|
-
|
|
34
|
-
| File | Description |
|
|
35
|
-
|------|-------------|
|
|
36
|
-
| desktop.png | 1920x1080 viewport screenshot |
|
|
37
|
-
| tablet.png | 768x1024 viewport screenshot |
|
|
38
|
-
| mobile.png | 375x812 viewport screenshot |
|
|
39
|
-
| source.html | Cleaned HTML (inline styles removed) |
|
|
40
|
-
| source-raw.css | All extracted CSS (unfiltered) |
|
|
41
|
-
| source.css | Filtered CSS (after filter-css.js) |
|
|
42
|
-
|
|
43
|
-
## Common Options
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
# Custom viewports
|
|
47
|
-
--viewports '[{"width":1440,"height":900,"name":"laptop"}]'
|
|
48
|
-
|
|
49
|
-
# Full page capture
|
|
50
|
-
--full-page
|
|
51
|
-
|
|
52
|
-
# Wait for animations
|
|
53
|
-
--wait 3000
|
|
54
|
-
|
|
55
|
-
# Skip HTML extraction
|
|
56
|
-
--extract-html false
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Tips
|
|
60
|
-
|
|
61
|
-
- Add `--wait 2000` for sites with loading animations
|
|
62
|
-
- Use `--full-page` for long scrolling pages
|
|
63
|
-
- Check `source.html` for missing sections before pixel-perfect
|
package/docs/cli-reference.md
DELETED
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
# CLI Reference
|
|
2
|
-
|
|
3
|
-
All script options and parameters.
|
|
4
|
-
|
|
5
|
-
## screenshot.js
|
|
6
|
-
|
|
7
|
-
Core screenshot and extraction tool.
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
node src/core/screenshot.js [options]
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
| Option | Type | Default | Description |
|
|
14
|
-
|--------|------|---------|-------------|
|
|
15
|
-
| --url | string | required | Target URL |
|
|
16
|
-
| --output | string | required | Output directory |
|
|
17
|
-
| --viewports | string | all | Comma-separated: desktop,tablet,mobile |
|
|
18
|
-
| --full-page | bool | true | Capture full page height |
|
|
19
|
-
| --max-size | number | 5 | Max file size in MB before compression |
|
|
20
|
-
| --headless | bool | false | Run in headless mode (desktop always uses headless) |
|
|
21
|
-
| --scroll-delay | number | 1500 | Pause time in ms between scroll steps for lazy content |
|
|
22
|
-
| --close | bool | false | Close browser after capture (false keeps session) |
|
|
23
|
-
| --extract-html | bool | false | Extract cleaned HTML |
|
|
24
|
-
| --extract-css | bool | false | Extract all CSS from page |
|
|
25
|
-
| --extract-animations | bool | true* | Extract @keyframes and transitions (enabled with --extract-css) |
|
|
26
|
-
| --filter-unused | bool | true | Filter CSS to remove unused selectors |
|
|
27
|
-
| --capture-hover | bool | false | Capture hover state screenshots and generate :hover CSS |
|
|
28
|
-
| --no-semantic | bool | false | Disable WordPress semantic HTML enhancement (Phase 3) |
|
|
29
|
-
| --verbose | bool | false | Verbose logging |
|
|
30
|
-
|
|
31
|
-
*Default true when --extract-css is enabled, can be disabled with `--extract-animations false`
|
|
32
|
-
|
|
33
|
-
**Output**: JSON with screenshot paths and metadata. Includes `browserRestarts` count tracking for stability monitoring. When `--capture-hover` is enabled, also includes hover state results in output. When semantic enhancement is enabled (default), output includes `semanticStats` with enhancement details (sections enhanced, IDs/classes/roles added).
|
|
34
|
-
|
|
35
|
-
### Semantic HTML Enhancement (Phase 3)
|
|
36
|
-
|
|
37
|
-
Semantic HTML enhancement is enabled by default when extracting HTML. It injects WordPress-compatible semantic IDs, classes, and ARIA roles into the extracted HTML.
|
|
38
|
-
|
|
39
|
-
**What's Added**:
|
|
40
|
-
- **IDs**: `site-header`, `main-content`, `site-footer`, `site-navigation`, `primary-sidebar`, `hero-section`
|
|
41
|
-
- **Classes**: `site-header`, `main-navigation`, `nav-menu`, `site-main`, `content-area`, `widget-area`, `sidebar`, `site-footer`, `hero`
|
|
42
|
-
- **ARIA Roles**: `banner` (header), `navigation` (nav), `main`, `complementary` (sidebar), `contentinfo` (footer)
|
|
43
|
-
|
|
44
|
-
**Detection Priority**:
|
|
45
|
-
1. Semantic HTML tags (`<header>`, `<nav>`, `<main>`, `<aside>`, `<footer>`)
|
|
46
|
-
2. ARIA role attributes (`banner`, `navigation`, `main`, `complementary`, `contentinfo`)
|
|
47
|
-
3. Class patterns (header, nav, main, sidebar, footer, hero)
|
|
48
|
-
|
|
49
|
-
**Usage**:
|
|
50
|
-
```bash
|
|
51
|
-
# Enable semantic enhancement (default)
|
|
52
|
-
node src/core/screenshot.js --url https://example.com --output ./out --extract-html
|
|
53
|
-
|
|
54
|
-
# Disable semantic enhancement
|
|
55
|
-
node src/core/screenshot.js --url https://example.com --output ./out --extract-html --no-semantic
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
**Example Output Metadata**:
|
|
59
|
-
```json
|
|
60
|
-
{
|
|
61
|
-
"html": "path/to/source.html",
|
|
62
|
-
"semanticStats": {
|
|
63
|
-
"sectionsEnhanced": 5,
|
|
64
|
-
"idsAdded": 3,
|
|
65
|
-
"classesAdded": 4,
|
|
66
|
-
"rolesAdded": 2,
|
|
67
|
-
"warnings": []
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## filter-css.js
|
|
73
|
-
|
|
74
|
-
Remove unused CSS selectors.
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
node src/core/filter-css.js --html FILE --css FILE --output FILE [--verbose]
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
| Option | Required | Description |
|
|
81
|
-
|--------|----------|-------------|
|
|
82
|
-
| --html | yes | Source HTML file |
|
|
83
|
-
| --css | yes | Raw CSS file |
|
|
84
|
-
| --output | yes | Filtered CSS output |
|
|
85
|
-
| --verbose | no | Show stats |
|
|
86
|
-
|
|
87
|
-
## analyze-structure.py
|
|
88
|
-
|
|
89
|
-
AI structure analysis with Gemini.
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
python src/ai/analyze-structure.py -s SCREENSHOT -o OUTPUT [options]
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
| Option | Required | Description |
|
|
96
|
-
|--------|----------|-------------|
|
|
97
|
-
| -s, --screenshot | yes | Desktop screenshot |
|
|
98
|
-
| -o, --output | yes | Output directory |
|
|
99
|
-
| --html | no | Source HTML (improves accuracy) |
|
|
100
|
-
| --css | no | Source CSS (improves accuracy) |
|
|
101
|
-
| --model | no | Gemini model (default: gemini-2.5-flash) |
|
|
102
|
-
| -v, --verbose | no | Verbose output |
|
|
103
|
-
|
|
104
|
-
## extract-design-tokens.py
|
|
105
|
-
|
|
106
|
-
Extract colors, typography, spacing.
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
python src/ai/extract-design-tokens.py -s SCREENSHOT -o OUTPUT [options]
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Same options as analyze-structure.py.
|
|
113
|
-
|
|
114
|
-
## extract-assets.js
|
|
115
|
-
|
|
116
|
-
Download images, fonts, icons.
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
node src/core/extract-assets.js --url URL --output DIR
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## verify-menu.js
|
|
123
|
-
|
|
124
|
-
Validate navigation structure.
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
node src/verification/verify-menu.js --html FILE [--url URL] [--output DIR] [--verbose]
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
| Option | Description |
|
|
131
|
-
|--------|-------------|
|
|
132
|
-
| --html | Path to HTML file |
|
|
133
|
-
| --url | URL to test (alternative to --html) |
|
|
134
|
-
| --output | Output directory for screenshots |
|
|
135
|
-
| --verbose | Show detailed progress |
|
|
136
|
-
|
|
137
|
-
## verify-header.js
|
|
138
|
-
|
|
139
|
-
Verify header components (Phase 1).
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
node src/verification/verify-header.js --html FILE [--url URL] [--output DIR] [--verbose]
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
Tests: logo presence, navigation visibility, CTA buttons, sticky/fixed behavior, z-index layering, height consistency.
|
|
146
|
-
|
|
147
|
-
## verify-footer.js
|
|
148
|
-
|
|
149
|
-
Verify footer components (Phase 1).
|
|
150
|
-
|
|
151
|
-
```bash
|
|
152
|
-
node src/verification/verify-footer.js --html FILE [--url URL] [--output DIR] [--verbose]
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
Tests: position at bottom, multi-column layout, link sections, copyright text, social icons, background contrast.
|
|
156
|
-
|
|
157
|
-
## verify-slider.js
|
|
158
|
-
|
|
159
|
-
Verify slider/carousel components (Phase 1).
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
node src/verification/verify-slider.js --html FILE [--url URL] [--output DIR] [--verbose]
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
Tests: library detection (Swiper, Slick, Owl, native), navigation arrows, pagination dots, autoplay behavior, current slide indicator.
|
|
166
|
-
|
|
167
|
-
## generate-audit-report.js
|
|
168
|
-
|
|
169
|
-
Aggregate verification results into consolidated report (Phase 1).
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
node src/verification/generate-audit-report.js --dir DIR [--output FILE] [--verbose]
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
| Option | Description |
|
|
176
|
-
|--------|-------------|
|
|
177
|
-
| --dir | Directory containing verification JSON results |
|
|
178
|
-
| --output | Output path for report (default: component-audit.md) |
|
|
179
|
-
| --verbose | Show detailed progress |
|
|
180
|
-
|
|
181
|
-
Output: Markdown report with summary table, side-by-side screenshots, responsive analysis, CSS suggestions.
|
|
182
|
-
|
|
183
|
-
## verify-layout.js
|
|
184
|
-
|
|
185
|
-
Verify layout consistency.
|
|
186
|
-
|
|
187
|
-
```bash
|
|
188
|
-
node src/verification/verify-layout.js --html FILE
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
## state-capture.js
|
|
192
|
-
|
|
193
|
-
Capture hover states for interactive elements.
|
|
194
|
-
|
|
195
|
-
Used internally by screenshot.js with `--capture-hover` flag.
|
|
196
|
-
|
|
197
|
-
| Export | Description |
|
|
198
|
-
|--------|-------------|
|
|
199
|
-
| `captureAllHoverStates(page, cssString, outputDir)` | Detect interactive elements and capture normal/hover screenshots |
|
|
200
|
-
| `captureHoverState(page, selector, outputDir, index)` | Capture hover state for a single element |
|
|
201
|
-
| `generateHoverCss(results)` | Generate `:hover` CSS rules from captured style diffs |
|
|
202
|
-
| `detectInteractiveElements(page, cssString)` | Detect interactive elements via CSS analysis and DOM query |
|
|
203
|
-
|
|
204
|
-
**Key Features:**
|
|
205
|
-
- Dual detection: CSS-based (`:hover` selectors) and DOM-based (interactive elements, transitions)
|
|
206
|
-
- Per-element style diff capture (backgroundColor, color, transform, boxShadow, etc.)
|
|
207
|
-
- Automatic screenshot pair generation (normal + hover states)
|
|
208
|
-
- CSS rule generation from detected style changes
|
|
209
|
-
- Validates selectors and skips hidden/invisible elements
|
|
210
|
-
|
|
211
|
-
## ux-audit.js
|
|
212
|
-
|
|
213
|
-
UX quality assessment using Gemini Vision AI (Phase 2).
|
|
214
|
-
|
|
215
|
-
```bash
|
|
216
|
-
node src/ai/ux-audit.js --screenshots <dir> [--output <dir>] [--url <url>] [--verbose]
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
| Option | Required | Description |
|
|
220
|
-
|--------|----------|-------------|
|
|
221
|
-
| --screenshots | yes | Directory containing viewport screenshots (desktop.png, tablet.png, mobile.png) |
|
|
222
|
-
| --output | no | Output directory for report and JSON results (default: same as screenshots) |
|
|
223
|
-
| --url | no | Original URL (for report metadata) |
|
|
224
|
-
| --verbose | no | Show detailed progress |
|
|
225
|
-
|
|
226
|
-
**Requires**: GEMINI_API_KEY or GOOGLE_API_KEY environment variable
|
|
227
|
-
|
|
228
|
-
**Output**:
|
|
229
|
-
- `ux-audit.md`: Markdown report with scores, issues, and recommendations
|
|
230
|
-
- `ux-audit.json`: Structured results (aggregated scores, viewport breakdown, issues, recommendations)
|
|
231
|
-
|
|
232
|
-
**Evaluation Categories** (0-100 score each):
|
|
233
|
-
1. Visual Hierarchy - Content prominence, scanning patterns, call-to-action visibility
|
|
234
|
-
2. Navigation - Touch targets, menu discoverability, current page indicator
|
|
235
|
-
3. Typography - Text size, line height, contrast ratio, readability
|
|
236
|
-
4. Spacing - Padding/margins, element breathing room, touch target spacing
|
|
237
|
-
5. Interactive Elements - Button affordance, link distinguishability, focus states
|
|
238
|
-
6. Responsive - Content reflow, no horizontal scroll, text truncation, breakpoint transitions
|
|
239
|
-
|
|
240
|
-
**Viewport Analysis**: Evaluates all three viewports (desktop: 1920×1080, tablet: 768×1024, mobile: 375×812) and generates weighted scores (desktop 40%, tablet 30%, mobile 30%).
|
|
241
|
-
|
|
242
|
-
**Issue Severity Levels**:
|
|
243
|
-
- Critical (0-30 score): Blocks tasks or causes confusion
|
|
244
|
-
- Major (31-60 score): Degrades experience significantly
|
|
245
|
-
- Minor (61-80 score): Polish improvements
|
|
246
|
-
|
|
247
|
-
**Scoring Scale**:
|
|
248
|
-
- 90-100: Excellent, industry-leading UX
|
|
249
|
-
- 70-89: Good, meets modern standards
|
|
250
|
-
- 50-69: Adequate, room for improvement
|
|
251
|
-
- 30-49: Poor, significant issues
|
|
252
|
-
- 0-29: Critical, requires immediate attention
|
|
253
|
-
|
|
254
|
-
## clone-site.js
|
|
255
|
-
|
|
256
|
-
Clone multiple pages from website with integrated UX audit (Phase 2).
|
|
257
|
-
|
|
258
|
-
```bash
|
|
259
|
-
design-clone clone-site <url> [options]
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
| Option | Description |
|
|
263
|
-
|--------|-------------|
|
|
264
|
-
| --pages <paths> | Comma-separated paths (e.g., /,/about,/contact) |
|
|
265
|
-
| --max-pages <n> | Maximum pages to auto-discover (default: 10) |
|
|
266
|
-
| --viewports <list> | Viewport list (default: desktop,tablet,mobile) |
|
|
267
|
-
| --output <dir> | Custom output directory |
|
|
268
|
-
| --ai | Extract design tokens using Gemini AI (requires GEMINI_API_KEY) |
|
|
269
|
-
| --ux-audit | Run UX audit using Gemini Vision (requires GEMINI_API_KEY) |
|
|
270
|
-
| --yes, -y | Skip confirmation prompt |
|
|
271
|
-
|
|
272
|
-
**Integrated Workflow** (when using --ux-audit):
|
|
273
|
-
1. Discover or use manual pages
|
|
274
|
-
2. Capture screenshots across viewports
|
|
275
|
-
3. Merge CSS files
|
|
276
|
-
4. Extract design tokens (with --ai)
|
|
277
|
-
5. **Run UX audit** (with --ux-audit) - Analyzes homepage screenshots via Gemini Vision
|
|
278
|
-
6. Rewrite links
|
|
279
|
-
7. Generate manifest
|
|
280
|
-
|
|
281
|
-
**UX Audit Output**: When enabled, generates `analysis/ux-audit.md` and `analysis/ux-audit.json` in output directory.
|
|
282
|
-
|
|
283
|
-
**Examples**:
|
|
284
|
-
```bash
|
|
285
|
-
design-clone clone-site https://example.com --ux-audit
|
|
286
|
-
design-clone clone-site https://example.com --pages /,/about,/contact --ux-audit
|
|
287
|
-
design-clone clone-site https://example.com --ai --ux-audit
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
## ux_audit.py
|
|
291
|
-
|
|
292
|
-
Python module providing UX audit prompts for Gemini Vision integration.
|
|
293
|
-
|
|
294
|
-
```python
|
|
295
|
-
from src.ai.prompts.ux_audit import build_ux_audit_prompt, build_aggregation_prompt
|
|
296
|
-
|
|
297
|
-
# Build viewport-specific prompt
|
|
298
|
-
prompt = build_ux_audit_prompt(viewport='mobile')
|
|
299
|
-
|
|
300
|
-
# Build aggregation prompt for multiple viewports
|
|
301
|
-
aggregation = build_aggregation_prompt(desktop_results, tablet_results, mobile_results)
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
**Functions**:
|
|
305
|
-
- `build_ux_audit_prompt(viewport)` - Build prompt with viewport-specific checks (mobile/tablet/desktop)
|
|
306
|
-
- `build_aggregation_prompt(desktop, tablet, mobile)` - Combine viewport results into unified assessment
|
|
307
|
-
|
|
308
|
-
**Constants**:
|
|
309
|
-
- `UX_AUDIT_PROMPT` - Base UX evaluation prompt (6 categories)
|
|
310
|
-
- `VIEWPORT_CONTEXT` - Dictionary of viewport-specific evaluation criteria
|
|
311
|
-
- `AGGREGATION_PROMPT` - Template for combining viewport results with weighted averaging
|
|
312
|
-
|
|
313
|
-
**Viewport Weighting**:
|
|
314
|
-
- Desktop: 40% (primary interaction model)
|
|
315
|
-
- Tablet: 30% (hybrid interaction)
|
|
316
|
-
- Mobile: 30% (touch-first)
|