fix: Update reference files for mcp - #4102
Conversation
📝 WalkthroughWalkthroughThe PR adds a canonical v4.4 token reference, updates token-family and Sana Canvas documentation, generates token-reference data, exposes new MCP resources, and labels older migration guides as historical. Changesv4.4 Token Reference
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Workday/canvas-kit
|
||||||||||||||||||||||||||||||||||||||||
| Project |
Workday/canvas-kit
|
| Branch Review |
mc-update-mcp-reference
|
| Run status |
|
| Run duration | 02m 44s |
| Commit |
|
| Committer | Manuel Carrera |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
17
|
|
|
0
|
|
|
809
|
| View all changes introduced in this branch ↗︎ | |
UI Coverage
19.67%
|
|
|---|---|
|
|
1521
|
|
|
370
|
Accessibility
99.47%
|
|
|---|---|
|
|
5 critical
5 serious
0 moderate
2 minor
|
|
|
72
|
|
|
||
| Use this document when choosing tokens, migrating deprecated paths, or enabling the Sana Canvas theme. For historical migrations (v2→v3, v13→v14), see the older guides listed at the end. | ||
|
|
||
| > **Your priors may be out of date.** In v4.4, ~64% of `system.color.*` is deprecated, including all of `text.*` and `icon.*` and nearly all of `bg.*`. Trust this reference and the installed package JSDoc over older MCP migration docs. |
There was a problem hiding this comment.
nit: "Prior documentation sources"?
| @import '@workday/canvas-tokens-web/css/component/_variables.css'; | ||
| @import '@workday/canvas-tokens-web/css/system/_variables.css'; | ||
| /* Import Sana last so equal-specificity [data-theme] rules win over :root */ | ||
| @import '@workday/canvas-tokens-web/css/sana/_variables.css'; |
There was a problem hiding this comment.
Thanks for including this! That ordering is important.
| color tokens under `[data-theme="sana-canvas"]`. Consumers write plain `system.*` paths — values | ||
| change automatically. Do not use `system.sana.*` or `system.legacy.*` in application code. | ||
|
|
||
| Load Sana Sans via `@workday/canvas-kit-react/fonts`. For the full current token inventory and |
There was a problem hiding this comment.
We could link to the new Fonts guide in Storybook (just merged the PR adding it), if needed.
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (1)
modules/mcp/build/generate-token-reference-data.mjs (1)
44-60: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate deprecation-scanning logic between
parseDeprecatedandbuildDeprecationTable.Both functions scan
.d.tslines for@deprecatedmarkers and then look ahead up to 8 lines for a matching CSS-variable key using near-identical regexes. The only difference is the output shape (Mapvs. array of rows). Extract one shared scanning helper that yields{key, cssVar, note}records, then haveparseDeprecatedbuild theMapandbuildDeprecationTablebuild the array from it. This also centralizes the magic "8 lines" lookahead window, which is a fragile assumption tied to the exact formatting of the third-party.d.tsoutput.Also applies to: 108-124
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@modules/mcp/build/generate-token-reference-data.mjs` around lines 44 - 60, Extract the shared `@deprecated` marker and CSS-variable lookahead logic from `parseDeprecated` and `buildDeprecationTable` into one helper that yields `{key, cssVar, note}` records, centralizing the 8-line window. Update `parseDeprecated` to construct its `Map` from those records and `buildDeprecationTable` to construct its row array, preserving both existing output shapes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@modules/docs/llm/llm-token-migration-14.txt`:
- Around line 4-9: The historical guide header uses past tense but the body text
at line 10 still uses present tense with "is using a new token system". Update
that sentence to use past tense by changing "is using" to "used" or "introduced"
to maintain consistent historical tone throughout the document.
In `@modules/docs/llm/tokens/v4/shape.md`:
- Line 9: Update the deprecated scalar scale list in the documentation text to
include x1Half, keeping it aligned with the complete canonical sequence: x1,
x1Half, x2, x4, x6, zero, half, and round. Apply the same correction to both
occurrences of the list.
In `@modules/docs/llm/tokens/v4/v4.4-token-reference.md`:
- Line 277: Update the deprecated system.space documentation in the token
reference to include system.space.zero and system.space.half alongside
system.space.x1–x20, or explicitly state that the listed aliases are not
exhaustive.
- Around line 386-387: Add surface.elevated and border.elevated to the Sana
token inventories in the v4.4 token reference, including their
system.color.surface.*, system.color.border.*, and system.sana.* paths. Keep the
beta.11 entry consistent with these public token listings rather than describing
them only as CSS variables.
In `@modules/mcp/build/generate-token-reference-data.mjs`:
- Around line 224-233: Update the generated color-deprecations markdown in the
loop using colorDeps and depMd to interpolate the computed
systemDeprecations.length and brandDeprecations.length values instead of
hardcoded 261 and 39, keeping the existing explanatory text and output file
unchanged.
- Around line 14-19: Remove the hardcoded /tmp/ck-token-audit/package fallback
from the tokensPkgPath resolution logic in generate-token-reference-data.mjs.
The conditional that checks beta11Path should be removed so the script always
resolves `@workday/canvas-tokens-web` from the localPath (node_modules) where the
pinned 4.4.0-beta.13 version is installed. After updating the script, regenerate
token-reference-data.json by running the corrected generator, ensuring the
version field and all token-derived counts in the output match the actual pinned
dependency version in package.json.
- Around line 66-76: Update extractPx to parse the final fallback value from
nested var() expressions, rather than capturing the inner variable name.
Preserve existing rem-to-px conversion and px/raw-value handling, while ensuring
packaged base token fallbacks such as 1.5rem resolve correctly instead of
returning "—" or an intermediate var() value.
---
Nitpick comments:
In `@modules/mcp/build/generate-token-reference-data.mjs`:
- Around line 44-60: Extract the shared `@deprecated` marker and CSS-variable
lookahead logic from `parseDeprecated` and `buildDeprecationTable` into one
helper that yields `{key, cssVar, note}` records, centralizing the 8-line
window. Update `parseDeprecated` to construct its `Map` from those records and
`buildDeprecationTable` to construct its row array, preserving both existing
output shapes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0c3d190b-5bf6-45b0-bd87-6540c9386792
📒 Files selected for processing (13)
modules/docs/llm/llm-token-migration-14.txtmodules/docs/llm/theming.mdmodules/docs/llm/tokens/token-migration.mdmodules/docs/llm/tokens/v4/color.mdmodules/docs/llm/tokens/v4/shape.mdmodules/docs/llm/tokens/v4/size.mdmodules/docs/llm/tokens/v4/space.mdmodules/docs/llm/tokens/v4/v4.4-token-reference.mdmodules/mcp/build/generate-token-reference-data.mjsmodules/mcp/build/token-reference-data.jsonmodules/mcp/lib/config.jsonmodules/mcp/lib/index.tsmodules/mcp/stories/mdx/MCPDocs.mdx
| IMPORTANT: This migration guide is for Canvas Kit v14 (historical) | ||
| ================================================================================ | ||
|
|
||
| For the current v4.4 token surface (Sana Canvas, t-shirt scales, deprecations), see | ||
| tokens/v4/v4.4-token-reference.md in this MCP server's token documentation. | ||
|
|
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use past tense for the historical v14 guide.
After labeling this guide historical, the body still says Canvas Kit v14 is using a new token system at Line 10. Change it to used or introduced.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@modules/docs/llm/llm-token-migration-14.txt` around lines 4 - 9, The
historical guide header uses past tense but the body text at line 10 still uses
present tense with "is using a new token system". Update that sentence to use
past tense by changing "is using" to "used" or "introduced" to maintain
consistent historical tone throughout the document.
| Shape tokens are aliased to base `size` tokens to define border radius. Each token corresponds to a specific use case and component type. | ||
|
|
||
| [View our shape tokens](https://workday.github.io/canvas-tokens/?path=/docs/docs-system-tokens-shape--docs) | ||
| Use t-shirt size names (`sm`, `md`, `lg`, …). The old scalar scale (`x1`, `x2`, `x4`, `x6`, `zero`, `half`, `round`) is deprecated. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Include the complete deprecated scalar list.
The canonical reference also marks shape.x1Half as deprecated. Update both lists to include x1Half, or label the examples as non-exhaustive. Keep the list aligned with x1, x1Half, x2, x4, x6, zero, half, and round.
Also applies to: 39-39
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@modules/docs/llm/tokens/v4/shape.md` at line 9, Update the deprecated scalar
scale list in the documentation text to include x1Half, keeping it aligned with
the complete canonical sequence: x1, x1Half, x2, x4, x6, zero, half, and round.
Apply the same correction to both occurrences of the list.
| | `padding*` | `system.padding.*` | | ||
| | `width`, `height`, `min/max`, `inlineSize`, `blockSize` | `system.size.*` | | ||
|
|
||
| `system.size.*` tokens (`xxxs` through `xxl`) are **valid** for component dimensions. `system.space.x1`–`x20` are **deprecated** — there is no `system.space` in new code. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Include all deprecated system.space aliases.
modules/docs/llm/tokens/v4/space.md also identifies system.space.zero and system.space.half as deprecated. Include these paths here, or state that the x1–x20 list is not exhaustive.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@modules/docs/llm/tokens/v4/v4.4-token-reference.md` at line 277, Update the
deprecated system.space documentation in the token reference to include
system.space.zero and system.space.half alongside system.space.x1–x20, or
explicitly state that the listed aliases are not exhaustive.
| | New in beta.11 | `surface.elevated`, `border.elevated` (Sana-only) | | ||
|
|
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
pkg="node_modules/@workday/canvas-tokens-web"
for file in \
"$pkg/dist/es6/system/index.d.ts" \
"$pkg/css/sana/_variables.css"
do
test -f "$file" || {
echo "Missing file: $file" >&2
exit 1
}
echo "== $file =="
rg -n -i 'elevated|surface|border' "$file"
doneRepository: Workday/canvas-kit
Length of output: 21668
🏁 Script executed:
#!/bin/bash
set -euo pipefail
doc="modules/docs/llm/tokens/v4/v4.4-token-reference.md"
echo "== doc status =="
test -f "$doc" || { echo "Missing doc file: $doc"; exit 1; }
echo "== target lines =="
sed -n '360,395p' "$doc" | cat -n
echo "== nearby inventories/sections for surface/border/elevated =="
rg -n -i 'surface\.|border\.|elevated|New in beta\.11|surface\.raised|border\.default|raised' "$doc" | sed -n '1,200p'
echo "== exact path occurrences in repo docs =="
rg -n '\\`surface\\.elevated\\`|\\`border\\.elevated\\`|surface\\.elevated|border\\.elevated' modules/docs || true
echo "== exact path occurrences in package sources outside installed node_modules =="
rg -n -i 'surface\.elevated|border\.elevated|--cnvs-sys-color-surface-elevated|--cnvs-sys-color-border-elevated' . --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' || trueRepository: Workday/canvas-kit
Length of output: 8103
Add surface.elevated / border.elevated to the Sana inventory.
These paths are Sana public tokens (system.sana.color.surface.elevated / system.sana.color.border.elevated), but they are not listed in the system.color.surface.*, system.color.border.*, or system.sana.* inventories. Add them there, or change the beta.11 row to describe them only as CSS variable tokens.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@modules/docs/llm/tokens/v4/v4.4-token-reference.md` around lines 386 - 387,
Add surface.elevated and border.elevated to the Sana token inventories in the
v4.4 token reference, including their system.color.surface.*,
system.color.border.*, and system.sana.* paths. Keep the beta.11 entry
consistent with these public token listings rather than describing them only as
CSS variables.
| // Prefer beta.11 from /tmp if repo still has beta.7 | ||
| const beta11Path = '/tmp/ck-token-audit/package'; | ||
| const localPath = path.join(repoRoot, 'node_modules/@workday/canvas-tokens-web'); | ||
| const tokensPkgPath = fs.existsSync(path.join(beta11Path, 'package.json')) | ||
| ? beta11Path | ||
| : localPath; |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🔴 Critical | ⚡ Quick win
Version mismatch between the pinned dependency and the generated reference data. The generator's hardcoded /tmp path fallback is the root cause: it lets the script resolve token data from a package snapshot other than the one pinned in package.json (4.4.0-beta.13), and the checked-in output reflects that divergent snapshot.
modules/mcp/build/generate-token-reference-data.mjs#L14-L19: remove the/tmp/ck-token-audit/packagefallback so the script always resolves@workday/canvas-tokens-webfromnode_modules/package.json.modules/mcp/build/token-reference-data.json#L2: regenerate this file against the pinned4.4.0-beta.13release so"version"and all derived counts reflect the actual dependency version shipped inpackage.json.
📍 Affects 2 files
modules/mcp/build/generate-token-reference-data.mjs#L14-L19(this comment)modules/mcp/build/token-reference-data.json#L2-L2
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@modules/mcp/build/generate-token-reference-data.mjs` around lines 14 - 19,
Remove the hardcoded /tmp/ck-token-audit/package fallback from the tokensPkgPath
resolution logic in generate-token-reference-data.mjs. The conditional that
checks beta11Path should be removed so the script always resolves
`@workday/canvas-tokens-web` from the localPath (node_modules) where the pinned
4.4.0-beta.13 version is installed. After updating the script, regenerate
token-reference-data.json by running the corrected generator, ensuring the
version field and all token-derived counts in the output match the actual pinned
dependency version in package.json.
| function extractPx(varString) { | ||
| const m = varString.match(/,\s*([^)]+)\)$/); | ||
| if (!m) return '—'; | ||
| const val = m[1].trim(); | ||
| if (val.endsWith('rem')) { | ||
| const rem = parseFloat(val); | ||
| if (!Number.isNaN(rem)) return `${Math.round(rem * 16)}px`; | ||
| } | ||
| if (val.endsWith('px')) return val; | ||
| return val; | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Inspect the actual value format of base vs sana namespace tokens.
fd -HI 'canvas-tokens-web' -t d node_modules/@workday 2>/dev/null | head -5
find / -maxdepth 6 -path '*canvas-tokens-web/dist/common-js/system/index.js' 2>/dev/null -exec node -e "
const s = require(process.argv[1]);
console.log('shape.md:', JSON.stringify(s.shape?.md));
console.log('gap.md:', JSON.stringify(s.gap?.md));
console.log('sana.shape.sm:', JSON.stringify(s.sana?.shape?.sm));
" {} \;Repository: Workday/canvas-kit
Length of output: 197
🏁 Script executed:
#!/bin/bash
set -u
echo "== package version/config =="
if [ -f package.json ]; then
node - <<'JS'
const fs = require('fs');
const p = JSON.parse(fs.readFileSync(process.cwd() + '/package.json','utf8'));
console.log(JSON.stringify({
name: p.name,
version: p.version,
dependencies: p.dependencies,
devDependencies: p.devDependencies
}, null, 2));
JS
fi
echo "== locate generated file and token data =="
fd -HI 'generate-token-reference-data.mjs|token-reference-data.json' .
echo "== inspect generate-token-reference-data.mjs outline and contents =="
GEN="$(fd -HI 'generate-token-reference-data.mjs' . | head -1)"
if [ -n "${GEN:-}" ]; then
wc -l "$GEN"
ast-grep outline "$GEN" || true
sed -n '1,160p' "$GEN" | cat -n
fi
echo "== inspect token-reference-data relevant entries if present =="
DAT="$(fd -HI 'token-reference-data.json' . | head -1)"
if [ -n "${DAT:-}" ]; then
wc -l "$DAT"
python3 - <<'PY' "$DAT"
import json,sys
p=sys.argv[1]
d=json.load(open(p))
for key in default_keys:=list(d.keys())[:15]:
print(key, type(d[key] if isinstance(d[key], dict) else d[key]), repr(str(d[key]).replace('\n','\\n')[:300]))
print("shapeDefault sample entries:")
for k,v in d.get("shapeDefault",{}).items():
if len(str(v))<200:
print(k, repr(v))
print("sanaPx sample resolved:")
for k,v in d.get("sanaPx",{}).items():
if k=="system.shape.x2" or k=="system.gap.x4" or v not in ("—", None):
print(k, repr(v))
PY
fi
echo "== package files and exports =="
ls -R node_modules/@workday/canvas-tokens-web | head -80
package_json="$(ls node_modules/@workday/canvas-tokens-web/package.json 2>/dev/null | head -1)"
if [ -n "${package_json:-}" ]; then cat "$package_json" ; fi
echo "== locate relevant token source files =="
fd -HI 'index.(js|cjs|mjs|ts)|variables.css' node_modules/@workday/canvas-tokens-web | sed -n '1,80p'
TG="$(fd -HI 'index.js' node_modules/@workday/canvas-tokens-web | head -5 | tr '\n' ' ')"
if [ -n "${TG:-}" ]; then
node - <<'JS'
const fs = require('fs');
for (const p of process.argv.slice(2)) {
if (!p.includes('system')) continue;
const text = fs.readFileSync(p,'utf8');
const lines = text.split('\n').filter(l => /shape.x2|gap.x4|padding|sana\.shape|sana\.gap/.test(l)).slice(0,40);
console.log('---', p, '---');
console.log(lines.join('\n'));
}
JS
node - "$TG" 2>/dev/null || true
fi
echo "== relevant CSS variable declarations =="
css="$(find node_modules/@workday/canvas-tokens-web -path '*system*/css/*/variables*.css' -print | head -20)"
if [ -n "${css:-}" ]; then
for f in $(find node_modules/@workday/canvas-tokens-web -path '*/css/system/_variables.css' 2>/dev/null | head -20); do
echo "--- $f ---"
sed -n '/\[data-token-type="shape"\],/I;/\[data-token-type="space"\],/I,/\/\*/,/p' "$f" | sed -n '1,80p'
rg -n -- '--cnvs-sys-(shape|space|gap|padding|size)|data-token-type' "$f" | sed -n '1,120p'
done
fiRepository: Workday/canvas-kit
Length of output: 15251
🏁 Script executed:
#!/bin/bash
set -u
echo "== package token JS exports =="
node_modules/@workday/canvas-tokens-web/dist/common-js/index.js
echo "---"
node_modules/@workday/canvas-tokens-web/dist/common-js/system/index.js | sed -n '1,220p'
echo "---- extra relevant system JS lines ----"
rg -n "shape|x2|x4|gap|padding|size|sana" node_modules/@workday/canvas-tokens-web/dist/common-js/system/index.js | sed -n '1,200p'
echo "== package token ES6 exports =="
node_modules/@workday/canvas-tokens-web/dist/es6/index.js
echo "---"
node_modules/@workday/canvas-tokens-web/dist/es6/system/index.js | sed -n '1,260p'
echo "---- extra relevant system ES6 lines ----"
rg -n "shape|x2|x4|gap|padding|size|sana" node_modules/@workday/canvas-tokens-web/dist/es6/system/index.js | sed -n '1,200p'
echo "== CSS default variables around shape/space/sana =="
rg -n --color=never "--cnvs-sys-(shape|space|gap|padding|size)|cnvs-sana|data-token-type" \
node_modules/@workday/canvas-tokens-web/css/system/_variables.css \
node_modules/@workday/canvas-tokens-web/css/sana/_variables.css \
node_modules/@workday/canvas-tokens-web/css/base/_variables.css \
node_modules/@workday/canvas-tokens-web/css/base/_variables.css | sed -n '1,260p'
echo "== generated data sample =="
python3 - <<'PY'
import json
d=json.load(open("modules/mcp/build/token-reference-data.json"))
for section in ["shapeDefault","scaleData","sanaPx"]:
print(section)
s=d.get(section)
print(type(s).__name__, len(s) if isinstance(s, (list, dict)) else "NA")
samples=[]
if isinstance(s, dict): samples=[("scaleData.gap x4", s["gap"]["x4"]), (f"scaleData.size x4", s["size"]["x4"])]
elif isinstance(s, list): samples=s[:6]
for x in samples:
if isinstance(x, dict):
print(x)
else:
print(x)
PY
echo "== static behavioral probe of extractPx on package values =="
node_modules/@workday/canvas-tokens-web/dist/common-js/system/index.js > /tmp/system-token-index.js
node - <<'JS'
const fs = require('fs');
const System = require('/tmp/system-token-index.js');
const extractPx = (varString) => {
const m = varString.match(/,\s*([^)]+)\)$/);
if (!m) return '—';
const val = m[1].trim();
if (val.endsWith('rem')) {
const rem = parseFloat(val);
if (!Number.isNaN(rem)) return `${Math.round(rem * 16)}px`;
}
if (val.endsWith('px')) return val;
return val;
};
const samples = [
{ns: 'system.shape', tokens: ['x2','x4','circle','circular','rounded','sharp','round']},
{ns: 'system.gap', tokens: ['x2','x4','x8']},
{ns: 'system.padding', tokens: ['x2','x4','x8']},
{ns: 'system.size', tokens: ['x2','x4','x8']},
{ns: 'system.sana.shape', tokens: ['sm','x2','x4']},
{ns: 'system.sana.gap', tokens: ['x2','x4']},
];
for (const {ns, tokens} of samples) {
let obj = System;
for (const part of ns.split('.')) obj = obj?.[part];
const rootObj = ns.startsWith('system.sana') ? System.sana : System;
const flat = (o, prefix='') => Object.entries(o).flatMap(([k,v]) => typeof v==='object' && v!=null ? flat(v, `${prefix}${k}.`) : [[`${prefix}${k}`, v]]);
for (const token of tokens) {
const key = ns+'.'+token;
const value = (ns==='system.sana.shape' && rootObj.sana && rootObj.sana.shape) ? rootObj.sana.shape[token]
: (ns.startsWith('system.sana') ? rootObj.sana?.[token] : rootObj[token]);
const derived = extractPx(value || '');
console.log(JSON.stringify({key, value, derived}));
}
}
JSRepository: Workday/canvas-kit
Length of output: 20163
Parse the packaged token fallback values instead of defaulting to "—".
@workday/canvas-tokens-web@4.4.0-beta.13 exports base shape, gap, padding, and size tokens as var(..., fallback) strings, while system.shape.x2, system.gap.x4, and similar raw variable names are leaf tokens only. This generator uses the correct runtime values and can resolve "0.5rem"/"1rem" defaults from the fallbacks instead of resolving all base defaults to "—", but extractPx still mis-parses nested fallbacks like var(--cnvs-sys-gap-xl, var(--cnvs-sys-space-x6, 1.5rem)) as var(--cnvs-sys-space-x6. Handle the last fallback in the var() chain before converting units.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@modules/mcp/build/generate-token-reference-data.mjs` around lines 66 - 76,
Update extractPx to parse the final fallback value from nested var()
expressions, rather than capturing the inner variable name. Preserve existing
rem-to-px conversion and px/raw-value handling, while ensuring packaged base
token fallbacks such as 1.5rem resolve correctly instead of returning "—" or an
intermediate var() value.
| // Top deprecated color mappings | ||
| const colorDeps = systemDeprecations | ||
| .filter(r => r.cssVar.includes('color')) | ||
| .slice(0, 40); | ||
| let depMd = '| Deprecated CSS variable | Replacement |\n|---|---|\n'; | ||
| for (const r of colorDeps) { | ||
| depMd += `| \`${r.cssVar}\` | ${r.replacement} |\n`; | ||
| } | ||
| depMd += '\n_See installed JSDoc for the full list of 261 system and 39 brand deprecations._\n'; | ||
| fs.writeFileSync(path.join(fragmentsDir, 'color-deprecations-sample.md'), depMd); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Use the computed deprecation counts instead of hardcoding literal numbers.
systemDeprecations.length and brandDeprecations.length are computed dynamically at lines 149-150, but line 232 hardcodes the literal numbers "261" and "39" directly into the generated markdown text. If the token package's deprecation count changes on a future regeneration, this text will silently go stale relative to the actual systemDeprecationCount/brandDeprecationCount fields written into the same output.
🐛 Proposed fix
-depMd += '\n_See installed JSDoc for the full list of 261 system and 39 brand deprecations._\n';
+depMd += `\n_See installed JSDoc for the full list of ${systemDeprecations.length} system and ${brandDeprecations.length} brand deprecations._\n`;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Top deprecated color mappings | |
| const colorDeps = systemDeprecations | |
| .filter(r => r.cssVar.includes('color')) | |
| .slice(0, 40); | |
| let depMd = '| Deprecated CSS variable | Replacement |\n|---|---|\n'; | |
| for (const r of colorDeps) { | |
| depMd += `| \`${r.cssVar}\` | ${r.replacement} |\n`; | |
| } | |
| depMd += '\n_See installed JSDoc for the full list of 261 system and 39 brand deprecations._\n'; | |
| fs.writeFileSync(path.join(fragmentsDir, 'color-deprecations-sample.md'), depMd); | |
| // Top deprecated color mappings | |
| const colorDeps = systemDeprecations | |
| .filter(r => r.cssVar.includes('color')) | |
| .slice(0, 40); | |
| let depMd = '| Deprecated CSS variable | Replacement |\n|---|---|\n'; | |
| for (const r of colorDeps) { | |
| depMd += `| \`${r.cssVar}\` | ${r.replacement} |\n`; | |
| } | |
| depMd += `\n_See installed JSDoc for the full list of ${systemDeprecations.length} system and ${brandDeprecations.length} brand deprecations._\n`; | |
| fs.writeFileSync(path.join(fragmentsDir, 'color-deprecations-sample.md'), depMd); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@modules/mcp/build/generate-token-reference-data.mjs` around lines 224 - 233,
Update the generated color-deprecations markdown in the loop using colorDeps and
depMd to interpolate the computed systemDeprecations.length and
brandDeprecations.length values instead of hardcoded 261 and 39, keeping the
existing explanatory text and output file unchanged.
Summary
MCP was missing quite a bit of token docs, updating the references for v16
Release Category
Infrastructure
Checklist
ready for reviewhas been added to PRFor the Reviewer
Where Should the Reviewer Start?
Areas for Feedback? (optional)
Testing Manually
Screenshots or GIFs (if applicable)
Thank You Gif (optional)
Summary by CodeRabbit
Documentation
Tools