gemini-design-mcp 3.12.3 → 3.12.5
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/tools/create-frontend.d.ts +4 -45
- package/build/tools/create-frontend.js +22 -96
- package/build/tools/modify-frontend.d.ts +4 -7
- package/build/tools/modify-frontend.js +25 -40
- package/build/tools/snippet-frontend.d.ts +4 -11
- package/build/tools/snippet-frontend.js +27 -43
- package/package.json +1 -1
|
@@ -1,56 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { type Scale } from "../lib/scale.js";
|
|
3
2
|
export declare const createFrontendSchema: {
|
|
4
3
|
request: z.ZodString;
|
|
5
4
|
techStack: z.ZodString;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
vibe: z.ZodObject<{
|
|
9
|
-
name: z.ZodString;
|
|
10
|
-
description: z.ZodString;
|
|
11
|
-
scale: z.ZodEnum<["refined", "balanced", "zoomed"]>;
|
|
12
|
-
keywords: z.ZodArray<z.ZodString, "many">;
|
|
13
|
-
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
name: string;
|
|
15
|
-
description: string;
|
|
16
|
-
scale: "refined" | "balanced" | "zoomed";
|
|
17
|
-
keywords: string[];
|
|
18
|
-
}, {
|
|
19
|
-
name: string;
|
|
20
|
-
description: string;
|
|
21
|
-
scale: "refined" | "balanced" | "zoomed";
|
|
22
|
-
keywords: string[];
|
|
23
|
-
}>;
|
|
24
|
-
}, "strip", z.ZodTypeAny, {
|
|
25
|
-
vibe: {
|
|
26
|
-
name: string;
|
|
27
|
-
description: string;
|
|
28
|
-
scale: "refined" | "balanced" | "zoomed";
|
|
29
|
-
keywords: string[];
|
|
30
|
-
};
|
|
31
|
-
}, {
|
|
32
|
-
vibe: {
|
|
33
|
-
name: string;
|
|
34
|
-
description: string;
|
|
35
|
-
scale: "refined" | "balanced" | "zoomed";
|
|
36
|
-
keywords: string[];
|
|
37
|
-
};
|
|
38
|
-
}>>;
|
|
39
|
-
writeFile: z.ZodDefault<z.ZodBoolean>;
|
|
5
|
+
designSystem: z.ZodString;
|
|
6
|
+
context: z.ZodString;
|
|
40
7
|
};
|
|
41
8
|
export declare function createFrontend(params: {
|
|
42
9
|
request: string;
|
|
43
10
|
techStack: string;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
vibe: {
|
|
47
|
-
name: string;
|
|
48
|
-
description: string;
|
|
49
|
-
scale: Scale;
|
|
50
|
-
keywords: string[];
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
writeFile?: boolean;
|
|
11
|
+
designSystem: string;
|
|
12
|
+
context: string;
|
|
54
13
|
}): Promise<{
|
|
55
14
|
content: {
|
|
56
15
|
type: "text";
|
|
@@ -1,125 +1,51 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { generateWithGemini } from "../lib/gemini.js";
|
|
3
|
-
import { CREATE_FRONTEND_PROMPT,
|
|
4
|
-
import { stripCodeFences
|
|
5
|
-
import { scaleSchema, scaleDescriptions } from "../lib/scale.js";
|
|
3
|
+
import { CREATE_FRONTEND_PROMPT, DESIGN_SYSTEM_USAGE_INSTRUCTIONS } from "../prompts/system.js";
|
|
4
|
+
import { stripCodeFences } from "../lib/filesystem.js";
|
|
6
5
|
export const createFrontendSchema = {
|
|
7
6
|
request: z.string().describe("What to create: describe the page, component, or section. " +
|
|
8
7
|
"Be specific about functionality and content. " +
|
|
9
8
|
"Example: 'A pricing page with 3 tiers (Basic, Pro, Enterprise) with feature comparison table'"),
|
|
10
9
|
techStack: z.string().describe("The tech stack to use. Be specific. " +
|
|
11
10
|
"Examples: 'React + TypeScript + Tailwind CSS', 'Next.js 14 App Router + shadcn/ui', 'Vue 3 + Composition API + CSS Modules'"),
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
scale: scaleSchema.describe("Scale: 'refined' (small, elegant), 'balanced' (standard), 'zoomed' (large elements)"),
|
|
21
|
-
keywords: z.array(z.string()).describe("Style keywords (e.g., ['minimal', 'whitespace', 'gallery'])"),
|
|
22
|
-
}).describe("The selected design vibe"),
|
|
23
|
-
}).optional().describe("Design system with selected vibe. REQUIRED for new projects without existing design. " +
|
|
24
|
-
"Call generate_vibes first, user selects, then pass the selection here."),
|
|
25
|
-
generateDesignSystem: z.boolean().optional().describe(
|
|
26
|
-
"Si true, Gemini génère aussi un design system complet en plus du code. " +
|
|
27
|
-
"Activer UNIQUEMENT pour la PREMIÈRE page du projet. " +
|
|
28
|
-
"Le design system sera retourné séparément pour être sauvegardé dans design-system.md"
|
|
29
|
-
),
|
|
30
|
-
projectRoot: z.string().optional().describe(
|
|
31
|
-
"Root directory du projet. Utilisé pour auto-charger design-system.md s'il existe. " +
|
|
32
|
-
"TOUJOURS passer ce paramètre pour que Gemini utilise le design system existant."
|
|
33
|
-
),
|
|
11
|
+
designSystem: z.string().describe("REQUIRED: Copy-paste the ENTIRE content of design-system.md here. " +
|
|
12
|
+
"This contains ALL visual/design information: colors, typography, spacing, components styling, etc. " +
|
|
13
|
+
"Do NOT summarize - paste the FULL file content as-is."),
|
|
14
|
+
context: z.string().describe("REQUIRED: Functional/business context for what you're creating. " +
|
|
15
|
+
"What is the PURPOSE of this page/component? What should it DO? " +
|
|
16
|
+
"Include: user flow, features needed, data it displays, actions it performs, " +
|
|
17
|
+
"how it fits in the app, business requirements. " +
|
|
18
|
+
"Do NOT include design/styling info here - that goes in designSystem."),
|
|
34
19
|
};
|
|
35
20
|
export async function createFrontend(params) {
|
|
36
|
-
const { request, techStack,
|
|
21
|
+
const { request, techStack, designSystem, context } = params;
|
|
37
22
|
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
const systemPrompt = `${CREATE_FRONTEND_PROMPT}
|
|
24
|
+
${DESIGN_SYSTEM_USAGE_INSTRUCTIONS}
|
|
40
25
|
|
|
41
|
-
|
|
42
|
-
let designSystemInstructions = '';
|
|
43
|
-
if (designSystem?.vibe) {
|
|
44
|
-
const { vibe } = designSystem;
|
|
45
|
-
const scale = vibe.scale || "balanced";
|
|
46
|
-
designSystemInstructions = `
|
|
47
|
-
MANDATORY DESIGN SYSTEM (User Selected Vibe):
|
|
26
|
+
## DESIGN SYSTEM (COPY EXACTLY - ALL CODE):
|
|
48
27
|
|
|
49
|
-
|
|
50
|
-
${vibe.description}
|
|
28
|
+
${designSystem}
|
|
51
29
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
Keywords: ${vibe.keywords.join(', ')}
|
|
55
|
-
|
|
56
|
-
Interpret this vibe creatively — choose colors, typography, and styling that embody this atmosphere.
|
|
57
|
-
The scale above is MANDATORY and defines how large or small UI elements should be.
|
|
58
|
-
`;
|
|
59
|
-
}
|
|
60
|
-
// Build context instructions - prioritize auto-loaded design system
|
|
61
|
-
let contextInstructions = '';
|
|
62
|
-
let designSystemRules = '';
|
|
63
|
-
|
|
64
|
-
if (autoDesignSystem) {
|
|
65
|
-
contextInstructions = `
|
|
66
|
-
## DESIGN SYSTEM COMPLET (COPIER EXACTEMENT - TOUT LE CODE):
|
|
30
|
+
---
|
|
67
31
|
|
|
68
|
-
|
|
32
|
+
## FUNCTIONAL CONTEXT (what it should DO):
|
|
69
33
|
|
|
70
|
-
---
|
|
71
|
-
RÈGLE CRITIQUE: Copier EXACTEMENT les classes Tailwind, couleurs, spacing, border-radius du code ci-dessus.
|
|
72
|
-
NE JAMAIS inventer de nouvelles valeurs. Le nouveau composant doit ressembler EXACTEMENT au design system.
|
|
73
|
-
`;
|
|
74
|
-
designSystemRules = DESIGN_SYSTEM_USAGE_INSTRUCTIONS;
|
|
75
|
-
} else if (context && context !== "null" && context.trim() !== "") {
|
|
76
|
-
contextInstructions = `
|
|
77
|
-
EXISTING PROJECT CONTEXT (match this design system):
|
|
78
34
|
${context}
|
|
79
35
|
|
|
80
|
-
IMPORTANT: Analyze the existing code carefully and match:
|
|
81
|
-
- Color palette and theme
|
|
82
|
-
- Typography and font choices
|
|
83
|
-
- Component patterns and naming conventions
|
|
84
|
-
- Spacing and layout rhythms
|
|
85
|
-
- Import patterns and file structure
|
|
86
|
-
`;
|
|
87
|
-
}
|
|
88
|
-
// Build the system prompt - design system generation instructions go FIRST if enabled
|
|
89
|
-
let systemPrompt;
|
|
90
|
-
if (generateDesignSystem) {
|
|
91
|
-
systemPrompt = `${DESIGN_SYSTEM_GENERATION_PROMPT}
|
|
92
|
-
|
|
93
36
|
---
|
|
94
37
|
|
|
95
|
-
${CREATE_FRONTEND_PROMPT}
|
|
96
|
-
${designSystemInstructions}
|
|
97
|
-
${contextInstructions}
|
|
98
38
|
TECH STACK: ${techStack}
|
|
99
39
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
${designSystemInstructions}
|
|
105
|
-
${contextInstructions}
|
|
106
|
-
TECH STACK: ${techStack}
|
|
40
|
+
CRITICAL RULES:
|
|
41
|
+
- Copy EXACTLY the Tailwind classes, colors, spacing, border-radius from the design system above.
|
|
42
|
+
- NEVER invent new values. The new component must look EXACTLY like the design system.
|
|
43
|
+
- Implement the functional requirements from the context above.
|
|
107
44
|
|
|
108
45
|
Remember: Return a COMPLETE, functional file ready to use.`.trim();
|
|
109
|
-
|
|
46
|
+
|
|
110
47
|
const rawResult = await generateWithGemini(systemPrompt, request, undefined, "high", "create_frontend");
|
|
111
|
-
// Handle design system generation mode
|
|
112
|
-
if (generateDesignSystem) {
|
|
113
|
-
const parsed = parseGeminiResponseWithDesignSystem(rawResult);
|
|
114
|
-
const code = stripCodeFences(parsed.code);
|
|
115
|
-
return {
|
|
116
|
-
content: [{ type: "text", text: code }],
|
|
117
|
-
designSystem: parsed.designSystem,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
// Strip markdown code fences from the result
|
|
121
48
|
const result = stripCodeFences(rawResult);
|
|
122
|
-
// Return the code for the agent to write
|
|
123
49
|
return {
|
|
124
50
|
content: [{ type: "text", text: result }],
|
|
125
51
|
};
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { type Scale } from "../lib/scale.js";
|
|
3
2
|
export declare const modifyFrontendSchema: {
|
|
4
3
|
modification: z.ZodString;
|
|
5
4
|
targetCode: z.ZodString;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
writeFile: z.ZodDefault<z.ZodBoolean>;
|
|
5
|
+
designSystem: z.ZodString;
|
|
6
|
+
context: z.ZodString;
|
|
9
7
|
};
|
|
10
8
|
export declare function modifyFrontend(params: {
|
|
11
9
|
modification: string;
|
|
12
10
|
targetCode: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
writeFile?: boolean;
|
|
11
|
+
designSystem: string;
|
|
12
|
+
context: string;
|
|
16
13
|
}): Promise<{
|
|
17
14
|
content: {
|
|
18
15
|
type: "text";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { generateWithGemini } from "../lib/gemini.js";
|
|
3
3
|
import { MODIFY_FRONTEND_PROMPT, DESIGN_SYSTEM_USAGE_INSTRUCTIONS } from "../prompts/system.js";
|
|
4
|
-
import { scaleSchema, getScaleInstructions } from "../lib/scale.js";
|
|
5
|
-
import { loadDesignSystemIfExists } from "../lib/filesystem.js";
|
|
6
4
|
export const modifyFrontendSchema = {
|
|
7
5
|
modification: z.string().describe("The SINGLE design modification to make. Be specific. " +
|
|
8
6
|
"Examples: " +
|
|
@@ -12,51 +10,33 @@ export const modifyFrontendSchema = {
|
|
|
12
10
|
targetCode: z.string().describe("The specific code section to modify (NOT the full file). " +
|
|
13
11
|
"Pass only the relevant component/element that needs redesigning. " +
|
|
14
12
|
"This helps Gemini focus on exactly what to change."),
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
"
|
|
13
|
+
designSystem: z.string().describe("REQUIRED: Copy-paste the ENTIRE content of design-system.md here. " +
|
|
14
|
+
"This contains ALL visual/design information: colors, typography, spacing, components styling, etc. " +
|
|
15
|
+
"Do NOT summarize - paste the FULL file content as-is."),
|
|
16
|
+
context: z.string().describe("REQUIRED: Functional context for the modification. " +
|
|
17
|
+
"WHY are you making this change? What is the PURPOSE? " +
|
|
18
|
+
"Include: what the component should do after modification, user flow changes, " +
|
|
19
|
+
"new features or behaviors expected, business requirements. " +
|
|
20
|
+
"Do NOT include design/styling info here - that goes in designSystem."),
|
|
23
21
|
};
|
|
24
22
|
export async function modifyFrontend(params) {
|
|
25
|
-
const { modification, targetCode,
|
|
26
|
-
// Auto-load design system if exists
|
|
27
|
-
const autoDesignSystem = loadDesignSystemIfExists(projectRoot);
|
|
28
|
-
// Build context instructions with design system merged
|
|
29
|
-
let contextInstructions = '';
|
|
30
|
-
if (autoDesignSystem) {
|
|
31
|
-
contextInstructions = `
|
|
32
|
-
## DESIGN SYSTEM COMPLET (COPIER EXACTEMENT - NE RIEN MODIFIER):
|
|
23
|
+
const { modification, targetCode, designSystem, context } = params;
|
|
33
24
|
|
|
34
|
-
|
|
25
|
+
const systemPrompt = `${MODIFY_FRONTEND_PROMPT}
|
|
26
|
+
${DESIGN_SYSTEM_USAGE_INSTRUCTIONS}
|
|
27
|
+
|
|
28
|
+
## DESIGN SYSTEM (COPY EXACTLY - ALL CODE):
|
|
29
|
+
|
|
30
|
+
${designSystem}
|
|
35
31
|
|
|
36
32
|
---
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
- Copier EXACTEMENT les classes Tailwind du design system ci-dessus
|
|
40
|
-
- NE JAMAIS inventer de nouvelles couleurs, paddings, ou border-radius
|
|
41
|
-
- Utiliser les mêmes patterns visuels (shadows, transitions, etc.)
|
|
42
|
-
- Le code modifié doit être INDISTINGUABLE du reste du projet
|
|
34
|
+
## FUNCTIONAL CONTEXT (why this modification):
|
|
43
35
|
|
|
44
|
-
`;
|
|
45
|
-
}
|
|
46
|
-
if (context) {
|
|
47
|
-
contextInstructions += `
|
|
48
|
-
DESIGN CONTEXT:
|
|
49
36
|
${context}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const scaleInstructions = getScaleInstructions(scale);
|
|
54
|
-
// Add design system usage instructions if design system was loaded
|
|
55
|
-
const designSystemRules = autoDesignSystem ? DESIGN_SYSTEM_USAGE_INSTRUCTIONS : '';
|
|
56
|
-
const systemPrompt = `${MODIFY_FRONTEND_PROMPT}
|
|
57
|
-
${designSystemRules}
|
|
58
|
-
${scaleInstructions}
|
|
59
|
-
${contextInstructions}
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
60
40
|
CODE TO MODIFY:
|
|
61
41
|
\`\`\`
|
|
62
42
|
${targetCode}
|
|
@@ -64,9 +44,14 @@ ${targetCode}
|
|
|
64
44
|
|
|
65
45
|
MODIFICATION REQUESTED: ${modification}
|
|
66
46
|
|
|
47
|
+
CRITICAL RULES:
|
|
48
|
+
- Copy EXACTLY the Tailwind classes, colors, spacing, border-radius from the design system above.
|
|
49
|
+
- NEVER invent new values. The modified code must look EXACTLY like the design system.
|
|
50
|
+
- Implement the functional requirements from the context above.
|
|
51
|
+
|
|
67
52
|
Remember: Return ONLY the find/replace block. ONE modification, surgical precision.`.trim();
|
|
53
|
+
|
|
68
54
|
const result = await generateWithGemini(systemPrompt, modification, undefined, "high", "modify_frontend");
|
|
69
|
-
// Return the find/replace instructions for the agent to apply
|
|
70
55
|
return {
|
|
71
56
|
content: [{ type: "text", text: result }],
|
|
72
57
|
};
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { type Scale } from "../lib/scale.js";
|
|
3
2
|
export declare const snippetFrontendSchema: {
|
|
4
3
|
request: z.ZodString;
|
|
5
4
|
techStack: z.ZodString;
|
|
5
|
+
designSystem: z.ZodString;
|
|
6
|
+
context: z.ZodString;
|
|
6
7
|
insertionContext: z.ZodString;
|
|
7
|
-
context: z.ZodOptional<z.ZodString>;
|
|
8
|
-
scale: z.ZodOptional<z.ZodEnum<["refined", "balanced", "zoomed"]>>;
|
|
9
|
-
writeFile: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
-
insertAtLine: z.ZodOptional<z.ZodNumber>;
|
|
11
|
-
insertAfterPattern: z.ZodOptional<z.ZodString>;
|
|
12
8
|
};
|
|
13
9
|
export declare function snippetFrontend(params: {
|
|
14
10
|
request: string;
|
|
15
11
|
techStack: string;
|
|
12
|
+
designSystem: string;
|
|
13
|
+
context: string;
|
|
16
14
|
insertionContext: string;
|
|
17
|
-
context?: string;
|
|
18
|
-
scale?: Scale;
|
|
19
|
-
writeFile?: boolean;
|
|
20
|
-
insertAtLine?: number;
|
|
21
|
-
insertAfterPattern?: string;
|
|
22
15
|
}): Promise<{
|
|
23
16
|
content: {
|
|
24
17
|
type: "text";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { generateWithGemini } from "../lib/gemini.js";
|
|
3
3
|
import { SNIPPET_FRONTEND_PROMPT, DESIGN_SYSTEM_USAGE_INSTRUCTIONS } from "../prompts/system.js";
|
|
4
|
-
import { scaleSchema, getScaleInstructions } from "../lib/scale.js";
|
|
5
|
-
import { loadDesignSystemIfExists } from "../lib/filesystem.js";
|
|
6
4
|
export const snippetFrontendSchema = {
|
|
7
5
|
request: z.string().describe("What code snippet to generate. Be specific about what you need. " +
|
|
8
6
|
"Examples: " +
|
|
@@ -12,62 +10,48 @@ export const snippetFrontendSchema = {
|
|
|
12
10
|
"'A custom hook for handling API requests with loading/error states'"),
|
|
13
11
|
techStack: z.string().describe("The tech stack being used. " +
|
|
14
12
|
"Examples: 'React + TypeScript + Tailwind CSS', 'Vue 3 + Composition API'"),
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"Include:
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"If not provided, uses current working directory."),
|
|
13
|
+
designSystem: z.string().describe("REQUIRED: Copy-paste the ENTIRE content of design-system.md here. " +
|
|
14
|
+
"This contains ALL visual/design information: colors, typography, spacing, components styling, etc. " +
|
|
15
|
+
"Do NOT summarize - paste the FULL file content as-is."),
|
|
16
|
+
context: z.string().describe("REQUIRED: Functional context for this snippet. " +
|
|
17
|
+
"What is the PURPOSE of this snippet? What should it DO? " +
|
|
18
|
+
"Include: its role in the app, what data it handles, what actions it performs, " +
|
|
19
|
+
"how it interacts with other parts of the app, business requirements. " +
|
|
20
|
+
"Do NOT include design/styling info here - that goes in designSystem."),
|
|
21
|
+
insertionContext: z.string().describe("WHERE in the file this snippet will go. " +
|
|
22
|
+
"Example: 'Inside the Dashboard component, after the header section.'"),
|
|
26
23
|
};
|
|
27
24
|
export async function snippetFrontend(params) {
|
|
28
|
-
const { request, techStack,
|
|
29
|
-
// Auto-load design system if exists
|
|
30
|
-
const autoDesignSystem = loadDesignSystemIfExists(projectRoot);
|
|
31
|
-
// Build context instructions with design system merged
|
|
32
|
-
let contextInstructions = '';
|
|
33
|
-
if (autoDesignSystem) {
|
|
34
|
-
contextInstructions = `
|
|
35
|
-
## DESIGN SYSTEM COMPLET (COPIER EXACTEMENT - NE RIEN MODIFIER):
|
|
25
|
+
const { request, techStack, designSystem, context, insertionContext } = params;
|
|
36
26
|
|
|
37
|
-
|
|
27
|
+
const systemPrompt = `${SNIPPET_FRONTEND_PROMPT}
|
|
28
|
+
${DESIGN_SYSTEM_USAGE_INSTRUCTIONS}
|
|
29
|
+
|
|
30
|
+
## DESIGN SYSTEM (COPY EXACTLY - ALL CODE):
|
|
31
|
+
|
|
32
|
+
${designSystem}
|
|
38
33
|
|
|
39
34
|
---
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
- Copier EXACTEMENT les classes Tailwind du design system ci-dessus
|
|
43
|
-
- NE JAMAIS inventer de nouvelles couleurs, paddings, ou border-radius
|
|
44
|
-
- Utiliser les mêmes patterns visuels (shadows, transitions, etc.)
|
|
45
|
-
- Le snippet doit être INDISTINGUABLE du reste du projet
|
|
36
|
+
## FUNCTIONAL CONTEXT (what this snippet should DO):
|
|
46
37
|
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
if (context) {
|
|
50
|
-
contextInstructions += `
|
|
51
|
-
PROJECT CONTEXT (match these patterns):
|
|
52
38
|
${context}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const scaleInstructions = getScaleInstructions(scale);
|
|
57
|
-
// Add design system usage instructions if design system was loaded
|
|
58
|
-
const designSystemRules = autoDesignSystem ? DESIGN_SYSTEM_USAGE_INSTRUCTIONS : '';
|
|
59
|
-
const systemPrompt = `${SNIPPET_FRONTEND_PROMPT}
|
|
60
|
-
${designSystemRules}
|
|
61
|
-
${scaleInstructions}
|
|
62
|
-
${contextInstructions}
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
63
42
|
TECH STACK: ${techStack}
|
|
64
43
|
|
|
65
44
|
INSERTION CONTEXT:
|
|
66
45
|
${insertionContext}
|
|
67
46
|
|
|
47
|
+
CRITICAL RULES:
|
|
48
|
+
- Copy EXACTLY the Tailwind classes, colors, spacing, border-radius from the design system above.
|
|
49
|
+
- NEVER invent new values. The snippet must look EXACTLY like the design system.
|
|
50
|
+
- Implement the functional requirements from the context above.
|
|
51
|
+
|
|
68
52
|
Generate a snippet that will integrate smoothly at this location.`.trim();
|
|
53
|
+
|
|
69
54
|
const result = await generateWithGemini(systemPrompt, request, undefined, "high", "snippet_frontend");
|
|
70
|
-
// Return the snippet for the agent to insert
|
|
71
55
|
return {
|
|
72
56
|
content: [{ type: "text", text: result }],
|
|
73
57
|
};
|