ds-shadcn: emit DTCG aliases for shadcn's own var() references, and put the template back - #15
Merged
Merged
Conversation
shadcn's default theme points a few of its variables at others of its own
(--code: var(--surface), --surface-foreground: var(--foreground)). The
generator only resolved var(--color-*) into Tailwind palette values, so
those five landed in tokens/system.{light,dark}.json as raw CSS, which a
consumer reads as a broken alias — scan() reported them as such, and the
Studio chooser left the pack out for that reason.
Map a var(--x) whose --x is a variable in the same set to {shadcn.x} and
regenerate. Both forms name the same colour, so nothing rendered changes;
the three tokens that previously resolved to nothing now resolve.
With the pack clean, put "shadcn" back in TEMPLATE_NAMES.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DpBnGsdoAuaeNu6VECKHL3
visualfart
marked this pull request as ready for review
October 1, 2026 04:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
shadcn's default theme points a few of its own variables at others of its own —
--code: var(--surface),--code-foreground: var(--surface-foreground),--surface-foreground: var(--foreground).systemTier()inpackages/ds-shadcn/scripts/generate.tsonly resolvedvar(--color-*)(the chart ramp's Tailwind blues) and copied everything else through verbatim, so five tokens landed intokens/system.light.jsonandtokens/system.dark.jsonas raw CSS. A consumer reads those as broken aliases, andscan()reported them asbroken-alias— which is why"shadcn"was left out of the Studio'sTEMPLATE_NAMES.The fix is in the generator, not the JSON: a
var(--x)whose--xis a variable in the same set becomes{shadcn.x}; avar(--x)naming a Tailwind variable still resolves to its value, as before.--radiusis excluded because the generator emits it as ashadcn.radius.*group rather than a token.With the pack clean,
"shadcn"goes back intoTEMPLATE_NAMES(afterfluent, matching the order inMODELLED) and the expected template count inapps/studio/test/templates.test.tsgoes 25 → 26.Regenerated tokens
Exactly the five values named above changed, e.g.:
"code": { - "$value": "var(--surface)" + "$value": "{shadcn.surface}" },Verification
templateGraph("shadcn")→scan(g)reports no issues at all — not just nobroken-alias/circular-alias. 832 tokens, both modes.undefinedand now resolve (shadcn.code,shadcn.code-foreground,shadcn.surface-foreground). Every other value is byte-identical, so nothing rendered changes.apps/studiotests: 86/86 pass, including the per-template assertion that aliases resolve, all 87 roles map exactly, and contrast passes in both modes for shadcn.npm run typecheckpasses.packages/ds-shadcnnpm run check: "Design system satisfies the semantic token contract."packages/verifierfails in this container, before and after the change, because Playwright's headless-shell binary isn't present (Executable doesn't exist at /opt/pw-browsers/chromium_headless_shell-1243/…). Unrelated to this diff.🤖 Generated with Claude Code
https://claude.ai/code/session_01DpBnGsdoAuaeNu6VECKHL3
Generated by Claude Code