@salesforce/plugin-agent 1.15.1-dev.3 → 1.15.2

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.
@@ -1,75 +1,45 @@
1
1
  /*
2
- * Copyright (c) 2025, salesforce.com, inc.
2
+ * Copyright (c) 2024, salesforce.com, inc.
3
3
  * All rights reserved.
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
6
  */
7
+ import { join } from 'node:path';
7
8
  import { readFile } from 'node:fs/promises';
8
- import { join, parse } from 'node:path';
9
- import { existsSync } from 'node:fs';
10
- import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
11
- import { Messages, SfError, SfProject } from '@salesforce/core';
12
- import { writeTestSpec, generateTestSpecFromAiEvalDefinition } from '@salesforce/agents';
9
+ import { SfCommand } from '@salesforce/sf-plugins-core';
10
+ import { Messages, SfError } from '@salesforce/core';
11
+ import { generateTestSpec } from '@salesforce/agents';
13
12
  import { select, input, confirm, checkbox } from '@inquirer/prompts';
14
13
  import { XMLParser } from 'fast-xml-parser';
15
- import { ComponentSetBuilder } from '@salesforce/source-deploy-retrieve';
16
- import { warn } from '@oclif/core/errors';
17
14
  import { theme } from '../../../inquirer-theme.js';
18
- import yesNoOrCancel from '../../../yes-no-cancel.js';
15
+ import { readDir } from '../../../read-dir.js';
19
16
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
20
17
  const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.generate.test-spec');
21
18
  function castArray(value) {
22
- if (!value)
23
- return [];
24
19
  return Array.isArray(value) ? value : [value];
25
20
  }
26
- /**
27
- * Prompts the user for test case information through interactive prompts.
28
- *
29
- * @param genAiPlugins - Record mapping topic names to GenAiPlugin XML file paths (used to find the related actions)
30
- * @param genAiFunctions - Array of GenAiFunction names from the GenAiPlanner
31
- * @returns Promise resolving to a TestCase object containing:
32
- * - utterance: The user input string
33
- * - expectedTopic: The expected topic for classification
34
- * - expectedActions: Array of expected action names
35
- * - expectedOutcome: Expected outcome string
36
- *
37
- * @remarks
38
- * This function guides users through creating a test case by:
39
- * 1. Prompting for an utterance
40
- * 2. Selecting an expected topic (from GenAiPlugins specified in the Bot's GenAiPlanner)
41
- * 3. Choosing expected actions (from GenAiFunctions in the GenAiPlanner or GenAiPlugin)
42
- * 4. Defining an expected outcome
43
- */
44
- async function promptForTestCase(genAiPlugins, genAiFunctions) {
21
+ async function promptForTestCase(genAiPlugins) {
45
22
  const utterance = await input({
46
23
  message: 'Utterance',
47
24
  validate: (d) => d.length > 0 || 'utterance cannot be empty',
48
25
  theme,
49
26
  });
50
- const expectedTopic = await select({
51
- message: 'Expected topic',
52
- choices: Object.keys(genAiPlugins),
53
- theme,
54
- });
55
- // GenAiFunctions (aka actions) can be defined in the GenAiPlugin or GenAiPlanner
56
- // the actions from the planner are passed in as an argument to this function
57
- // the actions from the plugin are read from the GenAiPlugin file
58
- let actions = [];
59
- if (genAiPlugins[expectedTopic]) {
60
- const genAiPluginXml = await readFile(genAiPlugins[expectedTopic], 'utf-8');
61
- const parser = new XMLParser();
62
- const parsed = parser.parse(genAiPluginXml);
63
- actions = castArray(parsed.GenAiPlugin.genAiFunctions ?? []).map((f) => f.functionName);
64
- }
65
- const expectedActions = await checkbox({
27
+ const customKey = '<OTHER>';
28
+ const topics = Object.keys(genAiPlugins);
29
+ const askForOtherActions = async () => (await input({
66
30
  message: 'Expected action(s)',
67
- choices: [...actions, ...genAiFunctions],
31
+ validate: (d) => {
32
+ if (!d.length) {
33
+ return 'expected value cannot be empty';
34
+ }
35
+ return true;
36
+ },
68
37
  theme,
69
- required: true,
70
- });
71
- const expectedOutcome = await input({
72
- message: 'Expected outcome',
38
+ }))
39
+ .split(',')
40
+ .map((a) => a.trim());
41
+ const askForBotRating = async () => input({
42
+ message: 'Expected response',
73
43
  validate: (d) => {
74
44
  if (!d.length) {
75
45
  return 'expected value cannot be empty';
@@ -78,155 +48,62 @@ async function promptForTestCase(genAiPlugins, genAiFunctions) {
78
48
  },
79
49
  theme,
80
50
  });
51
+ const expectedTopic = await select({
52
+ message: 'Expected topic',
53
+ choices: [...topics, customKey],
54
+ theme,
55
+ });
56
+ if (expectedTopic === customKey) {
57
+ return {
58
+ utterance,
59
+ expectedTopic: await input({
60
+ message: 'Expected topic',
61
+ validate: (d) => {
62
+ if (!d.length) {
63
+ return 'expected value cannot be empty';
64
+ }
65
+ return true;
66
+ },
67
+ theme,
68
+ }),
69
+ // If the user selects OTHER for the topic, then we don't have a genAiPlugin to get actions from so we ask for them for custom input
70
+ expectedActions: await askForOtherActions(),
71
+ expectedOutcome: await askForBotRating(),
72
+ };
73
+ }
74
+ const genAiPluginXml = await readFile(genAiPlugins[expectedTopic], 'utf-8');
75
+ const parser = new XMLParser();
76
+ const parsed = parser.parse(genAiPluginXml);
77
+ const actions = castArray(parsed.GenAiPlugin.genAiFunctions).map((f) => f.functionName);
78
+ let expectedActions = await checkbox({
79
+ message: 'Expected action(s)',
80
+ choices: [...actions, customKey],
81
+ theme,
82
+ required: true,
83
+ });
84
+ if (expectedActions.includes(customKey)) {
85
+ const additional = await askForOtherActions();
86
+ expectedActions = [...expectedActions.filter((a) => a !== customKey), ...additional];
87
+ }
88
+ const expectedOutcome = await askForBotRating();
81
89
  return {
82
90
  utterance,
83
- expectedTopic,
84
91
  expectedActions,
85
92
  expectedOutcome,
93
+ expectedTopic,
86
94
  };
87
95
  }
88
- function getMetadataFilePaths(cs, type) {
89
- return [...cs.filter((component) => component.type.name === type && component.fullName !== '*')].reduce((acc, component) => ({
90
- ...acc,
91
- [component.fullName]: cs.getComponentFilenamesByNameAndType({
92
- fullName: component.fullName,
93
- type,
94
- })[0],
95
- }), {});
96
- }
97
- /**
98
- * Retrieves GenAIPlugins and GenAiFunctions from a Bot's GenAiPlanner
99
- *
100
- * We have to get the bot version and planner for the selected bot so that we can get
101
- * the actions (GenAiFunctions) and topics (GenAiPlugins) that can be selected for the
102
- * test cases.
103
- *
104
- * The BotVersion tells us which GenAiPlanner to use, and the GenAiPlanner
105
- * tells us which GenAiPlugins and GenAiFunctions are available. More GenAiFunctions
106
- * might be available in the GenAiPlugin, so we read those later when the user
107
- * has selected a GenAiPlugin/topic - inside of `promptForTestCase`.
108
- *
109
- * @param subjectName - The name of the Bot to analyze
110
- * @param cs - ComponentSet containing Bot, GenAiPlanner, and GenAiPlugin components
111
- *
112
- * @returns Object containing:
113
- * - genAiPlugins: Record of plugin names to their file paths
114
- * - genAiFunctions: Array of function names
115
- */
116
- async function getPluginsAndFunctions(subjectName, cs) {
117
- const botVersions = getMetadataFilePaths(cs, 'Bot');
118
- const genAiPlanners = getMetadataFilePaths(cs, 'GenAiPlanner');
119
- const parser = new XMLParser();
120
- const botVersionXml = await readFile(botVersions[subjectName], 'utf-8');
121
- const parsedBotVersion = parser.parse(botVersionXml);
122
- const plannerXml = await readFile(genAiPlanners[parsedBotVersion.BotVersion.conversationDefinitionPlanners.genAiPlannerName ?? subjectName], 'utf-8');
123
- const parsedPlanner = parser.parse(plannerXml);
124
- const genAiFunctions = castArray(parsedPlanner.GenAiPlanner.genAiFunctions).map(({ genAiFunctionName }) => genAiFunctionName);
125
- const genAiPlugins = castArray(parsedPlanner.GenAiPlanner.genAiPlugins).reduce((acc, { genAiPluginName }) => ({
126
- ...acc,
127
- [genAiPluginName]: cs.getComponentFilenamesByNameAndType({
128
- fullName: genAiPluginName,
129
- type: 'GenAiPlugin',
130
- })[0],
131
- }), {});
132
- return { genAiPlugins, genAiFunctions };
133
- }
134
- function ensureYamlExtension(filePath) {
135
- const parsedPath = parse(filePath);
136
- if (parsedPath.ext === '.yaml' || parsedPath.ext === '.yml')
137
- return filePath;
138
- const normalized = `${join(parsedPath.dir, parsedPath.name)}.yaml`;
139
- warn(`Provided file path does not have a .yaml or .yml extension. Normalizing to ${normalized}`);
140
- return normalized;
141
- }
142
- async function promptUntilUniqueFile(subjectName, filePath) {
143
- const outputFile = filePath ??
144
- (await input({
145
- message: 'Enter a path for the test spec file',
146
- validate(d) {
147
- if (!d.length) {
148
- return 'Path cannot be empty';
149
- }
150
- return true;
151
- },
152
- theme,
153
- }));
154
- const normalized = ensureYamlExtension(outputFile);
155
- if (!existsSync(normalized)) {
156
- return normalized;
157
- }
158
- const confirmation = await yesNoOrCancel({
159
- message: `File ${normalized} already exists. Overwrite?`,
160
- default: false,
161
- });
162
- if (confirmation === 'cancel') {
163
- return;
164
- }
165
- if (!confirmation) {
166
- return promptUntilUniqueFile(subjectName);
167
- }
168
- return normalized;
169
- }
170
- /**
171
- * If the user provides the --force-overwrite flag, then we'll use the default file path (either the one provided by --output-file or the default path).
172
- * If the user doesn't provide it, we'll prompt the user for a file path until they provide a unique one or cancel.
173
- */
174
- async function determineFilePath(subjectName, outputFile, forceOverwrite) {
175
- const defaultFile = ensureYamlExtension(outputFile ?? join('specs', `${subjectName}-testSpec.yaml`));
176
- return forceOverwrite ? defaultFile : promptUntilUniqueFile(subjectName, defaultFile);
177
- }
178
96
  export default class AgentGenerateTestSpec extends SfCommand {
179
97
  static summary = messages.getMessage('summary');
180
98
  static description = messages.getMessage('description');
181
99
  static examples = messages.getMessages('examples');
182
100
  static enableJsonFlag = false;
183
101
  static state = 'beta';
184
- static flags = {
185
- 'from-definition': Flags.string({
186
- char: 'd',
187
- summary: messages.getMessage('flags.from-definition.summary'),
188
- }),
189
- 'force-overwrite': Flags.boolean({
190
- summary: messages.getMessage('flags.force-overwrite.summary'),
191
- }),
192
- 'output-file': Flags.file({
193
- char: 'f',
194
- summary: messages.getMessage('flags.output-file.summary'),
195
- parse: async (raw) => Promise.resolve(raw ? ensureYamlExtension(raw) : undefined),
196
- }),
197
- };
198
102
  async run() {
199
- const { flags } = await this.parse(AgentGenerateTestSpec);
200
- const directoryPaths = (await SfProject.resolve().then((project) => project.getPackageDirectories())).map((dir) => dir.fullPath);
201
- const cs = await ComponentSetBuilder.build({
202
- metadata: {
203
- metadataEntries: ['GenAiPlanner', 'GenAiPlugin', 'Bot', 'AiEvaluationDefinition'],
204
- directoryPaths,
205
- },
206
- });
207
- if (flags['from-definition']) {
208
- const aiEvalDefs = getMetadataFilePaths(cs, 'AiEvaluationDefinition');
209
- if (!aiEvalDefs[flags['from-definition']]) {
210
- throw new SfError(`AiEvaluationDefinition ${flags['from-definition']} not found`, 'AiEvalDefinitionNotFoundError');
211
- }
212
- const spec = await generateTestSpecFromAiEvalDefinition(aiEvalDefs[flags['from-definition']]);
213
- const outputFile = await determineFilePath(spec.subjectName, flags['output-file'], flags['force-overwrite']);
214
- if (!outputFile) {
215
- this.log(messages.getMessage('info.cancel'));
216
- return;
217
- }
218
- await writeTestSpec(spec, outputFile);
219
- this.log(`Created ${outputFile}`);
220
- return;
221
- }
222
- const bots = [
223
- ...cs
224
- .filter((component) => component.type.name === 'Bot')
225
- .map((c) => c.fullName)
226
- .filter((n) => n !== '*'),
227
- ];
103
+ const botsDir = join('force-app', 'main', 'default', 'bots');
104
+ const bots = await readDir(botsDir);
228
105
  if (bots.length === 0) {
229
- throw new SfError(`No agents found in ${directoryPaths.join(', ')}`, 'NoAgentsFoundError');
106
+ throw new SfError(`No agents found in ${botsDir}`, 'NoAgentsFoundError');
230
107
  }
231
108
  const subjectType = await select({
232
109
  message: 'What are you testing',
@@ -238,12 +115,6 @@ export default class AgentGenerateTestSpec extends SfCommand {
238
115
  choices: bots,
239
116
  theme,
240
117
  });
241
- const outputFile = await determineFilePath(subjectName, flags['output-file'], flags['force-overwrite']);
242
- if (!outputFile) {
243
- this.log(messages.getMessage('info.cancel'));
244
- return;
245
- }
246
- const { genAiPlugins, genAiFunctions } = await getPluginsAndFunctions(subjectName, cs);
247
118
  const name = await input({
248
119
  message: 'Enter a name for the test definition',
249
120
  validate(d) {
@@ -252,6 +123,12 @@ export default class AgentGenerateTestSpec extends SfCommand {
252
123
  return 'Name cannot be empty';
253
124
  }
254
125
  return true;
126
+ // TODO: add back validation once we refine the regex
127
+ // check against FORTY_CHAR_API_NAME_REGEX
128
+ // if (!FORTY_CHAR_API_NAME_REGEX.test(d)) {
129
+ // return 'The non-namespaced portion an API name must begin with a letter, contain only letters, numbers, and underscores, not contain consecutive underscores, and not end with an underscore.';
130
+ // }
131
+ // return true;
255
132
  },
256
133
  theme,
257
134
  });
@@ -259,26 +136,31 @@ export default class AgentGenerateTestSpec extends SfCommand {
259
136
  message: 'Enter a description for test definition (optional)',
260
137
  theme,
261
138
  });
139
+ const genAiPluginDir = join('force-app', 'main', 'default', 'genAiPlugins');
140
+ const genAiPlugins = Object.fromEntries((await readDir(genAiPluginDir)).map((genAiPlugin) => [
141
+ genAiPlugin.replace('.genAiPlugin-meta.xml', ''),
142
+ join(genAiPluginDir, genAiPlugin),
143
+ ]));
262
144
  const testCases = [];
263
145
  do {
264
146
  this.log();
265
147
  this.styledHeader(`Adding test case #${testCases.length + 1}`);
266
148
  // eslint-disable-next-line no-await-in-loop
267
- testCases.push(await promptForTestCase(genAiPlugins, genAiFunctions));
149
+ testCases.push(await promptForTestCase(genAiPlugins));
268
150
  } while ( // eslint-disable-next-line no-await-in-loop
269
151
  await confirm({
270
152
  message: 'Would you like to add another test case',
271
153
  default: true,
272
154
  }));
273
155
  this.log();
274
- await writeTestSpec({
156
+ await generateTestSpec({
275
157
  name,
276
158
  description,
277
159
  subjectType,
278
160
  subjectName,
279
161
  testCases,
280
- }, outputFile);
281
- this.log(`Created ${outputFile}`);
162
+ }, `${name}-test-spec.yaml`);
163
+ this.log(`Created ${name}-test-spec.yaml`);
282
164
  }
283
165
  }
284
166
  //# sourceMappingURL=test-spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"test-spec.js","sourceRoot":"","sources":["../../../../src/commands/agent/generate/test-spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,UA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,CAAC,CAAC;QAEH,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;QAC5E,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CACrC,CAAC,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YACnD,WAAW,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC;YAChD,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC;SAClC,CAAC,CACH,CAAC;QAEF,MAAM,SAAS,GAAG,EAAE,CAAC;QACrB,GAAG,CAAC;YACF,IAAI,CAAC,GAAG,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,CAAC,qBAAqB,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC;YAC/D,4CAA4C;YAC5C,SAAS,CAAC,IAAI,CAAC,MAAM,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC;QACxD,CAAC,SAAS,4CAA4C;QACpD,MAAM,OAAO,CAAC;YACZ,OAAO,EAAE,yCAAyC;YAClD,OAAO,EAAE,IAAI;SACd,CAAC,EACF;QAEF,IAAI,CAAC,GAAG,EAAE,CAAC;QAEX,MAAM,gBAAgB,CACpB;YACE,IAAI;YACJ,WAAW;YACX,WAAW;YACX,WAAW;YACX,SAAS;SACV,EACD,GAAG,IAAI,iBAAiB,CACzB,CAAC;QACF,IAAI,CAAC,GAAG,CAAC,WAAW,IAAI,iBAAiB,CAAC,CAAC;IAC7C,CAAC"}
@@ -11,12 +11,11 @@ export default class AgentTestCreate extends SfCommand<AgentTestCreateResult> {
11
11
  static readonly examples: string[];
12
12
  static readonly state = "beta";
13
13
  static readonly flags: {
14
+ spec: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
15
  'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
15
16
  'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
17
  preview: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
- 'force-overwrite': import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
- spec: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
- "test-api-name": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ 'no-prompt': import("@oclif/core/interfaces").BooleanFlag<boolean>;
20
19
  };
21
20
  private mso?;
22
21
  run(): Promise<AgentTestCreateResult>;
@@ -1,115 +1,49 @@
1
1
  /*
2
- * Copyright (c) 2025, salesforce.com, inc.
2
+ * Copyright (c) 2024, salesforce.com, inc.
3
3
  * All rights reserved.
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
6
  */
7
- import { join, resolve } from 'node:path';
8
- import { existsSync } from 'node:fs';
7
+ import { join } from 'node:path';
9
8
  import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
10
9
  import { Lifecycle, Messages } from '@salesforce/core';
11
10
  import { AgentTester, AgentTestCreateLifecycleStages } from '@salesforce/agents';
12
11
  import { MultiStageOutput } from '@oclif/multi-stage-output';
13
- import { makeFlags, promptForFlag, promptForYamlFile } from '../../../flags.js';
14
- import yesNoOrCancel from '../../../yes-no-cancel.js';
15
12
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
16
13
  const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.test.create');
17
- const FLAGGABLE_PROMPTS = {
18
- 'test-api-name': {
19
- message: messages.getMessage('flags.test-api-name.summary'),
20
- validate: (d) => {
21
- if (!d.length) {
22
- return 'API name cannot be empty';
23
- }
24
- if (d.length > 80) {
25
- return 'API name cannot be over 80 characters.';
26
- }
27
- const regex = /^[A-Za-z][A-Za-z0-9_]*[A-Za-z0-9]+$/;
28
- if (!regex.test(d)) {
29
- return 'Invalid API name.';
30
- }
31
- return true;
32
- },
33
- required: true,
34
- },
35
- spec: {
36
- message: messages.getMessage('flags.spec.summary'),
37
- validate: (d) => {
38
- const specPath = resolve(d);
39
- if (!existsSync(specPath)) {
40
- return 'Please enter an existing test spec (yaml) file';
41
- }
42
- return true;
43
- },
44
- required: true,
45
- },
46
- };
47
- async function promptUntilUniqueName(agentTester, name) {
48
- const apiName = name ?? (await promptForFlag(FLAGGABLE_PROMPTS['test-api-name']));
49
- const existingDefinitions = await agentTester.list();
50
- if (existingDefinitions.some((d) => d.fullName === apiName)) {
51
- const confirmation = await yesNoOrCancel({
52
- message: messages.getMessage('prompt.confirm', [apiName]),
53
- default: false,
54
- });
55
- if (confirmation === 'cancel') {
56
- return;
57
- }
58
- if (!confirmation) {
59
- return promptUntilUniqueName(agentTester);
60
- }
61
- }
62
- return apiName;
63
- }
64
14
  export default class AgentTestCreate extends SfCommand {
65
15
  static summary = messages.getMessage('summary');
66
16
  static description = messages.getMessage('description');
67
17
  static examples = messages.getMessages('examples');
68
18
  static state = 'beta';
69
19
  static flags = {
70
- ...makeFlags(FLAGGABLE_PROMPTS),
20
+ spec: Flags.file({
21
+ summary: messages.getMessage('flags.spec.summary'),
22
+ description: messages.getMessage('flags.spec.description'),
23
+ char: 's',
24
+ required: true,
25
+ exists: true,
26
+ }),
71
27
  'target-org': Flags.requiredOrg(),
72
28
  'api-version': Flags.orgApiVersion(),
73
29
  preview: Flags.boolean({
74
30
  summary: messages.getMessage('flags.preview.summary'),
75
31
  }),
76
- 'force-overwrite': Flags.boolean({
77
- summary: messages.getMessage('flags.force-overwrite.summary'),
32
+ 'no-prompt': Flags.boolean({
33
+ summary: messages.getMessage('flags.no-prompt.summary'),
34
+ char: 'p',
78
35
  }),
79
36
  };
80
37
  mso;
81
38
  async run() {
82
39
  const { flags } = await this.parse(AgentTestCreate);
83
- // throw error if --json is used and not all required flags are provided
84
- if (this.jsonEnabled()) {
85
- if (!flags['test-api-name']) {
86
- throw messages.createError('error.missingRequiredFlags', ['test-api-name']);
87
- }
88
- if (!flags.spec) {
89
- throw messages.createError('error.missingRequiredFlags', ['spec']);
90
- }
91
- }
92
- if (flags['force-overwrite'] && !flags['test-api-name']) {
93
- throw messages.createError('error.missingRequiredFlags', ['test-api-name']);
94
- }
95
40
  const agentTester = new AgentTester(flags['target-org'].getConnection(flags['api-version']));
96
- const apiName = flags['force-overwrite']
97
- ? flags['test-api-name']
98
- : await promptUntilUniqueName(agentTester, flags['test-api-name']);
99
- if (!apiName) {
100
- this.log(messages.getMessage('info.cancel'));
101
- return {
102
- path: '',
103
- contents: '',
104
- };
105
- }
106
- const spec = flags.spec ?? (await promptForYamlFile(FLAGGABLE_PROMPTS.spec));
107
41
  const lifecycle = Lifecycle.getInstance();
108
42
  lifecycle.on(AgentTestCreateLifecycleStages.CreatingLocalMetadata, async () => {
109
43
  this.mso = new MultiStageOutput({
110
44
  jsonEnabled: this.jsonEnabled(),
111
45
  stages: Object.values(AgentTestCreateLifecycleStages),
112
- title: `Creating test for ${spec}`,
46
+ title: `Creating test for ${flags.spec}`,
113
47
  });
114
48
  this.mso?.skipTo(AgentTestCreateLifecycleStages.CreatingLocalMetadata);
115
49
  return Promise.resolve();
@@ -127,9 +61,16 @@ export default class AgentTestCreate extends SfCommand {
127
61
  }
128
62
  return Promise.resolve();
129
63
  });
130
- const { path, contents } = await agentTester.create(apiName, spec, {
64
+ const confirmationCallback = flags['no-prompt']
65
+ ? async () => Promise.resolve(true)
66
+ : async (spec) => this.confirm({
67
+ message: messages.getMessage('prompt.confirm', [spec.name]),
68
+ defaultAnswer: false,
69
+ });
70
+ const { path, contents } = await agentTester.create(flags.spec, {
131
71
  outputDir: join('force-app', 'main', 'default', 'aiEvaluationDefinitions'),
132
72
  preview: flags.preview,
73
+ confirmationCallback,
133
74
  });
134
75
  if (flags.preview) {
135
76
  this.mso?.skipTo(AgentTestCreateLifecycleStages.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Interf
20
20
  requiredOrDefaulted: false;
21
21
  }>;
22
22
  export declare function makeFlags<T extends Record<string, FlaggablePrompt>>(flaggablePrompts: T): FlagsOfPrompts<T>;
23
- export declare const promptForYamlFile: (flagDef: FlaggablePrompt) => Promise<string>;
24
23
  export declare const promptForFlag: (flagDef: FlaggablePrompt) => Promise<string>;
25
24
  export declare const validateAgentType: (agentType?: string, required?: boolean) => string | undefined;
26
25
  export declare const validateMaxTopics: (maxTopics?: number) => number | undefined;
package/lib/flags.js CHANGED
@@ -4,13 +4,10 @@
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
6
  */
7
- import { readdir } from 'node:fs/promises';
8
- import { join, relative } from 'node:path';
9
7
  import { Flags } from '@salesforce/sf-plugins-core';
10
8
  import { Messages, SfError } from '@salesforce/core';
11
9
  import { camelCaseToTitleCase } from '@salesforce/kit';
12
10
  import { select, input as inquirerInput } from '@inquirer/prompts';
13
- import autocomplete from 'inquirer-autocomplete-standalone';
14
11
  import { theme } from './inquirer-theme.js';
15
12
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
16
13
  const messages = Messages.loadMessages('@salesforce/plugin-agent', 'shared');
@@ -45,34 +42,6 @@ export function makeFlags(flaggablePrompts) {
45
42
  }),
46
43
  ]));
47
44
  }
48
- async function traverseForYamlFiles(dir) {
49
- const files = await readdir(dir, { withFileTypes: true });
50
- const results = [];
51
- for (const file of files) {
52
- const fullPath = join(dir, file.name);
53
- if (file.isDirectory()) {
54
- // eslint-disable-next-line no-await-in-loop
55
- results.push(...(await traverseForYamlFiles(fullPath)));
56
- }
57
- else if (file.name.endsWith('.yaml') || file.name.endsWith('.yml')) {
58
- results.push(fullPath);
59
- }
60
- }
61
- return results;
62
- }
63
- export const promptForYamlFile = async (flagDef) => {
64
- const yamlFiles = await traverseForYamlFiles(process.cwd());
65
- return autocomplete({
66
- message: flagDef.message,
67
- // eslint-disable-next-line @typescript-eslint/require-await
68
- source: async (input) => {
69
- const arr = yamlFiles.map((o) => ({ name: relative(process.cwd(), o), value: o }));
70
- if (!input)
71
- return arr;
72
- return arr.filter((o) => o.name.includes(input));
73
- },
74
- });
75
- };
76
45
  export const promptForFlag = async (flagDef) => {
77
46
  const message = flagDef.promptMessage ?? flagDef.message.replace(/\.$/, '');
78
47
  if (flagDef.options) {