sonance-brand-mcp 1.3.17 → 1.3.19
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.
- package/dist/index.js +59 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import * as fs from "fs";
|
|
|
6
6
|
import * as path from "path";
|
|
7
7
|
import * as os from "os";
|
|
8
8
|
import { fileURLToPath } from "url";
|
|
9
|
+
import { execSync } from "child_process";
|
|
9
10
|
// ============================================
|
|
10
11
|
// INSTALLER (--init flag)
|
|
11
12
|
// ============================================
|
|
@@ -290,6 +291,27 @@ function getRelativeImportPath(fromFile, toFile) {
|
|
|
290
291
|
}
|
|
291
292
|
return relativePath;
|
|
292
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Recursively copy a directory, tracking files and directories for the manifest
|
|
296
|
+
*/
|
|
297
|
+
function copyDirRecursive(src, dest, files, dirs, pathPrefix) {
|
|
298
|
+
if (!fs.existsSync(dest)) {
|
|
299
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
300
|
+
}
|
|
301
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
302
|
+
for (const entry of entries) {
|
|
303
|
+
const srcPath = path.join(src, entry.name);
|
|
304
|
+
const destPath = path.join(dest, entry.name);
|
|
305
|
+
if (entry.isDirectory()) {
|
|
306
|
+
dirs.push(`${pathPrefix}${entry.name}`);
|
|
307
|
+
copyDirRecursive(srcPath, destPath, files, dirs, `${pathPrefix}${entry.name}/`);
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
fs.copyFileSync(srcPath, destPath);
|
|
311
|
+
files.push(`${pathPrefix}${entry.name}`);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
293
315
|
/**
|
|
294
316
|
* Run the installer for DevTools Plugin (copies files to user project)
|
|
295
317
|
*/
|
|
@@ -456,19 +478,9 @@ function runDevToolsInstaller() {
|
|
|
456
478
|
else {
|
|
457
479
|
console.log(` ⏭️ Skipped ${pathPrefix}lib/utils.ts (already exists)`);
|
|
458
480
|
}
|
|
459
|
-
// 2. Install DevTools components
|
|
460
|
-
if (!fs.existsSync(devToolsDir)) {
|
|
461
|
-
fs.mkdirSync(devToolsDir, { recursive: true });
|
|
462
|
-
}
|
|
481
|
+
// 2. Install DevTools components (recursively, including subdirectories)
|
|
463
482
|
createdDirectories.push(`${pathPrefix}components/dev-tools`);
|
|
464
|
-
|
|
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
|
-
}
|
|
483
|
+
copyDirRecursive(sourceDevTools, devToolsDir, createdFiles, createdDirectories, `${pathPrefix}components/dev-tools/`);
|
|
472
484
|
console.log(` ✓ Created ${pathPrefix}components/dev-tools/`);
|
|
473
485
|
// 3. Install API route for saving theme
|
|
474
486
|
if (!fs.existsSync(apiThemeDir)) {
|
|
@@ -710,6 +722,20 @@ function runDevToolsInstaller() {
|
|
|
710
722
|
else {
|
|
711
723
|
manualSteps.push("layout.tsx not found - add to your layout:\n import { SonanceDevTools } from '[path-to]/src/components/dev-tools';\n {process.env.NODE_ENV === 'development' && <SonanceDevTools />}\n (adjust the path based on your layout file location)");
|
|
712
724
|
}
|
|
725
|
+
// --- Install required npm dependencies ---
|
|
726
|
+
console.log("");
|
|
727
|
+
console.log(" 📦 Installing dependencies...");
|
|
728
|
+
try {
|
|
729
|
+
execSync("npm install html2canvas-pro lucide-react", {
|
|
730
|
+
cwd: targetDir,
|
|
731
|
+
stdio: "pipe"
|
|
732
|
+
});
|
|
733
|
+
console.log(" ✓ Installed html2canvas-pro lucide-react");
|
|
734
|
+
}
|
|
735
|
+
catch (err) {
|
|
736
|
+
console.log(" ⚠️ Could not auto-install dependencies. Run manually:");
|
|
737
|
+
console.log(" npm install html2canvas-pro lucide-react");
|
|
738
|
+
}
|
|
713
739
|
// --- Output results ---
|
|
714
740
|
console.log("");
|
|
715
741
|
console.log(" ✅ Sonance DevTools installed successfully!");
|
|
@@ -1025,24 +1051,38 @@ function runDevToolsSync(fullSync = false) {
|
|
|
1025
1051
|
{ src: sourceBrandSystem, dest: path.join(targetDir, baseDir, "lib/brand-system.ts"), name: "brand-system.ts" },
|
|
1026
1052
|
{ src: sourceBrandContext, dest: path.join(targetDir, baseDir, "lib/brand-context.tsx"), name: "brand-context.tsx" },
|
|
1027
1053
|
];
|
|
1028
|
-
// Sync DevTools directory
|
|
1054
|
+
// Sync DevTools directory (recursively, including subdirectories)
|
|
1029
1055
|
const devToolsDestDir = path.join(targetDir, baseDir, "components/dev-tools");
|
|
1030
|
-
|
|
1031
|
-
|
|
1056
|
+
function syncDirRecursive(srcDir, destDir, relativePath) {
|
|
1057
|
+
if (!fs.existsSync(srcDir))
|
|
1058
|
+
return;
|
|
1059
|
+
if (!fs.existsSync(destDir)) {
|
|
1060
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
1061
|
+
}
|
|
1062
|
+
const entries = fs.readdirSync(srcDir, { withFileTypes: true });
|
|
1032
1063
|
for (const entry of entries) {
|
|
1033
|
-
|
|
1064
|
+
const srcPath = path.join(srcDir, entry.name);
|
|
1065
|
+
const destPath = path.join(destDir, entry.name);
|
|
1066
|
+
const entryRelPath = relativePath ? `${relativePath}/${entry.name}` : entry.name;
|
|
1067
|
+
if (entry.isDirectory()) {
|
|
1068
|
+
syncDirRecursive(srcPath, destPath, entryRelPath);
|
|
1069
|
+
}
|
|
1070
|
+
else {
|
|
1034
1071
|
try {
|
|
1035
|
-
fs.copyFileSync(
|
|
1036
|
-
console.log(` ✓ Synced components/dev-tools/${
|
|
1072
|
+
fs.copyFileSync(srcPath, destPath);
|
|
1073
|
+
console.log(` ✓ Synced components/dev-tools/${entryRelPath}`);
|
|
1037
1074
|
syncedCount++;
|
|
1038
1075
|
}
|
|
1039
1076
|
catch (err) {
|
|
1040
|
-
console.log(` ✗ Failed: components/dev-tools/${
|
|
1077
|
+
console.log(` ✗ Failed: components/dev-tools/${entryRelPath}`);
|
|
1041
1078
|
errorCount++;
|
|
1042
1079
|
}
|
|
1043
1080
|
}
|
|
1044
1081
|
}
|
|
1045
1082
|
}
|
|
1083
|
+
if (fs.existsSync(sourceDevTools)) {
|
|
1084
|
+
syncDirRecursive(sourceDevTools, devToolsDestDir, "");
|
|
1085
|
+
}
|
|
1046
1086
|
// Sync core lib files
|
|
1047
1087
|
for (const file of coreFiles) {
|
|
1048
1088
|
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.
|
|
3
|
+
"version": "1.3.19",
|
|
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",
|