@sxl-studio/bridge 1.7.2 → 1.8.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 +342 -16
- package/dist/agent-recipes.d.ts +781 -11
- package/dist/agent-recipes.js +886 -13
- package/dist/agent-recipes.js.map +1 -1
- package/dist/agent-runbook.d.ts +50 -0
- package/dist/agent-runbook.js +243 -0
- package/dist/agent-runbook.js.map +1 -0
- package/dist/asset-upload.d.ts +63 -0
- package/dist/asset-upload.js +225 -0
- package/dist/asset-upload.js.map +1 -0
- package/dist/audit-store.d.ts +15 -0
- package/dist/audit-store.js +100 -0
- package/dist/audit-store.js.map +1 -0
- package/dist/audit.d.ts +4 -3
- package/dist/audit.js +37 -4
- package/dist/audit.js.map +1 -1
- package/dist/auth.d.ts +8 -1
- package/dist/auth.js +41 -1
- package/dist/auth.js.map +1 -1
- package/dist/bridge-agent-workflow-validation-cli.d.ts +2 -0
- package/dist/bridge-agent-workflow-validation-cli.js +68 -0
- package/dist/bridge-agent-workflow-validation-cli.js.map +1 -0
- package/dist/bridge-agent-workflow-validation.d.ts +42 -0
- package/dist/bridge-agent-workflow-validation.js +170 -0
- package/dist/bridge-agent-workflow-validation.js.map +1 -0
- package/dist/bridge-contract-audit.d.ts +45 -0
- package/dist/bridge-contract-audit.js +345 -0
- package/dist/bridge-contract-audit.js.map +1 -0
- package/dist/bridge-health-cli.d.ts +2 -0
- package/dist/bridge-health-cli.js +115 -0
- package/dist/bridge-health-cli.js.map +1 -0
- package/dist/bridge-health.d.ts +33 -0
- package/dist/bridge-health.js +594 -0
- package/dist/bridge-health.js.map +1 -0
- package/dist/bridge-live-validation-cli.d.ts +2 -0
- package/dist/bridge-live-validation-cli.js +114 -0
- package/dist/bridge-live-validation-cli.js.map +1 -0
- package/dist/bridge-live-validation.d.ts +39 -0
- package/dist/bridge-live-validation.js +1141 -0
- package/dist/bridge-live-validation.js.map +1 -0
- package/dist/bridge-performance-profile.d.ts +81 -0
- package/dist/bridge-performance-profile.js +227 -0
- package/dist/bridge-performance-profile.js.map +1 -0
- package/dist/bridge-readiness-cli.d.ts +30 -0
- package/dist/bridge-readiness-cli.js +242 -0
- package/dist/bridge-readiness-cli.js.map +1 -0
- package/dist/bridge-runtime-summary.d.ts +50 -0
- package/dist/bridge-runtime-summary.js +112 -0
- package/dist/bridge-runtime-summary.js.map +1 -0
- package/dist/bridge-workflow-smoke-cli.d.ts +2 -0
- package/dist/bridge-workflow-smoke-cli.js +126 -0
- package/dist/bridge-workflow-smoke-cli.js.map +1 -0
- package/dist/bridge-workflow-smoke.d.ts +39 -0
- package/dist/bridge-workflow-smoke.js +431 -0
- package/dist/bridge-workflow-smoke.js.map +1 -0
- package/dist/codeconnect-suggestions.d.ts +74 -0
- package/dist/codeconnect-suggestions.js +398 -0
- package/dist/codeconnect-suggestions.js.map +1 -0
- package/dist/codeconnect-template.d.ts +98 -0
- package/dist/codeconnect-template.js +280 -0
- package/dist/codeconnect-template.js.map +1 -0
- package/dist/command-queue.d.ts +11 -1
- package/dist/command-queue.js +200 -1
- package/dist/command-queue.js.map +1 -1
- package/dist/command-safety.d.ts +13 -0
- package/dist/command-safety.js +59 -0
- package/dist/command-safety.js.map +1 -0
- package/dist/enabled-library-search.d.ts +49 -0
- package/dist/enabled-library-search.js +151 -0
- package/dist/enabled-library-search.js.map +1 -0
- package/dist/figma-mcp-parity.d.ts +49 -0
- package/dist/figma-mcp-parity.js +368 -0
- package/dist/figma-mcp-parity.js.map +1 -0
- package/dist/figma-mcp-skills-parity.d.ts +61 -0
- package/dist/figma-mcp-skills-parity.js +434 -0
- package/dist/figma-mcp-skills-parity.js.map +1 -0
- package/dist/figma-rest-diagnostics.d.ts +50 -0
- package/dist/figma-rest-diagnostics.js +314 -0
- package/dist/figma-rest-diagnostics.js.map +1 -0
- package/dist/figma-rest.d.ts +27 -0
- package/dist/figma-rest.js +116 -0
- package/dist/figma-rest.js.map +1 -0
- package/dist/http-api.d.ts +16 -2
- package/dist/http-api.js +329 -17
- package/dist/http-api.js.map +1 -1
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-factory.d.ts +6 -1
- package/dist/mcp-factory.js +23 -4
- package/dist/mcp-factory.js.map +1 -1
- package/dist/mcp-runtime-probe.d.ts +22 -0
- package/dist/mcp-runtime-probe.js +777 -0
- package/dist/mcp-runtime-probe.js.map +1 -0
- package/dist/mcp-server.d.ts +2 -1
- package/dist/mcp-server.js +2 -2
- package/dist/mcp-server.js.map +1 -1
- package/dist/sxl-mcp-instructions.js +99 -26
- package/dist/sxl-mcp-instructions.js.map +1 -1
- package/dist/tools/audit.d.ts +22 -6
- package/dist/tools/audit.js +49 -7
- package/dist/tools/audit.js.map +1 -1
- package/dist/tools/capability-matrix.d.ts +22 -0
- package/dist/tools/capability-matrix.js +38 -0
- package/dist/tools/capability-matrix.js.map +1 -0
- package/dist/tools/catalogue-bootstrap.d.ts +1 -0
- package/dist/tools/catalogue-bootstrap.js +665 -30
- package/dist/tools/catalogue-bootstrap.js.map +1 -1
- package/dist/tools/code-connect-context.d.ts +3 -0
- package/dist/tools/code-connect-context.js +319 -0
- package/dist/tools/code-connect-context.js.map +1 -0
- package/dist/tools/code-connect-template.d.ts +3 -0
- package/dist/tools/code-connect-template.js +111 -0
- package/dist/tools/code-connect-template.js.map +1 -0
- package/dist/tools/composition.js +15 -30
- package/dist/tools/composition.js.map +1 -1
- package/dist/tools/compositions-orchestration.d.ts +14 -14
- package/dist/tools/compositions-orchestration.js +2 -2
- package/dist/tools/compositions-orchestration.js.map +1 -1
- package/dist/tools/data.js +839 -27
- package/dist/tools/data.js.map +1 -1
- package/dist/tools/design-context.d.ts +3 -0
- package/dist/tools/design-context.js +197 -0
- package/dist/tools/design-context.js.map +1 -0
- package/dist/tools/destructive-confirmation.d.ts +10 -0
- package/dist/tools/destructive-confirmation.js +25 -0
- package/dist/tools/destructive-confirmation.js.map +1 -0
- package/dist/tools/diagnostics.js +76 -51
- package/dist/tools/diagnostics.js.map +1 -1
- package/dist/tools/figma-mcp-design.d.ts +3 -0
- package/dist/tools/figma-mcp-design.js +377 -0
- package/dist/tools/figma-mcp-design.js.map +1 -0
- package/dist/tools/figma-nodes.js +57 -43
- package/dist/tools/figma-nodes.js.map +1 -1
- package/dist/tools/figma-rc-extended.js +23 -6
- package/dist/tools/figma-rc-extended.js.map +1 -1
- package/dist/tools/figma-rest.d.ts +39 -0
- package/dist/tools/figma-rest.js +279 -0
- package/dist/tools/figma-rest.js.map +1 -0
- package/dist/tools/git.js +11 -7
- package/dist/tools/git.js.map +1 -1
- package/dist/tools/large-data.d.ts +14 -0
- package/dist/tools/large-data.js +189 -0
- package/dist/tools/large-data.js.map +1 -0
- package/dist/tools/meta.d.ts +6 -1
- package/dist/tools/meta.js +89 -11
- package/dist/tools/meta.js.map +1 -1
- package/dist/tools/metadata.d.ts +3 -0
- package/dist/tools/metadata.js +140 -0
- package/dist/tools/metadata.js.map +1 -0
- package/dist/tools/mockup.d.ts +15 -156
- package/dist/tools/mockup.js +54 -121
- package/dist/tools/mockup.js.map +1 -1
- package/dist/tools/orchestration.js +75 -47
- package/dist/tools/orchestration.js.map +1 -1
- package/dist/tools/prompts.d.ts +3 -0
- package/dist/tools/prompts.js +219 -0
- package/dist/tools/prompts.js.map +1 -0
- package/dist/tools/registry.d.ts +19 -1
- package/dist/tools/registry.js +4 -4
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/resources.d.ts +19 -2
- package/dist/tools/resources.js +149 -5
- package/dist/tools/resources.js.map +1 -1
- package/dist/tools/schema-contracts.d.ts +4763 -0
- package/dist/tools/schema-contracts.js +814 -0
- package/dist/tools/schema-contracts.js.map +1 -0
- package/dist/tools/screenshot.d.ts +3 -0
- package/dist/tools/screenshot.js +144 -0
- package/dist/tools/screenshot.js.map +1 -0
- package/dist/tools/shared.d.ts +11 -1
- package/dist/tools/shared.js +55 -2
- package/dist/tools/shared.js.map +1 -1
- package/dist/tools/styles-orchestration.d.ts +2 -2
- package/dist/tools/styles-orchestration.js +13 -5
- package/dist/tools/styles-orchestration.js.map +1 -1
- package/dist/tools/styles.js +22 -8
- package/dist/tools/styles.js.map +1 -1
- package/dist/tools/tokens.d.ts +31 -692
- package/dist/tools/tokens.js +175 -135
- package/dist/tools/tokens.js.map +1 -1
- package/dist/tools/variable-defs.d.ts +3 -0
- package/dist/tools/variable-defs.js +338 -0
- package/dist/tools/variable-defs.js.map +1 -0
- package/dist/tools/variables-orchestration.js +13 -5
- package/dist/tools/variables-orchestration.js.map +1 -1
- package/dist/tools/variables.js +18 -15
- package/dist/tools/variables.js.map +1 -1
- package/dist/types.d.ts +53 -0
- package/dist/ultimate-readiness-audit.d.ts +37 -0
- package/dist/ultimate-readiness-audit.js +431 -0
- package/dist/ultimate-readiness-audit.js.map +1 -0
- package/dist/workflow-planner.d.ts +57 -0
- package/dist/workflow-planner.js +464 -0
- package/dist/workflow-planner.js.map +1 -0
- package/dist/workspace-blob-store.d.ts +6 -0
- package/dist/workspace-blob-store.js +9 -0
- package/dist/workspace-blob-store.js.map +1 -1
- package/dist/workspace-path-http.d.ts +24 -0
- package/dist/workspace-path-http.js +146 -0
- package/dist/workspace-path-http.js.map +1 -0
- package/dist/ws-server.js +16 -3
- package/dist/ws-server.js.map +1 -1
- package/package.json +21 -2
package/dist/agent-recipes.js
CHANGED
|
@@ -21,6 +21,165 @@ export const RECIPE_INDEX = {
|
|
|
21
21
|
version: 1,
|
|
22
22
|
context: "Decision tree for any documentation / palette / scenario request that targets a Figma file managed by SXL Studio. Always read this resource first; it routes the agent to a specific recipe instead of running ad-hoc figma.* JS.",
|
|
23
23
|
userIntents: [
|
|
24
|
+
{
|
|
25
|
+
recipeId: "sxl-use",
|
|
26
|
+
userPhrases: [
|
|
27
|
+
"управляй фигмой через bridge",
|
|
28
|
+
"figma-use",
|
|
29
|
+
"use_figma",
|
|
30
|
+
"use figma to update the current design file",
|
|
31
|
+
"create or modify nodes in figma",
|
|
32
|
+
"read selection and edit canvas",
|
|
33
|
+
"назначь переменные объектам",
|
|
34
|
+
"work with variables styles and components",
|
|
35
|
+
"use figma rest api",
|
|
36
|
+
"diagnose figma rest token",
|
|
37
|
+
"whoami figma token",
|
|
38
|
+
"search known figma library",
|
|
39
|
+
"get_libraries",
|
|
40
|
+
"search_design_system",
|
|
41
|
+
"search design system library",
|
|
42
|
+
"upload images to figma",
|
|
43
|
+
"загрузи изображения в фигму",
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
recipeId: "sxl-implement-design",
|
|
48
|
+
userPhrases: [
|
|
49
|
+
"figma-implement-design",
|
|
50
|
+
"figma-swiftui",
|
|
51
|
+
"implement this figma design in swiftui",
|
|
52
|
+
"convert figma selection to swiftui",
|
|
53
|
+
"implement this figma design in code",
|
|
54
|
+
"turn figma selection into code",
|
|
55
|
+
"convert figma selection to code",
|
|
56
|
+
"реализуй выбранный макет в коде",
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
recipeId: "sxl-generate-design",
|
|
61
|
+
userPhrases: [
|
|
62
|
+
"нарисуй экран в фигме",
|
|
63
|
+
"figma-generate-design",
|
|
64
|
+
"generate_figma_design",
|
|
65
|
+
"code to canvas",
|
|
66
|
+
"push app page into figma",
|
|
67
|
+
"build a real UI screen in Figma",
|
|
68
|
+
"собери макет из дизайн-системы",
|
|
69
|
+
"update this screen without rebuilding everything",
|
|
70
|
+
"validate screen spec before applying",
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
recipeId: "sxl-generate-library",
|
|
75
|
+
userPhrases: [
|
|
76
|
+
"создай дизайн-систему в фигме",
|
|
77
|
+
"figma-generate-library",
|
|
78
|
+
"generate a figma design system library",
|
|
79
|
+
"generate library in figma from codebase",
|
|
80
|
+
"generate library variables styles components docs",
|
|
81
|
+
"экспортируй переменные и стили",
|
|
82
|
+
"пересобери компоненты из композиций",
|
|
83
|
+
"build design system foundations",
|
|
84
|
+
"figma-create-design-system-rules",
|
|
85
|
+
"create design system rules for this project",
|
|
86
|
+
"generate rules for translating figma designs into code",
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
recipeId: "sxl-code-connect",
|
|
91
|
+
userPhrases: [
|
|
92
|
+
"настрой code connect",
|
|
93
|
+
"figma-code-connect",
|
|
94
|
+
"figma-code-connect-components",
|
|
95
|
+
"get_context_for_code_connect",
|
|
96
|
+
"send_code_connect_mappings",
|
|
97
|
+
"save code connect binding",
|
|
98
|
+
"свяжи figma компонент с storybook",
|
|
99
|
+
"show code connect registry",
|
|
100
|
+
"component docs url files storybook binding",
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
recipeId: "sxl-audit",
|
|
105
|
+
userPhrases: [
|
|
106
|
+
"проведи аудит макетов",
|
|
107
|
+
"analyze variables styles and component usage",
|
|
108
|
+
"проверь пропсы компонентов",
|
|
109
|
+
"найди компоненты с prop value",
|
|
110
|
+
"audit coverage drift unused analytics",
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
recipeId: "sxl-doc-builder",
|
|
115
|
+
userPhrases: [
|
|
116
|
+
"нарисуй документацию в фигме",
|
|
117
|
+
"build documentation in Figma",
|
|
118
|
+
"документация компонентов токенов флоу",
|
|
119
|
+
"render markdown scenario as Figma flow",
|
|
120
|
+
"apply doc spec",
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
recipeId: "sxl-data-apply-mapping",
|
|
125
|
+
userPhrases: [
|
|
126
|
+
"примени маппинг",
|
|
127
|
+
"примени mapping",
|
|
128
|
+
"apply mapping to selection",
|
|
129
|
+
"apply data mapping",
|
|
130
|
+
"подставь данные по маппингу",
|
|
131
|
+
"fill selected nodes from dataset",
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
recipeId: "sxl-data-apply-all",
|
|
136
|
+
userPhrases: [
|
|
137
|
+
"примени все маппинги",
|
|
138
|
+
"apply all mappings",
|
|
139
|
+
"apply all data mappings",
|
|
140
|
+
"подставь данные по всем маппингам",
|
|
141
|
+
"apply mappings on page",
|
|
142
|
+
"apply mappings to document",
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
recipeId: "sxl-data-generate-instances",
|
|
147
|
+
userPhrases: [
|
|
148
|
+
"сгенерируй инстансы из датасета",
|
|
149
|
+
"generate instances from dataset",
|
|
150
|
+
"generate instances from mapping",
|
|
151
|
+
"создай строки из датасета",
|
|
152
|
+
"render rows from mapping data",
|
|
153
|
+
"generate cards from dataset mapping",
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
recipeId: "sxl-database-transfer",
|
|
158
|
+
userPhrases: [
|
|
159
|
+
"экспортируй базу sxl",
|
|
160
|
+
"импортируй базу sxl",
|
|
161
|
+
"backup sxl database",
|
|
162
|
+
"restore sxl database",
|
|
163
|
+
"export database payload",
|
|
164
|
+
"import database payload",
|
|
165
|
+
"перенеси datasets assets mappings",
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
recipeId: "figma-mcp-companion",
|
|
170
|
+
userPhrases: [
|
|
171
|
+
"figma-create-new-file",
|
|
172
|
+
"create_new_file",
|
|
173
|
+
"create a new figma file",
|
|
174
|
+
"new figma design file",
|
|
175
|
+
"figma-generate-diagram",
|
|
176
|
+
"generate_diagram",
|
|
177
|
+
"create a figjam diagram",
|
|
178
|
+
"figma-use-figjam",
|
|
179
|
+
"figma-use-slides",
|
|
180
|
+
"create figma slides",
|
|
181
|
+
],
|
|
182
|
+
},
|
|
24
183
|
{
|
|
25
184
|
recipeId: "doc-tokens",
|
|
26
185
|
userPhrases: [
|
|
@@ -112,7 +271,12 @@ export const RECIPE_INDEX = {
|
|
|
112
271
|
recipeId: "audit-coverage",
|
|
113
272
|
userPhrases: [
|
|
114
273
|
"проверь везде ли подкреплены переменные",
|
|
274
|
+
"проверь на всех макетах установлены ли переменные и стили",
|
|
275
|
+
"проверь на всех ли макетах и объектах установленные переменные",
|
|
276
|
+
"проверь переменные и стили на макетах",
|
|
115
277
|
"найди объекты без переменных",
|
|
278
|
+
"check whether every screen object has variables and styles assigned",
|
|
279
|
+
"check variable and style coverage across layouts",
|
|
116
280
|
"audit raw values without variables",
|
|
117
281
|
"review the file for missing bindings",
|
|
118
282
|
"где hex заливки вместо токенов",
|
|
@@ -321,6 +485,608 @@ export const RECIPE_INDEX = {
|
|
|
321
485
|
],
|
|
322
486
|
doneCriteria: "Agent picked exactly one recipe, called only the tools it lists, and produced a verifiable result (doneWhen of that recipe).",
|
|
323
487
|
};
|
|
488
|
+
export const RECIPE_SXL_USE = {
|
|
489
|
+
id: "sxl-use",
|
|
490
|
+
title: "SXL Use — read/write the current Figma Design file through Bridge",
|
|
491
|
+
version: 1,
|
|
492
|
+
context: "Foundational SXL skill for canvas reads/writes, variables, styles, components, token workspace operations, status checks, and design-to-code context. Mirrors the role of figma-use for SXL Studio and supplies the active-file context needed by figma-implement-design-style workflows: prefer Bridge tools and plugin handlers over arbitrary use_figma scripts.",
|
|
493
|
+
userPhrases: [
|
|
494
|
+
"управляй фигмой через bridge",
|
|
495
|
+
"create or modify nodes in figma",
|
|
496
|
+
"read selection and edit canvas",
|
|
497
|
+
"назначь переменные объектам",
|
|
498
|
+
"work with variables styles and components",
|
|
499
|
+
"figma-implement-design",
|
|
500
|
+
"implement this figma design in code",
|
|
501
|
+
"turn figma selection into code",
|
|
502
|
+
"diagnose figma rest token",
|
|
503
|
+
"whoami figma token",
|
|
504
|
+
"search known figma library",
|
|
505
|
+
"get_libraries",
|
|
506
|
+
"search_design_system",
|
|
507
|
+
"search organization design library",
|
|
508
|
+
"get variable definitions used in selection",
|
|
509
|
+
"покажи переменные и стили выделения",
|
|
510
|
+
],
|
|
511
|
+
decideBetween: [
|
|
512
|
+
{
|
|
513
|
+
between: ["sxl-use", "sxl-generate-design"],
|
|
514
|
+
hint: "sxl-use handles low-level targeted reads/writes; sxl-generate-design assembles or updates full screens via Design DSL.",
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
between: ["sxl-use", "sxl-audit"],
|
|
518
|
+
hint: "sxl-use writes after the target is known; sxl-audit discovers usage, coverage, drift, unused entries, or component prop statistics first.",
|
|
519
|
+
},
|
|
520
|
+
],
|
|
521
|
+
preferredTools: [
|
|
522
|
+
"get_bridge_runtime_summary",
|
|
523
|
+
"get_plugin_status",
|
|
524
|
+
"get_capability_matrix",
|
|
525
|
+
"get_figma_mcp_skills_parity",
|
|
526
|
+
"list_tools",
|
|
527
|
+
"get_selection",
|
|
528
|
+
"get_design_context",
|
|
529
|
+
"get_metadata",
|
|
530
|
+
"get_node_info",
|
|
531
|
+
"get_node_tree",
|
|
532
|
+
"get_screenshot",
|
|
533
|
+
"get_variable_defs",
|
|
534
|
+
"get_context_for_code_connect",
|
|
535
|
+
"get_code_connect_suggestions",
|
|
536
|
+
"get_libraries",
|
|
537
|
+
"search_design_system",
|
|
538
|
+
"get_variables",
|
|
539
|
+
"get_local_styles",
|
|
540
|
+
"search_enabled_library_assets",
|
|
541
|
+
"inspect_enabled_libraries",
|
|
542
|
+
"list_enabled_library_variables",
|
|
543
|
+
"figma_rest_diagnose",
|
|
544
|
+
"figma_rest_whoami",
|
|
545
|
+
"figma_rest_get_file_nodes",
|
|
546
|
+
"figma_rest_search_design_system",
|
|
547
|
+
"upload_assets",
|
|
548
|
+
"set_node_fill_variable",
|
|
549
|
+
"batch_bind_variables",
|
|
550
|
+
],
|
|
551
|
+
schemaResources: ["sxl://agent/schemas/code-connect-context-v1"],
|
|
552
|
+
forbidden: [
|
|
553
|
+
"Calling use_figma with a hand-written figma.* script when a Bridge tool exists.",
|
|
554
|
+
"Writing canvas changes before checking get_plugin_status.writesAllowed.",
|
|
555
|
+
"Fetching image URLs in an ad-hoc script or sending raw imageBytes arrays when upload_assets can validate and apply assets.",
|
|
556
|
+
"Looping single-node writes for bulk variable binding when batch_bind_variables covers the request.",
|
|
557
|
+
],
|
|
558
|
+
steps: [
|
|
559
|
+
"Call get_bridge_runtime_summary before heavy workflows to check plugin connection, queue pressure, recent failures, and auth status.",
|
|
560
|
+
"Call get_plugin_status and inspect editorType / writesAllowed before any write.",
|
|
561
|
+
"Call get_capability_matrix or list_tools if tool choice is uncertain; prefer tools with dryRunSupported for writes.",
|
|
562
|
+
"For Figma MCP-style library discovery, prefer get_libraries and search_design_system; they combine active-file enabled libraries, local components, and known REST file/team libraries where configured.",
|
|
563
|
+
"When the plugin is not open, cross-file context is needed, or the request targets a known file/team library outside the active file, call figma_rest_diagnose first; get_libraries/search_design_system can then use fileKey/url/teamId with a configured FIGMA_TOKEN / FIGMA_ACCESS_TOKEN.",
|
|
564
|
+
"For image insertion in Figma Design, call upload_assets with dryRun=true first; it validates PNG/JPG/GIF/WebP assets up to 10MB and applies them through set_image_fill.",
|
|
565
|
+
"Read the narrowest needed context: current selection, node tree, variables, or styles.",
|
|
566
|
+
"For design implementation requests, call get_design_context plus get_variable_defs/get_screenshot/get_context_for_code_connect when components or code mappings matter; the agent then edits project code outside the plugin.",
|
|
567
|
+
"For writes, use the thickest Bridge command that covers the task; fall back to direct canvas tools only for small targeted edits.",
|
|
568
|
+
"After writes, inspect the changed node or rerun the relevant audit/read tool.",
|
|
569
|
+
],
|
|
570
|
+
doneCriteria: "Agent completed the requested Figma operation through Bridge tools, respected Design/Dev mode constraints, and did not use arbitrary use_figma scripts.",
|
|
571
|
+
};
|
|
572
|
+
export const RECIPE_SXL_IMPLEMENT_DESIGN = {
|
|
573
|
+
id: "sxl-implement-design",
|
|
574
|
+
title: "SXL Implement Design — read Figma context for code implementation",
|
|
575
|
+
version: 1,
|
|
576
|
+
context: "Read-only Bridge workflow for Figma-to-code requests, including current official figma-swiftui and legacy/client figma-implement-design-style aliases. It gathers active-file design context, screenshots, variable/style definitions, SXL codegen/composition data, and Code Connect hints so the agent can edit the repository code outside Figma. It must not mutate the Figma canvas.",
|
|
577
|
+
userPhrases: [
|
|
578
|
+
"figma-implement-design",
|
|
579
|
+
"figma-swiftui",
|
|
580
|
+
"implement this figma design in swiftui",
|
|
581
|
+
"convert figma selection to swiftui",
|
|
582
|
+
"implement this figma design in code",
|
|
583
|
+
"turn figma selection into code",
|
|
584
|
+
"convert figma selection to code",
|
|
585
|
+
"реализуй выбранный макет в коде",
|
|
586
|
+
],
|
|
587
|
+
decideBetween: [
|
|
588
|
+
{
|
|
589
|
+
between: ["sxl-implement-design", "sxl-use"],
|
|
590
|
+
hint: "sxl-implement-design is read-only context for code implementation; sxl-use is broad active-file read/write control.",
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
between: ["sxl-implement-design", "sxl-generate-design"],
|
|
594
|
+
hint: "sxl-implement-design turns Figma into repository code; sxl-generate-design builds Figma screens from a spec/code context.",
|
|
595
|
+
},
|
|
596
|
+
],
|
|
597
|
+
preferredTools: [
|
|
598
|
+
"get_bridge_runtime_summary",
|
|
599
|
+
"get_figma_mcp_skills_parity",
|
|
600
|
+
"get_design_context",
|
|
601
|
+
"get_metadata",
|
|
602
|
+
"get_screenshot",
|
|
603
|
+
"get_variable_defs",
|
|
604
|
+
"get_context_for_code_connect",
|
|
605
|
+
"get_code_connect_suggestions",
|
|
606
|
+
"get_codegen",
|
|
607
|
+
"export_composition_json",
|
|
608
|
+
],
|
|
609
|
+
schemaResources: ["sxl://agent/schemas/code-connect-context-v1"],
|
|
610
|
+
forbidden: [
|
|
611
|
+
"Mutating the Figma canvas for an implement-design request.",
|
|
612
|
+
"Calling upload_assets, set_node_fill_variable, batch_bind_variables, build_screen, or export_variables.",
|
|
613
|
+
"Treating SXL codegen as final project code without adapting it to repository components and conventions.",
|
|
614
|
+
],
|
|
615
|
+
steps: [
|
|
616
|
+
"Call get_bridge_runtime_summary to confirm Bridge/plugin state and queue pressure.",
|
|
617
|
+
"Call get_design_context for the selected frame/component; include screenshot/context options when useful.",
|
|
618
|
+
"Call get_variable_defs and get_screenshot when visual/token fidelity matters.",
|
|
619
|
+
"Call get_context_for_code_connect and get_code_connect_suggestions when component mappings or Storybook context matter.",
|
|
620
|
+
"Use get_codegen/export_composition_json only as reference material; then edit repository code with normal project tooling.",
|
|
621
|
+
],
|
|
622
|
+
doneCriteria: "Agent collected read-only Figma/SXL context and implemented or updated repository code without mutating the Figma file.",
|
|
623
|
+
};
|
|
624
|
+
export const RECIPE_SXL_GENERATE_DESIGN = {
|
|
625
|
+
id: "sxl-generate-design",
|
|
626
|
+
title: "SXL Generate Design — build or update real UI screens in Figma",
|
|
627
|
+
version: 1,
|
|
628
|
+
context: "Screen-building skill for real editable Figma Design files. Use inspect_design_system + validate_screen_spec + build_screen/update_screen first; direct canvas tools are fallback only.",
|
|
629
|
+
userPhrases: [
|
|
630
|
+
"нарисуй экран в фигме",
|
|
631
|
+
"build a real UI screen in Figma",
|
|
632
|
+
"собери макет из дизайн-системы",
|
|
633
|
+
"update this screen without rebuilding everything",
|
|
634
|
+
"validate screen spec before applying",
|
|
635
|
+
],
|
|
636
|
+
decideBetween: [
|
|
637
|
+
{
|
|
638
|
+
between: ["sxl-generate-design", "mockup-builder"],
|
|
639
|
+
hint: "sxl-generate-design is the top-level screen skill; mockup-builder is the detailed recipe for the underlying build_mockup/build_screen DSL.",
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
between: ["sxl-generate-design", "sxl-doc-builder"],
|
|
643
|
+
hint: "generate-design builds product UI screens; doc-builder builds documentation pages, palettes, component docs, and flows.",
|
|
644
|
+
},
|
|
645
|
+
],
|
|
646
|
+
preferredTools: [
|
|
647
|
+
"inspect_design_system",
|
|
648
|
+
"validate_screen_spec",
|
|
649
|
+
"build_screen",
|
|
650
|
+
"update_screen",
|
|
651
|
+
"find_components",
|
|
652
|
+
"search_enabled_library_assets",
|
|
653
|
+
"inspect_enabled_libraries",
|
|
654
|
+
"get_variables",
|
|
655
|
+
"audit_variable_coverage",
|
|
656
|
+
],
|
|
657
|
+
schemaResources: ["sxl://agent/schemas/design-dsl-v1"],
|
|
658
|
+
forbidden: [
|
|
659
|
+
"Creating a screen by hand with many create_frame/create_text/create_component_instance calls when build_screen covers it.",
|
|
660
|
+
"Guessing component names or component prop keys without inspect_design_system / find_components.",
|
|
661
|
+
"Committing build_screen/update_screen without a dryRun or validate_screen_spec preview.",
|
|
662
|
+
"Hardcoding hex colors when a local Figma Variable is available.",
|
|
663
|
+
],
|
|
664
|
+
steps: [
|
|
665
|
+
"Run inspect_design_system with includeProperties and a narrow query/prefix when possible; use search_enabled_library_assets when the user expects components/styles/variables from libraries enabled in the current file.",
|
|
666
|
+
"Draft a Design DSL v1 spec using real component ids/keys, human prop keys, text overrides, and variable fill bindings.",
|
|
667
|
+
"Call validate_screen_spec or build_screen/update_screen with dryRun: true and fix any unresolved components/props.",
|
|
668
|
+
"Commit build_screen or update_screen only after the dry-run plan is clean or approved.",
|
|
669
|
+
"Run audit_variable_coverage on the resulting root/page when variable binding quality matters.",
|
|
670
|
+
],
|
|
671
|
+
doneCriteria: "A real Figma screen was created or updated with existing components, auto layout, and variable/style bindings where available. The flow used dryRun before write.",
|
|
672
|
+
};
|
|
673
|
+
export const RECIPE_SXL_GENERATE_LIBRARY = {
|
|
674
|
+
id: "sxl-generate-library",
|
|
675
|
+
title: "SXL Generate Library — variables, styles, compositions, and docs",
|
|
676
|
+
version: 1,
|
|
677
|
+
context: "Design-system skill for SXL Studio. Covers safe export_variables modes, bulk variable/style specs, composition generation, drift checks, library documentation, and the SXL context needed by figma-create-design-system-rules-style agent workflows.",
|
|
678
|
+
userPhrases: [
|
|
679
|
+
"создай дизайн-систему в фигме",
|
|
680
|
+
"generate library variables styles components docs",
|
|
681
|
+
"экспортируй переменные и стили",
|
|
682
|
+
"пересобери компоненты из композиций",
|
|
683
|
+
"build design system foundations",
|
|
684
|
+
"figma-create-design-system-rules",
|
|
685
|
+
"create design system rules for this project",
|
|
686
|
+
"generate rules for translating figma designs into code",
|
|
687
|
+
],
|
|
688
|
+
decideBetween: [
|
|
689
|
+
{
|
|
690
|
+
between: ["sxl-generate-library", "bulk-variables"],
|
|
691
|
+
hint: "use bulk-variables for variable-only refactors; use sxl-generate-library when variables, styles, compositions, and docs are part of one system workflow.",
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
between: ["sxl-generate-library", "bulk-compositions"],
|
|
695
|
+
hint: "bulk-compositions rebuilds existing composition files; sxl-generate-library orchestrates the broader library pipeline.",
|
|
696
|
+
},
|
|
697
|
+
],
|
|
698
|
+
preferredTools: [
|
|
699
|
+
"get_tokens_config",
|
|
700
|
+
"get_figma_mcp_skills_parity",
|
|
701
|
+
"search_enabled_library_assets",
|
|
702
|
+
"inspect_enabled_libraries",
|
|
703
|
+
"list_enabled_library_variables",
|
|
704
|
+
"inspect_design_system",
|
|
705
|
+
"get_context_for_code_connect",
|
|
706
|
+
"get_code_connect_suggestions",
|
|
707
|
+
"preview_export_variables",
|
|
708
|
+
"export_variables",
|
|
709
|
+
"import_variable_spec",
|
|
710
|
+
"import_style_spec",
|
|
711
|
+
"list_compositions",
|
|
712
|
+
"bulk_generate_compositions",
|
|
713
|
+
"audit_composition_drift",
|
|
714
|
+
"build_component_doc",
|
|
715
|
+
],
|
|
716
|
+
forbidden: [
|
|
717
|
+
"Using destructive export options such as deleteOrphans, forceUpdateAll, or allowDestructiveReorder unless the user explicitly asked for them.",
|
|
718
|
+
"Claiming export_variables applies codeSyntax/scopes by default; plugin safe default is applyCodeSyntaxAndScopes=false.",
|
|
719
|
+
"Hand-crafting composition JSON instead of export_composition_json / compose_from_url / list_compositions.",
|
|
720
|
+
"Bulk-generating compositions without dryRun first.",
|
|
721
|
+
],
|
|
722
|
+
steps: [
|
|
723
|
+
"Read get_tokens_config and list_token_files/list_compositions to understand the workspace; use inspect_enabled_libraries/list_enabled_library_variables when reconciling enabled library definitions.",
|
|
724
|
+
"For design-system-rules requests, call inspect_design_system and get_context_for_code_connect/get_code_connect_suggestions when code mappings matter; the agent writes the client-specific rule file in the repository, not through a plugin command.",
|
|
725
|
+
"For token export, call preview_export_variables first; then call export_variables with only explicit settings and keep safe defaults unless requested.",
|
|
726
|
+
"For large variable/style changes, use import_variable_spec/import_style_spec with dryRun first.",
|
|
727
|
+
"Run audit_composition_drift before rebuilding existing components; use bulk_generate_compositions dryRun before commit.",
|
|
728
|
+
"Build documentation with sxl-doc-builder recipes after foundations are generated.",
|
|
729
|
+
],
|
|
730
|
+
doneCriteria: "Library foundations were exported/generated with non-destructive defaults, drift was inspected before rebuilds, and all bulk writes were previewed first.",
|
|
731
|
+
};
|
|
732
|
+
export const RECIPE_SXL_CODE_CONNECT = {
|
|
733
|
+
id: "sxl-code-connect",
|
|
734
|
+
title: "SXL Code Connect — bind Figma components to code, Storybook, and docs",
|
|
735
|
+
version: 1,
|
|
736
|
+
context: "Code Connect skill for SXL Studio. Manages full CodeConnectBinding payloads: docs URL, files, Storybook, component API, status, registry, and global settings.",
|
|
737
|
+
userPhrases: [
|
|
738
|
+
"настрой code connect",
|
|
739
|
+
"save code connect binding",
|
|
740
|
+
"свяжи figma компонент с storybook",
|
|
741
|
+
"show code connect registry",
|
|
742
|
+
"component docs url files storybook binding",
|
|
743
|
+
],
|
|
744
|
+
decideBetween: [
|
|
745
|
+
{
|
|
746
|
+
between: ["sxl-code-connect", "doc-component"],
|
|
747
|
+
hint: "code-connect links Figma nodes to code/docs metadata; doc-component renders documentation on the Figma canvas.",
|
|
748
|
+
},
|
|
749
|
+
],
|
|
750
|
+
preferredTools: [
|
|
751
|
+
"codeconnect_get_global_settings",
|
|
752
|
+
"codeconnect_save_global_settings",
|
|
753
|
+
"codeconnect_get_registry",
|
|
754
|
+
"codeconnect_get_selection_status",
|
|
755
|
+
"get_context_for_code_connect",
|
|
756
|
+
"get_code_connect_suggestions",
|
|
757
|
+
"generate_code_connect_template",
|
|
758
|
+
"codeconnect_get_binding",
|
|
759
|
+
"codeconnect_save_binding",
|
|
760
|
+
"codeconnect_get_node_ui_status",
|
|
761
|
+
],
|
|
762
|
+
schemaResources: [
|
|
763
|
+
"sxl://agent/schemas/code-connect-context-v1",
|
|
764
|
+
"sxl://agent/schemas/code-connect-template-v1",
|
|
765
|
+
],
|
|
766
|
+
forbidden: [
|
|
767
|
+
"Saving partial binding metadata that drops docsUrl/files/storybook/component API fields.",
|
|
768
|
+
"Guessing node ids when selection status can identify the current component.",
|
|
769
|
+
"Hand-writing filePath/importPath bindings before checking get_context_for_code_connect or get_code_connect_suggestions.",
|
|
770
|
+
"Writing .figma.ts files without generate_code_connect_template dry-run preview.",
|
|
771
|
+
"Treating Code Connect as composition JSON; keep bindings as metadata, not generated component structure.",
|
|
772
|
+
],
|
|
773
|
+
steps: [
|
|
774
|
+
"Read codeconnect_get_global_settings and codeconnect_get_registry to understand existing defaults.",
|
|
775
|
+
"Use codeconnect_get_selection_status or get_node_info to confirm target node ids.",
|
|
776
|
+
"Call get_context_for_code_connect with explicit targets/componentNames or current selection; review existing binding, component props, codegen/composition context, and highest-confidence local code candidates.",
|
|
777
|
+
"For template-file workflows, call generate_code_connect_template without writeFile first; only writeFile=true after reviewing output path/content.",
|
|
778
|
+
"Save the chosen binding with full metadata: componentName, docs URL, files[], Storybook data, component API, and status where available.",
|
|
779
|
+
"Verify with codeconnect_get_binding and codeconnect_get_node_ui_status.",
|
|
780
|
+
],
|
|
781
|
+
doneCriteria: "Target Figma component has a full Code Connect binding and the registry/UI status reflect it.",
|
|
782
|
+
};
|
|
783
|
+
export const RECIPE_SXL_AUDIT = {
|
|
784
|
+
id: "sxl-audit",
|
|
785
|
+
title: "SXL Audit — variables, styles, components, props, drift, and unused entries",
|
|
786
|
+
version: 1,
|
|
787
|
+
context: "Audit skill for read-only analysis and dry-run-first remediation. Covers variable/style coverage, usage, unused entries, component usage, component prop usage, and composition/style drift.",
|
|
788
|
+
userPhrases: [
|
|
789
|
+
"проведи аудит макетов",
|
|
790
|
+
"analyze variables styles and component usage",
|
|
791
|
+
"проверь пропсы компонентов",
|
|
792
|
+
"найди компоненты с prop value",
|
|
793
|
+
"audit coverage drift unused analytics",
|
|
794
|
+
],
|
|
795
|
+
decideBetween: [
|
|
796
|
+
{
|
|
797
|
+
between: ["sxl-audit", "audit-coverage"],
|
|
798
|
+
hint: "audit-coverage is the specialized recipe for missing variable/style bindings; sxl-audit is the broad audit router.",
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
between: ["sxl-audit", "composition-drift"],
|
|
802
|
+
hint: "composition-drift is composition JSON vs Figma component; sxl-audit can route there when that is the user's unit.",
|
|
803
|
+
},
|
|
804
|
+
],
|
|
805
|
+
preferredTools: [
|
|
806
|
+
"audit_variable_coverage",
|
|
807
|
+
"find_variable_coverage_misses",
|
|
808
|
+
"audit_style_coverage",
|
|
809
|
+
"find_style_coverage_misses",
|
|
810
|
+
"analyze_component_usage",
|
|
811
|
+
"find_component_usages",
|
|
812
|
+
"analyze_component_prop_usage",
|
|
813
|
+
"find_component_prop_usages",
|
|
814
|
+
"find_unused_variables",
|
|
815
|
+
"find_unused_styles",
|
|
816
|
+
"audit_composition_drift",
|
|
817
|
+
],
|
|
818
|
+
forbidden: [
|
|
819
|
+
"Walking the entire document manually with use_figma for analytics already covered by Bridge audit tools.",
|
|
820
|
+
"Requesting full detail lists before running summary tools.",
|
|
821
|
+
"Applying audit suggestions without preview mode first and explicit user confirmation.",
|
|
822
|
+
],
|
|
823
|
+
steps: [
|
|
824
|
+
"Choose the narrowest scope: selection, page, node, then file only when needed.",
|
|
825
|
+
"Run summary tools first; use find_* paginated tools only for requested details.",
|
|
826
|
+
"For component prop analytics, use analyze_component_prop_usage for counts and find_component_prop_usages for node ids.",
|
|
827
|
+
"If the user asks to fix findings, switch to apply_coverage_suggestions / apply_style_coverage_suggestions / batch_bind_variables and preview before committing.",
|
|
828
|
+
],
|
|
829
|
+
doneCriteria: "Agent returned a scoped audit report with counts and actionable findings; any remediation used preview mode before write.",
|
|
830
|
+
};
|
|
831
|
+
export const RECIPE_SXL_DOC_BUILDER = {
|
|
832
|
+
id: "sxl-doc-builder",
|
|
833
|
+
title: "SXL Doc Builder — render documentation in Figma",
|
|
834
|
+
version: 1,
|
|
835
|
+
context: "Documentation skill for Figma canvas output: token tables, variable palettes, component docs, doc flows, and markdown scenarios. Uses Bridge doc tools, never ad-hoc scripts.",
|
|
836
|
+
userPhrases: [
|
|
837
|
+
"нарисуй документацию в фигме",
|
|
838
|
+
"build documentation in Figma",
|
|
839
|
+
"документация компонентов токенов флоу",
|
|
840
|
+
"render markdown scenario as Figma flow",
|
|
841
|
+
"apply doc spec",
|
|
842
|
+
],
|
|
843
|
+
decideBetween: [
|
|
844
|
+
{
|
|
845
|
+
between: ["sxl-doc-builder", "doc-component"],
|
|
846
|
+
hint: "doc-component is the specialized single-component recipe; sxl-doc-builder routes all documentation types.",
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
between: ["sxl-doc-builder", "scenario-from-markdown"],
|
|
850
|
+
hint: "scenario-from-markdown wins when the user provides markdown H1/H2 scenario text with Figma URLs.",
|
|
851
|
+
},
|
|
852
|
+
],
|
|
853
|
+
preferredTools: [
|
|
854
|
+
"apply_doc_spec",
|
|
855
|
+
"build_component_doc",
|
|
856
|
+
"build_doc_flow",
|
|
857
|
+
"bind_variable_palette",
|
|
858
|
+
"build_scenario_from_md",
|
|
859
|
+
"build_token_documentation",
|
|
860
|
+
],
|
|
861
|
+
schemaResources: [
|
|
862
|
+
"sxl://agent/schemas/doc-spec-v2",
|
|
863
|
+
"sxl://agent/schemas/token-doc-v1",
|
|
864
|
+
],
|
|
865
|
+
forbidden: [
|
|
866
|
+
"Creating throwaway JS scripts or /tmp payload loaders for documentation.",
|
|
867
|
+
"Using use_figma to clone templates or enumerate variables when bind_variable_palette/apply_doc_spec exists.",
|
|
868
|
+
"Hand-crafting composition JSON for docs; use export_composition_json or compose_from_url.",
|
|
869
|
+
"Skipping dryRun on build_scenario_from_md or doc flows that support preview.",
|
|
870
|
+
],
|
|
871
|
+
steps: [
|
|
872
|
+
"Route the request: token table, variable palette, component doc, flow, markdown scenario, or custom Doc Spec v2.",
|
|
873
|
+
"Read the specialized recipe resource for that route before building payloads.",
|
|
874
|
+
"Discover targetParentId/templateNodeId/layer names via template-discovery when templates are involved.",
|
|
875
|
+
"Call the chosen doc tool with dryRun when supported, then commit.",
|
|
876
|
+
"Inspect the created documentation root or report returned nodes.",
|
|
877
|
+
],
|
|
878
|
+
doneCriteria: "Documentation was rendered in Figma through Bridge doc tools with real token/variable/component data and without ad-hoc scripts.",
|
|
879
|
+
};
|
|
880
|
+
export const RECIPE_SXL_DATA_APPLY_MAPPING = {
|
|
881
|
+
id: "sxl-data-apply-mapping",
|
|
882
|
+
title: "SXL Data — apply one mapping to explicit targets or current selection",
|
|
883
|
+
version: 1,
|
|
884
|
+
context: "Agent workflow for applying one SXL database mapping to explicit targetNodeIds or the current Figma selection. Agents must preview mapping fields, datasets, and target counts before writing.",
|
|
885
|
+
userPhrases: [
|
|
886
|
+
"примени маппинг",
|
|
887
|
+
"apply mapping to selection",
|
|
888
|
+
"apply data mapping",
|
|
889
|
+
"подставь данные по маппингу",
|
|
890
|
+
"fill selected nodes from dataset",
|
|
891
|
+
],
|
|
892
|
+
decideBetween: [
|
|
893
|
+
{
|
|
894
|
+
between: ["sxl-data-apply-mapping", "sxl-data-apply-all"],
|
|
895
|
+
hint: "Use apply-mapping when the user names one mapping or selected target. Use apply-all only when the user says all mappings or whole scope.",
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
between: ["sxl-data-apply-mapping", "sxl-data-generate-instances"],
|
|
899
|
+
hint: "Use apply-mapping to fill existing selected layers. Use generate-instances when the task needs new rows/cards/instances.",
|
|
900
|
+
},
|
|
901
|
+
],
|
|
902
|
+
preferredTools: [
|
|
903
|
+
"get_plugin_status",
|
|
904
|
+
"list_mappings",
|
|
905
|
+
"get_mapping",
|
|
906
|
+
"count_apply_targets",
|
|
907
|
+
"apply_mapping",
|
|
908
|
+
],
|
|
909
|
+
forbidden: [
|
|
910
|
+
"Calling apply_mapping without dryRun preview and explicit approval.",
|
|
911
|
+
"Passing legacy targetNodes when targetNodeIds are available; use explicit node ids for deterministic agent control.",
|
|
912
|
+
"Applying to page/document scope with apply_mapping; use apply_all_mappings for broad scope.",
|
|
913
|
+
],
|
|
914
|
+
steps: [
|
|
915
|
+
"Check plugin status and writesAllowed.",
|
|
916
|
+
"List mappings and read the selected mapping before applying.",
|
|
917
|
+
"Run count_apply_targets for selection and apply_mapping with dryRun:true.",
|
|
918
|
+
"Present mapping fields, dataset row hints, and target count.",
|
|
919
|
+
"Commit apply_mapping only after approval, preferably with targetNodeIds when the intended roots are known.",
|
|
920
|
+
],
|
|
921
|
+
doneCriteria: "One selected SXL mapping was previewed, approved, and applied to the intended explicit targetNodeIds or current Figma selection.",
|
|
922
|
+
};
|
|
923
|
+
export const RECIPE_SXL_DATA_APPLY_ALL = {
|
|
924
|
+
id: "sxl-data-apply-all",
|
|
925
|
+
title: "SXL Data — apply all mappings in a scope",
|
|
926
|
+
version: 1,
|
|
927
|
+
context: "Agent workflow for applying all SXL mappings to explicit targetNodeIds or a selection/page/document scope. This is a bulk write and must be dry-run previewed before commit.",
|
|
928
|
+
userPhrases: [
|
|
929
|
+
"примени все маппинги",
|
|
930
|
+
"apply all mappings",
|
|
931
|
+
"apply all data mappings",
|
|
932
|
+
"подставь данные по всем маппингам",
|
|
933
|
+
"apply mappings on page",
|
|
934
|
+
"apply mappings to document",
|
|
935
|
+
],
|
|
936
|
+
decideBetween: [
|
|
937
|
+
{
|
|
938
|
+
between: ["sxl-data-apply-all", "sxl-data-apply-mapping"],
|
|
939
|
+
hint: "Use apply-all only when the user explicitly asks for all mappings or a broad scope.",
|
|
940
|
+
},
|
|
941
|
+
],
|
|
942
|
+
preferredTools: [
|
|
943
|
+
"get_plugin_status",
|
|
944
|
+
"list_mappings",
|
|
945
|
+
"count_apply_targets",
|
|
946
|
+
"apply_all_mappings",
|
|
947
|
+
],
|
|
948
|
+
forbidden: [
|
|
949
|
+
"Running apply_all_mappings without dryRun preview and explicit approval.",
|
|
950
|
+
"Defaulting to document scope when the user did not ask for it; prefer selection/page unless specified.",
|
|
951
|
+
"Deleting or changing mappings as part of apply; this workflow only fills data into existing nodes.",
|
|
952
|
+
],
|
|
953
|
+
steps: [
|
|
954
|
+
"Check plugin status and writesAllowed.",
|
|
955
|
+
"List mappings and choose explicit targetNodeIds when known, otherwise scope: selection, page, or document.",
|
|
956
|
+
"Run count_apply_targets and apply_all_mappings with dryRun:true.",
|
|
957
|
+
"Show mapping count, target count, and scope.",
|
|
958
|
+
"Commit apply_all_mappings only after approval.",
|
|
959
|
+
],
|
|
960
|
+
doneCriteria: "All requested mappings were previewed and applied only to the approved explicit target roots or Figma scope.",
|
|
961
|
+
};
|
|
962
|
+
export const RECIPE_SXL_DATA_GENERATE_INSTANCES = {
|
|
963
|
+
id: "sxl-data-generate-instances",
|
|
964
|
+
title: "SXL Data — generate instances from mapping rows",
|
|
965
|
+
version: 1,
|
|
966
|
+
context: "Agent workflow for generating repeated component instances/cards/rows from an SXL mapping and dataset. The selected Figma node is the template/container source.",
|
|
967
|
+
userPhrases: [
|
|
968
|
+
"сгенерируй инстансы из датасета",
|
|
969
|
+
"generate instances from dataset",
|
|
970
|
+
"generate instances from mapping",
|
|
971
|
+
"создай строки из датасета",
|
|
972
|
+
"render rows from mapping data",
|
|
973
|
+
"generate cards from dataset mapping",
|
|
974
|
+
],
|
|
975
|
+
decideBetween: [
|
|
976
|
+
{
|
|
977
|
+
between: ["sxl-data-generate-instances", "mockup-builder"],
|
|
978
|
+
hint: "Use generate-instances when a mapping already exists and the selected Figma template should be duplicated. Use mockup-builder for declarative Design DSL screens.",
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
between: ["sxl-data-generate-instances", "sxl-data-apply-mapping"],
|
|
982
|
+
hint: "Use generate-instances to create new repeated nodes; use apply-mapping to fill existing selected nodes.",
|
|
983
|
+
},
|
|
984
|
+
],
|
|
985
|
+
preferredTools: [
|
|
986
|
+
"get_plugin_status",
|
|
987
|
+
"list_mappings",
|
|
988
|
+
"get_mapping",
|
|
989
|
+
"generate_instances",
|
|
990
|
+
],
|
|
991
|
+
forbidden: [
|
|
992
|
+
"Calling generate_instances without dryRun preview and explicit approval.",
|
|
993
|
+
"Generating rows without targetNodeIds when the intended template/container root is already known.",
|
|
994
|
+
"Hand-duplicating components through low-level canvas tools when the existing SXL generation engine should be used.",
|
|
995
|
+
],
|
|
996
|
+
steps: [
|
|
997
|
+
"Check plugin status and writesAllowed.",
|
|
998
|
+
"List mappings and read the mapping/dataset relationship.",
|
|
999
|
+
"Use explicit targetNodeIds for the template/container root when known; otherwise confirm the active Figma selection.",
|
|
1000
|
+
"Run generate_instances with dryRun:true to estimate rows and validate mapping fields.",
|
|
1001
|
+
"Show requested row count, estimated generated rows, and dataset row counts.",
|
|
1002
|
+
"Commit generate_instances only after approval, preferably with targetNodeIds for deterministic remote control.",
|
|
1003
|
+
],
|
|
1004
|
+
doneCriteria: "Instances were generated through SXL's mapping engine after dry-run preview, with the approved row count and intended explicit targetNodeIds or confirmed active selection.",
|
|
1005
|
+
};
|
|
1006
|
+
export const RECIPE_SXL_DATABASE_TRANSFER = {
|
|
1007
|
+
id: "sxl-database-transfer",
|
|
1008
|
+
title: "SXL Database — portable datasets/assets/mappings payloads",
|
|
1009
|
+
version: 1,
|
|
1010
|
+
context: "Agent workflow for backing up, restoring, or moving SXL Studio database datasets, local assets, and mappings between files/workspaces using portable Bridge payloads.",
|
|
1011
|
+
userPhrases: [
|
|
1012
|
+
"экспортируй базу sxl",
|
|
1013
|
+
"импортируй базу sxl",
|
|
1014
|
+
"backup sxl database",
|
|
1015
|
+
"restore sxl database",
|
|
1016
|
+
"export database payload",
|
|
1017
|
+
"import database payload",
|
|
1018
|
+
"перенеси datasets assets mappings",
|
|
1019
|
+
],
|
|
1020
|
+
decideBetween: [
|
|
1021
|
+
{
|
|
1022
|
+
between: ["sxl-database-transfer", "sxl-data-apply-mapping"],
|
|
1023
|
+
hint: "Use database-transfer for moving/storing datasets/assets/mappings. Use data-apply when the goal is to fill nodes on canvas.",
|
|
1024
|
+
},
|
|
1025
|
+
],
|
|
1026
|
+
preferredTools: [
|
|
1027
|
+
"get_plugin_status",
|
|
1028
|
+
"list_datasets",
|
|
1029
|
+
"list_assets",
|
|
1030
|
+
"list_mappings",
|
|
1031
|
+
"export_database_payload",
|
|
1032
|
+
"import_database_payload",
|
|
1033
|
+
],
|
|
1034
|
+
forbidden: [
|
|
1035
|
+
"Importing payloads without dryRun preview.",
|
|
1036
|
+
"Overwriting existing ids without confirmDestructive:true and a human-readable destructiveReason.",
|
|
1037
|
+
"Including asset content in export unless the user needs a full backup/restore payload.",
|
|
1038
|
+
],
|
|
1039
|
+
steps: [
|
|
1040
|
+
"Check plugin status and inspect existing datasets/assets/mappings.",
|
|
1041
|
+
"For backup/transfer, call export_database_payload; include asset content only when needed.",
|
|
1042
|
+
"For restore/import, call import_database_payload with dryRun:true first.",
|
|
1043
|
+
"Review counts, conflicts, and warnings.",
|
|
1044
|
+
"Commit import only after approval; existing id conflicts require destructive confirmation and reason.",
|
|
1045
|
+
],
|
|
1046
|
+
doneCriteria: "SXL database payload was exported or imported through Bridge with dry-run conflict review and no accidental overwrites.",
|
|
1047
|
+
};
|
|
1048
|
+
export const RECIPE_FIGMA_MCP_COMPANION = {
|
|
1049
|
+
id: "figma-mcp-companion",
|
|
1050
|
+
title: "Official Figma MCP Companion — remote-only and non-Design scopes",
|
|
1051
|
+
version: 1,
|
|
1052
|
+
context: "Routing recipe for official Figma MCP features that Bridge should not fake through the local SXL plugin: new-file creation, FigJam/Slides, diagram generation, and hosted remote-only workflows. Bridge can explain parity and prepare local SXL context, but the agent must call official Figma MCP tools for these capabilities.",
|
|
1053
|
+
userPhrases: [
|
|
1054
|
+
"figma-create-new-file",
|
|
1055
|
+
"create_new_file",
|
|
1056
|
+
"create a new figma file",
|
|
1057
|
+
"figma-generate-diagram",
|
|
1058
|
+
"generate_diagram",
|
|
1059
|
+
"create a figjam diagram",
|
|
1060
|
+
"figma-use-figjam",
|
|
1061
|
+
"figma-use-slides",
|
|
1062
|
+
],
|
|
1063
|
+
decideBetween: [
|
|
1064
|
+
{
|
|
1065
|
+
between: ["figma-mcp-companion", "sxl-use"],
|
|
1066
|
+
hint: "Use sxl-use for the active Figma Design file, SXL plugin workflows, Figma Design asset upload, and get_libraries/search_design_system. Use companion when the request names remote-only official Figma MCP features, FigJam, Slides, or new-file creation.",
|
|
1067
|
+
},
|
|
1068
|
+
{
|
|
1069
|
+
between: ["figma-mcp-companion", "sxl-generate-design"],
|
|
1070
|
+
hint: "Use sxl-generate-design when building into an existing Figma Design file through SXL Bridge. Use companion when the first step is creating a new Figma file or using official generate_figma_design in a supported hosted MCP client.",
|
|
1071
|
+
},
|
|
1072
|
+
],
|
|
1073
|
+
preferredTools: [
|
|
1074
|
+
"get_figma_mcp_parity",
|
|
1075
|
+
"get_bridge_runtime_summary",
|
|
1076
|
+
"figma_rest_diagnose",
|
|
1077
|
+
],
|
|
1078
|
+
forbidden: [
|
|
1079
|
+
"Pretending Bridge can create new Figma files, FigJam boards, Slides decks, or Mermaid diagrams through the local plugin.",
|
|
1080
|
+
"Routing Figma Design get_libraries/search_design_system to companion without first checking Bridge get_libraries/search_design_system coverage.",
|
|
1081
|
+
"Replacing official Figma MCP FigJam/Slides workflows with Figma Design canvas commands.",
|
|
1082
|
+
],
|
|
1083
|
+
steps: [
|
|
1084
|
+
"Call get_figma_mcp_parity to identify the exact official Figma MCP companion tool and explain why Bridge is not primary for this request.",
|
|
1085
|
+
"If the request also needs SXL Studio state, call get_bridge_runtime_summary and relevant SXL reads after the official MCP step has produced/selected a Figma Design file.",
|
|
1086
|
+
"Use official Figma MCP tools for create_new_file, generate_diagram, FigJam, Slides, and remote-only generate_figma_design workflows.",
|
|
1087
|
+
],
|
|
1088
|
+
doneCriteria: "Agent routed the user to official Figma MCP for remote-only/non-Design work and did not claim the local SXL plugin can perform unsupported operations.",
|
|
1089
|
+
};
|
|
324
1090
|
export const RECIPE_TEMPLATE_DISCOVERY = {
|
|
325
1091
|
id: "template-discovery",
|
|
326
1092
|
title: "Find the swatch / card template inside a content frame",
|
|
@@ -356,6 +1122,7 @@ export const RECIPE_DOC_SPEC_V2 = {
|
|
|
356
1122
|
version: 1,
|
|
357
1123
|
context: "Doc Spec v2 lets you compose a single apply_doc_spec call from a list of sections. Each section is independent: combine only what the user asked for. Read this resource before assembling a custom spec.",
|
|
358
1124
|
preferredTools: ["apply_doc_spec", "build_component_doc", "bind_variable_palette", "build_doc_flow"],
|
|
1125
|
+
schemaResources: ["sxl://agent/schemas/doc-spec-v2"],
|
|
359
1126
|
sections: [
|
|
360
1127
|
{ type: "title", note: "Either creates a TEXT node or writes into an existing layerName." },
|
|
361
1128
|
{ type: "description", note: "Markdown subset → formatted runs. Use **bold**, *italic*, `code`, # headings." },
|
|
@@ -494,8 +1261,8 @@ export const RECIPE_DOC_FLOW = {
|
|
|
494
1261
|
],
|
|
495
1262
|
steps: [
|
|
496
1263
|
"Resolve each Figma URL to a node id (parseFigmaUrl handles `&node-id=` segments).",
|
|
497
|
-
"Call build_doc_flow with pages[] (each with nodeId
|
|
498
|
-
"
|
|
1264
|
+
"Call build_doc_flow with pages[] (each with nodeId or compositionFileId, plus optional title / description).",
|
|
1265
|
+
"When a page references an existing composition file, pass pages[].compositionFileId directly; Bridge/plugin will generate/apply it and render an instance or clone in the flow.",
|
|
499
1266
|
],
|
|
500
1267
|
doneCriteria: "All requested pages appear inside a single auto-layout container with optional captions; no use_figma script was used.",
|
|
501
1268
|
};
|
|
@@ -657,7 +1424,12 @@ export const RECIPE_AUDIT_COVERAGE = {
|
|
|
657
1424
|
version: 1,
|
|
658
1425
|
userPhrases: [
|
|
659
1426
|
"проверь везде ли подкреплены переменные",
|
|
1427
|
+
"проверь на всех макетах установлены ли переменные и стили",
|
|
1428
|
+
"проверь на всех ли макетах и объектах установленные переменные",
|
|
1429
|
+
"проверь переменные и стили на макетах",
|
|
660
1430
|
"найди объекты без переменных",
|
|
1431
|
+
"check whether every screen object has variables and styles assigned",
|
|
1432
|
+
"check variable and style coverage across layouts",
|
|
661
1433
|
"audit raw values without variables",
|
|
662
1434
|
"review the file for missing bindings",
|
|
663
1435
|
"где hex заливки вместо токенов",
|
|
@@ -674,7 +1446,6 @@ export const RECIPE_AUDIT_COVERAGE = {
|
|
|
674
1446
|
"find_variable_coverage_misses",
|
|
675
1447
|
"audit_style_coverage",
|
|
676
1448
|
"find_style_coverage_misses",
|
|
677
|
-
"batch_bind_variables",
|
|
678
1449
|
],
|
|
679
1450
|
forbidden: [
|
|
680
1451
|
"Walking the document manually with use_figma — audit_* tools cover the case (chunked, alias-aware).",
|
|
@@ -684,10 +1455,11 @@ export const RECIPE_AUDIT_COVERAGE = {
|
|
|
684
1455
|
steps: [
|
|
685
1456
|
"Start narrow: audit_variable_coverage { scope: 'page' } — confirm magnitude.",
|
|
686
1457
|
"If acceptable, widen: scope: 'file'.",
|
|
687
|
-
"For details
|
|
1458
|
+
"For details: find_variable_coverage_misses { limit, cursor } and find_style_coverage_misses { limit, cursor }.",
|
|
688
1459
|
"For style coverage do the same with audit_style_coverage / find_style_coverage_misses.",
|
|
1460
|
+
"If the user asks to fix the findings, switch to auto-bind-from-audit and run apply_coverage_suggestions / apply_style_coverage_suggestions in preview mode first.",
|
|
689
1461
|
],
|
|
690
|
-
doneCriteria: "Agent returned a summary
|
|
1462
|
+
doneCriteria: "Agent returned a read-only summary and optional paginated findings without using use_figma. Coverage gaps are quantified per property and per page; remediation is a separate dry-run-first workflow.",
|
|
691
1463
|
};
|
|
692
1464
|
export const RECIPE_BULK_VARIABLES = {
|
|
693
1465
|
id: "bulk-variables",
|
|
@@ -927,32 +1699,38 @@ export const RECIPE_MOCKUP_BUILDER = {
|
|
|
927
1699
|
hint: "mockup-builder = single auto-layout screen; doc-flow = multiple pages stacked side-by-side as a story.",
|
|
928
1700
|
},
|
|
929
1701
|
],
|
|
930
|
-
context: "Phase D: thick orchestration over `figma.createInstance / setProperties / setBoundVariableForPaint / loadFontAsync`. Pipeline: (1) `find_components` to
|
|
1702
|
+
context: "Phase D: thick orchestration over `figma.createInstance / setProperties / setBoundVariableForPaint / loadFontAsync`. Pipeline: (1) `inspect_design_system` to aggregate components, variables, styles, token config, and compositions; (2) optional `find_components` to narrow ids / keys + componentPropertyDefinitions; (3) `validate_screen_spec` or `build_screen { dryRun: true }` to preview; (4) `build_screen` / `update_screen` to assemble an auto-layout container from a declarative item tree (`instance | section | spacer | text`) with property / text / fill-binding overrides; (5) `apply_mockup_dataset` when the same template needs to be cloned per-row from a structured list.",
|
|
931
1703
|
preferredTools: [
|
|
1704
|
+
"inspect_design_system",
|
|
1705
|
+
"validate_screen_spec",
|
|
1706
|
+
"build_screen",
|
|
1707
|
+
"update_screen",
|
|
932
1708
|
"find_components",
|
|
933
1709
|
"build_mockup",
|
|
934
1710
|
"apply_mockup_dataset",
|
|
935
1711
|
"get_variables",
|
|
936
1712
|
],
|
|
1713
|
+
schemaResources: ["sxl://agent/schemas/design-dsl-v1"],
|
|
937
1714
|
forbidden: [
|
|
938
|
-
"Calling use_figma to write a hand-rolled `figma.createInstance(...) / setProperties(...)` loop when build_mockup covers the assembly.",
|
|
939
|
-
"Guessing component names instead of running find_components first — the user's file may have arbitrary local names.",
|
|
940
|
-
"Skipping dryRun for build_mockup / apply_mockup_dataset — always preview the resolved plan before writing to canvas.",
|
|
1715
|
+
"Calling use_figma to write a hand-rolled `figma.createInstance(...) / setProperties(...)` loop when build_screen/build_mockup covers the assembly.",
|
|
1716
|
+
"Guessing component names instead of running inspect_design_system or find_components first — the user's file may have arbitrary local names.",
|
|
1717
|
+
"Skipping dryRun for build_screen / update_screen / build_mockup / apply_mockup_dataset — always preview the resolved plan before writing to canvas.",
|
|
941
1718
|
"Hand-coding fill colours when a Figma Variable is available — use fillBindings { variableId } so the mockup picks up theme switches automatically.",
|
|
942
1719
|
"Loading fonts manually — build_mockup loads fonts on demand with a safe Inter Regular fallback.",
|
|
943
1720
|
"Assuming property names like `size#123:0` — pass the human key (`size`); the plugin maps to the internal `name#defId` suffix via `componentProperties`.",
|
|
944
1721
|
],
|
|
945
1722
|
steps: [
|
|
946
|
-
"Run
|
|
1723
|
+
"Run inspect_design_system { query | prefix?, includeProperties: true, includeRemoteInstances?: true } to aggregate components, variables, local styles, token config, and composition index.",
|
|
1724
|
+
"Run find_components { query | prefix?, includeProperties: true, kind?: 'COMPONENT' | 'COMPONENT_SET', limit?: 50 } when the aggregate response needs narrowing. Cache the (id, name, propertyDefinitions, defaultVariantId) list.",
|
|
947
1725
|
"If the user wants library components, set includeRemoteInstances: true so library components instantiated in this file are included; otherwise stay local-only.",
|
|
948
1726
|
"Decide the layout: VERTICAL stack of sections, HORIZONTAL row of cards, or WRAP grid. Pick itemSpacing / padding to match the user's intent (e.g. 16px gutters).",
|
|
949
1727
|
"Build the items[] tree. Use `instance` for components (one of componentId | componentKey | componentName), `section` for nested auto-layout frames, `spacer` for explicit gaps, `text` for bare TEXT layers (TEXT styles can be applied via textStyleId).",
|
|
950
1728
|
"For property / text / fill overrides on instances: pass `properties` (human keys), `textOverrides[]` (layerName + value), `fillBindings[]` (variableId; optional layerName when only one child should receive the fill).",
|
|
951
|
-
"Call
|
|
952
|
-
"Re-call
|
|
1729
|
+
"Call validate_screen_spec or build_screen { ..., dryRun: true } first. The plugin returns a resolved plan with per-item ok/error. If any errors → fix the spec, do not commit.",
|
|
1730
|
+
"Re-call build_screen without dryRun to write a new canvas root, or update_screen { targetRootId, ... } to modify an existing frame without recreating the whole screen. Capture rootNodeId for downstream tools (e.g. document the mockup, run audit_variable_coverage on it).",
|
|
953
1731
|
"If the user wants N cards from a dataset, leave one template instance inside the mockup (kind: 'instance'), then call apply_mockup_dataset { templateNodeId, rows[], dryRun: true } → preview → commit. removeTemplate: true deletes the placeholder after cloning.",
|
|
954
1732
|
],
|
|
955
|
-
doneCriteria: "Agent produced one (or a sequence of) Phase D calls (
|
|
1733
|
+
doneCriteria: "Agent produced one (or a sequence of) Phase D calls (inspect_design_system → validate/build_screen [dryRun → commit] → optional apply_mockup_dataset) that the plugin executed without use_figma. The user approved each diff before commit. The mockup uses real components by id/key (not duplicated geometry) and binds Figma Variables instead of raw hex when a variable is available.",
|
|
956
1734
|
};
|
|
957
1735
|
export const RECIPE_BULK_COMPOSITIONS = {
|
|
958
1736
|
id: "bulk-compositions",
|
|
@@ -1056,4 +1834,99 @@ export const RECIPE_COMPOSITION_DRIFT = {
|
|
|
1056
1834
|
],
|
|
1057
1835
|
doneCriteria: "Agent returned a deterministic drift report with per-composition status. No canvas writes happened during the audit. If the user approved a fix, a follow-up bulk_generate_compositions was issued with explicit dryRun preview.",
|
|
1058
1836
|
};
|
|
1837
|
+
export const ALL_AGENT_RECIPES = [
|
|
1838
|
+
RECIPE_SXL_USE,
|
|
1839
|
+
RECIPE_SXL_IMPLEMENT_DESIGN,
|
|
1840
|
+
RECIPE_SXL_GENERATE_DESIGN,
|
|
1841
|
+
RECIPE_SXL_GENERATE_LIBRARY,
|
|
1842
|
+
RECIPE_SXL_CODE_CONNECT,
|
|
1843
|
+
RECIPE_SXL_AUDIT,
|
|
1844
|
+
RECIPE_SXL_DOC_BUILDER,
|
|
1845
|
+
RECIPE_SXL_DATA_APPLY_MAPPING,
|
|
1846
|
+
RECIPE_SXL_DATA_APPLY_ALL,
|
|
1847
|
+
RECIPE_SXL_DATA_GENERATE_INSTANCES,
|
|
1848
|
+
RECIPE_SXL_DATABASE_TRANSFER,
|
|
1849
|
+
RECIPE_FIGMA_MCP_COMPANION,
|
|
1850
|
+
RECIPE_DOC_TOKENS,
|
|
1851
|
+
RECIPE_DOC_COMPONENT,
|
|
1852
|
+
RECIPE_DOC_COMPOSITION,
|
|
1853
|
+
RECIPE_DOC_FLOW,
|
|
1854
|
+
RECIPE_VARIABLE_PALETTE,
|
|
1855
|
+
RECIPE_DOC_SPEC_V2,
|
|
1856
|
+
RECIPE_TEMPLATE_DISCOVERY,
|
|
1857
|
+
RECIPE_COMPOSE_WITH_VARIABLES,
|
|
1858
|
+
RECIPE_SCENARIO_FROM_MARKDOWN,
|
|
1859
|
+
RECIPE_VARIABLE_USAGE,
|
|
1860
|
+
RECIPE_AUDIT_COVERAGE,
|
|
1861
|
+
RECIPE_FIND_UNUSED,
|
|
1862
|
+
RECIPE_BULK_VARIABLES,
|
|
1863
|
+
RECIPE_AUTO_BIND_FROM_AUDIT,
|
|
1864
|
+
RECIPE_BULK_STYLES,
|
|
1865
|
+
RECIPE_STYLE_DRIFT,
|
|
1866
|
+
RECIPE_MOCKUP_BUILDER,
|
|
1867
|
+
RECIPE_BULK_COMPOSITIONS,
|
|
1868
|
+
RECIPE_COMPOSITION_DRIFT,
|
|
1869
|
+
];
|
|
1870
|
+
const RECIPES_BY_ID = new Map(ALL_AGENT_RECIPES.map((recipe) => [recipe.id, recipe]));
|
|
1871
|
+
function normalizeIntent(input) {
|
|
1872
|
+
return input
|
|
1873
|
+
.toLowerCase()
|
|
1874
|
+
.replace(/[^\p{L}\p{N}_:#/-]+/gu, " ")
|
|
1875
|
+
.replace(/\s+/g, " ")
|
|
1876
|
+
.trim();
|
|
1877
|
+
}
|
|
1878
|
+
function intentTokens(input) {
|
|
1879
|
+
return new Set(normalizeIntent(input)
|
|
1880
|
+
.split(" ")
|
|
1881
|
+
.filter((token) => token.length >= 3));
|
|
1882
|
+
}
|
|
1883
|
+
function routeScore(request, phrase) {
|
|
1884
|
+
const normalizedRequest = normalizeIntent(request);
|
|
1885
|
+
const normalizedPhrase = normalizeIntent(phrase);
|
|
1886
|
+
if (!normalizedRequest || !normalizedPhrase)
|
|
1887
|
+
return 0;
|
|
1888
|
+
if (normalizedRequest.includes(normalizedPhrase))
|
|
1889
|
+
return 100 + normalizedPhrase.length / 10;
|
|
1890
|
+
const requestTokens = intentTokens(normalizedRequest);
|
|
1891
|
+
const phraseTokens = intentTokens(normalizedPhrase);
|
|
1892
|
+
if (requestTokens.size === 0 || phraseTokens.size === 0)
|
|
1893
|
+
return 0;
|
|
1894
|
+
let overlap = 0;
|
|
1895
|
+
for (const token of phraseTokens) {
|
|
1896
|
+
if (requestTokens.has(token))
|
|
1897
|
+
overlap += 1;
|
|
1898
|
+
}
|
|
1899
|
+
return overlap === 0 ? 0 : overlap / phraseTokens.size;
|
|
1900
|
+
}
|
|
1901
|
+
export function routeAgentIntent(request, options = {}) {
|
|
1902
|
+
const routes = [];
|
|
1903
|
+
for (const intent of RECIPE_INDEX.userIntents) {
|
|
1904
|
+
const recipe = RECIPES_BY_ID.get(intent.recipeId);
|
|
1905
|
+
if (!recipe)
|
|
1906
|
+
continue;
|
|
1907
|
+
const scored = intent.userPhrases
|
|
1908
|
+
.map((phrase) => ({ phrase, score: routeScore(request, phrase) }))
|
|
1909
|
+
.filter((entry) => entry.score > 0)
|
|
1910
|
+
.sort((a, b) => b.score - a.score);
|
|
1911
|
+
if (scored.length === 0)
|
|
1912
|
+
continue;
|
|
1913
|
+
const recipeText = JSON.stringify(recipe);
|
|
1914
|
+
routes.push({
|
|
1915
|
+
recipeId: recipe.id,
|
|
1916
|
+
title: recipe.title,
|
|
1917
|
+
score: scored[0].score,
|
|
1918
|
+
matchedPhrases: scored.slice(0, 3).map((entry) => entry.phrase),
|
|
1919
|
+
preferredTools: recipe.preferredTools,
|
|
1920
|
+
schemaResources: "schemaResources" in recipe ? recipe.schemaResources : [],
|
|
1921
|
+
dryRunFirst: /dryRun/i.test(recipeText),
|
|
1922
|
+
doneCriteria: recipe.doneCriteria,
|
|
1923
|
+
});
|
|
1924
|
+
}
|
|
1925
|
+
routes.sort((a, b) => b.score - a.score || a.recipeId.localeCompare(b.recipeId));
|
|
1926
|
+
return {
|
|
1927
|
+
ok: true,
|
|
1928
|
+
request,
|
|
1929
|
+
routes: routes.slice(0, Math.max(1, Math.min(options.limit ?? 5, 10))),
|
|
1930
|
+
};
|
|
1931
|
+
}
|
|
1059
1932
|
//# sourceMappingURL=agent-recipes.js.map
|