Design token metrics#694
Conversation
Add a new tool at tools/token-metrics that extracts quantitative metrics from @adobe/spectrum-tokens to support the OKR: 'Token metrics are defined and included into our metrics system & have a baseline to compare moving forward.' Metrics extracted from the current token data: - Token inventory: 2,338 total (2,150 active, 188 deprecated) - Token scope: 965 global, 1,373 component-scoped across 95 components - Architecture: 654 aliases, 459 direct-value, 1,225 set-based - Data quality: 100% UUID coverage, max alias depth 4 - Component coverage: 44/54 registered components have tokens (81.5%) - Semantic categories: layout (741), content (289), typography (284), color (227), background (151), border (58), shadow (23) Includes: - src/index.js: Core metrics extraction library with exported functions - src/cli.js: CLI tool for generating reports - test/index.test.js: 21 unit and integration tests (all passing) - README.md: Documents all metrics, their meaning, and recommended timeline for Alison and the team - token-metrics-report.json: Baseline snapshot from current data - moon.yml, ava.config.js, package.json: Standard tooling config
|
Cursor Agent can help with this pull request. Just |
🦋 Changeset detectedLatest commit: bd9ba63 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Run report for bd9ba63bTotal time: 7.2ms | Comparison time: 0s | Estimated loss: 7.2ms (100.0% slower)
Touched files |
|
Maintainer triage (Mar 2026)
Suggested next steps
|
- update DEFAULT_COMPONENT_SCHEMAS to packages/design-data-spec/components (schemas moved under the component-format spec; coverage was reporting 0%) - recalibrate real-data integration thresholds for current token corpus (deprecation rose to 32.2% after corpus migration) - add regression test asserting component-schema coverage resolves - refresh README baseline numbers and regenerate token-metrics-report.json - add changeset for the new @adobe/spectrum-tokens-metrics tool Co-authored-by: Cursor <cursoragent@cursor.com>
|
Refreshed this PR against current Verification + fixes applied:
Current baseline: 2,460 total tokens / 1,667 active / 793 deprecated (32.2%, 70% with migration path) / 100% UUID coverage / 96 components with tokens / 54 components with schema. All 22 tests pass. |
Description
This PR introduces a new CLI tool located at
tools/token-metricsto extract and report quantitative metrics from@adobe/spectrum-tokens. The tool provides a comprehensive baseline analysis of the design token system, covering inventory, scope, architecture, data quality, and component coverage. It generates both a human-readable summary (printed to stdout) and a machine-readable JSON report (token-metrics-report.json).Related Issue
This addresses the Spectrum OKR: "Token metrics are defined and included into our metrics system & have a baseline to compare moving forward." Specifically, it provides a concrete answer to Alison's question: "what does this mean specifically, and when should this be done by?"
Motivation and Context
The primary motivation is to establish a clear, quantifiable understanding of the current state of Spectrum's design token system. This baseline is crucial for:
How Has This Been Tested?
tools/token-metrics/test/index.test.js) cover all core utility functions and metric computations.computeMetricsagainst the actualpackages/tokens/srcdirectory to ensure real-world data processing.token-metrics-report.jsonand verify the summary output.Screenshots (if appropriate):
N/A (CLI tool, output is text/JSON). The generated
token-metrics-report.jsonserves as an example output.Types of changes
Checklist: