@designesy/score 0.6.0 → 0.7.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @designesy/score
2
2
 
3
- Standalone 42-check design-contract scoring engine. Fetches a URL, extracts CSS + `:root` tokens, runs all checks locally, with **no server required**. Zero dependencies.
3
+ Standalone 44-check design-contract scoring engine. Fetches a URL, extracts CSS + `:root` tokens, runs all checks locally, with **no server required**. No required dependencies.
4
4
 
5
5
  ## Install
6
6
 
@@ -54,14 +54,14 @@ console.log(result.fail); // 3
54
54
  console.log(result.checks); // [{ id: 'v01', status: 'PASS', detail: '...' }, ...]
55
55
  ```
56
56
 
57
- ## The 42 checks
57
+ ## The 44 checks
58
58
 
59
59
  | Category | Checks | Weight |
60
60
  |---|---|---|
61
61
  | cadence | v14, v15, v16, v17, v18, v19, v20, v26, v28, x01, x02, x03 | 18 |
62
- | accessibility | v06, v22, v24, v25, v27, v35 | 15 |
62
+ | accessibility | v06, v22, v24, v25, v27, v35, v44 | 15 |
63
63
  | semantic | v42, v43 | 12 |
64
- | motion | v05, v11, v12, v23 | 10 |
64
+ | motion | v05, v11, v12, v23, v45 | 10 |
65
65
  | tokens | v01, v29 | 9 |
66
66
  | takt | v10, v13 | 8 |
67
67
  | copywriting | v38, v39, v40, v41 | 8 |
@@ -85,17 +85,19 @@ Plus 12 anti-slop deductions (S1 to S12) and 7 originality lifts (O1 to O7).
85
85
 
86
86
  ## Scope system
87
87
 
88
- - **contract** (default for designesy.org): All 42 checks active. Absence = WARN/FAIL.
88
+ - **contract** (default for designesy.org): All 44 checks active. Absence = WARN/FAIL.
89
89
  - **universal** (default for external sites): Optional features SKIP on absence instead of penalizing.
90
90
 
91
91
  Auto-detect: `designesy.org` → contract, everything else → universal.
92
92
 
93
- ## Zero dependencies
93
+ ## Dependencies
94
94
 
95
- Uses only Node.js built-ins:
95
+ The engine uses only Node.js built-ins:
96
96
  - `node:https` for URL fetching (avoids the Windows libuv/undici crash)
97
97
  - `node:dns` for SSRF guard (DNS resolution validation)
98
- - No `ipaddr.js`, no `undici`, no `fetch()`, no external packages
98
+ - No `ipaddr.js`, no `undici`, no `fetch()`
99
+
100
+ One optional dependency: Google's [`@google/design.md`](https://github.com/google-labs-code/design.md) linter (Apache-2.0), the version the hosted engine runs. v37 uses it to lint a site's `/DESIGN.md`. npm installs it by default, `npx` included. Installed without it (`npm install --omit=optional`), v37 reports MANUAL (not run, weight 0) for a site that serves a DESIGN.md, and every other check is unchanged.
99
101
 
100
102
  ## SSRF guard
101
103
 
package/dist/cli.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * @designesy/score CLI — Score a URL against the 42-check Designesy engine.
3
+ * @designesy/score CLI — Score a URL against the 44-check Designesy engine.
4
4
  *
5
- * Runs the full 42-check scoring engine locally — no server required.
5
+ * Runs the full 44-check scoring engine locally — no server required.
6
6
  * Fetches the target URL, extracts CSS + :root tokens, runs all checks,
7
7
  * and prints a formatted report. Exits with code 1 when the score drops
8
8
  * below --min-score or the grade drops below --min-grade.
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * @designesy/score CLI — Score a URL against the 42-check Designesy engine.
3
+ * @designesy/score CLI — Score a URL against the 44-check Designesy engine.
4
4
  *
5
- * Runs the full 42-check scoring engine locally — no server required.
5
+ * Runs the full 44-check scoring engine locally — no server required.
6
6
  * Fetches the target URL, extracts CSS + :root tokens, runs all checks,
7
7
  * and prints a formatted report. Exits with code 1 when the score drops
8
8
  * below --min-score or the grade drops below --min-grade.
@@ -98,10 +98,10 @@ function formatReport(result, url) {
98
98
  }
99
99
  function printUsage() {
100
100
  console.log(`
101
- designesy-score: Score a URL against the 42-check Designesy engine.
101
+ designesy-score: Score a URL against the 44-check Designesy engine.
102
102
 
103
103
  Runs locally: no server required. Fetches the URL, extracts CSS + tokens,
104
- and runs all 42 checks in one process.
104
+ and runs all 44 checks in one process.
105
105
 
106
106
  Usage:
107
107
  designesy-score <url> [options]
@@ -192,7 +192,7 @@ async function main() {
192
192
  // Progress and the gate verdict go to stderr: stdout carries only the
193
193
  // result, so --json and the JSON formats pipe straight into a parser.
194
194
  if (!args.quiet) {
195
- console.error(`${DIM}Scoring ${url} locally (42-check engine, scope=${scope || 'auto'})…${RESET}`);
195
+ console.error(`${DIM}Scoring ${url} locally (44-check engine, scope=${scope || 'auto'})…${RESET}`);
196
196
  }
197
197
  let result;
198
198
  try {
package/dist/engine.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  /**
2
- * @designesy/score — 42-check design-contract scoring engine.
2
+ * @designesy/score — 44-check design-contract scoring engine.
3
3
  *
4
4
  * Scores a URL against the Designesy design-system contract: fetches the page,
5
- * extracts CSS + :root tokens, runs 40 deterministic checks, computes a weighted
6
- * score (0-100), assigns a letter grade (A-F), and applies anti-slop deductions
7
- * + originality lifts.
5
+ * extracts CSS + :root tokens, runs 44 checks (41 scored, 3 that need a
6
+ * browser), computes a weighted score (0-100), assigns a letter grade (A-F),
7
+ * and applies anti-slop deductions + originality lifts.
8
8
  *
9
- * Zero dependencies. Uses node:https (not fetch/undici) to avoid the Windows
10
- * libuv crash during process exit.
9
+ * No required dependencies. Uses node:https (not fetch/undici) to avoid the
10
+ * Windows libuv crash during process exit. One optional dependency,
11
+ * @google/design.md, lints /DESIGN.md for v37; without it v37 is MANUAL.
11
12
  *
12
13
  * Extracted from apps/site/app/api/score/route.ts — same engine, same checks,
13
14
  * same scoring math. The API route wraps this module; the CLI calls it directly.
@@ -26,6 +27,13 @@ export type CheckResult = {
26
27
  detail: string;
27
28
  weight?: number;
28
29
  remediation?: string;
30
+ /** Structured findings (v44, v45), capped at 20 with the rest counted in `truncated`. */
31
+ evidence?: CheckEvidence;
32
+ };
33
+ /** Structured findings a check attaches (v44, v45), capped at 20 with the rest counted. */
34
+ export type CheckEvidence = {
35
+ findings: Array<Record<string, string | number | null>>;
36
+ truncated: number;
29
37
  };
30
38
  export type ScoreResult = {
31
39
  /**
@@ -147,9 +155,11 @@ export declare function scoreFromParts(input: ScorePartsInput): Promise<ScoreRes
147
155
  /**
148
156
  * The contract revision these checks implement, reported by every emission.
149
157
  * The site derives its copy from the contract source; this standalone engine
150
- * pins it here, once, and each release moves it.
158
+ * pins it here, once, and each release moves it. 0.6.0 shipped v0.4.1 while
159
+ * the site served v0.4.3; test/engine-1-2-0.test.mjs now reads the site's
160
+ * contract source and fails when the two differ.
151
161
  */
152
- export declare const CONTRACT_VERSION = "v0.4.1";
162
+ export declare const CONTRACT_VERSION = "v0.4.3";
153
163
  /**
154
164
  * The one verdict rule, shared by every emission format.
155
165
  *