gemini-design-mcp 1.0.5 → 2.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 +75 -33
- package/build/prompts/system.d.ts +1 -4
- package/build/prompts/system.js +47 -58
- package/build/tools/generate-frontend.d.ts +34 -0
- package/build/tools/generate-frontend.js +28 -2
- package/package.json +1 -1
- package/build/tools/improve-frontend.d.ts +0 -16
- package/build/tools/improve-frontend.js +0 -21
- package/build/tools/patch-frontend.d.ts +0 -18
- package/build/tools/patch-frontend.js +0 -28
- package/build/tools/suggest-design.d.ts +0 -14
- package/build/tools/suggest-design.js +0 -17
package/build/index.js
CHANGED
|
@@ -2,47 +2,89 @@
|
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { generateFrontendSchema, generateFrontend } from "./tools/generate-frontend.js";
|
|
5
|
-
import { improveFrontendSchema, improveFrontend } from "./tools/improve-frontend.js";
|
|
6
|
-
import { suggestDesignSchema, suggestDesign } from "./tools/suggest-design.js";
|
|
7
|
-
import { patchFrontendSchema, patchFrontend } from "./tools/patch-frontend.js";
|
|
8
5
|
// Create MCP server
|
|
9
6
|
const server = new McpServer({
|
|
10
7
|
name: "gemini-design-mcp",
|
|
11
|
-
version: "
|
|
8
|
+
version: "2.0.0",
|
|
12
9
|
});
|
|
13
|
-
// Tool
|
|
14
|
-
server.tool("generate_frontend", `Generate frontend code
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
10
|
+
// Tool: generate_frontend
|
|
11
|
+
server.tool("generate_frontend", `Generate premium, production-ready frontend code with Gemini's 1M context window.
|
|
12
|
+
|
|
13
|
+
⚠️ CRITICAL: DO NOT call this tool immediately. Follow this flow STRICTLY:
|
|
14
|
+
|
|
15
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
16
|
+
STEP 1: CHECK PROJECT STATE (before ANY tool call)
|
|
17
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
18
|
+
|
|
19
|
+
A) EMPTY REPO (no package.json, no framework installed):
|
|
20
|
+
→ DO NOT call this tool
|
|
21
|
+
→ Ask user: "What tech stack do you want? (Next.js, React + Vite, Vue, etc.)"
|
|
22
|
+
→ Wait for user to initialize the project first
|
|
23
|
+
→ Only proceed after project is set up
|
|
24
|
+
|
|
25
|
+
B) PROJECT INITIALIZED but NO existing pages/components/design:
|
|
26
|
+
→ DO NOT call this tool yet
|
|
27
|
+
→ MANDATORY: Run vibe selection questionnaire first (see Step 2)
|
|
28
|
+
|
|
29
|
+
C) PROJECT WITH EXISTING CODE:
|
|
30
|
+
→ First, analyze the codebase to understand:
|
|
31
|
+
• Tech stack (React? Vue? Next.js? Tailwind? CSS Modules?)
|
|
32
|
+
• Project structure (where to put pages/components)
|
|
33
|
+
• Existing design patterns (colors, spacing, component style)
|
|
34
|
+
→ Then pass relevant files as context parameter
|
|
35
|
+
|
|
36
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
37
|
+
STEP 2: VIBE SELECTION (required for new designs)
|
|
38
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
39
|
+
|
|
40
|
+
If the project has no existing design system, you MUST:
|
|
41
|
+
|
|
42
|
+
1. Generate 5 vibe options with RICH, EVOCATIVE descriptions (2-3 sentences each).
|
|
43
|
+
Each vibe should paint a vivid picture of the aesthetic. Examples:
|
|
44
|
+
|
|
45
|
+
• 🏛️ "Pristine Museum" - An ultra-clean, 'white-cube' aesthetic focused on
|
|
46
|
+
vast negative space and absolute stillness. The focus is entirely on the
|
|
47
|
+
content as if it were hanging in a modern gallery. Minimal chrome,
|
|
48
|
+
maximum breathing room.
|
|
49
|
+
|
|
50
|
+
• ⚡ "Technical Precision" - A layout-driven vibe that emphasizes the grid.
|
|
51
|
+
It feels intentional, structured, and slightly 'under construction' in a
|
|
52
|
+
cool, architectural way. Sharp edges, monospace accents, blueprint energy.
|
|
53
|
+
|
|
54
|
+
• 🌊 "Fluid & Organic" - Soft curves, flowing gradients, and a sense of
|
|
55
|
+
natural movement. Like water or silk, everything feels smooth and
|
|
56
|
+
interconnected. Calming yet sophisticated.
|
|
57
|
+
|
|
58
|
+
• 🔥 "Bold & Unapologetic" - High contrast, oversized typography, and
|
|
59
|
+
dramatic color blocks. It demands attention and makes a statement.
|
|
60
|
+
Not for the faint of heart.
|
|
61
|
+
|
|
62
|
+
• 🌙 "Dark Luxe" - Deep, rich darks with subtle metallic or jewel-tone
|
|
63
|
+
accents. Premium feel, like a high-end app at night. Sophisticated
|
|
64
|
+
shadows and glowing highlights.
|
|
65
|
+
|
|
66
|
+
2. Present the 5 vibes to the user and wait for their selection
|
|
67
|
+
|
|
68
|
+
3. Only THEN call this tool with the designSystem.vibe parameter filled
|
|
69
|
+
(Gemini will choose the best font to match the vibe automatically)
|
|
70
|
+
|
|
71
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
72
|
+
STEP 3: CALL THIS TOOL
|
|
73
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
74
|
+
|
|
75
|
+
Only after completing the above steps:
|
|
76
|
+
- New project: context=null, designSystem={vibe}, techStack specified
|
|
77
|
+
- Existing project: context=<relevant files>, techStack from analysis
|
|
78
|
+
|
|
79
|
+
CAPABILITIES:
|
|
80
|
+
- Creates visually stunning, feature-rich interfaces (not wireframes)
|
|
81
|
+
- Supports any tech stack: React, Vue, Svelte, HTML/CSS, Next.js, etc.
|
|
82
|
+
- Maintains design consistency when given project context`, generateFrontendSchema, generateFrontend);
|
|
41
83
|
// Start server
|
|
42
84
|
async function main() {
|
|
43
85
|
const transport = new StdioServerTransport();
|
|
44
86
|
await server.connect(transport);
|
|
45
|
-
console.error("gemini-design-mcp
|
|
87
|
+
console.error("gemini-design-mcp v2.0.0 running on stdio");
|
|
46
88
|
}
|
|
47
89
|
main().catch((error) => {
|
|
48
90
|
console.error("Fatal error:", error);
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
export declare const GENERATE_FRONTEND_PROMPT = "You are an
|
|
2
|
-
export declare const IMPROVE_FRONTEND_PROMPT = "You are an expert UI/UX designer and frontend developer.\nYou improve existing frontend code based on the feedback provided.\n\nRULES:\n1. Keep the general structure unless asked otherwise\n2. Only improve the aspects mentioned in the feedback\n3. Maintain consistency with the rest of the code\n4. Return the COMPLETE improved code, not just the changes\n5. No explanations, just the code";
|
|
3
|
-
export declare const SUGGEST_DESIGN_PROMPT = "You are an expert UI/UX designer.\nYou provide concise and actionable design suggestions.\n\nRULES:\n1. Short and precise suggestions\n2. Focus on visual impact and UX\n3. Propose 3-5 ideas maximum\n4. Format: bullet points\n5. No code, just ideas";
|
|
4
|
-
export declare const PATCH_FRONTEND_PROMPT = "You are an expert developer.\nYou return ONLY JSON patches to modify code. NEVER return full code.\n\nYou receive:\n- A file structure overview (to understand context)\n- A target section (the actual code to modify)\n- A list of modifications to apply\n\nOUTPUT FORMAT (strict JSON, no markdown fences):\n{\n \"patches\": [\n {\n \"operation\": \"insert_after | insert_before | replace | delete\",\n \"find\": \"exact unique text/code snippet to locate in target section\",\n \"content\": \"new code to insert or replace with (omit for delete)\"\n }\n ]\n}\n\nRULES:\n1. NEVER return full code, ONLY the JSON patches object\n2. \"find\" MUST be an exact string that exists in the target section (copy-paste precision)\n3. \"find\" MUST be unique within the target section - use enough context to ensure uniqueness\n4. Keep patches minimal - only what's needed for each modification\n5. Preserve original indentation and code style\n6. For multi-line \"find\" or \"content\", use \\n for newlines in JSON\n7. Operations:\n - \"insert_after\": insert content after the found text\n - \"insert_before\": insert content before the found text\n - \"replace\": replace the found text with content\n - \"delete\": remove the found text (no content needed)\n8. Return ONLY valid JSON, no explanations, no markdown";
|
|
1
|
+
export declare const GENERATE_FRONTEND_PROMPT = "You are an elite UI/UX Designer creating production-ready, visually stunning interfaces.\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\nTECHNICAL RULES:\n- Return COMPLETE, functional code - never use \"// TODO\", \"...\", or placeholders\n- If CONTEXT is provided, match its design language and component patterns\n- If no context, you have full creative freedom but MUST achieve premium quality\n- Respect the specified tech stack exactly\n- Return ONLY the code, no explanations or markdown fences";
|
package/build/prompts/system.js
CHANGED
|
@@ -1,58 +1,47 @@
|
|
|
1
|
-
export const GENERATE_FRONTEND_PROMPT = `You are an
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
2. "find" MUST be an exact string that exists in the target section (copy-paste precision)
|
|
49
|
-
3. "find" MUST be unique within the target section - use enough context to ensure uniqueness
|
|
50
|
-
4. Keep patches minimal - only what's needed for each modification
|
|
51
|
-
5. Preserve original indentation and code style
|
|
52
|
-
6. For multi-line "find" or "content", use \\n for newlines in JSON
|
|
53
|
-
7. Operations:
|
|
54
|
-
- "insert_after": insert content after the found text
|
|
55
|
-
- "insert_before": insert content before the found text
|
|
56
|
-
- "replace": replace the found text with content
|
|
57
|
-
- "delete": remove the found text (no content needed)
|
|
58
|
-
8. Return ONLY valid JSON, no explanations, no markdown`;
|
|
1
|
+
export const GENERATE_FRONTEND_PROMPT = `You are an elite UI/UX Designer creating production-ready, visually stunning interfaces.
|
|
2
|
+
|
|
3
|
+
DESIGN EXCELLENCE REQUIREMENTS:
|
|
4
|
+
|
|
5
|
+
1. **MAXIMUM DETAIL AND DENSITY**
|
|
6
|
+
- The interface MUST be densely populated and feature-rich
|
|
7
|
+
- NEVER produce simple wireframes, empty containers, or placeholder content
|
|
8
|
+
- Fill the space with intricate details, realistic content, background elements, and meaningful UI components
|
|
9
|
+
- Every section should feel like a fully finished, polished product
|
|
10
|
+
|
|
11
|
+
2. **PREMIUM VISUAL STYLING**
|
|
12
|
+
- Apply high-end design principles throughout
|
|
13
|
+
- Use sophisticated styling: nuanced shadows, subtle gradients, refined borders, micro-textures
|
|
14
|
+
- Add depth and dimension with layered elements
|
|
15
|
+
- The aesthetic MUST feel modern, premium, and visually captivating
|
|
16
|
+
- Use professional color palettes with proper contrast and hierarchy
|
|
17
|
+
|
|
18
|
+
3. **COMPREHENSIVE INTERACTIVITY**
|
|
19
|
+
- Design every element to look tangible and interactive
|
|
20
|
+
- Include visual states: hover effects, focus rings, active states, transitions
|
|
21
|
+
- Buttons should look clickable, inputs should look fillable
|
|
22
|
+
- The interface should feel alive, not static
|
|
23
|
+
|
|
24
|
+
4. **LAYOUT EXCELLENCE**
|
|
25
|
+
- Use proper visual hierarchy with clear focal points
|
|
26
|
+
- Apply consistent spacing rhythm throughout
|
|
27
|
+
- Ensure the layout breathes - balance density with whitespace
|
|
28
|
+
- Full viewport height designs (min-height: 100vh on body)
|
|
29
|
+
- No awkward gaps or orphaned elements
|
|
30
|
+
|
|
31
|
+
5. **RESPONSIVE BY DEFAULT**
|
|
32
|
+
- Designs MUST work flawlessly on mobile and desktop
|
|
33
|
+
- Touch-friendly sizing for interactive elements on mobile
|
|
34
|
+
- Stackable grids that adapt naturally to screen size
|
|
35
|
+
|
|
36
|
+
6. **REALISTIC CONTENT**
|
|
37
|
+
- Use believable placeholder content (real-looking names, dates, numbers)
|
|
38
|
+
- Include appropriate icons, avatars, and imagery
|
|
39
|
+
- Data visualizations should have realistic data points
|
|
40
|
+
- Text should be contextually appropriate, not "Lorem ipsum"
|
|
41
|
+
|
|
42
|
+
TECHNICAL RULES:
|
|
43
|
+
- Return COMPLETE, functional code - never use "// TODO", "...", or placeholders
|
|
44
|
+
- If CONTEXT is provided, match its design language and component patterns
|
|
45
|
+
- If no context, you have full creative freedom but MUST achieve premium quality
|
|
46
|
+
- Respect the specified tech stack exactly
|
|
47
|
+
- Return ONLY the code, no explanations or markdown fences`;
|
|
@@ -3,11 +3,45 @@ export declare const generateFrontendSchema: {
|
|
|
3
3
|
request: z.ZodString;
|
|
4
4
|
context: z.ZodNullable<z.ZodString>;
|
|
5
5
|
techStack: z.ZodOptional<z.ZodString>;
|
|
6
|
+
designSystem: z.ZodOptional<z.ZodObject<{
|
|
7
|
+
vibe: z.ZodObject<{
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
description: z.ZodString;
|
|
10
|
+
keywords: z.ZodArray<z.ZodString, "many">;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
keywords: string[];
|
|
15
|
+
}, {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
keywords: string[];
|
|
19
|
+
}>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
vibe: {
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
keywords: string[];
|
|
25
|
+
};
|
|
26
|
+
}, {
|
|
27
|
+
vibe: {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
keywords: string[];
|
|
31
|
+
};
|
|
32
|
+
}>>;
|
|
6
33
|
};
|
|
7
34
|
export declare function generateFrontend(params: {
|
|
8
35
|
request: string;
|
|
9
36
|
context: string | null;
|
|
10
37
|
techStack?: string;
|
|
38
|
+
designSystem?: {
|
|
39
|
+
vibe: {
|
|
40
|
+
name: string;
|
|
41
|
+
description: string;
|
|
42
|
+
keywords: string[];
|
|
43
|
+
};
|
|
44
|
+
};
|
|
11
45
|
}): Promise<{
|
|
12
46
|
content: {
|
|
13
47
|
type: "text";
|
|
@@ -8,11 +8,37 @@ export const generateFrontendSchema = {
|
|
|
8
8
|
"Null if new project."),
|
|
9
9
|
techStack: z.string().optional().describe("Tech stack (e.g., 'React + Tailwind', 'Vue + CSS', 'HTML/CSS vanilla', 'Next.js + shadcn'). " +
|
|
10
10
|
"If not specified, Gemini will choose based on context."),
|
|
11
|
+
designSystem: z.object({
|
|
12
|
+
vibe: z.object({
|
|
13
|
+
name: z.string().describe("Vibe name (e.g., 'Pristine Museum', 'Dark Luxe')"),
|
|
14
|
+
description: z.string().describe("Rich, evocative description of the mood and aesthetic (2-3 sentences)"),
|
|
15
|
+
keywords: z.array(z.string()).describe("Style keywords (e.g., ['minimal', 'whitespace', 'gallery'])"),
|
|
16
|
+
}).describe("Selected design vibe from the vibe selection step"),
|
|
17
|
+
}).optional().describe("Design system with selected vibe. The calling agent generates vibe options, " +
|
|
18
|
+
"user selects, then pass the selection here. Gemini chooses the best font automatically."),
|
|
11
19
|
};
|
|
12
20
|
export async function generateFrontend(params) {
|
|
13
|
-
const { request, context, techStack } = params;
|
|
14
|
-
|
|
21
|
+
const { request, context, techStack, designSystem } = params;
|
|
22
|
+
// Build design system instructions if provided
|
|
23
|
+
let designSystemInstructions = '';
|
|
24
|
+
if (designSystem?.vibe) {
|
|
25
|
+
const { vibe } = designSystem;
|
|
26
|
+
designSystemInstructions = `
|
|
27
|
+
MANDATORY DESIGN SYSTEM (User Selected Vibe):
|
|
28
|
+
|
|
29
|
+
**Design Vibe: "${vibe.name}"**
|
|
30
|
+
${vibe.description}
|
|
31
|
+
Keywords: ${vibe.keywords.join(', ')}
|
|
15
32
|
|
|
33
|
+
Interpret this vibe creatively:
|
|
34
|
+
- Choose colors, gradients, and visual styling that embody this atmosphere
|
|
35
|
+
- Select a font from Google Fonts that perfectly matches this vibe
|
|
36
|
+
- Apply consistent visual language throughout the entire interface
|
|
37
|
+
- You have freedom in the specific implementation, but the overall feel MUST match this vibe
|
|
38
|
+
`;
|
|
39
|
+
}
|
|
40
|
+
const systemPrompt = `${GENERATE_FRONTEND_PROMPT}
|
|
41
|
+
${designSystemInstructions}
|
|
16
42
|
${techStack ? `TECH STACK: ${techStack}` : ""}`.trim();
|
|
17
43
|
const userPrompt = context
|
|
18
44
|
? `PROJECT CONTEXT (match this style):
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const improveFrontendSchema: {
|
|
3
|
-
code: z.ZodString;
|
|
4
|
-
feedback: z.ZodString;
|
|
5
|
-
context: z.ZodOptional<z.ZodString>;
|
|
6
|
-
};
|
|
7
|
-
export declare function improveFrontend(params: {
|
|
8
|
-
code: string;
|
|
9
|
-
feedback: string;
|
|
10
|
-
context?: string;
|
|
11
|
-
}): Promise<{
|
|
12
|
-
content: {
|
|
13
|
-
type: "text";
|
|
14
|
-
text: string;
|
|
15
|
-
}[];
|
|
16
|
-
}>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { generateWithGemini } from "../lib/gemini.js";
|
|
3
|
-
import { IMPROVE_FRONTEND_PROMPT } from "../prompts/system.js";
|
|
4
|
-
export const improveFrontendSchema = {
|
|
5
|
-
code: z.string().describe("Current frontend code to improve"),
|
|
6
|
-
feedback: z.string().describe("What to improve or change"),
|
|
7
|
-
context: z.string().optional().describe("Additional context (other components for consistency)"),
|
|
8
|
-
};
|
|
9
|
-
export async function improveFrontend(params) {
|
|
10
|
-
const { code, feedback, context } = params;
|
|
11
|
-
const userPrompt = `CURRENT CODE:
|
|
12
|
-
${code}
|
|
13
|
-
|
|
14
|
-
${context ? `CONTEXT:\n${context}\n` : ""}
|
|
15
|
-
FEEDBACK / REQUESTED IMPROVEMENTS:
|
|
16
|
-
${feedback}`;
|
|
17
|
-
const result = await generateWithGemini(IMPROVE_FRONTEND_PROMPT, userPrompt);
|
|
18
|
-
return {
|
|
19
|
-
content: [{ type: "text", text: result }],
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const patchFrontendSchema: {
|
|
3
|
-
file_structure: z.ZodString;
|
|
4
|
-
target_section: z.ZodString;
|
|
5
|
-
modifications: z.ZodArray<z.ZodString, "many">;
|
|
6
|
-
language: z.ZodOptional<z.ZodString>;
|
|
7
|
-
};
|
|
8
|
-
export declare function patchFrontend(params: {
|
|
9
|
-
file_structure: string;
|
|
10
|
-
target_section: string;
|
|
11
|
-
modifications: string[];
|
|
12
|
-
language?: string;
|
|
13
|
-
}): Promise<{
|
|
14
|
-
content: {
|
|
15
|
-
type: "text";
|
|
16
|
-
text: string;
|
|
17
|
-
}[];
|
|
18
|
-
}>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { generateWithGemini } from "../lib/gemini.js";
|
|
3
|
-
import { PATCH_FRONTEND_PROMPT } from "../prompts/system.js";
|
|
4
|
-
export const patchFrontendSchema = {
|
|
5
|
-
file_structure: z.string().describe("Summary of the file structure (e.g., 'lines 1-50: imports, lines 51-100: Header component, lines 101-200: LoginForm')"),
|
|
6
|
-
target_section: z.string().describe("The specific section of code to modify (only the relevant part, not the entire file)"),
|
|
7
|
-
modifications: z.array(z.string()).describe("List of modifications to apply to the target section"),
|
|
8
|
-
language: z.string().optional().describe("Programming language or framework (e.g., 'typescript', 'python', 'c++', 'swift'). Helps Gemini understand syntax."),
|
|
9
|
-
};
|
|
10
|
-
export async function patchFrontend(params) {
|
|
11
|
-
const { file_structure, target_section, modifications, language } = params;
|
|
12
|
-
const langHint = language ? `\nLANGUAGE/FRAMEWORK: ${language}` : "";
|
|
13
|
-
const userPrompt = `FILE STRUCTURE OVERVIEW:
|
|
14
|
-
${file_structure}
|
|
15
|
-
${langHint}
|
|
16
|
-
|
|
17
|
-
TARGET SECTION TO MODIFY:
|
|
18
|
-
\`\`\`
|
|
19
|
-
${target_section}
|
|
20
|
-
\`\`\`
|
|
21
|
-
|
|
22
|
-
MODIFICATIONS REQUESTED:
|
|
23
|
-
${modifications.map((m, i) => `${i + 1}. ${m}`).join("\n")}`;
|
|
24
|
-
const result = await generateWithGemini(PATCH_FRONTEND_PROMPT, userPrompt);
|
|
25
|
-
return {
|
|
26
|
-
content: [{ type: "text", text: result }],
|
|
27
|
-
};
|
|
28
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const suggestDesignSchema: {
|
|
3
|
-
description: z.ZodString;
|
|
4
|
-
currentApproach: z.ZodOptional<z.ZodString>;
|
|
5
|
-
};
|
|
6
|
-
export declare function suggestDesign(params: {
|
|
7
|
-
description: string;
|
|
8
|
-
currentApproach?: string;
|
|
9
|
-
}): Promise<{
|
|
10
|
-
content: {
|
|
11
|
-
type: "text";
|
|
12
|
-
text: string;
|
|
13
|
-
}[];
|
|
14
|
-
}>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { generateWithGemini } from "../lib/gemini.js";
|
|
3
|
-
import { SUGGEST_DESIGN_PROMPT } from "../prompts/system.js";
|
|
4
|
-
export const suggestDesignSchema = {
|
|
5
|
-
description: z.string().describe("Description of the component/page you want suggestions for"),
|
|
6
|
-
currentApproach: z.string().optional().describe("Current approach or constraints to consider"),
|
|
7
|
-
};
|
|
8
|
-
export async function suggestDesign(params) {
|
|
9
|
-
const { description, currentApproach } = params;
|
|
10
|
-
const userPrompt = currentApproach
|
|
11
|
-
? `DESCRIPTION: ${description}\n\nCURRENT APPROACH: ${currentApproach}`
|
|
12
|
-
: description;
|
|
13
|
-
const result = await generateWithGemini(SUGGEST_DESIGN_PROMPT, userPrompt);
|
|
14
|
-
return {
|
|
15
|
-
content: [{ type: "text", text: result }],
|
|
16
|
-
};
|
|
17
|
-
}
|