@salesforce/plugin-agent 1.14.3 → 1.14.5-dev.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/README.md +24 -59
- package/lib/commands/agent/generate/test-spec.d.ts +3 -0
- package/lib/commands/agent/generate/test-spec.js +125 -76
- package/lib/commands/agent/generate/test-spec.js.map +1 -1
- package/lib/commands/agent/test/cancel.d.ts +1 -0
- package/lib/commands/agent/test/cancel.js +1 -0
- package/lib/commands/agent/test/cancel.js.map +1 -1
- package/lib/commands/agent/test/create.d.ts +3 -1
- package/lib/commands/agent/test/create.js +55 -16
- package/lib/commands/agent/test/create.js.map +1 -1
- package/lib/handleTestResults.js +2 -21
- package/lib/handleTestResults.js.map +1 -1
- package/messages/agent.generate.test-spec.md +4 -0
- package/messages/agent.test.create.md +13 -7
- package/npm-shrinkwrap.json +10 -10
- package/oclif.lock +12 -37
- package/oclif.manifest.json +21 -7
- package/package.json +4 -4
- package/lib/read-dir.d.ts +0 -1
- package/lib/read-dir.js +0 -16
- package/lib/read-dir.js.map +0 -1
package/README.md
CHANGED
|
@@ -66,7 +66,6 @@ sf plugins
|
|
|
66
66
|
- [`sf agent generate template`](#sf-agent-generate-template)
|
|
67
67
|
- [`sf agent generate test-spec`](#sf-agent-generate-test-spec)
|
|
68
68
|
- [`sf agent preview`](#sf-agent-preview)
|
|
69
|
-
- [`sf agent test cancel`](#sf-agent-test-cancel)
|
|
70
69
|
- [`sf agent test create`](#sf-agent-test-create)
|
|
71
70
|
- [`sf agent test list`](#sf-agent-test-list)
|
|
72
71
|
- [`sf agent test results`](#sf-agent-test-results)
|
|
@@ -133,7 +132,7 @@ EXAMPLES
|
|
|
133
132
|
$ sf agent create --agent-name "Resort Manager" --spec specs/resortManagerAgent.yaml --preview
|
|
134
133
|
```
|
|
135
134
|
|
|
136
|
-
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.
|
|
135
|
+
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.5-dev.0/src/commands/agent/create.ts)_
|
|
137
136
|
|
|
138
137
|
## `sf agent generate agent-spec`
|
|
139
138
|
|
|
@@ -237,7 +236,7 @@ EXAMPLES
|
|
|
237
236
|
$ sf agent generate agent-spec --tone formal --agent-user resortmanager@myorg.com
|
|
238
237
|
```
|
|
239
238
|
|
|
240
|
-
_See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.
|
|
239
|
+
_See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.5-dev.0/src/commands/agent/generate/agent-spec.ts)_
|
|
241
240
|
|
|
242
241
|
## `sf agent generate template`
|
|
243
242
|
|
|
@@ -270,7 +269,7 @@ EXAMPLES
|
|
|
270
269
|
$ sf agent generate template --agent-api-name My_Packaged_Agent
|
|
271
270
|
```
|
|
272
271
|
|
|
273
|
-
_See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.
|
|
272
|
+
_See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.5-dev.0/src/commands/agent/generate/template.ts)_
|
|
274
273
|
|
|
275
274
|
## `sf agent generate test-spec`
|
|
276
275
|
|
|
@@ -278,7 +277,10 @@ Interactively generate a specification file for a AI evaluation test.
|
|
|
278
277
|
|
|
279
278
|
```
|
|
280
279
|
USAGE
|
|
281
|
-
$ sf agent generate test-spec [--flags-dir <value>]
|
|
280
|
+
$ sf agent generate test-spec [--flags-dir <value>] [-d <value>]
|
|
281
|
+
|
|
282
|
+
FLAGS
|
|
283
|
+
-d, --output-dir=<value> [default: specs] The directory to save the generated spec file.
|
|
282
284
|
|
|
283
285
|
GLOBAL FLAGS
|
|
284
286
|
--flags-dir=<value> Import flag values from a directory.
|
|
@@ -293,7 +295,7 @@ EXAMPLES
|
|
|
293
295
|
$ sf agent generate test-spec
|
|
294
296
|
```
|
|
295
297
|
|
|
296
|
-
_See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.
|
|
298
|
+
_See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.5-dev.0/src/commands/agent/generate/test-spec.ts)_
|
|
297
299
|
|
|
298
300
|
## `sf agent preview`
|
|
299
301
|
|
|
@@ -328,80 +330,43 @@ FLAG DESCRIPTIONS
|
|
|
328
330
|
the API name of the agent? (TBD based on agents library)
|
|
329
331
|
```
|
|
330
332
|
|
|
331
|
-
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.
|
|
332
|
-
|
|
333
|
-
## `sf agent test cancel`
|
|
334
|
-
|
|
335
|
-
Cancel an agent test that's currently running in your org.
|
|
336
|
-
|
|
337
|
-
```
|
|
338
|
-
USAGE
|
|
339
|
-
$ sf agent test cancel -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-i <value>] [-r]
|
|
340
|
-
|
|
341
|
-
FLAGS
|
|
342
|
-
-i, --job-id=<value> Job ID of the running agent test that you want to cancel.
|
|
343
|
-
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
344
|
-
configuration variable is already set.
|
|
345
|
-
-r, --use-most-recent Use the job ID of the most recently-run agent test.
|
|
346
|
-
--api-version=<value> Override the api version used for api requests made by this command
|
|
347
|
-
|
|
348
|
-
GLOBAL FLAGS
|
|
349
|
-
--flags-dir=<value> Import flag values from a directory.
|
|
350
|
-
--json Format output as json.
|
|
351
|
-
|
|
352
|
-
DESCRIPTION
|
|
353
|
-
Cancel an agent test that's currently running in your org.
|
|
354
|
-
|
|
355
|
-
This command requires a job ID, which the original "agent test run" command displays when it completes. You can also
|
|
356
|
-
use the --use-most-recent flag to see results for the most recently run agent test.
|
|
357
|
-
|
|
358
|
-
EXAMPLES
|
|
359
|
-
Cancel an agent test currently running in your default org using a job ID:
|
|
360
|
-
|
|
361
|
-
$ sf agent test cancel --job-id 4KBfake0000003F4AQ
|
|
362
|
-
|
|
363
|
-
Cancel the most recently run agent test in the org with alias "my-org":
|
|
364
|
-
|
|
365
|
-
$ sf agent test cancel --job-id 4KBfake0000003F4AQ --target-org my-org
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
_See code: [src/commands/agent/test/cancel.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.3/src/commands/agent/test/cancel.ts)_
|
|
333
|
+
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.5-dev.0/src/commands/agent/preview.ts)_
|
|
369
334
|
|
|
370
335
|
## `sf agent test create`
|
|
371
336
|
|
|
372
|
-
|
|
337
|
+
Convert a test spec file into an AiEvaluationDefinition and deploy it to your org.
|
|
373
338
|
|
|
374
339
|
```
|
|
375
340
|
USAGE
|
|
376
|
-
$ sf agent test create -
|
|
341
|
+
$ sf agent test create -o <value> [--json] [--flags-dir <value>] [--api-name <value>] [--spec <value>] [--api-version
|
|
342
|
+
<value>] [--preview] [-p]
|
|
377
343
|
|
|
378
344
|
FLAGS
|
|
379
345
|
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
380
346
|
configuration variable is already set.
|
|
381
347
|
-p, --no-prompt Don't prompt for confirmation when overwriting an existing test.
|
|
382
|
-
|
|
348
|
+
--api-name=<value> The API name of the AiEvaluationDefinition.
|
|
383
349
|
--api-version=<value> Override the api version used for api requests made by this command
|
|
384
350
|
--preview Preview the test metadata without deploying to your org.
|
|
351
|
+
--spec=<value> The path to the spec file.
|
|
385
352
|
|
|
386
353
|
GLOBAL FLAGS
|
|
387
354
|
--flags-dir=<value> Import flag values from a directory.
|
|
388
355
|
--json Format output as json.
|
|
389
356
|
|
|
390
357
|
DESCRIPTION
|
|
391
|
-
|
|
358
|
+
Convert a test spec file into an AiEvaluationDefinition and deploy it to your org.
|
|
392
359
|
|
|
393
|
-
|
|
360
|
+
This command will convert a test spec file into an AiEvaluationDefinition and deploy it to your org. The spec file
|
|
361
|
+
must be in yaml format.
|
|
362
|
+
|
|
363
|
+
Use the --preview flag to see the metadata that will be deployed without actually deploying it.
|
|
394
364
|
|
|
395
365
|
EXAMPLES
|
|
396
366
|
$ sf agent test create
|
|
397
|
-
|
|
398
|
-
FLAG DESCRIPTIONS
|
|
399
|
-
-s, --spec=<value> Description of a flag.
|
|
400
|
-
|
|
401
|
-
More information about a flag. Don't repeat the summary.
|
|
402
367
|
```
|
|
403
368
|
|
|
404
|
-
_See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.
|
|
369
|
+
_See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.5-dev.0/src/commands/agent/test/create.ts)_
|
|
405
370
|
|
|
406
371
|
## `sf agent test list`
|
|
407
372
|
|
|
@@ -430,7 +395,7 @@ EXAMPLES
|
|
|
430
395
|
$ sf agent test list
|
|
431
396
|
```
|
|
432
397
|
|
|
433
|
-
_See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.
|
|
398
|
+
_See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.5-dev.0/src/commands/agent/test/list.ts)_
|
|
434
399
|
|
|
435
400
|
## `sf agent test results`
|
|
436
401
|
|
|
@@ -486,7 +451,7 @@ FLAG DESCRIPTIONS
|
|
|
486
451
|
test results aren't written.
|
|
487
452
|
```
|
|
488
453
|
|
|
489
|
-
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.
|
|
454
|
+
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.5-dev.0/src/commands/agent/test/results.ts)_
|
|
490
455
|
|
|
491
456
|
## `sf agent test resume`
|
|
492
457
|
|
|
@@ -549,7 +514,7 @@ FLAG DESCRIPTIONS
|
|
|
549
514
|
test results aren't written.
|
|
550
515
|
```
|
|
551
516
|
|
|
552
|
-
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.
|
|
517
|
+
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.5-dev.0/src/commands/agent/test/resume.ts)_
|
|
553
518
|
|
|
554
519
|
## `sf agent test run`
|
|
555
520
|
|
|
@@ -612,6 +577,6 @@ FLAG DESCRIPTIONS
|
|
|
612
577
|
test results aren't written.
|
|
613
578
|
```
|
|
614
579
|
|
|
615
|
-
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.
|
|
580
|
+
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.5-dev.0/src/commands/agent/test/run.ts)_
|
|
616
581
|
|
|
617
582
|
<!-- commandsstop -->
|
|
@@ -5,5 +5,8 @@ export default class AgentGenerateTestSpec extends SfCommand<void> {
|
|
|
5
5
|
static readonly examples: string[];
|
|
6
6
|
static readonly enableJsonFlag = false;
|
|
7
7
|
static readonly state = "beta";
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'output-dir': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
8
11
|
run(): Promise<void>;
|
|
9
12
|
}
|
|
@@ -1,45 +1,71 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2025, 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';
|
|
8
7
|
import { readFile } from 'node:fs/promises';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { join } 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';
|
|
11
12
|
import { generateTestSpec } from '@salesforce/agents';
|
|
12
13
|
import { select, input, confirm, checkbox } from '@inquirer/prompts';
|
|
13
14
|
import { XMLParser } from 'fast-xml-parser';
|
|
15
|
+
import { ComponentSetBuilder } from '@salesforce/source-deploy-retrieve';
|
|
14
16
|
import { theme } from '../../../inquirer-theme.js';
|
|
15
|
-
import { readDir } from '../../../read-dir.js';
|
|
16
17
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
17
18
|
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.generate.test-spec');
|
|
18
19
|
function castArray(value) {
|
|
19
20
|
return Array.isArray(value) ? value : [value];
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Prompts the user for test case information through interactive prompts.
|
|
24
|
+
*
|
|
25
|
+
* @param genAiPlugins - Record mapping topic names to GenAiPlugin XML file paths (used to find the related actions)
|
|
26
|
+
* @param genAiFunctions - Array of GenAiFunction names from the GenAiPlanner
|
|
27
|
+
* @returns Promise resolving to a TestCase object containing:
|
|
28
|
+
* - utterance: The user input string
|
|
29
|
+
* - expectedTopic: The expected topic for classification
|
|
30
|
+
* - expectedActions: Array of expected action names
|
|
31
|
+
* - expectedOutcome: Expected outcome string
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* This function guides users through creating a test case by:
|
|
35
|
+
* 1. Prompting for an utterance
|
|
36
|
+
* 2. Selecting an expected topic (from GenAiPlugins specified in the Bot's GenAiPlanner)
|
|
37
|
+
* 3. Choosing expected actions (from GenAiFunctions in the GenAiPlanner or GenAiPlugin)
|
|
38
|
+
* 4. Defining an expected outcome
|
|
39
|
+
*/
|
|
40
|
+
async function promptForTestCase(genAiPlugins, genAiFunctions) {
|
|
22
41
|
const utterance = await input({
|
|
23
42
|
message: 'Utterance',
|
|
24
43
|
validate: (d) => d.length > 0 || 'utterance cannot be empty',
|
|
25
44
|
theme,
|
|
26
45
|
});
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
46
|
+
const expectedTopic = await select({
|
|
47
|
+
message: 'Expected topic',
|
|
48
|
+
choices: Object.keys(genAiPlugins),
|
|
49
|
+
theme,
|
|
50
|
+
});
|
|
51
|
+
// GenAiFunctions (aka actions) can be defined in the GenAiPlugin or GenAiPlanner
|
|
52
|
+
// the actions from the planner are passed in as an argument to this function
|
|
53
|
+
// the actions from the plugin are read from the GenAiPlugin file
|
|
54
|
+
let actions = [];
|
|
55
|
+
if (genAiPlugins[expectedTopic]) {
|
|
56
|
+
const genAiPluginXml = await readFile(genAiPlugins[expectedTopic], 'utf-8');
|
|
57
|
+
const parser = new XMLParser();
|
|
58
|
+
const parsed = parser.parse(genAiPluginXml);
|
|
59
|
+
actions = castArray(parsed.GenAiPlugin.genAiFunctions ?? []).map((f) => f.functionName);
|
|
60
|
+
}
|
|
61
|
+
const expectedActions = await checkbox({
|
|
30
62
|
message: 'Expected action(s)',
|
|
31
|
-
|
|
32
|
-
if (!d.length) {
|
|
33
|
-
return 'expected value cannot be empty';
|
|
34
|
-
}
|
|
35
|
-
return true;
|
|
36
|
-
},
|
|
63
|
+
choices: [...actions, ...genAiFunctions],
|
|
37
64
|
theme,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
message: 'Expected response',
|
|
65
|
+
required: true,
|
|
66
|
+
});
|
|
67
|
+
const expectedOutcome = await input({
|
|
68
|
+
message: 'Expected outcome',
|
|
43
69
|
validate: (d) => {
|
|
44
70
|
if (!d.length) {
|
|
45
71
|
return 'expected value cannot be empty';
|
|
@@ -48,62 +74,91 @@ async function promptForTestCase(genAiPlugins) {
|
|
|
48
74
|
},
|
|
49
75
|
theme,
|
|
50
76
|
});
|
|
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();
|
|
89
77
|
return {
|
|
90
78
|
utterance,
|
|
79
|
+
expectedTopic,
|
|
91
80
|
expectedActions,
|
|
92
81
|
expectedOutcome,
|
|
93
|
-
expectedTopic,
|
|
94
82
|
};
|
|
95
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves GenAIPlugins and GenAiFunctions from a Bot's GenAiPlanner
|
|
86
|
+
*
|
|
87
|
+
* We have to get the bot version and planner for the selected bot so that we can get
|
|
88
|
+
* the actions (GenAiFunctions) and topics (GenAiPlugins) that can be selected for the
|
|
89
|
+
* test cases.
|
|
90
|
+
*
|
|
91
|
+
* The BotVersion tells us which GenAiPlanner to use, and the GenAiPlanner
|
|
92
|
+
* tells us which GenAiPlugins and GenAiFunctions are available. More GenAiFunctions
|
|
93
|
+
* might be available in the GenAiPlugin, so we read those later when the user
|
|
94
|
+
* has selected a GenAiPlugin/topic - inside of `promptForTestCase`.
|
|
95
|
+
*
|
|
96
|
+
* @param subjectName - The name of the Bot to analyze
|
|
97
|
+
* @param cs - ComponentSet containing Bot, GenAiPlanner, and GenAiPlugin components
|
|
98
|
+
*
|
|
99
|
+
* @returns Object containing:
|
|
100
|
+
* - genAiPlugins: Record of plugin names to their file paths
|
|
101
|
+
* - genAiFunctions: Array of function names
|
|
102
|
+
*/
|
|
103
|
+
async function getPluginsAndFunctions(subjectName, cs) {
|
|
104
|
+
const botVersions = [...cs.filter((component) => component.type.name === 'Bot' && component.fullName !== '*')].reduce((acc, component) => ({
|
|
105
|
+
...acc,
|
|
106
|
+
// this resolves to the BotVersion filepath
|
|
107
|
+
[component.fullName]: cs.getComponentFilenamesByNameAndType({
|
|
108
|
+
fullName: component.fullName,
|
|
109
|
+
type: 'Bot',
|
|
110
|
+
})[0],
|
|
111
|
+
}), {});
|
|
112
|
+
const genAiPlanners = [
|
|
113
|
+
...cs.filter((component) => component.type.name === 'GenAiPlanner' && component.fullName !== '*'),
|
|
114
|
+
].reduce((acc, component) => ({
|
|
115
|
+
...acc,
|
|
116
|
+
[component.fullName]: cs.getComponentFilenamesByNameAndType({
|
|
117
|
+
fullName: component.fullName,
|
|
118
|
+
type: 'GenAiPlanner',
|
|
119
|
+
})[0],
|
|
120
|
+
}), {});
|
|
121
|
+
const parser = new XMLParser();
|
|
122
|
+
const botVersionXml = await readFile(botVersions[subjectName], 'utf-8');
|
|
123
|
+
const parsedBotVersion = parser.parse(botVersionXml);
|
|
124
|
+
const plannerXml = await readFile(genAiPlanners[parsedBotVersion.BotVersion.conversationDefinitionPlanners.genAiPlannerName ?? subjectName], 'utf-8');
|
|
125
|
+
const parsedPlanner = parser.parse(plannerXml);
|
|
126
|
+
const genAiFunctions = castArray(parsedPlanner.GenAiPlanner.genAiFunctions).map(({ genAiFunctionName }) => genAiFunctionName);
|
|
127
|
+
const genAiPlugins = castArray(parsedPlanner.GenAiPlanner.genAiPlugins).reduce((acc, { genAiPluginName }) => ({
|
|
128
|
+
...acc,
|
|
129
|
+
[genAiPluginName]: cs.getComponentFilenamesByNameAndType({
|
|
130
|
+
fullName: genAiPluginName,
|
|
131
|
+
type: 'GenAiPlugin',
|
|
132
|
+
})[0],
|
|
133
|
+
}), {});
|
|
134
|
+
return { genAiPlugins, genAiFunctions };
|
|
135
|
+
}
|
|
96
136
|
export default class AgentGenerateTestSpec extends SfCommand {
|
|
97
137
|
static summary = messages.getMessage('summary');
|
|
98
138
|
static description = messages.getMessage('description');
|
|
99
139
|
static examples = messages.getMessages('examples');
|
|
100
140
|
static enableJsonFlag = false;
|
|
101
141
|
static state = 'beta';
|
|
142
|
+
static flags = {
|
|
143
|
+
'output-dir': Flags.directory({
|
|
144
|
+
char: 'd',
|
|
145
|
+
summary: messages.getMessage('flags.output-dir.summary'),
|
|
146
|
+
default: 'specs',
|
|
147
|
+
}),
|
|
148
|
+
};
|
|
102
149
|
async run() {
|
|
103
|
-
const
|
|
104
|
-
const
|
|
150
|
+
const { flags } = await this.parse(AgentGenerateTestSpec);
|
|
151
|
+
const directoryPaths = (await SfProject.resolve().then((project) => project.getPackageDirectories())).map((dir) => dir.fullPath);
|
|
152
|
+
const cs = await ComponentSetBuilder.build({
|
|
153
|
+
metadata: {
|
|
154
|
+
metadataEntries: ['GenAiPlanner', 'GenAiPlugin', 'Bot'],
|
|
155
|
+
directoryPaths,
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
const botsComponents = cs.filter((component) => component.type.name === 'Bot');
|
|
159
|
+
const bots = [...botsComponents.map((c) => c.fullName).filter((n) => n !== '*')];
|
|
105
160
|
if (bots.length === 0) {
|
|
106
|
-
throw new SfError(`No agents found in ${
|
|
161
|
+
throw new SfError(`No agents found in ${directoryPaths.join(', ')}`, 'NoAgentsFoundError');
|
|
107
162
|
}
|
|
108
163
|
const subjectType = await select({
|
|
109
164
|
message: 'What are you testing',
|
|
@@ -115,6 +170,7 @@ export default class AgentGenerateTestSpec extends SfCommand {
|
|
|
115
170
|
choices: bots,
|
|
116
171
|
theme,
|
|
117
172
|
});
|
|
173
|
+
const { genAiPlugins, genAiFunctions } = await getPluginsAndFunctions(subjectName, cs);
|
|
118
174
|
const name = await input({
|
|
119
175
|
message: 'Enter a name for the test definition',
|
|
120
176
|
validate(d) {
|
|
@@ -123,12 +179,6 @@ export default class AgentGenerateTestSpec extends SfCommand {
|
|
|
123
179
|
return 'Name cannot be empty';
|
|
124
180
|
}
|
|
125
181
|
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;
|
|
132
182
|
},
|
|
133
183
|
theme,
|
|
134
184
|
});
|
|
@@ -136,31 +186,30 @@ export default class AgentGenerateTestSpec extends SfCommand {
|
|
|
136
186
|
message: 'Enter a description for test definition (optional)',
|
|
137
187
|
theme,
|
|
138
188
|
});
|
|
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
|
-
]));
|
|
144
189
|
const testCases = [];
|
|
145
190
|
do {
|
|
146
191
|
this.log();
|
|
147
192
|
this.styledHeader(`Adding test case #${testCases.length + 1}`);
|
|
148
193
|
// eslint-disable-next-line no-await-in-loop
|
|
149
|
-
testCases.push(await promptForTestCase(genAiPlugins));
|
|
194
|
+
testCases.push(await promptForTestCase(genAiPlugins, genAiFunctions));
|
|
150
195
|
} while ( // eslint-disable-next-line no-await-in-loop
|
|
151
196
|
await confirm({
|
|
152
197
|
message: 'Would you like to add another test case',
|
|
153
198
|
default: true,
|
|
154
199
|
}));
|
|
155
200
|
this.log();
|
|
201
|
+
const outputFile = join(flags['output-dir'], `${subjectName}-test-spec.yaml`);
|
|
202
|
+
if (existsSync(outputFile)) {
|
|
203
|
+
await this.confirm({ message: `File ${outputFile} already exists. Overwrite?`, defaultAnswer: false });
|
|
204
|
+
}
|
|
156
205
|
await generateTestSpec({
|
|
157
206
|
name,
|
|
158
207
|
description,
|
|
159
208
|
subjectType,
|
|
160
209
|
subjectName,
|
|
161
210
|
testCases,
|
|
162
|
-
},
|
|
163
|
-
this.log(`Created ${
|
|
211
|
+
}, outputFile);
|
|
212
|
+
this.log(`Created ${outputFile}`);
|
|
164
213
|
}
|
|
165
214
|
}
|
|
166
215
|
//# 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,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,
|
|
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,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;A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gentTestCancelResult> {
|
|
|
10
10
|
static readonly description: string;
|
|
11
11
|
static readonly examples: string[];
|
|
12
12
|
static readonly state = "beta";
|
|
13
|
+
static readonly hidden = true;
|
|
13
14
|
static readonly flags: {
|
|
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>;
|
|
@@ -15,6 +15,7 @@ export default class AgentTestCancel extends SfCommand {
|
|
|
15
15
|
static description = messages.getMessage('description');
|
|
16
16
|
static examples = messages.getMessages('examples');
|
|
17
17
|
static state = 'beta';
|
|
18
|
+
static hidden = true;
|
|
18
19
|
static flags = {
|
|
19
20
|
'target-org': Flags.requiredOrg(),
|
|
20
21
|
'api-version': Flags.orgApiVersion(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../../src/commands/agent/test/cancel.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,mBAAmB,CAAC,CAAC;AASxF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,SAAgC;IACpE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC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AU,EAAE,CAAC,iBAAiB,EAAE,QAAQ,CAAC;SAC1C,CAAC;QACF,iBAAiB,EAAE,KAAK,CAAC,OAAO,CAAC;YAC/B,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,+BAA+B,CAAC;YAC7D,UAAU,EAAE,CAAC,iBAAiB,EAAE,QAAQ,CAAC;SAC1C,CAAC;KACH,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAEpD,MAAM,cAAc,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,CAAC;QACrD,MAAM,EAAE,KAAK,EAAE,GAAG,cAAc,CAAC,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAE9F,IAAI,CAAC,GAAG,CAAC,yCAAyC,KAAK,EAAE,CAAC,CAAC;QAE3D,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QAC7F,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAE/C,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,cAAc,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC;QAED,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK;SACN,CAAC;IACJ,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
2
|
import { SfError } from '@salesforce/core';
|
|
3
3
|
import { CLIError } from '@oclif/core/errors';
|
|
4
|
+
export declare const FORTY_CHAR_API_NAME_REGEX: RegExp;
|
|
4
5
|
export type AgentTestCreateResult = {
|
|
5
6
|
path: string;
|
|
6
7
|
contents: string;
|
|
@@ -11,11 +12,12 @@ export default class AgentTestCreate extends SfCommand<AgentTestCreateResult> {
|
|
|
11
12
|
static readonly examples: string[];
|
|
12
13
|
static readonly state = "beta";
|
|
13
14
|
static readonly flags: {
|
|
14
|
-
spec: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
15
|
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
16
|
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
17
|
preview: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
18
|
'no-prompt': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
spec: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
"api-name": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
21
|
};
|
|
20
22
|
private mso?;
|
|
21
23
|
run(): Promise<AgentTestCreateResult>;
|
|
@@ -4,26 +4,51 @@
|
|
|
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
|
+
import { join, resolve } from 'node:path';
|
|
8
|
+
import { existsSync } from 'node:fs';
|
|
8
9
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
9
|
-
import { Lifecycle, Messages } from '@salesforce/core';
|
|
10
|
+
import { Lifecycle, Messages, SfError } from '@salesforce/core';
|
|
10
11
|
import { AgentTester, AgentTestCreateLifecycleStages } from '@salesforce/agents';
|
|
11
12
|
import { MultiStageOutput } from '@oclif/multi-stage-output';
|
|
13
|
+
import { makeFlags, promptForFlag } from '../../../flags.js';
|
|
14
|
+
export const FORTY_CHAR_API_NAME_REGEX = /^(?=.{1,57}$)[a-zA-Z]([a-zA-Z0-9]|_(?!_)){0,14}(__[a-zA-Z]([a-zA-Z0-9]|_(?!_)){0,39})?$/;
|
|
12
15
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
13
16
|
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.test.create');
|
|
17
|
+
const FLAGGABLE_PROMPTS = {
|
|
18
|
+
'api-name': {
|
|
19
|
+
message: messages.getMessage('flags.api-name.summary'),
|
|
20
|
+
validate: (d) => {
|
|
21
|
+
// ensure that it's not empty
|
|
22
|
+
if (!d.length) {
|
|
23
|
+
return 'Name cannot be empty';
|
|
24
|
+
}
|
|
25
|
+
// check against FORTY_CHAR_API_NAME_REGEX
|
|
26
|
+
if (!FORTY_CHAR_API_NAME_REGEX.test(d)) {
|
|
27
|
+
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.';
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
},
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
spec: {
|
|
34
|
+
message: messages.getMessage('flags.spec.summary'),
|
|
35
|
+
validate: (d) => {
|
|
36
|
+
const specPath = resolve(d);
|
|
37
|
+
if (!existsSync(specPath)) {
|
|
38
|
+
return 'Please enter an existing test spec (yaml) file';
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
},
|
|
42
|
+
required: true,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
14
45
|
export default class AgentTestCreate extends SfCommand {
|
|
15
46
|
static summary = messages.getMessage('summary');
|
|
16
47
|
static description = messages.getMessage('description');
|
|
17
48
|
static examples = messages.getMessages('examples');
|
|
18
49
|
static state = 'beta';
|
|
19
50
|
static flags = {
|
|
20
|
-
|
|
21
|
-
summary: messages.getMessage('flags.spec.summary'),
|
|
22
|
-
description: messages.getMessage('flags.spec.description'),
|
|
23
|
-
char: 's',
|
|
24
|
-
required: true,
|
|
25
|
-
exists: true,
|
|
26
|
-
}),
|
|
51
|
+
...makeFlags(FLAGGABLE_PROMPTS),
|
|
27
52
|
'target-org': Flags.requiredOrg(),
|
|
28
53
|
'api-version': Flags.orgApiVersion(),
|
|
29
54
|
preview: Flags.boolean({
|
|
@@ -37,13 +62,24 @@ export default class AgentTestCreate extends SfCommand {
|
|
|
37
62
|
mso;
|
|
38
63
|
async run() {
|
|
39
64
|
const { flags } = await this.parse(AgentTestCreate);
|
|
65
|
+
// throw error if --json is used and not all required flags are provided
|
|
66
|
+
if (this.jsonEnabled()) {
|
|
67
|
+
if (!flags['api-name']) {
|
|
68
|
+
throw messages.createError('error.missingRequiredFlags', ['api-name']);
|
|
69
|
+
}
|
|
70
|
+
if (!flags.spec) {
|
|
71
|
+
throw messages.createError('error.missingRequiredFlags', ['spec']);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
40
74
|
const agentTester = new AgentTester(flags['target-org'].getConnection(flags['api-version']));
|
|
75
|
+
const apiName = flags['api-name'] ?? (await promptForFlag(FLAGGABLE_PROMPTS['api-name']));
|
|
76
|
+
const spec = flags.spec ?? (await promptForFlag(FLAGGABLE_PROMPTS.spec));
|
|
41
77
|
const lifecycle = Lifecycle.getInstance();
|
|
42
78
|
lifecycle.on(AgentTestCreateLifecycleStages.CreatingLocalMetadata, async () => {
|
|
43
79
|
this.mso = new MultiStageOutput({
|
|
44
80
|
jsonEnabled: this.jsonEnabled(),
|
|
45
81
|
stages: Object.values(AgentTestCreateLifecycleStages),
|
|
46
|
-
title: `Creating test for ${
|
|
82
|
+
title: `Creating test for ${spec}`,
|
|
47
83
|
});
|
|
48
84
|
this.mso?.skipTo(AgentTestCreateLifecycleStages.CreatingLocalMetadata);
|
|
49
85
|
return Promise.resolve();
|
|
@@ -61,16 +97,19 @@ export default class AgentTestCreate extends SfCommand {
|
|
|
61
97
|
}
|
|
62
98
|
return Promise.resolve();
|
|
63
99
|
});
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
message: messages.getMessage('prompt.confirm', [
|
|
100
|
+
const existingDefinitions = await agentTester.list();
|
|
101
|
+
if (existingDefinitions.some((d) => d.fullName === apiName)) {
|
|
102
|
+
const confirmation = await this.confirm({
|
|
103
|
+
message: messages.getMessage('prompt.confirm', [apiName]),
|
|
68
104
|
defaultAnswer: false,
|
|
69
105
|
});
|
|
70
|
-
|
|
106
|
+
if (!confirmation) {
|
|
107
|
+
throw new SfError(`An AiEvaluationDefinition with the name ${apiName} already exists in the org.`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const { path, contents } = await agentTester.create(apiName, spec, {
|
|
71
111
|
outputDir: join('force-app', 'main', 'default', 'aiEvaluationDefinitions'),
|
|
72
112
|
preview: flags.preview,
|
|
73
|
-
confirmationCallback,
|
|
74
113
|
});
|
|
75
114
|
if (flags.preview) {
|
|
76
115
|
this.mso?.skipTo(AgentTestCreateLifecycleStages.Done);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/agent/test/create.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/agent/test/create.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAA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AAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,sBAAsB,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChE,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CACN,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CACjH,CAAC;QACJ,CAAC;QAED,OAAO;YACL,IAAI;YACJ,QAAQ;SACT,CAAC;IACJ,CAAC;IAES,KAAK,CAAC,KAAiC;QAC/C,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC"}
|
package/lib/handleTestResults.js
CHANGED
|
@@ -14,25 +14,6 @@ async function writeFileToDir(outputDir, fileName, content) {
|
|
|
14
14
|
await mkdir(outputDir, { recursive: true });
|
|
15
15
|
await writeFile(join(outputDir, fileName), content);
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Clean a string by replacing HTML entities with their respective characters. Implementation done by copilot.
|
|
19
|
-
*
|
|
20
|
-
* This is only required until W-17594913 is resolved by SF Eval
|
|
21
|
-
*
|
|
22
|
-
* @param str - The string to clean.
|
|
23
|
-
* @returns The cleaned string with all HTML entities replaced with their respective characters.
|
|
24
|
-
*/
|
|
25
|
-
function decodeHtmlEntities(str) {
|
|
26
|
-
const entities = {
|
|
27
|
-
'"': '"',
|
|
28
|
-
''': "'",
|
|
29
|
-
'&': '&',
|
|
30
|
-
'<': '<',
|
|
31
|
-
'>': '>',
|
|
32
|
-
''': "'",
|
|
33
|
-
};
|
|
34
|
-
return str.replace(/&[a-zA-Z0-9#]+;/g, (entity) => entities[entity] || entity);
|
|
35
|
-
}
|
|
36
17
|
function makeSimpleTable(data, title) {
|
|
37
18
|
if (Object.keys(data).length === 0) {
|
|
38
19
|
return '';
|
|
@@ -85,8 +66,8 @@ export function humanFormat(results) {
|
|
|
85
66
|
data: testCase.testResults.map((r) => ({
|
|
86
67
|
test: humanFriendlyName(r.name),
|
|
87
68
|
result: r.result === 'PASS' ? ansis.green('Pass') : ansis.red('Fail'),
|
|
88
|
-
expected:
|
|
89
|
-
actual:
|
|
69
|
+
expected: r.expectedValue,
|
|
70
|
+
actual: r.actualValue,
|
|
90
71
|
})),
|
|
91
72
|
width: '100%',
|
|
92
73
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleTestResults.js","sourceRoot":"","sources":["../src/handleTestResults.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAA4B,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC7G,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,KAAK,UAAU,cAAc,CAAC,SAAiB,EAAE,QAAgB,EAAE,OAAe;IAChF,wCAAwC;IACxC,MAAM,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5C,MAAM,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"handleTestResults.js","sourceRoot":"","sources":["../src/handleTestResults.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAA4B,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,o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,EAAE,CAAC,GAAG,CAAC,uBAAuB,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACzD,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -6,6 +6,10 @@ Interactively generate a specification file for a AI evaluation test.
|
|
|
6
6
|
|
|
7
7
|
This command will prompt you for the necessary information to create a new spec file (in yaml format). You can then create a new AI evaluation using "sf agent test create --spec <spec-file>".
|
|
8
8
|
|
|
9
|
+
# flags.output-dir.summary
|
|
10
|
+
|
|
11
|
+
The directory to save the generated spec file.
|
|
12
|
+
|
|
9
13
|
# examples
|
|
10
14
|
|
|
11
15
|
- <%= config.bin %> <%= command.id %>
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
# summary
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Convert a test spec file into an AiEvaluationDefinition and deploy it to your org.
|
|
4
4
|
|
|
5
5
|
# description
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
This command will convert a test spec file into an AiEvaluationDefinition and deploy it to your org. The spec file must be in yaml format.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Description of a flag.
|
|
9
|
+
Use the --preview flag to see the metadata that will be deployed without actually deploying it.
|
|
12
10
|
|
|
13
|
-
# flags.spec.
|
|
11
|
+
# flags.spec.summary
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
The path to the spec file.
|
|
16
14
|
|
|
17
15
|
# flags.preview.summary
|
|
18
16
|
|
|
@@ -22,6 +20,10 @@ Preview the test metadata without deploying to your org.
|
|
|
22
20
|
|
|
23
21
|
Don't prompt for confirmation when overwriting an existing test.
|
|
24
22
|
|
|
23
|
+
# flags.api-name.summary
|
|
24
|
+
|
|
25
|
+
The API name of the AiEvaluationDefinition.
|
|
26
|
+
|
|
25
27
|
# examples
|
|
26
28
|
|
|
27
29
|
- <%= config.bin %> <%= command.id %>
|
|
@@ -37,3 +39,7 @@ AiEvaluationDefinition created at %s and deployed to %s
|
|
|
37
39
|
# info.preview-success
|
|
38
40
|
|
|
39
41
|
Preview of AiEvaluationDefinition created at %s
|
|
42
|
+
|
|
43
|
+
# error.missingRequiredFlags
|
|
44
|
+
|
|
45
|
+
Missing required flags: %s.
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-agent",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.5-dev.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@salesforce/plugin-agent",
|
|
9
|
-
"version": "1.14.
|
|
9
|
+
"version": "1.14.5-dev.0",
|
|
10
10
|
"license": "BSD-3-Clause",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@inquirer/figures": "^1.0.7",
|
|
13
13
|
"@inquirer/prompts": "^7.2.0",
|
|
14
14
|
"@oclif/core": "^4",
|
|
15
15
|
"@oclif/multi-stage-output": "^0.7.12",
|
|
16
|
-
"@salesforce/agents": "0.9.
|
|
16
|
+
"@salesforce/agents": "0.9.8-dev.0",
|
|
17
17
|
"@salesforce/core": "^8.8.0",
|
|
18
18
|
"@salesforce/kit": "^3.2.1",
|
|
19
19
|
"@salesforce/sf-plugins-core": "^12.1.0",
|
|
@@ -3350,14 +3350,14 @@
|
|
|
3350
3350
|
}
|
|
3351
3351
|
},
|
|
3352
3352
|
"node_modules/@salesforce/agents": {
|
|
3353
|
-
"version": "0.9.
|
|
3354
|
-
"resolved": "https://registry.npmjs.org/@salesforce/agents/-/agents-0.9.
|
|
3355
|
-
"integrity": "sha512-
|
|
3353
|
+
"version": "0.9.8-dev.0",
|
|
3354
|
+
"resolved": "https://registry.npmjs.org/@salesforce/agents/-/agents-0.9.8-dev.0.tgz",
|
|
3355
|
+
"integrity": "sha512-iHJAuzpm/ii1Jp7FopLPOhOGL1e9zCBRl4Cyo23E4xIKWAkFBmbLiTGD3VNzpt47ML2mBGbK+rQqOrXwltGPnQ==",
|
|
3356
3356
|
"license": "BSD-3-Clause",
|
|
3357
3357
|
"dependencies": {
|
|
3358
3358
|
"@salesforce/core": "^8.8.2",
|
|
3359
3359
|
"@salesforce/kit": "^3.2.3",
|
|
3360
|
-
"@salesforce/source-deploy-retrieve": "^12.14.
|
|
3360
|
+
"@salesforce/source-deploy-retrieve": "^12.14.5",
|
|
3361
3361
|
"fast-xml-parser": "^4.5.1",
|
|
3362
3362
|
"nock": "^13.5.6",
|
|
3363
3363
|
"yaml": "^2.7.0"
|
|
@@ -3367,9 +3367,9 @@
|
|
|
3367
3367
|
}
|
|
3368
3368
|
},
|
|
3369
3369
|
"node_modules/@salesforce/agents/node_modules/@salesforce/source-deploy-retrieve": {
|
|
3370
|
-
"version": "12.14.
|
|
3371
|
-
"resolved": "https://registry.npmjs.org/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-12.14.
|
|
3372
|
-
"integrity": "sha512-
|
|
3370
|
+
"version": "12.14.8",
|
|
3371
|
+
"resolved": "https://registry.npmjs.org/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-12.14.8.tgz",
|
|
3372
|
+
"integrity": "sha512-XmTAen0b49YhhFhVuRag/n38uRgqRXpdS/0iqUhEmLEaNXVaH9/jpSNaNRM3VHOfIWxDd2QtEj3JUgAEfy1i3A==",
|
|
3373
3373
|
"license": "BSD-3-Clause",
|
|
3374
3374
|
"dependencies": {
|
|
3375
3375
|
"@salesforce/core": "^8.8.2",
|
package/oclif.lock
CHANGED
|
@@ -1462,14 +1462,14 @@
|
|
|
1462
1462
|
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
|
|
1463
1463
|
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
|
|
1464
1464
|
|
|
1465
|
-
"@salesforce/agents@0.9.
|
|
1466
|
-
version "0.9.
|
|
1467
|
-
resolved "https://registry.yarnpkg.com/@salesforce/agents/-/agents-0.9.
|
|
1468
|
-
integrity sha512-
|
|
1465
|
+
"@salesforce/agents@0.9.8-dev.0":
|
|
1466
|
+
version "0.9.8-dev.0"
|
|
1467
|
+
resolved "https://registry.yarnpkg.com/@salesforce/agents/-/agents-0.9.8-dev.0.tgz#c5b30ab09b1af3998b5a233699741a41b91ca0bc"
|
|
1468
|
+
integrity sha512-iHJAuzpm/ii1Jp7FopLPOhOGL1e9zCBRl4Cyo23E4xIKWAkFBmbLiTGD3VNzpt47ML2mBGbK+rQqOrXwltGPnQ==
|
|
1469
1469
|
dependencies:
|
|
1470
1470
|
"@salesforce/core" "^8.8.2"
|
|
1471
1471
|
"@salesforce/kit" "^3.2.3"
|
|
1472
|
-
"@salesforce/source-deploy-retrieve" "^12.14.
|
|
1472
|
+
"@salesforce/source-deploy-retrieve" "^12.14.5"
|
|
1473
1473
|
fast-xml-parser "^4.5.1"
|
|
1474
1474
|
nock "^13.5.6"
|
|
1475
1475
|
yaml "^2.7.0"
|
|
@@ -1636,10 +1636,10 @@
|
|
|
1636
1636
|
proxy-agent "^6.4.0"
|
|
1637
1637
|
yaml "^2.6.1"
|
|
1638
1638
|
|
|
1639
|
-
"@salesforce/source-deploy-retrieve@^12.14.
|
|
1640
|
-
version "12.14.
|
|
1641
|
-
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-12.14.
|
|
1642
|
-
integrity sha512-
|
|
1639
|
+
"@salesforce/source-deploy-retrieve@^12.14.5":
|
|
1640
|
+
version "12.14.8"
|
|
1641
|
+
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-12.14.8.tgz#df47446a46cd405e2c2fdbd741ef985eeea000be"
|
|
1642
|
+
integrity sha512-XmTAen0b49YhhFhVuRag/n38uRgqRXpdS/0iqUhEmLEaNXVaH9/jpSNaNRM3VHOfIWxDd2QtEj3JUgAEfy1i3A==
|
|
1643
1643
|
dependencies:
|
|
1644
1644
|
"@salesforce/core" "^8.8.2"
|
|
1645
1645
|
"@salesforce/kit" "^3.2.3"
|
|
@@ -7497,16 +7497,7 @@ stack-utils@^2.0.6:
|
|
|
7497
7497
|
dependencies:
|
|
7498
7498
|
escape-string-regexp "^2.0.0"
|
|
7499
7499
|
|
|
7500
|
-
"string-width-cjs@npm:string-width@^4.2.0":
|
|
7501
|
-
version "4.2.3"
|
|
7502
|
-
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
|
7503
|
-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
|
7504
|
-
dependencies:
|
|
7505
|
-
emoji-regex "^8.0.0"
|
|
7506
|
-
is-fullwidth-code-point "^3.0.0"
|
|
7507
|
-
strip-ansi "^6.0.1"
|
|
7508
|
-
|
|
7509
|
-
string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
|
|
7500
|
+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
|
|
7510
7501
|
version "4.2.3"
|
|
7511
7502
|
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
|
7512
7503
|
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
|
@@ -7601,14 +7592,7 @@ string_decoder@~1.1.1:
|
|
|
7601
7592
|
dependencies:
|
|
7602
7593
|
safe-buffer "~5.1.0"
|
|
7603
7594
|
|
|
7604
|
-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
|
|
7605
|
-
version "6.0.1"
|
|
7606
|
-
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
|
7607
|
-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
|
7608
|
-
dependencies:
|
|
7609
|
-
ansi-regex "^5.0.1"
|
|
7610
|
-
|
|
7611
|
-
strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
|
7595
|
+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
|
7612
7596
|
version "6.0.1"
|
|
7613
7597
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
|
7614
7598
|
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
|
@@ -8217,7 +8201,7 @@ workerpool@^6.5.1:
|
|
|
8217
8201
|
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544"
|
|
8218
8202
|
integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==
|
|
8219
8203
|
|
|
8220
|
-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
|
|
8204
|
+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
|
|
8221
8205
|
version "7.0.0"
|
|
8222
8206
|
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
|
|
8223
8207
|
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
|
|
@@ -8235,15 +8219,6 @@ wrap-ansi@^6.2.0:
|
|
|
8235
8219
|
string-width "^4.1.0"
|
|
8236
8220
|
strip-ansi "^6.0.0"
|
|
8237
8221
|
|
|
8238
|
-
wrap-ansi@^7.0.0:
|
|
8239
|
-
version "7.0.0"
|
|
8240
|
-
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
|
|
8241
|
-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
|
|
8242
|
-
dependencies:
|
|
8243
|
-
ansi-styles "^4.0.0"
|
|
8244
|
-
string-width "^4.1.0"
|
|
8245
|
-
strip-ansi "^6.0.0"
|
|
8246
|
-
|
|
8247
8222
|
wrap-ansi@^8.1.0:
|
|
8248
8223
|
version "8.1.0"
|
|
8249
8224
|
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
|
package/oclif.manifest.json
CHANGED
|
@@ -466,6 +466,15 @@
|
|
|
466
466
|
"hasDynamicHelp": false,
|
|
467
467
|
"multiple": false,
|
|
468
468
|
"type": "option"
|
|
469
|
+
},
|
|
470
|
+
"output-dir": {
|
|
471
|
+
"char": "d",
|
|
472
|
+
"name": "output-dir",
|
|
473
|
+
"summary": "The directory to save the generated spec file.",
|
|
474
|
+
"default": "specs",
|
|
475
|
+
"hasDynamicHelp": false,
|
|
476
|
+
"multiple": false,
|
|
477
|
+
"type": "option"
|
|
469
478
|
}
|
|
470
479
|
},
|
|
471
480
|
"hasDynamicHelp": false,
|
|
@@ -554,6 +563,7 @@
|
|
|
554
563
|
}
|
|
555
564
|
},
|
|
556
565
|
"hasDynamicHelp": true,
|
|
566
|
+
"hidden": true,
|
|
557
567
|
"hiddenAliases": [],
|
|
558
568
|
"id": "agent:test:cancel",
|
|
559
569
|
"pluginAlias": "@salesforce/plugin-agent",
|
|
@@ -584,7 +594,7 @@
|
|
|
584
594
|
"agent:test:create": {
|
|
585
595
|
"aliases": [],
|
|
586
596
|
"args": {},
|
|
587
|
-
"description": "
|
|
597
|
+
"description": "This command will convert a test spec file into an AiEvaluationDefinition and deploy it to your org. The spec file must be in yaml format.\n\nUse the --preview flag to see the metadata that will be deployed without actually deploying it.",
|
|
588
598
|
"examples": [
|
|
589
599
|
"<%= config.bin %> <%= command.id %>"
|
|
590
600
|
],
|
|
@@ -604,12 +614,16 @@
|
|
|
604
614
|
"multiple": false,
|
|
605
615
|
"type": "option"
|
|
606
616
|
},
|
|
617
|
+
"api-name": {
|
|
618
|
+
"name": "api-name",
|
|
619
|
+
"summary": "The API name of the AiEvaluationDefinition.",
|
|
620
|
+
"hasDynamicHelp": false,
|
|
621
|
+
"multiple": false,
|
|
622
|
+
"type": "option"
|
|
623
|
+
},
|
|
607
624
|
"spec": {
|
|
608
|
-
"char": "s",
|
|
609
|
-
"description": "More information about a flag. Don't repeat the summary.",
|
|
610
625
|
"name": "spec",
|
|
611
|
-
"
|
|
612
|
-
"summary": "Description of a flag.",
|
|
626
|
+
"summary": "The path to the spec file.",
|
|
613
627
|
"hasDynamicHelp": false,
|
|
614
628
|
"multiple": false,
|
|
615
629
|
"type": "option"
|
|
@@ -653,7 +667,7 @@
|
|
|
653
667
|
"pluginType": "core",
|
|
654
668
|
"state": "beta",
|
|
655
669
|
"strict": true,
|
|
656
|
-
"summary": "
|
|
670
|
+
"summary": "Convert a test spec file into an AiEvaluationDefinition and deploy it to your org.",
|
|
657
671
|
"enableJsonFlag": true,
|
|
658
672
|
"isESM": true,
|
|
659
673
|
"relativePath": [
|
|
@@ -1074,5 +1088,5 @@
|
|
|
1074
1088
|
]
|
|
1075
1089
|
}
|
|
1076
1090
|
},
|
|
1077
|
-
"version": "1.14.
|
|
1091
|
+
"version": "1.14.5-dev.0"
|
|
1078
1092
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-agent",
|
|
3
3
|
"description": "Commands to interact with Salesforce agents",
|
|
4
|
-
"version": "1.14.
|
|
4
|
+
"version": "1.14.5-dev.0",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"@inquirer/prompts": "^7.2.0",
|
|
10
10
|
"@oclif/core": "^4",
|
|
11
11
|
"@oclif/multi-stage-output": "^0.7.12",
|
|
12
|
-
"@salesforce/agents": "0.9.
|
|
12
|
+
"@salesforce/agents": "0.9.8-dev.0",
|
|
13
13
|
"@salesforce/core": "^8.8.0",
|
|
14
14
|
"@salesforce/kit": "^3.2.1",
|
|
15
15
|
"@salesforce/sf-plugins-core": "^12.1.0",
|
|
@@ -226,7 +226,7 @@
|
|
|
226
226
|
"exports": "./lib/index.js",
|
|
227
227
|
"type": "module",
|
|
228
228
|
"sfdx": {
|
|
229
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.14.
|
|
230
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.14.
|
|
229
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.14.5-dev.0.crt",
|
|
230
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.14.5-dev.0.sig"
|
|
231
231
|
}
|
|
232
232
|
}
|
package/lib/read-dir.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function readDir(path: string): Promise<string[]>;
|
package/lib/read-dir.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2024, salesforce.com, inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* Licensed under the BSD 3-Clause license.
|
|
5
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
-
*/
|
|
7
|
-
import { readdir } from 'node:fs/promises';
|
|
8
|
-
export async function readDir(path) {
|
|
9
|
-
try {
|
|
10
|
-
return (await readdir(path)).filter((bot) => !bot.startsWith('.'));
|
|
11
|
-
}
|
|
12
|
-
catch {
|
|
13
|
-
return [];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=read-dir.js.map
|
package/lib/read-dir.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read-dir.js","sourceRoot":"","sources":["../src/read-dir.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAY;IACxC,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|