Skip to content

Commit 3023651

Browse files
Merge pull request #223 from salesforcecli/er/ui-changes-for-agent-generate
W-19801606: UI changes for agent generate
2 parents c1d7995 + a309d08 commit 3023651

File tree

10 files changed

+17
-19
lines changed

10 files changed

+17
-19
lines changed

messages/agent.generate.authoring-bundle.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ Directory where the authoring bundle files will be generated.
1818

1919
Name (label) of the authoring bundle. If not provided, you will be prompted for it.
2020

21+
# flags.name.prompt
22+
23+
Name (label) of the authoring bundle
24+
2125
# examples
2226

2327
- Generate an authoring bundle from a specification file:

messages/agent.publish.authoring-bundle.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ Failed to publish agent with the following errors:
3434

3535
# error.afscriptNotFound
3636

37-
Could not find an .afscript file with API name '%s' in the project.
37+
Could not find an .agent file with API name '%s' in the project.
3838

3939
# error.afscriptNotFoundAction
4040

41-
Please check that the API name is correct and that the .afscript file exists in your project directory.
41+
Please check that the API name is correct and that the .agent file exists in your project directory.

messages/agent.validate.authoring-bundle.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ AF Script compilation failed with the following errors:
3030

3131
# error.afscriptNotFound
3232

33-
Could not find an .afscript file with API name '%s' in the project.
33+
Could not find an .agent file with API name '%s' in the project.
3434

3535
# error.afscriptNotFoundAction
3636

37-
Please check that the API name is correct and that the .afscript file exists in your project directory.
37+
Please check that the API name is correct and that the .agent file exists in your project directory.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export default class AgentGenerateAuthoringBundle extends SfCommand<AgentGenerat
3636
public static readonly description = messages.getMessage('description');
3737
public static readonly examples = messages.getMessages('examples');
3838
public static readonly requiresProject = true;
39-
public static state = 'beta';
4039

4140
public static readonly flags = {
4241
'target-org': Flags.requiredOrg(),
@@ -59,6 +58,7 @@ export default class AgentGenerateAuthoringBundle extends SfCommand<AgentGenerat
5958
private static readonly FLAGGABLE_PROMPTS = {
6059
name: {
6160
message: messages.getMessage('flags.name.summary'),
61+
promptMessage: messages.getMessage('flags.name.prompt'),
6262
validate: (d: string): boolean | string => d.length > 0 || 'Name cannot be empty',
6363
required: true,
6464
},
@@ -84,11 +84,11 @@ export default class AgentGenerateAuthoringBundle extends SfCommand<AgentGenerat
8484
try {
8585
// Get default output directory if not specified
8686
const defaultOutputDir = join(this.project!.getDefaultPackage().fullPath, 'main', 'default');
87-
const targetOutputDir = join(outputDir ?? defaultOutputDir, 'aiAuthoringBundle', name);
87+
const targetOutputDir = join(outputDir ?? defaultOutputDir, 'aiAuthoringBundles', name);
8888

8989
// Generate file paths
90-
const afScriptPath = join(targetOutputDir, `${name}.afscript`);
91-
const metaXmlPath = join(targetOutputDir, `${name}.authoring-bundle-meta.xml`);
90+
const afScriptPath = join(targetOutputDir, `${name}.agent`);
91+
const metaXmlPath = join(targetOutputDir, `${name}.aiAuthoringBundle-meta.xml`);
9292

9393
// Write AFScript file
9494
const conn = targetOrg.getConnection(flags['api-version']);

src/commands/agent/preview.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ export default class AgentPreview extends SfCommand<AgentPreviewResult> {
5858
public static readonly examples = messages.getMessages('examples');
5959
public static readonly enableJsonFlag = false;
6060
public static readonly requiresProject = true;
61-
public static state = 'beta';
6261

6362
public static readonly flags = {
6463
'target-org': Flags.requiredOrg(),

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export default class AgentPublishAuthoringBundle extends SfCommand<AgentPublishA
3737
public static readonly description = messages.getMessage('description');
3838
public static readonly examples = messages.getMessages('examples');
3939
public static readonly requiresProject = true;
40-
public static state = 'beta';
4140

4241
public static readonly flags = {
4342
'target-org': Flags.requiredOrg(),
@@ -84,7 +83,7 @@ export default class AgentPublishAuthoringBundle extends SfCommand<AgentPublishA
8483
// First compile the AF script to get the Agent JSON
8584
const agentJson = await Agent.compileAfScript(
8685
conn,
87-
readFileSync(join(authoringBundleDir, `${flags['api-name']}.afscript`), 'utf8')
86+
readFileSync(join(authoringBundleDir, `${flags['api-name']}.agent`), 'utf8')
8887
);
8988
mso.skipTo('Publish Agent');
9089

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export default class AgentValidateAuthoringBundle extends SfCommand<AgentValidat
3232
public static readonly description = messages.getMessage('description');
3333
public static readonly examples = messages.getMessages('examples');
3434
public static readonly requiresProject = true;
35-
public static state = 'beta';
3635

3736
public static readonly flags = {
3837
'target-org': Flags.requiredOrg(),
@@ -59,10 +58,7 @@ export default class AgentValidateAuthoringBundle extends SfCommand<AgentValidat
5958
const targetOrg = flags['target-org'];
6059
const conn = targetOrg.getConnection(flags['api-version']);
6160
// Call Agent.compileAfScript() API
62-
await Agent.compileAfScript(
63-
conn,
64-
readFileSync(join(authoringBundleDir, `${flags['api-name']}.afscript`), 'utf8')
65-
);
61+
await Agent.compileAfScript(conn, readFileSync(join(authoringBundleDir, `${flags['api-name']}.agent`), 'utf8'));
6662
this.logSuccess('Successfully compiled');
6763
return {
6864
success: true,

test/nuts/agent.generate.authoring-bundle.nut.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe.skip('agent generate authoring-bundle NUTs', () => {
7979
it('should use default output directory when not specified', async () => {
8080
const username = session.orgs.get('default')!.username as string;
8181
const specPath = join(session.project.dir, 'specs', specFileName);
82-
const defaultPath = join('force-app', 'main', 'default', 'aiAuthoringBundle');
82+
const defaultPath = join('force-app', 'main', 'default', 'aiAuthoringBundles');
8383

8484
const command = `agent generate authoring-bundle --spec ${specPath} --name ${bundleName} --target-org ${username} --json`;
8585
const result = execCmd<AgentGenerateAuthoringBundleResult>(command, { ensureExitCode: 0 }).jsonOutput?.result;

test/nuts/agent.publish.nut.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe.skip('agent publish authoring-bundle NUTs', () => {
4242
});
4343

4444
it('should publish a valid authoring bundle', () => {
45-
const bundlePath = join(session.project.dir, 'force-app', 'main', 'default', 'aiAuthoringBundle');
45+
const bundlePath = join(session.project.dir, 'force-app', 'main', 'default', 'aiAuthoringBundles');
4646

4747
const result = execCmd<AgentPublishAuthoringBundleResult>(
4848
`agent publish authoring-bundle --api-name ${bundlePath} --json`,

test/nuts/agent.validate.nut.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe.skip('agent validate authoring-bundle NUTs', () => {
4343

4444
it('should validate a valid authoring bundle', () => {
4545
const username = session.orgs.get('default')!.username as string;
46-
const bundlePath = join(session.project.dir, 'force-app', 'main', 'default', 'aiAuthoringBundle');
46+
const bundlePath = join(session.project.dir, 'force-app', 'main', 'default', 'aiAuthoringBundles');
4747

4848
const result = execCmd<AgentValidateAuthoringBundleResult>(
4949
`agent validate authoring-bundle --api-name ${bundlePath} --target-org ${username} --json`,

0 commit comments

Comments
 (0)