Skip to content

Commit 6f93837

Browse files
committed
Fix shadow token validation and bump to v0.2.1
- Fixed false positives in validate_token_usage for Optics shadow tokens - Improved CSS value normalization to preserve spaces in hsl() syntax - All 5 shadow tokens now validate correctly - Bumped version from 0.2.0 to 0.2.1
1 parent 57cdc96 commit 6f93837

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "optics-mcp",
3-
"version": "0.1.1",
4-
"description": "MCP Server for Optics Design System documentation and token usage",
3+
"version": "0.2.1",
4+
"description": "MCP Server for Optics Design System documentation and token usage with AI-optimized comprehension guide",
55
"main": "dist/index.js",
66
"type": "module",
77
"bin": {
@@ -28,7 +28,7 @@
2828
"license": "MIT",
2929
"repository": {
3030
"type": "git",
31-
"url": "https://github.com/RoleModel/optics-mcp.git"
31+
"url": "git+https://github.com/RoleModel/optics-mcp.git"
3232
},
3333
"bugs": {
3434
"url": "https://github.com/RoleModel/optics-mcp/issues"
@@ -47,6 +47,11 @@
4747
"files": [
4848
"dist",
4949
"README.md",
50-
"LICENSE"
50+
"LICENSE",
51+
"SYSTEM_OVERVIEW.md",
52+
"AI_IMPROVEMENTS.md",
53+
"WARP.md",
54+
"TOOLS.md",
55+
"EXAMPLES.md"
5156
]
5257
}

src/utils/css-parser.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,18 @@ export function extractAllValues(css: string): CSSValue[] {
174174
*/
175175
export function findMatchingToken(value: string, tokens: Array<{ name: string; value: string; category: string }>): string | null {
176176
// Normalize values for comparison
177-
const normalizeValue = (v: string) => v.toLowerCase().replace(/\s+/g, '');
177+
// Keep spaces in specific contexts like hsl() and rgba() where they're significant
178+
const normalizeValue = (v: string) => {
179+
return v
180+
.toLowerCase()
181+
.replace(/\s+/g, ' ') // Normalize multiple spaces to single space
182+
.replace(/\(\s+/g, '(') // Remove space after opening paren
183+
.replace(/\s+\)/g, ')') // Remove space before closing paren
184+
.replace(/\s*,\s*/g, ',') // Normalize commas
185+
.replace(/\s*\/\s*/g, '/') // Normalize forward slash (for alpha)
186+
.trim();
187+
};
188+
178189
const normalizedValue = normalizeValue(value);
179190

180191
for (const token of tokens) {

0 commit comments

Comments
 (0)