@champpaba/claude-agent-kit 3.5.0 → 3.6.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/CHANGELOG.md +60 -0
- package/.claude/CLAUDE.md +105 -45
- package/.claude/agents/01-integration.md +0 -0
- package/.claude/agents/02-uxui-frontend.md +1 -1
- package/.claude/agents/03-test-debug.md +0 -0
- package/.claude/agents/04-frontend.md +0 -0
- package/.claude/agents/05-backend.md +0 -0
- package/.claude/agents/06-database.md +0 -0
- package/.claude/agents/07-ux-tester.md +92 -84
- package/.claude/agents/CLAUDE.md +18 -0
- package/.claude/agents/_shared/CLAUDE.md +11 -0
- package/.claude/agents/_shared/README.md +0 -0
- package/.claude/agents/_shared/agent-boundaries.md +0 -0
- package/.claude/agents/_shared/documentation-policy.md +0 -0
- package/.claude/agents/_shared/package-manager.md +0 -0
- package/.claude/agents/_shared/pre-work-checklist.md +45 -2
- package/.claude/commands/CLAUDE.md +20 -0
- package/.claude/commands/cdev.md +20 -4
- package/.claude/commands/csetup.md +0 -0
- package/.claude/commands/cstatus.md +0 -0
- package/.claude/commands/cview.md +0 -0
- package/.claude/commands/designsetup.md +0 -0
- package/.claude/commands/extract.md +22 -20
- package/.claude/commands/pageplan.md +0 -0
- package/.claude/commands/pstatus.md +0 -0
- package/.claude/contexts/_core/CLAUDE.md +11 -0
- package/.claude/contexts/_core/README.md +33 -0
- package/.claude/contexts/{patterns → _core}/code-standards.md +0 -0
- package/.claude/contexts/{patterns → _core}/development-principles.md +0 -0
- package/.claude/contexts/design/CLAUDE.md +17 -0
- package/.claude/contexts/design/accessibility.md +2 -2
- package/.claude/contexts/design/box-thinking.md +0 -0
- package/.claude/contexts/design/color-theory.md +2 -2
- package/.claude/contexts/design/index.md +0 -0
- package/.claude/contexts/design/layout.md +0 -0
- package/.claude/contexts/design/responsive.md +0 -0
- package/.claude/contexts/design/shadows.md +0 -0
- package/.claude/contexts/design/spacing.md +0 -0
- package/.claude/contexts/design/typography.md +0 -0
- package/.claude/contexts/domain/README.md +0 -0
- package/.claude/contexts/patterns/CLAUDE.md +13 -0
- package/.claude/contexts/patterns/agent-coordination.md +0 -0
- package/.claude/contexts/patterns/agent-discovery.md +0 -0
- package/.claude/contexts/patterns/animation-patterns.md +0 -0
- package/.claude/contexts/patterns/change-workflow.md +1 -1
- package/.claude/contexts/patterns/error-handling.md +0 -0
- package/.claude/contexts/patterns/error-recovery.md +0 -0
- package/.claude/contexts/patterns/frontend-component-strategy.md +0 -0
- package/.claude/contexts/patterns/git-workflow.md +0 -0
- package/.claude/contexts/patterns/logging.md +0 -0
- package/.claude/contexts/patterns/performance-optimization.md +1 -1
- package/.claude/contexts/patterns/task-breakdown.md +0 -0
- package/.claude/contexts/patterns/task-classification.md +0 -0
- package/.claude/contexts/patterns/tdd-classification.md +0 -0
- package/.claude/contexts/patterns/testing.md +0 -0
- package/.claude/contexts/patterns/ui-component-consistency.md +0 -0
- package/.claude/contexts/patterns/validation-framework.md +0 -0
- package/.claude/lib/CLAUDE.md +19 -0
- package/.claude/lib/README.md +1 -1
- package/.claude/lib/agent-executor.md +1 -1
- package/.claude/lib/agent-router.md +0 -0
- package/.claude/lib/context-loading-protocol.md +0 -0
- package/.claude/lib/design-validator.md +8 -8
- package/.claude/lib/detailed-guides/agent-system.md +0 -0
- package/.claude/lib/detailed-guides/best-practices-system.md +0 -0
- package/.claude/lib/detailed-guides/context-optimization.md +0 -0
- package/.claude/lib/detailed-guides/design-system.md +0 -0
- package/.claude/lib/detailed-guides/incremental-testing.md +0 -0
- package/.claude/lib/detailed-guides/page-planning.md +0 -0
- package/.claude/lib/detailed-guides/taskmaster-analysis.md +0 -0
- package/.claude/lib/document-loader.md +0 -0
- package/.claude/lib/feature-best-practices.md +0 -0
- package/.claude/lib/flags-updater.md +0 -0
- package/.claude/lib/handoff-protocol.md +0 -0
- package/.claude/lib/task-analyzer.md +2 -2
- package/.claude/lib/tdd-workflow.md +0 -0
- package/.claude/lib/validation-gates.md +0 -0
- package/.claude/settings.local.json +0 -0
- package/.claude/templates/PROJECT_STATUS.template.yml +0 -0
- package/.claude/templates/STYLE_GUIDE.template.md +0 -0
- package/.claude/templates/context-template.md +0 -0
- package/.claude/templates/design-context-template.md +0 -0
- package/.claude/templates/flags-template.json +0 -0
- package/.claude/templates/page-plan-example.md +0 -0
- package/.claude/templates/phases-sections/CLAUDE.md +13 -0
- package/.claude/templates/phases-sections/accessibility-test.md +0 -0
- package/.claude/templates/phases-sections/api-design.md +0 -0
- package/.claude/templates/phases-sections/backend-tests.md +0 -0
- package/.claude/templates/phases-sections/backend.md +0 -0
- package/.claude/templates/phases-sections/business-logic-validation.md +0 -0
- package/.claude/templates/phases-sections/component-tests.md +0 -0
- package/.claude/templates/phases-sections/contract-backend.md +0 -0
- package/.claude/templates/phases-sections/contract-frontend.md +0 -0
- package/.claude/templates/phases-sections/database.md +0 -0
- package/.claude/templates/phases-sections/e2e-tests.md +0 -0
- package/.claude/templates/phases-sections/fix-implementation.md +0 -0
- package/.claude/templates/phases-sections/frontend-integration.md +0 -0
- package/.claude/templates/phases-sections/frontend-mockup.md +0 -0
- package/.claude/templates/phases-sections/manual-flow-test.md +0 -0
- package/.claude/templates/phases-sections/manual-ux-test.md +0 -0
- package/.claude/templates/phases-sections/refactor-implementation.md +0 -0
- package/.claude/templates/phases-sections/refactor.md +0 -0
- package/.claude/templates/phases-sections/regression-tests.md +0 -0
- package/.claude/templates/phases-sections/responsive-test.md +0 -0
- package/.claude/templates/phases-sections/script-implementation.md +0 -0
- package/.claude/templates/phases-sections/test-coverage.md +0 -0
- package/.claude/templates/phases-sections/user-approval.md +0 -0
- package/.claude/templates/phases-sections/ux-testing.md +6 -10
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/bin/CLAUDE.md +11 -0
- package/bin/cli.js +0 -0
- package/lib/CLAUDE.md +11 -0
- package/lib/helpers.js +0 -0
- package/lib/init.js +0 -0
- package/lib/update.js +0 -0
- package/package.json +3 -2
- package/skills/design-extract/CLAUDE.md +12 -0
- package/skills/design-extract/SKILL.md +76 -0
- package/skills/design-extract/references/CLAUDE.md +16 -0
- package/skills/design-extract/references/error-handling.md +161 -0
- package/skills/design-extract/references/extraction-steps.md +183 -0
- package/skills/design-extract/references/output-format.md +250 -0
- package/skills/design-extract/references/style-detection.md +137 -0
- package/skills/design-extract/templates/CLAUDE.md +11 -0
- package/skills/design-extract/templates/data.yaml.template +95 -0
- package/skills/design-setup/CLAUDE.md +11 -0
- package/skills/design-setup/SKILL.md +104 -0
- package/skills/design-setup/references/CLAUDE.md +11 -0
- package/skills/design-setup/references/data-yaml-schema.md +205 -0
- package/skills/design-setup/references/error-handling.md +157 -0
- package/skills/design-setup/references/generation-steps.md +192 -0
- package/skills/design-setup/references/interactive-workflow.md +151 -0
- package/skills/page-planner/CLAUDE.md +11 -0
- package/skills/page-planner/SKILL.md +112 -0
- package/skills/page-planner/references/CLAUDE.md +11 -0
- package/skills/page-planner/references/animation-patterns.md +169 -0
- package/skills/page-planner/references/generation-steps.md +166 -0
- package/skills/page-planner/references/wireframe-patterns.md +182 -0
- package/skills/page-planner/templates/CLAUDE.md +11 -0
- package/skills/page-planner/templates/page-plan.md +303 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
ทดสอบ UI จากมุมมอง User จริง ก่อนที่จะไป Phase ถัดไป (Backend)
|
|
11
11
|
- Auto-generate personas จาก product context
|
|
12
|
-
- Test แต่ละ persona ผ่าน
|
|
12
|
+
- Test แต่ละ persona ผ่าน agent-browser
|
|
13
13
|
- คำนวณ weighted conversion prediction
|
|
14
14
|
- รอ User approve หรือ reject
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
- ✅ Phase 1 (Frontend Mockup) completed
|
|
19
19
|
- ✅ Dev server running (localhost:3000 or similar)
|
|
20
|
-
- ✅
|
|
20
|
+
- ✅ agent-browser installed (`npx skills add vercel-labs/agent-browser`)
|
|
21
21
|
|
|
22
22
|
## 🔄 Process
|
|
23
23
|
|
|
@@ -52,8 +52,8 @@ For each persona:
|
|
|
52
52
|
- Calculate total conversion prediction
|
|
53
53
|
- Calculate potential after fixes
|
|
54
54
|
|
|
55
|
-
### Step 6:
|
|
56
|
-
Output
|
|
55
|
+
### Step 6: Output Report (Inline)
|
|
56
|
+
Output ทุกอย่างใน response โดยตรง (ไม่สร้างไฟล์)
|
|
57
57
|
|
|
58
58
|
## ✅ Success Criteria
|
|
59
59
|
|
|
@@ -66,8 +66,7 @@ Output: `openspec/changes/{change-id}/ux-test-report.md`
|
|
|
66
66
|
|
|
67
67
|
## 📤 Output
|
|
68
68
|
|
|
69
|
-
**
|
|
70
|
-
- `openspec/changes/{change-id}/ux-test-report.md`
|
|
69
|
+
**Output:** Inline response (ไม่สร้างไฟล์)
|
|
71
70
|
|
|
72
71
|
**Update flags.json:**
|
|
73
72
|
```json
|
|
@@ -79,8 +78,7 @@ Output: `openspec/changes/{change-id}/ux-test-report.md`
|
|
|
79
78
|
"actual_minutes": {duration},
|
|
80
79
|
"personas_tested": {count},
|
|
81
80
|
"conversion_prediction": "{percentage}",
|
|
82
|
-
"critical_issues": {count}
|
|
83
|
-
"report_path": "ux-test-report.md"
|
|
81
|
+
"critical_issues": {count}
|
|
84
82
|
}
|
|
85
83
|
}
|
|
86
84
|
}
|
|
@@ -101,8 +99,6 @@ Output: `openspec/changes/{change-id}/ux-test-report.md`
|
|
|
101
99
|
- Critical issues: {count}
|
|
102
100
|
- Potential after fixes: {percentage}%
|
|
103
101
|
|
|
104
|
-
📄 Full report: openspec/changes/{change-id}/ux-test-report.md
|
|
105
|
-
|
|
106
102
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
107
103
|
|
|
108
104
|
กรุณา:
|
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/bin/CLAUDE.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<claude-mem-context>
|
|
2
|
+
# Recent Activity
|
|
3
|
+
|
|
4
|
+
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
|
5
|
+
|
|
6
|
+
### Feb 3, 2026
|
|
7
|
+
|
|
8
|
+
| ID | Time | T | Title | Read |
|
|
9
|
+
|----|------|---|-------|------|
|
|
10
|
+
| #166 | 9:55 PM | 🔵 | CLI entry point implements commander-based interface with two primary commands | ~397 |
|
|
11
|
+
</claude-mem-context>
|
package/bin/cli.js
CHANGED
|
File without changes
|
package/lib/CLAUDE.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<claude-mem-context>
|
|
2
|
+
# Recent Activity
|
|
3
|
+
|
|
4
|
+
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
|
5
|
+
|
|
6
|
+
### Feb 3, 2026
|
|
7
|
+
|
|
8
|
+
| ID | Time | T | Title | Read |
|
|
9
|
+
|----|------|---|-------|------|
|
|
10
|
+
| #167 | 9:55 PM | 🔵 | Init command implements smart template merging with optional PROJECT_STATUS.yml | ~465 |
|
|
11
|
+
</claude-mem-context>
|
package/lib/helpers.js
CHANGED
|
File without changes
|
package/lib/init.js
CHANGED
|
File without changes
|
package/lib/update.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@champpaba/claude-agent-kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Universal multi-agent template for Claude Code - AI-assisted development with specialized agents",
|
|
5
5
|
"main": "bin/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"bin/",
|
|
12
12
|
"lib/",
|
|
13
|
-
".claude/"
|
|
13
|
+
".claude/",
|
|
14
|
+
"skills/"
|
|
14
15
|
],
|
|
15
16
|
"scripts": {
|
|
16
17
|
"test": "vitest run",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<claude-mem-context>
|
|
2
|
+
# Recent Activity
|
|
3
|
+
|
|
4
|
+
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
|
5
|
+
|
|
6
|
+
### Feb 3, 2026
|
|
7
|
+
|
|
8
|
+
| ID | Time | T | Title | Read |
|
|
9
|
+
|----|------|---|-------|------|
|
|
10
|
+
| #252 | 11:38 PM | 🔵 | Git status reveals extensive refactoring with skills migration and core context reorganization | ~682 |
|
|
11
|
+
| #211 | 11:21 PM | ✅ | Standardized design-extract skill to require agent-browser CLI only | ~513 |
|
|
12
|
+
</claude-mem-context>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Design Extract Skill
|
|
2
|
+
|
|
3
|
+
Extract comprehensive design system data from any website.
|
|
4
|
+
|
|
5
|
+
## Triggers
|
|
6
|
+
|
|
7
|
+
- "extract design from [URL]"
|
|
8
|
+
- "ดึง design จาก [URL]"
|
|
9
|
+
- "/extract [URL]"
|
|
10
|
+
- "analyze design of [URL]"
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
|
|
14
|
+
- agent-browser CLI (`npm install -g agent-browser && agent-browser install`)
|
|
15
|
+
|
|
16
|
+
## Quick Usage
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
/extract https://airbnb.com
|
|
20
|
+
/extract https://linear.app
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## What Gets Extracted
|
|
24
|
+
|
|
25
|
+
| Category | Details |
|
|
26
|
+
|----------|---------|
|
|
27
|
+
| Colors | Backgrounds, text, borders with usage context |
|
|
28
|
+
| Typography | Fonts, weights, sizes, line heights |
|
|
29
|
+
| Spacing | Grid base detection, padding/margin values |
|
|
30
|
+
| Components | Buttons, cards, inputs with animations |
|
|
31
|
+
| Shadows | Box shadows, elevation levels |
|
|
32
|
+
| Animations | @keyframes, transitions, hover/focus states |
|
|
33
|
+
| Psychology | Style classification, emotions, target audience |
|
|
34
|
+
|
|
35
|
+
## Output
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
design-system/extracted/{site-name}/
|
|
39
|
+
├── data.yaml # Complete 17-section design data
|
|
40
|
+
└── screenshots/
|
|
41
|
+
├── full-page.png # Full page capture
|
|
42
|
+
├── button-0-default.png
|
|
43
|
+
├── button-0-hover.png
|
|
44
|
+
└── ...
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Workflow
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
1. Navigate → Open URL in browser
|
|
51
|
+
2. Extract → CSS data (colors, typography, spacing, components)
|
|
52
|
+
3. Capture → Interactive states (hover, focus screenshots)
|
|
53
|
+
4. Analyze → AI psychology analysis
|
|
54
|
+
5. Generate → data.yaml with 17 sections
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Detailed Documentation
|
|
58
|
+
|
|
59
|
+
| Reference | Use When |
|
|
60
|
+
|-----------|----------|
|
|
61
|
+
| [references/extraction-steps.md](references/extraction-steps.md) | Full step-by-step extraction process |
|
|
62
|
+
| [references/output-format.md](references/output-format.md) | data.yaml schema and sections |
|
|
63
|
+
| [references/style-detection.md](references/style-detection.md) | Design style classification |
|
|
64
|
+
| [references/error-handling.md](references/error-handling.md) | Handling failures gracefully |
|
|
65
|
+
|
|
66
|
+
## Next Steps After Extraction
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Extract more reference sites (optional)
|
|
70
|
+
/extract https://linear.app
|
|
71
|
+
|
|
72
|
+
# Generate final design system
|
|
73
|
+
/designsetup @prd.md
|
|
74
|
+
# → Merges all extracted data
|
|
75
|
+
# → Outputs: design-system/data.yaml
|
|
76
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<claude-mem-context>
|
|
2
|
+
# Recent Activity
|
|
3
|
+
|
|
4
|
+
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
|
5
|
+
|
|
6
|
+
### Feb 3, 2026
|
|
7
|
+
|
|
8
|
+
| ID | Time | T | Title | Read |
|
|
9
|
+
|----|------|---|-------|------|
|
|
10
|
+
| #252 | 11:38 PM | 🔵 | Git status reveals extensive refactoring with skills migration and core context reorganization | ~682 |
|
|
11
|
+
| #231 | 11:22 PM | ✅ | Simplified design-extract error handling to require only agent-browser | ~518 |
|
|
12
|
+
| #230 | " | ✅ | Updated design-extract skill error handling to reference agent-browser installation | ~376 |
|
|
13
|
+
| #228 | " | 🔵 | Design extraction error handling supports both Chrome DevTools MCP and agent-browser | ~766 |
|
|
14
|
+
| #212 | 11:21 PM | ✅ | Standardized extraction-steps to use agent-browser exclusively, removing Chrome DevTools option | ~511 |
|
|
15
|
+
| #197 | 11:20 PM | 🔵 | Design extraction workflow uses Chrome DevTools or agent-browser for automated design token extraction | ~875 |
|
|
16
|
+
</claude-mem-context>
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Error Handling
|
|
2
|
+
|
|
3
|
+
How to handle failures during design extraction.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Critical Errors (Stop Execution)
|
|
8
|
+
|
|
9
|
+
### Navigation Failures
|
|
10
|
+
|
|
11
|
+
If browser navigation fails:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
❌ Failed to load URL: {url}
|
|
15
|
+
|
|
16
|
+
Error: {error.message}
|
|
17
|
+
|
|
18
|
+
Check:
|
|
19
|
+
- Is the URL accessible?
|
|
20
|
+
- Is agent-browser installed? (npm install -g agent-browser && agent-browser install)
|
|
21
|
+
- Is the site blocking automated access?
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Action:** Stop execution. Cannot proceed without page loaded.
|
|
25
|
+
|
|
26
|
+
### Browser Not Available
|
|
27
|
+
|
|
28
|
+
If agent-browser is not available:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
❌ Browser automation not available
|
|
32
|
+
|
|
33
|
+
Required: agent-browser CLI
|
|
34
|
+
|
|
35
|
+
Setup:
|
|
36
|
+
npm install -g agent-browser && agent-browser install
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Action:** Stop execution. Provide setup instructions.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Non-Critical Errors (Continue with Fallbacks)
|
|
44
|
+
|
|
45
|
+
### Extraction Failures
|
|
46
|
+
|
|
47
|
+
If individual extraction steps fail:
|
|
48
|
+
|
|
49
|
+
| Extraction | Fallback |
|
|
50
|
+
|------------|----------|
|
|
51
|
+
| Colors | `{ backgrounds: [], texts: [], borders: [] }` |
|
|
52
|
+
| Typography | `{ h1: [], fonts: [], weights: [], sizes: [] }` |
|
|
53
|
+
| Shadows | `{ shadows: [], borderRadii: [] }` |
|
|
54
|
+
| Spacing | `{ grid_base: 8, common_values: [] }` |
|
|
55
|
+
| Components | `[]` (empty array) |
|
|
56
|
+
| Animations | `{ keyframes: [], transitions: [] }` |
|
|
57
|
+
|
|
58
|
+
Log warning and continue:
|
|
59
|
+
```
|
|
60
|
+
⚠️ Color extraction failed: {error.message}
|
|
61
|
+
Using fallback empty data
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Screenshot Failures
|
|
65
|
+
|
|
66
|
+
| Scenario | Fallback |
|
|
67
|
+
|----------|----------|
|
|
68
|
+
| Full-page screenshot fails | Try viewport-only screenshot |
|
|
69
|
+
| Component screenshot fails | Skip component, continue with others |
|
|
70
|
+
| All screenshots fail | Continue without screenshots, note in report |
|
|
71
|
+
|
|
72
|
+
### CORS/Security Errors
|
|
73
|
+
|
|
74
|
+
Some sites block stylesheet access:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
⚠️ Cannot access stylesheet: {url}
|
|
78
|
+
Reason: CORS policy
|
|
79
|
+
Skipping external stylesheet
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Action:** Continue with inline styles and accessible stylesheets.
|
|
83
|
+
|
|
84
|
+
### Element Not Found
|
|
85
|
+
|
|
86
|
+
If expected elements don't exist:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
⚠️ No buttons found on page
|
|
90
|
+
Skipping button extraction
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Action:** Mark section as `detected: false` in output YAML.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Partial Success Handling
|
|
98
|
+
|
|
99
|
+
### Coverage Calculation
|
|
100
|
+
|
|
101
|
+
Track what was successfully extracted:
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
coverage:
|
|
105
|
+
total_sections: 17
|
|
106
|
+
detected_sections: 12
|
|
107
|
+
percentage: 71
|
|
108
|
+
missing:
|
|
109
|
+
- icons_imagery
|
|
110
|
+
- navigation_patterns
|
|
111
|
+
- loading_states
|
|
112
|
+
- feedback_states
|
|
113
|
+
- accessibility
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Final Report with Warnings
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
120
|
+
✅ EXTRACTION COMPLETE (with warnings)
|
|
121
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
122
|
+
|
|
123
|
+
📊 Coverage: 12/17 sections (71%)
|
|
124
|
+
|
|
125
|
+
⚠️ Warnings:
|
|
126
|
+
- Color extraction partial: CORS blocked 2 stylesheets
|
|
127
|
+
- Button hover states: 1 of 3 failed
|
|
128
|
+
- Full-page screenshot failed, using viewport
|
|
129
|
+
|
|
130
|
+
📁 Output:
|
|
131
|
+
✓ design-system/extracted/example/data.yaml
|
|
132
|
+
⚠️ design-system/extracted/example/screenshots/ (partial)
|
|
133
|
+
|
|
134
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Retry Strategy
|
|
140
|
+
|
|
141
|
+
For transient failures (network timeouts):
|
|
142
|
+
|
|
143
|
+
1. **First attempt:** Normal extraction
|
|
144
|
+
2. **If timeout:** Wait 2 seconds, retry once
|
|
145
|
+
3. **If still fails:** Use fallback data, continue
|
|
146
|
+
|
|
147
|
+
Do NOT retry indefinitely. Accept partial data over blocking on single failure.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## User Communication
|
|
152
|
+
|
|
153
|
+
Always inform user of issues:
|
|
154
|
+
|
|
155
|
+
| Severity | Format |
|
|
156
|
+
|----------|--------|
|
|
157
|
+
| Critical | ❌ Error message, stop |
|
|
158
|
+
| Warning | ⚠️ Warning, continue |
|
|
159
|
+
| Info | ℹ️ Note, continue |
|
|
160
|
+
|
|
161
|
+
Never silently fail. User should know what succeeded and what didn't.
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Extraction Steps
|
|
2
|
+
|
|
3
|
+
Complete step-by-step guide for extracting design data from a website.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## STEP 0: Parse Input & Setup
|
|
8
|
+
|
|
9
|
+
### 0.1: Validate and Normalize URL
|
|
10
|
+
|
|
11
|
+
1. Check if URL argument is provided
|
|
12
|
+
- If missing, return error: "URL required. Usage: /extract https://airbnb.com"
|
|
13
|
+
2. Trim whitespace from URL
|
|
14
|
+
3. Add "https://" prefix if URL doesn't start with "http://" or "https://"
|
|
15
|
+
4. Parse hostname and auto-detect site name:
|
|
16
|
+
- Remove "www." prefix if present
|
|
17
|
+
- Remove top-level domain (TLD) to get clean site name
|
|
18
|
+
- Example: "www.airbnb.com" → "airbnb"
|
|
19
|
+
|
|
20
|
+
### 0.2: Check for Existing Extraction
|
|
21
|
+
|
|
22
|
+
1. Build path: `design-system/extracted/{siteName}/data.yaml`
|
|
23
|
+
2. If file exists:
|
|
24
|
+
- Read existing YAML file
|
|
25
|
+
- Extract `meta.extracted_at` field
|
|
26
|
+
- Ask user: "Site '{siteName}' was already extracted on {extractedDate}. Re-extract?"
|
|
27
|
+
- If user chooses "No", exit with message: "Extraction cancelled. Existing data preserved."
|
|
28
|
+
|
|
29
|
+
### 0.3: Create Output Directories
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
mkdir -p design-system/extracted/{siteName}/screenshots
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## STEP 1: Navigate & Wait
|
|
38
|
+
|
|
39
|
+
### 1.1: Navigate to URL
|
|
40
|
+
|
|
41
|
+
Use agent-browser to navigate to the target URL:
|
|
42
|
+
```bash
|
|
43
|
+
agent-browser open {url}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 1.2: Smart Wait for Page Load
|
|
47
|
+
|
|
48
|
+
1. Take DOM snapshot to analyze page structure
|
|
49
|
+
2. Find heading elements
|
|
50
|
+
3. If headings found:
|
|
51
|
+
- Wait for first heading text (timeout: 15000ms)
|
|
52
|
+
4. If no headings found:
|
|
53
|
+
- Fallback to sleep 5000ms
|
|
54
|
+
|
|
55
|
+
### 1.3: Verify Document Ready
|
|
56
|
+
|
|
57
|
+
1. Check document.readyState
|
|
58
|
+
2. If not "complete", sleep additional 3000ms
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## STEP 2: Extract CSS Data (8 Parallel Extractions)
|
|
63
|
+
|
|
64
|
+
Run all extractions in parallel for speed.
|
|
65
|
+
|
|
66
|
+
### 2.1: Extract Colors
|
|
67
|
+
|
|
68
|
+
Extract from all elements using `window.getComputedStyle()`:
|
|
69
|
+
- Background colors (skip transparent)
|
|
70
|
+
- Text colors
|
|
71
|
+
- Border colors
|
|
72
|
+
|
|
73
|
+
Convert RGB to HEX, detect usage context, count frequency.
|
|
74
|
+
|
|
75
|
+
Output: `colors.backgrounds`, `colors.texts`, `colors.borders`
|
|
76
|
+
|
|
77
|
+
### 2.2: Extract Typography
|
|
78
|
+
|
|
79
|
+
Extract heading styles (h1, h2, h3) and body text:
|
|
80
|
+
- fontSize, fontWeight, fontFamily
|
|
81
|
+
- lineHeight, letterSpacing
|
|
82
|
+
|
|
83
|
+
Collect unique fonts, weights, sizes.
|
|
84
|
+
|
|
85
|
+
### 2.3: Extract Shadows & Effects
|
|
86
|
+
|
|
87
|
+
- boxShadow values (skip "none")
|
|
88
|
+
- borderRadius values (skip "0px")
|
|
89
|
+
- borderWidth values
|
|
90
|
+
|
|
91
|
+
### 2.4: Extract Spacing
|
|
92
|
+
|
|
93
|
+
- Padding values
|
|
94
|
+
- Margin values (skip "auto")
|
|
95
|
+
- Gap values
|
|
96
|
+
|
|
97
|
+
Detect spacing grid pattern (usually 4px or 8px base).
|
|
98
|
+
|
|
99
|
+
### 2.5: Extract Buttons
|
|
100
|
+
|
|
101
|
+
Query: `button`, `a[role="button"]`, `.btn`, `[class*="button"]`
|
|
102
|
+
|
|
103
|
+
For each button:
|
|
104
|
+
- Add `data-extract-id` attribute
|
|
105
|
+
- Extract styles: backgroundColor, color, padding, borderRadius, transition
|
|
106
|
+
|
|
107
|
+
### 2.6: Extract Cards
|
|
108
|
+
|
|
109
|
+
Query: `[class*="card"]`, `article`, `section`
|
|
110
|
+
|
|
111
|
+
Extract: backgroundColor, padding, border, boxShadow, transition
|
|
112
|
+
|
|
113
|
+
### 2.7: Extract Input Fields
|
|
114
|
+
|
|
115
|
+
Query: `input[type="text"]`, `textarea`, etc.
|
|
116
|
+
|
|
117
|
+
Extract: height, padding, border, borderRadius, transition
|
|
118
|
+
|
|
119
|
+
### 2.8: Extract Animations
|
|
120
|
+
|
|
121
|
+
1. CSS @keyframes from stylesheets
|
|
122
|
+
2. Transition properties from elements
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## STEP 3: Extract Component Animations
|
|
127
|
+
|
|
128
|
+
For buttons, cards, and inputs:
|
|
129
|
+
|
|
130
|
+
1. Find element by data-extract-id
|
|
131
|
+
2. Scroll into view
|
|
132
|
+
3. Screenshot default state
|
|
133
|
+
4. Capture default computed styles
|
|
134
|
+
5. Trigger hover/focus event
|
|
135
|
+
6. Wait for transition (500ms)
|
|
136
|
+
7. Screenshot hover/focus state
|
|
137
|
+
8. Capture new computed styles
|
|
138
|
+
9. Remove hover/focus event
|
|
139
|
+
10. Compare and describe changes
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## STEP 4: Full-Page Screenshot
|
|
144
|
+
|
|
145
|
+
1. Try full-page screenshot first
|
|
146
|
+
2. If fails, fallback to viewport-only
|
|
147
|
+
3. Save to `screenshots/full-page.png` or `screenshots/viewport.png`
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## STEP 5: AI Psychology Analysis
|
|
152
|
+
|
|
153
|
+
Using the screenshot and extracted data, analyze:
|
|
154
|
+
|
|
155
|
+
1. **style_classification**: Neo-Brutalism, Minimalist, Glassmorphism, etc.
|
|
156
|
+
2. **emotions_evoked**: What feelings the design triggers
|
|
157
|
+
3. **target_audience**: Who this design appeals to
|
|
158
|
+
4. **visual_principles**: Key design patterns observed
|
|
159
|
+
5. **why_it_works**: Strategic design decisions
|
|
160
|
+
6. **design_philosophy**: Underlying beliefs
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## STEP 6: Generate data.yaml
|
|
165
|
+
|
|
166
|
+
1. Calculate coverage metrics (X/17 sections)
|
|
167
|
+
2. Build YAML with all extracted data
|
|
168
|
+
3. Include psychology analysis
|
|
169
|
+
4. Write to `design-system/extracted/{siteName}/data.yaml`
|
|
170
|
+
|
|
171
|
+
→ See [output-format.md](output-format.md) for complete schema
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## STEP 7: Final Report
|
|
176
|
+
|
|
177
|
+
Display extraction summary:
|
|
178
|
+
- Coverage percentage
|
|
179
|
+
- Design tokens extracted
|
|
180
|
+
- Psychology analysis status
|
|
181
|
+
- Screenshot count
|
|
182
|
+
- Output file paths
|
|
183
|
+
- Next steps
|