gemini-design-mcp 3.0.0 → 3.1.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/build/index.js +114 -113
- package/build/prompts/system.d.ts +2 -2
- package/build/prompts/system.js +55 -38
- package/build/tools/modify-frontend.d.ts +4 -4
- package/build/tools/modify-frontend.js +17 -19
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -7,26 +7,32 @@ import { snippetFrontendSchema, snippetFrontend } from "./tools/snippet-frontend
|
|
|
7
7
|
// Create MCP server
|
|
8
8
|
const server = new McpServer({
|
|
9
9
|
name: "gemini-design-mcp",
|
|
10
|
-
version: "3.
|
|
10
|
+
version: "3.1.0",
|
|
11
11
|
});
|
|
12
12
|
// =============================================================================
|
|
13
13
|
// TOOL 1: CREATE_FRONTEND
|
|
14
14
|
// =============================================================================
|
|
15
|
-
server.tool("create_frontend", `Create a NEW, complete frontend file
|
|
15
|
+
server.tool("create_frontend", `Create a NEW, complete frontend file with PREMIUM DESIGN quality.
|
|
16
16
|
|
|
17
17
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
18
18
|
🎯 WHEN TO USE THIS TOOL
|
|
19
19
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
✅ "Create a new UserProfile component"
|
|
24
|
-
✅ "Create the main dashboard layout"
|
|
25
|
-
✅ "Create a settings page"
|
|
21
|
+
This tool is for creating NEW files that need HIGH-QUALITY DESIGN.
|
|
22
|
+
Gemini excels at visual design, layout, and premium UI aesthetics.
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
✅ USE THIS TOOL FOR:
|
|
25
|
+
• "Create a pricing page with 3 tiers" → Complex layout + design decisions
|
|
26
|
+
• "Create a dashboard with charts and stats" → Premium UI needed
|
|
27
|
+
• "Create a landing page for a SaaS" → Visual impact matters
|
|
28
|
+
• "Create a settings page" → Full page design
|
|
29
|
+
• "Create a user profile component" → Polished UI component
|
|
30
|
+
|
|
31
|
+
❌ DO NOT USE THIS TOOL FOR:
|
|
32
|
+
• Creating utility functions → You can do this yourself
|
|
33
|
+
• Creating simple TypeScript types → You can do this yourself
|
|
34
|
+
• Creating config files → You can do this yourself
|
|
35
|
+
• Creating files that don't need design → You can do this yourself
|
|
30
36
|
|
|
31
37
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
32
38
|
⚠️ CRITICAL: MANDATORY FLOW BEFORE CALLING
|
|
@@ -34,13 +40,10 @@ DO NOT use this tool for:
|
|
|
34
40
|
|
|
35
41
|
STEP 1: CHECK PROJECT STATE
|
|
36
42
|
─────────────────────────────
|
|
37
|
-
Before calling this tool, you MUST check the project state:
|
|
38
|
-
|
|
39
43
|
A) EMPTY REPO (no package.json, no framework):
|
|
40
44
|
→ DO NOT call any tool yet
|
|
41
|
-
→ Ask user: "What tech stack do you want?
|
|
45
|
+
→ Ask user: "What tech stack do you want?"
|
|
42
46
|
→ Help them initialize the project first
|
|
43
|
-
→ Only proceed after framework is installed
|
|
44
47
|
|
|
45
48
|
B) PROJECT EXISTS but NO frontend files/design yet:
|
|
46
49
|
→ Proceed to Step 2 (Vibe Selection) - MANDATORY
|
|
@@ -48,18 +51,17 @@ B) PROJECT EXISTS but NO frontend files/design yet:
|
|
|
48
51
|
C) PROJECT EXISTS with existing frontend code:
|
|
49
52
|
→ Analyze existing files to understand design system
|
|
50
53
|
→ Pass relevant files as context parameter
|
|
51
|
-
→ Skip vibe selection (use existing design
|
|
54
|
+
→ Skip vibe selection (use existing design)
|
|
52
55
|
|
|
53
56
|
STEP 2: VIBE SELECTION (Required for new designs)
|
|
54
57
|
──────────────────────────────────────────────────
|
|
55
58
|
If the project has no existing design system, you MUST run vibe selection:
|
|
56
59
|
|
|
57
|
-
1. Generate 5 vibe options with RICH, EVOCATIVE descriptions (2-3 sentences each)
|
|
58
|
-
Each vibe should paint a vivid picture of the aesthetic. Examples:
|
|
60
|
+
1. Generate 5 vibe options with RICH, EVOCATIVE descriptions (2-3 sentences each):
|
|
59
61
|
|
|
60
62
|
🏛️ "Pristine Museum"
|
|
61
63
|
An ultra-clean, 'white-cube' aesthetic focused on vast negative space and
|
|
62
|
-
absolute stillness. Content
|
|
64
|
+
absolute stillness. Content displayed like art in a modern gallery.
|
|
63
65
|
Minimal chrome, maximum breathing room, typography as sculpture.
|
|
64
66
|
|
|
65
67
|
⚡ "Technical Precision"
|
|
@@ -74,7 +76,7 @@ If the project has no existing design system, you MUST run vibe selection:
|
|
|
74
76
|
|
|
75
77
|
🔥 "Bold & Unapologetic"
|
|
76
78
|
High contrast, oversized typography, dramatic color blocks.
|
|
77
|
-
|
|
79
|
+
Demands attention and makes a statement. Not for the faint of heart.
|
|
78
80
|
Strong visual hierarchy, impactful first impressions.
|
|
79
81
|
|
|
80
82
|
🌙 "Dark Luxe"
|
|
@@ -83,170 +85,169 @@ If the project has no existing design system, you MUST run vibe selection:
|
|
|
83
85
|
glowing highlights, and refined micro-interactions.
|
|
84
86
|
|
|
85
87
|
2. Present vibes to user, wait for selection
|
|
86
|
-
|
|
87
88
|
3. Call this tool with designSystem.vibe filled
|
|
88
89
|
|
|
89
|
-
STEP 3: GATHER CONTEXT
|
|
90
|
-
───────────────────────
|
|
91
|
-
If the project has existing code:
|
|
92
|
-
- Read relevant files (components, styles, theme config)
|
|
93
|
-
- Pass them as the context parameter
|
|
94
|
-
- This ensures Gemini matches the existing design system
|
|
95
|
-
|
|
96
90
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
97
91
|
📤 OUTPUT
|
|
98
92
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
99
93
|
|
|
100
94
|
Returns a COMPLETE file with:
|
|
101
|
-
- All necessary imports
|
|
102
|
-
-
|
|
103
|
-
-
|
|
95
|
+
- All necessary imports
|
|
96
|
+
- Premium, polished UI design
|
|
97
|
+
- Proper exports
|
|
104
98
|
- Ready to save directly to filePath`, createFrontendSchema, createFrontend);
|
|
105
99
|
// =============================================================================
|
|
106
100
|
// TOOL 2: MODIFY_FRONTEND
|
|
107
101
|
// =============================================================================
|
|
108
|
-
server.tool("modify_frontend", `
|
|
102
|
+
server.tool("modify_frontend", `Redesign a SINGLE UI element. Returns ONLY the changed code (find/replace format).
|
|
109
103
|
|
|
110
104
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
111
|
-
|
|
105
|
+
⚠️ CRITICAL: ONE MODIFICATION PER CALL
|
|
112
106
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
113
107
|
|
|
114
|
-
|
|
115
|
-
✅ "Add a delete button to this card component"
|
|
116
|
-
✅ "Change the color scheme from blue to purple"
|
|
117
|
-
✅ "Add loading and error states"
|
|
118
|
-
✅ "Make this sidebar collapsible"
|
|
119
|
-
✅ "Add dark mode support to this component"
|
|
120
|
-
✅ "Refactor this component to use a different state pattern"
|
|
108
|
+
This tool makes exactly ONE design modification at a time.
|
|
121
109
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
110
|
+
If you need multiple design changes, call this tool MULTIPLE TIMES IN PARALLEL.
|
|
111
|
+
|
|
112
|
+
Example - User: "Redesign the sidebar and the header"
|
|
113
|
+
→ Call 1: modify_frontend (sidebar redesign)
|
|
114
|
+
→ Call 2: modify_frontend (header redesign)
|
|
115
|
+
→ Run both calls IN PARALLEL
|
|
116
|
+
|
|
117
|
+
NEVER bundle multiple modifications into one call!
|
|
125
118
|
|
|
126
119
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
127
|
-
|
|
120
|
+
🎯 THIS TOOL IS FOR DESIGN CHANGES, NOT CODE LOGIC
|
|
128
121
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
129
122
|
|
|
130
|
-
|
|
131
|
-
You MUST read the file's current content before calling this tool.
|
|
132
|
-
Pass the complete file content as existingCode parameter.
|
|
123
|
+
Gemini is a DESIGN specialist. Use this tool when the visual design needs work.
|
|
133
124
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
125
|
+
✅ USE THIS TOOL FOR (design changes):
|
|
126
|
+
• "The sidebar looks ugly, redesign it" → Full visual redesign
|
|
127
|
+
• "Make this button look more premium" → Design quality upgrade
|
|
128
|
+
• "This card looks dated, refresh it" → Visual refresh
|
|
129
|
+
• "Redesign the header with better layout" → Layout + design
|
|
138
130
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
131
|
+
❌ DO NOT USE THIS TOOL FOR (you can do these yourself):
|
|
132
|
+
• "Make the sidebar collapsible" → Logic change, just add useState
|
|
133
|
+
• "Change the background to blue" → Just change the class
|
|
134
|
+
• "Add a loading spinner" → Simple code addition
|
|
135
|
+
• "Add onClick handler" → Just code, no design
|
|
136
|
+
• "Center this div" → Just flex + items-center
|
|
142
137
|
|
|
143
138
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
144
|
-
|
|
139
|
+
💡 DECISION GUIDE: Should I use this tool?
|
|
145
140
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
146
141
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
142
|
+
Ask yourself: "Does this require VISUAL DESIGN expertise?"
|
|
143
|
+
|
|
144
|
+
| User says... | Use this tool? | Why |
|
|
145
|
+
|---------------------------------------|----------------|------------------------------|
|
|
146
|
+
| "Redesign the sidebar" | ✅ YES | Visual design needed |
|
|
147
|
+
| "Make it look more premium" | ✅ YES | Design quality improvement |
|
|
148
|
+
| "The UI looks bad, fix it" | ✅ YES | Design expertise needed |
|
|
149
|
+
| "Make the sidebar collapsible" | ❌ NO | Just logic (useState) |
|
|
150
|
+
| "Change background color" | ❌ NO | One class change |
|
|
151
|
+
| "Add a button" | ❌ NO | Simple code addition |
|
|
152
|
+
| "Add hover effects" | ❌ NO | Just add hover: classes |
|
|
154
153
|
|
|
155
154
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
156
|
-
📤 OUTPUT
|
|
155
|
+
📤 OUTPUT FORMAT
|
|
157
156
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
158
157
|
|
|
159
|
-
Returns the
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
158
|
+
Returns a find/replace block (NOT the full file):
|
|
159
|
+
|
|
160
|
+
// NEW IMPORTS NEEDED: (if any)
|
|
161
|
+
import { X } from "y";
|
|
162
|
+
|
|
163
|
+
// FIND THIS CODE:
|
|
164
|
+
<exact existing code to find>
|
|
165
|
+
|
|
166
|
+
// REPLACE WITH:
|
|
167
|
+
<new redesigned code>
|
|
168
|
+
|
|
169
|
+
You (the agent) are responsible for:
|
|
170
|
+
- Applying the find/replace to the file
|
|
171
|
+
- Merging any new imports`, modifyFrontendSchema, modifyFrontend);
|
|
164
172
|
// =============================================================================
|
|
165
173
|
// TOOL 3: SNIPPET_FRONTEND
|
|
166
174
|
// =============================================================================
|
|
167
|
-
server.tool("snippet_frontend", `Generate a
|
|
175
|
+
server.tool("snippet_frontend", `Generate a NEW UI component/section to INSERT into an existing file.
|
|
168
176
|
|
|
169
177
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
170
|
-
🎯
|
|
178
|
+
🎯 THIS TOOL IS FOR ADDING NEW DESIGNED UI ELEMENTS
|
|
171
179
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
172
180
|
|
|
173
|
-
Use this
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
181
|
+
Use this when you need to ADD a new UI element that requires design quality.
|
|
182
|
+
|
|
183
|
+
✅ USE THIS TOOL FOR (new designed UI to insert):
|
|
184
|
+
• "Add a sidebar to this dashboard" → New designed component to insert
|
|
185
|
+
• "Add a stats section with charts" → Complex UI element
|
|
186
|
+
• "Add a pricing table" → Designed component
|
|
187
|
+
• "Add a testimonials carousel" → Needs visual design
|
|
188
|
+
• "Add a feature comparison grid" → Complex layout + design
|
|
179
189
|
|
|
180
|
-
DO NOT
|
|
181
|
-
|
|
182
|
-
|
|
190
|
+
❌ DO NOT USE THIS TOOL FOR (you can do these yourself):
|
|
191
|
+
• "Add a button" → Too simple, just write the button
|
|
192
|
+
• "Add a loading spinner" → Simple, do it yourself
|
|
193
|
+
• "Add an onClick handler" → Just code, no design
|
|
194
|
+
• "Add a useState hook" → Logic, not design
|
|
195
|
+
• "Add an import statement" → Just code
|
|
183
196
|
|
|
184
197
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
185
|
-
💡
|
|
198
|
+
💡 DECISION GUIDE: snippet_frontend vs modify_frontend
|
|
186
199
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
187
200
|
|
|
188
|
-
|
|
|
189
|
-
|
|
190
|
-
|
|
|
191
|
-
|
|
|
192
|
-
|
|
|
193
|
-
|
|
194
|
-
snippet_frontend is for when you want to INSERT new code into an existing file
|
|
195
|
-
without having Gemini rewrite the entire file.
|
|
201
|
+
| Situation | Tool |
|
|
202
|
+
|----------------------------------------------|-------------------|
|
|
203
|
+
| Adding NEW UI element to a file | snippet_frontend |
|
|
204
|
+
| Redesigning EXISTING UI in a file | modify_frontend |
|
|
205
|
+
| Creating a NEW file entirely | create_frontend |
|
|
196
206
|
|
|
197
|
-
Example
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
4. Gemini returns just the sidebar code
|
|
202
|
-
5. You insert it at the right location in Dashboard.tsx
|
|
207
|
+
Example:
|
|
208
|
+
- Dashboard.tsx exists with header + main content
|
|
209
|
+
- User: "Add a sidebar" → snippet_frontend (adding NEW element)
|
|
210
|
+
- User: "Redesign the header" → modify_frontend (changing EXISTING element)
|
|
203
211
|
|
|
204
212
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
205
213
|
⚠️ REQUIRED: INSERTION CONTEXT
|
|
206
214
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
207
215
|
|
|
208
|
-
The insertionContext parameter
|
|
209
|
-
- WHERE the snippet will be inserted
|
|
210
|
-
- WHAT code surrounds it
|
|
211
|
-
- WHAT patterns to match
|
|
216
|
+
The insertionContext parameter tells Gemini WHERE and HOW to match the design:
|
|
212
217
|
|
|
213
|
-
Good
|
|
214
|
-
"Inside
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
+
Good example:
|
|
219
|
+
"Inside Dashboard component's return, after <Header />.
|
|
220
|
+
Uses Tailwind with dark theme (bg-zinc-900, text-zinc-100).
|
|
221
|
+
Existing components use rounded-xl, p-6 padding, shadow-lg.
|
|
222
|
+
State managed with useState."
|
|
218
223
|
|
|
219
|
-
Bad
|
|
220
|
-
"In the dashboard
|
|
224
|
+
Bad example:
|
|
225
|
+
"In the dashboard"
|
|
221
226
|
|
|
222
227
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
223
228
|
📤 OUTPUT FORMAT
|
|
224
229
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
225
230
|
|
|
226
|
-
Returns
|
|
231
|
+
Returns snippet with optional new imports:
|
|
227
232
|
|
|
228
233
|
// NEW IMPORTS NEEDED:
|
|
229
234
|
import { useState } from "react";
|
|
230
|
-
import { Dialog } from "@headlessui/react";
|
|
231
235
|
|
|
232
236
|
// SNIPPET:
|
|
233
237
|
<Sidebar className="...">
|
|
234
238
|
...
|
|
235
239
|
</Sidebar>
|
|
236
240
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
- Merging new imports with existing imports
|
|
241
|
-
- Inserting the snippet at the correct location
|
|
242
|
-
- Ensuring the file still compiles after insertion`, snippetFrontendSchema, snippetFrontend);
|
|
241
|
+
You are responsible for:
|
|
242
|
+
- Merging new imports with existing ones
|
|
243
|
+
- Inserting the snippet at the correct location`, snippetFrontendSchema, snippetFrontend);
|
|
243
244
|
// =============================================================================
|
|
244
245
|
// START SERVER
|
|
245
246
|
// =============================================================================
|
|
246
247
|
async function main() {
|
|
247
248
|
const transport = new StdioServerTransport();
|
|
248
249
|
await server.connect(transport);
|
|
249
|
-
console.error("gemini-design-mcp v3.
|
|
250
|
+
console.error("gemini-design-mcp v3.1.0 running on stdio");
|
|
250
251
|
}
|
|
251
252
|
main().catch((error) => {
|
|
252
253
|
console.error("Fatal error:", error);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const CREATE_FRONTEND_PROMPT = "You are an elite UI/UX Designer creating production-ready, visually stunning interfaces.\n\nYOUR TASK: Create a COMPLETE, NEW frontend file.\n\nDESIGN EXCELLENCE REQUIREMENTS:\n\n1. **MAXIMUM DETAIL AND DENSITY**\n - The interface MUST be densely populated and feature-rich\n - NEVER produce simple wireframes, empty containers, or placeholder content\n - Fill the space with intricate details, realistic content, background elements, and meaningful UI components\n - Every section should feel like a fully finished, polished product\n\n2. **PREMIUM VISUAL STYLING**\n - Apply high-end design principles throughout\n - Use sophisticated styling: nuanced shadows, subtle gradients, refined borders, micro-textures\n - Add depth and dimension with layered elements\n - The aesthetic MUST feel modern, premium, and visually captivating\n - Use professional color palettes with proper contrast and hierarchy\n\n3. **COMPREHENSIVE INTERACTIVITY**\n - Design every element to look tangible and interactive\n - Include visual states: hover effects, focus rings, active states, transitions\n - Buttons should look clickable, inputs should look fillable\n - The interface should feel alive, not static\n\n4. **LAYOUT EXCELLENCE**\n - Use proper visual hierarchy with clear focal points\n - Apply consistent spacing rhythm throughout\n - Ensure the layout breathes - balance density with whitespace\n - Full viewport height designs (min-height: 100vh on body)\n - No awkward gaps or orphaned elements\n\n5. **RESPONSIVE BY DEFAULT**\n - Designs MUST work flawlessly on mobile and desktop\n - Touch-friendly sizing for interactive elements on mobile\n - Stackable grids that adapt naturally to screen size\n\n6. **REALISTIC CONTENT**\n - Use believable placeholder content (real-looking names, dates, numbers)\n - Include appropriate icons, avatars, and imagery\n - Data visualizations should have realistic data points\n - Text should be contextually appropriate, not \"Lorem ipsum\"\n\nOUTPUT REQUIREMENTS:\n- Return a COMPLETE file with all necessary imports at the top\n- Include proper exports (default or named as appropriate)\n- The code must be ready to use as-is, no modifications needed\n- Follow the tech stack conventions exactly\n- Return ONLY the code, no explanations or markdown fences";
|
|
2
|
-
export declare const MODIFY_FRONTEND_PROMPT = "You are an elite UI/UX Designer
|
|
3
|
-
export declare const SNIPPET_FRONTEND_PROMPT = "You are an elite UI/UX Designer generating a code snippet.\n\nYOUR TASK: Generate a focused code snippet that will be INSERTED into an existing file.\n\nSNIPPET PRINCIPLES:\n\n1. **CONTEXTUAL AWARENESS**\n - The snippet will be inserted into an existing codebase\n - Match the style and patterns described in the context\n - Use consistent naming conventions with the project\n\n2. **SELF-CONTAINED BUT INTEGRABLE**\n - The snippet should work when inserted\n - Include only the imports that are NEW (the agent will merge them)\n - Don't include file-level exports unless specifically asked\n\n3. **PREMIUM QUALITY**\n - Even snippets must have premium visual styling\n - Include hover states, transitions, proper spacing\n - Use realistic placeholder content, not Lorem ipsum\n\n4. **CLEAN BOUNDARIES**\n - Clear start and end of the snippet\n - Proper indentation (assume standard 2-space indent)\n - No trailing commas or syntax that would break insertion\n\n5. **FOCUSED SCOPE**\n - Generate exactly what was asked, nothing more\n - Don't add \"nice to have\" features unless requested\n - Keep the snippet as lean as possible while meeting requirements\n\nOUTPUT
|
|
2
|
+
export declare const MODIFY_FRONTEND_PROMPT = "You are an elite UI/UX Designer making a SINGLE, focused design modification.\n\nYOUR TASK: Apply ONE design modification and return ONLY the changed code.\n\nCRITICAL RULES:\n\n1. **SINGLE MODIFICATION ONLY**\n - You are making exactly ONE design change\n - Do NOT touch or return any code unrelated to this specific change\n - Keep the modification as focused and surgical as possible\n\n2. **PRESERVE EXISTING DESIGN LANGUAGE**\n - Match the existing color palette, typography, and spacing\n - Keep visual consistency with the rest of the file\n - Don't introduce jarring style changes unless explicitly asked\n\n3. **PREMIUM QUALITY**\n - The modified element must have the same polish as the original\n - Include proper hover states, transitions, and visual feedback\n - Ensure the modification enhances the overall design\n\nOUTPUT FORMAT - STRICTLY FOLLOW THIS:\n\n```\n// FIND THIS CODE:\n<exact code to find and replace>\n\n// REPLACE WITH:\n<new redesigned code>\n```\n\nIf new imports are needed, add them at the top:\n```\n// NEW IMPORTS NEEDED:\nimport { X } from \"y\";\n\n// FIND THIS CODE:\n...\n\n// REPLACE WITH:\n...\n```\n\nIMPORTANT:\n- The \"FIND THIS CODE\" must be an EXACT match of existing code (copy-paste precision)\n- Include enough context in \"FIND THIS CODE\" to make it unique in the file\n- Return ONLY what needs to change, nothing else\n- No explanations, no full file, just the find/replace block";
|
|
3
|
+
export declare const SNIPPET_FRONTEND_PROMPT = "You are an elite UI/UX Designer generating a code snippet to INSERT.\n\nYOUR TASK: Generate a focused code snippet that will be INSERTED into an existing file.\n\nSNIPPET PRINCIPLES:\n\n1. **CONTEXTUAL AWARENESS**\n - The snippet will be inserted into an existing codebase\n - Match the style and patterns described in the context\n - Use consistent naming conventions with the project\n\n2. **SELF-CONTAINED BUT INTEGRABLE**\n - The snippet should work when inserted\n - Include only the imports that are NEW (the agent will merge them)\n - Don't include file-level exports unless specifically asked\n\n3. **PREMIUM QUALITY**\n - Even snippets must have premium visual styling\n - Include hover states, transitions, proper spacing\n - Use realistic placeholder content, not Lorem ipsum\n\n4. **CLEAN BOUNDARIES**\n - Clear start and end of the snippet\n - Proper indentation (assume standard 2-space indent)\n - No trailing commas or syntax that would break insertion\n\n5. **FOCUSED SCOPE**\n - Generate exactly what was asked, nothing more\n - Don't add \"nice to have\" features unless requested\n - Keep the snippet as lean as possible while meeting requirements\n\nOUTPUT FORMAT:\n\nIf new imports are needed:\n```\n// NEW IMPORTS NEEDED:\nimport { X } from \"y\";\n\n// SNIPPET:\n<your code here>\n```\n\nIf no new imports needed:\n```\n// SNIPPET:\n<your code here>\n```\n\nReturn ONLY the code, no explanations.";
|
package/build/prompts/system.js
CHANGED
|
@@ -53,50 +53,62 @@ OUTPUT REQUIREMENTS:
|
|
|
53
53
|
- Return ONLY the code, no explanations or markdown fences`;
|
|
54
54
|
// =============================================================================
|
|
55
55
|
// MODIFY_FRONTEND PROMPT
|
|
56
|
-
// Used for
|
|
56
|
+
// Used for making a SINGLE design modification to existing code
|
|
57
|
+
// Returns ONLY the modified portion, not the full file
|
|
57
58
|
// =============================================================================
|
|
58
|
-
export const MODIFY_FRONTEND_PROMPT = `You are an elite UI/UX Designer
|
|
59
|
+
export const MODIFY_FRONTEND_PROMPT = `You are an elite UI/UX Designer making a SINGLE, focused design modification.
|
|
59
60
|
|
|
60
|
-
YOUR TASK:
|
|
61
|
+
YOUR TASK: Apply ONE design modification and return ONLY the changed code.
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
CRITICAL RULES:
|
|
63
64
|
|
|
64
|
-
1. **
|
|
65
|
-
-
|
|
66
|
-
-
|
|
65
|
+
1. **SINGLE MODIFICATION ONLY**
|
|
66
|
+
- You are making exactly ONE design change
|
|
67
|
+
- Do NOT touch or return any code unrelated to this specific change
|
|
68
|
+
- Keep the modification as focused and surgical as possible
|
|
69
|
+
|
|
70
|
+
2. **PRESERVE EXISTING DESIGN LANGUAGE**
|
|
71
|
+
- Match the existing color palette, typography, and spacing
|
|
72
|
+
- Keep visual consistency with the rest of the file
|
|
67
73
|
- Don't introduce jarring style changes unless explicitly asked
|
|
68
74
|
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
75
|
+
3. **PREMIUM QUALITY**
|
|
76
|
+
- The modified element must have the same polish as the original
|
|
77
|
+
- Include proper hover states, transitions, and visual feedback
|
|
78
|
+
- Ensure the modification enhances the overall design
|
|
73
79
|
|
|
74
|
-
|
|
75
|
-
- Only change what needs to be changed
|
|
76
|
-
- Don't refactor unrelated parts of the code
|
|
77
|
-
- Preserve imports that are still needed, add new ones as required
|
|
80
|
+
OUTPUT FORMAT - STRICTLY FOLLOW THIS:
|
|
78
81
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
- Ensure new interactive elements have proper states (hover, focus, etc.)
|
|
82
|
+
\`\`\`
|
|
83
|
+
// FIND THIS CODE:
|
|
84
|
+
<exact code to find and replace>
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
- Ensure the file remains properly typed (if TypeScript)
|
|
86
|
+
// REPLACE WITH:
|
|
87
|
+
<new redesigned code>
|
|
88
|
+
\`\`\`
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
If new imports are needed, add them at the top:
|
|
91
|
+
\`\`\`
|
|
92
|
+
// NEW IMPORTS NEEDED:
|
|
93
|
+
import { X } from "y";
|
|
94
|
+
|
|
95
|
+
// FIND THIS CODE:
|
|
96
|
+
...
|
|
97
|
+
|
|
98
|
+
// REPLACE WITH:
|
|
99
|
+
...
|
|
100
|
+
\`\`\`
|
|
101
|
+
|
|
102
|
+
IMPORTANT:
|
|
103
|
+
- The "FIND THIS CODE" must be an EXACT match of existing code (copy-paste precision)
|
|
104
|
+
- Include enough context in "FIND THIS CODE" to make it unique in the file
|
|
105
|
+
- Return ONLY what needs to change, nothing else
|
|
106
|
+
- No explanations, no full file, just the find/replace block`;
|
|
95
107
|
// =============================================================================
|
|
96
108
|
// SNIPPET_FRONTEND PROMPT
|
|
97
109
|
// Used for generating code snippets to INSERT into existing files
|
|
98
110
|
// =============================================================================
|
|
99
|
-
export const SNIPPET_FRONTEND_PROMPT = `You are an elite UI/UX Designer generating a code snippet.
|
|
111
|
+
export const SNIPPET_FRONTEND_PROMPT = `You are an elite UI/UX Designer generating a code snippet to INSERT.
|
|
100
112
|
|
|
101
113
|
YOUR TASK: Generate a focused code snippet that will be INSERTED into an existing file.
|
|
102
114
|
|
|
@@ -127,16 +139,21 @@ SNIPPET PRINCIPLES:
|
|
|
127
139
|
- Don't add "nice to have" features unless requested
|
|
128
140
|
- Keep the snippet as lean as possible while meeting requirements
|
|
129
141
|
|
|
130
|
-
OUTPUT
|
|
131
|
-
- Return ONLY the code snippet
|
|
132
|
-
- If new imports are needed, list them at the very top, clearly separated
|
|
133
|
-
- The snippet should be ready to paste/insert
|
|
134
|
-
- Match the tech stack and patterns from context
|
|
135
|
-
- Return ONLY the code, no explanations or markdown fences
|
|
142
|
+
OUTPUT FORMAT:
|
|
136
143
|
|
|
137
|
-
|
|
144
|
+
If new imports are needed:
|
|
145
|
+
\`\`\`
|
|
138
146
|
// NEW IMPORTS NEEDED:
|
|
139
147
|
import { X } from "y";
|
|
140
148
|
|
|
141
149
|
// SNIPPET:
|
|
142
|
-
<your code here
|
|
150
|
+
<your code here>
|
|
151
|
+
\`\`\`
|
|
152
|
+
|
|
153
|
+
If no new imports needed:
|
|
154
|
+
\`\`\`
|
|
155
|
+
// SNIPPET:
|
|
156
|
+
<your code here>
|
|
157
|
+
\`\`\`
|
|
158
|
+
|
|
159
|
+
Return ONLY the code, no explanations.`;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const modifyFrontendSchema: {
|
|
3
|
-
|
|
3
|
+
modification: z.ZodString;
|
|
4
|
+
targetCode: z.ZodString;
|
|
4
5
|
filePath: z.ZodString;
|
|
5
|
-
existingCode: z.ZodString;
|
|
6
6
|
context: z.ZodOptional<z.ZodString>;
|
|
7
7
|
};
|
|
8
8
|
export declare function modifyFrontend(params: {
|
|
9
|
-
|
|
9
|
+
modification: string;
|
|
10
|
+
targetCode: string;
|
|
10
11
|
filePath: string;
|
|
11
|
-
existingCode: string;
|
|
12
12
|
context?: string;
|
|
13
13
|
}): Promise<{
|
|
14
14
|
content: {
|
|
@@ -2,44 +2,42 @@ import { z } from "zod";
|
|
|
2
2
|
import { generateWithGemini } from "../lib/gemini.js";
|
|
3
3
|
import { MODIFY_FRONTEND_PROMPT } from "../prompts/system.js";
|
|
4
4
|
export const modifyFrontendSchema = {
|
|
5
|
-
|
|
5
|
+
modification: z.string().describe("The SINGLE design modification to make. Be specific. " +
|
|
6
6
|
"Examples: " +
|
|
7
|
-
"'
|
|
8
|
-
"'
|
|
9
|
-
"'
|
|
10
|
-
|
|
7
|
+
"'Redesign this button to look more premium with gradient and shadow', " +
|
|
8
|
+
"'Redesign the card header with better typography and spacing', " +
|
|
9
|
+
"'Make this sidebar look more modern with glassmorphism effect'"),
|
|
10
|
+
targetCode: z.string().describe("The specific code section to modify (NOT the full file). " +
|
|
11
|
+
"Pass only the relevant component/element that needs redesigning. " +
|
|
12
|
+
"This helps Gemini focus on exactly what to change."),
|
|
11
13
|
filePath: z.string().describe("The path of the file being modified. " +
|
|
12
14
|
"Example: 'src/components/Sidebar.tsx'"),
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
"Gemini will return the complete modified file."),
|
|
16
|
-
context: z.string().optional().describe("Additional project context if needed for the modification. " +
|
|
17
|
-
"Pass related files if the modification needs to match patterns from elsewhere. " +
|
|
18
|
-
"Optional - only include if relevant to the modification."),
|
|
15
|
+
context: z.string().optional().describe("Additional context about the file's design system. " +
|
|
16
|
+
"Example: 'Uses Tailwind, dark theme with zinc colors, rounded-xl borders'"),
|
|
19
17
|
};
|
|
20
18
|
export async function modifyFrontend(params) {
|
|
21
|
-
const {
|
|
19
|
+
const { modification, targetCode, filePath, context } = params;
|
|
22
20
|
// Build context instructions
|
|
23
21
|
let contextInstructions = '';
|
|
24
22
|
if (context) {
|
|
25
23
|
contextInstructions = `
|
|
26
|
-
|
|
24
|
+
DESIGN CONTEXT:
|
|
27
25
|
${context}
|
|
28
26
|
`;
|
|
29
27
|
}
|
|
30
28
|
const systemPrompt = `${MODIFY_FRONTEND_PROMPT}
|
|
31
29
|
${contextInstructions}
|
|
32
|
-
FILE
|
|
30
|
+
FILE: ${filePath}
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
CODE TO MODIFY:
|
|
35
33
|
\`\`\`
|
|
36
|
-
${
|
|
34
|
+
${targetCode}
|
|
37
35
|
\`\`\`
|
|
38
36
|
|
|
39
|
-
MODIFICATION REQUESTED: ${
|
|
37
|
+
MODIFICATION REQUESTED: ${modification}
|
|
40
38
|
|
|
41
|
-
Remember: Return the
|
|
42
|
-
const result = await generateWithGemini(systemPrompt,
|
|
39
|
+
Remember: Return ONLY the find/replace block. ONE modification, surgical precision.`.trim();
|
|
40
|
+
const result = await generateWithGemini(systemPrompt, modification);
|
|
43
41
|
return {
|
|
44
42
|
content: [{ type: "text", text: result }],
|
|
45
43
|
};
|