@forgespace/branding-mcp 0.4.0
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/.env.example +3 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +22 -0
- package/.github/workflows/ci.yml +73 -0
- package/.github/workflows/release-automation.yml +56 -0
- package/.github/workflows/security-scan.yml +37 -0
- package/.gitleaks.toml +14 -0
- package/.prettierrc.json +10 -0
- package/CHANGELOG.md +66 -0
- package/CONTRIBUTING.md +203 -0
- package/LICENSE +21 -0
- package/README.md +105 -0
- package/data/README.md +13 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/branding-core/ai/brand-interpreter.d.ts +5 -0
- package/dist/lib/branding-core/ai/brand-interpreter.d.ts.map +1 -0
- package/dist/lib/branding-core/ai/brand-interpreter.js +16 -0
- package/dist/lib/branding-core/ai/brand-interpreter.js.map +1 -0
- package/dist/lib/branding-core/ai/claude-interpreter.d.ts +5 -0
- package/dist/lib/branding-core/ai/claude-interpreter.d.ts.map +1 -0
- package/dist/lib/branding-core/ai/claude-interpreter.js +55 -0
- package/dist/lib/branding-core/ai/claude-interpreter.js.map +1 -0
- package/dist/lib/branding-core/ai/intent-applier.d.ts +4 -0
- package/dist/lib/branding-core/ai/intent-applier.d.ts.map +1 -0
- package/dist/lib/branding-core/ai/intent-applier.js +29 -0
- package/dist/lib/branding-core/ai/intent-applier.js.map +1 -0
- package/dist/lib/branding-core/ai/keyword-interpreter.d.ts +4 -0
- package/dist/lib/branding-core/ai/keyword-interpreter.d.ts.map +1 -0
- package/dist/lib/branding-core/ai/keyword-interpreter.js +85 -0
- package/dist/lib/branding-core/ai/keyword-interpreter.js.map +1 -0
- package/dist/lib/branding-core/ai/prompts.d.ts +4 -0
- package/dist/lib/branding-core/ai/prompts.d.ts.map +1 -0
- package/dist/lib/branding-core/ai/prompts.js +79 -0
- package/dist/lib/branding-core/ai/prompts.js.map +1 -0
- package/dist/lib/branding-core/ai/types.d.ts +27 -0
- package/dist/lib/branding-core/ai/types.d.ts.map +1 -0
- package/dist/lib/branding-core/ai/types.js +2 -0
- package/dist/lib/branding-core/ai/types.js.map +1 -0
- package/dist/lib/branding-core/documents/html-generator.d.ts +3 -0
- package/dist/lib/branding-core/documents/html-generator.d.ts.map +1 -0
- package/dist/lib/branding-core/documents/html-generator.js +31 -0
- package/dist/lib/branding-core/documents/html-generator.js.map +1 -0
- package/dist/lib/branding-core/documents/pdf-generator.d.ts +3 -0
- package/dist/lib/branding-core/documents/pdf-generator.d.ts.map +1 -0
- package/dist/lib/branding-core/documents/pdf-generator.js +20 -0
- package/dist/lib/branding-core/documents/pdf-generator.js.map +1 -0
- package/dist/lib/branding-core/exporters/css-variables.d.ts +3 -0
- package/dist/lib/branding-core/exporters/css-variables.d.ts.map +1 -0
- package/dist/lib/branding-core/exporters/css-variables.js +62 -0
- package/dist/lib/branding-core/exporters/css-variables.js.map +1 -0
- package/dist/lib/branding-core/exporters/design-tokens.d.ts +3 -0
- package/dist/lib/branding-core/exporters/design-tokens.d.ts.map +1 -0
- package/dist/lib/branding-core/exporters/design-tokens.js +75 -0
- package/dist/lib/branding-core/exporters/design-tokens.js.map +1 -0
- package/dist/lib/branding-core/exporters/figma-tokens.d.ts +9 -0
- package/dist/lib/branding-core/exporters/figma-tokens.d.ts.map +1 -0
- package/dist/lib/branding-core/exporters/figma-tokens.js +69 -0
- package/dist/lib/branding-core/exporters/figma-tokens.js.map +1 -0
- package/dist/lib/branding-core/exporters/react-theme.d.ts +3 -0
- package/dist/lib/branding-core/exporters/react-theme.d.ts.map +1 -0
- package/dist/lib/branding-core/exporters/react-theme.js +61 -0
- package/dist/lib/branding-core/exporters/react-theme.js.map +1 -0
- package/dist/lib/branding-core/exporters/sass-variables.d.ts +3 -0
- package/dist/lib/branding-core/exporters/sass-variables.d.ts.map +1 -0
- package/dist/lib/branding-core/exporters/sass-variables.js +65 -0
- package/dist/lib/branding-core/exporters/sass-variables.js.map +1 -0
- package/dist/lib/branding-core/exporters/tailwind-preset.d.ts +3 -0
- package/dist/lib/branding-core/exporters/tailwind-preset.d.ts.map +1 -0
- package/dist/lib/branding-core/exporters/tailwind-preset.js +55 -0
- package/dist/lib/branding-core/exporters/tailwind-preset.js.map +1 -0
- package/dist/lib/branding-core/generators/border-system.d.ts +3 -0
- package/dist/lib/branding-core/generators/border-system.d.ts.map +1 -0
- package/dist/lib/branding-core/generators/border-system.js +37 -0
- package/dist/lib/branding-core/generators/border-system.js.map +1 -0
- package/dist/lib/branding-core/generators/color-palette.d.ts +7 -0
- package/dist/lib/branding-core/generators/color-palette.d.ts.map +1 -0
- package/dist/lib/branding-core/generators/color-palette.js +117 -0
- package/dist/lib/branding-core/generators/color-palette.js.map +1 -0
- package/dist/lib/branding-core/generators/favicon-generator.d.ts +3 -0
- package/dist/lib/branding-core/generators/favicon-generator.d.ts.map +1 -0
- package/dist/lib/branding-core/generators/favicon-generator.js +23 -0
- package/dist/lib/branding-core/generators/favicon-generator.js.map +1 -0
- package/dist/lib/branding-core/generators/gradient-system.d.ts +3 -0
- package/dist/lib/branding-core/generators/gradient-system.d.ts.map +1 -0
- package/dist/lib/branding-core/generators/gradient-system.js +74 -0
- package/dist/lib/branding-core/generators/gradient-system.js.map +1 -0
- package/dist/lib/branding-core/generators/logo-generator.d.ts +4 -0
- package/dist/lib/branding-core/generators/logo-generator.d.ts.map +1 -0
- package/dist/lib/branding-core/generators/logo-generator.js +130 -0
- package/dist/lib/branding-core/generators/logo-generator.js.map +1 -0
- package/dist/lib/branding-core/generators/motion-system.d.ts +3 -0
- package/dist/lib/branding-core/generators/motion-system.d.ts.map +1 -0
- package/dist/lib/branding-core/generators/motion-system.js +91 -0
- package/dist/lib/branding-core/generators/motion-system.js.map +1 -0
- package/dist/lib/branding-core/generators/og-image-generator.d.ts +3 -0
- package/dist/lib/branding-core/generators/og-image-generator.d.ts.map +1 -0
- package/dist/lib/branding-core/generators/og-image-generator.js +72 -0
- package/dist/lib/branding-core/generators/og-image-generator.js.map +1 -0
- package/dist/lib/branding-core/generators/shadow-system.d.ts +3 -0
- package/dist/lib/branding-core/generators/shadow-system.d.ts.map +1 -0
- package/dist/lib/branding-core/generators/shadow-system.js +44 -0
- package/dist/lib/branding-core/generators/shadow-system.js.map +1 -0
- package/dist/lib/branding-core/generators/spacing-scale.d.ts +3 -0
- package/dist/lib/branding-core/generators/spacing-scale.d.ts.map +1 -0
- package/dist/lib/branding-core/generators/spacing-scale.js +27 -0
- package/dist/lib/branding-core/generators/spacing-scale.js.map +1 -0
- package/dist/lib/branding-core/generators/typography-system.d.ts +3 -0
- package/dist/lib/branding-core/generators/typography-system.d.ts.map +1 -0
- package/dist/lib/branding-core/generators/typography-system.js +121 -0
- package/dist/lib/branding-core/generators/typography-system.js.map +1 -0
- package/dist/lib/branding-core/index.d.ts +24 -0
- package/dist/lib/branding-core/index.d.ts.map +1 -0
- package/dist/lib/branding-core/index.js +22 -0
- package/dist/lib/branding-core/index.js.map +1 -0
- package/dist/lib/branding-core/validators/brand-consistency.d.ts +3 -0
- package/dist/lib/branding-core/validators/brand-consistency.d.ts.map +1 -0
- package/dist/lib/branding-core/validators/brand-consistency.js +70 -0
- package/dist/lib/branding-core/validators/brand-consistency.js.map +1 -0
- package/dist/lib/branding-core/validators/contrast-checker.d.ts +3 -0
- package/dist/lib/branding-core/validators/contrast-checker.d.ts.map +1 -0
- package/dist/lib/branding-core/validators/contrast-checker.js +33 -0
- package/dist/lib/branding-core/validators/contrast-checker.js.map +1 -0
- package/dist/lib/branding-core/validators/token-schema.d.ts +10 -0
- package/dist/lib/branding-core/validators/token-schema.d.ts.map +1 -0
- package/dist/lib/branding-core/validators/token-schema.js +43 -0
- package/dist/lib/branding-core/validators/token-schema.js.map +1 -0
- package/dist/lib/config.d.ts +7 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +8 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/logger.d.ts +3 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +10 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/types.d.ts +208 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/resources/brand-knowledge.d.ts +3 -0
- package/dist/resources/brand-knowledge.d.ts.map +1 -0
- package/dist/resources/brand-knowledge.js +53 -0
- package/dist/resources/brand-knowledge.js.map +1 -0
- package/dist/resources/brand-templates.d.ts +3 -0
- package/dist/resources/brand-templates.d.ts.map +1 -0
- package/dist/resources/brand-templates.js +68 -0
- package/dist/resources/brand-templates.js.map +1 -0
- package/dist/tools/create-brand-guidelines.d.ts +3 -0
- package/dist/tools/create-brand-guidelines.d.ts.map +1 -0
- package/dist/tools/create-brand-guidelines.js +85 -0
- package/dist/tools/create-brand-guidelines.js.map +1 -0
- package/dist/tools/export-design-tokens.d.ts +3 -0
- package/dist/tools/export-design-tokens.d.ts.map +1 -0
- package/dist/tools/export-design-tokens.js +37 -0
- package/dist/tools/export-design-tokens.js.map +1 -0
- package/dist/tools/generate-brand-assets.d.ts +3 -0
- package/dist/tools/generate-brand-assets.d.ts.map +1 -0
- package/dist/tools/generate-brand-assets.js +37 -0
- package/dist/tools/generate-brand-assets.js.map +1 -0
- package/dist/tools/generate-brand-identity.d.ts +3 -0
- package/dist/tools/generate-brand-identity.d.ts.map +1 -0
- package/dist/tools/generate-brand-identity.js +73 -0
- package/dist/tools/generate-brand-identity.js.map +1 -0
- package/dist/tools/generate-color-palette.d.ts +3 -0
- package/dist/tools/generate-color-palette.d.ts.map +1 -0
- package/dist/tools/generate-color-palette.js +33 -0
- package/dist/tools/generate-color-palette.js.map +1 -0
- package/dist/tools/generate-typography-system.d.ts +3 -0
- package/dist/tools/generate-typography-system.d.ts.map +1 -0
- package/dist/tools/generate-typography-system.js +28 -0
- package/dist/tools/generate-typography-system.js.map +1 -0
- package/dist/tools/refine-brand-element.d.ts +3 -0
- package/dist/tools/refine-brand-element.d.ts.map +1 -0
- package/dist/tools/refine-brand-element.js +41 -0
- package/dist/tools/refine-brand-element.js.map +1 -0
- package/dist/tools/validate-brand-consistency.d.ts +3 -0
- package/dist/tools/validate-brand-consistency.d.ts.map +1 -0
- package/dist/tools/validate-brand-consistency.js +25 -0
- package/dist/tools/validate-brand-consistency.js.map +1 -0
- package/docs/API.md +110 -0
- package/docs/DATA_SOURCES.md +69 -0
- package/docs/INTEGRATION.md +58 -0
- package/eslint.config.js +52 -0
- package/jest.config.js +40 -0
- package/package.json +78 -0
- package/src/__tests__/integration/brand-generation.test.ts +84 -0
- package/src/__tests__/integration/mcp-server.test.ts +18 -0
- package/src/__tests__/unit/ai-interpreter.test.ts +172 -0
- package/src/__tests__/unit/border-system.test.ts +77 -0
- package/src/__tests__/unit/color-palette.test.ts +161 -0
- package/src/__tests__/unit/contrast-checker.test.ts +124 -0
- package/src/__tests__/unit/design-tokens.test.ts +184 -0
- package/src/__tests__/unit/favicon-generator.test.ts +80 -0
- package/src/__tests__/unit/gradient-system.test.ts +122 -0
- package/src/__tests__/unit/logo-generator.test.ts +146 -0
- package/src/__tests__/unit/motion-system.test.ts +91 -0
- package/src/__tests__/unit/og-image-generator.test.ts +115 -0
- package/src/__tests__/unit/shadow-system.test.ts +63 -0
- package/src/__tests__/unit/spacing-scale.test.ts +60 -0
- package/src/__tests__/unit/typography-system.test.ts +71 -0
- package/src/index.ts +59 -0
- package/src/lib/branding-core/ai/brand-interpreter.ts +30 -0
- package/src/lib/branding-core/ai/claude-interpreter.ts +76 -0
- package/src/lib/branding-core/ai/intent-applier.ts +59 -0
- package/src/lib/branding-core/ai/keyword-interpreter.ts +95 -0
- package/src/lib/branding-core/ai/prompts.ts +93 -0
- package/src/lib/branding-core/ai/types.ts +36 -0
- package/src/lib/branding-core/documents/html-generator.ts +32 -0
- package/src/lib/branding-core/documents/pdf-generator.ts +21 -0
- package/src/lib/branding-core/exporters/css-variables.ts +71 -0
- package/src/lib/branding-core/exporters/design-tokens.ts +86 -0
- package/src/lib/branding-core/exporters/figma-tokens.ts +87 -0
- package/src/lib/branding-core/exporters/react-theme.ts +69 -0
- package/src/lib/branding-core/exporters/sass-variables.ts +74 -0
- package/src/lib/branding-core/exporters/tailwind-preset.ts +67 -0
- package/src/lib/branding-core/generators/border-system.ts +41 -0
- package/src/lib/branding-core/generators/color-palette.ts +147 -0
- package/src/lib/branding-core/generators/favicon-generator.ts +33 -0
- package/src/lib/branding-core/generators/gradient-system.ts +120 -0
- package/src/lib/branding-core/generators/logo-generator.ts +152 -0
- package/src/lib/branding-core/generators/motion-system.ts +98 -0
- package/src/lib/branding-core/generators/og-image-generator.ts +97 -0
- package/src/lib/branding-core/generators/shadow-system.ts +66 -0
- package/src/lib/branding-core/generators/spacing-scale.ts +29 -0
- package/src/lib/branding-core/generators/typography-system.ts +128 -0
- package/src/lib/branding-core/index.ts +28 -0
- package/src/lib/branding-core/validators/brand-consistency.ts +79 -0
- package/src/lib/branding-core/validators/contrast-checker.ts +37 -0
- package/src/lib/branding-core/validators/token-schema.ts +50 -0
- package/src/lib/config.ts +13 -0
- package/src/lib/logger.ts +12 -0
- package/src/lib/types.ts +236 -0
- package/src/resources/brand-knowledge.ts +60 -0
- package/src/resources/brand-templates.ts +70 -0
- package/src/tools/create-brand-guidelines.ts +94 -0
- package/src/tools/export-design-tokens.ts +52 -0
- package/src/tools/generate-brand-assets.ts +48 -0
- package/src/tools/generate-brand-identity.ts +115 -0
- package/src/tools/generate-color-palette.ts +43 -0
- package/src/tools/generate-typography-system.ts +42 -0
- package/src/tools/refine-brand-element.ts +65 -0
- package/src/tools/validate-brand-consistency.ts +32 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refine-brand-element.js","sourceRoot":"","sources":["../../src/tools/refine-brand-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAG/E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,UAAU,0BAA0B,CAAC,MAAiB;IAC1D,MAAM,CAAC,IAAI,CACT,sBAAsB,EACtB,+JAA+J,EAC/J;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;QACrD,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;QAClF,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,QAAQ,CACP,wHAAwH,CACzH;QACH,QAAQ,EAAE,CAAC;aACR,IAAI,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;aAC/B,QAAQ,EAAE;aACV,QAAQ,CACP,sFAAsF,CACvF;KACJ,EACD,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC/C,IAAI,CAAC;YACH,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,wBAAwB,CAAC,CAAC;YACvE,MAAM,SAAS,GAAkB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACnD,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;YAE5B,MAAM,MAAM,GAAG,MAAM,iBAAiB,CACpC,QAAQ,EACR,OAAO,EACP,SAAS,EACR,QAAgC,IAAI,MAAM,EAC3C,EAAE,eAAe,EAAE,MAAM,CAAC,eAAe,EAAE,CAC5C,CAAC;YAEF,MAAM,OAAO,GAAG,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YAE/C,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB,EAAE,GAAG,OAAO,EAAE,eAAe,EAAE,EAAE,QAAQ,EAAE,QAAQ,IAAI,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,EAC5E,IAAI,EACJ,CAAC,CACF;qBACF;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B,OAAO,EAAE,EAAE,CAAC;gBACvE,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-brand-consistency.d.ts","sourceRoot":"","sources":["../../src/tools/validate-brand-consistency.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKzE,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAyBxE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { validateBrandConsistency } from '../lib/branding-core/index.js';
|
|
3
|
+
import { logger } from '../lib/logger.js';
|
|
4
|
+
export function registerValidateBrandConsistency(server) {
|
|
5
|
+
server.tool('validate_brand_consistency', 'Validate a brand identity for completeness, WCAG contrast compliance, and typography best practices. Returns a score (0-100) and actionable issues.', {
|
|
6
|
+
brand: z.string().describe('Full BrandIdentity JSON to validate'),
|
|
7
|
+
}, async ({ brand }) => {
|
|
8
|
+
try {
|
|
9
|
+
logger.info('Validating brand consistency');
|
|
10
|
+
const brandData = JSON.parse(brand);
|
|
11
|
+
const result = validateBrandConsistency(brandData);
|
|
12
|
+
return {
|
|
13
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
18
|
+
return {
|
|
19
|
+
content: [{ type: 'text', text: `Error validating brand: ${message}` }],
|
|
20
|
+
isError: true,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=validate-brand-consistency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-brand-consistency.js","sourceRoot":"","sources":["../../src/tools/validate-brand-consistency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,UAAU,gCAAgC,CAAC,MAAiB;IAChE,MAAM,CAAC,IAAI,CACT,4BAA4B,EAC5B,qJAAqJ,EACrJ;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;KAClE,EACD,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QAClB,IAAI,CAAC;YACH,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;YAC5C,MAAM,SAAS,GAAkB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACnD,MAAM,MAAM,GAAG,wBAAwB,CAAC,SAAS,CAAC,CAAC;YAEnD,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aACnE,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B,OAAO,EAAE,EAAE,CAAC;gBACvE,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/docs/API.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# MCP Tool API Reference
|
|
2
|
+
|
|
3
|
+
## generate_brand_identity
|
|
4
|
+
|
|
5
|
+
Generate a complete brand identity from minimal input.
|
|
6
|
+
|
|
7
|
+
**Parameters:**
|
|
8
|
+
| Name | Type | Required | Description |
|
|
9
|
+
|------|------|----------|-------------|
|
|
10
|
+
| brandName | string | yes | Brand name (1-100 chars) |
|
|
11
|
+
| industry | string | yes | Industry sector |
|
|
12
|
+
| style | BrandStyle | yes | Visual direction |
|
|
13
|
+
| tagline | string | no | Brand tagline |
|
|
14
|
+
| baseColor | hex string | no | Base color preference |
|
|
15
|
+
| harmony | ColorHarmony | no | Color harmony type |
|
|
16
|
+
| theme | ColorTheme | no | Light/dark/both |
|
|
17
|
+
| headingCategory | FontCategory | no | Heading font category |
|
|
18
|
+
| bodyCategory | FontCategory | no | Body font category |
|
|
19
|
+
| scaleRatio | TypeScaleRatio | no | Typography scale ratio |
|
|
20
|
+
|
|
21
|
+
**Returns:** Complete `BrandIdentity` JSON with colors, typography, spacing, and logo.
|
|
22
|
+
|
|
23
|
+
## generate_color_palette
|
|
24
|
+
|
|
25
|
+
Generate a color palette from a base color and harmony.
|
|
26
|
+
|
|
27
|
+
**Parameters:**
|
|
28
|
+
| Name | Type | Required | Description |
|
|
29
|
+
|------|------|----------|-------------|
|
|
30
|
+
| baseColor | hex string | no | Base hex color (#RRGGBB) |
|
|
31
|
+
| harmony | ColorHarmony | no | Harmony type |
|
|
32
|
+
| theme | ColorTheme | no | Neutral scale direction |
|
|
33
|
+
|
|
34
|
+
**Returns:** `ColorPalette` with primary, secondary, accent, neutrals, semantic colors, and WCAG contrast data.
|
|
35
|
+
|
|
36
|
+
## generate_typography_system
|
|
37
|
+
|
|
38
|
+
Generate a typography system with font pairing.
|
|
39
|
+
|
|
40
|
+
**Parameters:**
|
|
41
|
+
| Name | Type | Required | Description |
|
|
42
|
+
|------|------|----------|-------------|
|
|
43
|
+
| headingCategory | FontCategory | no | Heading font type |
|
|
44
|
+
| bodyCategory | FontCategory | no | Body font type |
|
|
45
|
+
| scaleRatio | TypeScaleRatio | no | Modular scale ratio |
|
|
46
|
+
| baseSize | number (12-24) | no | Base font size in px |
|
|
47
|
+
|
|
48
|
+
**Returns:** `TypographySystem` with fonts, scale ratio, and type steps.
|
|
49
|
+
|
|
50
|
+
## export_design_tokens
|
|
51
|
+
|
|
52
|
+
Export a brand identity to various design token formats.
|
|
53
|
+
|
|
54
|
+
**Parameters:**
|
|
55
|
+
| Name | Type | Required | Description |
|
|
56
|
+
|------|------|----------|-------------|
|
|
57
|
+
| brand | string (JSON) | yes | Full BrandIdentity JSON |
|
|
58
|
+
| format | ExportFormat | yes | json, css, tailwind, figma, react, sass |
|
|
59
|
+
|
|
60
|
+
**Returns:** Formatted design tokens string.
|
|
61
|
+
|
|
62
|
+
## create_brand_guidelines
|
|
63
|
+
|
|
64
|
+
Generate a brand guidelines document.
|
|
65
|
+
|
|
66
|
+
**Parameters:**
|
|
67
|
+
| Name | Type | Required | Description |
|
|
68
|
+
|------|------|----------|-------------|
|
|
69
|
+
| brand | string (JSON) | yes | Full BrandIdentity JSON |
|
|
70
|
+
| format | BrandDocFormat | no | html (default) or pdf |
|
|
71
|
+
|
|
72
|
+
**Returns:** HTML brand book document.
|
|
73
|
+
|
|
74
|
+
## validate_brand_consistency
|
|
75
|
+
|
|
76
|
+
Check a brand identity for completeness and accessibility compliance.
|
|
77
|
+
|
|
78
|
+
**Parameters:**
|
|
79
|
+
| Name | Type | Required | Description |
|
|
80
|
+
|------|------|----------|-------------|
|
|
81
|
+
| brand | string (JSON) | yes | Full BrandIdentity JSON |
|
|
82
|
+
|
|
83
|
+
**Returns:** `BrandValidationResult` with score (0-100), validity flag, and issues list.
|
|
84
|
+
|
|
85
|
+
## refine_brand_element
|
|
86
|
+
|
|
87
|
+
Iterate on a specific element of an existing brand.
|
|
88
|
+
|
|
89
|
+
**Parameters:**
|
|
90
|
+
| Name | Type | Required | Description |
|
|
91
|
+
|------|------|----------|-------------|
|
|
92
|
+
| brand | string (JSON) | yes | Full BrandIdentity JSON |
|
|
93
|
+
| element | string | yes | colors, typography, or spacing |
|
|
94
|
+
| feedback | string | yes | Natural language refinement instruction |
|
|
95
|
+
|
|
96
|
+
**Returns:** Updated `BrandIdentity` JSON.
|
|
97
|
+
|
|
98
|
+
## Enums
|
|
99
|
+
|
|
100
|
+
**BrandStyle:** minimal, bold, elegant, playful, corporate, tech, organic, retro
|
|
101
|
+
|
|
102
|
+
**ColorHarmony:** complementary, analogous, triadic, split-complementary, tetradic, monochromatic
|
|
103
|
+
|
|
104
|
+
**ColorTheme:** light, dark, both
|
|
105
|
+
|
|
106
|
+
**FontCategory:** serif, sans-serif, monospace, display, handwriting
|
|
107
|
+
|
|
108
|
+
**TypeScaleRatio:** minor-second, major-second, minor-third, major-third, perfect-fourth, augmented-fourth, perfect-fifth, golden-ratio
|
|
109
|
+
|
|
110
|
+
**ExportFormat:** json, css, tailwind, figma, react, sass
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# AI Training Data Sources
|
|
2
|
+
|
|
3
|
+
Curated data sources for enhancing the branding MCP's knowledge base and the broader Forge Space ecosystem.
|
|
4
|
+
|
|
5
|
+
## Color Theory & Design
|
|
6
|
+
|
|
7
|
+
| Source | License | Use Case |
|
|
8
|
+
| -------------------------------- | ---------- | -------------------------------------- |
|
|
9
|
+
| culori (color science library) | MIT | Color space conversions, OKLCH support |
|
|
10
|
+
| Open Color (13 hues x 10 shades) | MIT | Curated color palettes reference |
|
|
11
|
+
| Tailwind CSS default palette | MIT | Industry-standard web color scales |
|
|
12
|
+
| Carbon Design System tokens | Apache 2.0 | Enterprise design token patterns |
|
|
13
|
+
|
|
14
|
+
## Typography
|
|
15
|
+
|
|
16
|
+
| Source | License | Use Case |
|
|
17
|
+
| --------------------------- | ---------- | --------------------------------------- |
|
|
18
|
+
| Google Fonts API | Apache 2.0 | Font metadata, pairing data, popularity |
|
|
19
|
+
| Fontpair.co | Free | Curated font pairing combinations |
|
|
20
|
+
| Type Scale (type-scale.com) | Free | Modular scale visualization reference |
|
|
21
|
+
| Typewolf | Free/Paid | Font usage in the wild, trend data |
|
|
22
|
+
|
|
23
|
+
## Accessibility
|
|
24
|
+
|
|
25
|
+
| Source | License | Use Case |
|
|
26
|
+
| ----------------------- | ------- | ----------------------------------- |
|
|
27
|
+
| WCAG 2.1 as JSON (W3C) | W3C | Structured accessibility guidelines |
|
|
28
|
+
| WCAG as JSON (Tenon.io) | MIT | Machine-readable WCAG criteria |
|
|
29
|
+
| A11Y Project Patterns | MIT | Accessible component patterns |
|
|
30
|
+
| ARIA Practices Guide | W3C | ARIA pattern implementations |
|
|
31
|
+
|
|
32
|
+
## Design Tokens
|
|
33
|
+
|
|
34
|
+
| Source | License | Use Case |
|
|
35
|
+
| ---------------------- | ------------ | ------------------------------ |
|
|
36
|
+
| W3C Design Tokens Spec | W3C | Token format standard |
|
|
37
|
+
| Style Dictionary | Apache 2.0 | Token transformation pipelines |
|
|
38
|
+
| Tokens Studio | MIT (plugin) | Figma-to-code token workflows |
|
|
39
|
+
|
|
40
|
+
## Brand Identity
|
|
41
|
+
|
|
42
|
+
| Source | License | Use Case |
|
|
43
|
+
| -------------- | -------- | ------------------------------ |
|
|
44
|
+
| Brandfetch API | Freemium | Brand asset data for reference |
|
|
45
|
+
| Logo.dev | Freemium | Logo generation patterns |
|
|
46
|
+
| Coolors.co | Free | Color palette inspiration |
|
|
47
|
+
|
|
48
|
+
## Component Libraries (for integration)
|
|
49
|
+
|
|
50
|
+
| Source | License | Use Case |
|
|
51
|
+
| ------------------- | ------- | ------------------------------- |
|
|
52
|
+
| shadcn/ui | MIT | Component styling patterns |
|
|
53
|
+
| Radix UI Primitives | MIT | Accessible primitive components |
|
|
54
|
+
| Headless UI | MIT | Unstyled component patterns |
|
|
55
|
+
|
|
56
|
+
## SEO & Web Standards
|
|
57
|
+
|
|
58
|
+
| Source | License | Use Case |
|
|
59
|
+
| --------------------- | ------------ | ------------------------------------ |
|
|
60
|
+
| Schema.org vocabulary | CC BY-SA 3.0 | Structured data for brand pages |
|
|
61
|
+
| Google Lighthouse | Apache 2.0 | Performance scoring for brand assets |
|
|
62
|
+
| web.dev | Apache 2.0 | Web best practices reference |
|
|
63
|
+
|
|
64
|
+
## Security
|
|
65
|
+
|
|
66
|
+
| Source | License | Use Case |
|
|
67
|
+
| ------------------------ | ------------ | ------------------------------------------- |
|
|
68
|
+
| OWASP Cheat Sheet Series | CC BY-SA 4.0 | Security guidelines for brand asset serving |
|
|
69
|
+
| CSP Reference (MDN) | CC BY-SA 2.5 | Content Security Policy for brand assets |
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Ecosystem Integration Guide
|
|
2
|
+
|
|
3
|
+
## mcp-gateway Registration
|
|
4
|
+
|
|
5
|
+
Register branding-mcp as an upstream server in mcp-gateway:
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"name": "branding",
|
|
10
|
+
"command": "node",
|
|
11
|
+
"args": ["/path/to/branding-mcp/dist/index.js"],
|
|
12
|
+
"port": 8033,
|
|
13
|
+
"tools": [
|
|
14
|
+
"generate_brand_identity",
|
|
15
|
+
"generate_color_palette",
|
|
16
|
+
"generate_typography_system",
|
|
17
|
+
"export_design_tokens",
|
|
18
|
+
"create_brand_guidelines",
|
|
19
|
+
"validate_brand_consistency",
|
|
20
|
+
"refine_brand_element"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## uiforge-mcp Integration
|
|
26
|
+
|
|
27
|
+
The UI generator can consume brand tokens to ensure generated components match the brand:
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
// In uiforge-mcp, pass brandId to component generation
|
|
31
|
+
const component = await generateComponent({
|
|
32
|
+
type: 'button',
|
|
33
|
+
brandId: 'brand_abc123',
|
|
34
|
+
// Brand tokens auto-applied to colors, fonts, spacing
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## uiforge-webapp Routes
|
|
39
|
+
|
|
40
|
+
New frontend routes for brand management:
|
|
41
|
+
|
|
42
|
+
- `/branding` — Brand dashboard
|
|
43
|
+
- `/branding/new` — Create new brand identity
|
|
44
|
+
- `/branding/:id` — View/edit brand
|
|
45
|
+
- `/branding/:id/export` — Export design tokens
|
|
46
|
+
- `/branding/:id/guidelines` — View brand guidelines
|
|
47
|
+
|
|
48
|
+
## Design Token Flow
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
branding-mcp (generate) → export_design_tokens → format selection
|
|
52
|
+
├── json → W3C Design Tokens → Style Dictionary pipeline
|
|
53
|
+
├── css → CSS custom properties → direct import
|
|
54
|
+
├── tailwind → Tailwind preset → tailwind.config.ts
|
|
55
|
+
├── figma → Figma token format → Tokens Studio sync
|
|
56
|
+
├── react → Theme object → ThemeProvider
|
|
57
|
+
└── sass → SCSS variables → @import
|
|
58
|
+
```
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
2
|
+
import tsparser from '@typescript-eslint/parser';
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
{
|
|
6
|
+
ignores: ['dist/', 'node_modules/', 'coverage/', '*.js', '!eslint.config.js'],
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
files: ['src/**/*.ts'],
|
|
10
|
+
ignores: ['src/__tests__/**'],
|
|
11
|
+
languageOptions: {
|
|
12
|
+
parser: tsparser,
|
|
13
|
+
parserOptions: {
|
|
14
|
+
ecmaVersion: 2022,
|
|
15
|
+
sourceType: 'module',
|
|
16
|
+
project: './tsconfig.json',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
plugins: {
|
|
20
|
+
'@typescript-eslint': tseslint,
|
|
21
|
+
},
|
|
22
|
+
rules: {
|
|
23
|
+
'no-console': 'warn',
|
|
24
|
+
eqeqeq: ['error', 'always'],
|
|
25
|
+
'no-unused-vars': 'off',
|
|
26
|
+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
27
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
28
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
29
|
+
'@typescript-eslint/explicit-function-return-type': ['warn', { allowExpressions: true }],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
files: ['src/__tests__/**/*.ts'],
|
|
34
|
+
languageOptions: {
|
|
35
|
+
parser: tsparser,
|
|
36
|
+
parserOptions: {
|
|
37
|
+
ecmaVersion: 2022,
|
|
38
|
+
sourceType: 'module',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
plugins: {
|
|
42
|
+
'@typescript-eslint': tseslint,
|
|
43
|
+
},
|
|
44
|
+
rules: {
|
|
45
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
46
|
+
'@typescript-eslint/no-floating-promises': 'off',
|
|
47
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
48
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
49
|
+
'no-console': 'off',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
];
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** @type {import('jest').Config} */
|
|
2
|
+
export default {
|
|
3
|
+
preset: 'ts-jest/presets/default-esm',
|
|
4
|
+
testEnvironment: 'node',
|
|
5
|
+
testMatch: ['<rootDir>/src/__tests__/**/*.test.ts'],
|
|
6
|
+
testTimeout: 15_000,
|
|
7
|
+
extensionsToTreatAsEsm: ['.ts'],
|
|
8
|
+
moduleNameMapper: {
|
|
9
|
+
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
10
|
+
},
|
|
11
|
+
transform: {
|
|
12
|
+
'^.+\\.ts$': [
|
|
13
|
+
'ts-jest',
|
|
14
|
+
{
|
|
15
|
+
useESM: true,
|
|
16
|
+
tsconfig: 'tsconfig.json',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
coverageDirectory: 'coverage',
|
|
21
|
+
collectCoverageFrom: [
|
|
22
|
+
'src/lib/**/*.ts',
|
|
23
|
+
'!src/lib/config.ts',
|
|
24
|
+
'!src/lib/logger.ts',
|
|
25
|
+
'!src/lib/branding-core/documents/**',
|
|
26
|
+
'!src/lib/branding-core/validators/token-schema.ts',
|
|
27
|
+
'!src/lib/branding-core/ai/claude-interpreter.ts',
|
|
28
|
+
'!src/lib/branding-core/ai/prompts.ts',
|
|
29
|
+
'!src/**/*.d.ts',
|
|
30
|
+
'!src/__tests__/**',
|
|
31
|
+
],
|
|
32
|
+
coverageThreshold: {
|
|
33
|
+
global: {
|
|
34
|
+
branches: 80,
|
|
35
|
+
functions: 80,
|
|
36
|
+
lines: 80,
|
|
37
|
+
statements: 80,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@forgespace/branding-mcp",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "MCP server for AI-powered brand identity generation — color palettes, typography systems, design tokens, and brand guidelines with multi-format export",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"forgespace-branding-mcp": "dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=22.0.0"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"dev": "tsc --watch",
|
|
17
|
+
"start": "node dist/index.js",
|
|
18
|
+
"validate": "npm run lint:check && npm run format:check && npm run test",
|
|
19
|
+
"lint": "eslint . --fix",
|
|
20
|
+
"lint:check": "eslint .",
|
|
21
|
+
"format": "prettier --write .",
|
|
22
|
+
"format:check": "prettier --check .",
|
|
23
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
24
|
+
"test:coverage": "NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
|
25
|
+
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch",
|
|
26
|
+
"typecheck": "tsc --noEmit",
|
|
27
|
+
"pre-commit": "npm run lint && npm run format && npm run test",
|
|
28
|
+
"prepare": "husky"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"mcp",
|
|
32
|
+
"branding",
|
|
33
|
+
"design-tokens",
|
|
34
|
+
"color-palette",
|
|
35
|
+
"typography",
|
|
36
|
+
"brand-identity",
|
|
37
|
+
"ai",
|
|
38
|
+
"forge-space"
|
|
39
|
+
],
|
|
40
|
+
"author": "Forge Space",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/Forge-Space/branding-mcp.git"
|
|
45
|
+
},
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/Forge-Space/branding-mcp/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/Forge-Space/branding-mcp#readme",
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
52
|
+
"culori": "^4.0.1",
|
|
53
|
+
"pdfkit": "^0.16.0",
|
|
54
|
+
"pino": "^10.3.1",
|
|
55
|
+
"satori": "^0.12.1",
|
|
56
|
+
"sharp": "^0.34.5",
|
|
57
|
+
"zod": "^3.24.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/node": "^22.15.0",
|
|
61
|
+
"@types/pdfkit": "^0.13.8",
|
|
62
|
+
"@typescript-eslint/eslint-plugin": "^8.32.0",
|
|
63
|
+
"@typescript-eslint/parser": "^8.32.0",
|
|
64
|
+
"eslint": "^9.0.0",
|
|
65
|
+
"husky": "^9.0.0",
|
|
66
|
+
"jest": "^29.7.0",
|
|
67
|
+
"lint-staged": "^15.0.0",
|
|
68
|
+
"prettier": "^3.0.0",
|
|
69
|
+
"ts-jest": "^29.4.6",
|
|
70
|
+
"typescript": "^5.1.6"
|
|
71
|
+
},
|
|
72
|
+
"lint-staged": {
|
|
73
|
+
"*.ts": [
|
|
74
|
+
"eslint --fix",
|
|
75
|
+
"prettier --write"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {
|
|
2
|
+
generateColorPalette,
|
|
3
|
+
generateTypographySystem,
|
|
4
|
+
generateSpacingScale,
|
|
5
|
+
generateSvgLogo,
|
|
6
|
+
defaultLogoConfig,
|
|
7
|
+
exportDesignTokens,
|
|
8
|
+
exportCssVariables,
|
|
9
|
+
exportTailwindPreset,
|
|
10
|
+
validateBrandConsistency,
|
|
11
|
+
} from '../../lib/branding-core/index.js';
|
|
12
|
+
import type { BrandIdentity } from '../../lib/types.js';
|
|
13
|
+
|
|
14
|
+
describe('brand generation integration', () => {
|
|
15
|
+
let brand: BrandIdentity;
|
|
16
|
+
|
|
17
|
+
beforeAll(() => {
|
|
18
|
+
const colors = generateColorPalette('#6B4CE6', 'complementary');
|
|
19
|
+
const typography = generateTypographySystem('sans-serif', 'serif', 'major-third');
|
|
20
|
+
const spacing = generateSpacingScale();
|
|
21
|
+
const logoConfig = defaultLogoConfig('TestBrand', colors.primary.hex);
|
|
22
|
+
const logo = generateSvgLogo(logoConfig);
|
|
23
|
+
|
|
24
|
+
brand = {
|
|
25
|
+
id: 'brand_test',
|
|
26
|
+
name: 'TestBrand',
|
|
27
|
+
tagline: 'Test tagline',
|
|
28
|
+
industry: 'tech',
|
|
29
|
+
style: 'tech',
|
|
30
|
+
colors,
|
|
31
|
+
typography,
|
|
32
|
+
spacing,
|
|
33
|
+
logo,
|
|
34
|
+
createdAt: new Date().toISOString(),
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('generates a complete brand identity', () => {
|
|
39
|
+
expect(brand.colors.primary.hex).toMatch(/^#[0-9a-f]{6}$/);
|
|
40
|
+
expect(brand.typography.headingFont).toBeTruthy();
|
|
41
|
+
expect(brand.spacing.unit).toBe(4);
|
|
42
|
+
expect(brand.logo?.svg).toContain('<svg');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('exports valid design tokens JSON', () => {
|
|
46
|
+
const tokens = exportDesignTokens(brand);
|
|
47
|
+
expect(tokens.color.primary).toBeDefined();
|
|
48
|
+
expect(tokens.typography['font-heading']).toBeDefined();
|
|
49
|
+
expect(Object.keys(tokens.spacing).length).toBeGreaterThan(0);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('exports valid CSS variables', () => {
|
|
53
|
+
const css = exportCssVariables(brand);
|
|
54
|
+
expect(css).toContain(':root');
|
|
55
|
+
expect(css).toContain('--color-primary');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('exports valid Tailwind preset', () => {
|
|
59
|
+
const preset = exportTailwindPreset(brand);
|
|
60
|
+
expect(preset).toContain('export default');
|
|
61
|
+
expect(preset).toContain('primary');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('validates brand consistency', () => {
|
|
65
|
+
const result = validateBrandConsistency(brand);
|
|
66
|
+
expect(result.score).toBeGreaterThan(0);
|
|
67
|
+
expect(typeof result.valid).toBe('boolean');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('logo SVG contains brand initial', () => {
|
|
71
|
+
expect(brand.logo?.svg).toContain('>T</text>');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('logo SVG contains brand name', () => {
|
|
75
|
+
expect(brand.logo?.svg).toContain('>TestBrand</text>');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('generates logo with background color', () => {
|
|
79
|
+
const config = { ...defaultLogoConfig('BG', '#000'), backgroundColor: '#ffffff' };
|
|
80
|
+
const logo = generateSvgLogo(config);
|
|
81
|
+
expect(logo.svg).toContain('rect');
|
|
82
|
+
expect(logo.svg).toContain('#ffffff');
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
describe('MCP server', () => {
|
|
2
|
+
it('module can be imported without errors', async () => {
|
|
3
|
+
const mod = await import('../../lib/branding-core/index.js');
|
|
4
|
+
expect(mod.generateColorPalette).toBeDefined();
|
|
5
|
+
expect(mod.generateTypographySystem).toBeDefined();
|
|
6
|
+
expect(mod.generateSpacingScale).toBeDefined();
|
|
7
|
+
expect(mod.exportDesignTokens).toBeDefined();
|
|
8
|
+
expect(mod.exportCssVariables).toBeDefined();
|
|
9
|
+
expect(mod.exportTailwindPreset).toBeDefined();
|
|
10
|
+
expect(mod.exportFigmaTokens).toBeDefined();
|
|
11
|
+
expect(mod.exportReactTheme).toBeDefined();
|
|
12
|
+
expect(mod.exportSassVariables).toBeDefined();
|
|
13
|
+
expect(mod.validateBrandConsistency).toBeDefined();
|
|
14
|
+
expect(mod.validateContrast).toBeDefined();
|
|
15
|
+
expect(mod.generateSvgLogo).toBeDefined();
|
|
16
|
+
expect(mod.defaultLogoConfig).toBeDefined();
|
|
17
|
+
});
|
|
18
|
+
});
|