Skip to content

Commit 38c7f54

Browse files
chore: rework env var to use dev name
1 parent 1e899f2 commit 38c7f54

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/commands/agent/preview.ts

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

1717
import { resolve, join } from 'node:path';
18-
import * as process from 'node:process';
1918
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
2019
import { AuthInfo, Connection, Messages, SfError } from '@salesforce/core';
2120
import React from 'react';
@@ -113,8 +112,14 @@ export default class AgentPreview extends SfCommand<AgentPreviewResult> {
113112
let selectedAgent;
114113

115114
if (flags['authoring-bundle']) {
115+
const envAgentName = env.getString('SF_DEMO_AGENT');
116+
const agent = agentsQuery.records.find((a) => a.DeveloperName === envAgentName);
116117
selectedAgent = {
117-
Id: process.env.SF_DEMO_AGENT_ID ?? 'SF_DEMO_AGENT_ID is unset',
118+
Id:
119+
agent?.Id ??
120+
`Couldn't find an agent in ${agentsQuery.records.map((a) => a.DeveloperName).join(', ')} matching ${
121+
envAgentName ?? '!SF_DEMO_AGENT is unset!'
122+
}`,
118123
DeveloperName: flags['authoring-bundle'],
119124
};
120125
} else if (apiNameFlag) {

0 commit comments

Comments
 (0)