Skip to content

fix: Update reference files for mcp - #4102

Merged
alanbsmith merged 5 commits into
Workday:prerelease/majorfrom
mannycarrera4:mc-update-mcp-reference
Jul 31, 2026
Merged

fix: Update reference files for mcp#4102
alanbsmith merged 5 commits into
Workday:prerelease/majorfrom
mannycarrera4:mc-update-mcp-reference

Conversation

@mannycarrera4

@mannycarrera4 mannycarrera4 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

MCP was missing quite a bit of token docs, updating the references for v16

Release Category

Infrastructure


Checklist

For the Reviewer

  • PR title is short and descriptive
  • PR summary describes the change (Fixes/Resolves linked correctly)
  • PR Release Notes describes additional information useful to call out in a release message or removed if not applicable
  • Breaking Changes provides useful information to upgrade to this code or removed if not applicable

Where Should the Reviewer Start?

Areas for Feedback? (optional)

  • Code
  • Documentation
  • Testing
  • Codemods

Testing Manually

Screenshots or GIFs (if applicable)

Thank You Gif (optional)

Summary by CodeRabbit

  • Documentation

    • Added a comprehensive v4.4 token reference covering colors, spacing, sizing, shape, typography, themes, deprecations, and Sana Canvas.
    • Documented Sana Canvas theming setup, token imports, theme configuration, and font guidance.
    • Clarified historical migration guides and linked them to current token documentation.
    • Updated color, shape, size, and spacing guidance with current usage examples, deprecated-token mappings, and migration recommendations.
  • Tools

    • Added token reference data and documentation resources for improved token discovery and MCP documentation support.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The 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.

Changes

v4.4 Token Reference

Layer / File(s) Summary
Canonical v4.4 reference
modules/docs/llm/tokens/v4/v4.4-token-reference.md
Adds setup, namespaces, color, spacing, sizing, shape, typography, theme, utility, verification, and regeneration guidance.
Token family and theme guidance
modules/docs/llm/theming.md, modules/docs/llm/tokens/v4/*.md
Documents Sana Canvas setup, current token families, deprecated mappings, t-shirt scales, and updated createStyles examples.
Token inventory generation
modules/mcp/build/generate-token-reference-data.mjs, modules/mcp/build/token-reference-data.json
Extracts token metadata, live values, scales, Sana overrides, and deprecation counts into generated reference data.
MCP resource exposure
modules/mcp/lib/config.json, modules/mcp/lib/index.ts, modules/mcp/stories/mdx/MCPDocs.mdx
Registers the v4.4 reference and color guide as MCP resources and updates token-tool documentation.
Historical migration pointers
modules/docs/llm/llm-token-migration-14.txt, modules/docs/llm/tokens/token-migration.md
Identifies older migration documents as historical and links to the current v4.4 reference.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Possibly related PRs

  • Workday/canvas-kit#3992 — Covers Sana Canvas component styling and Storybook changes related to this theming documentation.
  • Workday/canvas-kit#4000 — Uses Sana Canvas button styling that this PR documents through token and theme guidance.
  • Workday/canvas-kit#4048 — Covers token and theming updates for Segmented Control and Action Bar components.

Suggested reviewers: sheelah, rayredgoose

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change, which updates MCP reference files and related token documentation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cypress

cypress Bot commented Jul 29, 2026

Copy link
Copy Markdown

Workday/canvas-kit    Run #11404

Run Properties:  status check passed Passed #11404  •  git commit 83b3f008f1 ℹ️: Merge 00ab97a2035e0465715bb57aa1f895a9dd5a293b into 80bd19c17860e51ce456ce4d2b9a...
Project Workday/canvas-kit
Branch Review mc-update-mcp-reference
Run status status check passed Passed #11404
Run duration 02m 44s
Commit git commit 83b3f008f1 ℹ️: Merge 00ab97a2035e0465715bb57aa1f895a9dd5a293b into 80bd19c17860e51ce456ce4d2b9a...
Committer Manuel Carrera
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 17
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 809
View all changes introduced in this branch ↗︎
UI Coverage  19.67%
  Untested elements 1521  
  Tested elements 370  
Accessibility  99.47%
  Failed rules  5 critical   5 serious   0 moderate   2 minor
  Failed elements 72  

Comment thread modules/react-fonts/lib/fonts.ts Outdated
@mannycarrera4
mannycarrera4 marked this pull request as ready for review July 30, 2026 17:11
@mannycarrera4
mannycarrera4 requested a review from a team as a code owner July 30, 2026 17:11

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could link to the new Fonts guide in Storybook (just merged the PR adding it), if needed.

@alanbsmith
alanbsmith enabled auto-merge (squash) July 31, 2026 13:26
@alanbsmith
alanbsmith disabled auto-merge July 31, 2026 13:29
@alanbsmith
alanbsmith enabled auto-merge (squash) July 31, 2026 13:29

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (1)
modules/mcp/build/generate-token-reference-data.mjs (1)

44-60: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate deprecation-scanning logic between parseDeprecated and buildDeprecationTable.

Both functions scan .d.ts lines for @deprecated markers 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 (Map vs. array of rows). Extract one shared scanning helper that yields {key, cssVar, note} records, then have parseDeprecated build the Map and buildDeprecationTable build 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.ts output.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 27691d7 and c5d9e7e.

📒 Files selected for processing (13)
  • modules/docs/llm/llm-token-migration-14.txt
  • modules/docs/llm/theming.md
  • modules/docs/llm/tokens/token-migration.md
  • modules/docs/llm/tokens/v4/color.md
  • modules/docs/llm/tokens/v4/shape.md
  • modules/docs/llm/tokens/v4/size.md
  • modules/docs/llm/tokens/v4/space.md
  • modules/docs/llm/tokens/v4/v4.4-token-reference.md
  • modules/mcp/build/generate-token-reference-data.mjs
  • modules/mcp/build/token-reference-data.json
  • modules/mcp/lib/config.json
  • modules/mcp/lib/index.ts
  • modules/mcp/stories/mdx/MCPDocs.mdx

Comment on lines +4 to +9
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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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 x1x20 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.

Comment on lines +386 to +387
| New in beta.11 | `surface.elevated`, `border.elevated` (Sana-only) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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"
done

Repository: 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/**' || true

Repository: 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.

Comment on lines +14 to +19
// 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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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/package fallback so the script always resolves @workday/canvas-tokens-web from node_modules/package.json.
  • modules/mcp/build/token-reference-data.json#L2: regenerate this file against the pinned 4.4.0-beta.13 release so "version" and all derived counts reflect the actual dependency version shipped in package.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.

Comment on lines +66 to +76
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;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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
fi

Repository: 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}));
  }
}
JS

Repository: 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.

Comment on lines +224 to +233
// 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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Suggested change
// 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.

@alanbsmith
alanbsmith merged commit fa29f86 into Workday:prerelease/major Jul 31, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants