testdriverai 6.1.3 → 6.1.4-canary.a7176c2.0

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/agent/index.js CHANGED
@@ -892,7 +892,10 @@ commands:
892
892
  // it will generate files that contain only "prompts"
893
893
  // @todo revit the generate command
894
894
  async generate(count = 1, prompt = null) {
895
- this.emitter.emit(events.log.debug, `generate called with count: ${count}`);
895
+ this.emitter.emit(
896
+ events.log.debug,
897
+ `generate called with count: ${count}, prompt: ${prompt}`,
898
+ );
896
899
 
897
900
  await this.runLifecycle("prerun");
898
901
 
@@ -172,20 +172,27 @@ class BaseCommand extends Command {
172
172
  return file;
173
173
  }
174
174
 
175
- async setupAgent(file, flags) {
175
+ async setupAgent(firstArg, flags) {
176
176
  // Load .env file into process.env for CLI usage
177
177
  require("dotenv").config();
178
178
 
179
179
  // Create the agent only when actually needed
180
180
  const TestDriverAgent = require("../../../agent/index.js");
181
181
 
182
- // Use --path flag if provided, otherwise use the file argument
183
- const filePath = this.id === "run" && flags.path ? flags.path : file;
182
+ let args;
183
+ if (this.id === "generate") {
184
+ // For generate command, the first parameter is a prompt, not a file
185
+ args = firstArg ? [firstArg] : [];
186
+ } else {
187
+ // For run and other commands, handle file path
188
+ const filePath = this.id === "run" && flags.path ? flags.path : firstArg;
189
+ args = filePath ? [filePath] : [];
190
+ }
184
191
 
185
192
  // Prepare CLI args for the agent with all derived options
186
193
  const cliArgs = {
187
194
  command: this.id,
188
- args: filePath ? [filePath] : [], // Only pass file path if it exists
195
+ args,
189
196
  options: {
190
197
  ...flags,
191
198
  resultFile:
@@ -28,9 +28,18 @@ function createOclifCommand(commandName) {
28
28
  this.agent.readlineInterface = readlineInterface;
29
29
  await readlineInterface.start();
30
30
  } else {
31
- // For run and sandbox commands, use the unified command system
32
- const fileArg = args.file || args.action || null;
33
- await this.setupAgent(fileArg, flags);
31
+ // For run and generate commands, use the unified command system
32
+ let commandArgs;
33
+ if (commandName === "generate") {
34
+ // Generate command: pass prompt as first argument
35
+ await this.setupAgent(args.prompt, flags);
36
+ commandArgs = [args.prompt];
37
+ } else {
38
+ // Run and other commands use file argument
39
+ const fileArg = args.file || args.action || null;
40
+ await this.setupAgent(fileArg, flags);
41
+ commandArgs = [fileArg];
42
+ }
34
43
 
35
44
  if (commandName === "run") {
36
45
  // Set error limit higher for run command
@@ -38,7 +47,11 @@ function createOclifCommand(commandName) {
38
47
  }
39
48
 
40
49
  // Execute through unified command system
41
- await this.agent.executeUnifiedCommand(commandName, [fileArg], flags);
50
+ await this.agent.executeUnifiedCommand(
51
+ commandName,
52
+ commandArgs,
53
+ flags,
54
+ );
42
55
  }
43
56
  } catch (error) {
44
57
  console.error(`Error executing ${commandName} command:`, error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "6.1.3",
3
+ "version": "6.1.4-canary.a7176c2.0",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {