launchframe 0.1.7 → 0.1.9

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 CHANGED
@@ -1,229 +1,238 @@
1
- # launchframe
2
-
3
- > Point Launchframe at SaaS sites you admire. Get back a drop-in
4
- > shadcn/ui design system you can build your own UI on top of —
5
- > with a ready-made handoff for Cursor or Claude Code.
6
-
7
- `launchframe` opens each URL in headless Chromium, harvests the
8
- **computed appearance** of the rendered page (colors, type, spacing,
9
- radii, shadows), and synthesizes an original design system as
10
- `tailwind.config.ts` + `globals.css` + `tokens.json` + a Markdown
11
- report and an AI-handoff file.
12
-
13
- It also crawls the rendered DOM into a typed `SiteLayout` and emits a
14
- **layout-mirror page** per source: a Next.js component that reconstructs
15
- the source's section tree, grid, and density from typed primitives, with
16
- `<TextSlot>` / `<MediaSlot>` placeholders where the source had copy,
17
- logos, illustrations, or product imagery. The mirror does **not** embed
18
- the source's copy text, brand assets, or product screenshots — fill those
19
- slots with your own content before shipping. Proprietary type families
20
- are substituted with open-source equivalents.
21
-
22
- ---
23
-
24
- ## Quick start (any folder)
25
-
26
- The design system is written to **`./output/<runId>/`** in whatever
27
- directory you run the command from — not inside the package.
28
-
29
- **One time per machine** (Chromium for Playwright):
30
-
31
- ```bash
32
- npx playwright install chromium
33
- ```
34
-
35
- **Every time you want a new theme:**
36
-
37
- ```bash
38
- cd path/to/your-app-or-empty-folder
39
- npx launchframe@latest https://site-a.example https://site-b.example
40
- ```
41
-
42
- When it finishes, every source URL has produced a **layout-mirror
43
- page** under `output/<runId>/mirror/<host>/page.tsx`, plus a synthesized
44
- design system at the run root.
45
-
46
- ```txt
47
- output/<runId>/
48
- ├── FOR_AI.md ← paste / @-attach this for your AI (handoff instructions)
49
- ├── tokens.json ← every aggregated value, machine-readable
50
- ├── tailwind.config.ts ← drop-in Tailwind theme
51
- ├── globals.css ← drop-in shadcn-compatible CSS variables
52
- ├── theme-preview.tsx ← render this to eyeball the system
53
- ├── REPORT.md ← what was extracted, from where, why
54
- ├── run.json ← full run metadata (sources, timing, status)
55
- ├── screenshots/ ← captured PNGs
56
- ├── raw/ ← per-site raw token + SiteLayout JSON
57
- ├── reference/ ← verbatim DOM + copy for AI (see below)
58
- │ └── <host>/
59
- │ ├── page.html ← full HTML after JavaScript
60
- │ ├── visible-text.txt paste-friendly copy extraction
61
- │ ├── visible-text.json structured headings / body / buttons
62
- │ ├── media.json ← img + video URLs
63
- │ ├── meta.json ← title, description, lang
64
- └── FOR_AI_REFERENCE.md
65
- └── mirror/
66
- └── <host>/
67
- ├── page.tsx ← Next.js: Motion + Phosphor + image/video patterns
68
- ├── layout.json
69
- └── MIRROR_NOTES.md
70
- ```
71
-
72
- ---
73
-
74
- ## Hand the output to your AI
75
-
76
- 1. Run the command above so `output/<runId>/` exists.
77
- 2. Attach **`reference/<host>/`** (`visible-text.txt`, `page.html`, `media.json`) so the model sees **exact copy and structure** from the crawl.
78
- 3. Pick the mirror folder: `output/<runId>/mirror/<host>/`.
79
- 4. Either:
80
- - **Cursor:** `@`-attach `reference/<host>/`, `mirror/<host>/`, `FOR_AI.md`, and
81
- `tokens.json`, then ask the agent to port copy from `visible-text.txt` into
82
- `page.tsx` and wire media from `media.json`.
83
- - **Claude Code:** copy both folders into your project, then ask the same.
84
- 5. The AI's authority order is **reference/visible-text.txt & page.html →
85
- MIRROR_NOTES.md page.tsx tokens.json tailwind.config.ts + globals.css**. It must:
86
- - Keep the section tree, grid composition, density, Motion, and Phosphor usage in `page.tsx`.
87
- - Map strings from `visible-text.txt` into the right `<TextSlot>` slots (or replace slots with plain JSX).
88
- - Use `media.json` for image/video `src` / `poster` (respect licensing; prefer your own assets).
89
-
90
- ---
91
-
92
- ## CLI reference
93
-
94
- ```bash
95
- npx launchframe <url> [<url> ...] [options]
96
- ```
97
-
98
- | Flag | Default | Notes |
99
- | -------------- | -------------------- | -------------------------------------------------------- |
100
- | `--out <dir>` | `./output/<runId>` (under **current working directory**) | Absolute or relative path for the run folder |
101
- | `--name <slug>`| _(unset)_ | Append a slug to the runId for findability |
102
- | `--no-robots` | _(off)_ | Skip robots.txt check (not recommended) |
103
- | `--rate <n>` | `15` | Per-domain requests per minute |
104
- | `--width <px>` | `1440` | Viewport width |
105
- | `--height <px>`| `900` | Viewport height |
106
-
107
- ```bash
108
- npx launchframe https://example.com --name my-brand
109
- npx launchframe https://a.example https://b.example https://c.example --width 1280
110
- ```
111
-
112
- ---
113
-
114
- ## What the extractor actually does
115
-
116
- For each URL:
117
-
118
- 1. Open the page in headless Chromium at a 1440 × 900 desktop viewport.
119
- 2. Take a full-page screenshot.
120
- 3. Walk the rendered DOM and harvest **computed styles** for every
121
- visible element:
122
- - Text and background colors, weighted by area
123
- - Font families, sizes, weights, line-heights, letter-spacing
124
- - Padding, gap, and margin values (snapped to a 4 px grid)
125
- - Border radii (mode-picked across the page)
126
- - Box-shadow stacks
127
- - Dominant container width (the layout signal)
128
- 4. Save the raw observations as JSON.
129
-
130
- After every site is captured, the synthesizer:
131
-
132
- 1. Clusters all colors into a representative palette and derives a full
133
- shadcn-compatible ramp (`--background`, `--foreground`, `--primary`,
134
- …) for both light and dark themes.
135
- 2. Picks a body base size from the count-weighted mode of body-range
136
- font sizes, then fits a single scale ratio that lands the largest
137
- observed heading at the `6xl` step. Substitutes proprietary type
138
- families (e.g. SF Pro, Söhne, Circular, Graphik) with open-source
139
- equivalents.
140
- 3. Snaps spacing values to a 4 px scale, takes the most-used buckets,
141
- and computes a recommended container width from the median dominant
142
- block width across the corpus.
143
- 4. Picks a representative radius and emits a tasteful three-stop shadow
144
- scale.
145
- 5. Writes drop-in files plus a Markdown report attributing every source.
146
-
147
- ```
148
- URLs ──▶ Playwright ──▶ raw tokens.json ──▶ synthesize ──▶ DesignSystem ──▶ emit
149
- (per site) (one corpus)
150
- ```
151
-
152
- ---
153
-
154
- ## Run inside this repo (contributors)
155
-
156
- ```bash
157
- git clone https://github.com/evangruhlkey/launchframe
158
- cd launchframe
159
- npm install
160
- npx playwright install chromium
161
- npm run extract -- https://site-a.example https://site-b.example
162
- ```
163
-
164
- The repo is a monorepo that also contains a research framework for
165
- classifying SaaS UI patterns and generating original shadcn blocks:
166
-
167
- ```txt
168
- launchframe/
169
- ├── apps/
170
- │ └── studio/ # Next.js dashboard for browsing patterns/blocks
171
- ├── packages/
172
- ├── extract/ # the published CLI
173
- ├── capture/ # Playwright screenshot capture (lower level)
174
- │ ├── analysis/ # Layout-tree extraction & section classifier
175
- │ ├── patterns/ # Typed pattern schemas + atlas registry loader
176
- │ ├── blocks/ # Shadcn/ui blocks + TextSlot / MediaSlot primitives
177
- └── evaluation/ # Coherence + responsiveness/a11y evaluator
178
- ├── pattern-atlas/ # Pattern catalog per category (block-composition mode)
179
- ├── prompts/ # Markdown prompts for AI agents
180
- ├── rules/ # Design / copy / a11y rules
181
- ├── registry/ # shadcn-compatible custom registry manifest
182
- └── output/ # every `extract` run lands here
183
- ```
184
-
185
- Other commands (repo-only):
186
-
187
- ```bash
188
- npm run studio # Next.js dashboard at localhost:3000
189
- npm run capture # Lower-level Playwright capture pipeline
190
- npm run analyze # Run section classifier on captured screenshots
191
- npm run formalize # Validate the pattern-atlas/*.json files
192
- npm run evaluate # Grade a generated page (coherence + a11y)
193
- npm run typecheck # Project-wide TypeScript check
194
- ```
195
-
196
- ---
197
-
198
- ## What this is not
199
-
200
- - **Not a verbatim site downloader.** The crawler builds a typed
201
- `SiteLayout` model from the rendered DOM section tree, geometry,
202
- computed style tokens, content kinds — and emits code generated from
203
- that model. It does not save the source's HTML/CSS to disk.
204
- - **Not a content lift.** Heading text, body copy, logos, illustrations,
205
- and product imagery become `<TextSlot>` / `<MediaSlot>` placeholders in
206
- the mirror page. You fill them with your own copy and assets before
207
- shipping.
208
- - **Not a component library replacement.** It sits *on top* of
209
- shadcn/ui and produces theme files plus slot-driven page templates.
210
-
211
- ---
212
-
213
- ## Responsible use in one paragraph
214
-
215
- Launchframe is intended for layout research and design-system seeding
216
- against pages you have permission to analyze (your own products, sites
217
- where the operator has permission, or pages where structural analysis is
218
- permitted by `robots.txt`). The crawler respects `robots.txt` by default
219
- and rate-limits per domain. The output is generated code derived from a
220
- normalized typed model and slot placeholders — not a verbatim copy of
221
- the source's markup, copy, or assets. Operators are responsible for the
222
- content they paste into those slots and for honoring third-party
223
- trademarks, terms of service, and licenses.
224
-
225
- ---
226
-
227
- ## License
228
-
229
- MIT. See [`LICENSE`](./LICENSE).
1
+ # launchframe
2
+
3
+ > Point Launchframe at SaaS sites you admire. Get back a drop-in
4
+ > shadcn/ui design system you can build your own UI on top of —
5
+ > with a ready-made handoff for Cursor or Claude Code.
6
+
7
+ `launchframe` opens each URL in headless Chromium, harvests the
8
+ **computed appearance** of the rendered page (colors, type, spacing,
9
+ radii, shadows), and synthesizes an original design system as
10
+ `tailwind.config.ts` + `globals.css` + `tokens.json` + a Markdown
11
+ report and an AI-handoff file.
12
+
13
+ It also crawls the rendered DOM into a typed `SiteLayout` and emits a
14
+ **layout-mirror page** per source: a Next.js component that reconstructs
15
+ the source's section tree, grid, and density from typed primitives, with
16
+ `<TextSlot>` / `<MediaSlot>` placeholders where the source had copy,
17
+ logos, illustrations, or product imagery. The mirror does **not** embed
18
+ the source's copy text, brand assets, or product screenshots — fill those
19
+ slots with your own content before shipping. Proprietary type families
20
+ are substituted with open-source equivalents.
21
+
22
+ ---
23
+
24
+ ## Quick start (any folder)
25
+
26
+ The design system is written to **`./output/<runId>/`** in whatever
27
+ directory you run the command from — not inside the package.
28
+
29
+ **One time per machine** (Chromium for Playwright):
30
+
31
+ ```bash
32
+ npx playwright install chromium
33
+ ```
34
+
35
+ **Every time you want a new theme:**
36
+
37
+ ```bash
38
+ cd path/to/your-app-or-empty-folder
39
+ npx launchframe@latest https://site-a.example https://site-b.example
40
+ ```
41
+
42
+ When it finishes, every source URL has produced a **layout-mirror
43
+ page** under `output/<runId>/mirror/<host>/page.tsx`, plus a synthesized
44
+ design system at the run root.
45
+
46
+ ```txt
47
+ output/<runId>/
48
+ ├── FOR_AI.md ← paste / @-attach this for your AI (handoff instructions)
49
+ ├── tokens.json ← every aggregated value, machine-readable
50
+ ├── tailwind.config.ts ← drop-in Tailwind theme
51
+ ├── globals.css ← drop-in shadcn-compatible CSS variables
52
+ ├── theme-preview.tsx ← render this to eyeball the system
53
+ ├── REPORT.md ← what was extracted, from where, why
54
+ ├── run.json ← full run metadata (sources, timing, status)
55
+ ├── screenshots/ ← captured PNGs
56
+ ├── raw/ ← per-site raw token + SiteLayout JSON
57
+ ├── reference/ ← verbatim DOM + **exact structure JSON** + copy for AI
58
+ │ └── <host>/
59
+ │ ├── page.html
60
+ │ ├── dom-structure.json canonical body tree (tags, attrs, text nodes)
61
+ │ ├── structure-outline.txt tag skeleton for quick scanning
62
+ │ ├── visible-text.txt
63
+ │ ├── visible-text.json
64
+ ├── media.json
65
+ │ ├── meta.json
66
+ └── FOR_AI_REFERENCE.md
67
+ └── mirror/
68
+ └── <host>/
69
+ ├── page.tsx ← Next.js: Motion + Phosphor + image/video patterns
70
+ ├── layout.json
71
+ └── MIRROR_NOTES.md
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Hand the output to your AI
77
+
78
+ 1. Run the command above so `output/<runId>/` exists.
79
+ 2. Attach **`reference/<host>/`**, especially **`dom-structure.json`** (exact tree) and **`visible-text.*`**, plus **`page.html`** and **`media.json`** so the model sees **exact structure and copy** from the crawl.
80
+ 3. Pick the mirror folder: `output/<runId>/mirror/<host>/`.
81
+ 4. Either:
82
+ - **Cursor:** `@`-attach `reference/<host>/`, `mirror/<host>/`, `FOR_AI.md`, and
83
+ `tokens.json`, then ask the agent to port copy from `visible-text.txt` into
84
+ `page.tsx` and wire media from `media.json`.
85
+ - **Claude Code:** copy both folders into your project, then ask the same.
86
+ 5. The AI's authority order is **`dom-structure.json` (nesting) `structure-outline.txt` / `page.html` `visible-text.*` →
87
+ MIRROR_NOTES.md mirror `page.tsx` tokens.json tailwind.config.ts + globals.css**. It must:
88
+ - Keep the section tree, grid composition, density, Motion, and Phosphor usage in `page.tsx`.
89
+ - Map strings from `visible-text.txt` into the right `<TextSlot>` slots (or replace slots with plain JSX).
90
+ - Use `media.json` for image/video `src` / `poster` (respect licensing; prefer your own assets).
91
+
92
+ ---
93
+
94
+ ## CLI reference
95
+
96
+ ```bash
97
+ npx launchframe <url> [<url> ...] [options]
98
+ ```
99
+
100
+ | Flag | Default | Notes |
101
+ | -------------- | -------------------- | -------------------------------------------------------- |
102
+ | `--out <dir>` | `./output/<runId>` (under **current working directory**) | Absolute or relative path for the run folder |
103
+ | `--name <slug>`| _(unset)_ | Append a slug to the runId for findability |
104
+ | `--no-robots` | _(off)_ | Skip robots.txt check (not recommended) |
105
+ | `--rate <n>` | `15` | Per-domain requests per minute |
106
+ | `--width <px>` | `1440` | Viewport width |
107
+ | `--height <px>`| `900` | Viewport height |
108
+
109
+ ```bash
110
+ npx launchframe https://example.com --name my-brand
111
+ npx launchframe https://a.example https://b.example https://c.example --width 1280
112
+ ```
113
+
114
+ ---
115
+
116
+ ## What the extractor actually does
117
+
118
+ For each URL:
119
+
120
+ 1. Open the page in headless Chromium at a 1440 × 900 desktop viewport.
121
+ 2. Take a full-page screenshot.
122
+ 3. Walk the rendered DOM and harvest **computed styles** for every
123
+ visible element:
124
+ - Text and background colors, weighted by area
125
+ - Font families, sizes, weights, line-heights, letter-spacing
126
+ - Padding, gap, and margin values (snapped to a 4 px grid)
127
+ - Border radii (mode-picked across the page)
128
+ - Box-shadow stacks
129
+ - Dominant container width (the layout signal)
130
+ 4. Save the raw observations as JSON.
131
+
132
+ After every site is captured, the synthesizer:
133
+
134
+ 1. Clusters all colors into a representative palette and derives a full
135
+ shadcn-compatible ramp (`--background`, `--foreground`, `--primary`,
136
+ …) for both light and dark themes.
137
+ 2. Picks a body base size from the count-weighted mode of body-range
138
+ font sizes, then fits a single scale ratio that lands the largest
139
+ observed heading at the `6xl` step. Substitutes proprietary type
140
+ families (e.g. SF Pro, Söhne, Circular, Graphik) with open-source
141
+ equivalents.
142
+ 3. Snaps spacing values to a 4 px scale, takes the most-used buckets,
143
+ and computes a recommended container width from the median dominant
144
+ block width across the corpus.
145
+ 4. Picks a representative radius and emits a tasteful three-stop shadow
146
+ scale.
147
+ 5. Writes drop-in files plus a Markdown report attributing every source.
148
+
149
+ ```
150
+ URLs ──▶ Playwright ──▶ raw tokens.json ──▶ synthesize ──▶ DesignSystem ──▶ emit
151
+ (per site) (one corpus)
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Run inside this repo (contributors)
157
+
158
+ ```bash
159
+ git clone https://github.com/evangruhlkey/launchframe
160
+ cd launchframe
161
+ npm install
162
+ npx playwright install chromium
163
+ npm run extract -- https://site-a.example https://site-b.example
164
+ ```
165
+
166
+ The repo is a monorepo that also contains a research framework for
167
+ classifying SaaS UI patterns and generating original shadcn blocks:
168
+
169
+ ```txt
170
+ launchframe/
171
+ ├── apps/
172
+ └── studio/ # Next.js dashboard for browsing patterns/blocks
173
+ ├── packages/
174
+ │ ├── extract/ # the published CLI
175
+ │ ├── capture/ # Playwright screenshot capture (lower level)
176
+ │ ├── analysis/ # Layout-tree extraction & section classifier
177
+ ├── patterns/ # Typed pattern schemas + atlas registry loader
178
+ ├── blocks/ # Shadcn/ui blocks + TextSlot / MediaSlot primitives
179
+ │ └── evaluation/ # Coherence + responsiveness/a11y evaluator
180
+ ├── pattern-atlas/ # Pattern catalog per category (block-composition mode)
181
+ ├── prompts/ # Markdown prompts for AI agents
182
+ ├── rules/ # Design / copy / a11y rules
183
+ ├── registry/ # shadcn-compatible custom registry manifest
184
+ └── output/ # ← every `extract` run lands here
185
+ ```
186
+
187
+ Other commands (repo-only):
188
+
189
+ ```bash
190
+ npm run studio # Next.js dashboard at localhost:3000
191
+ npm run capture # Lower-level Playwright capture pipeline
192
+ npm run analyze # Run section classifier on captured screenshots
193
+ npm run formalize # Validate the pattern-atlas/*.json files
194
+ npm run evaluate # Grade a generated page (coherence + a11y)
195
+ npm run typecheck # Project-wide TypeScript check
196
+ npm run sync:agents # Regenerate Copilot / Cline / Continue / Amazon Q stubs from AGENTS.md
197
+ ```
198
+
199
+ ### AI agents in this repo
200
+
201
+ - **`AGENTS.md`** (root) is the **single source of truth** for how agents should work here (extract handoff, structure fidelity, compliance). **`docs/research/INSPECTION_GUIDE.md`** is inlined into derived configs when you run `npm run sync:agents`.
202
+ - **Cursor:** `.cursor/rules/project.mdc` points at `AGENTS.md`.
203
+ - **Claude Code / Gemini CLI:** `CLAUDE.md` and `GEMINI.md` import `AGENTS.md`.
204
+ - Edit `AGENTS.md`, then run `npm run sync:agents` (or `bash scripts/sync-agent-rules.sh`) to refresh `.github/copilot-instructions.md`, `.clinerules`, `.continue/rules/project.md`, and `.amazonq/rules/project.md`.
205
+
206
+ ---
207
+
208
+ ## What this is not
209
+
210
+ - **Not the source site's frontend bundle.** The **layout mirror** is React
211
+ code emitted from a typed `SiteLayout` (section tree, composition,
212
+ density) — not a dump of the origin's original components or stylesheets.
213
+ - **Not a substitute for legal clearance.** `reference/<host>/` may contain
214
+ serialized DOM and visible text for tooling **you** run on pages you are
215
+ allowed to analyze. You are responsible for trademarks, copy licenses, and
216
+ `robots.txt`/ToS compliance when using those artifacts.
217
+ - **Not a component library replacement.** Launchframe sits *alongside*
218
+ shadcn/ui: theme files, reference dumps, and slot-driven mirror pages —
219
+ you integrate into your own app.
220
+
221
+ ---
222
+
223
+ ## Responsible use in one paragraph
224
+
225
+ Launchframe is intended for layout research and design-system seeding
226
+ against pages you have permission to analyze (your own products, sites
227
+ where the operator has permission, or pages where structural analysis is
228
+ permitted by `robots.txt`). The crawler respects `robots.txt` by default
229
+ and rate-limits per domain. Output includes synthesized theme files, a
230
+ typed **mirror** page scaffold, and (per capture) a **reference** bundle
231
+ (DOM snapshot, visible text, media URLs) for AI-assisted reconstruction.
232
+ Operators remain responsible for how they use copy, media, and branding.
233
+
234
+ ---
235
+
236
+ ## License
237
+
238
+ MIT. See [`LICENSE`](./LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "launchframe",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Point Launchframe at SaaS sites you admire and get back a drop-in shadcn/ui design system (tokens, Tailwind theme, CSS variables, AI handoff) you can build your own UI on top of.",
5
5
  "license": "MIT",
6
6
  "author": "Evan Gruhlkey",
@@ -46,6 +46,7 @@
46
46
  "analyze": "tsx packages/analysis/analyze-screenshot.ts",
47
47
  "formalize": "tsx packages/patterns/pattern-registry.ts",
48
48
  "evaluate": "tsx packages/evaluation/evaluate-page.ts",
49
+ "sync:agents": "node scripts/sync-agent-rules.mjs",
49
50
  "typecheck": "tsc -p tsconfig.json --noEmit",
50
51
  "format:check": "prettier --check ."
51
52
  },