Design Token Extractor & Migrator
A VS Code / Cursor extension and CLI that finds hardcoded design values, clusters them into a token system, and rewrites the literals after you preview and accept.
Problem
Hardcoded design values pile up in real codebases — hex colors, spacing literals, Tailwind arbitrary values, CSS-in-JS templates. Teams want a token system, but the migration is tedious and easy to get wrong if you rewrite everything at once.
What I did
I built a monorepo with three packages that share one pipeline: scan, cluster and name, review, then rewrite.
@design-token-extractor/core owns the logic. @design-token-extractor/cli exposes scan, generate, check, preview, and apply. The VS Code / Cursor extension (design-token-extractor-migrator) wraps the same pipeline with commands, CodeLens, and a preview UI.
Nothing writes source until you confirm. Preview Migration is accept/reject per safe replacement. Risky patterns — calc(), multi-layer shadows, vendor prefixes — stay flagged for manual review. Undo restores the last local backup.
Result
It has been downloaded 1,927 times on Open VSX.
The extension is on the Visual Studio Marketplace(opens in a new tab) and Open VSX(opens in a new tab). The core and CLI are on npm. The repo is public under MIT.
What I'd do next
Richer semantic naming suggestions, and better defaults for large monorepos where include/exclude globs matter as much as the scanner itself.
Architecture
The pipeline runs scan → cluster and name → review → rewrite, exposed through the CLI and the extension.
Scan
Reads CSS, SCSS, SASS, LESS, Vue SFCs, HTML, and JS/TS — including Tailwind arbitrary values and CSS-in-JS tagged templates — and finds hardcoded design values. Scan Workspace writes a report only; it does not change source files.
Cluster & name
Groups near-duplicate values and proposes primitive or semantic names. Close values can be flagged as similar; they are never auto-merged. Probable typos are flagged without merging them into a cluster.
Review
Human decisions — Review Clusters, Map Semantic Alias, Rename Token — persist to tokens.lock.json. Generate Token Files writes design-tokens/ from the lockfile without rewriting source CSS yet.
Rewrite
Preview Migration lets you accept or reject each safe replacement. Apply writes only what you accepted. Shorthand values, calc(), var(), custom properties, vendor prefixes, breakpoints, and multi-layer shadows stay flagged for manual review. Undo Last Migration restores the last local backup.