generator-agent 1.0.3 → 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.
- package/.agents/generators.json +2 -2
- package/.vscode/agents.json +3 -3
- package/main.js +94 -9
- package/package.json +3 -3
- package/post-install.js +13 -5
package/.agents/generators.json
CHANGED
package/.vscode/agents.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"agents": [
|
|
3
3
|
{
|
|
4
|
-
"id": "
|
|
5
|
-
"name": "
|
|
4
|
+
"id": "generator",
|
|
5
|
+
"name": "GeneratorAgent",
|
|
6
6
|
"description": "Generator Agent responsible for generating generators"
|
|
7
7
|
}
|
|
8
8
|
],
|
|
9
|
-
"registeredAt": "2026-02-26T07:
|
|
9
|
+
"registeredAt": "2026-02-26T07:34:16.245Z",
|
|
10
10
|
"installedFrom": "/home/ish-zstk410/Agent"
|
|
11
11
|
}
|
package/main.js
CHANGED
|
@@ -5,8 +5,8 @@ const fs = require('fs');
|
|
|
5
5
|
// Agent objects that will be discovered by Copilot
|
|
6
6
|
const agents = [
|
|
7
7
|
{
|
|
8
|
-
id: '
|
|
9
|
-
name: '
|
|
8
|
+
id: 'generator',
|
|
9
|
+
name: 'GeneratorAgent',
|
|
10
10
|
description: 'Generator Agent responsible for generating generators',
|
|
11
11
|
}
|
|
12
12
|
];
|
|
@@ -40,17 +40,102 @@ 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('
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
stream.markdown(
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
const participant = vscode.chat.createChatParticipant('generator', async (request, context, stream, token) => {
|
|
44
|
+
const userPrompt = request.prompt;
|
|
45
|
+
|
|
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
|
+
}
|
|
125
|
+
|
|
49
126
|
return {};
|
|
50
127
|
});
|
|
51
128
|
participant.iconPath = vscode.Uri.file(__dirname + '/.agents/generators.json');
|
|
52
129
|
context.subscriptions.push(participant);
|
|
53
|
-
console.log('✅ Chat participant registered: @
|
|
130
|
+
console.log('✅ Chat participant registered: @generator');
|
|
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('');
|
|
54
139
|
}
|
|
55
140
|
|
|
56
141
|
// Export agents for Copilot discovery (fallback)
|
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.
|
|
5
|
+
"version": "1.0.7",
|
|
6
6
|
"publisher": "zohodesk",
|
|
7
7
|
"engines": {
|
|
8
8
|
"vscode": "^1.80.0"
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
],
|
|
30
30
|
"chatParticipants": [
|
|
31
31
|
{
|
|
32
|
-
"id": "
|
|
33
|
-
"name": "
|
|
32
|
+
"id": "generator",
|
|
33
|
+
"name": "GeneratorAgent",
|
|
34
34
|
"description": "Generator Agent responsible for generating generators",
|
|
35
35
|
"isSticky": true
|
|
36
36
|
}
|
package/post-install.js
CHANGED
|
@@ -31,8 +31,8 @@ try {
|
|
|
31
31
|
const agentsConfig = {
|
|
32
32
|
agents: [
|
|
33
33
|
{
|
|
34
|
-
id: '
|
|
35
|
-
name: '
|
|
34
|
+
id: 'generator',
|
|
35
|
+
name: 'GeneratorAgent',
|
|
36
36
|
description: 'Generator Agent responsible for generating generators',
|
|
37
37
|
}
|
|
38
38
|
],
|
|
@@ -61,7 +61,7 @@ try {
|
|
|
61
61
|
|
|
62
62
|
// Create extension symlink for VS Code to discover
|
|
63
63
|
const extensionsDir = path.join(cwd, '.vscode', 'extensions');
|
|
64
|
-
const extensionLink = path.join(extensionsDir, 'generator-agent');
|
|
64
|
+
const extensionLink = path.join(extensionsDir, 'zohodesk.generator-agent');
|
|
65
65
|
const packagePath = path.join(cwd, 'node_modules', 'generator-agent');
|
|
66
66
|
|
|
67
67
|
if (!fs.existsSync(extensionsDir)) {
|
|
@@ -70,7 +70,11 @@ try {
|
|
|
70
70
|
|
|
71
71
|
// Remove old symlink if exists
|
|
72
72
|
if (fs.existsSync(extensionLink)) {
|
|
73
|
-
|
|
73
|
+
try {
|
|
74
|
+
fs.unlinkSync(extensionLink);
|
|
75
|
+
} catch (e) {
|
|
76
|
+
// ignore
|
|
77
|
+
}
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
// Create symlink to make extension discoverable
|
|
@@ -79,7 +83,11 @@ try {
|
|
|
79
83
|
console.log('🔗 Extension linked to .vscode/extensions/');
|
|
80
84
|
} catch (e) {
|
|
81
85
|
console.log('⚠️ Could not create symlink, copying files instead...');
|
|
82
|
-
// Fallback: copy instead of symlink
|
|
86
|
+
// Fallback: copy instead of symlink - check if both paths exist first
|
|
87
|
+
if (!fs.existsSync(packagePath)) {
|
|
88
|
+
console.log('⚠️ Package path not found:', packagePath);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
83
91
|
const copyDir = (src, dest) => {
|
|
84
92
|
if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
|
|
85
93
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|