Skip to content

Commit cc19ea4

Browse files
Merge pull request #216 from salesforcecli/wr/ngaAgentPreview
chore: add --authoring-bundle and SF_DEMO_AGENT_ID env var for DF Demo @W-19619766@
2 parents 2050744 + c2a79d6 commit cc19ea4

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

command-snapshot.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,16 @@
8080
"command": "agent:preview",
8181
"flagAliases": [],
8282
"flagChars": ["c", "d", "n", "o", "x"],
83-
"flags": ["apex-debug", "api-name", "api-version", "client-app", "flags-dir", "output-dir", "target-org"],
83+
"flags": [
84+
"apex-debug",
85+
"api-name",
86+
"api-version",
87+
"authoring-bundle",
88+
"client-app",
89+
"flags-dir",
90+
"output-dir",
91+
"target-org"
92+
],
8493
"plugin": "@salesforce/plugin-agent"
8594
},
8695
{

messages/agent.preview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ IMPORTANT: Before you use this command, you must complete a number of configurat
1818

1919
API name of the agent you want to interact with.
2020

21+
# flags.authoring-bundle.summary
22+
23+
Preview an ephemeral afscript agent by specifying the API name of the Authoring Bundle metadata
24+
2125
# flags.client-app.summary
2226

2327
Name of the linked client app to use for the agent connection. You must have previously created this link with "org login web --client-app". Run "org display" to see the available linked client apps.

src/commands/agent/preview.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import { resolve, join } from 'node:path';
18+
import * as process from 'node:process';
1819
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
1920
import { AuthInfo, Connection, Messages, SfError } from '@salesforce/core';
2021
import React from 'react';
@@ -73,6 +74,9 @@ export default class AgentPreview extends SfCommand<AgentPreviewResult> {
7374
summary: messages.getMessage('flags.api-name.summary'),
7475
char: 'n',
7576
}),
77+
'authoring-bundle': Flags.string({
78+
summary: messages.getMessage('flags.authoring-bundle.summary'),
79+
}),
7680
'output-dir': Flags.directory({
7781
summary: messages.getMessage('flags.output-dir.summary'),
7882
char: 'd',
@@ -108,7 +112,12 @@ export default class AgentPreview extends SfCommand<AgentPreviewResult> {
108112

109113
let selectedAgent;
110114

111-
if (apiNameFlag) {
115+
if (flags['authoring-bundle']) {
116+
selectedAgent = {
117+
Id: process.env.SF_DEMO_AGENT_ID ?? 'SF_DEMO_AGENT_ID is unset',
118+
DeveloperName: flags['authoring-bundle'],
119+
};
120+
} else if (apiNameFlag) {
112121
selectedAgent = agentsInOrg.find((agent) => agent.DeveloperName === apiNameFlag);
113122
if (!selectedAgent) throw new Error(`No valid Agents were found with the Api Name ${apiNameFlag}.`);
114123
validateAgent(selectedAgent);

0 commit comments

Comments
 (0)