extraktor 1.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/LICENSE +21 -0
- package/README.md +174 -0
- package/dist/chunk-5IH5TLAQ.js +91 -0
- package/dist/chunk-PHMSK7VD.js +6411 -0
- package/dist/chunk-VLLFGYUN.js +2773 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +3261 -0
- package/dist/design-md-generator-YMQOE2IW.js +502 -0
- package/dist/index.d.ts +2774 -0
- package/dist/index.js +58 -0
- package/dist/server-DR7RCM5S.js +328 -0
- package/dist/style-applier-BMHP6V57.js +1032 -0
- package/dist/theme-package-generator-E55BBBZN.js +412 -0
- package/package.json +99 -0
- package/skills/analyze-design.md +20 -0
- package/skills/apply-style.md +24 -0
- package/skills/clone-site.md +29 -0
- package/skills/design-md.md +29 -0
- package/skills/devtools-extract.md +30 -0
- package/skills/extract-tokens.md +21 -0
- package/skills/genome.md +31 -0
- package/skills/regen.md +32 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Aytunc Yildizli
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/banner.svg" alt="extraktor" width="100%" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://img.shields.io/npm/v/extraktor?style=flat-square&color=black" alt="npm version" />
|
|
7
|
+
<img src="https://img.shields.io/badge/license-MIT-black?style=flat-square" alt="license" />
|
|
8
|
+
<img src="https://img.shields.io/badge/node-%3E%3D18-black?style=flat-square" alt="node" />
|
|
9
|
+
<img src="https://img.shields.io/badge/tests-104%20passing-brightgreen?style=flat-square" alt="tests" />
|
|
10
|
+
<img src="https://img.shields.io/badge/skills-8-blue?style=flat-square" alt="skills" />
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## What is this
|
|
16
|
+
|
|
17
|
+
extraktor turns any URL into a usable design system. It opens a browser, reads the page, and outputs production-ready code: Tailwind configs, CSS variables, DTCG tokens, React components, Storybook, and DESIGN.md files.
|
|
18
|
+
|
|
19
|
+
It ships as **8 Claude Code skills**. Install once, then just talk to Claude.
|
|
20
|
+
|
|
21
|
+
## Setup
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# 1. Install
|
|
25
|
+
npm install -g extraktor
|
|
26
|
+
npx playwright install chromium
|
|
27
|
+
|
|
28
|
+
# 2. Copy skills into Claude Code
|
|
29
|
+
cp $(npm root -g)/extraktor/skills/*.md ~/.claude/skills/
|
|
30
|
+
|
|
31
|
+
# 3. Done. Talk to Claude.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Skills
|
|
35
|
+
|
|
36
|
+
| Skill | What it does | API key? |
|
|
37
|
+
|-------|-------------|----------|
|
|
38
|
+
| **extract-tokens** | Colors, fonts, spacing -> Tailwind config, CSS vars, DTCG tokens | No |
|
|
39
|
+
| **analyze-design** | Quick design audit - colors, fonts, framework detection | No |
|
|
40
|
+
| **clone-site** | Full Next.js project with all assets and animations | No |
|
|
41
|
+
| **apply-style** | Extract a site's style and apply it to your project | No |
|
|
42
|
+
| **design-md** | Generate Stitch-format DESIGN.md (compatible with [awesome-design-md](https://github.com/VoltAgent/awesome-design-md)) | No |
|
|
43
|
+
| **genome** | Vision-AI component extraction with Storybook | Yes |
|
|
44
|
+
| **regen** | Generate new pages from extracted genome | Yes |
|
|
45
|
+
| **devtools-extract** | Extract from authenticated pages via Chrome DevTools | No |
|
|
46
|
+
|
|
47
|
+
6 out of 8 work without any API key. `genome` and `regen` use your existing `ANTHROPIC_API_KEY` - if you're on Claude Code, it's already there.
|
|
48
|
+
|
|
49
|
+
## Examples
|
|
50
|
+
|
|
51
|
+
Just talk to Claude naturally:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
"Extract the design tokens from linear.app"
|
|
55
|
+
"What fonts does stripe.com use?"
|
|
56
|
+
"Generate a DESIGN.md from this site"
|
|
57
|
+
"Clone this site and make it about my product"
|
|
58
|
+
"Extract the design system and build me a new landing page"
|
|
59
|
+
"Get the colors from my dashboard" (uses --devtools for auth pages)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Claude picks the right skill automatically.
|
|
63
|
+
|
|
64
|
+
<p align="center">
|
|
65
|
+
<img src="assets/demo.svg" alt="extraktor extracting linear.app" width="100%" />
|
|
66
|
+
</p>
|
|
67
|
+
|
|
68
|
+
## What gets extracted
|
|
69
|
+
|
|
70
|
+
| Category | Output |
|
|
71
|
+
|----------|--------|
|
|
72
|
+
| **Colors** | Full palette, semantic names, gradients, usage roles |
|
|
73
|
+
| **Typography** | Families, sizes, weights, line heights, text styles |
|
|
74
|
+
| **Spacing** | Scale, margins, padding, gaps |
|
|
75
|
+
| **Animations** | Keyframes (named), transitions, transforms, timing functions |
|
|
76
|
+
| **Layout** | Section hierarchy, grid patterns, bento layouts, breakpoints |
|
|
77
|
+
| **Effects** | Shadows, border radii, filters, opacity |
|
|
78
|
+
| **Assets** | Images, SVGs, fonts, icons (downloaded) |
|
|
79
|
+
| **Components** | Cards, heroes, CTAs, pricing, testimonials, nav |
|
|
80
|
+
| **Platform** | Framer, Webflow, WordPress, Shopify, Squarespace, Wix |
|
|
81
|
+
|
|
82
|
+
## DESIGN.md generation
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
extraktor design-md https://linear.app -o ./DESIGN.md
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Generates a 9-section [Stitch-format](https://github.com/VoltAgent/awesome-design-md) DESIGN.md:
|
|
89
|
+
|
|
90
|
+
1. Visual Theme & Atmosphere
|
|
91
|
+
2. Color Palette & Roles
|
|
92
|
+
3. Typography Rules
|
|
93
|
+
4. Component Stylings
|
|
94
|
+
5. Layout Principles
|
|
95
|
+
6. Depth & Elevation
|
|
96
|
+
7. Do's and Don'ts
|
|
97
|
+
8. Responsive Behavior
|
|
98
|
+
9. Agent Prompt Guide
|
|
99
|
+
|
|
100
|
+
Drop it into any project. Any AI agent (Claude, Cursor, Copilot) reads it and builds matching UI. What [awesome-design-md](https://github.com/VoltAgent/awesome-design-md) does manually for 31 sites, extraktor does automatically for any URL.
|
|
101
|
+
|
|
102
|
+
## Genome - Vision AI design system
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
extraktor genome https://example.com -o ./genome
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
<p align="center">
|
|
109
|
+
<img src="assets/pipeline.svg" alt="genome pipeline" width="100%" />
|
|
110
|
+
</p>
|
|
111
|
+
|
|
112
|
+
Most tools scrape text. Genome reads design visually:
|
|
113
|
+
|
|
114
|
+
1. **Extract** - Design tokens (colors, fonts, spacing, animations)
|
|
115
|
+
2. **See** - Claude Vision analyzes screenshots to identify components
|
|
116
|
+
3. **Synthesize** - Screenshot + DOM together -> clean React/Tailwind components
|
|
117
|
+
4. **Package** - genome.json + components/ + theme/ + Storybook
|
|
118
|
+
|
|
119
|
+
The output is a portable design system you can build new pages from:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
extraktor regen ./genome --prompt "SaaS pricing page for TaskFlow"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## DevTools mode
|
|
126
|
+
|
|
127
|
+
Extract from pages you're logged into:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Start Chrome with debugging, log in to your app, then:
|
|
131
|
+
extraktor extract https://dashboard.example.com --devtools
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Connects via CDP. Cookies and sessions preserved. Works with extract, genome, clone, design-md.
|
|
135
|
+
|
|
136
|
+
## CLI reference
|
|
137
|
+
|
|
138
|
+
Works as a standalone CLI without Claude Code:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
extraktor extract <url> Design tokens (Tailwind, CSS vars, DTCG)
|
|
142
|
+
extraktor design-md <url> DESIGN.md (Stitch format, 9 sections)
|
|
143
|
+
extraktor clone <url> Next.js project with all assets
|
|
144
|
+
extraktor genome <url> Vision-AI design system + Storybook
|
|
145
|
+
extraktor regen <dir> New page from genome
|
|
146
|
+
extraktor analyze <url> Quick analysis (no output files)
|
|
147
|
+
extraktor init Generate config file
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
All commands support `--devtools`, `--timeout`, `--headless`, `-v`.
|
|
151
|
+
|
|
152
|
+
## Requirements
|
|
153
|
+
|
|
154
|
+
- Node.js >= 18
|
|
155
|
+
- Chromium (`npx playwright install chromium`)
|
|
156
|
+
- `ANTHROPIC_API_KEY` (only for genome and regen)
|
|
157
|
+
|
|
158
|
+
## Contributing
|
|
159
|
+
|
|
160
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). The project uses TypeScript strict mode, Vitest for testing, and Playwright for browser automation.
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
git clone https://github.com/aytuncyildizli/extraktor.git
|
|
164
|
+
cd extraktor && npm install && npx playwright install chromium
|
|
165
|
+
npm run build && npm test
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Responsible use
|
|
169
|
+
|
|
170
|
+
Designed for learning from web design, extracting tokens for your own projects, and rapid prototyping. Respect intellectual property, terms of service, and robots.txt.
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
MIT
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// src/utils/logger.ts
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
var LOG_LEVELS = {
|
|
4
|
+
debug: 0,
|
|
5
|
+
info: 1,
|
|
6
|
+
warn: 2,
|
|
7
|
+
error: 3
|
|
8
|
+
};
|
|
9
|
+
var LOG_COLORS = {
|
|
10
|
+
debug: chalk.gray,
|
|
11
|
+
info: chalk.blue,
|
|
12
|
+
warn: chalk.yellow,
|
|
13
|
+
error: chalk.red
|
|
14
|
+
};
|
|
15
|
+
var LOG_PREFIXES = {
|
|
16
|
+
debug: "[DEBUG]",
|
|
17
|
+
info: "[INFO]",
|
|
18
|
+
warn: "[WARN]",
|
|
19
|
+
error: "[ERROR]"
|
|
20
|
+
};
|
|
21
|
+
function createLogger(options = {}) {
|
|
22
|
+
const {
|
|
23
|
+
level = "info",
|
|
24
|
+
prefix = "extraktor",
|
|
25
|
+
pretty = true,
|
|
26
|
+
timestamp = false
|
|
27
|
+
} = options;
|
|
28
|
+
let currentLevel = level;
|
|
29
|
+
const shouldLog = (messageLevel) => {
|
|
30
|
+
return LOG_LEVELS[messageLevel] >= LOG_LEVELS[currentLevel];
|
|
31
|
+
};
|
|
32
|
+
const formatMessage = (messageLevel, message, args) => {
|
|
33
|
+
const parts = [];
|
|
34
|
+
if (timestamp) {
|
|
35
|
+
parts.push(chalk.gray((/* @__PURE__ */ new Date()).toISOString()));
|
|
36
|
+
}
|
|
37
|
+
if (pretty) {
|
|
38
|
+
parts.push(LOG_COLORS[messageLevel](LOG_PREFIXES[messageLevel]));
|
|
39
|
+
parts.push(chalk.cyan(`[${prefix}]`));
|
|
40
|
+
} else {
|
|
41
|
+
parts.push(LOG_PREFIXES[messageLevel]);
|
|
42
|
+
parts.push(`[${prefix}]`);
|
|
43
|
+
}
|
|
44
|
+
parts.push(message);
|
|
45
|
+
if (args.length > 0) {
|
|
46
|
+
const formattedArgs = args.map((arg) => {
|
|
47
|
+
if (typeof arg === "object") {
|
|
48
|
+
return JSON.stringify(arg, null, 2);
|
|
49
|
+
}
|
|
50
|
+
return String(arg);
|
|
51
|
+
});
|
|
52
|
+
parts.push(...formattedArgs);
|
|
53
|
+
}
|
|
54
|
+
return parts.join(" ");
|
|
55
|
+
};
|
|
56
|
+
const log = (messageLevel, message, ...args) => {
|
|
57
|
+
if (!shouldLog(messageLevel)) return;
|
|
58
|
+
const formatted = formatMessage(messageLevel, message, args);
|
|
59
|
+
switch (messageLevel) {
|
|
60
|
+
case "error":
|
|
61
|
+
console.error(formatted);
|
|
62
|
+
break;
|
|
63
|
+
case "warn":
|
|
64
|
+
console.warn(formatted);
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
console.log(formatted);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const logger2 = {
|
|
71
|
+
debug: (message, ...args) => log("debug", message, ...args),
|
|
72
|
+
info: (message, ...args) => log("info", message, ...args),
|
|
73
|
+
warn: (message, ...args) => log("warn", message, ...args),
|
|
74
|
+
error: (message, ...args) => log("error", message, ...args),
|
|
75
|
+
child: (childOptions) => createLogger({
|
|
76
|
+
level: currentLevel,
|
|
77
|
+
prefix: childOptions.prefix || prefix,
|
|
78
|
+
pretty,
|
|
79
|
+
timestamp
|
|
80
|
+
}),
|
|
81
|
+
setLevel: (newLevel) => {
|
|
82
|
+
currentLevel = newLevel;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
return logger2;
|
|
86
|
+
}
|
|
87
|
+
var logger = createLogger();
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
createLogger
|
|
91
|
+
};
|