@@ -22,7 +22,7 @@ import { Messages, Lifecycle, SfError } from '@salesforce/core';
2222import { Agent , findAuthoringBundle } from '@salesforce/agents' ;
2323import { RequestStatus , type ScopedPostRetrieve } from '@salesforce/source-deploy-retrieve' ;
2424import { ensureArray } from '@salesforce/kit' ;
25- import { FlaggablePrompt , promptForFlag } from '../../../flags.js' ;
25+ import { FlaggablePrompt , promptForFileByExtensions } from '../../../flags.js' ;
2626
2727Messages . importMessagesDirectoryFromMetaUrl ( import . meta. url ) ;
2828const 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