@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.
- package/README.md +67 -36
- package/dist/bin/cli.js +2 -0
- package/dist/design-bridge/bridge.js +2 -0
- package/dist/figma-bridge-plugin/bridge-relay.js +2 -0
- package/dist/figma-bridge-plugin/code.js +1 -0
- package/{figma-bridge-plugin → dist/figma-bridge-plugin}/package-lock.json +0 -3
- package/dist/figma-bridge-plugin/ui.html +4970 -0
- package/dist/figma-intelligence-layer/dist/index.js +2 -0
- package/dist/scripts/clean-existing-chunks.js +2 -0
- package/dist/scripts/connect-ai-tool.js +2 -0
- package/dist/scripts/convert-hub-pdfs.js +2 -0
- package/dist/scripts/figma-mcp-status.js +2 -0
- package/dist/scripts/register-codex-mcp.js +2 -0
- package/dist/scripts/test-copilot-chat.js +2 -0
- package/package.json +11 -8
- package/bin/cli.js +0 -859
- package/design-bridge/bridge.js +0 -196
- package/design-bridge/lib/assets.js +0 -367
- package/design-bridge/lib/prompt.js +0 -85
- package/design-bridge/lib/server.js +0 -66
- package/design-bridge/lib/stitch.js +0 -37
- package/design-bridge/lib/tokens.js +0 -82
- package/design-bridge/package-lock.json +0 -579
- package/figma-bridge-plugin/README.md +0 -97
- package/figma-bridge-plugin/anthropic-chat-runner.js +0 -192
- package/figma-bridge-plugin/bridge-relay.js +0 -2505
- package/figma-bridge-plugin/chat-runner.js +0 -485
- package/figma-bridge-plugin/code.js +0 -1534
- package/figma-bridge-plugin/codex-runner.js +0 -505
- package/figma-bridge-plugin/component-schemas.js +0 -110
- package/figma-bridge-plugin/content-context.js +0 -869
- package/figma-bridge-plugin/create-button.js +0 -216
- package/figma-bridge-plugin/gemini-cli-runner.js +0 -291
- package/figma-bridge-plugin/gemini-runner.js +0 -187
- package/figma-bridge-plugin/html-to-figma.js +0 -927
- package/figma-bridge-plugin/knowledge-hub/.gitkeep +0 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/anatomy-spec.md +0 -159
- package/figma-bridge-plugin/knowledge-hub/uspec-references/api-spec.md +0 -162
- package/figma-bridge-plugin/knowledge-hub/uspec-references/color-spec.md +0 -148
- package/figma-bridge-plugin/knowledge-hub/uspec-references/full-spec-template.md +0 -314
- package/figma-bridge-plugin/knowledge-hub/uspec-references/property-spec.md +0 -175
- package/figma-bridge-plugin/knowledge-hub/uspec-references/screen-reader-spec.md +0 -180
- package/figma-bridge-plugin/knowledge-hub/uspec-references/structure-spec.md +0 -165
- package/figma-bridge-plugin/perplexity-runner.js +0 -188
- package/figma-bridge-plugin/references/SKILL.md +0 -178
- package/figma-bridge-plugin/references/anatomy-spec.md +0 -159
- package/figma-bridge-plugin/references/api-spec.md +0 -162
- package/figma-bridge-plugin/references/color-spec.md +0 -148
- package/figma-bridge-plugin/references/full-spec-template.md +0 -314
- package/figma-bridge-plugin/references/property-spec.md +0 -175
- package/figma-bridge-plugin/references/screen-reader-spec.md +0 -180
- package/figma-bridge-plugin/references/structure-spec.md +0 -165
- package/figma-bridge-plugin/shared-prompt-config.js +0 -645
- package/figma-bridge-plugin/spec-helpers/build-table.js +0 -269
- package/figma-bridge-plugin/spec-helpers/classify-elements.js +0 -189
- package/figma-bridge-plugin/spec-helpers/index.js +0 -35
- package/figma-bridge-plugin/spec-helpers/parse-figma-link.js +0 -49
- package/figma-bridge-plugin/spec-helpers/position-markers.js +0 -158
- package/figma-bridge-plugin/stitch-auth.js +0 -322
- package/figma-bridge-plugin/stitch-runner.js +0 -1427
- package/figma-bridge-plugin/token-resolver.js +0 -107
- package/figma-bridge-plugin/ui.html +0 -4542
- package/figma-intelligence-layer/.env.example +0 -39
- package/figma-intelligence-layer/docs/local-image-generation.md +0 -60
- package/figma-intelligence-layer/examples/comfyui-workflow-template.example.json +0 -101
- package/figma-intelligence-layer/jest.config.js +0 -14
- package/figma-intelligence-layer/mcp-config.json +0 -19
- package/figma-intelligence-layer/package-lock.json +0 -5892
- package/figma-intelligence-layer/scripts/setup-comfyui-local.sh +0 -67
- package/figma-intelligence-layer/scripts/start-comfyui.sh +0 -33
- package/figma-intelligence-layer/src/index.ts +0 -2233
- package/figma-intelligence-layer/src/shared/auto-layout-validator.ts +0 -404
- package/figma-intelligence-layer/src/shared/cache.ts +0 -187
- package/figma-intelligence-layer/src/shared/color-operations.ts +0 -533
- package/figma-intelligence-layer/src/shared/color-utils.ts +0 -138
- package/figma-intelligence-layer/src/shared/component-script-builder.ts +0 -413
- package/figma-intelligence-layer/src/shared/component-templates.ts +0 -2767
- package/figma-intelligence-layer/src/shared/concept-taxonomy.ts +0 -694
- package/figma-intelligence-layer/src/shared/decision-log.ts +0 -128
- package/figma-intelligence-layer/src/shared/design-system-context.ts +0 -568
- package/figma-intelligence-layer/src/shared/design-system-intelligence.ts +0 -131
- package/figma-intelligence-layer/src/shared/design-system-matcher.ts +0 -184
- package/figma-intelligence-layer/src/shared/design-system-normalizers.ts +0 -196
- package/figma-intelligence-layer/src/shared/design-system-tokens.ts +0 -295
- package/figma-intelligence-layer/src/shared/dtcg-validator.ts +0 -530
- package/figma-intelligence-layer/src/shared/enrichment-pipeline.ts +0 -671
- package/figma-intelligence-layer/src/shared/figma-bridge.ts +0 -1418
- package/figma-intelligence-layer/src/shared/font-config.ts +0 -126
- package/figma-intelligence-layer/src/shared/icon-catalog.ts +0 -360
- package/figma-intelligence-layer/src/shared/icon-fetch.ts +0 -80
- package/figma-intelligence-layer/src/shared/prototype-script-builder.ts +0 -162
- package/figma-intelligence-layer/src/shared/response-compression.ts +0 -440
- package/figma-intelligence-layer/src/shared/semantic-token-catalog.ts +0 -324
- package/figma-intelligence-layer/src/shared/token-binder.ts +0 -505
- package/figma-intelligence-layer/src/shared/token-math.ts +0 -427
- package/figma-intelligence-layer/src/shared/token-naming.ts +0 -468
- package/figma-intelligence-layer/src/shared/token-utils.ts +0 -420
- package/figma-intelligence-layer/src/shared/types.ts +0 -346
- package/figma-intelligence-layer/src/shared/typography-presets.ts +0 -94
- package/figma-intelligence-layer/src/shared/unsplash.ts +0 -165
- package/figma-intelligence-layer/src/shared/vision-client.ts +0 -607
- package/figma-intelligence-layer/src/shared/vision-provider-anthropic.ts +0 -334
- package/figma-intelligence-layer/src/shared/vision-provider-openai.ts +0 -446
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-handler.ts +0 -782
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-renderer.ts +0 -496
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotation-kit.ts +0 -230
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/colorblind-sim.ts +0 -66
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/index.ts +0 -810
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-analyzer.ts +0 -1191
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-figma-page.ts +0 -1346
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-handler.ts +0 -148
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-figma-page.ts +0 -499
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-report.ts +0 -910
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-checker.ts +0 -989
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-criteria.ts +0 -1160
- package/figma-intelligence-layer/src/tools/phase1-vision/design-from-ref/index.ts +0 -424
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/component-recognizer.ts +0 -38
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/ds-matcher.ts +0 -111
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/font-matcher.ts +0 -114
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/icon-resolver.ts +0 -103
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/index.ts +0 -1060
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/layout-segmenter.ts +0 -18
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/token-inferencer.ts +0 -39
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/vision-pipeline.ts +0 -58
- package/figma-intelligence-layer/src/tools/phase1-vision/sketch-to-design/index.ts +0 -298
- package/figma-intelligence-layer/src/tools/phase1-vision/visual-audit/index.ts +0 -197
- package/figma-intelligence-layer/src/tools/phase2-accuracy/component-audit/index.ts +0 -494
- package/figma-intelligence-layer/src/tools/phase2-accuracy/intent-translator/index.ts +0 -356
- package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/container-patterns.ts +0 -123
- package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/index.ts +0 -663
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/built-in-rules.yaml +0 -56
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/index.ts +0 -614
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/rule-engine.ts +0 -113
- package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/color-theory.ts +0 -178
- package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/index.ts +0 -470
- package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/index.ts +0 -429
- package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/token-override-maps.ts +0 -226
- package/figma-intelligence-layer/src/tools/phase3-generation/ai-image-insert/index.ts +0 -535
- package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/index.ts +0 -660
- package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/pattern-fingerprints.ts +0 -209
- package/figma-intelligence-layer/src/tools/phase3-generation/composition-builder/index.ts +0 -540
- package/figma-intelligence-layer/src/tools/phase3-generation/figma-animated-build.ts +0 -391
- package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/index.ts +0 -2019
- package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/screen-templates.ts +0 -131
- package/figma-intelligence-layer/src/tools/phase3-generation/prototype-map/index.ts +0 -381
- package/figma-intelligence-layer/src/tools/phase3-generation/prototype-wire/index.ts +0 -565
- package/figma-intelligence-layer/src/tools/phase3-generation/swarm-build/index.ts +0 -764
- package/figma-intelligence-layer/src/tools/phase3-generation/system-drift/index.ts +0 -535
- package/figma-intelligence-layer/src/tools/phase3-generation/unsplash-search/index.ts +0 -84
- package/figma-intelligence-layer/src/tools/phase3-generation/url-to-frame/index.ts +0 -401
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/css-animations.ts +0 -68
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/framer-motion.ts +0 -78
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/swift-animations.ts +0 -93
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/index.ts +0 -596
- package/figma-intelligence-layer/src/tools/phase4-sync/ci-check/index.ts +0 -462
- package/figma-intelligence-layer/src/tools/phase4-sync/export-tokens/index.ts +0 -1470
- package/figma-intelligence-layer/src/tools/phase4-sync/generate-component-code/index.ts +0 -829
- package/figma-intelligence-layer/src/tools/phase4-sync/handoff-spec/index.ts +0 -702
- package/figma-intelligence-layer/src/tools/phase4-sync/icon-library-sync/index.ts +0 -483
- package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/index.ts +0 -501
- package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/storybook-parser.ts +0 -106
- package/figma-intelligence-layer/src/tools/phase4-sync/watch-docs/index.ts +0 -676
- package/figma-intelligence-layer/src/tools/phase4-sync/webhook-listener/index.ts +0 -560
- package/figma-intelligence-layer/src/tools/phase5-governance/apg-doc/index.ts +0 -1043
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/component-detection.ts +0 -620
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/anatomy.ts +0 -331
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/color-tokens.ts +0 -77
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/properties.ts +0 -54
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/snapshot.ts +0 -287
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/spacing.ts +0 -71
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/states.ts +0 -43
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/typography.ts +0 -71
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/index.ts +0 -221
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/_default.ts +0 -166
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/accordion.ts +0 -232
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/alert.ts +0 -234
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar-group.ts +0 -270
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar.ts +0 -249
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/badge.ts +0 -231
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/banner.ts +0 -293
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/breadcrumb.ts +0 -240
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/button.ts +0 -243
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/calendar.ts +0 -307
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/card.ts +0 -143
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/checkbox.ts +0 -227
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/chip.ts +0 -233
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/combobox.ts +0 -282
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/datepicker.ts +0 -276
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/divider.ts +0 -223
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/drawer.ts +0 -255
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/dropdown-menu.ts +0 -289
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/empty-state.ts +0 -261
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/file-uploader.ts +0 -290
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/form.ts +0 -265
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/grid.ts +0 -238
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/icon.ts +0 -255
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/index.ts +0 -128
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-edit.ts +0 -286
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-message.ts +0 -255
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/input.ts +0 -330
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/link.ts +0 -247
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/list.ts +0 -250
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/menu.ts +0 -247
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/modal.ts +0 -144
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navbar.ts +0 -264
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navigation.ts +0 -251
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/number-input.ts +0 -261
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/pagination.ts +0 -248
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/popover.ts +0 -270
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/progress.ts +0 -251
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/radio.ts +0 -142
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/range-slider.ts +0 -282
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/rating.ts +0 -250
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/search.ts +0 -258
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/segmented-control.ts +0 -265
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/select.ts +0 -319
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/skeleton.ts +0 -256
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/slider.ts +0 -232
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/spinner.ts +0 -239
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/status-dot.ts +0 -252
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/stepper.ts +0 -270
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/table.ts +0 -244
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tabs.ts +0 -143
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tag.ts +0 -243
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/textarea.ts +0 -259
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/time-picker.ts +0 -293
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toast.ts +0 -144
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toggle.ts +0 -289
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toolbar.ts +0 -267
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tooltip.ts +0 -232
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/treeview.ts +0 -257
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/typography.ts +0 -319
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/legacy-compat.ts +0 -121
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/anatomy-diagram.ts +0 -430
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/figma-page.ts +0 -312
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/json.ts +0 -129
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/markdown.ts +0 -78
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/visual-doc.ts +0 -2333
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/accessibility.ts +0 -100
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/anatomy.ts +0 -32
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/color-tokens.ts +0 -59
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/content-guidance.ts +0 -18
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/design-tokens.ts +0 -53
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/interaction-rules.ts +0 -19
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/overview.ts +0 -91
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/properties-api.ts +0 -71
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/qa-criteria.ts +0 -19
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/related-components.ts +0 -110
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/responsive.ts +0 -19
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/size-specs.ts +0 -67
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/spacing-structure.ts +0 -58
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/state-specs.ts +0 -79
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/states.ts +0 -50
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/type-hierarchy.ts +0 -33
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/typography.ts +0 -55
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/usage-guidelines.ts +0 -73
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/variants.ts +0 -81
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/types.ts +0 -409
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/index.ts +0 -198
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/renderer.ts +0 -701
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/types.ts +0 -88
- package/figma-intelligence-layer/src/tools/phase5-governance/decision-log/index.ts +0 -135
- package/figma-intelligence-layer/src/tools/phase5-governance/design-decision-log/index.ts +0 -491
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-primitives/index.ts +0 -416
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-scaffolder/index.ts +0 -722
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-variables/index.ts +0 -449
- package/figma-intelligence-layer/src/tools/phase5-governance/health-report/index.ts +0 -393
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/index.ts +0 -406
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/figma-page.ts +0 -292
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/json.ts +0 -24
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/markdown.ts +0 -172
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/naming-guide.ts +0 -409
- package/figma-intelligence-layer/src/tools/phase5-governance/token-analytics/index.ts +0 -594
- package/figma-intelligence-layer/src/tools/phase5-governance/token-docs/index.ts +0 -710
- package/figma-intelligence-layer/src/tools/phase5-governance/token-migrate/index.ts +0 -458
- package/figma-intelligence-layer/src/tools/phase5-governance/token-naming/index.ts +0 -134
- package/figma-intelligence-layer/tests/apg-doc.test.ts +0 -101
- package/figma-intelligence-layer/tests/design-system-context.test.ts +0 -152
- package/figma-intelligence-layer/tests/design-system-matcher.test.ts +0 -144
- package/figma-intelligence-layer/tests/figma-bridge.test.ts +0 -83
- package/figma-intelligence-layer/tests/generate-image-and-insert.test.ts +0 -56
- package/figma-intelligence-layer/tests/screen-cloner-regression.test.ts +0 -69
- package/figma-intelligence-layer/tests/smoke.test.ts +0 -174
- package/figma-intelligence-layer/tests/spec-generator.test.ts +0 -127
- package/figma-intelligence-layer/tests/token-migrate.test.ts +0 -21
- package/figma-intelligence-layer/tests/token-naming.test.ts +0 -30
- package/figma-intelligence-layer/tsconfig.json +0 -19
- package/scripts/clean-existing-chunks.js +0 -179
- package/scripts/connect-ai-tool.js +0 -490
- package/scripts/convert-hub-pdfs.js +0 -425
- package/scripts/figma-mcp-status.js +0 -349
- package/scripts/register-codex-mcp.js +0 -96
- /package/{design-bridge → dist/design-bridge}/.env.example +0 -0
- /package/{design-bridge → dist/design-bridge}/package.json +0 -0
- /package/{figma-bridge-plugin → dist/figma-bridge-plugin}/manifest.json +0 -0
- /package/{figma-bridge-plugin → dist/figma-bridge-plugin}/package.json +0 -0
- /package/{figma-intelligence-layer → dist/figma-intelligence-layer}/package.json +0 -0
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* build-table.js
|
|
3
|
-
*
|
|
4
|
-
* Generates Figma MCP commands to create structured data tables.
|
|
5
|
-
* Used by all spec types for rendering property tables, attribute tables,
|
|
6
|
-
* token mapping tables, etc.
|
|
7
|
-
*
|
|
8
|
-
* Design tokens:
|
|
9
|
-
* - Header background: #F3F4F6
|
|
10
|
-
* - Alternate row background: #FAFAFA
|
|
11
|
-
* - Border color: #E5E5E5
|
|
12
|
-
* - Header text: 13px bold, #1A1A1A
|
|
13
|
-
* - Body text: 13px regular, #1A1A1A
|
|
14
|
-
* - Cell padding: 8px horizontal, 6px vertical
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const TABLE_STYLES = {
|
|
18
|
-
headerBg: '#F3F4F6',
|
|
19
|
-
altRowBg: '#FAFAFA',
|
|
20
|
-
borderColor: '#E5E5E5',
|
|
21
|
-
textColor: '#1A1A1A',
|
|
22
|
-
headerFontSize: 13,
|
|
23
|
-
bodyFontSize: 13,
|
|
24
|
-
cellPaddingH: 8,
|
|
25
|
-
cellPaddingV: 6,
|
|
26
|
-
borderWeight: 1,
|
|
27
|
-
rowHeight: 36,
|
|
28
|
-
headerRowHeight: 40
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Build a table specification object.
|
|
33
|
-
*
|
|
34
|
-
* @param {Object} config
|
|
35
|
-
* @param {Array<Object>} config.columns - [{ key, label, width }]
|
|
36
|
-
* @param {Array<Object>} config.rows - [{ [key]: value, ... }]
|
|
37
|
-
* @param {number} config.x - X position
|
|
38
|
-
* @param {number} config.y - Y position
|
|
39
|
-
* @param {string} config.name - Frame name for the table
|
|
40
|
-
* @returns {Object} Table spec with dimensions and commands
|
|
41
|
-
*/
|
|
42
|
-
function buildTable(config) {
|
|
43
|
-
const { columns, rows, x = 0, y = 0, name = 'Table' } = config;
|
|
44
|
-
|
|
45
|
-
const totalWidth = columns.reduce((sum, col) => sum + col.width, 0);
|
|
46
|
-
const totalHeight = TABLE_STYLES.headerRowHeight + (rows.length * TABLE_STYLES.rowHeight);
|
|
47
|
-
|
|
48
|
-
const commands = [];
|
|
49
|
-
|
|
50
|
-
// Table container frame
|
|
51
|
-
commands.push({
|
|
52
|
-
tool: 'create_frame',
|
|
53
|
-
params: {
|
|
54
|
-
x, y,
|
|
55
|
-
width: totalWidth,
|
|
56
|
-
height: totalHeight,
|
|
57
|
-
name,
|
|
58
|
-
fills: [{ type: 'SOLID', color: '#FFFFFF' }],
|
|
59
|
-
stroke: { color: TABLE_STYLES.borderColor, weight: TABLE_STYLES.borderWeight }
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// Header row
|
|
64
|
-
let colX = 0;
|
|
65
|
-
for (const col of columns) {
|
|
66
|
-
commands.push({
|
|
67
|
-
tool: 'create_frame',
|
|
68
|
-
params: {
|
|
69
|
-
x: colX, y: 0,
|
|
70
|
-
width: col.width,
|
|
71
|
-
height: TABLE_STYLES.headerRowHeight,
|
|
72
|
-
name: `Header: ${col.label}`,
|
|
73
|
-
fills: [{ type: 'SOLID', color: TABLE_STYLES.headerBg }]
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
commands.push({
|
|
78
|
-
tool: 'create_text',
|
|
79
|
-
params: {
|
|
80
|
-
x: colX + TABLE_STYLES.cellPaddingH,
|
|
81
|
-
y: TABLE_STYLES.cellPaddingV + 4,
|
|
82
|
-
content: col.label,
|
|
83
|
-
font_size: TABLE_STYLES.headerFontSize,
|
|
84
|
-
font_weight: 'Bold',
|
|
85
|
-
color: TABLE_STYLES.textColor,
|
|
86
|
-
width: col.width - (TABLE_STYLES.cellPaddingH * 2)
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
colX += col.width;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Body rows
|
|
94
|
-
for (let rowIdx = 0; rowIdx < rows.length; rowIdx++) {
|
|
95
|
-
const row = rows[rowIdx];
|
|
96
|
-
const rowY = TABLE_STYLES.headerRowHeight + (rowIdx * TABLE_STYLES.rowHeight);
|
|
97
|
-
const isAlt = rowIdx % 2 === 1;
|
|
98
|
-
|
|
99
|
-
colX = 0;
|
|
100
|
-
for (const col of columns) {
|
|
101
|
-
const cellValue = String(row[col.key] || '');
|
|
102
|
-
|
|
103
|
-
// Cell background (alternating)
|
|
104
|
-
if (isAlt) {
|
|
105
|
-
commands.push({
|
|
106
|
-
tool: 'create_frame',
|
|
107
|
-
params: {
|
|
108
|
-
x: colX, y: rowY,
|
|
109
|
-
width: col.width,
|
|
110
|
-
height: TABLE_STYLES.rowHeight,
|
|
111
|
-
name: `Cell ${rowIdx}:${col.key}`,
|
|
112
|
-
fills: [{ type: 'SOLID', color: TABLE_STYLES.altRowBg }]
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Cell text
|
|
118
|
-
commands.push({
|
|
119
|
-
tool: 'create_text',
|
|
120
|
-
params: {
|
|
121
|
-
x: colX + TABLE_STYLES.cellPaddingH,
|
|
122
|
-
y: rowY + TABLE_STYLES.cellPaddingV + 2,
|
|
123
|
-
content: cellValue,
|
|
124
|
-
font_size: TABLE_STYLES.bodyFontSize,
|
|
125
|
-
font_weight: row._bold && row._bold.includes(col.key) ? 'Bold' : 'Regular',
|
|
126
|
-
color: TABLE_STYLES.textColor,
|
|
127
|
-
width: col.width - (TABLE_STYLES.cellPaddingH * 2)
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
// Cell border (bottom)
|
|
132
|
-
commands.push({
|
|
133
|
-
tool: 'create_line',
|
|
134
|
-
params: {
|
|
135
|
-
start_x: colX,
|
|
136
|
-
start_y: rowY + TABLE_STYLES.rowHeight,
|
|
137
|
-
end_x: colX + col.width,
|
|
138
|
-
end_y: rowY + TABLE_STYLES.rowHeight,
|
|
139
|
-
stroke_color: TABLE_STYLES.borderColor,
|
|
140
|
-
stroke_weight: TABLE_STYLES.borderWeight
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
colX += col.width;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return {
|
|
149
|
-
commands,
|
|
150
|
-
width: totalWidth,
|
|
151
|
-
height: totalHeight
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Build an anatomy attribute table.
|
|
157
|
-
*/
|
|
158
|
-
function buildAnatomyTable(elements, x, y) {
|
|
159
|
-
const columns = [
|
|
160
|
-
{ key: 'number', label: '#', width: 48 },
|
|
161
|
-
{ key: 'type', label: 'Type', width: 48 },
|
|
162
|
-
{ key: 'name', label: 'Element', width: 200 },
|
|
163
|
-
{ key: 'notes', label: 'Notes', width: 544 }
|
|
164
|
-
];
|
|
165
|
-
|
|
166
|
-
const rows = elements.map((el, i) => ({
|
|
167
|
-
number: String(i + 1),
|
|
168
|
-
type: el.typeIcon || '🔲',
|
|
169
|
-
name: el.displayName + (el.hidden ? ' (hidden)' : ''),
|
|
170
|
-
notes: el.semanticNotes || ''
|
|
171
|
-
}));
|
|
172
|
-
|
|
173
|
-
return buildTable({ columns, rows, x, y, name: 'Attribute Table' });
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Build an API property table.
|
|
178
|
-
*/
|
|
179
|
-
function buildApiTable(properties, x, y) {
|
|
180
|
-
const columns = [
|
|
181
|
-
{ key: 'name', label: 'Property', width: 160 },
|
|
182
|
-
{ key: 'type', label: 'Type', width: 100 },
|
|
183
|
-
{ key: 'values', label: 'Values', width: 200 },
|
|
184
|
-
{ key: 'default', label: 'Default', width: 120 },
|
|
185
|
-
{ key: 'required', label: 'Required', width: 80 },
|
|
186
|
-
{ key: 'notes', label: 'Notes', width: 380 }
|
|
187
|
-
];
|
|
188
|
-
|
|
189
|
-
const rows = properties.map(prop => ({
|
|
190
|
-
name: prop.name,
|
|
191
|
-
type: prop.type,
|
|
192
|
-
values: Array.isArray(prop.values) ? prop.values.join(' | ') : prop.values,
|
|
193
|
-
default: prop.default || '—',
|
|
194
|
-
required: prop.required ? '✓' : '—',
|
|
195
|
-
notes: prop.notes || '',
|
|
196
|
-
_bold: ['default']
|
|
197
|
-
}));
|
|
198
|
-
|
|
199
|
-
return buildTable({ columns, rows, x, y, name: 'API Property Table' });
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Build a color token mapping table.
|
|
204
|
-
*/
|
|
205
|
-
function buildColorTable(tokenMappings, states, x, y) {
|
|
206
|
-
const stateColumns = states.map(state => ({
|
|
207
|
-
key: state.toLowerCase(),
|
|
208
|
-
label: state,
|
|
209
|
-
width: Math.max(160, Math.floor(640 / states.length))
|
|
210
|
-
}));
|
|
211
|
-
|
|
212
|
-
const columns = [
|
|
213
|
-
{ key: 'element', label: 'Element', width: 140 },
|
|
214
|
-
{ key: 'property', label: 'Property', width: 80 },
|
|
215
|
-
...stateColumns
|
|
216
|
-
];
|
|
217
|
-
|
|
218
|
-
const rows = tokenMappings.map(mapping => {
|
|
219
|
-
const row = {
|
|
220
|
-
element: mapping.element,
|
|
221
|
-
property: mapping.property
|
|
222
|
-
};
|
|
223
|
-
for (const state of states) {
|
|
224
|
-
const stateKey = state.toLowerCase();
|
|
225
|
-
const token = mapping.states[stateKey];
|
|
226
|
-
row[stateKey] = token ? `${token.name}\n${token.hex}` : '—';
|
|
227
|
-
}
|
|
228
|
-
return row;
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
return buildTable({ columns, rows, x, y, name: 'Color Token Table' });
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Build a structure dimensions table.
|
|
236
|
-
*/
|
|
237
|
-
function buildStructureTable(measurements, variants, x, y, sectionName) {
|
|
238
|
-
const variantColumns = variants.map(v => ({
|
|
239
|
-
key: v.toLowerCase().replace(/\s/g, '_'),
|
|
240
|
-
label: v,
|
|
241
|
-
width: Math.max(120, Math.floor(720 / variants.length))
|
|
242
|
-
}));
|
|
243
|
-
|
|
244
|
-
const columns = [
|
|
245
|
-
{ key: 'property', label: 'Property', width: 200 },
|
|
246
|
-
...variantColumns
|
|
247
|
-
];
|
|
248
|
-
|
|
249
|
-
const rows = measurements.map(m => {
|
|
250
|
-
const row = { property: m.property };
|
|
251
|
-
for (const v of variants) {
|
|
252
|
-
const vKey = v.toLowerCase().replace(/\s/g, '_');
|
|
253
|
-
const val = m.values[vKey];
|
|
254
|
-
row[vKey] = val ? (val.token ? `${val.token} (${val.px})` : String(val.px)) : '—';
|
|
255
|
-
}
|
|
256
|
-
return row;
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
return buildTable({ columns, rows, x, y, name: `Structure: ${sectionName}` });
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
module.exports = {
|
|
263
|
-
buildTable,
|
|
264
|
-
buildAnatomyTable,
|
|
265
|
-
buildApiTable,
|
|
266
|
-
buildColorTable,
|
|
267
|
-
buildStructureTable,
|
|
268
|
-
TABLE_STYLES
|
|
269
|
-
};
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* classify-elements.js
|
|
3
|
-
*
|
|
4
|
-
* Deterministic classification rules for component child elements.
|
|
5
|
-
* Used by anatomy and color spec generation to filter and categorize elements.
|
|
6
|
-
*
|
|
7
|
-
* Usage: Import and call classifyElement(node) for each child layer.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
// Utility sub-components that should be skipped in anatomy per-child sections
|
|
11
|
-
const UTILITY_COMPONENTS = [
|
|
12
|
-
'spacer', 'divider', 'separator', 'gap', 'padding',
|
|
13
|
-
'spacing', 'gutter', 'rule', 'hairline'
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
// Structural frame names that indicate auto-layout wrappers (not meaningful elements)
|
|
17
|
-
const STRUCTURAL_PATTERNS = [
|
|
18
|
-
/^frame\s*\d*$/i,
|
|
19
|
-
/^group\s*\d*$/i,
|
|
20
|
-
/^auto[-\s]?layout/i,
|
|
21
|
-
/^wrapper/i,
|
|
22
|
-
/^container$/i, // generic "Container" (but "Input Container" is meaningful)
|
|
23
|
-
/^content$/i,
|
|
24
|
-
/^layout/i,
|
|
25
|
-
/^stack/i
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
// Decorative element patterns
|
|
29
|
-
const DECORATIVE_PATTERNS = [
|
|
30
|
-
/^background$/i,
|
|
31
|
-
/^bg$/i,
|
|
32
|
-
/^shadow$/i,
|
|
33
|
-
/^overlay$/i,
|
|
34
|
-
/^backdrop$/i,
|
|
35
|
-
/^\./, // Figma convention: layers starting with "." are private/decorative
|
|
36
|
-
/^_/ // Underscore prefix also common for internal layers
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Classify a Figma node into a documentation role.
|
|
41
|
-
*
|
|
42
|
-
* @param {Object} node - Figma node data
|
|
43
|
-
* @param {string} node.name - Layer name
|
|
44
|
-
* @param {string} node.type - Node type (INSTANCE, TEXT, FRAME, etc.)
|
|
45
|
-
* @param {boolean} node.visible - Whether the node is visible
|
|
46
|
-
* @param {Object} node.componentPropertyReferences - Boolean property bindings
|
|
47
|
-
* @param {number} node.childCount - Number of meaningful children (for instances)
|
|
48
|
-
* @param {string} node.componentName - Resolved component name (for instances)
|
|
49
|
-
*
|
|
50
|
-
* @returns {Object} { role, skip, reason }
|
|
51
|
-
* role: 'content-element' | 'optional-slot' | 'fixed-sub-component' | 'structural' | 'decorative'
|
|
52
|
-
* skip: boolean - whether to omit from documentation tables
|
|
53
|
-
* reason: string - human-readable explanation
|
|
54
|
-
*/
|
|
55
|
-
function classifyElement(node) {
|
|
56
|
-
const name = (node.name || '').trim();
|
|
57
|
-
const type = (node.type || '').toUpperCase();
|
|
58
|
-
|
|
59
|
-
// 1. Check if controlled by a boolean property → optional-slot
|
|
60
|
-
if (node.componentPropertyReferences &&
|
|
61
|
-
Object.keys(node.componentPropertyReferences).some(
|
|
62
|
-
key => key === 'visible' || key === 'mainComponent'
|
|
63
|
-
)) {
|
|
64
|
-
return {
|
|
65
|
-
role: 'optional-slot',
|
|
66
|
-
skip: false,
|
|
67
|
-
reason: `Controlled by boolean toggle`
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// 2. Check decorative patterns
|
|
72
|
-
for (const pattern of DECORATIVE_PATTERNS) {
|
|
73
|
-
if (pattern.test(name)) {
|
|
74
|
-
return {
|
|
75
|
-
role: 'decorative',
|
|
76
|
-
skip: true,
|
|
77
|
-
reason: `Name matches decorative pattern: ${pattern}`
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// 3. Check utility sub-components (for INSTANCE types)
|
|
83
|
-
if (type === 'INSTANCE' && node.componentName) {
|
|
84
|
-
const compNameLower = node.componentName.toLowerCase();
|
|
85
|
-
for (const util of UTILITY_COMPONENTS) {
|
|
86
|
-
if (compNameLower.includes(util)) {
|
|
87
|
-
return {
|
|
88
|
-
role: 'structural',
|
|
89
|
-
skip: true,
|
|
90
|
-
reason: `Utility sub-component: ${node.componentName}`
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// 4. Check structural frame patterns
|
|
97
|
-
if ((type === 'FRAME' || type === 'GROUP') && !node.hasContentChildren) {
|
|
98
|
-
for (const pattern of STRUCTURAL_PATTERNS) {
|
|
99
|
-
if (pattern.test(name)) {
|
|
100
|
-
return {
|
|
101
|
-
role: 'structural',
|
|
102
|
-
skip: true,
|
|
103
|
-
reason: `Structural wrapper matching: ${pattern}`
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// 5. INSTANCE with meaningful children → fixed-sub-component
|
|
110
|
-
if (type === 'INSTANCE' && node.childCount >= 2) {
|
|
111
|
-
return {
|
|
112
|
-
role: 'fixed-sub-component',
|
|
113
|
-
skip: false,
|
|
114
|
-
reason: `Instance with ${node.childCount} children — candidate for per-child section`
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// 6. Everything else → content-element
|
|
119
|
-
return {
|
|
120
|
-
role: 'content-element',
|
|
121
|
-
skip: false,
|
|
122
|
-
reason: `Content element of type ${type}`
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Check if a component instance qualifies for a per-child anatomy section.
|
|
128
|
-
*
|
|
129
|
-
* @param {Object} node - Figma instance node
|
|
130
|
-
* @returns {boolean}
|
|
131
|
-
*/
|
|
132
|
-
function qualifiesForPerChildSection(node) {
|
|
133
|
-
if (node.type !== 'INSTANCE') return false;
|
|
134
|
-
|
|
135
|
-
// Skip utility components
|
|
136
|
-
const compNameLower = (node.componentName || '').toLowerCase();
|
|
137
|
-
for (const util of UTILITY_COMPONENTS) {
|
|
138
|
-
if (compNameLower.includes(util)) return false;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Must have ≥3 internal child layers
|
|
142
|
-
if ((node.childCount || 0) < 3) return false;
|
|
143
|
-
|
|
144
|
-
// Must have its own configurable properties
|
|
145
|
-
if (node.hasOwnProperties) return true;
|
|
146
|
-
|
|
147
|
-
// Or must have enough structural complexity
|
|
148
|
-
return (node.childCount || 0) >= 3;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Collapse consecutive identical siblings.
|
|
153
|
-
* e.g., [Star, Star, Star, Star, Star] → [{ ...Star, count: 5, label: "Star (x5)" }]
|
|
154
|
-
*/
|
|
155
|
-
function collapseIdenticalSiblings(elements) {
|
|
156
|
-
const collapsed = [];
|
|
157
|
-
let i = 0;
|
|
158
|
-
|
|
159
|
-
while (i < elements.length) {
|
|
160
|
-
let count = 1;
|
|
161
|
-
const current = elements[i];
|
|
162
|
-
|
|
163
|
-
// Count consecutive elements with the same component ID
|
|
164
|
-
while (i + count < elements.length &&
|
|
165
|
-
elements[i + count].componentId === current.componentId &&
|
|
166
|
-
current.componentId != null) {
|
|
167
|
-
count++;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
collapsed.push({
|
|
171
|
-
...current,
|
|
172
|
-
count,
|
|
173
|
-
displayName: count > 1 ? `${current.name} (x${count})` : current.name
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
i += count;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return collapsed;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
module.exports = {
|
|
183
|
-
classifyElement,
|
|
184
|
-
qualifiesForPerChildSection,
|
|
185
|
-
collapseIdenticalSiblings,
|
|
186
|
-
UTILITY_COMPONENTS,
|
|
187
|
-
STRUCTURAL_PATTERNS,
|
|
188
|
-
DECORATIVE_PATTERNS
|
|
189
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* spec-helpers/index.js — Barrel export for spec helper modules.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const { classifyElement, qualifiesForPerChildSection, collapseIdenticalSiblings, UTILITY_COMPONENTS, STRUCTURAL_PATTERNS, DECORATIVE_PATTERNS } = require('./classify-elements');
|
|
6
|
-
const { buildTable, buildAnatomyTable, buildApiTable, buildColorTable, buildStructureTable, TABLE_STYLES } = require('./build-table');
|
|
7
|
-
const { calculateMarkerPositions, generateMarkerCommands, MARKER_DIAMETER, MARKER_COLOR, CONNECTOR_STROKE, MIN_MARKER_GAP, MARKER_OFFSET } = require('./position-markers');
|
|
8
|
-
const { parseFigmaLink } = require('./parse-figma-link');
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
// classify-elements
|
|
12
|
-
classifyElement,
|
|
13
|
-
qualifiesForPerChildSection,
|
|
14
|
-
collapseIdenticalSiblings,
|
|
15
|
-
UTILITY_COMPONENTS,
|
|
16
|
-
STRUCTURAL_PATTERNS,
|
|
17
|
-
DECORATIVE_PATTERNS,
|
|
18
|
-
// build-table
|
|
19
|
-
buildTable,
|
|
20
|
-
buildAnatomyTable,
|
|
21
|
-
buildApiTable,
|
|
22
|
-
buildColorTable,
|
|
23
|
-
buildStructureTable,
|
|
24
|
-
TABLE_STYLES,
|
|
25
|
-
// position-markers
|
|
26
|
-
calculateMarkerPositions,
|
|
27
|
-
generateMarkerCommands,
|
|
28
|
-
MARKER_DIAMETER,
|
|
29
|
-
MARKER_COLOR,
|
|
30
|
-
CONNECTOR_STROKE,
|
|
31
|
-
MIN_MARKER_GAP,
|
|
32
|
-
MARKER_OFFSET,
|
|
33
|
-
// parse-figma-link
|
|
34
|
-
parseFigmaLink,
|
|
35
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* parse-figma-link.js
|
|
3
|
-
*
|
|
4
|
-
* Parses a Figma URL into its component parts: file_key and node_id.
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* node parse-figma-link.js "https://www.figma.com/design/abc123/File-Name?node-id=100:200"
|
|
8
|
-
*
|
|
9
|
-
* Output (JSON):
|
|
10
|
-
* { "file_key": "abc123", "node_id": "100:200", "node_id_encoded": "100-200" }
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
function parseFigmaLink(url) {
|
|
14
|
-
// Handle both /design/ and /file/ URL formats
|
|
15
|
-
const fileMatch = url.match(/figma\.com\/(?:design|file)\/([a-zA-Z0-9]+)/);
|
|
16
|
-
if (!fileMatch) {
|
|
17
|
-
throw new Error(`Invalid Figma URL: could not extract file key from "${url}"`);
|
|
18
|
-
}
|
|
19
|
-
const file_key = fileMatch[1];
|
|
20
|
-
|
|
21
|
-
// Extract node-id from query params
|
|
22
|
-
const nodeMatch = url.match(/node-id=([^&]+)/);
|
|
23
|
-
if (!nodeMatch) {
|
|
24
|
-
throw new Error(`Invalid Figma URL: could not extract node-id from "${url}"`);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// node-id in URLs uses "-" separator, but Figma API uses ":"
|
|
28
|
-
const node_id_encoded = nodeMatch[1];
|
|
29
|
-
const node_id = node_id_encoded.replace(/-/g, ':');
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
file_key,
|
|
33
|
-
node_id,
|
|
34
|
-
node_id_encoded
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// CLI usage
|
|
39
|
-
if (typeof process !== 'undefined' && process.argv.length > 2) {
|
|
40
|
-
try {
|
|
41
|
-
const result = parseFigmaLink(process.argv[2]);
|
|
42
|
-
console.log(JSON.stringify(result, null, 2));
|
|
43
|
-
} catch (e) {
|
|
44
|
-
console.error(e.message);
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
module.exports = { parseFigmaLink };
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* position-markers.js
|
|
3
|
-
*
|
|
4
|
-
* Calculate marker positions for anatomy and color annotations.
|
|
5
|
-
* Places numbered markers outside the component artwork with
|
|
6
|
-
* non-overlapping leader lines to each target element.
|
|
7
|
-
*
|
|
8
|
-
* Used by anatomy and color spec rendering phases.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const MARKER_DIAMETER = 24;
|
|
12
|
-
const MARKER_COLOR = '#D946EF'; // Pink/magenta
|
|
13
|
-
const CONNECTOR_STROKE = 1;
|
|
14
|
-
const MIN_MARKER_GAP = 8;
|
|
15
|
-
const MARKER_OFFSET = 40; // Distance from artwork edge to marker center
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Calculate marker positions for a list of target elements.
|
|
19
|
-
*
|
|
20
|
-
* Strategy: Place markers in a column to the LEFT of the artwork,
|
|
21
|
-
* distributed evenly. If too many markers, use both left and right sides.
|
|
22
|
-
*
|
|
23
|
-
* @param {Object} artworkBounds - { x, y, width, height } of the component artwork
|
|
24
|
-
* @param {Array} targets - Array of { id, name, bounds: { x, y, width, height } }
|
|
25
|
-
* @returns {Array} Array of { targetId, markerX, markerY, lineStartX, lineStartY, lineEndX, lineEndY }
|
|
26
|
-
*/
|
|
27
|
-
function calculateMarkerPositions(artworkBounds, targets) {
|
|
28
|
-
const positions = [];
|
|
29
|
-
const count = targets.length;
|
|
30
|
-
|
|
31
|
-
if (count === 0) return positions;
|
|
32
|
-
|
|
33
|
-
// Determine available height for markers
|
|
34
|
-
const availableHeight = artworkBounds.height;
|
|
35
|
-
const markerSpacing = Math.max(
|
|
36
|
-
MARKER_DIAMETER + MIN_MARKER_GAP,
|
|
37
|
-
availableHeight / count
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
// If all markers fit on the left side
|
|
41
|
-
const maxLeftSide = Math.floor(availableHeight / (MARKER_DIAMETER + MIN_MARKER_GAP));
|
|
42
|
-
const useRightSide = count > maxLeftSide;
|
|
43
|
-
|
|
44
|
-
const leftCount = useRightSide ? Math.ceil(count / 2) : count;
|
|
45
|
-
const rightCount = useRightSide ? count - leftCount : 0;
|
|
46
|
-
|
|
47
|
-
// Place left-side markers
|
|
48
|
-
for (let i = 0; i < leftCount; i++) {
|
|
49
|
-
const target = targets[i];
|
|
50
|
-
const markerX = artworkBounds.x - MARKER_OFFSET;
|
|
51
|
-
const markerY = artworkBounds.y + (i * (availableHeight / leftCount)) + MARKER_DIAMETER;
|
|
52
|
-
|
|
53
|
-
// Connector line: from marker right edge to target left edge
|
|
54
|
-
const targetCenterY = target.bounds.y + target.bounds.height / 2;
|
|
55
|
-
|
|
56
|
-
positions.push({
|
|
57
|
-
targetId: target.id,
|
|
58
|
-
number: i + 1,
|
|
59
|
-
markerX,
|
|
60
|
-
markerY,
|
|
61
|
-
lineStartX: markerX + MARKER_DIAMETER / 2,
|
|
62
|
-
lineStartY: markerY,
|
|
63
|
-
lineEndX: target.bounds.x,
|
|
64
|
-
lineEndY: targetCenterY
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Place right-side markers (if needed)
|
|
69
|
-
for (let i = 0; i < rightCount; i++) {
|
|
70
|
-
const target = targets[leftCount + i];
|
|
71
|
-
const markerX = artworkBounds.x + artworkBounds.width + MARKER_OFFSET;
|
|
72
|
-
const markerY = artworkBounds.y + (i * (availableHeight / rightCount)) + MARKER_DIAMETER;
|
|
73
|
-
|
|
74
|
-
const targetCenterY = target.bounds.y + target.bounds.height / 2;
|
|
75
|
-
|
|
76
|
-
positions.push({
|
|
77
|
-
targetId: target.id,
|
|
78
|
-
number: leftCount + i + 1,
|
|
79
|
-
markerX,
|
|
80
|
-
markerY,
|
|
81
|
-
lineStartX: markerX - MARKER_DIAMETER / 2,
|
|
82
|
-
lineStartY: markerY,
|
|
83
|
-
lineEndX: target.bounds.x + target.bounds.width,
|
|
84
|
-
lineEndY: targetCenterY
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return positions;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Generate Figma MCP commands to render markers and connector lines.
|
|
93
|
-
*
|
|
94
|
-
* @param {string} parentFrameId - The frame to place markers in
|
|
95
|
-
* @param {Array} markerPositions - Output from calculateMarkerPositions
|
|
96
|
-
* @returns {Array} Array of MCP command objects
|
|
97
|
-
*/
|
|
98
|
-
function generateMarkerCommands(parentFrameId, markerPositions) {
|
|
99
|
-
const commands = [];
|
|
100
|
-
|
|
101
|
-
for (const pos of markerPositions) {
|
|
102
|
-
// Create marker circle
|
|
103
|
-
commands.push({
|
|
104
|
-
tool: 'create_ellipse',
|
|
105
|
-
params: {
|
|
106
|
-
parent_id: parentFrameId,
|
|
107
|
-
x: pos.markerX - MARKER_DIAMETER / 2,
|
|
108
|
-
y: pos.markerY - MARKER_DIAMETER / 2,
|
|
109
|
-
width: MARKER_DIAMETER,
|
|
110
|
-
height: MARKER_DIAMETER,
|
|
111
|
-
fill: MARKER_COLOR,
|
|
112
|
-
name: `Marker ${pos.number}`
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// Create number text inside marker
|
|
117
|
-
commands.push({
|
|
118
|
-
tool: 'create_text',
|
|
119
|
-
params: {
|
|
120
|
-
parent_id: parentFrameId,
|
|
121
|
-
x: pos.markerX - (pos.number >= 10 ? 7 : 4),
|
|
122
|
-
y: pos.markerY - 7,
|
|
123
|
-
content: String(pos.number),
|
|
124
|
-
font_size: 13,
|
|
125
|
-
font_weight: 'Bold',
|
|
126
|
-
color: '#FFFFFF',
|
|
127
|
-
name: `Marker ${pos.number} Label`
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
// Create connector line
|
|
132
|
-
commands.push({
|
|
133
|
-
tool: 'create_line',
|
|
134
|
-
params: {
|
|
135
|
-
parent_id: parentFrameId,
|
|
136
|
-
start_x: pos.lineStartX,
|
|
137
|
-
start_y: pos.lineStartY,
|
|
138
|
-
end_x: pos.lineEndX,
|
|
139
|
-
end_y: pos.lineEndY,
|
|
140
|
-
stroke_color: MARKER_COLOR,
|
|
141
|
-
stroke_weight: CONNECTOR_STROKE,
|
|
142
|
-
name: `Connector ${pos.number}`
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return commands;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
module.exports = {
|
|
151
|
-
calculateMarkerPositions,
|
|
152
|
-
generateMarkerCommands,
|
|
153
|
-
MARKER_DIAMETER,
|
|
154
|
-
MARKER_COLOR,
|
|
155
|
-
CONNECTOR_STROKE,
|
|
156
|
-
MIN_MARKER_GAP,
|
|
157
|
-
MARKER_OFFSET
|
|
158
|
-
};
|