real-prototypes-skill 0.1.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 +375 -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,278 @@
|
|
|
1
|
+
# Troubleshooting Guide
|
|
2
|
+
|
|
3
|
+
Common issues and solutions for the real-prototypes-skill capture system.
|
|
4
|
+
|
|
5
|
+
## Authentication Issues
|
|
6
|
+
|
|
7
|
+
### "Authentication failed - still on login page"
|
|
8
|
+
|
|
9
|
+
**Possible causes:**
|
|
10
|
+
1. Incorrect credentials
|
|
11
|
+
2. CAPTCHA or 2FA required
|
|
12
|
+
3. Form selectors not matching
|
|
13
|
+
4. Account locked or needs verification
|
|
14
|
+
|
|
15
|
+
**Solutions:**
|
|
16
|
+
|
|
17
|
+
1. **Verify credentials**
|
|
18
|
+
```bash
|
|
19
|
+
# Check environment variables are set
|
|
20
|
+
echo $PLATFORM_EMAIL
|
|
21
|
+
echo $PLATFORM_PASSWORD
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
2. **Use explicit CSS selectors** in your config:
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"auth": {
|
|
28
|
+
"credentials": {
|
|
29
|
+
"emailSelector": "#email",
|
|
30
|
+
"passwordSelector": "#password",
|
|
31
|
+
"submitSelector": "button[type='submit']"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
3. **Run with headed browser** to see what's happening:
|
|
38
|
+
```bash
|
|
39
|
+
agent-browser open https://your-platform.com/login --headed
|
|
40
|
+
agent-browser snapshot -i
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
4. **Check for CAPTCHA** - If present, you may need to use interactive mode or pre-authenticate manually.
|
|
44
|
+
|
|
45
|
+
### "Could not find email/username field"
|
|
46
|
+
|
|
47
|
+
**Cause:** The capture engine couldn't identify the email field in the login form.
|
|
48
|
+
|
|
49
|
+
**Solutions:**
|
|
50
|
+
|
|
51
|
+
1. **Inspect the login page** to find correct selectors:
|
|
52
|
+
```bash
|
|
53
|
+
agent-browser open https://your-platform.com/login
|
|
54
|
+
agent-browser snapshot -i
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
2. **Use explicit selector**:
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"auth": {
|
|
61
|
+
"credentials": {
|
|
62
|
+
"emailSelector": "input[name='username']"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
3. **Common selector patterns**:
|
|
69
|
+
- `#email`, `#username`, `#login-email`
|
|
70
|
+
- `[name='email']`, `[name='username']`
|
|
71
|
+
- `[type='email']`
|
|
72
|
+
- `[placeholder*='email']`
|
|
73
|
+
|
|
74
|
+
### "strict mode violation: getByText resolved to 2 elements"
|
|
75
|
+
|
|
76
|
+
**Cause:** Multiple elements have the same text (e.g., "Sign in" appears twice).
|
|
77
|
+
|
|
78
|
+
**Solution:** Use CSS selector instead of text-based matching:
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"auth": {
|
|
82
|
+
"credentials": {
|
|
83
|
+
"submitSelector": "form button[type='submit']"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Capture Issues
|
|
90
|
+
|
|
91
|
+
### "No pages discovered"
|
|
92
|
+
|
|
93
|
+
**Possible causes:**
|
|
94
|
+
1. Authentication failed silently
|
|
95
|
+
2. Starting page has no links
|
|
96
|
+
3. All links are excluded
|
|
97
|
+
|
|
98
|
+
**Solutions:**
|
|
99
|
+
|
|
100
|
+
1. **Check authentication** worked:
|
|
101
|
+
```bash
|
|
102
|
+
agent-browser get url # Should not be login page
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
2. **Use manual mode** with explicit pages:
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"capture": {
|
|
109
|
+
"mode": "manual",
|
|
110
|
+
"include": ["/dashboard", "/settings", "/accounts"]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
3. **Verify exclusion patterns** aren't too broad:
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"capture": {
|
|
119
|
+
"exclude": ["/logout"] // Don't exclude too much
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### "Failed to capture [page]: timeout"
|
|
125
|
+
|
|
126
|
+
**Cause:** Page took too long to load or element wasn't found.
|
|
127
|
+
|
|
128
|
+
**Solutions:**
|
|
129
|
+
|
|
130
|
+
1. **Increase wait times**:
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"capture": {
|
|
134
|
+
"waitAfterLoad": 5000,
|
|
135
|
+
"waitAfterInteraction": 2000
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
2. **Check for slow-loading content** (SPAs, infinite scroll)
|
|
141
|
+
|
|
142
|
+
3. **Reduce maximum pages** to prevent timeout accumulation
|
|
143
|
+
|
|
144
|
+
### "Screenshots missing or corrupt"
|
|
145
|
+
|
|
146
|
+
**Possible causes:**
|
|
147
|
+
1. Disk full
|
|
148
|
+
2. Permission issues
|
|
149
|
+
3. Path too long (Windows)
|
|
150
|
+
|
|
151
|
+
**Solutions:**
|
|
152
|
+
|
|
153
|
+
1. Check disk space
|
|
154
|
+
2. Verify output directory is writable:
|
|
155
|
+
```bash
|
|
156
|
+
mkdir -p ./references/screenshots
|
|
157
|
+
touch ./references/screenshots/test.txt
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Validation Failures
|
|
161
|
+
|
|
162
|
+
### "Page entries missing 'name' field"
|
|
163
|
+
|
|
164
|
+
**Cause:** The manifest.json has malformed page entries.
|
|
165
|
+
|
|
166
|
+
**Solution:** Regenerate the manifest by running capture again. Each page needs:
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"name": "page-name",
|
|
170
|
+
"url": "/path",
|
|
171
|
+
"screenshot": "screenshots/page-name-desktop.png"
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### "Minimum pages not met"
|
|
176
|
+
|
|
177
|
+
**Cause:** Fewer than 5 pages were captured (default minimum).
|
|
178
|
+
|
|
179
|
+
**Solutions:**
|
|
180
|
+
|
|
181
|
+
1. **Check authentication** - may have failed silently
|
|
182
|
+
2. **Use hybrid mode** to include specific pages:
|
|
183
|
+
```json
|
|
184
|
+
{
|
|
185
|
+
"capture": {
|
|
186
|
+
"mode": "hybrid",
|
|
187
|
+
"include": ["/dashboard", "/settings", "/profile", "/accounts", "/contacts"]
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
3. **Lower the threshold** (not recommended for production):
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"validation": {
|
|
195
|
+
"minPages": 3
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### "Insufficient colors extracted"
|
|
201
|
+
|
|
202
|
+
**Cause:** HTML capture didn't find enough color values.
|
|
203
|
+
|
|
204
|
+
**Solutions:**
|
|
205
|
+
|
|
206
|
+
1. **Ensure HTML capture is enabled**:
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"output": {
|
|
210
|
+
"html": true
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
2. **Check that pages have actual content** (not just loading spinners)
|
|
216
|
+
|
|
217
|
+
3. **Manually create design-tokens.json** based on the platform's style guide
|
|
218
|
+
|
|
219
|
+
### "Default Tailwind colors found in prototype"
|
|
220
|
+
|
|
221
|
+
**Cause:** Generated code uses colors like `bg-blue-500` instead of custom colors.
|
|
222
|
+
|
|
223
|
+
**Solution:** Update the prototype to use only colors from design-tokens.json:
|
|
224
|
+
```jsx
|
|
225
|
+
// Bad
|
|
226
|
+
<button className="bg-blue-500">
|
|
227
|
+
|
|
228
|
+
// Good
|
|
229
|
+
<button style={{ backgroundColor: '#1a73e8' }}>
|
|
230
|
+
|
|
231
|
+
// Or define custom colors in tailwind.config.js
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Browser Issues
|
|
235
|
+
|
|
236
|
+
### "agent-browser command not found"
|
|
237
|
+
|
|
238
|
+
**Solution:** Install the agent-browser-skill:
|
|
239
|
+
```bash
|
|
240
|
+
npm install -g agent-browser
|
|
241
|
+
# or
|
|
242
|
+
npx agent-browser open https://example.com
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### "Browser window doesn't open"
|
|
246
|
+
|
|
247
|
+
**Cause:** Running in headless mode by default.
|
|
248
|
+
|
|
249
|
+
**Solution:** Use `--headed` flag for debugging:
|
|
250
|
+
```bash
|
|
251
|
+
agent-browser open https://example.com --headed
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### "Failed to read: Resource temporarily unavailable"
|
|
255
|
+
|
|
256
|
+
**Cause:** Another process is using the browser or system resources.
|
|
257
|
+
|
|
258
|
+
**Solutions:**
|
|
259
|
+
1. Close other browser automation processes
|
|
260
|
+
2. Restart and try again
|
|
261
|
+
3. Check system memory usage
|
|
262
|
+
|
|
263
|
+
## Getting Help
|
|
264
|
+
|
|
265
|
+
If you're still stuck:
|
|
266
|
+
|
|
267
|
+
1. **Enable verbose logging** by examining the snapshot:
|
|
268
|
+
```bash
|
|
269
|
+
agent-browser snapshot -i > debug-snapshot.txt
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
2. **Check the agent-browser skill documentation** for command options
|
|
273
|
+
|
|
274
|
+
3. **File an issue** with:
|
|
275
|
+
- Config file (redact credentials)
|
|
276
|
+
- Error message
|
|
277
|
+
- Platform URL (if public)
|
|
278
|
+
- Browser snapshot output
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Capture Configuration Schema
|
|
2
|
+
|
|
3
|
+
The capture configuration file defines how the platform capture engine discovers, authenticates, and captures pages from a target platform.
|
|
4
|
+
|
|
5
|
+
## Complete Example
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"platform": {
|
|
10
|
+
"name": "My Platform",
|
|
11
|
+
"baseUrl": "https://app.example.com"
|
|
12
|
+
},
|
|
13
|
+
"auth": {
|
|
14
|
+
"type": "form",
|
|
15
|
+
"loginUrl": "/login",
|
|
16
|
+
"credentials": {
|
|
17
|
+
"emailField": "Email",
|
|
18
|
+
"emailSelector": "#email",
|
|
19
|
+
"passwordField": "Password",
|
|
20
|
+
"passwordSelector": "#password",
|
|
21
|
+
"submitButton": "Sign in",
|
|
22
|
+
"submitSelector": "button[type='submit']"
|
|
23
|
+
},
|
|
24
|
+
"successUrl": "/dashboard",
|
|
25
|
+
"waitAfterLogin": 3000
|
|
26
|
+
},
|
|
27
|
+
"capture": {
|
|
28
|
+
"mode": "auto",
|
|
29
|
+
"maxPages": 100,
|
|
30
|
+
"maxDepth": 5,
|
|
31
|
+
"viewports": [
|
|
32
|
+
{ "name": "desktop", "width": 1920, "height": 1080 },
|
|
33
|
+
{ "name": "tablet", "width": 768, "height": 1024 },
|
|
34
|
+
{ "name": "mobile", "width": 375, "height": 812 }
|
|
35
|
+
],
|
|
36
|
+
"interactions": {
|
|
37
|
+
"clickButtons": true,
|
|
38
|
+
"clickDropdowns": true,
|
|
39
|
+
"clickTabs": true,
|
|
40
|
+
"clickTableRows": true,
|
|
41
|
+
"clickModals": true
|
|
42
|
+
},
|
|
43
|
+
"include": ["/settings", "/profile"],
|
|
44
|
+
"exclude": ["/logout", "/signout", "/delete"],
|
|
45
|
+
"waitAfterLoad": 2000,
|
|
46
|
+
"waitAfterInteraction": 1000
|
|
47
|
+
},
|
|
48
|
+
"output": {
|
|
49
|
+
"directory": "./references",
|
|
50
|
+
"screenshots": true,
|
|
51
|
+
"html": true,
|
|
52
|
+
"designTokens": true
|
|
53
|
+
},
|
|
54
|
+
"validation": {
|
|
55
|
+
"minPages": 5,
|
|
56
|
+
"minColors": 10,
|
|
57
|
+
"requireDetailPages": true,
|
|
58
|
+
"requireAllTabs": true
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Schema Reference
|
|
64
|
+
|
|
65
|
+
### `platform` (required)
|
|
66
|
+
|
|
67
|
+
| Field | Type | Required | Description |
|
|
68
|
+
|-------|------|----------|-------------|
|
|
69
|
+
| `name` | string | Yes | Human-readable name of the platform |
|
|
70
|
+
| `baseUrl` | string | Yes | Base URL of the platform (e.g., `https://app.example.com`) |
|
|
71
|
+
|
|
72
|
+
### `auth`
|
|
73
|
+
|
|
74
|
+
| Field | Type | Required | Default | Description |
|
|
75
|
+
|-------|------|----------|---------|-------------|
|
|
76
|
+
| `type` | string | No | `"form"` | Authentication type: `"form"`, `"none"`, or `"oauth"` |
|
|
77
|
+
| `loginUrl` | string | No | `"/login"` | Path to the login page |
|
|
78
|
+
| `credentials` | object | No | - | Login form configuration (see below) |
|
|
79
|
+
| `successUrl` | string | No | - | URL pattern to verify successful login |
|
|
80
|
+
| `waitAfterLogin` | number | No | `3000` | Milliseconds to wait after login attempt |
|
|
81
|
+
|
|
82
|
+
#### `auth.credentials`
|
|
83
|
+
|
|
84
|
+
| Field | Type | Description |
|
|
85
|
+
|-------|------|-------------|
|
|
86
|
+
| `emailField` | string | Label text for email/username field (e.g., `"Email"`) |
|
|
87
|
+
| `emailSelector` | string | CSS selector for email field (e.g., `"#email"`, `"[name='email']"`) |
|
|
88
|
+
| `passwordField` | string | Label text for password field |
|
|
89
|
+
| `passwordSelector` | string | CSS selector for password field |
|
|
90
|
+
| `submitButton` | string | Text on submit button (e.g., `"Sign in"`) |
|
|
91
|
+
| `submitSelector` | string | CSS selector for submit button |
|
|
92
|
+
|
|
93
|
+
**Note:** You can use either `*Field` (label-based) or `*Selector` (CSS-based) fields. CSS selectors are more reliable for complex forms.
|
|
94
|
+
|
|
95
|
+
### `capture`
|
|
96
|
+
|
|
97
|
+
| Field | Type | Default | Description |
|
|
98
|
+
|-------|------|---------|-------------|
|
|
99
|
+
| `mode` | string | `"auto"` | `"auto"` (discover all), `"manual"` (only include list), `"hybrid"` (both) |
|
|
100
|
+
| `maxPages` | number | `100` | Maximum pages to capture |
|
|
101
|
+
| `maxDepth` | number | `5` | Maximum link depth to follow |
|
|
102
|
+
| `viewports` | array | Desktop only | List of viewport configurations |
|
|
103
|
+
| `interactions` | object | All true | Which interactive elements to capture |
|
|
104
|
+
| `include` | array | `[]` | URL paths to always include (for manual/hybrid mode) |
|
|
105
|
+
| `exclude` | array | Common logout paths | URL patterns to skip |
|
|
106
|
+
| `waitAfterLoad` | number | `2000` | Ms to wait after page load |
|
|
107
|
+
| `waitAfterInteraction` | number | `1000` | Ms to wait after clicking elements |
|
|
108
|
+
|
|
109
|
+
**Backwards compatibility:** `manualPages` is accepted as an alias for `include`.
|
|
110
|
+
|
|
111
|
+
#### `capture.viewports[]`
|
|
112
|
+
|
|
113
|
+
| Field | Type | Required | Description |
|
|
114
|
+
|-------|------|----------|-------------|
|
|
115
|
+
| `name` | string | Yes | Viewport name (used in filename) |
|
|
116
|
+
| `width` | number | Yes | Viewport width in pixels |
|
|
117
|
+
| `height` | number | Yes | Viewport height in pixels |
|
|
118
|
+
|
|
119
|
+
#### `capture.interactions`
|
|
120
|
+
|
|
121
|
+
| Field | Type | Default | Description |
|
|
122
|
+
|-------|------|---------|-------------|
|
|
123
|
+
| `clickButtons` | boolean | `true` | Capture button click states |
|
|
124
|
+
| `clickDropdowns` | boolean | `true` | Open and capture dropdowns |
|
|
125
|
+
| `clickTabs` | boolean | `true` | Click through tab interfaces |
|
|
126
|
+
| `clickTableRows` | boolean | `true` | Click table rows to discover detail pages |
|
|
127
|
+
| `clickModals` | boolean | `true` | Open and capture modals |
|
|
128
|
+
|
|
129
|
+
### `output`
|
|
130
|
+
|
|
131
|
+
| Field | Type | Default | Description |
|
|
132
|
+
|-------|------|---------|-------------|
|
|
133
|
+
| `directory` | string | `"./references"` | Output directory for captured assets |
|
|
134
|
+
| `screenshots` | boolean | `true` | Capture PNG screenshots |
|
|
135
|
+
| `html` | boolean | `true` | Capture raw HTML |
|
|
136
|
+
| `designTokens` | boolean | `true` | Extract design tokens (colors, fonts) |
|
|
137
|
+
|
|
138
|
+
### `validation`
|
|
139
|
+
|
|
140
|
+
| Field | Type | Default | Description |
|
|
141
|
+
|-------|------|---------|-------------|
|
|
142
|
+
| `minPages` | number | `5` | Minimum pages required for valid capture |
|
|
143
|
+
| `minColors` | number | `10` | Minimum colors to extract |
|
|
144
|
+
| `requireDetailPages` | boolean | `true` | Require detail pages for list views |
|
|
145
|
+
| `requireAllTabs` | boolean | `true` | Require all tabs to be captured |
|
|
146
|
+
|
|
147
|
+
## Environment Variables
|
|
148
|
+
|
|
149
|
+
Credentials can be provided via environment variables instead of config:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
export PLATFORM_EMAIL=user@example.com
|
|
153
|
+
export PLATFORM_PASSWORD=secretpassword
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
These override any values in the config file.
|
|
157
|
+
|
|
158
|
+
## Selector Strategy
|
|
159
|
+
|
|
160
|
+
The capture engine tries selectors in this order:
|
|
161
|
+
|
|
162
|
+
1. **Explicit CSS selector** (`emailSelector`, `passwordSelector`, `submitSelector`)
|
|
163
|
+
2. **Snapshot refs** (automatically detected from page structure)
|
|
164
|
+
3. **Label text** (`emailField`, `passwordField`)
|
|
165
|
+
4. **Common patterns** (input types, common IDs)
|
|
166
|
+
|
|
167
|
+
For best results on complex forms, provide explicit CSS selectors.
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Design Tokens Schema
|
|
2
|
+
|
|
3
|
+
The `design-tokens.json` file contains colors, fonts, and other design values extracted from captured HTML. This file is essential for generating prototypes that match the original platform's visual design.
|
|
4
|
+
|
|
5
|
+
## Complete Example
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"extractedAt": "2024-01-15T10:30:00.000Z",
|
|
10
|
+
"totalColorsFound": 47,
|
|
11
|
+
"colors": {
|
|
12
|
+
"primary": "#1a73e8",
|
|
13
|
+
"secondary": "#5f6368",
|
|
14
|
+
"background": {
|
|
15
|
+
"white": "#ffffff",
|
|
16
|
+
"light": "#f8f9fa",
|
|
17
|
+
"dark": "#202124"
|
|
18
|
+
},
|
|
19
|
+
"text": {
|
|
20
|
+
"primary": "#202124",
|
|
21
|
+
"secondary": "#5f6368",
|
|
22
|
+
"disabled": "#9aa0a6"
|
|
23
|
+
},
|
|
24
|
+
"border": {
|
|
25
|
+
"default": "#dadce0",
|
|
26
|
+
"focus": "#1a73e8"
|
|
27
|
+
},
|
|
28
|
+
"status": {
|
|
29
|
+
"success": "#1e8e3e",
|
|
30
|
+
"warning": "#f9ab00",
|
|
31
|
+
"error": "#d93025",
|
|
32
|
+
"info": "#1a73e8"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"fonts": {
|
|
36
|
+
"families": [
|
|
37
|
+
"Google Sans",
|
|
38
|
+
"Roboto",
|
|
39
|
+
"Arial",
|
|
40
|
+
"sans-serif"
|
|
41
|
+
],
|
|
42
|
+
"primary": "Google Sans"
|
|
43
|
+
},
|
|
44
|
+
"rawColors": [
|
|
45
|
+
["#ffffff", 245],
|
|
46
|
+
["#1a73e8", 89],
|
|
47
|
+
["#202124", 76],
|
|
48
|
+
["#f8f9fa", 54],
|
|
49
|
+
["#5f6368", 43],
|
|
50
|
+
["#dadce0", 38],
|
|
51
|
+
["#1e8e3e", 12],
|
|
52
|
+
["#d93025", 8]
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Schema Reference
|
|
58
|
+
|
|
59
|
+
### Root Object
|
|
60
|
+
|
|
61
|
+
| Field | Type | Required | Description |
|
|
62
|
+
|-------|------|----------|-------------|
|
|
63
|
+
| `extractedAt` | string | Yes | ISO 8601 timestamp of extraction |
|
|
64
|
+
| `totalColorsFound` | number | **Yes** | Total unique colors found (used for validation) |
|
|
65
|
+
| `colors` | object | Yes | Categorized color palette |
|
|
66
|
+
| `fonts` | object | Yes | Font information |
|
|
67
|
+
| `rawColors` | array | No | All colors sorted by frequency |
|
|
68
|
+
|
|
69
|
+
### `colors`
|
|
70
|
+
|
|
71
|
+
Categorized color values. All values are hex color strings (e.g., `"#1a73e8"`).
|
|
72
|
+
|
|
73
|
+
| Field | Type | Description |
|
|
74
|
+
|-------|------|-------------|
|
|
75
|
+
| `primary` | string | Primary brand/accent color |
|
|
76
|
+
| `secondary` | string | Secondary accent color |
|
|
77
|
+
| `background` | object | Background colors |
|
|
78
|
+
| `text` | object | Text colors |
|
|
79
|
+
| `border` | object | Border colors |
|
|
80
|
+
| `status` | object | Status/feedback colors |
|
|
81
|
+
|
|
82
|
+
#### `colors.background`
|
|
83
|
+
|
|
84
|
+
| Field | Description |
|
|
85
|
+
|-------|-------------|
|
|
86
|
+
| `white` | Pure white or near-white background |
|
|
87
|
+
| `light` | Light gray background (cards, sections) |
|
|
88
|
+
| `dark` | Dark background (dark mode, headers) |
|
|
89
|
+
|
|
90
|
+
#### `colors.text`
|
|
91
|
+
|
|
92
|
+
| Field | Description |
|
|
93
|
+
|-------|-------------|
|
|
94
|
+
| `primary` | Main body text color |
|
|
95
|
+
| `secondary` | Subdued text (captions, labels) |
|
|
96
|
+
| `disabled` | Disabled/placeholder text |
|
|
97
|
+
|
|
98
|
+
#### `colors.border`
|
|
99
|
+
|
|
100
|
+
| Field | Description |
|
|
101
|
+
|-------|-------------|
|
|
102
|
+
| `default` | Standard border color |
|
|
103
|
+
| `focus` | Focus state border color |
|
|
104
|
+
|
|
105
|
+
#### `colors.status`
|
|
106
|
+
|
|
107
|
+
| Field | Description |
|
|
108
|
+
|-------|-------------|
|
|
109
|
+
| `success` | Success/positive actions (green) |
|
|
110
|
+
| `warning` | Warning states (yellow/orange) |
|
|
111
|
+
| `error` | Error/destructive actions (red) |
|
|
112
|
+
| `info` | Informational messages (blue) |
|
|
113
|
+
|
|
114
|
+
### `fonts`
|
|
115
|
+
|
|
116
|
+
| Field | Type | Description |
|
|
117
|
+
|-------|------|-------------|
|
|
118
|
+
| `families` | array | List of font families found |
|
|
119
|
+
| `primary` | string | Most commonly used font family |
|
|
120
|
+
|
|
121
|
+
### `rawColors`
|
|
122
|
+
|
|
123
|
+
Array of `[color, count]` tuples, sorted by frequency (most common first).
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
[
|
|
127
|
+
["#ffffff", 245], // white appeared 245 times
|
|
128
|
+
["#1a73e8", 89], // primary blue appeared 89 times
|
|
129
|
+
...
|
|
130
|
+
]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Validation Requirements
|
|
134
|
+
|
|
135
|
+
For validation to pass:
|
|
136
|
+
|
|
137
|
+
1. **`totalColorsFound` must be >= 10** (default minimum)
|
|
138
|
+
2. **`colors.primary` should be identified** (warning if missing)
|
|
139
|
+
3. **File must exist** at `references/design-tokens.json`
|
|
140
|
+
|
|
141
|
+
## Color Categorization Logic
|
|
142
|
+
|
|
143
|
+
Colors are automatically categorized based on:
|
|
144
|
+
|
|
145
|
+
- **Primary**: First blue-dominant color with high frequency
|
|
146
|
+
- **Background**: Colors with luminance > 0.8
|
|
147
|
+
- **Text**: Colors with luminance < 0.5
|
|
148
|
+
- **Status colors**: Based on RGB dominance (red=error, green=success)
|
|
149
|
+
|
|
150
|
+
## Usage in Prototype Generation
|
|
151
|
+
|
|
152
|
+
When generating prototypes:
|
|
153
|
+
|
|
154
|
+
1. **Use ONLY colors from this file** - Never use Tailwind defaults
|
|
155
|
+
2. **Reference by category** - Use `colors.primary`, `colors.text.primary`, etc.
|
|
156
|
+
3. **Inline styles for custom colors** - Tailwind custom colors may not work reliably
|
|
157
|
+
|
|
158
|
+
Example Tailwind config extension:
|
|
159
|
+
|
|
160
|
+
```javascript
|
|
161
|
+
// tailwind.config.js
|
|
162
|
+
module.exports = {
|
|
163
|
+
theme: {
|
|
164
|
+
extend: {
|
|
165
|
+
colors: {
|
|
166
|
+
primary: '#1a73e8',
|
|
167
|
+
'text-primary': '#202124',
|
|
168
|
+
'text-secondary': '#5f6368',
|
|
169
|
+
'bg-light': '#f8f9fa',
|
|
170
|
+
// ... other colors from design-tokens.json
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Or use inline styles:
|
|
178
|
+
|
|
179
|
+
```jsx
|
|
180
|
+
<button style={{ backgroundColor: '#1a73e8', color: '#ffffff' }}>
|
|
181
|
+
Submit
|
|
182
|
+
</button>
|
|
183
|
+
```
|