@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.
Files changed (244) hide show
  1. package/.env.example +3 -0
  2. package/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  3. package/.github/workflows/ci.yml +73 -0
  4. package/.github/workflows/release-automation.yml +56 -0
  5. package/.github/workflows/security-scan.yml +37 -0
  6. package/.gitleaks.toml +14 -0
  7. package/.prettierrc.json +10 -0
  8. package/CHANGELOG.md +66 -0
  9. package/CONTRIBUTING.md +203 -0
  10. package/LICENSE +21 -0
  11. package/README.md +105 -0
  12. package/data/README.md +13 -0
  13. package/dist/index.d.ts +3 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +49 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/lib/branding-core/ai/brand-interpreter.d.ts +5 -0
  18. package/dist/lib/branding-core/ai/brand-interpreter.d.ts.map +1 -0
  19. package/dist/lib/branding-core/ai/brand-interpreter.js +16 -0
  20. package/dist/lib/branding-core/ai/brand-interpreter.js.map +1 -0
  21. package/dist/lib/branding-core/ai/claude-interpreter.d.ts +5 -0
  22. package/dist/lib/branding-core/ai/claude-interpreter.d.ts.map +1 -0
  23. package/dist/lib/branding-core/ai/claude-interpreter.js +55 -0
  24. package/dist/lib/branding-core/ai/claude-interpreter.js.map +1 -0
  25. package/dist/lib/branding-core/ai/intent-applier.d.ts +4 -0
  26. package/dist/lib/branding-core/ai/intent-applier.d.ts.map +1 -0
  27. package/dist/lib/branding-core/ai/intent-applier.js +29 -0
  28. package/dist/lib/branding-core/ai/intent-applier.js.map +1 -0
  29. package/dist/lib/branding-core/ai/keyword-interpreter.d.ts +4 -0
  30. package/dist/lib/branding-core/ai/keyword-interpreter.d.ts.map +1 -0
  31. package/dist/lib/branding-core/ai/keyword-interpreter.js +85 -0
  32. package/dist/lib/branding-core/ai/keyword-interpreter.js.map +1 -0
  33. package/dist/lib/branding-core/ai/prompts.d.ts +4 -0
  34. package/dist/lib/branding-core/ai/prompts.d.ts.map +1 -0
  35. package/dist/lib/branding-core/ai/prompts.js +79 -0
  36. package/dist/lib/branding-core/ai/prompts.js.map +1 -0
  37. package/dist/lib/branding-core/ai/types.d.ts +27 -0
  38. package/dist/lib/branding-core/ai/types.d.ts.map +1 -0
  39. package/dist/lib/branding-core/ai/types.js +2 -0
  40. package/dist/lib/branding-core/ai/types.js.map +1 -0
  41. package/dist/lib/branding-core/documents/html-generator.d.ts +3 -0
  42. package/dist/lib/branding-core/documents/html-generator.d.ts.map +1 -0
  43. package/dist/lib/branding-core/documents/html-generator.js +31 -0
  44. package/dist/lib/branding-core/documents/html-generator.js.map +1 -0
  45. package/dist/lib/branding-core/documents/pdf-generator.d.ts +3 -0
  46. package/dist/lib/branding-core/documents/pdf-generator.d.ts.map +1 -0
  47. package/dist/lib/branding-core/documents/pdf-generator.js +20 -0
  48. package/dist/lib/branding-core/documents/pdf-generator.js.map +1 -0
  49. package/dist/lib/branding-core/exporters/css-variables.d.ts +3 -0
  50. package/dist/lib/branding-core/exporters/css-variables.d.ts.map +1 -0
  51. package/dist/lib/branding-core/exporters/css-variables.js +62 -0
  52. package/dist/lib/branding-core/exporters/css-variables.js.map +1 -0
  53. package/dist/lib/branding-core/exporters/design-tokens.d.ts +3 -0
  54. package/dist/lib/branding-core/exporters/design-tokens.d.ts.map +1 -0
  55. package/dist/lib/branding-core/exporters/design-tokens.js +75 -0
  56. package/dist/lib/branding-core/exporters/design-tokens.js.map +1 -0
  57. package/dist/lib/branding-core/exporters/figma-tokens.d.ts +9 -0
  58. package/dist/lib/branding-core/exporters/figma-tokens.d.ts.map +1 -0
  59. package/dist/lib/branding-core/exporters/figma-tokens.js +69 -0
  60. package/dist/lib/branding-core/exporters/figma-tokens.js.map +1 -0
  61. package/dist/lib/branding-core/exporters/react-theme.d.ts +3 -0
  62. package/dist/lib/branding-core/exporters/react-theme.d.ts.map +1 -0
  63. package/dist/lib/branding-core/exporters/react-theme.js +61 -0
  64. package/dist/lib/branding-core/exporters/react-theme.js.map +1 -0
  65. package/dist/lib/branding-core/exporters/sass-variables.d.ts +3 -0
  66. package/dist/lib/branding-core/exporters/sass-variables.d.ts.map +1 -0
  67. package/dist/lib/branding-core/exporters/sass-variables.js +65 -0
  68. package/dist/lib/branding-core/exporters/sass-variables.js.map +1 -0
  69. package/dist/lib/branding-core/exporters/tailwind-preset.d.ts +3 -0
  70. package/dist/lib/branding-core/exporters/tailwind-preset.d.ts.map +1 -0
  71. package/dist/lib/branding-core/exporters/tailwind-preset.js +55 -0
  72. package/dist/lib/branding-core/exporters/tailwind-preset.js.map +1 -0
  73. package/dist/lib/branding-core/generators/border-system.d.ts +3 -0
  74. package/dist/lib/branding-core/generators/border-system.d.ts.map +1 -0
  75. package/dist/lib/branding-core/generators/border-system.js +37 -0
  76. package/dist/lib/branding-core/generators/border-system.js.map +1 -0
  77. package/dist/lib/branding-core/generators/color-palette.d.ts +7 -0
  78. package/dist/lib/branding-core/generators/color-palette.d.ts.map +1 -0
  79. package/dist/lib/branding-core/generators/color-palette.js +117 -0
  80. package/dist/lib/branding-core/generators/color-palette.js.map +1 -0
  81. package/dist/lib/branding-core/generators/favicon-generator.d.ts +3 -0
  82. package/dist/lib/branding-core/generators/favicon-generator.d.ts.map +1 -0
  83. package/dist/lib/branding-core/generators/favicon-generator.js +23 -0
  84. package/dist/lib/branding-core/generators/favicon-generator.js.map +1 -0
  85. package/dist/lib/branding-core/generators/gradient-system.d.ts +3 -0
  86. package/dist/lib/branding-core/generators/gradient-system.d.ts.map +1 -0
  87. package/dist/lib/branding-core/generators/gradient-system.js +74 -0
  88. package/dist/lib/branding-core/generators/gradient-system.js.map +1 -0
  89. package/dist/lib/branding-core/generators/logo-generator.d.ts +4 -0
  90. package/dist/lib/branding-core/generators/logo-generator.d.ts.map +1 -0
  91. package/dist/lib/branding-core/generators/logo-generator.js +130 -0
  92. package/dist/lib/branding-core/generators/logo-generator.js.map +1 -0
  93. package/dist/lib/branding-core/generators/motion-system.d.ts +3 -0
  94. package/dist/lib/branding-core/generators/motion-system.d.ts.map +1 -0
  95. package/dist/lib/branding-core/generators/motion-system.js +91 -0
  96. package/dist/lib/branding-core/generators/motion-system.js.map +1 -0
  97. package/dist/lib/branding-core/generators/og-image-generator.d.ts +3 -0
  98. package/dist/lib/branding-core/generators/og-image-generator.d.ts.map +1 -0
  99. package/dist/lib/branding-core/generators/og-image-generator.js +72 -0
  100. package/dist/lib/branding-core/generators/og-image-generator.js.map +1 -0
  101. package/dist/lib/branding-core/generators/shadow-system.d.ts +3 -0
  102. package/dist/lib/branding-core/generators/shadow-system.d.ts.map +1 -0
  103. package/dist/lib/branding-core/generators/shadow-system.js +44 -0
  104. package/dist/lib/branding-core/generators/shadow-system.js.map +1 -0
  105. package/dist/lib/branding-core/generators/spacing-scale.d.ts +3 -0
  106. package/dist/lib/branding-core/generators/spacing-scale.d.ts.map +1 -0
  107. package/dist/lib/branding-core/generators/spacing-scale.js +27 -0
  108. package/dist/lib/branding-core/generators/spacing-scale.js.map +1 -0
  109. package/dist/lib/branding-core/generators/typography-system.d.ts +3 -0
  110. package/dist/lib/branding-core/generators/typography-system.d.ts.map +1 -0
  111. package/dist/lib/branding-core/generators/typography-system.js +121 -0
  112. package/dist/lib/branding-core/generators/typography-system.js.map +1 -0
  113. package/dist/lib/branding-core/index.d.ts +24 -0
  114. package/dist/lib/branding-core/index.d.ts.map +1 -0
  115. package/dist/lib/branding-core/index.js +22 -0
  116. package/dist/lib/branding-core/index.js.map +1 -0
  117. package/dist/lib/branding-core/validators/brand-consistency.d.ts +3 -0
  118. package/dist/lib/branding-core/validators/brand-consistency.d.ts.map +1 -0
  119. package/dist/lib/branding-core/validators/brand-consistency.js +70 -0
  120. package/dist/lib/branding-core/validators/brand-consistency.js.map +1 -0
  121. package/dist/lib/branding-core/validators/contrast-checker.d.ts +3 -0
  122. package/dist/lib/branding-core/validators/contrast-checker.d.ts.map +1 -0
  123. package/dist/lib/branding-core/validators/contrast-checker.js +33 -0
  124. package/dist/lib/branding-core/validators/contrast-checker.js.map +1 -0
  125. package/dist/lib/branding-core/validators/token-schema.d.ts +10 -0
  126. package/dist/lib/branding-core/validators/token-schema.d.ts.map +1 -0
  127. package/dist/lib/branding-core/validators/token-schema.js +43 -0
  128. package/dist/lib/branding-core/validators/token-schema.js.map +1 -0
  129. package/dist/lib/config.d.ts +7 -0
  130. package/dist/lib/config.d.ts.map +1 -0
  131. package/dist/lib/config.js +8 -0
  132. package/dist/lib/config.js.map +1 -0
  133. package/dist/lib/logger.d.ts +3 -0
  134. package/dist/lib/logger.d.ts.map +1 -0
  135. package/dist/lib/logger.js +10 -0
  136. package/dist/lib/logger.js.map +1 -0
  137. package/dist/lib/types.d.ts +208 -0
  138. package/dist/lib/types.d.ts.map +1 -0
  139. package/dist/lib/types.js +2 -0
  140. package/dist/lib/types.js.map +1 -0
  141. package/dist/resources/brand-knowledge.d.ts +3 -0
  142. package/dist/resources/brand-knowledge.d.ts.map +1 -0
  143. package/dist/resources/brand-knowledge.js +53 -0
  144. package/dist/resources/brand-knowledge.js.map +1 -0
  145. package/dist/resources/brand-templates.d.ts +3 -0
  146. package/dist/resources/brand-templates.d.ts.map +1 -0
  147. package/dist/resources/brand-templates.js +68 -0
  148. package/dist/resources/brand-templates.js.map +1 -0
  149. package/dist/tools/create-brand-guidelines.d.ts +3 -0
  150. package/dist/tools/create-brand-guidelines.d.ts.map +1 -0
  151. package/dist/tools/create-brand-guidelines.js +85 -0
  152. package/dist/tools/create-brand-guidelines.js.map +1 -0
  153. package/dist/tools/export-design-tokens.d.ts +3 -0
  154. package/dist/tools/export-design-tokens.d.ts.map +1 -0
  155. package/dist/tools/export-design-tokens.js +37 -0
  156. package/dist/tools/export-design-tokens.js.map +1 -0
  157. package/dist/tools/generate-brand-assets.d.ts +3 -0
  158. package/dist/tools/generate-brand-assets.d.ts.map +1 -0
  159. package/dist/tools/generate-brand-assets.js +37 -0
  160. package/dist/tools/generate-brand-assets.js.map +1 -0
  161. package/dist/tools/generate-brand-identity.d.ts +3 -0
  162. package/dist/tools/generate-brand-identity.d.ts.map +1 -0
  163. package/dist/tools/generate-brand-identity.js +73 -0
  164. package/dist/tools/generate-brand-identity.js.map +1 -0
  165. package/dist/tools/generate-color-palette.d.ts +3 -0
  166. package/dist/tools/generate-color-palette.d.ts.map +1 -0
  167. package/dist/tools/generate-color-palette.js +33 -0
  168. package/dist/tools/generate-color-palette.js.map +1 -0
  169. package/dist/tools/generate-typography-system.d.ts +3 -0
  170. package/dist/tools/generate-typography-system.d.ts.map +1 -0
  171. package/dist/tools/generate-typography-system.js +28 -0
  172. package/dist/tools/generate-typography-system.js.map +1 -0
  173. package/dist/tools/refine-brand-element.d.ts +3 -0
  174. package/dist/tools/refine-brand-element.d.ts.map +1 -0
  175. package/dist/tools/refine-brand-element.js +41 -0
  176. package/dist/tools/refine-brand-element.js.map +1 -0
  177. package/dist/tools/validate-brand-consistency.d.ts +3 -0
  178. package/dist/tools/validate-brand-consistency.d.ts.map +1 -0
  179. package/dist/tools/validate-brand-consistency.js +25 -0
  180. package/dist/tools/validate-brand-consistency.js.map +1 -0
  181. package/docs/API.md +110 -0
  182. package/docs/DATA_SOURCES.md +69 -0
  183. package/docs/INTEGRATION.md +58 -0
  184. package/eslint.config.js +52 -0
  185. package/jest.config.js +40 -0
  186. package/package.json +78 -0
  187. package/src/__tests__/integration/brand-generation.test.ts +84 -0
  188. package/src/__tests__/integration/mcp-server.test.ts +18 -0
  189. package/src/__tests__/unit/ai-interpreter.test.ts +172 -0
  190. package/src/__tests__/unit/border-system.test.ts +77 -0
  191. package/src/__tests__/unit/color-palette.test.ts +161 -0
  192. package/src/__tests__/unit/contrast-checker.test.ts +124 -0
  193. package/src/__tests__/unit/design-tokens.test.ts +184 -0
  194. package/src/__tests__/unit/favicon-generator.test.ts +80 -0
  195. package/src/__tests__/unit/gradient-system.test.ts +122 -0
  196. package/src/__tests__/unit/logo-generator.test.ts +146 -0
  197. package/src/__tests__/unit/motion-system.test.ts +91 -0
  198. package/src/__tests__/unit/og-image-generator.test.ts +115 -0
  199. package/src/__tests__/unit/shadow-system.test.ts +63 -0
  200. package/src/__tests__/unit/spacing-scale.test.ts +60 -0
  201. package/src/__tests__/unit/typography-system.test.ts +71 -0
  202. package/src/index.ts +59 -0
  203. package/src/lib/branding-core/ai/brand-interpreter.ts +30 -0
  204. package/src/lib/branding-core/ai/claude-interpreter.ts +76 -0
  205. package/src/lib/branding-core/ai/intent-applier.ts +59 -0
  206. package/src/lib/branding-core/ai/keyword-interpreter.ts +95 -0
  207. package/src/lib/branding-core/ai/prompts.ts +93 -0
  208. package/src/lib/branding-core/ai/types.ts +36 -0
  209. package/src/lib/branding-core/documents/html-generator.ts +32 -0
  210. package/src/lib/branding-core/documents/pdf-generator.ts +21 -0
  211. package/src/lib/branding-core/exporters/css-variables.ts +71 -0
  212. package/src/lib/branding-core/exporters/design-tokens.ts +86 -0
  213. package/src/lib/branding-core/exporters/figma-tokens.ts +87 -0
  214. package/src/lib/branding-core/exporters/react-theme.ts +69 -0
  215. package/src/lib/branding-core/exporters/sass-variables.ts +74 -0
  216. package/src/lib/branding-core/exporters/tailwind-preset.ts +67 -0
  217. package/src/lib/branding-core/generators/border-system.ts +41 -0
  218. package/src/lib/branding-core/generators/color-palette.ts +147 -0
  219. package/src/lib/branding-core/generators/favicon-generator.ts +33 -0
  220. package/src/lib/branding-core/generators/gradient-system.ts +120 -0
  221. package/src/lib/branding-core/generators/logo-generator.ts +152 -0
  222. package/src/lib/branding-core/generators/motion-system.ts +98 -0
  223. package/src/lib/branding-core/generators/og-image-generator.ts +97 -0
  224. package/src/lib/branding-core/generators/shadow-system.ts +66 -0
  225. package/src/lib/branding-core/generators/spacing-scale.ts +29 -0
  226. package/src/lib/branding-core/generators/typography-system.ts +128 -0
  227. package/src/lib/branding-core/index.ts +28 -0
  228. package/src/lib/branding-core/validators/brand-consistency.ts +79 -0
  229. package/src/lib/branding-core/validators/contrast-checker.ts +37 -0
  230. package/src/lib/branding-core/validators/token-schema.ts +50 -0
  231. package/src/lib/config.ts +13 -0
  232. package/src/lib/logger.ts +12 -0
  233. package/src/lib/types.ts +236 -0
  234. package/src/resources/brand-knowledge.ts +60 -0
  235. package/src/resources/brand-templates.ts +70 -0
  236. package/src/tools/create-brand-guidelines.ts +94 -0
  237. package/src/tools/export-design-tokens.ts +52 -0
  238. package/src/tools/generate-brand-assets.ts +48 -0
  239. package/src/tools/generate-brand-identity.ts +115 -0
  240. package/src/tools/generate-color-palette.ts +43 -0
  241. package/src/tools/generate-typography-system.ts +42 -0
  242. package/src/tools/refine-brand-element.ts +65 -0
  243. package/src/tools/validate-brand-consistency.ts +32 -0
  244. package/tsconfig.json +21 -0
@@ -0,0 +1,93 @@
1
+ import type { BrandIdentity } from '../../types.js';
2
+
3
+ export function buildRefinementPrompt(
4
+ feedback: string,
5
+ element: 'colors' | 'typography' | 'spacing',
6
+ currentBrand: BrandIdentity
7
+ ): string {
8
+ const brandContext = [
9
+ `Brand: ${currentBrand.name}`,
10
+ `Industry: ${currentBrand.industry}`,
11
+ `Style: ${currentBrand.style}`,
12
+ `Current primary color: ${currentBrand.colors.primary.hex}`,
13
+ `Current heading font: ${currentBrand.typography.headingFont}`,
14
+ `Current body font: ${currentBrand.typography.bodyFont}`,
15
+ ].join('\n');
16
+
17
+ const colorSchema = `{
18
+ "color": {
19
+ "baseColor": "#hex (optional, keep current if not changing)",
20
+ "harmony": "complementary|analogous|triadic|split-complementary|tetradic|monochromatic",
21
+ "theme": "light|dark|both",
22
+ "saturationShift": number (-30 to 30),
23
+ "lightnessShift": number (-30 to 30),
24
+ "hueShift": number (-180 to 180)
25
+ },
26
+ "reasoning": "1-2 sentences explaining the design decision"
27
+ }`;
28
+
29
+ const typographySchema = `{
30
+ "typography": {
31
+ "headingCategory": "serif|sans-serif|monospace|display|handwriting",
32
+ "bodyCategory": "serif|sans-serif|monospace|display|handwriting",
33
+ "scaleRatio": "minor-second|major-second|minor-third|major-third|perfect-fourth|augmented-fourth|perfect-fifth|golden-ratio",
34
+ "baseSize": number (12-24)
35
+ },
36
+ "reasoning": "1-2 sentences explaining the design decision"
37
+ }`;
38
+
39
+ const schema = element === 'colors' ? colorSchema : typographySchema;
40
+
41
+ return [
42
+ 'You are a brand identity expert. Interpret the user feedback and output a JSON object with specific design parameters.',
43
+ '',
44
+ 'Current brand context:',
45
+ brandContext,
46
+ '',
47
+ `User wants to refine: ${element}`,
48
+ `User feedback: "${feedback}"`,
49
+ '',
50
+ 'Respond with ONLY valid JSON matching this schema:',
51
+ schema,
52
+ '',
53
+ 'Design principles:',
54
+ '- Warm colors: shift hue toward red/orange (positive hueShift), use analogous harmony',
55
+ '- Cool colors: shift hue toward blue/green (negative hueShift)',
56
+ '- Premium feel: lower saturation, slightly darker, analogous or monochromatic',
57
+ '- Playful: higher saturation, lighter, triadic harmony',
58
+ '- Corporate: moderate saturation, complementary, clean sans-serif',
59
+ '- Editorial: serif headings, perfect-fourth or larger scale ratio',
60
+ '- Technical: monospace body, sans-serif headings, compact scale',
61
+ '- WCAG: ensure contrast ratios remain accessible (>= 4.5:1 on white)',
62
+ ].join('\n');
63
+ }
64
+
65
+ export function buildGenerationPrompt(
66
+ brandName: string,
67
+ industry: string,
68
+ description: string
69
+ ): string {
70
+ return [
71
+ 'You are a brand identity expert. Based on the brand description, suggest specific design parameters.',
72
+ '',
73
+ `Brand name: ${brandName}`,
74
+ `Industry: ${industry}`,
75
+ `Description: "${description}"`,
76
+ '',
77
+ 'Respond with ONLY valid JSON:',
78
+ '{',
79
+ ' "style": "minimal|bold|elegant|playful|corporate|tech|organic|retro",',
80
+ ' "color": {',
81
+ ' "baseColor": "#hex",',
82
+ ' "harmony": "complementary|analogous|triadic|split-complementary|tetradic|monochromatic",',
83
+ ' "theme": "light|dark|both"',
84
+ ' },',
85
+ ' "typography": {',
86
+ ' "headingCategory": "serif|sans-serif|monospace|display|handwriting",',
87
+ ' "bodyCategory": "serif|sans-serif|monospace|display|handwriting",',
88
+ ' "scaleRatio": "minor-second|major-second|minor-third|major-third|perfect-fourth|augmented-fourth|perfect-fifth|golden-ratio"',
89
+ ' },',
90
+ ' "reasoning": "2-3 sentences explaining why these choices fit the brand"',
91
+ '}',
92
+ ].join('\n');
93
+ }
@@ -0,0 +1,36 @@
1
+ import type {
2
+ BrandStyle,
3
+ ColorHarmony,
4
+ ColorTheme,
5
+ FontCategory,
6
+ TypeScaleRatio,
7
+ } from '../../types.js';
8
+
9
+ export interface ColorIntent {
10
+ baseColor?: string;
11
+ harmony?: ColorHarmony;
12
+ theme?: ColorTheme;
13
+ saturationShift?: number;
14
+ lightnessShift?: number;
15
+ hueShift?: number;
16
+ }
17
+
18
+ export interface TypographyIntent {
19
+ headingCategory?: FontCategory;
20
+ bodyCategory?: FontCategory;
21
+ scaleRatio?: TypeScaleRatio;
22
+ baseSize?: number;
23
+ }
24
+
25
+ export interface BrandIntent {
26
+ color?: ColorIntent;
27
+ typography?: TypographyIntent;
28
+ style?: BrandStyle;
29
+ reasoning?: string;
30
+ }
31
+
32
+ export interface InterpreterOptions {
33
+ anthropicApiKey?: string;
34
+ model?: string;
35
+ maxTokens?: number;
36
+ }
@@ -0,0 +1,32 @@
1
+ import type { BrandIdentity } from '../../types.js';
2
+
3
+ export function generateBrandHtml(brand: BrandIdentity): string {
4
+ const { colors, typography, spacing } = brand;
5
+ return `<!DOCTYPE html>
6
+ <html lang="en">
7
+ <head>
8
+ <meta charset="UTF-8">
9
+ <title>${brand.name} Brand Book</title>
10
+ </head>
11
+ <body>
12
+ <h1>${brand.name}</h1>
13
+ ${brand.tagline ? `<p>${brand.tagline}</p>` : ''}
14
+ <section>
15
+ <h2>Colors</h2>
16
+ <p>Primary: ${colors.primary.hex}</p>
17
+ <p>Secondary: ${colors.secondary.hex}</p>
18
+ <p>Accent: ${colors.accent.hex}</p>
19
+ </section>
20
+ <section>
21
+ <h2>Typography</h2>
22
+ <p>Heading: ${typography.headingFont}</p>
23
+ <p>Body: ${typography.bodyFont}</p>
24
+ <p>Scale: ${typography.scaleRatio}</p>
25
+ </section>
26
+ <section>
27
+ <h2>Spacing</h2>
28
+ <p>Base unit: ${spacing.unit}px</p>
29
+ </section>
30
+ </body>
31
+ </html>`;
32
+ }
@@ -0,0 +1,21 @@
1
+ import type { BrandIdentity } from '../../types.js';
2
+
3
+ export function generateBrandPdfContent(brand: BrandIdentity): string {
4
+ return [
5
+ `${brand.name} Brand Guidelines`,
6
+ brand.tagline ?? '',
7
+ '',
8
+ 'Colors',
9
+ ` Primary: ${brand.colors.primary.hex}`,
10
+ ` Secondary: ${brand.colors.secondary.hex}`,
11
+ ` Accent: ${brand.colors.accent.hex}`,
12
+ '',
13
+ 'Typography',
14
+ ` Heading: ${brand.typography.headingFont}`,
15
+ ` Body: ${brand.typography.bodyFont}`,
16
+ ` Base size: ${brand.typography.baseSize}px`,
17
+ '',
18
+ 'Spacing',
19
+ ` Base unit: ${brand.spacing.unit}px`,
20
+ ].join('\n');
21
+ }
@@ -0,0 +1,71 @@
1
+ import type { BrandIdentity } from '../../types.js';
2
+
3
+ export function exportCssVariables(brand: BrandIdentity): string {
4
+ const { colors, typography, spacing } = brand;
5
+ const lines: string[] = [':root {'];
6
+
7
+ lines.push(` --color-primary: ${colors.primary.hex};`);
8
+ lines.push(` --color-secondary: ${colors.secondary.hex};`);
9
+ lines.push(` --color-accent: ${colors.accent.hex};`);
10
+ for (const n of colors.neutral) {
11
+ lines.push(` --color-${n.name}: ${n.hex};`);
12
+ }
13
+ lines.push(` --color-success: ${colors.semantic.success.hex};`);
14
+ lines.push(` --color-warning: ${colors.semantic.warning.hex};`);
15
+ lines.push(` --color-error: ${colors.semantic.error.hex};`);
16
+ lines.push(` --color-info: ${colors.semantic.info.hex};`);
17
+ lines.push('');
18
+
19
+ lines.push(` --font-heading: '${typography.headingFont}', sans-serif;`);
20
+ lines.push(` --font-body: '${typography.bodyFont}', sans-serif;`);
21
+ lines.push(` --font-mono: '${typography.monoFont}', monospace;`);
22
+ for (const step of typography.steps) {
23
+ lines.push(` --text-${step.name}: ${step.size};`);
24
+ lines.push(` --leading-${step.name}: ${step.lineHeight};`);
25
+ }
26
+ lines.push('');
27
+
28
+ for (const [key, value] of Object.entries(spacing.values)) {
29
+ lines.push(` --spacing-${key}: ${value};`);
30
+ }
31
+
32
+ if (brand.shadows) {
33
+ lines.push('');
34
+ for (const [name, level] of Object.entries(brand.shadows.levels)) {
35
+ lines.push(` --shadow-${name}: ${level.cssValue};`);
36
+ }
37
+ }
38
+
39
+ if (brand.borders) {
40
+ lines.push('');
41
+ for (const [name, value] of Object.entries(brand.borders.radii)) {
42
+ lines.push(` --radius-${name}: ${value};`);
43
+ }
44
+ for (const [name, value] of Object.entries(brand.borders.widths)) {
45
+ lines.push(` --border-${name}: ${value};`);
46
+ }
47
+ }
48
+
49
+ if (brand.motion) {
50
+ lines.push('');
51
+ for (const [name, value] of Object.entries(brand.motion.durations)) {
52
+ lines.push(` --duration-${name}: ${value};`);
53
+ }
54
+ for (const [name, value] of Object.entries(brand.motion.easings)) {
55
+ lines.push(` --ease-${name}: ${value};`);
56
+ }
57
+ for (const [name, value] of Object.entries(brand.motion.transitions)) {
58
+ lines.push(` --transition-${name}: ${value};`);
59
+ }
60
+ }
61
+
62
+ if (brand.gradients) {
63
+ lines.push('');
64
+ for (const [name, gradient] of Object.entries(brand.gradients.presets)) {
65
+ lines.push(` --gradient-${name}: ${gradient.cssValue};`);
66
+ }
67
+ }
68
+
69
+ lines.push('}');
70
+ return lines.join('\n');
71
+ }
@@ -0,0 +1,86 @@
1
+ import type { BrandIdentity, DesignTokens } from '../../types.js';
2
+
3
+ export function exportDesignTokens(brand: BrandIdentity): DesignTokens {
4
+ const { colors, typography, spacing } = brand;
5
+
6
+ const colorTokens: DesignTokens['color'] = {
7
+ primary: { value: { $value: colors.primary.hex, $type: 'color' } },
8
+ secondary: { value: { $value: colors.secondary.hex, $type: 'color' } },
9
+ accent: { value: { $value: colors.accent.hex, $type: 'color' } },
10
+ success: { value: { $value: colors.semantic.success.hex, $type: 'color' } },
11
+ warning: { value: { $value: colors.semantic.warning.hex, $type: 'color' } },
12
+ error: { value: { $value: colors.semantic.error.hex, $type: 'color' } },
13
+ info: { value: { $value: colors.semantic.info.hex, $type: 'color' } },
14
+ };
15
+
16
+ for (const neutral of colors.neutral) {
17
+ colorTokens[neutral.name] = { value: { $value: neutral.hex, $type: 'color' } };
18
+ }
19
+
20
+ const typographyTokens: DesignTokens['typography'] = {};
21
+ for (const step of typography.steps) {
22
+ typographyTokens[step.name] = {
23
+ fontSize: { $value: step.size, $type: 'dimension' },
24
+ lineHeight: { $value: step.lineHeight, $type: 'number' },
25
+ letterSpacing: { $value: step.letterSpacing, $type: 'dimension' },
26
+ fontWeight: { $value: step.weight, $type: 'number' },
27
+ };
28
+ }
29
+ typographyTokens['font-heading'] = {
30
+ value: { $value: typography.headingFont, $type: 'fontFamily' },
31
+ };
32
+ typographyTokens['font-body'] = {
33
+ value: { $value: typography.bodyFont, $type: 'fontFamily' },
34
+ };
35
+ typographyTokens['font-mono'] = {
36
+ value: { $value: typography.monoFont, $type: 'fontFamily' },
37
+ };
38
+
39
+ const spacingTokens: DesignTokens['spacing'] = {};
40
+ for (const [key, value] of Object.entries(spacing.values)) {
41
+ spacingTokens[key] = { $value: value, $type: 'dimension' };
42
+ }
43
+
44
+ const result: DesignTokens = {
45
+ $schema: 'https://design-tokens.github.io/community-group/format/',
46
+ color: colorTokens,
47
+ typography: typographyTokens,
48
+ spacing: spacingTokens,
49
+ };
50
+
51
+ if (brand.shadows) {
52
+ result.shadow = {};
53
+ for (const [name, level] of Object.entries(brand.shadows.levels)) {
54
+ result.shadow[name] = { $value: level.cssValue, $type: 'shadow' };
55
+ }
56
+ }
57
+
58
+ if (brand.borders) {
59
+ result.border = {};
60
+ for (const [name, value] of Object.entries(brand.borders.radii)) {
61
+ result.border[`radius-${name}`] = { $value: value, $type: 'dimension' };
62
+ }
63
+ for (const [name, value] of Object.entries(brand.borders.widths)) {
64
+ result.border[`width-${name}`] = { $value: value, $type: 'dimension' };
65
+ }
66
+ }
67
+
68
+ if (brand.motion) {
69
+ result.motion = {};
70
+ for (const [name, value] of Object.entries(brand.motion.durations)) {
71
+ result.motion[`duration-${name}`] = { $value: value, $type: 'duration' };
72
+ }
73
+ for (const [name, value] of Object.entries(brand.motion.easings)) {
74
+ result.motion[`easing-${name}`] = { $value: value, $type: 'cubicBezier' };
75
+ }
76
+ }
77
+
78
+ if (brand.gradients) {
79
+ result.gradient = {};
80
+ for (const [name, gradient] of Object.entries(brand.gradients.presets)) {
81
+ result.gradient[name] = { $value: gradient.cssValue, $type: 'gradient' };
82
+ }
83
+ }
84
+
85
+ return result;
86
+ }
@@ -0,0 +1,87 @@
1
+ import type { BrandIdentity } from '../../types.js';
2
+
3
+ interface FigmaToken {
4
+ value: string | number;
5
+ type: string;
6
+ description?: string;
7
+ }
8
+
9
+ export function exportFigmaTokens(
10
+ brand: BrandIdentity
11
+ ): Record<string, Record<string, FigmaToken>> {
12
+ const { colors, typography, spacing } = brand;
13
+
14
+ const colorGroup: Record<string, FigmaToken> = {
15
+ primary: { value: colors.primary.hex, type: 'color', description: 'Primary brand color' },
16
+ secondary: { value: colors.secondary.hex, type: 'color' },
17
+ accent: { value: colors.accent.hex, type: 'color' },
18
+ success: { value: colors.semantic.success.hex, type: 'color' },
19
+ warning: { value: colors.semantic.warning.hex, type: 'color' },
20
+ error: { value: colors.semantic.error.hex, type: 'color' },
21
+ info: { value: colors.semantic.info.hex, type: 'color' },
22
+ };
23
+ for (const n of colors.neutral) {
24
+ colorGroup[n.name] = { value: n.hex, type: 'color' };
25
+ }
26
+
27
+ const typographyGroup: Record<string, FigmaToken> = {};
28
+ for (const step of typography.steps) {
29
+ typographyGroup[`${step.name}-size`] = { value: step.size, type: 'fontSizes' };
30
+ typographyGroup[`${step.name}-weight`] = { value: step.weight, type: 'fontWeights' };
31
+ typographyGroup[`${step.name}-lineHeight`] = { value: step.lineHeight, type: 'lineHeights' };
32
+ }
33
+ typographyGroup['font-heading'] = { value: typography.headingFont, type: 'fontFamilies' };
34
+ typographyGroup['font-body'] = { value: typography.bodyFont, type: 'fontFamilies' };
35
+ typographyGroup['font-mono'] = { value: typography.monoFont, type: 'fontFamilies' };
36
+
37
+ const spacingGroup: Record<string, FigmaToken> = {};
38
+ for (const [key, value] of Object.entries(spacing.values)) {
39
+ spacingGroup[key] = { value, type: 'spacing' };
40
+ }
41
+
42
+ const result: Record<string, Record<string, FigmaToken>> = {
43
+ color: colorGroup,
44
+ typography: typographyGroup,
45
+ spacing: spacingGroup,
46
+ };
47
+
48
+ if (brand.shadows) {
49
+ const shadowGroup: Record<string, FigmaToken> = {};
50
+ for (const [name, level] of Object.entries(brand.shadows.levels)) {
51
+ shadowGroup[name] = { value: level.cssValue, type: 'boxShadow' };
52
+ }
53
+ result.shadow = shadowGroup;
54
+ }
55
+
56
+ if (brand.borders) {
57
+ const borderGroup: Record<string, FigmaToken> = {};
58
+ for (const [name, value] of Object.entries(brand.borders.radii)) {
59
+ borderGroup[`radius-${name}`] = { value, type: 'borderRadius' };
60
+ }
61
+ for (const [name, value] of Object.entries(brand.borders.widths)) {
62
+ borderGroup[`width-${name}`] = { value, type: 'borderWidth' };
63
+ }
64
+ result.border = borderGroup;
65
+ }
66
+
67
+ if (brand.motion) {
68
+ const motionGroup: Record<string, FigmaToken> = {};
69
+ for (const [name, value] of Object.entries(brand.motion.durations)) {
70
+ motionGroup[`duration-${name}`] = { value, type: 'duration' };
71
+ }
72
+ for (const [name, value] of Object.entries(brand.motion.easings)) {
73
+ motionGroup[`easing-${name}`] = { value, type: 'other' };
74
+ }
75
+ result.motion = motionGroup;
76
+ }
77
+
78
+ if (brand.gradients) {
79
+ const gradientGroup: Record<string, FigmaToken> = {};
80
+ for (const [name, gradient] of Object.entries(brand.gradients.presets)) {
81
+ gradientGroup[name] = { value: gradient.cssValue, type: 'gradient' };
82
+ }
83
+ result.gradient = gradientGroup;
84
+ }
85
+
86
+ return result;
87
+ }
@@ -0,0 +1,69 @@
1
+ import type { BrandIdentity } from '../../types.js';
2
+
3
+ export function exportReactTheme(brand: BrandIdentity): string {
4
+ const { colors, typography, spacing } = brand;
5
+
6
+ const neutralObj: Record<string, string> = {};
7
+ for (const n of colors.neutral) {
8
+ neutralObj[n.name] = n.hex;
9
+ }
10
+
11
+ const theme = {
12
+ colors: {
13
+ primary: colors.primary.hex,
14
+ secondary: colors.secondary.hex,
15
+ accent: colors.accent.hex,
16
+ ...neutralObj,
17
+ success: colors.semantic.success.hex,
18
+ warning: colors.semantic.warning.hex,
19
+ error: colors.semantic.error.hex,
20
+ info: colors.semantic.info.hex,
21
+ },
22
+ fonts: {
23
+ heading: `'${typography.headingFont}', sans-serif`,
24
+ body: `'${typography.bodyFont}', sans-serif`,
25
+ mono: `'${typography.monoFont}', monospace`,
26
+ },
27
+ fontSizes: Object.fromEntries(typography.steps.map((s) => [s.name, s.size])),
28
+ lineHeights: Object.fromEntries(typography.steps.map((s) => [s.name, s.lineHeight])),
29
+ space: spacing.values,
30
+ } as Record<string, unknown>;
31
+
32
+ if (brand.shadows) {
33
+ const shadowObj: Record<string, string> = {};
34
+ for (const [name, level] of Object.entries(brand.shadows.levels)) {
35
+ shadowObj[name] = level.cssValue;
36
+ }
37
+ theme.shadows = shadowObj;
38
+ }
39
+
40
+ if (brand.borders) {
41
+ theme.radii = brand.borders.radii;
42
+ theme.borderWidths = brand.borders.widths;
43
+ }
44
+
45
+ if (brand.motion) {
46
+ theme.motion = {
47
+ durations: brand.motion.durations,
48
+ easings: brand.motion.easings,
49
+ transitions: brand.motion.transitions,
50
+ };
51
+ }
52
+
53
+ if (brand.gradients) {
54
+ const gradientObj: Record<string, string> = {};
55
+ for (const [name, gradient] of Object.entries(brand.gradients.presets)) {
56
+ gradientObj[name] = gradient.cssValue;
57
+ }
58
+ theme.gradients = gradientObj;
59
+ }
60
+
61
+ return [
62
+ "import type { CSSProperties } from 'react';",
63
+ '',
64
+ `export const theme = ${JSON.stringify(theme, null, 2)} as const;`,
65
+ '',
66
+ 'export type Theme = typeof theme;',
67
+ '',
68
+ ].join('\n');
69
+ }
@@ -0,0 +1,74 @@
1
+ import type { BrandIdentity } from '../../types.js';
2
+
3
+ export function exportSassVariables(brand: BrandIdentity): string {
4
+ const { colors, typography, spacing } = brand;
5
+ const lines: string[] = ['// Brand Identity - Generated by @forgespace/branding-mcp', ''];
6
+
7
+ lines.push('// Colors');
8
+ lines.push(`$color-primary: ${colors.primary.hex};`);
9
+ lines.push(`$color-secondary: ${colors.secondary.hex};`);
10
+ lines.push(`$color-accent: ${colors.accent.hex};`);
11
+ for (const n of colors.neutral) {
12
+ lines.push(`$color-${n.name}: ${n.hex};`);
13
+ }
14
+ lines.push(`$color-success: ${colors.semantic.success.hex};`);
15
+ lines.push(`$color-warning: ${colors.semantic.warning.hex};`);
16
+ lines.push(`$color-error: ${colors.semantic.error.hex};`);
17
+ lines.push(`$color-info: ${colors.semantic.info.hex};`);
18
+ lines.push('');
19
+
20
+ lines.push('// Typography');
21
+ lines.push(`$font-heading: '${typography.headingFont}', sans-serif;`);
22
+ lines.push(`$font-body: '${typography.bodyFont}', sans-serif;`);
23
+ lines.push(`$font-mono: '${typography.monoFont}', monospace;`);
24
+ for (const step of typography.steps) {
25
+ lines.push(`$text-${step.name}: ${step.size};`);
26
+ lines.push(`$leading-${step.name}: ${step.lineHeight};`);
27
+ }
28
+ lines.push('');
29
+
30
+ lines.push('// Spacing');
31
+ for (const [key, value] of Object.entries(spacing.values)) {
32
+ lines.push(`$spacing-${key}: ${value};`);
33
+ }
34
+
35
+ if (brand.shadows) {
36
+ lines.push('');
37
+ lines.push('// Shadows');
38
+ for (const [name, level] of Object.entries(brand.shadows.levels)) {
39
+ lines.push(`$shadow-${name}: ${level.cssValue};`);
40
+ }
41
+ }
42
+
43
+ if (brand.borders) {
44
+ lines.push('');
45
+ lines.push('// Borders');
46
+ for (const [name, value] of Object.entries(brand.borders.radii)) {
47
+ lines.push(`$radius-${name}: ${value};`);
48
+ }
49
+ for (const [name, value] of Object.entries(brand.borders.widths)) {
50
+ lines.push(`$border-${name}: ${value};`);
51
+ }
52
+ }
53
+
54
+ if (brand.motion) {
55
+ lines.push('');
56
+ lines.push('// Motion');
57
+ for (const [name, value] of Object.entries(brand.motion.durations)) {
58
+ lines.push(`$duration-${name}: ${value};`);
59
+ }
60
+ for (const [name, value] of Object.entries(brand.motion.easings)) {
61
+ lines.push(`$ease-${name}: ${value};`);
62
+ }
63
+ }
64
+
65
+ if (brand.gradients) {
66
+ lines.push('');
67
+ lines.push('// Gradients');
68
+ for (const [name, gradient] of Object.entries(brand.gradients.presets)) {
69
+ lines.push(`$gradient-${name}: ${gradient.cssValue};`);
70
+ }
71
+ }
72
+
73
+ return lines.join('\n') + '\n';
74
+ }
@@ -0,0 +1,67 @@
1
+ import type { BrandIdentity } from '../../types.js';
2
+
3
+ export function exportTailwindPreset(brand: BrandIdentity): string {
4
+ const { colors, typography, spacing } = brand;
5
+
6
+ const neutralObj: Record<string, string> = {};
7
+ for (const n of colors.neutral) {
8
+ neutralObj[n.name.replace('neutral-', '')] = n.hex;
9
+ }
10
+
11
+ const spacingObj: Record<string, string> = {};
12
+ for (const [key, value] of Object.entries(spacing.values)) {
13
+ spacingObj[key] = value;
14
+ }
15
+
16
+ const extend: Record<string, unknown> = {
17
+ colors: {
18
+ primary: colors.primary.hex,
19
+ secondary: colors.secondary.hex,
20
+ accent: colors.accent.hex,
21
+ neutral: neutralObj,
22
+ success: colors.semantic.success.hex,
23
+ warning: colors.semantic.warning.hex,
24
+ error: colors.semantic.error.hex,
25
+ info: colors.semantic.info.hex,
26
+ },
27
+ fontFamily: {
28
+ heading: [typography.headingFont, 'sans-serif'],
29
+ body: [typography.bodyFont, 'sans-serif'],
30
+ mono: [typography.monoFont, 'monospace'],
31
+ },
32
+ fontSize: Object.fromEntries(
33
+ typography.steps.map((s) => [s.name, [s.size, { lineHeight: s.lineHeight }]])
34
+ ),
35
+ spacing: spacingObj,
36
+ };
37
+
38
+ if (brand.shadows) {
39
+ const shadowObj: Record<string, string> = {};
40
+ for (const [name, level] of Object.entries(brand.shadows.levels)) {
41
+ shadowObj[name] = level.cssValue;
42
+ }
43
+ extend.boxShadow = shadowObj;
44
+ }
45
+
46
+ if (brand.borders) {
47
+ extend.borderRadius = brand.borders.radii;
48
+ extend.borderWidth = brand.borders.widths;
49
+ }
50
+
51
+ if (brand.motion) {
52
+ extend.transitionDuration = brand.motion.durations;
53
+ extend.transitionTimingFunction = brand.motion.easings;
54
+ }
55
+
56
+ if (brand.gradients) {
57
+ const bgImage: Record<string, string> = {};
58
+ for (const [name, gradient] of Object.entries(brand.gradients.presets)) {
59
+ bgImage[name] = gradient.cssValue;
60
+ }
61
+ extend.backgroundImage = bgImage;
62
+ }
63
+
64
+ const preset = { theme: { extend } };
65
+
66
+ return `/** @type {import('tailwindcss').Config} */\nexport default ${JSON.stringify(preset, null, 2)};\n`;
67
+ }
@@ -0,0 +1,41 @@
1
+ import type { BorderRadiusName, BorderSystem, BrandStyle } from '../../types.js';
2
+
3
+ const STYLE_RADII: Record<BrandStyle, Record<BorderRadiusName, number>> = {
4
+ minimal: { none: 0, sm: 2, md: 4, lg: 6, xl: 8, full: 9999, circle: 9999 },
5
+ bold: { none: 0, sm: 4, md: 8, lg: 12, xl: 16, full: 9999, circle: 9999 },
6
+ elegant: { none: 0, sm: 1, md: 2, lg: 4, xl: 6, full: 9999, circle: 9999 },
7
+ playful: { none: 0, sm: 8, md: 12, lg: 16, xl: 24, full: 9999, circle: 9999 },
8
+ corporate: { none: 0, sm: 2, md: 4, lg: 6, xl: 8, full: 9999, circle: 9999 },
9
+ tech: { none: 0, sm: 2, md: 4, lg: 8, xl: 12, full: 9999, circle: 9999 },
10
+ organic: { none: 0, sm: 6, md: 12, lg: 20, xl: 28, full: 9999, circle: 9999 },
11
+ retro: { none: 0, sm: 0, md: 2, lg: 4, xl: 8, full: 9999, circle: 9999 },
12
+ };
13
+
14
+ const STYLE_BORDERS: Record<BrandStyle, { thin: number; medium: number; thick: number }> = {
15
+ minimal: { thin: 1, medium: 1, thick: 2 },
16
+ bold: { thin: 2, medium: 3, thick: 4 },
17
+ elegant: { thin: 1, medium: 1, thick: 2 },
18
+ playful: { thin: 2, medium: 3, thick: 4 },
19
+ corporate: { thin: 1, medium: 2, thick: 3 },
20
+ tech: { thin: 1, medium: 2, thick: 3 },
21
+ organic: { thin: 1, medium: 2, thick: 3 },
22
+ retro: { thin: 2, medium: 3, thick: 4 },
23
+ };
24
+
25
+ export function generateBorderSystem(style: BrandStyle = 'minimal'): BorderSystem {
26
+ const radiusMap = STYLE_RADII[style];
27
+ const radii = {} as Record<BorderRadiusName, string>;
28
+ for (const [name, value] of Object.entries(radiusMap)) {
29
+ radii[name as BorderRadiusName] = value === 9999 ? '9999px' : `${value}px`;
30
+ }
31
+
32
+ const borderWidths = STYLE_BORDERS[style];
33
+ return {
34
+ radii,
35
+ widths: {
36
+ thin: `${borderWidths.thin}px`,
37
+ medium: `${borderWidths.medium}px`,
38
+ thick: `${borderWidths.thick}px`,
39
+ },
40
+ };
41
+ }