@framingui/mcp-server 0.6.17 → 0.6.20
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 +79 -990
- package/dist/cli/agent-md-templates.d.ts +0 -12
- package/dist/cli/agent-md-templates.d.ts.map +1 -1
- package/dist/cli/agent-md-templates.js +73 -255
- package/dist/cli/agent-md-templates.js.map +1 -1
- package/dist/cli/guide-template.d.ts +0 -7
- package/dist/cli/guide-template.d.ts.map +1 -1
- package/dist/cli/guide-template.js +58 -157
- package/dist/cli/guide-template.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +3 -47
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init.d.ts +18 -2
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +278 -108
- package/dist/cli/init.js.map +1 -1
- package/dist/commands/slash-command-registry.d.ts.map +1 -1
- package/dist/commands/slash-command-registry.js +3 -0
- package/dist/commands/slash-command-registry.js.map +1 -1
- package/dist/index.js +39 -35
- package/dist/index.js.map +1 -1
- package/dist/prompts/getting-started.d.ts.map +1 -1
- package/dist/prompts/getting-started.js +5 -24
- package/dist/prompts/getting-started.js.map +1 -1
- package/dist/prompts/screen-workflow.d.ts +1 -4
- package/dist/prompts/screen-workflow.d.ts.map +1 -1
- package/dist/prompts/screen-workflow.js +84 -197
- package/dist/prompts/screen-workflow.js.map +1 -1
- package/dist/schemas/mcp-schemas.d.ts +212 -449
- package/dist/schemas/mcp-schemas.d.ts.map +1 -1
- package/dist/schemas/mcp-schemas.js +15 -69
- package/dist/schemas/mcp-schemas.js.map +1 -1
- package/dist/tools/get-screen-generation-context.d.ts.map +1 -1
- package/dist/tools/get-screen-generation-context.js +74 -117
- package/dist/tools/get-screen-generation-context.js.map +1 -1
- package/dist/tools/preview-component.js +1 -1
- package/dist/tools/preview-component.js.map +1 -1
- package/dist/tools/preview-screen-template.d.ts.map +1 -1
- package/dist/tools/preview-screen-template.js +0 -1
- package/dist/tools/preview-screen-template.js.map +1 -1
- package/dist/tools/validate-environment.d.ts.map +1 -1
- package/dist/tools/validate-environment.js +1 -84
- package/dist/tools/validate-environment.js.map +1 -1
- package/dist/tools/validate-screen-definition.d.ts.map +1 -1
- package/dist/tools/validate-screen-definition.js +0 -6
- package/dist/tools/validate-screen-definition.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MCP Prompts: Screen Generation Workflow
|
|
3
|
-
*
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Screen Workflow prompt with guarded direct-write process
|
|
3
|
+
* Current production workflow for guarded direct-write screen generation
|
|
7
4
|
*/
|
|
8
5
|
export function getScreenWorkflowPrompt() {
|
|
9
6
|
return {
|
|
@@ -12,102 +9,86 @@ export function getScreenWorkflowPrompt() {
|
|
|
12
9
|
role: 'user',
|
|
13
10
|
content: {
|
|
14
11
|
type: 'text',
|
|
15
|
-
text: `#
|
|
12
|
+
text: `# FramingUI Screen Generation Workflow
|
|
16
13
|
|
|
17
|
-
This is the
|
|
14
|
+
This is the current production workflow for building screens with FramingUI.
|
|
18
15
|
|
|
19
16
|
Prerequisite: authenticate with \`framingui-mcp login\` or provide \`FRAMINGUI_API_KEY\`.
|
|
20
|
-
Optional: call \`whoami\`
|
|
17
|
+
Optional: call \`whoami\` to inspect licensed themes before starting.
|
|
21
18
|
|
|
22
19
|
## Overview
|
|
23
20
|
|
|
24
|
-
The workflow
|
|
25
|
-
- ✅
|
|
26
|
-
- ✅
|
|
27
|
-
- ✅
|
|
28
|
-
- ✅
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
The production workflow is **guarded direct write**:
|
|
22
|
+
- ✅ Gather component contracts, theme context, layout hints, and starter structure
|
|
23
|
+
- ✅ Validate the Screen Definition before writing code
|
|
24
|
+
- ✅ Write React code directly using FramingUI components and props from context
|
|
25
|
+
- ✅ Verify dependencies, Tailwind setup, and raw HTML/style escapes before delivery
|
|
26
|
+
|
|
27
|
+
This is **not** the old \`generate_screen\`-first workflow.
|
|
28
|
+
\`generate_screen\` may still be used as an optional helper, but the default production path is:
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
\`preview-theme\` → \`get-screen-generation-context\` → \`preview-component\` / \`list-icon-libraries\` when needed → \`validate-screen-definition\` → write code directly → \`validate-environment\`
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
## Step 1/4: Gather Context
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
- \`host-utility\`: project styles screens with direct Tailwind utilities and does not expose FramingUI variables
|
|
38
|
-
- \`mixed\`: project defines only some FramingUI variables, which is the highest-risk state for broken component styling
|
|
34
|
+
**Primary tool:** \`get-screen-generation-context\`
|
|
39
35
|
|
|
40
|
-
|
|
41
|
-
- stay utility-first and use explicit classes, or
|
|
42
|
-
- migrate the page to the FramingUI variable contract after confirming with the user
|
|
36
|
+
Use this at the start of every screen task.
|
|
43
37
|
|
|
44
|
-
**
|
|
45
|
-
Use:
|
|
38
|
+
**Recommended input:**
|
|
46
39
|
\`\`\`json
|
|
47
40
|
{
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"checkStyles": true
|
|
41
|
+
"description": "Blog main page with square-minimalism theme, mobile optimized",
|
|
42
|
+
"themeId": "square-minimalism",
|
|
43
|
+
"includeExamples": false
|
|
52
44
|
}
|
|
53
45
|
\`\`\`
|
|
54
|
-
Block generation when:
|
|
55
|
-
- \`styles.styleContract === "mixed"\`
|
|
56
|
-
- \`styles.styleContract === "host-utility"\` and the user did not explicitly choose \`--style-contract host-utility\`
|
|
57
46
|
|
|
58
|
-
|
|
47
|
+
Set \`includeExamples: false\` when you want a smaller response and do not need example screen definitions.
|
|
59
48
|
|
|
60
|
-
**
|
|
49
|
+
**What to review from the response:**
|
|
50
|
+
- \`templateMatch\` as a layout hint only
|
|
51
|
+
- \`components\` as the source of truth for imports, props, and variants
|
|
52
|
+
- \`schema.screenDefinition\`
|
|
53
|
+
- \`themeRecipes\`
|
|
54
|
+
- \`hints\`
|
|
55
|
+
- \`workflow\`
|
|
61
56
|
|
|
62
|
-
**
|
|
57
|
+
**Escalate to discovery tools when needed:**
|
|
58
|
+
- Call \`preview-theme\` if theme application is still unclear
|
|
59
|
+
- Call \`preview-component\` when a component contract is ambiguous
|
|
60
|
+
- Call \`list-icon-libraries\` if the screen needs icons and the icon set is still undecided
|
|
63
61
|
|
|
64
|
-
|
|
65
|
-
\`\`\`json
|
|
66
|
-
{
|
|
67
|
-
"description": "User dashboard with profile card and recent activity",
|
|
68
|
-
"themeId": "minimal-workspace",
|
|
69
|
-
"includeExamples": true
|
|
70
|
-
}
|
|
71
|
-
\`\`\`
|
|
62
|
+
## Critical Handling Rule
|
|
72
63
|
|
|
73
|
-
|
|
74
|
-
- Template hints for inspiration
|
|
75
|
-
- A component plan and section plan for guided drafting
|
|
76
|
-
- Available components with **inline props and variants**
|
|
77
|
-
- A definition starter object for the first draft
|
|
78
|
-
- Screen Definition JSON schema
|
|
79
|
-
- Example definitions
|
|
80
|
-
- Theme recipes
|
|
81
|
-
- Warnings when component metadata could not be loaded cleanly
|
|
64
|
+
Treat MCP tool responses as structured tool output, not as shell text.
|
|
82
65
|
|
|
83
|
-
**
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
66
|
+
- Do **not** copy MCP transcript text into a file and run \`python\`, \`node\`, \`jq\`, or \`json.loads(...)\` against it
|
|
67
|
+
- Do **not** parse rendered transcript blocks such as \`⎿ { ... }\`, truncation markers, or console summaries
|
|
68
|
+
- Do **not** treat UI-expanded output or chat transcript text as canonical JSON
|
|
69
|
+
- Use the tool result directly in the agent context
|
|
87
70
|
|
|
88
|
-
|
|
89
|
-
**Guardrail:** treat \`templateHints\` as inspiration only. \`componentPlan\`, \`components\`, and the validated definition are the contract.
|
|
71
|
+
If you must persist data, write **only the raw JSON object** from the tool result, with no surrounding transcript text.
|
|
90
72
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
## Step 2/4: Validate Screen Definition
|
|
73
|
+
## Step 2/4: Create and Validate a Screen Definition
|
|
94
74
|
|
|
95
75
|
**Tool:** \`validate-screen-definition\`
|
|
96
76
|
|
|
97
|
-
|
|
77
|
+
Create a Screen Definition JSON object using the schema and starter guidance from Step 1, then validate it before writing React code.
|
|
98
78
|
|
|
99
|
-
**
|
|
79
|
+
**Validation input:**
|
|
100
80
|
\`\`\`json
|
|
101
81
|
{
|
|
102
82
|
"definition": {
|
|
103
|
-
"id": "
|
|
104
|
-
"shell": "shell.web.
|
|
105
|
-
"page": "page.
|
|
83
|
+
"id": "blog-home",
|
|
84
|
+
"shell": "shell.web.marketing",
|
|
85
|
+
"page": "page.blog",
|
|
86
|
+
"themeId": "square-minimalism",
|
|
106
87
|
"sections": [
|
|
107
88
|
{
|
|
108
|
-
"id": "
|
|
89
|
+
"id": "hero",
|
|
109
90
|
"pattern": "section.container",
|
|
110
|
-
"components": [
|
|
91
|
+
"components": []
|
|
111
92
|
}
|
|
112
93
|
]
|
|
113
94
|
},
|
|
@@ -115,153 +96,59 @@ Block generation when:
|
|
|
115
96
|
}
|
|
116
97
|
\`\`\`
|
|
117
98
|
|
|
118
|
-
**
|
|
119
|
-
- \`valid
|
|
120
|
-
- \`errors
|
|
121
|
-
- \`warnings
|
|
122
|
-
- \`suggestions
|
|
123
|
-
- \`autoFixPatches
|
|
124
|
-
|
|
125
|
-
**When to use:**
|
|
126
|
-
- Always before generating code (Step 3)
|
|
127
|
-
- When fixing validation errors (apply autoFixPatches)
|
|
128
|
-
- When exploring screen structure improvements
|
|
99
|
+
**Expect from validation:**
|
|
100
|
+
- \`valid\`
|
|
101
|
+
- \`errors\`
|
|
102
|
+
- \`warnings\`
|
|
103
|
+
- \`suggestions\`
|
|
104
|
+
- \`autoFixPatches\`
|
|
129
105
|
|
|
130
|
-
|
|
106
|
+
Always apply validation fixes before writing code.
|
|
131
107
|
|
|
132
108
|
## Step 3/4: Write React Code Directly
|
|
133
109
|
|
|
134
|
-
|
|
110
|
+
Write production React code directly after validation passes.
|
|
135
111
|
|
|
136
|
-
**Required
|
|
137
|
-
-
|
|
138
|
-
- Use
|
|
139
|
-
- Use
|
|
140
|
-
-
|
|
141
|
-
-
|
|
142
|
-
- If a screen needs custom JSX beyond the contract, keep it local and explain why FramingUI primitives were insufficient
|
|
112
|
+
**Required rules:**
|
|
113
|
+
- Prefer FramingUI components from \`@framingui/ui\`
|
|
114
|
+
- Use the exact import statements, props, and variants provided in the Step 1 context
|
|
115
|
+
- Use semantic HTML wrappers like \`header\`, \`main\`, \`section\`, and \`footer\` only for document structure
|
|
116
|
+
- Do not replace available FramingUI interactive or form primitives with raw HTML
|
|
117
|
+
- Do not claim a component is unavailable unless the catalog or preview tools confirmed that
|
|
143
118
|
|
|
144
|
-
**
|
|
119
|
+
**Styling rules:**
|
|
120
|
+
- Respect the detected style contract
|
|
121
|
+
- If the project is using FramingUI native styles, ensure \`@import '@framingui/ui/styles';\` is present in global CSS
|
|
122
|
+
- If the project is preserving host utilities, still prefer token-backed utilities and theme recipes over arbitrary raw values
|
|
123
|
+
- Avoid hardcoded design values when FramingUI tokens, variants, or recipes already exist
|
|
145
124
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
## Step 4/4: Validate Environment (Optional but Recommended)
|
|
125
|
+
## Step 4/4: Validate the Target Environment and Output
|
|
149
126
|
|
|
150
127
|
**Tool:** \`validate-environment\`
|
|
151
128
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
**Input:**
|
|
155
|
-
\`\`\`json
|
|
156
|
-
{
|
|
157
|
-
"projectPath": "/path/to/package.json",
|
|
158
|
-
"requiredPackages": ["@radix-ui/react-slot", "@radix-ui/react-avatar"],
|
|
159
|
-
"checkTailwind": true,
|
|
160
|
-
"checkStyles": true
|
|
161
|
-
}
|
|
162
|
-
\`\`\`
|
|
163
|
-
|
|
164
|
-
**Output:**
|
|
165
|
-
- \`installed\`: Packages already in package.json
|
|
166
|
-
- \`missing\`: Packages that need installation
|
|
167
|
-
- \`installCommands\`: Commands for npm/yarn/pnpm/bun
|
|
168
|
-
- \`tailwind\`: Tailwind config validation results
|
|
169
|
-
- \`issues\`: Problems found
|
|
170
|
-
- \`fixes\`: How to fix each issue
|
|
171
|
-
- \`styles\`: Style contract validation results
|
|
172
|
-
- \`styleContract\`: framingui-native, host-utility, mixed, or unknown
|
|
173
|
-
- \`issues\`: CSS contract mismatch risks
|
|
174
|
-
- \`fixes\`: Recommended next actions before integration
|
|
175
|
-
|
|
176
|
-
**Tailwind Validation Checks:**
|
|
177
|
-
- ✅ tailwind.config.{ts,js,mjs,cjs} exists
|
|
178
|
-
- ✅ @framingui/ui content paths included
|
|
179
|
-
- ✅ tailwindcss-animate plugin configured
|
|
180
|
-
|
|
181
|
-
**When to use:**
|
|
182
|
-
- After writing code (Step 3), when user's package.json path is known
|
|
183
|
-
- Before delivering code to user
|
|
184
|
-
- When user reports missing styles or animations
|
|
129
|
+
Run this after writing code when the target package path is known.
|
|
185
130
|
|
|
186
|
-
|
|
131
|
+
Use it to verify:
|
|
132
|
+
- missing dependencies
|
|
133
|
+
- install commands
|
|
134
|
+
- Tailwind setup
|
|
135
|
+
- raw HTML primitives or styling escapes in generated source files
|
|
187
136
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
\`\`\`
|
|
191
|
-
User: "Create a login page with email/password fields"
|
|
192
|
-
|
|
193
|
-
0. Call validate-environment({ projectPath: "...", requiredPackages: [], checkStyles: true })
|
|
194
|
-
-> Classify style contract and decide host-utility vs framingui-native before generation
|
|
195
|
-
|
|
196
|
-
1. Call get-screen-generation-context({ description: "login page..." })
|
|
197
|
-
→ Receive template hints, component plan, section plan, definition starter, and component contracts
|
|
198
|
-
|
|
199
|
-
2. Generate Screen Definition JSON based on definitionStarter + componentPlan
|
|
200
|
-
→ Call validate-screen-definition({ definition: {...} })
|
|
201
|
-
→ Apply autoFixPatches if any, re-validate if needed
|
|
202
|
-
|
|
203
|
-
3. Write React code directly from the validated definition and Step 1 component contracts
|
|
204
|
-
→ Preserve the validated layout structure
|
|
205
|
-
→ Use documented props instead of guessing
|
|
206
|
-
|
|
207
|
-
4. Call validate-environment({ projectPath: "...", requiredPackages: [...] })
|
|
208
|
-
→ Show user missing packages and install commands
|
|
209
|
-
→ Warn about Tailwind config issues if any
|
|
210
|
-
|
|
211
|
-
5. Deliver code to user with complete setup instructions
|
|
212
|
-
\`\`\`
|
|
213
|
-
|
|
214
|
-
## Troubleshooting
|
|
215
|
-
|
|
216
|
-
**Validation fails in Step 2:**
|
|
217
|
-
- Read error messages carefully - they include suggestions and autoFix patches
|
|
218
|
-
- Apply autoFixPatches to auto-correct common issues
|
|
219
|
-
- Check token names match SPEC-LAYOUT-001
|
|
220
|
-
- Verify component IDs exist (use list-components)
|
|
221
|
-
- Prefer componentPlan before exploring optional alternatives
|
|
222
|
-
|
|
223
|
-
**Code writing is blocked in Step 3:**
|
|
224
|
-
- Ensure Screen Definition passed validation in Step 2
|
|
225
|
-
- Resolve any Step 1 metadata warnings before guessing props
|
|
226
|
-
- Use \`preview-component\` when a component contract is incomplete
|
|
227
|
-
|
|
228
|
-
**Missing dependencies:**
|
|
229
|
-
- Always run Step 4 to verify environment
|
|
230
|
-
- Show install commands to user
|
|
231
|
-
- Check Tailwind config includes @framingui/ui paths
|
|
232
|
-
|
|
233
|
-
**Components render without styles:**
|
|
234
|
-
- Verify Tailwind content paths include @framingui/ui
|
|
235
|
-
- Check tailwindcss-animate plugin is configured
|
|
236
|
-
- Check whether the target project is \`host-utility\`, \`mixed\`, or \`framingui-native\`
|
|
237
|
-
- If the project is utility-first, prefer explicit classes instead of relying on FramingUI component defaults
|
|
238
|
-
- Run validate-environment to diagnose
|
|
239
|
-
|
|
240
|
-
---
|
|
137
|
+
If the tool reports missing setup or raw primitive drift, fix the code before delivery.
|
|
241
138
|
|
|
242
139
|
## Best Practices
|
|
243
140
|
|
|
244
|
-
1.
|
|
245
|
-
2.
|
|
246
|
-
3.
|
|
247
|
-
4.
|
|
248
|
-
5.
|
|
249
|
-
6.
|
|
250
|
-
7.
|
|
251
|
-
8. ✅ Use inline props from context instead of guessing
|
|
252
|
-
9. ✅ Use template hints only as inspiration, not as structural constraints
|
|
253
|
-
10. ✅ Confirm the target style contract before relying on CSS variables or component defaults
|
|
254
|
-
|
|
255
|
-
## Alternative Workflows
|
|
256
|
-
|
|
257
|
-
**Legacy prototyping helper:**
|
|
258
|
-
- \`generate-blueprint\` → \`export-screen\` remains available for backward compatibility, but new agent flows should prefer \`get-screen-generation-context\`
|
|
141
|
+
1. Start with \`get-screen-generation-context\`
|
|
142
|
+
2. Use \`includeExamples: false\` unless examples are actually needed
|
|
143
|
+
3. Treat \`templateMatch\` as a hint, not a hard constraint
|
|
144
|
+
4. Treat \`components\` as the source of truth
|
|
145
|
+
5. Validate the definition before writing JSX
|
|
146
|
+
6. Never parse MCP transcript text with shell or Python JSON tooling
|
|
147
|
+
7. Run \`validate-environment\` before handoff
|
|
259
148
|
|
|
260
|
-
|
|
261
|
-
- Follow complete 4-step workflow above
|
|
149
|
+
## Optional Helper Path
|
|
262
150
|
|
|
263
|
-
|
|
264
|
-
- \`generate_screen\` can be used after validation when you want a reference implementation or a starting point`,
|
|
151
|
+
\`generate_screen\` remains available as an optional helper for reference code generation, but it is not the default production workflow and should not replace validation plus direct writing.`,
|
|
265
152
|
},
|
|
266
153
|
},
|
|
267
154
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen-workflow.js","sourceRoot":"","sources":["../../src/prompts/screen-workflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"screen-workflow.js","sourceRoot":"","sources":["../../src/prompts/screen-workflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,UAAU,uBAAuB;IACrC,OAAO;QACL,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gMA2IgL;iBACvL;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|