generator-agent 1.0.4 → 1.0.8
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/extensions.json +8 -0
- package/.vscode/launch.json +17 -0
- package/.vscode-test.mjs +5 -0
- package/.vscodeignore +10 -0
- package/CHANGELOG.md +9 -0
- package/README.md +49 -43
- package/eslint.config.mjs +25 -0
- package/extension.js +36 -0
- package/jsconfig.json +13 -0
- package/package.json +32 -61
- package/test/extension.test.js +15 -0
- package/vsc-extension-quickstart.md +42 -0
- package/.agents/generators.json +0 -7
- package/.agents/generators.md +0 -19
- package/.github/agents/Generators.agent.md +0 -121
- package/.vscode/agents.json +0 -11
- package/.vscode/settings.json +0 -6
- package/Generator_Patterns/Conditional.md +0 -84
- package/Generator_Patterns/Dynamic.md +0 -129
- package/Generator_Patterns/PathConfig.properties +0 -4
- package/Generator_Patterns/README.md +0 -118
- package/Generator_Patterns/Reference.md +0 -98
- package/Generator_Patterns/Remote.md +0 -259
- package/Generator_Patterns/Static.md +0 -99
- package/NPM_PUBLISHING.md +0 -69
- package/generator-agent-1.0.0.vsix +0 -0
- package/main.js +0 -97
- package/post-install.js +0 -122
package/NPM_PUBLISHING.md
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# NPM Publishing Guide for Generator Agent
|
|
2
|
-
|
|
3
|
-
## Setup & Publishing
|
|
4
|
-
|
|
5
|
-
### 1. Authenticate with NPM
|
|
6
|
-
```bash
|
|
7
|
-
npm login
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
### 2. Update Version (if needed)
|
|
11
|
-
```bash
|
|
12
|
-
npm version patch # or minor/major
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### 3. Publish Package
|
|
16
|
-
```bash
|
|
17
|
-
npm publish
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Using the Package
|
|
21
|
-
|
|
22
|
-
### Installation in a Folder
|
|
23
|
-
|
|
24
|
-
1. Create a new folder:
|
|
25
|
-
```bash
|
|
26
|
-
mkdir my-generator-project
|
|
27
|
-
cd my-generator-project
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
2. Initialize npm (if not already initialized):
|
|
31
|
-
```bash
|
|
32
|
-
npm init -y
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
3. Install the generator-agent package:
|
|
36
|
-
```bash
|
|
37
|
-
npm install generator-agent
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### After Installation
|
|
41
|
-
|
|
42
|
-
- An `.agents` folder will be created in your project root
|
|
43
|
-
- The agent will be registered **only** in this folder scope
|
|
44
|
-
- Other folders won't see this agent
|
|
45
|
-
- VS Code will automatically reload to activate the agent
|
|
46
|
-
|
|
47
|
-
### Access the Agent
|
|
48
|
-
|
|
49
|
-
Open any file in this folder and use:
|
|
50
|
-
```
|
|
51
|
-
@Generators
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
The agent will only be visible in the agent list for this specific folder.
|
|
55
|
-
|
|
56
|
-
## Folder-Scoped Registration
|
|
57
|
-
|
|
58
|
-
The agent registration is stored in `.vscode/agents.json` at the folder level. This ensures:
|
|
59
|
-
- ✅ Agent is visible only in this folder
|
|
60
|
-
- ✅ Multiple folders can have their own agent instances
|
|
61
|
-
- ✅ No global pollution of the agent list
|
|
62
|
-
- ✅ Easy cleanup (just delete the folder)
|
|
63
|
-
|
|
64
|
-
## Publishing Configuration
|
|
65
|
-
|
|
66
|
-
The package publishes to NPM public registry with:
|
|
67
|
-
- Public access
|
|
68
|
-
- MIT License
|
|
69
|
-
- All source files included
|
|
Binary file
|
package/main.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
const vscode = require('vscode');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
|
|
5
|
-
// Agent objects that will be discovered by Copilot
|
|
6
|
-
const agents = [
|
|
7
|
-
{
|
|
8
|
-
id: 'generator',
|
|
9
|
-
name: 'GeneratorAgent',
|
|
10
|
-
description: 'Generator Agent responsible for generating generators',
|
|
11
|
-
}
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
function registerFolderScopedAgent(workspaceFolder) {
|
|
15
|
-
const agentConfigPath = path.join(workspaceFolder.uri.fsPath, '.vscode', 'agents.json');
|
|
16
|
-
|
|
17
|
-
if (!fs.existsSync(path.dirname(agentConfigPath))) {
|
|
18
|
-
fs.mkdirSync(path.dirname(agentConfigPath), { recursive: true });
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const agentConfig = {
|
|
22
|
-
agents: agents,
|
|
23
|
-
registeredAt: new Date().toISOString(),
|
|
24
|
-
folder: workspaceFolder.name
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
fs.writeFileSync(agentConfigPath, JSON.stringify(agentConfig, null, 2));
|
|
28
|
-
console.log(`Agents registered in folder: ${workspaceFolder.name}`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function activate(context) {
|
|
32
|
-
console.log('Generator Agent is now active!');
|
|
33
|
-
|
|
34
|
-
// Register agents in folder scope
|
|
35
|
-
if (vscode.workspace.workspaceFolders) {
|
|
36
|
-
vscode.workspace.workspaceFolders.forEach(folder => {
|
|
37
|
-
registerFolderScopedAgent(folder);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Register chat participant for Copilot
|
|
42
|
-
if (vscode.chat && vscode.chat.createChatParticipant) {
|
|
43
|
-
const participant = vscode.chat.createChatParticipant('generator', (request, context, stream, token) => {
|
|
44
|
-
const userMessage = request.prompt.toLowerCase();
|
|
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');
|
|
55
|
-
|
|
56
|
-
return {};
|
|
57
|
-
});
|
|
58
|
-
participant.iconPath = vscode.Uri.file(__dirname + '/.agents/generators.json');
|
|
59
|
-
context.subscriptions.push(participant);
|
|
60
|
-
console.log('✅ Chat participant registered: @generator');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Export agents for Copilot discovery (fallback)
|
|
64
|
-
if (vscode.window && vscode.window.registerChatAgents) {
|
|
65
|
-
try {
|
|
66
|
-
agents.forEach(agent => {
|
|
67
|
-
vscode.window.registerChatAgents(agent.id, agent.name, agent.description);
|
|
68
|
-
});
|
|
69
|
-
console.log('Agents registered:', agents.length);
|
|
70
|
-
} catch (e) {
|
|
71
|
-
console.log('Note: registerChatAgents API not available, agents may still work via .agents folder');
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Command to trigger the agent
|
|
76
|
-
let disposable = vscode.commands.registerCommand(
|
|
77
|
-
'generator.start',
|
|
78
|
-
function () {
|
|
79
|
-
vscode.window.showInformationMessage('Generator Agent started!');
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
context.subscriptions.push(disposable);
|
|
84
|
-
|
|
85
|
-
// Export agents for external access
|
|
86
|
-
context.subscriptions.push({
|
|
87
|
-
agentsProvided: agents
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function deactivate() { }
|
|
92
|
-
|
|
93
|
-
module.exports = {
|
|
94
|
-
activate,
|
|
95
|
-
deactivate,
|
|
96
|
-
agents
|
|
97
|
-
};
|
package/post-install.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Post-install script for generator-agent
|
|
8
|
-
* Registers the agent in the current folder scope
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
console.log('🔧 Generator Agent post-install starting...');
|
|
12
|
-
|
|
13
|
-
try {
|
|
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
|
-
|
|
24
|
-
const agentDir = path.join(cwd, '.vscode');
|
|
25
|
-
|
|
26
|
-
if (!fs.existsSync(agentDir)) {
|
|
27
|
-
fs.mkdirSync(agentDir, { recursive: true });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Create agent registration file
|
|
31
|
-
const agentsConfig = {
|
|
32
|
-
agents: [
|
|
33
|
-
{
|
|
34
|
-
id: 'generator',
|
|
35
|
-
name: 'GeneratorAgent',
|
|
36
|
-
description: 'Generator Agent responsible for generating generators',
|
|
37
|
-
}
|
|
38
|
-
],
|
|
39
|
-
registeredAt: new Date().toISOString(),
|
|
40
|
-
installedFrom: cwd
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const configPath = path.join(agentDir, 'agents.json');
|
|
44
|
-
fs.writeFileSync(configPath, JSON.stringify(agentsConfig, null, 2));
|
|
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, 'zohodesk.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
|
-
try {
|
|
74
|
-
fs.unlinkSync(extensionLink);
|
|
75
|
-
} catch (e) {
|
|
76
|
-
// ignore
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Create symlink to make extension discoverable
|
|
81
|
-
try {
|
|
82
|
-
fs.symlinkSync(packagePath, extensionLink, 'dir');
|
|
83
|
-
console.log('🔗 Extension linked to .vscode/extensions/');
|
|
84
|
-
} catch (e) {
|
|
85
|
-
console.log('⚠️ Could not create symlink, copying files instead...');
|
|
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
|
-
}
|
|
91
|
-
const copyDir = (src, dest) => {
|
|
92
|
-
if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
|
|
93
|
-
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
94
|
-
for (let entry of entries) {
|
|
95
|
-
const srcPath = path.join(src, entry.name);
|
|
96
|
-
const destPath = path.join(dest, entry.name);
|
|
97
|
-
if (entry.isDirectory()) {
|
|
98
|
-
copyDir(srcPath, destPath);
|
|
99
|
-
} else {
|
|
100
|
-
fs.copyFileSync(srcPath, destPath);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
copyDir(packagePath, extensionLink);
|
|
105
|
-
console.log('📁 Extension files copied to .vscode/extensions/');
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
console.log('✅ Agent registered in:', cwd);
|
|
109
|
-
console.log('📍 Config saved to:', configPath);
|
|
110
|
-
console.log('⚙️ VS Code settings updated');
|
|
111
|
-
console.log('');
|
|
112
|
-
console.log('🔄 Reload VS Code window to activate the agent:');
|
|
113
|
-
console.log(' Press Ctrl+Shift+P (or Cmd+Shift+P on Mac)');
|
|
114
|
-
console.log(' Type "Developer: Reload Window" and press Enter');
|
|
115
|
-
console.log('');
|
|
116
|
-
console.log('💡 Agent will appear in agent list (@ dropdown)');
|
|
117
|
-
console.log('✨ Post-install complete!');
|
|
118
|
-
process.exit(0);
|
|
119
|
-
} catch (error) {
|
|
120
|
-
console.error('❌ Post-install error:', error.message);
|
|
121
|
-
process.exit(1);
|
|
122
|
-
}
|