real-prototypes-skill 2.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/.claude/skills/agent-browser-skill/SKILL.md +252 -0
- package/.claude/skills/real-prototypes-skill/.gitignore +188 -0
- package/.claude/skills/real-prototypes-skill/ACCESSIBILITY.md +668 -0
- package/.claude/skills/real-prototypes-skill/INSTALL.md +259 -0
- package/.claude/skills/real-prototypes-skill/LICENSE +21 -0
- package/.claude/skills/real-prototypes-skill/PUBLISH.md +310 -0
- package/.claude/skills/real-prototypes-skill/QUICKSTART.md +240 -0
- package/.claude/skills/real-prototypes-skill/README.md +442 -0
- package/.claude/skills/real-prototypes-skill/SKILL.md +329 -0
- package/.claude/skills/real-prototypes-skill/capture/capture-engine.js +1153 -0
- package/.claude/skills/real-prototypes-skill/capture/config.schema.json +170 -0
- package/.claude/skills/real-prototypes-skill/cli.js +596 -0
- package/.claude/skills/real-prototypes-skill/docs/TROUBLESHOOTING.md +278 -0
- package/.claude/skills/real-prototypes-skill/docs/schemas/capture-config.md +167 -0
- package/.claude/skills/real-prototypes-skill/docs/schemas/design-tokens.md +183 -0
- package/.claude/skills/real-prototypes-skill/docs/schemas/manifest.md +169 -0
- package/.claude/skills/real-prototypes-skill/examples/CLAUDE.md.example +73 -0
- package/.claude/skills/real-prototypes-skill/examples/amazon-chatbot/CLAUDE.md +136 -0
- package/.claude/skills/real-prototypes-skill/examples/amazon-chatbot/FEATURES.md +222 -0
- package/.claude/skills/real-prototypes-skill/examples/amazon-chatbot/README.md +82 -0
- package/.claude/skills/real-prototypes-skill/examples/amazon-chatbot/references/design-tokens.json +87 -0
- package/.claude/skills/real-prototypes-skill/examples/amazon-chatbot/references/screenshots/homepage-viewport.png +0 -0
- package/.claude/skills/real-prototypes-skill/examples/amazon-chatbot/references/screenshots/prototype-chatbot-final.png +0 -0
- package/.claude/skills/real-prototypes-skill/examples/amazon-chatbot/references/screenshots/prototype-fullpage-v2.png +0 -0
- package/.claude/skills/real-prototypes-skill/references/accessibility-fixes.md +298 -0
- package/.claude/skills/real-prototypes-skill/references/accessibility-report.json +253 -0
- package/.claude/skills/real-prototypes-skill/scripts/CAPTURE-ENHANCEMENTS.md +344 -0
- package/.claude/skills/real-prototypes-skill/scripts/IMPLEMENTATION-SUMMARY.md +517 -0
- package/.claude/skills/real-prototypes-skill/scripts/QUICK-START.md +229 -0
- package/.claude/skills/real-prototypes-skill/scripts/QUICKSTART-layout-analysis.md +148 -0
- package/.claude/skills/real-prototypes-skill/scripts/README-analyze-layout.md +407 -0
- package/.claude/skills/real-prototypes-skill/scripts/analyze-layout.js +880 -0
- package/.claude/skills/real-prototypes-skill/scripts/capture-platform.js +203 -0
- package/.claude/skills/real-prototypes-skill/scripts/comprehensive-capture.js +597 -0
- package/.claude/skills/real-prototypes-skill/scripts/create-manifest.js +338 -0
- package/.claude/skills/real-prototypes-skill/scripts/enterprise-pipeline.js +428 -0
- package/.claude/skills/real-prototypes-skill/scripts/extract-tokens.js +468 -0
- package/.claude/skills/real-prototypes-skill/scripts/full-site-capture.js +738 -0
- package/.claude/skills/real-prototypes-skill/scripts/generate-tailwind-config.js +296 -0
- package/.claude/skills/real-prototypes-skill/scripts/integrate-accessibility.sh +161 -0
- package/.claude/skills/real-prototypes-skill/scripts/manifest-schema.json +302 -0
- package/.claude/skills/real-prototypes-skill/scripts/setup-prototype.sh +167 -0
- package/.claude/skills/real-prototypes-skill/scripts/test-analyze-layout.js +338 -0
- package/.claude/skills/real-prototypes-skill/scripts/test-validation.js +307 -0
- package/.claude/skills/real-prototypes-skill/scripts/validate-accessibility.js +598 -0
- package/.claude/skills/real-prototypes-skill/scripts/validate-manifest.js +499 -0
- package/.claude/skills/real-prototypes-skill/scripts/validate-output.js +361 -0
- package/.claude/skills/real-prototypes-skill/scripts/validate-prerequisites.js +319 -0
- package/.claude/skills/real-prototypes-skill/scripts/verify-layout-analysis.sh +77 -0
- package/.claude/skills/real-prototypes-skill/templates/dashboard-widget.tsx.template +91 -0
- package/.claude/skills/real-prototypes-skill/templates/data-table.tsx.template +193 -0
- package/.claude/skills/real-prototypes-skill/templates/form-section.tsx.template +250 -0
- package/.claude/skills/real-prototypes-skill/templates/modal-dialog.tsx.template +239 -0
- package/.claude/skills/real-prototypes-skill/templates/nav-item.tsx.template +265 -0
- package/.claude/skills/real-prototypes-skill/validation/validation-engine.js +559 -0
- package/.env.example +74 -0
- package/LICENSE +21 -0
- package/README.md +444 -0
- package/bin/cli.js +319 -0
- package/package.json +59 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# Quick Start - Enhanced Page Capture
|
|
2
|
+
|
|
3
|
+
## TL;DR
|
|
4
|
+
|
|
5
|
+
The enhanced capture system ensures **0% failures** and **100% fully loaded pages** before screenshots.
|
|
6
|
+
|
|
7
|
+
## Quick Setup
|
|
8
|
+
|
|
9
|
+
### 1. Configure Platform
|
|
10
|
+
|
|
11
|
+
Edit `CLAUDE.md`:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Required
|
|
15
|
+
PLATFORM_URL=https://qa.sprouts.ai/
|
|
16
|
+
PLATFORM_EMAIL=your@email.com
|
|
17
|
+
PLATFORM_PASSWORD=YourPassword
|
|
18
|
+
|
|
19
|
+
# Optional (defaults shown)
|
|
20
|
+
PAGES_TO_CAPTURE=auto
|
|
21
|
+
CAPTURE_MODE=full
|
|
22
|
+
MAX_PAGES=50
|
|
23
|
+
WAIT_AFTER_LOAD=5000
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 2. Generate Capture Script
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cd /path/to/project
|
|
30
|
+
node .claude/skills/real-prototypes-skill/scripts/full-site-capture.js
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
This creates `capture-site.sh` in your project root.
|
|
34
|
+
|
|
35
|
+
### 3. Run Capture
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
bash capture-site.sh
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## What Happens
|
|
42
|
+
|
|
43
|
+
### Wait Strategies (Automatic)
|
|
44
|
+
|
|
45
|
+
1. Initial wait: 5 seconds (configurable)
|
|
46
|
+
2. Wait for networkidle0 (all requests complete)
|
|
47
|
+
3. Wait for load event
|
|
48
|
+
4. Wait for domcontentloaded
|
|
49
|
+
|
|
50
|
+
### Pre-Screenshot Validation
|
|
51
|
+
|
|
52
|
+
Checks before capturing:
|
|
53
|
+
|
|
54
|
+
- ✓ Response status 200 OK
|
|
55
|
+
- ✓ Page title exists
|
|
56
|
+
- ✓ Document body exists
|
|
57
|
+
- ✓ Key elements loaded (main/nav/content)
|
|
58
|
+
- ✓ Page height > 500px
|
|
59
|
+
- ✓ No error messages visible
|
|
60
|
+
|
|
61
|
+
### Post-Capture Validation
|
|
62
|
+
|
|
63
|
+
Checks after capturing:
|
|
64
|
+
|
|
65
|
+
- ✓ Screenshot > 100KB
|
|
66
|
+
- ✓ HTML > 10KB
|
|
67
|
+
- ✓ Dimensions match viewport
|
|
68
|
+
|
|
69
|
+
### Retry Logic
|
|
70
|
+
|
|
71
|
+
If validation fails:
|
|
72
|
+
|
|
73
|
+
- Attempt 1: Immediate
|
|
74
|
+
- Attempt 2: Wait 1s, retry
|
|
75
|
+
- Attempt 3: Wait 2s, retry
|
|
76
|
+
- Attempt 4: Wait 4s, final attempt
|
|
77
|
+
|
|
78
|
+
## Output Files
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
references/
|
|
82
|
+
├── screenshots/ # PNG screenshots
|
|
83
|
+
├── html/ # Full HTML source
|
|
84
|
+
├── styles/ # Design tokens & CSS
|
|
85
|
+
└── capture-errors.log # Error details
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Monitoring Progress
|
|
89
|
+
|
|
90
|
+
### Console Output
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
Capturing: /dashboard -> dashboard
|
|
94
|
+
✓ Validated: Screenshot=245678 bytes, HTML=34567 bytes, Height=1240 px
|
|
95
|
+
✓ Successfully captured /dashboard
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Error Output
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
Capturing: /broken-page -> broken-page
|
|
102
|
+
⚠️ ERROR logged for /broken-page: Page height too small: 320px
|
|
103
|
+
Retry attempt 2 for /broken-page (waiting 2000ms)...
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Final Summary
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
=== CAPTURE COMPLETE ===
|
|
110
|
+
Statistics:
|
|
111
|
+
Pages Attempted: 25
|
|
112
|
+
Successful: 24
|
|
113
|
+
Failed: 1
|
|
114
|
+
Success Rate: 96%
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Common Issues & Fixes
|
|
118
|
+
|
|
119
|
+
### Issue: Timeouts
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Increase wait time
|
|
123
|
+
WAIT_AFTER_LOAD=10000
|
|
124
|
+
MAX_WAIT_TIMEOUT=15000
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Issue: Validation Failures
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Check error log
|
|
131
|
+
cat references/capture-errors.log
|
|
132
|
+
|
|
133
|
+
# Adjust thresholds
|
|
134
|
+
MIN_PAGE_HEIGHT=300
|
|
135
|
+
MIN_HTML_SIZE=5120
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Issue: 404 Errors
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Update page list in CLAUDE.md
|
|
142
|
+
PAGES_TO_CAPTURE=/dashboard,/settings,/profile
|
|
143
|
+
CAPTURE_MODE=manual
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Testing
|
|
147
|
+
|
|
148
|
+
### Test Validation Logic
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
node .claude/skills/real-prototypes-skill/scripts/test-validation.js
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Test Single Page
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# In generated capture-site.sh, run:
|
|
158
|
+
capture_page "/dashboard"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Configuration Reference
|
|
162
|
+
|
|
163
|
+
| Setting | Default | Description |
|
|
164
|
+
|---------|---------|-------------|
|
|
165
|
+
| `WAIT_AFTER_LOAD` | 5000ms | Initial wait after page load |
|
|
166
|
+
| `MAX_WAIT_TIMEOUT` | 10000ms | Maximum wait timeout |
|
|
167
|
+
| `MAX_RETRIES` | 3 | Retry attempts for 404 |
|
|
168
|
+
| `TIMEOUT_RETRIES` | 2 | Retry attempts for timeouts |
|
|
169
|
+
| `RETRY_DELAY_BASE` | 1000ms | Base delay for exponential backoff |
|
|
170
|
+
| `MIN_SCREENSHOT_SIZE` | 100KB | Minimum screenshot file size |
|
|
171
|
+
| `MIN_HTML_SIZE` | 10KB | Minimum HTML file size |
|
|
172
|
+
| `MIN_PAGE_HEIGHT` | 500px | Minimum page height |
|
|
173
|
+
|
|
174
|
+
## Success Criteria
|
|
175
|
+
|
|
176
|
+
- ✓ **0%** 404 errors (with valid page list)
|
|
177
|
+
- ✓ **100%** pages fully loaded before screenshot
|
|
178
|
+
- ✓ **95%+** first-attempt success rate
|
|
179
|
+
- ✓ **Comprehensive** error logging
|
|
180
|
+
- ✓ **Automatic** retry on failures
|
|
181
|
+
|
|
182
|
+
## Next Steps
|
|
183
|
+
|
|
184
|
+
After successful capture:
|
|
185
|
+
|
|
186
|
+
1. Review `capture-errors.log` (if any failures)
|
|
187
|
+
2. Check captured screenshots in `references/screenshots/`
|
|
188
|
+
3. Verify HTML in `references/html/`
|
|
189
|
+
4. Use captures for prototype generation
|
|
190
|
+
|
|
191
|
+
## Advanced Usage
|
|
192
|
+
|
|
193
|
+
### Custom Wait Selectors
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Wait for specific element before capture
|
|
197
|
+
agent-browser wait --selector "main[data-loaded='true']"
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Parallel Capture
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Run multiple instances for different sections
|
|
204
|
+
bash capture-site.sh --pages="/dashboard,/settings" &
|
|
205
|
+
bash capture-site.sh --pages="/profile,/reports" &
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Incremental Capture
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# Capture high-priority pages first
|
|
212
|
+
PAGES_TO_CAPTURE=/dashboard,/main,/home
|
|
213
|
+
CAPTURE_MODE=manual
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Support
|
|
217
|
+
|
|
218
|
+
For issues:
|
|
219
|
+
|
|
220
|
+
1. Check `capture-errors.log`
|
|
221
|
+
2. Run test suite: `node test-validation.js`
|
|
222
|
+
3. Review documentation: `CAPTURE-ENHANCEMENTS.md`
|
|
223
|
+
4. Test single page before full capture
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
**Version**: 2.0
|
|
228
|
+
**Status**: Production Ready
|
|
229
|
+
**Last Updated**: 2026-01-26
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Layout Analysis - Quick Start Guide
|
|
2
|
+
|
|
3
|
+
## 1-Minute Quick Start
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# Run analysis
|
|
7
|
+
node .claude/skills/real-prototypes-skill/scripts/analyze-layout.js references
|
|
8
|
+
|
|
9
|
+
# Verify output
|
|
10
|
+
./.claude/skills/real-prototypes-skill/scripts/verify-layout-analysis.sh references
|
|
11
|
+
|
|
12
|
+
# Test and view insights
|
|
13
|
+
node .claude/skills/real-prototypes-skill/scripts/test-analyze-layout.js references
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Output**: `structure-manifest.json` + 14 `component-map-*.json` files
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## What It Does
|
|
21
|
+
|
|
22
|
+
Analyzes captured HTML pages to extract:
|
|
23
|
+
|
|
24
|
+
- **Layout**: Grid, flex, positioning, containers, sidebar, header, footer
|
|
25
|
+
- **Components**: Buttons, inputs, cards, modals, navigation, tables, forms
|
|
26
|
+
- **HTML**: Semantic structure, classes, ARIA, data attributes, bounding boxes
|
|
27
|
+
- **UI Library**: Material-UI, Ant Design, Bootstrap, Tailwind, Chakra, or custom
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Key Files
|
|
32
|
+
|
|
33
|
+
| File | Purpose | Size |
|
|
34
|
+
|------|---------|------|
|
|
35
|
+
| `analyze-layout.js` | Main analysis script | 26KB |
|
|
36
|
+
| `test-analyze-layout.js` | Test/validation script | 11KB |
|
|
37
|
+
| `verify-layout-analysis.sh` | Automated verification | 1KB |
|
|
38
|
+
| `README-analyze-layout.md` | Full documentation | 11KB |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Output Files
|
|
43
|
+
|
|
44
|
+
| File | Contains |
|
|
45
|
+
|------|----------|
|
|
46
|
+
| `references/structure-manifest.json` | Aggregated analysis of all pages |
|
|
47
|
+
| `references/component-map-{page}.json` | Per-page component details (14 files) |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Example Results (Sprouts ABM)
|
|
52
|
+
|
|
53
|
+
- **Pages**: 14
|
|
54
|
+
- **UI Library**: Material-UI
|
|
55
|
+
- **Components**: 1,292 instances
|
|
56
|
+
- 894 tables
|
|
57
|
+
- 185 cards
|
|
58
|
+
- 141 buttons
|
|
59
|
+
- 72 inputs
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Use Cases
|
|
64
|
+
|
|
65
|
+
### 1. Detect UI Framework
|
|
66
|
+
```javascript
|
|
67
|
+
const manifest = require('./references/structure-manifest.json');
|
|
68
|
+
console.log(manifest.library); // "material-ui"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 2. Get Component Styles
|
|
72
|
+
```javascript
|
|
73
|
+
const manifest = require('./references/structure-manifest.json');
|
|
74
|
+
const buttonStyles = manifest.components.button.examples[0].styles;
|
|
75
|
+
// { backgroundColor: "rgb(99, 102, 241)", padding: "8px 16px", ... }
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3. Recreate Layout
|
|
79
|
+
```javascript
|
|
80
|
+
const manifest = require('./references/structure-manifest.json');
|
|
81
|
+
const layoutType = manifest.layout.type; // "sidebar-main"
|
|
82
|
+
const sidebarWidth = manifest.layout.sidebar.width; // "240px"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 4. Extract Design Tokens
|
|
86
|
+
```bash
|
|
87
|
+
# Run test script to extract colors, fonts, spacing
|
|
88
|
+
node test-analyze-layout.js references
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Integration Workflow
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
1. CAPTURE → full-site-capture.js (captures pages)
|
|
97
|
+
2. ANALYZE → analyze-layout.js (analyzes structure) ← YOU ARE HERE
|
|
98
|
+
3. EXTRACT → extract-all-styles.js (extracts CSS)
|
|
99
|
+
4. GENERATE → Use both outputs to generate prototype
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Troubleshooting
|
|
105
|
+
|
|
106
|
+
**Error: References directory not found**
|
|
107
|
+
```bash
|
|
108
|
+
# Run capture first
|
|
109
|
+
node .claude/skills/real-prototypes-skill/scripts/full-site-capture.js
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Error: No HTML files found**
|
|
113
|
+
```bash
|
|
114
|
+
# Check html/ directory exists
|
|
115
|
+
ls references/html/
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Browser launch fails**
|
|
119
|
+
```bash
|
|
120
|
+
# Install Playwright browsers
|
|
121
|
+
npx playwright install chromium
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Next Steps
|
|
127
|
+
|
|
128
|
+
1. Review `references/structure-manifest.json`
|
|
129
|
+
2. Check `references/component-map-*.json` for page details
|
|
130
|
+
3. Run style extraction: `node scripts/extract-all-styles.js`
|
|
131
|
+
4. Use outputs to generate pixel-perfect prototypes
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Documentation
|
|
136
|
+
|
|
137
|
+
- **Full Docs**: `README-analyze-layout.md`
|
|
138
|
+
- **Summary**: `/LAYOUT-ANALYSIS-SUMMARY.md`
|
|
139
|
+
- **Main README**: `/scripts/README.md`
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Key Metrics
|
|
144
|
+
|
|
145
|
+
- **Runtime**: ~45 seconds for 14 pages
|
|
146
|
+
- **Output**: ~255KB total
|
|
147
|
+
- **Components**: 1,292 cataloged
|
|
148
|
+
- **Success Rate**: 100%
|