Skip to content

Commit e3e2099

Browse files
chore: if api-name flag is not used, prompt user to select an .agent file from the project
1 parent c40b9c4 commit e3e2099

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 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, promptForFlag } from '../../../flags.js';
25+
import { FlaggablePrompt, promptForFileByExtensions } from '../../../flags.js';
2626

2727
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
2828
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.publish.authoring-bundle');
@@ -67,9 +67,10 @@ export default class AgentPublishAuthoringBundle extends SfCommand<AgentPublishA
6767

6868
public async run(): Promise<AgentPublishAuthoringBundleResult> {
6969
const { flags } = await this.parse(AgentPublishAuthoringBundle);
70-
// If we don't have an api name yet, prompt for it
70+
// 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 =
72-
flags['api-name'] ?? (await promptForFlag(AgentPublishAuthoringBundle.FLAGGABLE_PROMPTS['api-name']));
72+
flags['api-name'] ??
73+
(await promptForFileByExtensions(AgentPublishAuthoringBundle.FLAGGABLE_PROMPTS['api-name'], ['.agent'], true));
7374
// todo: this eslint warning can be removed once published
7475
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
7576
const authoringBundleDir = findAuthoringBundle(this.project!.getPath(), apiName);

0 commit comments

Comments
 (0)