gemini-design-mcp 3.0.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +123 -139
- 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,7 +7,7 @@ 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.0
|
|
10
|
+
version: "3.2.0",
|
|
11
11
|
});
|
|
12
12
|
// =============================================================================
|
|
13
13
|
// TOOL 1: CREATE_FRONTEND
|
|
@@ -19,20 +19,17 @@ server.tool("create_frontend", `Create a NEW, complete frontend file with PREMIU
|
|
|
19
19
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
20
20
|
|
|
21
21
|
This tool is for creating NEW files that need HIGH-QUALITY DESIGN.
|
|
22
|
-
Gemini excels at visual design, layout, and premium UI aesthetics.
|
|
23
22
|
|
|
24
23
|
✅ USE THIS TOOL FOR:
|
|
25
|
-
• "Create a pricing page
|
|
26
|
-
• "Create a dashboard
|
|
27
|
-
• "Create a landing page
|
|
28
|
-
• "Create a
|
|
29
|
-
• "Create a user profile component" → Polished UI component
|
|
24
|
+
• "Create a pricing page" → New file with designed UI
|
|
25
|
+
• "Create a dashboard" → New file with designed UI
|
|
26
|
+
• "Create a landing page" → New file with designed UI
|
|
27
|
+
• "Create a user profile component" → New file with designed UI
|
|
30
28
|
|
|
31
29
|
❌ DO NOT USE THIS TOOL FOR:
|
|
32
30
|
• Creating utility functions → You can do this yourself
|
|
33
|
-
• Creating
|
|
31
|
+
• Creating TypeScript types → You can do this yourself
|
|
34
32
|
• Creating config files → You can do this yourself
|
|
35
|
-
• Creating files that don't need design → You can do this yourself
|
|
36
33
|
|
|
37
34
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
38
35
|
⚠️ CRITICAL: MANDATORY FLOW BEFORE CALLING
|
|
@@ -40,196 +37,183 @@ Gemini excels at visual design, layout, and premium UI aesthetics.
|
|
|
40
37
|
|
|
41
38
|
STEP 1: CHECK PROJECT STATE
|
|
42
39
|
─────────────────────────────
|
|
43
|
-
A) EMPTY REPO (no package.json
|
|
44
|
-
→ DO NOT call any tool yet
|
|
40
|
+
A) EMPTY REPO (no package.json):
|
|
45
41
|
→ Ask user: "What tech stack do you want?"
|
|
46
|
-
→ Help them initialize
|
|
42
|
+
→ Help them initialize first
|
|
47
43
|
|
|
48
|
-
B) PROJECT EXISTS but NO frontend files
|
|
44
|
+
B) PROJECT EXISTS but NO frontend files yet:
|
|
49
45
|
→ Proceed to Step 2 (Vibe Selection) - MANDATORY
|
|
50
46
|
|
|
51
47
|
C) PROJECT EXISTS with existing frontend code:
|
|
52
|
-
→ Analyze existing files
|
|
53
|
-
→
|
|
54
|
-
→ Skip vibe selection (use existing design)
|
|
48
|
+
→ Analyze existing files, pass as context
|
|
49
|
+
→ Skip vibe selection
|
|
55
50
|
|
|
56
51
|
STEP 2: VIBE SELECTION (Required for new designs)
|
|
57
52
|
──────────────────────────────────────────────────
|
|
58
|
-
|
|
53
|
+
Generate 5 vibe options with RICH descriptions (2-3 sentences each):
|
|
59
54
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
Minimal chrome, maximum breathing room, typography as sculpture.
|
|
66
|
-
|
|
67
|
-
⚡ "Technical Precision"
|
|
68
|
-
A layout-driven vibe emphasizing the grid and intentional structure.
|
|
69
|
-
Sharp edges, monospace accents, blueprint energy. Feels slightly
|
|
70
|
-
'under construction' in a cool, architectural way.
|
|
71
|
-
|
|
72
|
-
🌊 "Fluid & Organic"
|
|
73
|
-
Soft curves, flowing gradients, and natural movement throughout.
|
|
74
|
-
Like water or silk, everything feels smooth and interconnected.
|
|
75
|
-
Calming yet sophisticated, with gentle animations.
|
|
76
|
-
|
|
77
|
-
🔥 "Bold & Unapologetic"
|
|
78
|
-
High contrast, oversized typography, dramatic color blocks.
|
|
79
|
-
Demands attention and makes a statement. Not for the faint of heart.
|
|
80
|
-
Strong visual hierarchy, impactful first impressions.
|
|
81
|
-
|
|
82
|
-
🌙 "Dark Luxe"
|
|
83
|
-
Deep, rich darks with subtle metallic or jewel-tone accents.
|
|
84
|
-
Premium feel, like a high-end app at night. Sophisticated shadows,
|
|
85
|
-
glowing highlights, and refined micro-interactions.
|
|
86
|
-
|
|
87
|
-
2. Present vibes to user, wait for selection
|
|
88
|
-
3. Call this tool with designSystem.vibe filled
|
|
55
|
+
🏛️ "Pristine Museum" - Ultra-clean, white-cube aesthetic...
|
|
56
|
+
⚡ "Technical Precision" - Grid-focused, architectural...
|
|
57
|
+
🌊 "Fluid & Organic" - Soft curves, flowing gradients...
|
|
58
|
+
🔥 "Bold & Unapologetic" - High contrast, oversized typography...
|
|
59
|
+
🌙 "Dark Luxe" - Deep darks, metallic accents...
|
|
89
60
|
|
|
90
61
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
91
62
|
📤 OUTPUT
|
|
92
63
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
93
64
|
|
|
94
|
-
Returns a COMPLETE file
|
|
95
|
-
- All necessary imports
|
|
96
|
-
- Premium, polished UI design
|
|
97
|
-
- Proper exports
|
|
98
|
-
- Ready to save directly to filePath`, createFrontendSchema, createFrontend);
|
|
65
|
+
Returns a COMPLETE file ready to save.`, createFrontendSchema, createFrontend);
|
|
99
66
|
// =============================================================================
|
|
100
67
|
// TOOL 2: MODIFY_FRONTEND
|
|
101
68
|
// =============================================================================
|
|
102
|
-
server.tool("modify_frontend", `Redesign
|
|
69
|
+
server.tool("modify_frontend", `Redesign a SINGLE UI element. Returns ONLY the changed code (find/replace format).
|
|
103
70
|
|
|
104
71
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
105
|
-
|
|
72
|
+
⚠️ CRITICAL: ONE MODIFICATION PER CALL
|
|
106
73
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
107
74
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
✅ USE THIS TOOL FOR (design changes):
|
|
111
|
-
• "The sidebar looks ugly, redesign it" → Full visual redesign
|
|
112
|
-
• "Make this page look more premium/modern" → Design quality upgrade
|
|
113
|
-
• "This component looks dated, refresh the design" → Visual refresh
|
|
114
|
-
• "Redesign the header with a better layout" → Layout + design
|
|
115
|
-
• "The cards look boring, make them more visually appealing" → Design improvement
|
|
116
|
-
|
|
117
|
-
❌ DO NOT USE THIS TOOL FOR (you can do these yourself):
|
|
118
|
-
• "Make the sidebar collapsible" → Logic change, just add useState + animation
|
|
119
|
-
• "Change the background to blue" → Just change bg-zinc-900 to bg-blue-900
|
|
120
|
-
• "Add a loading spinner" → Simple code addition
|
|
121
|
-
• "Add onClick handler" → Just code, no design needed
|
|
122
|
-
• "Fix the TypeScript error" → Not a design task
|
|
123
|
-
• "Add dark mode toggle" → Logic, not design
|
|
124
|
-
• "Make it responsive" → You can add breakpoints yourself
|
|
75
|
+
This tool makes exactly ONE design modification at a time.
|
|
76
|
+
If you need multiple changes, call this tool MULTIPLE TIMES IN PARALLEL.
|
|
125
77
|
|
|
126
78
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
127
|
-
|
|
79
|
+
🎯 WHEN TO USE THIS TOOL
|
|
128
80
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
129
81
|
|
|
130
|
-
|
|
82
|
+
Use this to REDESIGN existing UI elements that need better design.
|
|
83
|
+
|
|
84
|
+
✅ USE THIS TOOL FOR:
|
|
85
|
+
• "The sidebar looks ugly, redesign it"
|
|
86
|
+
• "Make this card look more premium"
|
|
87
|
+
• "This header looks dated, refresh it"
|
|
88
|
+
• "The buttons look boring, make them better"
|
|
131
89
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
| "Make the sidebar collapsible" | ❌ NO | Just logic (useState) |
|
|
138
|
-
| "Change background color" | ❌ NO | One class change |
|
|
139
|
-
| "Add a button" | ❌ NO | Simple code addition |
|
|
140
|
-
| "Add hover effects" | ❌ NO | Just add hover: classes |
|
|
141
|
-
| "Center this div" | ❌ NO | Just flex + items-center |
|
|
90
|
+
❌ DO NOT USE THIS TOOL FOR:
|
|
91
|
+
• "Make the sidebar collapsible" → Just logic (useState), do it yourself
|
|
92
|
+
• "Change background to blue" → Just change the class yourself
|
|
93
|
+
• "Add onClick handler" → Just code, do it yourself
|
|
94
|
+
• "Center this div" → Just add flex classes yourself
|
|
142
95
|
|
|
143
96
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
144
|
-
|
|
97
|
+
📤 OUTPUT FORMAT
|
|
145
98
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
146
99
|
|
|
147
|
-
|
|
148
|
-
|
|
100
|
+
// NEW IMPORTS NEEDED: (if any)
|
|
101
|
+
import { X } from "y";
|
|
149
102
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
Bad: "Fix the sidebar"
|
|
103
|
+
// FIND THIS CODE:
|
|
104
|
+
<exact existing code>
|
|
153
105
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
157
|
-
|
|
158
|
-
Returns the COMPLETE modified file:
|
|
159
|
-
- Ready to replace the original file
|
|
160
|
-
- Design improvements applied
|
|
161
|
-
- All functionality preserved`, modifyFrontendSchema, modifyFrontend);
|
|
106
|
+
// REPLACE WITH:
|
|
107
|
+
<new redesigned code>`, modifyFrontendSchema, modifyFrontend);
|
|
162
108
|
// =============================================================================
|
|
163
109
|
// TOOL 3: SNIPPET_FRONTEND
|
|
164
110
|
// =============================================================================
|
|
165
|
-
server.tool("snippet_frontend", `Generate a NEW UI component
|
|
111
|
+
server.tool("snippet_frontend", `Generate the JSX/HTML for a NEW UI component to INSERT into an existing file.
|
|
166
112
|
|
|
167
113
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
168
|
-
|
|
114
|
+
⚠️ CRITICAL: SEPARATION OF CONCERNS
|
|
169
115
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
170
116
|
|
|
171
|
-
|
|
117
|
+
When adding a new UI feature:
|
|
118
|
+
• YOU (Claude) handle the LOGIC: useState, handlers, data, conditions
|
|
119
|
+
• GEMINI handles the JSX/HTML: the actual UI component with premium design
|
|
172
120
|
|
|
173
|
-
|
|
174
|
-
• "Add a sidebar to this dashboard" → New designed component to insert
|
|
175
|
-
• "Add a stats section with charts" → Complex UI element
|
|
176
|
-
• "Add a pricing table" → Designed component
|
|
177
|
-
• "Add a testimonials carousel" → Needs visual design
|
|
178
|
-
• "Add a feature comparison grid" → Complex layout + design
|
|
121
|
+
EXAMPLE - User: "Add a search dropdown with results"
|
|
179
122
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
123
|
+
YOU do this yourself:
|
|
124
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
125
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
126
|
+
const filteredResults = data.filter(...)
|
|
127
|
+
|
|
128
|
+
GEMINI does this (via snippet_frontend):
|
|
129
|
+
<div className="relative">
|
|
130
|
+
<input className="..." />
|
|
131
|
+
{showDropdown && (
|
|
132
|
+
<div className="absolute ..."> // Premium designed dropdown
|
|
133
|
+
{filteredResults.map(item => (
|
|
134
|
+
<div className="..."> // Beautiful result items
|
|
135
|
+
<Icon />
|
|
136
|
+
<span>{item.title}</span>
|
|
137
|
+
</div>
|
|
138
|
+
))}
|
|
139
|
+
</div>
|
|
140
|
+
)}
|
|
141
|
+
</div>
|
|
186
142
|
|
|
187
143
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
188
|
-
|
|
144
|
+
🎯 WHEN TO USE THIS TOOL
|
|
189
145
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
190
146
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
147
|
+
Use this for ANY new UI component that needs visual design:
|
|
148
|
+
|
|
149
|
+
✅ USE THIS TOOL FOR (Gemini designs the JSX):
|
|
150
|
+
• "Add a sidebar" → You add state, Gemini designs the sidebar JSX
|
|
151
|
+
• "Add a search dropdown" → You add useState/filtering, Gemini designs the dropdown JSX
|
|
152
|
+
• "Add a modal" → You add open/close state, Gemini designs the modal JSX
|
|
153
|
+
• "Add a notification toast" → You add state, Gemini designs the toast JSX
|
|
154
|
+
• "Add a stats section" → You add data, Gemini designs the stats cards JSX
|
|
155
|
+
• "Add a navigation menu" → You add routing logic, Gemini designs the menu JSX
|
|
156
|
+
• "Add a user avatar dropdown" → You add state, Gemini designs the dropdown JSX
|
|
157
|
+
• "Add a data table" → You add sorting/filtering, Gemini designs the table JSX
|
|
196
158
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
159
|
+
❌ DO NOT USE THIS TOOL FOR (too simple, do it yourself):
|
|
160
|
+
• "Add a single button" → Just write <button>
|
|
161
|
+
• "Add an input field" → Just write <input>
|
|
162
|
+
• "Add a simple link" → Just write <a> or <Link>
|
|
163
|
+
• "Add a loading spinner" → Just a simple div with animation
|
|
164
|
+
|
|
165
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
166
|
+
💡 THE RULE: If it has multiple elements + needs to look good → snippet_frontend
|
|
167
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
168
|
+
|
|
169
|
+
| Component | Use snippet_frontend? | Why |
|
|
170
|
+
|------------------------------|----------------------|----------------------------|
|
|
171
|
+
| Search dropdown with results | ✅ YES | Multiple elements, design |
|
|
172
|
+
| Sidebar with nav items | ✅ YES | Multiple elements, design |
|
|
173
|
+
| Modal with form | ✅ YES | Multiple elements, design |
|
|
174
|
+
| Card grid | ✅ YES | Multiple elements, design |
|
|
175
|
+
| Data table | ✅ YES | Multiple elements, design |
|
|
176
|
+
| Single button | ❌ NO | Too simple |
|
|
177
|
+
| Single input | ❌ NO | Too simple |
|
|
178
|
+
| Loading spinner | ❌ NO | Too simple |
|
|
201
179
|
|
|
202
180
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
203
181
|
⚠️ REQUIRED: INSERTION CONTEXT
|
|
204
182
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
205
183
|
|
|
206
|
-
|
|
184
|
+
Tell Gemini WHERE and HOW to match the design:
|
|
207
185
|
|
|
208
|
-
Good
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
Existing components use rounded-xl, p-6 padding, shadow-lg.
|
|
212
|
-
State managed with useState."
|
|
186
|
+
Good: "After the header in Dashboard. Dark theme (bg-zinc-900),
|
|
187
|
+
rounded-xl corners, p-6 padding. The dropdown should show
|
|
188
|
+
search results with icons and subtitles."
|
|
213
189
|
|
|
214
|
-
Bad
|
|
215
|
-
"In the dashboard"
|
|
190
|
+
Bad: "In the dashboard"
|
|
216
191
|
|
|
217
192
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
218
193
|
📤 OUTPUT FORMAT
|
|
219
194
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
220
195
|
|
|
221
|
-
Returns snippet with optional new imports:
|
|
222
|
-
|
|
223
196
|
// NEW IMPORTS NEEDED:
|
|
224
|
-
import {
|
|
197
|
+
import { Search } from "lucide-react";
|
|
225
198
|
|
|
226
199
|
// SNIPPET:
|
|
227
|
-
<
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
-
|
|
200
|
+
<div className="relative">
|
|
201
|
+
<Search className="absolute left-3 top-1/2 -translate-y-1/2 text-zinc-400" />
|
|
202
|
+
<input
|
|
203
|
+
value={searchQuery}
|
|
204
|
+
onChange={(e) => setSearchQuery(e.target.value)}
|
|
205
|
+
className="w-full pl-10 pr-4 py-2 bg-zinc-800 rounded-xl ..."
|
|
206
|
+
/>
|
|
207
|
+
{showDropdown && (
|
|
208
|
+
<div className="absolute top-full mt-2 w-full bg-zinc-800 rounded-xl shadow-2xl ...">
|
|
209
|
+
{/* Premium designed dropdown content */}
|
|
210
|
+
</div>
|
|
211
|
+
)}
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
You (Claude) are responsible for:
|
|
215
|
+
- Adding the logic (useState, handlers) BEFORE calling this tool
|
|
216
|
+
- Merging new imports
|
|
233
217
|
- Inserting the snippet at the correct location`, snippetFrontendSchema, snippetFrontend);
|
|
234
218
|
// =============================================================================
|
|
235
219
|
// START SERVER
|
|
@@ -237,7 +221,7 @@ You are responsible for:
|
|
|
237
221
|
async function main() {
|
|
238
222
|
const transport = new StdioServerTransport();
|
|
239
223
|
await server.connect(transport);
|
|
240
|
-
console.error("gemini-design-mcp v3.0
|
|
224
|
+
console.error("gemini-design-mcp v3.2.0 running on stdio");
|
|
241
225
|
}
|
|
242
226
|
main().catch((error) => {
|
|
243
227
|
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
|
};
|