Skip to content

Commit 87de5c7

Browse files
Merge branch 'wr/nga' into js/edit-messages
2 parents 50ca6c6 + 98de71c commit 87de5c7

File tree

14 files changed

+158
-132
lines changed

14 files changed

+158
-132
lines changed

.github/workflows/onRelease.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: salesforcecli/github-workflows/.github/workflows/npmPublish.yml@main
2626
needs: [getDistTag]
2727
with:
28-
ctc: true
28+
# ctc: true
2929
sign: true
3030
tag: ${{ needs.getDistTag.outputs.tag || 'latest' }}
3131
githubTag: ${{ github.event.release.tag_name || inputs.tag }}

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ EXAMPLES
112112
$ sf agent activate --api-name Resort_Manager --target-org my-org
113113
```
114114

115-
_See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/activate.ts)_
115+
_See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/activate.ts)_
116116

117117
## `sf agent create`
118118

@@ -174,7 +174,7 @@ EXAMPLES
174174
$ sf agent create --name "Resort Manager" --spec specs/resortManagerAgent.yaml --preview
175175
```
176176

177-
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/create.ts)_
177+
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/create.ts)_
178178

179179
## `sf agent deactivate`
180180

@@ -214,7 +214,7 @@ EXAMPLES
214214
$ sf agent deactivate --api-name Resort_Manager --target-org my-org
215215
```
216216

217-
_See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/deactivate.ts)_
217+
_See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/deactivate.ts)_
218218

219219
## `sf agent generate agent-spec`
220220

@@ -319,7 +319,7 @@ EXAMPLES
319319
$ sf agent generate agent-spec --tone formal --agent-user [email protected]
320320
```
321321

322-
_See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/generate/agent-spec.ts)_
322+
_See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/generate/agent-spec.ts)_
323323

324324
## `sf agent generate authoring-bundle`
325325

@@ -360,7 +360,7 @@ EXAMPLES
360360
path/to/output
361361
```
362362

363-
_See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/generate/authoring-bundle.ts)_
363+
_See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/generate/authoring-bundle.ts)_
364364

365365
## `sf agent generate template`
366366

@@ -408,7 +408,7 @@ EXAMPLES
408408
force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml --agent-version 1
409409
```
410410

411-
_See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/generate/template.ts)_
411+
_See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/generate/template.ts)_
412412

413413
## `sf agent generate test-spec`
414414

@@ -469,7 +469,7 @@ EXAMPLES
469469
force-app//main/default/aiEvaluationDefinitions/Resort_Manager_Tests.aiEvaluationDefinition-meta.xml
470470
```
471471

472-
_See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/generate/test-spec.ts)_
472+
_See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/generate/test-spec.ts)_
473473

474474
## `sf agent preview`
475475

@@ -534,7 +534,7 @@ EXAMPLES
534534
transcripts/my-preview
535535
```
536536

537-
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/preview.ts)_
537+
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/preview.ts)_
538538

539539
## `sf agent publish authoring-bundle`
540540

@@ -545,7 +545,7 @@ USAGE
545545
$ sf agent publish authoring-bundle -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-n <value>]
546546
547547
FLAGS
548-
-n, --api-name=<value> API name of the Agent Authoring Bundle to publish
548+
-n, --api-name=<value> API name of the Agent Authoring Bundle to publish.
549549
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
550550
configuration variable is already set.
551551
--api-version=<value> Override the api version used for api requests made by this command
@@ -557,7 +557,7 @@ GLOBAL FLAGS
557557
DESCRIPTION
558558
Publish an Agent Authoring Bundle as a new agent
559559
560-
Publishes an Agent Authoring Bundle by compiling the AF script and creating a new agent in your org.
560+
Publishes an Agent Authoring Bundle by compiling the .agent file and creating a new agent in your org.
561561
562562
EXAMPLES
563563
Publish an Agent Authoring Bundle:
@@ -566,7 +566,7 @@ EXAMPLES
566566
567567
```
568568

569-
_See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/publish/authoring-bundle.ts)_
569+
_See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/publish/authoring-bundle.ts)_
570570

571571
## `sf agent test create`
572572

@@ -621,7 +621,7 @@ EXAMPLES
621621
$ sf agent test create --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --preview
622622
```
623623

624-
_See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/test/create.ts)_
624+
_See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/test/create.ts)_
625625

626626
## `sf agent test list`
627627

@@ -656,7 +656,7 @@ EXAMPLES
656656
$ sf agent test list --target-org my-org
657657
```
658658

659-
_See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/test/list.ts)_
659+
_See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/test/list.ts)_
660660

661661
## `sf agent test results`
662662

@@ -722,7 +722,7 @@ FLAG DESCRIPTIONS
722722
expression when using custom evaluations.
723723
```
724724

725-
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/test/results.ts)_
725+
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/test/results.ts)_
726726

727727
## `sf agent test resume`
728728

@@ -795,7 +795,7 @@ FLAG DESCRIPTIONS
795795
expression when using custom evaluations.
796796
```
797797

798-
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/test/resume.ts)_
798+
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/test/resume.ts)_
799799

800800
## `sf agent test run`
801801

@@ -869,7 +869,7 @@ FLAG DESCRIPTIONS
869869
expression when using custom evaluations.
870870
```
871871

872-
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/test/run.ts)_
872+
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/test/run.ts)_
873873

874874
## `sf agent validate authoring-bundle`
875875

@@ -880,7 +880,7 @@ USAGE
880880
$ sf agent validate authoring-bundle -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-n <value>]
881881
882882
FLAGS
883-
-n, --api-name=<value> Path to the Agent Authoring Bundle to validate
883+
-n, --api-name=<value> API name of the Agent Authoring Bundle to validate.
884884
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
885885
configuration variable is already set.
886886
--api-version=<value> Override the api version used for api requests made by this command
@@ -892,14 +892,14 @@ GLOBAL FLAGS
892892
DESCRIPTION
893893
Validate an Agent Authoring Bundle
894894
895-
Validates an Agent Authoring Bundle by compiling the AF script and checking for errors.
895+
Validates an Agent Authoring Bundle by compiling the .agent file and checking for errors.
896896
897897
EXAMPLES
898898
Validate an Agent Authoring Bundle:
899899
900900
$ sf agent validate authoring-bundle --api-name path/to/bundle
901901
```
902902

903-
_See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.3/src/commands/agent/validate/authoring-bundle.ts)_
903+
_See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/validate/authoring-bundle.ts)_
904904

905905
<!-- commandsstop -->

messages/agent.publish.authoring-bundle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Failed to publish agent with the following errors:
4343

4444
# error.agentNotFound
4545

46-
Couldn't find an .agent file with API name '%s' in the project.
46+
Could not find a .bundle-meta.xml file with API name '%s' in the project.
4747

4848
# error.agentNotFoundAction
4949

messages/agent.test.run.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ By default, this command outputs test results in human-readable tables for each
1414

1515
API name of the agent test to run; corresponds to the name of the AiEvaluationDefinition metadata component that implements the agent test.
1616

17+
# flags.api-name.prompt
18+
19+
API name of the agent test to run
20+
1721
# flags.wait.summary
1822

1923
Number of minutes to wait for the command to complete and display results to the terminal window.

messages/agent.validate.authoring-bundle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Compilation of the agent file failed with the following errors:
3939

4040
# error.agentNotFound
4141

42-
Couldn't find an ".agent" file with API name '%s' in the project.
42+
Could not find a .bundle-meta.xml file with API name '%s' in the project.
4343

4444
# error.agentNotFoundAction
4545

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "@salesforce/plugin-agent",
33
"description": "Commands to interact with Salesforce agents",
4-
"version": "1.24.14-demo.3",
4+
"version": "1.24.14-demo.8",
55
"author": "Salesforce",
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {
88
"@inquirer/core": "^10.2.2",
99
"@inquirer/prompts": "^7.8.6",
1010
"@oclif/core": "^4",
1111
"@oclif/multi-stage-output": "^0.8.23",
12-
"@salesforce/agents": "^0.17.11",
12+
"@salesforce/agents": "^0.18.1",
1313
"@salesforce/core": "^8.23.1",
1414
"@salesforce/kit": "^3.2.3",
1515
"@salesforce/sf-plugins-core": "^12.2.4",
@@ -25,17 +25,17 @@
2525
},
2626
"devDependencies": {
2727
"@oclif/plugin-command-snapshot": "^5.2.19",
28-
"@oclif/test": "^4.1.0",
28+
"@oclif/test": "^4.1.14",
2929
"@salesforce/cli-plugins-testkit": "^5.3.41",
3030
"@salesforce/dev-scripts": "^11.0.4",
31-
"@salesforce/plugin-command-reference": "^3.1.67",
31+
"@salesforce/plugin-command-reference": "^3.1.72",
3232
"@types/inquirer": "^9.0.9",
3333
"@types/react": "^18.3.3",
3434
"eslint-config-xo": "^0.49.0",
3535
"eslint-config-xo-react": "^0.27.0",
3636
"eslint-plugin-react": "^7.34.3",
3737
"eslint-plugin-react-hooks": "^4.6.2",
38-
"eslint-plugin-sf-plugin": "^1.20.20",
38+
"eslint-plugin-sf-plugin": "^1.20.33",
3939
"esmock": "^2.7.1",
4040
"oclif": "^4.22.14",
4141
"ts-node": "^10.9.2",

src/commands/agent/generate/authoring-bundle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export default class AgentGenerateAuthoringBundle extends SfCommand<AgentGenerat
134134
// Write Agent file
135135
const conn = targetOrg.getConnection(flags['api-version']);
136136
const specContents = YAML.parse(readFileSync(spec, 'utf8')) as AgentJobSpec;
137-
const agent = await Agent.createAfScript(conn, specContents);
137+
const agent = await Agent.createAgent(conn, specContents);
138138
// Create output directory if it doesn't exist
139139
mkdirSync(targetOutputDir, { recursive: true });
140140
writeFileSync(agentPath, agent);

src/commands/agent/publish/authoring-bundle.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { Messages, Lifecycle, SfError } from '@salesforce/core';
2222
import { Agent, findAuthoringBundle } from '@salesforce/agents';
2323
import { RequestStatus, type ScopedPostRetrieve } from '@salesforce/source-deploy-retrieve';
2424
import { ensureArray } from '@salesforce/kit';
25-
import { FlaggablePrompt, promptForFileByExtensions } from '../../../flags.js';
25+
import { FlaggablePrompt, promptForAgentFiles } from '../../../flags.js';
2626

2727
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
2828
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.publish.authoring-bundle');
@@ -70,10 +70,11 @@ export default class AgentPublishAuthoringBundle extends SfCommand<AgentPublishA
7070
// If api-name is not provided, prompt user to select an .agent file from the project and extract the API name from it
7171
const apiName =
7272
flags['api-name'] ??
73-
(await promptForFileByExtensions(AgentPublishAuthoringBundle.FLAGGABLE_PROMPTS['api-name'], ['.agent'], true));
74-
// todo: this eslint warning can be removed once published
75-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
76-
const authoringBundleDir = findAuthoringBundle(this.project!.getPath(), apiName);
73+
(await promptForAgentFiles(this.project!, AgentPublishAuthoringBundle.FLAGGABLE_PROMPTS['api-name']));
74+
const authoringBundleDir = findAuthoringBundle(
75+
this.project!.getPackageDirectories().map((dir) => dir.fullPath),
76+
apiName
77+
);
7778

7879
if (!authoringBundleDir) {
7980
throw new SfError(messages.getMessage('error.agentNotFound', [apiName]), 'AgentNotFoundError', [
@@ -101,8 +102,8 @@ export default class AgentPublishAuthoringBundle extends SfCommand<AgentPublishA
101102
const targetOrg = flags['target-org'];
102103
const conn = targetOrg.getConnection(flags['api-version']);
103104

104-
// First compile the AF script to get the Agent JSON
105-
const agentJson = await Agent.compileAfScript(
105+
// First compile the .agent file to get the Agent JSON
106+
const agentJson = await Agent.compileAgent(
106107
conn,
107108
readFileSync(join(authoringBundleDir, `${apiName}.agent`), 'utf8')
108109
);

src/commands/agent/test/run.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const FLAGGABLE_PROMPTS = {
4040
char: 'n',
4141
required: true,
4242
message: messages.getMessage('flags.api-name.summary'),
43+
promptMessage: messages.getMessage('flags.api-name.prompt'),
4344
validate: (d: string): boolean | string => {
4445
if (d.length === 0) {
4546
return true;

src/commands/agent/validate/authoring-bundle.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { MultiStageOutput } from '@oclif/multi-stage-output';
2121
import { Agent, findAuthoringBundle } from '@salesforce/agents';
2222
import { Duration, sleep } from '@salesforce/kit';
2323
import { colorize } from '@oclif/core/ux';
24-
import { FlaggablePrompt, promptForFileByExtensions } from '../../../flags.js';
24+
import { FlaggablePrompt, promptForAgentFiles } from '../../../flags.js';
2525

2626
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
2727
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.validate.authoring-bundle');
@@ -68,8 +68,11 @@ export default class AgentValidateAuthoringBundle extends SfCommand<AgentValidat
6868
// If api-name is not provided, prompt user to select an .agent file from the project and extract the API name from it
6969
const apiName =
7070
flags['api-name'] ??
71-
(await promptForFileByExtensions(AgentValidateAuthoringBundle.FLAGGABLE_PROMPTS['api-name'], ['.agent'], true));
72-
const authoringBundleDir = findAuthoringBundle(this.project!.getPath(), apiName);
71+
(await promptForAgentFiles(this.project!, AgentValidateAuthoringBundle.FLAGGABLE_PROMPTS['api-name']));
72+
const authoringBundleDir = findAuthoringBundle(
73+
this.project!.getPackageDirectories().map((dir) => dir.fullPath),
74+
apiName
75+
);
7376
if (!authoringBundleDir) {
7477
throw new SfError(messages.getMessage('error.agentNotFound', [apiName]), 'AgentNotFoundError', [
7578
messages.getMessage('error.agentNotFoundAction'),
@@ -100,9 +103,9 @@ export default class AgentValidateAuthoringBundle extends SfCommand<AgentValidat
100103
mso.skipTo('Validating Authoring Bundle');
101104
const targetOrg = flags['target-org'];
102105
const conn = targetOrg.getConnection(flags['api-version']);
103-
// Call Agent.compileAfScript() API
106+
// Call Agent.compileAgent() API
104107
await sleep(Duration.seconds(2));
105-
await Agent.compileAfScript(conn, readFileSync(join(authoringBundleDir, `${apiName}.agent`), 'utf8'));
108+
await Agent.compileAgent(conn, readFileSync(join(authoringBundleDir, `${apiName}.agent`), 'utf8'));
106109
mso.updateData({ status: 'COMPLETED' });
107110
mso.stop('completed');
108111
return {

0 commit comments

Comments
 (0)