sonance-brand-mcp 1.3.7 → 1.3.9

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.
Files changed (2) hide show
  1. package/dist/index.js +24 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -314,6 +314,7 @@ function runDevToolsInstaller() {
314
314
  // Source resolution
315
315
  let sourceBrandSystem;
316
316
  let sourceBrandContext;
317
+ let sourceUtils;
317
318
  let sourceDevTools;
318
319
  let sourceBrandOverridesCss;
319
320
  let sourceApiTheme;
@@ -325,6 +326,7 @@ function runDevToolsInstaller() {
325
326
  if (IS_BUNDLED) {
326
327
  sourceBrandSystem = path.join(BUNDLED_ASSETS, "brand-system.ts");
327
328
  sourceBrandContext = path.join(BUNDLED_ASSETS, "brand-context.tsx");
329
+ sourceUtils = path.join(BUNDLED_ASSETS, "utils.ts");
328
330
  sourceDevTools = path.join(BUNDLED_ASSETS, "dev-tools");
329
331
  sourceBrandOverridesCss = path.join(BUNDLED_ASSETS, "styles/brand-overrides.css");
330
332
  sourceApiTheme = path.join(BUNDLED_ASSETS, "api/sonance-theme/route.ts");
@@ -337,6 +339,7 @@ function runDevToolsInstaller() {
337
339
  else {
338
340
  sourceBrandSystem = path.join(DEV_PROJECT_ROOT, "src/lib/brand-system.ts");
339
341
  sourceBrandContext = path.join(DEV_PROJECT_ROOT, "src/lib/brand-context.tsx");
342
+ sourceUtils = path.join(DEV_PROJECT_ROOT, "src/lib/utils.ts");
340
343
  sourceDevTools = path.join(DEV_PROJECT_ROOT, "src/components/dev-tools");
341
344
  sourceBrandOverridesCss = path.join(DEV_PROJECT_ROOT, "src/styles/brand-overrides.css");
342
345
  sourceApiTheme = path.join(DEV_PROJECT_ROOT, "src/app/api/sonance-theme/route.ts");
@@ -357,6 +360,11 @@ function runDevToolsInstaller() {
357
360
  console.error(` Path: ${sourceBrandContext}`);
358
361
  process.exit(1);
359
362
  }
363
+ if (!fs.existsSync(sourceUtils)) {
364
+ console.error(" ❌ Error: Could not find utils.ts source file.");
365
+ console.error(` Path: ${sourceUtils}`);
366
+ process.exit(1);
367
+ }
360
368
  if (!fs.existsSync(sourceDevTools)) {
361
369
  console.error(" ❌ Error: Could not find dev-tools source directory.");
362
370
  console.error(` Path: ${sourceDevTools}`);
@@ -398,7 +406,7 @@ function runDevToolsInstaller() {
398
406
  process.exit(1);
399
407
  }
400
408
  console.log(" 📂 Installing files...");
401
- // 1. Install brand-system.ts and brand-context.tsx
409
+ // 1. Install lib files (brand-system.ts, brand-context.tsx, utils.ts)
402
410
  if (!fs.existsSync(libDir)) {
403
411
  fs.mkdirSync(libDir, { recursive: true });
404
412
  }
@@ -406,6 +414,8 @@ function runDevToolsInstaller() {
406
414
  console.log(" ✓ Created src/lib/brand-system.ts");
407
415
  fs.copyFileSync(sourceBrandContext, path.join(libDir, "brand-context.tsx"));
408
416
  console.log(" ✓ Created src/lib/brand-context.tsx");
417
+ fs.copyFileSync(sourceUtils, path.join(libDir, "utils.ts"));
418
+ console.log(" ✓ Created src/lib/utils.ts");
409
419
  // 2. Install DevTools components
410
420
  if (!fs.existsSync(devToolsDir)) {
411
421
  fs.mkdirSync(devToolsDir, { recursive: true });
@@ -573,14 +583,21 @@ function runDevToolsInstaller() {
573
583
  modified = true;
574
584
  }
575
585
  }
576
- // Add component before </body> if not present
586
+ // Add component - try ThemeProvider first, then body
577
587
  if (!layoutContent.includes("<SonanceDevTools")) {
578
- if (layoutContent.includes("</body>")) {
579
- layoutContent = layoutContent.replace(/<\/body>/, ` {process.env.NODE_ENV === 'development' && <SonanceDevTools />}\n </body>`);
588
+ const componentLine = "{process.env.NODE_ENV === 'development' && <SonanceDevTools />}";
589
+ // Priority 1: Inside ThemeProvider (for next-themes compatibility)
590
+ if (layoutContent.includes("</ThemeProvider>")) {
591
+ layoutContent = layoutContent.replace(/<\/ThemeProvider>/, ` ${componentLine}\n </ThemeProvider>`);
592
+ modified = true;
593
+ }
594
+ // Priority 2: Before </body>
595
+ else if (layoutContent.includes("</body>")) {
596
+ layoutContent = layoutContent.replace(/<\/body>/, ` ${componentLine}\n </body>`);
580
597
  modified = true;
581
598
  }
582
599
  else {
583
- manualSteps.push("Could not find </body> tag - add DevTools component manually");
600
+ manualSteps.push("Could not find ThemeProvider or body tag - add DevTools component manually");
584
601
  }
585
602
  }
586
603
  if (modified) {
@@ -713,7 +730,8 @@ function runDevToolsUninstaller() {
713
730
  "src/app/api/sonance-inject-id",
714
731
  "src/app/api/sonance-analyze",
715
732
  "src/lib/brand-system.ts",
716
- "src/lib/brand-context.tsx"
733
+ "src/lib/brand-context.tsx",
734
+ "src/lib/utils.ts"
717
735
  ];
718
736
  for (const item of itemsToDelete) {
719
737
  const fullPath = path.join(targetDir, item);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonance-brand-mcp",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
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",