@obra-studio/figma-console-mcp 1.32.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 (354) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +879 -0
  3. package/dist/apps/design-system-dashboard/scoring/accessibility.d.ts +14 -0
  4. package/dist/apps/design-system-dashboard/scoring/accessibility.d.ts.map +1 -0
  5. package/dist/apps/design-system-dashboard/scoring/accessibility.js +278 -0
  6. package/dist/apps/design-system-dashboard/scoring/accessibility.js.map +1 -0
  7. package/dist/apps/design-system-dashboard/scoring/component-metadata.d.ts +29 -0
  8. package/dist/apps/design-system-dashboard/scoring/component-metadata.d.ts.map +1 -0
  9. package/dist/apps/design-system-dashboard/scoring/component-metadata.js +358 -0
  10. package/dist/apps/design-system-dashboard/scoring/component-metadata.js.map +1 -0
  11. package/dist/apps/design-system-dashboard/scoring/consistency.d.ts +14 -0
  12. package/dist/apps/design-system-dashboard/scoring/consistency.d.ts.map +1 -0
  13. package/dist/apps/design-system-dashboard/scoring/consistency.js +342 -0
  14. package/dist/apps/design-system-dashboard/scoring/consistency.js.map +1 -0
  15. package/dist/apps/design-system-dashboard/scoring/coverage.d.ts +14 -0
  16. package/dist/apps/design-system-dashboard/scoring/coverage.d.ts.map +1 -0
  17. package/dist/apps/design-system-dashboard/scoring/coverage.js +231 -0
  18. package/dist/apps/design-system-dashboard/scoring/coverage.js.map +1 -0
  19. package/dist/apps/design-system-dashboard/scoring/engine.d.ts +27 -0
  20. package/dist/apps/design-system-dashboard/scoring/engine.d.ts.map +1 -0
  21. package/dist/apps/design-system-dashboard/scoring/engine.js +93 -0
  22. package/dist/apps/design-system-dashboard/scoring/engine.js.map +1 -0
  23. package/dist/apps/design-system-dashboard/scoring/naming-semantics.d.ts +14 -0
  24. package/dist/apps/design-system-dashboard/scoring/naming-semantics.d.ts.map +1 -0
  25. package/dist/apps/design-system-dashboard/scoring/naming-semantics.js +309 -0
  26. package/dist/apps/design-system-dashboard/scoring/naming-semantics.js.map +1 -0
  27. package/dist/apps/design-system-dashboard/scoring/token-architecture.d.ts +14 -0
  28. package/dist/apps/design-system-dashboard/scoring/token-architecture.d.ts.map +1 -0
  29. package/dist/apps/design-system-dashboard/scoring/token-architecture.js +350 -0
  30. package/dist/apps/design-system-dashboard/scoring/token-architecture.js.map +1 -0
  31. package/dist/apps/design-system-dashboard/scoring/types.d.ts +89 -0
  32. package/dist/apps/design-system-dashboard/scoring/types.d.ts.map +1 -0
  33. package/dist/apps/design-system-dashboard/scoring/types.js +41 -0
  34. package/dist/apps/design-system-dashboard/scoring/types.js.map +1 -0
  35. package/dist/apps/design-system-dashboard/server.d.ts +24 -0
  36. package/dist/apps/design-system-dashboard/server.d.ts.map +1 -0
  37. package/dist/apps/design-system-dashboard/server.js +160 -0
  38. package/dist/apps/design-system-dashboard/server.js.map +1 -0
  39. package/dist/apps/token-browser/server.d.ts +26 -0
  40. package/dist/apps/token-browser/server.d.ts.map +1 -0
  41. package/dist/apps/token-browser/server.js +137 -0
  42. package/dist/apps/token-browser/server.js.map +1 -0
  43. package/dist/browser/base.d.ts +58 -0
  44. package/dist/browser/base.d.ts.map +1 -0
  45. package/dist/browser/base.js +6 -0
  46. package/dist/browser/base.js.map +1 -0
  47. package/dist/browser/local.d.ts +87 -0
  48. package/dist/browser/local.d.ts.map +1 -0
  49. package/dist/browser/local.js +318 -0
  50. package/dist/browser/local.js.map +1 -0
  51. package/dist/core/accessibility-tools.d.ts +21 -0
  52. package/dist/core/accessibility-tools.d.ts.map +1 -0
  53. package/dist/core/accessibility-tools.js +307 -0
  54. package/dist/core/accessibility-tools.js.map +1 -0
  55. package/dist/core/annotation-tools.d.ts +14 -0
  56. package/dist/core/annotation-tools.d.ts.map +1 -0
  57. package/dist/core/annotation-tools.js +231 -0
  58. package/dist/core/annotation-tools.js.map +1 -0
  59. package/dist/core/autodocs-tools.d.ts +7 -0
  60. package/dist/core/autodocs-tools.d.ts.map +1 -0
  61. package/dist/core/autodocs-tools.js +195 -0
  62. package/dist/core/autodocs-tools.js.map +1 -0
  63. package/dist/core/comment-tools.d.ts +11 -0
  64. package/dist/core/comment-tools.d.ts.map +1 -0
  65. package/dist/core/comment-tools.js +293 -0
  66. package/dist/core/comment-tools.js.map +1 -0
  67. package/dist/core/config.d.ts +17 -0
  68. package/dist/core/config.d.ts.map +1 -0
  69. package/dist/core/config.js +154 -0
  70. package/dist/core/config.js.map +1 -0
  71. package/dist/core/console-monitor.d.ts +82 -0
  72. package/dist/core/console-monitor.d.ts.map +1 -0
  73. package/dist/core/console-monitor.js +428 -0
  74. package/dist/core/console-monitor.js.map +1 -0
  75. package/dist/core/deep-component-tools.d.ts +14 -0
  76. package/dist/core/deep-component-tools.d.ts.map +1 -0
  77. package/dist/core/deep-component-tools.js +129 -0
  78. package/dist/core/deep-component-tools.js.map +1 -0
  79. package/dist/core/design-code-tools.d.ts +116 -0
  80. package/dist/core/design-code-tools.d.ts.map +1 -0
  81. package/dist/core/design-code-tools.js +2751 -0
  82. package/dist/core/design-code-tools.js.map +1 -0
  83. package/dist/core/design-system-manifest.d.ts +272 -0
  84. package/dist/core/design-system-manifest.d.ts.map +1 -0
  85. package/dist/core/design-system-manifest.js +261 -0
  86. package/dist/core/design-system-manifest.js.map +1 -0
  87. package/dist/core/design-system-tools.d.ts +67 -0
  88. package/dist/core/design-system-tools.d.ts.map +1 -0
  89. package/dist/core/design-system-tools.js +874 -0
  90. package/dist/core/design-system-tools.js.map +1 -0
  91. package/dist/core/diagnose-tool.d.ts +33 -0
  92. package/dist/core/diagnose-tool.d.ts.map +1 -0
  93. package/dist/core/diagnose-tool.js +97 -0
  94. package/dist/core/diagnose-tool.js.map +1 -0
  95. package/dist/core/diff/changelog-formatter.d.ts +35 -0
  96. package/dist/core/diff/changelog-formatter.d.ts.map +1 -0
  97. package/dist/core/diff/changelog-formatter.js +276 -0
  98. package/dist/core/diff/changelog-formatter.js.map +1 -0
  99. package/dist/core/diff/diff-engine.d.ts +127 -0
  100. package/dist/core/diff/diff-engine.d.ts.map +1 -0
  101. package/dist/core/diff/diff-engine.js +335 -0
  102. package/dist/core/diff/diff-engine.js.map +1 -0
  103. package/dist/core/diff/property-compare.d.ts +19 -0
  104. package/dist/core/diff/property-compare.d.ts.map +1 -0
  105. package/dist/core/diff/property-compare.js +37 -0
  106. package/dist/core/diff/property-compare.js.map +1 -0
  107. package/dist/core/diff/version-cache.d.ts +40 -0
  108. package/dist/core/diff/version-cache.d.ts.map +1 -0
  109. package/dist/core/diff/version-cache.js +75 -0
  110. package/dist/core/diff/version-cache.js.map +1 -0
  111. package/dist/core/enrichment/enrichment-service.d.ts +52 -0
  112. package/dist/core/enrichment/enrichment-service.d.ts.map +1 -0
  113. package/dist/core/enrichment/enrichment-service.js +369 -0
  114. package/dist/core/enrichment/enrichment-service.js.map +1 -0
  115. package/dist/core/enrichment/index.d.ts +8 -0
  116. package/dist/core/enrichment/index.d.ts.map +1 -0
  117. package/dist/core/enrichment/index.js +8 -0
  118. package/dist/core/enrichment/index.js.map +1 -0
  119. package/dist/core/enrichment/relationship-mapper.d.ts +106 -0
  120. package/dist/core/enrichment/relationship-mapper.d.ts.map +1 -0
  121. package/dist/core/enrichment/relationship-mapper.js +352 -0
  122. package/dist/core/enrichment/relationship-mapper.js.map +1 -0
  123. package/dist/core/enrichment/style-resolver.d.ts +80 -0
  124. package/dist/core/enrichment/style-resolver.d.ts.map +1 -0
  125. package/dist/core/enrichment/style-resolver.js +327 -0
  126. package/dist/core/enrichment/style-resolver.js.map +1 -0
  127. package/dist/core/figjam-tools.d.ts +8 -0
  128. package/dist/core/figjam-tools.d.ts.map +1 -0
  129. package/dist/core/figjam-tools.js +548 -0
  130. package/dist/core/figjam-tools.js.map +1 -0
  131. package/dist/core/figma-api.d.ts +245 -0
  132. package/dist/core/figma-api.d.ts.map +1 -0
  133. package/dist/core/figma-api.js +446 -0
  134. package/dist/core/figma-api.js.map +1 -0
  135. package/dist/core/figma-connector.d.ts +180 -0
  136. package/dist/core/figma-connector.d.ts.map +1 -0
  137. package/dist/core/figma-connector.js +8 -0
  138. package/dist/core/figma-connector.js.map +1 -0
  139. package/dist/core/figma-desktop-connector.d.ts +312 -0
  140. package/dist/core/figma-desktop-connector.d.ts.map +1 -0
  141. package/dist/core/figma-desktop-connector.js +1298 -0
  142. package/dist/core/figma-desktop-connector.js.map +1 -0
  143. package/dist/core/figma-reconstruction-spec.d.ts +166 -0
  144. package/dist/core/figma-reconstruction-spec.d.ts.map +1 -0
  145. package/dist/core/figma-reconstruction-spec.js +403 -0
  146. package/dist/core/figma-reconstruction-spec.js.map +1 -0
  147. package/dist/core/figma-style-extractor.d.ts +76 -0
  148. package/dist/core/figma-style-extractor.d.ts.map +1 -0
  149. package/dist/core/figma-style-extractor.js +312 -0
  150. package/dist/core/figma-style-extractor.js.map +1 -0
  151. package/dist/core/figma-tools.d.ts +22 -0
  152. package/dist/core/figma-tools.d.ts.map +1 -0
  153. package/dist/core/figma-tools.js +3187 -0
  154. package/dist/core/figma-tools.js.map +1 -0
  155. package/dist/core/identity.d.ts +41 -0
  156. package/dist/core/identity.d.ts.map +1 -0
  157. package/dist/core/identity.js +97 -0
  158. package/dist/core/identity.js.map +1 -0
  159. package/dist/core/library-tools.d.ts +17 -0
  160. package/dist/core/library-tools.d.ts.map +1 -0
  161. package/dist/core/library-tools.js +581 -0
  162. package/dist/core/library-tools.js.map +1 -0
  163. package/dist/core/logger.d.ts +22 -0
  164. package/dist/core/logger.d.ts.map +1 -0
  165. package/dist/core/logger.js +54 -0
  166. package/dist/core/logger.js.map +1 -0
  167. package/dist/core/port-discovery.d.ts +171 -0
  168. package/dist/core/port-discovery.d.ts.map +1 -0
  169. package/dist/core/port-discovery.js +563 -0
  170. package/dist/core/port-discovery.js.map +1 -0
  171. package/dist/core/resolve-package-root.d.ts +2 -0
  172. package/dist/core/resolve-package-root.d.ts.map +1 -0
  173. package/dist/core/resolve-package-root.js +12 -0
  174. package/dist/core/resolve-package-root.js.map +1 -0
  175. package/dist/core/slides-tools.d.ts +8 -0
  176. package/dist/core/slides-tools.d.ts.map +1 -0
  177. package/dist/core/slides-tools.js +715 -0
  178. package/dist/core/slides-tools.js.map +1 -0
  179. package/dist/core/snippet-injector.d.ts +24 -0
  180. package/dist/core/snippet-injector.d.ts.map +1 -0
  181. package/dist/core/snippet-injector.js +97 -0
  182. package/dist/core/snippet-injector.js.map +1 -0
  183. package/dist/core/tokens/alias-resolver.d.ts +55 -0
  184. package/dist/core/tokens/alias-resolver.d.ts.map +1 -0
  185. package/dist/core/tokens/alias-resolver.js +136 -0
  186. package/dist/core/tokens/alias-resolver.js.map +1 -0
  187. package/dist/core/tokens/config.d.ts +87 -0
  188. package/dist/core/tokens/config.d.ts.map +1 -0
  189. package/dist/core/tokens/config.js +285 -0
  190. package/dist/core/tokens/config.js.map +1 -0
  191. package/dist/core/tokens/figma-converter.d.ts +81 -0
  192. package/dist/core/tokens/figma-converter.d.ts.map +1 -0
  193. package/dist/core/tokens/figma-converter.js +196 -0
  194. package/dist/core/tokens/figma-converter.js.map +1 -0
  195. package/dist/core/tokens/formatters/css-vars.d.ts +24 -0
  196. package/dist/core/tokens/formatters/css-vars.d.ts.map +1 -0
  197. package/dist/core/tokens/formatters/css-vars.js +330 -0
  198. package/dist/core/tokens/formatters/css-vars.js.map +1 -0
  199. package/dist/core/tokens/formatters/dtcg.d.ts +28 -0
  200. package/dist/core/tokens/formatters/dtcg.d.ts.map +1 -0
  201. package/dist/core/tokens/formatters/dtcg.js +301 -0
  202. package/dist/core/tokens/formatters/dtcg.js.map +1 -0
  203. package/dist/core/tokens/formatters/index.d.ts +30 -0
  204. package/dist/core/tokens/formatters/index.d.ts.map +1 -0
  205. package/dist/core/tokens/formatters/index.js +46 -0
  206. package/dist/core/tokens/formatters/index.js.map +1 -0
  207. package/dist/core/tokens/formatters/json.d.ts +37 -0
  208. package/dist/core/tokens/formatters/json.d.ts.map +1 -0
  209. package/dist/core/tokens/formatters/json.js +188 -0
  210. package/dist/core/tokens/formatters/json.js.map +1 -0
  211. package/dist/core/tokens/formatters/less.d.ts +4 -0
  212. package/dist/core/tokens/formatters/less.d.ts.map +1 -0
  213. package/dist/core/tokens/formatters/less.js +5 -0
  214. package/dist/core/tokens/formatters/less.js.map +1 -0
  215. package/dist/core/tokens/formatters/scss.d.ts +26 -0
  216. package/dist/core/tokens/formatters/scss.d.ts.map +1 -0
  217. package/dist/core/tokens/formatters/scss.js +253 -0
  218. package/dist/core/tokens/formatters/scss.js.map +1 -0
  219. package/dist/core/tokens/formatters/stubs.d.ts +9 -0
  220. package/dist/core/tokens/formatters/stubs.d.ts.map +1 -0
  221. package/dist/core/tokens/formatters/stubs.js +14 -0
  222. package/dist/core/tokens/formatters/stubs.js.map +1 -0
  223. package/dist/core/tokens/formatters/style-dictionary-v3.d.ts +45 -0
  224. package/dist/core/tokens/formatters/style-dictionary-v3.d.ts.map +1 -0
  225. package/dist/core/tokens/formatters/style-dictionary-v3.js +208 -0
  226. package/dist/core/tokens/formatters/style-dictionary-v3.js.map +1 -0
  227. package/dist/core/tokens/formatters/tailwind-v3.d.ts +37 -0
  228. package/dist/core/tokens/formatters/tailwind-v3.d.ts.map +1 -0
  229. package/dist/core/tokens/formatters/tailwind-v3.js +238 -0
  230. package/dist/core/tokens/formatters/tailwind-v3.js.map +1 -0
  231. package/dist/core/tokens/formatters/tailwind-v4.d.ts +41 -0
  232. package/dist/core/tokens/formatters/tailwind-v4.d.ts.map +1 -0
  233. package/dist/core/tokens/formatters/tailwind-v4.js +331 -0
  234. package/dist/core/tokens/formatters/tailwind-v4.js.map +1 -0
  235. package/dist/core/tokens/formatters/tokens-studio.d.ts +44 -0
  236. package/dist/core/tokens/formatters/tokens-studio.d.ts.map +1 -0
  237. package/dist/core/tokens/formatters/tokens-studio.js +251 -0
  238. package/dist/core/tokens/formatters/tokens-studio.js.map +1 -0
  239. package/dist/core/tokens/formatters/ts-module.d.ts +35 -0
  240. package/dist/core/tokens/formatters/ts-module.d.ts.map +1 -0
  241. package/dist/core/tokens/formatters/ts-module.js +199 -0
  242. package/dist/core/tokens/formatters/ts-module.js.map +1 -0
  243. package/dist/core/tokens/index.d.ts +17 -0
  244. package/dist/core/tokens/index.d.ts.map +1 -0
  245. package/dist/core/tokens/index.js +16 -0
  246. package/dist/core/tokens/index.js.map +1 -0
  247. package/dist/core/tokens/parsers/css-vars.d.ts +3 -0
  248. package/dist/core/tokens/parsers/css-vars.d.ts.map +1 -0
  249. package/dist/core/tokens/parsers/css-vars.js +5 -0
  250. package/dist/core/tokens/parsers/css-vars.js.map +1 -0
  251. package/dist/core/tokens/parsers/dtcg.d.ts +21 -0
  252. package/dist/core/tokens/parsers/dtcg.d.ts.map +1 -0
  253. package/dist/core/tokens/parsers/dtcg.js +254 -0
  254. package/dist/core/tokens/parsers/dtcg.js.map +1 -0
  255. package/dist/core/tokens/parsers/index.d.ts +37 -0
  256. package/dist/core/tokens/parsers/index.d.ts.map +1 -0
  257. package/dist/core/tokens/parsers/index.js +139 -0
  258. package/dist/core/tokens/parsers/index.js.map +1 -0
  259. package/dist/core/tokens/parsers/json.d.ts +4 -0
  260. package/dist/core/tokens/parsers/json.d.ts.map +1 -0
  261. package/dist/core/tokens/parsers/json.js +8 -0
  262. package/dist/core/tokens/parsers/json.js.map +1 -0
  263. package/dist/core/tokens/parsers/scss.d.ts +3 -0
  264. package/dist/core/tokens/parsers/scss.d.ts.map +1 -0
  265. package/dist/core/tokens/parsers/scss.js +5 -0
  266. package/dist/core/tokens/parsers/scss.js.map +1 -0
  267. package/dist/core/tokens/parsers/stubs.d.ts +15 -0
  268. package/dist/core/tokens/parsers/stubs.d.ts.map +1 -0
  269. package/dist/core/tokens/parsers/stubs.js +21 -0
  270. package/dist/core/tokens/parsers/stubs.js.map +1 -0
  271. package/dist/core/tokens/parsers/style-dictionary-v3.d.ts +3 -0
  272. package/dist/core/tokens/parsers/style-dictionary-v3.d.ts.map +1 -0
  273. package/dist/core/tokens/parsers/style-dictionary-v3.js +5 -0
  274. package/dist/core/tokens/parsers/style-dictionary-v3.js.map +1 -0
  275. package/dist/core/tokens/parsers/tailwind-v3.d.ts +3 -0
  276. package/dist/core/tokens/parsers/tailwind-v3.d.ts.map +1 -0
  277. package/dist/core/tokens/parsers/tailwind-v3.js +5 -0
  278. package/dist/core/tokens/parsers/tailwind-v3.js.map +1 -0
  279. package/dist/core/tokens/parsers/tailwind-v4.d.ts +3 -0
  280. package/dist/core/tokens/parsers/tailwind-v4.d.ts.map +1 -0
  281. package/dist/core/tokens/parsers/tailwind-v4.js +5 -0
  282. package/dist/core/tokens/parsers/tailwind-v4.js.map +1 -0
  283. package/dist/core/tokens/parsers/tokens-studio.d.ts +3 -0
  284. package/dist/core/tokens/parsers/tokens-studio.d.ts.map +1 -0
  285. package/dist/core/tokens/parsers/tokens-studio.js +5 -0
  286. package/dist/core/tokens/parsers/tokens-studio.js.map +1 -0
  287. package/dist/core/tokens/schemas.d.ts +31 -0
  288. package/dist/core/tokens/schemas.d.ts.map +1 -0
  289. package/dist/core/tokens/schemas.js +149 -0
  290. package/dist/core/tokens/schemas.js.map +1 -0
  291. package/dist/core/tokens/transforms/color.d.ts +9 -0
  292. package/dist/core/tokens/transforms/color.d.ts.map +1 -0
  293. package/dist/core/tokens/transforms/color.js +13 -0
  294. package/dist/core/tokens/transforms/color.js.map +1 -0
  295. package/dist/core/tokens/transforms/index.d.ts +36 -0
  296. package/dist/core/tokens/transforms/index.d.ts.map +1 -0
  297. package/dist/core/tokens/transforms/index.js +30 -0
  298. package/dist/core/tokens/transforms/index.js.map +1 -0
  299. package/dist/core/tokens/transforms/size.d.ts +7 -0
  300. package/dist/core/tokens/transforms/size.d.ts.map +1 -0
  301. package/dist/core/tokens/transforms/size.js +8 -0
  302. package/dist/core/tokens/transforms/size.js.map +1 -0
  303. package/dist/core/tokens/types.d.ts +228 -0
  304. package/dist/core/tokens/types.d.ts.map +1 -0
  305. package/dist/core/tokens/types.js +19 -0
  306. package/dist/core/tokens/types.js.map +1 -0
  307. package/dist/core/tokens-tools.d.ts +42 -0
  308. package/dist/core/tokens-tools.d.ts.map +1 -0
  309. package/dist/core/tokens-tools.js +860 -0
  310. package/dist/core/tokens-tools.js.map +1 -0
  311. package/dist/core/types/design-code.d.ts +271 -0
  312. package/dist/core/types/design-code.d.ts.map +1 -0
  313. package/dist/core/types/design-code.js +5 -0
  314. package/dist/core/types/design-code.js.map +1 -0
  315. package/dist/core/types/enriched.d.ts +213 -0
  316. package/dist/core/types/enriched.d.ts.map +1 -0
  317. package/dist/core/types/enriched.js +6 -0
  318. package/dist/core/types/enriched.js.map +1 -0
  319. package/dist/core/types/index.d.ts +104 -0
  320. package/dist/core/types/index.d.ts.map +1 -0
  321. package/dist/core/types/index.js +5 -0
  322. package/dist/core/types/index.js.map +1 -0
  323. package/dist/core/variable-resolver.d.ts +45 -0
  324. package/dist/core/variable-resolver.d.ts.map +1 -0
  325. package/dist/core/variable-resolver.js +86 -0
  326. package/dist/core/variable-resolver.js.map +1 -0
  327. package/dist/core/version-tools.d.ts +59 -0
  328. package/dist/core/version-tools.d.ts.map +1 -0
  329. package/dist/core/version-tools.js +1159 -0
  330. package/dist/core/version-tools.js.map +1 -0
  331. package/dist/core/websocket-connector.d.ts +187 -0
  332. package/dist/core/websocket-connector.d.ts.map +1 -0
  333. package/dist/core/websocket-connector.js +378 -0
  334. package/dist/core/websocket-connector.js.map +1 -0
  335. package/dist/core/websocket-server.js +866 -0
  336. package/dist/core/websocket-server.js.map +1 -0
  337. package/dist/core/write-tools.d.ts +7 -0
  338. package/dist/core/write-tools.d.ts.map +1 -0
  339. package/dist/core/write-tools.js +2172 -0
  340. package/dist/core/write-tools.js.map +1 -0
  341. package/dist/local.d.ts +95 -0
  342. package/dist/local.d.ts.map +1 -0
  343. package/dist/local.js +3036 -0
  344. package/dist/local.js.map +1 -0
  345. package/dist/vendor/obra-autodocs/autodocs-body.generated.d.ts +2 -0
  346. package/dist/vendor/obra-autodocs/autodocs-body.generated.d.ts.map +1 -0
  347. package/dist/vendor/obra-autodocs/autodocs-body.generated.js +6 -0
  348. package/dist/vendor/obra-autodocs/autodocs-body.generated.js.map +1 -0
  349. package/figma-desktop-bridge/README.md +365 -0
  350. package/figma-desktop-bridge/code.js +6504 -0
  351. package/figma-desktop-bridge/icon.png +0 -0
  352. package/figma-desktop-bridge/manifest.json +67 -0
  353. package/figma-desktop-bridge/ui.html +2441 -0
  354. package/package.json +98 -0
@@ -0,0 +1,581 @@
1
+ /**
2
+ * Library Tools
3
+ *
4
+ * MCP tools for inspecting components from PUBLISHED shared/team libraries
5
+ * without needing the source library file URL — only a component key
6
+ * (the 40-char hex returned by component search results) is required.
7
+ *
8
+ * Bridges the gap between component discovery (search_design_system /
9
+ * figma_search_components / figma_get_library_components) and full property
10
+ * inspection (componentPropertyDefinitions, variants, visual specs).
11
+ */
12
+ import { z } from "zod";
13
+ import { extractVisualSpec } from "./design-system-tools.js";
14
+ import { createChildLogger } from "./logger.js";
15
+ const logger = createChildLogger({ component: "library-tools" });
16
+ // ============================================================================
17
+ // Helpers
18
+ // ============================================================================
19
+ /**
20
+ * Detect whether a thrown REST error represents an HTTP 404.
21
+ * FigmaAPI.request() throws Error("Figma API error (XXX): body").
22
+ */
23
+ function is404(err) {
24
+ const msg = err instanceof Error ? err.message : String(err);
25
+ return msg.includes("(404)") || /\bNot Found\b/i.test(msg);
26
+ }
27
+ /**
28
+ * Detect missing-token or auth-related errors so we can return a clear hint.
29
+ */
30
+ function isAuthError(err) {
31
+ const msg = err instanceof Error ? err.message : String(err);
32
+ return (msg.includes("FIGMA_ACCESS_TOKEN") ||
33
+ msg.includes("(401)") ||
34
+ msg.includes("(403)") ||
35
+ /Forbidden|Unauthorized/i.test(msg));
36
+ }
37
+ /**
38
+ * Approximate JSON payload size in KB. Cheap — used for adaptive compression.
39
+ */
40
+ function jsonSizeKB(obj) {
41
+ try {
42
+ return JSON.stringify(obj).length / 1024;
43
+ }
44
+ catch {
45
+ return 0;
46
+ }
47
+ }
48
+ // ============================================================================
49
+ // Tool Registration
50
+ // ============================================================================
51
+ export function registerLibraryTools(server, getFigmaAPI) {
52
+ server.tool("figma_get_library_component_by_key", `Get full property definitions, variants, and visual specs for a SINGLE published library component using only its component key.
53
+
54
+ **USE THIS when you have a component key** (the 40-char hex returned by figma_search_components, figma_get_library_components, or search_design_system) **and want to inspect what properties/variants it exposes** before instantiating it — without first needing the source library file's URL.
55
+
56
+ **RESOLVES**: componentKey → file_key + node_id → componentPropertyDefinitions + variants + visualSpec.
57
+
58
+ **WORKFLOW**:
59
+ 1. Pass the componentKey from search results
60
+ 2. Tool tries /v1/component_sets/{key} first (most common case — buttons, inputs with variants)
61
+ 3. On 404 falls back to /v1/components/{key} (standalone components)
62
+ 4. Fetches the parent COMPONENT_SET at depth=2 to read componentPropertyDefinitions and per-variant visual data
63
+ 5. For COMPONENT_SET keys, also fetches the source file's /components list to map each variant's node to its published variant key (needed for figma_instantiate_component)
64
+
65
+ **REQUIRES** FIGMA_ACCESS_TOKEN with library_assets:read and files:read scopes.`, {
66
+ componentKey: z
67
+ .string()
68
+ .min(1)
69
+ .describe("The component key (40-char hex string from search results, e.g., '806826503bbd2ab15d0ff77d076a9406a5a83197'). Works for both COMPONENT_SET and standalone COMPONENT keys."),
70
+ includeVisualSpecs: z
71
+ .boolean()
72
+ .optional()
73
+ .default(true)
74
+ .describe("Include per-variant visual specs (fills, strokes, padding, typography). Default true. Auto-stripped if response exceeds 500KB."),
75
+ format: z
76
+ .enum(["full", "summary"])
77
+ .optional()
78
+ .default("full")
79
+ .describe("'full' returns properties + variants + visual specs. 'summary' returns properties + variant names only (no visualSpec). Auto-downgrades to 'summary' on large responses."),
80
+ }, async ({ componentKey, includeVisualSpecs, format }) => {
81
+ const warnings = [];
82
+ try {
83
+ const api = await getFigmaAPI();
84
+ // ---- Resolve componentKey → meta (try COMPONENT_SET first, fall back to COMPONENT) ----
85
+ let resolvedAs = "COMPONENT_SET";
86
+ let meta;
87
+ try {
88
+ const setResponse = await api.getComponentSetByKey(componentKey);
89
+ meta = setResponse?.meta;
90
+ }
91
+ catch (err) {
92
+ if (!is404(err)) {
93
+ throw err;
94
+ }
95
+ logger.info({ componentKey }, "component_sets/{key} returned 404, falling back to components/{key}");
96
+ try {
97
+ const compResponse = await api.getComponentByKey(componentKey);
98
+ meta = compResponse?.meta;
99
+ resolvedAs = "COMPONENT";
100
+ }
101
+ catch (err2) {
102
+ if (is404(err2)) {
103
+ return {
104
+ content: [
105
+ {
106
+ type: "text",
107
+ text: JSON.stringify({
108
+ _mcp: "figma-console-mcp",
109
+ error: `Component key not found: ${componentKey}`,
110
+ hint: "Verify the key is a published component or component_set key from figma_search_components / search_design_system. Unpublished/draft components are not accessible via this endpoint.",
111
+ componentKey,
112
+ }),
113
+ },
114
+ ],
115
+ isError: true,
116
+ };
117
+ }
118
+ throw err2;
119
+ }
120
+ }
121
+ if (!meta || !meta.file_key || !meta.node_id) {
122
+ return {
123
+ content: [
124
+ {
125
+ type: "text",
126
+ text: JSON.stringify({
127
+ _mcp: "figma-console-mcp",
128
+ error: "Figma REST API returned a response without file_key or node_id.",
129
+ hint: "This may indicate a Figma API change or a malformed component key. Re-check the key with figma_search_components.",
130
+ componentKey,
131
+ }),
132
+ },
133
+ ],
134
+ isError: true,
135
+ };
136
+ }
137
+ const { file_key: fileKey, node_id: nodeId } = meta;
138
+ // ---- Fetch full node tree (depth=2) + optionally the file's components list ----
139
+ // Components list is only needed for COMPONENT_SET keys to map variant
140
+ // node_ids → variant keys (needed for figma_instantiate_component).
141
+ const needsComponentsList = resolvedAs === "COMPONENT_SET";
142
+ const [nodeResponse, componentsResponse] = await Promise.all([
143
+ api.getNodes(fileKey, [nodeId], { depth: 2 }).catch((err) => {
144
+ warnings.push(`getNodes failed: ${err.message}`);
145
+ return null;
146
+ }),
147
+ needsComponentsList
148
+ ? api.getComponents(fileKey).catch((err) => {
149
+ warnings.push(`getComponents (variant key resolution) failed: ${err.message}. Variants will be returned without published keys.`);
150
+ return null;
151
+ })
152
+ : Promise.resolve(null),
153
+ ]);
154
+ const doc = nodeResponse?.nodes?.[nodeId]?.document;
155
+ // ---- Build base response ----
156
+ const response = {
157
+ _mcp: "figma-console-mcp",
158
+ componentKey,
159
+ resolvedAs,
160
+ fileKey,
161
+ nodeId,
162
+ name: meta.name,
163
+ description: meta.description || undefined,
164
+ thumbnail_url: meta.thumbnail_url,
165
+ containing_frame: meta.containing_frame,
166
+ user: meta.user,
167
+ created_at: meta.created_at,
168
+ updated_at: meta.updated_at,
169
+ format,
170
+ usage: {
171
+ instantiate: resolvedAs === "COMPONENT_SET"
172
+ ? "For COMPONENT_SET, pick a VARIANT key from the variants[] array (NOT the top-level componentKey) and pass it to figma_instantiate_component."
173
+ : "For standalone COMPONENT, pass the componentKey directly to figma_instantiate_component.",
174
+ },
175
+ };
176
+ // ---- Extract bounds + visual spec from the document node ----
177
+ if (doc) {
178
+ if (doc.absoluteBoundingBox) {
179
+ response.bounds = {
180
+ width: doc.absoluteBoundingBox.width,
181
+ height: doc.absoluteBoundingBox.height,
182
+ };
183
+ }
184
+ if (includeVisualSpecs && format === "full") {
185
+ const vs = extractVisualSpec(doc);
186
+ if (vs)
187
+ response.visualSpec = vs;
188
+ }
189
+ if (doc.componentPropertyDefinitions) {
190
+ response.properties = doc.componentPropertyDefinitions;
191
+ }
192
+ }
193
+ // ---- Build variants[] for COMPONENT_SET ----
194
+ if (resolvedAs === "COMPONENT_SET") {
195
+ const childComponents = doc?.children?.filter((c) => c.type === "COMPONENT") || [];
196
+ // Map variant node_id -> published key from /components endpoint
197
+ const keyByNodeId = new Map();
198
+ const rawComponents = componentsResponse?.meta?.components || [];
199
+ for (const c of rawComponents) {
200
+ const belongsToThisSet = c.component_set_id === nodeId ||
201
+ c.containing_frame?.nodeId === nodeId ||
202
+ c.containing_frame?.containingComponentSet?.nodeId === nodeId;
203
+ if (belongsToThisSet && c.node_id && c.key) {
204
+ keyByNodeId.set(c.node_id, c.key);
205
+ }
206
+ }
207
+ const variants = childComponents.map((child) => {
208
+ const entry = {
209
+ name: child.name,
210
+ nodeId: child.id,
211
+ };
212
+ const k = keyByNodeId.get(child.id);
213
+ if (k)
214
+ entry.key = k;
215
+ if (includeVisualSpecs && format === "full") {
216
+ const vs = extractVisualSpec(child);
217
+ if (vs)
218
+ entry.visualSpec = vs;
219
+ }
220
+ return entry;
221
+ });
222
+ if (variants.length > 0) {
223
+ response.variants = variants;
224
+ const firstWithKey = variants.find((v) => v.key);
225
+ if (firstWithKey) {
226
+ response.usage.example = `figma_instantiate_component({ componentKey: "${firstWithKey.key}" }) — first variant of "${meta.name}"`;
227
+ }
228
+ }
229
+ }
230
+ else {
231
+ // Standalone COMPONENT — the input key IS the instantiation key
232
+ response.usage.example = `figma_instantiate_component({ componentKey: "${componentKey}" })`;
233
+ }
234
+ // ---- Adaptive compression: if payload exceeds 500KB, strip visual specs ----
235
+ const originalSize = jsonSizeKB(response);
236
+ let finalResponse = response;
237
+ let strippedVisualSpecs = false;
238
+ if (originalSize > 500) {
239
+ strippedVisualSpecs = true;
240
+ const stripped = {
241
+ ...response,
242
+ format: "summary",
243
+ visualSpec: undefined,
244
+ variants: response.variants?.map((v) => ({
245
+ name: v.name,
246
+ nodeId: v.nodeId,
247
+ key: v.key,
248
+ })),
249
+ };
250
+ finalResponse = stripped;
251
+ finalResponse.compression = {
252
+ originalSizeKB: Math.round(originalSize),
253
+ finalSizeKB: Math.round(jsonSizeKB(finalResponse)),
254
+ strippedVisualSpecs: true,
255
+ };
256
+ warnings.push(`Response was ${Math.round(originalSize)}KB — visual specs stripped to fit context. Set includeVisualSpecs=false on next call to skip extraction entirely, or fetch a single variant via getNodes for its visual spec.`);
257
+ }
258
+ if (warnings.length > 0) {
259
+ finalResponse.warnings = warnings;
260
+ }
261
+ return {
262
+ content: [
263
+ {
264
+ type: "text",
265
+ text: JSON.stringify(finalResponse),
266
+ },
267
+ ],
268
+ };
269
+ }
270
+ catch (error) {
271
+ const errorMessage = error instanceof Error ? error.message : String(error);
272
+ logger.error({ error, componentKey }, "figma_get_library_component_by_key failed");
273
+ let hint = "Verify the componentKey is correct (40-char hex from search results) and FIGMA_ACCESS_TOKEN is set.";
274
+ if (isAuthError(error)) {
275
+ hint =
276
+ "Authentication failed. FIGMA_ACCESS_TOKEN must be set with library_assets:read and files:read scopes. Get a token at https://www.figma.com/developers/api#access-tokens";
277
+ }
278
+ else if (errorMessage.includes("(429)") || /Rate/i.test(errorMessage)) {
279
+ hint =
280
+ "Rate limited by Figma API. Wait a moment and retry, or reduce concurrent requests.";
281
+ }
282
+ return {
283
+ content: [
284
+ {
285
+ type: "text",
286
+ text: JSON.stringify({
287
+ _mcp: "figma-console-mcp",
288
+ error: errorMessage,
289
+ hint,
290
+ componentKey,
291
+ }),
292
+ },
293
+ ],
294
+ isError: true,
295
+ };
296
+ }
297
+ });
298
+ }
299
+ // ============================================================================
300
+ // Plugin-API based tools — library variable inspection + import
301
+ // ============================================================================
302
+ //
303
+ // These tools complement the REST-based component tool above by exposing
304
+ // the Figma Plugin API's team-library variable surface. They run via the
305
+ // Desktop Bridge (executeCodeViaUI) because the REST API's variables
306
+ // endpoints are Enterprise-only on most plans, while the Plugin API works
307
+ // on every plan — and crucially, can ONLY see libraries the current file
308
+ // has subscribed via the UI (which is exactly the surface the user wants).
309
+ //
310
+ // Pattern: send a short async script that calls figma.teamLibrary.* /
311
+ // figma.variables.* APIs and returns a plain JSON-serializable result.
312
+ /**
313
+ * JSON-stringify a value safely, returning a fallback on failure.
314
+ * Used inside the Plugin sandbox script to defend against unserializable
315
+ * objects (e.g., live Variable nodes returned by importVariableByKeyAsync).
316
+ */
317
+ function safeKey(value) {
318
+ return JSON.stringify(value);
319
+ }
320
+ export function registerLibraryVariableTools(server, getDesktopConnector) {
321
+ // --------------------------------------------------------------------
322
+ // figma_get_library_variables — list available variables from
323
+ // libraries currently subscribed by the open file.
324
+ // --------------------------------------------------------------------
325
+ server.tool("figma_get_library_variables", `List all variables from team libraries the current file has subscribed.
326
+
327
+ **USE THIS** when you want to see what design tokens (colors, spacing, typography sizes, booleans, strings) are available from shared libraries — without needing the library file's URL or REST API Enterprise plan.
328
+
329
+ **HOW IT WORKS**: Calls figma.teamLibrary.getAvailableLibraryVariableCollectionsAsync() + getVariablesInLibraryCollectionAsync() via the Desktop Bridge. Only libraries the user has explicitly enabled in the current file appear (Figma security model).
330
+
331
+ **WORKFLOW**:
332
+ 1. Call this tool to inventory available library variables
333
+ 2. Find the variable you want (use libraryName + collectionName + variable name to identify)
334
+ 3. Pass its key to figma_import_library_variable to bring it into the current file
335
+ 4. Once imported, the variable's id can be used with figma_set_fills / figma_update_variable / any standard variable-binding tool
336
+
337
+ **Filters**: libraryName/collectionName accept partial case-insensitive matches.
338
+
339
+ **REQUIRES** the Desktop Bridge plugin to be running in Figma Desktop.`, {
340
+ libraryName: z
341
+ .string()
342
+ .optional()
343
+ .describe("Optional: filter by library name (case-insensitive substring match). E.g., 'Northright' or 'Altitude'."),
344
+ collectionName: z
345
+ .string()
346
+ .optional()
347
+ .describe("Optional: filter by collection name within a library (case-insensitive substring match). E.g., 'Colors' or 'Spacing'."),
348
+ resolvedType: z
349
+ .enum(["COLOR", "FLOAT", "STRING", "BOOLEAN"])
350
+ .optional()
351
+ .describe("Optional: filter by variable type. Useful when you only need color tokens or only spacing values."),
352
+ }, async ({ libraryName, collectionName, resolvedType }) => {
353
+ try {
354
+ const connector = await getDesktopConnector();
355
+ // Script runs inside Plugin sandbox; receives no external bindings.
356
+ // Build a result array and return it for the bridge to forward.
357
+ const script = `
358
+ if (!figma.teamLibrary || typeof figma.teamLibrary.getAvailableLibraryVariableCollectionsAsync !== 'function') {
359
+ return { __error: 'figma.teamLibrary API not available. Requires a recent Figma Desktop build.' };
360
+ }
361
+ const collections = await figma.teamLibrary.getAvailableLibraryVariableCollectionsAsync();
362
+ const out = [];
363
+ for (let i = 0; i < collections.length; i++) {
364
+ const coll = collections[i];
365
+ let vars = [];
366
+ try {
367
+ vars = await figma.teamLibrary.getVariablesInLibraryCollectionAsync(coll.key);
368
+ } catch (innerErr) {
369
+ out.push({
370
+ libraryName: coll.libraryName || null,
371
+ collectionKey: coll.key,
372
+ collectionName: coll.name,
373
+ error: innerErr && innerErr.message ? innerErr.message : String(innerErr),
374
+ variables: [],
375
+ variableCount: 0,
376
+ });
377
+ continue;
378
+ }
379
+ out.push({
380
+ libraryName: coll.libraryName || null,
381
+ collectionKey: coll.key,
382
+ collectionName: coll.name,
383
+ variableCount: vars.length,
384
+ variables: vars.map(function(v) {
385
+ return {
386
+ key: v.key,
387
+ name: v.name,
388
+ resolvedType: v.resolvedType,
389
+ };
390
+ }),
391
+ });
392
+ }
393
+ return out;
394
+ `;
395
+ const raw = await connector.executeCodeViaUI(script, 30000);
396
+ // Detect the wrapped-error sentinel
397
+ if (raw && typeof raw === "object" && raw.__error) {
398
+ return {
399
+ content: [
400
+ {
401
+ type: "text",
402
+ text: JSON.stringify({
403
+ _mcp: "figma-console-mcp",
404
+ error: raw.__error,
405
+ hint: "Plugin sandbox could not access the team library API. Ensure Figma Desktop is recent and the Desktop Bridge is connected.",
406
+ }),
407
+ },
408
+ ],
409
+ isError: true,
410
+ };
411
+ }
412
+ let collections = Array.isArray(raw) ? raw : [];
413
+ // Apply server-side filters (cheaper to filter here than in plugin)
414
+ if (libraryName) {
415
+ const needle = libraryName.toLowerCase();
416
+ collections = collections.filter((c) => typeof c.libraryName === "string" &&
417
+ c.libraryName.toLowerCase().includes(needle));
418
+ }
419
+ if (collectionName) {
420
+ const needle = collectionName.toLowerCase();
421
+ collections = collections.filter((c) => typeof c.collectionName === "string" &&
422
+ c.collectionName.toLowerCase().includes(needle));
423
+ }
424
+ if (resolvedType) {
425
+ collections = collections.map((c) => ({
426
+ ...c,
427
+ variables: (c.variables || []).filter((v) => v.resolvedType === resolvedType),
428
+ }));
429
+ collections = collections.filter((c) => c.variables.length > 0);
430
+ // Refresh counts after filtering
431
+ collections.forEach((c) => {
432
+ c.variableCount = c.variables.length;
433
+ });
434
+ }
435
+ const totalVariables = collections.reduce((sum, c) => sum + (c.variableCount || 0), 0);
436
+ return {
437
+ content: [
438
+ {
439
+ type: "text",
440
+ text: JSON.stringify({
441
+ _mcp: "figma-console-mcp",
442
+ summary: {
443
+ totalCollections: collections.length,
444
+ totalVariables,
445
+ },
446
+ filters: {
447
+ libraryName: libraryName || null,
448
+ collectionName: collectionName || null,
449
+ resolvedType: resolvedType || null,
450
+ },
451
+ collections,
452
+ usage: {
453
+ import: "Pick a variable's key from collections[].variables[].key and pass it to figma_import_library_variable to bring it into the current file.",
454
+ note: "Only libraries the current file has explicitly subscribed via the Figma UI are listed. Subscribe a library via Figma > Assets panel > Libraries.",
455
+ },
456
+ }),
457
+ },
458
+ ],
459
+ };
460
+ }
461
+ catch (error) {
462
+ const msg = error instanceof Error ? error.message : String(error);
463
+ logger.error({ error }, "figma_get_library_variables failed");
464
+ return {
465
+ content: [
466
+ {
467
+ type: "text",
468
+ text: JSON.stringify({
469
+ _mcp: "figma-console-mcp",
470
+ error: msg,
471
+ hint: "Ensure the Desktop Bridge plugin is running in Figma Desktop. Run figma_get_status to verify the connection.",
472
+ }),
473
+ },
474
+ ],
475
+ isError: true,
476
+ };
477
+ }
478
+ });
479
+ // --------------------------------------------------------------------
480
+ // figma_import_library_variable — import a single library variable
481
+ // into the current file so it can be bound to nodes.
482
+ // --------------------------------------------------------------------
483
+ server.tool("figma_import_library_variable", `Import a single variable from a subscribed team library into the current file.
484
+
485
+ After import, the variable becomes locally addressable by its returned 'id' and can be passed to any tool that binds variables to nodes (fills, strokes, paddings, etc.). The import is idempotent — calling it twice returns the same local id.
486
+
487
+ **WORKFLOW**:
488
+ 1. Run figma_get_library_variables to find the variable key
489
+ 2. Call this tool with that key
490
+ 3. Use the returned 'id' with figma_set_fills (boundVariables), figma_update_variable, or other binding tools
491
+
492
+ **REQUIRES** the Desktop Bridge plugin and that the source library is subscribed by the current file (otherwise importVariableByKeyAsync rejects).`, {
493
+ variableKey: z
494
+ .string()
495
+ .min(1)
496
+ .describe("The variable key from figma_get_library_variables (collections[].variables[].key). Distinct from the variable's local id."),
497
+ }, async ({ variableKey }) => {
498
+ try {
499
+ const connector = await getDesktopConnector();
500
+ const script = `
501
+ if (!figma.variables || typeof figma.variables.importVariableByKeyAsync !== 'function') {
502
+ return { __error: 'figma.variables.importVariableByKeyAsync not available.' };
503
+ }
504
+ try {
505
+ const imported = await figma.variables.importVariableByKeyAsync(${safeKey(variableKey)});
506
+ if (!imported) {
507
+ return { __error: 'Import returned no variable. The key may be invalid or the source library is not subscribed by this file.' };
508
+ }
509
+ return {
510
+ id: imported.id,
511
+ key: imported.key,
512
+ name: imported.name,
513
+ resolvedType: imported.resolvedType,
514
+ description: imported.description || null,
515
+ variableCollectionId: imported.variableCollectionId,
516
+ remote: imported.remote === true,
517
+ };
518
+ } catch (e) {
519
+ return { __error: (e && e.message) ? e.message : String(e) };
520
+ }
521
+ `;
522
+ const raw = await connector.executeCodeViaUI(script, 20000);
523
+ if (raw && typeof raw === "object" && raw.__error) {
524
+ const errMsg = raw.__error;
525
+ let hint = "Verify the variableKey was returned by figma_get_library_variables and that the source library is subscribed by the current file.";
526
+ if (/not subscribed|not enabled|access/i.test(errMsg)) {
527
+ hint =
528
+ "The library containing this variable is not subscribed by the current file. Subscribe it via Figma > Assets panel > Libraries, then retry.";
529
+ }
530
+ return {
531
+ content: [
532
+ {
533
+ type: "text",
534
+ text: JSON.stringify({
535
+ _mcp: "figma-console-mcp",
536
+ error: errMsg,
537
+ hint,
538
+ variableKey,
539
+ }),
540
+ },
541
+ ],
542
+ isError: true,
543
+ };
544
+ }
545
+ return {
546
+ content: [
547
+ {
548
+ type: "text",
549
+ text: JSON.stringify({
550
+ _mcp: "figma-console-mcp",
551
+ imported: raw,
552
+ usage: {
553
+ bind: `Use the imported variable's id ('${raw?.id}') with figma_set_fills, figma_update_variable, or any other variable-binding tool to reference this token from nodes in the current file.`,
554
+ note: "Variables imported from a library remain linked to their source — updates published from the library will propagate here automatically.",
555
+ },
556
+ }),
557
+ },
558
+ ],
559
+ };
560
+ }
561
+ catch (error) {
562
+ const msg = error instanceof Error ? error.message : String(error);
563
+ logger.error({ error, variableKey }, "figma_import_library_variable failed");
564
+ return {
565
+ content: [
566
+ {
567
+ type: "text",
568
+ text: JSON.stringify({
569
+ _mcp: "figma-console-mcp",
570
+ error: msg,
571
+ hint: "Ensure the Desktop Bridge plugin is running. Run figma_get_status to verify.",
572
+ variableKey,
573
+ }),
574
+ },
575
+ ],
576
+ isError: true,
577
+ };
578
+ }
579
+ });
580
+ }
581
+ //# sourceMappingURL=library-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library-tools.js","sourceRoot":"","sources":["../../src/core/library-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,GAAG,iBAAiB,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC;AA+DjE,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;;GAGG;AACH,SAAS,KAAK,CAAC,GAAY;IAC1B,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7D,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,GAAY;IAChC,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC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CACX,EAAE,KAAK,EAAE,WAAW,EAAE,EACtB,sCAAsC,CACtC,CAAC;YACF,OAAO;gBACN,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACpB,IAAI,EAAE,mBAAmB;4BACzB,KAAK,EAAE,GAAG;4BACV,IAAI,EAAE,8EAA8E;4BACpF,WAAW;yBACX,CAAC;qBACF;iBACD;gBACD,OAAO,EAAE,IAAI;aACb,CAAC;SACF;IACF,CAAC,CACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Logging infrastructure using pino
3
+ */
4
+ import pino from 'pino';
5
+ /**
6
+ * Log levels
7
+ */
8
+ export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
9
+ /**
10
+ * Create logger instance
11
+ * Note: In Cloudflare Workers, console methods are automatically captured
12
+ */
13
+ export declare function createLogger(level?: LogLevel): pino.Logger;
14
+ /**
15
+ * Default logger instance
16
+ */
17
+ export declare const logger: pino.Logger;
18
+ /**
19
+ * Create child logger with additional context
20
+ */
21
+ export declare function createChildLogger(bindings: Record<string, unknown>): pino.Logger;
22
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAE/E;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,GAAE,QAAiB,GAAG,IAAI,CAAC,MAAM,CA4ClE;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,aAAiB,CAAC;AAErC;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAEhF"}