designmaxxing 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/LICENSE +21 -0
- package/README.md +220 -0
- package/dist/cli/cleanup.d.ts +5 -0
- package/dist/cli/cleanup.d.ts.map +1 -0
- package/dist/cli/cleanup.js +8 -0
- package/dist/cli/cleanup.js.map +1 -0
- package/dist/cli/extract.d.ts +3 -0
- package/dist/cli/extract.d.ts.map +1 -0
- package/dist/cli/extract.js +105 -0
- package/dist/cli/extract.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +44 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/install-claude.d.ts +3 -0
- package/dist/cli/install-claude.d.ts.map +1 -0
- package/dist/cli/install-claude.js +39 -0
- package/dist/cli/install-claude.js.map +1 -0
- package/dist/cli/report.d.ts +3 -0
- package/dist/cli/report.d.ts.map +1 -0
- package/dist/cli/report.js +115 -0
- package/dist/cli/report.js.map +1 -0
- package/dist/cli/tokens.d.ts +3 -0
- package/dist/cli/tokens.d.ts.map +1 -0
- package/dist/cli/tokens.js +111 -0
- package/dist/cli/tokens.js.map +1 -0
- package/dist/cli/verify.d.ts +3 -0
- package/dist/cli/verify.d.ts.map +1 -0
- package/dist/cli/verify.js +95 -0
- package/dist/cli/verify.js.map +1 -0
- package/dist/extractors/animations.d.ts +6 -0
- package/dist/extractors/animations.d.ts.map +1 -0
- package/dist/extractors/animations.js +7 -0
- package/dist/extractors/animations.js.map +1 -0
- package/dist/extractors/assets.d.ts +6 -0
- package/dist/extractors/assets.d.ts.map +1 -0
- package/dist/extractors/assets.js +7 -0
- package/dist/extractors/assets.js.map +1 -0
- package/dist/extractors/base.d.ts +13 -0
- package/dist/extractors/base.d.ts.map +1 -0
- package/dist/extractors/base.js +27 -0
- package/dist/extractors/base.js.map +1 -0
- package/dist/extractors/behavior.d.ts +6 -0
- package/dist/extractors/behavior.d.ts.map +1 -0
- package/dist/extractors/behavior.js +7 -0
- package/dist/extractors/behavior.js.map +1 -0
- package/dist/extractors/components.d.ts +6 -0
- package/dist/extractors/components.d.ts.map +1 -0
- package/dist/extractors/components.js +7 -0
- package/dist/extractors/components.js.map +1 -0
- package/dist/extractors/framework.d.ts +6 -0
- package/dist/extractors/framework.d.ts.map +1 -0
- package/dist/extractors/framework.js +7 -0
- package/dist/extractors/framework.js.map +1 -0
- package/dist/extractors/layout.d.ts +6 -0
- package/dist/extractors/layout.d.ts.map +1 -0
- package/dist/extractors/layout.js +7 -0
- package/dist/extractors/layout.js.map +1 -0
- package/dist/extractors/network.d.ts +6 -0
- package/dist/extractors/network.d.ts.map +1 -0
- package/dist/extractors/network.js +7 -0
- package/dist/extractors/network.js.map +1 -0
- package/dist/extractors/orchestrator.d.ts +4 -0
- package/dist/extractors/orchestrator.d.ts.map +1 -0
- package/dist/extractors/orchestrator.js +96 -0
- package/dist/extractors/orchestrator.js.map +1 -0
- package/dist/extractors/typography.d.ts +6 -0
- package/dist/extractors/typography.d.ts.map +1 -0
- package/dist/extractors/typography.js +7 -0
- package/dist/extractors/typography.js.map +1 -0
- package/dist/extractors/visual.d.ts +6 -0
- package/dist/extractors/visual.d.ts.map +1 -0
- package/dist/extractors/visual.js +7 -0
- package/dist/extractors/visual.js.map +1 -0
- package/dist/generators/component-inventory.d.ts +4 -0
- package/dist/generators/component-inventory.d.ts.map +1 -0
- package/dist/generators/component-inventory.js +218 -0
- package/dist/generators/component-inventory.js.map +1 -0
- package/dist/generators/design-tokens.d.ts +5 -0
- package/dist/generators/design-tokens.d.ts.map +1 -0
- package/dist/generators/design-tokens.js +384 -0
- package/dist/generators/design-tokens.js.map +1 -0
- package/dist/generators/layout-blueprint.d.ts +4 -0
- package/dist/generators/layout-blueprint.d.ts.map +1 -0
- package/dist/generators/layout-blueprint.js +86 -0
- package/dist/generators/layout-blueprint.js.map +1 -0
- package/dist/generators/report.d.ts +3 -0
- package/dist/generators/report.d.ts.map +1 -0
- package/dist/generators/report.js +215 -0
- package/dist/generators/report.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/scripts/detect-framework.d.ts +2 -0
- package/dist/scripts/detect-framework.d.ts.map +1 -0
- package/dist/scripts/detect-framework.js +2 -0
- package/dist/scripts/detect-framework.js.map +1 -0
- package/dist/scripts/extract-components.d.ts +2 -0
- package/dist/scripts/extract-components.d.ts.map +1 -0
- package/dist/scripts/extract-components.js +2 -0
- package/dist/scripts/extract-components.js.map +1 -0
- package/dist/scripts/extract-layout.d.ts +2 -0
- package/dist/scripts/extract-layout.d.ts.map +1 -0
- package/dist/scripts/extract-layout.js +2 -0
- package/dist/scripts/extract-layout.js.map +1 -0
- package/dist/scripts/extract-styles.d.ts +2 -0
- package/dist/scripts/extract-styles.d.ts.map +1 -0
- package/dist/scripts/extract-styles.js +2 -0
- package/dist/scripts/extract-styles.js.map +1 -0
- package/dist/scripts/extract-typography.d.ts +2 -0
- package/dist/scripts/extract-typography.d.ts.map +1 -0
- package/dist/scripts/extract-typography.js +2 -0
- package/dist/scripts/extract-typography.js.map +1 -0
- package/dist/types/config.d.ts +80 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +37 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/extraction.d.ts +204 -0
- package/dist/types/extraction.d.ts.map +1 -0
- package/dist/types/extraction.js +2 -0
- package/dist/types/extraction.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/report.d.ts +18 -0
- package/dist/types/report.d.ts.map +1 -0
- package/dist/types/report.js +2 -0
- package/dist/types/report.js.map +1 -0
- package/dist/types/tokens.d.ts +62 -0
- package/dist/types/tokens.d.ts.map +1 -0
- package/dist/types/tokens.js +2 -0
- package/dist/types/tokens.js.map +1 -0
- package/dist/utils/color.d.ts +21 -0
- package/dist/utils/color.d.ts.map +1 -0
- package/dist/utils/color.js +107 -0
- package/dist/utils/color.js.map +1 -0
- package/dist/utils/css-parser.d.ts +31 -0
- package/dist/utils/css-parser.d.ts.map +1 -0
- package/dist/utils/css-parser.js +77 -0
- package/dist/utils/css-parser.js.map +1 -0
- package/dist/utils/dedup.d.ts +12 -0
- package/dist/utils/dedup.d.ts.map +1 -0
- package/dist/utils/dedup.js +44 -0
- package/dist/utils/dedup.js.map +1 -0
- package/dist/utils/fs.d.ts +6 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +17 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/screenshot-diff.d.ts +7 -0
- package/dist/utils/screenshot-diff.d.ts.map +1 -0
- package/dist/utils/screenshot-diff.js +43 -0
- package/dist/utils/screenshot-diff.js.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mercuriumgroup
|
|
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,220 @@
|
|
|
1
|
+
# designmaxxing
|
|
2
|
+
|
|
3
|
+
Pixel-perfect UI reverse engineering toolkit. Extract design tokens, components, and layout from any web app and turn them into actionable design system assets.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx designmaxxing extract https://stripe.com/payments
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Global
|
|
15
|
+
npm install -g designmaxxing
|
|
16
|
+
|
|
17
|
+
# Per-project
|
|
18
|
+
npm install --save-dev designmaxxing
|
|
19
|
+
|
|
20
|
+
# Claude Code integration
|
|
21
|
+
npx designmaxxing install-claude
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## CLI Reference
|
|
25
|
+
|
|
26
|
+
### `extract <url>`
|
|
27
|
+
|
|
28
|
+
Navigate to a URL with a headless browser and extract design data.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
designmaxxing extract https://example.com [options]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
| Option | Default | Description |
|
|
35
|
+
|--------|---------|-------------|
|
|
36
|
+
| `--modules <list>` | `all` | Comma-separated modules: `visual,typography,layout,components,assets,animations,behavior,framework,network` |
|
|
37
|
+
| `--breakpoints <list>` | `375,768,1024,1280,1536` | Comma-separated viewport widths |
|
|
38
|
+
| `-o, --output <dir>` | `./designmaxxing-output` | Output directory |
|
|
39
|
+
| `--auth-cookies <file>` | — | Path to cookies JSON for authenticated pages |
|
|
40
|
+
| `--selector <css>` | — | Limit extraction to elements matching CSS selector |
|
|
41
|
+
| `--full-page` | `true` | Extract entire page (not just viewport) |
|
|
42
|
+
| `--no-headless` | — | Run browser in headed mode |
|
|
43
|
+
| `--timeout <ms>` | `30000` | Navigation timeout in milliseconds |
|
|
44
|
+
| `--wait-for-selector <css>` | — | Wait for this selector before extracting |
|
|
45
|
+
|
|
46
|
+
### `tokens <dir>`
|
|
47
|
+
|
|
48
|
+
Generate design tokens from extracted data.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
designmaxxing tokens ./designmaxxing-output [options]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
| Option | Default | Description |
|
|
55
|
+
|--------|---------|-------------|
|
|
56
|
+
| `--format <type>` | `all` | `json`, `css`, `tailwind`, `scss`, or `all` |
|
|
57
|
+
| `-o, --output <dir>` | Same as `<dir>` | Output directory for token files |
|
|
58
|
+
|
|
59
|
+
### `report <dir>`
|
|
60
|
+
|
|
61
|
+
Generate a visual HTML (or Markdown) design system report.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
designmaxxing report ./designmaxxing-output [options]
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| Option | Default | Description |
|
|
68
|
+
|--------|---------|-------------|
|
|
69
|
+
| `--format <type>` | `html` | `html` or `markdown` |
|
|
70
|
+
| `--open` | — | Open report in browser after generation |
|
|
71
|
+
| `--no-screenshots` | — | Skip embedding screenshots |
|
|
72
|
+
|
|
73
|
+
### `verify <original-url>`
|
|
74
|
+
|
|
75
|
+
Visual regression comparison between the original site and a rebuild.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
designmaxxing verify https://original.com --rebuild https://my-rebuild.com [options]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
| Option | Default | Description |
|
|
82
|
+
|--------|---------|-------------|
|
|
83
|
+
| `--breakpoints <list>` | `375,768,1024,1280,1536` | Comma-separated viewport widths |
|
|
84
|
+
| `--threshold <ratio>` | `0.02` | Max acceptable pixel diff ratio (0–1) |
|
|
85
|
+
| `-o, --output <dir>` | `./designmaxxing-verify` | Output directory |
|
|
86
|
+
|
|
87
|
+
### `cleanup [dir]`
|
|
88
|
+
|
|
89
|
+
Remove extraction output directories.
|
|
90
|
+
|
|
91
|
+
### `install-claude`
|
|
92
|
+
|
|
93
|
+
Install the `/designmaxxing` skill and AI agents into Claude Code.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Programmatic API
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { extractAll } from 'designmaxxing'
|
|
101
|
+
|
|
102
|
+
const manifest = await extractAll({
|
|
103
|
+
url: 'https://example.com',
|
|
104
|
+
modules: ['visual', 'typography', 'layout'],
|
|
105
|
+
breakpoints: [375, 768, 1280],
|
|
106
|
+
output: './my-output',
|
|
107
|
+
headless: true,
|
|
108
|
+
fullPage: true,
|
|
109
|
+
timeout: 30000,
|
|
110
|
+
viewport: { width: 1280, height: 800 },
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
console.log(manifest.results) // { visual: 'visual.json', typography: 'typography.json', ... }
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Claude Code Integration
|
|
119
|
+
|
|
120
|
+
After running `designmaxxing install-claude`, the `/designmaxxing` skill is available in Claude Code.
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
/designmaxxing https://stripe.com/payments
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
This orchestrates four agents in sequence:
|
|
127
|
+
|
|
128
|
+
| Agent | Role |
|
|
129
|
+
|-------|------|
|
|
130
|
+
| **extractor** | Runs the CLI and captures all design data |
|
|
131
|
+
| **analyzer** | Reads the extraction output and identifies the design system |
|
|
132
|
+
| **reconstructor** | Generates components matching the original |
|
|
133
|
+
| **verifier** | Runs `designmaxxing verify` and reports diff results |
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Configuration
|
|
138
|
+
|
|
139
|
+
Create `.designmaxxingrc` in your project root:
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"breakpoints": [375, 768, 1024, 1280, 1536],
|
|
144
|
+
"modules": ["visual", "typography", "layout", "components", "assets", "animations", "behavior"],
|
|
145
|
+
"output": "./designmaxxing-output",
|
|
146
|
+
"headless": true,
|
|
147
|
+
"fullPage": true,
|
|
148
|
+
"timeout": 30000,
|
|
149
|
+
"viewport": { "width": 1280, "height": 800 }
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
See `.designmaxxingrc.example` for the full annotated reference.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Output Structure
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
designmaxxing-output/
|
|
161
|
+
├── manifest.json # Links all results + metadata
|
|
162
|
+
├── visual.json # Colors, shadows, borders, spacing
|
|
163
|
+
├── typography.json # Type scale, font faces
|
|
164
|
+
├── layout.json # Grid/flex configs, breakpoints
|
|
165
|
+
├── components.json # Component inventory with states
|
|
166
|
+
├── assets.json # Asset inventory (fonts, images, SVGs)
|
|
167
|
+
├── animations.json # Transitions and keyframes
|
|
168
|
+
├── behavior.json # Scroll behavior, forms, events
|
|
169
|
+
├── framework.json # Tech stack detection
|
|
170
|
+
├── network.json # API endpoints observed during load
|
|
171
|
+
├── tokens.json # Generated design tokens
|
|
172
|
+
├── tokens.css # CSS custom properties (:root {...})
|
|
173
|
+
├── tokens.tailwind.ts # Tailwind theme extension
|
|
174
|
+
├── tokens.scss # SCSS variables
|
|
175
|
+
├── report.html # Visual HTML design system report
|
|
176
|
+
├── analysis.md # Markdown summary
|
|
177
|
+
└── screenshots/
|
|
178
|
+
├── breakpoint-375.png
|
|
179
|
+
├── breakpoint-768.png
|
|
180
|
+
└── breakpoint-1280.png
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Troubleshooting
|
|
186
|
+
|
|
187
|
+
**Playwright not installed**
|
|
188
|
+
```bash
|
|
189
|
+
npx playwright install chromium
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Auth-gated pages**
|
|
193
|
+
|
|
194
|
+
Export your session cookies from the browser (e.g. using a browser extension), save as `cookies.json`, then:
|
|
195
|
+
```bash
|
|
196
|
+
designmaxxing extract https://app.example.com --auth-cookies cookies.json
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**SPA not rendering**
|
|
200
|
+
```bash
|
|
201
|
+
designmaxxing extract https://example.com --wait-for-selector ".main-content"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**CORS font blocking**
|
|
205
|
+
|
|
206
|
+
Expected — font URLs are still captured in `typography.json`, but the font files themselves won't download. This is normal.
|
|
207
|
+
|
|
208
|
+
**Slow extraction**
|
|
209
|
+
|
|
210
|
+
Limit to only the modules you need:
|
|
211
|
+
```bash
|
|
212
|
+
designmaxxing extract https://example.com --modules visual,typography
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Requirements
|
|
218
|
+
|
|
219
|
+
- Node.js ≥ 18
|
|
220
|
+
- Chromium (auto-installed by Playwright on first run)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../../src/cli/cleanup.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;AAIpC,wBAAgB,eAAe,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,CAEnD;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAEhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup.js","sourceRoot":"","sources":["../../src/cli/cleanup.ts"],"names":[],"mappings":"AAEA,MAAM,QAAQ,GAAgB,EAAE,CAAA;AAEhC,MAAM,UAAU,eAAe,CAAC,EAAa;IAC3C,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACnB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AACpD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/cli/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAUnC,wBAAgB,oBAAoB,IAAI,OAAO,CAiG9C"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import { extractAll } from '../extractors/orchestrator.js';
|
|
5
|
+
import { ConfigSchema, ExtractionModules } from '../types/config.js';
|
|
6
|
+
import { registerCleanup } from './cleanup.js';
|
|
7
|
+
import { ZodError } from 'zod';
|
|
8
|
+
const VALID_MODULES = [...ExtractionModules];
|
|
9
|
+
export function createExtractCommand() {
|
|
10
|
+
return new Command('extract')
|
|
11
|
+
.description('Extract design data from a web page')
|
|
12
|
+
.argument('<url>', 'URL to extract from')
|
|
13
|
+
.option('--modules <list>', 'Comma-separated modules to run (or "all")', 'all')
|
|
14
|
+
.option('--breakpoints <list>', 'Comma-separated viewport widths', '375,768,1024,1280,1536')
|
|
15
|
+
.option('-o, --output <dir>', 'Output directory', './designmaxxing-output')
|
|
16
|
+
.option('--auth-cookies <file>', 'Path to cookies JSON for authenticated pages')
|
|
17
|
+
.option('--selector <css>', 'Limit extraction to elements matching CSS selector')
|
|
18
|
+
.option('--full-page', 'Extract entire page (not just viewport)', true)
|
|
19
|
+
.option('--no-headless', 'Run browser in headed mode')
|
|
20
|
+
.option('--timeout <ms>', 'Navigation timeout in milliseconds', '30000')
|
|
21
|
+
.option('--wait-for-selector <css>', 'Wait for this selector before extracting')
|
|
22
|
+
.action(async (url, options) => {
|
|
23
|
+
// 1. Parse modules
|
|
24
|
+
let parsedModules;
|
|
25
|
+
if (options.modules === 'all') {
|
|
26
|
+
parsedModules = [...VALID_MODULES];
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
const rawModules = options.modules.split(',').map(m => m.trim());
|
|
30
|
+
const invalid = rawModules.filter(m => !VALID_MODULES.includes(m));
|
|
31
|
+
if (invalid.length > 0) {
|
|
32
|
+
console.error(chalk.red(`Invalid module(s): ${invalid.join(', ')}`));
|
|
33
|
+
console.error(chalk.gray(`Valid modules: ${VALID_MODULES.join(', ')}`));
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
parsedModules = rawModules;
|
|
37
|
+
}
|
|
38
|
+
// 2. Parse breakpoints
|
|
39
|
+
const parsedBreakpoints = options.breakpoints
|
|
40
|
+
.split(',')
|
|
41
|
+
.map(b => parseInt(b.trim(), 10))
|
|
42
|
+
.filter(b => !isNaN(b));
|
|
43
|
+
// 3. Build config and validate
|
|
44
|
+
let config;
|
|
45
|
+
try {
|
|
46
|
+
config = ConfigSchema.parse({
|
|
47
|
+
url,
|
|
48
|
+
modules: parsedModules,
|
|
49
|
+
breakpoints: parsedBreakpoints,
|
|
50
|
+
output: options.output,
|
|
51
|
+
authCookies: options.authCookies,
|
|
52
|
+
selector: options.selector,
|
|
53
|
+
fullPage: options.fullPage,
|
|
54
|
+
headless: options.headless !== false,
|
|
55
|
+
timeout: parseInt(options.timeout),
|
|
56
|
+
waitForSelector: options.waitForSelector,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
if (err instanceof ZodError) {
|
|
61
|
+
console.error(chalk.red('Invalid configuration:'));
|
|
62
|
+
for (const issue of err.issues) {
|
|
63
|
+
console.error(chalk.red(` ${issue.path.join('.')}: ${issue.message}`));
|
|
64
|
+
}
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
69
|
+
// 4. Show banner
|
|
70
|
+
console.log(chalk.cyan('\n✦ designmaxxing') + chalk.gray(' — extracting from ') + chalk.white(url));
|
|
71
|
+
// 5. Create spinner
|
|
72
|
+
const spinner = ora('Initializing browser...').start();
|
|
73
|
+
// 6. Register cleanup
|
|
74
|
+
registerCleanup(async () => { spinner.stop(); });
|
|
75
|
+
try {
|
|
76
|
+
// 7. Call extractAll
|
|
77
|
+
await extractAll(config);
|
|
78
|
+
// 8. On success
|
|
79
|
+
spinner.succeed(chalk.green('Extraction complete'));
|
|
80
|
+
console.log(chalk.gray('\nOutput saved to: ') + chalk.white(config.output));
|
|
81
|
+
console.log(chalk.gray('Next step: ') + chalk.white(`designmaxxing tokens ${config.output}`));
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
if (err instanceof ZodError) {
|
|
85
|
+
// 9. ZodError
|
|
86
|
+
spinner.fail('Invalid configuration');
|
|
87
|
+
for (const issue of err.issues) {
|
|
88
|
+
console.error(chalk.red(` ${issue.path.join('.')}: ${issue.message}`));
|
|
89
|
+
}
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
else if (err instanceof Error) {
|
|
93
|
+
// 10. Other Error
|
|
94
|
+
spinner.fail(chalk.red(err.message));
|
|
95
|
+
console.error(chalk.gray('Tip: check that the URL is accessible and the server is reachable.'));
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
spinner.fail(chalk.red('Unknown error'));
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=extract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../src/c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AAC,CAAC,CAAA;YACjB,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { readFile } from 'node:fs/promises';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
6
|
+
import { runCleanup } from './cleanup.js';
|
|
7
|
+
import { createExtractCommand } from './extract.js';
|
|
8
|
+
import { createTokensCommand } from './tokens.js';
|
|
9
|
+
import { createVerifyCommand } from './verify.js';
|
|
10
|
+
import { createReportCommand } from './report.js';
|
|
11
|
+
import { createInstallClaudeCommand } from './install-claude.js';
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = dirname(__filename);
|
|
14
|
+
async function getVersion() {
|
|
15
|
+
const raw = await readFile(join(__dirname, '../../package.json'), 'utf-8');
|
|
16
|
+
return JSON.parse(raw).version;
|
|
17
|
+
}
|
|
18
|
+
async function main() {
|
|
19
|
+
process.on('SIGINT', async () => {
|
|
20
|
+
await runCleanup();
|
|
21
|
+
process.exit(0);
|
|
22
|
+
});
|
|
23
|
+
process.on('SIGTERM', async () => {
|
|
24
|
+
await runCleanup();
|
|
25
|
+
process.exit(0);
|
|
26
|
+
});
|
|
27
|
+
const version = await getVersion();
|
|
28
|
+
const program = new Command()
|
|
29
|
+
.name('designmaxxing')
|
|
30
|
+
.description('Pixel-perfect UI reverse engineering toolkit')
|
|
31
|
+
.version(version);
|
|
32
|
+
// Commands will be registered here as they are built in later phases
|
|
33
|
+
program.addCommand(createExtractCommand());
|
|
34
|
+
program.addCommand(createTokensCommand());
|
|
35
|
+
program.addCommand(createVerifyCommand());
|
|
36
|
+
program.addCommand(createReportCommand());
|
|
37
|
+
program.addCommand(createInstallClaudeCommand());
|
|
38
|
+
await program.parseAsync(process.argv);
|
|
39
|
+
}
|
|
40
|
+
main().catch((err) => {
|
|
41
|
+
console.error((err instanceof Error ? err.message : String(err)));
|
|
42
|
+
process.exit(1);
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAEhE,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAErC,KAAK,UAAU,UAAU;IACvB,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,CAAA;IAC1E,OAAQ,IAAI,CAAC,KAAK,CAAC,GAAG,CAAyB,CAAC,OAAO,CAAA;AACzD,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,OAAO,CAAC,EAAE,CAAC,QAAQ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-claude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAWnC,wBAAgB,0BAA0B,IAAI,OAAO,CA4BpD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { execFile } from 'node:child_process';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { dirname } from 'node:path';
|
|
6
|
+
import { access } from 'node:fs/promises';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
export function createInstallClaudeCommand() {
|
|
11
|
+
return new Command('install-claude')
|
|
12
|
+
.description('Install the /designmaxxing skill and agents into Claude Code')
|
|
13
|
+
.action(async () => {
|
|
14
|
+
// Find the script relative to this file — works from both src/ and dist/
|
|
15
|
+
const scriptPath = join(__dirname, '../../scripts/install-claude.sh');
|
|
16
|
+
try {
|
|
17
|
+
await access(scriptPath);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
console.log(chalk.yellow('install-claude script not found at:'), chalk.gray(scriptPath));
|
|
21
|
+
console.log(chalk.white('Run manually: npm run install-claude'));
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
console.log(chalk.cyan('Installing designmaxxing Claude Code integration...'));
|
|
25
|
+
execFile('bash', [scriptPath], (err, stdout, stderr) => {
|
|
26
|
+
if (err) {
|
|
27
|
+
console.error(chalk.red('Installation failed:'), err.message);
|
|
28
|
+
if (stderr)
|
|
29
|
+
console.error(chalk.gray(stderr));
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
if (stdout)
|
|
33
|
+
console.log(stdout);
|
|
34
|
+
console.log(chalk.green('✓ Claude Code integration installed'));
|
|
35
|
+
console.log(chalk.gray(' /designmaxxing skill is now available in Claude Code'));
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=install-claude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-claude.js","sourceRoot":"","sources":["../../src/cli/install-claude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAErC,MAAM,UAAU,0BAA0B;IACxC,OAAO,IAAI,OAAO,CAAC,gBAAgB,CAAC;SACjC,WAAW,CAAC,8DAA8D,CAAC;SAC3E,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,yEAAyE;QACzE,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,iCAAiC,CAAC,CAAA;QAErE,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,UAAU,CAAC,CAAA;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,qCAAqC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAA;YACxF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC,CAAA;YAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC,CAAA;QAE9E,QAAQ,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACrD,IAAI,GAAG,EAAE,CAAC;gBACR,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,sBAAsB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;gBAC7D,IAAI,MAAM;oBAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;gBAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACjB,CAAC;YACD,IAAI,MAAM;gBAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;YAC/B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,CAAA;YAC/D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAC,CAAA;QACnF,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/cli/report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAqBnC,wBAAgB,mBAAmB,IAAI,OAAO,CAuG7C"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import { join, resolve } from 'node:path';
|
|
5
|
+
import { readFile, writeFile, access, readdir } from 'node:fs/promises';
|
|
6
|
+
import { exec, execFile } from 'node:child_process';
|
|
7
|
+
import { generateReport } from '../generators/report.js';
|
|
8
|
+
async function tryReadJson(filePath) {
|
|
9
|
+
try {
|
|
10
|
+
await access(filePath);
|
|
11
|
+
const raw = await readFile(filePath, 'utf-8');
|
|
12
|
+
return JSON.parse(raw);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function createReportCommand() {
|
|
19
|
+
return new Command('report')
|
|
20
|
+
.description('Generate a visual HTML report from extraction data')
|
|
21
|
+
.argument('<dir>', 'Path to extraction output directory')
|
|
22
|
+
.option('--format <type>', 'Report format: html, markdown', 'html')
|
|
23
|
+
.option('--open', 'Open report in browser after generation')
|
|
24
|
+
.option('--no-screenshots', 'Skip embedding screenshots')
|
|
25
|
+
.action(async (dir, options) => {
|
|
26
|
+
const outputDir = resolve(dir);
|
|
27
|
+
const spinner = ora('Loading extraction data…').start();
|
|
28
|
+
try {
|
|
29
|
+
// 1. Read manifest.json
|
|
30
|
+
const manifestPath = join(outputDir, 'manifest.json');
|
|
31
|
+
const manifest = await tryReadJson(manifestPath);
|
|
32
|
+
if (!manifest) {
|
|
33
|
+
spinner.fail(chalk.red(`No manifest.json found in ${outputDir}`));
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
// 2. Read available module JSONs (gracefully skip missing ones)
|
|
37
|
+
const visual = await tryReadJson(join(outputDir, 'visual.json'));
|
|
38
|
+
const typography = await tryReadJson(join(outputDir, 'typography.json'));
|
|
39
|
+
const layout = await tryReadJson(join(outputDir, 'layout.json'));
|
|
40
|
+
const components = await tryReadJson(join(outputDir, 'components.json'));
|
|
41
|
+
const animations = await tryReadJson(join(outputDir, 'animations.json'));
|
|
42
|
+
// 3. Read tokens.json if it exists
|
|
43
|
+
const tokens = await tryReadJson(join(outputDir, 'tokens.json'));
|
|
44
|
+
// 4. Build screenshot paths map from screenshots/ dir
|
|
45
|
+
const screenshotPaths = {};
|
|
46
|
+
const screenshotDir = join(outputDir, 'screenshots');
|
|
47
|
+
try {
|
|
48
|
+
const files = await readdir(screenshotDir);
|
|
49
|
+
for (const file of files) {
|
|
50
|
+
const match = /breakpoint-(\d+)\.png$/.exec(file);
|
|
51
|
+
if (match) {
|
|
52
|
+
screenshotPaths[parseInt(match[1], 10)] = join(screenshotDir, file);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// no screenshots directory — that's fine
|
|
58
|
+
}
|
|
59
|
+
// Count assets and endpoints from nested results
|
|
60
|
+
const assetCount = (await tryReadJson(join(outputDir, 'assets.json')))?.assets.length ?? 0;
|
|
61
|
+
const endpointCount = (await tryReadJson(join(outputDir, 'network.json')))?.endpoints.length ?? 0;
|
|
62
|
+
// 5. Build ReportData
|
|
63
|
+
const includeScreenshots = options.screenshots !== false;
|
|
64
|
+
const reportData = {
|
|
65
|
+
manifest,
|
|
66
|
+
tokens,
|
|
67
|
+
visual,
|
|
68
|
+
typography,
|
|
69
|
+
layout,
|
|
70
|
+
components,
|
|
71
|
+
animations,
|
|
72
|
+
screenshotPaths,
|
|
73
|
+
frameworkReport: manifest.framework ?? null,
|
|
74
|
+
assetCount,
|
|
75
|
+
endpointCount,
|
|
76
|
+
includeScreenshots,
|
|
77
|
+
};
|
|
78
|
+
// 6. Validate format
|
|
79
|
+
const format = (options.format === 'markdown' ? 'markdown' : 'html');
|
|
80
|
+
spinner.text = 'Generating report…';
|
|
81
|
+
// 7. Call generateReport
|
|
82
|
+
const reportContent = await generateReport(reportData, format);
|
|
83
|
+
// 8. Write report file
|
|
84
|
+
const filename = format === 'markdown' ? 'report.md' : 'report.html';
|
|
85
|
+
const reportPath = join(outputDir, filename);
|
|
86
|
+
await writeFile(reportPath, reportContent, 'utf-8');
|
|
87
|
+
spinner.succeed(chalk.green(`Report written to ${reportPath}`));
|
|
88
|
+
// 9. If --open: open in browser (use execFile to avoid shell injection)
|
|
89
|
+
if (options.open) {
|
|
90
|
+
const platform = process.platform;
|
|
91
|
+
if (platform === 'win32') {
|
|
92
|
+
// 'start' is a shell built-in on Windows; strip quotes from path to prevent injection
|
|
93
|
+
const safePath = reportPath.replace(/['"]/g, '');
|
|
94
|
+
exec(`start "" "${safePath}"`, (err) => {
|
|
95
|
+
if (err)
|
|
96
|
+
console.error(chalk.yellow('Could not open report automatically.'));
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
const openCmd = platform === 'darwin' ? 'open' : 'xdg-open';
|
|
101
|
+
execFile(openCmd, [reportPath], (err) => {
|
|
102
|
+
if (err)
|
|
103
|
+
console.error(chalk.yellow('Could not open report automatically.'));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
spinner.fail(chalk.red('Report generation failed'));
|
|
110
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/cli/report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AACvE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAKxD,KAAK,UAAU,WAAW,CAAI,QAAgB;IAC5C,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAA;QACtB,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,EA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