generator-agent 1.0.4 → 1.0.7

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.
@@ -6,6 +6,6 @@
6
6
  "description": "Generator Agent responsible for generating generators"
7
7
  }
8
8
  ],
9
- "registeredAt": "2026-02-26T07:22:50.850Z",
9
+ "registeredAt": "2026-02-26T07:34:16.245Z",
10
10
  "installedFrom": "/home/ish-zstk410/Agent"
11
11
  }
package/main.js CHANGED
@@ -40,18 +40,88 @@ function activate(context) {
40
40
 
41
41
  // Register chat participant for Copilot
42
42
  if (vscode.chat && vscode.chat.createChatParticipant) {
43
- const participant = vscode.chat.createChatParticipant('generator', (request, context, stream, token) => {
44
- const userMessage = request.prompt.toLowerCase();
43
+ const participant = vscode.chat.createChatParticipant('generator', async (request, context, stream, token) => {
44
+ const userPrompt = request.prompt;
45
45
 
46
- // Default response for generator requests
47
- stream.markdown('**GeneratorAgent**: Processing...\n\n');
48
- stream.markdown(`You asked: "${request.prompt}"\n\n`);
49
- stream.markdown('I can help you generate:\n\n');
50
- stream.markdown('**Static data** - Fixed values\n');
51
- stream.markdown('**Dynamic data** - Generated using expressions\n');
52
- stream.markdown('**Conditional data** - Based on rules\n');
53
- stream.markdown('**Reference data** - From other fields\n');
54
- stream.markdown('**Remote data** - From external APIs\n');
46
+ stream.markdown(`**GeneratorAgent**: Processing "${userPrompt}"...\n\n`);
47
+
48
+ try {
49
+ // Step 1: Read Generator_Patterns folder
50
+ stream.markdown('📁 Reading Generator_Patterns folder...\n');
51
+ const workspaceFolders = vscode.workspace.workspaceFolders;
52
+ if (!workspaceFolders) {
53
+ stream.markdown(' No workspace folder found\n');
54
+ return {};
55
+ }
56
+
57
+ const workspaceRoot = workspaceFolders[0].uri.fsPath;
58
+ const patternsPath = path.join(workspaceRoot, 'Generator_Patterns');
59
+
60
+ if (!fs.existsSync(patternsPath)) {
61
+ stream.markdown('❌ Generator_Patterns folder not found\n');
62
+ return {};
63
+ }
64
+
65
+ // Step 2: Read PathConfig.properties
66
+ stream.markdown('🔍 Reading PathConfig.properties...\n');
67
+ const pathConfigPath = path.join(patternsPath, 'PathConfig.properties');
68
+ let oasPath = '';
69
+
70
+ if (fs.existsSync(pathConfigPath)) {
71
+ const pathConfig = fs.readFileSync(pathConfigPath, 'utf8');
72
+ const oasMatch = pathConfig.match(/oas_file_path\s*=\s*(.+)/);
73
+ if (oasMatch) {
74
+ oasPath = oasMatch[1].trim();
75
+ stream.markdown(`✓ OAS path: ${oasPath}\n`);
76
+ }
77
+ }
78
+
79
+ // Step 3: Parse user prompt to identify entity
80
+ stream.markdown('🔎 Analyzing prompt...\n');
81
+ const entityMatch = userPrompt.match(/create\s+(?:a\s+|an\s+)?(\w+)/i);
82
+ const entity = entityMatch ? entityMatch[1] : 'Unknown';
83
+ const generatorName = entity.toLowerCase().replace(/[^a-z0-9]+/g, '_');
84
+
85
+ stream.markdown(`✓ Entity identified: ${entity}\n`);
86
+ stream.markdown(`✓ Generator name: ${generatorName}\n\n`);
87
+
88
+ // Step 4: Create generator structure following patterns
89
+ stream.markdown('🔨 Creating generator following patterns...\n');
90
+
91
+ const generators = {
92
+ generators: {
93
+ [generatorName]: []
94
+ }
95
+ };
96
+
97
+ stream.markdown('✓ Generator structure created\n\n');
98
+
99
+ // Step 5: Create output directory and file
100
+ const outputDir = path.join(workspaceRoot, 'Created_Generators', pascalCase(generatorName));
101
+ const outputFile = path.join(outputDir, 'test_data_generation_configurations.json');
102
+
103
+ if (!fs.existsSync(outputDir)) {
104
+ fs.mkdirSync(outputDir, { recursive: true });
105
+ }
106
+
107
+ fs.writeFileSync(outputFile, JSON.stringify(generators, null, 2));
108
+
109
+ stream.markdown('✅ **Generator file created successfully!**\n\n');
110
+ stream.markdown(`📂 **Location**: \`Created_Generators/${pascalCase(generatorName)}/test_data_generation_configurations.json\`\n\n`);
111
+
112
+ stream.markdown('**Generator Structure**:\n');
113
+ stream.markdown('```json\n');
114
+ stream.markdown(JSON.stringify(generators, null, 2));
115
+ stream.markdown('\n```\n\n');
116
+
117
+ stream.markdown('💡 **Next Steps**:\n');
118
+ stream.markdown('- Add generator steps (static, dynamic, conditional, reference, remote)\n');
119
+ stream.markdown('- Define dependencies if needed\n');
120
+ stream.markdown('- Validate against OAS file\n');
121
+
122
+ } catch (error) {
123
+ stream.markdown(`❌ Error: ${error.message}\n`);
124
+ }
55
125
 
56
126
  return {};
57
127
  });
@@ -59,6 +129,14 @@ function activate(context) {
59
129
  context.subscriptions.push(participant);
60
130
  console.log('✅ Chat participant registered: @generator');
61
131
  }
132
+
133
+ // Helper function to convert snake_case to PascalCase
134
+ function pascalCase(str) {
135
+ return str
136
+ .split('_')
137
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
138
+ .join('');
139
+ }
62
140
 
63
141
  // Export agents for Copilot discovery (fallback)
64
142
  if (vscode.window && vscode.window.registerChatAgents) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "generator-agent",
3
3
  "displayName": "GeneratorAgent",
4
4
  "description": "A VS Code extension for conditional rule-based data generation",
5
- "version": "1.0.4",
5
+ "version": "1.0.7",
6
6
  "publisher": "zohodesk",
7
7
  "engines": {
8
8
  "vscode": "^1.80.0"