sonance-brand-mcp 1.3.17 → 1.3.18

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 +44 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -290,6 +290,27 @@ function getRelativeImportPath(fromFile, toFile) {
290
290
  }
291
291
  return relativePath;
292
292
  }
293
+ /**
294
+ * Recursively copy a directory, tracking files and directories for the manifest
295
+ */
296
+ function copyDirRecursive(src, dest, files, dirs, pathPrefix) {
297
+ if (!fs.existsSync(dest)) {
298
+ fs.mkdirSync(dest, { recursive: true });
299
+ }
300
+ const entries = fs.readdirSync(src, { withFileTypes: true });
301
+ for (const entry of entries) {
302
+ const srcPath = path.join(src, entry.name);
303
+ const destPath = path.join(dest, entry.name);
304
+ if (entry.isDirectory()) {
305
+ dirs.push(`${pathPrefix}${entry.name}`);
306
+ copyDirRecursive(srcPath, destPath, files, dirs, `${pathPrefix}${entry.name}/`);
307
+ }
308
+ else {
309
+ fs.copyFileSync(srcPath, destPath);
310
+ files.push(`${pathPrefix}${entry.name}`);
311
+ }
312
+ }
313
+ }
293
314
  /**
294
315
  * Run the installer for DevTools Plugin (copies files to user project)
295
316
  */
@@ -456,19 +477,9 @@ function runDevToolsInstaller() {
456
477
  else {
457
478
  console.log(` ⏭️ Skipped ${pathPrefix}lib/utils.ts (already exists)`);
458
479
  }
459
- // 2. Install DevTools components
460
- if (!fs.existsSync(devToolsDir)) {
461
- fs.mkdirSync(devToolsDir, { recursive: true });
462
- }
480
+ // 2. Install DevTools components (recursively, including subdirectories)
463
481
  createdDirectories.push(`${pathPrefix}components/dev-tools`);
464
- // Copy directory contents
465
- const entries = fs.readdirSync(sourceDevTools, { withFileTypes: true });
466
- for (const entry of entries) {
467
- if (entry.isFile()) {
468
- fs.copyFileSync(path.join(sourceDevTools, entry.name), path.join(devToolsDir, entry.name));
469
- createdFiles.push(`${pathPrefix}components/dev-tools/${entry.name}`);
470
- }
471
- }
482
+ copyDirRecursive(sourceDevTools, devToolsDir, createdFiles, createdDirectories, `${pathPrefix}components/dev-tools/`);
472
483
  console.log(` ✓ Created ${pathPrefix}components/dev-tools/`);
473
484
  // 3. Install API route for saving theme
474
485
  if (!fs.existsSync(apiThemeDir)) {
@@ -1025,24 +1036,38 @@ function runDevToolsSync(fullSync = false) {
1025
1036
  { src: sourceBrandSystem, dest: path.join(targetDir, baseDir, "lib/brand-system.ts"), name: "brand-system.ts" },
1026
1037
  { src: sourceBrandContext, dest: path.join(targetDir, baseDir, "lib/brand-context.tsx"), name: "brand-context.tsx" },
1027
1038
  ];
1028
- // Sync DevTools directory
1039
+ // Sync DevTools directory (recursively, including subdirectories)
1029
1040
  const devToolsDestDir = path.join(targetDir, baseDir, "components/dev-tools");
1030
- if (fs.existsSync(sourceDevTools) && fs.existsSync(devToolsDestDir)) {
1031
- const entries = fs.readdirSync(sourceDevTools, { withFileTypes: true });
1041
+ function syncDirRecursive(srcDir, destDir, relativePath) {
1042
+ if (!fs.existsSync(srcDir))
1043
+ return;
1044
+ if (!fs.existsSync(destDir)) {
1045
+ fs.mkdirSync(destDir, { recursive: true });
1046
+ }
1047
+ const entries = fs.readdirSync(srcDir, { withFileTypes: true });
1032
1048
  for (const entry of entries) {
1033
- if (entry.isFile()) {
1049
+ const srcPath = path.join(srcDir, entry.name);
1050
+ const destPath = path.join(destDir, entry.name);
1051
+ const entryRelPath = relativePath ? `${relativePath}/${entry.name}` : entry.name;
1052
+ if (entry.isDirectory()) {
1053
+ syncDirRecursive(srcPath, destPath, entryRelPath);
1054
+ }
1055
+ else {
1034
1056
  try {
1035
- fs.copyFileSync(path.join(sourceDevTools, entry.name), path.join(devToolsDestDir, entry.name));
1036
- console.log(` ✓ Synced components/dev-tools/${entry.name}`);
1057
+ fs.copyFileSync(srcPath, destPath);
1058
+ console.log(` ✓ Synced components/dev-tools/${entryRelPath}`);
1037
1059
  syncedCount++;
1038
1060
  }
1039
1061
  catch (err) {
1040
- console.log(` ✗ Failed: components/dev-tools/${entry.name}`);
1062
+ console.log(` ✗ Failed: components/dev-tools/${entryRelPath}`);
1041
1063
  errorCount++;
1042
1064
  }
1043
1065
  }
1044
1066
  }
1045
1067
  }
1068
+ if (fs.existsSync(sourceDevTools)) {
1069
+ syncDirRecursive(sourceDevTools, devToolsDestDir, "");
1070
+ }
1046
1071
  // Sync core lib files
1047
1072
  for (const file of coreFiles) {
1048
1073
  if (fs.existsSync(file.src)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonance-brand-mcp",
3
- "version": "1.3.17",
3
+ "version": "1.3.18",
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",