generator-agent 1.0.0 → 1.0.3
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/.vscode/agents.json +1 -1
- package/.vscode/settings.json +6 -0
- package/main.js +16 -1
- package/package.json +9 -1
- package/post-install.js +68 -4
package/.vscode/agents.json
CHANGED
package/main.js
CHANGED
|
@@ -38,7 +38,22 @@ function activate(context) {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
//
|
|
41
|
+
// Register chat participant for Copilot
|
|
42
|
+
if (vscode.chat && vscode.chat.createChatParticipant) {
|
|
43
|
+
const participant = vscode.chat.createChatParticipant('generators', (request, context, stream, token) => {
|
|
44
|
+
stream.markdown('👋 Generator Agent activated! Use me to generate API data generators.\n\n');
|
|
45
|
+
stream.markdown('Available commands:\n');
|
|
46
|
+
stream.markdown('- Create a new generator\n');
|
|
47
|
+
stream.markdown('- Analyze OpenAPI specification\n');
|
|
48
|
+
stream.markdown('- Generate based on patterns\n');
|
|
49
|
+
return {};
|
|
50
|
+
});
|
|
51
|
+
participant.iconPath = vscode.Uri.file(__dirname + '/.agents/generators.json');
|
|
52
|
+
context.subscriptions.push(participant);
|
|
53
|
+
console.log('✅ Chat participant registered: @generators');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Export agents for Copilot discovery (fallback)
|
|
42
57
|
if (vscode.window && vscode.window.registerChatAgents) {
|
|
43
58
|
try {
|
|
44
59
|
agents.forEach(agent => {
|
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.3",
|
|
6
6
|
"publisher": "zohodesk",
|
|
7
7
|
"engines": {
|
|
8
8
|
"vscode": "^1.80.0"
|
|
@@ -26,6 +26,14 @@
|
|
|
26
26
|
"command": "generator.start",
|
|
27
27
|
"title": "Start Generator Agent"
|
|
28
28
|
}
|
|
29
|
+
],
|
|
30
|
+
"chatParticipants": [
|
|
31
|
+
{
|
|
32
|
+
"id": "generators",
|
|
33
|
+
"name": "Generators",
|
|
34
|
+
"description": "Generator Agent responsible for generating generators",
|
|
35
|
+
"isSticky": true
|
|
36
|
+
}
|
|
29
37
|
]
|
|
30
38
|
},
|
|
31
39
|
"repository": {
|
package/post-install.js
CHANGED
|
@@ -11,8 +11,16 @@ const fs = require('fs');
|
|
|
11
11
|
console.log('🔧 Generator Agent post-install starting...');
|
|
12
12
|
|
|
13
13
|
try {
|
|
14
|
-
//
|
|
15
|
-
|
|
14
|
+
// Detect if running from node_modules and get the parent project root
|
|
15
|
+
let cwd = process.cwd();
|
|
16
|
+
|
|
17
|
+
// If we're inside node_modules, go up to the project root
|
|
18
|
+
if (cwd.includes('node_modules')) {
|
|
19
|
+
const nodeModulesIndex = cwd.indexOf('node_modules');
|
|
20
|
+
cwd = cwd.substring(0, nodeModulesIndex - 1); // -1 to remove trailing slash
|
|
21
|
+
console.log('📂 Detected installation in node_modules, registering in parent project');
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
const agentDir = path.join(cwd, '.vscode');
|
|
17
25
|
|
|
18
26
|
if (!fs.existsSync(agentDir)) {
|
|
@@ -35,13 +43,69 @@ try {
|
|
|
35
43
|
const configPath = path.join(agentDir, 'agents.json');
|
|
36
44
|
fs.writeFileSync(configPath, JSON.stringify(agentsConfig, null, 2));
|
|
37
45
|
|
|
46
|
+
// Create VS Code settings to enable Copilot agents
|
|
47
|
+
const settingsPath = path.join(agentDir, 'settings.json');
|
|
48
|
+
let settings = {};
|
|
49
|
+
|
|
50
|
+
if (fs.existsSync(settingsPath)) {
|
|
51
|
+
settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Add GitHub Copilot agent settings
|
|
55
|
+
settings['github.copilot.chat.experimental.agents'] = true;
|
|
56
|
+
settings['github.copilot.chat.experimental.agentLocations'] = [
|
|
57
|
+
'.vscode/agents.json'
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
61
|
+
|
|
62
|
+
// Create extension symlink for VS Code to discover
|
|
63
|
+
const extensionsDir = path.join(cwd, '.vscode', 'extensions');
|
|
64
|
+
const extensionLink = path.join(extensionsDir, 'generator-agent');
|
|
65
|
+
const packagePath = path.join(cwd, 'node_modules', 'generator-agent');
|
|
66
|
+
|
|
67
|
+
if (!fs.existsSync(extensionsDir)) {
|
|
68
|
+
fs.mkdirSync(extensionsDir, { recursive: true });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Remove old symlink if exists
|
|
72
|
+
if (fs.existsSync(extensionLink)) {
|
|
73
|
+
fs.unlinkSync(extensionLink);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Create symlink to make extension discoverable
|
|
77
|
+
try {
|
|
78
|
+
fs.symlinkSync(packagePath, extensionLink, 'dir');
|
|
79
|
+
console.log('🔗 Extension linked to .vscode/extensions/');
|
|
80
|
+
} catch (e) {
|
|
81
|
+
console.log('⚠️ Could not create symlink, copying files instead...');
|
|
82
|
+
// Fallback: copy instead of symlink
|
|
83
|
+
const copyDir = (src, dest) => {
|
|
84
|
+
if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
|
|
85
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
86
|
+
for (let entry of entries) {
|
|
87
|
+
const srcPath = path.join(src, entry.name);
|
|
88
|
+
const destPath = path.join(dest, entry.name);
|
|
89
|
+
if (entry.isDirectory()) {
|
|
90
|
+
copyDir(srcPath, destPath);
|
|
91
|
+
} else {
|
|
92
|
+
fs.copyFileSync(srcPath, destPath);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
copyDir(packagePath, extensionLink);
|
|
97
|
+
console.log('📁 Extension files copied to .vscode/extensions/');
|
|
98
|
+
}
|
|
99
|
+
|
|
38
100
|
console.log('✅ Agent registered in:', cwd);
|
|
39
101
|
console.log('📍 Config saved to:', configPath);
|
|
102
|
+
console.log('⚙️ VS Code settings updated');
|
|
40
103
|
console.log('');
|
|
41
|
-
console.log('
|
|
104
|
+
console.log('🔄 Reload VS Code window to activate the agent:');
|
|
42
105
|
console.log(' Press Ctrl+Shift+P (or Cmd+Shift+P on Mac)');
|
|
43
|
-
console.log(' Type "Reload Window" and press Enter');
|
|
106
|
+
console.log(' Type "Developer: Reload Window" and press Enter');
|
|
44
107
|
console.log('');
|
|
108
|
+
console.log('💡 Agent will appear in agent list (@ dropdown)');
|
|
45
109
|
console.log('✨ Post-install complete!');
|
|
46
110
|
process.exit(0);
|
|
47
111
|
} catch (error) {
|