@sarjallab09/figma-intelligence 1.1.0 → 1.2.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 (297) hide show
  1. package/README.md +67 -36
  2. package/dist/bin/cli.js +2 -0
  3. package/dist/design-bridge/bridge.js +2 -0
  4. package/dist/figma-bridge-plugin/bridge-relay.js +2 -0
  5. package/dist/figma-bridge-plugin/code.js +1 -0
  6. package/{figma-bridge-plugin → dist/figma-bridge-plugin}/package-lock.json +0 -3
  7. package/dist/figma-bridge-plugin/ui.html +4970 -0
  8. package/dist/figma-intelligence-layer/dist/index.js +2 -0
  9. package/dist/scripts/clean-existing-chunks.js +2 -0
  10. package/dist/scripts/connect-ai-tool.js +2 -0
  11. package/dist/scripts/convert-hub-pdfs.js +2 -0
  12. package/dist/scripts/figma-mcp-status.js +2 -0
  13. package/dist/scripts/register-codex-mcp.js +2 -0
  14. package/dist/scripts/test-copilot-chat.js +2 -0
  15. package/package.json +11 -8
  16. package/bin/cli.js +0 -859
  17. package/design-bridge/bridge.js +0 -196
  18. package/design-bridge/lib/assets.js +0 -367
  19. package/design-bridge/lib/prompt.js +0 -85
  20. package/design-bridge/lib/server.js +0 -66
  21. package/design-bridge/lib/stitch.js +0 -37
  22. package/design-bridge/lib/tokens.js +0 -82
  23. package/design-bridge/package-lock.json +0 -579
  24. package/figma-bridge-plugin/README.md +0 -97
  25. package/figma-bridge-plugin/anthropic-chat-runner.js +0 -192
  26. package/figma-bridge-plugin/bridge-relay.js +0 -2505
  27. package/figma-bridge-plugin/chat-runner.js +0 -485
  28. package/figma-bridge-plugin/code.js +0 -1534
  29. package/figma-bridge-plugin/codex-runner.js +0 -505
  30. package/figma-bridge-plugin/component-schemas.js +0 -110
  31. package/figma-bridge-plugin/content-context.js +0 -869
  32. package/figma-bridge-plugin/create-button.js +0 -216
  33. package/figma-bridge-plugin/gemini-cli-runner.js +0 -291
  34. package/figma-bridge-plugin/gemini-runner.js +0 -187
  35. package/figma-bridge-plugin/html-to-figma.js +0 -927
  36. package/figma-bridge-plugin/knowledge-hub/.gitkeep +0 -0
  37. package/figma-bridge-plugin/knowledge-hub/uspec-references/anatomy-spec.md +0 -159
  38. package/figma-bridge-plugin/knowledge-hub/uspec-references/api-spec.md +0 -162
  39. package/figma-bridge-plugin/knowledge-hub/uspec-references/color-spec.md +0 -148
  40. package/figma-bridge-plugin/knowledge-hub/uspec-references/full-spec-template.md +0 -314
  41. package/figma-bridge-plugin/knowledge-hub/uspec-references/property-spec.md +0 -175
  42. package/figma-bridge-plugin/knowledge-hub/uspec-references/screen-reader-spec.md +0 -180
  43. package/figma-bridge-plugin/knowledge-hub/uspec-references/structure-spec.md +0 -165
  44. package/figma-bridge-plugin/perplexity-runner.js +0 -188
  45. package/figma-bridge-plugin/references/SKILL.md +0 -178
  46. package/figma-bridge-plugin/references/anatomy-spec.md +0 -159
  47. package/figma-bridge-plugin/references/api-spec.md +0 -162
  48. package/figma-bridge-plugin/references/color-spec.md +0 -148
  49. package/figma-bridge-plugin/references/full-spec-template.md +0 -314
  50. package/figma-bridge-plugin/references/property-spec.md +0 -175
  51. package/figma-bridge-plugin/references/screen-reader-spec.md +0 -180
  52. package/figma-bridge-plugin/references/structure-spec.md +0 -165
  53. package/figma-bridge-plugin/shared-prompt-config.js +0 -645
  54. package/figma-bridge-plugin/spec-helpers/build-table.js +0 -269
  55. package/figma-bridge-plugin/spec-helpers/classify-elements.js +0 -189
  56. package/figma-bridge-plugin/spec-helpers/index.js +0 -35
  57. package/figma-bridge-plugin/spec-helpers/parse-figma-link.js +0 -49
  58. package/figma-bridge-plugin/spec-helpers/position-markers.js +0 -158
  59. package/figma-bridge-plugin/stitch-auth.js +0 -322
  60. package/figma-bridge-plugin/stitch-runner.js +0 -1427
  61. package/figma-bridge-plugin/token-resolver.js +0 -107
  62. package/figma-bridge-plugin/ui.html +0 -4542
  63. package/figma-intelligence-layer/.env.example +0 -39
  64. package/figma-intelligence-layer/docs/local-image-generation.md +0 -60
  65. package/figma-intelligence-layer/examples/comfyui-workflow-template.example.json +0 -101
  66. package/figma-intelligence-layer/jest.config.js +0 -14
  67. package/figma-intelligence-layer/mcp-config.json +0 -19
  68. package/figma-intelligence-layer/package-lock.json +0 -5892
  69. package/figma-intelligence-layer/scripts/setup-comfyui-local.sh +0 -67
  70. package/figma-intelligence-layer/scripts/start-comfyui.sh +0 -33
  71. package/figma-intelligence-layer/src/index.ts +0 -2233
  72. package/figma-intelligence-layer/src/shared/auto-layout-validator.ts +0 -404
  73. package/figma-intelligence-layer/src/shared/cache.ts +0 -187
  74. package/figma-intelligence-layer/src/shared/color-operations.ts +0 -533
  75. package/figma-intelligence-layer/src/shared/color-utils.ts +0 -138
  76. package/figma-intelligence-layer/src/shared/component-script-builder.ts +0 -413
  77. package/figma-intelligence-layer/src/shared/component-templates.ts +0 -2767
  78. package/figma-intelligence-layer/src/shared/concept-taxonomy.ts +0 -694
  79. package/figma-intelligence-layer/src/shared/decision-log.ts +0 -128
  80. package/figma-intelligence-layer/src/shared/design-system-context.ts +0 -568
  81. package/figma-intelligence-layer/src/shared/design-system-intelligence.ts +0 -131
  82. package/figma-intelligence-layer/src/shared/design-system-matcher.ts +0 -184
  83. package/figma-intelligence-layer/src/shared/design-system-normalizers.ts +0 -196
  84. package/figma-intelligence-layer/src/shared/design-system-tokens.ts +0 -295
  85. package/figma-intelligence-layer/src/shared/dtcg-validator.ts +0 -530
  86. package/figma-intelligence-layer/src/shared/enrichment-pipeline.ts +0 -671
  87. package/figma-intelligence-layer/src/shared/figma-bridge.ts +0 -1418
  88. package/figma-intelligence-layer/src/shared/font-config.ts +0 -126
  89. package/figma-intelligence-layer/src/shared/icon-catalog.ts +0 -360
  90. package/figma-intelligence-layer/src/shared/icon-fetch.ts +0 -80
  91. package/figma-intelligence-layer/src/shared/prototype-script-builder.ts +0 -162
  92. package/figma-intelligence-layer/src/shared/response-compression.ts +0 -440
  93. package/figma-intelligence-layer/src/shared/semantic-token-catalog.ts +0 -324
  94. package/figma-intelligence-layer/src/shared/token-binder.ts +0 -505
  95. package/figma-intelligence-layer/src/shared/token-math.ts +0 -427
  96. package/figma-intelligence-layer/src/shared/token-naming.ts +0 -468
  97. package/figma-intelligence-layer/src/shared/token-utils.ts +0 -420
  98. package/figma-intelligence-layer/src/shared/types.ts +0 -346
  99. package/figma-intelligence-layer/src/shared/typography-presets.ts +0 -94
  100. package/figma-intelligence-layer/src/shared/unsplash.ts +0 -165
  101. package/figma-intelligence-layer/src/shared/vision-client.ts +0 -607
  102. package/figma-intelligence-layer/src/shared/vision-provider-anthropic.ts +0 -334
  103. package/figma-intelligence-layer/src/shared/vision-provider-openai.ts +0 -446
  104. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-handler.ts +0 -782
  105. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-renderer.ts +0 -496
  106. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotation-kit.ts +0 -230
  107. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/colorblind-sim.ts +0 -66
  108. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/index.ts +0 -810
  109. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-analyzer.ts +0 -1191
  110. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-figma-page.ts +0 -1346
  111. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-handler.ts +0 -148
  112. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-figma-page.ts +0 -499
  113. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-report.ts +0 -910
  114. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-checker.ts +0 -989
  115. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-criteria.ts +0 -1160
  116. package/figma-intelligence-layer/src/tools/phase1-vision/design-from-ref/index.ts +0 -424
  117. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/component-recognizer.ts +0 -38
  118. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/ds-matcher.ts +0 -111
  119. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/font-matcher.ts +0 -114
  120. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/icon-resolver.ts +0 -103
  121. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/index.ts +0 -1060
  122. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/layout-segmenter.ts +0 -18
  123. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/token-inferencer.ts +0 -39
  124. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/vision-pipeline.ts +0 -58
  125. package/figma-intelligence-layer/src/tools/phase1-vision/sketch-to-design/index.ts +0 -298
  126. package/figma-intelligence-layer/src/tools/phase1-vision/visual-audit/index.ts +0 -197
  127. package/figma-intelligence-layer/src/tools/phase2-accuracy/component-audit/index.ts +0 -494
  128. package/figma-intelligence-layer/src/tools/phase2-accuracy/intent-translator/index.ts +0 -356
  129. package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/container-patterns.ts +0 -123
  130. package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/index.ts +0 -663
  131. package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/built-in-rules.yaml +0 -56
  132. package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/index.ts +0 -614
  133. package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/rule-engine.ts +0 -113
  134. package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/color-theory.ts +0 -178
  135. package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/index.ts +0 -470
  136. package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/index.ts +0 -429
  137. package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/token-override-maps.ts +0 -226
  138. package/figma-intelligence-layer/src/tools/phase3-generation/ai-image-insert/index.ts +0 -535
  139. package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/index.ts +0 -660
  140. package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/pattern-fingerprints.ts +0 -209
  141. package/figma-intelligence-layer/src/tools/phase3-generation/composition-builder/index.ts +0 -540
  142. package/figma-intelligence-layer/src/tools/phase3-generation/figma-animated-build.ts +0 -391
  143. package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/index.ts +0 -2019
  144. package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/screen-templates.ts +0 -131
  145. package/figma-intelligence-layer/src/tools/phase3-generation/prototype-map/index.ts +0 -381
  146. package/figma-intelligence-layer/src/tools/phase3-generation/prototype-wire/index.ts +0 -565
  147. package/figma-intelligence-layer/src/tools/phase3-generation/swarm-build/index.ts +0 -764
  148. package/figma-intelligence-layer/src/tools/phase3-generation/system-drift/index.ts +0 -535
  149. package/figma-intelligence-layer/src/tools/phase3-generation/unsplash-search/index.ts +0 -84
  150. package/figma-intelligence-layer/src/tools/phase3-generation/url-to-frame/index.ts +0 -401
  151. package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/css-animations.ts +0 -68
  152. package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/framer-motion.ts +0 -78
  153. package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/swift-animations.ts +0 -93
  154. package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/index.ts +0 -596
  155. package/figma-intelligence-layer/src/tools/phase4-sync/ci-check/index.ts +0 -462
  156. package/figma-intelligence-layer/src/tools/phase4-sync/export-tokens/index.ts +0 -1470
  157. package/figma-intelligence-layer/src/tools/phase4-sync/generate-component-code/index.ts +0 -829
  158. package/figma-intelligence-layer/src/tools/phase4-sync/handoff-spec/index.ts +0 -702
  159. package/figma-intelligence-layer/src/tools/phase4-sync/icon-library-sync/index.ts +0 -483
  160. package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/index.ts +0 -501
  161. package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/storybook-parser.ts +0 -106
  162. package/figma-intelligence-layer/src/tools/phase4-sync/watch-docs/index.ts +0 -676
  163. package/figma-intelligence-layer/src/tools/phase4-sync/webhook-listener/index.ts +0 -560
  164. package/figma-intelligence-layer/src/tools/phase5-governance/apg-doc/index.ts +0 -1043
  165. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/component-detection.ts +0 -620
  166. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/anatomy.ts +0 -331
  167. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/color-tokens.ts +0 -77
  168. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/properties.ts +0 -54
  169. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/snapshot.ts +0 -287
  170. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/spacing.ts +0 -71
  171. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/states.ts +0 -43
  172. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/typography.ts +0 -71
  173. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/index.ts +0 -221
  174. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/_default.ts +0 -166
  175. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/accordion.ts +0 -232
  176. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/alert.ts +0 -234
  177. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar-group.ts +0 -270
  178. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar.ts +0 -249
  179. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/badge.ts +0 -231
  180. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/banner.ts +0 -293
  181. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/breadcrumb.ts +0 -240
  182. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/button.ts +0 -243
  183. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/calendar.ts +0 -307
  184. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/card.ts +0 -143
  185. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/checkbox.ts +0 -227
  186. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/chip.ts +0 -233
  187. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/combobox.ts +0 -282
  188. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/datepicker.ts +0 -276
  189. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/divider.ts +0 -223
  190. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/drawer.ts +0 -255
  191. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/dropdown-menu.ts +0 -289
  192. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/empty-state.ts +0 -261
  193. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/file-uploader.ts +0 -290
  194. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/form.ts +0 -265
  195. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/grid.ts +0 -238
  196. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/icon.ts +0 -255
  197. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/index.ts +0 -128
  198. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-edit.ts +0 -286
  199. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-message.ts +0 -255
  200. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/input.ts +0 -330
  201. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/link.ts +0 -247
  202. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/list.ts +0 -250
  203. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/menu.ts +0 -247
  204. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/modal.ts +0 -144
  205. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navbar.ts +0 -264
  206. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navigation.ts +0 -251
  207. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/number-input.ts +0 -261
  208. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/pagination.ts +0 -248
  209. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/popover.ts +0 -270
  210. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/progress.ts +0 -251
  211. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/radio.ts +0 -142
  212. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/range-slider.ts +0 -282
  213. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/rating.ts +0 -250
  214. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/search.ts +0 -258
  215. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/segmented-control.ts +0 -265
  216. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/select.ts +0 -319
  217. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/skeleton.ts +0 -256
  218. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/slider.ts +0 -232
  219. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/spinner.ts +0 -239
  220. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/status-dot.ts +0 -252
  221. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/stepper.ts +0 -270
  222. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/table.ts +0 -244
  223. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tabs.ts +0 -143
  224. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tag.ts +0 -243
  225. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/textarea.ts +0 -259
  226. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/time-picker.ts +0 -293
  227. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toast.ts +0 -144
  228. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toggle.ts +0 -289
  229. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toolbar.ts +0 -267
  230. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tooltip.ts +0 -232
  231. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/treeview.ts +0 -257
  232. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/typography.ts +0 -319
  233. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/legacy-compat.ts +0 -121
  234. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/anatomy-diagram.ts +0 -430
  235. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/figma-page.ts +0 -312
  236. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/json.ts +0 -129
  237. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/markdown.ts +0 -78
  238. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/visual-doc.ts +0 -2333
  239. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/accessibility.ts +0 -100
  240. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/anatomy.ts +0 -32
  241. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/color-tokens.ts +0 -59
  242. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/content-guidance.ts +0 -18
  243. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/design-tokens.ts +0 -53
  244. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/interaction-rules.ts +0 -19
  245. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/overview.ts +0 -91
  246. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/properties-api.ts +0 -71
  247. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/qa-criteria.ts +0 -19
  248. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/related-components.ts +0 -110
  249. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/responsive.ts +0 -19
  250. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/size-specs.ts +0 -67
  251. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/spacing-structure.ts +0 -58
  252. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/state-specs.ts +0 -79
  253. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/states.ts +0 -50
  254. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/type-hierarchy.ts +0 -33
  255. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/typography.ts +0 -55
  256. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/usage-guidelines.ts +0 -73
  257. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/variants.ts +0 -81
  258. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/types.ts +0 -409
  259. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/index.ts +0 -198
  260. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/renderer.ts +0 -701
  261. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/types.ts +0 -88
  262. package/figma-intelligence-layer/src/tools/phase5-governance/decision-log/index.ts +0 -135
  263. package/figma-intelligence-layer/src/tools/phase5-governance/design-decision-log/index.ts +0 -491
  264. package/figma-intelligence-layer/src/tools/phase5-governance/ds-primitives/index.ts +0 -416
  265. package/figma-intelligence-layer/src/tools/phase5-governance/ds-scaffolder/index.ts +0 -722
  266. package/figma-intelligence-layer/src/tools/phase5-governance/ds-variables/index.ts +0 -449
  267. package/figma-intelligence-layer/src/tools/phase5-governance/health-report/index.ts +0 -393
  268. package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/index.ts +0 -406
  269. package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/figma-page.ts +0 -292
  270. package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/json.ts +0 -24
  271. package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/markdown.ts +0 -172
  272. package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/naming-guide.ts +0 -409
  273. package/figma-intelligence-layer/src/tools/phase5-governance/token-analytics/index.ts +0 -594
  274. package/figma-intelligence-layer/src/tools/phase5-governance/token-docs/index.ts +0 -710
  275. package/figma-intelligence-layer/src/tools/phase5-governance/token-migrate/index.ts +0 -458
  276. package/figma-intelligence-layer/src/tools/phase5-governance/token-naming/index.ts +0 -134
  277. package/figma-intelligence-layer/tests/apg-doc.test.ts +0 -101
  278. package/figma-intelligence-layer/tests/design-system-context.test.ts +0 -152
  279. package/figma-intelligence-layer/tests/design-system-matcher.test.ts +0 -144
  280. package/figma-intelligence-layer/tests/figma-bridge.test.ts +0 -83
  281. package/figma-intelligence-layer/tests/generate-image-and-insert.test.ts +0 -56
  282. package/figma-intelligence-layer/tests/screen-cloner-regression.test.ts +0 -69
  283. package/figma-intelligence-layer/tests/smoke.test.ts +0 -174
  284. package/figma-intelligence-layer/tests/spec-generator.test.ts +0 -127
  285. package/figma-intelligence-layer/tests/token-migrate.test.ts +0 -21
  286. package/figma-intelligence-layer/tests/token-naming.test.ts +0 -30
  287. package/figma-intelligence-layer/tsconfig.json +0 -19
  288. package/scripts/clean-existing-chunks.js +0 -179
  289. package/scripts/connect-ai-tool.js +0 -490
  290. package/scripts/convert-hub-pdfs.js +0 -425
  291. package/scripts/figma-mcp-status.js +0 -349
  292. package/scripts/register-codex-mcp.js +0 -96
  293. /package/{design-bridge → dist/design-bridge}/.env.example +0 -0
  294. /package/{design-bridge → dist/design-bridge}/package.json +0 -0
  295. /package/{figma-bridge-plugin → dist/figma-bridge-plugin}/manifest.json +0 -0
  296. /package/{figma-bridge-plugin → dist/figma-bridge-plugin}/package.json +0 -0
  297. /package/{figma-intelligence-layer → dist/figma-intelligence-layer}/package.json +0 -0
@@ -1,165 +0,0 @@
1
- # Structure Spec Reference
2
-
3
- Generate dimensional properties documentation — spacing, padding, heights, widths, and gaps across size and density variants.
4
-
5
- ## What This Spec Produces
6
-
7
- 1. **Dimension tables** — Organized by component section (container, leading, labels, trailing)
8
- 2. **Size/density columns** — Values shown across all variants so engineers see how dimensions change
9
- 3. **Token references** — Values linked to design tokens when bound to variables
10
- 4. **Composition mapping** — How parent sizes map to sub-component sizes
11
-
12
- ---
13
-
14
- ## Step-by-Step Pipeline
15
-
16
- ### Phase 1: Identify Dimensional Axes
17
-
18
- Determine which variant axes and variable modes affect dimensions:
19
-
20
- **Common dimensional axes:**
21
- - **Size**: Large, Medium, Small, XSmall → changes heights, padding, icon sizes, font sizes
22
- - **Density**: Compact, Default, Spacious → changes vertical padding, gaps
23
- - **Shape**: Rounded, Square, Pill → changes border-radius (not spacing, but sometimes affects padding)
24
-
25
- Read from two sources:
26
- 1. Variant axes from component set variants
27
- 2. Variable mode collections (density, size often come from variable modes)
28
-
29
- ### Phase 2: Extract Measurements (Deterministic)
30
-
31
- For each dimensional variant combination, measure the component:
32
-
33
- ```
34
- // For each size/density variant:
35
- get_node_dimensions(instance_id) → {
36
- width, height,
37
- paddingTop, paddingBottom, paddingLeft, paddingRight,
38
- itemSpacing, // gap between children in auto-layout
39
- counterAxisSpacing, // gap in the cross-axis (if wrap)
40
- borderRadius,
41
- strokeWeight
42
- }
43
- ```
44
-
45
- Traverse child layers and measure each section:
46
- ```
47
- Container
48
- ├── Leading Content → width, height, gap from label section
49
- │ └── Icon/Avatar → width, height
50
- ├── Label Section → vertical layout
51
- │ ├── Primary Label → fontSize, lineHeight
52
- │ ├── Secondary Label → fontSize, lineHeight
53
- │ └── Gap between labels
54
- ├── Trailing Content → width, height
55
- │ └── Icon/Button → width, height
56
- └── Internal gaps between all sections
57
- ```
58
-
59
- **Token resolution**: For each measured value, check if it's bound to a variable:
60
- ```
61
- get_bound_variables(node_id, "paddingLeft") → "spacing/component/md" (16)
62
- get_bound_variables(node_id, "height") → "sizing/button/lg" (56)
63
- ```
64
-
65
- Report as: `token-name (resolved-value)` e.g., `spacing-md (16)` or just the raw number if hardcoded.
66
-
67
- ### Phase 3: Plan Documentation Sections (AI Reasoning)
68
-
69
- Group measurements into logical sections based on the component's structure:
70
-
71
- | Section | What to Document |
72
- |---------|-----------------|
73
- | **Container** | Height, min-width, max-width, border-radius, stroke-weight |
74
- | **Padding** | Top, bottom, left, right (or horizontal/vertical if symmetric) |
75
- | **Internal Gaps** | Spacing between leading→labels, labels→trailing, label→sublabel |
76
- | **Leading Content** | Icon/avatar dimensions, gap from content |
77
- | **Labels** | Font sizes, line heights (note: these may go in a Typography spec instead) |
78
- | **Trailing Content** | Button/icon dimensions, gap from content |
79
- | **Touch Target** | Minimum touch area if different from visual bounds |
80
-
81
- **Section planning rules:**
82
- - Only create sections for parts that exist in the component
83
- - If a section has identical values across all variants, collapse it into a single-column note
84
- - If values vary across density but not size (or vice versa), use the varying axis as columns
85
- - Add a "Design Intent" note for non-obvious values (e.g., "Min-width ensures the button is tappable even with a single character label")
86
-
87
- ### Phase 4: Render the Documentation Frame
88
-
89
- ```
90
- Main Frame (1440px wide, auto-layout vertical, padding 60px, gap 40px)
91
- ├── Header Section
92
- │ ├── Title: "[Component Name] — Structure" (24px bold)
93
- │ └── Subtitle: "Dimensions, spacing, and padding reference" (14px, #6B7280)
94
-
95
- ├── Section: "Container"
96
- │ ├── Section Header (18px bold)
97
- │ └── Table:
98
- │ Header: Property | Large | Medium | Small | XSmall
99
- │ Row: Height | sizing-lg (56) | sizing-md (48) | sizing-sm (40) | sizing-xs (32)
100
- │ Row: Border Radius | radius-md (8) | radius-md (8) | radius-sm (6) | radius-sm (6)
101
- │ Row: Stroke | 1 | 1 | 1 | 1
102
-
103
- ├── Section: "Padding"
104
- │ └── Table:
105
- │ Header: Property | Large | Medium | Small | XSmall
106
- │ Row: Horizontal | spacing-lg (24) | spacing-md (16) | spacing-sm (12) | spacing-xs (8)
107
- │ Row: Vertical | spacing-md (16) | spacing-sm (12) | spacing-xs (8) | spacing-2xs (4)
108
-
109
- ├── Section: "Leading Content"
110
- │ └── Table:
111
- │ Header: Property | Large | Medium | Small | XSmall
112
- │ Row: Icon Size | 24 | 24 | 20 | 16
113
- │ Row: Gap to Labels | spacing-sm (12) | spacing-sm (12) | spacing-xs (8) | spacing-xs (8)
114
-
115
- ├── Section: "Composition Mapping" (if component contains sub-components with their own sizes)
116
- │ └── Table:
117
- │ Header: Parent Size | Icon Size | Badge Size
118
- │ Row: Large | Medium | Small
119
- │ Row: Medium | Small | XSmall
120
- │ Row: Small | XSmall | —
121
-
122
- └── Notes Section (optional)
123
- └── Design intent notes, edge cases, responsive behavior
124
- ```
125
-
126
- **Table formatting for structure specs:**
127
- - Values with tokens: Show as `token-name (value)` e.g., `spacing-md (16)`
128
- - Hardcoded values: Show as plain number e.g., `16`
129
- - Units: Always in pixels (px), but omit the "px" suffix in tables for cleanliness
130
- - Identical values across columns: Show the value (don't use "—" for same values in structure specs; engineers need explicit numbers)
131
-
132
- ### Phase 5: Validate
133
-
134
- Checklist:
135
- - [ ] All size/density variants are represented as columns
136
- - [ ] Container dimensions are documented (height, width constraints, border-radius)
137
- - [ ] Padding values are documented (all four sides or horizontal/vertical)
138
- - [ ] Internal gaps between sections are documented
139
- - [ ] Sub-component dimensions are documented
140
- - [ ] Token names match actual Figma variable names
141
- - [ ] Resolved values match actual measured pixel values
142
- - [ ] Composition mapping exists for nested size relationships
143
-
144
- ---
145
-
146
- ## Density vs. Size
147
-
148
- **Size** changes the overall scale: heights, icon dimensions, padding, font sizes, and minimum widths all change together.
149
-
150
- **Density** changes only vertical rhythm: vertical padding and gaps change, but heights, icon sizes, and horizontal values stay the same.
151
-
152
- If both axes exist, render size as primary columns and density as separate table sections:
153
- ```
154
- ## Container — Default Density
155
- Property | Large | Medium | Small
156
- Height | 56 | 48 | 40
157
-
158
- ## Container — Compact Density
159
- Property | Large | Medium | Small
160
- Height | 48 | 40 | 32
161
-
162
- ## Container — Spacious Density
163
- Property | Large | Medium | Small
164
- Height | 64 | 56 | 48
165
- ```
@@ -1,188 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * perplexity-runner.js — Streams a chat response from the Perplexity API.
4
- * Emits the same event shape as chat-runner.js so bridge-relay can use either.
5
- *
6
- * Perplexity is a research-only provider (chat mode only, no Figma tool execution).
7
- */
8
-
9
- const https = require("https");
10
- const { EventEmitter } = require("events");
11
-
12
- // Perplexity model IDs — all are search-grounded
13
- const MODEL_MAP = {
14
- "sonar": "sonar",
15
- "sonar-pro": "sonar-pro",
16
- "sonar-reasoning": "sonar-reasoning",
17
- "sonar-reasoning-pro": "sonar-reasoning-pro",
18
- };
19
-
20
- const SYSTEM_PROMPT = `You are a research assistant embedded in a Figma design plugin. Help users research design patterns, UI/UX best practices, accessibility guidelines, competitive analysis, typography, color theory, design systems, and any other topics. Provide thorough, well-sourced answers. Be concise but comprehensive.`;
21
-
22
- /**
23
- * Convert the plugin's conversation array to OpenAI-format messages.
24
- */
25
- function buildMessages(systemPrompt, conversation, userMessage) {
26
- const messages = [{ role: "system", content: systemPrompt }];
27
-
28
- if (Array.isArray(conversation)) {
29
- for (const entry of conversation) {
30
- if (!entry || !entry.text) continue;
31
- if (entry.role === "user" || entry.role === "assistant") {
32
- messages.push({ role: entry.role, content: entry.text });
33
- }
34
- }
35
- }
36
-
37
- messages.push({ role: "user", content: userMessage });
38
- return messages;
39
- }
40
-
41
- /**
42
- * Spawn a Perplexity streaming chat request.
43
- * Returns an EventEmitter-like object with a .kill() method.
44
- */
45
- function runPerplexity({ message, attachments, conversation, requestId, apiKey, model, onEvent }) {
46
- const emitter = new EventEmitter();
47
-
48
- // Process text attachments inline
49
- let extraText = "";
50
- for (const att of (attachments || [])) {
51
- if (!att?.data) continue;
52
- if (att.isImage) {
53
- const label = att.name || "image";
54
- extraText += `\n\n[Image attached: ${label}] (image analysis not available with Perplexity)`;
55
- } else {
56
- const label = att.name ? `\n\n--- Attached: ${att.name} ---\n` : "\n\n--- Attached file ---\n";
57
- extraText += label + att.data;
58
- }
59
- }
60
-
61
- const userText = ((message || "").trim() || "Help me with my research.") + extraText;
62
- const resolvedModel = MODEL_MAP[model] || "sonar-pro";
63
- const messages = buildMessages(SYSTEM_PROMPT, conversation, userText);
64
-
65
- const bodyObj = {
66
- model: resolvedModel,
67
- stream: true,
68
- messages,
69
- };
70
- const body = JSON.stringify(bodyObj);
71
-
72
- let aborted = false;
73
- let req = null;
74
-
75
- // Emit phase indicator
76
- onEvent({ type: "phase_start", id: requestId, phase: `Researching · ${resolvedModel}` });
77
-
78
- function abort() {
79
- aborted = true;
80
- if (req) { try { req.destroy(); } catch {} }
81
- emitter.emit("close", null);
82
- }
83
-
84
- try {
85
- req = https.request(
86
- {
87
- hostname: "api.perplexity.ai",
88
- path: "/chat/completions",
89
- method: "POST",
90
- headers: {
91
- "Content-Type": "application/json",
92
- "Authorization": `Bearer ${apiKey}`,
93
- "Content-Length": Buffer.byteLength(body),
94
- },
95
- },
96
- (res) => {
97
- if (res.statusCode !== 200) {
98
- let errBody = "";
99
- res.on("data", (d) => { errBody += d.toString(); });
100
- res.on("end", () => {
101
- let msg = errBody;
102
- try { msg = JSON.parse(errBody).error?.message || errBody; } catch {}
103
- onEvent({ type: "error", id: requestId, error: `Perplexity: ${msg}` });
104
- onEvent({ type: "done", id: requestId, fullText: "" });
105
- emitter.emit("close", 1);
106
- });
107
- return;
108
- }
109
-
110
- let buffer = "";
111
- let fullText = "";
112
- let previousText = "";
113
- let citations = null;
114
-
115
- res.on("data", (chunk) => {
116
- if (aborted) return;
117
- buffer += chunk.toString();
118
- const lines = buffer.split("\n");
119
- buffer = lines.pop() || "";
120
-
121
- for (const line of lines) {
122
- if (!line.startsWith("data: ")) continue;
123
- const data = line.slice(6).trim();
124
-
125
- // OpenAI-compatible sentinel
126
- if (data === "[DONE]") continue;
127
-
128
- try {
129
- const parsed = JSON.parse(data);
130
-
131
- // Extract citations if present (usually in the final chunk)
132
- if (parsed.citations && Array.isArray(parsed.citations)) {
133
- citations = parsed.citations;
134
- }
135
-
136
- // Perplexity sends cumulative content — diff to get delta
137
- const content = parsed.choices?.[0]?.delta?.content;
138
- if (content) {
139
- fullText += content;
140
- onEvent({ type: "text_delta", id: requestId, delta: content });
141
- }
142
- } catch {}
143
- }
144
- });
145
-
146
- res.on("end", () => {
147
- if (!aborted) {
148
- // Emit citations if present
149
- if (citations && citations.length > 0) {
150
- onEvent({ type: "citations", id: requestId, urls: citations });
151
- }
152
- onEvent({ type: "done", id: requestId, fullText });
153
- }
154
- emitter.emit("close", 0);
155
- });
156
-
157
- res.on("error", (err) => {
158
- if (!aborted) {
159
- onEvent({ type: "error", id: requestId, error: `Perplexity stream error: ${err.message}` });
160
- onEvent({ type: "done", id: requestId, fullText: "" });
161
- }
162
- emitter.emit("close", 1);
163
- });
164
- }
165
- );
166
-
167
- req.on("error", (err) => {
168
- if (!aborted) {
169
- onEvent({ type: "error", id: requestId, error: `Perplexity connection error: ${err.message}` });
170
- onEvent({ type: "done", id: requestId, fullText: "" });
171
- }
172
- emitter.emit("close", 1);
173
- });
174
-
175
- req.write(body);
176
- req.end();
177
-
178
- } catch (err) {
179
- onEvent({ type: "error", id: requestId, error: `Perplexity error: ${err.message}` });
180
- onEvent({ type: "done", id: requestId, fullText: "" });
181
- emitter.emit("close", 1);
182
- }
183
-
184
- emitter.kill = abort;
185
- return emitter;
186
- }
187
-
188
- module.exports = { runPerplexity };
@@ -1,178 +0,0 @@
1
- ---
2
- name: component-doc-generator
3
- description: >
4
- Generate comprehensive design system component documentation directly in Figma.
5
- Produces anatomy annotations, API specs, property exhibits, color token mapping,
6
- structure/spacing specs, and accessibility (screen reader) specs — all rendered
7
- as structured frames in your Figma file via Figma MCP. Use this skill whenever
8
- someone asks to document a component, create component specs, generate design
9
- system documentation, annotate a component's anatomy, map color tokens, document
10
- spacing/structure, create accessibility specs, or produce any form of component
11
- specification in Figma. Also trigger when users mention "component docs", "spec
12
- pages", "design handoff docs", "anatomy markers", "API table", "property overview",
13
- "color annotation", "structure spec", "screen reader spec", or "a11y spec".
14
- Works with Figma Intelligence MCP via the bridge-relay.
15
- ---
16
-
17
- # Component Documentation Generator
18
-
19
- Generate production-quality design system component documentation directly in Figma — anatomy, API, properties, color tokens, structure, and screen reader specs.
20
-
21
- ## Overview
22
-
23
- This skill connects to your Figma file through Figma Intelligence MCP (via the bridge-relay local server), extracts component data programmatically, applies AI reasoning for classification and semantics, and renders structured documentation frames directly in your Figma file.
24
-
25
- **The pipeline for every spec type follows the same pattern:**
26
- 1. **Extract** — Read component layers, properties, variables, and styles from Figma via MCP
27
- 2. **Classify & Enrich** — AI determines element roles, semantic meaning, and documentation strategy
28
- 3. **Import Template** — Pull the documentation template from your library (or create frames from scratch)
29
- 4. **Render** — Build the spec: fill text fields, create instances, place markers, build tables
30
- 5. **Validate** — Capture screenshot, check completeness, fix issues (up to 3 iterations)
31
-
32
- ## Prerequisites
33
-
34
- - **Figma Intelligence MCP connected** — Via the bridge-relay local server
35
- - **A Figma component link** — The URL to a component set or standalone component
36
- - **Template library** (optional but recommended) — A published Figma library with documentation templates
37
-
38
- Before running any spec, verify the Figma MCP connection by asking the agent to check Figma status or list pages.
39
-
40
- ## Available Spec Types
41
-
42
- | Command | What It Generates |
43
- |---------|-------------------|
44
- | `create-anatomy` | Numbered markers on each element + attribute table with semantic notes |
45
- | `create-api` | Property tables with values, defaults, required/optional, configuration examples |
46
- | `create-property` | Visual exhibits for variant axes, boolean toggles, variable modes, child properties |
47
- | `create-color` | Design token mapping for every element across states and variants |
48
- | `create-structure` | Dimensions, spacing, padding tables across size/density variants |
49
- | `create-screen-reader` | VoiceOver, TalkBack, and ARIA accessibility specs per platform |
50
-
51
- ## How to Invoke
52
-
53
- Paste a Figma component link and specify the spec type. Add context about the component for richer output.
54
-
55
- ```
56
- create-anatomy https://www.figma.com/design/FILE_KEY/File-Name?node-id=XX:YY
57
-
58
- This is a text field with a leading icon, label, placeholder text,
59
- helper text, and a trailing clear button. It has enabled, focused,
60
- error, and disabled states.
61
- ```
62
-
63
- **Optional destination**: Place the spec in a different file or page:
64
- ```
65
- Destination: https://www.figma.com/design/OTHER_KEY/Docs?node-id=0-1
66
- ```
67
-
68
- ## Reading Reference Files
69
-
70
- Before generating any spec, read the appropriate reference file for detailed instructions:
71
-
72
- | Spec Type | Reference File |
73
- |-----------|---------------|
74
- | Anatomy | `references/anatomy-spec.md` |
75
- | API | `references/api-spec.md` |
76
- | Properties | `references/property-spec.md` |
77
- | Color Annotation | `references/color-spec.md` |
78
- | Structure | `references/structure-spec.md` |
79
- | Screen Reader | `references/screen-reader-spec.md` |
80
-
81
- **Always read the reference file before starting.** Each contains the exact extraction steps, classification logic, rendering instructions, and validation checklist for that spec type.
82
-
83
- ## General Rendering Rules (Apply to ALL Spec Types)
84
-
85
- ### Frame & Layout Standards
86
- - Documentation frame width: **1440px** (standard Figma doc width)
87
- - Use **auto-layout** for all sections (vertical, spacing 24–40px between sections)
88
- - Section headers: **24px bold**, body text: **14px regular**, table text: **13px**
89
- - Use your design system's font family if configured; fall back to Inter
90
- - Background: white (#FFFFFF); text: near-black (#1A1A1A)
91
- - Section dividers: 1px line, #E5E5E5
92
-
93
- ### Marker Standards (Anatomy & Color)
94
- - Marker circles: **24px diameter**, fill **#D946EF** (pink/magenta), white text, 13px bold
95
- - Connector lines: 1px stroke, same pink color, from marker center to element edge
96
- - Markers numbered sequentially starting at 1
97
- - Place markers outside the component artwork, connected by leader lines
98
-
99
- ### Table Standards
100
- - Header row: **#F3F4F6** background, 13px bold text
101
- - Body rows: alternating white / **#FAFAFA**
102
- - Cell padding: 8px horizontal, 6px vertical
103
- - Border: 1px #E5E5E5
104
-
105
- ### Instance Rendering
106
- - When showing component instances as artwork, set them to the exact variant/state needed
107
- - Make hidden boolean elements visible by toggling component properties (not raw visibility)
108
- - Label hidden elements as "(hidden)" in tables
109
-
110
- ### Validation Loop
111
- After rendering each spec:
112
- 1. Capture a screenshot of the output frame
113
- 2. Check: Are all sections present? Are markers aligned? Are tables complete?
114
- 3. If issues found, fix them automatically
115
- 4. Repeat up to **3 times** maximum
116
- 5. Report completion to the user
117
-
118
- ## Figma MCP Operations Reference
119
-
120
- These are the key MCP operations used across all spec types. The exact tool names depend on your MCP provider.
121
-
122
- ### Reading Component Data
123
- ```
124
- // Get component children and properties
125
- get_node_children(node_id)
126
- get_component_property_definitions(node_id)
127
- get_variant_properties(node_id)
128
-
129
- // Get styles, fills, variables
130
- get_node_styles(node_id)
131
- get_node_fills(node_id)
132
- get_bound_variables(node_id)
133
- get_variable_collection(collection_id)
134
-
135
- // Get dimensions
136
- get_node_dimensions(node_id) // returns width, height, padding, gaps
137
- ```
138
-
139
- ### Writing to Figma
140
- ```
141
- // Create frames and text
142
- create_frame(parent_id, name, width, height, layout_mode)
143
- create_text(parent_id, content, font_size, font_weight)
144
-
145
- // Create instances
146
- create_instance(component_key, parent_id)
147
- set_component_properties(instance_id, properties)
148
-
149
- // Drawing markers
150
- create_ellipse(parent_id, x, y, diameter, fill_color)
151
- create_line(parent_id, start_x, start_y, end_x, end_y, stroke_color)
152
-
153
- // Import from library
154
- import_component_by_key(template_key)
155
- detach_instance(instance_id)
156
- ```
157
-
158
- ### Screenshots
159
- ```
160
- capture_screenshot(node_id) // for validation
161
- ```
162
-
163
- ## Tips for Best Results
164
-
165
- 1. **Use component sets** — Skills expect a component set (dashed-border container) or standalone component, not an instance
166
- 2. **Name your layers** — Layer names become element labels. "Leading Icon" beats "Frame 47"
167
- 3. **Describe all states** — The agent can't infer states not visible in the current frame
168
- 4. **Mention sub-components** — If your component nests other components, describe their configuration
169
- 5. **Specify defaults** — Tell the agent which values are the default configuration
170
- 6. **List interactive states** — enabled, hover, pressed, disabled, focused, selected, loading
171
- 7. **Describe variable modes** — If properties are controlled by Figma variable collections, name them
172
-
173
- ## Error Handling
174
-
175
- - If MCP connection fails: Ask the user to verify their Figma MCP setup and Desktop Bridge plugin
176
- - If component not found: Verify the node-id in the Figma link is correct
177
- - If template import fails: Fall back to creating frames from scratch (no template dependency)
178
- - If rendering is incomplete after 3 validation attempts: Report what was completed and what needs manual adjustment
@@ -1,159 +0,0 @@
1
- # Anatomy Spec Reference
2
-
3
- Generate numbered anatomy annotations with attribute tables directly in Figma.
4
-
5
- ## What This Spec Produces
6
-
7
- 1. **Component artwork** — A default-variant instance with all hidden elements made visible
8
- 2. **Numbered markers** — Pink circles (24px, #D946EF) with connector lines pointing to each element
9
- 3. **Attribute table** — 4 columns: Number, Type (instance/text/shape icon), Element Name, Semantic Notes
10
- 4. **Per-child sections** — Nested component instances get their own markers and tables
11
- 5. **Cross-references** — Composition table notes link to per-child sections ("See X anatomy section")
12
-
13
- ---
14
-
15
- ## Step-by-Step Pipeline
16
-
17
- ### Phase 1: Extract Component Data
18
-
19
- 1. Parse the Figma link to get `file_key` and `node_id`
20
- 2. Read the component set or standalone component:
21
- ```
22
- get_node(file_key, node_id)
23
- get_component_property_definitions(node_id)
24
- ```
25
- 3. Get the **default variant** (first child of the component set, or the component itself if standalone)
26
- 4. Traverse all child layers recursively and collect:
27
- - `name` — Layer name
28
- - `type` — INSTANCE, TEXT, RECTANGLE, ELLIPSE, VECTOR, FRAME, GROUP, LINE
29
- - `visible` — Whether the element is visible in the default state
30
- - `componentPropertyReferences` — Which boolean property controls this element's visibility
31
- - `characters` — Text content (for TEXT nodes)
32
- - `componentId` — If an INSTANCE, the component it references
33
-
34
- 5. For each INSTANCE child, resolve to its source component and check if it has meaningful internal structure (more than 1 visible child layer). If yes, mark it as a **per-child candidate**.
35
-
36
- 6. **Filter out utility sub-components**: Skip elements whose resolved component name matches: `Spacer`, `Divider`, `Separator`, `Gap`, `Padding`. These have no meaningful anatomy to document.
37
-
38
- ### Phase 2: Classify Each Element (AI Reasoning)
39
-
40
- For each collected element, determine its **role**:
41
-
42
- | Role | Description | Example |
43
- |------|-------------|---------|
44
- | `content-element` | Displays user-facing content | Label text, avatar image |
45
- | `optional-slot` | Controlled by a boolean toggle, can be hidden | Leading icon, trailing button |
46
- | `fixed-sub-component` | Always present nested instance | Icon component, badge |
47
- | `structural` | Layout container, not meaningful to document | Auto-layout wrapper frame |
48
- | `decorative` | Visual-only, no semantic meaning | Background shape, shadow layer |
49
-
50
- **Classification rules:**
51
- - If element has a `componentPropertyReference` to a boolean → `optional-slot`
52
- - If element is an INSTANCE with ≥2 meaningful children → `fixed-sub-component` or per-child candidate
53
- - If element is a FRAME/GROUP with only auto-layout purpose → `structural` (skip from table)
54
- - If element name starts with "." or is named "Background", "Shadow", "Overlay" → `decorative` (skip)
55
- - Everything else → `content-element`
56
-
57
- **Write semantic notes for each non-skipped element:**
58
- - For optional slots: "Optional. Controlled by [boolean-name] toggle. Hidden by default." or "Visible by default."
59
- - For content elements: Describe the element's purpose in the component context
60
- - For fixed sub-components: "Fixed sub-component. See [Name] anatomy section." (if per-child exists)
61
- - For instance swap slots: "Swappable. Accepts [list of allowed instances]."
62
-
63
- ### Phase 3: Determine Per-Child Sections
64
-
65
- A nested instance warrants its own per-child section when:
66
- - It has ≥3 internal child layers (not counting structural wrappers)
67
- - It is NOT a utility component (Spacer, Divider, etc.)
68
- - It has its own configurable properties (booleans, variants)
69
-
70
- For qualifying per-child instances, repeat Phase 1 and Phase 2 on the nested component.
71
-
72
- **Collapsing identical siblings**: If the same component appears N times consecutively (e.g., 5 star icons), collapse into a single row with "(xN)" suffix.
73
-
74
- ### Phase 4: Make Hidden Elements Visible
75
-
76
- For the artwork instance, unhide all hidden optional elements **through component properties**:
77
- ```
78
- // DO THIS (property-aware unhide):
79
- set_component_properties(instance_id, { "Show Leading Icon": true, "Show Badge": true })
80
-
81
- // DO NOT DO THIS (raw visibility override):
82
- set_visibility(child_node_id, true) // WRONG — breaks component property binding
83
- ```
84
-
85
- This ensures the artwork shows the complete anatomy with all optional elements visible, while maintaining proper component property bindings.
86
-
87
- ### Phase 5: Render the Documentation Frame
88
-
89
- #### Create the main frame
90
- ```
91
- Main Frame (1440px wide, auto-layout vertical, padding 60px, gap 40px)
92
- ├── Header Section
93
- │ ├── Title: "[Component Name] — Anatomy" (24px bold)
94
- │ └── Subtitle: "Component structure and element inventory" (14px, #6B7280)
95
- ├── Artwork + Markers Section (horizontal layout)
96
- │ ├── Component Instance (all hidden elements visible)
97
- │ └── Marker Layer (positioned absolutely relative to artwork)
98
- ├── Attribute Table
99
- │ ├── Header Row: # | Type | Element | Notes
100
- │ └── Body Rows: One per non-skipped element
101
- ├── Per-Child Section 1 (if applicable)
102
- │ ├── Section Header: "[Child Name] Anatomy"
103
- │ ├── Child Artwork + Markers
104
- │ └── Child Attribute Table
105
- └── Per-Child Section N...
106
- ```
107
-
108
- #### Place markers
109
- For each element in the attribute table:
110
- 1. Get the element's absolute position and bounds within the artwork
111
- 2. Create a marker circle (24px, #D946EF fill, white number text)
112
- 3. Position the marker **outside** the component artwork (to the left, right, top, or bottom — whichever has the most space)
113
- 4. Draw a 1px connector line from the marker center to the nearest edge of the element
114
- 5. Avoid overlapping markers — distribute them evenly with ≥8px gaps
115
-
116
- #### Build the attribute table
117
- | Column | Width | Content |
118
- |--------|-------|---------|
119
- | # | 48px | Sequential number matching the marker |
120
- | Type | 48px | Icon indicator: 🔲 for instance, 📝 for text, ⬡ for shape/vector |
121
- | Element | 200px | Layer name. Append "(hidden)" if element is not visible in default state |
122
- | Notes | Fill remaining | Semantic notes from Phase 2 classification |
123
-
124
- ### Phase 6: Validate
125
-
126
- 1. Capture a screenshot of the completed frame
127
- 2. Check against this checklist:
128
- - [ ] All non-structural, non-decorative elements have a marker
129
- - [ ] Marker numbers match table row numbers
130
- - [ ] No markers overlap each other
131
- - [ ] Connector lines point to the correct elements
132
- - [ ] Hidden elements are labeled "(hidden)" in the table
133
- - [ ] Per-child sections exist for qualifying nested instances
134
- - [ ] Cross-references in the main table link to per-child sections
135
- 3. Fix any issues found
136
- 4. Repeat up to 3 times
137
-
138
- ---
139
-
140
- ## Example Output Structure
141
-
142
- For a **Text Field** component with: Container, Leading Icon (optional), Label, Input Area, Placeholder Text, Helper Text (optional), Trailing Clear Button (optional):
143
-
144
- **Main Attribute Table:**
145
- | # | Type | Element | Notes |
146
- |---|------|---------|-------|
147
- | 1 | 🔲 | Container | Root frame. Auto-layout horizontal with nested vertical sections. |
148
- | 2 | 🔲 | Leading Icon (hidden) | Optional. Controlled by "Show Leading Icon" toggle. Hidden by default. |
149
- | 3 | 📝 | Label | Required. Displays the field's label text above the input area. |
150
- | 4 | 📝 | Input Text | Content element. Displays user-entered text or placeholder. |
151
- | 5 | 📝 | Placeholder Text | Content element. Visible when Input Text is empty. |
152
- | 6 | 📝 | Helper Text (hidden) | Optional. Controlled by "Show Helper" toggle. Provides guidance below the input. |
153
- | 7 | 🔲 | Clear Button (hidden) | Optional. Controlled by "Show Clear" toggle. See Clear Button anatomy section. |
154
-
155
- **Per-child: Clear Button Anatomy:**
156
- | # | Type | Element | Notes |
157
- |---|------|---------|-------|
158
- | 1 | 🔲 | Icon | Fixed sub-component. Displays the clear/close icon. |
159
- | 2 | ⬡ | Hit Area | Touch target overlay. 44x44px minimum for accessibility compliance. |