@mp3wizard/figma-console-mcp 1.25.1 → 1.27.2

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 (205) hide show
  1. package/README.md +49 -33
  2. package/dist/cloudflare/core/config.js +0 -8
  3. package/dist/cloudflare/core/console-monitor.js +3 -3
  4. package/dist/cloudflare/core/diagnose-tool.js +96 -0
  5. package/dist/cloudflare/core/figma-tools.js +69 -229
  6. package/dist/cloudflare/core/identity.js +96 -0
  7. package/dist/cloudflare/core/tokens/alias-resolver.js +98 -0
  8. package/dist/cloudflare/core/tokens/config.js +284 -0
  9. package/dist/cloudflare/core/tokens/figma-converter.js +195 -0
  10. package/dist/cloudflare/core/tokens/formatters/css-vars.js +329 -0
  11. package/dist/cloudflare/core/tokens/formatters/dtcg.js +300 -0
  12. package/dist/cloudflare/core/tokens/formatters/index.js +45 -0
  13. package/dist/cloudflare/core/tokens/formatters/json.js +7 -0
  14. package/dist/cloudflare/core/tokens/formatters/less.js +4 -0
  15. package/dist/cloudflare/core/tokens/formatters/scss.js +4 -0
  16. package/dist/cloudflare/core/tokens/formatters/stubs.js +11 -0
  17. package/dist/cloudflare/core/tokens/formatters/style-dictionary-v3.js +4 -0
  18. package/dist/cloudflare/core/tokens/formatters/tailwind-v3.js +4 -0
  19. package/dist/cloudflare/core/tokens/formatters/tailwind-v4.js +4 -0
  20. package/dist/cloudflare/core/tokens/formatters/tokens-studio.js +4 -0
  21. package/dist/cloudflare/core/tokens/formatters/ts-module.js +4 -0
  22. package/dist/cloudflare/core/tokens/index.js +15 -0
  23. package/dist/cloudflare/core/tokens/parsers/css-vars.js +4 -0
  24. package/dist/cloudflare/core/tokens/parsers/dtcg.js +253 -0
  25. package/dist/cloudflare/core/tokens/parsers/index.js +138 -0
  26. package/dist/cloudflare/core/tokens/parsers/json.js +7 -0
  27. package/dist/cloudflare/core/tokens/parsers/scss.js +4 -0
  28. package/dist/cloudflare/core/tokens/parsers/stubs.js +13 -0
  29. package/dist/cloudflare/core/tokens/parsers/style-dictionary-v3.js +4 -0
  30. package/dist/cloudflare/core/tokens/parsers/tailwind-v3.js +4 -0
  31. package/dist/cloudflare/core/tokens/parsers/tailwind-v4.js +4 -0
  32. package/dist/cloudflare/core/tokens/parsers/tokens-studio.js +4 -0
  33. package/dist/cloudflare/core/tokens/schemas.js +148 -0
  34. package/dist/cloudflare/core/tokens/transforms/color.js +12 -0
  35. package/dist/cloudflare/core/tokens/transforms/index.js +29 -0
  36. package/dist/cloudflare/core/tokens/transforms/size.js +7 -0
  37. package/dist/cloudflare/core/tokens/types.js +18 -0
  38. package/dist/cloudflare/core/tokens-tools.js +849 -0
  39. package/dist/cloudflare/core/websocket-server.js +5 -55
  40. package/dist/cloudflare/index.js +37 -26
  41. package/dist/core/config.d.ts.map +1 -1
  42. package/dist/core/config.js +0 -8
  43. package/dist/core/config.js.map +1 -1
  44. package/dist/core/console-monitor.d.ts +2 -2
  45. package/dist/core/console-monitor.d.ts.map +1 -1
  46. package/dist/core/console-monitor.js +3 -3
  47. package/dist/core/console-monitor.js.map +1 -1
  48. package/dist/core/diagnose-tool.d.ts +33 -0
  49. package/dist/core/diagnose-tool.d.ts.map +1 -0
  50. package/dist/core/diagnose-tool.js +97 -0
  51. package/dist/core/diagnose-tool.js.map +1 -0
  52. package/dist/core/figma-connector.d.ts +1 -1
  53. package/dist/core/figma-connector.d.ts.map +1 -1
  54. package/dist/core/figma-tools.d.ts +1 -2
  55. package/dist/core/figma-tools.d.ts.map +1 -1
  56. package/dist/core/figma-tools.js +69 -229
  57. package/dist/core/figma-tools.js.map +1 -1
  58. package/dist/core/identity.d.ts +41 -0
  59. package/dist/core/identity.d.ts.map +1 -0
  60. package/dist/core/identity.js +97 -0
  61. package/dist/core/identity.js.map +1 -0
  62. package/dist/core/tokens/alias-resolver.d.ts +40 -0
  63. package/dist/core/tokens/alias-resolver.d.ts.map +1 -0
  64. package/dist/core/tokens/alias-resolver.js +99 -0
  65. package/dist/core/tokens/alias-resolver.js.map +1 -0
  66. package/dist/core/tokens/config.d.ts +352 -0
  67. package/dist/core/tokens/config.d.ts.map +1 -0
  68. package/dist/core/tokens/config.js +285 -0
  69. package/dist/core/tokens/config.js.map +1 -0
  70. package/dist/core/tokens/figma-converter.d.ts +81 -0
  71. package/dist/core/tokens/figma-converter.d.ts.map +1 -0
  72. package/dist/core/tokens/figma-converter.js +196 -0
  73. package/dist/core/tokens/figma-converter.js.map +1 -0
  74. package/dist/core/tokens/formatters/css-vars.d.ts +24 -0
  75. package/dist/core/tokens/formatters/css-vars.d.ts.map +1 -0
  76. package/dist/core/tokens/formatters/css-vars.js +330 -0
  77. package/dist/core/tokens/formatters/css-vars.js.map +1 -0
  78. package/dist/core/tokens/formatters/dtcg.d.ts +28 -0
  79. package/dist/core/tokens/formatters/dtcg.d.ts.map +1 -0
  80. package/dist/core/tokens/formatters/dtcg.js +301 -0
  81. package/dist/core/tokens/formatters/dtcg.js.map +1 -0
  82. package/dist/core/tokens/formatters/index.d.ts +30 -0
  83. package/dist/core/tokens/formatters/index.d.ts.map +1 -0
  84. package/dist/core/tokens/formatters/index.js +46 -0
  85. package/dist/core/tokens/formatters/index.js.map +1 -0
  86. package/dist/core/tokens/formatters/json.d.ts +5 -0
  87. package/dist/core/tokens/formatters/json.d.ts.map +1 -0
  88. package/dist/core/tokens/formatters/json.js +8 -0
  89. package/dist/core/tokens/formatters/json.js.map +1 -0
  90. package/dist/core/tokens/formatters/less.d.ts +4 -0
  91. package/dist/core/tokens/formatters/less.d.ts.map +1 -0
  92. package/dist/core/tokens/formatters/less.js +5 -0
  93. package/dist/core/tokens/formatters/less.js.map +1 -0
  94. package/dist/core/tokens/formatters/scss.d.ts +4 -0
  95. package/dist/core/tokens/formatters/scss.d.ts.map +1 -0
  96. package/dist/core/tokens/formatters/scss.js +5 -0
  97. package/dist/core/tokens/formatters/scss.js.map +1 -0
  98. package/dist/core/tokens/formatters/stubs.d.ts +9 -0
  99. package/dist/core/tokens/formatters/stubs.d.ts.map +1 -0
  100. package/dist/core/tokens/formatters/stubs.js +12 -0
  101. package/dist/core/tokens/formatters/stubs.js.map +1 -0
  102. package/dist/core/tokens/formatters/style-dictionary-v3.d.ts +4 -0
  103. package/dist/core/tokens/formatters/style-dictionary-v3.d.ts.map +1 -0
  104. package/dist/core/tokens/formatters/style-dictionary-v3.js +5 -0
  105. package/dist/core/tokens/formatters/style-dictionary-v3.js.map +1 -0
  106. package/dist/core/tokens/formatters/tailwind-v3.d.ts +4 -0
  107. package/dist/core/tokens/formatters/tailwind-v3.d.ts.map +1 -0
  108. package/dist/core/tokens/formatters/tailwind-v3.js +5 -0
  109. package/dist/core/tokens/formatters/tailwind-v3.js.map +1 -0
  110. package/dist/core/tokens/formatters/tailwind-v4.d.ts +4 -0
  111. package/dist/core/tokens/formatters/tailwind-v4.d.ts.map +1 -0
  112. package/dist/core/tokens/formatters/tailwind-v4.js +5 -0
  113. package/dist/core/tokens/formatters/tailwind-v4.js.map +1 -0
  114. package/dist/core/tokens/formatters/tokens-studio.d.ts +4 -0
  115. package/dist/core/tokens/formatters/tokens-studio.d.ts.map +1 -0
  116. package/dist/core/tokens/formatters/tokens-studio.js +5 -0
  117. package/dist/core/tokens/formatters/tokens-studio.js.map +1 -0
  118. package/dist/core/tokens/formatters/ts-module.d.ts +4 -0
  119. package/dist/core/tokens/formatters/ts-module.d.ts.map +1 -0
  120. package/dist/core/tokens/formatters/ts-module.js +5 -0
  121. package/dist/core/tokens/formatters/ts-module.js.map +1 -0
  122. package/dist/core/tokens/index.d.ts +17 -0
  123. package/dist/core/tokens/index.d.ts.map +1 -0
  124. package/dist/core/tokens/index.js +16 -0
  125. package/dist/core/tokens/index.js.map +1 -0
  126. package/dist/core/tokens/parsers/css-vars.d.ts +3 -0
  127. package/dist/core/tokens/parsers/css-vars.d.ts.map +1 -0
  128. package/dist/core/tokens/parsers/css-vars.js +5 -0
  129. package/dist/core/tokens/parsers/css-vars.js.map +1 -0
  130. package/dist/core/tokens/parsers/dtcg.d.ts +21 -0
  131. package/dist/core/tokens/parsers/dtcg.d.ts.map +1 -0
  132. package/dist/core/tokens/parsers/dtcg.js +254 -0
  133. package/dist/core/tokens/parsers/dtcg.js.map +1 -0
  134. package/dist/core/tokens/parsers/index.d.ts +37 -0
  135. package/dist/core/tokens/parsers/index.d.ts.map +1 -0
  136. package/dist/core/tokens/parsers/index.js +139 -0
  137. package/dist/core/tokens/parsers/index.js.map +1 -0
  138. package/dist/core/tokens/parsers/json.d.ts +4 -0
  139. package/dist/core/tokens/parsers/json.d.ts.map +1 -0
  140. package/dist/core/tokens/parsers/json.js +8 -0
  141. package/dist/core/tokens/parsers/json.js.map +1 -0
  142. package/dist/core/tokens/parsers/scss.d.ts +3 -0
  143. package/dist/core/tokens/parsers/scss.d.ts.map +1 -0
  144. package/dist/core/tokens/parsers/scss.js +5 -0
  145. package/dist/core/tokens/parsers/scss.js.map +1 -0
  146. package/dist/core/tokens/parsers/stubs.d.ts +11 -0
  147. package/dist/core/tokens/parsers/stubs.d.ts.map +1 -0
  148. package/dist/core/tokens/parsers/stubs.js +14 -0
  149. package/dist/core/tokens/parsers/stubs.js.map +1 -0
  150. package/dist/core/tokens/parsers/style-dictionary-v3.d.ts +3 -0
  151. package/dist/core/tokens/parsers/style-dictionary-v3.d.ts.map +1 -0
  152. package/dist/core/tokens/parsers/style-dictionary-v3.js +5 -0
  153. package/dist/core/tokens/parsers/style-dictionary-v3.js.map +1 -0
  154. package/dist/core/tokens/parsers/tailwind-v3.d.ts +3 -0
  155. package/dist/core/tokens/parsers/tailwind-v3.d.ts.map +1 -0
  156. package/dist/core/tokens/parsers/tailwind-v3.js +5 -0
  157. package/dist/core/tokens/parsers/tailwind-v3.js.map +1 -0
  158. package/dist/core/tokens/parsers/tailwind-v4.d.ts +3 -0
  159. package/dist/core/tokens/parsers/tailwind-v4.d.ts.map +1 -0
  160. package/dist/core/tokens/parsers/tailwind-v4.js +5 -0
  161. package/dist/core/tokens/parsers/tailwind-v4.js.map +1 -0
  162. package/dist/core/tokens/parsers/tokens-studio.d.ts +3 -0
  163. package/dist/core/tokens/parsers/tokens-studio.d.ts.map +1 -0
  164. package/dist/core/tokens/parsers/tokens-studio.js +5 -0
  165. package/dist/core/tokens/parsers/tokens-studio.js.map +1 -0
  166. package/dist/core/tokens/schemas.d.ts +152 -0
  167. package/dist/core/tokens/schemas.d.ts.map +1 -0
  168. package/dist/core/tokens/schemas.js +149 -0
  169. package/dist/core/tokens/schemas.js.map +1 -0
  170. package/dist/core/tokens/transforms/color.d.ts +9 -0
  171. package/dist/core/tokens/transforms/color.d.ts.map +1 -0
  172. package/dist/core/tokens/transforms/color.js +13 -0
  173. package/dist/core/tokens/transforms/color.js.map +1 -0
  174. package/dist/core/tokens/transforms/index.d.ts +36 -0
  175. package/dist/core/tokens/transforms/index.d.ts.map +1 -0
  176. package/dist/core/tokens/transforms/index.js +30 -0
  177. package/dist/core/tokens/transforms/index.js.map +1 -0
  178. package/dist/core/tokens/transforms/size.d.ts +7 -0
  179. package/dist/core/tokens/transforms/size.d.ts.map +1 -0
  180. package/dist/core/tokens/transforms/size.js +8 -0
  181. package/dist/core/tokens/transforms/size.js.map +1 -0
  182. package/dist/core/tokens/types.d.ts +228 -0
  183. package/dist/core/tokens/types.d.ts.map +1 -0
  184. package/dist/core/tokens/types.js +19 -0
  185. package/dist/core/tokens/types.js.map +1 -0
  186. package/dist/core/tokens-tools.d.ts +42 -0
  187. package/dist/core/tokens-tools.d.ts.map +1 -0
  188. package/dist/core/tokens-tools.js +850 -0
  189. package/dist/core/tokens-tools.js.map +1 -0
  190. package/dist/core/types/index.d.ts +0 -8
  191. package/dist/core/types/index.d.ts.map +1 -1
  192. package/dist/core/websocket-connector.d.ts +1 -1
  193. package/dist/core/websocket-connector.d.ts.map +1 -1
  194. package/dist/core/websocket-server.d.ts +4 -3
  195. package/dist/core/websocket-server.d.ts.map +1 -1
  196. package/dist/core/websocket-server.js +5 -55
  197. package/dist/core/websocket-server.js.map +1 -1
  198. package/dist/local.d.ts +0 -12
  199. package/dist/local.d.ts.map +1 -1
  200. package/dist/local.js +959 -3406
  201. package/dist/local.js.map +1 -1
  202. package/figma-desktop-bridge/code.js +11 -63
  203. package/figma-desktop-bridge/ui.html +72 -11
  204. package/package.json +10 -9
  205. package/figma-desktop-bridge/ui-full.html +0 -1353
@@ -0,0 +1,228 @@
1
+ /**
2
+ * Canonical internal token model for figma-console-mcp's token sync engine.
3
+ *
4
+ * Every parser (DTCG, Tokens Studio, CSS vars, Tailwind, etc.) produces this
5
+ * shape. Every formatter (DTCG, CSS vars, Tailwind v4, SCSS, TS, etc.) consumes
6
+ * this shape. Keeps the engine fan-out clean: N parsers + M formatters means
7
+ * N + M modules, not N * M conversion pairs.
8
+ *
9
+ * Aligned with the DTCG (Design Tokens Community Group) W3C spec where
10
+ * possible — see https://tr.designtokens.org/format/ — but the internal model
11
+ * is richer because it carries Figma metadata, multi-mode values per-token,
12
+ * and our $extensions for round-trip ID preservation.
13
+ */
14
+ /**
15
+ * The DTCG-aligned set of token types. Maps directly to `$type` in DTCG output.
16
+ * Composite types (typography, shadow, gradient, etc.) have structured `$value`
17
+ * objects; primitive types have scalar values.
18
+ */
19
+ export type TokenType = "color" | "dimension" | "fontFamily" | "fontWeight" | "duration" | "cubicBezier" | "number" | "string" | "boolean" | "shadow" | "typography" | "gradient" | "border" | "transition" | "strokeStyle";
20
+ /**
21
+ * The DTCG composite token value shapes. Used inside TokenValue.literal when
22
+ * the token type is composite.
23
+ */
24
+ export interface TypographyValue {
25
+ fontFamily: string | string[];
26
+ fontSize: string | number;
27
+ fontWeight: string | number;
28
+ lineHeight?: string | number;
29
+ letterSpacing?: string | number;
30
+ }
31
+ export interface ShadowValue {
32
+ color: string;
33
+ offsetX: string | number;
34
+ offsetY: string | number;
35
+ blur: string | number;
36
+ spread?: string | number;
37
+ inset?: boolean;
38
+ }
39
+ export interface GradientStop {
40
+ color: string;
41
+ position: number;
42
+ }
43
+ export interface GradientValue {
44
+ type: "linear" | "radial" | "conic";
45
+ angle?: number;
46
+ stops: GradientStop[];
47
+ }
48
+ export interface BorderValue {
49
+ color: string;
50
+ width: string | number;
51
+ style: string;
52
+ }
53
+ export interface TransitionValue {
54
+ duration: string | number;
55
+ timingFunction: string | number[];
56
+ delay?: string | number;
57
+ }
58
+ /**
59
+ * A single token value. Either a literal (primitive scalar or composite object)
60
+ * or an alias reference to another token by its dot-path.
61
+ *
62
+ * Examples:
63
+ * { literal: "#4085F2" } // primitive color
64
+ * { reference: "color.primitive.blue.500" } // alias
65
+ * { literal: { fontFamily: "Inter", ... } } // composite typography
66
+ */
67
+ export interface TokenValue {
68
+ literal?: string | number | boolean | TypographyValue | ShadowValue | ShadowValue[] | GradientValue | BorderValue | TransitionValue | Record<string, unknown>;
69
+ reference?: string;
70
+ }
71
+ /**
72
+ * Our vendor namespace inside DTCG $extensions. Survives round-trip through
73
+ * any DTCG-compliant tool that preserves $extensions verbatim (Style
74
+ * Dictionary v4, Tokens Studio, Figma's announced 2026 native export, etc).
75
+ *
76
+ * The presence of `variableId` is what makes diff-aware merge non-destructive:
77
+ * renames on either side don't create duplicates because the ID is the
78
+ * primary match key.
79
+ */
80
+ export interface FigmaMcpExtensions {
81
+ /** Figma variable ID (`VariableID:1234:5678`). Survives renames. */
82
+ variableId?: string;
83
+ /** Figma collection ID. Used to route the variable to the right collection. */
84
+ collectionId?: string;
85
+ /**
86
+ * The value(s) that were synced to/from Figma the last time this tool ran.
87
+ * Used to detect true two-sided conflicts: if BOTH the current Figma value
88
+ * and the current code value differ from this, we don't have a clean winner.
89
+ */
90
+ lastSyncedValue?: Record<string, TokenValue>;
91
+ /** ISO timestamp of the last successful sync for this token. */
92
+ lastSyncedAt?: string;
93
+ }
94
+ /**
95
+ * A single design token in our internal model. Carries enough information to
96
+ * round-trip through Figma without losing identity, name, type, value, modes,
97
+ * description, or vendor extensions.
98
+ */
99
+ export interface Token {
100
+ /**
101
+ * Hierarchical path, e.g. ["color", "primary"] or
102
+ * ["typography", "heading", "1"]. Joined with "/" for display and most
103
+ * output formats. Joined with "." for DTCG alias references.
104
+ */
105
+ path: string[];
106
+ /** DTCG-aligned token type. */
107
+ type: TokenType;
108
+ /** Optional human-readable description (DTCG `$description`). */
109
+ description?: string;
110
+ /**
111
+ * Map of mode name → value. Single-mode tokens have one entry. Multi-mode
112
+ * tokens (typically theme tokens) have one entry per mode.
113
+ *
114
+ * Mode names match the corresponding Figma collection's mode names by
115
+ * default; can be remapped via tokens.config.json's modes.map.
116
+ */
117
+ values: Record<string, TokenValue>;
118
+ /**
119
+ * Vendor extensions. Our own metadata lives under
120
+ * `extensions["figma-console-mcp"]`. We preserve other vendors' extensions
121
+ * verbatim during round-trip (e.g. `studio.tokens` from Tokens Studio).
122
+ */
123
+ extensions?: Record<string, unknown> & {
124
+ "figma-console-mcp"?: FigmaMcpExtensions;
125
+ };
126
+ }
127
+ /**
128
+ * A grouping of related tokens. Maps 1:1 to a Figma variable collection.
129
+ *
130
+ * Examples: a "Primitives" set with raw color/spacing primitives; a "Semantic"
131
+ * set with aliases to primitives; a "Theme" set with light/dark mode values.
132
+ */
133
+ export interface TokenSet {
134
+ /** Display name. Maps to the Figma collection name. */
135
+ name: string;
136
+ description?: string;
137
+ /**
138
+ * Mode names in this set. Single-mode sets use a single mode (typically
139
+ * "Default" or "Value"). Multi-mode sets list each mode (e.g.
140
+ * ["Light", "Dark"]).
141
+ */
142
+ modes: string[];
143
+ tokens: Token[];
144
+ /** Set-level metadata. */
145
+ meta?: {
146
+ /** Figma collection ID. Set on first sync, used as primary match key. */
147
+ figmaCollectionId?: string;
148
+ /**
149
+ * Source files that contributed tokens to this set. Used by formatters
150
+ * that emit one-file-per-set to derive output filenames, and by parsers
151
+ * to track provenance for conflict reporting.
152
+ */
153
+ sourceFiles?: string[];
154
+ };
155
+ }
156
+ /**
157
+ * The top-level container that export produces and import consumes. Holds
158
+ * one or more TokenSets plus file-level metadata.
159
+ */
160
+ export interface TokenDocument {
161
+ /**
162
+ * Format identifier. Helps consumers detect our extended DTCG output
163
+ * (where we stash Figma IDs in $extensions) vs vanilla DTCG.
164
+ */
165
+ $schema?: "https://tr.designtokens.org/format/" | "https://figma-console-mcp.southleft.com/schemas/dtcg-extended-v1.json";
166
+ sets: TokenSet[];
167
+ meta?: {
168
+ /** Figma file key the document was exported from. */
169
+ figmaFileKey?: string;
170
+ /** ISO timestamp the document was generated/parsed. */
171
+ exportedAt?: string;
172
+ /** MCP version that produced/parsed the document. */
173
+ mcpVersion?: string;
174
+ };
175
+ }
176
+ /**
177
+ * The strategies both tools accept. Mirrored on export and import sides for
178
+ * predictability — same name, same semantic, opposite direction.
179
+ */
180
+ export type SyncStrategy = "merge" | "replace" | "dry-run";
181
+ /**
182
+ * How to resolve true two-sided conflicts (both Figma and code changed the
183
+ * same token since last sync).
184
+ */
185
+ export type ConflictResolution =
186
+ /** Surface the conflict to the AI/user, write nothing. */
187
+ "ask"
188
+ /** Figma's value wins, code gets overwritten. */
189
+ | "figma-wins"
190
+ /** Code's value wins, Figma gets overwritten. */
191
+ | "code-wins"
192
+ /** Skip the conflicted token, continue with the rest. */
193
+ | "skip";
194
+ /**
195
+ * Diff result for a single token. Produced by the matcher, consumed by the
196
+ * applier and the dry-run reporter.
197
+ */
198
+ export interface TokenDiff {
199
+ path: string[];
200
+ /** How the match was made — used for diagnostics and conflict explanation. */
201
+ matchedBy: "id" | "path" | "none";
202
+ /** What action the merge engine recommends. */
203
+ action: "create" | "update" | "rename" | "delete" | "no-op" | "conflict" | "preserve-other-side";
204
+ /** The token from the "left" side of the diff (typically Figma on export). */
205
+ before?: Token;
206
+ /** The token from the "right" side of the diff (typically code on export). */
207
+ after?: Token;
208
+ /** For conflicts: the last-synced value that diverged. */
209
+ lastSynced?: Record<string, TokenValue>;
210
+ /** Human-readable reason for the action, used in dry-run output. */
211
+ reason?: string;
212
+ }
213
+ /**
214
+ * Output formats supported by figma_export_tokens. Listed in priority order
215
+ * — earlier formats are the canonical/primary outputs.
216
+ */
217
+ export type ExportFormat = "dtcg" | "tokens-studio" | "css-vars" | "tailwind-v4" | "tailwind-v3" | "scss" | "less" | "ts-module" | "json-flat" | "json-nested" | "style-dictionary-v3";
218
+ /**
219
+ * Input formats supported by figma_import_tokens. `auto` triggers detection
220
+ * from payload structure or file extension.
221
+ */
222
+ export type ImportFormat = "auto" | "dtcg" | "tokens-studio" | "css-vars" | "tailwind-v4" | "tailwind-v3-config" | "scss" | "style-dictionary-v3" | "json-flat" | "json-nested";
223
+ /**
224
+ * Identifier returned in MCP-tagged responses so callers know which vendor
225
+ * extensions namespace to read.
226
+ */
227
+ export declare const FIGMA_MCP_EXTENSION_KEY: "figma-console-mcp";
228
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/tokens/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAEjB,OAAO,GACP,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,aAAa,GACb,QAAQ,GACR,QAAQ,GACR,SAAS,GAET,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,QAAQ,GACR,YAAY,GACZ,aAAa,CAAC;AAElB;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,IAAI,EAA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AAiD;GAC/C,YAAY;AACd,iDAAiD;GAC/C,WAAW;AACb,yDAAyD;GACvD,MAAM,CAAC;AAEX;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,8EAA8E;IAC9E,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,+CAA+C;IAC/C,MAAM,EACF,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,UAAU,GACV,qBAAqB,CAAC;IAC1B,8EAA8E;IAC9E,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,8EAA8E;IAC9E,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAEpB,MAAM,GACN,eAAe,GAEf,UAAU,GACV,aAAa,GACb,aAAa,GACb,MAAM,GACN,MAAM,GAEN,WAAW,GACX,WAAW,GACX,aAAa,GAEb,qBAAqB,CAAC;AAE1B;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,eAAe,GACf,UAAU,GACV,aAAa,GACb,oBAAoB,GACpB,MAAM,GACN,qBAAqB,GACrB,WAAW,GACX,aAAa,CAAC;AAElB;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAG,mBAA4B,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Canonical internal token model for figma-console-mcp's token sync engine.
3
+ *
4
+ * Every parser (DTCG, Tokens Studio, CSS vars, Tailwind, etc.) produces this
5
+ * shape. Every formatter (DTCG, CSS vars, Tailwind v4, SCSS, TS, etc.) consumes
6
+ * this shape. Keeps the engine fan-out clean: N parsers + M formatters means
7
+ * N + M modules, not N * M conversion pairs.
8
+ *
9
+ * Aligned with the DTCG (Design Tokens Community Group) W3C spec where
10
+ * possible — see https://tr.designtokens.org/format/ — but the internal model
11
+ * is richer because it carries Figma metadata, multi-mode values per-token,
12
+ * and our $extensions for round-trip ID preservation.
13
+ */
14
+ /**
15
+ * Identifier returned in MCP-tagged responses so callers know which vendor
16
+ * extensions namespace to read.
17
+ */
18
+ export const FIGMA_MCP_EXTENSION_KEY = "figma-console-mcp";
19
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/tokens/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAiSH;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAA4B,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * MCP tool registrar for figma_export_tokens and figma_import_tokens.
3
+ *
4
+ * Current scope (v1.27.0):
5
+ * - figma_export_tokens: working for DTCG JSON (canonical) and CSS
6
+ * custom properties output. Other formats (Tailwind v4, SCSS, TS
7
+ * module, Tokens Studio, Style Dictionary v3) are scaffolded and
8
+ * return TokenFormatNotImplementedError with a helpful message
9
+ * directing users to DTCG.
10
+ * - figma_import_tokens: working for DTCG JSON input with full
11
+ * diff-aware merge. Apply phase pushes value updates (toUpdate) to
12
+ * Figma via the plugin bridge — verified end-to-end against real
13
+ * multi-mode design systems. toCreate / toDelete / alias-target
14
+ * updates surface in the diff plan but are not yet wired through
15
+ * the apply phase (use figma_setup_design_tokens /
16
+ * figma_batch_create_variables / figma_delete_variable manually for
17
+ * those for now).
18
+ *
19
+ * Both tools auto-discover `tokens.config.json` at the project root and use
20
+ * its source/generated/modes/conflictResolution settings as defaults. They
21
+ * stay zero-arg in normal use.
22
+ */
23
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
24
+ export interface RegisterTokensToolsOptions {
25
+ /**
26
+ * True when registering in Cloud Mode (Cloudflare Workers). In Cloud Mode
27
+ * the MCP server has no local filesystem access, so the tools surface a
28
+ * clear "inline payload required" error instead of letting an fs ENOENT
29
+ * bubble up cryptically. Export still works with explicit content return;
30
+ * import still works with inline payload/files. tokens.config.json
31
+ * autodiscovery, outputPath disk writes, and config-source file reads
32
+ * are all Local Mode only.
33
+ */
34
+ isRemoteMode?: boolean;
35
+ }
36
+ export declare function registerExportTokensTool(server: McpServer, getDesktopConnector: () => Promise<any>, opts?: RegisterTokensToolsOptions): void;
37
+ export declare function registerImportTokensTool(server: McpServer, getDesktopConnector: () => Promise<any>, opts?: RegisterTokensToolsOptions): void;
38
+ /**
39
+ * Convenience: register both tools at once.
40
+ */
41
+ export declare function registerTokensTools(server: McpServer, getDesktopConnector: () => Promise<any>, opts?: RegisterTokensToolsOptions): void;
42
+ //# sourceMappingURL=tokens-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens-tools.d.ts","sourceRoot":"","sources":["../../src/core/tokens-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAWH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA6CzE,MAAM,WAAW,0BAA0B;IACzC;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,EACjB,mBAAmB,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,EACvC,IAAI,GAAE,0BAA+B,GACpC,IAAI,CAyBN;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,EACjB,mBAAmB,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,EACvC,IAAI,GAAE,0BAA+B,GACpC,IAAI,CAyBN;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,mBAAmB,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,EACvC,IAAI,GAAE,0BAA+B,GACpC,IAAI,CAGN"}