generator-agent 1.0.24 → 1.0.26

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.
@@ -10,13 +10,13 @@ Responsible for building generators that follow strict rules and guidelines base
10
10
 
11
11
  ## What to do
12
12
 
13
- 1. Read all generator type definitions in the Generator_Patterns folder to understand their rules and structures, then use them to create generators based on the OAS file’s schema and dependencies.
13
+ 1. Read all generator type definitions from `node_modules/generator-agent/Generator_Patterns` to understand their rules and structures, then use them to create generators based on the OAS file’s schema and dependencies.
14
14
 
15
15
  2. **Strict Rule (Non-Negotiable):** Add only dependencies, fields, and parameters explicitly mentioned by the user. Do not guess from old generators, past outputs, OAS specs, or optional fields. Do not auto-create additional dependency generators unless explicitly asked.
16
16
 
17
17
  3. For user-requested dependencies, ensure generators extract the required values from API responses so downstream generators can consume them clearly and correctly.
18
18
 
19
- 4. Refer to the `PathConfig.properties` file to find the paths for OAS files and existing generator files. Always use these paths when reading or referencing OAS or generator files.
19
+ 4. Refer to the project-root `PathConfig.properties` file to find the paths for OAS files and existing generator files. Always use these user-provided paths when reading or referencing OAS or generator files.
20
20
 
21
21
  6. You may use tools if necessary to generate the generators correctly.
22
22
 
@@ -43,12 +43,18 @@ Responsible for building generators that follow strict rules and guidelines base
43
43
 
44
44
  10. When params are used in a dynamic generator, the parameter names should be the same as those defined in the OpenAPI specification.
45
45
 
46
- 11. If you use param input from body, query, path or header, please make sure the reference path is correct and the field exists in the OpenAPI specification. For example: "$.input.body:$.ticketId" for request body, "$.input.query:$.status" for query parameter, "$.input.path:$.agentId" for path parameter, "$.input.header:$.Authorization" for header.
46
+ 11. If you use param input from body, query, path, or header, make sure the input path is correct and the field exists in the OpenAPI specification. For example: "$.input.body:$.ticketId" for request body, "$.input.query:$.status" for query parameter, "$.input.path:$.agentId" for path parameter, "$.input.header:$.Authorization" for header.
47
47
 
48
48
  12. If the same API with the same payload is needed more than once, call that API only once, store the entire response object, and extract all required values from that stored response.
49
49
 
50
50
  13. When storing an entire object in a generator, the `dataPath` must use the `:$` format (for example: `$.response.body:$`).
51
51
 
52
+ 14. Do not hardcode business values (for example department names/ids, status values, or entity identifiers) when they can be provided at runtime. Prefer parameterized input references (for example `$.input.query`, `$.input.body`, `$.input.path`, `$.input.header`) and pass them through generator params.
53
+
54
+ 15. When a runtime value is expected directly in `params`, provide it as an explicit placeholder string in this format: `"<provide_param_name>"` (for example: `"searchStr": "<provide_department_name>"`). Do not hardcode concrete business values.
55
+
56
+ 15. The first generator in any generator list must not be of type `reference`. Start with a data-producing generator type (for example `dynamic`, `static`, `remote`, or `conditional`) and use `reference` only after an earlier step has produced source data.
57
+
52
58
  ---
53
59
 
54
60
  ## Generator Structure Rule
package/README.md CHANGED
@@ -20,6 +20,10 @@
20
20
  # Step2 : Run the initialization command to set up the extension:
21
21
  - npx generatoragent init
22
22
 
23
+ This will copy only `.github/agents` and `PathConfig.properties` to your project root.
24
+ `Generator_Patterns` and `Created_Generators` will not be copied.
25
+ Generator pattern files are read directly from `node_modules/generator-agent/Generator_Patterns`.
26
+
23
27
  # Step3: Reload VS Code window to activate the extension.
24
28
  - Reload VS Code window after adding agents
25
29
 
package/bin/cli.js CHANGED
@@ -101,7 +101,7 @@ function main() {
101
101
  log('Usage: agentpublish [command]\n', 'cyan');
102
102
  log('Commands:', 'green');
103
103
  log(' list List all installed agents (default)');
104
- log(' init Copy .github and Generator_Patterns to project root');
104
+ log(' init Copy .github/agents and create PathConfig.properties');
105
105
  log(' --version Show version');
106
106
  log(' --help Show this help message\n');
107
107
  return;
@@ -115,7 +115,7 @@ function main() {
115
115
 
116
116
  if (command === 'init') {
117
117
  runInstall(process.cwd());
118
- log('✅ Copied files to project root.', 'green');
118
+ log('✅ Copied .github/agents and prepared PathConfig.properties.', 'green');
119
119
  return;
120
120
  }
121
121
 
package/bin/install.js CHANGED
@@ -21,8 +21,7 @@ function copyRecursive(src, dest) {
21
21
  function runInstall(targetRoot = process.cwd()) {
22
22
  const pkgRoot = path.resolve(__dirname, '..');
23
23
 
24
- const foldersToCopy = ['.github', 'Generator_Patterns', 'Created_Generators'];
25
- const filesToCopy = ['README.md'];
24
+ const foldersToCopy = ['.github/agents'];
26
25
 
27
26
  console.log(`[GeneratorAgent] Installing to: ${targetRoot}`);
28
27
  console.log(`[GeneratorAgent] Package root: ${pkgRoot}`);
@@ -34,32 +33,17 @@ function runInstall(targetRoot = process.cwd()) {
34
33
  copyRecursive(src, dest);
35
34
  });
36
35
 
37
- filesToCopy.forEach(file => {
38
- const src = path.join(pkgRoot, file);
39
- const dest = path.join(targetRoot, file);
40
- if (fs.existsSync(src)) {
41
- console.log(`[GeneratorAgent] Copying file ${src} to ${dest}`);
42
- fs.copyFileSync(src, dest);
43
- }
44
- });
36
+ const pathConfigSrc = path.join(pkgRoot, 'Generator_Patterns', 'PathConfig.properties');
37
+ const pathConfigDest = path.join(targetRoot, 'PathConfig.properties');
45
38
 
46
- // Delete the entire generator-agent package from node_modules after copying
47
- try {
48
- const nodeModulesPath = path.join(targetRoot, 'node_modules', 'generator-agent');
49
- console.log(`[GeneratorAgent] Attempting to remove: ${nodeModulesPath}`);
50
- if (fs.existsSync(nodeModulesPath)) {
51
- console.log(`[GeneratorAgent] Found generator-agent in node_modules, removing...`);
52
- fs.rmSync(nodeModulesPath, { recursive: true, force: true });
53
- console.log(`[GeneratorAgent] Successfully removed generator-agent from node_modules`);
54
- } else {
55
- console.log(`[GeneratorAgent] generator-agent not found in node_modules`);
56
- }
57
- } catch (err) {
58
- console.log(`[GeneratorAgent] Error removing package: ${err.message}`);
39
+ if (fs.existsSync(pathConfigSrc) && !fs.existsSync(pathConfigDest)) {
40
+ console.log(`[GeneratorAgent] Creating ${pathConfigDest}`);
41
+ fs.copyFileSync(pathConfigSrc, pathConfigDest);
42
+ } else if (fs.existsSync(pathConfigDest)) {
43
+ console.log(`[GeneratorAgent] Keeping existing ${pathConfigDest}`);
59
44
  }
60
45
 
61
- // eslint-disable-next-line no-console
62
- console.log('GeneratorAgent: Copied .github, Generator_Patterns, and Created_Generators to project root. Package removed from node_modules.');
46
+ console.log('GeneratorAgent: Copied .github/agents only. Generator patterns are read from node_modules/generator-agent/Generator_Patterns.');
63
47
  }
64
48
 
65
49
  if (require.main === module) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "generator-agent",
3
3
  "displayName": "GeneratorAgent",
4
4
  "description": "Custom agent that responds with greetings and follows specific instructions",
5
- "version": "1.0.24",
5
+ "version": "1.0.26",
6
6
  "publisher": "Ishwarya",
7
7
  "author": "Ishwarya",
8
8
  "license": "MIT",
@@ -73,4 +73,4 @@
73
73
  "@vscode/test-cli": "^0.0.12",
74
74
  "@vscode/test-electron": "^2.5.2"
75
75
  }
76
- }
76
+ }