mycontext-cli 0.4.8 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -97
- package/dist/agents/communication/AgentCommunicationManager.d.ts +27 -0
- package/dist/agents/communication/AgentCommunicationManager.d.ts.map +1 -0
- package/dist/agents/communication/AgentCommunicationManager.js +293 -0
- package/dist/agents/communication/AgentCommunicationManager.js.map +1 -0
- package/dist/agents/evolution/CodeEvolutionEngine.d.ts +92 -0
- package/dist/agents/evolution/CodeEvolutionEngine.d.ts.map +1 -0
- package/dist/agents/evolution/CodeEvolutionEngine.js +639 -0
- package/dist/agents/evolution/CodeEvolutionEngine.js.map +1 -0
- package/dist/agents/implementations/ArchitectAgent.d.ts +39 -0
- package/dist/agents/implementations/ArchitectAgent.d.ts.map +1 -0
- package/dist/agents/implementations/ArchitectAgent.js +345 -0
- package/dist/agents/implementations/ArchitectAgent.js.map +1 -0
- package/dist/agents/implementations/CodeGenSubAgent.d.ts +12 -0
- package/dist/agents/implementations/CodeGenSubAgent.d.ts.map +1 -1
- package/dist/agents/implementations/CodeGenSubAgent.js +296 -43
- package/dist/agents/implementations/CodeGenSubAgent.js.map +1 -1
- package/dist/agents/implementations/PromptConstructorAgent.d.ts +50 -0
- package/dist/agents/implementations/PromptConstructorAgent.d.ts.map +1 -0
- package/dist/agents/implementations/PromptConstructorAgent.js +481 -0
- package/dist/agents/implementations/PromptConstructorAgent.js.map +1 -0
- package/dist/agents/implementations/SecurityAgent.d.ts +31 -0
- package/dist/agents/implementations/SecurityAgent.d.ts.map +1 -0
- package/dist/agents/implementations/SecurityAgent.js +453 -0
- package/dist/agents/implementations/SecurityAgent.js.map +1 -0
- package/dist/agents/intelligence/ProjectIntelligence.d.ts +127 -0
- package/dist/agents/intelligence/ProjectIntelligence.d.ts.map +1 -0
- package/dist/agents/intelligence/ProjectIntelligence.js +456 -0
- package/dist/agents/intelligence/ProjectIntelligence.js.map +1 -0
- package/dist/agents/interfaces/AgentCommunication.d.ts +65 -0
- package/dist/agents/interfaces/AgentCommunication.d.ts.map +1 -0
- package/dist/agents/interfaces/AgentCommunication.js +13 -0
- package/dist/agents/interfaces/AgentCommunication.js.map +1 -0
- package/dist/agents/learning/CrossProjectLearning.d.ts +99 -0
- package/dist/agents/learning/CrossProjectLearning.d.ts.map +1 -0
- package/dist/agents/learning/CrossProjectLearning.js +517 -0
- package/dist/agents/learning/CrossProjectLearning.js.map +1 -0
- package/dist/cli.js +47 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/agent-flow.d.ts +21 -0
- package/dist/commands/agent-flow.d.ts.map +1 -0
- package/dist/commands/agent-flow.js +225 -0
- package/dist/commands/agent-flow.js.map +1 -0
- package/dist/commands/generate-components.d.ts +0 -13
- package/dist/commands/generate-components.d.ts.map +1 -1
- package/dist/commands/generate-components.js +23 -385
- package/dist/commands/generate-components.js.map +1 -1
- package/dist/commands/generate.d.ts +4 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +173 -1
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/predict.d.ts +36 -0
- package/dist/commands/predict.d.ts.map +1 -0
- package/dist/commands/predict.js +539 -0
- package/dist/commands/predict.js.map +1 -0
- package/dist/utils/clean.d.ts +6 -0
- package/dist/utils/clean.d.ts.map +1 -0
- package/dist/utils/clean.js +220 -0
- package/dist/utils/clean.js.map +1 -0
- package/dist/utils/githubModelsClient.d.ts.map +1 -1
- package/dist/utils/githubModelsClient.js +11 -12
- package/dist/utils/githubModelsClient.js.map +1 -1
- package/dist/utils/hybridAIClient.d.ts +1 -0
- package/dist/utils/hybridAIClient.d.ts.map +1 -1
- package/dist/utils/hybridAIClient.js +23 -9
- package/dist/utils/hybridAIClient.js.map +1 -1
- package/dist/utils/ollamaClient.d.ts.map +1 -1
- package/dist/utils/ollamaClient.js +6 -4
- package/dist/utils/ollamaClient.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.PromptConstructorAgent = void 0;
|
|
37
|
+
/**
|
|
38
|
+
* PromptConstructorAgent
|
|
39
|
+
*
|
|
40
|
+
* Analyzes all context files and constructs highly specific prompts
|
|
41
|
+
* for component generation based on project requirements, types, and branding.
|
|
42
|
+
*
|
|
43
|
+
* Features:
|
|
44
|
+
* - Context file analysis and extraction
|
|
45
|
+
* - Component-specific requirement generation
|
|
46
|
+
* - Intelligent prompt construction
|
|
47
|
+
* - Domain knowledge integration
|
|
48
|
+
*/
|
|
49
|
+
class PromptConstructorAgent {
|
|
50
|
+
constructor() {
|
|
51
|
+
this.name = "PromptConstructorAgent";
|
|
52
|
+
this.description = "Analyzes project context and constructs intelligent prompts for component generation";
|
|
53
|
+
this.personality = "analytical, detail-oriented, context-aware";
|
|
54
|
+
this.llmProvider = "github";
|
|
55
|
+
this.expertise = [
|
|
56
|
+
"prompt engineering",
|
|
57
|
+
"context analysis",
|
|
58
|
+
"requirement extraction",
|
|
59
|
+
"domain knowledge",
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
async run(context) {
|
|
63
|
+
// Step 1: Analyze all context files
|
|
64
|
+
const contextAnalysis = await this.analyzeContextFiles(context);
|
|
65
|
+
// Step 2: Extract component-specific requirements
|
|
66
|
+
const componentRequirements = await this.extractComponentRequirements(context, contextAnalysis);
|
|
67
|
+
// Step 3: Use AI to enhance and refine the prompt
|
|
68
|
+
const enhancedPrompt = await this.enhancePromptWithAI(context, contextAnalysis, componentRequirements);
|
|
69
|
+
// Step 4: Construct final prompt with AI enhancements
|
|
70
|
+
const constructedPrompt = await this.constructPrompt(context, enhancedPrompt, componentRequirements);
|
|
71
|
+
return constructedPrompt;
|
|
72
|
+
}
|
|
73
|
+
async analyzeContextFiles(context) {
|
|
74
|
+
const analysis = {
|
|
75
|
+
domain: "",
|
|
76
|
+
businessLogic: [],
|
|
77
|
+
userStories: [],
|
|
78
|
+
technicalRequirements: [],
|
|
79
|
+
uiPatterns: [],
|
|
80
|
+
dataStructures: [],
|
|
81
|
+
brandingGuidelines: [],
|
|
82
|
+
externalDependencies: [],
|
|
83
|
+
enhancedRequirements: [],
|
|
84
|
+
implementationNotes: [],
|
|
85
|
+
edgeCases: [],
|
|
86
|
+
accessibilityRequirements: [],
|
|
87
|
+
};
|
|
88
|
+
// Analyze PRD
|
|
89
|
+
if (context.prd) {
|
|
90
|
+
analysis.domain = this.extractDomain(context.prd);
|
|
91
|
+
analysis.businessLogic = this.extractBusinessLogic(context.prd);
|
|
92
|
+
analysis.userStories = this.extractUserStories(context.prd);
|
|
93
|
+
analysis.technicalRequirements = this.extractTechnicalRequirements(context.prd);
|
|
94
|
+
}
|
|
95
|
+
// Analyze Types
|
|
96
|
+
if (context.types) {
|
|
97
|
+
analysis.dataStructures = this.extractDataStructures(context.types);
|
|
98
|
+
}
|
|
99
|
+
// Analyze Branding
|
|
100
|
+
if (context.branding) {
|
|
101
|
+
analysis.brandingGuidelines = this.extractBrandingGuidelines(context.branding);
|
|
102
|
+
}
|
|
103
|
+
// Analyze Component List
|
|
104
|
+
if (context.componentList) {
|
|
105
|
+
analysis.uiPatterns = this.extractUIPatterns(context.componentList);
|
|
106
|
+
analysis.externalDependencies = this.detectExternalDependencies(context.componentList, context.componentName, context.componentGroup);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
analysis.externalDependencies = [];
|
|
110
|
+
}
|
|
111
|
+
return analysis;
|
|
112
|
+
}
|
|
113
|
+
async enhancePromptWithAI(context, analysis, requirements) {
|
|
114
|
+
try {
|
|
115
|
+
const { HybridAIClient } = await Promise.resolve().then(() => __importStar(require("../../utils/hybridAIClient")));
|
|
116
|
+
const enhancementPrompt = `You are an expert prompt engineer specializing in React component generation.
|
|
117
|
+
|
|
118
|
+
Based on this project context, enhance the component generation requirements:
|
|
119
|
+
|
|
120
|
+
PROJECT DOMAIN: ${analysis.domain}
|
|
121
|
+
COMPONENT: ${context.componentName}
|
|
122
|
+
GROUP: ${context.componentGroup}
|
|
123
|
+
|
|
124
|
+
CURRENT ANALYSIS:
|
|
125
|
+
- Business Logic: ${analysis.businessLogic.join(", ")}
|
|
126
|
+
- User Stories: ${analysis.userStories.join(", ")}
|
|
127
|
+
- Technical Requirements: ${analysis.technicalRequirements.join(", ")}
|
|
128
|
+
|
|
129
|
+
CURRENT REQUIREMENTS:
|
|
130
|
+
${requirements.map((req, i) => `${i + 1}. ${req}`).join("\n")}
|
|
131
|
+
|
|
132
|
+
Please enhance these requirements by:
|
|
133
|
+
1. Adding specific implementation details
|
|
134
|
+
2. Identifying potential edge cases
|
|
135
|
+
3. Suggesting best practices for this component type
|
|
136
|
+
4. Adding accessibility requirements
|
|
137
|
+
5. Including error handling patterns
|
|
138
|
+
6. Suggesting performance optimizations
|
|
139
|
+
|
|
140
|
+
Return your response as a JSON object with these keys:
|
|
141
|
+
{
|
|
142
|
+
"enhancedRequirements": ["array of enhanced requirement strings"],
|
|
143
|
+
"implementationNotes": ["array of specific implementation guidance"],
|
|
144
|
+
"externalDependencies": ["array of required external files with paths"],
|
|
145
|
+
"edgeCases": ["array of edge cases to handle"],
|
|
146
|
+
"accessibilityRequirements": ["array of accessibility features to implement"]
|
|
147
|
+
}`;
|
|
148
|
+
const aiClient = new HybridAIClient();
|
|
149
|
+
const enhancementResponse = await aiClient.generateText(enhancementPrompt, { model: "openai/gpt-5" });
|
|
150
|
+
// Try to parse the AI response as JSON
|
|
151
|
+
try {
|
|
152
|
+
const enhancedAnalysis = JSON.parse(enhancementResponse.text);
|
|
153
|
+
return {
|
|
154
|
+
...analysis,
|
|
155
|
+
enhancedRequirements: enhancedAnalysis.enhancedRequirements || requirements,
|
|
156
|
+
implementationNotes: enhancedAnalysis.implementationNotes || [],
|
|
157
|
+
externalDependencies: enhancedAnalysis.externalDependencies || [],
|
|
158
|
+
edgeCases: enhancedAnalysis.edgeCases || [],
|
|
159
|
+
accessibilityRequirements: enhancedAnalysis.accessibilityRequirements || [],
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
catch (parseError) {
|
|
163
|
+
console.log("AI enhancement parsing failed, using original analysis");
|
|
164
|
+
return analysis;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
console.log("AI prompt enhancement failed, using original analysis");
|
|
169
|
+
return analysis;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
extractDomain(prd) {
|
|
173
|
+
// Extract the main domain/application type
|
|
174
|
+
const lines = prd.split("\n");
|
|
175
|
+
for (const line of lines) {
|
|
176
|
+
if (line.includes("Product Requirements") ||
|
|
177
|
+
line.includes("PRD") ||
|
|
178
|
+
line.includes("Overview")) {
|
|
179
|
+
return line.toLowerCase().includes("tic-tac-toe")
|
|
180
|
+
? "game"
|
|
181
|
+
: line.toLowerCase().includes("e-commerce")
|
|
182
|
+
? "ecommerce"
|
|
183
|
+
: line.toLowerCase().includes("dashboard")
|
|
184
|
+
? "dashboard"
|
|
185
|
+
: line.toLowerCase().includes("social")
|
|
186
|
+
? "social"
|
|
187
|
+
: "application";
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return "application";
|
|
191
|
+
}
|
|
192
|
+
extractBusinessLogic(prd) {
|
|
193
|
+
const logic = [];
|
|
194
|
+
const lines = prd.split("\n");
|
|
195
|
+
for (let i = 0; i < lines.length; i++) {
|
|
196
|
+
const line = lines[i].toLowerCase();
|
|
197
|
+
if (line.includes("algorithm") ||
|
|
198
|
+
line.includes("logic") ||
|
|
199
|
+
line.includes("rules")) {
|
|
200
|
+
logic.push(lines[i].trim());
|
|
201
|
+
// Get next few lines for context
|
|
202
|
+
for (let j = i + 1; j < Math.min(i + 3, lines.length); j++) {
|
|
203
|
+
if (lines[j].trim() && !lines[j].startsWith("#")) {
|
|
204
|
+
logic.push(lines[j].trim());
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return logic;
|
|
210
|
+
}
|
|
211
|
+
extractUserStories(prd) {
|
|
212
|
+
const stories = [];
|
|
213
|
+
const lines = prd.split("\n");
|
|
214
|
+
for (const line of lines) {
|
|
215
|
+
if (line.includes("As a") ||
|
|
216
|
+
line.includes("User Story") ||
|
|
217
|
+
line.includes("story")) {
|
|
218
|
+
stories.push(line.trim());
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return stories;
|
|
222
|
+
}
|
|
223
|
+
extractTechnicalRequirements(prd) {
|
|
224
|
+
const requirements = [];
|
|
225
|
+
const lines = prd.split("\n");
|
|
226
|
+
for (const line of lines) {
|
|
227
|
+
const lowerLine = line.toLowerCase();
|
|
228
|
+
if (lowerLine.includes("technical") ||
|
|
229
|
+
lowerLine.includes("requirement") ||
|
|
230
|
+
lowerLine.includes("technology") ||
|
|
231
|
+
lowerLine.includes("framework")) {
|
|
232
|
+
requirements.push(line.trim());
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return requirements;
|
|
236
|
+
}
|
|
237
|
+
extractDataStructures(types) {
|
|
238
|
+
const structures = [];
|
|
239
|
+
const lines = types.split("\n");
|
|
240
|
+
for (const line of lines) {
|
|
241
|
+
if (line.includes("interface") ||
|
|
242
|
+
line.includes("type") ||
|
|
243
|
+
line.includes("enum")) {
|
|
244
|
+
structures.push(line.trim());
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return structures;
|
|
248
|
+
}
|
|
249
|
+
extractBrandingGuidelines(branding) {
|
|
250
|
+
const guidelines = [];
|
|
251
|
+
const lines = branding.split("\n");
|
|
252
|
+
for (const line of lines) {
|
|
253
|
+
const lowerLine = line.toLowerCase();
|
|
254
|
+
if (lowerLine.includes("color") ||
|
|
255
|
+
lowerLine.includes("font") ||
|
|
256
|
+
lowerLine.includes("style") ||
|
|
257
|
+
lowerLine.includes("design")) {
|
|
258
|
+
guidelines.push(line.trim());
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return guidelines;
|
|
262
|
+
}
|
|
263
|
+
extractUIPatterns(componentList) {
|
|
264
|
+
const patterns = [];
|
|
265
|
+
try {
|
|
266
|
+
const parsed = JSON.parse(componentList);
|
|
267
|
+
if (parsed.groups) {
|
|
268
|
+
for (const group of parsed.groups) {
|
|
269
|
+
if (group.components) {
|
|
270
|
+
for (const component of group.components) {
|
|
271
|
+
if (component.description) {
|
|
272
|
+
patterns.push(`${component.name}: ${component.description}`);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
catch (e) {
|
|
280
|
+
// Fallback to text parsing
|
|
281
|
+
const lines = componentList.split("\n");
|
|
282
|
+
for (const line of lines) {
|
|
283
|
+
if (line.includes("description") || line.includes("component")) {
|
|
284
|
+
patterns.push(line.trim());
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return patterns;
|
|
289
|
+
}
|
|
290
|
+
async extractComponentRequirements(context, analysis) {
|
|
291
|
+
const requirements = [];
|
|
292
|
+
// Component-specific requirements based on name and group
|
|
293
|
+
const componentName = context.componentName.toLowerCase();
|
|
294
|
+
const componentGroup = context.componentGroup.toLowerCase();
|
|
295
|
+
// Game-specific requirements
|
|
296
|
+
if (analysis.domain === "game") {
|
|
297
|
+
if (componentName.includes("board") || componentName.includes("game")) {
|
|
298
|
+
requirements.push("Implement a 3x3 grid for tic-tac-toe gameplay");
|
|
299
|
+
requirements.push("Handle click events for each cell");
|
|
300
|
+
requirements.push("Display X and O markers clearly");
|
|
301
|
+
requirements.push("Show game state (current player, winner, draw)");
|
|
302
|
+
requirements.push("Include reset/new game functionality");
|
|
303
|
+
requirements.push("Add smooth hover and click animations");
|
|
304
|
+
}
|
|
305
|
+
if (componentName.includes("ai") || componentName.includes("logic")) {
|
|
306
|
+
requirements.push("Implement minimax algorithm for AI moves");
|
|
307
|
+
requirements.push("Support different difficulty levels");
|
|
308
|
+
requirements.push("Provide optimal move calculation");
|
|
309
|
+
}
|
|
310
|
+
if (componentName.includes("score") ||
|
|
311
|
+
componentName.includes("history")) {
|
|
312
|
+
requirements.push("Track wins, losses, and draws");
|
|
313
|
+
requirements.push("Display game history");
|
|
314
|
+
requirements.push("Persist score data");
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
// UI-specific requirements based on group
|
|
318
|
+
if (componentGroup.includes("interface") || componentGroup.includes("ui")) {
|
|
319
|
+
requirements.push("Use consistent spacing and layout patterns");
|
|
320
|
+
requirements.push("Ensure responsive design for mobile and desktop");
|
|
321
|
+
requirements.push("Include proper accessibility attributes");
|
|
322
|
+
requirements.push("Follow shadcn/ui component patterns");
|
|
323
|
+
}
|
|
324
|
+
return requirements;
|
|
325
|
+
}
|
|
326
|
+
async constructPrompt(context, analysis, requirements) {
|
|
327
|
+
const systemPrompt = `You are an expert React/TypeScript developer generating production-ready Next.js components.
|
|
328
|
+
|
|
329
|
+
DOMAIN CONTEXT: ${analysis.domain}
|
|
330
|
+
PROJECT TYPE: ${analysis.domain === "game"
|
|
331
|
+
? "Interactive Game Application"
|
|
332
|
+
: "Web Application"}
|
|
333
|
+
|
|
334
|
+
COMPONENT TARGET:
|
|
335
|
+
- Name: ${context.componentName}
|
|
336
|
+
- Group: ${context.componentGroup}
|
|
337
|
+
- Purpose: Generate a fully functional, production-ready component
|
|
338
|
+
|
|
339
|
+
CRITICAL REQUIREMENTS:
|
|
340
|
+
- Use TypeScript with strict typing
|
|
341
|
+
- Import React properly: import React from 'react'
|
|
342
|
+
- Use ONLY the design tokens provided in the DESIGN TOKENS section
|
|
343
|
+
- Use ONLY the UI components listed in AVAILABLE UI COMPONENTS
|
|
344
|
+
- Apply branding values from BRANDING CONTEXT section
|
|
345
|
+
- Use shadcn/ui primitives with correct import paths: import { Button } from '@/components/ui/button'
|
|
346
|
+
- For icons, use: import { X, O } from 'lucide-react' (not custom components)
|
|
347
|
+
- Use proper React hooks: useState, useCallback, useEffect
|
|
348
|
+
- Add comprehensive TypeScript interfaces
|
|
349
|
+
- Include proper error handling and validation
|
|
350
|
+
- Ensure accessibility with ARIA labels and roles
|
|
351
|
+
- Return only a single TSX component file with default export
|
|
352
|
+
- NO external dependencies unless they exist in the project
|
|
353
|
+
- If hooks or utilities are needed, add them as inline implementations
|
|
354
|
+
- Use proper state management patterns
|
|
355
|
+
- FOLLOW THE DESIGN SYSTEM: Use provided CSS custom properties and design tokens
|
|
356
|
+
|
|
357
|
+
EXTERNAL DEPENDENCIES DETECTION:
|
|
358
|
+
${analysis.externalDependencies && analysis.externalDependencies.length > 0
|
|
359
|
+
? `This component requires these external files (add as comments):
|
|
360
|
+
${analysis.externalDependencies.map((dep) => `- ${dep}`).join("\n")}`
|
|
361
|
+
: "No external dependencies required - implement everything inline"}
|
|
362
|
+
|
|
363
|
+
AI-ENHANCED REQUIREMENTS:
|
|
364
|
+
${analysis.enhancedRequirements
|
|
365
|
+
? analysis.enhancedRequirements.map((req) => `- ${req}`).join("\n")
|
|
366
|
+
: "Use standard component generation best practices"}
|
|
367
|
+
|
|
368
|
+
IMPLEMENTATION NOTES:
|
|
369
|
+
${analysis.implementationNotes
|
|
370
|
+
? analysis.implementationNotes.map((note) => `- ${note}`).join("\n")
|
|
371
|
+
: ""}
|
|
372
|
+
|
|
373
|
+
EDGE CASES TO HANDLE:
|
|
374
|
+
${analysis.edgeCases
|
|
375
|
+
? analysis.edgeCases.map((edgeCase) => `- ${edgeCase}`).join("\n")
|
|
376
|
+
: "Handle standard edge cases (loading, errors, empty states)"}
|
|
377
|
+
|
|
378
|
+
ACCESSIBILITY REQUIREMENTS:
|
|
379
|
+
${analysis.accessibilityRequirements
|
|
380
|
+
? analysis.accessibilityRequirements
|
|
381
|
+
.map((req) => `- ${req}`)
|
|
382
|
+
.join("\n")
|
|
383
|
+
: "Implement standard accessibility features (ARIA labels, keyboard navigation, focus management)"}
|
|
384
|
+
|
|
385
|
+
SPECIFIC BUSINESS LOGIC:
|
|
386
|
+
${analysis.businessLogic.map((logic) => `- ${logic}`).join("\n")}
|
|
387
|
+
|
|
388
|
+
DATA STRUCTURES TO USE:
|
|
389
|
+
${analysis.dataStructures.map((struct) => `- ${struct}`).join("\n")}`;
|
|
390
|
+
const userPrompt = `Generate the ${context.componentName} component with these specific requirements:
|
|
391
|
+
|
|
392
|
+
FUNCTIONAL REQUIREMENTS:
|
|
393
|
+
${requirements.map((req) => `- ${req}`).join("\n")}
|
|
394
|
+
|
|
395
|
+
USER STORIES TO FULFILL:
|
|
396
|
+
${analysis.userStories.map((story) => `- ${story}`).join("\n")}
|
|
397
|
+
|
|
398
|
+
BRANDING GUIDELINES:
|
|
399
|
+
${analysis.brandingGuidelines
|
|
400
|
+
.map((guideline) => `- ${guideline}`)
|
|
401
|
+
.join("\n")}
|
|
402
|
+
|
|
403
|
+
UI PATTERNS TO FOLLOW:
|
|
404
|
+
${analysis.uiPatterns.map((pattern) => `- ${pattern}`).join("\n")}
|
|
405
|
+
|
|
406
|
+
IMPORTANT: This should be a complete, functional component that implements the actual business logic, not just a layout wrapper. Include all necessary state management, event handlers, and user interactions.`;
|
|
407
|
+
return {
|
|
408
|
+
systemPrompt,
|
|
409
|
+
userPrompt,
|
|
410
|
+
contextSummary: `Domain: ${analysis.domain}, Component: ${context.componentName}`,
|
|
411
|
+
specificRequirements: requirements,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
detectExternalDependencies(componentList, componentName, componentGroup) {
|
|
415
|
+
const dependencies = [];
|
|
416
|
+
try {
|
|
417
|
+
// Try to parse JSON, if it fails, try to extract useful info from the text
|
|
418
|
+
let componentData;
|
|
419
|
+
try {
|
|
420
|
+
componentData = JSON.parse(componentList);
|
|
421
|
+
}
|
|
422
|
+
catch (jsonError) {
|
|
423
|
+
// If JSON parsing fails, try to extract dependencies from text
|
|
424
|
+
console.log("JSON parsing failed, trying text-based extraction");
|
|
425
|
+
this.extractDependenciesFromText(componentList, componentName, dependencies);
|
|
426
|
+
return dependencies;
|
|
427
|
+
}
|
|
428
|
+
if (componentData.groups) {
|
|
429
|
+
for (const group of componentData.groups) {
|
|
430
|
+
for (const component of group.components || []) {
|
|
431
|
+
if (component.name === componentName && component.dependencies) {
|
|
432
|
+
// Add custom hooks that might be needed
|
|
433
|
+
if (component.dependencies.some((dep) => dep.toLowerCase().includes("auth"))) {
|
|
434
|
+
dependencies.push("@/hooks/useAuth.ts - User authentication hook");
|
|
435
|
+
}
|
|
436
|
+
if (component.dependencies.some((dep) => dep.toLowerCase().includes("history"))) {
|
|
437
|
+
dependencies.push("@/hooks/useGameHistory.ts - Game history management hook");
|
|
438
|
+
}
|
|
439
|
+
if (component.dependencies.some((dep) => dep.toLowerCase().includes("storage"))) {
|
|
440
|
+
dependencies.push("@/hooks/useLocalStorage.ts - Local storage utility hook");
|
|
441
|
+
}
|
|
442
|
+
// Add utility files for complex logic
|
|
443
|
+
if (component.actionFunctions?.some((fn) => fn.includes("minimax") || fn.includes("AI"))) {
|
|
444
|
+
dependencies.push("@/utils/minimax.ts - AI algorithm implementation");
|
|
445
|
+
}
|
|
446
|
+
if (component.actionFunctions?.some((fn) => fn.includes("validation"))) {
|
|
447
|
+
dependencies.push("@/utils/validation.ts - Form/data validation utilities");
|
|
448
|
+
}
|
|
449
|
+
// Add type definitions
|
|
450
|
+
if (component.stateVariables?.length > 0) {
|
|
451
|
+
dependencies.push("@/types/game.ts - Game-related type definitions");
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
catch (error) {
|
|
459
|
+
console.log("Error parsing component list for dependencies:", error);
|
|
460
|
+
}
|
|
461
|
+
return dependencies;
|
|
462
|
+
}
|
|
463
|
+
extractDependenciesFromText(text, componentName, dependencies) {
|
|
464
|
+
// Simple text-based extraction for common patterns
|
|
465
|
+
if (text.toLowerCase().includes("minimax") ||
|
|
466
|
+
text.toLowerCase().includes("ai")) {
|
|
467
|
+
dependencies.push("@/utils/minimax.ts - AI algorithm implementation");
|
|
468
|
+
}
|
|
469
|
+
if (text.toLowerCase().includes("auth")) {
|
|
470
|
+
dependencies.push("@/hooks/useAuth.ts - User authentication hook");
|
|
471
|
+
}
|
|
472
|
+
if (text.toLowerCase().includes("history")) {
|
|
473
|
+
dependencies.push("@/hooks/useGameHistory.ts - Game history management hook");
|
|
474
|
+
}
|
|
475
|
+
if (text.toLowerCase().includes("storage")) {
|
|
476
|
+
dependencies.push("@/hooks/useLocalStorage.ts - Local storage utility hook");
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
exports.PromptConstructorAgent = PromptConstructorAgent;
|
|
481
|
+
//# sourceMappingURL=PromptConstructorAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PromptConstructorAgent.js","sourceRoot":"","sources":["../../../src/agents/implementations/PromptConstructorAgent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA;;;;;;;;;;;GAWG;AACH,MAAa,sBAAsB;IAAnC;QAGE,SAAI,GAAG,wBAAwB,CAAC;QAChC,gBAAW,GACT,sFAAsF,CAAC;QACzF,gBAAW,GAAG,4CAA4C,CAAC;QAC3D,gBAAW,GAAW,QAAQ,CAAC;QAC/B,cAAS,GAAG;YACV,oBAAoB;YACpB,kBAAkB;YAClB,wBAAwB;YACxB,kBAAkB;SACnB,CAAC;IAmkBJ,CAAC;IAjkBC,KAAK,CAAC,GAAG,CAAC,OAAkC;QAC1C,oCAAoC;QACpC,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAEhE,kDAAkD;QAClD,MAAM,qBAAqB,GAAG,MAAM,IAAI,CAAC,4BAA4B,CACnE,OAAO,EACP,eAAe,CAChB,CAAC;QAEF,kDAAkD;QAClD,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,mBAAmB,CACnD,OAAO,EACP,eAAe,EACf,qBAAqB,CACtB,CAAC;QAEF,sDAAsD;QACtD,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,eAAe,CAClD,OAAO,EACP,cAAc,EACd,qBAAqB,CACtB,CAAC;QAEF,OAAO,iBAAiB,CAAC;IA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SubAgent } from "../interfaces/SubAgent";
|
|
2
|
+
export declare class SecurityAgent implements SubAgent {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
personality: string;
|
|
6
|
+
llmProvider: string;
|
|
7
|
+
expertise: string[];
|
|
8
|
+
run(input: any): Promise<any>;
|
|
9
|
+
execute(input: any): Promise<any>;
|
|
10
|
+
private scanVulnerabilities;
|
|
11
|
+
private detectXSS;
|
|
12
|
+
private detectCSRF;
|
|
13
|
+
private detectInjection;
|
|
14
|
+
private detectAuthenticationIssues;
|
|
15
|
+
private detectDataExposure;
|
|
16
|
+
private performSecurityChecks;
|
|
17
|
+
private checkInputValidation;
|
|
18
|
+
private checkOutputEncoding;
|
|
19
|
+
private checkAccessControl;
|
|
20
|
+
private checkDataProtection;
|
|
21
|
+
private checkCommunicationSecurity;
|
|
22
|
+
private checkErrorHandling;
|
|
23
|
+
private generateSecurityRecommendations;
|
|
24
|
+
private calculateSecurityScore;
|
|
25
|
+
private checkCompliance;
|
|
26
|
+
private checkOWASPCompliance;
|
|
27
|
+
private checkGDPRCompliance;
|
|
28
|
+
private checkPCICompliance;
|
|
29
|
+
private checkHIPAACompliance;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=SecurityAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SecurityAgent.d.ts","sourceRoot":"","sources":["../../../src/agents/implementations/SecurityAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,qBAAa,aAAc,YAAW,QAAQ;IAC5C,IAAI,SAAmB;IACvB,WAAW,SACgE;IAC3E,WAAW,SAAc;IACzB,WAAW,SAAY;IACvB,SAAS,WAA0D;IAE7D,GAAG,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAI7B,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;YAwBzB,mBAAmB;IA6BjC,OAAO,CAAC,SAAS;IA4CjB,OAAO,CAAC,UAAU;IA0ClB,OAAO,CAAC,eAAe;IA8CvB,OAAO,CAAC,0BAA0B;IAuDlC,OAAO,CAAC,kBAAkB;YAoDZ,qBAAqB;IAcnC,OAAO,CAAC,oBAAoB;IA6B5B,OAAO,CAAC,mBAAmB;IAU3B,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,0BAA0B;IAUlC,OAAO,CAAC,kBAAkB;YAWZ,+BAA+B;IAmD7C,OAAO,CAAC,sBAAsB;IAmC9B,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,oBAAoB;CAa7B"}
|