sonance-brand-mcp 1.3.66 → 1.3.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -946,6 +946,15 @@ ${linesWithNumbers}
|
|
|
946
946
|
|
|
947
947
|
// Add theme context to the prompt so LLM knows actual color values and safe combinations
|
|
948
948
|
const themeContext = formatThemeForPrompt(discoveredTheme);
|
|
949
|
+
|
|
950
|
+
// DEBUG: Log what we're sending to the LLM
|
|
951
|
+
debugLog("Theme context for LLM", {
|
|
952
|
+
cssVarCount: Object.keys(discoveredTheme.cssVariables).length,
|
|
953
|
+
warningCount: discoveredTheme.contrastAnalysis?.warnings.length || 0,
|
|
954
|
+
safePatternCount: discoveredTheme.contrastAnalysis?.safePatterns.length || 0,
|
|
955
|
+
preview: themeContext.substring(0, 1000) + "...",
|
|
956
|
+
});
|
|
957
|
+
|
|
949
958
|
textContent += `\n${themeContext}\n`;
|
|
950
959
|
}
|
|
951
960
|
|
|
@@ -480,18 +480,32 @@ export function analyzeContrastRelationships(
|
|
|
480
480
|
// Track which backgrounds we've analyzed to add white/black alternatives
|
|
481
481
|
const analyzedBackgrounds: { name: string; rgb: RGB }[] = [];
|
|
482
482
|
|
|
483
|
+
// DEBUG: Log start of analysis
|
|
484
|
+
const varCount = Object.keys(cssVariables).length;
|
|
485
|
+
console.log("[Contrast] Starting analysis with", varCount, "variables");
|
|
486
|
+
|
|
487
|
+
let skippedForeground = 0;
|
|
488
|
+
let skippedNonColor = 0;
|
|
489
|
+
let failedParse = 0;
|
|
490
|
+
let noForegroundVar = 0;
|
|
491
|
+
let pairsAnalyzed = 0;
|
|
492
|
+
|
|
483
493
|
// Find all bg/foreground pairs automatically
|
|
484
494
|
for (const [varName, value] of Object.entries(cssVariables)) {
|
|
485
495
|
// Skip if this is a foreground variable
|
|
486
|
-
if (varName.includes("foreground"))
|
|
496
|
+
if (varName.includes("foreground")) {
|
|
497
|
+
skippedForeground++;
|
|
498
|
+
continue;
|
|
499
|
+
}
|
|
487
500
|
|
|
488
501
|
// Skip non-color variables
|
|
489
502
|
if (
|
|
490
503
|
varName.includes("radius") ||
|
|
491
504
|
varName.includes("shadow") ||
|
|
492
505
|
varName.includes("ring") ||
|
|
493
|
-
varName.includes("border") && !varName.match(/border$/)
|
|
506
|
+
(varName.includes("border") && !varName.match(/border$/))
|
|
494
507
|
) {
|
|
508
|
+
skippedNonColor++;
|
|
495
509
|
continue;
|
|
496
510
|
}
|
|
497
511
|
|
|
@@ -500,19 +514,30 @@ export function analyzeContrastRelationships(
|
|
|
500
514
|
|
|
501
515
|
// Parse background color
|
|
502
516
|
const bgRgb = parseColorToRgb(value);
|
|
503
|
-
if (!bgRgb)
|
|
517
|
+
if (!bgRgb) {
|
|
518
|
+
// DEBUG: Log failed parses for important color variables
|
|
519
|
+
if (baseName.includes("primary") || baseName.includes("accent") || baseName.includes("success")) {
|
|
520
|
+
console.log("[Contrast] Failed to parse:", varName, "=", value);
|
|
521
|
+
}
|
|
522
|
+
failedParse++;
|
|
523
|
+
continue;
|
|
524
|
+
}
|
|
504
525
|
|
|
505
526
|
// Track this background for alternative suggestions
|
|
506
527
|
analyzedBackgrounds.push({ name: baseName, rgb: bgRgb });
|
|
507
528
|
|
|
508
529
|
// Check if there's a corresponding foreground variable
|
|
509
530
|
if (cssVariables[foregroundVar]) {
|
|
531
|
+
pairsAnalyzed++;
|
|
510
532
|
const fgRgb = parseColorToRgb(cssVariables[foregroundVar]);
|
|
511
533
|
|
|
512
534
|
if (fgRgb) {
|
|
513
535
|
const ratio = getContrastRatio(bgRgb, fgRgb);
|
|
514
536
|
const passes = ratio >= 4.5; // WCAG AA for normal text
|
|
515
537
|
|
|
538
|
+
// DEBUG: Log analyzed pairs
|
|
539
|
+
console.log("[Contrast] Pair:", baseName, "bg:", value, "fg:", cssVariables[foregroundVar], "ratio:", ratio.toFixed(1), passes ? "PASS" : "FAIL");
|
|
540
|
+
|
|
516
541
|
if (!passes) {
|
|
517
542
|
// Find the best alternative
|
|
518
543
|
const alternative = getBestAlternative(bgRgb);
|
|
@@ -531,9 +556,26 @@ export function analyzeContrastRelationships(
|
|
|
531
556
|
});
|
|
532
557
|
}
|
|
533
558
|
}
|
|
559
|
+
} else {
|
|
560
|
+
// DEBUG: Log important variables without foreground
|
|
561
|
+
if (baseName.includes("primary") || baseName.includes("accent") || baseName.includes("success")) {
|
|
562
|
+
console.log("[Contrast] No foreground var for:", baseName, "looked for:", foregroundVar);
|
|
563
|
+
}
|
|
564
|
+
noForegroundVar++;
|
|
534
565
|
}
|
|
535
566
|
}
|
|
536
567
|
|
|
568
|
+
// DEBUG: Summary
|
|
569
|
+
console.log("[Contrast] Summary:", {
|
|
570
|
+
total: varCount,
|
|
571
|
+
skippedForeground,
|
|
572
|
+
skippedNonColor,
|
|
573
|
+
failedParse,
|
|
574
|
+
noForegroundVar,
|
|
575
|
+
pairsAnalyzed,
|
|
576
|
+
analyzedBackgrounds: analyzedBackgrounds.length,
|
|
577
|
+
});
|
|
578
|
+
|
|
537
579
|
// Add white/black alternatives for all analyzed backgrounds
|
|
538
580
|
const whiteRgb: RGB = { r: 255, g: 255, b: 255 };
|
|
539
581
|
const blackRgb: RGB = { r: 0, g: 0, b: 0 };
|
|
@@ -915,6 +915,15 @@ ${linesWithNumbers}
|
|
|
915
915
|
|
|
916
916
|
// Add theme context to the prompt so LLM knows actual color values and safe combinations
|
|
917
917
|
const themeContext = formatThemeForPrompt(discoveredTheme);
|
|
918
|
+
|
|
919
|
+
// DEBUG: Log what we're sending to the LLM
|
|
920
|
+
debugLog("Theme context for LLM", {
|
|
921
|
+
cssVarCount: Object.keys(discoveredTheme.cssVariables).length,
|
|
922
|
+
warningCount: discoveredTheme.contrastAnalysis?.warnings.length || 0,
|
|
923
|
+
safePatternCount: discoveredTheme.contrastAnalysis?.safePatterns.length || 0,
|
|
924
|
+
preview: themeContext.substring(0, 1000) + "...",
|
|
925
|
+
});
|
|
926
|
+
|
|
918
927
|
textContent += `\n${themeContext}\n`;
|
|
919
928
|
}
|
|
920
929
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sonance-brand-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.68",
|
|
4
4
|
"description": "MCP Server for Sonance Brand Guidelines and Component Library - gives Claude instant access to brand colors, typography, and UI components.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|