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 |
|
Run report for f68c4a5bTotal time: 7.1ms | Comparison time: 0s | Estimated loss: 7.1ms (100.0% slower)
Touched files |
|
Maintainer triage (Mar 2026)
Suggested next steps
|
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: