designlang 12.9.0 → 12.10.1

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.
@@ -9,7 +9,7 @@
9
9
  "name": "designlang",
10
10
  "source": "./",
11
11
  "description": "Eight slash commands wrapping the designlang CLI: /extract (full design language \u2192 DTCG, Tailwind, Figma), /grade (shareable HTML report card + SVG badge), /battle (head-to-head graded comparison), /remix (restyle in 6 vocabularies \u2014 brutalist, swiss, art-deco, cyberpunk, soft-ui, editorial), /pack (one downloadable design-system bundle), /theme-swap (OKLCH-correct recolour around a new brand primary), /brand (full editorial brand-guidelines book \u2014 13 chapters, hand-off-ready), /pair (fuse two designs across configurable axes \u2014 colours from one site, typography from another).",
12
- "version": "12.9.0",
12
+ "version": "12.10.1",
13
13
  "author": {
14
14
  "name": "Manavarya Singh"
15
15
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "designlang",
3
3
  "description": "Extract any website's design language and ship it. Eight slash commands \u2014 /extract, /grade, /battle, /remix, /pack, /theme-swap, /brand, /pair \u2014 wrap the designlang CLI to pull DTCG tokens, Tailwind/shadcn/Figma vars, motion + voice, generate shareable graded report cards, head-to-head battle pages, six-vocabulary remixes, downloadable design-system bundles, OKLCH-correct theme recolouring, full editorial brand-guidelines books, and design crossovers between two sites.",
4
- "version": "12.9.0",
4
+ "version": "12.10.1",
5
5
  "author": {
6
6
  "name": "Manavarya Singh",
7
7
  "url": "https://github.com/Manavarya09"
package/CHANGELOG.md CHANGED
@@ -1,5 +1,67 @@
1
1
  # Changelog
2
2
 
3
+ ## [12.10.1] — 2026-05-13
4
+
5
+ **Tiny ship: \`stats\` now scans multiple URLs at once.**
6
+
7
+ \`designlang stats\` previously took exactly one URL. Now it takes any
8
+ number, runs them in parallel, and prints each block with a divider:
9
+
10
+ \`\`\`bash
11
+ npx designlang stats stripe.com vercel.com linear.app
12
+ \`\`\`
13
+
14
+ In \`--as-json\` mode:
15
+
16
+ - One URL → a bare object (legacy shape, unchanged)
17
+ - Two-or-more URLs → an array of objects
18
+ - Per-URL failures don't kill the batch — they surface as
19
+ \`{ url, error }\` in JSON or a red row in pretty mode, and the
20
+ process exits non-zero only when at least one site failed.
21
+
22
+ No flag changes, no schema breaks for the existing single-URL callers.
23
+
24
+ ## [12.10.0] — 2026-05-12
25
+
26
+ **Small ship: \`designlang stats\` + low-confidence warning in grade cards.**
27
+
28
+ Two tight quality-of-life additions on top of the v12.9 extraction pass.
29
+
30
+ ### Added
31
+
32
+ - **\`designlang stats <url>\`** — one-screen summary to stdout. Grade, primary, fonts, spacing base, WCAG, stack, library, tone, material, intent — all in ~15 lines. No files written. Use \`-j\` / \`--as-json\` for machine-readable output (CI, scripting).
33
+
34
+ \`\`\`
35
+ Grade B · 87/100
36
+ Primary #533afd ×899 59% conf
37
+ Fonts sohne-var
38
+ Type scale 14 sizes
39
+ Spacing base 2px · 13 steps
40
+ Shape 5 radii · 6 shadows
41
+ Colours 31 tokens
42
+ WCAG 79%
43
+ Stack next · unknown
44
+ Material skeuomorphic
45
+ Tone neutral
46
+ Intent landing
47
+ \`\`\`
48
+
49
+ - **Low-confidence primary warning in \`grade.html\`.** Surfaces the v12.9
50
+ \`primary.confidence\` field when it drops under 0.5 — a soft, amber
51
+ callout above the dimensions grid that tells the reader the brand
52
+ colour is a near-tie pick rather than a runaway leader. Renders as
53
+ ordinary inline note, not an error. Stays out of the way when
54
+ confidence is high (the common case).
55
+
56
+ ### Why \`stats\`?
57
+
58
+ Every other command writes files. There was no one-line "what's this
59
+ site made of" path for scripting, CI summaries, or a quick sanity
60
+ check. \`stats\` fills that gap without bloat — it's the read-only,
61
+ zero-side-effect entry point.
62
+
63
+ 2 new tests (low-confidence note present + absent paths). 398/398 total.
64
+
3
65
  ## [12.9.0] — 2026-05-11
4
66
 
5
67
  **Extraction quality pass — the core MVP, fixed.**
@@ -944,6 +944,140 @@ program
944
944
  }
945
945
  });
946
946
 
947
+ // ── Stats command — fast stdout summary, no files written ──
948
+ program
949
+ .command('stats <urls...>')
950
+ .description('Print a concise one-screen summary to stdout — grade, primary, fonts, spacing, voice. Accepts multiple URLs. No files written.')
951
+ .option('-j, --as-json', 'emit machine-readable JSON to stdout instead of pretty text (an array when multiple URLs)')
952
+ .action(async (urls, opts) => {
953
+ // Normalise each URL the same way the single-URL path used to.
954
+ const targets = urls.map(u => {
955
+ const full = u.startsWith('http') ? u : `https://${u}`;
956
+ validateUrl(full);
957
+ return full;
958
+ });
959
+
960
+ // Quiet path for --as-json: no spinner / chrome noise, just data on stdout.
961
+ // (`--json` is already a global program flag; `--as-json` avoids the clash.)
962
+ const wantJson = !!opts.asJson;
963
+ const spinner = wantJson
964
+ ? null
965
+ : ora(targets.length === 1 ? `Reading ${targets[0]}...` : `Reading ${targets.length} sites in parallel...`).start();
966
+
967
+ // Single helper used by both pretty and JSON paths.
968
+ async function summarise(url) {
969
+ const design = await extractDesignLanguage(url);
970
+ const s = design.score || {};
971
+ const primary = design.colors?.primary;
972
+ const families = (design.typography?.families || []).map(f => f?.name || f).filter(Boolean);
973
+ return {
974
+ url,
975
+ title: design.meta?.title,
976
+ grade: s.grade ?? null,
977
+ score: s.overall ?? null,
978
+ primary: primary
979
+ ? { hex: primary.hex, count: primary.count, confidence: primary.confidence ?? null }
980
+ : null,
981
+ families: families.slice(0, 3),
982
+ fontFamilyCount: families.length,
983
+ typeScale: (design.typography?.scale || []).length,
984
+ spacingBase: design.spacing?.base ?? null,
985
+ spacingScale: (design.spacing?.scale || []).length,
986
+ radii: (design.borders?.radii || []).length,
987
+ shadows: (design.shadows?.values || []).length,
988
+ colors: (design.colors?.all || []).length,
989
+ wcag: design.accessibility?.score ?? null,
990
+ material: design.materialLanguage?.label,
991
+ library: design.componentLibrary?.library,
992
+ tone: design.voice?.tone,
993
+ stack: design.stack?.framework,
994
+ intent: design.pageIntent?.type,
995
+ };
996
+ }
997
+
998
+ function printPretty(summary) {
999
+ const gradeColor =
1000
+ summary.grade === 'A' ? chalk.green
1001
+ : summary.grade === 'B' ? chalk.cyan
1002
+ : summary.grade === 'C' ? chalk.yellow
1003
+ : summary.grade === 'D' ? chalk.magenta
1004
+ : chalk.red;
1005
+ const primary = summary.primary;
1006
+ const confTag = primary && primary.confidence != null
1007
+ ? (primary.confidence < 0.5
1008
+ ? chalk.yellow(`~${Math.round(primary.confidence * 100)}% conf`)
1009
+ : chalk.gray(`${Math.round(primary.confidence * 100)}% conf`))
1010
+ : '';
1011
+ const line = (label, value) => ` ${chalk.gray(label.padEnd(12))} ${value}`;
1012
+ console.log('');
1013
+ console.log(` ${chalk.bold(summary.url)}`);
1014
+ if (summary.title) console.log(` ${chalk.gray(summary.title)}`);
1015
+ console.log('');
1016
+ console.log(line('Grade', `${gradeColor.bold(summary.grade || '—')} ${chalk.gray('·')} ${chalk.bold(String(summary.score ?? '—') + '/100')}`));
1017
+ if (primary) {
1018
+ console.log(line('Primary', `${chalk.bold(primary.hex)} ${chalk.gray('×' + primary.count)} ${confTag}`));
1019
+ } else {
1020
+ console.log(line('Primary', chalk.gray('—')));
1021
+ }
1022
+ if (summary.families.length) {
1023
+ const head = summary.families[0];
1024
+ const body = summary.families[1] || head;
1025
+ const extra = summary.fontFamilyCount > 2 ? chalk.gray(` +${summary.fontFamilyCount - 2}`) : '';
1026
+ console.log(line('Fonts', `${head}${body && body !== head ? chalk.gray(' / ') + body : ''}${extra}`));
1027
+ } else {
1028
+ console.log(line('Fonts', chalk.gray('—')));
1029
+ }
1030
+ console.log(line('Type scale', `${summary.typeScale} sizes`));
1031
+ console.log(line('Spacing', `${summary.spacingBase ? `base ${summary.spacingBase}px` : 'no base'} · ${summary.spacingScale} steps`));
1032
+ console.log(line('Shape', `${summary.radii} radii · ${summary.shadows} shadows`));
1033
+ console.log(line('Colours', `${summary.colors} tokens`));
1034
+ console.log(line('WCAG', summary.wcag != null ? `${summary.wcag}%` : chalk.gray('—')));
1035
+ console.log(line('Stack', [summary.stack, summary.library].filter(Boolean).join(' · ') || chalk.gray('—')));
1036
+ console.log(line('Material', summary.material || chalk.gray('—')));
1037
+ console.log(line('Tone', summary.tone || chalk.gray('—')));
1038
+ console.log(line('Intent', summary.intent || chalk.gray('—')));
1039
+ }
1040
+
1041
+ try {
1042
+ // Settle so a single failure doesn't kill the whole batch; per-URL
1043
+ // errors are surfaced as individual rejections in both paths.
1044
+ const results = await Promise.allSettled(targets.map(summarise));
1045
+
1046
+ if (wantJson) {
1047
+ if (spinner) spinner.stop();
1048
+ const payload = results.map((r, i) => r.status === 'fulfilled'
1049
+ ? r.value
1050
+ : { url: targets[i], error: r.reason?.message || String(r.reason) });
1051
+ // When the caller passed a single URL we keep the legacy shape
1052
+ // (a bare object) so existing scripts don't break. Multiple URLs
1053
+ // become an array.
1054
+ const out = targets.length === 1 ? payload[0] : payload;
1055
+ process.stdout.write(JSON.stringify(out, null, 2) + '\n');
1056
+ return;
1057
+ }
1058
+
1059
+ spinner.stop();
1060
+ let anyFailed = false;
1061
+ results.forEach((r, i) => {
1062
+ if (i > 0) console.log(chalk.gray(' ' + '─'.repeat(60)));
1063
+ if (r.status === 'fulfilled') {
1064
+ printPretty(r.value);
1065
+ } else {
1066
+ anyFailed = true;
1067
+ console.log('');
1068
+ console.log(` ${chalk.bold(targets[i])}`);
1069
+ console.log(` ${chalk.red('failed:')} ${chalk.red(r.reason?.message || String(r.reason))}`);
1070
+ }
1071
+ });
1072
+ console.log('');
1073
+ if (anyFailed) process.exitCode = 1;
1074
+ } catch (err) {
1075
+ if (spinner) spinner.fail('Stats failed');
1076
+ console.error(chalk.red(`\n ${err.message}\n`));
1077
+ process.exit(1);
1078
+ }
1079
+ });
1080
+
947
1081
  // ── Grade command — shareable HTML report card ─────────────
948
1082
  program
949
1083
  .command('grade <url>')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "designlang",
3
- "version": "12.9.0",
3
+ "version": "12.10.1",
4
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": {
@@ -124,6 +124,16 @@ export function formatGrade(design, opts = {}) {
124
124
  const ogTitle = `${host} — Grade ${s.grade}`;
125
125
  const ogDesc = `Design system audit by designlang. ${s.overall}/100 across 8 dimensions.`;
126
126
 
127
+ // Surface a low-confidence warning when the primary detection was uncertain
128
+ // (e.g. monochrome site, near-tie between top brand candidates). The field
129
+ // arrived in v12.9 — this card now exposes it so readers don't take the
130
+ // primary at face value when it's a soft pick.
131
+ const primaryConfidence = design.colors?.primary?.confidence;
132
+ const lowConfidence = typeof primaryConfidence === 'number' && primaryConfidence < 0.5;
133
+ const confidenceNote = lowConfidence
134
+ ? `<p class="confidence-note">Primary detection was low-confidence (${Math.round(primaryConfidence * 100)}%). The brand colour may be a soft pick — review the palette below.</p>`
135
+ : '';
136
+
127
137
  const dims = DIMENSIONS
128
138
  .filter(([k]) => s.scores[k] !== undefined)
129
139
  .map(([k, label, blurb]) => {
@@ -225,6 +235,20 @@ ${headHref ? `<link href="${esc(headHref)}" rel="stylesheet">` : ''}
225
235
  section > h2 { font-family: var(--display); font-weight: 400; font-size: 32px; margin: 0 0 8px; letter-spacing: -.005em; }
226
236
  section > h2 + .lead { color: var(--ink-soft); margin: 0 0 36px; max-width: 60ch; }
227
237
 
238
+ /* Low-confidence primary callout — only rendered when v12.9's
239
+ primary.confidence drops under 0.5. Soft warning, not an error. */
240
+ .confidence-note {
241
+ margin: -16px 0 32px;
242
+ padding: 12px 16px;
243
+ background: rgba(212, 145, 0, .08);
244
+ border-left: 2px solid #d49100;
245
+ border-radius: 0 4px 4px 0;
246
+ font-size: 14px;
247
+ color: var(--ink-soft);
248
+ max-width: 60ch;
249
+ }
250
+ [data-theme="dark"] .confidence-note { background: rgba(212, 145, 0, .14); }
251
+
228
252
  /* — Dimensions grid — */
229
253
  .dims { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 48px; }
230
254
  @media (max-width: 640px) { .dims { grid-template-columns: 1fr; gap: 28px; } }
@@ -313,6 +337,7 @@ ${headHref ? `<link href="${esc(headHref)}" rel="stylesheet">` : ''}
313
337
  <section>
314
338
  <h2>Eight dimensions, scored.</h2>
315
339
  <p class="lead">Each dimension is graded against calibrated thresholds drawn from production design systems (Stripe, Linear, Vercel, GitHub, Apple). The number is the headline; the prose underneath is what to do next.</p>
340
+ ${confidenceNote}
316
341
  <div class="dims">${dims}</div>
317
342
  </section>
318
343