sonance-brand-mcp 1.3.9 → 1.3.11
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 +78 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -300,17 +300,39 @@ function runDevToolsInstaller() {
|
|
|
300
300
|
console.log(" └─────────────────────────────────────────────────┘");
|
|
301
301
|
console.log("");
|
|
302
302
|
const targetDir = process.cwd();
|
|
303
|
-
//
|
|
304
|
-
const
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
303
|
+
// Detect project structure by checking where layout.tsx actually lives
|
|
304
|
+
const hasRootLayout = fs.existsSync(path.join(targetDir, "app/layout.tsx"));
|
|
305
|
+
const hasSrcLayout = fs.existsSync(path.join(targetDir, "src/app/layout.tsx"));
|
|
306
|
+
let useSrcDir;
|
|
307
|
+
if (hasRootLayout) {
|
|
308
|
+
// Root layout exists - use root structure (even if src/ also exists)
|
|
309
|
+
useSrcDir = false;
|
|
310
|
+
if (hasSrcLayout) {
|
|
311
|
+
console.log(" ⚠️ Found both app/ and src/app/ layouts - using root app/");
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
else if (hasSrcLayout) {
|
|
315
|
+
// Only src layout exists
|
|
316
|
+
useSrcDir = true;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
// No layout found - fall back to directory detection
|
|
320
|
+
useSrcDir = fs.existsSync(path.join(targetDir, "src/app")) ||
|
|
321
|
+
fs.existsSync(path.join(targetDir, "src/components"));
|
|
322
|
+
}
|
|
323
|
+
const baseDir = useSrcDir ? "src" : "";
|
|
324
|
+
console.log(` 📁 Detected structure: ${useSrcDir ? "src/" : "root"}`);
|
|
325
|
+
// Dynamic paths based on detected structure
|
|
326
|
+
const libDir = path.join(targetDir, baseDir, "lib");
|
|
327
|
+
const devToolsDir = path.join(targetDir, baseDir, "components/dev-tools");
|
|
328
|
+
const stylesDir = path.join(targetDir, baseDir, "styles");
|
|
329
|
+
const apiThemeDir = path.join(targetDir, baseDir, "app/api/sonance-theme");
|
|
330
|
+
const apiComponentsDir = path.join(targetDir, baseDir, "app/api/sonance-components");
|
|
331
|
+
const apiSaveLogoDir = path.join(targetDir, baseDir, "app/api/sonance-save-logo");
|
|
332
|
+
const apiAssetsDir = path.join(targetDir, baseDir, "app/api/sonance-assets");
|
|
333
|
+
const apiInjectIdDir = path.join(targetDir, baseDir, "app/api/sonance-inject-id");
|
|
334
|
+
const apiAnalyzeDir = path.join(targetDir, baseDir, "app/api/sonance-analyze");
|
|
335
|
+
const themeDir = path.join(targetDir, baseDir, "theme");
|
|
314
336
|
// Source resolution
|
|
315
337
|
let sourceBrandSystem;
|
|
316
338
|
let sourceBrandContext;
|
|
@@ -406,16 +428,18 @@ function runDevToolsInstaller() {
|
|
|
406
428
|
process.exit(1);
|
|
407
429
|
}
|
|
408
430
|
console.log(" 📂 Installing files...");
|
|
431
|
+
// Path prefix for logging (shows "src/" or "" based on detected structure)
|
|
432
|
+
const pathPrefix = baseDir ? `${baseDir}/` : "";
|
|
409
433
|
// 1. Install lib files (brand-system.ts, brand-context.tsx, utils.ts)
|
|
410
434
|
if (!fs.existsSync(libDir)) {
|
|
411
435
|
fs.mkdirSync(libDir, { recursive: true });
|
|
412
436
|
}
|
|
413
437
|
fs.copyFileSync(sourceBrandSystem, path.join(libDir, "brand-system.ts"));
|
|
414
|
-
console.log(
|
|
438
|
+
console.log(` ✓ Created ${pathPrefix}lib/brand-system.ts`);
|
|
415
439
|
fs.copyFileSync(sourceBrandContext, path.join(libDir, "brand-context.tsx"));
|
|
416
|
-
console.log(
|
|
440
|
+
console.log(` ✓ Created ${pathPrefix}lib/brand-context.tsx`);
|
|
417
441
|
fs.copyFileSync(sourceUtils, path.join(libDir, "utils.ts"));
|
|
418
|
-
console.log(
|
|
442
|
+
console.log(` ✓ Created ${pathPrefix}lib/utils.ts`);
|
|
419
443
|
// 2. Install DevTools components
|
|
420
444
|
if (!fs.existsSync(devToolsDir)) {
|
|
421
445
|
fs.mkdirSync(devToolsDir, { recursive: true });
|
|
@@ -427,49 +451,49 @@ function runDevToolsInstaller() {
|
|
|
427
451
|
fs.copyFileSync(path.join(sourceDevTools, entry.name), path.join(devToolsDir, entry.name));
|
|
428
452
|
}
|
|
429
453
|
}
|
|
430
|
-
console.log(
|
|
454
|
+
console.log(` ✓ Created ${pathPrefix}components/dev-tools/`);
|
|
431
455
|
// 3. Install API route for saving theme
|
|
432
456
|
if (!fs.existsSync(apiThemeDir)) {
|
|
433
457
|
fs.mkdirSync(apiThemeDir, { recursive: true });
|
|
434
458
|
}
|
|
435
459
|
fs.copyFileSync(sourceApiTheme, path.join(apiThemeDir, "route.ts"));
|
|
436
|
-
console.log(
|
|
460
|
+
console.log(` ✓ Created ${pathPrefix}app/api/sonance-theme/route.ts`);
|
|
437
461
|
// 4. Install API route for component detection
|
|
438
462
|
if (!fs.existsSync(apiComponentsDir)) {
|
|
439
463
|
fs.mkdirSync(apiComponentsDir, { recursive: true });
|
|
440
464
|
}
|
|
441
465
|
fs.copyFileSync(sourceApiComponents, path.join(apiComponentsDir, "route.ts"));
|
|
442
|
-
console.log(
|
|
466
|
+
console.log(` ✓ Created ${pathPrefix}app/api/sonance-components/route.ts`);
|
|
443
467
|
// 5. Install API route for saving logo configuration
|
|
444
468
|
if (!fs.existsSync(apiSaveLogoDir)) {
|
|
445
469
|
fs.mkdirSync(apiSaveLogoDir, { recursive: true });
|
|
446
470
|
}
|
|
447
471
|
fs.copyFileSync(sourceApiSaveLogo, path.join(apiSaveLogoDir, "route.ts"));
|
|
448
|
-
console.log(
|
|
472
|
+
console.log(` ✓ Created ${pathPrefix}app/api/sonance-save-logo/route.ts`);
|
|
449
473
|
// 7. Install API route for listing logo assets
|
|
450
474
|
if (!fs.existsSync(apiAssetsDir)) {
|
|
451
475
|
fs.mkdirSync(apiAssetsDir, { recursive: true });
|
|
452
476
|
}
|
|
453
477
|
fs.copyFileSync(sourceApiAssets, path.join(apiAssetsDir, "route.ts"));
|
|
454
|
-
console.log(
|
|
478
|
+
console.log(` ✓ Created ${pathPrefix}app/api/sonance-assets/route.ts`);
|
|
455
479
|
// 8. Install API route for auto-fixing logo IDs
|
|
456
480
|
if (!fs.existsSync(apiInjectIdDir)) {
|
|
457
481
|
fs.mkdirSync(apiInjectIdDir, { recursive: true });
|
|
458
482
|
}
|
|
459
483
|
fs.copyFileSync(sourceApiInjectId, path.join(apiInjectIdDir, "route.ts"));
|
|
460
|
-
console.log(
|
|
484
|
+
console.log(` ✓ Created ${pathPrefix}app/api/sonance-inject-id/route.ts`);
|
|
461
485
|
// 9. Install API route for project analysis
|
|
462
486
|
if (!fs.existsSync(apiAnalyzeDir)) {
|
|
463
487
|
fs.mkdirSync(apiAnalyzeDir, { recursive: true });
|
|
464
488
|
}
|
|
465
489
|
fs.copyFileSync(sourceApiAnalyze, path.join(apiAnalyzeDir, "route.ts"));
|
|
466
|
-
console.log(
|
|
490
|
+
console.log(` ✓ Created ${pathPrefix}app/api/sonance-analyze/route.ts`);
|
|
467
491
|
// 11. Install brand-overrides.css for production logo sizing
|
|
468
492
|
if (!fs.existsSync(stylesDir)) {
|
|
469
493
|
fs.mkdirSync(stylesDir, { recursive: true });
|
|
470
494
|
}
|
|
471
495
|
fs.copyFileSync(sourceBrandOverridesCss, path.join(stylesDir, "brand-overrides.css"));
|
|
472
|
-
console.log(
|
|
496
|
+
console.log(` ✓ Created ${pathPrefix}styles/brand-overrides.css`);
|
|
473
497
|
// 12. Create theme directory with initial files
|
|
474
498
|
if (!fs.existsSync(themeDir)) {
|
|
475
499
|
fs.mkdirSync(themeDir, { recursive: true });
|
|
@@ -495,7 +519,7 @@ function runDevToolsInstaller() {
|
|
|
495
519
|
spacing: "default"
|
|
496
520
|
};
|
|
497
521
|
fs.writeFileSync(path.join(themeDir, "sonance-config.json"), JSON.stringify(initialConfig, null, 2), "utf-8");
|
|
498
|
-
console.log(
|
|
522
|
+
console.log(` ✓ Created ${pathPrefix}theme/ with initial files`);
|
|
499
523
|
}
|
|
500
524
|
// Detect user's file paths
|
|
501
525
|
const globalsCssPaths = [
|
|
@@ -719,19 +743,38 @@ function runDevToolsUninstaller() {
|
|
|
719
743
|
}
|
|
720
744
|
}
|
|
721
745
|
// --- 3. Delete installed directories/files ---
|
|
746
|
+
// Detect project structure by checking where layout.tsx actually lives
|
|
747
|
+
const hasRootLayout = fs.existsSync(path.join(targetDir, "app/layout.tsx"));
|
|
748
|
+
const hasSrcLayout = fs.existsSync(path.join(targetDir, "src/app/layout.tsx"));
|
|
749
|
+
let useSrcDir;
|
|
750
|
+
if (hasRootLayout) {
|
|
751
|
+
// Root layout exists - use root structure (even if src/ also exists)
|
|
752
|
+
useSrcDir = false;
|
|
753
|
+
}
|
|
754
|
+
else if (hasSrcLayout) {
|
|
755
|
+
// Only src layout exists
|
|
756
|
+
useSrcDir = true;
|
|
757
|
+
}
|
|
758
|
+
else {
|
|
759
|
+
// No layout found - fall back to directory detection
|
|
760
|
+
useSrcDir = fs.existsSync(path.join(targetDir, "src/app")) ||
|
|
761
|
+
fs.existsSync(path.join(targetDir, "src/components"));
|
|
762
|
+
}
|
|
763
|
+
const baseDir = useSrcDir ? "src" : "";
|
|
764
|
+
const pathPrefix = baseDir ? `${baseDir}/` : "";
|
|
722
765
|
const itemsToDelete = [
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
766
|
+
`${pathPrefix}components/dev-tools`,
|
|
767
|
+
`${pathPrefix}styles/brand-overrides.css`,
|
|
768
|
+
`${pathPrefix}theme`,
|
|
769
|
+
`${pathPrefix}app/api/sonance-theme`,
|
|
770
|
+
`${pathPrefix}app/api/sonance-components`,
|
|
771
|
+
`${pathPrefix}app/api/sonance-save-logo`,
|
|
772
|
+
`${pathPrefix}app/api/sonance-assets`,
|
|
773
|
+
`${pathPrefix}app/api/sonance-inject-id`,
|
|
774
|
+
`${pathPrefix}app/api/sonance-analyze`,
|
|
775
|
+
`${pathPrefix}lib/brand-system.ts`,
|
|
776
|
+
`${pathPrefix}lib/brand-context.tsx`,
|
|
777
|
+
`${pathPrefix}lib/utils.ts`
|
|
735
778
|
];
|
|
736
779
|
for (const item of itemsToDelete) {
|
|
737
780
|
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.
|
|
3
|
+
"version": "1.3.11",
|
|
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",
|