designlang 12.4.0 → 12.8.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.
@@ -50,6 +50,11 @@ import { formatScoreBadge } from '../src/formatters/badge.js';
50
50
  import { formatRemix } from '../src/formatters/remix.js';
51
51
  import { VOCABULARIES, getVocabulary, listVocabularies } from '../src/vocabularies/index.js';
52
52
  import { buildPack } from '../src/pack.js';
53
+ import { recolorDesign } from '../src/recolor.js';
54
+ import { formatThemeSwap, formatThemeSwapMarkdown } from '../src/formatters/theme-swap.js';
55
+ import { formatBrandBook, formatBrandBookMarkdown } from '../src/formatters/brand-book.js';
56
+ import { fuseDesigns, AXES } from '../src/fuse.js';
57
+ import { formatPair, formatPairMarkdown } from '../src/formatters/pair.js';
53
58
  import { nameFromUrl } from '../src/utils.js';
54
59
 
55
60
  function validateUrl(url) {
@@ -1225,6 +1230,296 @@ program
1225
1230
  }
1226
1231
  });
1227
1232
 
1233
+ // ── Theme-swap command — recolour an extracted design around a new primary
1234
+ program
1235
+ .command('theme-swap <url>')
1236
+ .description('Recolour the extracted design around a new brand primary (preserves type, spacing, neutrals)')
1237
+ .requiredOption('--primary <hex>', 'target primary colour as hex (e.g. "#ff4800")')
1238
+ .option('--from <hex>', 'override the auto-detected source primary (e.g. when the extractor misclassifies)')
1239
+ .option('-o, --out <dir>', 'output directory', './design-extract-output')
1240
+ .option('-n, --name <name>', 'output file prefix (default: derived from URL + target hex)')
1241
+ .option('--format <fmt>', 'output format: html, md, json, tokens, all', 'all')
1242
+ .option('--open', 'open the HTML preview in the default browser')
1243
+ .action(async (url, opts) => {
1244
+ if (!url.startsWith('http')) url = `https://${url}`;
1245
+ validateUrl(url);
1246
+
1247
+ const spinner = ora(`Extracting ${url}...`).start();
1248
+ try {
1249
+ const original = await extractDesignLanguage(url);
1250
+ spinner.text = `Recolouring around ${opts.primary}...`;
1251
+ const { design: recoloured, summary } = recolorDesign(original, {
1252
+ primary: opts.primary,
1253
+ fromPrimary: opts.from,
1254
+ });
1255
+
1256
+ const outDir = resolve(opts.out);
1257
+ mkdirSync(outDir, { recursive: true });
1258
+ const targetSlug = String(opts.primary).replace(/^#/, '').toLowerCase();
1259
+ const prefix = opts.name || `${nameFromUrl(url)}-themeswap-${targetSlug}`;
1260
+ const written = [];
1261
+
1262
+ if (opts.format === 'all' || opts.format === 'html') {
1263
+ const html = formatThemeSwap(original, recoloured, { version: PKG_VERSION });
1264
+ const p = join(outDir, `${prefix}.themeswap.html`);
1265
+ writeFileSync(p, html);
1266
+ written.push(p);
1267
+ }
1268
+ if (opts.format === 'all' || opts.format === 'md') {
1269
+ const md = formatThemeSwapMarkdown(original, recoloured);
1270
+ const p = join(outDir, `${prefix}.themeswap.md`);
1271
+ writeFileSync(p, md);
1272
+ written.push(p);
1273
+ }
1274
+ if (opts.format === 'all' || opts.format === 'json') {
1275
+ const p = join(outDir, `${prefix}.themeswap.json`);
1276
+ writeFileSync(p, JSON.stringify({
1277
+ url: original.meta?.url,
1278
+ from: summary.from,
1279
+ to: summary.to,
1280
+ hueShift: summary.hueShift,
1281
+ changedColors: summary.changes.length,
1282
+ changes: summary.changes,
1283
+ timestamp: new Date().toISOString(),
1284
+ }, null, 2));
1285
+ written.push(p);
1286
+ }
1287
+ if (opts.format === 'all' || opts.format === 'tokens') {
1288
+ const tokens = formatDtcgTokens(recoloured);
1289
+ const p = join(outDir, `${prefix}.themeswap.tokens.json`);
1290
+ writeFileSync(p, typeof tokens === 'string' ? tokens : JSON.stringify(tokens, null, 2));
1291
+ written.push(p);
1292
+ }
1293
+
1294
+ spinner.stop();
1295
+ console.log('');
1296
+ console.log(` ${chalk.bold(`${summary.from} → ${summary.to}`)} ${chalk.gray('·')} ${chalk.cyan(summary.changes.length)} colours ${chalk.gray('·')} ${chalk.gray(url)}`);
1297
+ console.log(` ${chalk.gray(`Hue shift: ${(summary.hueShift).toFixed(1)}° · neutrals preserved · type/spacing/motion untouched`)}`);
1298
+ console.log('');
1299
+ for (const f of written) console.log(` ${chalk.green('✓')} ${chalk.gray(f)}`);
1300
+ console.log('');
1301
+
1302
+ if (opts.open) {
1303
+ const htmlPath = written.find(p => p.endsWith('.html'));
1304
+ if (htmlPath) {
1305
+ const { spawn } = await import('child_process');
1306
+ const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
1307
+ spawn(cmd, [htmlPath], { detached: true, stdio: 'ignore' }).unref();
1308
+ }
1309
+ }
1310
+ } catch (err) {
1311
+ spinner.fail('Theme-swap failed');
1312
+ console.error(chalk.red(`\n ${err.message}\n`));
1313
+ process.exit(1);
1314
+ }
1315
+ });
1316
+
1317
+ // ── Brand command — full editorial brand-guidelines book ────
1318
+ program
1319
+ .command('brand <url>')
1320
+ .description('Generate a full brand-guidelines book — colour, type, spacing, motion, voice, components, accessibility, tokens, and how-to-use guidance')
1321
+ .option('-o, --out <dir>', 'output directory', './design-extract-output')
1322
+ .option('-n, --name <name>', 'output file prefix (default: derived from URL)')
1323
+ .option('--format <fmt>', 'output format: html, md, json, all', 'all')
1324
+ .option('--open', 'open the HTML book in the default browser')
1325
+ .action(async (url, opts) => {
1326
+ if (!url.startsWith('http')) url = `https://${url}`;
1327
+ validateUrl(url);
1328
+
1329
+ const spinner = ora(`Building brand guidelines for ${url}...`).start();
1330
+ try {
1331
+ // The brand book leans on the full extraction (logo, motion, voice,
1332
+ // anatomy, accessibility), so default to --full unless the caller has
1333
+ // explicitly opted out via env.
1334
+ const design = await extractDesignLanguage(url, {
1335
+ screenshots: true,
1336
+ responsive: false,
1337
+ interactions: false,
1338
+ deepInteract: true,
1339
+ });
1340
+
1341
+ const outDir = resolve(opts.out);
1342
+ mkdirSync(outDir, { recursive: true });
1343
+ const prefix = opts.name || `${nameFromUrl(url)}.brand`;
1344
+ const written = [];
1345
+
1346
+ if (opts.format === 'all' || opts.format === 'html') {
1347
+ const html = formatBrandBook(design, { version: PKG_VERSION });
1348
+ const p = join(outDir, `${prefix}.html`);
1349
+ writeFileSync(p, html);
1350
+ written.push(p);
1351
+ }
1352
+ if (opts.format === 'all' || opts.format === 'md') {
1353
+ const md = formatBrandBookMarkdown(design);
1354
+ const p = join(outDir, `${prefix}.md`);
1355
+ writeFileSync(p, md);
1356
+ written.push(p);
1357
+ }
1358
+ if (opts.format === 'all' || opts.format === 'json') {
1359
+ // A trimmed JSON of the most-used surfaces in the book — useful for
1360
+ // programmatic consumption without re-running extraction.
1361
+ const p = join(outDir, `${prefix}.json`);
1362
+ writeFileSync(p, JSON.stringify({
1363
+ url: design.meta?.url,
1364
+ title: design.meta?.title,
1365
+ timestamp: design.meta?.timestamp,
1366
+ intent: design.pageIntent,
1367
+ material: design.materialLanguage,
1368
+ imagery: design.imageryStyle,
1369
+ library: design.componentLibrary,
1370
+ stack: design.stack,
1371
+ voice: design.voice,
1372
+ colors: design.colors,
1373
+ typography: design.typography,
1374
+ spacing: design.spacing,
1375
+ shadows: design.shadows,
1376
+ borders: design.borders,
1377
+ motion: design.motion,
1378
+ accessibility: design.accessibility,
1379
+ score: design.score,
1380
+ }, null, 2));
1381
+ written.push(p);
1382
+ }
1383
+
1384
+ spinner.stop();
1385
+ const colorCount = (design.colors?.all || []).length;
1386
+ const fontCount = (design.typography?.families || []).length;
1387
+ const grade = design.score?.grade || '—';
1388
+ console.log('');
1389
+ console.log(` ${chalk.bold('Brand book')} ${chalk.gray('·')} ${chalk.cyan(colorCount + ' tokens')} ${chalk.gray('·')} ${chalk.cyan(fontCount + ' fonts')} ${chalk.gray('·')} ${chalk.cyan('grade ' + grade)} ${chalk.gray('·')} ${chalk.gray(url)}`);
1390
+ console.log('');
1391
+ for (const f of written) console.log(` ${chalk.green('✓')} ${chalk.gray(f)}`);
1392
+ console.log('');
1393
+ console.log(chalk.gray(` Open the .html — it's a self-contained, print-ready guidelines book.`));
1394
+ console.log('');
1395
+
1396
+ if (opts.open) {
1397
+ const htmlPath = written.find(p => p.endsWith('.html'));
1398
+ if (htmlPath) {
1399
+ const { spawn } = await import('child_process');
1400
+ const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
1401
+ spawn(cmd, [htmlPath], { detached: true, stdio: 'ignore' }).unref();
1402
+ }
1403
+ }
1404
+ } catch (err) {
1405
+ spinner.fail('Brand book failed');
1406
+ console.error(chalk.red(`\n ${err.message}\n`));
1407
+ process.exit(1);
1408
+ }
1409
+ });
1410
+
1411
+ // ── Pair command — fuse two designs across configurable axes
1412
+ program
1413
+ .command('pair <urlA> <urlB>')
1414
+ .description('Fuse two extracted designs across axes (colours/typography/spacing/shape/motion/voice/components)')
1415
+ .option('-o, --out <dir>', 'output directory', './design-extract-output')
1416
+ .option('-n, --name <name>', 'output file prefix (default: <hostA>-x-<hostB>)')
1417
+ .option('--colors-from <a|b>', 'pull colours from A or B (default: a)')
1418
+ .option('--typography-from <a|b>', 'pull typography from A or B (default: b)')
1419
+ .option('--spacing-from <a|b>', 'pull spacing from A or B (default: a)')
1420
+ .option('--shape-from <a|b>', 'pull shape (radii + shadows) from A or B (default: a)')
1421
+ .option('--motion-from <a|b>', 'pull motion from A or B (default: a)')
1422
+ .option('--voice-from <a|b>', 'pull voice from A or B (default: b)')
1423
+ .option('--components-from <a|b>', 'pull component anatomy from A or B (default: b)')
1424
+ .option('--brand', 'also emit a full brand-guidelines book of the fused identity')
1425
+ .option('--format <fmt>', 'output format: html, md, json, all', 'all')
1426
+ .option('--open', 'open the HTML pair card in the default browser')
1427
+ .action(async (urlA, urlB, opts) => {
1428
+ if (!urlA.startsWith('http')) urlA = `https://${urlA}`;
1429
+ if (!urlB.startsWith('http')) urlB = `https://${urlB}`;
1430
+ validateUrl(urlA);
1431
+ validateUrl(urlB);
1432
+
1433
+ const spinner = ora(`Extracting ${urlA} and ${urlB} in parallel...`).start();
1434
+ try {
1435
+ const [designA, designB] = await Promise.all([
1436
+ extractDesignLanguage(urlA),
1437
+ extractDesignLanguage(urlB),
1438
+ ]);
1439
+
1440
+ spinner.text = 'Fusing...';
1441
+ const { design: fused, summary } = fuseDesigns(designA, designB, {
1442
+ colorsFrom: opts.colorsFrom,
1443
+ typographyFrom: opts.typographyFrom,
1444
+ spacingFrom: opts.spacingFrom,
1445
+ shapeFrom: opts.shapeFrom,
1446
+ motionFrom: opts.motionFrom,
1447
+ voiceFrom: opts.voiceFrom,
1448
+ componentsFrom: opts.componentsFrom,
1449
+ });
1450
+
1451
+ const outDir = resolve(opts.out);
1452
+ mkdirSync(outDir, { recursive: true });
1453
+ const prefix = opts.name || `${nameFromUrl(urlA)}-x-${nameFromUrl(urlB)}.pair`;
1454
+ const written = [];
1455
+
1456
+ if (opts.format === 'all' || opts.format === 'html') {
1457
+ const html = formatPair(designA, designB, fused, summary, { version: PKG_VERSION });
1458
+ const p = join(outDir, `${prefix}.html`);
1459
+ writeFileSync(p, html);
1460
+ written.push(p);
1461
+ }
1462
+ if (opts.format === 'all' || opts.format === 'md') {
1463
+ const md = formatPairMarkdown(designA, designB, fused, summary);
1464
+ const p = join(outDir, `${prefix}.md`);
1465
+ writeFileSync(p, md);
1466
+ written.push(p);
1467
+ }
1468
+ if (opts.format === 'all' || opts.format === 'json') {
1469
+ const p = join(outDir, `${prefix}.json`);
1470
+ writeFileSync(p, JSON.stringify({
1471
+ a: { url: designA.meta?.url, host: summary.a.host },
1472
+ b: { url: designB.meta?.url, host: summary.b.host },
1473
+ axes: summary.axes,
1474
+ fused: {
1475
+ primary: fused.colors?.primary?.hex || null,
1476
+ family: (fused.typography?.families || [])[0],
1477
+ tone: fused.voice?.tone,
1478
+ },
1479
+ timestamp: new Date().toISOString(),
1480
+ }, null, 2));
1481
+ written.push(p);
1482
+ }
1483
+ if (opts.brand) {
1484
+ const html = formatBrandBook(fused, { version: PKG_VERSION });
1485
+ const p = join(outDir, `${prefix}.brand.html`);
1486
+ writeFileSync(p, html);
1487
+ written.push(p);
1488
+ }
1489
+
1490
+ spinner.stop();
1491
+ console.log('');
1492
+ console.log(` ${chalk.bold(`${summary.a.host} × ${summary.b.host}`)}`);
1493
+ console.log('');
1494
+ const axisLabels = {
1495
+ colors: 'Colours', typography: 'Typography', spacing: 'Spacing',
1496
+ shape: 'Shape', motion: 'Motion', voice: 'Voice', components: 'Components',
1497
+ };
1498
+ for (const axis of Object.keys(axisLabels)) {
1499
+ const src = summary.axes[axis];
1500
+ const fromHost = src === 'a' ? summary.a.host : summary.b.host;
1501
+ const tag = src === 'a' ? chalk.cyan('A') : chalk.magenta('B');
1502
+ console.log(` ${tag} ${axisLabels[axis].padEnd(12)} ${chalk.gray('·')} ${chalk.gray(fromHost)}`);
1503
+ }
1504
+ console.log('');
1505
+ for (const f of written) console.log(` ${chalk.green('✓')} ${chalk.gray(f)}`);
1506
+ console.log('');
1507
+
1508
+ if (opts.open) {
1509
+ const htmlPath = written.find(p => p.endsWith('.html'));
1510
+ if (htmlPath) {
1511
+ const { spawn } = await import('child_process');
1512
+ const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
1513
+ spawn(cmd, [htmlPath], { detached: true, stdio: 'ignore' }).unref();
1514
+ }
1515
+ }
1516
+ } catch (err) {
1517
+ spinner.fail('Pair failed');
1518
+ console.error(chalk.red(`\n ${err.message}\n`));
1519
+ process.exit(1);
1520
+ }
1521
+ });
1522
+
1228
1523
  // ── Apply command ──────────────────────────────────────────
1229
1524
  program
1230
1525
  .command('apply <url>')
@@ -0,0 +1,27 @@
1
+ ---
2
+ description: Head-to-head graded battle card between two sites — eight dimensions, bar-by-bar, verdict line.
3
+ argument-hint: <urlA> <urlB>
4
+ ---
5
+
6
+ Pit two sites against each other and emit a single shareable HTML battle card.
7
+
8
+ ```bash
9
+ npx designlang battle $ARGUMENTS
10
+ ```
11
+
12
+ If `$ARGUMENTS` is empty or contains fewer than two URLs, ask the user for both sites.
13
+
14
+ Both sites are extracted in parallel (~30s total). Outputs land in `./design-extract-output/`:
15
+
16
+ - `<a>-vs-<b>.battle.html` — the shareable card
17
+ - `<a>-vs-<b>.battle.md` — markdown summary
18
+ - `<a>-vs-<b>.battle.json` — structured scores
19
+
20
+ After the run:
21
+
22
+ 1. Read the `*.battle.md` file
23
+ 2. Show the user the verdict line ("X wins" / "tie") and the per-dimension table
24
+ 3. Highlight the dimensions where the gap is widest
25
+ 4. Offer to open the HTML card
26
+
27
+ This is pure viral content — battles are designed to be tweeted. Pair with `/grade <url> --badge` so each side has a permanent badge to link back to.
@@ -0,0 +1,59 @@
1
+ ---
2
+ description: Generate a full editorial brand-guidelines book for any URL. 13 chapters covering colour, typography, spacing, shape, iconography, motion, components, voice, accessibility, tokens, and how-to-use guidance. Print-ready, dark-mode toggle, hand-off-ready single HTML.
3
+ argument-hint: <url> [--open]
4
+ ---
5
+
6
+ Build a self-contained, hand-off-ready brand-guidelines book from any live URL.
7
+
8
+ ```bash
9
+ npx designlang brand $ARGUMENTS
10
+ ```
11
+
12
+ If no URL is provided, ask the user which site to document.
13
+
14
+ Output goes to `./design-extract-output/`:
15
+
16
+ - `*.brand.html` — the editorial book (open this — it's a self-contained, print-ready document with TOC, smooth-scroll, dark-mode toggle)
17
+ - `*.brand.md` — terse markdown summary (good for diffing snapshots)
18
+ - `*.brand.json` — structured slice of the design with the surfaces the book renders
19
+
20
+ After the run completes:
21
+
22
+ 1. Read `*.brand.md` to summarise what was captured (host, page intent, material language, tone, palette size, type families, WCAG score)
23
+ 2. Tell the user the headline numbers (`X tokens · Y fonts · grade Z`)
24
+ 3. Offer to open the HTML book (`--open` does this automatically)
25
+ 4. Suggest pairing: `/pack <url>` if they want a developer-facing bundle to drop into a project, `/grade <url>` for the audit, `/theme-swap <url>` to derive a recoloured variant
26
+
27
+ ## What's in the book
28
+
29
+ | § | Chapter | What it documents |
30
+ |---|---|---|
31
+ | 01 | About | Page intent, material language, imagery style, component library, stack, voice tone |
32
+ | 02 | Logo | Extracted SVG logo + clearspace + dimensions |
33
+ | 03 | Colour | Brand colours with HEX/RGB/HSL/usage, neutrals grid, full palette, A11y callout |
34
+ | 04 | Typography | Display + body families, weights, scale table, large specimen |
35
+ | 05 | Spacing | Base unit, scale length, visual rhythm bars |
36
+ | 06 | Shape | Border radii visualised, shadow elevation system |
37
+ | 07 | Iconography | Icon library detection + captured icons grid |
38
+ | 08 | Motion | Feel, durations (animated dots), easings, spring presence, scroll-linked flag |
39
+ | 09 | Components | Detected components with slots/variants/sizes |
40
+ | 10 | Voice & tone | Tone, pronoun posture, heading case, top CTA verbs, sample headings |
41
+ | 11 | Accessibility | WCAG score, failing pairs table, suggested replacements |
42
+ | 12 | Tokens | Drop-in code blocks (CSS vars, Tailwind config) + cross-ref to `pack` |
43
+ | 13 | How to use | Six rules of thumb for derivative work |
44
+
45
+ ## Useful flags
46
+
47
+ | Flag | Effect |
48
+ |---|---|
49
+ | `--format html\|md\|json\|all` | Pick the output(s). Default `all`. |
50
+ | `--out <dir>` | Output directory. Default `./design-extract-output`. |
51
+ | `-n, --name <name>` | Output file prefix. Default derived from URL. |
52
+ | `--open` | Open the HTML book in your default browser. |
53
+
54
+ ## Pairs nicely with
55
+
56
+ - `/pack <url>` — when the recipient wants files to drop into a project, not a guidelines doc
57
+ - `/grade <url>` — when the recipient wants the audit/score, not the full book
58
+ - `/theme-swap <url> --primary <hex>` — when the recipient wants the same system in their brand colour
59
+ - `/remix <url> --as <vocab>` — when the recipient wants a vocabulary swap (brutalist, swiss, etc.)
@@ -0,0 +1,41 @@
1
+ ---
2
+ description: Extract the complete design language from a URL — DTCG tokens, Tailwind, Figma vars, motion, voice, components.
3
+ argument-hint: <url> [extra flags…]
4
+ ---
5
+
6
+ Run **designlang** against the user-provided URL and surface the result.
7
+
8
+ ```bash
9
+ npx designlang $ARGUMENTS
10
+ ```
11
+
12
+ If no `$ARGUMENTS` were supplied, ask the user which URL to extract.
13
+
14
+ Default output goes to `./design-extract-output/`. Once it finishes, read the generated `*-design-language.md` (the AI-optimized markdown) and present a tight summary to the user:
15
+
16
+ - Primary palette (hex codes)
17
+ - Type families + scale
18
+ - Spacing base + scale
19
+ - WCAG accessibility score
20
+ - Component patterns detected
21
+ - Notable signals (motion feel, material language, brand voice tone)
22
+
23
+ Then offer follow-ups:
24
+
25
+ - `/grade <url>` — shareable HTML Design Report Card + SVG badge
26
+ - `/battle <urlA> <urlB>` — head-to-head graded comparison
27
+ - `/remix <url> --as <vocab>` — restyle in another vocabulary
28
+ - `/pack <url>` — bundle every output into one design-system directory
29
+
30
+ Useful flags the user may pass via `$ARGUMENTS`:
31
+
32
+ | Flag | Effect |
33
+ |---|---|
34
+ | `--full` | screenshots + responsive + interactions + deep-interact |
35
+ | `--depth <n>` | crawl N additional canonical pages |
36
+ | `--dark` | also extract dark mode |
37
+ | `--platforms ios,android,flutter,wordpress` | multi-platform emitters |
38
+ | `--smart` | LLM fallback for low-confidence classifiers (needs `OPENAI_API_KEY` or `ANTHROPIC_API_KEY`) |
39
+ | `--cookie-file ./session.json` | authenticated extraction |
40
+
41
+ Full reference: https://github.com/Manavarya09/design-extract#full-cli-reference
@@ -0,0 +1,29 @@
1
+ ---
2
+ description: Generate a shareable HTML "Design Report Card" — letter grade, 8 dimensions, evidence (palette, type, rhythm), strengths + fixes, plus an SVG badge.
3
+ argument-hint: <url> [--badge] [--open]
4
+ ---
5
+
6
+ Audit the design system at the user-provided URL. Emits a self-contained HTML report card plus JSON + Markdown variants. Pass `--badge` to also emit a shields.io-style SVG you can drop into any README.
7
+
8
+ ```bash
9
+ npx designlang grade $ARGUMENTS
10
+ ```
11
+
12
+ If no `$ARGUMENTS` were supplied, ask the user which URL to grade.
13
+
14
+ After the run completes:
15
+
16
+ 1. Read the generated `*.grade.md` file from `./design-extract-output/`
17
+ 2. Surface the headline grade (A–F · score · 8 dimensions)
18
+ 3. Highlight the top 3 strengths and top 3 issues from the report
19
+ 4. Offer to open the HTML in the browser (the `--open` flag does this automatically)
20
+
21
+ If the user wants the live shareable badge URL instead of generating files locally, they can use:
22
+
23
+ ```markdown
24
+ ![Design Score](https://designlang.app/badge/<host>.svg)
25
+ ```
26
+
27
+ This endpoint is blob-cached 24h with edge caching for ~50ms repeat hits.
28
+
29
+ Compare two sites with `/battle <A> <B>`, restyle with `/remix`, bundle everything with `/pack`.
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Bundle every designlang output (DTCG tokens, Tailwind, shadcn, Figma vars, motion, anatomy, Storybook, prompts) into one polished design-system directory ready to zip and ship.
3
+ argument-hint: <url> [--with-clone] [--open]
4
+ ---
5
+
6
+ Run the full extraction once and write every emitter output into a single, signed, layered directory.
7
+
8
+ ```bash
9
+ npx designlang pack $ARGUMENTS
10
+ ```
11
+
12
+ If no URL is provided, ask the user. Default output is `./<host>-design-system/`.
13
+
14
+ Layout produced:
15
+
16
+ ```
17
+ <host>-design-system/
18
+ ├── README.md bespoke "Built from <host>" + grade + at-a-glance
19
+ ├── LICENSE.txt provenance + usage guidance
20
+ ├── tokens/ DTCG + Tailwind + CSS vars + Figma vars + motion + theme.js
21
+ ├── components/ typed React stubs (anatomy.tsx)
22
+ ├── storybook/ runnable Storybook project
23
+ ├── starter/ minimal HTML starter wired to tokens/variables.css
24
+ ├── prompts/ v0 / Lovable / Cursor / Claude Artifacts + named recipes/*.md
25
+ └── extras/ voice.json + prompt-pack.md rollup
26
+ ```
27
+
28
+ After the run:
29
+
30
+ 1. Surface the headline (`X files, Y KB · ./<dir>`)
31
+ 2. Read the auto-generated `README.md` and tell the user what's inside
32
+ 3. Suggest next steps:
33
+ - `cd <dir> && zip -r ../<dir>.zip .` to package for sharing
34
+ - `cd <dir>/storybook && npm install && npm run storybook` to run the design system locally
35
+ - Copy `tokens/tailwind.config.js` straight into a project
36
+
37
+ Use `--with-clone` to swap the minimal HTML starter for the full Next.js clone (slower; only when the user wants a runnable app).
@@ -0,0 +1,68 @@
1
+ ---
2
+ description: Fuse two extracted designs into a single hybrid identity. Pick which axis (colour, typography, spacing, shape, motion, voice, components) comes from which site. Defaults to "visual A × voice B" — same colours/spacing as the first URL, type/voice/components from the second.
3
+ argument-hint: <urlA> <urlB> [--colors-from a|b] [--typography-from a|b] [--brand]
4
+ ---
5
+
6
+ Fuse the design DNA of two sites and emit an editorial pair card showing the crossover.
7
+
8
+ ```bash
9
+ npx designlang pair $ARGUMENTS
10
+ ```
11
+
12
+ If `$ARGUMENTS` doesn't contain at least two URLs, ask the user for the second one.
13
+
14
+ Both sites are extracted in parallel (~30s total). Outputs land in `./design-extract-output/`:
15
+
16
+ - `*-x-*.pair.html` — editorial pair card with cover, axis matrix, fused specimen
17
+ - `*-x-*.pair.md` — markdown summary (axis source table)
18
+ - `*-x-*.pair.json` — structured deltas (which axis came from where)
19
+ - `*-x-*.pair.brand.html` — full brand-guidelines book of the fused identity (only with `--brand`)
20
+
21
+ After the run completes:
22
+
23
+ 1. Read the markdown to summarise: which axis came from A, which from B
24
+ 2. Highlight the most distinctive crossover (the fused specimen quotes a real headline from whichever site contributed the voice)
25
+ 3. Offer to open the HTML pair card
26
+
27
+ ## Default axis split
28
+
29
+ | Axis | Default source | Why |
30
+ |---|---|---|
31
+ | Colour | A | Brand identity tends to lead with colour |
32
+ | Spacing | A | Spacing co-varies with the visual layout |
33
+ | Shape | A | Radii + shadows belong with the visual surface |
34
+ | Motion | A | Motion is part of the visual feel |
35
+ | **Typography** | **B** | The crossover moment — different voice |
36
+ | **Voice** | **B** | Tone, headings, CTA verbs from B |
37
+ | **Components** | **B** | Anatomy from B's library |
38
+
39
+ So the default is "Site A's visuals + Site B's words". Override any axis with `--<axis>-from a|b`.
40
+
41
+ ## Useful flags
42
+
43
+ | Flag | Effect |
44
+ |---|---|
45
+ | `--colors-from <a\|b>` | Force colour source |
46
+ | `--typography-from <a\|b>` | Force typography source |
47
+ | `--spacing-from <a\|b>` | Force spacing source |
48
+ | `--shape-from <a\|b>` | Force radii + shadows source |
49
+ | `--motion-from <a\|b>` | Force motion source |
50
+ | `--voice-from <a\|b>` | Force voice / tone / heading source |
51
+ | `--components-from <a\|b>` | Force component anatomy source |
52
+ | `--brand` | Also emit a full brand-guidelines book of the fused identity |
53
+ | `--format html\|md\|json\|all` | Pick output formats |
54
+ | `--open` | Open the HTML pair card |
55
+
56
+ ## Example experiments
57
+
58
+ ```
59
+ npx designlang pair stripe.com linear.app # default split
60
+ npx designlang pair stripe.com linear.app --type-from a # Stripe everything except components/voice from Linear
61
+ npx designlang pair vercel.com apple.com --brand # fused identity as a hand-off brand book
62
+ ```
63
+
64
+ ## Pairs nicely with
65
+
66
+ - `/grade <url>` — grade either source side individually before pairing
67
+ - `/brand <url>` — generate a brand book of one source for comparison
68
+ - `/battle <urlA> <urlB>` — head-to-head graded comparison (the inverse of `pair`)
@@ -0,0 +1,29 @@
1
+ ---
2
+ description: Restyle a site in another design vocabulary — brutalist, swiss, art-deco, cyberpunk, soft-ui, or editorial. Preserves page shape, swaps the visual vocabulary.
3
+ argument-hint: <url> --as <brutalist|swiss|art-deco|cyberpunk|soft-ui|editorial> | --all
4
+ ---
5
+
6
+ Restyle the page shape of an extracted site under a different visual vocabulary.
7
+
8
+ ```bash
9
+ npx designlang remix $ARGUMENTS
10
+ ```
11
+
12
+ If `$ARGUMENTS` is empty, ask the user for a URL and offer the six vocabularies. If only a URL is given, default to `--all` so they see every variant side by side.
13
+
14
+ The six vocabularies:
15
+
16
+ | `--as <id>` | Vibe |
17
+ |---|---|
18
+ | `brutalist` | Raw, blocky, monospace, no shadows |
19
+ | `swiss` | Clean grid, sans, minimal palette |
20
+ | `art-deco` | Geometric, gold accents, serif display |
21
+ | `cyberpunk` | Neon, dark, glowing CTAs |
22
+ | `soft-ui` | Pastel, soft shadows, generous radii |
23
+ | `editorial` | Newspaper feel, serif, narrow columns |
24
+
25
+ Use `--all` to emit all six in one pass — six standalone HTML files plus a comparison index.
26
+
27
+ After the run, read the comparison index (`*-remix-index.html` or `*-remix.<vocab>.html`) and tell the user which file to open. Offer to launch `--open` automatically.
28
+
29
+ Pair with `/battle` for cross-vocab fights ("Stripe-as-cyberpunk vs Vercel-as-art-deco"), or `/pack` to bundle a remixed system as a downloadable design directory.
@@ -0,0 +1,42 @@
1
+ ---
2
+ description: Recolour an extracted site's design around a new brand primary. OKLCH hue rotation preserves perceptual lightness — neutrals, type, spacing, and motion stay untouched. Side-by-side HTML preview + recoloured tokens (DTCG, Tailwind, shadcn, Figma).
3
+ argument-hint: <url> --primary <hex> [--from <hex>] [--open]
4
+ ---
5
+
6
+ Take any extracted site and swap its brand primary to the user-provided hex. The whole palette rotates around that hue while neutrals and structural tokens stay put.
7
+
8
+ ```bash
9
+ npx designlang theme-swap $ARGUMENTS
10
+ ```
11
+
12
+ If `$ARGUMENTS` doesn't contain both a URL and `--primary <hex>`, ask the user for the missing piece.
13
+
14
+ After the run completes, all output goes to `./design-extract-output/`:
15
+
16
+ - `*.themeswap.html` — editorial side-by-side preview (open this)
17
+ - `*.themeswap.md` — markdown diff table
18
+ - `*.themeswap.json` — structured before→after deltas
19
+ - `*.themeswap.tokens.json` — recoloured DTCG token set you can drop into a project
20
+
21
+ After the command finishes:
22
+
23
+ 1. Read `*.themeswap.md` to summarise the swap (`from → to`, hue shift, count of changed colours).
24
+ 2. Show the user the verdict line ("X colours changed, neutrals preserved, type/spacing/motion untouched").
25
+ 3. Offer to open the HTML preview (`--open` does this automatically).
26
+ 4. Suggest the recoloured token files as drop-ins for an existing Tailwind / shadcn project.
27
+
28
+ ## Useful flags
29
+
30
+ | Flag | Effect |
31
+ |---|---|
32
+ | `--primary <hex>` | **required.** Target brand colour (e.g. `"#ff4800"`). |
33
+ | `--from <hex>` | Override the auto-detected source primary when the extractor misclassifies (e.g. a neutral got promoted by usage count). |
34
+ | `--format html\|md\|json\|tokens\|all` | Pick the output(s). Default `all`. |
35
+ | `--out <dir>` | Output directory. Default `./design-extract-output`. |
36
+ | `--open` | Open the HTML preview in your default browser. |
37
+
38
+ ## Pairs nicely with
39
+
40
+ - `/grade <url>` — grade the recoloured site by feeding the same target through `/extract` then `/grade`.
41
+ - `/pack <url>` — bundle the recoloured tokens as a downloadable design-system folder.
42
+ - `/remix <url> --as <vocab>` — full vocabulary swap (brutalist, art-deco, cyberpunk…) instead of just brand colour.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "designlang",
3
- "version": "12.4.0",
4
- "description": "Extract the complete design language from any website and ship it clone to a working Next.js starter, guard tokens with a CI drift bot, or browse everything in a local studio. Outputs W3C DTCG tokens, motion tokens, typed anatomy stubs, Tailwind config, and ready-to-paste v0 / Lovable / Cursor / Claude-Artifacts prompts.",
3
+ "version": "12.8.0",
4
+ "description": "Extract the complete design language from any website and ship it \u2014 clone to a working Next.js starter, guard tokens with a CI drift bot, or browse everything in a local studio. Outputs W3C DTCG tokens, motion tokens, typed anatomy stubs, Tailwind config, and ready-to-paste v0 / Lovable / Cursor / Claude-Artifacts prompts.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "designlang": "./bin/design-extract.js"
@@ -48,4 +48,4 @@
48
48
  ],
49
49
  "author": "masyv",
50
50
  "license": "MIT"
51
- }
51
+ }